@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.js
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
mergeMessages,
|
|
43
43
|
resolveMessages,
|
|
44
44
|
useXlsxMessages
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-MCS2EQEF.js";
|
|
46
46
|
import "./chunk-QXXS4J36.js";
|
|
47
47
|
import {
|
|
48
48
|
configureWorkbookArchiveDecoder,
|
|
@@ -93,6 +93,80 @@ function* bandIndices(bands) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
// src/read-only-layout.ts
|
|
97
|
+
function changedVisibilityRanges(existing, ranges, hidden, fromSelection) {
|
|
98
|
+
if (!hidden && !existing.size) return [];
|
|
99
|
+
let firstVisible = 0;
|
|
100
|
+
if (!hidden && fromSelection) {
|
|
101
|
+
while (existing.has(firstVisible)) firstVisible++;
|
|
102
|
+
}
|
|
103
|
+
const changed = [];
|
|
104
|
+
for (const range of ranges) {
|
|
105
|
+
const start = firstVisible > 0 && range.start === firstVisible ? 0 : range.start;
|
|
106
|
+
for (let index = start; index <= range.end; index++) {
|
|
107
|
+
if (existing.has(index) !== hidden) {
|
|
108
|
+
changed.push({ start, end: range.end });
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return changed;
|
|
114
|
+
}
|
|
115
|
+
function nextVisibleIndex(index, limit, isHidden) {
|
|
116
|
+
let next = index;
|
|
117
|
+
while (next < limit && isHidden(next)) next++;
|
|
118
|
+
if (next < limit) return next;
|
|
119
|
+
next = index - 1;
|
|
120
|
+
while (next >= 0 && isHidden(next)) next--;
|
|
121
|
+
return next;
|
|
122
|
+
}
|
|
123
|
+
function visibleAxis(hidden, max, originalIndices, originalSizes, overrides, defaultSize) {
|
|
124
|
+
const indices = [];
|
|
125
|
+
const sizes = [];
|
|
126
|
+
let offset = 0;
|
|
127
|
+
for (let index = 0; index <= max; index++) {
|
|
128
|
+
const originalSize = originalIndices[offset] === index ? originalSizes[offset++] : void 0;
|
|
129
|
+
if (hidden.has(index)) continue;
|
|
130
|
+
indices.push(index);
|
|
131
|
+
sizes.push(originalSize ?? overrides[index] ?? defaultSize);
|
|
132
|
+
}
|
|
133
|
+
return { indices, sizes };
|
|
134
|
+
}
|
|
135
|
+
function applyReadOnlyLayout(sheet, layout) {
|
|
136
|
+
if (!layout) return sheet;
|
|
137
|
+
const view = { ...sheet };
|
|
138
|
+
if (layout.freezePanes !== void 0) view.freezePanes = layout.freezePanes;
|
|
139
|
+
if (layout.hiddenRows) {
|
|
140
|
+
const rows = visibleAxis(
|
|
141
|
+
layout.hiddenRows,
|
|
142
|
+
sheet.maxUsedRow,
|
|
143
|
+
sheet.visibleRows,
|
|
144
|
+
sheet.rowHeights,
|
|
145
|
+
sheet.rowHeightOverridesPx,
|
|
146
|
+
sheet.defaultRowHeightPx
|
|
147
|
+
);
|
|
148
|
+
view.hiddenRows = Array.from(layout.hiddenRows).sort((a, b) => a - b);
|
|
149
|
+
view.visibleRows = rows.indices;
|
|
150
|
+
view.rowHeights = rows.sizes;
|
|
151
|
+
view.rowCount = rows.indices.length;
|
|
152
|
+
}
|
|
153
|
+
if (layout.hiddenCols) {
|
|
154
|
+
const cols = visibleAxis(
|
|
155
|
+
layout.hiddenCols,
|
|
156
|
+
sheet.maxUsedCol,
|
|
157
|
+
sheet.visibleCols,
|
|
158
|
+
sheet.colWidths,
|
|
159
|
+
sheet.colWidthOverridesPx,
|
|
160
|
+
sheet.defaultColWidthPx
|
|
161
|
+
);
|
|
162
|
+
view.hiddenCols = Array.from(layout.hiddenCols).sort((a, b) => a - b);
|
|
163
|
+
view.visibleCols = cols.indices;
|
|
164
|
+
view.colWidths = cols.sizes;
|
|
165
|
+
view.colCount = cols.indices.length;
|
|
166
|
+
}
|
|
167
|
+
return view;
|
|
168
|
+
}
|
|
169
|
+
|
|
96
170
|
// src/merged-range-lookup.ts
|
|
97
171
|
function createMergedRangeLookup(ranges) {
|
|
98
172
|
const normalizedRanges = [];
|
|
@@ -962,7 +1036,7 @@ var XlsxWorkerClient = class {
|
|
|
962
1036
|
}
|
|
963
1037
|
async getMainRuntime() {
|
|
964
1038
|
if (this.disposed) throw createAbortError();
|
|
965
|
-
this.mainRuntime ??= import("./workbook-runtime-
|
|
1039
|
+
this.mainRuntime ??= import("./workbook-runtime-BAAYDYYK.js").then(({ createWorkbookRuntime }) => createWorkbookRuntime());
|
|
966
1040
|
const runtime = await this.mainRuntime;
|
|
967
1041
|
if (this.disposed) {
|
|
968
1042
|
runtime.dispose();
|
|
@@ -1938,6 +2012,8 @@ function downloadUrl(src, fileName) {
|
|
|
1938
2012
|
}
|
|
1939
2013
|
function useXlsxViewerController(options2) {
|
|
1940
2014
|
const {
|
|
2015
|
+
allowFreezeInReadOnly = false,
|
|
2016
|
+
allowHideInReadOnly = false,
|
|
1941
2017
|
allowResizeInReadOnly = false,
|
|
1942
2018
|
deferLoadingAboveBytes = DEFAULT_DEFER_LOADING_ABOVE_BYTES,
|
|
1943
2019
|
file,
|
|
@@ -1956,7 +2032,8 @@ function useXlsxViewerController(options2) {
|
|
|
1956
2032
|
const [isLoading, setIsLoading] = React.useState(Boolean(file ?? src));
|
|
1957
2033
|
const [error, setError] = React.useState(null);
|
|
1958
2034
|
const [workbook, setWorkbook] = React.useState(null);
|
|
1959
|
-
const [
|
|
2035
|
+
const [readOnlyLayouts, setReadOnlyLayouts] = React.useState({});
|
|
2036
|
+
const [workbookSheets, setSheets] = React.useState([]);
|
|
1960
2037
|
const [chartsByWorkbookSheetIndex, setChartsByWorkbookSheetIndex] = React.useState([]);
|
|
1961
2038
|
const [chartsheets, setChartsheets] = React.useState([]);
|
|
1962
2039
|
const [tabs, setTabs] = React.useState([]);
|
|
@@ -2011,6 +2088,7 @@ function useXlsxViewerController(options2) {
|
|
|
2011
2088
|
const displayFileName = React.useMemo(() => resolveDisplayFileName(src, fileName), [fileName, src]);
|
|
2012
2089
|
const shouldDeferLoading = deferLoadingAboveBytes > 0;
|
|
2013
2090
|
const readOnly = requestedReadOnly || forcedReadOnly;
|
|
2091
|
+
const sheets = React.useMemo(() => readOnly ? workbookSheets.map((sheet) => applyReadOnlyLayout(sheet, readOnlyLayouts[sheet.workbookSheetIndex])) : workbookSheets, [readOnly, readOnlyLayouts, workbookSheets]);
|
|
2014
2092
|
const drawingMutationEpoch = React.useRef(0);
|
|
2015
2093
|
const drawingMutationState = React.useRef({ workbook, revision, readOnly, activeCell, activeSheetIndex });
|
|
2016
2094
|
drawingMutationState.current = { workbook, revision, readOnly, activeCell, activeSheetIndex };
|
|
@@ -2172,6 +2250,7 @@ function useXlsxViewerController(options2) {
|
|
|
2172
2250
|
}, [disposeWorkerClient]);
|
|
2173
2251
|
React.useEffect(() => {
|
|
2174
2252
|
loadGenerationRef.current += 1;
|
|
2253
|
+
setReadOnlyLayouts({});
|
|
2175
2254
|
if (!file && !src) {
|
|
2176
2255
|
disposeWorkerClient();
|
|
2177
2256
|
setForcedReadOnly(false);
|
|
@@ -3463,28 +3542,50 @@ function useXlsxViewerController(options2) {
|
|
|
3463
3542
|
}));
|
|
3464
3543
|
setRevision((current) => current + 1);
|
|
3465
3544
|
}, [activeSheet]);
|
|
3545
|
+
const canChangeVisibility = Boolean(activeSheet && !isLoading && (readOnly ? allowHideInReadOnly : workbook));
|
|
3546
|
+
const canChangeFreezePanes = Boolean(activeSheet && !isLoading && (readOnly ? allowFreezeInReadOnly : workbook));
|
|
3547
|
+
const activeLayout = activeSheet && readOnly ? readOnlyLayouts[activeSheet.workbookSheetIndex] : void 0;
|
|
3548
|
+
React.useEffect(() => {
|
|
3549
|
+
if (!activeCell || !activeLayout) return;
|
|
3550
|
+
const { hiddenRows, hiddenCols } = activeLayout;
|
|
3551
|
+
const row2 = hiddenRows?.has(activeCell.row) ? nextVisibleIndex(activeCell.row, XLSX_MAX_ROWS, (index) => hiddenRows.has(index)) : activeCell.row;
|
|
3552
|
+
const col = hiddenCols?.has(activeCell.col) ? nextVisibleIndex(activeCell.col, XLSX_MAX_COLUMNS, (index) => hiddenCols.has(index)) : activeCell.col;
|
|
3553
|
+
if (row2 === activeCell.row && col === activeCell.col) return;
|
|
3554
|
+
const cell = row2 < 0 || col < 0 ? null : { row: row2, col };
|
|
3555
|
+
setActiveCell(cell);
|
|
3556
|
+
setSelection(cell && { start: cell, end: cell });
|
|
3557
|
+
selectionAnchorRef.current = cell;
|
|
3558
|
+
}, [activeCell, activeLayout, setSelection]);
|
|
3466
3559
|
const setAxisHidden = React.useCallback((axis, hidden, start, end = start) => {
|
|
3467
|
-
if (
|
|
3560
|
+
if (!canChangeVisibility || !activeSheet) return;
|
|
3468
3561
|
const limit = axis === "row" ? XLSX_MAX_ROWS : XLSX_MAX_COLUMNS;
|
|
3469
|
-
const
|
|
3562
|
+
const fromSelection = start === void 0 && end === void 0;
|
|
3563
|
+
const ranges = fromSelection ? selectionRanges.map((area) => ({ start: area.start[axis], end: area.end[axis] })) : [{ start: start ?? -1, end: end ?? -1 }];
|
|
3470
3564
|
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;
|
|
3471
|
-
const
|
|
3472
|
-
|
|
3473
|
-
const
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3565
|
+
const sheetIndex = activeSheet.workbookSheetIndex;
|
|
3566
|
+
if (readOnly) {
|
|
3567
|
+
const key = axis === "row" ? "hiddenRows" : "hiddenCols";
|
|
3568
|
+
setReadOnlyLayouts((current) => {
|
|
3569
|
+
const layout = current[sheetIndex];
|
|
3570
|
+
const existing = layout?.[key] ?? new Set(activeSheet[key]);
|
|
3571
|
+
const changes = changedVisibilityRanges(existing, ranges, hidden, fromSelection);
|
|
3572
|
+
if (!changes.length) return current;
|
|
3573
|
+
const next = new Set(existing);
|
|
3574
|
+
for (const range of changes) {
|
|
3575
|
+
for (let index = range.start; index <= range.end; index++) {
|
|
3576
|
+
if (hidden) next.add(index);
|
|
3577
|
+
else next.delete(index);
|
|
3578
|
+
}
|
|
3485
3579
|
}
|
|
3486
|
-
return
|
|
3580
|
+
return { ...current, [sheetIndex]: { ...layout, [key]: next } };
|
|
3487
3581
|
});
|
|
3582
|
+
return;
|
|
3583
|
+
}
|
|
3584
|
+
if (!workbook) return;
|
|
3585
|
+
const worksheet = workbook.getSheet(sheetIndex);
|
|
3586
|
+
try {
|
|
3587
|
+
const existing = new Set(axis === "row" ? worksheet.hiddenRows : worksheet.hiddenColumns);
|
|
3588
|
+
const changes = changedVisibilityRanges(existing, ranges, hidden, fromSelection);
|
|
3488
3589
|
if (!changes.length) return;
|
|
3489
3590
|
recordHistoryBeforeMutation();
|
|
3490
3591
|
for (const range of changes) {
|
|
@@ -3492,13 +3593,11 @@ function useXlsxViewerController(options2) {
|
|
|
3492
3593
|
else worksheet.setColumnsHidden(range.start, range.end, hidden);
|
|
3493
3594
|
}
|
|
3494
3595
|
if (hidden && activeCell && changes.some((range) => range.start <= activeCell[axis] && activeCell[axis] <= range.end)) {
|
|
3495
|
-
const
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
while (index >= 0 && isHidden(index)) index--;
|
|
3501
|
-
}
|
|
3596
|
+
const index = nextVisibleIndex(
|
|
3597
|
+
activeCell[axis],
|
|
3598
|
+
limit,
|
|
3599
|
+
(value) => axis === "row" ? worksheet.isRowHidden(value) : worksheet.isColumnHidden(value)
|
|
3600
|
+
);
|
|
3502
3601
|
if (index >= 0) {
|
|
3503
3602
|
const cell = { ...activeCell, [axis]: index };
|
|
3504
3603
|
setActiveCell(cell);
|
|
@@ -3510,16 +3609,23 @@ function useXlsxViewerController(options2) {
|
|
|
3510
3609
|
} finally {
|
|
3511
3610
|
worksheet.free();
|
|
3512
3611
|
}
|
|
3513
|
-
}, [activeCell, activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
|
|
3612
|
+
}, [activeCell, activeSheet, canChangeVisibility, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
|
|
3514
3613
|
const hideRows = React.useCallback((start, end) => setAxisHidden("row", true, start, end), [setAxisHidden]);
|
|
3515
3614
|
const unhideRows = React.useCallback((start, end) => setAxisHidden("row", false, start, end), [setAxisHidden]);
|
|
3516
3615
|
const hideColumns = React.useCallback((start, end) => setAxisHidden("col", true, start, end), [setAxisHidden]);
|
|
3517
3616
|
const unhideColumns = React.useCallback((start, end) => setAxisHidden("col", false, start, end), [setAxisHidden]);
|
|
3518
3617
|
const setFreezeBoundary = React.useCallback((cell) => {
|
|
3519
|
-
if (
|
|
3618
|
+
if (!canChangeFreezePanes || !activeSheet) return;
|
|
3520
3619
|
const { row: row2, col } = cell;
|
|
3521
3620
|
if (!Number.isInteger(row2) || row2 < 0 || row2 >= XLSX_MAX_ROWS || !Number.isInteger(col) || col < 0 || col >= XLSX_MAX_COLUMNS) return;
|
|
3522
|
-
const
|
|
3621
|
+
const sheetIndex = activeSheet.workbookSheetIndex;
|
|
3622
|
+
if (readOnly) {
|
|
3623
|
+
const freezePanes2 = row2 || col ? { row: row2, col } : null;
|
|
3624
|
+
setReadOnlyLayouts((current) => ({ ...current, [sheetIndex]: { ...current[sheetIndex], freezePanes: freezePanes2 } }));
|
|
3625
|
+
return;
|
|
3626
|
+
}
|
|
3627
|
+
if (!workbook) return;
|
|
3628
|
+
const worksheet = workbook.getSheet(sheetIndex);
|
|
3523
3629
|
try {
|
|
3524
3630
|
const current = parseWorksheetFreezePanes(worksheet);
|
|
3525
3631
|
if (row2 === (current?.row ?? 0) && col === (current?.col ?? 0)) return;
|
|
@@ -3529,9 +3635,9 @@ function useXlsxViewerController(options2) {
|
|
|
3529
3635
|
} finally {
|
|
3530
3636
|
worksheet.free();
|
|
3531
3637
|
}
|
|
3532
|
-
}, [activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
3638
|
+
}, [activeSheet, canChangeFreezePanes, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
3533
3639
|
const freezeCell = resolveFreezePanesCell(activeCell, selection);
|
|
3534
|
-
const canFreezePanes = Boolean(
|
|
3640
|
+
const canFreezePanes = Boolean(canChangeFreezePanes && freezeCell && (freezeCell.row > 0 || freezeCell.col > 0));
|
|
3535
3641
|
const freezePanes = React.useCallback((cell = freezeCell) => {
|
|
3536
3642
|
if (cell) setFreezeBoundary(cell);
|
|
3537
3643
|
}, [freezeCell, setFreezeBoundary]);
|
|
@@ -4001,7 +4107,8 @@ function useXlsxViewerController(options2) {
|
|
|
4001
4107
|
setSelectedImageId(null);
|
|
4002
4108
|
selectionAnchorRef.current = active?.start ?? null;
|
|
4003
4109
|
const cell = active?.[activeCorner];
|
|
4004
|
-
|
|
4110
|
+
const mergeAnchor = cell && findSelectionMerge(cell)?.start;
|
|
4111
|
+
setActiveCell(mergeAnchor && active && rangeContainsCell(active, mergeAnchor) ? mergeAnchor : cell ?? null);
|
|
4005
4112
|
setSelectionRanges(areas);
|
|
4006
4113
|
}, [findSelectionMerge]);
|
|
4007
4114
|
const selectRange = React.useCallback((range) => {
|
|
@@ -4822,6 +4929,8 @@ function useXlsxViewerController(options2) {
|
|
|
4822
4929
|
resizeChartBy,
|
|
4823
4930
|
resizeImageBy,
|
|
4824
4931
|
frozenPanes: activeSheet?.freezePanes ?? null,
|
|
4932
|
+
canChangeFreezePanes,
|
|
4933
|
+
canChangeVisibility,
|
|
4825
4934
|
canFreezePanes,
|
|
4826
4935
|
hideRows,
|
|
4827
4936
|
unhideRows,
|
|
@@ -4974,6 +5083,8 @@ function useXlsxViewerController(options2) {
|
|
|
4974
5083
|
revision,
|
|
4975
5084
|
resizeChartBy,
|
|
4976
5085
|
resizeImageBy,
|
|
5086
|
+
canChangeFreezePanes,
|
|
5087
|
+
canChangeVisibility,
|
|
4977
5088
|
canFreezePanes,
|
|
4978
5089
|
hideRows,
|
|
4979
5090
|
unhideRows,
|
|
@@ -5042,12 +5153,12 @@ function useXlsxViewerController(options2) {
|
|
|
5042
5153
|
import { initWasm, parseXlsxRange as parseXlsxRange2, setWasmSource, XlsxFileSizeLimitExceededError as XlsxFileSizeLimitExceededError3 } from "@extend-ai/react-xlsx/vanilla";
|
|
5043
5154
|
|
|
5044
5155
|
// src/react-viewer.tsx
|
|
5045
|
-
import * as
|
|
5156
|
+
import * as React17 from "react";
|
|
5046
5157
|
import { createPortal as createPortal7 } from "react-dom";
|
|
5047
5158
|
import { __createContentNode, __createContentRoot, __createControlledViewer } from "@extend-ai/react-xlsx/internal";
|
|
5048
5159
|
|
|
5049
5160
|
// src/XlsxViewer.tsx
|
|
5050
|
-
import * as
|
|
5161
|
+
import * as React16 from "react";
|
|
5051
5162
|
import { createPortal as createPortal6 } from "react-dom";
|
|
5052
5163
|
|
|
5053
5164
|
// src/cell-editor.tsx
|
|
@@ -5344,13 +5455,31 @@ function getCellGeneralAlignment(worksheet, row2, col) {
|
|
|
5344
5455
|
}
|
|
5345
5456
|
}
|
|
5346
5457
|
|
|
5347
|
-
// src/
|
|
5458
|
+
// src/hidden-range-marker.tsx
|
|
5348
5459
|
import * as React6 from "react";
|
|
5460
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
5461
|
+
function resizeCursor(axis) {
|
|
5462
|
+
const transform = axis === "column" ? ' transform="rotate(90 12 12)"' : "";
|
|
5463
|
+
const path = "M6 10h12 M6 14h12 M12 7V3 M9 6l3-3 3 3 M12 17v4 M9 18l3 3 3-3";
|
|
5464
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
5465
|
+
<g fill="none" stroke-linecap="round" stroke-linejoin="round"${transform}>
|
|
5466
|
+
<path d="${path}" stroke="white" stroke-width="3.5"/>
|
|
5467
|
+
<path d="${path}" stroke="#111" stroke-width="1.5"/>
|
|
5468
|
+
</g>
|
|
5469
|
+
</svg>`;
|
|
5470
|
+
const fallback = axis === "row" ? "row-resize" : "col-resize";
|
|
5471
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}") 12 12, ${fallback}`;
|
|
5472
|
+
}
|
|
5473
|
+
var ROW_RESIZE_CURSOR = resizeCursor("row");
|
|
5474
|
+
var COLUMN_RESIZE_CURSOR = resizeCursor("column");
|
|
5475
|
+
|
|
5476
|
+
// src/header-size-dialog.tsx
|
|
5477
|
+
import * as React7 from "react";
|
|
5349
5478
|
import { createPortal as createPortal3 } from "react-dom";
|
|
5350
|
-
import { jsx as
|
|
5479
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5351
5480
|
|
|
5352
5481
|
// src/context-menu.tsx
|
|
5353
|
-
import * as
|
|
5482
|
+
import * as React9 from "react";
|
|
5354
5483
|
import { createPortal as createPortal4 } from "react-dom";
|
|
5355
5484
|
|
|
5356
5485
|
// src/viewer-palette.ts
|
|
@@ -5415,23 +5544,23 @@ function resolveViewerPalette(isDark = false, headerBackgroundColor, headerTextC
|
|
|
5415
5544
|
}
|
|
5416
5545
|
|
|
5417
5546
|
// src/context-menu-items.tsx
|
|
5418
|
-
import * as
|
|
5419
|
-
import { Fragment as Fragment3, jsx as
|
|
5547
|
+
import * as React8 from "react";
|
|
5548
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
5420
5549
|
|
|
5421
5550
|
// src/context-menu.tsx
|
|
5422
|
-
import { jsx as
|
|
5551
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
5423
5552
|
|
|
5424
5553
|
// src/pivot-controls.tsx
|
|
5425
|
-
import * as
|
|
5426
|
-
import { Fragment as Fragment5, jsx as
|
|
5554
|
+
import * as React10 from "react";
|
|
5555
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
5427
5556
|
|
|
5428
5557
|
// src/pivot-header-controls.tsx
|
|
5429
|
-
import * as
|
|
5558
|
+
import * as React11 from "react";
|
|
5430
5559
|
import { createPortal as createPortal5 } from "react-dom";
|
|
5431
|
-
import { Fragment as Fragment7, jsx as
|
|
5560
|
+
import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5432
5561
|
|
|
5433
5562
|
// src/pivot-editor.ts
|
|
5434
|
-
import * as
|
|
5563
|
+
import * as React12 from "react";
|
|
5435
5564
|
function address(row2, col) {
|
|
5436
5565
|
let letters = "";
|
|
5437
5566
|
for (let n = col + 1; n > 0; n = Math.floor((n - 1) / 26)) letters = String.fromCharCode(65 + (n - 1) % 26) + letters;
|
|
@@ -5450,18 +5579,18 @@ function copyPivot(pivot) {
|
|
|
5450
5579
|
function usePivotTableEditor(viewer, options2 = {}) {
|
|
5451
5580
|
const open = viewer.pivotFieldListVisible;
|
|
5452
5581
|
const setOpen = viewer.setPivotFieldListVisible;
|
|
5453
|
-
const [draft, setDraft] =
|
|
5454
|
-
const [dirty, setDirty] =
|
|
5455
|
-
const [error, setError] =
|
|
5456
|
-
const [status, setStatus] =
|
|
5457
|
-
const [details, setDetails] =
|
|
5458
|
-
const [detailContext, setDetailContext] =
|
|
5459
|
-
const [loadedSource, setLoadedSource] =
|
|
5460
|
-
const [savedDefinition, setSavedDefinition] =
|
|
5461
|
-
const [pendingFocus, setPendingFocus] =
|
|
5582
|
+
const [draft, setDraft] = React12.useState(null);
|
|
5583
|
+
const [dirty, setDirty] = React12.useState(false);
|
|
5584
|
+
const [error, setError] = React12.useState(null);
|
|
5585
|
+
const [status, setStatus] = React12.useState(null);
|
|
5586
|
+
const [details, setDetails] = React12.useState(null);
|
|
5587
|
+
const [detailContext, setDetailContext] = React12.useState(null);
|
|
5588
|
+
const [loadedSource, setLoadedSource] = React12.useState("");
|
|
5589
|
+
const [savedDefinition, setSavedDefinition] = React12.useState("");
|
|
5590
|
+
const [pendingFocus, setPendingFocus] = React12.useState(null);
|
|
5462
5591
|
const sourceNeedsLoad = Boolean(draft && JSON.stringify(draft.source) !== loadedSource);
|
|
5463
5592
|
const stale = Boolean(dirty && draft?.id && savedDefinition !== JSON.stringify(viewer.pivotTables.find((pivot) => pivot.id === draft.id) ?? null));
|
|
5464
|
-
const run =
|
|
5593
|
+
const run = React12.useCallback((action) => {
|
|
5465
5594
|
setError(null);
|
|
5466
5595
|
setStatus(null);
|
|
5467
5596
|
try {
|
|
@@ -5471,7 +5600,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5471
5600
|
setOpen(true);
|
|
5472
5601
|
}
|
|
5473
5602
|
}, []);
|
|
5474
|
-
|
|
5603
|
+
React12.useEffect(() => {
|
|
5475
5604
|
if (options2.enabled === false) return;
|
|
5476
5605
|
setDraft(null);
|
|
5477
5606
|
setDirty(false);
|
|
@@ -5484,7 +5613,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5484
5613
|
setPendingFocus(null);
|
|
5485
5614
|
if (options2.initialOpen !== void 0) setOpen(options2.initialOpen);
|
|
5486
5615
|
}, [viewer.src, viewer.file]);
|
|
5487
|
-
|
|
5616
|
+
React12.useEffect(() => {
|
|
5488
5617
|
if (options2.enabled === false || dirty || !draft?.id) return;
|
|
5489
5618
|
const current = viewer.pivotTables.find((pivot) => pivot.id === draft.id);
|
|
5490
5619
|
setDraft(current ? copyPivot(current) : null);
|
|
@@ -5493,7 +5622,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5493
5622
|
setSavedDefinition(JSON.stringify(current));
|
|
5494
5623
|
}
|
|
5495
5624
|
}, [viewer.pivotTables]);
|
|
5496
|
-
|
|
5625
|
+
React12.useEffect(() => {
|
|
5497
5626
|
if (options2.enabled === false || options2.autoSelect === false || dirty || pendingFocus || !viewer.activeCell || !viewer.activeSheet) return;
|
|
5498
5627
|
const current = viewer.getPivotTableAtCell(viewer.activeCell, viewer.activeSheet.name);
|
|
5499
5628
|
if (!current || current.id === draft?.id) return;
|
|
@@ -5504,7 +5633,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5504
5633
|
setStatus(null);
|
|
5505
5634
|
setDetails(null);
|
|
5506
5635
|
}, [viewer.activeCell?.row, viewer.activeCell?.col, viewer.activeSheet?.name, viewer.pivotTables, options2.autoSelect, options2.enabled]);
|
|
5507
|
-
|
|
5636
|
+
React12.useEffect(() => {
|
|
5508
5637
|
if (!pendingFocus || viewer.activeSheet?.name.toLowerCase() !== pendingFocus.sheet.toLowerCase()) return;
|
|
5509
5638
|
viewer.selectCell({ row: pendingFocus.row, col: pendingFocus.col });
|
|
5510
5639
|
setPendingFocus(null);
|
|
@@ -5709,8 +5838,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5709
5838
|
}
|
|
5710
5839
|
|
|
5711
5840
|
// src/pivot-field-list.tsx
|
|
5712
|
-
import * as
|
|
5713
|
-
import { Fragment as Fragment8, jsx as
|
|
5841
|
+
import * as React13 from "react";
|
|
5842
|
+
import { Fragment as Fragment8, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5714
5843
|
var AREAS = ["reportFilters", "columns", "rows", "values"];
|
|
5715
5844
|
var AREA_NAMES = { reportFilters: "Filters", columns: "Columns", rows: "Rows", values: "Values" };
|
|
5716
5845
|
var AGGREGATIONS = [["sum", "Sum"], ["count", "Count"], ["average", "Average"], ["max", "Max"], ["min", "Min"], ["product", "Product"], ["countNums", "Count Numbers"], ["stdDev", "StdDev"], ["stdDevp", "StdDevp"], ["var", "Var"], ["varp", "Varp"]];
|
|
@@ -5737,52 +5866,52 @@ function groupingUnit(axis) {
|
|
|
5737
5866
|
return axis?.grouping ? axis.grouping.kind === "date" ? axis.grouping.unit : axis.grouping.kind : null;
|
|
5738
5867
|
}
|
|
5739
5868
|
function Action({ children: children2, primary, style, ...props }) {
|
|
5740
|
-
return /* @__PURE__ */
|
|
5869
|
+
return /* @__PURE__ */ jsx10("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 });
|
|
5741
5870
|
}
|
|
5742
5871
|
function Text({ label, value, onChange, ...props }) {
|
|
5743
5872
|
return /* @__PURE__ */ jsxs7("label", { style: { ...stack, gap: 4 }, children: [
|
|
5744
|
-
/* @__PURE__ */
|
|
5745
|
-
/* @__PURE__ */
|
|
5873
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
5874
|
+
/* @__PURE__ */ jsx10("input", { ...props, style: { ...control, ...props.style }, value, onChange: (event) => onChange(event.target.value) })
|
|
5746
5875
|
] });
|
|
5747
5876
|
}
|
|
5748
5877
|
function Choice({ label, value, options: options2, onChange, placeholder, disabled }) {
|
|
5749
5878
|
return /* @__PURE__ */ jsxs7("label", { style: { ...stack, gap: 4 }, children: [
|
|
5750
|
-
/* @__PURE__ */
|
|
5879
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
5751
5880
|
/* @__PURE__ */ jsxs7("select", { disabled, style: control, value, onChange: (event) => onChange(event.target.value), children: [
|
|
5752
|
-
placeholder ? /* @__PURE__ */
|
|
5753
|
-
options2.map(([key, text]) => /* @__PURE__ */
|
|
5881
|
+
placeholder ? /* @__PURE__ */ jsx10("option", { value: "", children: placeholder }) : null,
|
|
5882
|
+
options2.map(([key, text]) => /* @__PURE__ */ jsx10("option", { value: key, children: text }, key))
|
|
5754
5883
|
] })
|
|
5755
5884
|
] });
|
|
5756
5885
|
}
|
|
5757
5886
|
function Check({ label, checked, onChange, disabled }) {
|
|
5758
5887
|
return /* @__PURE__ */ jsxs7("label", { style: { ...row, alignItems: "flex-start", cursor: disabled ? "default" : "pointer", paddingBlock: 2 }, children: [
|
|
5759
|
-
/* @__PURE__ */
|
|
5760
|
-
/* @__PURE__ */
|
|
5888
|
+
/* @__PURE__ */ jsx10("input", { type: "checkbox", disabled, checked, onChange: (event) => onChange(event.target.checked), style: { margin: "2px 0 0", accentColor: "var(--xlsx-pivot-accent)", flexShrink: 0 } }),
|
|
5889
|
+
/* @__PURE__ */ jsx10("span", { style: { overflowWrap: "anywhere" }, children: label })
|
|
5761
5890
|
] });
|
|
5762
5891
|
}
|
|
5763
5892
|
function Section({ title, children: children2 }) {
|
|
5764
5893
|
return /* @__PURE__ */ jsxs7("details", { style: { borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5765
|
-
/* @__PURE__ */
|
|
5766
|
-
/* @__PURE__ */
|
|
5894
|
+
/* @__PURE__ */ jsx10("summary", { style: { cursor: "pointer", fontWeight: 600, padding: "11px 12px", userSelect: "none" }, children: title }),
|
|
5895
|
+
/* @__PURE__ */ jsx10("div", { style: { ...stack, padding: "0 12px 12px" }, children: children2 })
|
|
5767
5896
|
] });
|
|
5768
5897
|
}
|
|
5769
5898
|
function Members({ items, selected, onChange, label = "Items" }) {
|
|
5770
|
-
const [search, setSearch] =
|
|
5899
|
+
const [search, setSearch] = React13.useState("");
|
|
5771
5900
|
const visible = items.filter((item) => item.caption.toLocaleLowerCase().includes(search.toLocaleLowerCase()));
|
|
5772
5901
|
const keys = new Set(selected);
|
|
5773
5902
|
return /* @__PURE__ */ jsxs7("div", { style: { ...stack, gap: 6 }, children: [
|
|
5774
|
-
/* @__PURE__ */
|
|
5903
|
+
/* @__PURE__ */ jsx10(Text, { label: `Search ${label.toLowerCase()}`, type: "search", value: search, onChange: setSearch }),
|
|
5775
5904
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, flexWrap: "wrap" }, children: [
|
|
5776
|
-
/* @__PURE__ */
|
|
5777
|
-
/* @__PURE__ */
|
|
5905
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => onChange(items.map((item) => item.key)), children: "Select all" }),
|
|
5906
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => onChange([]), children: "Clear" }),
|
|
5778
5907
|
/* @__PURE__ */ jsxs7("span", { style: hint, children: [
|
|
5779
5908
|
keys.size,
|
|
5780
5909
|
" selected"
|
|
5781
5910
|
] })
|
|
5782
5911
|
] }),
|
|
5783
5912
|
/* @__PURE__ */ jsxs7("div", { role: "group", "aria-label": label, style: { maxHeight: 150, overflowY: "auto", padding: "4px 6px", border: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5784
|
-
visible.slice(0, 200).map((item) => /* @__PURE__ */
|
|
5785
|
-
!visible.length ? /* @__PURE__ */
|
|
5913
|
+
visible.slice(0, 200).map((item) => /* @__PURE__ */ jsx10(Check, { label: item.caption || "(blank)", checked: keys.has(item.key), onChange: (checked) => onChange(checked ? [...keys, item.key] : selected.filter((key) => key !== item.key)) }, item.key)),
|
|
5914
|
+
!visible.length ? /* @__PURE__ */ jsx10("p", { style: hint, children: "No matching items." }) : null,
|
|
5786
5915
|
visible.length > 200 ? /* @__PURE__ */ jsxs7("p", { style: hint, children: [
|
|
5787
5916
|
"Search to narrow ",
|
|
5788
5917
|
visible.length.toLocaleString(),
|
|
@@ -5799,16 +5928,16 @@ function ValueSettings({ pivot, value, onChange }) {
|
|
|
5799
5928
|
const base = baseAxes.find((axis) => groupingUnit(axis) === (value.baseGroupingUnit ?? null)) ?? baseAxes[0];
|
|
5800
5929
|
const source = pivot.fields.find((field) => field.index === value.baseField);
|
|
5801
5930
|
return /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5802
|
-
/* @__PURE__ */
|
|
5803
|
-
/* @__PURE__ */
|
|
5804
|
-
/* @__PURE__ */
|
|
5805
|
-
needsBase ? /* @__PURE__ */
|
|
5806
|
-
needsBase && baseAxes.length > 1 ? /* @__PURE__ */
|
|
5807
|
-
needsItem ? /* @__PURE__ */
|
|
5808
|
-
/* @__PURE__ */
|
|
5809
|
-
/* @__PURE__ */
|
|
5810
|
-
/* @__PURE__ */
|
|
5811
|
-
/* @__PURE__ */
|
|
5931
|
+
/* @__PURE__ */ jsx10(Text, { label: "Custom name", value: value.name, onChange: (name) => onChange({ ...value, name }) }),
|
|
5932
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Summarize values by", value: value.aggregation, options: AGGREGATIONS, onChange: (aggregation) => onChange({ ...value, aggregation }) }),
|
|
5933
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Show values as", value: value.showAs, options: SHOW_AS, onChange: (showAs) => onChange({ ...value, showAs, baseField: value.baseField ?? axes[0]?.field }) }),
|
|
5934
|
+
needsBase ? /* @__PURE__ */ jsx10(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,
|
|
5935
|
+
needsBase && baseAxes.length > 1 ? /* @__PURE__ */ jsx10(Choice, { label: "Base grouping level", value: value.baseGroupingUnit ?? groupingUnit(base) ?? "", options: baseAxes.map((axis) => [groupingUnit(axis) ?? "", axis.name || groupingUnit(axis) || "Source items"]), onChange: (unit) => onChange({ ...value, baseGroupingUnit: unit || null, baseItem: null }) }) : null,
|
|
5936
|
+
needsItem ? /* @__PURE__ */ jsx10(Choice, { label: "Base item", value: value.baseItem ?? "previous", options: [["previous", "(previous)"], ["next", "(next)"], ...(base?.items?.length ? base.items : source?.items ?? []).map((item) => [item.key, item.caption])], onChange: (baseItem) => onChange({ ...value, baseItem }) }) : null,
|
|
5937
|
+
/* @__PURE__ */ jsx10(Text, { label: "Number format", value: value.numberFormat ?? "", placeholder: "General", onChange: (numberFormat) => onChange({ ...value, numberFormat: numberFormat || null }) }),
|
|
5938
|
+
/* @__PURE__ */ jsx10(Text, { label: "Calculated field formula", value: value.formula ?? "", placeholder: "Leave blank for a source field", onChange: (formula) => onChange({ ...value, formula: formula || null }) }),
|
|
5939
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: "Use field names in formulas. Enclose names containing spaces in single quotes or square brackets." }),
|
|
5940
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: FORMULA_HELP })
|
|
5812
5941
|
] });
|
|
5813
5942
|
}
|
|
5814
5943
|
function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
@@ -5817,38 +5946,38 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
|
5817
5946
|
const updateGrouping = (patch) => onChange({ ...axis, grouping: { ...grouping, ...patch }, items: [], collapsed: [] });
|
|
5818
5947
|
const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && field.grouping?.kind === "date" && field.grouping.unit === unit));
|
|
5819
5948
|
return /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5820
|
-
/* @__PURE__ */
|
|
5821
|
-
/* @__PURE__ */
|
|
5822
|
-
axis.sort.startsWith("value") ? /* @__PURE__ */
|
|
5823
|
-
/* @__PURE__ */
|
|
5949
|
+
/* @__PURE__ */ jsx10(Text, { label: "Custom name", value: axis.name ?? "", placeholder: source?.name, onChange: (name) => onChange({ ...axis, name: name || null }) }),
|
|
5950
|
+
/* @__PURE__ */ jsx10(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: axis.sortMeasure ?? 0 }) }),
|
|
5951
|
+
axis.sort.startsWith("value") ? /* @__PURE__ */ jsx10(Choice, { label: "Sort by value", value: String(axis.sortMeasure ?? 0), options: pivot.values.map((value, index) => [String(index), value.name]), onChange: (sortMeasure) => onChange({ ...axis, sortMeasure: Number(sortMeasure) }) }) : null,
|
|
5952
|
+
/* @__PURE__ */ jsx10(Check, { label: "Show subtotals", checked: axis.subtotals, onChange: (subtotals) => onChange({ ...axis, subtotals }) }),
|
|
5824
5953
|
axis.subtotals ? /* @__PURE__ */ jsxs7("details", { children: [
|
|
5825
|
-
/* @__PURE__ */
|
|
5826
|
-
/* @__PURE__ */
|
|
5827
|
-
/* @__PURE__ */
|
|
5954
|
+
/* @__PURE__ */ jsx10("summary", { style: { cursor: "pointer" }, children: "Custom subtotal functions" }),
|
|
5955
|
+
/* @__PURE__ */ jsx10("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 3, marginTop: 6 }, children: AGGREGATIONS.map(([value, label]) => /* @__PURE__ */ jsx10(Check, { label, checked: axis.subtotalFunctions?.includes(value) ?? false, onChange: (checked) => onChange({ ...axis, subtotalFunctions: checked ? [...axis.subtotalFunctions ?? [], value] : axis.subtotalFunctions?.filter((item) => item !== value) }) }, value)) }),
|
|
5956
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: "Leave unchecked to use the value field\u2019s summary function." })
|
|
5828
5957
|
] }) : null,
|
|
5829
|
-
/* @__PURE__ */
|
|
5830
|
-
/* @__PURE__ */
|
|
5831
|
-
grouping?.kind === "date" ? /* @__PURE__ */
|
|
5958
|
+
/* @__PURE__ */ jsx10(Check, { label: "Show items with no data", checked: axis.showItemsWithNoData ?? false, onChange: (showItemsWithNoData) => onChange({ ...axis, showItemsWithNoData }) }),
|
|
5959
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Grouping", value: grouping?.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: [] }) }),
|
|
5960
|
+
grouping?.kind === "date" ? /* @__PURE__ */ jsx10(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,
|
|
5832
5961
|
grouping && grouping.kind !== "manual" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5833
|
-
/* @__PURE__ */
|
|
5962
|
+
/* @__PURE__ */ jsx10(Text, { label: "Interval", type: "number", min: 1e-6, step: "any", value: String(grouping.interval), onChange: (interval) => updateGrouping({ interval: Number(interval) }) }),
|
|
5834
5963
|
/* @__PURE__ */ jsxs7("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
5835
|
-
/* @__PURE__ */
|
|
5836
|
-
/* @__PURE__ */
|
|
5964
|
+
/* @__PURE__ */ jsx10(Text, { label: "Starting at", type: "number", step: "any", placeholder: "Automatic", value: grouping.start == null ? "" : String(grouping.start), onChange: (start) => updateGrouping({ start: start === "" ? null : Number(start) }) }),
|
|
5965
|
+
/* @__PURE__ */ jsx10(Text, { label: "Ending at", type: "number", step: "any", placeholder: "Automatic", value: grouping.end == null ? "" : String(grouping.end), onChange: (end) => updateGrouping({ end: end === "" ? null : Number(end) }) })
|
|
5837
5966
|
] }),
|
|
5838
|
-
grouping.kind === "date" ? /* @__PURE__ */
|
|
5967
|
+
grouping.kind === "date" ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Optional bounds use Excel date serial values." }) : null
|
|
5839
5968
|
] }) : null,
|
|
5840
|
-
grouping?.kind === "date" && availableUnits.length ? /* @__PURE__ */
|
|
5969
|
+
grouping?.kind === "date" && availableUnits.length ? /* @__PURE__ */ jsx10(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,
|
|
5841
5970
|
grouping?.kind === "manual" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5842
5971
|
grouping.groups.map((group, index) => /* @__PURE__ */ jsxs7("div", { style: { ...stack, borderTop: "1px solid var(--xlsx-pivot-border)", paddingTop: 8 }, children: [
|
|
5843
|
-
/* @__PURE__ */
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5972
|
+
/* @__PURE__ */ jsx10(Text, { label: "Group name", value: group.name, onChange: (name) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, name } : item) }) }),
|
|
5973
|
+
/* @__PURE__ */ jsx10(Members, { items: source?.items ?? [], selected: group.members, onChange: (members) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, members } : item) }) }),
|
|
5974
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => updateGrouping({ groups: grouping.groups.filter((_, position) => position !== index) }), children: "Remove group" })
|
|
5846
5975
|
] }, index)),
|
|
5847
|
-
/* @__PURE__ */
|
|
5976
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => updateGrouping({ groups: [...grouping.groups, { name: `Group ${grouping.groups.length + 1}`, members: [] }] }), children: "Add named group" })
|
|
5848
5977
|
] }) : null,
|
|
5849
5978
|
/* @__PURE__ */ jsxs7("details", { children: [
|
|
5850
|
-
/* @__PURE__ */
|
|
5851
|
-
/* @__PURE__ */
|
|
5979
|
+
/* @__PURE__ */ jsx10("summary", { style: { cursor: "pointer" }, children: "Collapse members" }),
|
|
5980
|
+
/* @__PURE__ */ jsx10("div", { style: { paddingTop: 8 }, children: grouping && !axis.items?.length ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Apply grouping to load its members." }) : /* @__PURE__ */ jsx10(Members, { label: "Members to collapse", items: axis.items?.length ? axis.items : source?.items ?? [], selected: axis.collapsed, onChange: (collapsed) => onChange({ ...axis, collapsed }) }) })
|
|
5852
5981
|
] })
|
|
5853
5982
|
] });
|
|
5854
5983
|
}
|
|
@@ -5865,70 +5994,70 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5865
5994
|
"Field filters",
|
|
5866
5995
|
unit ? ` \xB7 ${unit}` : ""
|
|
5867
5996
|
] }),
|
|
5868
|
-
filterAxis?.grouping && !filterAxis.items?.length ? /* @__PURE__ */
|
|
5997
|
+
filterAxis?.grouping && !filterAxis.items?.length ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Apply grouping before selecting its members." }) : null,
|
|
5869
5998
|
filters.map(({ filter, index }) => /* @__PURE__ */ jsxs7("div", { style: { ...stack, paddingBlock: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5870
5999
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
5871
|
-
/* @__PURE__ */
|
|
5872
|
-
/* @__PURE__ */
|
|
6000
|
+
/* @__PURE__ */ jsx10("span", { children: kinds.find(([kind]) => kind === filter.kind)?.[1] }),
|
|
6001
|
+
/* @__PURE__ */ jsx10(Action, { "aria-label": `Remove ${filter.kind} filter`, onClick: () => update(index, null), children: "\xD7" })
|
|
5873
6002
|
] }),
|
|
5874
|
-
filter.kind === "members" ? /* @__PURE__ */
|
|
6003
|
+
filter.kind === "members" ? /* @__PURE__ */ jsx10(Members, { items: members, selected: filter.values, onChange: (values) => update(index, { ...filter, values }) }) : null,
|
|
5875
6004
|
filter.kind === "label" || filter.kind === "value" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5876
|
-
/* @__PURE__ */
|
|
5877
|
-
/* @__PURE__ */
|
|
5878
|
-
filter.operator === "between" || filter.operator === "notBetween" ? /* @__PURE__ */
|
|
6005
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Condition", value: filter.operator, options: filter.kind === "value" ? OPERATORS.filter(([operator]) => !/contains|begins|ends/i.test(operator)) : OPERATORS, onChange: (operator) => update(index, { ...filter, operator }) }),
|
|
6006
|
+
/* @__PURE__ */ jsx10(Text, { label: "Value", type: filter.kind === "value" ? "number" : "text", value: filter.value, onChange: (value) => update(index, { ...filter, value }) }),
|
|
6007
|
+
filter.operator === "between" || filter.operator === "notBetween" ? /* @__PURE__ */ jsx10(Text, { label: "And", type: filter.kind === "value" ? "number" : "text", value: filter.value2, onChange: (value2) => update(index, { ...filter, value2 }) }) : null
|
|
5879
6008
|
] }) : null,
|
|
5880
6009
|
filter.kind === "top10" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5881
|
-
/* @__PURE__ */
|
|
5882
|
-
/* @__PURE__ */
|
|
5883
|
-
/* @__PURE__ */
|
|
6010
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Show", value: filter.top ? "top" : "bottom", options: [["top", "Top"], ["bottom", "Bottom"]], onChange: (top) => update(index, { ...filter, top: top === "top" }) }),
|
|
6011
|
+
/* @__PURE__ */ jsx10(Text, { label: "Amount", type: "number", min: 1, value: String(filter.count), onChange: (count) => update(index, { ...filter, count: Number(count) }) }),
|
|
6012
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Unit", value: filter.percent ? "percent" : "items", options: [["items", "Items"], ["percent", "Percent"]], onChange: (percent) => update(index, { ...filter, percent: percent === "percent" }) })
|
|
5884
6013
|
] }) : null,
|
|
5885
|
-
filter.kind === "value" || filter.kind === "top10" ? /* @__PURE__ */
|
|
6014
|
+
filter.kind === "value" || filter.kind === "top10" ? /* @__PURE__ */ jsx10(Choice, { label: "By value", value: String(filter.measure), options: pivot.values.map((value, position) => [String(position), value.name]), onChange: (measure) => update(index, { ...filter, measure: Number(measure) }) }) : null
|
|
5886
6015
|
] }, index)),
|
|
5887
|
-
/* @__PURE__ */
|
|
6016
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Add filter", value: "", placeholder: "Choose a filter", options: kinds.filter(([kind]) => !filters.some(({ filter }) => filter.kind === kind)), onChange: (kind) => editor.edit((current) => ({ ...current, filters: [...current.filters, { field, groupingUnit: unit, kind, values: kind === "members" ? members.map((member) => member.key) : [], operator: "equal", value: "", value2: "", measure: 0, top: true, count: 10, percent: false }] })) })
|
|
5888
6017
|
] });
|
|
5889
6018
|
}
|
|
5890
6019
|
function Advanced({ editor, pivot }) {
|
|
5891
|
-
const [chartType, setChartType] =
|
|
5892
|
-
const [chartCell, setChartCell] =
|
|
5893
|
-
const [chartTitle, setChartTitle] =
|
|
5894
|
-
const [chartMeasure, setChartMeasure] =
|
|
5895
|
-
const [chartSheet, setChartSheet] =
|
|
5896
|
-
const [chartWidth, setChartWidth] =
|
|
5897
|
-
const [chartHeight, setChartHeight] =
|
|
6020
|
+
const [chartType, setChartType] = React13.useState("ColumnClustered");
|
|
6021
|
+
const [chartCell, setChartCell] = React13.useState("I2");
|
|
6022
|
+
const [chartTitle, setChartTitle] = React13.useState("");
|
|
6023
|
+
const [chartMeasure, setChartMeasure] = React13.useState("");
|
|
6024
|
+
const [chartSheet, setChartSheet] = React13.useState("");
|
|
6025
|
+
const [chartWidth, setChartWidth] = React13.useState("560");
|
|
6026
|
+
const [chartHeight, setChartHeight] = React13.useState("340");
|
|
5898
6027
|
const update = (patch) => editor.edit((current) => ({ ...current, ...patch }));
|
|
5899
6028
|
const sheets = editor.viewer.sheets.map((sheet) => [sheet.name, sheet.name]);
|
|
5900
6029
|
return /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5901
6030
|
/* @__PURE__ */ jsxs7(Section, { title: "Source and location", children: [
|
|
5902
|
-
/* @__PURE__ */
|
|
5903
|
-
/* @__PURE__ */
|
|
5904
|
-
/* @__PURE__ */
|
|
5905
|
-
/* @__PURE__ */
|
|
5906
|
-
/* @__PURE__ */
|
|
5907
|
-
/* @__PURE__ */
|
|
5908
|
-
/* @__PURE__ */
|
|
6031
|
+
/* @__PURE__ */ jsx10(Text, { label: "PivotTable name", value: pivot.name, onChange: (name) => update({ name }) }),
|
|
6032
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Source worksheet", value: pivot.source.sheet, options: sheets, onChange: (sheet) => update({ source: { ...pivot.source, sheet } }) }),
|
|
6033
|
+
/* @__PURE__ */ jsx10(Text, { label: "Source range", value: pivot.source.range, onChange: (range) => update({ source: { ...pivot.source, range } }) }),
|
|
6034
|
+
/* @__PURE__ */ jsx10(Text, { label: "Source table name (optional)", value: pivot.source.table ?? "", onChange: (table) => update({ source: { ...pivot.source, table: table || null } }) }),
|
|
6035
|
+
/* @__PURE__ */ jsx10(Action, { onClick: editor.readFields, children: "Load source fields" }),
|
|
6036
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Destination worksheet", value: pivot.target.sheet, options: sheets, onChange: (sheet) => update({ target: { ...pivot.target, sheet } }) }),
|
|
6037
|
+
/* @__PURE__ */ jsx10(Text, { label: "Destination cell", value: pivot.target.cell, onChange: (cell) => update({ target: { ...pivot.target, cell } }) })
|
|
5909
6038
|
] }),
|
|
5910
6039
|
/* @__PURE__ */ jsxs7(Section, { title: "Layout and format", children: [
|
|
5911
|
-
/* @__PURE__ */
|
|
5912
|
-
/* @__PURE__ */
|
|
5913
|
-
/* @__PURE__ */
|
|
5914
|
-
/* @__PURE__ */
|
|
5915
|
-
/* @__PURE__ */
|
|
5916
|
-
/* @__PURE__ */
|
|
5917
|
-
/* @__PURE__ */
|
|
5918
|
-
/* @__PURE__ */
|
|
5919
|
-
/* @__PURE__ */
|
|
6040
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Report layout", value: pivot.layout, options: [["compact", "Compact form"], ["outline", "Outline form"], ["tabular", "Tabular form"]], onChange: (layout) => update({ layout }) }),
|
|
6041
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Multiple value fields", value: pivot.valuesOnRows ? "rows" : "columns", options: [["columns", "Show values in columns"], ["rows", "Show values in rows"]], onChange: (value) => update({ valuesOnRows: value === "rows" }) }),
|
|
6042
|
+
/* @__PURE__ */ jsx10(Check, { label: "Repeat item labels", checked: pivot.repeatLabels, onChange: (repeatLabels) => update({ repeatLabels }) }),
|
|
6043
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Subtotals", value: pivot.subtotalsPosition, options: [["top", "At top of group"], ["bottom", "At bottom of group"], ["none", "Do not show"]], onChange: (subtotalsPosition) => update({ subtotalsPosition }) }),
|
|
6044
|
+
/* @__PURE__ */ jsx10(Check, { label: "Grand totals for rows", checked: pivot.rowGrandTotals, onChange: (rowGrandTotals) => update({ rowGrandTotals }) }),
|
|
6045
|
+
/* @__PURE__ */ jsx10(Check, { label: "Grand totals for columns", checked: pivot.columnGrandTotals, onChange: (columnGrandTotals) => update({ columnGrandTotals }) }),
|
|
6046
|
+
/* @__PURE__ */ jsx10(Text, { label: "PivotTable style", value: pivot.styleName, onChange: (styleName) => update({ styleName }) }),
|
|
6047
|
+
/* @__PURE__ */ jsx10(Check, { label: "Preserve cell formatting", checked: pivot.preserveFormatting ?? true, onChange: (preserveFormatting) => update({ preserveFormatting }) }),
|
|
6048
|
+
/* @__PURE__ */ jsx10(Check, { label: "Refresh when opened in Excel", checked: pivot.refreshOnLoad, onChange: (refreshOnLoad) => update({ refreshOnLoad }) })
|
|
5920
6049
|
] }),
|
|
5921
6050
|
/* @__PURE__ */ jsxs7(Section, { title: "Calculated fields and items", children: [
|
|
5922
|
-
/* @__PURE__ */
|
|
5923
|
-
/* @__PURE__ */
|
|
5924
|
-
/* @__PURE__ */
|
|
6051
|
+
/* @__PURE__ */ jsx10(Action, { disabled: !pivot.fields.length, onClick: () => editor.edit((current) => ({ ...current, values: [...current.values, { field: current.fields[0].index, name: `Calculated ${current.values.length + 1}`, aggregation: "sum", showAs: "normal", formula: "0" }] })), children: "Add calculated field" }),
|
|
6052
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: "Edit the new field\u2019s formula in its Values settings." }),
|
|
6053
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: FORMULA_HELP }),
|
|
5925
6054
|
pivot.calculatedItems.map((item, index) => /* @__PURE__ */ jsxs7("div", { style: { ...stack, paddingTop: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5926
|
-
/* @__PURE__ */
|
|
5927
|
-
/* @__PURE__ */
|
|
5928
|
-
/* @__PURE__ */
|
|
5929
|
-
/* @__PURE__ */
|
|
6055
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Field", value: String(item.field), options: pivot.fields.map((field) => [String(field.index), field.name]), onChange: (field) => update({ calculatedItems: pivot.calculatedItems.map((entry, position) => position === index ? { ...entry, field: Number(field) } : entry) }) }),
|
|
6056
|
+
/* @__PURE__ */ jsx10(Text, { label: "Item name", value: item.name, onChange: (name) => update({ calculatedItems: pivot.calculatedItems.map((entry, position) => position === index ? { ...entry, name } : entry) }) }),
|
|
6057
|
+
/* @__PURE__ */ jsx10(Text, { label: "Formula", value: item.formula, onChange: (formula) => update({ calculatedItems: pivot.calculatedItems.map((entry, position) => position === index ? { ...entry, formula } : entry) }) }),
|
|
6058
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => update({ calculatedItems: pivot.calculatedItems.filter((_, position) => position !== index) }), children: "Remove calculated item" })
|
|
5930
6059
|
] }, index)),
|
|
5931
|
-
/* @__PURE__ */
|
|
6060
|
+
/* @__PURE__ */ jsx10(Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: pivot.rows[0]?.field ?? pivot.fields[0].index, name: `Calculated item ${pivot.calculatedItems.length + 1}`, formula: "0" }] }), children: "Add calculated item" })
|
|
5932
6061
|
] }),
|
|
5933
6062
|
/* @__PURE__ */ jsxs7(Section, { title: "PivotChart", children: [
|
|
5934
6063
|
pivot.charts?.length ? /* @__PURE__ */ jsxs7("p", { style: hint, children: [
|
|
@@ -5937,39 +6066,39 @@ function Advanced({ editor, pivot }) {
|
|
|
5937
6066
|
pivot.charts.length === 1 ? "" : "s",
|
|
5938
6067
|
". Refreshing the PivotTable updates their values."
|
|
5939
6068
|
] }) : null,
|
|
5940
|
-
/* @__PURE__ */
|
|
5941
|
-
/* @__PURE__ */
|
|
5942
|
-
/* @__PURE__ */
|
|
5943
|
-
/* @__PURE__ */
|
|
6069
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Chart type", value: chartType, options: CHART_TYPES, onChange: (value) => setChartType(value) }),
|
|
6070
|
+
/* @__PURE__ */ jsx10(Text, { label: "Title", value: chartTitle, placeholder: pivot.name, onChange: setChartTitle }),
|
|
6071
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Chart worksheet", value: chartSheet || pivot.target.sheet, options: sheets, onChange: setChartSheet }),
|
|
6072
|
+
/* @__PURE__ */ jsx10(Text, { label: "Top-left cell", value: chartCell, onChange: setChartCell }),
|
|
5944
6073
|
/* @__PURE__ */ jsxs7("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
5945
|
-
/* @__PURE__ */
|
|
5946
|
-
/* @__PURE__ */
|
|
6074
|
+
/* @__PURE__ */ jsx10(Text, { label: "Width (px)", type: "number", min: 80, max: 1e4, value: chartWidth, onChange: setChartWidth }),
|
|
6075
|
+
/* @__PURE__ */ jsx10(Text, { label: "Height (px)", type: "number", min: 80, max: 1e4, value: chartHeight, onChange: setChartHeight })
|
|
5947
6076
|
] }),
|
|
5948
|
-
/* @__PURE__ */
|
|
5949
|
-
chartType === "Pie" || chartType === "Doughnut" ? /* @__PURE__ */
|
|
5950
|
-
/* @__PURE__ */
|
|
6077
|
+
/* @__PURE__ */ jsx10(Choice, { label: "Values", value: chartMeasure, options: [["", "All value fields"], ...pivot.values.map((value, index) => [String(index), value.name])], onChange: setChartMeasure }),
|
|
6078
|
+
chartType === "Pie" || chartType === "Doughnut" ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Pie and doughnut charts display the first series." }) : null,
|
|
6079
|
+
/* @__PURE__ */ jsx10(Action, { disabled: !pivot.id || editor.dirty || !pivot.values.length, onClick: () => editor.run(() => {
|
|
5951
6080
|
editor.viewer.createPivotChart(pivot.id, { chartType, sheet: chartSheet || pivot.target.sheet, cell: chartCell, title: chartTitle || pivot.name, width: Number(chartWidth), height: Number(chartHeight), measure: chartMeasure ? Number(chartMeasure) : null });
|
|
5952
6081
|
}), children: "Insert PivotChart" }),
|
|
5953
|
-
editor.dirty ? /* @__PURE__ */
|
|
6082
|
+
editor.dirty ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Apply field changes before inserting a chart." }) : null
|
|
5954
6083
|
] })
|
|
5955
6084
|
] });
|
|
5956
6085
|
}
|
|
5957
6086
|
function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, style }) {
|
|
5958
|
-
const paneRef =
|
|
5959
|
-
const [placement, setPlacement] =
|
|
5960
|
-
const [search, setSearch] =
|
|
5961
|
-
const [selected, setSelected] =
|
|
5962
|
-
const [dragOver, setDragOver] =
|
|
5963
|
-
const [announcement, setAnnouncement] =
|
|
5964
|
-
const titleId =
|
|
5965
|
-
const settingsId =
|
|
6087
|
+
const paneRef = React13.useRef(null);
|
|
6088
|
+
const [placement, setPlacement] = React13.useState({ overlay: false, top: 0, width: 324 });
|
|
6089
|
+
const [search, setSearch] = React13.useState("");
|
|
6090
|
+
const [selected, setSelected] = React13.useState(null);
|
|
6091
|
+
const [dragOver, setDragOver] = React13.useState(null);
|
|
6092
|
+
const [announcement, setAnnouncement] = React13.useState("");
|
|
6093
|
+
const titleId = React13.useId();
|
|
6094
|
+
const settingsId = React13.useId();
|
|
5966
6095
|
const pivot = editor.draft;
|
|
5967
6096
|
const disabled = editor.readOnly || Boolean(pivot?.unsupportedFeatures.length) || editor.sourceNeedsLoad;
|
|
5968
|
-
|
|
6097
|
+
React13.useEffect(() => {
|
|
5969
6098
|
setSelected(null);
|
|
5970
6099
|
setSearch("");
|
|
5971
6100
|
}, [pivot?.id]);
|
|
5972
|
-
|
|
6101
|
+
React13.useEffect(() => {
|
|
5973
6102
|
const parent = paneRef.current?.parentElement;
|
|
5974
6103
|
if (!parent) return;
|
|
5975
6104
|
const viewer = parent.closest(".react-xlsx-viewer");
|
|
@@ -6028,34 +6157,34 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6028
6157
|
};
|
|
6029
6158
|
return /* @__PURE__ */ jsxs7("aside", { ref: paneRef, "aria-labelledby": titleId, className, style: { ...theme, boxSizing: "border-box", display: "flex", flexDirection: "column", width: placement.width, minWidth: 0, maxWidth: "100%", height: "100%", minHeight: 0, flexShrink: 0, borderInlineStart: "1px solid var(--xlsx-pivot-border)", background: "var(--xlsx-pivot-bg)", color: isDark ? "#edf2ef" : "#202a24", font: "12px/1.4 system-ui, sans-serif", ...placement.overlay ? { position: "absolute", insetInlineEnd: 0, top: placement.top, bottom: 0, height: "auto", zIndex: 20, boxShadow: "-6px 0 18px #0002" } : {}, ...style }, children: [
|
|
6030
6159
|
/* @__PURE__ */ jsxs7("header", { style: { ...row, justifyContent: "space-between", padding: "10px 12px", borderBottom: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
6031
|
-
/* @__PURE__ */
|
|
6032
|
-
/* @__PURE__ */
|
|
6160
|
+
/* @__PURE__ */ jsx10("h2", { id: titleId, style: { margin: 0, fontSize: 16, fontWeight: 600 }, children: "PivotTable Fields" }),
|
|
6161
|
+
/* @__PURE__ */ jsx10(Action, { "aria-label": "Close PivotTable field list", onClick: () => editor.setOpen(false), style: { border: 0, background: "transparent", fontSize: 20, lineHeight: 1, padding: "2px 6px" }, children: "\xD7" })
|
|
6033
6162
|
] }),
|
|
6034
6163
|
/* @__PURE__ */ jsxs7("div", { style: { overflowY: "auto", flex: 1, minHeight: 0 }, children: [
|
|
6035
6164
|
/* @__PURE__ */ jsxs7("div", { style: { ...stack, padding: 12 }, children: [
|
|
6036
6165
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, alignItems: "end" }, children: [
|
|
6037
|
-
/* @__PURE__ */
|
|
6038
|
-
/* @__PURE__ */
|
|
6166
|
+
/* @__PURE__ */ jsx10("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx10(Choice, { label: "PivotTable", value: pivot?.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 }) }),
|
|
6167
|
+
/* @__PURE__ */ jsx10(Action, { disabled: editor.viewer.readOnly || editor.dirty, onClick: editor.create, children: "New" })
|
|
6039
6168
|
] }),
|
|
6040
|
-
editor.error ? /* @__PURE__ */
|
|
6041
|
-
editor.status ? /* @__PURE__ */
|
|
6042
|
-
editor.stale ? /* @__PURE__ */
|
|
6043
|
-
editor.sourceNeedsLoad ? /* @__PURE__ */
|
|
6169
|
+
editor.error ? /* @__PURE__ */ jsx10("p", { role: "alert", style: { margin: 0, color: isDark ? "#ffb7b0" : "#a12622", overflowWrap: "anywhere" }, children: editor.error }) : null,
|
|
6170
|
+
editor.status ? /* @__PURE__ */ jsx10("p", { role: "status", style: hint, children: editor.status }) : null,
|
|
6171
|
+
editor.stale ? /* @__PURE__ */ jsx10("p", { role: "alert", style: hint, children: "The worksheet changed while you were editing. Discard these changes to load the current PivotTable." }) : null,
|
|
6172
|
+
editor.sourceNeedsLoad ? /* @__PURE__ */ jsx10("p", { role: "status", style: hint, children: "The source changed. Load its fields under Source and location." }) : null,
|
|
6044
6173
|
pivot?.unsupportedFeatures.length ? /* @__PURE__ */ jsxs7("p", { style: hint, children: [
|
|
6045
6174
|
"This PivotTable is preserved for Excel. Editing is unavailable for: ",
|
|
6046
6175
|
pivot.unsupportedFeatures.join(", "),
|
|
6047
6176
|
"."
|
|
6048
6177
|
] }) : null,
|
|
6049
|
-
editor.viewer.readOnly ? /* @__PURE__ */
|
|
6178
|
+
editor.viewer.readOnly ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Enable workbook editing to change this PivotTable." }) : null
|
|
6050
6179
|
] }),
|
|
6051
6180
|
pivot ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
6052
6181
|
/* @__PURE__ */ jsxs7("fieldset", { disabled, style: { margin: 0, padding: "0 12px 12px", border: 0, minWidth: 0 }, children: [
|
|
6053
|
-
/* @__PURE__ */
|
|
6054
|
-
/* @__PURE__ */
|
|
6182
|
+
/* @__PURE__ */ jsx10("legend", { style: { padding: 0, fontWeight: 600, marginBottom: 8 }, children: "Choose fields to add to report" }),
|
|
6183
|
+
/* @__PURE__ */ jsx10("input", { "aria-label": "Search PivotTable fields", type: "search", placeholder: "Search fields", value: search, onChange: (event) => setSearch(event.target.value), style: { ...control, marginBottom: 6 } }),
|
|
6055
6184
|
/* @__PURE__ */ jsxs7("div", { role: "group", "aria-label": "Source fields", style: { maxHeight: 190, overflowY: "auto", border: "1px solid var(--xlsx-pivot-border)", padding: "5px 7px", background: "var(--xlsx-pivot-input)" }, children: [
|
|
6056
6185
|
pivot.fields.filter((field) => field.name.toLocaleLowerCase().includes(search.toLocaleLowerCase())).map((field) => {
|
|
6057
6186
|
const checked = AREAS.some((area) => pivot[area].some((_, index) => sourceFieldIndex(pivot, area, index) === field.index));
|
|
6058
|
-
return /* @__PURE__ */
|
|
6187
|
+
return /* @__PURE__ */ jsx10("div", { draggable: !disabled, onDragStart: (event) => drag(event, { field: field.index }), style: { padding: "2px 0" }, children: /* @__PURE__ */ jsx10(Check, { label: field.name, checked, onChange: (value) => {
|
|
6059
6188
|
if (value) editor.addField(field.dataType === "number" ? "values" : "rows", field.index);
|
|
6060
6189
|
else {
|
|
6061
6190
|
for (const area of AREAS) for (let index = pivot[area].length - 1; index >= 0; index--) if (sourceFieldIndex(pivot, area, index) === field.index) editor.removeField(area, index);
|
|
@@ -6064,10 +6193,10 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6064
6193
|
setSelected(null);
|
|
6065
6194
|
} }) }, field.index);
|
|
6066
6195
|
}),
|
|
6067
|
-
!pivot.fields.length ? /* @__PURE__ */
|
|
6196
|
+
!pivot.fields.length ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Load source fields to begin." }) : !pivot.fields.some((field) => field.name.toLocaleLowerCase().includes(search.toLocaleLowerCase())) ? /* @__PURE__ */ jsx10("p", { style: hint, children: "No matching fields." }) : null
|
|
6068
6197
|
] }),
|
|
6069
|
-
/* @__PURE__ */
|
|
6070
|
-
/* @__PURE__ */
|
|
6198
|
+
/* @__PURE__ */ jsx10("p", { style: { ...hint, marginBlock: "10px 6px" }, children: "Drag fields between the areas below." }),
|
|
6199
|
+
/* @__PURE__ */ jsx10("div", { style: { display: "grid", gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1fr)", gap: 8 }, children: AREAS.map((area) => /* @__PURE__ */ jsxs7("section", { "aria-label": `${AREA_NAMES[area]} fields`, onDragOver: (event) => {
|
|
6071
6200
|
if (!disabled && event.dataTransfer.types.includes(DRAG_TYPE)) {
|
|
6072
6201
|
event.preventDefault();
|
|
6073
6202
|
setDragOver(area);
|
|
@@ -6084,91 +6213,91 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6084
6213
|
const field = fieldIndex(pivot, area, index);
|
|
6085
6214
|
const name = area === "values" ? pivot.values[index].name : area === "reportFilters" ? fieldName(pivot, field) : pivot[area][index].name || fieldName(pivot, field);
|
|
6086
6215
|
const active = selected?.area === area && selected.index === index;
|
|
6087
|
-
return /* @__PURE__ */
|
|
6216
|
+
return /* @__PURE__ */ jsx10("div", { draggable: !disabled, onDragStart: (event) => drag(event, { area, index }), onDrop: (event) => drop(event, area, index), style: { marginBottom: 3 }, children: /* @__PURE__ */ jsxs7("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) => {
|
|
6088
6217
|
if (!event.altKey || !["ArrowUp", "ArrowDown"].includes(event.key)) return;
|
|
6089
6218
|
event.preventDefault();
|
|
6090
6219
|
const position = index + (event.key === "ArrowUp" ? -1 : 1);
|
|
6091
6220
|
if (position >= 0 && position < pivot[area].length) move({ area, index }, area, position);
|
|
6092
6221
|
}, style: { ...control, ...row, textAlign: "start", justifyContent: "space-between", background: active ? "var(--xlsx-pivot-hover)" : "var(--xlsx-pivot-bg)", padding: "4px 5px", cursor: "pointer", fontSize: 11 }, children: [
|
|
6093
|
-
/* @__PURE__ */
|
|
6094
|
-
/* @__PURE__ */
|
|
6222
|
+
/* @__PURE__ */ jsx10("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: name }),
|
|
6223
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u25BE" })
|
|
6095
6224
|
] }) }, `${field}-${index}`);
|
|
6096
6225
|
}),
|
|
6097
|
-
!pivot[area].length ? /* @__PURE__ */
|
|
6226
|
+
!pivot[area].length ? /* @__PURE__ */ jsx10("p", { style: { ...hint, padding: "5px 3px", fontSize: 10 }, children: "Drop fields here" }) : null
|
|
6098
6227
|
] })
|
|
6099
6228
|
] }, area)) }),
|
|
6100
|
-
/* @__PURE__ */
|
|
6229
|
+
/* @__PURE__ */ jsx10("p", { style: { ...hint, marginTop: 6 }, children: "Select a field for settings and keyboard move controls." }),
|
|
6101
6230
|
selected && selectedField !== void 0 ? /* @__PURE__ */ jsxs7("section", { id: settingsId, "aria-label": "Field settings", style: { ...stack, marginTop: 12, paddingTop: 10, borderTop: "2px solid var(--xlsx-pivot-accent)" }, children: [
|
|
6102
6231
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
6103
6232
|
/* @__PURE__ */ jsxs7("strong", { style: { overflowWrap: "anywhere" }, children: [
|
|
6104
6233
|
selected.area === "values" ? pivot.values[selected.index].name : fieldName(pivot, selectedField),
|
|
6105
6234
|
" settings"
|
|
6106
6235
|
] }),
|
|
6107
|
-
/* @__PURE__ */
|
|
6236
|
+
/* @__PURE__ */ jsx10(Action, { "aria-label": "Close field settings", onClick: () => setSelected(null), children: "\xD7" })
|
|
6108
6237
|
] }),
|
|
6109
|
-
selectedCalculated ? /* @__PURE__ */
|
|
6238
|
+
selectedCalculated ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Calculated fields stay in the Values area." }) : /* @__PURE__ */ jsx10(Choice, { label: "Move to", value: selected.area, options: AREAS.map((area) => [area, AREA_NAMES[area]]), onChange: (area) => move(selected, area) }),
|
|
6110
6239
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, flexWrap: "wrap" }, children: [
|
|
6111
|
-
/* @__PURE__ */
|
|
6112
|
-
/* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsx10(Action, { disabled: selected.index === 0, onClick: () => move(selected, selected.area, selected.index - 1), children: "Move up" }),
|
|
6241
|
+
/* @__PURE__ */ jsx10(Action, { disabled: selected.index === pivot[selected.area].length - 1, onClick: () => move(selected, selected.area, selected.index + 1), children: "Move down" }),
|
|
6242
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => {
|
|
6114
6243
|
editor.removeField(selected.area, selected.index);
|
|
6115
6244
|
setSelected(null);
|
|
6116
6245
|
}, children: "Remove field" })
|
|
6117
6246
|
] }),
|
|
6118
|
-
selected.area === "values" ? /* @__PURE__ */
|
|
6247
|
+
selected.area === "values" ? /* @__PURE__ */ jsx10(ValueSettings, { pivot, value: pivot.values[selected.index], onChange: (value) => editor.edit((current) => ({ ...current, values: current.values.map((item, index) => index === selected.index ? value : item) })) }) : selected.area === "rows" || selected.area === "columns" ? /* @__PURE__ */ jsx10(AxisSettings, { pivot, axis: pivot[selected.area][selected.index], onChange: (axis) => editor.edit((current) => ({ ...current, [selected.area]: current[selected.area].map((item, index) => index === selected.index ? axis : item) })), onAddDateLevel: (unit) => editor.edit((current) => {
|
|
6119
6248
|
const area = selected.area;
|
|
6120
6249
|
const axis = current[area][selected.index];
|
|
6121
6250
|
return { ...current, [area]: [...current[area].slice(0, selected.index + 1), { ...axis, name: unit[0].toUpperCase() + unit.slice(1), grouping: { ...axis.grouping, kind: "date", unit }, items: [], collapsed: [] }, ...current[area].slice(selected.index + 1)] };
|
|
6122
6251
|
}) }) : null,
|
|
6123
|
-
selected.area !== "values" ? /* @__PURE__ */
|
|
6252
|
+
selected.area !== "values" ? /* @__PURE__ */ jsx10(FieldFilters, { editor, pivot, field: selectedField, axis: selected.area === "rows" || selected.area === "columns" ? pivot[selected.area][selected.index] : void 0 }) : null
|
|
6124
6253
|
] }) : null
|
|
6125
6254
|
] }),
|
|
6126
|
-
/* @__PURE__ */
|
|
6255
|
+
/* @__PURE__ */ jsx10("fieldset", { disabled: editor.readOnly || Boolean(pivot.unsupportedFeatures.length), style: { margin: 0, padding: 0, minWidth: 0, border: 0 }, children: /* @__PURE__ */ jsx10(Advanced, { editor, pivot }) }),
|
|
6127
6256
|
/* @__PURE__ */ jsxs7(Section, { title: "Refresh and details", children: [
|
|
6128
6257
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, flexWrap: "wrap" }, children: [
|
|
6129
|
-
/* @__PURE__ */
|
|
6130
|
-
/* @__PURE__ */
|
|
6131
|
-
/* @__PURE__ */
|
|
6258
|
+
/* @__PURE__ */ jsx10(Action, { disabled: disabled || editor.dirty || !pivot.id, onClick: () => editor.refresh(), children: "Refresh" }),
|
|
6259
|
+
/* @__PURE__ */ jsx10(Action, { disabled: editor.readOnly || editor.dirty || !editor.viewer.pivotTables.length, onClick: () => editor.refresh(true), children: "Refresh all" }),
|
|
6260
|
+
/* @__PURE__ */ jsx10(Action, { disabled: disabled || editor.dirty || !pivot.id, onClick: editor.showDetails, children: "Show details" })
|
|
6132
6261
|
] }),
|
|
6133
|
-
/* @__PURE__ */
|
|
6262
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: "Select a value cell in the report to inspect its source records." }),
|
|
6134
6263
|
editor.details ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
6135
6264
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
6136
6265
|
/* @__PURE__ */ jsxs7("span", { children: [
|
|
6137
6266
|
editor.details.rows.length.toLocaleString(),
|
|
6138
6267
|
" records"
|
|
6139
6268
|
] }),
|
|
6140
|
-
/* @__PURE__ */
|
|
6269
|
+
/* @__PURE__ */ jsx10(Action, { onClick: editor.clearDetails, children: "Close details" })
|
|
6141
6270
|
] }),
|
|
6142
|
-
/* @__PURE__ */
|
|
6143
|
-
/* @__PURE__ */
|
|
6144
|
-
/* @__PURE__ */
|
|
6271
|
+
/* @__PURE__ */ jsx10("div", { style: { maxHeight: 210, overflow: "auto", border: "1px solid var(--xlsx-pivot-border)" }, children: /* @__PURE__ */ jsxs7("table", { style: { borderCollapse: "collapse", fontSize: 11 }, children: [
|
|
6272
|
+
/* @__PURE__ */ jsx10("thead", { children: /* @__PURE__ */ jsx10("tr", { children: editor.details.fields.map((field, index) => /* @__PURE__ */ jsx10("th", { scope: "col", style: { padding: "5px 7px", textAlign: "start", whiteSpace: "nowrap", borderBottom: "1px solid var(--xlsx-pivot-border)" }, children: field }, index)) }) }),
|
|
6273
|
+
/* @__PURE__ */ jsx10("tbody", { children: editor.details.rows.slice(0, 100).map((record, index) => /* @__PURE__ */ jsx10("tr", { children: record.map((value, column) => /* @__PURE__ */ jsx10("td", { style: { padding: "4px 7px", whiteSpace: "nowrap", borderBottom: "1px solid var(--xlsx-pivot-border)" }, children: value == null ? "" : String(value) }, column)) }, index)) })
|
|
6145
6274
|
] }) }),
|
|
6146
|
-
editor.details.rows.length > 100 ? /* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
6275
|
+
editor.details.rows.length > 100 ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Showing the first 100 records. Create a detail worksheet to see all records." }) : null,
|
|
6276
|
+
/* @__PURE__ */ jsx10(Action, { disabled: editor.readOnly || !editor.detailContext, onClick: () => editor.run(() => {
|
|
6148
6277
|
const context = editor.detailContext;
|
|
6149
6278
|
if (context) editor.viewer.showPivotDetails(context.id, context.row, context.col);
|
|
6150
6279
|
}), children: "Create detail worksheet" })
|
|
6151
6280
|
] }) : null,
|
|
6152
|
-
/* @__PURE__ */
|
|
6281
|
+
/* @__PURE__ */ jsx10(Action, { disabled: editor.readOnly || editor.dirty || !pivot.id, onClick: editor.remove, children: "Remove PivotTable" })
|
|
6153
6282
|
] })
|
|
6154
6283
|
] }) : /* @__PURE__ */ jsxs7("div", { style: { ...stack, padding: "4px 12px 20px" }, children: [
|
|
6155
|
-
/* @__PURE__ */
|
|
6156
|
-
/* @__PURE__ */
|
|
6284
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: "Select a PivotTable cell to arrange its fields, or create a PivotTable from the selected data." }),
|
|
6285
|
+
/* @__PURE__ */ jsx10(Action, { primary: true, disabled: editor.readOnly || !editor.viewer.activeSheet, onClick: editor.create, children: "Create PivotTable" })
|
|
6157
6286
|
] })
|
|
6158
6287
|
] }),
|
|
6159
|
-
pivot ? /* @__PURE__ */
|
|
6160
|
-
/* @__PURE__ */
|
|
6288
|
+
pivot ? /* @__PURE__ */ jsx10("footer", { style: { ...stack, gap: 7, padding: "10px 12px", borderTop: "1px solid var(--xlsx-pivot-border)" }, children: /* @__PURE__ */ jsxs7("div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
6289
|
+
/* @__PURE__ */ jsx10("span", { style: hint, children: editor.dirty ? "Changes pending" : "Report is up to date" }),
|
|
6161
6290
|
/* @__PURE__ */ jsxs7("div", { style: row, children: [
|
|
6162
|
-
/* @__PURE__ */
|
|
6163
|
-
/* @__PURE__ */
|
|
6291
|
+
/* @__PURE__ */ jsx10(Action, { disabled: !editor.dirty, onClick: editor.reset, children: "Discard" }),
|
|
6292
|
+
/* @__PURE__ */ jsx10(Action, { primary: true, disabled: disabled || !editor.dirty || editor.stale, onClick: editor.apply, children: "Apply" })
|
|
6164
6293
|
] })
|
|
6165
6294
|
] }) }) : null,
|
|
6166
|
-
/* @__PURE__ */
|
|
6295
|
+
/* @__PURE__ */ jsx10("span", { role: "status", "aria-live": "polite", style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clipPath: "inset(50%)", whiteSpace: "nowrap" }, children: announcement })
|
|
6167
6296
|
] });
|
|
6168
6297
|
}
|
|
6169
6298
|
|
|
6170
6299
|
// src/lazy-chart.tsx
|
|
6171
|
-
import * as
|
|
6300
|
+
import * as React15 from "react";
|
|
6172
6301
|
|
|
6173
6302
|
// src/chart-loader.ts
|
|
6174
6303
|
function createChartModule(importModule) {
|
|
@@ -6199,15 +6328,15 @@ function createChartModule(importModule) {
|
|
|
6199
6328
|
};
|
|
6200
6329
|
}
|
|
6201
6330
|
var officeChartRenderer = createChartModule(async () => {
|
|
6202
|
-
const { SharedChartSvg } = await import("./shared-chart-
|
|
6331
|
+
const { SharedChartSvg } = await import("./shared-chart-PMIN7YMP.js");
|
|
6203
6332
|
return { renderer: null, SharedChartSvg };
|
|
6204
6333
|
});
|
|
6205
6334
|
|
|
6206
6335
|
// src/use-chart-module.ts
|
|
6207
|
-
import * as
|
|
6336
|
+
import * as React14 from "react";
|
|
6208
6337
|
|
|
6209
6338
|
// src/lazy-chart.tsx
|
|
6210
|
-
import { Fragment as Fragment9, jsx as
|
|
6339
|
+
import { Fragment as Fragment9, jsx as jsx11 } from "react/jsx-runtime";
|
|
6211
6340
|
|
|
6212
6341
|
// src/picture-paint.ts
|
|
6213
6342
|
function resolvePicturePaintRect(image, rect) {
|
|
@@ -6224,7 +6353,7 @@ function resolvePicturePaintRect(image, rect) {
|
|
|
6224
6353
|
}
|
|
6225
6354
|
|
|
6226
6355
|
// src/XlsxViewer.tsx
|
|
6227
|
-
import { Fragment as Fragment11, jsx as
|
|
6356
|
+
import { Fragment as Fragment11, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6228
6357
|
var DEFAULT_ROW_HEIGHT2 = 24;
|
|
6229
6358
|
var DEFAULT_COL_WIDTH2 = 80;
|
|
6230
6359
|
var MAX_AUTOFIT_ROW_HEIGHT_PX = 409 * (4 / 3);
|
|
@@ -6898,10 +7027,10 @@ function lightenColor(color, ratio) {
|
|
|
6898
7027
|
function darkenColor(color, ratio) {
|
|
6899
7028
|
return mixRgbColor(color, "#000000", ratio);
|
|
6900
7029
|
}
|
|
6901
|
-
var ViewerContext =
|
|
6902
|
-
var ViewerAppearanceContext =
|
|
7030
|
+
var ViewerContext = React16.createContext(null);
|
|
7031
|
+
var ViewerAppearanceContext = React16.createContext({ isDark: false });
|
|
6903
7032
|
function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
|
|
6904
|
-
return /* @__PURE__ */
|
|
7033
|
+
return /* @__PURE__ */ jsx12(Fragment11, { children: [top && "top", bottom && "bottom"].flatMap((vertical) => vertical ? [left && "left", right && "right"].map((horizontal) => horizontal ? /* @__PURE__ */ jsx12("span", { style: {
|
|
6905
7034
|
position: "absolute",
|
|
6906
7035
|
[vertical]: -4,
|
|
6907
7036
|
[horizontal]: -4,
|
|
@@ -7865,7 +7994,7 @@ function applyCanvasShapeDash(context, dash, lineWidth) {
|
|
|
7865
7994
|
}
|
|
7866
7995
|
}
|
|
7867
7996
|
function useViewerPalette(isDark = false, headerBackgroundColor, headerTextColor) {
|
|
7868
|
-
return
|
|
7997
|
+
return React16.useMemo(
|
|
7869
7998
|
() => resolveViewerPalette(isDark, headerBackgroundColor, headerTextColor),
|
|
7870
7999
|
[headerBackgroundColor, headerTextColor, isDark]
|
|
7871
8000
|
);
|
|
@@ -8552,10 +8681,10 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8552
8681
|
const gap = normalizedValues.length > 1 ? (innerWidth2 - segmentWidth * normalizedValues.length) / (normalizedValues.length - 1) : 0;
|
|
8553
8682
|
const positiveY = 4.5;
|
|
8554
8683
|
const negativeY = height - 4.5;
|
|
8555
|
-
return /* @__PURE__ */
|
|
8684
|
+
return /* @__PURE__ */ jsx12("svg", { "aria-hidden": "true", height, style: { display: "block", overflow: "visible", width: "100%" }, viewBox: `0 0 ${width} ${height}`, width: "100%", children: normalizedValues.map((entry, index) => {
|
|
8556
8685
|
const left = 1 + index * (segmentWidth + Math.max(0, gap));
|
|
8557
8686
|
const y = entry.value >= 0 ? positiveY : negativeY;
|
|
8558
|
-
return /* @__PURE__ */
|
|
8687
|
+
return /* @__PURE__ */ jsx12(
|
|
8559
8688
|
"line",
|
|
8560
8689
|
{
|
|
8561
8690
|
stroke: seriesColor,
|
|
@@ -8578,14 +8707,14 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8578
8707
|
const barWidth = Math.max(2, innerWidth2 / Math.max(normalizedValues.length * 1.8, 1));
|
|
8579
8708
|
const gap = normalizedValues.length > 1 ? (innerWidth2 - barWidth * normalizedValues.length) / (normalizedValues.length - 1) : 0;
|
|
8580
8709
|
return /* @__PURE__ */ jsxs8("svg", { "aria-hidden": "true", height, style: { display: "block", overflow: "visible", width: "100%" }, viewBox: `0 0 ${width} ${height}`, width: "100%", children: [
|
|
8581
|
-
/* @__PURE__ */
|
|
8710
|
+
/* @__PURE__ */ jsx12("line", { stroke: palette.border, strokeWidth: 1, x1: 1, x2: width - 1, y1: zeroY, y2: zeroY }),
|
|
8582
8711
|
normalizedValues.map((entry, index) => {
|
|
8583
8712
|
const left = 1 + index * (barWidth + Math.max(0, gap));
|
|
8584
8713
|
const y = 2 + innerHeight2 - clampSparklineValue(entry.value, minValue2, maxValue2) * innerHeight2;
|
|
8585
8714
|
const top = Math.min(y, zeroY);
|
|
8586
8715
|
const barHeight = Math.max(1, Math.abs(y - zeroY));
|
|
8587
8716
|
const fill = entry.value < 0 ? negativeColor : seriesColor;
|
|
8588
|
-
return /* @__PURE__ */
|
|
8717
|
+
return /* @__PURE__ */ jsx12(
|
|
8589
8718
|
"rect",
|
|
8590
8719
|
{
|
|
8591
8720
|
fill,
|
|
@@ -8612,7 +8741,7 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8612
8741
|
const highValue = Math.max(...points.map((entry) => entry.value));
|
|
8613
8742
|
const lowValue = Math.min(...points.map((entry) => entry.value));
|
|
8614
8743
|
return /* @__PURE__ */ jsxs8("svg", { "aria-hidden": "true", height, style: { display: "block", overflow: "visible", width: "100%" }, viewBox: `0 0 ${width} ${height}`, width: "100%", children: [
|
|
8615
|
-
/* @__PURE__ */
|
|
8744
|
+
/* @__PURE__ */ jsx12("path", { d: path, fill: "none", stroke: seriesColor, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.6 }),
|
|
8616
8745
|
sparkline.markers ? points.map((entry, index) => {
|
|
8617
8746
|
const x = 1 + index * xStep;
|
|
8618
8747
|
const y = 2 + innerHeight2 - clampSparklineValue(entry.value, minValue, maxValue) * innerHeight2;
|
|
@@ -8628,7 +8757,7 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8628
8757
|
} else if (entry.value < 0 && sparkline.negative && sparkline.negativeColor) {
|
|
8629
8758
|
fill = sparkline.negativeColor;
|
|
8630
8759
|
}
|
|
8631
|
-
return /* @__PURE__ */
|
|
8760
|
+
return /* @__PURE__ */ jsx12("circle", { cx: x, cy: y, fill, r: 1.75 }, `spark-point-${index}`);
|
|
8632
8761
|
}) : null
|
|
8633
8762
|
] });
|
|
8634
8763
|
}
|
|
@@ -8752,7 +8881,7 @@ function SegmentedControl({
|
|
|
8752
8881
|
palette,
|
|
8753
8882
|
value
|
|
8754
8883
|
}) {
|
|
8755
|
-
return /* @__PURE__ */
|
|
8884
|
+
return /* @__PURE__ */ jsx12(
|
|
8756
8885
|
"div",
|
|
8757
8886
|
{
|
|
8758
8887
|
"aria-label": messages.workbookSheets,
|
|
@@ -8770,7 +8899,7 @@ function SegmentedControl({
|
|
|
8770
8899
|
children: items.map((item) => {
|
|
8771
8900
|
const selected = item.id === value;
|
|
8772
8901
|
const isHidden = item.visibility === "hidden" || item.visibility === "veryHidden";
|
|
8773
|
-
return /* @__PURE__ */
|
|
8902
|
+
return /* @__PURE__ */ jsx12(
|
|
8774
8903
|
"button",
|
|
8775
8904
|
{
|
|
8776
8905
|
"aria-selected": selected,
|
|
@@ -8834,7 +8963,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8834
8963
|
padding: "0 16px"
|
|
8835
8964
|
},
|
|
8836
8965
|
children: [
|
|
8837
|
-
/* @__PURE__ */
|
|
8966
|
+
/* @__PURE__ */ jsx12("div", { style: { minWidth: 0 }, children: /* @__PURE__ */ jsx12(
|
|
8838
8967
|
"div",
|
|
8839
8968
|
{
|
|
8840
8969
|
style: {
|
|
@@ -8849,7 +8978,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8849
8978
|
}
|
|
8850
8979
|
) }),
|
|
8851
8980
|
/* @__PURE__ */ jsxs8("div", { style: { alignItems: "center", display: "flex", gap: 8 }, children: [
|
|
8852
|
-
pivotTableEditor && (!controller.readOnly || controller.pivotTables.length > 0) ? /* @__PURE__ */
|
|
8981
|
+
pivotTableEditor && (!controller.readOnly || controller.pivotTables.length > 0) ? /* @__PURE__ */ jsx12(
|
|
8853
8982
|
"button",
|
|
8854
8983
|
{
|
|
8855
8984
|
"aria-label": messages.pivotTableFields,
|
|
@@ -8877,7 +9006,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8877
9006
|
overflow: "hidden"
|
|
8878
9007
|
},
|
|
8879
9008
|
children: [
|
|
8880
|
-
/* @__PURE__ */
|
|
9009
|
+
/* @__PURE__ */ jsx12(
|
|
8881
9010
|
"button",
|
|
8882
9011
|
{
|
|
8883
9012
|
"aria-label": messages.zoomOut,
|
|
@@ -8896,7 +9025,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8896
9025
|
children: "-"
|
|
8897
9026
|
}
|
|
8898
9027
|
),
|
|
8899
|
-
/* @__PURE__ */
|
|
9028
|
+
/* @__PURE__ */ jsx12(
|
|
8900
9029
|
"button",
|
|
8901
9030
|
{
|
|
8902
9031
|
"aria-label": messages.resetZoom,
|
|
@@ -8917,7 +9046,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8917
9046
|
children: formatZoomScale(zoomScale, locale)
|
|
8918
9047
|
}
|
|
8919
9048
|
),
|
|
8920
|
-
/* @__PURE__ */
|
|
9049
|
+
/* @__PURE__ */ jsx12(
|
|
8921
9050
|
"button",
|
|
8922
9051
|
{
|
|
8923
9052
|
"aria-label": messages.zoomIn,
|
|
@@ -8939,7 +9068,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8939
9068
|
]
|
|
8940
9069
|
}
|
|
8941
9070
|
),
|
|
8942
|
-
canDownload ? /* @__PURE__ */
|
|
9071
|
+
canDownload ? /* @__PURE__ */ jsx12(
|
|
8943
9072
|
"button",
|
|
8944
9073
|
{
|
|
8945
9074
|
"aria-label": messages.downloadWorkbook,
|
|
@@ -8968,7 +9097,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8968
9097
|
]
|
|
8969
9098
|
}
|
|
8970
9099
|
),
|
|
8971
|
-
tabs.length > 1 ? /* @__PURE__ */
|
|
9100
|
+
tabs.length > 1 ? /* @__PURE__ */ jsx12(
|
|
8972
9101
|
"div",
|
|
8973
9102
|
{
|
|
8974
9103
|
style: {
|
|
@@ -8977,7 +9106,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8977
9106
|
overflowX: "auto",
|
|
8978
9107
|
padding: "8px 12px"
|
|
8979
9108
|
},
|
|
8980
|
-
children: /* @__PURE__ */
|
|
9109
|
+
children: /* @__PURE__ */ jsx12(
|
|
8981
9110
|
SegmentedControl,
|
|
8982
9111
|
{
|
|
8983
9112
|
messages,
|
|
@@ -9029,7 +9158,7 @@ function resolveRichCellRuns(raw, value, base, theme, zoom) {
|
|
|
9029
9158
|
}
|
|
9030
9159
|
function renderRichCellText(cell) {
|
|
9031
9160
|
const scale = cell.shrinkToFitFontSizePx === void 0 ? 1 : cell.shrinkToFitFontSizePx / resolveCanvasFontSizePx(cell.style, 14);
|
|
9032
|
-
return cell.richText ? cell.richText.map((run, index) => /* @__PURE__ */
|
|
9161
|
+
return cell.richText ? cell.richText.map((run, index) => /* @__PURE__ */ jsx12("span", { style: {
|
|
9033
9162
|
fontFamily: run.style.fontFamily,
|
|
9034
9163
|
fontSize: resolveCanvasFontSizePx(run.style, 14) * scale,
|
|
9035
9164
|
fontWeight: run.style.fontWeight,
|
|
@@ -9430,7 +9559,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9430
9559
|
if (icon.shape === "arrow") {
|
|
9431
9560
|
const fill = icon.color ?? "#111827";
|
|
9432
9561
|
const stroke = icon.borderColor ?? darkenColor(fill, 0.32);
|
|
9433
|
-
return /* @__PURE__ */
|
|
9562
|
+
return /* @__PURE__ */ jsx12(
|
|
9434
9563
|
"svg",
|
|
9435
9564
|
{
|
|
9436
9565
|
"aria-hidden": "true",
|
|
@@ -9438,7 +9567,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9438
9567
|
style: { display: "block" },
|
|
9439
9568
|
viewBox: "0 0 16 16",
|
|
9440
9569
|
width: iconSize,
|
|
9441
|
-
children: /* @__PURE__ */
|
|
9570
|
+
children: /* @__PURE__ */ jsx12("g", { transform: `rotate(${icon.rotationDeg ?? 0} 8 8)`, children: /* @__PURE__ */ jsx12(
|
|
9442
9571
|
"path",
|
|
9443
9572
|
{
|
|
9444
9573
|
d: "M2.5 8 L8.4 2.4 L8.4 5.2 L13.5 5.2 L13.5 10.8 L8.4 10.8 L8.4 13.6 Z",
|
|
@@ -9452,7 +9581,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9452
9581
|
);
|
|
9453
9582
|
}
|
|
9454
9583
|
if (icon.glyph) {
|
|
9455
|
-
return /* @__PURE__ */
|
|
9584
|
+
return /* @__PURE__ */ jsx12(
|
|
9456
9585
|
"span",
|
|
9457
9586
|
{
|
|
9458
9587
|
style: {
|
|
@@ -9470,7 +9599,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9470
9599
|
}
|
|
9471
9600
|
);
|
|
9472
9601
|
}
|
|
9473
|
-
return /* @__PURE__ */
|
|
9602
|
+
return /* @__PURE__ */ jsx12(
|
|
9474
9603
|
"span",
|
|
9475
9604
|
{
|
|
9476
9605
|
style: {
|
|
@@ -9495,8 +9624,8 @@ function renderCheckboxControl(checked, palette, scale = 1, mixed = false) {
|
|
|
9495
9624
|
const fill = checked || mixed ? paletteIsDark(palette) ? "#60a5fa" : "#2563eb" : "transparent";
|
|
9496
9625
|
const check = paletteIsDark(palette) ? "#020617" : "#ffffff";
|
|
9497
9626
|
return /* @__PURE__ */ jsxs8("svg", { "aria-hidden": "true", height: 14 * scale, style: { display: "block" }, viewBox: "0 0 16 16", width: 14 * scale, children: [
|
|
9498
|
-
/* @__PURE__ */
|
|
9499
|
-
mixed ? /* @__PURE__ */
|
|
9627
|
+
/* @__PURE__ */ jsx12("rect", { fill, height: 11, rx: 2, ry: 2, stroke, strokeWidth: 1.2, width: 11, x: 2.5, y: 2.5 }),
|
|
9628
|
+
mixed ? /* @__PURE__ */ jsx12("path", { d: "M5 8h6", fill: "none", stroke: check, strokeLinecap: "round", strokeWidth: 1.8 }) : checked ? /* @__PURE__ */ jsx12(
|
|
9500
9629
|
"path",
|
|
9501
9630
|
{
|
|
9502
9631
|
d: "M5 8.1 7.1 10.2 11.3 5.8",
|
|
@@ -9968,7 +10097,7 @@ function GridRow({
|
|
|
9968
10097
|
zIndex: stickyTop !== void 0 ? frozenRowHeaderZIndex : rowHeaderZIndex
|
|
9969
10098
|
},
|
|
9970
10099
|
children: [
|
|
9971
|
-
/* @__PURE__ */
|
|
10100
|
+
/* @__PURE__ */ jsx12("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsx12(
|
|
9972
10101
|
"span",
|
|
9973
10102
|
{
|
|
9974
10103
|
style: {
|
|
@@ -9979,7 +10108,7 @@ function GridRow({
|
|
|
9979
10108
|
children: actualRow + 1
|
|
9980
10109
|
}
|
|
9981
10110
|
) }),
|
|
9982
|
-
/* @__PURE__ */
|
|
10111
|
+
/* @__PURE__ */ jsx12(
|
|
9983
10112
|
"div",
|
|
9984
10113
|
{
|
|
9985
10114
|
onDoubleClick: (event) => {
|
|
@@ -10001,7 +10130,7 @@ function GridRow({
|
|
|
10001
10130
|
]
|
|
10002
10131
|
}
|
|
10003
10132
|
),
|
|
10004
|
-
leadingSpacerWidth > 0 ? /* @__PURE__ */
|
|
10133
|
+
leadingSpacerWidth > 0 ? /* @__PURE__ */ jsx12(
|
|
10005
10134
|
"td",
|
|
10006
10135
|
{
|
|
10007
10136
|
"aria-hidden": "true",
|
|
@@ -10165,7 +10294,7 @@ function GridRow({
|
|
|
10165
10294
|
style: cellStyle,
|
|
10166
10295
|
title,
|
|
10167
10296
|
children: [
|
|
10168
|
-
cellData.chartHighlight ? /* @__PURE__ */
|
|
10297
|
+
cellData.chartHighlight ? /* @__PURE__ */ jsx12(
|
|
10169
10298
|
"div",
|
|
10170
10299
|
{
|
|
10171
10300
|
"aria-hidden": "true",
|
|
@@ -10180,7 +10309,7 @@ function GridRow({
|
|
|
10180
10309
|
pointerEvents: "none",
|
|
10181
10310
|
position: "absolute"
|
|
10182
10311
|
},
|
|
10183
|
-
children: /* @__PURE__ */
|
|
10312
|
+
children: /* @__PURE__ */ jsx12(
|
|
10184
10313
|
ReferenceRangeHandles,
|
|
10185
10314
|
{
|
|
10186
10315
|
color: cellData.chartHighlight.strokeColor,
|
|
@@ -10192,7 +10321,7 @@ function GridRow({
|
|
|
10192
10321
|
)
|
|
10193
10322
|
}
|
|
10194
10323
|
) : null,
|
|
10195
|
-
cellData.conditionalDataBar ? /* @__PURE__ */
|
|
10324
|
+
cellData.conditionalDataBar ? /* @__PURE__ */ jsx12(
|
|
10196
10325
|
"div",
|
|
10197
10326
|
{
|
|
10198
10327
|
"aria-hidden": "true",
|
|
@@ -10204,7 +10333,7 @@ function GridRow({
|
|
|
10204
10333
|
position: "absolute",
|
|
10205
10334
|
zIndex: 0
|
|
10206
10335
|
},
|
|
10207
|
-
children: /* @__PURE__ */
|
|
10336
|
+
children: /* @__PURE__ */ jsx12(
|
|
10208
10337
|
"div",
|
|
10209
10338
|
{
|
|
10210
10339
|
style: {
|
|
@@ -10220,7 +10349,7 @@ function GridRow({
|
|
|
10220
10349
|
}
|
|
10221
10350
|
) : null,
|
|
10222
10351
|
adornment,
|
|
10223
|
-
cellData.conditionalIcon ? /* @__PURE__ */
|
|
10352
|
+
cellData.conditionalIcon ? /* @__PURE__ */ jsx12(
|
|
10224
10353
|
"div",
|
|
10225
10354
|
{
|
|
10226
10355
|
"aria-hidden": "true",
|
|
@@ -10238,7 +10367,7 @@ function GridRow({
|
|
|
10238
10367
|
children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
|
|
10239
10368
|
}
|
|
10240
10369
|
) : null,
|
|
10241
|
-
isSpilling && !isEditing ? /* @__PURE__ */
|
|
10370
|
+
isSpilling && !isEditing ? /* @__PURE__ */ jsx12("div", { "aria-hidden": "true", style: {
|
|
10242
10371
|
backgroundColor: cellStyle.backgroundColor ?? palette.surface,
|
|
10243
10372
|
position: "absolute",
|
|
10244
10373
|
left: cellData.spillSide === "left" ? cellData.spillOffsetX : "calc(100% - 1px)",
|
|
@@ -10247,7 +10376,7 @@ function GridRow({
|
|
|
10247
10376
|
height: "calc(100% - 1px)",
|
|
10248
10377
|
pointerEvents: "none"
|
|
10249
10378
|
} }) : null,
|
|
10250
|
-
isEditing ? /* @__PURE__ */
|
|
10379
|
+
isEditing ? /* @__PURE__ */ jsx12(
|
|
10251
10380
|
CellEditor,
|
|
10252
10381
|
{
|
|
10253
10382
|
editorRef,
|
|
@@ -10272,7 +10401,7 @@ function GridRow({
|
|
|
10272
10401
|
...cellEditorStyle
|
|
10273
10402
|
}
|
|
10274
10403
|
}
|
|
10275
|
-
) : isSpilling ? /* @__PURE__ */
|
|
10404
|
+
) : isSpilling ? /* @__PURE__ */ jsx12(
|
|
10276
10405
|
"div",
|
|
10277
10406
|
{
|
|
10278
10407
|
style: {
|
|
@@ -10286,7 +10415,7 @@ function GridRow({
|
|
|
10286
10415
|
},
|
|
10287
10416
|
children: renderRichCellText(cellData)
|
|
10288
10417
|
}
|
|
10289
|
-
) : cellData.sparkline ? /* @__PURE__ */
|
|
10418
|
+
) : cellData.sparkline ? /* @__PURE__ */ jsx12(
|
|
10290
10419
|
"div",
|
|
10291
10420
|
{
|
|
10292
10421
|
style: {
|
|
@@ -10299,7 +10428,7 @@ function GridRow({
|
|
|
10299
10428
|
},
|
|
10300
10429
|
children: renderSparkline(cellData.sparkline.config, cellData.sparkline.values, palette)
|
|
10301
10430
|
}
|
|
10302
|
-
) : cellData.checkboxState != null ? /* @__PURE__ */
|
|
10431
|
+
) : cellData.checkboxState != null ? /* @__PURE__ */ jsx12(
|
|
10303
10432
|
"div",
|
|
10304
10433
|
{
|
|
10305
10434
|
style: {
|
|
@@ -10312,13 +10441,13 @@ function GridRow({
|
|
|
10312
10441
|
},
|
|
10313
10442
|
children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
|
|
10314
10443
|
}
|
|
10315
|
-
) : /* @__PURE__ */
|
|
10444
|
+
) : /* @__PURE__ */ jsx12("div", { style: cellContentStyle, children: rotatedTextStyle ? /* @__PURE__ */ jsx12("span", { style: { ...rotatedTextBounds, flex: "0 0 auto", position: "relative" }, children: /* @__PURE__ */ jsx12("span", { style: rotatedTextStyle, children: renderRichCellText(cellData) }) }) : wrappedTextStyle ? /* @__PURE__ */ jsx12("span", { style: wrappedTextStyle, children: renderRichCellText(cellData) }) : renderRichCellText(cellData) })
|
|
10316
10445
|
]
|
|
10317
10446
|
},
|
|
10318
10447
|
key
|
|
10319
10448
|
);
|
|
10320
10449
|
}),
|
|
10321
|
-
trailingSpacerWidth > 0 ? /* @__PURE__ */
|
|
10450
|
+
trailingSpacerWidth > 0 ? /* @__PURE__ */ jsx12(
|
|
10322
10451
|
"td",
|
|
10323
10452
|
{
|
|
10324
10453
|
"aria-hidden": "true",
|
|
@@ -10332,7 +10461,7 @@ function GridRow({
|
|
|
10332
10461
|
) : null
|
|
10333
10462
|
] });
|
|
10334
10463
|
}
|
|
10335
|
-
var MemoGridRow =
|
|
10464
|
+
var MemoGridRow = React16.memo(GridRow, (prev, next) => {
|
|
10336
10465
|
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) {
|
|
10337
10466
|
return false;
|
|
10338
10467
|
}
|
|
@@ -10352,16 +10481,16 @@ function XlsxViewerProviderWithInlineController({
|
|
|
10352
10481
|
...options2
|
|
10353
10482
|
}) {
|
|
10354
10483
|
const controller = useXlsxViewerController(options2);
|
|
10355
|
-
return /* @__PURE__ */
|
|
10484
|
+
return /* @__PURE__ */ jsx12(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ jsx12(ViewerContext.Provider, { value: controller, children: children2 }) });
|
|
10356
10485
|
}
|
|
10357
10486
|
function XlsxViewerProvider({ children: children2, controller, isDark = false, ...options2 }) {
|
|
10358
10487
|
if (controller) {
|
|
10359
|
-
return /* @__PURE__ */
|
|
10488
|
+
return /* @__PURE__ */ jsx12(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ jsx12(ViewerContext.Provider, { value: controller, children: children2 }) });
|
|
10360
10489
|
}
|
|
10361
|
-
return /* @__PURE__ */
|
|
10490
|
+
return /* @__PURE__ */ jsx12(XlsxViewerProviderWithInlineController, { ...options2, isDark, children: children2 });
|
|
10362
10491
|
}
|
|
10363
10492
|
function useXlsxViewer() {
|
|
10364
|
-
const context =
|
|
10493
|
+
const context = React16.useContext(ViewerContext);
|
|
10365
10494
|
if (!context) {
|
|
10366
10495
|
throw new Error("useXlsxViewer must be used inside XlsxViewer or XlsxViewerProvider.");
|
|
10367
10496
|
}
|
|
@@ -10379,7 +10508,7 @@ function useXlsxViewerSelection() {
|
|
|
10379
10508
|
selectionRanges,
|
|
10380
10509
|
selection
|
|
10381
10510
|
} = useXlsxViewer();
|
|
10382
|
-
return
|
|
10511
|
+
return React16.useMemo(
|
|
10383
10512
|
() => ({
|
|
10384
10513
|
activeCell,
|
|
10385
10514
|
activeCellAddress,
|
|
@@ -10395,10 +10524,10 @@ function useXlsxViewerSelection() {
|
|
|
10395
10524
|
);
|
|
10396
10525
|
}
|
|
10397
10526
|
function useXlsxViewerLayout() {
|
|
10398
|
-
const { canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
|
|
10399
|
-
return
|
|
10400
|
-
() => ({ canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
|
|
10401
|
-
[canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
|
|
10527
|
+
const { canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
|
|
10528
|
+
return React16.useMemo(
|
|
10529
|
+
() => ({ canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
|
|
10530
|
+
[canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
|
|
10402
10531
|
);
|
|
10403
10532
|
}
|
|
10404
10533
|
function useXlsxViewerZoom() {
|
|
@@ -10414,7 +10543,7 @@ function useXlsxViewerZoom() {
|
|
|
10414
10543
|
zoomOut,
|
|
10415
10544
|
zoomScale
|
|
10416
10545
|
} = useXlsxViewer();
|
|
10417
|
-
return
|
|
10546
|
+
return React16.useMemo(
|
|
10418
10547
|
() => ({
|
|
10419
10548
|
canZoomIn,
|
|
10420
10549
|
canZoomOut,
|
|
@@ -10483,7 +10612,7 @@ function useXlsxViewerEditing() {
|
|
|
10483
10612
|
unmergeSelection,
|
|
10484
10613
|
updateFormControl
|
|
10485
10614
|
} = useXlsxViewer();
|
|
10486
|
-
return
|
|
10615
|
+
return React16.useMemo(
|
|
10487
10616
|
() => ({
|
|
10488
10617
|
addFormControl,
|
|
10489
10618
|
addSheet,
|
|
@@ -10570,7 +10699,7 @@ function useXlsxViewerEditing() {
|
|
|
10570
10699
|
}
|
|
10571
10700
|
function useXlsxViewerTables() {
|
|
10572
10701
|
const { sortState, sortTable, tables } = useXlsxViewer();
|
|
10573
|
-
return
|
|
10702
|
+
return React16.useMemo(
|
|
10574
10703
|
() => ({
|
|
10575
10704
|
sortState,
|
|
10576
10705
|
sortTable,
|
|
@@ -10581,7 +10710,7 @@ function useXlsxViewerTables() {
|
|
|
10581
10710
|
}
|
|
10582
10711
|
function useXlsxViewerPivots() {
|
|
10583
10712
|
const { pivotTables, pivotFieldListVisible, setPivotFieldListVisible, getPivotSourceFields, getPivotTableAtCell, upsertPivotTable, refreshPivotTable, refreshAllPivotTables, removePivotTable, pivotDrillDown, showPivotDetails, createPivotChart, togglePivotGroup } = useXlsxViewer();
|
|
10584
|
-
return
|
|
10713
|
+
return React16.useMemo(() => ({
|
|
10585
10714
|
pivotTables,
|
|
10586
10715
|
pivotFieldListVisible,
|
|
10587
10716
|
setPivotFieldListVisible,
|
|
@@ -10635,7 +10764,7 @@ function useXlsxViewerImages() {
|
|
|
10635
10764
|
setImageRect,
|
|
10636
10765
|
updateChart
|
|
10637
10766
|
} = useXlsxViewer();
|
|
10638
|
-
return
|
|
10767
|
+
return React16.useMemo(
|
|
10639
10768
|
() => ({
|
|
10640
10769
|
arrangeDrawing,
|
|
10641
10770
|
changeChartType,
|
|
@@ -10737,7 +10866,7 @@ function useXlsxViewerCharts() {
|
|
|
10737
10866
|
tabs,
|
|
10738
10867
|
updateChart
|
|
10739
10868
|
} = useXlsxViewer();
|
|
10740
|
-
return
|
|
10869
|
+
return React16.useMemo(
|
|
10741
10870
|
() => ({
|
|
10742
10871
|
activeTab,
|
|
10743
10872
|
activeTabIndex,
|
|
@@ -10810,30 +10939,30 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10810
10939
|
workbook,
|
|
10811
10940
|
sheets
|
|
10812
10941
|
} = useXlsxViewer();
|
|
10813
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
10942
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
10814
10943
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
10815
10944
|
const includeHeaders = options2.includeHeaders ?? true;
|
|
10816
10945
|
const resolution = options2.resolution;
|
|
10817
|
-
const thumbnailImageCacheRef =
|
|
10818
|
-
const workerThumbnailRowBatchCacheRef =
|
|
10819
|
-
const workerThumbnailRowBatchRequestRef =
|
|
10946
|
+
const thumbnailImageCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10947
|
+
const workerThumbnailRowBatchCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10948
|
+
const workerThumbnailRowBatchRequestRef = React16.useRef(
|
|
10820
10949
|
/* @__PURE__ */ new Map()
|
|
10821
10950
|
);
|
|
10822
|
-
const isMountedRef =
|
|
10823
|
-
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] =
|
|
10824
|
-
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] =
|
|
10825
|
-
|
|
10951
|
+
const isMountedRef = React16.useRef(false);
|
|
10952
|
+
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React16.useState(0);
|
|
10953
|
+
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React16.useState(0);
|
|
10954
|
+
React16.useEffect(() => {
|
|
10826
10955
|
isMountedRef.current = true;
|
|
10827
10956
|
return () => {
|
|
10828
10957
|
isMountedRef.current = false;
|
|
10829
10958
|
};
|
|
10830
10959
|
}, []);
|
|
10831
|
-
|
|
10960
|
+
React16.useEffect(() => {
|
|
10832
10961
|
workerThumbnailRowBatchCacheRef.current.clear();
|
|
10833
10962
|
workerThumbnailRowBatchRequestRef.current.clear();
|
|
10834
10963
|
setWorkerThumbnailRowBatchVersion((version) => version + 1);
|
|
10835
10964
|
}, [locale]);
|
|
10836
|
-
|
|
10965
|
+
React16.useEffect(() => {
|
|
10837
10966
|
const currentSheets = new Set(sheets);
|
|
10838
10967
|
for (const sheet of workerThumbnailRowBatchCacheRef.current.keys()) {
|
|
10839
10968
|
if (!currentSheets.has(sheet)) {
|
|
@@ -10846,7 +10975,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10846
10975
|
}
|
|
10847
10976
|
}
|
|
10848
10977
|
}, [sheets]);
|
|
10849
|
-
const getWorkerThumbnailRowBatch =
|
|
10978
|
+
const getWorkerThumbnailRowBatch = React16.useCallback((sheet, startRow, endRow) => {
|
|
10850
10979
|
const cachedBatch = workerThumbnailRowBatchCacheRef.current.get(sheet);
|
|
10851
10980
|
if (cachedBatch && startRow >= cachedBatch.startRow && endRow <= cachedBatch.endRow) {
|
|
10852
10981
|
return cachedBatch;
|
|
@@ -10888,7 +11017,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10888
11017
|
}
|
|
10889
11018
|
return null;
|
|
10890
11019
|
}, [getRowsBatchAsync]);
|
|
10891
|
-
const getThumbnailImage =
|
|
11020
|
+
const getThumbnailImage = React16.useCallback((image) => {
|
|
10892
11021
|
if (typeof Image === "undefined") {
|
|
10893
11022
|
return null;
|
|
10894
11023
|
}
|
|
@@ -10920,7 +11049,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10920
11049
|
imageElement.src = image.src;
|
|
10921
11050
|
return null;
|
|
10922
11051
|
}, []);
|
|
10923
|
-
const thumbnails =
|
|
11052
|
+
const thumbnails = React16.useMemo(() => {
|
|
10924
11053
|
return sheets.map((sheet, sheetIndex) => {
|
|
10925
11054
|
const worksheet = workbook?.getSheet(sheet.workbookSheetIndex) ?? null;
|
|
10926
11055
|
const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
|
|
@@ -10966,7 +11095,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10966
11095
|
hiddenColSet
|
|
10967
11096
|
);
|
|
10968
11097
|
const resolveColumnWidthPx = (actualCol) => {
|
|
10969
|
-
if (worksheet && !
|
|
11098
|
+
if (worksheet && !hiddenColSet.has(actualCol)) {
|
|
10970
11099
|
const width = worksheet.getColumnWidth(actualCol);
|
|
10971
11100
|
if (width !== void 0 && width !== null) {
|
|
10972
11101
|
return Math.max(
|
|
@@ -10984,7 +11113,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10984
11113
|
);
|
|
10985
11114
|
};
|
|
10986
11115
|
const resolveRowHeightPx = (actualRow) => {
|
|
10987
|
-
if (worksheet && !
|
|
11116
|
+
if (worksheet && !hiddenRowSet.has(actualRow)) {
|
|
10988
11117
|
const height = worksheet.getRowHeight(actualRow);
|
|
10989
11118
|
if (height !== void 0 && height !== null) {
|
|
10990
11119
|
return Math.max(
|
|
@@ -11503,11 +11632,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11503
11632
|
locale,
|
|
11504
11633
|
workbook
|
|
11505
11634
|
]);
|
|
11506
|
-
const paintThumbnail =
|
|
11635
|
+
const paintThumbnail = React16.useCallback(
|
|
11507
11636
|
(sheetIndex, canvas) => thumbnails[sheetIndex]?.paint(canvas) ?? false,
|
|
11508
11637
|
[thumbnails]
|
|
11509
11638
|
);
|
|
11510
|
-
return
|
|
11639
|
+
return React16.useMemo(
|
|
11511
11640
|
() => ({
|
|
11512
11641
|
paintThumbnail,
|
|
11513
11642
|
thumbnails
|
|
@@ -11517,13 +11646,13 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11517
11646
|
}
|
|
11518
11647
|
function DefaultXlsxToolbar({ pivotTableEditor } = {}) {
|
|
11519
11648
|
const controller = useXlsxViewer();
|
|
11520
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
11649
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
11521
11650
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
11522
|
-
return /* @__PURE__ */
|
|
11651
|
+
return /* @__PURE__ */ jsx12(DefaultToolbar, { controller, palette, pivotTableEditor });
|
|
11523
11652
|
}
|
|
11524
11653
|
|
|
11525
11654
|
// src/react-viewer.tsx
|
|
11526
|
-
import { jsx as
|
|
11655
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
11527
11656
|
var SlotStore = class {
|
|
11528
11657
|
slots = /* @__PURE__ */ new Map();
|
|
11529
11658
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -11592,9 +11721,9 @@ var SlotStore = class {
|
|
|
11592
11721
|
}
|
|
11593
11722
|
};
|
|
11594
11723
|
function RuntimeContent({ content }) {
|
|
11595
|
-
const hostRef =
|
|
11596
|
-
const rootRef =
|
|
11597
|
-
|
|
11724
|
+
const hostRef = React17.useRef(null);
|
|
11725
|
+
const rootRef = React17.useRef(null);
|
|
11726
|
+
React17.useLayoutEffect(() => {
|
|
11598
11727
|
const host = hostRef.current;
|
|
11599
11728
|
if (!host) return;
|
|
11600
11729
|
const root = __createContentRoot(host);
|
|
@@ -11604,14 +11733,14 @@ function RuntimeContent({ content }) {
|
|
|
11604
11733
|
root.destroy();
|
|
11605
11734
|
};
|
|
11606
11735
|
}, []);
|
|
11607
|
-
|
|
11736
|
+
React17.useLayoutEffect(() => {
|
|
11608
11737
|
rootRef.current?.update(content);
|
|
11609
11738
|
}, [content]);
|
|
11610
|
-
return /* @__PURE__ */
|
|
11739
|
+
return /* @__PURE__ */ jsx13("span", { ref: hostRef, style: { display: "contents" } });
|
|
11611
11740
|
}
|
|
11612
|
-
function renderOptions(props, controller, slots, owner) {
|
|
11741
|
+
function renderOptions(props, controller, slots, owner, renderHiddenRangeMarker) {
|
|
11613
11742
|
const slot = (key, node) => slots.render(key, node, owner);
|
|
11614
|
-
const runtime = (node) => /* @__PURE__ */
|
|
11743
|
+
const runtime = (node) => /* @__PURE__ */ jsx13(RuntimeContent, { content: node });
|
|
11615
11744
|
const {
|
|
11616
11745
|
emptyState,
|
|
11617
11746
|
errorState,
|
|
@@ -11636,6 +11765,7 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11636
11765
|
return {
|
|
11637
11766
|
...other,
|
|
11638
11767
|
controller,
|
|
11768
|
+
renderHiddenRangeMarker,
|
|
11639
11769
|
emptyState: emptyState === void 0 ? void 0 : slot("empty", emptyState),
|
|
11640
11770
|
loadingComponent: loadingComponent === void 0 ? void 0 : slot("loading-component", loadingComponent),
|
|
11641
11771
|
loadingState: loadingState === void 0 ? void 0 : slot("loading", loadingState),
|
|
@@ -11667,13 +11797,24 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11667
11797
|
};
|
|
11668
11798
|
}
|
|
11669
11799
|
function BoundViewer({ props, controller: sourceController }) {
|
|
11670
|
-
const messages =
|
|
11671
|
-
const controller =
|
|
11672
|
-
const hostRef =
|
|
11673
|
-
const viewerRef =
|
|
11674
|
-
const slots =
|
|
11675
|
-
|
|
11676
|
-
|
|
11800
|
+
const messages = React17.useMemo(() => mergeMessages(sourceController.messages, props.messages), [sourceController.messages, props.messages]);
|
|
11801
|
+
const controller = React17.useMemo(() => ({ ...sourceController, messages }), [sourceController, messages]);
|
|
11802
|
+
const hostRef = React17.useRef(null);
|
|
11803
|
+
const viewerRef = React17.useRef(null);
|
|
11804
|
+
const slots = React17.useMemo(() => new SlotStore(), []);
|
|
11805
|
+
const markerRenderer = props.renderHiddenRangeMarker;
|
|
11806
|
+
const markerSheetIndex = controller.activeSheet?.workbookSheetIndex;
|
|
11807
|
+
const renderHiddenRangeMarker = React17.useMemo(() => {
|
|
11808
|
+
if (!markerRenderer) return void 0;
|
|
11809
|
+
return ({ defaultNode, ...range }) => {
|
|
11810
|
+
const content = markerRenderer({ ...range, defaultNode: /* @__PURE__ */ jsx13(RuntimeContent, { content: defaultNode }) });
|
|
11811
|
+
if (content == null || content === false) return null;
|
|
11812
|
+
const host = hostRef.current;
|
|
11813
|
+
return host ? slots.render(`hidden:${markerSheetIndex}:${range.axis}:${range.start}`, content, host.ownerDocument) : null;
|
|
11814
|
+
};
|
|
11815
|
+
}, [markerRenderer, markerSheetIndex, slots]);
|
|
11816
|
+
React17.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
|
|
11817
|
+
React17.useLayoutEffect(() => {
|
|
11677
11818
|
const host = hostRef.current;
|
|
11678
11819
|
if (!host) return;
|
|
11679
11820
|
slots.observe(host);
|
|
@@ -11685,27 +11826,27 @@ function BoundViewer({ props, controller: sourceController }) {
|
|
|
11685
11826
|
slots.destroy();
|
|
11686
11827
|
};
|
|
11687
11828
|
}, [slots]);
|
|
11688
|
-
|
|
11829
|
+
React17.useLayoutEffect(() => {
|
|
11689
11830
|
const host = hostRef.current;
|
|
11690
|
-
if (host) viewerRef.current?.update(renderOptions(props, controller, slots, host.ownerDocument));
|
|
11691
|
-
}, [controller, props, slots]);
|
|
11692
|
-
return /* @__PURE__ */
|
|
11831
|
+
if (host) viewerRef.current?.update(renderOptions(props, controller, slots, host.ownerDocument, renderHiddenRangeMarker));
|
|
11832
|
+
}, [controller, props, slots, renderHiddenRangeMarker]);
|
|
11833
|
+
return /* @__PURE__ */ jsx13(ViewerAppearanceContext.Provider, { value: {
|
|
11693
11834
|
headerBackgroundColor: props.headerBackgroundColor,
|
|
11694
11835
|
headerTextColor: props.headerTextColor,
|
|
11695
11836
|
isDark: props.isDark ?? false
|
|
11696
11837
|
}, children: /* @__PURE__ */ jsxs9(ViewerContext.Provider, { value: controller, children: [
|
|
11697
|
-
/* @__PURE__ */
|
|
11838
|
+
/* @__PURE__ */ jsx13("div", { ref: hostRef, style: { display: "contents" } }),
|
|
11698
11839
|
slots.portals()
|
|
11699
11840
|
] }) });
|
|
11700
11841
|
}
|
|
11701
11842
|
function UncontrolledViewer(props) {
|
|
11702
11843
|
const controller = useXlsxViewerController(props);
|
|
11703
|
-
return /* @__PURE__ */
|
|
11844
|
+
return /* @__PURE__ */ jsx13(BoundViewer, { props, controller });
|
|
11704
11845
|
}
|
|
11705
11846
|
function XlsxViewer(props) {
|
|
11706
|
-
const context =
|
|
11847
|
+
const context = React17.useContext(ViewerContext);
|
|
11707
11848
|
const controller = props.controller ?? context;
|
|
11708
|
-
return controller ? /* @__PURE__ */
|
|
11849
|
+
return controller ? /* @__PURE__ */ jsx13(BoundViewer, { props, controller }) : /* @__PURE__ */ jsx13(UncontrolledViewer, { ...props });
|
|
11709
11850
|
}
|
|
11710
11851
|
export {
|
|
11711
11852
|
DefaultXlsxPivotTableFieldList,
|