- 1.1 Add
@bwip-js/browsertopackages/pluggableWidgets/barcode-generator-web/package.jsondependencies - 1.2 Add
DataMatrixenum value to top-levelcodeFormatinsrc/BarcodeGenerator.xml - 1.3 Add "Advanced Data Matrix Settings" property group in XML:
dmGs1Mode(boolean, default false),dmShape(enum square/rectangle, default square), and sizing property (dmSize/ reuse margin) - 1.4 Build to regenerate
typings/BarcodeGeneratorProps.d.tsand confirmCodeFormatEnumincludesDataMatrix
- 2.1 Add
DataMatrixTypeConfig(type: "datamatrix",gs1Mode,shape,size,margin) to theBarcodeConfigunion insrc/config/Barcode.config.ts - 2.2 In
barcodeConfig(), branchformat === "DataMatrix"before the QR check, returning the new config - 2.3 Extend
src/utils/download-code.tsfilename-prefix logic to handleconfig.type === "datamatrix"
- 3.1 Create
src/components/DataMatrix.tsxwithDataMatrixRenderer({ config }), importing{ datamatrix, drawingSVG }from@bwip-js/browser(tree-shakeable; do NOT usetoSVG()) - 3.2 Build bwip-js options:
bcid=gs1datamatrixwhengs1Modeelsedatamatrix; apply rectangular option whenshape === "rectangle"; settext, size, margin - 3.3 Render SVG and expose a real
SVGSVGElementref soDownloadButton+downloadCode(ref, config, ...)work unchanged - 3.4 Wrap encoding in try/catch → error state; render the existing error-alert markup honoring
logLevel(mirrorBarcodeRenderer) - 3.5 Extend dispatch in
src/BarcodeGenerator.tsx:25to routeconfig.type === "datamatrix"toDataMatrixRenderer
- 4.1 Add
DataMatrixcase tovalidateBarcodeValueinsrc/config/validation.ts(plain: charset/length sanity; GS1: loose balanced-(nn)AI syntax) - 4.2 Wire GS1-mode-aware validation into the DataMatrix renderer before encoding
- 5.1 Add a DataMatrix preview asset/branch alongside
src/hooks/useBarcodePreviewSvg.ts,src/assets/barcodes/*.svg,src/components/preview/*so Studio Pro shows a DataMatrix glyph for the format
- 6.1 Unit tests: config mapping for DataMatrix, GS1 vs plain
bcidselection, shape option, validation (valid GS1 AI, malformed AI, plain string, empty value) - 6.2 Playwright E2E: render + download a DataMatrix per
docs/requirements/e2e-test-guidelines.md(blocked: existing e2e spec is a placeholder; needs the external Mendix testProjects page configured with a DataMatrix widget instance) - 6.3 Add user-facing
CHANGELOG.mdentry ("Added Data Matrix and GS1 Data Matrix generation support")
- 7.1
cd packages/pluggableWidgets/barcode-generator-web && pnpm run testpasses - 7.2
pnpm run buildsucceeds; confirm bundle delta small (bwip-js tree-shaken to DataMatrix encoder only) (blocked: local build env has a broken rollup binary — stale.bin/rollupshim points to uninstalled rollup@3.29.5; unrelated to this change. Code verified viatsc --noEmit+ jest instead.) - 7.3 Live Studio Pro test: plain DataMatrix scans via Barcode Scanner (round-trip); GS1 value
(01)09501101020917(17)261231(10)ABC123renders + decodes; PNG download works; rectangular shape renders (requires human: live Studio Pro session withMX_PROJECT_PATHset)