[WC-3334] Fix DG2 export type bugs#2182
Conversation
b804adb to
05d8784
Compare
05d8784 to
bc6c7a0
Compare
08b3fd2 to
66ebfc8
Compare
AI Code Review
What was reviewed
Skipped (out of scope): Findings🔶 Medium —
|
4e8b769 to
f494395
Compare
AI Code Review
What was reviewed
Skipped (out of scope): Findings
|
f494395 to
5aef9f2
Compare
AI Code Review
What was reviewed
Skipped (out of scope): Findings🔶 Medium — Whitespace-only strings silently export as the number 0File: if (props.exportType === "number" && value.trim() !== "") {
const parsed = Number(value);
if (!Number.isNaN(parsed)) {
return excelNumber(parsed, format);
}
}A companion test: it("falls back to string for whitespace-only value with number exportType", () => {
const col = column("Ws", c => {
c.showContentAs = "customContent";
c.exportValue = listExpression(() => " ");
c.exportType = "number";
});
const cell = readSingleCell(col);
expect(cell.t).toBe("s");
expect(cell.v).toBe(" ");
});
|
631494d to
e9df53e
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI checks could not be fetched (requires approval) — verify green before merging. Findings🔶 Medium — E2E assertion weakened by
|
46321d8 to
bf67c2c
Compare
…number Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…digits Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove "b" from ExcelCell.t union and boolean from ExcelCell.v since excelBoolean now returns string cells. Fix misleading test name for undefined dynamicText case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add overloads to excelDate so t:"d" is only produced when v is a Date, preventing invalid SheetJS cells. Remove dead plain-number branch in attribute reader (Mendix always returns Big for numeric types). Drop no-op getCellFormat call in dynamicText reader (pre-rendered strings have no raw typed value to coerce). Remove redundant `?? undefined` in excelString. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Number(" ") === 0, so the old value !== "" check silently exported
whitespace strings as 0. Use value.trim() !== "" instead.
hasTimeComponent matched "S" in locale tags like [$-en-US], causing
date-only formats to incorrectly retain a time component. Strip
bracket-delimited tokens before testing.
Also documents that Mendix numeric attributes are always Big — the
plain-number branch was not accidentally omitted.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dynamicText Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ngelog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…om string fallback Check exportValue status before reading .value to avoid silent empty-string on loading/unavailable. Drop format arg from fallback excelString — SheetJS ignores z on t:"s" cells so passing it was misleading. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Split sheet_to_json into raw:true and raw:false passes. The raw pass verifies t:"n" cell type (the core bug fix); the formatted pass verifies display values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
73d5735
bf67c2c to
73d5735
Compare
AI Code Review
What was reviewed
Skipped (out of scope): CI checks could not be fetched due to permission constraints — author should confirm all checks are green before merge. Findings🔶 Medium — E2E export test describe block is missing
|
…wait for data readiness
b7255d4
AI Code Review
What was reviewed
Skipped (out of scope): CI checks: Findings
|
Pull request type
Refactoring (e.g. file rename, variable rename, etc.)
Bug fix (non-breaking change which fixes an issue)
Description
Fix multiple data export bugs in DataGrid2's Excel export feature (WC-3334).
Problems
t: "b")Changes
Number()for "number",new Date()for "date", string boolean matching for "boolean", with graceful string fallback on parse failurehasTimeComponent(format)/stripTime(date)helpers — when format has no h/s tokens, date values are normalized to midnight UTCexcelDatenow always producest: "d"cells with a format code; when no explicit format is configured, reads the app's locale date pattern fromwindow.mx.session.getConfig().locale.patterns.dateand converts it to an Excel-compatible formatexcelBooleannow returns{ t: "b", v: boolean }— native Excel boolean cells (TRUE/FALSE)toFixed()to preserve all digitstypings/global.d.tsforwindow.mxtype declarations