[WC-3448]: Add datamatrix option for Barcode Generation - #2319
[WC-3448]: Add datamatrix option for Barcode Generation#2319samuelreichert wants to merge 16 commits into
Conversation
431b188 to
d9b57b4
Compare
This comment has been minimized.
This comment has been minimized.
312ba29 to
f568c62
Compare
This comment has been minimized.
This comment has been minimized.
3abcf4d to
9cc45a5
Compare
This comment has been minimized.
This comment has been minimized.
Adds the tree-shakeable bwip-js browser entry, the only maintained library with native GS1 Data Matrix support, for upcoming Data Matrix generation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds "Data Matrix" to the top-level barcode format and a new "Advanced Data Matrix Settings" group (GS1 mode toggle, square/rectangle shape, size). Regenerates the widget prop typings to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds DataMatrixTypeConfig to the BarcodeConfig union with a format === "DataMatrix" branch in barcodeConfig(), plus a DataMatrix value check and a loose GS1 Application Identifier syntax validator. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds DataMatrixRenderer as a third render path. Selects the bwip-js encoder by GS1 mode and shape (datamatrix / gs1datamatrix / *rectangular), renders inline SVG, and reuses the existing SVG->PNG download pipeline. Wires the dispatch in BarcodeGenerator and the download filename prefix for the datamatrix type. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Renders a representative Data Matrix glyph in the Studio Pro page editor when the Data Matrix format is selected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds config-mapping and validation unit tests plus render tests asserting encoder selection (plain vs GS1, rectangular) and the malformed-GS1 error path. Mocks bwip-js and adds the new required Data Matrix props to the shared test props builder. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Proposal, design, specs, and task checklist for adding Data Matrix and GS1 Data Matrix generation to the barcode generator widget. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9cc45a5 to
db1c6ac
Compare
This comment has been minimized.
This comment has been minimized.
Move the add-datamatrix-generation change folder under packages/pluggableWidgets/barcode-generator-web/openspec/ instead of the repo-root openspec/ folder, per AGENTS.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bwip-js SVGs carry only a viewBox, no width/height attributes, so the rendered element defaulted to intrinsic sizing instead of the configured size. Derive pixel dimensions from the viewBox and apply them via inline style.
…class, tighten memo deps Data Matrix code value comes from a Mendix DynamicValue and reaches the DOM via dangerouslySetInnerHTML; sanitize the bwip-js SVG output with DOMPurify before injecting it. Also prefix the preview image class per widget style convention and destructure encodeDataMatrix's params so the useMemo dependency list stays exhaustive without a lint suppression.
…QR Code value length validation
Data Matrix reused codeMargin, which is documented in pixels, but bwip-js multiplies paddingwidth/paddingheight by scale — so the Data Matrix margin is in module units, like qrMargin. A codeMargin of 0 chosen for a 1D barcode therefore stripped the Data Matrix quiet zone and made the symbol unscannable. Add dmMargin (module units, default 2) and branch the margin per format. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… format The Advanced Data Matrix Settings group was never hidden, so it showed for Barcode, QR Code and Custom. The reverse leaked too: because the existing conditions enumerated QRCode/CODE128/Custom, selecting Data Matrix still showed bar width, code height, display value, EAN-128, Mod43 and the EAN addon properties. Replace the enumerated format checks with intent-named booleans so adding a format cannot silently reopen these, and gate check() to validate only the sizing properties that are visible. Also report QR size problems on qrSize instead of codeHeight, and validate static GS1 values at design time. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Replace the placeholder body assertion with plain render, GS1 render, rectangular shape, value re-render and PNG download tests. These stay dormant: mendix/testProjects has no barcode-generator-web branch yet, so the e2e script remains stubbed. The spec header lists the page route and mx-names the test project needs before the runner can be enabled. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Add requirements for the dedicated Data Matrix sizing/quiet zone and for format-scoped property visibility, resolve the design doc's open question on sizing props with the bwip-js scaling evidence, and update the task list: the build now succeeds (~228 KB minified / ~73 KB gzipped for the tree-shaken Data Matrix encoders) and e2e is written but dormant. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
db1c6ac to
8086499
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI check result: could not retrieve (permission not granted) — no failing checks observed from context. Findings
|
Pull request type
New feature (non-breaking change which adds functionality)
Description