@extend-ai/react-xlsx 0.24.1 → 0.24.3
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-WW6G674Q.cjs → chunk-6TAWBCPV.cjs} +1974 -1796
- package/dist/chunk-6TAWBCPV.cjs.map +1 -0
- 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-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-XUHSQ3GF.js → chunk-TVUCGYTJ.js} +239 -61
- package/dist/chunk-TVUCGYTJ.js.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.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,
|
|
@@ -4107,7 +4107,8 @@ function useXlsxViewerController(options2) {
|
|
|
4107
4107
|
setSelectedImageId(null);
|
|
4108
4108
|
selectionAnchorRef.current = active?.start ?? null;
|
|
4109
4109
|
const cell = active?.[activeCorner];
|
|
4110
|
-
|
|
4110
|
+
const mergeAnchor = cell && findSelectionMerge(cell)?.start;
|
|
4111
|
+
setActiveCell(mergeAnchor && active && rangeContainsCell(active, mergeAnchor) ? mergeAnchor : cell ?? null);
|
|
4111
4112
|
setSelectionRanges(areas);
|
|
4112
4113
|
}, [findSelectionMerge]);
|
|
4113
4114
|
const selectRange = React.useCallback((range) => {
|
|
@@ -5152,12 +5153,12 @@ function useXlsxViewerController(options2) {
|
|
|
5152
5153
|
import { initWasm, parseXlsxRange as parseXlsxRange2, setWasmSource, XlsxFileSizeLimitExceededError as XlsxFileSizeLimitExceededError3 } from "@extend-ai/react-xlsx/vanilla";
|
|
5153
5154
|
|
|
5154
5155
|
// src/react-viewer.tsx
|
|
5155
|
-
import * as
|
|
5156
|
+
import * as React17 from "react";
|
|
5156
5157
|
import { createPortal as createPortal7 } from "react-dom";
|
|
5157
5158
|
import { __createContentNode, __createContentRoot, __createControlledViewer } from "@extend-ai/react-xlsx/internal";
|
|
5158
5159
|
|
|
5159
5160
|
// src/XlsxViewer.tsx
|
|
5160
|
-
import * as
|
|
5161
|
+
import * as React16 from "react";
|
|
5161
5162
|
import { createPortal as createPortal6 } from "react-dom";
|
|
5162
5163
|
|
|
5163
5164
|
// src/cell-editor.tsx
|
|
@@ -5454,13 +5455,31 @@ function getCellGeneralAlignment(worksheet, row2, col) {
|
|
|
5454
5455
|
}
|
|
5455
5456
|
}
|
|
5456
5457
|
|
|
5457
|
-
// src/
|
|
5458
|
+
// src/hidden-range-marker.tsx
|
|
5458
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";
|
|
5459
5478
|
import { createPortal as createPortal3 } from "react-dom";
|
|
5460
|
-
import { jsx as
|
|
5479
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5461
5480
|
|
|
5462
5481
|
// src/context-menu.tsx
|
|
5463
|
-
import * as
|
|
5482
|
+
import * as React9 from "react";
|
|
5464
5483
|
import { createPortal as createPortal4 } from "react-dom";
|
|
5465
5484
|
|
|
5466
5485
|
// src/viewer-palette.ts
|
|
@@ -5525,23 +5544,23 @@ function resolveViewerPalette(isDark = false, headerBackgroundColor, headerTextC
|
|
|
5525
5544
|
}
|
|
5526
5545
|
|
|
5527
5546
|
// src/context-menu-items.tsx
|
|
5528
|
-
import * as
|
|
5529
|
-
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";
|
|
5530
5549
|
|
|
5531
5550
|
// src/context-menu.tsx
|
|
5532
|
-
import { jsx as
|
|
5551
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
5533
5552
|
|
|
5534
5553
|
// src/pivot-controls.tsx
|
|
5535
|
-
import * as
|
|
5536
|
-
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";
|
|
5537
5556
|
|
|
5538
5557
|
// src/pivot-header-controls.tsx
|
|
5539
|
-
import * as
|
|
5558
|
+
import * as React11 from "react";
|
|
5540
5559
|
import { createPortal as createPortal5 } from "react-dom";
|
|
5541
|
-
import { Fragment as Fragment7, jsx as
|
|
5560
|
+
import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5542
5561
|
|
|
5543
5562
|
// src/pivot-editor.ts
|
|
5544
|
-
import * as
|
|
5563
|
+
import * as React12 from "react";
|
|
5545
5564
|
function address(row2, col) {
|
|
5546
5565
|
let letters = "";
|
|
5547
5566
|
for (let n = col + 1; n > 0; n = Math.floor((n - 1) / 26)) letters = String.fromCharCode(65 + (n - 1) % 26) + letters;
|
|
@@ -5560,18 +5579,18 @@ function copyPivot(pivot) {
|
|
|
5560
5579
|
function usePivotTableEditor(viewer, options2 = {}) {
|
|
5561
5580
|
const open = viewer.pivotFieldListVisible;
|
|
5562
5581
|
const setOpen = viewer.setPivotFieldListVisible;
|
|
5563
|
-
const [draft, setDraft] =
|
|
5564
|
-
const [dirty, setDirty] =
|
|
5565
|
-
const [error, setError] =
|
|
5566
|
-
const [status, setStatus] =
|
|
5567
|
-
const [details, setDetails] =
|
|
5568
|
-
const [detailContext, setDetailContext] =
|
|
5569
|
-
const [loadedSource, setLoadedSource] =
|
|
5570
|
-
const [savedDefinition, setSavedDefinition] =
|
|
5571
|
-
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);
|
|
5572
5591
|
const sourceNeedsLoad = Boolean(draft && JSON.stringify(draft.source) !== loadedSource);
|
|
5573
5592
|
const stale = Boolean(dirty && draft?.id && savedDefinition !== JSON.stringify(viewer.pivotTables.find((pivot) => pivot.id === draft.id) ?? null));
|
|
5574
|
-
const run =
|
|
5593
|
+
const run = React12.useCallback((action) => {
|
|
5575
5594
|
setError(null);
|
|
5576
5595
|
setStatus(null);
|
|
5577
5596
|
try {
|
|
@@ -5581,7 +5600,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5581
5600
|
setOpen(true);
|
|
5582
5601
|
}
|
|
5583
5602
|
}, []);
|
|
5584
|
-
|
|
5603
|
+
React12.useEffect(() => {
|
|
5585
5604
|
if (options2.enabled === false) return;
|
|
5586
5605
|
setDraft(null);
|
|
5587
5606
|
setDirty(false);
|
|
@@ -5594,7 +5613,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5594
5613
|
setPendingFocus(null);
|
|
5595
5614
|
if (options2.initialOpen !== void 0) setOpen(options2.initialOpen);
|
|
5596
5615
|
}, [viewer.src, viewer.file]);
|
|
5597
|
-
|
|
5616
|
+
React12.useEffect(() => {
|
|
5598
5617
|
if (options2.enabled === false || dirty || !draft?.id) return;
|
|
5599
5618
|
const current = viewer.pivotTables.find((pivot) => pivot.id === draft.id);
|
|
5600
5619
|
setDraft(current ? copyPivot(current) : null);
|
|
@@ -5603,7 +5622,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5603
5622
|
setSavedDefinition(JSON.stringify(current));
|
|
5604
5623
|
}
|
|
5605
5624
|
}, [viewer.pivotTables]);
|
|
5606
|
-
|
|
5625
|
+
React12.useEffect(() => {
|
|
5607
5626
|
if (options2.enabled === false || options2.autoSelect === false || dirty || pendingFocus || !viewer.activeCell || !viewer.activeSheet) return;
|
|
5608
5627
|
const current = viewer.getPivotTableAtCell(viewer.activeCell, viewer.activeSheet.name);
|
|
5609
5628
|
if (!current || current.id === draft?.id) return;
|
|
@@ -5614,7 +5633,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5614
5633
|
setStatus(null);
|
|
5615
5634
|
setDetails(null);
|
|
5616
5635
|
}, [viewer.activeCell?.row, viewer.activeCell?.col, viewer.activeSheet?.name, viewer.pivotTables, options2.autoSelect, options2.enabled]);
|
|
5617
|
-
|
|
5636
|
+
React12.useEffect(() => {
|
|
5618
5637
|
if (!pendingFocus || viewer.activeSheet?.name.toLowerCase() !== pendingFocus.sheet.toLowerCase()) return;
|
|
5619
5638
|
viewer.selectCell({ row: pendingFocus.row, col: pendingFocus.col });
|
|
5620
5639
|
setPendingFocus(null);
|
|
@@ -5819,8 +5838,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5819
5838
|
}
|
|
5820
5839
|
|
|
5821
5840
|
// src/pivot-field-list.tsx
|
|
5822
|
-
import * as
|
|
5823
|
-
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";
|
|
5824
5843
|
var AREAS = ["reportFilters", "columns", "rows", "values"];
|
|
5825
5844
|
var AREA_NAMES = { reportFilters: "Filters", columns: "Columns", rows: "Rows", values: "Values" };
|
|
5826
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"]];
|
|
@@ -5847,52 +5866,52 @@ function groupingUnit(axis) {
|
|
|
5847
5866
|
return axis?.grouping ? axis.grouping.kind === "date" ? axis.grouping.unit : axis.grouping.kind : null;
|
|
5848
5867
|
}
|
|
5849
5868
|
function Action({ children: children2, primary, style, ...props }) {
|
|
5850
|
-
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 });
|
|
5851
5870
|
}
|
|
5852
5871
|
function Text({ label, value, onChange, ...props }) {
|
|
5853
5872
|
return /* @__PURE__ */ jsxs7("label", { style: { ...stack, gap: 4 }, children: [
|
|
5854
|
-
/* @__PURE__ */
|
|
5855
|
-
/* @__PURE__ */
|
|
5873
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
5874
|
+
/* @__PURE__ */ jsx10("input", { ...props, style: { ...control, ...props.style }, value, onChange: (event) => onChange(event.target.value) })
|
|
5856
5875
|
] });
|
|
5857
5876
|
}
|
|
5858
5877
|
function Choice({ label, value, options: options2, onChange, placeholder, disabled }) {
|
|
5859
5878
|
return /* @__PURE__ */ jsxs7("label", { style: { ...stack, gap: 4 }, children: [
|
|
5860
|
-
/* @__PURE__ */
|
|
5879
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
5861
5880
|
/* @__PURE__ */ jsxs7("select", { disabled, style: control, value, onChange: (event) => onChange(event.target.value), children: [
|
|
5862
|
-
placeholder ? /* @__PURE__ */
|
|
5863
|
-
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))
|
|
5864
5883
|
] })
|
|
5865
5884
|
] });
|
|
5866
5885
|
}
|
|
5867
5886
|
function Check({ label, checked, onChange, disabled }) {
|
|
5868
5887
|
return /* @__PURE__ */ jsxs7("label", { style: { ...row, alignItems: "flex-start", cursor: disabled ? "default" : "pointer", paddingBlock: 2 }, children: [
|
|
5869
|
-
/* @__PURE__ */
|
|
5870
|
-
/* @__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 })
|
|
5871
5890
|
] });
|
|
5872
5891
|
}
|
|
5873
5892
|
function Section({ title, children: children2 }) {
|
|
5874
5893
|
return /* @__PURE__ */ jsxs7("details", { style: { borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5875
|
-
/* @__PURE__ */
|
|
5876
|
-
/* @__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 })
|
|
5877
5896
|
] });
|
|
5878
5897
|
}
|
|
5879
5898
|
function Members({ items, selected, onChange, label = "Items" }) {
|
|
5880
|
-
const [search, setSearch] =
|
|
5899
|
+
const [search, setSearch] = React13.useState("");
|
|
5881
5900
|
const visible = items.filter((item) => item.caption.toLocaleLowerCase().includes(search.toLocaleLowerCase()));
|
|
5882
5901
|
const keys = new Set(selected);
|
|
5883
5902
|
return /* @__PURE__ */ jsxs7("div", { style: { ...stack, gap: 6 }, children: [
|
|
5884
|
-
/* @__PURE__ */
|
|
5903
|
+
/* @__PURE__ */ jsx10(Text, { label: `Search ${label.toLowerCase()}`, type: "search", value: search, onChange: setSearch }),
|
|
5885
5904
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, flexWrap: "wrap" }, children: [
|
|
5886
|
-
/* @__PURE__ */
|
|
5887
|
-
/* @__PURE__ */
|
|
5905
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => onChange(items.map((item) => item.key)), children: "Select all" }),
|
|
5906
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => onChange([]), children: "Clear" }),
|
|
5888
5907
|
/* @__PURE__ */ jsxs7("span", { style: hint, children: [
|
|
5889
5908
|
keys.size,
|
|
5890
5909
|
" selected"
|
|
5891
5910
|
] })
|
|
5892
5911
|
] }),
|
|
5893
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: [
|
|
5894
|
-
visible.slice(0, 200).map((item) => /* @__PURE__ */
|
|
5895
|
-
!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,
|
|
5896
5915
|
visible.length > 200 ? /* @__PURE__ */ jsxs7("p", { style: hint, children: [
|
|
5897
5916
|
"Search to narrow ",
|
|
5898
5917
|
visible.length.toLocaleString(),
|
|
@@ -5909,16 +5928,16 @@ function ValueSettings({ pivot, value, onChange }) {
|
|
|
5909
5928
|
const base = baseAxes.find((axis) => groupingUnit(axis) === (value.baseGroupingUnit ?? null)) ?? baseAxes[0];
|
|
5910
5929
|
const source = pivot.fields.find((field) => field.index === value.baseField);
|
|
5911
5930
|
return /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5912
|
-
/* @__PURE__ */
|
|
5913
|
-
/* @__PURE__ */
|
|
5914
|
-
/* @__PURE__ */
|
|
5915
|
-
needsBase ? /* @__PURE__ */
|
|
5916
|
-
needsBase && baseAxes.length > 1 ? /* @__PURE__ */
|
|
5917
|
-
needsItem ? /* @__PURE__ */
|
|
5918
|
-
/* @__PURE__ */
|
|
5919
|
-
/* @__PURE__ */
|
|
5920
|
-
/* @__PURE__ */
|
|
5921
|
-
/* @__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 })
|
|
5922
5941
|
] });
|
|
5923
5942
|
}
|
|
5924
5943
|
function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
@@ -5927,38 +5946,38 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
|
5927
5946
|
const updateGrouping = (patch) => onChange({ ...axis, grouping: { ...grouping, ...patch }, items: [], collapsed: [] });
|
|
5928
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));
|
|
5929
5948
|
return /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5930
|
-
/* @__PURE__ */
|
|
5931
|
-
/* @__PURE__ */
|
|
5932
|
-
axis.sort.startsWith("value") ? /* @__PURE__ */
|
|
5933
|
-
/* @__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 }) }),
|
|
5934
5953
|
axis.subtotals ? /* @__PURE__ */ jsxs7("details", { children: [
|
|
5935
|
-
/* @__PURE__ */
|
|
5936
|
-
/* @__PURE__ */
|
|
5937
|
-
/* @__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." })
|
|
5938
5957
|
] }) : null,
|
|
5939
|
-
/* @__PURE__ */
|
|
5940
|
-
/* @__PURE__ */
|
|
5941
|
-
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,
|
|
5942
5961
|
grouping && grouping.kind !== "manual" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5943
|
-
/* @__PURE__ */
|
|
5962
|
+
/* @__PURE__ */ jsx10(Text, { label: "Interval", type: "number", min: 1e-6, step: "any", value: String(grouping.interval), onChange: (interval) => updateGrouping({ interval: Number(interval) }) }),
|
|
5944
5963
|
/* @__PURE__ */ jsxs7("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
5945
|
-
/* @__PURE__ */
|
|
5946
|
-
/* @__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) }) })
|
|
5947
5966
|
] }),
|
|
5948
|
-
grouping.kind === "date" ? /* @__PURE__ */
|
|
5967
|
+
grouping.kind === "date" ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Optional bounds use Excel date serial values." }) : null
|
|
5949
5968
|
] }) : null,
|
|
5950
|
-
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,
|
|
5951
5970
|
grouping?.kind === "manual" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5952
5971
|
grouping.groups.map((group, index) => /* @__PURE__ */ jsxs7("div", { style: { ...stack, borderTop: "1px solid var(--xlsx-pivot-border)", paddingTop: 8 }, children: [
|
|
5953
|
-
/* @__PURE__ */
|
|
5954
|
-
/* @__PURE__ */
|
|
5955
|
-
/* @__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" })
|
|
5956
5975
|
] }, index)),
|
|
5957
|
-
/* @__PURE__ */
|
|
5976
|
+
/* @__PURE__ */ jsx10(Action, { onClick: () => updateGrouping({ groups: [...grouping.groups, { name: `Group ${grouping.groups.length + 1}`, members: [] }] }), children: "Add named group" })
|
|
5958
5977
|
] }) : null,
|
|
5959
5978
|
/* @__PURE__ */ jsxs7("details", { children: [
|
|
5960
|
-
/* @__PURE__ */
|
|
5961
|
-
/* @__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 }) }) })
|
|
5962
5981
|
] })
|
|
5963
5982
|
] });
|
|
5964
5983
|
}
|
|
@@ -5975,70 +5994,70 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5975
5994
|
"Field filters",
|
|
5976
5995
|
unit ? ` \xB7 ${unit}` : ""
|
|
5977
5996
|
] }),
|
|
5978
|
-
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,
|
|
5979
5998
|
filters.map(({ filter, index }) => /* @__PURE__ */ jsxs7("div", { style: { ...stack, paddingBlock: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5980
5999
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
5981
|
-
/* @__PURE__ */
|
|
5982
|
-
/* @__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" })
|
|
5983
6002
|
] }),
|
|
5984
|
-
filter.kind === "members" ? /* @__PURE__ */
|
|
6003
|
+
filter.kind === "members" ? /* @__PURE__ */ jsx10(Members, { items: members, selected: filter.values, onChange: (values) => update(index, { ...filter, values }) }) : null,
|
|
5985
6004
|
filter.kind === "label" || filter.kind === "value" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5986
|
-
/* @__PURE__ */
|
|
5987
|
-
/* @__PURE__ */
|
|
5988
|
-
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
|
|
5989
6008
|
] }) : null,
|
|
5990
6009
|
filter.kind === "top10" ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
5991
|
-
/* @__PURE__ */
|
|
5992
|
-
/* @__PURE__ */
|
|
5993
|
-
/* @__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" }) })
|
|
5994
6013
|
] }) : null,
|
|
5995
|
-
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
|
|
5996
6015
|
] }, index)),
|
|
5997
|
-
/* @__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 }] })) })
|
|
5998
6017
|
] });
|
|
5999
6018
|
}
|
|
6000
6019
|
function Advanced({ editor, pivot }) {
|
|
6001
|
-
const [chartType, setChartType] =
|
|
6002
|
-
const [chartCell, setChartCell] =
|
|
6003
|
-
const [chartTitle, setChartTitle] =
|
|
6004
|
-
const [chartMeasure, setChartMeasure] =
|
|
6005
|
-
const [chartSheet, setChartSheet] =
|
|
6006
|
-
const [chartWidth, setChartWidth] =
|
|
6007
|
-
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");
|
|
6008
6027
|
const update = (patch) => editor.edit((current) => ({ ...current, ...patch }));
|
|
6009
6028
|
const sheets = editor.viewer.sheets.map((sheet) => [sheet.name, sheet.name]);
|
|
6010
6029
|
return /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
6011
6030
|
/* @__PURE__ */ jsxs7(Section, { title: "Source and location", children: [
|
|
6012
|
-
/* @__PURE__ */
|
|
6013
|
-
/* @__PURE__ */
|
|
6014
|
-
/* @__PURE__ */
|
|
6015
|
-
/* @__PURE__ */
|
|
6016
|
-
/* @__PURE__ */
|
|
6017
|
-
/* @__PURE__ */
|
|
6018
|
-
/* @__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 } }) })
|
|
6019
6038
|
] }),
|
|
6020
6039
|
/* @__PURE__ */ jsxs7(Section, { title: "Layout and format", children: [
|
|
6021
|
-
/* @__PURE__ */
|
|
6022
|
-
/* @__PURE__ */
|
|
6023
|
-
/* @__PURE__ */
|
|
6024
|
-
/* @__PURE__ */
|
|
6025
|
-
/* @__PURE__ */
|
|
6026
|
-
/* @__PURE__ */
|
|
6027
|
-
/* @__PURE__ */
|
|
6028
|
-
/* @__PURE__ */
|
|
6029
|
-
/* @__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 }) })
|
|
6030
6049
|
] }),
|
|
6031
6050
|
/* @__PURE__ */ jsxs7(Section, { title: "Calculated fields and items", children: [
|
|
6032
|
-
/* @__PURE__ */
|
|
6033
|
-
/* @__PURE__ */
|
|
6034
|
-
/* @__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 }),
|
|
6035
6054
|
pivot.calculatedItems.map((item, index) => /* @__PURE__ */ jsxs7("div", { style: { ...stack, paddingTop: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
6036
|
-
/* @__PURE__ */
|
|
6037
|
-
/* @__PURE__ */
|
|
6038
|
-
/* @__PURE__ */
|
|
6039
|
-
/* @__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" })
|
|
6040
6059
|
] }, index)),
|
|
6041
|
-
/* @__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" })
|
|
6042
6061
|
] }),
|
|
6043
6062
|
/* @__PURE__ */ jsxs7(Section, { title: "PivotChart", children: [
|
|
6044
6063
|
pivot.charts?.length ? /* @__PURE__ */ jsxs7("p", { style: hint, children: [
|
|
@@ -6047,39 +6066,39 @@ function Advanced({ editor, pivot }) {
|
|
|
6047
6066
|
pivot.charts.length === 1 ? "" : "s",
|
|
6048
6067
|
". Refreshing the PivotTable updates their values."
|
|
6049
6068
|
] }) : null,
|
|
6050
|
-
/* @__PURE__ */
|
|
6051
|
-
/* @__PURE__ */
|
|
6052
|
-
/* @__PURE__ */
|
|
6053
|
-
/* @__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 }),
|
|
6054
6073
|
/* @__PURE__ */ jsxs7("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
/* @__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 })
|
|
6057
6076
|
] }),
|
|
6058
|
-
/* @__PURE__ */
|
|
6059
|
-
chartType === "Pie" || chartType === "Doughnut" ? /* @__PURE__ */
|
|
6060
|
-
/* @__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(() => {
|
|
6061
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 });
|
|
6062
6081
|
}), children: "Insert PivotChart" }),
|
|
6063
|
-
editor.dirty ? /* @__PURE__ */
|
|
6082
|
+
editor.dirty ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Apply field changes before inserting a chart." }) : null
|
|
6064
6083
|
] })
|
|
6065
6084
|
] });
|
|
6066
6085
|
}
|
|
6067
6086
|
function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, style }) {
|
|
6068
|
-
const paneRef =
|
|
6069
|
-
const [placement, setPlacement] =
|
|
6070
|
-
const [search, setSearch] =
|
|
6071
|
-
const [selected, setSelected] =
|
|
6072
|
-
const [dragOver, setDragOver] =
|
|
6073
|
-
const [announcement, setAnnouncement] =
|
|
6074
|
-
const titleId =
|
|
6075
|
-
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();
|
|
6076
6095
|
const pivot = editor.draft;
|
|
6077
6096
|
const disabled = editor.readOnly || Boolean(pivot?.unsupportedFeatures.length) || editor.sourceNeedsLoad;
|
|
6078
|
-
|
|
6097
|
+
React13.useEffect(() => {
|
|
6079
6098
|
setSelected(null);
|
|
6080
6099
|
setSearch("");
|
|
6081
6100
|
}, [pivot?.id]);
|
|
6082
|
-
|
|
6101
|
+
React13.useEffect(() => {
|
|
6083
6102
|
const parent = paneRef.current?.parentElement;
|
|
6084
6103
|
if (!parent) return;
|
|
6085
6104
|
const viewer = parent.closest(".react-xlsx-viewer");
|
|
@@ -6138,34 +6157,34 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6138
6157
|
};
|
|
6139
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: [
|
|
6140
6159
|
/* @__PURE__ */ jsxs7("header", { style: { ...row, justifyContent: "space-between", padding: "10px 12px", borderBottom: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
6141
|
-
/* @__PURE__ */
|
|
6142
|
-
/* @__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" })
|
|
6143
6162
|
] }),
|
|
6144
6163
|
/* @__PURE__ */ jsxs7("div", { style: { overflowY: "auto", flex: 1, minHeight: 0 }, children: [
|
|
6145
6164
|
/* @__PURE__ */ jsxs7("div", { style: { ...stack, padding: 12 }, children: [
|
|
6146
6165
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, alignItems: "end" }, children: [
|
|
6147
|
-
/* @__PURE__ */
|
|
6148
|
-
/* @__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" })
|
|
6149
6168
|
] }),
|
|
6150
|
-
editor.error ? /* @__PURE__ */
|
|
6151
|
-
editor.status ? /* @__PURE__ */
|
|
6152
|
-
editor.stale ? /* @__PURE__ */
|
|
6153
|
-
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,
|
|
6154
6173
|
pivot?.unsupportedFeatures.length ? /* @__PURE__ */ jsxs7("p", { style: hint, children: [
|
|
6155
6174
|
"This PivotTable is preserved for Excel. Editing is unavailable for: ",
|
|
6156
6175
|
pivot.unsupportedFeatures.join(", "),
|
|
6157
6176
|
"."
|
|
6158
6177
|
] }) : null,
|
|
6159
|
-
editor.viewer.readOnly ? /* @__PURE__ */
|
|
6178
|
+
editor.viewer.readOnly ? /* @__PURE__ */ jsx10("p", { style: hint, children: "Enable workbook editing to change this PivotTable." }) : null
|
|
6160
6179
|
] }),
|
|
6161
6180
|
pivot ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
6162
6181
|
/* @__PURE__ */ jsxs7("fieldset", { disabled, style: { margin: 0, padding: "0 12px 12px", border: 0, minWidth: 0 }, children: [
|
|
6163
|
-
/* @__PURE__ */
|
|
6164
|
-
/* @__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 } }),
|
|
6165
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: [
|
|
6166
6185
|
pivot.fields.filter((field) => field.name.toLocaleLowerCase().includes(search.toLocaleLowerCase())).map((field) => {
|
|
6167
6186
|
const checked = AREAS.some((area) => pivot[area].some((_, index) => sourceFieldIndex(pivot, area, index) === field.index));
|
|
6168
|
-
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) => {
|
|
6169
6188
|
if (value) editor.addField(field.dataType === "number" ? "values" : "rows", field.index);
|
|
6170
6189
|
else {
|
|
6171
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);
|
|
@@ -6174,10 +6193,10 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6174
6193
|
setSelected(null);
|
|
6175
6194
|
} }) }, field.index);
|
|
6176
6195
|
}),
|
|
6177
|
-
!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
|
|
6178
6197
|
] }),
|
|
6179
|
-
/* @__PURE__ */
|
|
6180
|
-
/* @__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) => {
|
|
6181
6200
|
if (!disabled && event.dataTransfer.types.includes(DRAG_TYPE)) {
|
|
6182
6201
|
event.preventDefault();
|
|
6183
6202
|
setDragOver(area);
|
|
@@ -6194,91 +6213,91 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
6194
6213
|
const field = fieldIndex(pivot, area, index);
|
|
6195
6214
|
const name = area === "values" ? pivot.values[index].name : area === "reportFilters" ? fieldName(pivot, field) : pivot[area][index].name || fieldName(pivot, field);
|
|
6196
6215
|
const active = selected?.area === area && selected.index === index;
|
|
6197
|
-
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) => {
|
|
6198
6217
|
if (!event.altKey || !["ArrowUp", "ArrowDown"].includes(event.key)) return;
|
|
6199
6218
|
event.preventDefault();
|
|
6200
6219
|
const position = index + (event.key === "ArrowUp" ? -1 : 1);
|
|
6201
6220
|
if (position >= 0 && position < pivot[area].length) move({ area, index }, area, position);
|
|
6202
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: [
|
|
6203
|
-
/* @__PURE__ */
|
|
6204
|
-
/* @__PURE__ */
|
|
6222
|
+
/* @__PURE__ */ jsx10("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: name }),
|
|
6223
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u25BE" })
|
|
6205
6224
|
] }) }, `${field}-${index}`);
|
|
6206
6225
|
}),
|
|
6207
|
-
!pivot[area].length ? /* @__PURE__ */
|
|
6226
|
+
!pivot[area].length ? /* @__PURE__ */ jsx10("p", { style: { ...hint, padding: "5px 3px", fontSize: 10 }, children: "Drop fields here" }) : null
|
|
6208
6227
|
] })
|
|
6209
6228
|
] }, area)) }),
|
|
6210
|
-
/* @__PURE__ */
|
|
6229
|
+
/* @__PURE__ */ jsx10("p", { style: { ...hint, marginTop: 6 }, children: "Select a field for settings and keyboard move controls." }),
|
|
6211
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: [
|
|
6212
6231
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
6213
6232
|
/* @__PURE__ */ jsxs7("strong", { style: { overflowWrap: "anywhere" }, children: [
|
|
6214
6233
|
selected.area === "values" ? pivot.values[selected.index].name : fieldName(pivot, selectedField),
|
|
6215
6234
|
" settings"
|
|
6216
6235
|
] }),
|
|
6217
|
-
/* @__PURE__ */
|
|
6236
|
+
/* @__PURE__ */ jsx10(Action, { "aria-label": "Close field settings", onClick: () => setSelected(null), children: "\xD7" })
|
|
6218
6237
|
] }),
|
|
6219
|
-
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) }),
|
|
6220
6239
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, flexWrap: "wrap" }, children: [
|
|
6221
|
-
/* @__PURE__ */
|
|
6222
|
-
/* @__PURE__ */
|
|
6223
|
-
/* @__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: () => {
|
|
6224
6243
|
editor.removeField(selected.area, selected.index);
|
|
6225
6244
|
setSelected(null);
|
|
6226
6245
|
}, children: "Remove field" })
|
|
6227
6246
|
] }),
|
|
6228
|
-
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) => {
|
|
6229
6248
|
const area = selected.area;
|
|
6230
6249
|
const axis = current[area][selected.index];
|
|
6231
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)] };
|
|
6232
6251
|
}) }) : null,
|
|
6233
|
-
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
|
|
6234
6253
|
] }) : null
|
|
6235
6254
|
] }),
|
|
6236
|
-
/* @__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 }) }),
|
|
6237
6256
|
/* @__PURE__ */ jsxs7(Section, { title: "Refresh and details", children: [
|
|
6238
6257
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, flexWrap: "wrap" }, children: [
|
|
6239
|
-
/* @__PURE__ */
|
|
6240
|
-
/* @__PURE__ */
|
|
6241
|
-
/* @__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" })
|
|
6242
6261
|
] }),
|
|
6243
|
-
/* @__PURE__ */
|
|
6262
|
+
/* @__PURE__ */ jsx10("p", { style: hint, children: "Select a value cell in the report to inspect its source records." }),
|
|
6244
6263
|
editor.details ? /* @__PURE__ */ jsxs7(Fragment8, { children: [
|
|
6245
6264
|
/* @__PURE__ */ jsxs7("div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
6246
6265
|
/* @__PURE__ */ jsxs7("span", { children: [
|
|
6247
6266
|
editor.details.rows.length.toLocaleString(),
|
|
6248
6267
|
" records"
|
|
6249
6268
|
] }),
|
|
6250
|
-
/* @__PURE__ */
|
|
6269
|
+
/* @__PURE__ */ jsx10(Action, { onClick: editor.clearDetails, children: "Close details" })
|
|
6251
6270
|
] }),
|
|
6252
|
-
/* @__PURE__ */
|
|
6253
|
-
/* @__PURE__ */
|
|
6254
|
-
/* @__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)) })
|
|
6255
6274
|
] }) }),
|
|
6256
|
-
editor.details.rows.length > 100 ? /* @__PURE__ */
|
|
6257
|
-
/* @__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(() => {
|
|
6258
6277
|
const context = editor.detailContext;
|
|
6259
6278
|
if (context) editor.viewer.showPivotDetails(context.id, context.row, context.col);
|
|
6260
6279
|
}), children: "Create detail worksheet" })
|
|
6261
6280
|
] }) : null,
|
|
6262
|
-
/* @__PURE__ */
|
|
6281
|
+
/* @__PURE__ */ jsx10(Action, { disabled: editor.readOnly || editor.dirty || !pivot.id, onClick: editor.remove, children: "Remove PivotTable" })
|
|
6263
6282
|
] })
|
|
6264
6283
|
] }) : /* @__PURE__ */ jsxs7("div", { style: { ...stack, padding: "4px 12px 20px" }, children: [
|
|
6265
|
-
/* @__PURE__ */
|
|
6266
|
-
/* @__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" })
|
|
6267
6286
|
] })
|
|
6268
6287
|
] }),
|
|
6269
|
-
pivot ? /* @__PURE__ */
|
|
6270
|
-
/* @__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" }),
|
|
6271
6290
|
/* @__PURE__ */ jsxs7("div", { style: row, children: [
|
|
6272
|
-
/* @__PURE__ */
|
|
6273
|
-
/* @__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" })
|
|
6274
6293
|
] })
|
|
6275
6294
|
] }) }) : null,
|
|
6276
|
-
/* @__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 })
|
|
6277
6296
|
] });
|
|
6278
6297
|
}
|
|
6279
6298
|
|
|
6280
6299
|
// src/lazy-chart.tsx
|
|
6281
|
-
import * as
|
|
6300
|
+
import * as React15 from "react";
|
|
6282
6301
|
|
|
6283
6302
|
// src/chart-loader.ts
|
|
6284
6303
|
function createChartModule(importModule) {
|
|
@@ -6309,15 +6328,15 @@ function createChartModule(importModule) {
|
|
|
6309
6328
|
};
|
|
6310
6329
|
}
|
|
6311
6330
|
var officeChartRenderer = createChartModule(async () => {
|
|
6312
|
-
const { SharedChartSvg } = await import("./shared-chart-
|
|
6331
|
+
const { SharedChartSvg } = await import("./shared-chart-PMIN7YMP.js");
|
|
6313
6332
|
return { renderer: null, SharedChartSvg };
|
|
6314
6333
|
});
|
|
6315
6334
|
|
|
6316
6335
|
// src/use-chart-module.ts
|
|
6317
|
-
import * as
|
|
6336
|
+
import * as React14 from "react";
|
|
6318
6337
|
|
|
6319
6338
|
// src/lazy-chart.tsx
|
|
6320
|
-
import { Fragment as Fragment9, jsx as
|
|
6339
|
+
import { Fragment as Fragment9, jsx as jsx11 } from "react/jsx-runtime";
|
|
6321
6340
|
|
|
6322
6341
|
// src/picture-paint.ts
|
|
6323
6342
|
function resolvePicturePaintRect(image, rect) {
|
|
@@ -6334,7 +6353,7 @@ function resolvePicturePaintRect(image, rect) {
|
|
|
6334
6353
|
}
|
|
6335
6354
|
|
|
6336
6355
|
// src/XlsxViewer.tsx
|
|
6337
|
-
import { Fragment as Fragment11, jsx as
|
|
6356
|
+
import { Fragment as Fragment11, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6338
6357
|
var DEFAULT_ROW_HEIGHT2 = 24;
|
|
6339
6358
|
var DEFAULT_COL_WIDTH2 = 80;
|
|
6340
6359
|
var MAX_AUTOFIT_ROW_HEIGHT_PX = 409 * (4 / 3);
|
|
@@ -7008,10 +7027,10 @@ function lightenColor(color, ratio) {
|
|
|
7008
7027
|
function darkenColor(color, ratio) {
|
|
7009
7028
|
return mixRgbColor(color, "#000000", ratio);
|
|
7010
7029
|
}
|
|
7011
|
-
var ViewerContext =
|
|
7012
|
-
var ViewerAppearanceContext =
|
|
7030
|
+
var ViewerContext = React16.createContext(null);
|
|
7031
|
+
var ViewerAppearanceContext = React16.createContext({ isDark: false });
|
|
7013
7032
|
function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
|
|
7014
|
-
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: {
|
|
7015
7034
|
position: "absolute",
|
|
7016
7035
|
[vertical]: -4,
|
|
7017
7036
|
[horizontal]: -4,
|
|
@@ -7975,7 +7994,7 @@ function applyCanvasShapeDash(context, dash, lineWidth) {
|
|
|
7975
7994
|
}
|
|
7976
7995
|
}
|
|
7977
7996
|
function useViewerPalette(isDark = false, headerBackgroundColor, headerTextColor) {
|
|
7978
|
-
return
|
|
7997
|
+
return React16.useMemo(
|
|
7979
7998
|
() => resolveViewerPalette(isDark, headerBackgroundColor, headerTextColor),
|
|
7980
7999
|
[headerBackgroundColor, headerTextColor, isDark]
|
|
7981
8000
|
);
|
|
@@ -8662,10 +8681,10 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8662
8681
|
const gap = normalizedValues.length > 1 ? (innerWidth2 - segmentWidth * normalizedValues.length) / (normalizedValues.length - 1) : 0;
|
|
8663
8682
|
const positiveY = 4.5;
|
|
8664
8683
|
const negativeY = height - 4.5;
|
|
8665
|
-
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) => {
|
|
8666
8685
|
const left = 1 + index * (segmentWidth + Math.max(0, gap));
|
|
8667
8686
|
const y = entry.value >= 0 ? positiveY : negativeY;
|
|
8668
|
-
return /* @__PURE__ */
|
|
8687
|
+
return /* @__PURE__ */ jsx12(
|
|
8669
8688
|
"line",
|
|
8670
8689
|
{
|
|
8671
8690
|
stroke: seriesColor,
|
|
@@ -8688,14 +8707,14 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8688
8707
|
const barWidth = Math.max(2, innerWidth2 / Math.max(normalizedValues.length * 1.8, 1));
|
|
8689
8708
|
const gap = normalizedValues.length > 1 ? (innerWidth2 - barWidth * normalizedValues.length) / (normalizedValues.length - 1) : 0;
|
|
8690
8709
|
return /* @__PURE__ */ jsxs8("svg", { "aria-hidden": "true", height, style: { display: "block", overflow: "visible", width: "100%" }, viewBox: `0 0 ${width} ${height}`, width: "100%", children: [
|
|
8691
|
-
/* @__PURE__ */
|
|
8710
|
+
/* @__PURE__ */ jsx12("line", { stroke: palette.border, strokeWidth: 1, x1: 1, x2: width - 1, y1: zeroY, y2: zeroY }),
|
|
8692
8711
|
normalizedValues.map((entry, index) => {
|
|
8693
8712
|
const left = 1 + index * (barWidth + Math.max(0, gap));
|
|
8694
8713
|
const y = 2 + innerHeight2 - clampSparklineValue(entry.value, minValue2, maxValue2) * innerHeight2;
|
|
8695
8714
|
const top = Math.min(y, zeroY);
|
|
8696
8715
|
const barHeight = Math.max(1, Math.abs(y - zeroY));
|
|
8697
8716
|
const fill = entry.value < 0 ? negativeColor : seriesColor;
|
|
8698
|
-
return /* @__PURE__ */
|
|
8717
|
+
return /* @__PURE__ */ jsx12(
|
|
8699
8718
|
"rect",
|
|
8700
8719
|
{
|
|
8701
8720
|
fill,
|
|
@@ -8722,7 +8741,7 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8722
8741
|
const highValue = Math.max(...points.map((entry) => entry.value));
|
|
8723
8742
|
const lowValue = Math.min(...points.map((entry) => entry.value));
|
|
8724
8743
|
return /* @__PURE__ */ jsxs8("svg", { "aria-hidden": "true", height, style: { display: "block", overflow: "visible", width: "100%" }, viewBox: `0 0 ${width} ${height}`, width: "100%", children: [
|
|
8725
|
-
/* @__PURE__ */
|
|
8744
|
+
/* @__PURE__ */ jsx12("path", { d: path, fill: "none", stroke: seriesColor, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.6 }),
|
|
8726
8745
|
sparkline.markers ? points.map((entry, index) => {
|
|
8727
8746
|
const x = 1 + index * xStep;
|
|
8728
8747
|
const y = 2 + innerHeight2 - clampSparklineValue(entry.value, minValue, maxValue) * innerHeight2;
|
|
@@ -8738,7 +8757,7 @@ function renderSparkline(sparkline, values, palette) {
|
|
|
8738
8757
|
} else if (entry.value < 0 && sparkline.negative && sparkline.negativeColor) {
|
|
8739
8758
|
fill = sparkline.negativeColor;
|
|
8740
8759
|
}
|
|
8741
|
-
return /* @__PURE__ */
|
|
8760
|
+
return /* @__PURE__ */ jsx12("circle", { cx: x, cy: y, fill, r: 1.75 }, `spark-point-${index}`);
|
|
8742
8761
|
}) : null
|
|
8743
8762
|
] });
|
|
8744
8763
|
}
|
|
@@ -8862,7 +8881,7 @@ function SegmentedControl({
|
|
|
8862
8881
|
palette,
|
|
8863
8882
|
value
|
|
8864
8883
|
}) {
|
|
8865
|
-
return /* @__PURE__ */
|
|
8884
|
+
return /* @__PURE__ */ jsx12(
|
|
8866
8885
|
"div",
|
|
8867
8886
|
{
|
|
8868
8887
|
"aria-label": messages.workbookSheets,
|
|
@@ -8880,7 +8899,7 @@ function SegmentedControl({
|
|
|
8880
8899
|
children: items.map((item) => {
|
|
8881
8900
|
const selected = item.id === value;
|
|
8882
8901
|
const isHidden = item.visibility === "hidden" || item.visibility === "veryHidden";
|
|
8883
|
-
return /* @__PURE__ */
|
|
8902
|
+
return /* @__PURE__ */ jsx12(
|
|
8884
8903
|
"button",
|
|
8885
8904
|
{
|
|
8886
8905
|
"aria-selected": selected,
|
|
@@ -8944,7 +8963,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8944
8963
|
padding: "0 16px"
|
|
8945
8964
|
},
|
|
8946
8965
|
children: [
|
|
8947
|
-
/* @__PURE__ */
|
|
8966
|
+
/* @__PURE__ */ jsx12("div", { style: { minWidth: 0 }, children: /* @__PURE__ */ jsx12(
|
|
8948
8967
|
"div",
|
|
8949
8968
|
{
|
|
8950
8969
|
style: {
|
|
@@ -8959,7 +8978,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8959
8978
|
}
|
|
8960
8979
|
) }),
|
|
8961
8980
|
/* @__PURE__ */ jsxs8("div", { style: { alignItems: "center", display: "flex", gap: 8 }, children: [
|
|
8962
|
-
pivotTableEditor && (!controller.readOnly || controller.pivotTables.length > 0) ? /* @__PURE__ */
|
|
8981
|
+
pivotTableEditor && (!controller.readOnly || controller.pivotTables.length > 0) ? /* @__PURE__ */ jsx12(
|
|
8963
8982
|
"button",
|
|
8964
8983
|
{
|
|
8965
8984
|
"aria-label": messages.pivotTableFields,
|
|
@@ -8987,7 +9006,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8987
9006
|
overflow: "hidden"
|
|
8988
9007
|
},
|
|
8989
9008
|
children: [
|
|
8990
|
-
/* @__PURE__ */
|
|
9009
|
+
/* @__PURE__ */ jsx12(
|
|
8991
9010
|
"button",
|
|
8992
9011
|
{
|
|
8993
9012
|
"aria-label": messages.zoomOut,
|
|
@@ -9006,7 +9025,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
9006
9025
|
children: "-"
|
|
9007
9026
|
}
|
|
9008
9027
|
),
|
|
9009
|
-
/* @__PURE__ */
|
|
9028
|
+
/* @__PURE__ */ jsx12(
|
|
9010
9029
|
"button",
|
|
9011
9030
|
{
|
|
9012
9031
|
"aria-label": messages.resetZoom,
|
|
@@ -9027,7 +9046,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
9027
9046
|
children: formatZoomScale(zoomScale, locale)
|
|
9028
9047
|
}
|
|
9029
9048
|
),
|
|
9030
|
-
/* @__PURE__ */
|
|
9049
|
+
/* @__PURE__ */ jsx12(
|
|
9031
9050
|
"button",
|
|
9032
9051
|
{
|
|
9033
9052
|
"aria-label": messages.zoomIn,
|
|
@@ -9049,7 +9068,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
9049
9068
|
]
|
|
9050
9069
|
}
|
|
9051
9070
|
),
|
|
9052
|
-
canDownload ? /* @__PURE__ */
|
|
9071
|
+
canDownload ? /* @__PURE__ */ jsx12(
|
|
9053
9072
|
"button",
|
|
9054
9073
|
{
|
|
9055
9074
|
"aria-label": messages.downloadWorkbook,
|
|
@@ -9078,7 +9097,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
9078
9097
|
]
|
|
9079
9098
|
}
|
|
9080
9099
|
),
|
|
9081
|
-
tabs.length > 1 ? /* @__PURE__ */
|
|
9100
|
+
tabs.length > 1 ? /* @__PURE__ */ jsx12(
|
|
9082
9101
|
"div",
|
|
9083
9102
|
{
|
|
9084
9103
|
style: {
|
|
@@ -9087,7 +9106,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
9087
9106
|
overflowX: "auto",
|
|
9088
9107
|
padding: "8px 12px"
|
|
9089
9108
|
},
|
|
9090
|
-
children: /* @__PURE__ */
|
|
9109
|
+
children: /* @__PURE__ */ jsx12(
|
|
9091
9110
|
SegmentedControl,
|
|
9092
9111
|
{
|
|
9093
9112
|
messages,
|
|
@@ -9139,7 +9158,7 @@ function resolveRichCellRuns(raw, value, base, theme, zoom) {
|
|
|
9139
9158
|
}
|
|
9140
9159
|
function renderRichCellText(cell) {
|
|
9141
9160
|
const scale = cell.shrinkToFitFontSizePx === void 0 ? 1 : cell.shrinkToFitFontSizePx / resolveCanvasFontSizePx(cell.style, 14);
|
|
9142
|
-
return cell.richText ? cell.richText.map((run, index) => /* @__PURE__ */
|
|
9161
|
+
return cell.richText ? cell.richText.map((run, index) => /* @__PURE__ */ jsx12("span", { style: {
|
|
9143
9162
|
fontFamily: run.style.fontFamily,
|
|
9144
9163
|
fontSize: resolveCanvasFontSizePx(run.style, 14) * scale,
|
|
9145
9164
|
fontWeight: run.style.fontWeight,
|
|
@@ -9540,7 +9559,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9540
9559
|
if (icon.shape === "arrow") {
|
|
9541
9560
|
const fill = icon.color ?? "#111827";
|
|
9542
9561
|
const stroke = icon.borderColor ?? darkenColor(fill, 0.32);
|
|
9543
|
-
return /* @__PURE__ */
|
|
9562
|
+
return /* @__PURE__ */ jsx12(
|
|
9544
9563
|
"svg",
|
|
9545
9564
|
{
|
|
9546
9565
|
"aria-hidden": "true",
|
|
@@ -9548,7 +9567,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9548
9567
|
style: { display: "block" },
|
|
9549
9568
|
viewBox: "0 0 16 16",
|
|
9550
9569
|
width: iconSize,
|
|
9551
|
-
children: /* @__PURE__ */
|
|
9570
|
+
children: /* @__PURE__ */ jsx12("g", { transform: `rotate(${icon.rotationDeg ?? 0} 8 8)`, children: /* @__PURE__ */ jsx12(
|
|
9552
9571
|
"path",
|
|
9553
9572
|
{
|
|
9554
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",
|
|
@@ -9562,7 +9581,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9562
9581
|
);
|
|
9563
9582
|
}
|
|
9564
9583
|
if (icon.glyph) {
|
|
9565
|
-
return /* @__PURE__ */
|
|
9584
|
+
return /* @__PURE__ */ jsx12(
|
|
9566
9585
|
"span",
|
|
9567
9586
|
{
|
|
9568
9587
|
style: {
|
|
@@ -9580,7 +9599,7 @@ function renderConditionalIcon(icon, scale = 1) {
|
|
|
9580
9599
|
}
|
|
9581
9600
|
);
|
|
9582
9601
|
}
|
|
9583
|
-
return /* @__PURE__ */
|
|
9602
|
+
return /* @__PURE__ */ jsx12(
|
|
9584
9603
|
"span",
|
|
9585
9604
|
{
|
|
9586
9605
|
style: {
|
|
@@ -9605,8 +9624,8 @@ function renderCheckboxControl(checked, palette, scale = 1, mixed = false) {
|
|
|
9605
9624
|
const fill = checked || mixed ? paletteIsDark(palette) ? "#60a5fa" : "#2563eb" : "transparent";
|
|
9606
9625
|
const check = paletteIsDark(palette) ? "#020617" : "#ffffff";
|
|
9607
9626
|
return /* @__PURE__ */ jsxs8("svg", { "aria-hidden": "true", height: 14 * scale, style: { display: "block" }, viewBox: "0 0 16 16", width: 14 * scale, children: [
|
|
9608
|
-
/* @__PURE__ */
|
|
9609
|
-
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(
|
|
9610
9629
|
"path",
|
|
9611
9630
|
{
|
|
9612
9631
|
d: "M5 8.1 7.1 10.2 11.3 5.8",
|
|
@@ -10078,7 +10097,7 @@ function GridRow({
|
|
|
10078
10097
|
zIndex: stickyTop !== void 0 ? frozenRowHeaderZIndex : rowHeaderZIndex
|
|
10079
10098
|
},
|
|
10080
10099
|
children: [
|
|
10081
|
-
/* @__PURE__ */
|
|
10100
|
+
/* @__PURE__ */ jsx12("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsx12(
|
|
10082
10101
|
"span",
|
|
10083
10102
|
{
|
|
10084
10103
|
style: {
|
|
@@ -10089,7 +10108,7 @@ function GridRow({
|
|
|
10089
10108
|
children: actualRow + 1
|
|
10090
10109
|
}
|
|
10091
10110
|
) }),
|
|
10092
|
-
/* @__PURE__ */
|
|
10111
|
+
/* @__PURE__ */ jsx12(
|
|
10093
10112
|
"div",
|
|
10094
10113
|
{
|
|
10095
10114
|
onDoubleClick: (event) => {
|
|
@@ -10111,7 +10130,7 @@ function GridRow({
|
|
|
10111
10130
|
]
|
|
10112
10131
|
}
|
|
10113
10132
|
),
|
|
10114
|
-
leadingSpacerWidth > 0 ? /* @__PURE__ */
|
|
10133
|
+
leadingSpacerWidth > 0 ? /* @__PURE__ */ jsx12(
|
|
10115
10134
|
"td",
|
|
10116
10135
|
{
|
|
10117
10136
|
"aria-hidden": "true",
|
|
@@ -10275,7 +10294,7 @@ function GridRow({
|
|
|
10275
10294
|
style: cellStyle,
|
|
10276
10295
|
title,
|
|
10277
10296
|
children: [
|
|
10278
|
-
cellData.chartHighlight ? /* @__PURE__ */
|
|
10297
|
+
cellData.chartHighlight ? /* @__PURE__ */ jsx12(
|
|
10279
10298
|
"div",
|
|
10280
10299
|
{
|
|
10281
10300
|
"aria-hidden": "true",
|
|
@@ -10290,7 +10309,7 @@ function GridRow({
|
|
|
10290
10309
|
pointerEvents: "none",
|
|
10291
10310
|
position: "absolute"
|
|
10292
10311
|
},
|
|
10293
|
-
children: /* @__PURE__ */
|
|
10312
|
+
children: /* @__PURE__ */ jsx12(
|
|
10294
10313
|
ReferenceRangeHandles,
|
|
10295
10314
|
{
|
|
10296
10315
|
color: cellData.chartHighlight.strokeColor,
|
|
@@ -10302,7 +10321,7 @@ function GridRow({
|
|
|
10302
10321
|
)
|
|
10303
10322
|
}
|
|
10304
10323
|
) : null,
|
|
10305
|
-
cellData.conditionalDataBar ? /* @__PURE__ */
|
|
10324
|
+
cellData.conditionalDataBar ? /* @__PURE__ */ jsx12(
|
|
10306
10325
|
"div",
|
|
10307
10326
|
{
|
|
10308
10327
|
"aria-hidden": "true",
|
|
@@ -10314,7 +10333,7 @@ function GridRow({
|
|
|
10314
10333
|
position: "absolute",
|
|
10315
10334
|
zIndex: 0
|
|
10316
10335
|
},
|
|
10317
|
-
children: /* @__PURE__ */
|
|
10336
|
+
children: /* @__PURE__ */ jsx12(
|
|
10318
10337
|
"div",
|
|
10319
10338
|
{
|
|
10320
10339
|
style: {
|
|
@@ -10330,7 +10349,7 @@ function GridRow({
|
|
|
10330
10349
|
}
|
|
10331
10350
|
) : null,
|
|
10332
10351
|
adornment,
|
|
10333
|
-
cellData.conditionalIcon ? /* @__PURE__ */
|
|
10352
|
+
cellData.conditionalIcon ? /* @__PURE__ */ jsx12(
|
|
10334
10353
|
"div",
|
|
10335
10354
|
{
|
|
10336
10355
|
"aria-hidden": "true",
|
|
@@ -10348,7 +10367,7 @@ function GridRow({
|
|
|
10348
10367
|
children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
|
|
10349
10368
|
}
|
|
10350
10369
|
) : null,
|
|
10351
|
-
isSpilling && !isEditing ? /* @__PURE__ */
|
|
10370
|
+
isSpilling && !isEditing ? /* @__PURE__ */ jsx12("div", { "aria-hidden": "true", style: {
|
|
10352
10371
|
backgroundColor: cellStyle.backgroundColor ?? palette.surface,
|
|
10353
10372
|
position: "absolute",
|
|
10354
10373
|
left: cellData.spillSide === "left" ? cellData.spillOffsetX : "calc(100% - 1px)",
|
|
@@ -10357,7 +10376,7 @@ function GridRow({
|
|
|
10357
10376
|
height: "calc(100% - 1px)",
|
|
10358
10377
|
pointerEvents: "none"
|
|
10359
10378
|
} }) : null,
|
|
10360
|
-
isEditing ? /* @__PURE__ */
|
|
10379
|
+
isEditing ? /* @__PURE__ */ jsx12(
|
|
10361
10380
|
CellEditor,
|
|
10362
10381
|
{
|
|
10363
10382
|
editorRef,
|
|
@@ -10382,7 +10401,7 @@ function GridRow({
|
|
|
10382
10401
|
...cellEditorStyle
|
|
10383
10402
|
}
|
|
10384
10403
|
}
|
|
10385
|
-
) : isSpilling ? /* @__PURE__ */
|
|
10404
|
+
) : isSpilling ? /* @__PURE__ */ jsx12(
|
|
10386
10405
|
"div",
|
|
10387
10406
|
{
|
|
10388
10407
|
style: {
|
|
@@ -10396,7 +10415,7 @@ function GridRow({
|
|
|
10396
10415
|
},
|
|
10397
10416
|
children: renderRichCellText(cellData)
|
|
10398
10417
|
}
|
|
10399
|
-
) : cellData.sparkline ? /* @__PURE__ */
|
|
10418
|
+
) : cellData.sparkline ? /* @__PURE__ */ jsx12(
|
|
10400
10419
|
"div",
|
|
10401
10420
|
{
|
|
10402
10421
|
style: {
|
|
@@ -10409,7 +10428,7 @@ function GridRow({
|
|
|
10409
10428
|
},
|
|
10410
10429
|
children: renderSparkline(cellData.sparkline.config, cellData.sparkline.values, palette)
|
|
10411
10430
|
}
|
|
10412
|
-
) : cellData.checkboxState != null ? /* @__PURE__ */
|
|
10431
|
+
) : cellData.checkboxState != null ? /* @__PURE__ */ jsx12(
|
|
10413
10432
|
"div",
|
|
10414
10433
|
{
|
|
10415
10434
|
style: {
|
|
@@ -10422,13 +10441,13 @@ function GridRow({
|
|
|
10422
10441
|
},
|
|
10423
10442
|
children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
|
|
10424
10443
|
}
|
|
10425
|
-
) : /* @__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) })
|
|
10426
10445
|
]
|
|
10427
10446
|
},
|
|
10428
10447
|
key
|
|
10429
10448
|
);
|
|
10430
10449
|
}),
|
|
10431
|
-
trailingSpacerWidth > 0 ? /* @__PURE__ */
|
|
10450
|
+
trailingSpacerWidth > 0 ? /* @__PURE__ */ jsx12(
|
|
10432
10451
|
"td",
|
|
10433
10452
|
{
|
|
10434
10453
|
"aria-hidden": "true",
|
|
@@ -10442,7 +10461,7 @@ function GridRow({
|
|
|
10442
10461
|
) : null
|
|
10443
10462
|
] });
|
|
10444
10463
|
}
|
|
10445
|
-
var MemoGridRow =
|
|
10464
|
+
var MemoGridRow = React16.memo(GridRow, (prev, next) => {
|
|
10446
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) {
|
|
10447
10466
|
return false;
|
|
10448
10467
|
}
|
|
@@ -10462,16 +10481,16 @@ function XlsxViewerProviderWithInlineController({
|
|
|
10462
10481
|
...options2
|
|
10463
10482
|
}) {
|
|
10464
10483
|
const controller = useXlsxViewerController(options2);
|
|
10465
|
-
return /* @__PURE__ */
|
|
10484
|
+
return /* @__PURE__ */ jsx12(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ jsx12(ViewerContext.Provider, { value: controller, children: children2 }) });
|
|
10466
10485
|
}
|
|
10467
10486
|
function XlsxViewerProvider({ children: children2, controller, isDark = false, ...options2 }) {
|
|
10468
10487
|
if (controller) {
|
|
10469
|
-
return /* @__PURE__ */
|
|
10488
|
+
return /* @__PURE__ */ jsx12(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ jsx12(ViewerContext.Provider, { value: controller, children: children2 }) });
|
|
10470
10489
|
}
|
|
10471
|
-
return /* @__PURE__ */
|
|
10490
|
+
return /* @__PURE__ */ jsx12(XlsxViewerProviderWithInlineController, { ...options2, isDark, children: children2 });
|
|
10472
10491
|
}
|
|
10473
10492
|
function useXlsxViewer() {
|
|
10474
|
-
const context =
|
|
10493
|
+
const context = React16.useContext(ViewerContext);
|
|
10475
10494
|
if (!context) {
|
|
10476
10495
|
throw new Error("useXlsxViewer must be used inside XlsxViewer or XlsxViewerProvider.");
|
|
10477
10496
|
}
|
|
@@ -10489,7 +10508,7 @@ function useXlsxViewerSelection() {
|
|
|
10489
10508
|
selectionRanges,
|
|
10490
10509
|
selection
|
|
10491
10510
|
} = useXlsxViewer();
|
|
10492
|
-
return
|
|
10511
|
+
return React16.useMemo(
|
|
10493
10512
|
() => ({
|
|
10494
10513
|
activeCell,
|
|
10495
10514
|
activeCellAddress,
|
|
@@ -10506,7 +10525,7 @@ function useXlsxViewerSelection() {
|
|
|
10506
10525
|
}
|
|
10507
10526
|
function useXlsxViewerLayout() {
|
|
10508
10527
|
const { canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
|
|
10509
|
-
return
|
|
10528
|
+
return React16.useMemo(
|
|
10510
10529
|
() => ({ canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
|
|
10511
10530
|
[canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
|
|
10512
10531
|
);
|
|
@@ -10524,7 +10543,7 @@ function useXlsxViewerZoom() {
|
|
|
10524
10543
|
zoomOut,
|
|
10525
10544
|
zoomScale
|
|
10526
10545
|
} = useXlsxViewer();
|
|
10527
|
-
return
|
|
10546
|
+
return React16.useMemo(
|
|
10528
10547
|
() => ({
|
|
10529
10548
|
canZoomIn,
|
|
10530
10549
|
canZoomOut,
|
|
@@ -10593,7 +10612,7 @@ function useXlsxViewerEditing() {
|
|
|
10593
10612
|
unmergeSelection,
|
|
10594
10613
|
updateFormControl
|
|
10595
10614
|
} = useXlsxViewer();
|
|
10596
|
-
return
|
|
10615
|
+
return React16.useMemo(
|
|
10597
10616
|
() => ({
|
|
10598
10617
|
addFormControl,
|
|
10599
10618
|
addSheet,
|
|
@@ -10680,7 +10699,7 @@ function useXlsxViewerEditing() {
|
|
|
10680
10699
|
}
|
|
10681
10700
|
function useXlsxViewerTables() {
|
|
10682
10701
|
const { sortState, sortTable, tables } = useXlsxViewer();
|
|
10683
|
-
return
|
|
10702
|
+
return React16.useMemo(
|
|
10684
10703
|
() => ({
|
|
10685
10704
|
sortState,
|
|
10686
10705
|
sortTable,
|
|
@@ -10691,7 +10710,7 @@ function useXlsxViewerTables() {
|
|
|
10691
10710
|
}
|
|
10692
10711
|
function useXlsxViewerPivots() {
|
|
10693
10712
|
const { pivotTables, pivotFieldListVisible, setPivotFieldListVisible, getPivotSourceFields, getPivotTableAtCell, upsertPivotTable, refreshPivotTable, refreshAllPivotTables, removePivotTable, pivotDrillDown, showPivotDetails, createPivotChart, togglePivotGroup } = useXlsxViewer();
|
|
10694
|
-
return
|
|
10713
|
+
return React16.useMemo(() => ({
|
|
10695
10714
|
pivotTables,
|
|
10696
10715
|
pivotFieldListVisible,
|
|
10697
10716
|
setPivotFieldListVisible,
|
|
@@ -10745,7 +10764,7 @@ function useXlsxViewerImages() {
|
|
|
10745
10764
|
setImageRect,
|
|
10746
10765
|
updateChart
|
|
10747
10766
|
} = useXlsxViewer();
|
|
10748
|
-
return
|
|
10767
|
+
return React16.useMemo(
|
|
10749
10768
|
() => ({
|
|
10750
10769
|
arrangeDrawing,
|
|
10751
10770
|
changeChartType,
|
|
@@ -10847,7 +10866,7 @@ function useXlsxViewerCharts() {
|
|
|
10847
10866
|
tabs,
|
|
10848
10867
|
updateChart
|
|
10849
10868
|
} = useXlsxViewer();
|
|
10850
|
-
return
|
|
10869
|
+
return React16.useMemo(
|
|
10851
10870
|
() => ({
|
|
10852
10871
|
activeTab,
|
|
10853
10872
|
activeTabIndex,
|
|
@@ -10920,30 +10939,30 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10920
10939
|
workbook,
|
|
10921
10940
|
sheets
|
|
10922
10941
|
} = useXlsxViewer();
|
|
10923
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
10942
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
10924
10943
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
10925
10944
|
const includeHeaders = options2.includeHeaders ?? true;
|
|
10926
10945
|
const resolution = options2.resolution;
|
|
10927
|
-
const thumbnailImageCacheRef =
|
|
10928
|
-
const workerThumbnailRowBatchCacheRef =
|
|
10929
|
-
const workerThumbnailRowBatchRequestRef =
|
|
10946
|
+
const thumbnailImageCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10947
|
+
const workerThumbnailRowBatchCacheRef = React16.useRef(/* @__PURE__ */ new Map());
|
|
10948
|
+
const workerThumbnailRowBatchRequestRef = React16.useRef(
|
|
10930
10949
|
/* @__PURE__ */ new Map()
|
|
10931
10950
|
);
|
|
10932
|
-
const isMountedRef =
|
|
10933
|
-
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] =
|
|
10934
|
-
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] =
|
|
10935
|
-
|
|
10951
|
+
const isMountedRef = React16.useRef(false);
|
|
10952
|
+
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React16.useState(0);
|
|
10953
|
+
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React16.useState(0);
|
|
10954
|
+
React16.useEffect(() => {
|
|
10936
10955
|
isMountedRef.current = true;
|
|
10937
10956
|
return () => {
|
|
10938
10957
|
isMountedRef.current = false;
|
|
10939
10958
|
};
|
|
10940
10959
|
}, []);
|
|
10941
|
-
|
|
10960
|
+
React16.useEffect(() => {
|
|
10942
10961
|
workerThumbnailRowBatchCacheRef.current.clear();
|
|
10943
10962
|
workerThumbnailRowBatchRequestRef.current.clear();
|
|
10944
10963
|
setWorkerThumbnailRowBatchVersion((version) => version + 1);
|
|
10945
10964
|
}, [locale]);
|
|
10946
|
-
|
|
10965
|
+
React16.useEffect(() => {
|
|
10947
10966
|
const currentSheets = new Set(sheets);
|
|
10948
10967
|
for (const sheet of workerThumbnailRowBatchCacheRef.current.keys()) {
|
|
10949
10968
|
if (!currentSheets.has(sheet)) {
|
|
@@ -10956,7 +10975,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10956
10975
|
}
|
|
10957
10976
|
}
|
|
10958
10977
|
}, [sheets]);
|
|
10959
|
-
const getWorkerThumbnailRowBatch =
|
|
10978
|
+
const getWorkerThumbnailRowBatch = React16.useCallback((sheet, startRow, endRow) => {
|
|
10960
10979
|
const cachedBatch = workerThumbnailRowBatchCacheRef.current.get(sheet);
|
|
10961
10980
|
if (cachedBatch && startRow >= cachedBatch.startRow && endRow <= cachedBatch.endRow) {
|
|
10962
10981
|
return cachedBatch;
|
|
@@ -10998,7 +11017,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10998
11017
|
}
|
|
10999
11018
|
return null;
|
|
11000
11019
|
}, [getRowsBatchAsync]);
|
|
11001
|
-
const getThumbnailImage =
|
|
11020
|
+
const getThumbnailImage = React16.useCallback((image) => {
|
|
11002
11021
|
if (typeof Image === "undefined") {
|
|
11003
11022
|
return null;
|
|
11004
11023
|
}
|
|
@@ -11030,7 +11049,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11030
11049
|
imageElement.src = image.src;
|
|
11031
11050
|
return null;
|
|
11032
11051
|
}, []);
|
|
11033
|
-
const thumbnails =
|
|
11052
|
+
const thumbnails = React16.useMemo(() => {
|
|
11034
11053
|
return sheets.map((sheet, sheetIndex) => {
|
|
11035
11054
|
const worksheet = workbook?.getSheet(sheet.workbookSheetIndex) ?? null;
|
|
11036
11055
|
const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
|
|
@@ -11613,11 +11632,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11613
11632
|
locale,
|
|
11614
11633
|
workbook
|
|
11615
11634
|
]);
|
|
11616
|
-
const paintThumbnail =
|
|
11635
|
+
const paintThumbnail = React16.useCallback(
|
|
11617
11636
|
(sheetIndex, canvas) => thumbnails[sheetIndex]?.paint(canvas) ?? false,
|
|
11618
11637
|
[thumbnails]
|
|
11619
11638
|
);
|
|
11620
|
-
return
|
|
11639
|
+
return React16.useMemo(
|
|
11621
11640
|
() => ({
|
|
11622
11641
|
paintThumbnail,
|
|
11623
11642
|
thumbnails
|
|
@@ -11627,13 +11646,13 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11627
11646
|
}
|
|
11628
11647
|
function DefaultXlsxToolbar({ pivotTableEditor } = {}) {
|
|
11629
11648
|
const controller = useXlsxViewer();
|
|
11630
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
11649
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React16.useContext(ViewerAppearanceContext);
|
|
11631
11650
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
11632
|
-
return /* @__PURE__ */
|
|
11651
|
+
return /* @__PURE__ */ jsx12(DefaultToolbar, { controller, palette, pivotTableEditor });
|
|
11633
11652
|
}
|
|
11634
11653
|
|
|
11635
11654
|
// src/react-viewer.tsx
|
|
11636
|
-
import { jsx as
|
|
11655
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
11637
11656
|
var SlotStore = class {
|
|
11638
11657
|
slots = /* @__PURE__ */ new Map();
|
|
11639
11658
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -11702,9 +11721,9 @@ var SlotStore = class {
|
|
|
11702
11721
|
}
|
|
11703
11722
|
};
|
|
11704
11723
|
function RuntimeContent({ content }) {
|
|
11705
|
-
const hostRef =
|
|
11706
|
-
const rootRef =
|
|
11707
|
-
|
|
11724
|
+
const hostRef = React17.useRef(null);
|
|
11725
|
+
const rootRef = React17.useRef(null);
|
|
11726
|
+
React17.useLayoutEffect(() => {
|
|
11708
11727
|
const host = hostRef.current;
|
|
11709
11728
|
if (!host) return;
|
|
11710
11729
|
const root = __createContentRoot(host);
|
|
@@ -11714,14 +11733,14 @@ function RuntimeContent({ content }) {
|
|
|
11714
11733
|
root.destroy();
|
|
11715
11734
|
};
|
|
11716
11735
|
}, []);
|
|
11717
|
-
|
|
11736
|
+
React17.useLayoutEffect(() => {
|
|
11718
11737
|
rootRef.current?.update(content);
|
|
11719
11738
|
}, [content]);
|
|
11720
|
-
return /* @__PURE__ */
|
|
11739
|
+
return /* @__PURE__ */ jsx13("span", { ref: hostRef, style: { display: "contents" } });
|
|
11721
11740
|
}
|
|
11722
|
-
function renderOptions(props, controller, slots, owner) {
|
|
11741
|
+
function renderOptions(props, controller, slots, owner, renderHiddenRangeMarker) {
|
|
11723
11742
|
const slot = (key, node) => slots.render(key, node, owner);
|
|
11724
|
-
const runtime = (node) => /* @__PURE__ */
|
|
11743
|
+
const runtime = (node) => /* @__PURE__ */ jsx13(RuntimeContent, { content: node });
|
|
11725
11744
|
const {
|
|
11726
11745
|
emptyState,
|
|
11727
11746
|
errorState,
|
|
@@ -11746,6 +11765,7 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11746
11765
|
return {
|
|
11747
11766
|
...other,
|
|
11748
11767
|
controller,
|
|
11768
|
+
renderHiddenRangeMarker,
|
|
11749
11769
|
emptyState: emptyState === void 0 ? void 0 : slot("empty", emptyState),
|
|
11750
11770
|
loadingComponent: loadingComponent === void 0 ? void 0 : slot("loading-component", loadingComponent),
|
|
11751
11771
|
loadingState: loadingState === void 0 ? void 0 : slot("loading", loadingState),
|
|
@@ -11777,13 +11797,24 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11777
11797
|
};
|
|
11778
11798
|
}
|
|
11779
11799
|
function BoundViewer({ props, controller: sourceController }) {
|
|
11780
|
-
const messages =
|
|
11781
|
-
const controller =
|
|
11782
|
-
const hostRef =
|
|
11783
|
-
const viewerRef =
|
|
11784
|
-
const slots =
|
|
11785
|
-
|
|
11786
|
-
|
|
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(() => {
|
|
11787
11818
|
const host = hostRef.current;
|
|
11788
11819
|
if (!host) return;
|
|
11789
11820
|
slots.observe(host);
|
|
@@ -11795,27 +11826,27 @@ function BoundViewer({ props, controller: sourceController }) {
|
|
|
11795
11826
|
slots.destroy();
|
|
11796
11827
|
};
|
|
11797
11828
|
}, [slots]);
|
|
11798
|
-
|
|
11829
|
+
React17.useLayoutEffect(() => {
|
|
11799
11830
|
const host = hostRef.current;
|
|
11800
|
-
if (host) viewerRef.current?.update(renderOptions(props, controller, slots, host.ownerDocument));
|
|
11801
|
-
}, [controller, props, slots]);
|
|
11802
|
-
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: {
|
|
11803
11834
|
headerBackgroundColor: props.headerBackgroundColor,
|
|
11804
11835
|
headerTextColor: props.headerTextColor,
|
|
11805
11836
|
isDark: props.isDark ?? false
|
|
11806
11837
|
}, children: /* @__PURE__ */ jsxs9(ViewerContext.Provider, { value: controller, children: [
|
|
11807
|
-
/* @__PURE__ */
|
|
11838
|
+
/* @__PURE__ */ jsx13("div", { ref: hostRef, style: { display: "contents" } }),
|
|
11808
11839
|
slots.portals()
|
|
11809
11840
|
] }) });
|
|
11810
11841
|
}
|
|
11811
11842
|
function UncontrolledViewer(props) {
|
|
11812
11843
|
const controller = useXlsxViewerController(props);
|
|
11813
|
-
return /* @__PURE__ */
|
|
11844
|
+
return /* @__PURE__ */ jsx13(BoundViewer, { props, controller });
|
|
11814
11845
|
}
|
|
11815
11846
|
function XlsxViewer(props) {
|
|
11816
|
-
const context =
|
|
11847
|
+
const context = React17.useContext(ViewerContext);
|
|
11817
11848
|
const controller = props.controller ?? context;
|
|
11818
|
-
return controller ? /* @__PURE__ */
|
|
11849
|
+
return controller ? /* @__PURE__ */ jsx13(BoundViewer, { props, controller }) : /* @__PURE__ */ jsx13(UncontrolledViewer, { ...props });
|
|
11819
11850
|
}
|
|
11820
11851
|
export {
|
|
11821
11852
|
DefaultXlsxPivotTableFieldList,
|