@extend-ai/react-xlsx 0.24.1 → 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 +22 -1
- 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-XUHSQ3GF.js → chunk-J3G4UUGR.js} +207 -54
- package/dist/chunk-J3G4UUGR.js.map +1 -0
- package/dist/{chunk-WW6G674Q.cjs → chunk-LX33ROHL.cjs} +1527 -1374
- 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 +115 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +318 -287
- package/dist/index.js.map +1 -1
- package/dist/{internal-D5HReXVR.d.cts → internal-BhZTIzgZ.d.cts} +19 -1
- package/dist/{internal-D5HReXVR.d.ts → internal-BhZTIzgZ.d.ts} +19 -1
- 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/package.json +1 -1
- package/dist/chunk-MNIFKMIL.js.map +0 -1
- package/dist/chunk-WW6G674Q.cjs.map +0 -1
- package/dist/chunk-XUHSQ3GF.js.map +0 -1
- package/dist/chunk-YOLIVKZD.cjs.map +0 -1
- package/dist/chunk-Z4WMURVU.cjs.map +0 -1
- /package/dist/{shared-chart-CGEK7EAB.js.map → shared-chart-NR4KWDQM.js.map} +0 -0
- /package/dist/{shared-chart-24MCGSFJ.js.map → shared-chart-PMIN7YMP.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var _chunkXZJLPW64cjs = require('./chunk-XZJLPW64.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var _chunkUXJAG7MUcjs = require('./chunk-UXJAG7MU.cjs');
|
|
46
46
|
require('./chunk-JRWNIQWR.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
@@ -889,7 +889,7 @@ function quoteClipboardField(value) {
|
|
|
889
889
|
}
|
|
890
890
|
|
|
891
891
|
// src/controller.tsx
|
|
892
|
-
var _react = require('react'); var React = _interopRequireWildcard(_react); var
|
|
892
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react); var React17 = _interopRequireWildcard(_react); var React16 = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react);
|
|
893
893
|
var _internal = require('@extend-ai/react-xlsx/internal');
|
|
894
894
|
|
|
895
895
|
|
|
@@ -2031,7 +2031,7 @@ function useXlsxViewerController(options2) {
|
|
|
2031
2031
|
src,
|
|
2032
2032
|
useWorker = true
|
|
2033
2033
|
} = options2;
|
|
2034
|
-
const messages = React.useMemo(() =>
|
|
2034
|
+
const messages = React.useMemo(() => _chunkUXJAG7MUcjs.resolveMessages.call(void 0, locale, messageOverrides), [locale, messageOverrides]);
|
|
2035
2035
|
const [isLoading, setIsLoading] = React.useState(Boolean(_nullishCoalesce(file, () => ( src))));
|
|
2036
2036
|
const [error, setError] = React.useState(null);
|
|
2037
2037
|
const [workbook, setWorkbook] = React.useState(null);
|
|
@@ -4110,7 +4110,8 @@ function useXlsxViewerController(options2) {
|
|
|
4110
4110
|
setSelectedImageId(null);
|
|
4111
4111
|
selectionAnchorRef.current = _nullishCoalesce(_optionalChain([active, 'optionalAccess', _387 => _387.start]), () => ( null));
|
|
4112
4112
|
const cell = _optionalChain([active, 'optionalAccess', _388 => _388[activeCorner]]);
|
|
4113
|
-
|
|
4113
|
+
const mergeAnchor = cell && _optionalChain([findSelectionMerge, 'call', _389 => _389(cell), 'optionalAccess', _390 => _390.start]);
|
|
4114
|
+
setActiveCell(mergeAnchor && active && rangeContainsCell(active, mergeAnchor) ? mergeAnchor : _nullishCoalesce(cell, () => ( null)));
|
|
4114
4115
|
setSelectionRanges(areas);
|
|
4115
4116
|
}, [findSelectionMerge]);
|
|
4116
4117
|
const selectRange = React.useCallback((range) => {
|
|
@@ -5184,7 +5185,7 @@ function CellEditor({
|
|
|
5184
5185
|
onNavigate
|
|
5185
5186
|
}) {
|
|
5186
5187
|
const rootRef = React2.useRef(null);
|
|
5187
|
-
const messages =
|
|
5188
|
+
const messages = _chunkUXJAG7MUcjs.useXlsxMessages.call(void 0, );
|
|
5188
5189
|
const mirrorRef = React2.useRef(null);
|
|
5189
5190
|
const textRef = React2.useRef(null);
|
|
5190
5191
|
const baselineRef = React2.useRef(null);
|
|
@@ -5457,6 +5458,24 @@ function getCellGeneralAlignment(worksheet, row2, col) {
|
|
|
5457
5458
|
}
|
|
5458
5459
|
}
|
|
5459
5460
|
|
|
5461
|
+
// src/hidden-range-marker.tsx
|
|
5462
|
+
|
|
5463
|
+
|
|
5464
|
+
function resizeCursor(axis) {
|
|
5465
|
+
const transform = axis === "column" ? ' transform="rotate(90 12 12)"' : "";
|
|
5466
|
+
const path = "M6 10h12 M6 14h12 M12 7V3 M9 6l3-3 3 3 M12 17v4 M9 18l3 3 3-3";
|
|
5467
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
5468
|
+
<g fill="none" stroke-linecap="round" stroke-linejoin="round"${transform}>
|
|
5469
|
+
<path d="${path}" stroke="white" stroke-width="3.5"/>
|
|
5470
|
+
<path d="${path}" stroke="#111" stroke-width="1.5"/>
|
|
5471
|
+
</g>
|
|
5472
|
+
</svg>`;
|
|
5473
|
+
const fallback = axis === "row" ? "row-resize" : "col-resize";
|
|
5474
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}") 12 12, ${fallback}`;
|
|
5475
|
+
}
|
|
5476
|
+
var ROW_RESIZE_CURSOR = resizeCursor("row");
|
|
5477
|
+
var COLUMN_RESIZE_CURSOR = resizeCursor("column");
|
|
5478
|
+
|
|
5460
5479
|
// src/header-size-dialog.tsx
|
|
5461
5480
|
|
|
5462
5481
|
|
|
@@ -5563,18 +5582,18 @@ function copyPivot(pivot) {
|
|
|
5563
5582
|
function usePivotTableEditor(viewer, options2 = {}) {
|
|
5564
5583
|
const open = viewer.pivotFieldListVisible;
|
|
5565
5584
|
const setOpen = viewer.setPivotFieldListVisible;
|
|
5566
|
-
const [draft, setDraft] =
|
|
5567
|
-
const [dirty, setDirty] =
|
|
5568
|
-
const [error, setError] =
|
|
5569
|
-
const [status, setStatus] =
|
|
5570
|
-
const [details, setDetails] =
|
|
5571
|
-
const [detailContext, setDetailContext] =
|
|
5572
|
-
const [loadedSource, setLoadedSource] =
|
|
5573
|
-
const [savedDefinition, setSavedDefinition] =
|
|
5574
|
-
const [pendingFocus, setPendingFocus] =
|
|
5585
|
+
const [draft, setDraft] = React12.useState(null);
|
|
5586
|
+
const [dirty, setDirty] = React12.useState(false);
|
|
5587
|
+
const [error, setError] = React12.useState(null);
|
|
5588
|
+
const [status, setStatus] = React12.useState(null);
|
|
5589
|
+
const [details, setDetails] = React12.useState(null);
|
|
5590
|
+
const [detailContext, setDetailContext] = React12.useState(null);
|
|
5591
|
+
const [loadedSource, setLoadedSource] = React12.useState("");
|
|
5592
|
+
const [savedDefinition, setSavedDefinition] = React12.useState("");
|
|
5593
|
+
const [pendingFocus, setPendingFocus] = React12.useState(null);
|
|
5575
5594
|
const sourceNeedsLoad = Boolean(draft && JSON.stringify(draft.source) !== loadedSource);
|
|
5576
5595
|
const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess', _440 => _440.id]) && savedDefinition !== JSON.stringify(_nullishCoalesce(viewer.pivotTables.find((pivot) => pivot.id === draft.id), () => ( null))));
|
|
5577
|
-
const run =
|
|
5596
|
+
const run = React12.useCallback((action) => {
|
|
5578
5597
|
setError(null);
|
|
5579
5598
|
setStatus(null);
|
|
5580
5599
|
try {
|
|
@@ -5584,7 +5603,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5584
5603
|
setOpen(true);
|
|
5585
5604
|
}
|
|
5586
5605
|
}, []);
|
|
5587
|
-
|
|
5606
|
+
React12.useEffect(() => {
|
|
5588
5607
|
if (options2.enabled === false) return;
|
|
5589
5608
|
setDraft(null);
|
|
5590
5609
|
setDirty(false);
|
|
@@ -5597,7 +5616,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5597
5616
|
setPendingFocus(null);
|
|
5598
5617
|
if (options2.initialOpen !== void 0) setOpen(options2.initialOpen);
|
|
5599
5618
|
}, [viewer.src, viewer.file]);
|
|
5600
|
-
|
|
5619
|
+
React12.useEffect(() => {
|
|
5601
5620
|
if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess', _441 => _441.id])) return;
|
|
5602
5621
|
const current = viewer.pivotTables.find((pivot) => pivot.id === draft.id);
|
|
5603
5622
|
setDraft(current ? copyPivot(current) : null);
|
|
@@ -5606,7 +5625,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5606
5625
|
setSavedDefinition(JSON.stringify(current));
|
|
5607
5626
|
}
|
|
5608
5627
|
}, [viewer.pivotTables]);
|
|
5609
|
-
|
|
5628
|
+
React12.useEffect(() => {
|
|
5610
5629
|
if (options2.enabled === false || options2.autoSelect === false || dirty || pendingFocus || !viewer.activeCell || !viewer.activeSheet) return;
|
|
5611
5630
|
const current = viewer.getPivotTableAtCell(viewer.activeCell, viewer.activeSheet.name);
|
|
5612
5631
|
if (!current || current.id === _optionalChain([draft, 'optionalAccess', _442 => _442.id])) return;
|
|
@@ -5617,7 +5636,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5617
5636
|
setStatus(null);
|
|
5618
5637
|
setDetails(null);
|
|
5619
5638
|
}, [_optionalChain([viewer, 'access', _443 => _443.activeCell, 'optionalAccess', _444 => _444.row]), _optionalChain([viewer, 'access', _445 => _445.activeCell, 'optionalAccess', _446 => _446.col]), _optionalChain([viewer, 'access', _447 => _447.activeSheet, 'optionalAccess', _448 => _448.name]), viewer.pivotTables, options2.autoSelect, options2.enabled]);
|
|
5620
|
-
|
|
5639
|
+
React12.useEffect(() => {
|
|
5621
5640
|
if (!pendingFocus || _optionalChain([viewer, 'access', _449 => _449.activeSheet, 'optionalAccess', _450 => _450.name, 'access', _451 => _451.toLowerCase, 'call', _452 => _452()]) !== pendingFocus.sheet.toLowerCase()) return;
|
|
5622
5641
|
viewer.selectCell({ row: pendingFocus.row, col: pendingFocus.col });
|
|
5623
5642
|
setPendingFocus(null);
|
|
@@ -5880,7 +5899,7 @@ function Section({ title, children: children2 }) {
|
|
|
5880
5899
|
] });
|
|
5881
5900
|
}
|
|
5882
5901
|
function Members({ items, selected, onChange, label = "Items" }) {
|
|
5883
|
-
const [search, setSearch] =
|
|
5902
|
+
const [search, setSearch] = React13.useState("");
|
|
5884
5903
|
const visible = items.filter((item) => item.caption.toLocaleLowerCase().includes(search.toLocaleLowerCase()));
|
|
5885
5904
|
const keys = new Set(selected);
|
|
5886
5905
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, gap: 6 }, children: [
|
|
@@ -6001,13 +6020,13 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
6001
6020
|
] });
|
|
6002
6021
|
}
|
|
6003
6022
|
function Advanced({ editor, pivot }) {
|
|
6004
|
-
const [chartType, setChartType] =
|
|
6005
|
-
const [chartCell, setChartCell] =
|
|
6006
|
-
const [chartTitle, setChartTitle] =
|
|
6007
|
-
const [chartMeasure, setChartMeasure] =
|
|
6008
|
-
const [chartSheet, setChartSheet] =
|
|
6009
|
-
const [chartWidth, setChartWidth] =
|
|
6010
|
-
const [chartHeight, setChartHeight] =
|
|
6023
|
+
const [chartType, setChartType] = React13.useState("ColumnClustered");
|
|
6024
|
+
const [chartCell, setChartCell] = React13.useState("I2");
|
|
6025
|
+
const [chartTitle, setChartTitle] = React13.useState("");
|
|
6026
|
+
const [chartMeasure, setChartMeasure] = React13.useState("");
|
|
6027
|
+
const [chartSheet, setChartSheet] = React13.useState("");
|
|
6028
|
+
const [chartWidth, setChartWidth] = React13.useState("560");
|
|
6029
|
+
const [chartHeight, setChartHeight] = React13.useState("340");
|
|
6011
6030
|
const update = (patch) => editor.edit((current) => ({ ...current, ...patch }));
|
|
6012
6031
|
const sheets = editor.viewer.sheets.map((sheet) => [sheet.name, sheet.name]);
|
|
6013
6032
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
@@ -6068,21 +6087,21 @@ function Advanced({ editor, pivot }) {
|
|
|
6068
6087
|
] });
|
|
6069
6088
|
}
|
|
6070
6089
|
function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, style }) {
|
|
6071
|
-
const paneRef =
|
|
6072
|
-
const [placement, setPlacement] =
|
|
6073
|
-
const [search, setSearch] =
|
|
6074
|
-
const [selected, setSelected] =
|
|
6075
|
-
const [dragOver, setDragOver] =
|
|
6076
|
-
const [announcement, setAnnouncement] =
|
|
6077
|
-
const titleId =
|
|
6078
|
-
const settingsId =
|
|
6090
|
+
const paneRef = React13.useRef(null);
|
|
6091
|
+
const [placement, setPlacement] = React13.useState({ overlay: false, top: 0, width: 324 });
|
|
6092
|
+
const [search, setSearch] = React13.useState("");
|
|
6093
|
+
const [selected, setSelected] = React13.useState(null);
|
|
6094
|
+
const [dragOver, setDragOver] = React13.useState(null);
|
|
6095
|
+
const [announcement, setAnnouncement] = React13.useState("");
|
|
6096
|
+
const titleId = React13.useId();
|
|
6097
|
+
const settingsId = React13.useId();
|
|
6079
6098
|
const pivot = editor.draft;
|
|
6080
6099
|
const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess', _529 => _529.unsupportedFeatures, 'access', _530 => _530.length])) || editor.sourceNeedsLoad;
|
|
6081
|
-
|
|
6100
|
+
React13.useEffect(() => {
|
|
6082
6101
|
setSelected(null);
|
|
6083
6102
|
setSearch("");
|
|
6084
6103
|
}, [_optionalChain([pivot, 'optionalAccess', _531 => _531.id])]);
|
|
6085
|
-
|
|
6104
|
+
React13.useEffect(() => {
|
|
6086
6105
|
const parent = _optionalChain([paneRef, 'access', _532 => _532.current, 'optionalAccess', _533 => _533.parentElement]);
|
|
6087
6106
|
if (!parent) return;
|
|
6088
6107
|
const viewer = parent.closest(".react-xlsx-viewer");
|
|
@@ -6312,7 +6331,7 @@ function createChartModule(importModule) {
|
|
|
6312
6331
|
};
|
|
6313
6332
|
}
|
|
6314
6333
|
var officeChartRenderer = createChartModule(async () => {
|
|
6315
|
-
const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-
|
|
6334
|
+
const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-QIS7OPL3.cjs")));
|
|
6316
6335
|
return { renderer: null, SharedChartSvg };
|
|
6317
6336
|
});
|
|
6318
6337
|
|
|
@@ -7011,8 +7030,8 @@ function lightenColor(color, ratio) {
|
|
|
7011
7030
|
function darkenColor(color, ratio) {
|
|
7012
7031
|
return mixRgbColor(color, "#000000", ratio);
|
|
7013
7032
|
}
|
|
7014
|
-
var ViewerContext =
|
|
7015
|
-
var ViewerAppearanceContext =
|
|
7033
|
+
var ViewerContext = React16.createContext(null);
|
|
7034
|
+
var ViewerAppearanceContext = React16.createContext({ isDark: false });
|
|
7016
7035
|
function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
|
|
7017
7036
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: [top && "top", bottom && "bottom"].flatMap((vertical) => vertical ? [left && "left", right && "right"].map((horizontal) => horizontal ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
|
|
7018
7037
|
position: "absolute",
|
|
@@ -7978,7 +7997,7 @@ function applyCanvasShapeDash(context, dash, lineWidth) {
|
|
|
7978
7997
|
}
|
|
7979
7998
|
}
|
|
7980
7999
|
function useViewerPalette(isDark = false, headerBackgroundColor, headerTextColor) {
|
|
7981
|
-
return
|
|
8000
|
+
return React16.useMemo(
|
|
7982
8001
|
() => resolveViewerPalette(isDark, headerBackgroundColor, headerTextColor),
|
|
7983
8002
|
[headerBackgroundColor, headerTextColor, isDark]
|
|
7984
8003
|
);
|
|
@@ -9097,7 +9116,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
9097
9116
|
items: tabs.map((tab, index) => ({
|
|
9098
9117
|
id: String(index),
|
|
9099
9118
|
label: tab.name,
|
|
9100
|
-
title: tab.visibility === "hidden" ?
|
|
9119
|
+
title: tab.visibility === "hidden" ? _chunkUXJAG7MUcjs.formatMessage.call(void 0, messages.hiddenSheet, { sheet: tab.name }) : tab.visibility === "veryHidden" ? _chunkUXJAG7MUcjs.formatMessage.call(void 0, messages.veryHiddenSheet, { sheet: tab.name }) : tab.name,
|
|
9101
9120
|
visibility: tab.visibility
|
|
9102
9121
|
})),
|
|
9103
9122
|
onValueChange: (value) => setActiveTabIndex(Number(value)),
|
|
@@ -10445,7 +10464,7 @@ function GridRow({
|
|
|
10445
10464
|
) : null
|
|
10446
10465
|
] });
|
|
10447
10466
|
}
|
|
10448
|
-
var MemoGridRow =
|
|
10467
|
+
var MemoGridRow = React16.memo(GridRow, (prev, next) => {
|
|
10449
10468
|
if (prev.actualRow !== next.actualRow || prev.rowHeight !== next.rowHeight || prev.headerLabelLiveScale !== next.headerLabelLiveScale || prev.palette !== next.palette || prev.readOnly !== next.readOnly || prev.visibleCols !== next.visibleCols || prev.leadingSpacerWidth !== next.leadingSpacerWidth || prev.rowHeaderWidth !== next.rowHeaderWidth || prev.stickyLeftByCol !== next.stickyLeftByCol || prev.stickyTop !== next.stickyTop || prev.trailingSpacerWidth !== next.trailingSpacerWidth || prev.zoomFactor !== next.zoomFactor || prev.getCellData !== next.getCellData || prev.onCellClick !== next.onCellClick || prev.onCellDoubleClick !== next.onCellDoubleClick || prev.onCellPointerDown !== next.onCellPointerDown || prev.onEditingBlur !== next.onEditingBlur || prev.onEditingCancel !== next.onEditingCancel || prev.onEditingCommit !== next.onEditingCommit || prev.onEditingNavigate !== next.onEditingNavigate || prev.onEditingValueChange !== next.onEditingValueChange || prev.onRowHeaderRef !== next.onRowHeaderRef || prev.onRowPointerDown !== next.onRowPointerDown || prev.onRowResizeDoubleClick !== next.onRowResizeDoubleClick || prev.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment || prev.cellEditorStyle !== next.cellEditorStyle || prev.onFocusEditorOverlay !== next.onFocusEditorOverlay) {
|
|
10450
10469
|
return false;
|
|
10451
10470
|
}
|
|
@@ -10474,7 +10493,7 @@ function XlsxViewerProvider({ children: children2, controller, isDark = false, .
|
|
|
10474
10493
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, XlsxViewerProviderWithInlineController, { ...options2, isDark, children: children2 });
|
|
10475
10494
|
}
|
|
10476
10495
|
function useXlsxViewer() {
|
|
10477
|
-
const context =
|
|
10496
|
+
const context = React16.useContext(ViewerContext);
|
|
10478
10497
|
if (!context) {
|
|
10479
10498
|
throw new Error("useXlsxViewer must be used inside XlsxViewer or XlsxViewerProvider.");
|
|
10480
10499
|
}
|
|
@@ -10492,7 +10511,7 @@ function useXlsxViewerSelection() {
|
|
|
10492
10511
|
selectionRanges,
|
|
10493
10512
|
selection
|
|
10494
10513
|
} = useXlsxViewer();
|
|
10495
|
-
return
|
|
10514
|
+
return React16.useMemo(
|
|
10496
10515
|
() => ({
|
|
10497
10516
|
activeCell,
|
|
10498
10517
|
activeCellAddress,
|
|
@@ -10509,7 +10528,7 @@ function useXlsxViewerSelection() {
|
|
|
10509
10528
|
}
|
|
10510
10529
|
function useXlsxViewerLayout() {
|
|
10511
10530
|
const { canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
|
|
10512
|
-
return
|
|
10531
|
+
return React16.useMemo(
|
|
10513
10532
|
() => ({ canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
|
|
10514
10533
|
[canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
|
|
10515
10534
|
);
|
|
@@ -10527,7 +10546,7 @@ function useXlsxViewerZoom() {
|
|
|
10527
10546
|
zoomOut,
|
|
10528
10547
|
zoomScale
|
|
10529
10548
|
} = useXlsxViewer();
|
|
10530
|
-
return
|
|
10549
|
+
return React16.useMemo(
|
|
10531
10550
|
() => ({
|
|
10532
10551
|
canZoomIn,
|
|
10533
10552
|
canZoomOut,
|
|
@@ -10596,7 +10615,7 @@ function useXlsxViewerEditing() {
|
|
|
10596
10615
|
unmergeSelection,
|
|
10597
10616
|
updateFormControl
|
|
10598
10617
|
} = useXlsxViewer();
|
|
10599
|
-
return
|
|
10618
|
+
return React16.useMemo(
|
|
10600
10619
|
() => ({
|
|
10601
10620
|
addFormControl,
|
|
10602
10621
|
addSheet,
|
|
@@ -10683,7 +10702,7 @@ function useXlsxViewerEditing() {
|
|
|
10683
10702
|
}
|
|
10684
10703
|
function useXlsxViewerTables() {
|
|
10685
10704
|
const { sortState, sortTable, tables } = useXlsxViewer();
|
|
10686
|
-
return
|
|
10705
|
+
return React16.useMemo(
|
|
10687
10706
|
() => ({
|
|
10688
10707
|
sortState,
|
|
10689
10708
|
sortTable,
|
|
@@ -10694,7 +10713,7 @@ function useXlsxViewerTables() {
|
|
|
10694
10713
|
}
|
|
10695
10714
|
function useXlsxViewerPivots() {
|
|
10696
10715
|
const { pivotTables, pivotFieldListVisible, setPivotFieldListVisible, getPivotSourceFields, getPivotTableAtCell, upsertPivotTable, refreshPivotTable, refreshAllPivotTables, removePivotTable, pivotDrillDown, showPivotDetails, createPivotChart, togglePivotGroup } = useXlsxViewer();
|
|
10697
|
-
return
|
|
10716
|
+
return React16.useMemo(() => ({
|
|
10698
10717
|
pivotTables,
|
|
10699
10718
|
pivotFieldListVisible,
|
|
10700
10719
|
setPivotFieldListVisible,
|
|
@@ -10748,7 +10767,7 @@ function useXlsxViewerImages() {
|
|
|
10748
10767
|
setImageRect,
|
|
10749
10768
|
updateChart
|
|
10750
10769
|
} = useXlsxViewer();
|
|
10751
|
-
return
|
|
10770
|
+
return React16.useMemo(
|
|
10752
10771
|
() => ({
|
|
10753
10772
|
arrangeDrawing,
|
|
10754
10773
|
changeChartType,
|
|
@@ -10850,7 +10869,7 @@ function useXlsxViewerCharts() {
|
|
|
10850
10869
|
tabs,
|
|
10851
10870
|
updateChart
|
|
10852
10871
|
} = useXlsxViewer();
|
|
10853
|
-
return
|
|
10872
|
+
return React16.useMemo(
|
|
10854
10873
|
() => ({
|
|
10855
10874
|
activeTab,
|
|
10856
10875
|
activeTabIndex,
|
|
@@ -10923,30 +10942,30 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10923
10942
|
workbook,
|
|
10924
10943
|
sheets
|
|
10925
10944
|
} = useXlsxViewer();
|
|
10926
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
10945
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
10927
10946
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
10928
10947
|
const includeHeaders = _nullishCoalesce(options2.includeHeaders, () => ( true));
|
|
10929
10948
|
const resolution = options2.resolution;
|
|
10930
|
-
const thumbnailImageCacheRef =
|
|
10931
|
-
const workerThumbnailRowBatchCacheRef =
|
|
10932
|
-
const workerThumbnailRowBatchRequestRef =
|
|
10949
|
+
const thumbnailImageCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10950
|
+
const workerThumbnailRowBatchCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10951
|
+
const workerThumbnailRowBatchRequestRef = React16.useRef(
|
|
10933
10952
|
/* @__PURE__ */ new Map()
|
|
10934
10953
|
);
|
|
10935
|
-
const isMountedRef =
|
|
10936
|
-
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] =
|
|
10937
|
-
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] =
|
|
10938
|
-
|
|
10954
|
+
const isMountedRef = React16.useRef(false);
|
|
10955
|
+
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React16.useState(0);
|
|
10956
|
+
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React16.useState(0);
|
|
10957
|
+
React16.useEffect(() => {
|
|
10939
10958
|
isMountedRef.current = true;
|
|
10940
10959
|
return () => {
|
|
10941
10960
|
isMountedRef.current = false;
|
|
10942
10961
|
};
|
|
10943
10962
|
}, []);
|
|
10944
|
-
|
|
10963
|
+
React16.useEffect(() => {
|
|
10945
10964
|
workerThumbnailRowBatchCacheRef.current.clear();
|
|
10946
10965
|
workerThumbnailRowBatchRequestRef.current.clear();
|
|
10947
10966
|
setWorkerThumbnailRowBatchVersion((version) => version + 1);
|
|
10948
10967
|
}, [locale]);
|
|
10949
|
-
|
|
10968
|
+
React16.useEffect(() => {
|
|
10950
10969
|
const currentSheets = new Set(sheets);
|
|
10951
10970
|
for (const sheet of workerThumbnailRowBatchCacheRef.current.keys()) {
|
|
10952
10971
|
if (!currentSheets.has(sheet)) {
|
|
@@ -10959,7 +10978,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10959
10978
|
}
|
|
10960
10979
|
}
|
|
10961
10980
|
}, [sheets]);
|
|
10962
|
-
const getWorkerThumbnailRowBatch =
|
|
10981
|
+
const getWorkerThumbnailRowBatch = React16.useCallback((sheet, startRow, endRow) => {
|
|
10963
10982
|
const cachedBatch = workerThumbnailRowBatchCacheRef.current.get(sheet);
|
|
10964
10983
|
if (cachedBatch && startRow >= cachedBatch.startRow && endRow <= cachedBatch.endRow) {
|
|
10965
10984
|
return cachedBatch;
|
|
@@ -11001,7 +11020,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11001
11020
|
}
|
|
11002
11021
|
return null;
|
|
11003
11022
|
}, [getRowsBatchAsync]);
|
|
11004
|
-
const getThumbnailImage =
|
|
11023
|
+
const getThumbnailImage = React16.useCallback((image) => {
|
|
11005
11024
|
if (typeof Image === "undefined") {
|
|
11006
11025
|
return null;
|
|
11007
11026
|
}
|
|
@@ -11033,7 +11052,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11033
11052
|
imageElement.src = image.src;
|
|
11034
11053
|
return null;
|
|
11035
11054
|
}, []);
|
|
11036
|
-
const thumbnails =
|
|
11055
|
+
const thumbnails = React16.useMemo(() => {
|
|
11037
11056
|
return sheets.map((sheet, sheetIndex) => {
|
|
11038
11057
|
const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _675 => _675.getSheet, 'call', _676 => _676(sheet.workbookSheetIndex)]), () => ( null));
|
|
11039
11058
|
const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
|
|
@@ -11616,11 +11635,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11616
11635
|
locale,
|
|
11617
11636
|
workbook
|
|
11618
11637
|
]);
|
|
11619
|
-
const paintThumbnail =
|
|
11638
|
+
const paintThumbnail = React16.useCallback(
|
|
11620
11639
|
(sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _713 => _713[sheetIndex], 'optionalAccess', _714 => _714.paint, 'call', _715 => _715(canvas)]), () => ( false)),
|
|
11621
11640
|
[thumbnails]
|
|
11622
11641
|
);
|
|
11623
|
-
return
|
|
11642
|
+
return React16.useMemo(
|
|
11624
11643
|
() => ({
|
|
11625
11644
|
paintThumbnail,
|
|
11626
11645
|
thumbnails
|
|
@@ -11630,7 +11649,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11630
11649
|
}
|
|
11631
11650
|
function DefaultXlsxToolbar({ pivotTableEditor } = {}) {
|
|
11632
11651
|
const controller = useXlsxViewer();
|
|
11633
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
11652
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
11634
11653
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
11635
11654
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultToolbar, { controller, palette, pivotTableEditor });
|
|
11636
11655
|
}
|
|
@@ -11705,9 +11724,9 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
|
|
|
11705
11724
|
}
|
|
11706
11725
|
}, _class2);
|
|
11707
11726
|
function RuntimeContent({ content }) {
|
|
11708
|
-
const hostRef =
|
|
11709
|
-
const rootRef =
|
|
11710
|
-
|
|
11727
|
+
const hostRef = React17.useRef(null);
|
|
11728
|
+
const rootRef = React17.useRef(null);
|
|
11729
|
+
React17.useLayoutEffect(() => {
|
|
11711
11730
|
const host = hostRef.current;
|
|
11712
11731
|
if (!host) return;
|
|
11713
11732
|
const root = _internal.__createContentRoot.call(void 0, host);
|
|
@@ -11717,12 +11736,12 @@ function RuntimeContent({ content }) {
|
|
|
11717
11736
|
root.destroy();
|
|
11718
11737
|
};
|
|
11719
11738
|
}, []);
|
|
11720
|
-
|
|
11739
|
+
React17.useLayoutEffect(() => {
|
|
11721
11740
|
_optionalChain([rootRef, 'access', _719 => _719.current, 'optionalAccess', _720 => _720.update, 'call', _721 => _721(content)]);
|
|
11722
11741
|
}, [content]);
|
|
11723
11742
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: hostRef, style: { display: "contents" } });
|
|
11724
11743
|
}
|
|
11725
|
-
function renderOptions(props, controller, slots, owner) {
|
|
11744
|
+
function renderOptions(props, controller, slots, owner, renderHiddenRangeMarker) {
|
|
11726
11745
|
const slot = (key, node) => slots.render(key, node, owner);
|
|
11727
11746
|
const runtime = (node) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RuntimeContent, { content: node });
|
|
11728
11747
|
const {
|
|
@@ -11749,6 +11768,7 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11749
11768
|
return {
|
|
11750
11769
|
...other,
|
|
11751
11770
|
controller,
|
|
11771
|
+
renderHiddenRangeMarker,
|
|
11752
11772
|
emptyState: emptyState === void 0 ? void 0 : slot("empty", emptyState),
|
|
11753
11773
|
loadingComponent: loadingComponent === void 0 ? void 0 : slot("loading-component", loadingComponent),
|
|
11754
11774
|
loadingState: loadingState === void 0 ? void 0 : slot("loading", loadingState),
|
|
@@ -11780,13 +11800,24 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11780
11800
|
};
|
|
11781
11801
|
}
|
|
11782
11802
|
function BoundViewer({ props, controller: sourceController }) {
|
|
11783
|
-
const messages =
|
|
11784
|
-
const controller =
|
|
11785
|
-
const hostRef =
|
|
11786
|
-
const viewerRef =
|
|
11787
|
-
const slots =
|
|
11788
|
-
|
|
11789
|
-
|
|
11803
|
+
const messages = React17.useMemo(() => _chunkUXJAG7MUcjs.mergeMessages.call(void 0, sourceController.messages, props.messages), [sourceController.messages, props.messages]);
|
|
11804
|
+
const controller = React17.useMemo(() => ({ ...sourceController, messages }), [sourceController, messages]);
|
|
11805
|
+
const hostRef = React17.useRef(null);
|
|
11806
|
+
const viewerRef = React17.useRef(null);
|
|
11807
|
+
const slots = React17.useMemo(() => new SlotStore(), []);
|
|
11808
|
+
const markerRenderer = props.renderHiddenRangeMarker;
|
|
11809
|
+
const markerSheetIndex = _optionalChain([controller, 'access', _722 => _722.activeSheet, 'optionalAccess', _723 => _723.workbookSheetIndex]);
|
|
11810
|
+
const renderHiddenRangeMarker = React17.useMemo(() => {
|
|
11811
|
+
if (!markerRenderer) return void 0;
|
|
11812
|
+
return ({ defaultNode, ...range }) => {
|
|
11813
|
+
const content = markerRenderer({ ...range, defaultNode: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RuntimeContent, { content: defaultNode }) });
|
|
11814
|
+
if (content == null || content === false) return null;
|
|
11815
|
+
const host = hostRef.current;
|
|
11816
|
+
return host ? slots.render(`hidden:${markerSheetIndex}:${range.axis}:${range.start}`, content, host.ownerDocument) : null;
|
|
11817
|
+
};
|
|
11818
|
+
}, [markerRenderer, markerSheetIndex, slots]);
|
|
11819
|
+
React17.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
|
|
11820
|
+
React17.useLayoutEffect(() => {
|
|
11790
11821
|
const host = hostRef.current;
|
|
11791
11822
|
if (!host) return;
|
|
11792
11823
|
slots.observe(host);
|
|
@@ -11798,10 +11829,10 @@ function BoundViewer({ props, controller: sourceController }) {
|
|
|
11798
11829
|
slots.destroy();
|
|
11799
11830
|
};
|
|
11800
11831
|
}, [slots]);
|
|
11801
|
-
|
|
11832
|
+
React17.useLayoutEffect(() => {
|
|
11802
11833
|
const host = hostRef.current;
|
|
11803
|
-
if (host) _optionalChain([viewerRef, 'access',
|
|
11804
|
-
}, [controller, props, slots]);
|
|
11834
|
+
if (host) _optionalChain([viewerRef, 'access', _724 => _724.current, 'optionalAccess', _725 => _725.update, 'call', _726 => _726(renderOptions(props, controller, slots, host.ownerDocument, renderHiddenRangeMarker))]);
|
|
11835
|
+
}, [controller, props, slots, renderHiddenRangeMarker]);
|
|
11805
11836
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ViewerAppearanceContext.Provider, { value: {
|
|
11806
11837
|
headerBackgroundColor: props.headerBackgroundColor,
|
|
11807
11838
|
headerTextColor: props.headerTextColor,
|
|
@@ -11816,7 +11847,7 @@ function UncontrolledViewer(props) {
|
|
|
11816
11847
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller });
|
|
11817
11848
|
}
|
|
11818
11849
|
function XlsxViewer(props) {
|
|
11819
|
-
const context =
|
|
11850
|
+
const context = React17.useContext(ViewerContext);
|
|
11820
11851
|
const controller = _nullishCoalesce(props.controller, () => ( context));
|
|
11821
11852
|
return controller ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UncontrolledViewer, { ...props });
|
|
11822
11853
|
}
|