@sheetxl/studio-mui 0.8.0-beta.11 → 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.
Files changed (121) hide show
  1. package/browser/esm/{DTpRkgsTm_zYnWfW.mjs → 0IBZhOJaVmzJxuTv.mjs} +1 -1
  2. package/browser/esm/{LZoYSQAYV2wksnDv.mjs → 2nRxqrNYbmEn8fS8.mjs} +5 -5
  3. package/browser/esm/{DDc6rDuU9JAo1DH_.mjs → 7fVZXXuonYb6Z7FU.mjs} +3 -3
  4. package/browser/esm/{DpD4fg2WcyiKX_2K.mjs → BAzhmMX4Fk_qnUTp.mjs} +5 -5
  5. package/browser/esm/{CBD4RiRKbbZtSXV-.mjs → BGL3x0W74D7qZXlf.mjs} +3 -3
  6. package/browser/esm/{D9ISy7VkaRRFJl46.mjs → BHGr2gsFofTdAFxq.mjs} +4 -4
  7. package/browser/esm/{BknfGJouygmnpFIU.mjs → BKhcJI-G15D3kGap.mjs} +2 -2
  8. package/browser/esm/{CyLn6zOOp_biA3xU.mjs → BNbub9weuqm3mcoF.mjs} +8 -8
  9. package/browser/esm/{CWkOgdL7mOKiTR62.mjs → BSv9MVJaz1DVEffm.mjs} +4 -4
  10. package/browser/esm/{BAbq4-I5f5oUiNaF.mjs → BWfLpYmd3cSgJ0C6.mjs} +4 -4
  11. package/browser/esm/{0BWO0bLZ8Vm_dKd2.mjs → BZqwbIE8qzjSOYcJ.mjs} +13 -13
  12. package/browser/esm/{ttjcNHcFn8O6hfnd.mjs → BZy9xUrYpAtnKeji.mjs} +11 -11
  13. package/browser/esm/{COlZu93LRwuBvjE-.mjs → BnkwC5rsg9LZyhoP.mjs} +2 -2
  14. package/browser/esm/{BvhYPwX3GrRaO9CM.mjs → BpJsBv413cNQpyg0.mjs} +3 -3
  15. package/browser/esm/{DDczwkXhz_MHub4z.mjs → BpVrgbVISiTDyFR3.mjs} +2 -2
  16. package/browser/esm/{DRSCS6aLiYmPjUz1.mjs → BsngRDhvVYGVBJeK.mjs} +365 -362
  17. package/browser/esm/{Ds3XRkne7HxcXD8J.mjs → C29TKq47CbXs652l.mjs} +2 -2
  18. package/browser/esm/{BXhNFzyEGokTF-BL.mjs → C8p2iMad_NNCwGI_.mjs} +2 -2
  19. package/browser/esm/{G0Inqm6Eqw47dMpa.mjs → CBzXksWnb-1gGEWZ.mjs} +1 -1
  20. package/browser/esm/{zqilJefihVd7At2T.mjs → CFIAWgpU3UyepLBn.mjs} +7 -7
  21. package/browser/esm/{DG21x7RKDpge6zAE.mjs → CJD4jF4m9cBGHzr_.mjs} +1 -1
  22. package/browser/esm/{C9pIZVACtl9unFOp.mjs → CMc7G7cevxzPGxr9.mjs} +2 -2
  23. package/browser/esm/{HViD4Wfoi0mmqk9w.mjs → CYtULLhY9M2m3DeH.mjs} +1 -1
  24. package/browser/esm/{Buqcl7J75MJrhpVE.mjs → CeF35ZeFP28Do5Zx.mjs} +8 -8
  25. package/browser/esm/{D3rRUK4dIM5gUSmj.mjs → CjYKDxU4EP2Kf_vo.mjs} +2 -2
  26. package/browser/esm/{BlE_8o8tO2AgAlaj.mjs → Cq82lvdjyBvlJ8xJ.mjs} +1 -1
  27. package/browser/esm/{DEv4pIEgYr5C7etm.mjs → CuRxFAO42JkQvMEx.mjs} +1 -1
  28. package/browser/esm/{C8JU4KsMasmLvojI.mjs → Cvk2yY90hpgXWMAt.mjs} +1 -1
  29. package/browser/esm/{CynTY0oNtyJnoaBq.mjs → D0slJycx3nq53qmf.mjs} +1 -1
  30. package/browser/esm/{DKtJxrpN0axtuQ0l.mjs → D2jzliMwAo2ENpfi.mjs} +1 -1
  31. package/browser/esm/{DdcZrjMLWVukWcU5.mjs → D5Fn0Hqllwv5HY6i.mjs} +768 -660
  32. package/browser/esm/{Bujtz_Guj88d03vI.mjs → D5N4nGaZsXtrHAOh.mjs} +6 -6
  33. package/browser/esm/{ChSVxkPTIjgcC8PL.mjs → D7AqPfyhMiuda5l5.mjs} +2 -2
  34. package/browser/esm/{BED6h6YAwCf1HEQJ.mjs → DHZA48ZMCETvHmeP.mjs} +1 -1
  35. package/browser/esm/{Di3BUxA0SqFWWgeg.mjs → DX2_vf7WX6uRLaOZ.mjs} +1 -1
  36. package/browser/esm/{DnGaP5F7mLwCGUYG.mjs → DaxpbAF1ShkT7hNU.mjs} +206 -124
  37. package/browser/esm/{YThnrg3PadGs7B4j.mjs → Db3oHfXiRtcH015t.mjs} +143 -137
  38. package/browser/esm/{C0wlMAIn9iREPK6w.mjs → Dt47Huh1l3C4_5_w.mjs} +1 -1
  39. package/browser/esm/{xFqkfN8QMCxvsetB.mjs → DtPt0phL7m56YfHZ.mjs} +1 -1
  40. package/browser/esm/{CTjqDD-swFMZzI-Y.mjs → DtTDaXmnWUoG4VBO.mjs} +2 -2
  41. package/browser/esm/{Brsh5yscJ_4uKFXp.mjs → DuuyN4-7K6_io2Py.mjs} +2 -2
  42. package/browser/esm/{w_JrR69vEpvoyeMy.mjs → NeGeLF3gbGMZyV6E.mjs} +1 -1
  43. package/browser/esm/{BokqKEpU6TFgfRs6.mjs → PY3Br5Bo_TxcCnCU.mjs} +2 -2
  44. package/browser/esm/{DV6i9RQZfJiKtEaJ.mjs → WIhvQtBkGiw-oFUs.mjs} +636 -622
  45. package/browser/esm/{DJOOed_OtB-XT7f3.mjs → WgIvwAENeO8LANax.mjs} +6 -6
  46. package/browser/esm/{BjvD_4t2KGsZP5V8.mjs → Yjq3p_7eVGFw2Jod.mjs} +3 -3
  47. package/browser/esm/index.mjs +290 -287
  48. package/browser/esm/{QgaAIDUMmBQBsXP9.mjs → jFRFCWlkD7Dsrhkh.mjs} +84 -84
  49. package/browser/esm/{BYE9gCDWKyx6mnVs.mjs → lKXEDVt2ow1NlWJj.mjs} +114 -103
  50. package/browser/esm/{CEtXsBzEjEKk9GOj.mjs → oC0OwOddhOD0OoCJ.mjs} +2 -2
  51. package/browser/esm/{DsoNMWDwHZP8UXQd.mjs → tIKqpsA0vNXH9EgU.mjs} +1 -1
  52. package/browser/esm/{ClBvNPeNCAhuVWrG.mjs → u84rSnESjxqB6gay.mjs} +1 -1
  53. package/node/esm/{DMXLxp3T0E0SRTQc.mjs → B8Ls4Eh1k8-Yiry_.mjs} +1 -1
  54. package/node/esm/{3WghtBXAvCDwcVrq.mjs → B9X3n8MglL4OitAV.mjs} +1 -1
  55. package/node/esm/{XEDcegsv5AGKBfu2.mjs → BBGoyqs2L_ccSH1e.mjs} +2 -2
  56. package/node/esm/{zITjZ7R4raDqhP-n.mjs → BLv99aovW4R3C5PE.mjs} +3 -3
  57. package/node/esm/{DfCuL8AUxMFoEG2s.mjs → BUGU_5lUtnCRlp3n.mjs} +36 -36
  58. package/node/esm/{BNg4QQY0WAPLE0q7.mjs → BalROFG_oa9PFs9Q.mjs} +3 -3
  59. package/node/esm/{Bph-sR3l6AYWeuxK.mjs → BqVxnA1mo52ubjdf.mjs} +2 -2
  60. package/node/esm/{CZyA9uD4SkTvqp_G.mjs → C3FCh9xju2SccUIE.mjs} +253 -253
  61. package/node/esm/{Do-zCKziWhoG5eAv.mjs → C4F6WY8M4nkLyxdb.mjs} +2 -2
  62. package/node/esm/{CSAnTp5rwId0DUb8.mjs → CKWeipCqqpLnLE5e.mjs} +127 -116
  63. package/node/esm/{DLqBHdFp6wvm6EGs.mjs → CTnVNfz4eqFnM92M.mjs} +1 -1
  64. package/node/esm/{BPzcW4BejRqso338.mjs → Cfi_ly8fBDZZdiZT.mjs} +3 -3
  65. package/node/esm/{Db3dbaYLKUO66T9s.mjs → CgKa6JuyJ1tTodev.mjs} +414 -400
  66. package/node/esm/{4HmLH0bPVJCZLgik.mjs → Cq53M7bAUSXMNq1f.mjs} +1 -1
  67. package/node/esm/{1bf4gn-2vld4BZ9u.mjs → Cr8AYWUoU-XVt0hu.mjs} +1 -1
  68. package/node/esm/CyuOE595I2e-U4cG.mjs +236 -0
  69. package/node/esm/{D-xqQ5qOSd6WrzwJ.mjs → D72CupF9mfy2D1Xa.mjs} +1 -1
  70. package/node/esm/{CyafafEgfmjLqE5O.mjs → DGDHFK8okuVbRCe5.mjs} +1 -1
  71. package/node/esm/{DpJ2gmZJioCyq8La.mjs → DJFkALt4XrwkMbnU.mjs} +166 -160
  72. package/node/esm/{CPq-MIdEnc-53JpF.mjs → DJpwI8PlKBI2rk0r.mjs} +2 -2
  73. package/node/esm/{DWqvf4H5F2wMnZ0L.mjs → DQaGPUYbgL4Y5YZW.mjs} +1 -1
  74. package/node/esm/{CYIoK22I6Yvv12_x.mjs → DsNYnq4NtYBxPmeA.mjs} +1 -1
  75. package/node/esm/{yCUxQuqVuC4DHKPx.mjs → DygDgOpa9sJ6YFVS.mjs} +1 -1
  76. package/node/esm/Dz0Hg87UcJ-awwiI.mjs +489 -0
  77. package/node/esm/{BIMkjQUwG4Ih-6Sh.mjs → M7YxvRPGCuxuk9aK.mjs} +1 -1
  78. package/node/esm/{CWcv7UVXF8IUB0PC.mjs → QNjtpX8rIpqGGLEJ.mjs} +15 -15
  79. package/node/esm/{DdEzhVqYTrGODXrz.mjs → ZzvsynJTCSuChYS-.mjs} +1 -1
  80. package/node/esm/{CjC6s3RUJQNCF7mP.mjs → di_8-pXh90j4BO4j.mjs} +1 -1
  81. package/node/esm/{CvRbu8JPxFarsSR-.mjs → dm8dmEaTIqfmgyeL.mjs} +5 -5
  82. package/node/esm/{CuMePia6i_8yfJ6S.mjs → fmya3XQnTGyQisvT.mjs} +9 -9
  83. package/node/esm/{BR45ogAR-hY2bE60.mjs → gPYAb_A0T5ZwcQ1E.mjs} +1 -1
  84. package/node/esm/index.mjs +2817 -2702
  85. package/node/esm/{DeZJlLk8WJ3BLtLs.mjs → wB8xMpyJ_NvE16yG.mjs} +3 -3
  86. package/node/esm/{BlN7G0DVC24zauig.mjs → zGAcd4Jr7wkvXDBS.mjs} +1 -1
  87. package/package.json +9 -9
  88. package/resources/locales/de/groups.cmd.json +4 -0
  89. package/resources/locales/de/ui.msg.json +3 -1
  90. package/resources/locales/en/groups.cmd.json +4 -0
  91. package/resources/locales/en/ui.msg.json +3 -1
  92. package/types/src/border/BorderPopupButton.d.ts +1 -1
  93. package/types/src/color/ColorPopupButton.d.ts +1 -1
  94. package/types/src/command/AccountingStyleCommandButton.d.ts +1 -1
  95. package/types/src/command/DocThemeCommandButton.d.ts +1 -1
  96. package/types/src/command/FontFamilyCommandButton.d.ts +1 -1
  97. package/types/src/command/FontSizeCommandButton.d.ts +1 -1
  98. package/types/src/command/InsertCellControlCommandButton.d.ts +17 -0
  99. package/types/src/command/LanguageCommandButton.d.ts +1 -1
  100. package/types/src/command/LocaleCommandButton.d.ts +1 -1
  101. package/types/src/command/index.d.ts +1 -0
  102. package/types/src/conditionalFormat/IconPickerPopupButton.d.ts +1 -1
  103. package/types/src/conditions/ConditionEditor.d.ts +1 -1
  104. package/types/src/conditions/OperatorAndParamEditor.d.ts +1 -1
  105. package/types/src/conditions/OperatorSelectPopupButton.d.ts +1 -1
  106. package/types/src/fill/PatternPopupButton.d.ts +1 -1
  107. package/types/src/formulaBar/IFormulaBar.d.ts +4 -2
  108. package/types/src/itemsPanel/ItemsPanel.d.ts +5 -0
  109. package/types/src/named/NamedDetailsPanel.d.ts +2 -2
  110. package/types/src/statusBar/PendingStatus.d.ts +19 -0
  111. package/types/src/statusBar/index.d.ts +1 -0
  112. package/types/src/studio/StudioProps.d.ts +10 -10
  113. package/types/src/template/TemplatePanel.d.ts +5 -1
  114. package/types/src/theme/ThemeSelectPopupButton.d.ts +1 -1
  115. package/types/src/toolbar/WorkbookToolbars.d.ts +1 -1
  116. package/types/src/workbook/DefaultRenderers.d.ts +30 -18
  117. package/types/src/workbook/WorkbookElement.d.ts +5 -4
  118. package/types/src/workbook/WorkbookStrip.d.ts +8 -7
  119. package/types/src/workbook/index.d.ts +1 -1
  120. package/node/esm/B0bdb_6p7fQI_ivo.mjs +0 -236
  121. package/node/esm/DatM6eEYPpAtIMy-.mjs +0 -405
@@ -1,236 +0,0 @@
1
- /**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.11
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 { FormulaField as e, InputField as t } from "./index.mjs";
8
- import { useReferenceMode as n } from "@sheetxl/react";
9
- import { useCallbackRef as l, useTranslator as r } from "@sheetxl/utils-react";
10
- import { memo as s, useEffect as o, useId as a, useMemo as i, useRef as u, useState as d } from "react";
11
- import { OptionsDialog as p } from "@sheetxl/utils-mui";
12
- import { Fragment as c, jsx as m, jsxs as g } from "react/jsx-runtime";
13
- import { Box as h, FormControl as f, InputLabel as y, MenuItem as x, Select as b, TextField as k } from "@mui/material";
14
- var T = ["Ok", "Cancel"], C = { paddingTop: (e) => e.spacing(1.5) }, v = "mailto:", I = (e) => e.length >= 7 && e.substring(0, 7).toLowerCase() === v, F = (e) => {
15
- if (!I(e)) return null;
16
- const t = e.substring(7), n = t.indexOf("?");
17
- if (-1 === n) return {
18
- address: t,
19
- subject: ""
20
- };
21
- let l = "";
22
- try {
23
- l = new URLSearchParams(t.substring(n + 1)).get("subject") ?? "";
24
- } catch {}
25
- return {
26
- address: t.substring(0, n),
27
- subject: l
28
- };
29
- }, O = s((s) => {
30
- const { initialValue: O = null, context: D, onInput: P, onOption: j, onValidateOption: w, onDone: M, options: W = T, defaultOption: $ = W?.[0], cancelOption: E = "Cancel", sx: R, ...A } = s, H = r(), L = i(() => null !== (O ?? D?.()?.getHyperlink()), []), S = i(() => {
31
- let e = null, t = null;
32
- O && ("string" == typeof O ? t = O : e = O);
33
- const n = e ? null : D?.()?.getHyperlink();
34
- return {
35
- address: t ?? e?.address ?? n?.getAddress() ?? "",
36
- textToDisplay: e?.textToDisplay ?? n?.getTextToDisplay() ?? ""
37
- };
38
- }, [O, D]), V = S.address.startsWith("#"), z = i(() => F(S.address), [S.address]), [B, N] = d(V ? "document" : z ? "email" : "url"), [U, q] = d(V || z ? "" : S.address), [G, J] = d(z?.address ?? ""), [K, Q] = d(z?.subject ?? ""), [X, Y] = d(() => V && S.address.substring(1) || null), [Z, _] = d(V ? S.address.substring(1) : ""), [ee, te] = d(null), [ne, le] = d(() => {
39
- const e = D?.().getText({ useFormattingCategory: !0 }) ?? S.textToDisplay;
40
- return e === S.address || z && e === z.address ? "" : e;
41
- }), [re, se] = d(!1), oe = a(), ae = u(null), ie = u(null), ue = l(() => {
42
- ae.current?.querySelector("input.autoFocus")?.focus(), ie.current?.engage();
43
- }, []), de = u(B);
44
- o(() => {
45
- de.current !== B && (de.current = B, ue());
46
- }, [B]);
47
- const pe = i(() => {
48
- const e = D?.()?.getWorksheet()?.getName();
49
- return e ? { scope: e } : void 0;
50
- }, [D]), ce = "point" === n().getMode()?.mode, me = l((e) => {
51
- le(e.target.value);
52
- }, []), ge = l(() => {
53
- if ("document" === B) {
54
- if ("string" == typeof X) {
55
- const e = X.trim();
56
- return e ? `#${e}` : null;
57
- }
58
- const e = X?.getReferences()?.getAddress();
59
- return e ? `#${e}` : null;
60
- }
61
- return "email" === B ? ((e, t) => {
62
- let n = e.trim();
63
- if (I(n) && (n = n.substring(7)), !n) return null;
64
- const l = t.trim();
65
- return `${v}${n}${l ? `?subject=${encodeURIComponent(l)}` : ""}`;
66
- })(G, K) : "" === U ? null : U;
67
- }, [
68
- B,
69
- X,
70
- U,
71
- G,
72
- K
73
- ]), he = l(async (e) => {
74
- const t = e === E;
75
- if (!t) {
76
- const e = ge();
77
- let t = e;
78
- e?.startsWith("#") ? t = e.substring(1) : "email" === B && e && (t = F(e)?.address ?? e), P?.({
79
- address: e,
80
- textToDisplay: ("" === ne ? t : ne) ?? null
81
- });
82
- }
83
- j?.(e, t, e === $), M?.();
84
- }, [
85
- ge,
86
- B,
87
- ne,
88
- P,
89
- M,
90
- j,
91
- $,
92
- E
93
- ]), fe = l(async (e) => !1 !== await Promise.resolve(w?.(e)) && ("document" !== B || !ee), [
94
- w,
95
- B,
96
- ee
97
- ]), ye = "document" === B ? Z : "email" === B ? G : U;
98
- return m(p, {
99
- title: H(L ? "hyperlink.titleEdit" : "hyperlink.titleInsert"),
100
- options: W,
101
- onDone: M,
102
- onOption: (e) => he(e),
103
- onValidateOption: fe,
104
- defaultOption: $,
105
- cancelOption: E,
106
- autoFocusSel: ".autoFocus",
107
- suspendModal: ce,
108
- sx: {
109
- width: "480px",
110
- ...R
111
- },
112
- ...A,
113
- children: g(h, {
114
- ref: ae,
115
- sx: {
116
- paddingTop: (e) => e.spacing(1),
117
- paddingBottom: (e) => e.spacing(0),
118
- rowGap: (e) => e.spacing(1),
119
- display: "flex",
120
- flexDirection: "column"
121
- },
122
- children: [
123
- g(f, {
124
- sx: {
125
- minWidth: 135,
126
- width: "100%"
127
- },
128
- size: "small",
129
- children: [m(y, {
130
- id: oe,
131
- children: H("hyperlink.linkTo")
132
- }), g(b, {
133
- labelId: oe,
134
- value: B,
135
- label: H("hyperlink.linkTo"),
136
- MenuProps: {
137
- disableRestoreFocus: !0,
138
- slotProps: { transition: { onExited: ue } },
139
- container: () => document.fullscreenElement
140
- },
141
- onChange: (e) => {
142
- N(e.target.value);
143
- },
144
- children: [
145
- m(x, {
146
- value: "url",
147
- children: H("hyperlink.typeWebPage")
148
- }),
149
- m(x, {
150
- value: "document",
151
- children: H("hyperlink.typeInDocument")
152
- }),
153
- m(x, {
154
- value: "email",
155
- children: H("hyperlink.typeEmail")
156
- })
157
- ]
158
- })]
159
- }),
160
- "email" === B ? g(c, { children: [m(t, {
161
- sx: C,
162
- label: H("hyperlink.emailAddress"),
163
- defaultInput: H("hyperlink.emailPlaceholder"),
164
- value: G,
165
- onChangeInput: (e) => J(e),
166
- onFocus: (e) => {
167
- re || e.target?.select?.(), se(!0);
168
- }
169
- }), m(t, {
170
- label: H("hyperlink.subject"),
171
- defaultInput: "",
172
- value: K,
173
- onChangeInput: (e) => Q(e),
174
- onFocus: () => se(!0)
175
- })] }) : "document" === B ? m(e, {
176
- sx: C,
177
- grammar: "reference",
178
- apiRef: ie,
179
- classNameInput: "autoFocus",
180
- label: H("hyperlink.reference"),
181
- value: X,
182
- allowMulti: !1,
183
- home: pe,
184
- onChangeInput: (e) => Y(e),
185
- onChangeText: (e) => _(e),
186
- onChangeError: (e) => te(e),
187
- onFocus: (e) => {
188
- re || e.target?.select?.(), se(!0);
189
- }
190
- }) : m(t, {
191
- sx: C,
192
- label: H("hyperlink.address"),
193
- defaultInput: H("hyperlink.addressPlaceholder"),
194
- value: U,
195
- onChangeInput: (e) => q(e),
196
- onFocus: (e) => {
197
- re || e.target?.select?.(), se(!0);
198
- }
199
- }),
200
- m(f, {
201
- sx: {
202
- paddingTop: (e) => e.spacing(1.5),
203
- minWidth: 135,
204
- width: "100%"
205
- },
206
- size: "small",
207
- children: m(k, {
208
- label: H("hyperlink.displayText"),
209
- placeholder: ye,
210
- onFocus: () => {
211
- se(!0);
212
- },
213
- sx: { "& .MuiFormHelperText-root": { marginTop: (e) => e.spacing(.5) } },
214
- slotProps: {
215
- inputLabel: { shrink: !0 },
216
- htmlInput: {
217
- spellCheck: !1,
218
- autoComplete: "off",
219
- sx: {
220
- paddingTop: (e) => e.spacing(1.25),
221
- paddingBottom: (e) => e.spacing(.75)
222
- }
223
- }
224
- },
225
- value: ne,
226
- onChange: me,
227
- onContextMenu: (e) => {
228
- e.stopPropagation();
229
- }
230
- })
231
- })
232
- ]
233
- })
234
- });
235
- });
236
- export { O as HyperlinkDialog, O as default };
@@ -1,405 +0,0 @@
1
- /**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.11
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 "./CSAnTp5rwId0DUb8.mjs";
8
- import { FormulaField as a, InputField as n, PresetChip as t, f 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 p, useCallback as h, useMemo as u, useState as x } from "react";
12
- import { Fragment as f, jsx as b, jsxs as y } from "react/jsx-runtime";
13
- import { Box as v, Checkbox as k, FormControlLabel as C, FormHelperText as w, MenuItem as N, Paper as R, TextField as T, Typography as S } from "@mui/material";
14
- import { messageKey as E, t as I } from "@sheetxl/utils";
15
- var H = (e) => "formula" === e.getType(), L = (e) => {
16
- try {
17
- return H(e) ? String(e.getValue() ?? "") : e.getRanges?.()?.toString() ?? "";
18
- } catch (e) {
19
- return "";
20
- }
21
- }, P = (e) => {
22
- try {
23
- return e.getRanges(e.getWorksheet().getSelectedRange()).getFixed(!0).toString();
24
- } catch (e) {
25
- return "";
26
- }
27
- }, W = (e, a) => a ? {
28
- name: a.getName(),
29
- expression: L(a),
30
- scope: a.getScope(),
31
- comment: a.getComment() ?? "",
32
- hidden: a.isHidden(),
33
- editable: H(a)
34
- } : {
35
- name: e.getNames().findValidName("Name"),
36
- expression: P(e),
37
- scope: null,
38
- comment: "",
39
- hidden: !1,
40
- editable: !0
41
- }, z = (e, a, n) => {
42
- const t = a.name.trim(), r = a.expression.trim().replace(/^=\s*/, "").trim(), o = a.comment.trim(), i = a.scope || null;
43
- if (!t) throw new Error(I("error.named.nameEmpty"));
44
- if (!r) throw new Error(I("named.expressionRequired"));
45
- if (null !== n) {
46
- if (t.toLowerCase() !== n.getName().toLowerCase() && e.getNames().validateName(t, i ?? void 0), (n.getScope() ?? null) !== i) {
47
- if (!a.editable || !n.delete) throw new Error(I("error.named.nameReadonly"));
48
- const d = e.getTransactions().beginCommit({ description: I("op.updateNamed", { name: t }) });
49
- try {
50
- n.delete(), e.getCalculation().getNamedFormulas().add({
51
- name: t,
52
- expression: r,
53
- scope: i,
54
- comment: o || void 0,
55
- hidden: a.hidden || void 0
56
- }), d.commit();
57
- } catch (e) {
58
- throw d.rollback(), e;
59
- }
60
- return;
61
- }
62
- n.doBatch(() => {
63
- t !== n.getName() && n.setName(t), a.editable && r !== L(n) && n.setExpression(r), (n.getComment() ?? "") !== o && n.setComment(o || null), n.isHidden() !== a.hidden && n.setHidden?.(a.hidden);
64
- }, { description: I("op.updateNamed", { name: t }) });
65
- } else e.getCalculation().getNamedFormulas().add({
66
- name: t,
67
- expression: r,
68
- scope: i,
69
- comment: o || void 0,
70
- hidden: a.hidden || void 0
71
- });
72
- }, A = {
73
- table: "Table",
74
- range: "NamedRange",
75
- formula: "Function"
76
- }, F = {
77
- table: E("named.kindTable"),
78
- range: E("named.kindRange"),
79
- formula: E("named.kindFormula")
80
- }, O = (e) => {
81
- if (!H(e)) return "table";
82
- try {
83
- return e.getRanges?.() ? "range" : "formula";
84
- } catch (e) {
85
- return "formula";
86
- }
87
- }, j = p((e) => {
88
- const { kind: a, size: n = 28, ...r } = e, o = c();
89
- return b(t, {
90
- className: "sxl-named-kind-chip",
91
- title: o(F[a]),
92
- sx: {
93
- width: "auto",
94
- minWidth: 1.7 * n + "px",
95
- height: `${n}px`,
96
- color: "table" === a ? "primary.main" : "text.secondary"
97
- },
98
- ...r,
99
- children: b(d, {
100
- iconKey: A[a],
101
- size: Math.round(.7 * n)
102
- })
103
- });
104
- });
105
- j.displayName = "NamedKindChip";
106
- var q = "workbook", K = p((e) => {
107
- const { draft: t, workbook: o } = e, i = c(), [d] = x(() => t.name), [l] = x(() => t.expression), [m, g] = x(null), [p, h] = x(() => t.scope), [f, E] = x(() => t.comment), [I, H] = x(() => t.hidden), [L, P] = x(() => t.editable ? ((e, a) => {
108
- const n = a.trim().replace(/^=\s*/, "");
109
- if (!n) return "formula";
110
- try {
111
- return e.createFormula(n, void 0, { target: "display" }).isReferenceOnly() ? "range" : "formula";
112
- } catch (e) {
113
- return "formula";
114
- }
115
- })(o, t.expression) : "table"), W = !t.editable, z = s((e) => {
116
- e.trim().toLowerCase() !== d.toLowerCase() && o.getNames().validateName(e.trim(), p ?? void 0);
117
- }, [
118
- o,
119
- d,
120
- p
121
- ]), A = u(() => {
122
- try {
123
- return o.getWorksheets().getItems().map((e) => e.getName());
124
- } catch (e) {
125
- return [];
126
- }
127
- }, [o]);
128
- return b(R, {
129
- tabIndex: 0,
130
- className: r["editor-panel"],
131
- sx: {
132
- gap: (e) => e.spacing(1),
133
- paddingTop: (e) => e.spacing(1.25),
134
- paddingBottom: (e) => e.spacing(2),
135
- paddingLeft: (e) => e.spacing(1.5),
136
- paddingRight: (e) => e.spacing(1.5),
137
- border: (e) => `1px solid ${e.palette.divider}`,
138
- borderRadius: (e) => e.spacing(1.25),
139
- overflow: "auto"
140
- },
141
- children: y(v, {
142
- sx: {
143
- display: "flex",
144
- flexDirection: "column",
145
- gap: (e) => e.spacing(2),
146
- margin: (e) => e.spacing(1.25)
147
- },
148
- children: [
149
- y(v, { children: [y(v, {
150
- sx: {
151
- display: "flex",
152
- alignItems: "flex-end",
153
- gap: (e) => e.spacing(1.5)
154
- },
155
- children: [b(j, {
156
- kind: L,
157
- size: 48
158
- }), b(n, {
159
- label: i("named.name"),
160
- sx: {
161
- flex: "1 1 auto",
162
- minWidth: 0
163
- },
164
- helperText: null,
165
- showError: !1,
166
- onChangeError: g,
167
- disabled: W,
168
- value: d,
169
- onValidate: z,
170
- onChangeText: (e) => {
171
- t.name = e;
172
- }
173
- })]
174
- }), b(w, {
175
- error: !!m,
176
- sx: {
177
- marginTop: (e) => e.spacing(.5),
178
- marginX: "14px"
179
- },
180
- children: m ? i(m) : " "
181
- })] }),
182
- b(a, {
183
- label: i("named.refersTo"),
184
- value: l,
185
- workbook: o,
186
- disabled: W,
187
- helperText: i("named.refersToHelp"),
188
- equals: "required",
189
- pickAs: "absolute",
190
- onChangeText: (e) => {
191
- t.expression = e;
192
- },
193
- onChangeInput: (e) => {
194
- e && P(e.isReferenceOnly() ? "range" : "formula");
195
- }
196
- }),
197
- y(T, {
198
- label: i("named.scope"),
199
- size: "small",
200
- fullWidth: !0,
201
- select: !0,
202
- disabled: W,
203
- value: p ?? q,
204
- helperText: i("named.scopeHelp"),
205
- onChange: (e) => {
206
- const a = e.target.value === q ? null : e.target.value;
207
- h(a), t.scope = a;
208
- },
209
- children: [b(N, {
210
- value: q,
211
- children: i("named.scopeWorkbook")
212
- }), A.map((e) => b(N, {
213
- value: e,
214
- children: e
215
- }, e))]
216
- }),
217
- b(T, {
218
- label: i("named.comment"),
219
- size: "small",
220
- fullWidth: !0,
221
- multiline: !0,
222
- minRows: 2,
223
- maxRows: 4,
224
- disabled: W,
225
- value: f,
226
- onChange: (e) => {
227
- E(e.target.value), t.comment = e.target.value;
228
- }
229
- }),
230
- b(C, {
231
- control: b(k, {
232
- size: "small",
233
- disabled: W,
234
- checked: I,
235
- onChange: (e) => {
236
- H(e.target.checked), t.hidden = e.target.checked;
237
- }
238
- }),
239
- label: b(S, {
240
- variant: "body2",
241
- children: i("named.hidden")
242
- })
243
- }),
244
- b(S, {
245
- variant: "caption",
246
- sx: {
247
- color: "text.secondary",
248
- marginTop: "-12px"
249
- },
250
- children: i("named.hiddenHelp")
251
- }),
252
- W ? b(S, {
253
- variant: "caption",
254
- sx: {
255
- color: "text.secondary",
256
- fontStyle: "italic"
257
- },
258
- children: i("named.derivedReadOnly")
259
- }) : null
260
- ]
261
- })
262
- });
263
- });
264
- K.displayName = "NamedEditorPanel";
265
- var M = p((e) => {
266
- const { named: n, label: t, helperText: r } = e, d = c(), s = m(), g = i();
267
- o(n, ["onAnyChange", "onRangesChange"]);
268
- const p = H(n) && !n.isReadOnly() && (g?.getProtection().isStructureAllowed() ?? !0), u = h((e, a) => {
269
- if ("accept" !== a.reason) return;
270
- const t = e?.getExpression()?.trim();
271
- if (t && t !== L(n)) try {
272
- n.setExpression(t);
273
- } catch (e) {
274
- s.showMessage?.(e.message, { type: l.Error });
275
- }
276
- }, [n, s]);
277
- return b(a, {
278
- value: L(n),
279
- equals: "required",
280
- pickAs: "absolute",
281
- changeOn: "done",
282
- onDone: u,
283
- label: void 0 === t ? d("named.refersTo") : t,
284
- helperText: r,
285
- disabled: !p
286
- });
287
- });
288
- M.displayName = "NamedExpressionField";
289
- var B = ({ item: e }) => {
290
- const a = c(), n = e.getScope(), t = e.getComment(), r = [n ? a("named.scopedTo", { scope: n }) : a("named.scopeWorkbook")];
291
- return e.isHidden() && r.push(a("named.hidden")), y(f, { children: [b(S, {
292
- variant: "caption",
293
- sx: { color: (e) => e.palette.text.secondary },
294
- children: r.join(" · ")
295
- }), t ? b(S, {
296
- variant: "caption",
297
- sx: {
298
- color: (e) => e.palette.text.secondary,
299
- fontStyle: "italic"
300
- },
301
- children: t
302
- }) : null] });
303
- }, D = p(g((a, n) => {
304
- const { workbook: t, args: r, ...o } = a, i = c(), [d, l] = x(!1), s = u(() => ((e) => ({
305
- key: "named",
306
- messageKeys: {
307
- none: E("named.none"),
308
- addPrompt: E("named.addPrompt"),
309
- heading: E("named.heading"),
310
- insert: E("named.insert"),
311
- new: E("named.new"),
312
- edit: E("named.edit"),
313
- delete: E("named.delete"),
314
- cancel: E("named.cancel"),
315
- save: E("named.save"),
316
- search: E("named.search"),
317
- clearSearch: E("named.clearSearch"),
318
- noMatches: E("named.noMatches")
319
- },
320
- getItems: (a) => a.getNames().getItems({ includeHidden: e }),
321
- subscribe: (e, a) => {
322
- const n = e.getNames().addListeners({
323
- onCollectionChange: () => a.onChange(),
324
- onInvalidated: () => a.onChange()
325
- }, { transactional: !1 }), t = e.addListeners({
326
- onSheetsChange: () => a.onChange(),
327
- onProtectionChange: () => a.onChange()
328
- }, { transactional: !1 });
329
- return () => {
330
- n?.(), t?.();
331
- };
332
- },
333
- isReadOnly: (e) => !e.getProtection().isStructureAllowed(),
334
- isItemReadOnly: (e, a) => !a.getProtection().isStructureAllowed() || "table" === O(e) || e.isReadOnly(),
335
- getItemKey: (e) => e.getId(),
336
- subscribeItem: (e, a) => e.addListeners({
337
- onAnyChange: () => a(),
338
- onInvalidated: () => a()
339
- }, { transactional: !1 }),
340
- createDraft: W,
341
- save: z,
342
- delete: (e) => {
343
- e.delete?.();
344
- },
345
- select: (e) => {
346
- Promise.resolve(e.select()).catch(() => {});
347
- },
348
- getSearchText: (e, a) => [
349
- e.getName(),
350
- L(e),
351
- e.getScope() ?? a("named.scopeWorkbook"),
352
- e.getComment() ?? ""
353
- ].join("\n"),
354
- getCardTitle: (e) => e.getName(),
355
- CardMedia: ({ item: e }) => b(j, {
356
- kind: O(e),
357
- size: 32
358
- }),
359
- CardSubtitle: ({ item: e }) => b(M, {
360
- named: e,
361
- label: null,
362
- helperText: null
363
- }),
364
- CardBody: B,
365
- EditorBody: ({ draft: e, workbook: a }) => b(K, {
366
- draft: e,
367
- workbook: a
368
- })
369
- }))(d), [d]), m = u(() => b(C, {
370
- sx: {
371
- flex: "0 0 auto",
372
- marginLeft: 0,
373
- marginRight: 0,
374
- whiteSpace: "nowrap"
375
- },
376
- control: b(k, {
377
- size: "small",
378
- checked: d,
379
- onChange: (e) => l(e.target.checked)
380
- }),
381
- label: b(S, {
382
- variant: "caption",
383
- children: i("named.showHidden")
384
- })
385
- }), [d, i]);
386
- return b(e, {
387
- ref: n,
388
- workbook: t,
389
- descriptor: s,
390
- args: r,
391
- listActions: m,
392
- ...o
393
- });
394
- }));
395
- D.displayName = "NamedDetailsPanel";
396
- var V = (e) => {
397
- const { model: a, entryKey: n, frame: t, args: r, ref: o, ...i } = e;
398
- return b(D, {
399
- ref: o,
400
- workbook: a,
401
- args: r,
402
- ...i
403
- });
404
- };
405
- export { V as NamedDetailsTaskPane };