@sheetxl/studio-mui 0.8.0-beta.10 → 0.8.0-beta.11

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 (119) hide show
  1. package/browser/esm/0BWO0bLZ8Vm_dKd2.mjs +582 -0
  2. package/browser/esm/BAbq4-I5f5oUiNaF.mjs +141 -0
  3. package/browser/esm/BED6h6YAwCf1HEQJ.mjs +161 -0
  4. package/browser/esm/{CEvZe2cZK-voZTif.mjs → BXhNFzyEGokTF-BL.mjs} +5 -5
  5. package/browser/esm/BYE9gCDWKyx6mnVs.mjs +381 -0
  6. package/browser/esm/{DBtc4lku0uHVcqWn.mjs → BjvD_4t2KGsZP5V8.mjs} +3 -3
  7. package/browser/esm/{DU3J8Gcf-WpBxNYg.mjs → BknfGJouygmnpFIU.mjs} +4 -4
  8. package/browser/esm/{D8al_cJ4U-NgzwoK.mjs → BlE_8o8tO2AgAlaj.mjs} +19 -17
  9. package/browser/esm/BokqKEpU6TFgfRs6.mjs +252 -0
  10. package/browser/esm/{DHY19rkSiiRZxShC.mjs → Brsh5yscJ_4uKFXp.mjs} +3 -3
  11. package/browser/esm/Bujtz_Guj88d03vI.mjs +831 -0
  12. package/browser/esm/Buqcl7J75MJrhpVE.mjs +1379 -0
  13. package/browser/esm/BvhYPwX3GrRaO9CM.mjs +319 -0
  14. package/browser/esm/C0wlMAIn9iREPK6w.mjs +87 -0
  15. package/browser/esm/C8JU4KsMasmLvojI.mjs +103 -0
  16. package/browser/esm/{CjznclrKqJRi7u9O.mjs → C9pIZVACtl9unFOp.mjs} +2 -2
  17. package/browser/esm/CBD4RiRKbbZtSXV-.mjs +318 -0
  18. package/browser/esm/{Blaj2R5hYxtLAW__.mjs → CEtXsBzEjEKk9GOj.mjs} +6 -6
  19. package/browser/esm/{CIu1bjPJe_x31Oww.mjs → COlZu93LRwuBvjE-.mjs} +3 -3
  20. package/browser/esm/{CoSiOS-og0zFw4Ws.mjs → CTjqDD-swFMZzI-Y.mjs} +2 -2
  21. package/browser/esm/CWkOgdL7mOKiTR62.mjs +975 -0
  22. package/browser/esm/ChSVxkPTIjgcC8PL.mjs +412 -0
  23. package/browser/esm/{5cbK03T_Oh3tNdR7.mjs → ClBvNPeNCAhuVWrG.mjs} +1 -1
  24. package/browser/esm/CyLn6zOOp_biA3xU.mjs +335 -0
  25. package/browser/esm/CynTY0oNtyJnoaBq.mjs +14 -0
  26. package/browser/esm/{xKiLJKiLxto8SayF.mjs → D3rRUK4dIM5gUSmj.mjs} +2 -2
  27. package/browser/esm/D9ISy7VkaRRFJl46.mjs +515 -0
  28. package/browser/esm/{fb126BNj3F8URR19.mjs → DDc6rDuU9JAo1DH_.mjs} +3 -3
  29. package/browser/esm/DDczwkXhz_MHub4z.mjs +197 -0
  30. package/browser/esm/{X1Db3b_7b_7OuCk6.mjs → DEv4pIEgYr5C7etm.mjs} +1 -1
  31. package/browser/esm/DG21x7RKDpge6zAE.mjs +31 -0
  32. package/browser/esm/DJOOed_OtB-XT7f3.mjs +437 -0
  33. package/browser/esm/{9eKCkvqpMQwqcXiw.mjs → DKtJxrpN0axtuQ0l.mjs} +1 -1
  34. package/browser/esm/DRSCS6aLiYmPjUz1.mjs +1543 -0
  35. package/browser/esm/{ByeL_BZuJ2kl8gtf.mjs → DTpRkgsTm_zYnWfW.mjs} +1 -1
  36. package/browser/esm/DV6i9RQZfJiKtEaJ.mjs +2552 -0
  37. package/browser/esm/DdcZrjMLWVukWcU5.mjs +7473 -0
  38. package/browser/esm/Di3BUxA0SqFWWgeg.mjs +94 -0
  39. package/browser/esm/DnGaP5F7mLwCGUYG.mjs +408 -0
  40. package/browser/esm/DpD4fg2WcyiKX_2K.mjs +414 -0
  41. package/browser/esm/{C1Rp2hZrApo5MUc8.mjs → Ds3XRkne7HxcXD8J.mjs} +2 -2
  42. package/browser/esm/{sFOAxZpxXo-qvDSp.mjs → DsoNMWDwHZP8UXQd.mjs} +1 -1
  43. package/browser/esm/G0Inqm6Eqw47dMpa.mjs +212 -0
  44. package/browser/esm/{B1Yp_uy1vFHcJB3U.mjs → HViD4Wfoi0mmqk9w.mjs} +1 -1
  45. package/browser/esm/LZoYSQAYV2wksnDv.mjs +386 -0
  46. package/browser/esm/{CtEFHbzYNvYjDYvi.mjs → QgaAIDUMmBQBsXP9.mjs} +8 -8
  47. package/browser/esm/{D6S8kVTzOjCn0-SK.mjs → YThnrg3PadGs7B4j.mjs} +51 -51
  48. package/browser/esm/index.mjs +1028 -170
  49. package/browser/esm/ttjcNHcFn8O6hfnd.mjs +1288 -0
  50. package/browser/esm/{yZxC4qUENOlMhVUH.mjs → w_JrR69vEpvoyeMy.mjs} +1 -1
  51. package/browser/esm/{DmCQbW4zwkT_Rq88.mjs → xFqkfN8QMCxvsetB.mjs} +1 -1
  52. package/browser/esm/{IQLeaAbtGTipUsOD.mjs → zqilJefihVd7At2T.mjs} +22 -21
  53. package/licenses/dependencies.txt +94 -94
  54. package/node/esm/{BYsG3KYVmxSe_CIQ.mjs → 1bf4gn-2vld4BZ9u.mjs} +1 -1
  55. package/node/esm/{CKu1AtRgyltyEdEN.mjs → 3WghtBXAvCDwcVrq.mjs} +1 -1
  56. package/node/esm/{cqzp431iNSLWictb.mjs → 4HmLH0bPVJCZLgik.mjs} +22 -22
  57. package/node/esm/{BYVLi0md4AYuDsB_.mjs → B0bdb_6p7fQI_ivo.mjs} +28 -28
  58. package/node/esm/BIMkjQUwG4Ih-6Sh.mjs +142 -0
  59. package/node/esm/BNg4QQY0WAPLE0q7.mjs +141 -0
  60. package/node/esm/BPzcW4BejRqso338.mjs +72 -0
  61. package/node/esm/BR45ogAR-hY2bE60.mjs +318 -0
  62. package/node/esm/BlN7G0DVC24zauig.mjs +197 -0
  63. package/node/esm/{ah3CUg4-VmNstGk_.mjs → Bph-sR3l6AYWeuxK.mjs} +2 -2
  64. package/node/esm/CPq-MIdEnc-53JpF.mjs +319 -0
  65. package/node/esm/CSAnTp5rwId0DUb8.mjs +380 -0
  66. package/node/esm/CWcv7UVXF8IUB0PC.mjs +1379 -0
  67. package/node/esm/{D9rzScOA9pEYFrtz.mjs → CYIoK22I6Yvv12_x.mjs} +20 -20
  68. package/node/esm/CZyA9uD4SkTvqp_G.mjs +1283 -0
  69. package/node/esm/{ci8d-mF1H9wnYzix.mjs → CjC6s3RUJQNCF7mP.mjs} +1 -1
  70. package/node/esm/{D6oQL8knsPpgdXuk.mjs → CuMePia6i_8yfJ6S.mjs} +9 -9
  71. package/node/esm/CvRbu8JPxFarsSR-.mjs +412 -0
  72. package/node/esm/{DNSjK5DAH3M14Qbc.mjs → CyafafEgfmjLqE5O.mjs} +1 -1
  73. package/node/esm/D-xqQ5qOSd6WrzwJ.mjs +94 -0
  74. package/node/esm/DLqBHdFp6wvm6EGs.mjs +212 -0
  75. package/node/esm/{BcwMb6CyVfvEwbHn.mjs → DMXLxp3T0E0SRTQc.mjs} +1 -1
  76. package/node/esm/{DZzvTQxIKr9LbEsA.mjs → DWqvf4H5F2wMnZ0L.mjs} +32 -30
  77. package/node/esm/DatM6eEYPpAtIMy-.mjs +405 -0
  78. package/node/esm/Db3dbaYLKUO66T9s.mjs +1689 -0
  79. package/node/esm/{B_jRGdwGFkudwmL-.mjs → DdEzhVqYTrGODXrz.mjs} +1 -1
  80. package/node/esm/DeZJlLk8WJ3BLtLs.mjs +975 -0
  81. package/node/esm/DfCuL8AUxMFoEG2s.mjs +519 -0
  82. package/node/esm/{Bb1sLMqXWKjdve23.mjs → Do-zCKziWhoG5eAv.mjs} +2 -2
  83. package/node/esm/{B8SQfjKjzYHLxzZR.mjs → DpJ2gmZJioCyq8La.mjs} +67 -67
  84. package/node/esm/{ETK6T6G0SIcFXDe5.mjs → XEDcegsv5AGKBfu2.mjs} +40 -40
  85. package/node/esm/index.mjs +8941 -13558
  86. package/node/esm/yCUxQuqVuC4DHKPx.mjs +385 -0
  87. package/node/esm/zITjZ7R4raDqhP-n.mjs +515 -0
  88. package/package.json +9 -9
  89. package/resources/locales/de/ui.msg.json +97 -0
  90. package/resources/locales/en/ui.msg.json +97 -0
  91. package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +4 -4
  92. package/types/src/anomalies/AnomaliesPlugin.d.ts +5 -0
  93. package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
  94. package/types/src/anomalies/index.d.ts +3 -0
  95. package/types/src/border/BorderTemplateIcon.d.ts +6 -1
  96. package/types/src/chart/ChartFormatPanel.d.ts +20 -0
  97. package/types/src/chart/ChartPlugin.d.ts +6 -0
  98. package/types/src/chart/index.d.ts +3 -0
  99. package/types/src/comments/CommentCard.d.ts +2 -2
  100. package/types/src/conditions/useFormulaOption.d.ts +2 -2
  101. package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
  102. package/types/src/format/BorderPreview.d.ts +11 -4
  103. package/types/src/format/useFormatSelection.d.ts +4 -4
  104. package/types/src/formulaBar/MobileFormulaBar.d.ts +18 -6
  105. package/types/src/formulaBar/MobileInputToolbar.d.ts +9 -3
  106. package/types/src/formulaBar/useFormulaBarSession.d.ts +6 -3
  107. package/types/src/index.d.ts +15 -6
  108. package/types/src/protection/ProtectedCellsPanel.d.ts +2 -2
  109. package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
  110. package/types/src/protection/index.d.ts +1 -1
  111. package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +2 -2
  112. package/types/src/workbook/DefaultRenderers.d.ts +2 -2
  113. package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
  114. package/browser/esm/Biy7bhzzzPb5sfRN.mjs +0 -152
  115. package/browser/esm/COv-m-c2byCgvU3M.mjs +0 -14861
  116. package/browser/esm/Die9NXVFveHvcCT-.mjs +0 -4205
  117. package/browser/esm/sam1KGQZ59B_fADz.mjs +0 -1941
  118. package/node/esm/BYwXhrEwkRAt9nJS.mjs +0 -71
  119. package/node/esm/Cmt8Wv806N7NmE4Y.mjs +0 -3344
@@ -0,0 +1,975 @@
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 { i as e } from "./BokqKEpU6TFgfRs6.mjs";
8
+ import { t } from "./C0wlMAIn9iREPK6w.mjs";
9
+ import { n, t as r } from "./BAbq4-I5f5oUiNaF.mjs";
10
+ import { ICellRange as i } from "@sheetxl/sdk";
11
+ import { promptUnlockProtectedRanges as a, useModelListener as o, useModelSync as s } from "@sheetxl/react";
12
+ import { DynamicIcon as c, NotifierType as l, useNotifier as u, useTranslator as d } from "@sheetxl/utils-react";
13
+ import { forwardRef as f, memo as p, useCallback as m, useReducer as h, useState as g } from "react";
14
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
15
+ import { Accordion as y, AccordionDetails as b, AccordionSummary as x, Alert as S, Box as C, Button as w, Checkbox as T, FormControlLabel as E, Paper as D, Switch as O, Tab as k, Tabs as A, TextField as j, Typography as M } from "@mui/material";
16
+ import { messageKey as N } from "@sheetxl/utils";
17
+ var P = /* @__PURE__ */ new WeakMap(), F = p((n) => {
18
+ let { protectedRange: i } = n, a = d();
19
+ s(i, "onAnyChange");
20
+ let o = i.isProtected(), [c, l] = g(() => i.getName()), [u] = g(() => i.getName()), [f, p] = g(null), [m, h] = g(() => i.hasPassword()), y = (() => {
21
+ try {
22
+ let e = i.getRanges();
23
+ return e.isInvalid() ? null : e.getWorksheet().getProtectedRanges();
24
+ } catch {
25
+ return null;
26
+ }
27
+ })(), b = () => {
28
+ let e = c.trim();
29
+ if (!e) return void p(a("protectedRange.nameRequired"));
30
+ let t = y?.getItems({ name: e })[0];
31
+ if (t && t.getName().toLocaleLowerCase() !== u.toLocaleLowerCase()) p(a("protectedRange.nameTaken", { name: e }));
32
+ else if (e !== i.getName()) try {
33
+ i.setName(e), p(null);
34
+ } catch (e) {
35
+ p(e?.message ?? a("protectedRange.nameRequired"));
36
+ }
37
+ else p(null);
38
+ };
39
+ return _(D, {
40
+ tabIndex: 0,
41
+ className: e["editor-panel"],
42
+ sx: {
43
+ gap: (e) => e.spacing(1),
44
+ paddingTop: (e) => e.spacing(1.25),
45
+ paddingBottom: (e) => e.spacing(2),
46
+ paddingLeft: (e) => e.spacing(1.5),
47
+ paddingRight: (e) => e.spacing(1.5),
48
+ border: (e) => `1px solid ${e.palette.divider}`,
49
+ borderRadius: (e) => e.spacing(1.25),
50
+ overflow: "auto"
51
+ },
52
+ children: v(C, {
53
+ sx: {
54
+ display: "flex",
55
+ flexDirection: "column",
56
+ gap: (e) => e.spacing(2),
57
+ margin: (e) => e.spacing(1.25)
58
+ },
59
+ children: [
60
+ _(j, {
61
+ label: a("protectedRange.name"),
62
+ size: "small",
63
+ fullWidth: !0,
64
+ disabled: o,
65
+ value: c,
66
+ error: f !== null,
67
+ helperText: f ?? void 0,
68
+ onChange: (e) => {
69
+ l(e.target.value), p(null);
70
+ },
71
+ onBlur: b,
72
+ onKeyDown: (e) => {
73
+ e.key === "Enter" && b();
74
+ }
75
+ }),
76
+ _(r, {
77
+ item: i,
78
+ label: a("protectedRange.applyTo")
79
+ }),
80
+ _(t, {
81
+ label: a("protectedRange.password"),
82
+ description: a("protectedRange.passwordHelp"),
83
+ hasPassword: m,
84
+ disabled: o,
85
+ onSet: (e) => {
86
+ h(!0), P.set(i, e);
87
+ },
88
+ onClear: () => {
89
+ h(!1), P.set(i, null);
90
+ }
91
+ }),
92
+ i.getSecurityDescriptor() ? _(M, {
93
+ variant: "caption",
94
+ sx: {
95
+ color: "text.secondary",
96
+ fontStyle: "italic"
97
+ },
98
+ children: a("protectedRange.hasPermissions")
99
+ }) : null
100
+ ]
101
+ })
102
+ });
103
+ });
104
+ F.displayName = "ProtectedRangeEditorPanel";
105
+ var I = {
106
+ color: (e) => e.palette.text.secondary,
107
+ fontStyle: "italic",
108
+ minWidth: 0
109
+ }, L = {
110
+ key: "protected-range",
111
+ messageKeys: {
112
+ none: N("protectedRange.none"),
113
+ addPrompt: N("protectedRange.addPrompt"),
114
+ insert: N("protectedRange.insert"),
115
+ new: N("protectedRange.new"),
116
+ edit: N("protectedRange.edit"),
117
+ duplicate: N("protectedRange.duplicate"),
118
+ delete: N("protectedRange.delete"),
119
+ cancel: N("protectedRange.cancel"),
120
+ save: N("protectedRange.save")
121
+ },
122
+ getCollection: (e) => e.getProtectedRanges(),
123
+ changeEvents: ["onProtectedRangesChange"],
124
+ isReadOnly: (e) => e.getProtection().isLocked(),
125
+ reorderable: !1,
126
+ beforeSave: (e) => (async (e) => {
127
+ if (!P.has(e)) return;
128
+ let t = P.get(e);
129
+ P.delete(e), await e.setPassword(t);
130
+ })(e),
131
+ applyUpdate: (e, t) => {
132
+ e.update(t);
133
+ },
134
+ getCardTitle: (e, t) => e.getName() || t("protectedRange.unnamed"),
135
+ CardMedia: () => _(c, {
136
+ iconKey: "LockRange",
137
+ size: 24,
138
+ ariaHidden: !0
139
+ }),
140
+ CardBody: ({ item: e }) => {
141
+ let t = d(), n = u(), r = e.getRanges(), i = r.isInvalid() ? null : r.getWorksheet();
142
+ if (s(e, ["onUnlockChange"]), s(i, ["onProtectionChange"]), !e.hasPassword()) return null;
143
+ if (!i?.getProtection().isLocked()) return _(M, {
144
+ variant: "caption",
145
+ sx: I,
146
+ children: t("protectedRange.passwordRequired")
147
+ });
148
+ let o = e.isUnlocked();
149
+ return v(C, {
150
+ sx: {
151
+ display: "grid",
152
+ gridTemplateColumns: "minmax(0, 1fr) auto",
153
+ alignItems: "center",
154
+ columnGap: (e) => e.spacing(1)
155
+ },
156
+ children: [_(M, {
157
+ variant: "caption",
158
+ sx: I,
159
+ children: t(o ? "protectedRange.unlocked" : "protectedRange.passwordRequired")
160
+ }), _(w, {
161
+ size: "small",
162
+ color: o ? "inherit" : "primary",
163
+ sx: { textTransform: "none" },
164
+ onClick: () => {
165
+ o ? e.relock() : a(n, [e]);
166
+ },
167
+ children: t(o ? "protectedRange.lock" : "protectedRange.unlock")
168
+ })]
169
+ });
170
+ },
171
+ EditorBody: ({ item: e }) => _(F, { protectedRange: e })
172
+ }, R = p(f((e, t) => {
173
+ let { workbook: r, args: i, ...a } = e;
174
+ return _(n, {
175
+ ref: t,
176
+ workbook: r,
177
+ descriptor: L,
178
+ args: i,
179
+ ...a
180
+ });
181
+ }));
182
+ R.displayName = "ProtectedRangeDetailsPanel";
183
+ var z = Object.freeze([
184
+ {
185
+ key: "selectLockedCells",
186
+ messageKey: N("sheetProtection.option.selectLockedCells"),
187
+ defaultValue: !0
188
+ },
189
+ {
190
+ key: "selectUnlockedCells",
191
+ messageKey: N("sheetProtection.option.selectUnlockedCells"),
192
+ defaultValue: !0
193
+ },
194
+ {
195
+ key: "formatCells",
196
+ messageKey: N("sheetProtection.option.formatCells")
197
+ },
198
+ {
199
+ key: "formatColumns",
200
+ messageKey: N("sheetProtection.option.formatColumns")
201
+ },
202
+ {
203
+ key: "formatRows",
204
+ messageKey: N("sheetProtection.option.formatRows")
205
+ },
206
+ {
207
+ key: "insertColumns",
208
+ messageKey: N("sheetProtection.option.insertColumns")
209
+ },
210
+ {
211
+ key: "insertRows",
212
+ messageKey: N("sheetProtection.option.insertRows")
213
+ },
214
+ {
215
+ key: "insertHyperlinks",
216
+ messageKey: N("sheetProtection.option.insertHyperlinks")
217
+ },
218
+ {
219
+ key: "deleteColumns",
220
+ messageKey: N("sheetProtection.option.deleteColumns")
221
+ },
222
+ {
223
+ key: "deleteRows",
224
+ messageKey: N("sheetProtection.option.deleteRows")
225
+ },
226
+ {
227
+ key: "sort",
228
+ messageKey: N("sheetProtection.option.sort")
229
+ },
230
+ {
231
+ key: "autoTable",
232
+ messageKey: N("sheetProtection.option.autoFilter")
233
+ },
234
+ {
235
+ key: "pivotTables",
236
+ messageKey: N("sheetProtection.option.pivotTables")
237
+ },
238
+ {
239
+ key: "objects",
240
+ messageKey: N("sheetProtection.option.objects")
241
+ },
242
+ {
243
+ key: "scenarios",
244
+ messageKey: N("sheetProtection.option.scenarios")
245
+ },
246
+ {
247
+ key: "showFormulas",
248
+ messageKey: N("sheetProtection.option.showFormulas"),
249
+ defaultValue: !0
250
+ }
251
+ ]), B = (e) => {
252
+ let t = e.getProperties() ?? {}, n = {};
253
+ for (let e of z) n[e.key] = !0 === (t[e.key] ?? e.defaultValue ?? !1);
254
+ return n;
255
+ }, V = p(f((e, n) => {
256
+ let { sheet: r, ...i } = e, a = d(), o = u(), f = r.getProtection(), p = r.getView();
257
+ s(r, ["onProtectionChange"]), s(p, ["onAnyChange"]);
258
+ let h = f.isPaused(), D = f.isLocked() || h, k = f.hasPassword(), [A, j] = g(null), [N, P] = g(!1), F = B(f), I = f.isLocked(), L = m((e) => {
259
+ o.showMessage?.(e?.message ?? String(e), { type: l.Error });
260
+ }, [o]), R = m(async (e) => {
261
+ let t = await o.showInput({
262
+ title: a("dialog.password.title"),
263
+ description: e,
264
+ options: ["Ok", "Cancel"],
265
+ defaultOption: "Ok",
266
+ cancelOption: "Cancel",
267
+ inputType: "password"
268
+ });
269
+ return t?.option === "Ok" ? t.input ?? "" : null;
270
+ }, [o, a]), V = m((e, t) => {
271
+ f.setProperties({
272
+ ...B(f),
273
+ [e]: t
274
+ }).catch(L);
275
+ }, [f, L]), H = m(async (e) => {
276
+ try {
277
+ if (!e) {
278
+ let e;
279
+ if (f.hasPassword()) {
280
+ let t = await R(a("dialog.password.description"));
281
+ if (t === null) return;
282
+ e = t || void 0;
283
+ }
284
+ await f.unlock(e), j(null);
285
+ return;
286
+ }
287
+ await f.lock(void 0, A || void 0), j(null);
288
+ } catch (e) {
289
+ L(e);
290
+ }
291
+ }, [
292
+ f,
293
+ R,
294
+ a,
295
+ A,
296
+ L
297
+ ]), U = m(async () => {
298
+ try {
299
+ if (f.isPaused()) return void f.resume();
300
+ let e;
301
+ if (f.hasPassword()) {
302
+ let t = await R(a("dialog.password.pauseDescription"));
303
+ if (t === null) return;
304
+ e = t || void 0;
305
+ }
306
+ await f.pause(e);
307
+ } catch (e) {
308
+ L(e);
309
+ }
310
+ }, [
311
+ f,
312
+ R,
313
+ a,
314
+ L
315
+ ]), W = m((e) => {
316
+ j(e);
317
+ }, []), G = m(() => {
318
+ j(null);
319
+ }, []);
320
+ return v(C, {
321
+ ref: n,
322
+ ...i,
323
+ sx: {
324
+ display: "flex",
325
+ flexDirection: "column",
326
+ width: "100%",
327
+ minWidth: 0,
328
+ flex: "1 1 auto",
329
+ minHeight: 0,
330
+ overflowX: "hidden",
331
+ overflowY: "auto",
332
+ boxSizing: "border-box",
333
+ gap: (e) => e.spacing(2),
334
+ paddingTop: (e) => e.spacing(1.5),
335
+ paddingBottom: (e) => e.spacing(1.5),
336
+ paddingLeft: (e) => e.spacing(2),
337
+ paddingRight: (e) => e.spacing(2)
338
+ },
339
+ children: [
340
+ v(C, {
341
+ sx: {
342
+ display: "flex",
343
+ flexDirection: "column",
344
+ minWidth: 0
345
+ },
346
+ children: [
347
+ _(E, {
348
+ control: _(O, {
349
+ checked: D,
350
+ onChange: (e) => {
351
+ H(e.target.checked);
352
+ }
353
+ }),
354
+ label: a("sheetProtection.protect")
355
+ }),
356
+ _(C, {
357
+ sx: {
358
+ display: "flex",
359
+ alignItems: "center",
360
+ minHeight: "38px"
361
+ },
362
+ children: _(w, {
363
+ size: "small",
364
+ variant: "outlined",
365
+ color: "inherit",
366
+ disabled: !D,
367
+ startIcon: _(c, {
368
+ iconKey: h ? "Lock" : "LockOpen",
369
+ size: 18,
370
+ ariaHidden: !0
371
+ }),
372
+ onClick: () => {
373
+ U();
374
+ },
375
+ sx: { textTransform: "none" },
376
+ children: a(h ? "sheetProtection.resume" : "sheetProtection.pause")
377
+ })
378
+ }),
379
+ h ? _(S, {
380
+ severity: "warning",
381
+ sx: {
382
+ marginTop: (e) => e.spacing(.5),
383
+ marginBottom: (e) => e.spacing(1)
384
+ },
385
+ children: a("sheetProtection.pausedBanner")
386
+ }) : null,
387
+ _(E, {
388
+ control: _(O, {
389
+ checked: p.isShowLockedShading(),
390
+ onChange: (e) => {
391
+ p.setShowLockedShading(e.target.checked);
392
+ }
393
+ }),
394
+ label: a("sheetProtection.highlightLocked")
395
+ })
396
+ ]
397
+ }),
398
+ _(t, {
399
+ label: a("sheetProtection.passwordHeading"),
400
+ description: a("sheetProtection.passwordDescription"),
401
+ hasPassword: D ? k : A !== null,
402
+ note: D || A === null ? void 0 : a("sheetProtection.passwordPending"),
403
+ disabled: D,
404
+ onSet: W,
405
+ onClear: G
406
+ }),
407
+ v(y, {
408
+ expanded: N,
409
+ onChange: (e, t) => P(t),
410
+ disableGutters: !0,
411
+ elevation: 0,
412
+ sx: {
413
+ backgroundColor: "action.hover",
414
+ border: 1,
415
+ borderColor: "divider",
416
+ borderRadius: 1,
417
+ "&:before": { display: "none" },
418
+ "&.Mui-expanded": { margin: 0 },
419
+ ...N ? {
420
+ flex: "1 1 auto",
421
+ minHeight: 0,
422
+ display: "flex",
423
+ flexDirection: "column",
424
+ "& .MuiCollapse-root": {
425
+ flex: "1 1 auto",
426
+ minHeight: 0,
427
+ display: "flex"
428
+ },
429
+ "& .MuiCollapse-wrapper": {
430
+ flex: "1 1 auto",
431
+ minHeight: 0,
432
+ display: "flex"
433
+ },
434
+ "& .MuiCollapse-wrapperInner": {
435
+ flex: "1 1 auto",
436
+ minHeight: 0,
437
+ display: "flex"
438
+ },
439
+ "& .MuiAccordion-region": {
440
+ flex: "1 1 auto",
441
+ minHeight: 0,
442
+ display: "flex",
443
+ flexDirection: "column"
444
+ },
445
+ "& .MuiAccordionDetails-root": {
446
+ flex: "1 1 auto",
447
+ minHeight: 0,
448
+ display: "flex",
449
+ flexDirection: "column"
450
+ }
451
+ } : { flex: "0 0 auto" }
452
+ },
453
+ children: [_(x, {
454
+ expandIcon: _(c, { iconKey: "ExpandMore" }),
455
+ sx: {
456
+ px: 2,
457
+ "& .MuiAccordionSummary-content": { my: 0 },
458
+ "&.Mui-expanded .MuiAccordionSummary-content": { my: 0 }
459
+ },
460
+ children: _(M, {
461
+ variant: "subtitle2",
462
+ sx: { alignSelf: "center" },
463
+ children: a("sheetProtection.optionsHeading")
464
+ })
465
+ }), v(b, {
466
+ sx: {
467
+ px: 2,
468
+ pt: 0,
469
+ pb: 2,
470
+ display: "flex",
471
+ flexDirection: "column"
472
+ },
473
+ children: [I ? _(M, {
474
+ variant: "caption",
475
+ sx: {
476
+ color: "text.secondary",
477
+ pb: 1
478
+ },
479
+ children: a("sheetProtection.optionsLocked")
480
+ }) : null, _(C, {
481
+ sx: {
482
+ display: "flex",
483
+ flexDirection: "column",
484
+ flex: "1 1 auto",
485
+ minHeight: 0,
486
+ overflowY: "auto"
487
+ },
488
+ children: z.map((e) => _(E, {
489
+ control: _(T, {
490
+ size: "small",
491
+ sx: {
492
+ paddingTop: .5,
493
+ paddingBottom: .5
494
+ },
495
+ disabled: I,
496
+ checked: !0 === F[e.key],
497
+ onChange: (t) => V(e.key, t.target.checked)
498
+ }),
499
+ label: _(M, {
500
+ variant: "body2",
501
+ children: a(e.messageKey)
502
+ })
503
+ }, e.key))
504
+ })]
505
+ })]
506
+ })
507
+ ]
508
+ });
509
+ }));
510
+ V.displayName = "WorksheetProtectionPanel";
511
+ var H = (e, t) => e === void 0 || e === t ? t : null, U = (e) => (e.rowEnd - e.rowStart + 1) * (e.colEnd - e.colStart + 1), W = p(f((e, t) => {
512
+ let { sheet: n, ...r } = e, a = d(), s = u(), [, c] = h((e) => e + 1, 0);
513
+ o(n, {
514
+ onSelectionChange: () => c(),
515
+ onStyleChange: () => c(),
516
+ onProtectionChange: () => c()
517
+ });
518
+ let f = n.getProtection().isLocked(), { alwaysUnlocked: p, showFormulas: g } = ((e) => {
519
+ let t, n, r = (e) => {
520
+ t = H(t, e.isAlwaysUnlocked()), n = H(n, e.isShowFormulas());
521
+ };
522
+ for (let t of e.getSelectedRanges().getCoords()) {
523
+ let n = 0;
524
+ for (let a of e.getRange(t).getRegions(i.Feature.Protection)) n += U(a.getCoords()), r(a.getCell().getProtection());
525
+ n < U(t) && r(e.getStyles().getNormal().getProtection());
526
+ }
527
+ return {
528
+ alwaysUnlocked: t ?? null,
529
+ showFormulas: n ?? null
530
+ };
531
+ })(n), y = m((e) => {
532
+ try {
533
+ e(n.getSelectedRanges().getStyle().getProtection());
534
+ } catch (e) {
535
+ s.showMessage?.(e?.message ?? String(e), { type: l.Error });
536
+ }
537
+ }, [n, s]);
538
+ return v(C, {
539
+ ref: t,
540
+ ...r,
541
+ sx: {
542
+ display: "flex",
543
+ flexDirection: "column",
544
+ width: "100%",
545
+ minWidth: 0,
546
+ flex: "1 1 auto",
547
+ minHeight: 0,
548
+ overflowX: "hidden",
549
+ overflowY: "auto",
550
+ boxSizing: "border-box",
551
+ gap: (e) => e.spacing(1),
552
+ paddingTop: (e) => e.spacing(1.5),
553
+ paddingBottom: (e) => e.spacing(1.5),
554
+ paddingLeft: (e) => e.spacing(2),
555
+ paddingRight: (e) => e.spacing(2)
556
+ },
557
+ children: [
558
+ _(M, {
559
+ variant: "body2",
560
+ sx: { color: "text.secondary" },
561
+ children: a("sheetProtection.cells.description")
562
+ }),
563
+ f ? _(M, {
564
+ variant: "caption",
565
+ sx: { color: "text.secondary" },
566
+ children: a("sheetProtection.cells.locked")
567
+ }) : null,
568
+ v(C, {
569
+ sx: {
570
+ display: "flex",
571
+ flexDirection: "column",
572
+ minWidth: 0
573
+ },
574
+ children: [_(E, {
575
+ control: _(T, {
576
+ size: "small",
577
+ sx: {
578
+ paddingTop: .5,
579
+ paddingBottom: .5
580
+ },
581
+ disabled: f,
582
+ checked: !0 === p,
583
+ indeterminate: p === null,
584
+ onChange: () => y((e) => e.setAlwaysUnlocked(!0 !== p))
585
+ }),
586
+ label: _(M, {
587
+ variant: "body2",
588
+ children: a("sheetProtection.cells.alwaysUnlocked")
589
+ })
590
+ }), _(E, {
591
+ control: _(T, {
592
+ size: "small",
593
+ sx: {
594
+ paddingTop: .5,
595
+ paddingBottom: .5
596
+ },
597
+ disabled: f,
598
+ checked: !0 === g,
599
+ indeterminate: g === null,
600
+ onChange: () => y((e) => e.setShowFormulas(!0 !== g))
601
+ }),
602
+ label: _(M, {
603
+ variant: "body2",
604
+ children: a("sheetProtection.cells.showFormulas")
605
+ })
606
+ })]
607
+ })
608
+ ]
609
+ });
610
+ }));
611
+ W.displayName = "ProtectedCellsPanel";
612
+ var G = p(f((e, n) => {
613
+ let { value: r, onEncryptPassword: i, onEncryptPasswordClear: a, onStructureChange: o, onStructurePassword: s, onStructurePasswordClear: c, onLocksChange: l, sx: u } = e, f = d();
614
+ return v(C, {
615
+ ref: n,
616
+ sx: {
617
+ display: "flex",
618
+ flexDirection: "column",
619
+ minWidth: 0,
620
+ gap: (e) => e.spacing(2.5),
621
+ ...u
622
+ },
623
+ children: [v(C, {
624
+ sx: {
625
+ display: "flex",
626
+ flexDirection: "column",
627
+ minWidth: 0,
628
+ gap: (e) => e.spacing(1)
629
+ },
630
+ children: [
631
+ _(E, {
632
+ control: _(T, {
633
+ checked: r.structure,
634
+ onChange: (e) => o(e.target.checked)
635
+ }),
636
+ label: f("protection.structure.label")
637
+ }),
638
+ _(C, {
639
+ sx: {
640
+ paddingLeft: 4,
641
+ minWidth: 0
642
+ },
643
+ children: _(t, {
644
+ hasPassword: r.hasStructurePassword,
645
+ description: f("protection.structure.passwordDescription"),
646
+ disabled: !r.structure,
647
+ requireCurrent: !0,
648
+ onSet: s,
649
+ onClear: c
650
+ })
651
+ }),
652
+ v(C, {
653
+ sx: {
654
+ display: "flex",
655
+ flexWrap: "wrap",
656
+ columnGap: (e) => e.spacing(2),
657
+ paddingLeft: 4,
658
+ minWidth: 0
659
+ },
660
+ children: [_(E, {
661
+ control: _(T, {
662
+ size: "small",
663
+ sx: {
664
+ paddingTop: .5,
665
+ paddingBottom: .5
666
+ },
667
+ disabled: !r.locksEditable,
668
+ checked: r.lockStructure,
669
+ onChange: (e) => l({
670
+ lockStructure: e.target.checked,
671
+ lockWindows: r.lockWindows
672
+ })
673
+ }),
674
+ label: f("protection.structure.lockStructure")
675
+ }), _(E, {
676
+ control: _(T, {
677
+ size: "small",
678
+ sx: {
679
+ paddingTop: .5,
680
+ paddingBottom: .5
681
+ },
682
+ disabled: !r.locksEditable,
683
+ checked: r.lockWindows,
684
+ onChange: (e) => l({
685
+ lockStructure: r.lockStructure,
686
+ lockWindows: e.target.checked
687
+ })
688
+ }),
689
+ label: f("protection.structure.lockWindows")
690
+ })]
691
+ }),
692
+ _(M, {
693
+ variant: "caption",
694
+ sx: {
695
+ minWidth: 0,
696
+ color: "text.secondary"
697
+ },
698
+ children: r.locksEditable ? f("protection.structure.note") : f("protection.structure.locksLocked")
699
+ })
700
+ ]
701
+ }), v(C, {
702
+ sx: {
703
+ display: "flex",
704
+ flexDirection: "column",
705
+ minWidth: 0,
706
+ gap: (e) => e.spacing(1)
707
+ },
708
+ children: [
709
+ _(M, {
710
+ variant: "body1",
711
+ sx: { minWidth: 0 },
712
+ children: f("protection.encrypt.label")
713
+ }),
714
+ _(t, {
715
+ hasPassword: r.hasEncryptPassword,
716
+ description: f("protection.encrypt.passwordDescription"),
717
+ onSet: i,
718
+ onClear: a
719
+ }),
720
+ _(M, {
721
+ variant: "caption",
722
+ sx: {
723
+ minWidth: 0,
724
+ color: "warning.main"
725
+ },
726
+ children: f("protection.encrypt.warning")
727
+ })
728
+ ]
729
+ })]
730
+ });
731
+ })), K = (e) => ({
732
+ structure: !e.lockStructure,
733
+ windows: !e.lockWindows
734
+ }), q = p(f((e, t) => {
735
+ let { workbook: n, ...r } = e, i = d(), a = u();
736
+ s(n, ["onProtectionChange", "onOriginChange"]);
737
+ let o = ((e) => {
738
+ let t = e.getOrigin(), n = e.getProtection(), r = n.isLocked(), i = r ? null : n.getProperties();
739
+ return {
740
+ hasEncryptPassword: t.isEncrypted(),
741
+ structure: r,
742
+ hasStructurePassword: n.hasPassword(),
743
+ lockStructure: r ? !n.isStructureAllowed() : !i || !0 !== i.structure,
744
+ lockWindows: r ? !n.isWindowsAllowed() : !!i && !0 !== i.windows,
745
+ locksEditable: !r
746
+ };
747
+ })(n), { lockStructure: c, lockWindows: f } = o, p = m((e) => {
748
+ a.showMessage?.(e?.message ?? String(e), { type: l.Error });
749
+ }, [a]), g = m(async () => {
750
+ if (!n.getProtection().hasPassword()) return;
751
+ let e = await a.showInput({
752
+ title: i("dialog.password.title"),
753
+ description: i("protection.structure.passwordPrompt"),
754
+ options: ["Ok", "Cancel"],
755
+ defaultOption: "Ok",
756
+ cancelOption: "Cancel",
757
+ inputType: "password"
758
+ });
759
+ return e?.option === "Ok" ? e.input || void 0 : null;
760
+ }, [
761
+ n,
762
+ a,
763
+ i
764
+ ]), [, v] = h((e) => e + 1, 0), y = m((e) => {
765
+ n.getOrigin().setPassword(e), v();
766
+ }, [n]), b = m(() => {
767
+ n.getOrigin().setPassword(null), v();
768
+ }, [n]), x = m(async (e) => {
769
+ let t = n.getProtection();
770
+ try {
771
+ if (!e) {
772
+ let e = await g();
773
+ if (e === null) return;
774
+ await t.unlock(e);
775
+ return;
776
+ }
777
+ await t.lock(K({
778
+ lockStructure: c,
779
+ lockWindows: f
780
+ }));
781
+ } catch (e) {
782
+ p(e);
783
+ }
784
+ }, [
785
+ n,
786
+ g,
787
+ c,
788
+ f,
789
+ p
790
+ ]), S = m(async (e) => {
791
+ try {
792
+ await n.getProtection().setProperties(K(e));
793
+ } catch (e) {
794
+ p(e);
795
+ }
796
+ }, [n, p]), w = m(async (e, t) => {
797
+ let r = n.getProtection();
798
+ try {
799
+ r.isLocked() && await r.unlock(t), await r.lock(K({
800
+ lockStructure: c,
801
+ lockWindows: f
802
+ }), e);
803
+ } catch (e) {
804
+ p(e);
805
+ }
806
+ }, [
807
+ n,
808
+ c,
809
+ f,
810
+ p
811
+ ]), T = m(async () => {
812
+ let e = n.getProtection();
813
+ try {
814
+ let t = await g();
815
+ if (t === null) return;
816
+ await e.unlock(t), await e.lock(K({
817
+ lockStructure: c,
818
+ lockWindows: f
819
+ }));
820
+ } catch (e) {
821
+ p(e);
822
+ }
823
+ }, [
824
+ n,
825
+ g,
826
+ c,
827
+ f,
828
+ p
829
+ ]);
830
+ return _(C, {
831
+ ref: t,
832
+ ...r,
833
+ sx: {
834
+ display: "flex",
835
+ flexDirection: "column",
836
+ width: "100%",
837
+ minWidth: 0,
838
+ flex: "1 1 auto",
839
+ minHeight: 0,
840
+ overflowX: "hidden",
841
+ overflowY: "auto",
842
+ boxSizing: "border-box",
843
+ gap: (e) => e.spacing(2),
844
+ paddingTop: (e) => e.spacing(1.5),
845
+ paddingBottom: (e) => e.spacing(1.5),
846
+ paddingLeft: (e) => e.spacing(2),
847
+ paddingRight: (e) => e.spacing(2)
848
+ },
849
+ children: _(G, {
850
+ value: o,
851
+ onEncryptPassword: y,
852
+ onEncryptPasswordClear: b,
853
+ onStructureChange: (e) => {
854
+ x(e);
855
+ },
856
+ onStructurePassword: (e, t) => {
857
+ w(e, t);
858
+ },
859
+ onStructurePasswordClear: () => {
860
+ T();
861
+ },
862
+ onLocksChange: (e) => {
863
+ S(e);
864
+ }
865
+ })
866
+ });
867
+ }));
868
+ q.displayName = "WorkbookProtectionTab";
869
+ var J = {
870
+ sheet: N("protection.tab.sheet"),
871
+ ranges: N("protection.tab.ranges"),
872
+ cells: N("protection.tab.cells"),
873
+ workbook: N("protection.tab.workbook")
874
+ }, Y = Object.keys(J), X = (e) => Y.includes(e) ? e : null, Z = p((e) => {
875
+ let { model: t, args: n, defaultTab: r = "sheet", entryKey: i, frame: a, ref: o, ...c } = e, l = d(), [u, f] = g(() => X(n?.tab) ?? r), [p, m] = g(n);
876
+ if (n !== p) {
877
+ m(n);
878
+ let e = X(n?.tab);
879
+ e && f(e);
880
+ }
881
+ s(t, ["onSelectedSheetChange"]);
882
+ let h = t?.getSelectedWorksheet() ?? null;
883
+ return t ? v(C, {
884
+ ref: o,
885
+ ...c,
886
+ sx: {
887
+ display: "flex",
888
+ flexDirection: "column",
889
+ width: "100%",
890
+ minWidth: 0,
891
+ flex: "1 1 auto",
892
+ height: "100%",
893
+ minHeight: 0,
894
+ overflowX: "hidden"
895
+ },
896
+ children: [_(A, {
897
+ value: u,
898
+ onChange: (e, t) => f(t),
899
+ variant: "fullWidth",
900
+ sx: {
901
+ width: "100%",
902
+ flex: "0 0 auto",
903
+ minHeight: "36px",
904
+ borderBottom: 1,
905
+ borderColor: "divider",
906
+ "& .MuiTab-root": {
907
+ minHeight: "36px",
908
+ textTransform: "none",
909
+ pt: .5,
910
+ pb: .5,
911
+ px: .5,
912
+ minWidth: 0
913
+ }
914
+ },
915
+ children: Y.map((e) => _(k, {
916
+ value: e,
917
+ label: l(J[e])
918
+ }, e))
919
+ }), v(C, {
920
+ sx: {
921
+ flex: "1 1 auto",
922
+ minHeight: 0,
923
+ minWidth: 0,
924
+ width: "100%",
925
+ display: "flex",
926
+ flexDirection: "column"
927
+ },
928
+ children: [
929
+ u === "sheet" && h ? _(V, {
930
+ sheet: h,
931
+ style: {
932
+ flex: "1 1 auto",
933
+ minHeight: 0,
934
+ minWidth: 0,
935
+ width: "100%"
936
+ }
937
+ }, h.getId()) : null,
938
+ u === "cells" && h ? _(W, {
939
+ sheet: h,
940
+ style: {
941
+ flex: "1 1 auto",
942
+ minHeight: 0,
943
+ minWidth: 0,
944
+ width: "100%"
945
+ }
946
+ }, h.getId()) : null,
947
+ u === "ranges" ? _(R, {
948
+ workbook: t,
949
+ args: n?.items,
950
+ style: {
951
+ flex: "1 1 auto",
952
+ minHeight: 0,
953
+ minWidth: 0,
954
+ width: "100%"
955
+ }
956
+ }) : null,
957
+ u === "workbook" ? _(q, {
958
+ workbook: t,
959
+ style: {
960
+ flex: "1 1 auto",
961
+ minHeight: 0,
962
+ minWidth: 0,
963
+ width: "100%"
964
+ }
965
+ }) : null
966
+ ]
967
+ })]
968
+ }) : null;
969
+ });
970
+ Z.displayName = "ManageProtectionTaskPane";
971
+ var Q = (e) => _(Z, {
972
+ ...e,
973
+ defaultTab: "ranges"
974
+ });
975
+ export { Z as ManageProtectionTaskPane, Z as default, Q as ProtectedRangeDetailsTaskPane };