@sheetxl/studio-mui 0.8.0-beta.10 → 0.8.0-beta.12
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/browser/esm/{ByeL_BZuJ2kl8gtf.mjs → 0IBZhOJaVmzJxuTv.mjs} +1 -1
- package/browser/esm/2nRxqrNYbmEn8fS8.mjs +386 -0
- package/browser/esm/{fb126BNj3F8URR19.mjs → 7fVZXXuonYb6Z7FU.mjs} +3 -3
- package/browser/esm/BAzhmMX4Fk_qnUTp.mjs +414 -0
- package/browser/esm/BGL3x0W74D7qZXlf.mjs +318 -0
- package/browser/esm/BHGr2gsFofTdAFxq.mjs +515 -0
- package/browser/esm/{DU3J8Gcf-WpBxNYg.mjs → BKhcJI-G15D3kGap.mjs} +4 -4
- package/browser/esm/BNbub9weuqm3mcoF.mjs +335 -0
- package/browser/esm/BSv9MVJaz1DVEffm.mjs +975 -0
- package/browser/esm/BWfLpYmd3cSgJ0C6.mjs +141 -0
- package/browser/esm/BZqwbIE8qzjSOYcJ.mjs +582 -0
- package/browser/esm/BZy9xUrYpAtnKeji.mjs +1288 -0
- package/browser/esm/{CIu1bjPJe_x31Oww.mjs → BnkwC5rsg9LZyhoP.mjs} +3 -3
- package/browser/esm/BpJsBv413cNQpyg0.mjs +319 -0
- package/browser/esm/BpVrgbVISiTDyFR3.mjs +197 -0
- package/browser/esm/BsngRDhvVYGVBJeK.mjs +1546 -0
- package/browser/esm/{C1Rp2hZrApo5MUc8.mjs → C29TKq47CbXs652l.mjs} +2 -2
- package/browser/esm/{CEvZe2cZK-voZTif.mjs → C8p2iMad_NNCwGI_.mjs} +5 -5
- package/browser/esm/CBzXksWnb-1gGEWZ.mjs +212 -0
- package/browser/esm/{IQLeaAbtGTipUsOD.mjs → CFIAWgpU3UyepLBn.mjs} +25 -24
- package/browser/esm/CJD4jF4m9cBGHzr_.mjs +31 -0
- package/browser/esm/{CjznclrKqJRi7u9O.mjs → CMc7G7cevxzPGxr9.mjs} +2 -2
- package/browser/esm/{B1Yp_uy1vFHcJB3U.mjs → CYtULLhY9M2m3DeH.mjs} +1 -1
- package/browser/esm/CeF35ZeFP28Do5Zx.mjs +1379 -0
- package/browser/esm/{xKiLJKiLxto8SayF.mjs → CjYKDxU4EP2Kf_vo.mjs} +2 -2
- package/browser/esm/{D8al_cJ4U-NgzwoK.mjs → Cq82lvdjyBvlJ8xJ.mjs} +19 -17
- package/browser/esm/{X1Db3b_7b_7OuCk6.mjs → CuRxFAO42JkQvMEx.mjs} +1 -1
- package/browser/esm/Cvk2yY90hpgXWMAt.mjs +103 -0
- package/browser/esm/D0slJycx3nq53qmf.mjs +14 -0
- package/browser/esm/{9eKCkvqpMQwqcXiw.mjs → D2jzliMwAo2ENpfi.mjs} +1 -1
- package/browser/esm/D5Fn0Hqllwv5HY6i.mjs +7581 -0
- package/browser/esm/D5N4nGaZsXtrHAOh.mjs +831 -0
- package/browser/esm/D7AqPfyhMiuda5l5.mjs +412 -0
- package/browser/esm/DHZA48ZMCETvHmeP.mjs +161 -0
- package/browser/esm/DX2_vf7WX6uRLaOZ.mjs +94 -0
- package/browser/esm/DaxpbAF1ShkT7hNU.mjs +490 -0
- package/browser/esm/{D6S8kVTzOjCn0-SK.mjs → Db3oHfXiRtcH015t.mjs} +162 -156
- package/browser/esm/Dt47Huh1l3C4_5_w.mjs +87 -0
- package/browser/esm/{DmCQbW4zwkT_Rq88.mjs → DtPt0phL7m56YfHZ.mjs} +1 -1
- package/browser/esm/{CoSiOS-og0zFw4Ws.mjs → DtTDaXmnWUoG4VBO.mjs} +2 -2
- package/browser/esm/{DHY19rkSiiRZxShC.mjs → DuuyN4-7K6_io2Py.mjs} +3 -3
- package/browser/esm/{yZxC4qUENOlMhVUH.mjs → NeGeLF3gbGMZyV6E.mjs} +1 -1
- package/browser/esm/PY3Br5Bo_TxcCnCU.mjs +252 -0
- package/browser/esm/WIhvQtBkGiw-oFUs.mjs +2566 -0
- package/browser/esm/WgIvwAENeO8LANax.mjs +437 -0
- package/browser/esm/{DBtc4lku0uHVcqWn.mjs → Yjq3p_7eVGFw2Jod.mjs} +3 -3
- package/browser/esm/index.mjs +1053 -192
- package/browser/esm/jFRFCWlkD7Dsrhkh.mjs +236 -0
- package/browser/esm/lKXEDVt2ow1NlWJj.mjs +392 -0
- package/browser/esm/{Blaj2R5hYxtLAW__.mjs → oC0OwOddhOD0OoCJ.mjs} +6 -6
- package/browser/esm/{sFOAxZpxXo-qvDSp.mjs → tIKqpsA0vNXH9EgU.mjs} +1 -1
- package/browser/esm/{5cbK03T_Oh3tNdR7.mjs → u84rSnESjxqB6gay.mjs} +1 -1
- package/licenses/dependencies.txt +94 -94
- package/node/esm/{BcwMb6CyVfvEwbHn.mjs → B8Ls4Eh1k8-Yiry_.mjs} +1 -1
- package/node/esm/{CKu1AtRgyltyEdEN.mjs → B9X3n8MglL4OitAV.mjs} +1 -1
- package/node/esm/{ETK6T6G0SIcFXDe5.mjs → BBGoyqs2L_ccSH1e.mjs} +40 -40
- package/node/esm/BLv99aovW4R3C5PE.mjs +515 -0
- package/node/esm/BUGU_5lUtnCRlp3n.mjs +519 -0
- package/node/esm/BalROFG_oa9PFs9Q.mjs +141 -0
- package/node/esm/{ah3CUg4-VmNstGk_.mjs → BqVxnA1mo52ubjdf.mjs} +2 -2
- package/node/esm/C3FCh9xju2SccUIE.mjs +1283 -0
- package/node/esm/{Bb1sLMqXWKjdve23.mjs → C4F6WY8M4nkLyxdb.mjs} +2 -2
- package/node/esm/CKWeipCqqpLnLE5e.mjs +391 -0
- package/node/esm/CTnVNfz4eqFnM92M.mjs +212 -0
- package/node/esm/Cfi_ly8fBDZZdiZT.mjs +72 -0
- package/node/esm/CgKa6JuyJ1tTodev.mjs +1703 -0
- package/node/esm/{cqzp431iNSLWictb.mjs → Cq53M7bAUSXMNq1f.mjs} +22 -22
- package/node/esm/{BYsG3KYVmxSe_CIQ.mjs → Cr8AYWUoU-XVt0hu.mjs} +1 -1
- package/node/esm/CyuOE595I2e-U4cG.mjs +236 -0
- package/node/esm/D72CupF9mfy2D1Xa.mjs +94 -0
- package/node/esm/{DNSjK5DAH3M14Qbc.mjs → DGDHFK8okuVbRCe5.mjs} +1 -1
- package/node/esm/{B8SQfjKjzYHLxzZR.mjs → DJFkALt4XrwkMbnU.mjs} +163 -157
- package/node/esm/DJpwI8PlKBI2rk0r.mjs +319 -0
- package/node/esm/{DZzvTQxIKr9LbEsA.mjs → DQaGPUYbgL4Y5YZW.mjs} +32 -30
- package/node/esm/{D9rzScOA9pEYFrtz.mjs → DsNYnq4NtYBxPmeA.mjs} +20 -20
- package/node/esm/DygDgOpa9sJ6YFVS.mjs +385 -0
- package/node/esm/Dz0Hg87UcJ-awwiI.mjs +489 -0
- package/node/esm/M7YxvRPGCuxuk9aK.mjs +142 -0
- package/node/esm/QNjtpX8rIpqGGLEJ.mjs +1379 -0
- package/node/esm/{B_jRGdwGFkudwmL-.mjs → ZzvsynJTCSuChYS-.mjs} +1 -1
- package/node/esm/{ci8d-mF1H9wnYzix.mjs → di_8-pXh90j4BO4j.mjs} +1 -1
- package/node/esm/dm8dmEaTIqfmgyeL.mjs +412 -0
- package/node/esm/{D6oQL8knsPpgdXuk.mjs → fmya3XQnTGyQisvT.mjs} +2 -2
- package/node/esm/gPYAb_A0T5ZwcQ1E.mjs +318 -0
- package/node/esm/index.mjs +8915 -13417
- package/node/esm/wB8xMpyJ_NvE16yG.mjs +975 -0
- package/node/esm/zGAcd4Jr7wkvXDBS.mjs +197 -0
- package/package.json +9 -9
- package/resources/locales/de/groups.cmd.json +4 -0
- package/resources/locales/de/ui.msg.json +100 -1
- package/resources/locales/en/groups.cmd.json +4 -0
- package/resources/locales/en/ui.msg.json +100 -1
- package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +4 -4
- package/types/src/anomalies/AnomaliesPlugin.d.ts +5 -0
- package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
- package/types/src/anomalies/index.d.ts +3 -0
- package/types/src/border/BorderPopupButton.d.ts +1 -1
- package/types/src/border/BorderTemplateIcon.d.ts +6 -1
- package/types/src/chart/ChartFormatPanel.d.ts +20 -0
- package/types/src/chart/ChartPlugin.d.ts +6 -0
- package/types/src/chart/index.d.ts +3 -0
- package/types/src/color/ColorPopupButton.d.ts +1 -1
- package/types/src/command/AccountingStyleCommandButton.d.ts +1 -1
- package/types/src/command/DocThemeCommandButton.d.ts +1 -1
- package/types/src/command/FontFamilyCommandButton.d.ts +1 -1
- package/types/src/command/FontSizeCommandButton.d.ts +1 -1
- package/types/src/command/InsertCellControlCommandButton.d.ts +17 -0
- package/types/src/command/LanguageCommandButton.d.ts +1 -1
- package/types/src/command/LocaleCommandButton.d.ts +1 -1
- package/types/src/command/index.d.ts +1 -0
- package/types/src/comments/CommentCard.d.ts +2 -2
- package/types/src/conditionalFormat/IconPickerPopupButton.d.ts +1 -1
- package/types/src/conditions/ConditionEditor.d.ts +1 -1
- package/types/src/conditions/OperatorAndParamEditor.d.ts +1 -1
- package/types/src/conditions/OperatorSelectPopupButton.d.ts +1 -1
- package/types/src/conditions/useFormulaOption.d.ts +2 -2
- package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
- package/types/src/fill/PatternPopupButton.d.ts +1 -1
- package/types/src/format/BorderPreview.d.ts +11 -4
- package/types/src/format/useFormatSelection.d.ts +4 -4
- package/types/src/formulaBar/IFormulaBar.d.ts +4 -2
- package/types/src/formulaBar/MobileFormulaBar.d.ts +18 -6
- package/types/src/formulaBar/MobileInputToolbar.d.ts +9 -3
- package/types/src/formulaBar/useFormulaBarSession.d.ts +6 -3
- package/types/src/index.d.ts +15 -6
- package/types/src/itemsPanel/ItemsPanel.d.ts +5 -0
- package/types/src/named/NamedDetailsPanel.d.ts +2 -2
- package/types/src/protection/ProtectedCellsPanel.d.ts +2 -2
- package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
- package/types/src/protection/index.d.ts +1 -1
- package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +2 -2
- package/types/src/statusBar/PendingStatus.d.ts +19 -0
- package/types/src/statusBar/index.d.ts +1 -0
- package/types/src/studio/StudioProps.d.ts +10 -10
- package/types/src/template/TemplatePanel.d.ts +5 -1
- package/types/src/theme/ThemeSelectPopupButton.d.ts +1 -1
- package/types/src/toolbar/WorkbookToolbars.d.ts +1 -1
- package/types/src/workbook/DefaultRenderers.d.ts +31 -19
- package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
- package/types/src/workbook/WorkbookElement.d.ts +5 -4
- package/types/src/workbook/WorkbookStrip.d.ts +8 -7
- package/types/src/workbook/index.d.ts +1 -1
- package/browser/esm/Biy7bhzzzPb5sfRN.mjs +0 -152
- package/browser/esm/COv-m-c2byCgvU3M.mjs +0 -14861
- package/browser/esm/CtEFHbzYNvYjDYvi.mjs +0 -236
- package/browser/esm/Die9NXVFveHvcCT-.mjs +0 -4205
- package/browser/esm/sam1KGQZ59B_fADz.mjs +0 -1941
- package/node/esm/BYVLi0md4AYuDsB_.mjs +0 -236
- package/node/esm/BYwXhrEwkRAt9nJS.mjs +0 -71
- package/node/esm/Cmt8Wv806N7NmE4Y.mjs +0 -3344
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.12
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { t as e } from "./CKWeipCqqpLnLE5e.mjs";
|
|
8
|
+
import { FormulaField as t, InputField as n, PresetChip as a, c as r } from "./index.mjs";
|
|
9
|
+
import { useModelSync as o, useWorkbook as i } from "@sheetxl/react";
|
|
10
|
+
import { DynamicIcon as d, NotifierType as l, useCallbackRef as s, useNotifier as m, useTranslator as c } from "@sheetxl/utils-react";
|
|
11
|
+
import { forwardRef as g, memo as u, useCallback as p, useEffect as h, useMemo as x, useState as f } from "react";
|
|
12
|
+
import { SimpleTooltip as b } from "@sheetxl/utils-mui";
|
|
13
|
+
import { Fragment as y, jsx as v, jsxs as C } from "react/jsx-runtime";
|
|
14
|
+
import { Box as k, Button as w, Checkbox as N, Chip as R, FormControlLabel as S, FormHelperText as T, MenuItem as E, Paper as I, TextField as L, Typography as O } from "@mui/material";
|
|
15
|
+
import { messageKey as P, t as z } from "@sheetxl/utils";
|
|
16
|
+
var W = (e) => "formula" === e.getType(), A = (e) => {
|
|
17
|
+
try {
|
|
18
|
+
return W(e) ? String(e.getValue() ?? "") : e.getRanges?.()?.toString() ?? "";
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return "";
|
|
21
|
+
}
|
|
22
|
+
}, D = (e) => {
|
|
23
|
+
try {
|
|
24
|
+
return e.getRanges(e.getWorksheet().getSelectedRange()).getFixed(!0).toString();
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
}, F = (e, t) => t ? {
|
|
29
|
+
name: t.getName(),
|
|
30
|
+
expression: A(t),
|
|
31
|
+
scope: t.getScope(),
|
|
32
|
+
comment: t.getComment() ?? "",
|
|
33
|
+
hidden: t.isHidden(),
|
|
34
|
+
editable: W(t)
|
|
35
|
+
} : {
|
|
36
|
+
name: e.getNames().findValidName("Name"),
|
|
37
|
+
expression: D(e),
|
|
38
|
+
scope: null,
|
|
39
|
+
comment: "",
|
|
40
|
+
hidden: !1,
|
|
41
|
+
editable: !0
|
|
42
|
+
}, H = (e, t, n) => {
|
|
43
|
+
const a = t.name.trim(), r = t.expression.trim().replace(/^=\s*/, "").trim(), o = t.comment.trim(), i = t.scope || null;
|
|
44
|
+
if (!a) throw new Error(z("error.named.nameEmpty"));
|
|
45
|
+
if (!r) throw new Error(z("named.expressionRequired"));
|
|
46
|
+
if (null !== n) {
|
|
47
|
+
if (a.toLowerCase() !== n.getName().toLowerCase() && e.getNames().validateName(a, i ?? void 0), (n.getScope() ?? null) !== i) {
|
|
48
|
+
if (!t.editable || !n.delete) throw new Error(z("error.named.nameReadonly"));
|
|
49
|
+
const d = e.getTransactions().beginCommit({ description: z("op.updateNamed", { name: a }) });
|
|
50
|
+
try {
|
|
51
|
+
n.delete(), e.getCalculation().getNamedFormulas().add({
|
|
52
|
+
name: a,
|
|
53
|
+
expression: r,
|
|
54
|
+
scope: i,
|
|
55
|
+
comment: o || void 0,
|
|
56
|
+
hidden: t.hidden || void 0
|
|
57
|
+
}), d.commit();
|
|
58
|
+
} catch (e) {
|
|
59
|
+
throw d.rollback(), e;
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
n.doBatch(() => {
|
|
64
|
+
a !== n.getName() && n.setName(a), t.editable && r !== A(n) && n.setExpression(r), (n.getComment() ?? "") !== o && n.setComment(o || null), n.isHidden() !== t.hidden && n.setHidden?.(t.hidden);
|
|
65
|
+
}, { description: z("op.updateNamed", { name: a }) });
|
|
66
|
+
} else e.getCalculation().getNamedFormulas().add({
|
|
67
|
+
name: a,
|
|
68
|
+
expression: r,
|
|
69
|
+
scope: i,
|
|
70
|
+
comment: o || void 0,
|
|
71
|
+
hidden: t.hidden || void 0
|
|
72
|
+
});
|
|
73
|
+
}, M = {
|
|
74
|
+
table: "Table",
|
|
75
|
+
range: "NamedRange",
|
|
76
|
+
formula: "Function"
|
|
77
|
+
}, j = {
|
|
78
|
+
table: P("named.kindTable"),
|
|
79
|
+
range: P("named.kindRange"),
|
|
80
|
+
formula: P("named.kindFormula")
|
|
81
|
+
}, q = (e) => {
|
|
82
|
+
if (!W(e)) return "table";
|
|
83
|
+
try {
|
|
84
|
+
return e.getRanges?.() ? "range" : "formula";
|
|
85
|
+
} catch (e) {
|
|
86
|
+
return "formula";
|
|
87
|
+
}
|
|
88
|
+
}, K = u((e) => {
|
|
89
|
+
const { kind: t, size: n = 28, ...r } = e, o = c();
|
|
90
|
+
return v(a, {
|
|
91
|
+
className: "sxl-named-kind-chip",
|
|
92
|
+
title: o(j[t]),
|
|
93
|
+
sx: {
|
|
94
|
+
width: "auto",
|
|
95
|
+
minWidth: 1.7 * n + "px",
|
|
96
|
+
height: `${n}px`,
|
|
97
|
+
color: "table" === t ? "primary.main" : "text.secondary"
|
|
98
|
+
},
|
|
99
|
+
...r,
|
|
100
|
+
children: v(d, {
|
|
101
|
+
iconKey: M[t],
|
|
102
|
+
size: Math.round(.7 * n)
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
K.displayName = "NamedKindChip";
|
|
107
|
+
var B = "workbook", U = u((e) => {
|
|
108
|
+
const { draft: a, workbook: o } = e, i = c(), [d] = f(() => a.name), [l] = f(() => a.expression), [m, g] = f(null), [u, p] = f(() => a.scope), [h, b] = f(() => a.comment), [y, w] = f(() => a.hidden), [R, P] = f(() => a.editable ? ((e, t) => {
|
|
109
|
+
const n = t.trim().replace(/^=\s*/, "");
|
|
110
|
+
if (!n) return "formula";
|
|
111
|
+
try {
|
|
112
|
+
return e.createFormula(n, void 0, { target: "display" }).isReferenceOnly() ? "range" : "formula";
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return "formula";
|
|
115
|
+
}
|
|
116
|
+
})(o, a.expression) : "table"), z = !a.editable, W = s((e) => {
|
|
117
|
+
e.trim().toLowerCase() !== d.toLowerCase() && o.getNames().validateName(e.trim(), u ?? void 0);
|
|
118
|
+
}, [
|
|
119
|
+
o,
|
|
120
|
+
d,
|
|
121
|
+
u
|
|
122
|
+
]), A = x(() => {
|
|
123
|
+
try {
|
|
124
|
+
return o.getWorksheets().getItems().map((e) => e.getName());
|
|
125
|
+
} catch (e) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
}, [o]);
|
|
129
|
+
return v(I, {
|
|
130
|
+
tabIndex: 0,
|
|
131
|
+
className: r["editor-panel"],
|
|
132
|
+
sx: {
|
|
133
|
+
gap: (e) => e.spacing(1),
|
|
134
|
+
paddingTop: (e) => e.spacing(1.25),
|
|
135
|
+
paddingBottom: (e) => e.spacing(2),
|
|
136
|
+
paddingLeft: (e) => e.spacing(1.5),
|
|
137
|
+
paddingRight: (e) => e.spacing(1.5),
|
|
138
|
+
border: (e) => `1px solid ${e.palette.divider}`,
|
|
139
|
+
borderRadius: (e) => e.spacing(1.25),
|
|
140
|
+
overflow: "auto"
|
|
141
|
+
},
|
|
142
|
+
children: C(k, {
|
|
143
|
+
sx: {
|
|
144
|
+
display: "flex",
|
|
145
|
+
flexDirection: "column",
|
|
146
|
+
gap: (e) => e.spacing(2),
|
|
147
|
+
margin: (e) => e.spacing(1.25)
|
|
148
|
+
},
|
|
149
|
+
children: [
|
|
150
|
+
C(k, { children: [C(k, {
|
|
151
|
+
sx: {
|
|
152
|
+
display: "flex",
|
|
153
|
+
alignItems: "flex-end",
|
|
154
|
+
gap: (e) => e.spacing(1.5)
|
|
155
|
+
},
|
|
156
|
+
children: [v(K, {
|
|
157
|
+
kind: R,
|
|
158
|
+
size: 48
|
|
159
|
+
}), v(n, {
|
|
160
|
+
label: i("named.name"),
|
|
161
|
+
sx: {
|
|
162
|
+
flex: "1 1 auto",
|
|
163
|
+
minWidth: 0
|
|
164
|
+
},
|
|
165
|
+
helperText: null,
|
|
166
|
+
showError: !1,
|
|
167
|
+
onChangeError: g,
|
|
168
|
+
disabled: z,
|
|
169
|
+
value: d,
|
|
170
|
+
onValidate: W,
|
|
171
|
+
onChangeText: (e) => {
|
|
172
|
+
a.name = e;
|
|
173
|
+
}
|
|
174
|
+
})]
|
|
175
|
+
}), v(T, {
|
|
176
|
+
error: !!m,
|
|
177
|
+
sx: {
|
|
178
|
+
marginTop: (e) => e.spacing(.5),
|
|
179
|
+
marginX: "14px"
|
|
180
|
+
},
|
|
181
|
+
children: m ? i(m) : " "
|
|
182
|
+
})] }),
|
|
183
|
+
v(t, {
|
|
184
|
+
label: i("named.refersTo"),
|
|
185
|
+
value: l,
|
|
186
|
+
workbook: o,
|
|
187
|
+
disabled: z,
|
|
188
|
+
helperText: i("named.refersToHelp"),
|
|
189
|
+
equals: "required",
|
|
190
|
+
pickAs: "absolute",
|
|
191
|
+
onChangeText: (e) => {
|
|
192
|
+
a.expression = e;
|
|
193
|
+
},
|
|
194
|
+
onChangeInput: (e) => {
|
|
195
|
+
e && P(e.isReferenceOnly() ? "range" : "formula");
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
C(L, {
|
|
199
|
+
label: i("named.scope"),
|
|
200
|
+
size: "small",
|
|
201
|
+
fullWidth: !0,
|
|
202
|
+
select: !0,
|
|
203
|
+
disabled: z,
|
|
204
|
+
value: u ?? B,
|
|
205
|
+
helperText: i("named.scopeHelp"),
|
|
206
|
+
onChange: (e) => {
|
|
207
|
+
const t = e.target.value === B ? null : e.target.value;
|
|
208
|
+
p(t), a.scope = t;
|
|
209
|
+
},
|
|
210
|
+
children: [v(E, {
|
|
211
|
+
value: B,
|
|
212
|
+
children: i("named.scopeWorkbook")
|
|
213
|
+
}), A.map((e) => v(E, {
|
|
214
|
+
value: e,
|
|
215
|
+
children: e
|
|
216
|
+
}, e))]
|
|
217
|
+
}),
|
|
218
|
+
v(L, {
|
|
219
|
+
label: i("named.comment"),
|
|
220
|
+
size: "small",
|
|
221
|
+
fullWidth: !0,
|
|
222
|
+
multiline: !0,
|
|
223
|
+
minRows: 2,
|
|
224
|
+
maxRows: 4,
|
|
225
|
+
disabled: z,
|
|
226
|
+
value: h,
|
|
227
|
+
onChange: (e) => {
|
|
228
|
+
b(e.target.value), a.comment = e.target.value;
|
|
229
|
+
}
|
|
230
|
+
}),
|
|
231
|
+
v(S, {
|
|
232
|
+
control: v(N, {
|
|
233
|
+
size: "small",
|
|
234
|
+
disabled: z,
|
|
235
|
+
checked: y,
|
|
236
|
+
onChange: (e) => {
|
|
237
|
+
w(e.target.checked), a.hidden = e.target.checked;
|
|
238
|
+
}
|
|
239
|
+
}),
|
|
240
|
+
label: v(O, {
|
|
241
|
+
variant: "body2",
|
|
242
|
+
children: i("named.hidden")
|
|
243
|
+
})
|
|
244
|
+
}),
|
|
245
|
+
v(O, {
|
|
246
|
+
variant: "caption",
|
|
247
|
+
sx: {
|
|
248
|
+
color: "text.secondary",
|
|
249
|
+
marginTop: "-12px"
|
|
250
|
+
},
|
|
251
|
+
children: i("named.hiddenHelp")
|
|
252
|
+
}),
|
|
253
|
+
z ? v(O, {
|
|
254
|
+
variant: "caption",
|
|
255
|
+
sx: {
|
|
256
|
+
color: "text.secondary",
|
|
257
|
+
fontStyle: "italic"
|
|
258
|
+
},
|
|
259
|
+
children: i("named.derivedReadOnly")
|
|
260
|
+
}) : null
|
|
261
|
+
]
|
|
262
|
+
})
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
U.displayName = "NamedEditorPanel";
|
|
266
|
+
var V = u((e) => {
|
|
267
|
+
const { named: n, label: a, helperText: r } = e, d = c(), s = m(), g = i();
|
|
268
|
+
o(n, ["onAnyChange", "onRangesChange"]);
|
|
269
|
+
const u = W(n) && !n.isReadOnly() && (g?.getProtection().isStructureAllowed() ?? !0), h = p((e, t) => {
|
|
270
|
+
if ("accept" !== t.reason) return;
|
|
271
|
+
const a = e?.getExpression()?.trim();
|
|
272
|
+
if (a && a !== A(n)) try {
|
|
273
|
+
n.setExpression(a);
|
|
274
|
+
} catch (e) {
|
|
275
|
+
s.showMessage?.(e.message, { type: l.Error });
|
|
276
|
+
}
|
|
277
|
+
}, [n, s]);
|
|
278
|
+
return v(t, {
|
|
279
|
+
value: A(n),
|
|
280
|
+
equals: "required",
|
|
281
|
+
pickAs: "absolute",
|
|
282
|
+
changeOn: "done",
|
|
283
|
+
onDone: h,
|
|
284
|
+
label: void 0 === a ? d("named.refersTo") : a,
|
|
285
|
+
helperText: r,
|
|
286
|
+
disabled: !u
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
V.displayName = "NamedExpressionField";
|
|
290
|
+
var $ = /^_xlnm\./i, X = (e) => {
|
|
291
|
+
if (!e) return 0;
|
|
292
|
+
const t = e.getCoords();
|
|
293
|
+
let n = 0;
|
|
294
|
+
for (let a = 0; a < e.getCount(); a++) {
|
|
295
|
+
if (e.at(a).isINamedRange) {
|
|
296
|
+
n++;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const r = t[a];
|
|
300
|
+
n += (r.rowEnd - r.rowStart + 1) * (r.colEnd - r.colStart + 1);
|
|
301
|
+
}
|
|
302
|
+
return n;
|
|
303
|
+
}, _ = ({ item: e, workbook: t }) => {
|
|
304
|
+
const n = c(), a = ((e, t) => {
|
|
305
|
+
const [n, a] = f(null);
|
|
306
|
+
return h(() => {
|
|
307
|
+
const n = e;
|
|
308
|
+
if ("function" != typeof n.getDirectDependents) return;
|
|
309
|
+
let r = !0;
|
|
310
|
+
const o = () => {
|
|
311
|
+
n.getDirectDependents().then((e) => {
|
|
312
|
+
r && a(X(e));
|
|
313
|
+
}).catch(() => {});
|
|
314
|
+
};
|
|
315
|
+
o();
|
|
316
|
+
const i = t.getCalculation().addListeners({ onComplete: o }, { transactional: !1 });
|
|
317
|
+
return () => {
|
|
318
|
+
r = !1, i?.();
|
|
319
|
+
};
|
|
320
|
+
}, [e, t]), n;
|
|
321
|
+
})(e, t), r = e.getScope(), o = e.getComment(), i = null !== a && !$.test(e.getName()), d = [r ? n("named.scopedTo", { scope: r }) : n("named.scopeWorkbook")];
|
|
322
|
+
return e.isHidden() && d.push(n("named.hidden")), C(y, { children: [C(k, {
|
|
323
|
+
sx: {
|
|
324
|
+
display: "flex",
|
|
325
|
+
alignItems: "center",
|
|
326
|
+
gap: 1
|
|
327
|
+
},
|
|
328
|
+
children: [v(O, {
|
|
329
|
+
variant: "caption",
|
|
330
|
+
sx: {
|
|
331
|
+
flex: "1 1 auto",
|
|
332
|
+
color: (e) => e.palette.text.secondary
|
|
333
|
+
},
|
|
334
|
+
children: d.join(" · ")
|
|
335
|
+
}), i ? v(b, {
|
|
336
|
+
disableInteractive: !0,
|
|
337
|
+
title: n("named.references", { count: a }),
|
|
338
|
+
children: v(R, {
|
|
339
|
+
size: "small",
|
|
340
|
+
variant: "outlined",
|
|
341
|
+
label: a.toLocaleString(),
|
|
342
|
+
"aria-label": n("named.references", { count: a }),
|
|
343
|
+
sx: {
|
|
344
|
+
height: 20,
|
|
345
|
+
color: 0 === a ? "text.disabled" : void 0
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
}) : null]
|
|
349
|
+
}), o ? v(O, {
|
|
350
|
+
variant: "caption",
|
|
351
|
+
sx: {
|
|
352
|
+
color: (e) => e.palette.text.secondary,
|
|
353
|
+
fontStyle: "italic"
|
|
354
|
+
},
|
|
355
|
+
children: o
|
|
356
|
+
}) : null] });
|
|
357
|
+
}, G = u(g((t, n) => {
|
|
358
|
+
const { workbook: a, args: r, ...o } = t, i = c(), d = m(), s = ((e) => {
|
|
359
|
+
const [t, n] = f(0), [a, r] = f(0);
|
|
360
|
+
return h(() => {
|
|
361
|
+
const t = () => r((e) => e + 1), n = e.getNames().addListeners({
|
|
362
|
+
onCollectionChange: t,
|
|
363
|
+
onInvalidated: t
|
|
364
|
+
}, { transactional: !1 }), a = e.getCalculation().addListeners({ onComplete: t }, { transactional: !1 });
|
|
365
|
+
return () => {
|
|
366
|
+
n?.(), a?.();
|
|
367
|
+
};
|
|
368
|
+
}, [e]), h(() => {
|
|
369
|
+
if (!e.getProtection().isStructureAllowed()) return void n(0);
|
|
370
|
+
let t = !0;
|
|
371
|
+
return e.getNames().removeUnused({
|
|
372
|
+
hiddenOnly: !0,
|
|
373
|
+
dryRun: !0
|
|
374
|
+
}).then((e) => {
|
|
375
|
+
t && n(e);
|
|
376
|
+
}).catch(() => {}), () => {
|
|
377
|
+
t = !1;
|
|
378
|
+
};
|
|
379
|
+
}, [e, a]), {
|
|
380
|
+
count: t,
|
|
381
|
+
remove: p(async () => {
|
|
382
|
+
await e.getNames().removeUnused({ hiddenOnly: !0 });
|
|
383
|
+
}, [e])
|
|
384
|
+
};
|
|
385
|
+
})(a), g = x(() => ((e) => ({
|
|
386
|
+
key: "named",
|
|
387
|
+
messageKeys: {
|
|
388
|
+
none: P("named.none"),
|
|
389
|
+
addPrompt: P("named.addPrompt"),
|
|
390
|
+
heading: P("named.heading"),
|
|
391
|
+
insert: P("named.insert"),
|
|
392
|
+
new: P("named.new"),
|
|
393
|
+
edit: P("named.edit"),
|
|
394
|
+
delete: P("named.delete"),
|
|
395
|
+
cancel: P("named.cancel"),
|
|
396
|
+
save: P("named.save"),
|
|
397
|
+
search: P("named.search"),
|
|
398
|
+
clearSearch: P("named.clearSearch"),
|
|
399
|
+
noMatches: P("named.noMatches")
|
|
400
|
+
},
|
|
401
|
+
getItems: (e) => e.getNames().getItems(),
|
|
402
|
+
subscribe: (e, t) => {
|
|
403
|
+
const n = e.getNames().addListeners({
|
|
404
|
+
onCollectionChange: () => t.onChange(),
|
|
405
|
+
onInvalidated: () => t.onChange()
|
|
406
|
+
}, { transactional: !1 }), a = e.addListeners({
|
|
407
|
+
onSheetsChange: () => t.onChange(),
|
|
408
|
+
onProtectionChange: () => t.onChange()
|
|
409
|
+
}, { transactional: !1 });
|
|
410
|
+
return () => {
|
|
411
|
+
n?.(), a?.();
|
|
412
|
+
};
|
|
413
|
+
},
|
|
414
|
+
isReadOnly: (e) => !e.getProtection().isStructureAllowed(),
|
|
415
|
+
isItemReadOnly: (e, t) => !t.getProtection().isStructureAllowed() || "table" === q(e) || e.isReadOnly(),
|
|
416
|
+
getItemKey: (e) => e.getId(),
|
|
417
|
+
subscribeItem: (e, t) => e.addListeners({
|
|
418
|
+
onAnyChange: () => t(),
|
|
419
|
+
onInvalidated: () => t()
|
|
420
|
+
}, { transactional: !1 }),
|
|
421
|
+
createDraft: F,
|
|
422
|
+
save: H,
|
|
423
|
+
delete: (e) => {
|
|
424
|
+
e.delete?.();
|
|
425
|
+
},
|
|
426
|
+
select: (e) => {
|
|
427
|
+
Promise.resolve(e.select()).catch(() => {});
|
|
428
|
+
},
|
|
429
|
+
getSearchText: (e, t) => [
|
|
430
|
+
e.getName(),
|
|
431
|
+
A(e),
|
|
432
|
+
e.getScope() ?? t("named.scopeWorkbook"),
|
|
433
|
+
e.getComment() ?? ""
|
|
434
|
+
].join("\n"),
|
|
435
|
+
getCardTitle: (e) => e.getName(),
|
|
436
|
+
CardMedia: ({ item: e }) => v(K, {
|
|
437
|
+
kind: q(e),
|
|
438
|
+
size: 32
|
|
439
|
+
}),
|
|
440
|
+
CardSubtitle: ({ item: e }) => v(V, {
|
|
441
|
+
named: e,
|
|
442
|
+
label: null,
|
|
443
|
+
helperText: null
|
|
444
|
+
}),
|
|
445
|
+
CardBody: (t) => v(_, {
|
|
446
|
+
...t,
|
|
447
|
+
workbook: e
|
|
448
|
+
}),
|
|
449
|
+
EditorBody: ({ draft: e, workbook: t }) => v(U, {
|
|
450
|
+
draft: e,
|
|
451
|
+
workbook: t
|
|
452
|
+
})
|
|
453
|
+
}))(a), [a]), u = x(() => 0 === s.count ? null : v(w, {
|
|
454
|
+
size: "small",
|
|
455
|
+
sx: {
|
|
456
|
+
textTransform: "none",
|
|
457
|
+
width: "100%"
|
|
458
|
+
},
|
|
459
|
+
onClick: () => {
|
|
460
|
+
s.remove().catch((e) => {
|
|
461
|
+
d.showMessage?.(e.message, { type: l.Error });
|
|
462
|
+
});
|
|
463
|
+
},
|
|
464
|
+
children: i("named.removeUnusedHidden", { count: s.count })
|
|
465
|
+
}), [
|
|
466
|
+
s,
|
|
467
|
+
d,
|
|
468
|
+
i
|
|
469
|
+
]);
|
|
470
|
+
return v(e, {
|
|
471
|
+
ref: n,
|
|
472
|
+
workbook: a,
|
|
473
|
+
descriptor: g,
|
|
474
|
+
args: r,
|
|
475
|
+
footer: u,
|
|
476
|
+
...o
|
|
477
|
+
});
|
|
478
|
+
}));
|
|
479
|
+
G.displayName = "NamedDetailsPanel";
|
|
480
|
+
var J = (e) => {
|
|
481
|
+
const { model: t, entryKey: n, frame: a, args: r, ref: o, ...i } = e;
|
|
482
|
+
return v(G, {
|
|
483
|
+
ref: o,
|
|
484
|
+
workbook: t,
|
|
485
|
+
args: r,
|
|
486
|
+
...i
|
|
487
|
+
});
|
|
488
|
+
};
|
|
489
|
+
export { J as NamedDetailsTaskPane };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.12
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { memo as t, useMemo as r, useRef as e } from "react";
|
|
8
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
9
|
+
import { Box as o } from "@mui/material";
|
|
10
|
+
import i from "clsx";
|
|
11
|
+
import { DndContext as a, MouseSensor as s, TouchSensor as l, closestCenter as c, useSensor as d, useSensors as u } from "@dnd-kit/core";
|
|
12
|
+
import { restrictToVerticalAxis as m } from "@dnd-kit/modifiers";
|
|
13
|
+
import { SortableContext as f, useSortable as g, verticalListSortingStrategy as p } from "@dnd-kit/sortable";
|
|
14
|
+
import { CSS as b, useIsomorphicLayoutEffect as y } from "@dnd-kit/utilities";
|
|
15
|
+
var x = "data-sxl-flip", v = t((t) => {
|
|
16
|
+
const { ids: o, onMove: i, scrollRef: g, children: b } = t, y = u(d(s, { activationConstraint: { distance: 6 } }), d(l, { activationConstraint: {
|
|
17
|
+
delay: 200,
|
|
18
|
+
tolerance: 6
|
|
19
|
+
} })), v = e(null), h = r(() => [m, ({ draggingNodeRect: t, transform: r }) => {
|
|
20
|
+
const e = v.current;
|
|
21
|
+
return t && e ? t.top + r.y < e.top ? {
|
|
22
|
+
...r,
|
|
23
|
+
y: e.top - t.top
|
|
24
|
+
} : t.bottom + r.y > e.bottom ? {
|
|
25
|
+
...r,
|
|
26
|
+
y: e.bottom - t.bottom
|
|
27
|
+
} : r : r;
|
|
28
|
+
}], []);
|
|
29
|
+
return n(a, {
|
|
30
|
+
sensors: y,
|
|
31
|
+
collisionDetection: c,
|
|
32
|
+
modifiers: h,
|
|
33
|
+
onDragStart: () => {
|
|
34
|
+
v.current = ((t) => {
|
|
35
|
+
if (!t) return null;
|
|
36
|
+
const r = t.querySelectorAll(`[${x}]`);
|
|
37
|
+
if (0 === r.length) return null;
|
|
38
|
+
let e = 1 / 0, n = -1 / 0;
|
|
39
|
+
for (let t = 0; t < r.length; t++) {
|
|
40
|
+
const o = r[t].getBoundingClientRect();
|
|
41
|
+
o.top < e && (e = o.top), o.bottom > n && (n = o.bottom);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
top: e,
|
|
45
|
+
bottom: n
|
|
46
|
+
};
|
|
47
|
+
})(g.current);
|
|
48
|
+
},
|
|
49
|
+
onDragCancel: () => {
|
|
50
|
+
v.current = null;
|
|
51
|
+
},
|
|
52
|
+
autoScroll: { canScroll: (t) => {
|
|
53
|
+
if (t === document.scrollingElement || t === document.documentElement || t === document.body) return !1;
|
|
54
|
+
const r = g.current;
|
|
55
|
+
return !!r && (t === r || t.contains(r));
|
|
56
|
+
} },
|
|
57
|
+
onDragEnd: (t) => {
|
|
58
|
+
v.current = null;
|
|
59
|
+
const { active: r, over: e } = t;
|
|
60
|
+
if (!e || r.id === e.id) return;
|
|
61
|
+
const n = o.indexOf(String(r.id)), a = o.indexOf(String(e.id));
|
|
62
|
+
-1 !== n && -1 !== a && n !== a && i(n, a);
|
|
63
|
+
},
|
|
64
|
+
children: n(f, {
|
|
65
|
+
items: o,
|
|
66
|
+
strategy: p,
|
|
67
|
+
children: b
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
function h(t, r, n) {
|
|
72
|
+
const o = e(/* @__PURE__ */ new Map());
|
|
73
|
+
y(() => {
|
|
74
|
+
if (!r || !t.current) return void (o.current = /* @__PURE__ */ new Map());
|
|
75
|
+
const e = o.current, i = /* @__PURE__ */ new Map(), a = [], s = t.current.querySelectorAll(`[${x}]`);
|
|
76
|
+
for (let t = 0; t < s.length; t++) {
|
|
77
|
+
const r = s[t], n = r.getAttribute(x), o = r.offsetTop;
|
|
78
|
+
i.set(n, o);
|
|
79
|
+
const l = e.get(n);
|
|
80
|
+
void 0 !== l && l !== o && a.push({
|
|
81
|
+
element: r,
|
|
82
|
+
delta: l - o
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (o.current = i, 0 !== a.length) if (n.current) n.current = !1;
|
|
86
|
+
else {
|
|
87
|
+
for (const { element: t, delta: r } of a) t.style.transition = "none", t.style.transform = `translateY(${r}px)`;
|
|
88
|
+
t.current.offsetHeight;
|
|
89
|
+
for (const { element: t } of a) t.style.transition = "transform 200ms ease", t.style.transform = "", t.addEventListener("transitionend", function r() {
|
|
90
|
+
t.style.transition = "", t.removeEventListener("transitionend", r);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
v.displayName = "SortableCards";
|
|
96
|
+
var S = t((t) => {
|
|
97
|
+
const { id: e, disabled: a, children: s } = t, { setNodeRef: l, transform: c, transition: d, isDragging: u, listeners: m } = g({
|
|
98
|
+
id: e,
|
|
99
|
+
disabled: a
|
|
100
|
+
}), f = r(() => {
|
|
101
|
+
if (!m) return m;
|
|
102
|
+
const t = {};
|
|
103
|
+
for (const [r, e] of Object.entries(m)) t[r] = (t, ...r) => {
|
|
104
|
+
(t?.target)?.closest?.("button, input, textarea, select, a[href], [contenteditable=\"true\"], [role=\"combobox\"]") || e(t, ...r);
|
|
105
|
+
};
|
|
106
|
+
return t;
|
|
107
|
+
}, [m]);
|
|
108
|
+
return n(o, {
|
|
109
|
+
ref: l,
|
|
110
|
+
...f,
|
|
111
|
+
[x]: e,
|
|
112
|
+
className: i("sxl-sortable-card", {
|
|
113
|
+
"sxl-dragging": u,
|
|
114
|
+
"sxl-drag-disabled": a
|
|
115
|
+
}),
|
|
116
|
+
sx: {
|
|
117
|
+
flex: "0 0 auto",
|
|
118
|
+
borderRadius: (t) => t.spacing(1.25),
|
|
119
|
+
boxShadow: u ? 6 : void 0,
|
|
120
|
+
...a ? null : {
|
|
121
|
+
cursor: u ? "grabbing" : "grab",
|
|
122
|
+
"&:active": { cursor: "grabbing" }
|
|
123
|
+
},
|
|
124
|
+
...u ? {
|
|
125
|
+
"& *": { cursor: "grabbing !important" },
|
|
126
|
+
backgroundColor: (t) => t.palette.background.paper
|
|
127
|
+
} : null
|
|
128
|
+
},
|
|
129
|
+
style: {
|
|
130
|
+
transform: b.Translate.toString(c),
|
|
131
|
+
transition: d,
|
|
132
|
+
touchAction: "manipulation",
|
|
133
|
+
...u ? {
|
|
134
|
+
position: "relative",
|
|
135
|
+
zIndex: 1
|
|
136
|
+
} : null
|
|
137
|
+
},
|
|
138
|
+
children: s
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
S.displayName = "SortableCard";
|
|
142
|
+
export { v as n, h as r, S as t };
|