@extend-ai/react-xlsx 0.20.0 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chart-renderer-AAVZ34BF.cjs → chart-renderer-3QDNTMRN.cjs} +526 -604
- package/dist/chart-renderer-3QDNTMRN.cjs.map +1 -0
- package/dist/{chart-renderer-RXO7WP4Q.js → chart-renderer-7DTEXXG6.js} +19 -97
- package/dist/chart-renderer-7DTEXXG6.js.map +1 -0
- package/dist/{chart-renderer-KGLAI4DN.js → chart-renderer-F355CYSE.js} +13 -92
- package/dist/chart-renderer-F355CYSE.js.map +1 -0
- package/dist/{chart-renderer-NM5UVCTO.cjs → chart-renderer-LGW4EH4M.cjs} +287 -366
- package/dist/chart-renderer-LGW4EH4M.cjs.map +1 -0
- package/dist/{chunk-WSQDFXDW.js → chunk-3LMOGW6A.js} +22 -6
- package/dist/chunk-3LMOGW6A.js.map +1 -0
- package/dist/chunk-A4S3AMON.js +108 -0
- package/dist/chunk-A4S3AMON.js.map +1 -0
- package/dist/{chunk-T5WZHPIN.cjs → chunk-AD4CGQN2.cjs} +2 -2
- package/dist/{chunk-T5WZHPIN.cjs.map → chunk-AD4CGQN2.cjs.map} +1 -1
- package/dist/chunk-AJT23BDP.js +111 -0
- package/dist/chunk-AJT23BDP.js.map +1 -0
- package/dist/{chunk-CJBI5F6V.cjs → chunk-AZWBTFJI.cjs} +12 -93
- package/dist/chunk-AZWBTFJI.cjs.map +1 -0
- package/dist/{chunk-6K3NSKDJ.cjs → chunk-D2UA4P6N.cjs} +15 -4
- package/dist/chunk-D2UA4P6N.cjs.map +1 -0
- package/dist/{chunk-QN3D3JS2.js → chunk-GXYDJPHM.js} +162 -40
- package/dist/chunk-GXYDJPHM.js.map +1 -0
- package/dist/chunk-IDNIGBUM.cjs +108 -0
- package/dist/chunk-IDNIGBUM.cjs.map +1 -0
- package/dist/{chunk-3JTCYAUX.js → chunk-IYGZTLDY.js} +14 -3
- package/dist/chunk-IYGZTLDY.js.map +1 -0
- package/dist/chunk-M55TBS4X.cjs +111 -0
- package/dist/chunk-M55TBS4X.cjs.map +1 -0
- package/dist/{chunk-MCFUTO4J.cjs → chunk-OCF75R75.cjs} +25 -9
- package/dist/chunk-OCF75R75.cjs.map +1 -0
- package/dist/{chunk-NBH72POD.js → chunk-PUI6QI4U.js} +11 -92
- package/dist/chunk-PUI6QI4U.js.map +1 -0
- package/dist/{chunk-2YBG7XQ3.cjs → chunk-ZJ76CZAL.cjs} +1683 -1561
- package/dist/chunk-ZJ76CZAL.cjs.map +1 -0
- package/dist/index.cjs +626 -529
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +124 -27
- package/dist/index.js.map +1 -1
- package/dist/{internal-DrXSHYJZ.d.cts → internal-BJsg5os3.d.cts} +13 -0
- package/dist/{internal-DrXSHYJZ.d.ts → internal-BJsg5os3.d.ts} +13 -0
- package/dist/internal.cjs +6 -5
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +4 -3
- package/dist/preact-LICENSE.txt +21 -0
- package/dist/region-map-geography-24TXETDP.cjs +184 -0
- package/dist/region-map-geography-24TXETDP.cjs.map +1 -0
- package/dist/region-map-geography-OR6DHAF7.js +182 -0
- package/dist/region-map-geography-OR6DHAF7.js.map +1 -0
- package/dist/shared-chart-3STFRVWT.js +215 -0
- package/dist/shared-chart-3STFRVWT.js.map +1 -0
- package/dist/shared-chart-BFQNYOIQ.js +221 -0
- package/dist/shared-chart-BFQNYOIQ.js.map +1 -0
- package/dist/shared-chart-DVC5S2P6.cjs +222 -0
- package/dist/shared-chart-DVC5S2P6.cjs.map +1 -0
- package/dist/shared-chart-MFQSQG4K.cjs +216 -0
- package/dist/shared-chart-MFQSQG4K.cjs.map +1 -0
- package/dist/{spreadsheet-font-assets-4AHYDTAQ.cjs → spreadsheet-font-assets-6FKCVICP.cjs} +2 -2
- package/dist/{spreadsheet-font-assets-4AHYDTAQ.cjs.map → spreadsheet-font-assets-6FKCVICP.cjs.map} +1 -1
- package/dist/{surface-regl-AY7JZVYY.cjs → surface-regl-BBJ6OIKK.cjs} +15 -13
- package/dist/surface-regl-BBJ6OIKK.cjs.map +1 -0
- package/dist/{surface-regl-TJUWTLAZ.js → surface-regl-R2N54JT2.js} +7 -5
- package/dist/{surface-regl-TJUWTLAZ.js.map → surface-regl-R2N54JT2.js.map} +1 -1
- package/dist/{surface-regl-5Z6IVOID.cjs → surface-regl-SUJ2TFZA.cjs} +2 -2
- package/dist/{surface-regl-5Z6IVOID.cjs.map → surface-regl-SUJ2TFZA.cjs.map} +1 -1
- package/dist/us-atlas-LICENSE.txt +13 -0
- package/dist/vanilla.cjs +6 -5
- package/dist/vanilla.cjs.map +1 -1
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +4 -3
- package/dist/world-atlas-LICENSE.txt +13 -0
- package/dist/xlsx-worker.js +82 -1
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +7 -6
- package/dist/chart-renderer-AAVZ34BF.cjs.map +0 -1
- package/dist/chart-renderer-KGLAI4DN.js.map +0 -1
- package/dist/chart-renderer-NM5UVCTO.cjs.map +0 -1
- package/dist/chart-renderer-RXO7WP4Q.js.map +0 -1
- package/dist/chunk-2YBG7XQ3.cjs.map +0 -1
- package/dist/chunk-3JTCYAUX.js.map +0 -1
- package/dist/chunk-6K3NSKDJ.cjs.map +0 -1
- package/dist/chunk-CJBI5F6V.cjs.map +0 -1
- package/dist/chunk-MCFUTO4J.cjs.map +0 -1
- package/dist/chunk-NBH72POD.js.map +0 -1
- package/dist/chunk-QN3D3JS2.js.map +0 -1
- package/dist/chunk-WSQDFXDW.js.map +0 -1
- package/dist/region-map-geography-6TGXBY3V.cjs +0 -184
- package/dist/region-map-geography-6TGXBY3V.cjs.map +0 -1
- package/dist/region-map-geography-YD54DI3H.js +0 -182
- package/dist/region-map-geography-YD54DI3H.js.map +0 -1
- package/dist/surface-regl-AY7JZVYY.cjs.map +0 -1
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chartRenderer,
|
|
3
|
+
officeChartRenderer,
|
|
3
4
|
preloadChartRenderers,
|
|
4
5
|
regionMapResources,
|
|
5
6
|
useChartModule
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3LMOGW6A.js";
|
|
8
|
+
import {
|
|
9
|
+
getBuiltinChartColor,
|
|
10
|
+
getBuiltinChartSurfaceStyle,
|
|
11
|
+
resolveBuiltinChartColor
|
|
12
|
+
} from "./chunk-VWGKYABF.js";
|
|
7
13
|
import {
|
|
8
14
|
$,
|
|
9
15
|
A,
|
|
@@ -15,19 +21,16 @@ import {
|
|
|
15
21
|
_,
|
|
16
22
|
bn,
|
|
17
23
|
d,
|
|
18
|
-
getBuiltinChartColor,
|
|
19
|
-
getBuiltinChartSurfaceStyle,
|
|
20
24
|
h,
|
|
21
25
|
k2 as k,
|
|
22
26
|
nn,
|
|
23
27
|
pn,
|
|
24
28
|
q,
|
|
25
|
-
resolveBuiltinChartColor,
|
|
26
29
|
u,
|
|
27
30
|
w,
|
|
28
31
|
x,
|
|
29
32
|
y
|
|
30
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-PUI6QI4U.js";
|
|
31
34
|
|
|
32
35
|
// src/range-reference.ts
|
|
33
36
|
var XLSX_MAX_ROWS = 1048576;
|
|
@@ -212,6 +215,85 @@ function getSheetsWasmModule() {
|
|
|
212
215
|
return wasmModulePromise;
|
|
213
216
|
}
|
|
214
217
|
|
|
218
|
+
// src/number-locale.ts
|
|
219
|
+
var separators = /* @__PURE__ */ new Map();
|
|
220
|
+
function parseLocaleNumber(text, locale) {
|
|
221
|
+
if (locale === "en-US") return void 0;
|
|
222
|
+
const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);
|
|
223
|
+
const decimal = parts.find((part) => part.type === "decimal")?.value ?? ".";
|
|
224
|
+
const group = parts.find((part) => part.type === "group")?.value ?? ",";
|
|
225
|
+
let normalized = text.trim();
|
|
226
|
+
const percent = normalized.endsWith("%");
|
|
227
|
+
if (percent) normalized = normalized.slice(0, -1).trim();
|
|
228
|
+
normalized = group.trim() === "" ? normalized.replace(/[ \u00a0\u202f]/g, "") : normalized.split(group).join("");
|
|
229
|
+
normalized = normalized.replace(decimal, ".");
|
|
230
|
+
if (!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(normalized)) return void 0;
|
|
231
|
+
const value = Number(normalized) / (percent ? 100 : 1);
|
|
232
|
+
return Number.isFinite(value) ? value : void 0;
|
|
233
|
+
}
|
|
234
|
+
function localizeCellNumber(worksheet, row, col, text, locale = "en-US") {
|
|
235
|
+
if (locale === "en-US" || !text) return text;
|
|
236
|
+
const value = worksheet.getCalculatedValueAt(row, col);
|
|
237
|
+
try {
|
|
238
|
+
if (!value.is_number) return text;
|
|
239
|
+
} finally {
|
|
240
|
+
value.free();
|
|
241
|
+
}
|
|
242
|
+
const style = worksheet.getCellStyleAt(row, col);
|
|
243
|
+
const format = style?.numberFormat;
|
|
244
|
+
if (format?.isDateFormat) return text;
|
|
245
|
+
let symbols = separators.get(locale);
|
|
246
|
+
if (!symbols) {
|
|
247
|
+
const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);
|
|
248
|
+
symbols = {
|
|
249
|
+
decimal: parts.find((part) => part.type === "decimal")?.value ?? ".",
|
|
250
|
+
group: parts.find((part) => part.type === "group")?.value ?? ","
|
|
251
|
+
};
|
|
252
|
+
if (separators.size >= 100) separators.clear();
|
|
253
|
+
separators.set(locale, symbols);
|
|
254
|
+
}
|
|
255
|
+
if (symbols.decimal === "." && symbols.group === ",") return text;
|
|
256
|
+
const protectedPositions = /* @__PURE__ */ new Set();
|
|
257
|
+
const code = format?.formatString ?? "";
|
|
258
|
+
const literalPattern = /"[^"]*"|\\.|\[[^\]]*\]/g;
|
|
259
|
+
const firstPlaceholder = code.replace(literalPattern, (token) => " ".repeat(token.length)).search(/[0#?]/);
|
|
260
|
+
const literals = [...code.matchAll(literalPattern)];
|
|
261
|
+
let suffixEnd = text.length;
|
|
262
|
+
let prefixStart = 0;
|
|
263
|
+
const protect = (token, suffix) => {
|
|
264
|
+
const literal = token.startsWith('"') ? token.slice(1, -1) : token.startsWith("\\") ? token.slice(1) : token.startsWith("[$") ? token.slice(2, -1).split("-")[0] : "";
|
|
265
|
+
if (!literal) return;
|
|
266
|
+
const offset = suffix ? text.lastIndexOf(literal, suffixEnd - literal.length) : text.indexOf(literal, prefixStart);
|
|
267
|
+
if (offset >= 0) {
|
|
268
|
+
for (let i = offset; i < offset + literal.length; i++) protectedPositions.add(i);
|
|
269
|
+
if (suffix) suffixEnd = offset;
|
|
270
|
+
else prefixStart = offset + literal.length;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
for (const token of literals.filter((token2) => token2.index < firstPlaceholder)) protect(token[0], false);
|
|
274
|
+
for (const token of literals.filter((token2) => token2.index >= firstPlaceholder).reverse()) protect(token[0], true);
|
|
275
|
+
return text.replace(
|
|
276
|
+
/\d[\d,]*(?:\.\d*)?|\.\d+/g,
|
|
277
|
+
(number, offset) => number.replace(/[.,]/g, (separator, index) => protectedPositions.has(offset + index) ? separator : separator === "." ? symbols.decimal : symbols.group)
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
function localizeRows(worksheet, rows, locale = "en-US") {
|
|
281
|
+
if (locale === "en-US" || !Array.isArray(rows)) return;
|
|
282
|
+
for (const row of rows) {
|
|
283
|
+
for (const cell of row.cells ?? []) {
|
|
284
|
+
if (!cell.isMergedSecondary && typeof cell.value === "string") {
|
|
285
|
+
const value = worksheet.getCalculatedValueAt(row.index, cell.col);
|
|
286
|
+
try {
|
|
287
|
+
cell.numericValue = value.is_number ? value.asNumber() : null;
|
|
288
|
+
} finally {
|
|
289
|
+
value.free();
|
|
290
|
+
}
|
|
291
|
+
cell.value = localizeCellNumber(worksheet, row.index, cell.col, cell.value, locale);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
215
297
|
// src/spreadsheet-fonts.ts
|
|
216
298
|
var fontLoadPromise;
|
|
217
299
|
var SPREADSHEET_FALLBACK_FONT = "React XLSX Carlito";
|
|
@@ -1770,6 +1852,21 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1770
1852
|
chart.axes = [...chart.axes, seriesAxis];
|
|
1771
1853
|
}
|
|
1772
1854
|
}
|
|
1855
|
+
const kind = chartTypeNode.localName === "lineChart" && chart.chartType === "Line" ? "line" : chartTypeNode.localName === "barChart" && chart.chartType === "ColumnClustered" ? "bar" : null;
|
|
1856
|
+
const groupCount = Array.from(plotArea.children).filter((entry) => entry.localName.endsWith("Chart")).length;
|
|
1857
|
+
if (kind && groupCount === 1 && !chart.is3d && !plotArea.querySelector("trendline, errBars, dropLines, hiLowLines, upDownBars, dateAx, multiLvlStrRef, pictureOptions") && getLocalChildren(chartTypeNode, "ser").length === chart.series.length) {
|
|
1858
|
+
chart.renderSource = {
|
|
1859
|
+
kind,
|
|
1860
|
+
xml: chartXml,
|
|
1861
|
+
themeColors: themePalette ? Object.fromEntries(Object.entries(THEME_COLOR_INDEX_BY_NAME).flatMap(([key, index]) => {
|
|
1862
|
+
const color = themePalette.colorsByIndex[index];
|
|
1863
|
+
return color ? [[key, color]] : [];
|
|
1864
|
+
})) : void 0,
|
|
1865
|
+
themeOverrideXml: readArchiveText(archive, relationships.get("http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride")) ?? void 0,
|
|
1866
|
+
styleXml: readArchiveText(archive, relationships.get(CHART_STYLE_REL_TYPE)) ?? void 0,
|
|
1867
|
+
colorStyleXml: readArchiveText(archive, relationships.get(CHART_COLOR_STYLE_REL_TYPE)) ?? void 0
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1773
1870
|
applyChartSeriesStyleFromXml(chart, chartTypeNode, themePalette);
|
|
1774
1871
|
applyFallbackSeriesStyles();
|
|
1775
1872
|
applyBuiltinChartDefaults(chart, themePalette);
|
|
@@ -6954,10 +7051,10 @@ var XlsxWorkerClient = class {
|
|
|
6954
7051
|
type: "load"
|
|
6955
7052
|
}, [workerBuffer]);
|
|
6956
7053
|
}
|
|
6957
|
-
getCellSnapshot(workbookSheetIndex, row, col) {
|
|
7054
|
+
getCellSnapshot(workbookSheetIndex, row, col, locale) {
|
|
6958
7055
|
return this.request({
|
|
6959
7056
|
id: 0,
|
|
6960
|
-
payload: { col, row, workbookSheetIndex },
|
|
7057
|
+
payload: { col, row, workbookSheetIndex, locale },
|
|
6961
7058
|
type: "getCellSnapshot"
|
|
6962
7059
|
});
|
|
6963
7060
|
}
|
|
@@ -6974,10 +7071,10 @@ var XlsxWorkerClient = class {
|
|
|
6974
7071
|
type: "parseCharts"
|
|
6975
7072
|
}, [workerBuffer]);
|
|
6976
7073
|
}
|
|
6977
|
-
getRowsBatch(workbookSheetIndex, startRow, rowCount) {
|
|
7074
|
+
getRowsBatch(workbookSheetIndex, startRow, rowCount, locale) {
|
|
6978
7075
|
return this.request({
|
|
6979
7076
|
id: 0,
|
|
6980
|
-
payload: { rowCount, startRow, workbookSheetIndex },
|
|
7077
|
+
payload: { rowCount, startRow, workbookSheetIndex, locale },
|
|
6981
7078
|
type: "getRowsBatch"
|
|
6982
7079
|
});
|
|
6983
7080
|
}
|
|
@@ -8101,7 +8198,7 @@ function cloneCellStyle(style) {
|
|
|
8101
8198
|
return style;
|
|
8102
8199
|
}
|
|
8103
8200
|
}
|
|
8104
|
-
function coerceUserEnteredValue(value) {
|
|
8201
|
+
function coerceUserEnteredValue(value, locale = "en-US") {
|
|
8105
8202
|
const trimmed = value.trim();
|
|
8106
8203
|
if (!trimmed) {
|
|
8107
8204
|
return "";
|
|
@@ -8112,6 +8209,8 @@ function coerceUserEnteredValue(value) {
|
|
|
8112
8209
|
if (/^(true|false)$/i.test(trimmed)) {
|
|
8113
8210
|
return trimmed.toLowerCase() === "true";
|
|
8114
8211
|
}
|
|
8212
|
+
const localizedNumber = parseLocaleNumber(trimmed, locale);
|
|
8213
|
+
if (localizedNumber !== void 0) return localizedNumber;
|
|
8115
8214
|
if (/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(trimmed)) {
|
|
8116
8215
|
const parsed = Number(trimmed);
|
|
8117
8216
|
if (Number.isFinite(parsed)) {
|
|
@@ -8531,6 +8630,7 @@ function useXlsxViewerController(options) {
|
|
|
8531
8630
|
deferLoadingAboveBytes = DEFAULT_DEFER_LOADING_ABOVE_BYTES,
|
|
8532
8631
|
file,
|
|
8533
8632
|
fileName,
|
|
8633
|
+
locale = "en-US",
|
|
8534
8634
|
maxFileSizeBytes = DEFAULT_MAX_FILE_SIZE_BYTES,
|
|
8535
8635
|
readOnly: requestedReadOnly = false,
|
|
8536
8636
|
readOnlyAboveBytes = 0,
|
|
@@ -9345,14 +9445,14 @@ function useXlsxViewerController(options) {
|
|
|
9345
9445
|
formula: ""
|
|
9346
9446
|
});
|
|
9347
9447
|
}
|
|
9348
|
-
return getWorkerClient().getCellSnapshot(workbookSheetIndex, row, col);
|
|
9349
|
-
}, [getWorkerClient, isWorkerBacked]);
|
|
9448
|
+
return getWorkerClient().getCellSnapshot(workbookSheetIndex, row, col, locale);
|
|
9449
|
+
}, [getWorkerClient, isWorkerBacked, locale]);
|
|
9350
9450
|
const getRowsBatchAsync = q((workbookSheetIndex, startRow, rowCount) => {
|
|
9351
9451
|
if (!isWorkerBacked) {
|
|
9352
9452
|
return Promise.resolve(null);
|
|
9353
9453
|
}
|
|
9354
|
-
return getWorkerClient().getRowsBatch(workbookSheetIndex, startRow, rowCount);
|
|
9355
|
-
}, [getWorkerClient, isWorkerBacked]);
|
|
9454
|
+
return getWorkerClient().getRowsBatch(workbookSheetIndex, startRow, rowCount, locale);
|
|
9455
|
+
}, [getWorkerClient, isWorkerBacked, locale]);
|
|
9356
9456
|
const visibleSheetIndexByWorkbookSheetIndex = T(
|
|
9357
9457
|
() => new Map(sheets.map((sheet, index) => [sheet.workbookSheetIndex, index])),
|
|
9358
9458
|
[sheets]
|
|
@@ -9565,7 +9665,7 @@ function useXlsxViewerController(options) {
|
|
|
9565
9665
|
}, [activeSheet?.showGridLines, activeSheet?.workbookSheetIndex]);
|
|
9566
9666
|
const getCellDisplayValue2 = q((cell) => {
|
|
9567
9667
|
if (cell && activeSheet) {
|
|
9568
|
-
const workerSnapshot = workerCellSnapshotCacheRef.current.get(`${activeSheet.workbookSheetIndex}:${cell.row}:${cell.col}`);
|
|
9668
|
+
const workerSnapshot = workerCellSnapshotCacheRef.current.get(`${locale}:${activeSheet.workbookSheetIndex}:${cell.row}:${cell.col}`);
|
|
9569
9669
|
if (workerSnapshot) {
|
|
9570
9670
|
return workerSnapshot.displayValue;
|
|
9571
9671
|
}
|
|
@@ -9578,7 +9678,7 @@ function useXlsxViewerController(options) {
|
|
|
9578
9678
|
const cachedFormulaValue = formula ? activeSheet?.cachedFormulaValues?.[cellAddressToA1(cell)] : void 0;
|
|
9579
9679
|
const formatted = worksheet.getFormattedValueAt(cell.row, cell.col);
|
|
9580
9680
|
if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
|
|
9581
|
-
return decodeHtmlEntities(formatted);
|
|
9681
|
+
return localizeCellNumber(worksheet, cell.row, cell.col, decodeHtmlEntities(formatted), locale);
|
|
9582
9682
|
}
|
|
9583
9683
|
const calculated = worksheet.getCalculatedValueAt(cell.row, cell.col);
|
|
9584
9684
|
if (formula && cachedFormulaValue !== void 0 && calculated.is_error) {
|
|
@@ -9591,10 +9691,10 @@ function useXlsxViewerController(options) {
|
|
|
9591
9691
|
return "";
|
|
9592
9692
|
}
|
|
9593
9693
|
return calculated.toString();
|
|
9594
|
-
}, [activeSheet, getActiveWorksheet]);
|
|
9694
|
+
}, [activeSheet, getActiveWorksheet, locale]);
|
|
9595
9695
|
const getCellFormula = q((cell) => {
|
|
9596
9696
|
if (cell && activeSheet) {
|
|
9597
|
-
const workerSnapshot = workerCellSnapshotCacheRef.current.get(`${activeSheet.workbookSheetIndex}:${cell.row}:${cell.col}`);
|
|
9697
|
+
const workerSnapshot = workerCellSnapshotCacheRef.current.get(`${locale}:${activeSheet.workbookSheetIndex}:${cell.row}:${cell.col}`);
|
|
9598
9698
|
if (workerSnapshot) {
|
|
9599
9699
|
return workerSnapshot.formula;
|
|
9600
9700
|
}
|
|
@@ -9604,7 +9704,7 @@ function useXlsxViewerController(options) {
|
|
|
9604
9704
|
return "";
|
|
9605
9705
|
}
|
|
9606
9706
|
return worksheet.getFormulaAt(cell.row, cell.col) ?? "";
|
|
9607
|
-
}, [activeSheet, getActiveWorksheet]);
|
|
9707
|
+
}, [activeSheet, getActiveWorksheet, locale]);
|
|
9608
9708
|
const getClipboardData = q(() => {
|
|
9609
9709
|
const worksheet = getActiveWorksheet();
|
|
9610
9710
|
const targetRange = selection ?? (activeCell ? { start: activeCell, end: activeCell } : null);
|
|
@@ -9724,7 +9824,7 @@ function useXlsxViewerController(options) {
|
|
|
9724
9824
|
if (!isWorkerBacked || !deferredMetadataSheet || !deferredMetadataCell) {
|
|
9725
9825
|
return;
|
|
9726
9826
|
}
|
|
9727
|
-
const cacheKey = `${deferredMetadataSheet.workbookSheetIndex}:${deferredMetadataCell.row}:${deferredMetadataCell.col}`;
|
|
9827
|
+
const cacheKey = `${locale}:${deferredMetadataSheet.workbookSheetIndex}:${deferredMetadataCell.row}:${deferredMetadataCell.col}`;
|
|
9728
9828
|
if (workerCellSnapshotCacheRef.current.has(cacheKey)) {
|
|
9729
9829
|
return;
|
|
9730
9830
|
}
|
|
@@ -9748,7 +9848,7 @@ function useXlsxViewerController(options) {
|
|
|
9748
9848
|
return () => {
|
|
9749
9849
|
isCurrent = false;
|
|
9750
9850
|
};
|
|
9751
|
-
}, [deferredMetadataCell, deferredMetadataSheet, getCellSnapshotAsync, isWorkerBacked]);
|
|
9851
|
+
}, [deferredMetadataCell, deferredMetadataSheet, getCellSnapshotAsync, isWorkerBacked, locale]);
|
|
9752
9852
|
const activeCellAddress = T(() => activeCell ? cellAddressToA1(activeCell) : null, [activeCell]);
|
|
9753
9853
|
const selectedRangeAddress = T(() => selection ? rangeToA1(selection) : null, [selection]);
|
|
9754
9854
|
const selectedValue = T(
|
|
@@ -10497,7 +10597,11 @@ function useXlsxViewerController(options) {
|
|
|
10497
10597
|
if (imageAssetsRef.current && hydratedChartAssets) {
|
|
10498
10598
|
updateWorkbookChartDefinition(imageAssetsRef.current, hydratedChartAssets, id, patch);
|
|
10499
10599
|
}
|
|
10500
|
-
setChartsByWorkbookSheetIndex((current) => current.map((sheetCharts) => sheetCharts.map((chart) =>
|
|
10600
|
+
setChartsByWorkbookSheetIndex((current) => current.map((sheetCharts) => sheetCharts.map((chart) => {
|
|
10601
|
+
if (chart.id !== id) return chart;
|
|
10602
|
+
const appearanceUnchanged = Object.keys(patch).every((key) => key === "anchor" || key === "title");
|
|
10603
|
+
return { ...chart, renderSource: appearanceUnchanged ? chart.renderSource : void 0, ...patch };
|
|
10604
|
+
})));
|
|
10501
10605
|
setRevision((current) => current + 1);
|
|
10502
10606
|
}, [ensureChartAssetsHydrated, getChartById, readOnly, recordHistoryBeforeMutation, sheets, workbook]);
|
|
10503
10607
|
const setChartSeriesFormula = q((chartId, seriesIndex, formula) => {
|
|
@@ -10512,7 +10616,7 @@ function useXlsxViewerController(options) {
|
|
|
10512
10616
|
if (!nextChart) {
|
|
10513
10617
|
return false;
|
|
10514
10618
|
}
|
|
10515
|
-
updateChart(chartId, { series: nextChart.series });
|
|
10619
|
+
updateChart(chartId, { series: nextChart.series, renderSource: chart.renderSource });
|
|
10516
10620
|
const selectedSeries = nextChart.series[seriesIndex];
|
|
10517
10621
|
if (selectedSeries) {
|
|
10518
10622
|
setSelectedChartElement((current) => current && current.chartId === chartId && current.kind !== "chart" ? {
|
|
@@ -10605,7 +10709,8 @@ function useXlsxViewerController(options) {
|
|
|
10605
10709
|
if (!before) {
|
|
10606
10710
|
return;
|
|
10607
10711
|
}
|
|
10608
|
-
|
|
10712
|
+
if (locale !== "en-US" && value === getCellDisplayValue2(cell)) return;
|
|
10713
|
+
const nextValue = coerceUserEnteredValue(value, locale);
|
|
10609
10714
|
worksheet.setCell(cellAddressToA1(cell), nextValue);
|
|
10610
10715
|
const after = captureCellMutationState(cell);
|
|
10611
10716
|
if (!after) {
|
|
@@ -10614,7 +10719,7 @@ function useXlsxViewerController(options) {
|
|
|
10614
10719
|
maybeRecalculateWorkbook(workbook);
|
|
10615
10720
|
refreshWorkbookState(workbook);
|
|
10616
10721
|
recordCellEditHistory(cell, before, after);
|
|
10617
|
-
}, [captureCellMutationState, getActiveWorksheet, maybeRecalculateWorkbook, readOnly, recordCellEditHistory, refreshWorkbookState, workbook]);
|
|
10722
|
+
}, [captureCellMutationState, getActiveWorksheet, getCellDisplayValue2, locale, maybeRecalculateWorkbook, readOnly, recordCellEditHistory, refreshWorkbookState, workbook]);
|
|
10618
10723
|
const setCellFormula = q((cell, formula) => {
|
|
10619
10724
|
const worksheet = getActiveWorksheet();
|
|
10620
10725
|
if (readOnly || !worksheet || !workbook) {
|
|
@@ -10955,7 +11060,7 @@ function useXlsxViewerController(options) {
|
|
|
10955
11060
|
cell: nextCell
|
|
10956
11061
|
});
|
|
10957
11062
|
} else {
|
|
10958
|
-
const nextValue = coerceUserEnteredValue(rawValue);
|
|
11063
|
+
const nextValue = coerceUserEnteredValue(rawValue, locale);
|
|
10959
11064
|
worksheet.setCell(cellAddressToA1(nextCell), nextValue);
|
|
10960
11065
|
const after = captureCellMutationState(nextCell);
|
|
10961
11066
|
if (!after) {
|
|
@@ -10983,7 +11088,7 @@ function useXlsxViewerController(options) {
|
|
|
10983
11088
|
selectionAnchorRef.current = targetCell;
|
|
10984
11089
|
recordRangeEditHistory(mutations, nextRange, targetCell);
|
|
10985
11090
|
return true;
|
|
10986
|
-
}, [activeCell, captureCellMutationState, getActiveWorksheet, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
|
|
11091
|
+
}, [activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
|
|
10987
11092
|
const pasteStructuredClipboardData = q((serializedPayload) => {
|
|
10988
11093
|
const worksheet = getActiveWorksheet();
|
|
10989
11094
|
const targetCell = activeCell ?? selection?.start ?? null;
|
|
@@ -11256,6 +11361,7 @@ function useXlsxViewerController(options) {
|
|
|
11256
11361
|
deferredLoadFileSize,
|
|
11257
11362
|
defineNamedRange,
|
|
11258
11363
|
displayFileName,
|
|
11364
|
+
locale,
|
|
11259
11365
|
download,
|
|
11260
11366
|
exportCsv,
|
|
11261
11367
|
exportXlsx,
|
|
@@ -11379,6 +11485,7 @@ function useXlsxViewerController(options) {
|
|
|
11379
11485
|
deferredLoadFileSize,
|
|
11380
11486
|
defineNamedRange,
|
|
11381
11487
|
displayFileName,
|
|
11488
|
+
locale,
|
|
11382
11489
|
download,
|
|
11383
11490
|
error,
|
|
11384
11491
|
exportCsv,
|
|
@@ -13457,13 +13564,19 @@ function MapChartSvg({ renderer, loadingFallback, ...props }) {
|
|
|
13457
13564
|
const resources = useChartModule(regionMapResources);
|
|
13458
13565
|
return resources ? /* @__PURE__ */ u(renderer.MemoChartSvg, { ...props }) : /* @__PURE__ */ u(S, { children: loadingFallback("map") });
|
|
13459
13566
|
}
|
|
13460
|
-
function
|
|
13567
|
+
function LegacyChartSvg({ loadingFallback, ...props }) {
|
|
13461
13568
|
const renderer = useChartModule(chartRenderer);
|
|
13462
13569
|
if (!renderer) return /* @__PURE__ */ u(S, { children: loadingFallback("renderer") });
|
|
13463
13570
|
return props.chart.chartType === "RegionMap" ? /* @__PURE__ */ u(MapChartSvg, { ...props, renderer, loadingFallback }) : /* @__PURE__ */ u(renderer.MemoChartSvg, { ...props });
|
|
13464
13571
|
}
|
|
13572
|
+
function SharedChart(props) {
|
|
13573
|
+
const module = useChartModule(officeChartRenderer);
|
|
13574
|
+
if (!module) return /* @__PURE__ */ u(S, { children: props.loadingFallback("renderer") });
|
|
13575
|
+
const fallback = /* @__PURE__ */ u(LegacyChartSvg, { ...props });
|
|
13576
|
+
return module.renderer ? /* @__PURE__ */ u(module.SharedChartSvg, { ...props, renderer: module.renderer, fallback }) : fallback;
|
|
13577
|
+
}
|
|
13465
13578
|
function MemoChartSvg(props) {
|
|
13466
|
-
return /* @__PURE__ */ u(ChartLoadBoundary, { children: /* @__PURE__ */ u(
|
|
13579
|
+
return /* @__PURE__ */ u(ChartLoadBoundary, { children: props.chart.renderSource ? /* @__PURE__ */ u(SharedChart, { ...props, source: props.chart.renderSource }) : /* @__PURE__ */ u(LegacyChartSvg, { ...props }) }, props.chart.id);
|
|
13467
13580
|
}
|
|
13468
13581
|
|
|
13469
13582
|
// src/XlsxViewer.tsx
|
|
@@ -16139,12 +16252,12 @@ function canCellTextOverflow(data) {
|
|
|
16139
16252
|
function canReceiveOverflowText(data) {
|
|
16140
16253
|
return !data.isMergedSecondary && !data.colSpan && data.value.length === 0;
|
|
16141
16254
|
}
|
|
16142
|
-
function getCellDisplayValue(worksheet, row, col, activeSheet) {
|
|
16255
|
+
function getCellDisplayValue(worksheet, row, col, activeSheet, locale = "en-US") {
|
|
16143
16256
|
const formula = worksheet.getFormulaAt(row, col);
|
|
16144
16257
|
const cachedFormulaValue = formula ? activeSheet?.cachedFormulaValues?.[cellAddressToA12({ row, col })] : void 0;
|
|
16145
16258
|
const formatted = worksheet.getFormattedValueAt(row, col);
|
|
16146
16259
|
if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
|
|
16147
|
-
return decodeHtmlEntities2(formatted);
|
|
16260
|
+
return localizeCellNumber(worksheet, row, col, decodeHtmlEntities2(formatted), locale);
|
|
16148
16261
|
}
|
|
16149
16262
|
const cellValue = worksheet.getCalculatedValueAt(row, col);
|
|
16150
16263
|
if (formula && cachedFormulaValue !== void 0 && cellValue.is_error) {
|
|
@@ -16194,6 +16307,7 @@ function getBatchedCellNumericValue(cell) {
|
|
|
16194
16307
|
if (!cell) {
|
|
16195
16308
|
return null;
|
|
16196
16309
|
}
|
|
16310
|
+
if (cell.numericValue !== void 0) return cell.numericValue;
|
|
16197
16311
|
const text = cell.value.trim();
|
|
16198
16312
|
if (text.length === 0) {
|
|
16199
16313
|
return null;
|
|
@@ -16531,6 +16645,7 @@ function buildWorksheetBatchWindow(rows, activeSheet, startRow, endRow) {
|
|
|
16531
16645
|
const formula = typeof cellEntry.formula === "string" ? cellEntry.formula : null;
|
|
16532
16646
|
cells.set(`${row}:${col}`, {
|
|
16533
16647
|
formula,
|
|
16648
|
+
numericValue: typeof cellEntry.numericValue === "number" ? cellEntry.numericValue : cellEntry.numericValue === null ? null : void 0,
|
|
16534
16649
|
generalAlignment: cellEntry.generalAlignment === "right" || cellEntry.generalAlignment === "center" ? cellEntry.generalAlignment : "left",
|
|
16535
16650
|
hyperlink: normalizeBatchedHyperlink(cellEntry.hyperlink),
|
|
16536
16651
|
isMergedSecondary: cellEntry.isMergedSecondary === true,
|
|
@@ -18661,6 +18776,7 @@ function XlsxGrid({
|
|
|
18661
18776
|
getRowsBatchAsync,
|
|
18662
18777
|
getClipboardData,
|
|
18663
18778
|
getCellDisplayValue: getControllerCellDisplayValue,
|
|
18779
|
+
locale,
|
|
18664
18780
|
getFormControlItems,
|
|
18665
18781
|
highlightedRanges,
|
|
18666
18782
|
images,
|
|
@@ -18705,8 +18821,8 @@ function XlsxGrid({
|
|
|
18705
18821
|
zoomScale
|
|
18706
18822
|
} = controller;
|
|
18707
18823
|
h(() => {
|
|
18708
|
-
if (showImages) preloadChartRenderers([charts]);
|
|
18709
|
-
}, [charts, showImages]);
|
|
18824
|
+
if (showImages && !isChartsLoading) preloadChartRenderers([charts]);
|
|
18825
|
+
}, [charts, isChartsLoading, showImages]);
|
|
18710
18826
|
const formControlItemsById = T(() => new Map(
|
|
18711
18827
|
formControls.flatMap((control) => control.controlIndex !== void 0 && (control.kind === "dropdown" || control.kind === "listbox") ? [[control.id, getFormControlItems(control.controlIndex, control.sheetIndex)]] : [])
|
|
18712
18828
|
), [formControls, getFormControlItems]);
|
|
@@ -19424,7 +19540,8 @@ function XlsxGrid({
|
|
|
19424
19540
|
activeSheet?.visibleCols,
|
|
19425
19541
|
displayColLimit,
|
|
19426
19542
|
worksheet,
|
|
19427
|
-
revision
|
|
19543
|
+
revision,
|
|
19544
|
+
locale
|
|
19428
19545
|
]
|
|
19429
19546
|
);
|
|
19430
19547
|
const actualRowHeights = T(
|
|
@@ -19455,7 +19572,7 @@ function XlsxGrid({
|
|
|
19455
19572
|
if (worksheet.isColumnHidden(col) || worksheet.isMergedSecondary(row, col)) {
|
|
19456
19573
|
continue;
|
|
19457
19574
|
}
|
|
19458
|
-
const cellValue = worksheet.getFormattedValueAt(row, col);
|
|
19575
|
+
const cellValue = localizeCellNumber(worksheet, row, col, worksheet.getFormattedValueAt(row, col), locale);
|
|
19459
19576
|
if (!cellValue) {
|
|
19460
19577
|
continue;
|
|
19461
19578
|
}
|
|
@@ -19530,7 +19647,8 @@ function XlsxGrid({
|
|
|
19530
19647
|
displayColLimit,
|
|
19531
19648
|
palette,
|
|
19532
19649
|
worksheet,
|
|
19533
|
-
revision
|
|
19650
|
+
revision,
|
|
19651
|
+
locale
|
|
19534
19652
|
]
|
|
19535
19653
|
);
|
|
19536
19654
|
const displayActualColWidths = T(
|
|
@@ -20740,11 +20858,12 @@ function XlsxGrid({
|
|
|
20740
20858
|
includeStyles: true,
|
|
20741
20859
|
useFormattedValues: true
|
|
20742
20860
|
});
|
|
20861
|
+
localizeRows(worksheet, rows, locale);
|
|
20743
20862
|
return buildWorksheetBatchWindow(rows, activeSheet ?? null, viewportRequest.startRow, viewportRequest.endRow);
|
|
20744
20863
|
} catch {
|
|
20745
20864
|
return null;
|
|
20746
20865
|
}
|
|
20747
|
-
}, [activeSheet, getRowsBatchAsync, shouldVirtualizeRows, viewportRequest, worksheet]);
|
|
20866
|
+
}, [activeSheet, getRowsBatchAsync, shouldVirtualizeRows, viewportRequest, worksheet, locale]);
|
|
20748
20867
|
h(() => {
|
|
20749
20868
|
if (!shouldVirtualizeRows || !getRowsBatchAsync || !activeSheet || !viewportRequest) {
|
|
20750
20869
|
setAsyncViewportRowBatch(null);
|
|
@@ -20786,7 +20905,7 @@ function XlsxGrid({
|
|
|
20786
20905
|
const viewportRowBatch = getRowsBatchAsync ? asyncViewportRowBatch : syncViewportRowBatch;
|
|
20787
20906
|
h(() => {
|
|
20788
20907
|
setAsyncViewportRowBatch(null);
|
|
20789
|
-
}, [activeSheetIndex, revision]);
|
|
20908
|
+
}, [activeSheetIndex, revision, locale]);
|
|
20790
20909
|
const sparklinesByCell = T(() => {
|
|
20791
20910
|
const map = /* @__PURE__ */ new Map();
|
|
20792
20911
|
for (const sparkline of activeSheet?.sparklines ?? []) {
|
|
@@ -20811,6 +20930,7 @@ function XlsxGrid({
|
|
|
20811
20930
|
getCellStyle,
|
|
20812
20931
|
palette,
|
|
20813
20932
|
revision,
|
|
20933
|
+
locale,
|
|
20814
20934
|
selectedChartElement,
|
|
20815
20935
|
selectedChartId,
|
|
20816
20936
|
viewportRowBatch,
|
|
@@ -20825,6 +20945,7 @@ function XlsxGrid({
|
|
|
20825
20945
|
getCellStyle,
|
|
20826
20946
|
palette,
|
|
20827
20947
|
revision,
|
|
20948
|
+
locale,
|
|
20828
20949
|
selectedChartElement,
|
|
20829
20950
|
selectedChartId,
|
|
20830
20951
|
viewportRowBatch,
|
|
@@ -20921,7 +21042,7 @@ function XlsxGrid({
|
|
|
20921
21042
|
let displayValue = null;
|
|
20922
21043
|
const readDisplayValue = () => {
|
|
20923
21044
|
if (displayValue === null) {
|
|
20924
|
-
displayValue = batchCoversRow || !worksheet ? batchedCell?.value ?? "" : getCellDisplayValue(worksheet, row, col, activeSheet);
|
|
21045
|
+
displayValue = batchCoversRow || !worksheet ? batchedCell?.value ?? "" : getCellDisplayValue(worksheet, row, col, activeSheet, locale);
|
|
20925
21046
|
}
|
|
20926
21047
|
return displayValue;
|
|
20927
21048
|
};
|
|
@@ -21114,6 +21235,7 @@ function XlsxGrid({
|
|
|
21114
21235
|
activeSheet,
|
|
21115
21236
|
activeSheetChartHighlights,
|
|
21116
21237
|
cellRenderCacheInvalidationKey,
|
|
21238
|
+
locale,
|
|
21117
21239
|
colIndexByActual,
|
|
21118
21240
|
colPrefixSums,
|
|
21119
21241
|
displayDefaultColWidth,
|
|
@@ -26975,4 +27097,4 @@ export {
|
|
|
26975
27097
|
__createContentNode,
|
|
26976
27098
|
__createContentRoot
|
|
26977
27099
|
};
|
|
26978
|
-
//# sourceMappingURL=chunk-
|
|
27100
|
+
//# sourceMappingURL=chunk-GXYDJPHM.js.map
|