|
2 | 2 |
|
3 | 3 | ### Reproduction Tests |
4 | 4 |
|
5 | | -- Attribute number with default export type uses formatter - (unit) |
6 | | - - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "number", config: { groupDigits: true, decimalPrecision: 2 } }` |
| 5 | +- Attribute number with default export type mirrors the grid - (unit) |
| 6 | + - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "number", config: { groupDigits: true } }` (Mendix Decimal attributes only expose `groupDigits` at runtime, not a fixed `decimalPrecision`) |
7 | 7 | - **When**: Export reads the cell |
8 | | - - **Then**: Cell is `{ t: "n", v: 1234.56, z: "#,##0.00" }` |
| 8 | + - **Then**: Cell is `{ t: "n", v: 1234.56, z: "#,##0.########" }` — `#` suppresses trailing zeros so Excel renders exactly what the grid shows (`1234.56` stays `1234.56`, `0.5` stays `0.5`, integers stay integers) |
9 | 9 |
|
10 | 10 | - Attribute date with default export type uses custom pattern - (unit) |
11 | 11 | - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "datetime", config: { type: "custom", pattern: "dd/MM/yyyy" } }` |
|
19 | 19 | - **When**: Export reads the cell |
20 | 20 | - **Then**: Cell has `z: "dd-mm-yyyy"` (locale fallback, not derived from formatter) |
21 | 21 |
|
22 | | -- Attribute number with no decimal precision - (unit) |
23 | | - - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "number", config: { groupDigits: false, decimalPrecision: 0 } }` |
| 22 | +- Attribute number honours explicit decimalPrecision when present - (unit) |
| 23 | + - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "number", config: { groupDigits: false, decimalPrecision: 0 } }` (precision explicitly provided) |
24 | 24 | - **When**: Export reads the cell |
25 | | - - **Then**: Cell has `z: "0"` (no grouping, no decimals) |
| 25 | + - **Then**: Cell has `z: "0"` (no grouping, no decimals) — an explicit `decimalPrecision` takes priority over the grid-mirroring fallback |
| 26 | + |
| 27 | +- Attribute number without grouping mirrors the grid - (unit) |
| 28 | + - **Given**: Attribute column with `exportType = "default"`, attribute has `formatter = { type: "number", config: { groupDigits: false } }` (no `decimalPrecision`) |
| 29 | + - **When**: Export reads the cell |
| 30 | + - **Then**: Cell has `z: "0.########"` (no grouping, up to 8 fractional digits with trailing zeros suppressed) |
26 | 31 |
|
27 | 32 | - Attribute with formatter lacking type field - (unit) |
28 | 33 | - **Given**: Attribute column with `exportType = "default"`, attribute has basic formatter (no `type` property, e.g., default mock) |
|
48 | 53 |
|
49 | 54 | ## Notes |
50 | 55 |
|
| 56 | +- Mendix Decimal attributes do **not** expose a fixed `decimalPrecision` on the formatter config at runtime — only `groupDigits` is present (verified against the live client). The number-default format therefore mirrors the grid using `{base}.########` (8 = the Mendix DB fractional-digit maximum) with `#` suppressing trailing zeros, rather than deriving a fixed precision. The `decimalPrecision` branch is retained for the case where a future runtime does supply it. |
51 | 57 | - The `M → m` conversion is needed because Mendix uses Java-style date patterns (M = month) while Excel uses `m` for month. |
52 | 58 | - `getAttributeDefaultFormat` returns `undefined` for string, boolean, and enum attributes — these fall through to existing logic (displayValue for strings, native boolean cells). |
53 | 59 | - The `editorConfig` change is Studio Pro-only (design time) — no runtime test needed. |
0 commit comments