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