@extend-ai/react-xlsx 0.24.0 → 0.24.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 +30 -5
- package/dist/{chunk-HAV76TR2.js → chunk-EDUJZDOK.js} +33 -1
- package/dist/{chunk-HAV76TR2.js.map → chunk-EDUJZDOK.js.map} +1 -1
- package/dist/{chunk-C4WTJIRG.js → chunk-J3G4UUGR.js} +352 -89
- package/dist/chunk-J3G4UUGR.js.map +1 -0
- package/dist/{chunk-DGNSB5M5.cjs → chunk-LX33ROHL.cjs} +2156 -1893
- package/dist/chunk-LX33ROHL.cjs.map +1 -0
- package/dist/{chunk-MNIFKMIL.js → chunk-MCS2EQEF.js} +33 -1
- package/dist/chunk-MCS2EQEF.js.map +1 -0
- package/dist/{chunk-Z4WMURVU.cjs → chunk-TLEC4K6W.cjs} +33 -1
- package/dist/chunk-TLEC4K6W.cjs.map +1 -0
- package/dist/{chunk-YOLIVKZD.cjs → chunk-UXJAG7MU.cjs} +33 -1
- package/dist/chunk-UXJAG7MU.cjs.map +1 -0
- package/dist/index.cjs +457 -316
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.js +464 -323
- package/dist/index.js.map +1 -1
- package/dist/{internal-CwTqluL7.d.cts → internal-BhZTIzgZ.d.cts} +28 -2
- package/dist/{internal-CwTqluL7.d.ts → internal-BhZTIzgZ.d.ts} +28 -2
- package/dist/internal.cjs +3 -3
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -2
- package/dist/{shared-chart-CGEK7EAB.js → shared-chart-NR4KWDQM.js} +2 -2
- package/dist/{shared-chart-24MCGSFJ.js → shared-chart-PMIN7YMP.js} +2 -2
- package/dist/{shared-chart-7E6KMGTG.cjs → shared-chart-QIS7OPL3.cjs} +3 -3
- package/dist/{shared-chart-7E6KMGTG.cjs.map → shared-chart-QIS7OPL3.cjs.map} +1 -1
- package/dist/{shared-chart-GKNMM72Q.cjs → shared-chart-ZP5J6OSZ.cjs} +15 -15
- package/dist/{shared-chart-GKNMM72Q.cjs.map → shared-chart-ZP5J6OSZ.cjs.map} +1 -1
- package/dist/vanilla.cjs +3 -3
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +2 -2
- package/dist/{workbook-runtime-QFXDLSSI.cjs → workbook-runtime-7WEPIK5Y.cjs} +41 -29
- package/dist/workbook-runtime-7WEPIK5Y.cjs.map +1 -0
- package/dist/{workbook-runtime-56Y3B64Y.js → workbook-runtime-BAAYDYYK.js} +17 -5
- package/dist/workbook-runtime-BAAYDYYK.js.map +1 -0
- package/dist/{workbook-runtime-7DSKESFL.js → workbook-runtime-FCKPXLTW.js} +17 -5
- package/dist/workbook-runtime-FCKPXLTW.js.map +1 -0
- package/dist/{workbook-runtime-MEI3CEWO.cjs → workbook-runtime-MOGSEJ5R.cjs} +41 -29
- package/dist/workbook-runtime-MOGSEJ5R.cjs.map +1 -0
- package/dist/xlsx-worker.js +16 -4
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-C4WTJIRG.js.map +0 -1
- package/dist/chunk-DGNSB5M5.cjs.map +0 -1
- package/dist/chunk-MNIFKMIL.js.map +0 -1
- package/dist/chunk-YOLIVKZD.cjs.map +0 -1
- package/dist/chunk-Z4WMURVU.cjs.map +0 -1
- package/dist/workbook-runtime-56Y3B64Y.js.map +0 -1
- package/dist/workbook-runtime-7DSKESFL.js.map +0 -1
- package/dist/workbook-runtime-MEI3CEWO.cjs.map +0 -1
- package/dist/workbook-runtime-QFXDLSSI.cjs.map +0 -1
- /package/dist/{shared-chart-CGEK7EAB.js.map → shared-chart-NR4KWDQM.js.map} +0 -0
- /package/dist/{shared-chart-24MCGSFJ.js.map → shared-chart-PMIN7YMP.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var _chunkXZJLPW64cjs = require('./chunk-XZJLPW64.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var _chunkUXJAG7MUcjs = require('./chunk-UXJAG7MU.cjs');
|
|
46
46
|
require('./chunk-JRWNIQWR.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
@@ -96,6 +96,80 @@ function* bandIndices(bands) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// src/read-only-layout.ts
|
|
100
|
+
function changedVisibilityRanges(existing, ranges, hidden, fromSelection) {
|
|
101
|
+
if (!hidden && !existing.size) return [];
|
|
102
|
+
let firstVisible = 0;
|
|
103
|
+
if (!hidden && fromSelection) {
|
|
104
|
+
while (existing.has(firstVisible)) firstVisible++;
|
|
105
|
+
}
|
|
106
|
+
const changed = [];
|
|
107
|
+
for (const range of ranges) {
|
|
108
|
+
const start = firstVisible > 0 && range.start === firstVisible ? 0 : range.start;
|
|
109
|
+
for (let index = start; index <= range.end; index++) {
|
|
110
|
+
if (existing.has(index) !== hidden) {
|
|
111
|
+
changed.push({ start, end: range.end });
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return changed;
|
|
117
|
+
}
|
|
118
|
+
function nextVisibleIndex(index, limit, isHidden) {
|
|
119
|
+
let next = index;
|
|
120
|
+
while (next < limit && isHidden(next)) next++;
|
|
121
|
+
if (next < limit) return next;
|
|
122
|
+
next = index - 1;
|
|
123
|
+
while (next >= 0 && isHidden(next)) next--;
|
|
124
|
+
return next;
|
|
125
|
+
}
|
|
126
|
+
function visibleAxis(hidden, max, originalIndices, originalSizes, overrides, defaultSize) {
|
|
127
|
+
const indices = [];
|
|
128
|
+
const sizes = [];
|
|
129
|
+
let offset = 0;
|
|
130
|
+
for (let index = 0; index <= max; index++) {
|
|
131
|
+
const originalSize = originalIndices[offset] === index ? originalSizes[offset++] : void 0;
|
|
132
|
+
if (hidden.has(index)) continue;
|
|
133
|
+
indices.push(index);
|
|
134
|
+
sizes.push(_nullishCoalesce(_nullishCoalesce(originalSize, () => ( overrides[index])), () => ( defaultSize)));
|
|
135
|
+
}
|
|
136
|
+
return { indices, sizes };
|
|
137
|
+
}
|
|
138
|
+
function applyReadOnlyLayout(sheet, layout) {
|
|
139
|
+
if (!layout) return sheet;
|
|
140
|
+
const view = { ...sheet };
|
|
141
|
+
if (layout.freezePanes !== void 0) view.freezePanes = layout.freezePanes;
|
|
142
|
+
if (layout.hiddenRows) {
|
|
143
|
+
const rows = visibleAxis(
|
|
144
|
+
layout.hiddenRows,
|
|
145
|
+
sheet.maxUsedRow,
|
|
146
|
+
sheet.visibleRows,
|
|
147
|
+
sheet.rowHeights,
|
|
148
|
+
sheet.rowHeightOverridesPx,
|
|
149
|
+
sheet.defaultRowHeightPx
|
|
150
|
+
);
|
|
151
|
+
view.hiddenRows = Array.from(layout.hiddenRows).sort((a, b) => a - b);
|
|
152
|
+
view.visibleRows = rows.indices;
|
|
153
|
+
view.rowHeights = rows.sizes;
|
|
154
|
+
view.rowCount = rows.indices.length;
|
|
155
|
+
}
|
|
156
|
+
if (layout.hiddenCols) {
|
|
157
|
+
const cols = visibleAxis(
|
|
158
|
+
layout.hiddenCols,
|
|
159
|
+
sheet.maxUsedCol,
|
|
160
|
+
sheet.visibleCols,
|
|
161
|
+
sheet.colWidths,
|
|
162
|
+
sheet.colWidthOverridesPx,
|
|
163
|
+
sheet.defaultColWidthPx
|
|
164
|
+
);
|
|
165
|
+
view.hiddenCols = Array.from(layout.hiddenCols).sort((a, b) => a - b);
|
|
166
|
+
view.visibleCols = cols.indices;
|
|
167
|
+
view.colWidths = cols.sizes;
|
|
168
|
+
view.colCount = cols.indices.length;
|
|
169
|
+
}
|
|
170
|
+
return view;
|
|
171
|
+
}
|
|
172
|
+
|
|
99
173
|
// src/merged-range-lookup.ts
|
|
100
174
|
function createMergedRangeLookup(ranges) {
|
|
101
175
|
const normalizedRanges = [];
|
|
@@ -815,7 +889,7 @@ function quoteClipboardField(value) {
|
|
|
815
889
|
}
|
|
816
890
|
|
|
817
891
|
// src/controller.tsx
|
|
818
|
-
var _react = require('react'); var React = _interopRequireWildcard(_react); var
|
|
892
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react); var React17 = _interopRequireWildcard(_react); var React16 = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react);
|
|
819
893
|
var _internal = require('@extend-ai/react-xlsx/internal');
|
|
820
894
|
|
|
821
895
|
|
|
@@ -965,7 +1039,7 @@ var XlsxWorkerClient = (_class = class {
|
|
|
965
1039
|
}
|
|
966
1040
|
async getMainRuntime() {
|
|
967
1041
|
if (this.disposed) throw createAbortError();
|
|
968
|
-
this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-
|
|
1042
|
+
this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-MOGSEJ5R.cjs"))).then(({ createWorkbookRuntime }) => createWorkbookRuntime());
|
|
969
1043
|
const runtime = await this.mainRuntime;
|
|
970
1044
|
if (this.disposed) {
|
|
971
1045
|
runtime.dispose();
|
|
@@ -1941,6 +2015,8 @@ function downloadUrl(src, fileName) {
|
|
|
1941
2015
|
}
|
|
1942
2016
|
function useXlsxViewerController(options2) {
|
|
1943
2017
|
const {
|
|
2018
|
+
allowFreezeInReadOnly = false,
|
|
2019
|
+
allowHideInReadOnly = false,
|
|
1944
2020
|
allowResizeInReadOnly = false,
|
|
1945
2021
|
deferLoadingAboveBytes = DEFAULT_DEFER_LOADING_ABOVE_BYTES,
|
|
1946
2022
|
file,
|
|
@@ -1955,11 +2031,12 @@ function useXlsxViewerController(options2) {
|
|
|
1955
2031
|
src,
|
|
1956
2032
|
useWorker = true
|
|
1957
2033
|
} = options2;
|
|
1958
|
-
const messages = React.useMemo(() =>
|
|
2034
|
+
const messages = React.useMemo(() => _chunkUXJAG7MUcjs.resolveMessages.call(void 0, locale, messageOverrides), [locale, messageOverrides]);
|
|
1959
2035
|
const [isLoading, setIsLoading] = React.useState(Boolean(_nullishCoalesce(file, () => ( src))));
|
|
1960
2036
|
const [error, setError] = React.useState(null);
|
|
1961
2037
|
const [workbook, setWorkbook] = React.useState(null);
|
|
1962
|
-
const [
|
|
2038
|
+
const [readOnlyLayouts, setReadOnlyLayouts] = React.useState({});
|
|
2039
|
+
const [workbookSheets, setSheets] = React.useState([]);
|
|
1963
2040
|
const [chartsByWorkbookSheetIndex, setChartsByWorkbookSheetIndex] = React.useState([]);
|
|
1964
2041
|
const [chartsheets, setChartsheets] = React.useState([]);
|
|
1965
2042
|
const [tabs, setTabs] = React.useState([]);
|
|
@@ -2014,6 +2091,7 @@ function useXlsxViewerController(options2) {
|
|
|
2014
2091
|
const displayFileName = React.useMemo(() => resolveDisplayFileName(src, fileName), [fileName, src]);
|
|
2015
2092
|
const shouldDeferLoading = deferLoadingAboveBytes > 0;
|
|
2016
2093
|
const readOnly = requestedReadOnly || forcedReadOnly;
|
|
2094
|
+
const sheets = React.useMemo(() => readOnly ? workbookSheets.map((sheet) => applyReadOnlyLayout(sheet, readOnlyLayouts[sheet.workbookSheetIndex])) : workbookSheets, [readOnly, readOnlyLayouts, workbookSheets]);
|
|
2017
2095
|
const drawingMutationEpoch = React.useRef(0);
|
|
2018
2096
|
const drawingMutationState = React.useRef({ workbook, revision, readOnly, activeCell, activeSheetIndex });
|
|
2019
2097
|
drawingMutationState.current = { workbook, revision, readOnly, activeCell, activeSheetIndex };
|
|
@@ -2175,6 +2253,7 @@ function useXlsxViewerController(options2) {
|
|
|
2175
2253
|
}, [disposeWorkerClient]);
|
|
2176
2254
|
React.useEffect(() => {
|
|
2177
2255
|
loadGenerationRef.current += 1;
|
|
2256
|
+
setReadOnlyLayouts({});
|
|
2178
2257
|
if (!file && !src) {
|
|
2179
2258
|
disposeWorkerClient();
|
|
2180
2259
|
setForcedReadOnly(false);
|
|
@@ -3466,28 +3545,50 @@ function useXlsxViewerController(options2) {
|
|
|
3466
3545
|
}));
|
|
3467
3546
|
setRevision((current) => current + 1);
|
|
3468
3547
|
}, [activeSheet]);
|
|
3548
|
+
const canChangeVisibility = Boolean(activeSheet && !isLoading && (readOnly ? allowHideInReadOnly : workbook));
|
|
3549
|
+
const canChangeFreezePanes = Boolean(activeSheet && !isLoading && (readOnly ? allowFreezeInReadOnly : workbook));
|
|
3550
|
+
const activeLayout = activeSheet && readOnly ? readOnlyLayouts[activeSheet.workbookSheetIndex] : void 0;
|
|
3551
|
+
React.useEffect(() => {
|
|
3552
|
+
if (!activeCell || !activeLayout) return;
|
|
3553
|
+
const { hiddenRows, hiddenCols } = activeLayout;
|
|
3554
|
+
const row2 = _optionalChain([hiddenRows, 'optionalAccess', _337 => _337.has, 'call', _338 => _338(activeCell.row)]) ? nextVisibleIndex(activeCell.row, _chunkXZJLPW64cjs.XLSX_MAX_ROWS, (index) => hiddenRows.has(index)) : activeCell.row;
|
|
3555
|
+
const col = _optionalChain([hiddenCols, 'optionalAccess', _339 => _339.has, 'call', _340 => _340(activeCell.col)]) ? nextVisibleIndex(activeCell.col, _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS, (index) => hiddenCols.has(index)) : activeCell.col;
|
|
3556
|
+
if (row2 === activeCell.row && col === activeCell.col) return;
|
|
3557
|
+
const cell = row2 < 0 || col < 0 ? null : { row: row2, col };
|
|
3558
|
+
setActiveCell(cell);
|
|
3559
|
+
setSelection(cell && { start: cell, end: cell });
|
|
3560
|
+
selectionAnchorRef.current = cell;
|
|
3561
|
+
}, [activeCell, activeLayout, setSelection]);
|
|
3469
3562
|
const setAxisHidden = React.useCallback((axis, hidden, start, end = start) => {
|
|
3470
|
-
if (
|
|
3563
|
+
if (!canChangeVisibility || !activeSheet) return;
|
|
3471
3564
|
const limit = axis === "row" ? _chunkXZJLPW64cjs.XLSX_MAX_ROWS : _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS;
|
|
3472
|
-
const
|
|
3565
|
+
const fromSelection = start === void 0 && end === void 0;
|
|
3566
|
+
const ranges = fromSelection ? selectionRanges.map((area) => ({ start: area.start[axis], end: area.end[axis] })) : [{ start: _nullishCoalesce(start, () => ( -1)), end: _nullishCoalesce(end, () => ( -1)) }];
|
|
3473
3567
|
if (!ranges.length || ranges.some((range) => !Number.isInteger(range.start) || !Number.isInteger(range.end) || range.start < 0 || range.end < range.start || range.end >= limit)) return;
|
|
3474
|
-
const
|
|
3475
|
-
|
|
3476
|
-
const
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3568
|
+
const sheetIndex = activeSheet.workbookSheetIndex;
|
|
3569
|
+
if (readOnly) {
|
|
3570
|
+
const key = axis === "row" ? "hiddenRows" : "hiddenCols";
|
|
3571
|
+
setReadOnlyLayouts((current) => {
|
|
3572
|
+
const layout = current[sheetIndex];
|
|
3573
|
+
const existing = _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _341 => _341[key]]), () => ( new Set(activeSheet[key])));
|
|
3574
|
+
const changes = changedVisibilityRanges(existing, ranges, hidden, fromSelection);
|
|
3575
|
+
if (!changes.length) return current;
|
|
3576
|
+
const next = new Set(existing);
|
|
3577
|
+
for (const range of changes) {
|
|
3578
|
+
for (let index = range.start; index <= range.end; index++) {
|
|
3579
|
+
if (hidden) next.add(index);
|
|
3580
|
+
else next.delete(index);
|
|
3581
|
+
}
|
|
3488
3582
|
}
|
|
3489
|
-
return
|
|
3583
|
+
return { ...current, [sheetIndex]: { ...layout, [key]: next } };
|
|
3490
3584
|
});
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
if (!workbook) return;
|
|
3588
|
+
const worksheet = workbook.getSheet(sheetIndex);
|
|
3589
|
+
try {
|
|
3590
|
+
const existing = new Set(axis === "row" ? worksheet.hiddenRows : worksheet.hiddenColumns);
|
|
3591
|
+
const changes = changedVisibilityRanges(existing, ranges, hidden, fromSelection);
|
|
3491
3592
|
if (!changes.length) return;
|
|
3492
3593
|
recordHistoryBeforeMutation();
|
|
3493
3594
|
for (const range of changes) {
|
|
@@ -3495,13 +3596,11 @@ function useXlsxViewerController(options2) {
|
|
|
3495
3596
|
else worksheet.setColumnsHidden(range.start, range.end, hidden);
|
|
3496
3597
|
}
|
|
3497
3598
|
if (hidden && activeCell && changes.some((range) => range.start <= activeCell[axis] && activeCell[axis] <= range.end)) {
|
|
3498
|
-
const
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
while (index >= 0 && isHidden(index)) index--;
|
|
3504
|
-
}
|
|
3599
|
+
const index = nextVisibleIndex(
|
|
3600
|
+
activeCell[axis],
|
|
3601
|
+
limit,
|
|
3602
|
+
(value) => axis === "row" ? worksheet.isRowHidden(value) : worksheet.isColumnHidden(value)
|
|
3603
|
+
);
|
|
3505
3604
|
if (index >= 0) {
|
|
3506
3605
|
const cell = { ...activeCell, [axis]: index };
|
|
3507
3606
|
setActiveCell(cell);
|
|
@@ -3513,28 +3612,35 @@ function useXlsxViewerController(options2) {
|
|
|
3513
3612
|
} finally {
|
|
3514
3613
|
worksheet.free();
|
|
3515
3614
|
}
|
|
3516
|
-
}, [activeCell, activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
|
|
3615
|
+
}, [activeCell, activeSheet, canChangeVisibility, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
|
|
3517
3616
|
const hideRows = React.useCallback((start, end) => setAxisHidden("row", true, start, end), [setAxisHidden]);
|
|
3518
3617
|
const unhideRows = React.useCallback((start, end) => setAxisHidden("row", false, start, end), [setAxisHidden]);
|
|
3519
3618
|
const hideColumns = React.useCallback((start, end) => setAxisHidden("col", true, start, end), [setAxisHidden]);
|
|
3520
3619
|
const unhideColumns = React.useCallback((start, end) => setAxisHidden("col", false, start, end), [setAxisHidden]);
|
|
3521
3620
|
const setFreezeBoundary = React.useCallback((cell) => {
|
|
3522
|
-
if (
|
|
3621
|
+
if (!canChangeFreezePanes || !activeSheet) return;
|
|
3523
3622
|
const { row: row2, col } = cell;
|
|
3524
3623
|
if (!Number.isInteger(row2) || row2 < 0 || row2 >= _chunkXZJLPW64cjs.XLSX_MAX_ROWS || !Number.isInteger(col) || col < 0 || col >= _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS) return;
|
|
3525
|
-
const
|
|
3624
|
+
const sheetIndex = activeSheet.workbookSheetIndex;
|
|
3625
|
+
if (readOnly) {
|
|
3626
|
+
const freezePanes2 = row2 || col ? { row: row2, col } : null;
|
|
3627
|
+
setReadOnlyLayouts((current) => ({ ...current, [sheetIndex]: { ...current[sheetIndex], freezePanes: freezePanes2 } }));
|
|
3628
|
+
return;
|
|
3629
|
+
}
|
|
3630
|
+
if (!workbook) return;
|
|
3631
|
+
const worksheet = workbook.getSheet(sheetIndex);
|
|
3526
3632
|
try {
|
|
3527
3633
|
const current = parseWorksheetFreezePanes(worksheet);
|
|
3528
|
-
if (row2 === (_nullishCoalesce(_optionalChain([current, 'optionalAccess',
|
|
3634
|
+
if (row2 === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _342 => _342.row]), () => ( 0))) && col === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _343 => _343.col]), () => ( 0)))) return;
|
|
3529
3635
|
recordHistoryBeforeMutation();
|
|
3530
3636
|
worksheet.setFreezePanes(row2, col);
|
|
3531
3637
|
refreshWorkbookState(workbook);
|
|
3532
3638
|
} finally {
|
|
3533
3639
|
worksheet.free();
|
|
3534
3640
|
}
|
|
3535
|
-
}, [activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
3641
|
+
}, [activeSheet, canChangeFreezePanes, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
3536
3642
|
const freezeCell = resolveFreezePanesCell(activeCell, selection);
|
|
3537
|
-
const canFreezePanes = Boolean(
|
|
3643
|
+
const canFreezePanes = Boolean(canChangeFreezePanes && freezeCell && (freezeCell.row > 0 || freezeCell.col > 0));
|
|
3538
3644
|
const freezePanes = React.useCallback((cell = freezeCell) => {
|
|
3539
3645
|
if (cell) setFreezeBoundary(cell);
|
|
3540
3646
|
}, [freezeCell, setFreezeBoundary]);
|
|
@@ -3615,10 +3721,10 @@ function useXlsxViewerController(options2) {
|
|
|
3615
3721
|
const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentChart.anchor, {
|
|
3616
3722
|
contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
|
|
3617
3723
|
contentOffsetTop: GRID_HEADER_HEIGHT,
|
|
3618
|
-
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3619
|
-
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3724
|
+
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _344 => _344.columnWidths, 'access', _345 => _345[col]]), () => ( getColumnWidthPx(worksheet, col))),
|
|
3725
|
+
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _346 => _346.rowHeights, 'access', _347 => _347[row2]]), () => ( getRowHeightPx(worksheet, row2)))
|
|
3620
3726
|
});
|
|
3621
|
-
if (_optionalChain([currentChart, 'access',
|
|
3727
|
+
if (_optionalChain([currentChart, 'access', _348 => _348.raw, 'optionalAccess', _349 => _349.pivotSource]) && currentChart.name) {
|
|
3622
3728
|
commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(worksheet.name, currentChart.name, {
|
|
3623
3729
|
anchor: _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, nextAnchor)
|
|
3624
3730
|
}), false);
|
|
@@ -3654,8 +3760,8 @@ function useXlsxViewerController(options2) {
|
|
|
3654
3760
|
const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentImage.anchor, {
|
|
3655
3761
|
contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
|
|
3656
3762
|
contentOffsetTop: GRID_HEADER_HEIGHT,
|
|
3657
|
-
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3658
|
-
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3763
|
+
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _350 => _350.columnWidths, 'access', _351 => _351[col]]), () => ( getColumnWidthPx(worksheet, col))),
|
|
3764
|
+
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _352 => _352.rowHeights, 'access', _353 => _353[row2]]), () => ( getRowHeightPx(worksheet, row2)))
|
|
3659
3765
|
});
|
|
3660
3766
|
recordHistoryBeforeMutation();
|
|
3661
3767
|
if (!_chunkXZJLPW64cjs.updateWorkbookImageAnchor.call(void 0, imageAssetsRef.current, id, nextAnchor)) {
|
|
@@ -3820,12 +3926,12 @@ function useXlsxViewerController(options2) {
|
|
|
3820
3926
|
setSelectedChartId(null);
|
|
3821
3927
|
setSelectedChartElement(null);
|
|
3822
3928
|
if (target.kind === "chart") {
|
|
3823
|
-
const chart = _optionalChain([chartAssetsRef, 'access',
|
|
3824
|
-
setSelectedChartId(_nullishCoalesce(_optionalChain([chart, 'optionalAccess',
|
|
3929
|
+
const chart = _optionalChain([chartAssetsRef, 'access', _354 => _354.current, 'optionalAccess', _355 => _355.chartsByWorkbookSheetIndex, 'access', _356 => _356.flat, 'call', _357 => _357(), 'access', _358 => _358.find, 'call', _359 => _359((chart2) => target.path ? chart2.chartPath === target.path : chart2.name === target.name)]);
|
|
3930
|
+
setSelectedChartId(_nullishCoalesce(_optionalChain([chart, 'optionalAccess', _360 => _360.id]), () => ( null)));
|
|
3825
3931
|
setSelectedChartElement(chart ? { kind: "chart", chartId: chart.id } : null);
|
|
3826
3932
|
} else if (target.kind === "image") {
|
|
3827
|
-
const image = _optionalChain([nextAssets, 'optionalAccess',
|
|
3828
|
-
setSelectedImageId(_nullishCoalesce(_optionalChain([image, 'optionalAccess',
|
|
3933
|
+
const image = _optionalChain([nextAssets, 'optionalAccess', _361 => _361.imagesByWorkbookSheetIndex, 'access', _362 => _362.flat, 'call', _363 => _363(), 'access', _364 => _364.find, 'call', _365 => _365((image2) => image2.name === target.name)]);
|
|
3934
|
+
setSelectedImageId(_nullishCoalesce(_optionalChain([image, 'optionalAccess', _366 => _366.id]), () => ( null)));
|
|
3829
3935
|
}
|
|
3830
3936
|
return true;
|
|
3831
3937
|
} catch (cause) {
|
|
@@ -3852,7 +3958,7 @@ function useXlsxViewerController(options2) {
|
|
|
3852
3958
|
const generation = loadGenerationRef.current;
|
|
3853
3959
|
const data = input === void 0 ? (await readBrowserClipboard()).drawing : typeof input === "string" ? decodeExcelDrawingClipboard(input) : input.type.startsWith("image/") ? await imageDrawingClipboard(input) : decodeExcelDrawingClipboard(new Uint8Array(await input.arrayBuffer()));
|
|
3854
3960
|
const latest = drawingMutationState.current;
|
|
3855
|
-
if (!data || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access',
|
|
3961
|
+
if (!data || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _367 => _367.activeCell, 'optionalAccess', _368 => _368.row]) !== _optionalChain([state, 'access', _369 => _369.activeCell, 'optionalAccess', _370 => _370.row]) || _optionalChain([latest, 'access', _371 => _371.activeCell, 'optionalAccess', _372 => _372.col]) !== _optionalChain([state, 'access', _373 => _373.activeCell, 'optionalAccess', _374 => _374.col])) return false;
|
|
3856
3962
|
return pasteDrawing(data);
|
|
3857
3963
|
}, [activeSheet, pasteDrawing, readOnly, workbook]);
|
|
3858
3964
|
const arrangeDrawing = React.useCallback(async (kind, id, order) => {
|
|
@@ -3891,7 +3997,7 @@ function useXlsxViewerController(options2) {
|
|
|
3891
3997
|
const chart = getChartById(id);
|
|
3892
3998
|
const option = chartTypeOptions.find((option2) => option2.id === type);
|
|
3893
3999
|
if (readOnly || !chart || !option || chartTypeUnavailable(chart, option)) return false;
|
|
3894
|
-
if (_optionalChain([chart, 'access',
|
|
4000
|
+
if (_optionalChain([chart, 'access', _375 => _375.raw, 'optionalAccess', _376 => _376.pivotSource])) {
|
|
3895
4001
|
if (!workbook || !chart.name) return false;
|
|
3896
4002
|
commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(workbook.getSheet(chart.workbookSheetIndex).name, chart.name, { chartType: option.chartType }), false);
|
|
3897
4003
|
return true;
|
|
@@ -3927,7 +4033,7 @@ function useXlsxViewerController(options2) {
|
|
|
3927
4033
|
if (readOnly || !currentChart) {
|
|
3928
4034
|
return;
|
|
3929
4035
|
}
|
|
3930
|
-
if (_optionalChain([currentChart, 'access',
|
|
4036
|
+
if (_optionalChain([currentChart, 'access', _377 => _377.raw, 'optionalAccess', _378 => _378.pivotSource])) {
|
|
3931
4037
|
if (!workbook || !currentChart.name) return;
|
|
3932
4038
|
if (Object.keys(patch).some((key) => !["title", "chartType", "anchor"].includes(key))) {
|
|
3933
4039
|
throw new Error("Change PivotChart data through the pivot table field settings.");
|
|
@@ -3959,7 +4065,7 @@ function useXlsxViewerController(options2) {
|
|
|
3959
4065
|
return false;
|
|
3960
4066
|
}
|
|
3961
4067
|
const chart = getChartById(chartId);
|
|
3962
|
-
if (!chart || chart.editable === false || _optionalChain([chart, 'access',
|
|
4068
|
+
if (!chart || chart.editable === false || _optionalChain([chart, 'access', _379 => _379.raw, 'optionalAccess', _380 => _380.pivotSource])) {
|
|
3963
4069
|
return false;
|
|
3964
4070
|
}
|
|
3965
4071
|
const nextChart = _chunkXZJLPW64cjs.applyChartSeriesFormula.call(void 0, chart, seriesIndex, formula, workbook);
|
|
@@ -3981,35 +4087,36 @@ function useXlsxViewerController(options2) {
|
|
|
3981
4087
|
}
|
|
3982
4088
|
return true;
|
|
3983
4089
|
}, [getChartById, readOnly, updateChart, workbook]);
|
|
3984
|
-
const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
4090
|
+
const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _381 => _381.mergedRanges]), () => ( []))), [_optionalChain([activeSheet, 'optionalAccess', _382 => _382.mergedRanges])]);
|
|
3985
4091
|
const selectCell = React.useCallback((cell, options3) => {
|
|
3986
4092
|
const merged = findSelectionMerge(cell);
|
|
3987
|
-
const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess',
|
|
4093
|
+
const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess', _383 => _383.start]), () => ( cell));
|
|
3988
4094
|
setSelectedChartId(null);
|
|
3989
4095
|
setSelectedChartElement(null);
|
|
3990
4096
|
setSelectedImageId(null);
|
|
3991
4097
|
setActiveCell(anchorCell);
|
|
3992
|
-
if (_optionalChain([options3, 'optionalAccess',
|
|
3993
|
-
setSelection(expandHighlightedRange(normalizeRange({ start: selectionAnchorRef.current, end: cell }), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
4098
|
+
if (_optionalChain([options3, 'optionalAccess', _384 => _384.extend]) && selectionAnchorRef.current) {
|
|
4099
|
+
setSelection(expandHighlightedRange(normalizeRange({ start: selectionAnchorRef.current, end: cell }), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _385 => _385.mergedRanges]), () => ( []))));
|
|
3994
4100
|
return;
|
|
3995
4101
|
}
|
|
3996
4102
|
selectionAnchorRef.current = anchorCell;
|
|
3997
4103
|
setSelection(_nullishCoalesce(merged, () => ( { start: cell, end: cell })));
|
|
3998
|
-
}, [_optionalChain([activeSheet, 'optionalAccess',
|
|
4104
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _386 => _386.mergedRanges]), findSelectionMerge]);
|
|
3999
4105
|
const selectRanges = React.useCallback((ranges, activeCorner = "end") => {
|
|
4000
4106
|
const areas = ranges.reduce((previous, range) => addSelectionRange(previous, normalizeRange(range)), []);
|
|
4001
4107
|
const active = areas.at(-1);
|
|
4002
4108
|
setSelectedChartId(null);
|
|
4003
4109
|
setSelectedChartElement(null);
|
|
4004
4110
|
setSelectedImageId(null);
|
|
4005
|
-
selectionAnchorRef.current = _nullishCoalesce(_optionalChain([active, 'optionalAccess',
|
|
4006
|
-
const cell = _optionalChain([active, 'optionalAccess',
|
|
4007
|
-
|
|
4111
|
+
selectionAnchorRef.current = _nullishCoalesce(_optionalChain([active, 'optionalAccess', _387 => _387.start]), () => ( null));
|
|
4112
|
+
const cell = _optionalChain([active, 'optionalAccess', _388 => _388[activeCorner]]);
|
|
4113
|
+
const mergeAnchor = cell && _optionalChain([findSelectionMerge, 'call', _389 => _389(cell), 'optionalAccess', _390 => _390.start]);
|
|
4114
|
+
setActiveCell(mergeAnchor && active && rangeContainsCell(active, mergeAnchor) ? mergeAnchor : _nullishCoalesce(cell, () => ( null)));
|
|
4008
4115
|
setSelectionRanges(areas);
|
|
4009
4116
|
}, [findSelectionMerge]);
|
|
4010
4117
|
const selectRange = React.useCallback((range) => {
|
|
4011
|
-
selectRanges([expandHighlightedRange(normalizeRange(range), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
4012
|
-
}, [_optionalChain([activeSheet, 'optionalAccess',
|
|
4118
|
+
selectRanges([expandHighlightedRange(normalizeRange(range), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _391 => _391.mergedRanges]), () => ( [])))]);
|
|
4119
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _392 => _392.mergedRanges]), selectRanges]);
|
|
4013
4120
|
const clearSelection = React.useCallback(() => {
|
|
4014
4121
|
selectionAnchorRef.current = null;
|
|
4015
4122
|
setActiveCell(null);
|
|
@@ -4158,7 +4265,7 @@ function useXlsxViewerController(options2) {
|
|
|
4158
4265
|
setCellFormula(activeCell, formula);
|
|
4159
4266
|
}, [activeCell, setCellFormula]);
|
|
4160
4267
|
const setSelectedFormula = React.useCallback((formula) => {
|
|
4161
|
-
if (_optionalChain([selectedFormulaTarget, 'optionalAccess',
|
|
4268
|
+
if (_optionalChain([selectedFormulaTarget, 'optionalAccess', _393 => _393.kind]) === "chartSeries") {
|
|
4162
4269
|
return setChartSeriesFormula(selectedFormulaTarget.chartId, selectedFormulaTarget.seriesIndex, formula);
|
|
4163
4270
|
}
|
|
4164
4271
|
if (readOnly || !activeCell || getPivotTableAtCell(activeCell)) {
|
|
@@ -4325,7 +4432,7 @@ function useXlsxViewerController(options2) {
|
|
|
4325
4432
|
return;
|
|
4326
4433
|
}
|
|
4327
4434
|
recordHistoryBeforeMutation();
|
|
4328
|
-
const baseName = _optionalChain([name, 'optionalAccess',
|
|
4435
|
+
const baseName = _optionalChain([name, 'optionalAccess', _394 => _394.trim, 'call', _395 => _395()]) || "Sheet";
|
|
4329
4436
|
let candidate = baseName;
|
|
4330
4437
|
let counter = 2;
|
|
4331
4438
|
while (workbook.sheetIndex(candidate) !== void 0) {
|
|
@@ -4345,11 +4452,11 @@ function useXlsxViewerController(options2) {
|
|
|
4345
4452
|
}
|
|
4346
4453
|
const nextSheets = buildSheetList(
|
|
4347
4454
|
workbook,
|
|
4348
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4349
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4350
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4351
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4352
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4455
|
+
_optionalChain([imageAssetsRef, 'access', _396 => _396.current, 'optionalAccess', _397 => _397.sheetStatesByWorkbookSheetIndex]),
|
|
4456
|
+
_optionalChain([imageAssetsRef, 'access', _398 => _398.current, 'optionalAccess', _399 => _399.themePalette]),
|
|
4457
|
+
_optionalChain([imageAssetsRef, 'access', _400 => _400.current, 'optionalAccess', _401 => _401.styleById]),
|
|
4458
|
+
_optionalChain([imageAssetsRef, 'access', _402 => _402.current, 'optionalAccess', _403 => _403.namedCellStyleByName]),
|
|
4459
|
+
_optionalChain([imageAssetsRef, 'access', _404 => _404.current, 'optionalAccess', _405 => _405.tableStyleByName]),
|
|
4353
4460
|
showHiddenSheets
|
|
4354
4461
|
);
|
|
4355
4462
|
setSheets(nextSheets);
|
|
@@ -4359,7 +4466,7 @@ function useXlsxViewerController(options2) {
|
|
|
4359
4466
|
}
|
|
4360
4467
|
const nextIndex = nextSheets.findIndex((sheet) => sheet.name === candidate);
|
|
4361
4468
|
setActiveSheetIndexState(nextIndex >= 0 ? nextIndex : 0);
|
|
4362
|
-
const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess',
|
|
4469
|
+
const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess', _406 => _406.tabs, 'access', _407 => _407.findIndex, 'call', _408 => _408((tab) => tab.kind === "sheet" && tab.name === candidate)]), () => ( -1));
|
|
4363
4470
|
if (nextTabIndex >= 0) {
|
|
4364
4471
|
setActiveTabIndexState(nextTabIndex);
|
|
4365
4472
|
}
|
|
@@ -4386,11 +4493,11 @@ function useXlsxViewerController(options2) {
|
|
|
4386
4493
|
}
|
|
4387
4494
|
const nextSheets = buildSheetList(
|
|
4388
4495
|
workbook,
|
|
4389
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4390
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4391
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4392
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4393
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4496
|
+
_optionalChain([imageAssetsRef, 'access', _409 => _409.current, 'optionalAccess', _410 => _410.sheetStatesByWorkbookSheetIndex]),
|
|
4497
|
+
_optionalChain([imageAssetsRef, 'access', _411 => _411.current, 'optionalAccess', _412 => _412.themePalette]),
|
|
4498
|
+
_optionalChain([imageAssetsRef, 'access', _413 => _413.current, 'optionalAccess', _414 => _414.styleById]),
|
|
4499
|
+
_optionalChain([imageAssetsRef, 'access', _415 => _415.current, 'optionalAccess', _416 => _416.namedCellStyleByName]),
|
|
4500
|
+
_optionalChain([imageAssetsRef, 'access', _417 => _417.current, 'optionalAccess', _418 => _418.tableStyleByName]),
|
|
4394
4501
|
showHiddenSheets
|
|
4395
4502
|
);
|
|
4396
4503
|
setSheets(nextSheets);
|
|
@@ -4418,7 +4525,7 @@ function useXlsxViewerController(options2) {
|
|
|
4418
4525
|
}, [readOnly, recordHistoryBeforeMutation, selection, selectionRanges, workbook]);
|
|
4419
4526
|
const pasteText = React.useCallback((text) => {
|
|
4420
4527
|
const worksheet = getActiveWorksheet();
|
|
4421
|
-
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess',
|
|
4528
|
+
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _419 => _419.start]))), () => ( null));
|
|
4422
4529
|
if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !text) {
|
|
4423
4530
|
return false;
|
|
4424
4531
|
}
|
|
@@ -4487,7 +4594,7 @@ function useXlsxViewerController(options2) {
|
|
|
4487
4594
|
}, [intersectsPivot, activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, selectionRanges, workbook]);
|
|
4488
4595
|
const pasteStructuredClipboardData = React.useCallback((serializedPayload) => {
|
|
4489
4596
|
const worksheet = getActiveWorksheet();
|
|
4490
|
-
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess',
|
|
4597
|
+
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _420 => _420.start]))), () => ( null));
|
|
4491
4598
|
if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !serializedPayload) {
|
|
4492
4599
|
return false;
|
|
4493
4600
|
}
|
|
@@ -4666,7 +4773,7 @@ function useXlsxViewerController(options2) {
|
|
|
4666
4773
|
const generation = loadGenerationRef.current;
|
|
4667
4774
|
const data = await readBrowserClipboard(clipboardData);
|
|
4668
4775
|
const latest = drawingMutationState.current;
|
|
4669
|
-
if (generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access',
|
|
4776
|
+
if (generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _421 => _421.activeCell, 'optionalAccess', _422 => _422.row]) !== _optionalChain([state, 'access', _423 => _423.activeCell, 'optionalAccess', _424 => _424.row]) || _optionalChain([latest, 'access', _425 => _425.activeCell, 'optionalAccess', _426 => _426.col]) !== _optionalChain([state, 'access', _427 => _427.activeCell, 'optionalAccess', _428 => _428.col])) return false;
|
|
4670
4777
|
if (data.drawing) return pasteDrawing(data.drawing);
|
|
4671
4778
|
if (data.structured && pasteStructuredClipboardData(data.structured)) return true;
|
|
4672
4779
|
return Boolean(data.text) && pasteText(data.text);
|
|
@@ -4824,7 +4931,9 @@ function useXlsxViewerController(options2) {
|
|
|
4824
4931
|
revision,
|
|
4825
4932
|
resizeChartBy,
|
|
4826
4933
|
resizeImageBy,
|
|
4827
|
-
frozenPanes: _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
4934
|
+
frozenPanes: _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _429 => _429.freezePanes]), () => ( null)),
|
|
4935
|
+
canChangeFreezePanes,
|
|
4936
|
+
canChangeVisibility,
|
|
4828
4937
|
canFreezePanes,
|
|
4829
4938
|
hideRows,
|
|
4830
4939
|
unhideRows,
|
|
@@ -4977,6 +5086,8 @@ function useXlsxViewerController(options2) {
|
|
|
4977
5086
|
revision,
|
|
4978
5087
|
resizeChartBy,
|
|
4979
5088
|
resizeImageBy,
|
|
5089
|
+
canChangeFreezePanes,
|
|
5090
|
+
canChangeVisibility,
|
|
4980
5091
|
canFreezePanes,
|
|
4981
5092
|
hideRows,
|
|
4982
5093
|
unhideRows,
|
|
@@ -5074,7 +5185,7 @@ function CellEditor({
|
|
|
5074
5185
|
onNavigate
|
|
5075
5186
|
}) {
|
|
5076
5187
|
const rootRef = React2.useRef(null);
|
|
5077
|
-
const messages =
|
|
5188
|
+
const messages = _chunkUXJAG7MUcjs.useXlsxMessages.call(void 0, );
|
|
5078
5189
|
const mirrorRef = React2.useRef(null);
|
|
5079
5190
|
const textRef = React2.useRef(null);
|
|
5080
5191
|
const baselineRef = React2.useRef(null);
|
|
@@ -5086,8 +5197,8 @@ function CellEditor({
|
|
|
5086
5197
|
const [bounds, setBounds] = React2.useState({ width: 0, height: 0, cellWidth: 0 });
|
|
5087
5198
|
React2.useLayoutEffect(() => {
|
|
5088
5199
|
const root = rootRef.current;
|
|
5089
|
-
const anchor = _optionalChain([root, 'optionalAccess',
|
|
5090
|
-
const viewport = _optionalChain([root, 'optionalAccess',
|
|
5200
|
+
const anchor = _optionalChain([root, 'optionalAccess', _430 => _430.parentElement]);
|
|
5201
|
+
const viewport = _optionalChain([root, 'optionalAccess', _431 => _431.closest, 'call', _432 => _432('[role="grid"]')]);
|
|
5091
5202
|
if (!root || !anchor || !viewport) {
|
|
5092
5203
|
return;
|
|
5093
5204
|
}
|
|
@@ -5144,8 +5255,8 @@ function CellEditor({
|
|
|
5144
5255
|
const canvas = canvasRef.current;
|
|
5145
5256
|
if (canvas && paintCanvasText) {
|
|
5146
5257
|
const dpr = window.devicePixelRatio || 1;
|
|
5147
|
-
const offsetX = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess',
|
|
5148
|
-
const offsetY = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess',
|
|
5258
|
+
const offsetX = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _433 => _433.left]), () => ( 0))) * dpr % 1 / dpr;
|
|
5259
|
+
const offsetY = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _434 => _434.top]), () => ( 0))) * dpr % 1 / dpr;
|
|
5149
5260
|
const width = rootRect.width / scale;
|
|
5150
5261
|
const height = rootRect.height / scale;
|
|
5151
5262
|
canvas.width = Math.ceil((width + offsetX) * dpr);
|
|
@@ -5156,11 +5267,11 @@ function CellEditor({
|
|
|
5156
5267
|
canvas.style.top = `${-offsetY}px`;
|
|
5157
5268
|
const context = canvas.getContext("2d");
|
|
5158
5269
|
if (context) {
|
|
5159
|
-
const node = _optionalChain([plainTextRef, 'access',
|
|
5270
|
+
const node = _optionalChain([plainTextRef, 'access', _435 => _435.current, 'optionalAccess', _436 => _436.firstChild]);
|
|
5160
5271
|
const lines = [];
|
|
5161
5272
|
if (node) {
|
|
5162
5273
|
const range = document.createRange();
|
|
5163
|
-
const length = _nullishCoalesce(_optionalChain([node, 'access',
|
|
5274
|
+
const length = _nullishCoalesce(_optionalChain([node, 'access', _437 => _437.textContent, 'optionalAccess', _438 => _438.length]), () => ( 0));
|
|
5164
5275
|
let start = 0;
|
|
5165
5276
|
while (start < length) {
|
|
5166
5277
|
range.setStart(node, start);
|
|
@@ -5274,7 +5385,7 @@ function CellEditor({
|
|
|
5274
5385
|
onKeyDown: (event) => {
|
|
5275
5386
|
event.stopPropagation();
|
|
5276
5387
|
if (event.nativeEvent.isComposing) return;
|
|
5277
|
-
if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall',
|
|
5388
|
+
if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall', _439 => _439()])) {
|
|
5278
5389
|
event.preventDefault();
|
|
5279
5390
|
} else if (event.key === "Enter" && !event.altKey) {
|
|
5280
5391
|
event.preventDefault();
|
|
@@ -5347,6 +5458,24 @@ function getCellGeneralAlignment(worksheet, row2, col) {
|
|
|
5347
5458
|
}
|
|
5348
5459
|
}
|
|
5349
5460
|
|
|
5461
|
+
// src/hidden-range-marker.tsx
|
|
5462
|
+
|
|
5463
|
+
|
|
5464
|
+
function resizeCursor(axis) {
|
|
5465
|
+
const transform = axis === "column" ? ' transform="rotate(90 12 12)"' : "";
|
|
5466
|
+
const path = "M6 10h12 M6 14h12 M12 7V3 M9 6l3-3 3 3 M12 17v4 M9 18l3 3 3-3";
|
|
5467
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
5468
|
+
<g fill="none" stroke-linecap="round" stroke-linejoin="round"${transform}>
|
|
5469
|
+
<path d="${path}" stroke="white" stroke-width="3.5"/>
|
|
5470
|
+
<path d="${path}" stroke="#111" stroke-width="1.5"/>
|
|
5471
|
+
</g>
|
|
5472
|
+
</svg>`;
|
|
5473
|
+
const fallback = axis === "row" ? "row-resize" : "col-resize";
|
|
5474
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}") 12 12, ${fallback}`;
|
|
5475
|
+
}
|
|
5476
|
+
var ROW_RESIZE_CURSOR = resizeCursor("row");
|
|
5477
|
+
var COLUMN_RESIZE_CURSOR = resizeCursor("column");
|
|
5478
|
+
|
|
5350
5479
|
// src/header-size-dialog.tsx
|
|
5351
5480
|
|
|
5352
5481
|
|
|
@@ -5453,18 +5582,18 @@ function copyPivot(pivot) {
|
|
|
5453
5582
|
function usePivotTableEditor(viewer, options2 = {}) {
|
|
5454
5583
|
const open = viewer.pivotFieldListVisible;
|
|
5455
5584
|
const setOpen = viewer.setPivotFieldListVisible;
|
|
5456
|
-
const [draft, setDraft] =
|
|
5457
|
-
const [dirty, setDirty] =
|
|
5458
|
-
const [error, setError] =
|
|
5459
|
-
const [status, setStatus] =
|
|
5460
|
-
const [details, setDetails] =
|
|
5461
|
-
const [detailContext, setDetailContext] =
|
|
5462
|
-
const [loadedSource, setLoadedSource] =
|
|
5463
|
-
const [savedDefinition, setSavedDefinition] =
|
|
5464
|
-
const [pendingFocus, setPendingFocus] =
|
|
5585
|
+
const [draft, setDraft] = React12.useState(null);
|
|
5586
|
+
const [dirty, setDirty] = React12.useState(false);
|
|
5587
|
+
const [error, setError] = React12.useState(null);
|
|
5588
|
+
const [status, setStatus] = React12.useState(null);
|
|
5589
|
+
const [details, setDetails] = React12.useState(null);
|
|
5590
|
+
const [detailContext, setDetailContext] = React12.useState(null);
|
|
5591
|
+
const [loadedSource, setLoadedSource] = React12.useState("");
|
|
5592
|
+
const [savedDefinition, setSavedDefinition] = React12.useState("");
|
|
5593
|
+
const [pendingFocus, setPendingFocus] = React12.useState(null);
|
|
5465
5594
|
const sourceNeedsLoad = Boolean(draft && JSON.stringify(draft.source) !== loadedSource);
|
|
5466
|
-
const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess',
|
|
5467
|
-
const run =
|
|
5595
|
+
const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess', _440 => _440.id]) && savedDefinition !== JSON.stringify(_nullishCoalesce(viewer.pivotTables.find((pivot) => pivot.id === draft.id), () => ( null))));
|
|
5596
|
+
const run = React12.useCallback((action) => {
|
|
5468
5597
|
setError(null);
|
|
5469
5598
|
setStatus(null);
|
|
5470
5599
|
try {
|
|
@@ -5474,7 +5603,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5474
5603
|
setOpen(true);
|
|
5475
5604
|
}
|
|
5476
5605
|
}, []);
|
|
5477
|
-
|
|
5606
|
+
React12.useEffect(() => {
|
|
5478
5607
|
if (options2.enabled === false) return;
|
|
5479
5608
|
setDraft(null);
|
|
5480
5609
|
setDirty(false);
|
|
@@ -5487,8 +5616,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5487
5616
|
setPendingFocus(null);
|
|
5488
5617
|
if (options2.initialOpen !== void 0) setOpen(options2.initialOpen);
|
|
5489
5618
|
}, [viewer.src, viewer.file]);
|
|
5490
|
-
|
|
5491
|
-
if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess',
|
|
5619
|
+
React12.useEffect(() => {
|
|
5620
|
+
if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess', _441 => _441.id])) return;
|
|
5492
5621
|
const current = viewer.pivotTables.find((pivot) => pivot.id === draft.id);
|
|
5493
5622
|
setDraft(current ? copyPivot(current) : null);
|
|
5494
5623
|
if (current) {
|
|
@@ -5496,22 +5625,22 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5496
5625
|
setSavedDefinition(JSON.stringify(current));
|
|
5497
5626
|
}
|
|
5498
5627
|
}, [viewer.pivotTables]);
|
|
5499
|
-
|
|
5628
|
+
React12.useEffect(() => {
|
|
5500
5629
|
if (options2.enabled === false || options2.autoSelect === false || dirty || pendingFocus || !viewer.activeCell || !viewer.activeSheet) return;
|
|
5501
5630
|
const current = viewer.getPivotTableAtCell(viewer.activeCell, viewer.activeSheet.name);
|
|
5502
|
-
if (!current || current.id === _optionalChain([draft, 'optionalAccess',
|
|
5631
|
+
if (!current || current.id === _optionalChain([draft, 'optionalAccess', _442 => _442.id])) return;
|
|
5503
5632
|
setDraft(copyPivot(current));
|
|
5504
5633
|
setLoadedSource(JSON.stringify(current.source));
|
|
5505
5634
|
setSavedDefinition(JSON.stringify(current));
|
|
5506
5635
|
setError(null);
|
|
5507
5636
|
setStatus(null);
|
|
5508
5637
|
setDetails(null);
|
|
5509
|
-
}, [_optionalChain([viewer, 'access',
|
|
5510
|
-
|
|
5511
|
-
if (!pendingFocus || _optionalChain([viewer, 'access',
|
|
5638
|
+
}, [_optionalChain([viewer, 'access', _443 => _443.activeCell, 'optionalAccess', _444 => _444.row]), _optionalChain([viewer, 'access', _445 => _445.activeCell, 'optionalAccess', _446 => _446.col]), _optionalChain([viewer, 'access', _447 => _447.activeSheet, 'optionalAccess', _448 => _448.name]), viewer.pivotTables, options2.autoSelect, options2.enabled]);
|
|
5639
|
+
React12.useEffect(() => {
|
|
5640
|
+
if (!pendingFocus || _optionalChain([viewer, 'access', _449 => _449.activeSheet, 'optionalAccess', _450 => _450.name, 'access', _451 => _451.toLowerCase, 'call', _452 => _452()]) !== pendingFocus.sheet.toLowerCase()) return;
|
|
5512
5641
|
viewer.selectCell({ row: pendingFocus.row, col: pendingFocus.col });
|
|
5513
5642
|
setPendingFocus(null);
|
|
5514
|
-
}, [pendingFocus, _optionalChain([viewer, 'access',
|
|
5643
|
+
}, [pendingFocus, _optionalChain([viewer, 'access', _453 => _453.activeSheet, 'optionalAccess', _454 => _454.name]), viewer.selectCell]);
|
|
5515
5644
|
const focus = (pivot) => {
|
|
5516
5645
|
const sheetIndex = viewer.sheets.findIndex((sheet) => sheet.name.toLowerCase() === pivot.target.sheet.toLowerCase());
|
|
5517
5646
|
if (sheetIndex >= 0) viewer.setActiveSheetIndex(sheetIndex);
|
|
@@ -5531,7 +5660,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5531
5660
|
focus(pivot);
|
|
5532
5661
|
});
|
|
5533
5662
|
const edit = (change) => {
|
|
5534
|
-
if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess',
|
|
5663
|
+
if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess', _455 => _455.unsupportedFeatures, 'access', _456 => _456.length])) return;
|
|
5535
5664
|
setDraft((current) => current ? change(current) : current);
|
|
5536
5665
|
setDirty(true);
|
|
5537
5666
|
setStatus(null);
|
|
@@ -5582,7 +5711,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5582
5711
|
if (!draft) return;
|
|
5583
5712
|
const fields = viewer.getPivotSourceFields(draft.source);
|
|
5584
5713
|
setLoadedSource(JSON.stringify(draft.source));
|
|
5585
|
-
const sameSchema = fields.length === draft.fields.length && fields.every((field, index) => field.name === _optionalChain([draft, 'access',
|
|
5714
|
+
const sameSchema = fields.length === draft.fields.length && fields.every((field, index) => field.name === _optionalChain([draft, 'access', _457 => _457.fields, 'access', _458 => _458[index], 'optionalAccess', _459 => _459.name]));
|
|
5586
5715
|
edit((pivot) => ({ ...pivot, fields, ...sameSchema ? {} : { rows: [], columns: [], values: [], filters: [], reportFilters: [], calculatedItems: [] } }));
|
|
5587
5716
|
setStatus(sameSchema ? "Source fields updated." : "Fields loaded. Choose the fields to summarize.");
|
|
5588
5717
|
});
|
|
@@ -5604,7 +5733,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5604
5733
|
if (all) {
|
|
5605
5734
|
const refreshed = viewer.refreshAllPivotTables();
|
|
5606
5735
|
setStatus(`${refreshed.length} PivotTable${refreshed.length === 1 ? "" : "s"} refreshed.`);
|
|
5607
|
-
} else if (_optionalChain([draft, 'optionalAccess',
|
|
5736
|
+
} else if (_optionalChain([draft, 'optionalAccess', _460 => _460.id])) {
|
|
5608
5737
|
const refreshed = viewer.refreshPivotTable(draft.id);
|
|
5609
5738
|
setDraft(copyPivot(refreshed));
|
|
5610
5739
|
setLoadedSource(JSON.stringify(refreshed.source));
|
|
@@ -5616,7 +5745,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5616
5745
|
});
|
|
5617
5746
|
const remove = () => run(() => {
|
|
5618
5747
|
if (dirty) throw new Error("Apply or discard your changes before removing the report.");
|
|
5619
|
-
if (!_optionalChain([draft, 'optionalAccess',
|
|
5748
|
+
if (!_optionalChain([draft, 'optionalAccess', _461 => _461.id])) return;
|
|
5620
5749
|
if (viewer.removePivotTable(draft.id)) {
|
|
5621
5750
|
setDraft(null);
|
|
5622
5751
|
setDirty(false);
|
|
@@ -5625,7 +5754,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5625
5754
|
}
|
|
5626
5755
|
});
|
|
5627
5756
|
const reset = () => run(() => {
|
|
5628
|
-
const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess',
|
|
5757
|
+
const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess', _462 => _462.id]));
|
|
5629
5758
|
setDraft(saved ? copyPivot(saved) : null);
|
|
5630
5759
|
setLoadedSource(saved ? JSON.stringify(saved.source) : "");
|
|
5631
5760
|
setSavedDefinition(saved ? JSON.stringify(saved) : "");
|
|
@@ -5633,8 +5762,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5633
5762
|
setDetails(null);
|
|
5634
5763
|
});
|
|
5635
5764
|
const showDetails = () => run(() => {
|
|
5636
|
-
if (!_optionalChain([draft, 'optionalAccess',
|
|
5637
|
-
if (_optionalChain([viewer, 'access',
|
|
5765
|
+
if (!_optionalChain([draft, 'optionalAccess', _463 => _463.id]) || !viewer.activeCell) return;
|
|
5766
|
+
if (_optionalChain([viewer, 'access', _464 => _464.activeSheet, 'optionalAccess', _465 => _465.name, 'access', _466 => _466.toLowerCase, 'call', _467 => _467()]) !== draft.target.sheet.toLowerCase()) throw new Error("Select a value cell inside this PivotTable first.");
|
|
5638
5767
|
setDetails(viewer.pivotDrillDown(draft.id, viewer.activeCell.row, viewer.activeCell.col));
|
|
5639
5768
|
setDetailContext({ id: draft.id, row: viewer.activeCell.row, col: viewer.activeCell.col });
|
|
5640
5769
|
setOpen(true);
|
|
@@ -5674,7 +5803,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5674
5803
|
});
|
|
5675
5804
|
const removeField = (area, index) => edit((pivot) => area === "values" ? replaceValues(pivot, pivot.values.filter((_, position) => position !== index)) : { ...pivot, [area]: pivot[area].filter((_, position) => position !== index) });
|
|
5676
5805
|
const moveField = (fromArea, fromIndex, toArea, toIndex) => {
|
|
5677
|
-
if (fromArea === "values" && toArea !== "values" && _optionalChain([draft, 'optionalAccess',
|
|
5806
|
+
if (fromArea === "values" && toArea !== "values" && _optionalChain([draft, 'optionalAccess', _468 => _468.values, 'access', _469 => _469[fromIndex], 'optionalAccess', _470 => _470.formula, 'optionalAccess', _471 => _471.trim, 'call', _472 => _472()])) {
|
|
5678
5807
|
run(() => {
|
|
5679
5808
|
throw new Error("Calculated fields can only be placed in Values.");
|
|
5680
5809
|
});
|
|
@@ -5682,7 +5811,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5682
5811
|
}
|
|
5683
5812
|
edit((pivot) => {
|
|
5684
5813
|
const entry = pivot[fromArea][fromIndex];
|
|
5685
|
-
if (entry === void 0 || fromArea === "values" && toArea !== "values" && typeof entry === "object" && "formula" in entry && _optionalChain([entry, 'access',
|
|
5814
|
+
if (entry === void 0 || fromArea === "values" && toArea !== "values" && typeof entry === "object" && "formula" in entry && _optionalChain([entry, 'access', _473 => _473.formula, 'optionalAccess', _474 => _474.trim, 'call', _475 => _475()])) return pivot;
|
|
5686
5815
|
if (fromArea === toArea) {
|
|
5687
5816
|
const entries2 = [...pivot[fromArea]];
|
|
5688
5817
|
entries2.splice(fromIndex, 1);
|
|
@@ -5705,7 +5834,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5705
5834
|
return { ...next, [toArea]: entries };
|
|
5706
5835
|
});
|
|
5707
5836
|
};
|
|
5708
|
-
return { viewer, readOnly: viewer.readOnly || Boolean(_optionalChain([draft, 'optionalAccess',
|
|
5837
|
+
return { viewer, readOnly: viewer.readOnly || Boolean(_optionalChain([draft, 'optionalAccess', _476 => _476.unsupportedFeatures, 'access', _477 => _477.length])), open, setOpen, draft, dirty, edit, select, create, apply, reset, remove, refresh, readFields, addField, removeField, moveField, details, detailContext, showDetails, clearDetails: () => {
|
|
5709
5838
|
setDetails(null);
|
|
5710
5839
|
setDetailContext(null);
|
|
5711
5840
|
}, sourceNeedsLoad, stale, error, status, run };
|
|
@@ -5728,16 +5857,16 @@ var row = { display: "flex", alignItems: "center", gap: 6, minWidth: 0 };
|
|
|
5728
5857
|
var hint = { color: "var(--xlsx-pivot-muted)", fontSize: 11, lineHeight: 1.5, margin: 0 };
|
|
5729
5858
|
var control = { boxSizing: "border-box", width: "100%", minWidth: 0, minHeight: 30, border: "1px solid var(--xlsx-pivot-border)", borderRadius: 3, background: "var(--xlsx-pivot-input)", color: "inherit", padding: "4px 7px", font: "inherit" };
|
|
5730
5859
|
function fieldName(pivot, index) {
|
|
5731
|
-
return _nullishCoalesce(_optionalChain([pivot, 'access',
|
|
5860
|
+
return _nullishCoalesce(_optionalChain([pivot, 'access', _478 => _478.fields, 'access', _479 => _479.find, 'call', _480 => _480((field) => field.index === index), 'optionalAccess', _481 => _481.name]), () => ( `Field ${index + 1}`));
|
|
5732
5861
|
}
|
|
5733
5862
|
function fieldIndex(pivot, area, index) {
|
|
5734
|
-
return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access',
|
|
5863
|
+
return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access', _482 => _482[area], 'access', _483 => _483[index], 'optionalAccess', _484 => _484.field]);
|
|
5735
5864
|
}
|
|
5736
5865
|
function sourceFieldIndex(pivot, area, index) {
|
|
5737
|
-
return area === "values" && _optionalChain([pivot, 'access',
|
|
5866
|
+
return area === "values" && _optionalChain([pivot, 'access', _485 => _485.values, 'access', _486 => _486[index], 'optionalAccess', _487 => _487.formula, 'optionalAccess', _488 => _488.trim, 'call', _489 => _489()]) ? void 0 : fieldIndex(pivot, area, index);
|
|
5738
5867
|
}
|
|
5739
5868
|
function groupingUnit(axis) {
|
|
5740
|
-
return _optionalChain([axis, 'optionalAccess',
|
|
5869
|
+
return _optionalChain([axis, 'optionalAccess', _490 => _490.grouping]) ? axis.grouping.kind === "date" ? axis.grouping.unit : axis.grouping.kind : null;
|
|
5741
5870
|
}
|
|
5742
5871
|
function Action({ children: children2, primary, style, ...props }) {
|
|
5743
5872
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...props, style: { ...control, width: "auto", cursor: props.disabled ? "default" : "pointer", opacity: props.disabled ? 0.55 : 1, ...primary ? { background: "var(--xlsx-pivot-accent)", borderColor: "var(--xlsx-pivot-accent)", color: "#fff" } : {}, ...style }, children: children2 });
|
|
@@ -5770,7 +5899,7 @@ function Section({ title, children: children2 }) {
|
|
|
5770
5899
|
] });
|
|
5771
5900
|
}
|
|
5772
5901
|
function Members({ items, selected, onChange, label = "Items" }) {
|
|
5773
|
-
const [search, setSearch] =
|
|
5902
|
+
const [search, setSearch] = React13.useState("");
|
|
5774
5903
|
const visible = items.filter((item) => item.caption.toLocaleLowerCase().includes(search.toLocaleLowerCase()));
|
|
5775
5904
|
const keys = new Set(selected);
|
|
5776
5905
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, gap: 6 }, children: [
|
|
@@ -5804,10 +5933,10 @@ function ValueSettings({ pivot, value, onChange }) {
|
|
|
5804
5933
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5805
5934
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: value.name, onChange: (name) => onChange({ ...value, name }) }),
|
|
5806
5935
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Summarize values by", value: value.aggregation, options: AGGREGATIONS, onChange: (aggregation) => onChange({ ...value, aggregation }) }),
|
|
5807
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Show values as", value: value.showAs, options: SHOW_AS, onChange: (showAs) => onChange({ ...value, showAs, baseField: _nullishCoalesce(value.baseField, () => ( _optionalChain([axes, 'access',
|
|
5936
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Show values as", value: value.showAs, options: SHOW_AS, onChange: (showAs) => onChange({ ...value, showAs, baseField: _nullishCoalesce(value.baseField, () => ( _optionalChain([axes, 'access', _491 => _491[0], 'optionalAccess', _492 => _492.field]))) }) }),
|
|
5808
5937
|
needsBase ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base field", value: value.baseField == null ? "" : String(value.baseField), placeholder: "Choose a field", options: pivot.fields.filter((field) => axes.some((axis) => axis.field === field.index)).map((field) => [String(field.index), field.name]), onChange: (field) => onChange({ ...value, baseField: Number(field), baseGroupingUnit: null, baseItem: null }) }) : null,
|
|
5809
5938
|
needsBase && baseAxes.length > 1 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base grouping level", value: _nullishCoalesce(_nullishCoalesce(value.baseGroupingUnit, () => ( groupingUnit(base))), () => ( "")), options: baseAxes.map((axis) => [_nullishCoalesce(groupingUnit(axis), () => ( "")), axis.name || groupingUnit(axis) || "Source items"]), onChange: (unit) => onChange({ ...value, baseGroupingUnit: unit || null, baseItem: null }) }) : null,
|
|
5810
|
-
needsItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base item", value: _nullishCoalesce(value.baseItem, () => ( "previous")), options: [["previous", "(previous)"], ["next", "(next)"], ...(_optionalChain([base, 'optionalAccess',
|
|
5939
|
+
needsItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base item", value: _nullishCoalesce(value.baseItem, () => ( "previous")), options: [["previous", "(previous)"], ["next", "(next)"], ...(_optionalChain([base, 'optionalAccess', _493 => _493.items, 'optionalAccess', _494 => _494.length]) ? base.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _495 => _495.items]), () => ( []))).map((item) => [item.key, item.caption])], onChange: (baseItem) => onChange({ ...value, baseItem }) }) : null,
|
|
5811
5940
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Number format", value: _nullishCoalesce(value.numberFormat, () => ( "")), placeholder: "General", onChange: (numberFormat) => onChange({ ...value, numberFormat: numberFormat || null }) }),
|
|
5812
5941
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Calculated field formula", value: _nullishCoalesce(value.formula, () => ( "")), placeholder: "Leave blank for a source field", onChange: (formula) => onChange({ ...value, formula: formula || null }) }),
|
|
5813
5942
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Use field names in formulas. Enclose names containing spaces in single quotes or square brackets." }),
|
|
@@ -5818,20 +5947,20 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
|
5818
5947
|
const source = pivot.fields.find((field) => field.index === axis.field);
|
|
5819
5948
|
const grouping = axis.grouping;
|
|
5820
5949
|
const updateGrouping = (patch) => onChange({ ...axis, grouping: { ...grouping, ...patch }, items: [], collapsed: [] });
|
|
5821
|
-
const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && _optionalChain([field, 'access',
|
|
5950
|
+
const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && _optionalChain([field, 'access', _496 => _496.grouping, 'optionalAccess', _497 => _497.kind]) === "date" && field.grouping.unit === unit));
|
|
5822
5951
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: _nullishCoalesce(axis.name, () => ( "")), placeholder: _optionalChain([source, 'optionalAccess',
|
|
5952
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: _nullishCoalesce(axis.name, () => ( "")), placeholder: _optionalChain([source, 'optionalAccess', _498 => _498.name]), onChange: (name) => onChange({ ...axis, name: name || null }) }),
|
|
5824
5953
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Sort", value: axis.sort, options: [["ascending", "Ascending (A to Z)"], ["descending", "Descending (Z to A)"], ["manual", "Source order"], ["valueAscending", "Smallest to largest by value"], ["valueDescending", "Largest to smallest by value"]], onChange: (sort) => onChange({ ...axis, sort, sortMeasure: _nullishCoalesce(axis.sortMeasure, () => ( 0)) }) }),
|
|
5825
5954
|
axis.sort.startsWith("value") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Sort by value", value: String(_nullishCoalesce(axis.sortMeasure, () => ( 0))), options: pivot.values.map((value, index) => [String(index), value.name]), onChange: (sortMeasure) => onChange({ ...axis, sortMeasure: Number(sortMeasure) }) }) : null,
|
|
5826
5955
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show subtotals", checked: axis.subtotals, onChange: (subtotals) => onChange({ ...axis, subtotals }) }),
|
|
5827
5956
|
axis.subtotals ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
|
|
5828
5957
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Custom subtotal functions" }),
|
|
5829
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 3, marginTop: 6 }, children: AGGREGATIONS.map(([value, label]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label, checked: _nullishCoalesce(_optionalChain([axis, 'access',
|
|
5958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 3, marginTop: 6 }, children: AGGREGATIONS.map(([value, label]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label, checked: _nullishCoalesce(_optionalChain([axis, 'access', _499 => _499.subtotalFunctions, 'optionalAccess', _500 => _500.includes, 'call', _501 => _501(value)]), () => ( false)), onChange: (checked) => onChange({ ...axis, subtotalFunctions: checked ? [..._nullishCoalesce(axis.subtotalFunctions, () => ( [])), value] : _optionalChain([axis, 'access', _502 => _502.subtotalFunctions, 'optionalAccess', _503 => _503.filter, 'call', _504 => _504((item) => item !== value)]) }) }, value)) }),
|
|
5830
5959
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Leave unchecked to use the value field\u2019s summary function." })
|
|
5831
5960
|
] }) : null,
|
|
5832
5961
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show items with no data", checked: _nullishCoalesce(axis.showItemsWithNoData, () => ( false)), onChange: (showItemsWithNoData) => onChange({ ...axis, showItemsWithNoData }) }),
|
|
5833
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Grouping", value: _nullishCoalesce(_optionalChain([grouping, 'optionalAccess',
|
|
5834
|
-
_optionalChain([grouping, 'optionalAccess',
|
|
5962
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Grouping", value: _nullishCoalesce(_optionalChain([grouping, 'optionalAccess', _505 => _505.kind]), () => ( "none")), options: [["none", "None"], ["number", "Numeric intervals"], ["date", "Date intervals"], ["manual", "Named groups"]], onChange: (kind) => onChange({ ...axis, grouping: kind === "none" ? null : { kind, unit: "months", interval: 1, groups: [] }, items: [], collapsed: [] }) }),
|
|
5963
|
+
_optionalChain([grouping, 'optionalAccess', _506 => _506.kind]) === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Group dates by", value: grouping.unit, options: DATE_UNITS.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => updateGrouping({ unit }) }) : null,
|
|
5835
5964
|
grouping && grouping.kind !== "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5836
5965
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Interval", type: "number", min: 1e-6, step: "any", value: String(grouping.interval), onChange: (interval) => updateGrouping({ interval: Number(interval) }) }),
|
|
5837
5966
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
@@ -5840,18 +5969,18 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
|
5840
5969
|
] }),
|
|
5841
5970
|
grouping.kind === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Optional bounds use Excel date serial values." }) : null
|
|
5842
5971
|
] }) : null,
|
|
5843
|
-
_optionalChain([grouping, 'optionalAccess',
|
|
5844
|
-
_optionalChain([grouping, 'optionalAccess',
|
|
5972
|
+
_optionalChain([grouping, 'optionalAccess', _507 => _507.kind]) === "date" && availableUnits.length ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Add date grouping level", value: "", placeholder: "Choose a level", options: availableUnits.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => onAddDateLevel(unit) }) : null,
|
|
5973
|
+
_optionalChain([grouping, 'optionalAccess', _508 => _508.kind]) === "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5845
5974
|
grouping.groups.map((group, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, borderTop: "1px solid var(--xlsx-pivot-border)", paddingTop: 8 }, children: [
|
|
5846
5975
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Group name", value: group.name, onChange: (name) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, name } : item) }) }),
|
|
5847
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
5976
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: _nullishCoalesce(_optionalChain([source, 'optionalAccess', _509 => _509.items]), () => ( [])), selected: group.members, onChange: (members) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, members } : item) }) }),
|
|
5848
5977
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: grouping.groups.filter((_, position) => position !== index) }), children: "Remove group" })
|
|
5849
5978
|
] }, index)),
|
|
5850
5979
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: [...grouping.groups, { name: `Group ${grouping.groups.length + 1}`, members: [] }] }), children: "Add named group" })
|
|
5851
5980
|
] }) : null,
|
|
5852
5981
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
|
|
5853
5982
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Collapse members" }),
|
|
5854
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { paddingTop: 8 }, children: grouping && !_optionalChain([axis, 'access',
|
|
5983
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { paddingTop: 8 }, children: grouping && !_optionalChain([axis, 'access', _510 => _510.items, 'optionalAccess', _511 => _511.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping to load its members." }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { label: "Members to collapse", items: _optionalChain([axis, 'access', _512 => _512.items, 'optionalAccess', _513 => _513.length]) ? axis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _514 => _514.items]), () => ( [])), selected: axis.collapsed, onChange: (collapsed) => onChange({ ...axis, collapsed }) }) })
|
|
5855
5984
|
] })
|
|
5856
5985
|
] });
|
|
5857
5986
|
}
|
|
@@ -5859,7 +5988,7 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5859
5988
|
const source = pivot.fields.find((item) => item.index === field);
|
|
5860
5989
|
const filterAxis = _nullishCoalesce(axis, () => ( [...pivot.rows, ...pivot.columns].find((item) => item.field === field && item.grouping)));
|
|
5861
5990
|
const unit = groupingUnit(filterAxis);
|
|
5862
|
-
const members = _optionalChain([filterAxis, 'optionalAccess',
|
|
5991
|
+
const members = _optionalChain([filterAxis, 'optionalAccess', _515 => _515.items, 'optionalAccess', _516 => _516.length]) ? filterAxis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _517 => _517.items]), () => ( []));
|
|
5863
5992
|
const filters = pivot.filters.map((filter, index) => ({ filter, index })).filter(({ filter }) => filter.field === field && (_nullishCoalesce(filter.groupingUnit, () => ( null))) === unit);
|
|
5864
5993
|
const kinds = [["members", "Select items"], ["label", "Label filter"], ["value", "Value filter"], ["top10", "Top / bottom filter"]];
|
|
5865
5994
|
const update = (index, next) => editor.edit((current) => ({ ...current, filters: current.filters.flatMap((filter, position) => position === index ? next ? [next] : [] : [filter]) }));
|
|
@@ -5868,10 +5997,10 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5868
5997
|
"Field filters",
|
|
5869
5998
|
unit ? ` \xB7 ${unit}` : ""
|
|
5870
5999
|
] }),
|
|
5871
|
-
_optionalChain([filterAxis, 'optionalAccess',
|
|
6000
|
+
_optionalChain([filterAxis, 'optionalAccess', _518 => _518.grouping]) && !_optionalChain([filterAxis, 'access', _519 => _519.items, 'optionalAccess', _520 => _520.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping before selecting its members." }) : null,
|
|
5872
6001
|
filters.map(({ filter, index }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, paddingBlock: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5873
6002
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
5874
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _optionalChain([kinds, 'access',
|
|
6003
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _optionalChain([kinds, 'access', _521 => _521.find, 'call', _522 => _522(([kind]) => kind === filter.kind), 'optionalAccess', _523 => _523[1]]) }),
|
|
5875
6004
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { "aria-label": `Remove ${filter.kind} filter`, onClick: () => update(index, null), children: "\xD7" })
|
|
5876
6005
|
] }),
|
|
5877
6006
|
filter.kind === "members" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: members, selected: filter.values, onChange: (values) => update(index, { ...filter, values }) }) : null,
|
|
@@ -5891,13 +6020,13 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5891
6020
|
] });
|
|
5892
6021
|
}
|
|
5893
6022
|
function Advanced({ editor, pivot }) {
|
|
5894
|
-
const [chartType, setChartType] =
|
|
5895
|
-
const [chartCell, setChartCell] =
|
|
5896
|
-
const [chartTitle, setChartTitle] =
|
|
5897
|
-
const [chartMeasure, setChartMeasure] =
|
|
5898
|
-
const [chartSheet, setChartSheet] =
|
|
5899
|
-
const [chartWidth, setChartWidth] =
|
|
5900
|
-
const [chartHeight, setChartHeight] =
|
|
6023
|
+
const [chartType, setChartType] = React13.useState("ColumnClustered");
|
|
6024
|
+
const [chartCell, setChartCell] = React13.useState("I2");
|
|
6025
|
+
const [chartTitle, setChartTitle] = React13.useState("");
|
|
6026
|
+
const [chartMeasure, setChartMeasure] = React13.useState("");
|
|
6027
|
+
const [chartSheet, setChartSheet] = React13.useState("");
|
|
6028
|
+
const [chartWidth, setChartWidth] = React13.useState("560");
|
|
6029
|
+
const [chartHeight, setChartHeight] = React13.useState("340");
|
|
5901
6030
|
const update = (patch) => editor.edit((current) => ({ ...current, ...patch }));
|
|
5902
6031
|
const sheets = editor.viewer.sheets.map((sheet) => [sheet.name, sheet.name]);
|
|
5903
6032
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
@@ -5931,10 +6060,10 @@ function Advanced({ editor, pivot }) {
|
|
|
5931
6060
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Formula", value: item.formula, onChange: (formula) => update({ calculatedItems: pivot.calculatedItems.map((entry, position) => position === index ? { ...entry, formula } : entry) }) }),
|
|
5932
6061
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => update({ calculatedItems: pivot.calculatedItems.filter((_, position) => position !== index) }), children: "Remove calculated item" })
|
|
5933
6062
|
] }, index)),
|
|
5934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: _nullishCoalesce(_optionalChain([pivot, 'access',
|
|
6063
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: _nullishCoalesce(_optionalChain([pivot, 'access', _524 => _524.rows, 'access', _525 => _525[0], 'optionalAccess', _526 => _526.field]), () => ( pivot.fields[0].index)), name: `Calculated item ${pivot.calculatedItems.length + 1}`, formula: "0" }] }), children: "Add calculated item" })
|
|
5935
6064
|
] }),
|
|
5936
6065
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Section, { title: "PivotChart", children: [
|
|
5937
|
-
_optionalChain([pivot, 'access',
|
|
6066
|
+
_optionalChain([pivot, 'access', _527 => _527.charts, 'optionalAccess', _528 => _528.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
|
|
5938
6067
|
pivot.charts.length,
|
|
5939
6068
|
" linked chart",
|
|
5940
6069
|
pivot.charts.length === 1 ? "" : "s",
|
|
@@ -5958,22 +6087,22 @@ function Advanced({ editor, pivot }) {
|
|
|
5958
6087
|
] });
|
|
5959
6088
|
}
|
|
5960
6089
|
function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, style }) {
|
|
5961
|
-
const paneRef =
|
|
5962
|
-
const [placement, setPlacement] =
|
|
5963
|
-
const [search, setSearch] =
|
|
5964
|
-
const [selected, setSelected] =
|
|
5965
|
-
const [dragOver, setDragOver] =
|
|
5966
|
-
const [announcement, setAnnouncement] =
|
|
5967
|
-
const titleId =
|
|
5968
|
-
const settingsId =
|
|
6090
|
+
const paneRef = React13.useRef(null);
|
|
6091
|
+
const [placement, setPlacement] = React13.useState({ overlay: false, top: 0, width: 324 });
|
|
6092
|
+
const [search, setSearch] = React13.useState("");
|
|
6093
|
+
const [selected, setSelected] = React13.useState(null);
|
|
6094
|
+
const [dragOver, setDragOver] = React13.useState(null);
|
|
6095
|
+
const [announcement, setAnnouncement] = React13.useState("");
|
|
6096
|
+
const titleId = React13.useId();
|
|
6097
|
+
const settingsId = React13.useId();
|
|
5969
6098
|
const pivot = editor.draft;
|
|
5970
|
-
const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess',
|
|
5971
|
-
|
|
6099
|
+
const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess', _529 => _529.unsupportedFeatures, 'access', _530 => _530.length])) || editor.sourceNeedsLoad;
|
|
6100
|
+
React13.useEffect(() => {
|
|
5972
6101
|
setSelected(null);
|
|
5973
6102
|
setSearch("");
|
|
5974
|
-
}, [_optionalChain([pivot, 'optionalAccess',
|
|
5975
|
-
|
|
5976
|
-
const parent = _optionalChain([paneRef, 'access',
|
|
6103
|
+
}, [_optionalChain([pivot, 'optionalAccess', _531 => _531.id])]);
|
|
6104
|
+
React13.useEffect(() => {
|
|
6105
|
+
const parent = _optionalChain([paneRef, 'access', _532 => _532.current, 'optionalAccess', _533 => _533.parentElement]);
|
|
5977
6106
|
if (!parent) return;
|
|
5978
6107
|
const viewer = parent.closest(".react-xlsx-viewer");
|
|
5979
6108
|
const measure = () => {
|
|
@@ -5983,16 +6112,16 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
5983
6112
|
};
|
|
5984
6113
|
measure();
|
|
5985
6114
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
5986
|
-
_optionalChain([observer, 'optionalAccess',
|
|
5987
|
-
if (viewer) _optionalChain([observer, 'optionalAccess',
|
|
6115
|
+
_optionalChain([observer, 'optionalAccess', _534 => _534.observe, 'call', _535 => _535(parent)]);
|
|
6116
|
+
if (viewer) _optionalChain([observer, 'optionalAccess', _536 => _536.observe, 'call', _537 => _537(viewer)]);
|
|
5988
6117
|
window.addEventListener("resize", measure);
|
|
5989
6118
|
return () => {
|
|
5990
|
-
_optionalChain([observer, 'optionalAccess',
|
|
6119
|
+
_optionalChain([observer, 'optionalAccess', _538 => _538.disconnect, 'call', _539 => _539()]);
|
|
5991
6120
|
window.removeEventListener("resize", measure);
|
|
5992
6121
|
};
|
|
5993
6122
|
}, []);
|
|
5994
6123
|
const selectedField = pivot && selected ? fieldIndex(pivot, selected.area, selected.index) : void 0;
|
|
5995
|
-
const selectedCalculated = Boolean(pivot && _optionalChain([selected, 'optionalAccess',
|
|
6124
|
+
const selectedCalculated = Boolean(pivot && _optionalChain([selected, 'optionalAccess', _540 => _540.area]) === "values" && _optionalChain([pivot, 'access', _541 => _541.values, 'access', _542 => _542[selected.index], 'optionalAccess', _543 => _543.formula, 'optionalAccess', _544 => _544.trim, 'call', _545 => _545()]));
|
|
5996
6125
|
const theme = {
|
|
5997
6126
|
"--xlsx-pivot-bg": isDark ? "#242729" : "#fafbfa",
|
|
5998
6127
|
"--xlsx-pivot-input": isDark ? "#303437" : "#ffffff",
|
|
@@ -6002,7 +6131,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6002
6131
|
"--xlsx-pivot-hover": isDark ? "#35483d" : "#edf5ef"
|
|
6003
6132
|
};
|
|
6004
6133
|
const move = (from, to, index) => {
|
|
6005
|
-
if (from.area === "values" && to !== "values" && _optionalChain([pivot, 'optionalAccess',
|
|
6134
|
+
if (from.area === "values" && to !== "values" && _optionalChain([pivot, 'optionalAccess', _546 => _546.values, 'access', _547 => _547[from.index], 'optionalAccess', _548 => _548.formula, 'optionalAccess', _549 => _549.trim, 'call', _550 => _550()])) {
|
|
6006
6135
|
setAnnouncement("Calculated fields stay in the Values area.");
|
|
6007
6136
|
return;
|
|
6008
6137
|
}
|
|
@@ -6017,7 +6146,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6017
6146
|
if (disabled) return;
|
|
6018
6147
|
try {
|
|
6019
6148
|
const data = JSON.parse(event.dataTransfer.getData(DRAG_TYPE));
|
|
6020
|
-
if ("field" in data && Number.isInteger(data.field) && _optionalChain([pivot, 'optionalAccess',
|
|
6149
|
+
if ("field" in data && Number.isInteger(data.field) && _optionalChain([pivot, 'optionalAccess', _551 => _551.fields, 'access', _552 => _552.some, 'call', _553 => _553((field) => field.index === data.field)])) {
|
|
6021
6150
|
editor.addField(area, data.field);
|
|
6022
6151
|
setAnnouncement(`Field added to ${AREA_NAMES[area]}.`);
|
|
6023
6152
|
} else if ("area" in data && AREAS.includes(data.area) && Number.isInteger(data.index) && pivot && data.index >= 0 && data.index < pivot[data.area].length) move(data, area, index);
|
|
@@ -6037,14 +6166,14 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6037
6166
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { overflowY: "auto", flex: 1, minHeight: 0 }, children: [
|
|
6038
6167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, padding: 12 }, children: [
|
|
6039
6168
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, alignItems: "end" }, children: [
|
|
6040
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "PivotTable", value: _nullishCoalesce(_optionalChain([pivot, 'optionalAccess',
|
|
6169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "PivotTable", value: _nullishCoalesce(_optionalChain([pivot, 'optionalAccess', _554 => _554.id]), () => ( "")), placeholder: pivot && !pivot.id ? pivot.name : "Choose a PivotTable", options: editor.viewer.pivotTables.map((item) => [item.id, item.name]), onChange: editor.select, disabled: editor.dirty }) }),
|
|
6041
6170
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: editor.viewer.readOnly || editor.dirty, onClick: editor.create, children: "New" })
|
|
6042
6171
|
] }),
|
|
6043
6172
|
editor.error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "alert", style: { margin: 0, color: isDark ? "#ffb7b0" : "#a12622", overflowWrap: "anywhere" }, children: editor.error }) : null,
|
|
6044
6173
|
editor.status ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", style: hint, children: editor.status }) : null,
|
|
6045
6174
|
editor.stale ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "alert", style: hint, children: "The worksheet changed while you were editing. Discard these changes to load the current PivotTable." }) : null,
|
|
6046
6175
|
editor.sourceNeedsLoad ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", style: hint, children: "The source changed. Load its fields under Source and location." }) : null,
|
|
6047
|
-
_optionalChain([pivot, 'optionalAccess',
|
|
6176
|
+
_optionalChain([pivot, 'optionalAccess', _555 => _555.unsupportedFeatures, 'access', _556 => _556.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
|
|
6048
6177
|
"This PivotTable is preserved for Excel. Editing is unavailable for: ",
|
|
6049
6178
|
pivot.unsupportedFeatures.join(", "),
|
|
6050
6179
|
"."
|
|
@@ -6086,7 +6215,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6086
6215
|
pivot[area].map((_, index) => {
|
|
6087
6216
|
const field = fieldIndex(pivot, area, index);
|
|
6088
6217
|
const name = area === "values" ? pivot.values[index].name : area === "reportFilters" ? fieldName(pivot, field) : pivot[area][index].name || fieldName(pivot, field);
|
|
6089
|
-
const active = _optionalChain([selected, 'optionalAccess',
|
|
6218
|
+
const active = _optionalChain([selected, 'optionalAccess', _557 => _557.area]) === area && selected.index === index;
|
|
6090
6219
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { draggable: !disabled, onDragStart: (event) => drag(event, { area, index }), onDrop: (event) => drop(event, area, index), style: { marginBottom: 3 }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", "aria-expanded": active, "aria-controls": settingsId, title: `${name} settings. Alt+Up or Alt+Down reorders the field.`, onClick: () => setSelected(active ? null : { area, index }), onKeyDown: (event) => {
|
|
6091
6220
|
if (!event.altKey || !["ArrowUp", "ArrowDown"].includes(event.key)) return;
|
|
6092
6221
|
event.preventDefault();
|
|
@@ -6202,7 +6331,7 @@ function createChartModule(importModule) {
|
|
|
6202
6331
|
};
|
|
6203
6332
|
}
|
|
6204
6333
|
var officeChartRenderer = createChartModule(async () => {
|
|
6205
|
-
const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-
|
|
6334
|
+
const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-QIS7OPL3.cjs")));
|
|
6206
6335
|
return { renderer: null, SharedChartSvg };
|
|
6207
6336
|
});
|
|
6208
6337
|
|
|
@@ -6746,7 +6875,7 @@ function parseCanvasGradientStops(value) {
|
|
|
6746
6875
|
if (!match) {
|
|
6747
6876
|
return null;
|
|
6748
6877
|
}
|
|
6749
|
-
const color = _optionalChain([match, 'access',
|
|
6878
|
+
const color = _optionalChain([match, 'access', _558 => _558[1], 'optionalAccess', _559 => _559.trim, 'call', _560 => _560()]);
|
|
6750
6879
|
const percent = match[2] ? Number.parseFloat(match[2]) : Number.NaN;
|
|
6751
6880
|
if (!color) {
|
|
6752
6881
|
return null;
|
|
@@ -6762,7 +6891,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
|
|
|
6762
6891
|
if (linearMatch) {
|
|
6763
6892
|
const parts = splitCssGradientArgs(_nullishCoalesce(linearMatch[1], () => ( "")));
|
|
6764
6893
|
if (parts.length >= 2) {
|
|
6765
|
-
const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access',
|
|
6894
|
+
const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _561 => _561[0], 'optionalAccess', _562 => _562.trim, 'call', _563 => _563()]), () => ( "180deg"));
|
|
6766
6895
|
const angleMatch = rawAngle.match(/(-?\d*\.?\d+)deg/i);
|
|
6767
6896
|
const cssAngle = angleMatch ? Number.parseFloat(_nullishCoalesce(angleMatch[1], () => ( "180"))) : 180;
|
|
6768
6897
|
const radians = (90 - cssAngle) * Math.PI / 180;
|
|
@@ -6792,7 +6921,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
|
|
|
6792
6921
|
const radialMatch = backgroundImage.match(/^radial-gradient\((.*)\)$/i);
|
|
6793
6922
|
if (radialMatch) {
|
|
6794
6923
|
const parts = splitCssGradientArgs(_nullishCoalesce(radialMatch[1], () => ( "")));
|
|
6795
|
-
const stopParts = _optionalChain([parts, 'access',
|
|
6924
|
+
const stopParts = _optionalChain([parts, 'access', _564 => _564[0], 'optionalAccess', _565 => _565.startsWith, 'call', _566 => _566("circle")]) ? parts.slice(1) : parts;
|
|
6796
6925
|
const gradient = context.createRadialGradient(
|
|
6797
6926
|
rect.left + rect.width / 2,
|
|
6798
6927
|
rect.top + rect.height / 2,
|
|
@@ -6901,8 +7030,8 @@ function lightenColor(color, ratio) {
|
|
|
6901
7030
|
function darkenColor(color, ratio) {
|
|
6902
7031
|
return mixRgbColor(color, "#000000", ratio);
|
|
6903
7032
|
}
|
|
6904
|
-
var ViewerContext =
|
|
6905
|
-
var ViewerAppearanceContext =
|
|
7033
|
+
var ViewerContext = React16.createContext(null);
|
|
7034
|
+
var ViewerAppearanceContext = React16.createContext({ isDark: false });
|
|
6906
7035
|
function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
|
|
6907
7036
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: [top && "top", bottom && "bottom"].flatMap((vertical) => vertical ? [left && "left", right && "right"].map((horizontal) => horizontal ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
|
|
6908
7037
|
position: "absolute",
|
|
@@ -6918,7 +7047,7 @@ function resolveDarkModeSurface(themePalette, palette) {
|
|
|
6918
7047
|
return "hsl(225 4% 6%)";
|
|
6919
7048
|
}
|
|
6920
7049
|
function resolveSheetSurface(sheet, palette) {
|
|
6921
|
-
return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess',
|
|
7050
|
+
return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _567 => _567.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _568 => _568.themePalette, 'access', _569 => _569.colorsByIndex, 'access', _570 => _570[0]]), () => ( SHEET_SURFACE));
|
|
6922
7051
|
}
|
|
6923
7052
|
function normalizeRange2(range) {
|
|
6924
7053
|
return {
|
|
@@ -6949,7 +7078,7 @@ function buildVisibleAxisIndices(precomputed, displayLimit, maxUsedIndex, hidden
|
|
|
6949
7078
|
const visible = precomputed.filter((index) => index < displayLimit);
|
|
6950
7079
|
const appendStart = precomputed.length ? Math.max(0, maxUsedIndex + 1) : 0;
|
|
6951
7080
|
for (let index = appendStart; index < displayLimit; index++) {
|
|
6952
|
-
if (!_optionalChain([hiddenIndices, 'optionalAccess',
|
|
7081
|
+
if (!_optionalChain([hiddenIndices, 'optionalAccess', _571 => _571.has, 'call', _572 => _572(index)])) visible.push(index);
|
|
6953
7082
|
}
|
|
6954
7083
|
return visible;
|
|
6955
7084
|
}
|
|
@@ -6982,7 +7111,7 @@ function clampPercent(value, fallback) {
|
|
|
6982
7111
|
return Math.max(0, Math.min(100, value));
|
|
6983
7112
|
}
|
|
6984
7113
|
function resolveShapeAdjustment(shape, name, fallback) {
|
|
6985
|
-
const rawValue = _optionalChain([shape, 'access',
|
|
7114
|
+
const rawValue = _optionalChain([shape, 'access', _573 => _573.geometryAdjustments, 'optionalAccess', _574 => _574[name]]);
|
|
6986
7115
|
if (typeof rawValue !== "number") {
|
|
6987
7116
|
return fallback;
|
|
6988
7117
|
}
|
|
@@ -7868,7 +7997,7 @@ function applyCanvasShapeDash(context, dash, lineWidth) {
|
|
|
7868
7997
|
}
|
|
7869
7998
|
}
|
|
7870
7999
|
function useViewerPalette(isDark = false, headerBackgroundColor, headerTextColor) {
|
|
7871
|
-
return
|
|
8000
|
+
return React16.useMemo(
|
|
7872
8001
|
() => resolveViewerPalette(isDark, headerBackgroundColor, headerTextColor),
|
|
7873
8002
|
[headerBackgroundColor, headerTextColor, isDark]
|
|
7874
8003
|
);
|
|
@@ -7882,8 +8011,8 @@ function normalizeThumbnailResolution(resolution) {
|
|
|
7882
8011
|
}
|
|
7883
8012
|
const resolvedObject = typeof resolution === "object" && resolution ? resolution : void 0;
|
|
7884
8013
|
return {
|
|
7885
|
-
maxHeight: _optionalChain([resolvedObject, 'optionalAccess',
|
|
7886
|
-
maxWidth: _optionalChain([resolvedObject, 'optionalAccess',
|
|
8014
|
+
maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _575 => _575.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
|
|
8015
|
+
maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _576 => _576.maxWidth]) && Number.isFinite(resolvedObject.maxWidth) && resolvedObject.maxWidth > 0 ? resolvedObject.maxWidth : THUMBNAIL_DEFAULT_MAX_DIMENSION
|
|
7887
8016
|
};
|
|
7888
8017
|
}
|
|
7889
8018
|
function resolveThumbnailOutputSize(sourceWidth, sourceHeight, resolution) {
|
|
@@ -8202,24 +8331,24 @@ function escapeCssFontFamily(name) {
|
|
|
8202
8331
|
return /[\s"'(),]/.test(name) ? `"${name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : name;
|
|
8203
8332
|
}
|
|
8204
8333
|
function resolveSpreadsheetThemeFont(font, themePalette) {
|
|
8205
|
-
const scheme = typeof _optionalChain([font, 'optionalAccess',
|
|
8334
|
+
const scheme = typeof _optionalChain([font, 'optionalAccess', _577 => _577.scheme]) === "string" ? font.scheme : null;
|
|
8206
8335
|
if (scheme === "major") {
|
|
8207
|
-
return _optionalChain([themePalette, 'optionalAccess',
|
|
8336
|
+
return _optionalChain([themePalette, 'optionalAccess', _578 => _578.majorLatinFont]);
|
|
8208
8337
|
}
|
|
8209
8338
|
if (scheme === "minor") {
|
|
8210
|
-
return _optionalChain([themePalette, 'optionalAccess',
|
|
8339
|
+
return _optionalChain([themePalette, 'optionalAccess', _579 => _579.minorLatinFont]);
|
|
8211
8340
|
}
|
|
8212
8341
|
return void 0;
|
|
8213
8342
|
}
|
|
8214
8343
|
function buildSpreadsheetFontFamily(font, themePalette) {
|
|
8215
8344
|
const candidates = [
|
|
8216
|
-
typeof _optionalChain([font, 'optionalAccess',
|
|
8217
|
-
_nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call',
|
|
8345
|
+
typeof _optionalChain([font, 'optionalAccess', _580 => _580.name]) === "string" ? font.name.trim() : "",
|
|
8346
|
+
_nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _581 => _581(font, themePalette), 'optionalAccess', _582 => _582.trim, 'call', _583 => _583()]), () => ( ""))
|
|
8218
8347
|
].filter((value, index, array) => value.length > 0 && array.indexOf(value) === index);
|
|
8219
8348
|
if (candidates.length === 0) {
|
|
8220
8349
|
return void 0;
|
|
8221
8350
|
}
|
|
8222
|
-
const primaryFont = _optionalChain([candidates, 'access',
|
|
8351
|
+
const primaryFont = _optionalChain([candidates, 'access', _584 => _584[0], 'optionalAccess', _585 => _585.toLowerCase, 'call', _586 => _586()]);
|
|
8223
8352
|
if (primaryFont === "calibri") {
|
|
8224
8353
|
return [
|
|
8225
8354
|
"Calibri",
|
|
@@ -8252,17 +8381,17 @@ function resolveSpreadsheetLineHeight(fontSizePt) {
|
|
|
8252
8381
|
}
|
|
8253
8382
|
function buildGridlineShadow(color, options2) {
|
|
8254
8383
|
const parts = [];
|
|
8255
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8384
|
+
if (_optionalChain([options2, 'optionalAccess', _587 => _587.right]) !== false) {
|
|
8256
8385
|
parts.push(`inset -1px 0 0 ${color}`);
|
|
8257
8386
|
}
|
|
8258
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8387
|
+
if (_optionalChain([options2, 'optionalAccess', _588 => _588.bottom]) !== false) {
|
|
8259
8388
|
parts.push(`inset 0 -1px 0 ${color}`);
|
|
8260
8389
|
}
|
|
8261
8390
|
return parts.join(", ");
|
|
8262
8391
|
}
|
|
8263
8392
|
function buildCellStyle(style, palette, themePalette, options2) {
|
|
8264
|
-
const showGridLines = _nullishCoalesce(_optionalChain([options2, 'optionalAccess',
|
|
8265
|
-
const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
8393
|
+
const showGridLines = _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _589 => _589.showGridLines]), () => ( true));
|
|
8394
|
+
const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _590 => _590.colorsByIndex, 'access', _591 => _591[0]]), () => ( SHEET_SURFACE));
|
|
8266
8395
|
const gridlineShadow = showGridLines ? buildGridlineShadow(palette.border) : void 0;
|
|
8267
8396
|
const css = {
|
|
8268
8397
|
backgroundColor: baseSurface,
|
|
@@ -8275,7 +8404,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
|
|
|
8275
8404
|
lineHeight: String(resolveSpreadsheetLineHeight(11)),
|
|
8276
8405
|
overflow: "hidden",
|
|
8277
8406
|
padding: DEFAULT_CELL_PADDING,
|
|
8278
|
-
textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess',
|
|
8407
|
+
textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _592 => _592.generalAlignment]), () => ( "left")),
|
|
8279
8408
|
textOverflow: "clip",
|
|
8280
8409
|
verticalAlign: "bottom",
|
|
8281
8410
|
whiteSpace: "nowrap"
|
|
@@ -8359,24 +8488,24 @@ function buildCellStyle(style, palette, themePalette, options2) {
|
|
|
8359
8488
|
}
|
|
8360
8489
|
const border = style.border;
|
|
8361
8490
|
if (border) {
|
|
8362
|
-
const hasRightBorder = Boolean(_optionalChain([border, 'access',
|
|
8363
|
-
const hasBottomBorder = Boolean(_optionalChain([border, 'access',
|
|
8491
|
+
const hasRightBorder = Boolean(_optionalChain([border, 'access', _593 => _593.right, 'optionalAccess', _594 => _594.style]) && border.right.style !== "none");
|
|
8492
|
+
const hasBottomBorder = Boolean(_optionalChain([border, 'access', _595 => _595.bottom, 'optionalAccess', _596 => _596.style]) && border.bottom.style !== "none");
|
|
8364
8493
|
if (showGridLines && (hasRightBorder || hasBottomBorder)) {
|
|
8365
8494
|
css.boxShadow = buildGridlineShadow(palette.border, {
|
|
8366
8495
|
bottom: !hasBottomBorder,
|
|
8367
8496
|
right: !hasRightBorder
|
|
8368
8497
|
}) || void 0;
|
|
8369
8498
|
}
|
|
8370
|
-
if (_optionalChain([border, 'access',
|
|
8499
|
+
if (_optionalChain([border, 'access', _597 => _597.top, 'optionalAccess', _598 => _598.style]) && border.top.style !== "none") {
|
|
8371
8500
|
css.borderTop = mapBorder2(border.top, themePalette);
|
|
8372
8501
|
}
|
|
8373
|
-
if (_optionalChain([border, 'access',
|
|
8502
|
+
if (_optionalChain([border, 'access', _599 => _599.right, 'optionalAccess', _600 => _600.style]) && border.right.style !== "none") {
|
|
8374
8503
|
css.borderRight = mapBorder2(border.right, themePalette);
|
|
8375
8504
|
}
|
|
8376
|
-
if (_optionalChain([border, 'access',
|
|
8505
|
+
if (_optionalChain([border, 'access', _601 => _601.bottom, 'optionalAccess', _602 => _602.style]) && border.bottom.style !== "none") {
|
|
8377
8506
|
css.borderBottom = mapBorder2(border.bottom, themePalette);
|
|
8378
8507
|
}
|
|
8379
|
-
if (_optionalChain([border, 'access',
|
|
8508
|
+
if (_optionalChain([border, 'access', _603 => _603.left, 'optionalAccess', _604 => _604.style]) && border.left.style !== "none") {
|
|
8380
8509
|
css.borderLeft = mapBorder2(border.left, themePalette);
|
|
8381
8510
|
}
|
|
8382
8511
|
}
|
|
@@ -8422,7 +8551,7 @@ function measureTextWidth(value, style) {
|
|
|
8422
8551
|
}
|
|
8423
8552
|
function getCellDisplayValue(worksheet, row2, col, activeSheet, locale = "en-US") {
|
|
8424
8553
|
const formula = worksheet.getFormulaAt(row2, col);
|
|
8425
|
-
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess',
|
|
8554
|
+
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _605 => _605.cachedFormulaValues, 'optionalAccess', _606 => _606[cellAddressToA12({ row: row2, col })]]) : void 0;
|
|
8426
8555
|
const formatted = worksheet.getFormattedValueAt(row2, col);
|
|
8427
8556
|
if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
|
|
8428
8557
|
return _chunkXZJLPW64cjs.localizeCellNumber.call(void 0, worksheet, row2, col, decodeHtmlEntities2(formatted), locale);
|
|
@@ -8669,7 +8798,7 @@ function normalizeBatchedMergeSpan(value) {
|
|
|
8669
8798
|
}
|
|
8670
8799
|
function normalizeBatchedCellValue(rawValue, formula, row2, col, activeSheet) {
|
|
8671
8800
|
const value = typeof rawValue === "string" ? decodeHtmlEntities2(rawValue) : rawValue === null || rawValue === void 0 ? "" : String(rawValue);
|
|
8672
|
-
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess',
|
|
8801
|
+
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _607 => _607.cachedFormulaValues, 'optionalAccess', _608 => _608[cellAddressToA12({ row: row2, col })]]) : void 0;
|
|
8673
8802
|
if (formula && cachedFormulaValue !== void 0 && value.startsWith("#")) {
|
|
8674
8803
|
return cachedFormulaValue;
|
|
8675
8804
|
}
|
|
@@ -8717,31 +8846,31 @@ function mergeResolvedCellStyle(base, overlay, options2) {
|
|
|
8717
8846
|
..._nullishCoalesce(base, () => ( {})),
|
|
8718
8847
|
..._nullishCoalesce(overlay, () => ( {}))
|
|
8719
8848
|
};
|
|
8720
|
-
const baseAlignment = _optionalChain([base, 'optionalAccess',
|
|
8721
|
-
const overlayAlignment = _optionalChain([overlay, 'optionalAccess',
|
|
8849
|
+
const baseAlignment = _optionalChain([base, 'optionalAccess', _609 => _609.alignment]);
|
|
8850
|
+
const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _610 => _610.alignment]);
|
|
8722
8851
|
if (baseAlignment || overlayAlignment) {
|
|
8723
8852
|
nextStyle.alignment = {
|
|
8724
8853
|
..._nullishCoalesce(baseAlignment, () => ( {})),
|
|
8725
8854
|
..._nullishCoalesce(overlayAlignment, () => ( {}))
|
|
8726
8855
|
};
|
|
8727
8856
|
}
|
|
8728
|
-
const baseBorder = _optionalChain([base, 'optionalAccess',
|
|
8729
|
-
const overlayBorder = _optionalChain([overlay, 'optionalAccess',
|
|
8857
|
+
const baseBorder = _optionalChain([base, 'optionalAccess', _611 => _611.border]);
|
|
8858
|
+
const overlayBorder = _optionalChain([overlay, 'optionalAccess', _612 => _612.border]);
|
|
8730
8859
|
if (baseBorder || overlayBorder) {
|
|
8731
|
-
nextStyle.border = _optionalChain([options2, 'optionalAccess',
|
|
8860
|
+
nextStyle.border = _optionalChain([options2, 'optionalAccess', _613 => _613.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
|
|
8732
8861
|
..._nullishCoalesce(baseBorder, () => ( {})),
|
|
8733
8862
|
..._nullishCoalesce(overlayBorder, () => ( {}))
|
|
8734
8863
|
};
|
|
8735
8864
|
}
|
|
8736
|
-
const baseFill = _optionalChain([base, 'optionalAccess',
|
|
8737
|
-
const overlayFill = _optionalChain([overlay, 'optionalAccess',
|
|
8865
|
+
const baseFill = _optionalChain([base, 'optionalAccess', _614 => _614.fill]);
|
|
8866
|
+
const overlayFill = _optionalChain([overlay, 'optionalAccess', _615 => _615.fill]);
|
|
8738
8867
|
if (baseFill || overlayFill) {
|
|
8739
|
-
nextStyle.fill = _optionalChain([options2, 'optionalAccess',
|
|
8868
|
+
nextStyle.fill = _optionalChain([options2, 'optionalAccess', _616 => _616.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
|
|
8740
8869
|
}
|
|
8741
|
-
const baseFont = _optionalChain([base, 'optionalAccess',
|
|
8742
|
-
const overlayFont = _optionalChain([overlay, 'optionalAccess',
|
|
8870
|
+
const baseFont = _optionalChain([base, 'optionalAccess', _617 => _617.font]);
|
|
8871
|
+
const overlayFont = _optionalChain([overlay, 'optionalAccess', _618 => _618.font]);
|
|
8743
8872
|
if (baseFont || overlayFont) {
|
|
8744
|
-
nextStyle.font = _optionalChain([options2, 'optionalAccess',
|
|
8873
|
+
nextStyle.font = _optionalChain([options2, 'optionalAccess', _619 => _619.replaceXfSubtrees]) && overlayFont ? overlayFont : {
|
|
8745
8874
|
..._nullishCoalesce(baseFont, () => ( {})),
|
|
8746
8875
|
..._nullishCoalesce(overlayFont, () => ( {}))
|
|
8747
8876
|
};
|
|
@@ -8987,7 +9116,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8987
9116
|
items: tabs.map((tab, index) => ({
|
|
8988
9117
|
id: String(index),
|
|
8989
9118
|
label: tab.name,
|
|
8990
|
-
title: tab.visibility === "hidden" ?
|
|
9119
|
+
title: tab.visibility === "hidden" ? _chunkUXJAG7MUcjs.formatMessage.call(void 0, messages.hiddenSheet, { sheet: tab.name }) : tab.visibility === "veryHidden" ? _chunkUXJAG7MUcjs.formatMessage.call(void 0, messages.veryHiddenSheet, { sheet: tab.name }) : tab.name,
|
|
8991
9120
|
visibility: tab.visibility
|
|
8992
9121
|
})),
|
|
8993
9122
|
onValueChange: (value) => setActiveTabIndex(Number(value)),
|
|
@@ -9255,11 +9384,11 @@ function resolveConditionalFormulaComparable(formula, worksheet, sheet, batchedC
|
|
|
9255
9384
|
return literal;
|
|
9256
9385
|
}
|
|
9257
9386
|
const splitReference = splitSheetFormulaReference(normalized);
|
|
9258
|
-
const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess',
|
|
9259
|
-
if (targetSheetName && _optionalChain([sheet, 'optionalAccess',
|
|
9387
|
+
const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _620 => _620.sheetName]), () => ( null));
|
|
9388
|
+
if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _621 => _621.name]) && targetSheetName !== sheet.name) {
|
|
9260
9389
|
return literal;
|
|
9261
9390
|
}
|
|
9262
|
-
const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess',
|
|
9391
|
+
const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _622 => _622.range]), () => ( normalized));
|
|
9263
9392
|
const cell = parseA1CellReference2(cellRef.replace(/\$/g, ""));
|
|
9264
9393
|
if (!cell) {
|
|
9265
9394
|
return literal;
|
|
@@ -9291,8 +9420,8 @@ function normalizeConditionalTextOperand(value) {
|
|
|
9291
9420
|
}
|
|
9292
9421
|
function resolveConditionalStyledRuleMatch(rule, numericValue, textValue, worksheet, sheet, batchedCells) {
|
|
9293
9422
|
const normalizedRuleType = rule.ruleType.trim().toLowerCase();
|
|
9294
|
-
const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access',
|
|
9295
|
-
const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access',
|
|
9423
|
+
const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _623 => _623.formulas, 'optionalAccess', _624 => _624[0]]), () => ( "")), worksheet, sheet, batchedCells);
|
|
9424
|
+
const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _625 => _625.formulas, 'optionalAccess', _626 => _626[1]]), () => ( "")), worksheet, sheet, batchedCells);
|
|
9296
9425
|
if (normalizedRuleType === "cellis") {
|
|
9297
9426
|
return resolveConditionalCellIsMatch(_nullishCoalesce(rule.operator, () => ( "equal")), left, right, numericValue, textValue);
|
|
9298
9427
|
}
|
|
@@ -9323,7 +9452,7 @@ function getStyledConditionalRules(rules) {
|
|
|
9323
9452
|
return styledRules;
|
|
9324
9453
|
}
|
|
9325
9454
|
function resolveConditionalCellStyleForCell(row2, col, sheet, readNumericValue, readTextValue, worksheet, batchedCells) {
|
|
9326
|
-
const rules = _optionalChain([sheet, 'optionalAccess',
|
|
9455
|
+
const rules = _optionalChain([sheet, 'optionalAccess', _627 => _627.conditionalFormatRules]);
|
|
9327
9456
|
if (!sheet || !rules || rules.length === 0) {
|
|
9328
9457
|
return null;
|
|
9329
9458
|
}
|
|
@@ -9527,11 +9656,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9527
9656
|
if (shape.paragraphs.length === 0) {
|
|
9528
9657
|
return;
|
|
9529
9658
|
}
|
|
9530
|
-
const inset = _optionalChain([shape, 'access',
|
|
9531
|
-
const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9532
|
-
const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9533
|
-
const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9534
|
-
const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9659
|
+
const inset = _optionalChain([shape, 'access', _628 => _628.textBox, 'optionalAccess', _629 => _629.insetPx]);
|
|
9660
|
+
const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _630 => _630.left]), () => ( 6))) * zoomFactor;
|
|
9661
|
+
const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _631 => _631.right]), () => ( 6))) * zoomFactor;
|
|
9662
|
+
const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _632 => _632.top]), () => ( 4))) * zoomFactor;
|
|
9663
|
+
const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _633 => _633.bottom]), () => ( 4))) * zoomFactor;
|
|
9535
9664
|
const textLeft = left + paddingLeft;
|
|
9536
9665
|
const textTop = top + paddingTop;
|
|
9537
9666
|
const textWidth = Math.max(0, width - paddingLeft - paddingRight);
|
|
@@ -9553,9 +9682,9 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9553
9682
|
});
|
|
9554
9683
|
const totalTextHeight = lineMetrics.reduce((total, metric) => total + metric.lineHeight, 0);
|
|
9555
9684
|
let y = textTop;
|
|
9556
|
-
if (_optionalChain([shape, 'access',
|
|
9685
|
+
if (_optionalChain([shape, 'access', _634 => _634.textBox, 'optionalAccess', _635 => _635.verticalAlign]) === "middle") {
|
|
9557
9686
|
y = textTop + Math.max(0, (textHeight - totalTextHeight) / 2);
|
|
9558
|
-
} else if (_optionalChain([shape, 'access',
|
|
9687
|
+
} else if (_optionalChain([shape, 'access', _636 => _636.textBox, 'optionalAccess', _637 => _637.verticalAlign]) === "bottom") {
|
|
9559
9688
|
y = textTop + Math.max(0, textHeight - totalTextHeight);
|
|
9560
9689
|
}
|
|
9561
9690
|
context.save();
|
|
@@ -9566,7 +9695,7 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9566
9695
|
shape.paragraphs.forEach((paragraph, paragraphIndex) => {
|
|
9567
9696
|
const metric = _nullishCoalesce(lineMetrics[paragraphIndex], () => ( { lineHeight: 14 * zoomFactor, widthPx: 0 }));
|
|
9568
9697
|
let x = textLeft;
|
|
9569
|
-
const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access',
|
|
9698
|
+
const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _638 => _638.textBox, 'optionalAccess', _639 => _639.horizontalAlign]))), () => ( "left"));
|
|
9570
9699
|
if (align === "center") {
|
|
9571
9700
|
x = textLeft + Math.max(0, (textWidth - metric.widthPx) / 2);
|
|
9572
9701
|
} else if (align === "right") {
|
|
@@ -9595,11 +9724,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9595
9724
|
context.restore();
|
|
9596
9725
|
}
|
|
9597
9726
|
function drawStaticShape(context, shape, rect, zoomFactor) {
|
|
9598
|
-
const fillColor = _optionalChain([shape, 'access',
|
|
9599
|
-
const strokeColor = _optionalChain([shape, 'access',
|
|
9600
|
-
const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access',
|
|
9727
|
+
const fillColor = _optionalChain([shape, 'access', _640 => _640.fill, 'optionalAccess', _641 => _641.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _642 => _642.fill, 'optionalAccess', _643 => _643.color]), () => ( "transparent"));
|
|
9728
|
+
const strokeColor = _optionalChain([shape, 'access', _644 => _644.stroke, 'optionalAccess', _645 => _645.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _646 => _646.stroke, 'optionalAccess', _647 => _647.color]), () => ( "transparent"));
|
|
9729
|
+
const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _648 => _648.stroke, 'optionalAccess', _649 => _649.widthPx]), () => ( (shape.geometry === "line" ? 2 : 1)))) * zoomFactor);
|
|
9601
9730
|
const vectorShape = resolveShapeVector(shape);
|
|
9602
|
-
const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access',
|
|
9731
|
+
const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _650 => _650.fill, 'optionalAccess', _651 => _651.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _652 => _652.stroke, 'optionalAccess', _653 => _653.opacity]), () => ( 1)));
|
|
9603
9732
|
context.save();
|
|
9604
9733
|
context.translate(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
9605
9734
|
if (shape.rotationDeg) {
|
|
@@ -9610,7 +9739,7 @@ function drawStaticShape(context, shape, rect, zoomFactor) {
|
|
|
9610
9739
|
context.lineWidth = lineWidth;
|
|
9611
9740
|
context.strokeStyle = strokeColor;
|
|
9612
9741
|
context.fillStyle = fillColor;
|
|
9613
|
-
applyCanvasShapeDash(context, _optionalChain([shape, 'access',
|
|
9742
|
+
applyCanvasShapeDash(context, _optionalChain([shape, 'access', _654 => _654.stroke, 'optionalAccess', _655 => _655.dash]), lineWidth);
|
|
9614
9743
|
const localLeft = -rect.width / 2;
|
|
9615
9744
|
const localTop = -rect.height / 2;
|
|
9616
9745
|
if (vectorShape && typeof Path2D !== "undefined") {
|
|
@@ -9747,7 +9876,7 @@ function drawStaticFormControl(context, control2, rect, palette, zoomFactor, she
|
|
|
9747
9876
|
context.restore();
|
|
9748
9877
|
}
|
|
9749
9878
|
function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCache) {
|
|
9750
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
9879
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _656 => _656.conditionalFormatRules]), () => ( []));
|
|
9751
9880
|
const matchingRule = rules.find(
|
|
9752
9881
|
(rule) => rule.kind === "dataBar" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
|
|
9753
9882
|
);
|
|
@@ -9785,23 +9914,23 @@ function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCa
|
|
|
9785
9914
|
const span = maxValue - minValue;
|
|
9786
9915
|
const ratio = span === 0 ? numericValue >= maxValue ? 1 : 0 : (numericValue - minValue) / span;
|
|
9787
9916
|
const widthPercent = minLength + Math.max(0, Math.min(1, ratio)) * (maxLength - minLength);
|
|
9788
|
-
const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.color, _optionalChain([sheet, 'optionalAccess',
|
|
9917
|
+
const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.color, _optionalChain([sheet, 'optionalAccess', _657 => _657.themePalette]));
|
|
9789
9918
|
if (!color || widthPercent <= 0) {
|
|
9790
9919
|
return null;
|
|
9791
9920
|
}
|
|
9792
9921
|
return {
|
|
9793
|
-
axisColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess',
|
|
9922
|
+
axisColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _658 => _658.themePalette])), () => ( void 0)),
|
|
9794
9923
|
border: _nullishCoalesce(matchingRule.border, () => ( void 0)),
|
|
9795
|
-
borderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess',
|
|
9924
|
+
borderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _659 => _659.themePalette])), () => ( void 0)),
|
|
9796
9925
|
color,
|
|
9797
9926
|
gradient: _nullishCoalesce(matchingRule.gradient, () => ( void 0)),
|
|
9798
|
-
negativeBorderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess',
|
|
9799
|
-
negativeFillColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess',
|
|
9927
|
+
negativeBorderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _660 => _660.themePalette])), () => ( void 0)),
|
|
9928
|
+
negativeFillColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _661 => _661.themePalette])), () => ( void 0)),
|
|
9800
9929
|
widthPercent
|
|
9801
9930
|
};
|
|
9802
9931
|
}
|
|
9803
9932
|
function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metricsCache) {
|
|
9804
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
9933
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _662 => _662.conditionalFormatRules]), () => ( []));
|
|
9805
9934
|
const matchingRule = rules.find(
|
|
9806
9935
|
(rule) => rule.kind === "colorScale" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
|
|
9807
9936
|
);
|
|
@@ -9829,7 +9958,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
|
|
|
9829
9958
|
});
|
|
9830
9959
|
metricsCache.set(cacheKey, ruleValues);
|
|
9831
9960
|
}
|
|
9832
|
-
const colors = matchingRule.colors.map((color) => _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, color, _optionalChain([sheet, 'optionalAccess',
|
|
9961
|
+
const colors = matchingRule.colors.map((color) => _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, color, _optionalChain([sheet, 'optionalAccess', _663 => _663.themePalette]))).filter((color) => typeof color === "string");
|
|
9833
9962
|
const thresholds = matchingRule.cfvos.map((threshold) => resolveConditionalRuleThreshold(threshold, ruleValues)).filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
9834
9963
|
if (colors.length < 2 || thresholds.length < 2) {
|
|
9835
9964
|
return null;
|
|
@@ -9848,7 +9977,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
|
|
|
9848
9977
|
return { color: resolvedColor };
|
|
9849
9978
|
}
|
|
9850
9979
|
function resolveConditionalIconForCell(row2, col, worksheet, sheet, metricsCache) {
|
|
9851
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
9980
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _664 => _664.conditionalFormatRules]), () => ( []));
|
|
9852
9981
|
const matchingRule = rules.find(
|
|
9853
9982
|
(rule) => rule.kind === "iconSet" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
|
|
9854
9983
|
);
|
|
@@ -10150,7 +10279,7 @@ function GridRow({
|
|
|
10150
10279
|
whiteSpace: "nowrap",
|
|
10151
10280
|
width: "max-content"
|
|
10152
10281
|
} : null;
|
|
10153
|
-
const title = [_optionalChain([cellData, 'access',
|
|
10282
|
+
const title = [_optionalChain([cellData, 'access', _665 => _665.hyperlink, 'optionalAccess', _666 => _666.tooltip]), _optionalChain([cellData, 'access', _667 => _667.validation, 'optionalAccess', _668 => _668.message]), cellData.value].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join("\n");
|
|
10154
10283
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
10155
10284
|
"td",
|
|
10156
10285
|
{
|
|
@@ -10335,12 +10464,12 @@ function GridRow({
|
|
|
10335
10464
|
) : null
|
|
10336
10465
|
] });
|
|
10337
10466
|
}
|
|
10338
|
-
var MemoGridRow =
|
|
10467
|
+
var MemoGridRow = React16.memo(GridRow, (prev, next) => {
|
|
10339
10468
|
if (prev.actualRow !== next.actualRow || prev.rowHeight !== next.rowHeight || prev.headerLabelLiveScale !== next.headerLabelLiveScale || prev.palette !== next.palette || prev.readOnly !== next.readOnly || prev.visibleCols !== next.visibleCols || prev.leadingSpacerWidth !== next.leadingSpacerWidth || prev.rowHeaderWidth !== next.rowHeaderWidth || prev.stickyLeftByCol !== next.stickyLeftByCol || prev.stickyTop !== next.stickyTop || prev.trailingSpacerWidth !== next.trailingSpacerWidth || prev.zoomFactor !== next.zoomFactor || prev.getCellData !== next.getCellData || prev.onCellClick !== next.onCellClick || prev.onCellDoubleClick !== next.onCellDoubleClick || prev.onCellPointerDown !== next.onCellPointerDown || prev.onEditingBlur !== next.onEditingBlur || prev.onEditingCancel !== next.onEditingCancel || prev.onEditingCommit !== next.onEditingCommit || prev.onEditingNavigate !== next.onEditingNavigate || prev.onEditingValueChange !== next.onEditingValueChange || prev.onRowHeaderRef !== next.onRowHeaderRef || prev.onRowPointerDown !== next.onRowPointerDown || prev.onRowResizeDoubleClick !== next.onRowResizeDoubleClick || prev.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment || prev.cellEditorStyle !== next.cellEditorStyle || prev.onFocusEditorOverlay !== next.onFocusEditorOverlay) {
|
|
10340
10469
|
return false;
|
|
10341
10470
|
}
|
|
10342
|
-
const prevEditingCol = _optionalChain([prev, 'access',
|
|
10343
|
-
const nextEditingCol = _optionalChain([next, 'access',
|
|
10471
|
+
const prevEditingCol = _optionalChain([prev, 'access', _669 => _669.editingCell, 'optionalAccess', _670 => _670.row]) === prev.actualRow ? prev.editingCell.col : -1;
|
|
10472
|
+
const nextEditingCol = _optionalChain([next, 'access', _671 => _671.editingCell, 'optionalAccess', _672 => _672.row]) === next.actualRow ? next.editingCell.col : -1;
|
|
10344
10473
|
if (prevEditingCol !== nextEditingCol) {
|
|
10345
10474
|
return false;
|
|
10346
10475
|
}
|
|
@@ -10364,7 +10493,7 @@ function XlsxViewerProvider({ children: children2, controller, isDark = false, .
|
|
|
10364
10493
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, XlsxViewerProviderWithInlineController, { ...options2, isDark, children: children2 });
|
|
10365
10494
|
}
|
|
10366
10495
|
function useXlsxViewer() {
|
|
10367
|
-
const context =
|
|
10496
|
+
const context = React16.useContext(ViewerContext);
|
|
10368
10497
|
if (!context) {
|
|
10369
10498
|
throw new Error("useXlsxViewer must be used inside XlsxViewer or XlsxViewerProvider.");
|
|
10370
10499
|
}
|
|
@@ -10382,7 +10511,7 @@ function useXlsxViewerSelection() {
|
|
|
10382
10511
|
selectionRanges,
|
|
10383
10512
|
selection
|
|
10384
10513
|
} = useXlsxViewer();
|
|
10385
|
-
return
|
|
10514
|
+
return React16.useMemo(
|
|
10386
10515
|
() => ({
|
|
10387
10516
|
activeCell,
|
|
10388
10517
|
activeCellAddress,
|
|
@@ -10398,10 +10527,10 @@ function useXlsxViewerSelection() {
|
|
|
10398
10527
|
);
|
|
10399
10528
|
}
|
|
10400
10529
|
function useXlsxViewerLayout() {
|
|
10401
|
-
const { canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
|
|
10402
|
-
return
|
|
10403
|
-
() => ({ canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
|
|
10404
|
-
[canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
|
|
10530
|
+
const { canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
|
|
10531
|
+
return React16.useMemo(
|
|
10532
|
+
() => ({ canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
|
|
10533
|
+
[canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
|
|
10405
10534
|
);
|
|
10406
10535
|
}
|
|
10407
10536
|
function useXlsxViewerZoom() {
|
|
@@ -10417,7 +10546,7 @@ function useXlsxViewerZoom() {
|
|
|
10417
10546
|
zoomOut,
|
|
10418
10547
|
zoomScale
|
|
10419
10548
|
} = useXlsxViewer();
|
|
10420
|
-
return
|
|
10549
|
+
return React16.useMemo(
|
|
10421
10550
|
() => ({
|
|
10422
10551
|
canZoomIn,
|
|
10423
10552
|
canZoomOut,
|
|
@@ -10486,7 +10615,7 @@ function useXlsxViewerEditing() {
|
|
|
10486
10615
|
unmergeSelection,
|
|
10487
10616
|
updateFormControl
|
|
10488
10617
|
} = useXlsxViewer();
|
|
10489
|
-
return
|
|
10618
|
+
return React16.useMemo(
|
|
10490
10619
|
() => ({
|
|
10491
10620
|
addFormControl,
|
|
10492
10621
|
addSheet,
|
|
@@ -10573,7 +10702,7 @@ function useXlsxViewerEditing() {
|
|
|
10573
10702
|
}
|
|
10574
10703
|
function useXlsxViewerTables() {
|
|
10575
10704
|
const { sortState, sortTable, tables } = useXlsxViewer();
|
|
10576
|
-
return
|
|
10705
|
+
return React16.useMemo(
|
|
10577
10706
|
() => ({
|
|
10578
10707
|
sortState,
|
|
10579
10708
|
sortTable,
|
|
@@ -10584,7 +10713,7 @@ function useXlsxViewerTables() {
|
|
|
10584
10713
|
}
|
|
10585
10714
|
function useXlsxViewerPivots() {
|
|
10586
10715
|
const { pivotTables, pivotFieldListVisible, setPivotFieldListVisible, getPivotSourceFields, getPivotTableAtCell, upsertPivotTable, refreshPivotTable, refreshAllPivotTables, removePivotTable, pivotDrillDown, showPivotDetails, createPivotChart, togglePivotGroup } = useXlsxViewer();
|
|
10587
|
-
return
|
|
10716
|
+
return React16.useMemo(() => ({
|
|
10588
10717
|
pivotTables,
|
|
10589
10718
|
pivotFieldListVisible,
|
|
10590
10719
|
setPivotFieldListVisible,
|
|
@@ -10638,7 +10767,7 @@ function useXlsxViewerImages() {
|
|
|
10638
10767
|
setImageRect,
|
|
10639
10768
|
updateChart
|
|
10640
10769
|
} = useXlsxViewer();
|
|
10641
|
-
return
|
|
10770
|
+
return React16.useMemo(
|
|
10642
10771
|
() => ({
|
|
10643
10772
|
arrangeDrawing,
|
|
10644
10773
|
changeChartType,
|
|
@@ -10740,7 +10869,7 @@ function useXlsxViewerCharts() {
|
|
|
10740
10869
|
tabs,
|
|
10741
10870
|
updateChart
|
|
10742
10871
|
} = useXlsxViewer();
|
|
10743
|
-
return
|
|
10872
|
+
return React16.useMemo(
|
|
10744
10873
|
() => ({
|
|
10745
10874
|
activeTab,
|
|
10746
10875
|
activeTabIndex,
|
|
@@ -10813,30 +10942,30 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10813
10942
|
workbook,
|
|
10814
10943
|
sheets
|
|
10815
10944
|
} = useXlsxViewer();
|
|
10816
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
10945
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
10817
10946
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
10818
10947
|
const includeHeaders = _nullishCoalesce(options2.includeHeaders, () => ( true));
|
|
10819
10948
|
const resolution = options2.resolution;
|
|
10820
|
-
const thumbnailImageCacheRef =
|
|
10821
|
-
const workerThumbnailRowBatchCacheRef =
|
|
10822
|
-
const workerThumbnailRowBatchRequestRef =
|
|
10949
|
+
const thumbnailImageCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10950
|
+
const workerThumbnailRowBatchCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10951
|
+
const workerThumbnailRowBatchRequestRef = React16.useRef(
|
|
10823
10952
|
/* @__PURE__ */ new Map()
|
|
10824
10953
|
);
|
|
10825
|
-
const isMountedRef =
|
|
10826
|
-
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] =
|
|
10827
|
-
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] =
|
|
10828
|
-
|
|
10954
|
+
const isMountedRef = React16.useRef(false);
|
|
10955
|
+
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React16.useState(0);
|
|
10956
|
+
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React16.useState(0);
|
|
10957
|
+
React16.useEffect(() => {
|
|
10829
10958
|
isMountedRef.current = true;
|
|
10830
10959
|
return () => {
|
|
10831
10960
|
isMountedRef.current = false;
|
|
10832
10961
|
};
|
|
10833
10962
|
}, []);
|
|
10834
|
-
|
|
10963
|
+
React16.useEffect(() => {
|
|
10835
10964
|
workerThumbnailRowBatchCacheRef.current.clear();
|
|
10836
10965
|
workerThumbnailRowBatchRequestRef.current.clear();
|
|
10837
10966
|
setWorkerThumbnailRowBatchVersion((version) => version + 1);
|
|
10838
10967
|
}, [locale]);
|
|
10839
|
-
|
|
10968
|
+
React16.useEffect(() => {
|
|
10840
10969
|
const currentSheets = new Set(sheets);
|
|
10841
10970
|
for (const sheet of workerThumbnailRowBatchCacheRef.current.keys()) {
|
|
10842
10971
|
if (!currentSheets.has(sheet)) {
|
|
@@ -10849,7 +10978,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10849
10978
|
}
|
|
10850
10979
|
}
|
|
10851
10980
|
}, [sheets]);
|
|
10852
|
-
const getWorkerThumbnailRowBatch =
|
|
10981
|
+
const getWorkerThumbnailRowBatch = React16.useCallback((sheet, startRow, endRow) => {
|
|
10853
10982
|
const cachedBatch = workerThumbnailRowBatchCacheRef.current.get(sheet);
|
|
10854
10983
|
if (cachedBatch && startRow >= cachedBatch.startRow && endRow <= cachedBatch.endRow) {
|
|
10855
10984
|
return cachedBatch;
|
|
@@ -10860,8 +10989,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10860
10989
|
const pendingRequest = workerThumbnailRowBatchRequestRef.current.get(sheet);
|
|
10861
10990
|
if (!pendingRequest) {
|
|
10862
10991
|
const request = {
|
|
10863
|
-
endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess',
|
|
10864
|
-
startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess',
|
|
10992
|
+
endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _673 => _673.endRow]), () => ( endRow))),
|
|
10993
|
+
startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _674 => _674.startRow]), () => ( startRow)))
|
|
10865
10994
|
};
|
|
10866
10995
|
workerThumbnailRowBatchRequestRef.current.set(sheet, request);
|
|
10867
10996
|
void getRowsBatchAsync(
|
|
@@ -10891,7 +11020,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10891
11020
|
}
|
|
10892
11021
|
return null;
|
|
10893
11022
|
}, [getRowsBatchAsync]);
|
|
10894
|
-
const getThumbnailImage =
|
|
11023
|
+
const getThumbnailImage = React16.useCallback((image) => {
|
|
10895
11024
|
if (typeof Image === "undefined") {
|
|
10896
11025
|
return null;
|
|
10897
11026
|
}
|
|
@@ -10923,9 +11052,9 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10923
11052
|
imageElement.src = image.src;
|
|
10924
11053
|
return null;
|
|
10925
11054
|
}, []);
|
|
10926
|
-
const thumbnails =
|
|
11055
|
+
const thumbnails = React16.useMemo(() => {
|
|
10927
11056
|
return sheets.map((sheet, sheetIndex) => {
|
|
10928
|
-
const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess',
|
|
11057
|
+
const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _675 => _675.getSheet, 'call', _676 => _676(sheet.workbookSheetIndex)]), () => ( null));
|
|
10929
11058
|
const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
|
|
10930
11059
|
const sheetShapes = getSheetShapes(sheetIndex);
|
|
10931
11060
|
const sheetFormControls = getSheetFormControls(sheetIndex).filter((control2) => !control2.hidden);
|
|
@@ -10941,18 +11070,18 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10941
11070
|
minRow: 0
|
|
10942
11071
|
}));
|
|
10943
11072
|
return {
|
|
10944
|
-
maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
10945
|
-
maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
10946
|
-
minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
10947
|
-
minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
11073
|
+
maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _677 => _677.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
|
|
11074
|
+
maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _678 => _678.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
|
|
11075
|
+
minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _679 => _679.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
|
|
11076
|
+
minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _680 => _680.minRow]), () => ( drawingBound.minRow)), drawingBound.minRow)
|
|
10948
11077
|
};
|
|
10949
11078
|
}, null);
|
|
10950
11079
|
const sheetMinUsedRow = (_nullishCoalesce(sheet.maxUsedRow, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedRow, () => ( 0))) ? _nullishCoalesce(sheet.minUsedRow, () => ( 0)) : void 0;
|
|
10951
11080
|
const sheetMinUsedCol = (_nullishCoalesce(sheet.maxUsedCol, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedCol, () => ( 0))) ? _nullishCoalesce(sheet.minUsedCol, () => ( 0)) : void 0;
|
|
10952
|
-
const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess',
|
|
10953
|
-
const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess',
|
|
10954
|
-
const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess',
|
|
10955
|
-
const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess',
|
|
11081
|
+
const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _681 => _681.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _682 => _682.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
|
|
11082
|
+
const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _683 => _683.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _684 => _684.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
|
|
11083
|
+
const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _685 => _685.maxRow]), () => ( -1)));
|
|
11084
|
+
const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _686 => _686.maxCol]), () => ( -1)));
|
|
10956
11085
|
const showGridLines = _nullishCoalesce(sheet.showGridLines, () => ( true));
|
|
10957
11086
|
const hiddenRowSet = new Set(_nullishCoalesce(sheet.hiddenRows, () => ( [])));
|
|
10958
11087
|
const hiddenColSet = new Set(_nullishCoalesce(sheet.hiddenCols, () => ( [])));
|
|
@@ -10969,7 +11098,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10969
11098
|
hiddenColSet
|
|
10970
11099
|
);
|
|
10971
11100
|
const resolveColumnWidthPx = (actualCol) => {
|
|
10972
|
-
if (worksheet && !
|
|
11101
|
+
if (worksheet && !hiddenColSet.has(actualCol)) {
|
|
10973
11102
|
const width = worksheet.getColumnWidth(actualCol);
|
|
10974
11103
|
if (width !== void 0 && width !== null) {
|
|
10975
11104
|
return Math.max(
|
|
@@ -10987,7 +11116,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10987
11116
|
);
|
|
10988
11117
|
};
|
|
10989
11118
|
const resolveRowHeightPx = (actualRow) => {
|
|
10990
|
-
if (worksheet && !
|
|
11119
|
+
if (worksheet && !hiddenRowSet.has(actualRow)) {
|
|
10991
11120
|
const height = worksheet.getRowHeight(actualRow);
|
|
10992
11121
|
if (height !== void 0 && height !== null) {
|
|
10993
11122
|
return Math.max(
|
|
@@ -11165,8 +11294,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11165
11294
|
return cached;
|
|
11166
11295
|
}
|
|
11167
11296
|
const batchCoversRow = workerRowBatch ? row2 >= workerRowBatch.startRow && row2 <= workerRowBatch.endRow : false;
|
|
11168
|
-
const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess',
|
|
11169
|
-
if (_optionalChain([batchedCell, 'optionalAccess',
|
|
11297
|
+
const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _687 => _687.cells, 'access', _688 => _688.get, 'call', _689 => _689(cacheKey)]) : void 0;
|
|
11298
|
+
if (_optionalChain([batchedCell, 'optionalAccess', _690 => _690.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _691 => _691.isMergedSecondary, 'call', _692 => _692(row2, col)])) {
|
|
11170
11299
|
const mergedSecondaryData = {
|
|
11171
11300
|
isMergedSecondary: true,
|
|
11172
11301
|
style: {},
|
|
@@ -11175,23 +11304,23 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11175
11304
|
cellRenderCache.set(cacheKey, mergedSecondaryData);
|
|
11176
11305
|
return mergedSecondaryData;
|
|
11177
11306
|
}
|
|
11178
|
-
const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
11307
|
+
const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _693 => _693.mergeSpan]);
|
|
11179
11308
|
const inheritedStyle = resolveInheritedCellStyle2(sheet, row2, col);
|
|
11180
|
-
const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
11309
|
+
const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _694 => _694.style]), () => ( null));
|
|
11181
11310
|
const mergedStyle = mergeResolvedCellStyle(inheritedStyle, worksheetStyle, { replaceXfSubtrees: true });
|
|
11182
11311
|
const conditionalCellStyle = resolveConditionalCellStyleForCell(
|
|
11183
11312
|
row2,
|
|
11184
11313
|
col,
|
|
11185
11314
|
sheet,
|
|
11186
11315
|
() => worksheet ? getCellNumericValue(worksheet, row2, col) : getBatchedCellNumericValue(batchedCell),
|
|
11187
|
-
() => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
11316
|
+
() => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _695 => _695.value]), () => ( "")),
|
|
11188
11317
|
worksheet,
|
|
11189
|
-
_optionalChain([workerRowBatch, 'optionalAccess',
|
|
11318
|
+
_optionalChain([workerRowBatch, 'optionalAccess', _696 => _696.cells])
|
|
11190
11319
|
);
|
|
11191
11320
|
const finalResolvedStyle = mergeResolvedCellStyle(mergedStyle, conditionalCellStyle);
|
|
11192
|
-
const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess',
|
|
11321
|
+
const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _697 => _697.alignment]);
|
|
11193
11322
|
const sparkline = _nullishCoalesce(sparklineByCell.get(cacheKey), () => ( null));
|
|
11194
|
-
const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess',
|
|
11323
|
+
const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _698 => _698.cells, 'access', _699 => _699.get, 'call', _700 => _700(`${targetRow}:${targetCol}`)]));
|
|
11195
11324
|
const sparklineValues = sparkline ? sparkline.range.start.row === sparkline.range.end.row ? Array.from(
|
|
11196
11325
|
{ length: Math.abs(sparkline.range.end.col - sparkline.range.start.col) + 1 },
|
|
11197
11326
|
(_, index) => getNumericValue(
|
|
@@ -11205,26 +11334,26 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11205
11334
|
sparkline.range.start.col
|
|
11206
11335
|
)
|
|
11207
11336
|
) : null;
|
|
11208
|
-
const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess',
|
|
11337
|
+
const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _701 => _701.cellControl]) ? worksheet ? getCellBooleanValue(worksheet, row2, col) : getBatchedCellBooleanValue(batchedCell) : null;
|
|
11209
11338
|
const nextData = {
|
|
11210
11339
|
canvas: void 0,
|
|
11211
11340
|
checkboxState,
|
|
11212
|
-
colSpan: _optionalChain([merge, 'optionalAccess',
|
|
11341
|
+
colSpan: _optionalChain([merge, 'optionalAccess', _702 => _702.colSpan]),
|
|
11213
11342
|
conditionalColorScale: worksheet ? resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
11214
11343
|
conditionalDataBar: worksheet ? resolveConditionalDataBarForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
11215
11344
|
conditionalIcon: worksheet ? resolveConditionalIconForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
11216
11345
|
isMergedSecondary: false,
|
|
11217
|
-
rowSpan: _optionalChain([merge, 'optionalAccess',
|
|
11346
|
+
rowSpan: _optionalChain([merge, 'optionalAccess', _703 => _703.rowSpan]),
|
|
11218
11347
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
11219
11348
|
style: buildCellStyle(finalResolvedStyle, palette, sheet.themePalette, {
|
|
11220
|
-
generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
11349
|
+
generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess', _704 => _704.generalAlignment]),
|
|
11221
11350
|
showGridLines
|
|
11222
11351
|
}),
|
|
11223
|
-
textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess',
|
|
11224
|
-
value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
11352
|
+
textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _705 => _705.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _706 => _706.textRotation])))),
|
|
11353
|
+
value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _707 => _707.value]), () => ( ""))
|
|
11225
11354
|
};
|
|
11226
11355
|
nextData.richText = resolveRichCellRuns(
|
|
11227
|
-
worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
11356
|
+
worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _708 => _708.richText]),
|
|
11228
11357
|
nextData.value,
|
|
11229
11358
|
nextData.style,
|
|
11230
11359
|
sheet.themePalette,
|
|
@@ -11246,11 +11375,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11246
11375
|
let height = rowItem.size;
|
|
11247
11376
|
for (let colOffset = 1; colOffset < colSpan; colOffset += 1) {
|
|
11248
11377
|
const nextCol = colItemByActual.get(colItem.actualIndex + colOffset);
|
|
11249
|
-
width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess',
|
|
11378
|
+
width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _709 => _709.size]), () => ( 0));
|
|
11250
11379
|
}
|
|
11251
11380
|
for (let rowOffset = 1; rowOffset < rowSpan; rowOffset += 1) {
|
|
11252
11381
|
const nextRow = rowItemByActual.get(rowItem.actualIndex + rowOffset);
|
|
11253
|
-
height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess',
|
|
11382
|
+
height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _710 => _710.size]), () => ( 0));
|
|
11254
11383
|
}
|
|
11255
11384
|
const rect = {
|
|
11256
11385
|
height,
|
|
@@ -11260,7 +11389,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11260
11389
|
};
|
|
11261
11390
|
const canvasCellStyle = _nullishCoalesce(cellData.canvas, () => ( buildCanvasCellStyleCache(cellData.style)));
|
|
11262
11391
|
const gradientFill = typeof cellData.style.backgroundImage === "string" ? resolveCanvasGradientFill(context, rect, cellData.style.backgroundImage) : null;
|
|
11263
|
-
const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access',
|
|
11392
|
+
const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _711 => _711.conditionalColorScale, 'optionalAccess', _712 => _712.color]), () => ( (typeof cellData.style.backgroundColor === "string" ? cellData.style.backgroundColor : thumbnailSheetSurface)));
|
|
11264
11393
|
context.fillStyle = _nullishCoalesce(gradientFill, () => ( fillColor));
|
|
11265
11394
|
context.fillRect(rect.left, rect.top, rect.width, rect.height);
|
|
11266
11395
|
if (cellData.conditionalDataBar) {
|
|
@@ -11506,11 +11635,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11506
11635
|
locale,
|
|
11507
11636
|
workbook
|
|
11508
11637
|
]);
|
|
11509
|
-
const paintThumbnail =
|
|
11510
|
-
(sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access',
|
|
11638
|
+
const paintThumbnail = React16.useCallback(
|
|
11639
|
+
(sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _713 => _713[sheetIndex], 'optionalAccess', _714 => _714.paint, 'call', _715 => _715(canvas)]), () => ( false)),
|
|
11511
11640
|
[thumbnails]
|
|
11512
11641
|
);
|
|
11513
|
-
return
|
|
11642
|
+
return React16.useMemo(
|
|
11514
11643
|
() => ({
|
|
11515
11644
|
paintThumbnail,
|
|
11516
11645
|
thumbnails
|
|
@@ -11520,7 +11649,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11520
11649
|
}
|
|
11521
11650
|
function DefaultXlsxToolbar({ pivotTableEditor } = {}) {
|
|
11522
11651
|
const controller = useXlsxViewer();
|
|
11523
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
11652
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
11524
11653
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
11525
11654
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultToolbar, { controller, palette, pivotTableEditor });
|
|
11526
11655
|
}
|
|
@@ -11566,7 +11695,7 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
|
|
|
11566
11695
|
}
|
|
11567
11696
|
destroy() {
|
|
11568
11697
|
this.destroyed = true;
|
|
11569
|
-
_optionalChain([this, 'access',
|
|
11698
|
+
_optionalChain([this, 'access', _716 => _716.observer, 'optionalAccess', _717 => _717.disconnect, 'call', _718 => _718()]);
|
|
11570
11699
|
this.observer = null;
|
|
11571
11700
|
this.slots.clear();
|
|
11572
11701
|
this.listeners.clear();
|
|
@@ -11595,9 +11724,9 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
|
|
|
11595
11724
|
}
|
|
11596
11725
|
}, _class2);
|
|
11597
11726
|
function RuntimeContent({ content }) {
|
|
11598
|
-
const hostRef =
|
|
11599
|
-
const rootRef =
|
|
11600
|
-
|
|
11727
|
+
const hostRef = React17.useRef(null);
|
|
11728
|
+
const rootRef = React17.useRef(null);
|
|
11729
|
+
React17.useLayoutEffect(() => {
|
|
11601
11730
|
const host = hostRef.current;
|
|
11602
11731
|
if (!host) return;
|
|
11603
11732
|
const root = _internal.__createContentRoot.call(void 0, host);
|
|
@@ -11607,12 +11736,12 @@ function RuntimeContent({ content }) {
|
|
|
11607
11736
|
root.destroy();
|
|
11608
11737
|
};
|
|
11609
11738
|
}, []);
|
|
11610
|
-
|
|
11611
|
-
_optionalChain([rootRef, 'access',
|
|
11739
|
+
React17.useLayoutEffect(() => {
|
|
11740
|
+
_optionalChain([rootRef, 'access', _719 => _719.current, 'optionalAccess', _720 => _720.update, 'call', _721 => _721(content)]);
|
|
11612
11741
|
}, [content]);
|
|
11613
11742
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: hostRef, style: { display: "contents" } });
|
|
11614
11743
|
}
|
|
11615
|
-
function renderOptions(props, controller, slots, owner) {
|
|
11744
|
+
function renderOptions(props, controller, slots, owner, renderHiddenRangeMarker) {
|
|
11616
11745
|
const slot = (key, node) => slots.render(key, node, owner);
|
|
11617
11746
|
const runtime = (node) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RuntimeContent, { content: node });
|
|
11618
11747
|
const {
|
|
@@ -11639,6 +11768,7 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11639
11768
|
return {
|
|
11640
11769
|
...other,
|
|
11641
11770
|
controller,
|
|
11771
|
+
renderHiddenRangeMarker,
|
|
11642
11772
|
emptyState: emptyState === void 0 ? void 0 : slot("empty", emptyState),
|
|
11643
11773
|
loadingComponent: loadingComponent === void 0 ? void 0 : slot("loading-component", loadingComponent),
|
|
11644
11774
|
loadingState: loadingState === void 0 ? void 0 : slot("loading", loadingState),
|
|
@@ -11670,13 +11800,24 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11670
11800
|
};
|
|
11671
11801
|
}
|
|
11672
11802
|
function BoundViewer({ props, controller: sourceController }) {
|
|
11673
|
-
const messages =
|
|
11674
|
-
const controller =
|
|
11675
|
-
const hostRef =
|
|
11676
|
-
const viewerRef =
|
|
11677
|
-
const slots =
|
|
11678
|
-
|
|
11679
|
-
|
|
11803
|
+
const messages = React17.useMemo(() => _chunkUXJAG7MUcjs.mergeMessages.call(void 0, sourceController.messages, props.messages), [sourceController.messages, props.messages]);
|
|
11804
|
+
const controller = React17.useMemo(() => ({ ...sourceController, messages }), [sourceController, messages]);
|
|
11805
|
+
const hostRef = React17.useRef(null);
|
|
11806
|
+
const viewerRef = React17.useRef(null);
|
|
11807
|
+
const slots = React17.useMemo(() => new SlotStore(), []);
|
|
11808
|
+
const markerRenderer = props.renderHiddenRangeMarker;
|
|
11809
|
+
const markerSheetIndex = _optionalChain([controller, 'access', _722 => _722.activeSheet, 'optionalAccess', _723 => _723.workbookSheetIndex]);
|
|
11810
|
+
const renderHiddenRangeMarker = React17.useMemo(() => {
|
|
11811
|
+
if (!markerRenderer) return void 0;
|
|
11812
|
+
return ({ defaultNode, ...range }) => {
|
|
11813
|
+
const content = markerRenderer({ ...range, defaultNode: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RuntimeContent, { content: defaultNode }) });
|
|
11814
|
+
if (content == null || content === false) return null;
|
|
11815
|
+
const host = hostRef.current;
|
|
11816
|
+
return host ? slots.render(`hidden:${markerSheetIndex}:${range.axis}:${range.start}`, content, host.ownerDocument) : null;
|
|
11817
|
+
};
|
|
11818
|
+
}, [markerRenderer, markerSheetIndex, slots]);
|
|
11819
|
+
React17.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
|
|
11820
|
+
React17.useLayoutEffect(() => {
|
|
11680
11821
|
const host = hostRef.current;
|
|
11681
11822
|
if (!host) return;
|
|
11682
11823
|
slots.observe(host);
|
|
@@ -11688,10 +11829,10 @@ function BoundViewer({ props, controller: sourceController }) {
|
|
|
11688
11829
|
slots.destroy();
|
|
11689
11830
|
};
|
|
11690
11831
|
}, [slots]);
|
|
11691
|
-
|
|
11832
|
+
React17.useLayoutEffect(() => {
|
|
11692
11833
|
const host = hostRef.current;
|
|
11693
|
-
if (host) _optionalChain([viewerRef, 'access',
|
|
11694
|
-
}, [controller, props, slots]);
|
|
11834
|
+
if (host) _optionalChain([viewerRef, 'access', _724 => _724.current, 'optionalAccess', _725 => _725.update, 'call', _726 => _726(renderOptions(props, controller, slots, host.ownerDocument, renderHiddenRangeMarker))]);
|
|
11835
|
+
}, [controller, props, slots, renderHiddenRangeMarker]);
|
|
11695
11836
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ViewerAppearanceContext.Provider, { value: {
|
|
11696
11837
|
headerBackgroundColor: props.headerBackgroundColor,
|
|
11697
11838
|
headerTextColor: props.headerTextColor,
|
|
@@ -11706,7 +11847,7 @@ function UncontrolledViewer(props) {
|
|
|
11706
11847
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller });
|
|
11707
11848
|
}
|
|
11708
11849
|
function XlsxViewer(props) {
|
|
11709
|
-
const context =
|
|
11850
|
+
const context = React17.useContext(ViewerContext);
|
|
11710
11851
|
const controller = _nullishCoalesce(props.controller, () => ( context));
|
|
11711
11852
|
return controller ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UncontrolledViewer, { ...props });
|
|
11712
11853
|
}
|