@sheetxl/studio-mui 0.8.0-beta.14 → 0.8.0-beta.16

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 (120) hide show
  1. package/LICENSE.md +17 -7
  2. package/browser/esm/{DviYEVpPnQaWx-Tr.mjs → 2DGUEeY8au7Hbmze.mjs} +2 -2
  3. package/browser/esm/{D5ASCLEncVX6S3t7.mjs → 9V0gwYl3BcajPwBD.mjs} +2 -2
  4. package/browser/esm/B0mscuFChIInl6Mo.mjs +119 -0
  5. package/browser/esm/{cMMnySiLwLtz8_Zk.mjs → BGg5TSbhaUimavRf.mjs} +7 -7
  6. package/browser/esm/BL-h4RElQAdaeHPF.mjs +360 -0
  7. package/browser/esm/{XkkwDAFA6f5msXE4.mjs → BSrubs5qLEinR8Ew.mjs} +92 -87
  8. package/browser/esm/BUCQPr09aodgC88P.mjs +225 -0
  9. package/browser/esm/{BJn4i5eSKttOM7Va.mjs → Bg6bcIJsute7rxDL.mjs} +3 -3
  10. package/browser/esm/{b6OpGIOfqvVgPkpN.mjs → BjR7L3X6je3fXyQi.mjs} +2 -2
  11. package/browser/esm/{Cm7gnL7wtPzU7kH9.mjs → Bo_18UwXk7eK6QaM.mjs} +3 -3
  12. package/browser/esm/{C4-74xZS6PXqeP2-.mjs → Bp4rtdIKIFzTeJvr.mjs} +13 -9
  13. package/browser/esm/BxneVAXjYuQbCUQo.mjs +424 -0
  14. package/browser/esm/{BhurfBABcwf3sq1Y.mjs → C2V3kv29foh8dScC.mjs} +2 -2
  15. package/browser/esm/{4meV2QrzGwOTw-Wg.mjs → C8M4U_SswTd6auZd.mjs} +4 -4
  16. package/browser/esm/{DydtA0Kx0EIVeRVq.mjs → C9XRjC0yoGvS9Cm9.mjs} +3 -3
  17. package/browser/esm/{D1METLVOmQUWB2GY.mjs → CDgoQhayiKyo-7Br.mjs} +34 -33
  18. package/browser/esm/{DJytYYs6hwKzoGdK.mjs → CLgar8cakFC22X3w.mjs} +2 -2
  19. package/browser/esm/{DSMZVJXRlgHj6hnF.mjs → CUh56URLD9Vh5Ak9.mjs} +1807 -1200
  20. package/browser/esm/{D7SHK5F4crIKlHfX.mjs → CXgBRmauwDvHb3fQ.mjs} +2 -2
  21. package/browser/esm/{CM5uH7kPI6bp0Ynb.mjs → CYOaHHiaC7Ip5VLn.mjs} +2 -2
  22. package/browser/esm/C_qDBCzb8IHBlPhJ.mjs +294 -0
  23. package/browser/esm/{CouH7NfOLzq-7BFG.mjs → CfsYKmwU44jlvh2Y.mjs} +2 -2
  24. package/browser/esm/Ch1y4AkETfKCYDwf.mjs +106 -0
  25. package/browser/esm/{C7G22BSOh6ahi_YA.mjs → CnId_LC0EekuwaAF.mjs} +3 -3
  26. package/browser/esm/{DUMfNkupQUkMYbRX.mjs → CtVSJjciTocAi-ph.mjs} +3 -3
  27. package/browser/esm/{BSgsK2ctkA7acJ8B.mjs → CuQsEoKZJrSL989Q.mjs} +6 -6
  28. package/browser/esm/{B65gFGIGbaB2HJ7S.mjs → Cv99zJfRtzJQmM9a.mjs} +2 -2
  29. package/browser/esm/{9wRFUyQKqfHCPUiS.mjs → Cxk-oWZzE2jq5ul6.mjs} +3 -3
  30. package/browser/esm/{B0u4XScttbCbHUuj.mjs → D3XdTSymYMag6tor.mjs} +6 -6
  31. package/browser/esm/{BLWzmTXqRJp_rp2R.mjs → D4jGaUxHOgVc4qN0.mjs} +3 -3
  32. package/browser/esm/{D5ioZQTn_SJateKf.mjs → DAdhaGB933dfni3E.mjs} +3 -3
  33. package/browser/esm/{DYKsNTXsl78btQCN.mjs → DBx1Y3oFzB6gv-LQ.mjs} +3 -3
  34. package/browser/esm/{DROcTh8qOW1i6ktd.mjs → DIAnBUXPTvYAp5fm.mjs} +3 -3
  35. package/browser/esm/{CQmRcbXzQ2ZnzWkm.mjs → DIJh9jY37iVFn-tE.mjs} +2 -2
  36. package/browser/esm/{DC70OHr0cJy33grZ.mjs → DK1K-M9iJV-DK3lK.mjs} +2 -2
  37. package/browser/esm/{ATDkpSD6QYiZqoUd.mjs → DMhFcJsnKSKTDivl.mjs} +2 -2
  38. package/browser/esm/{C4UBegw-DrnYEN3U.mjs → DMj9kkIWw9chI5_u.mjs} +5 -5
  39. package/browser/esm/DUpW8HMoEhD3C9l6.mjs +235 -0
  40. package/browser/esm/{IF6KtCM-Yj_9GGEI.mjs → DVJ5AK0zcqSACGov.mjs} +9 -9
  41. package/browser/esm/{TJm3V2B1CMw1iZoU.mjs → DVaykBKx4eEsP4MI.mjs} +4 -4
  42. package/browser/esm/{Dh1o7OIOvCQaeaVN.mjs → Dex65RXS_A5CnMg3.mjs} +3 -3
  43. package/browser/esm/{DcF7yoU5XaD0TzDi.mjs → DfYtGsqDIMAG4Sp8.mjs} +2 -2
  44. package/browser/esm/{B2NGlVfdWvs2G_Fq.mjs → Dj0VEFe2ckEWgQjy.mjs} +5 -5
  45. package/browser/esm/{CSjn0SmASZfMzjJD.mjs → DjCDJhBfVI9O_Sq1.mjs} +6 -6
  46. package/browser/esm/DjjmLQLxU_U4JB3n.mjs +973 -0
  47. package/browser/esm/{dcZCjUD2UCAzFGTB.mjs → DmOrKFaiUUr5hlFl.mjs} +5 -4
  48. package/browser/esm/{BnRqW8S8uRFT1dsa.mjs → DoYSmj1LQHAAqt5b.mjs} +2 -2
  49. package/browser/esm/{DEu_fNm5LXqXGUqI.mjs → KhOxaZS8EeSaYFXZ.mjs} +2 -2
  50. package/browser/esm/{CqAaow0-s9wI-Zco.mjs → PvNtCGveCLbLAP3e.mjs} +14 -14
  51. package/browser/esm/{DGGNjWCfZChvgtCJ.mjs → ROOxAZY7YyHDmPcQ.mjs} +4 -4
  52. package/browser/esm/{C85QGz19eE9ggqzR.mjs → TfUaejwwWzu5qFVE.mjs} +3 -3
  53. package/browser/esm/{CeYt9oGNq5J48kA8.mjs → ZhI7zxDSTWb1DfaE.mjs} +3 -3
  54. package/browser/esm/{BPEGlembHUmOukt-.mjs → fqZt7Z0jR4illVKU.mjs} +5 -5
  55. package/browser/esm/index.mjs +278 -277
  56. package/browser/esm/{7GvHfNWduigxqNjI.mjs → r7bLyFzJfaGLKP_7.mjs} +2 -2
  57. package/browser/esm/{DGsTOxJVdwIgmFiF.mjs → tffjGixzP1Ze4DqB.mjs} +3 -3
  58. package/browser/esm/{CQ6F1l897Rr74YXa.mjs → tiC8hseLz66gO5BS.mjs} +804 -713
  59. package/licenses/dependencies.txt +33 -33
  60. package/node/esm/{CnHJuuebdiYB4hU1.mjs → -Il_piuBrbndDROB.mjs} +2 -2
  61. package/node/esm/0cm_0VYweOBWmzi7.mjs +972 -0
  62. package/node/esm/{Ua-hzH0IDC5UU7I1.mjs → 1gdwmt5CrQy4cGTH.mjs} +2 -2
  63. package/node/esm/{BXq4h4T2V5D0e0GE.mjs → 3Geel3fylTwbPuxf.mjs} +2 -2
  64. package/node/esm/{BPbOKZTCABQS1v4l.mjs → 4pRKBhUYhbbE6qVT.mjs} +2 -2
  65. package/node/esm/{DV7GtbZngmzKJkGC.mjs → 9qIZWfzxSaxNk6Cm.mjs} +16 -15
  66. package/node/esm/B9uLfbf5gMGnoUjH.mjs +224 -0
  67. package/node/esm/{C2ZhJJ6JogM32N6v.mjs → BFO2WxwRNbu-UmKe.mjs} +3 -3
  68. package/node/esm/{DrZYqa9k2cas_dpR.mjs → BIJXqUbAalnd-gXD.mjs} +2 -2
  69. package/node/esm/{DLa2dwTHx-TF9X28.mjs → BIviFvkWx6eP4dMd.mjs} +12 -12
  70. package/node/esm/{By9Y6KcwsjQGiP4W.mjs → BTOCej61y3MazK6r.mjs} +2 -2
  71. package/node/esm/{DNhFkzvStZYjYqlY.mjs → BV9hUarSGd3mWC8o.mjs} +3 -3
  72. package/node/esm/{ChAnZ_8BZXB8xGku.mjs → BX1cTEV3SpcqLcXx.mjs} +81 -80
  73. package/node/esm/{DINEK8QwAC2xbcJg.mjs → BZu-8gEXwIzW_YX9.mjs} +2 -2
  74. package/node/esm/{Dua4HsVMCVMOSuUP.mjs → B_jOG6MlKoiboP3D.mjs} +3 -3
  75. package/node/esm/{a4ksKvzRiZRS-LjD.mjs → BgObBW8ZUr50OufC.mjs} +8 -8
  76. package/node/esm/{BIbJ-RvwV7EKR1AK.mjs → BhiuBl2z87xThV1b.mjs} +2 -2
  77. package/node/esm/{Cv_gkzf1CvleEpGx.mjs → Bm054Lh36PSa5m1P.mjs} +2 -2
  78. package/node/esm/BtxNP8JWe16vSXAs.mjs +106 -0
  79. package/node/esm/BzT_zks-KORaryRo.mjs +118 -0
  80. package/node/esm/{DfRwTR3tR0Wx5I0U.mjs → C5dRM0ExMHpFgKd0.mjs} +3 -3
  81. package/node/esm/{DKJDmlxmNG0mVHmb.mjs → CQxu_KONf2yyKKnD.mjs} +2 -2
  82. package/node/esm/{D9neYUsRInmBz-7P.mjs → CdoFRzEug2L0LwNb.mjs} +7 -7
  83. package/node/esm/{Hp0ggyjuRLoV7Zkw.mjs → Ch7Ebxf0bFrlCJpW.mjs} +2 -2
  84. package/node/esm/{GkXvPmel2BbE1Yvo.mjs → CsQTJ4JQRxLcJDiZ.mjs} +2 -2
  85. package/node/esm/{D1RBCi056McbAuVe.mjs → CyKOmz26TaZSFxmi.mjs} +3 -3
  86. package/node/esm/D3TsBlOewIFj-VDW.mjs +294 -0
  87. package/node/esm/{rSq-rFZ2oBrx0daL.mjs → D4TlOO7hjvqTR2HX.mjs} +3 -3
  88. package/node/esm/{CLArZpAFWoKR9UXC.mjs → DYNM5HfUK0JbGHsx.mjs} +2 -2
  89. package/node/esm/{B74EJtfb07jNPG2i.mjs → DhPNzztIuq9WJwCz.mjs} +3 -3
  90. package/node/esm/{CMsWjZqAF2n3PniO.mjs → cl-bDkq8M4STBYJy.mjs} +2 -2
  91. package/node/esm/fazR-cWd-2-W82Nk.mjs +425 -0
  92. package/node/esm/index.mjs +3391 -2778
  93. package/node/esm/{CzQvRTTBIzvSAQWs.mjs → iyOc5Rm5x746Qd3R.mjs} +2 -2
  94. package/node/esm/{D3BoGAsVExHN5pzo.mjs → klLaIOeBuqaYuz_q.mjs} +2 -2
  95. package/node/esm/{0TWX9zLKXvPj1qMo.mjs → mmzQ-lse6yBavXnw.mjs} +603 -514
  96. package/node/esm/{C29ReEXb9EK4DP6E.mjs → rpHmm4X81z1orjHr.mjs} +3 -3
  97. package/node/esm/{Y0a0MfNj9jzVeoRQ.mjs → tRnEFhRlzQPziQif.mjs} +2 -2
  98. package/package.json +10 -10
  99. package/resources/locales/de/groups.cmd.json +3 -0
  100. package/resources/locales/de/ui.msg.json +41 -0
  101. package/resources/locales/en/groups.cmd.json +3 -0
  102. package/resources/locales/en/ui.msg.json +41 -0
  103. package/types/src/command/PresetPivotStylesCommandButton.d.ts +17 -0
  104. package/types/src/command/index.d.ts +1 -0
  105. package/types/src/dialog/PivotTableNewDialog.d.ts +11 -0
  106. package/types/src/filter/PivotMenu.d.ts +31 -0
  107. package/types/src/filter/index.d.ts +1 -0
  108. package/types/src/pivot/PivotChipMenu.d.ts +10 -0
  109. package/types/src/pivot/PivotPlugin.d.ts +3 -0
  110. package/types/src/pivot/PivotStyleCanvasPreview.d.ts +23 -0
  111. package/types/src/pivot/PivotTableHeader.d.ts +12 -0
  112. package/types/src/pivot/PivotValueSettingsDialog.d.ts +15 -0
  113. package/types/src/pivot/_pivotSource.d.ts +7 -0
  114. package/types/src/table/_drawStyleSwatch.d.ts +25 -0
  115. package/types/src/workbook/DefaultRenderers.d.ts +10 -4
  116. package/browser/esm/BJPuzqf8wzAaSBCD.mjs +0 -1379
  117. package/browser/esm/CUBCWkB6A5HH4u5Q.mjs +0 -319
  118. package/browser/esm/DKnuzGrJHk4qI0Zi.mjs +0 -582
  119. package/node/esm/BbCPG2xTU1rpAM5l.mjs +0 -318
  120. package/node/esm/DtxnTVIKKE8mp6rU.mjs +0 -1379
@@ -1,1379 +0,0 @@
1
- /**
2
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.14
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 { BorderStylePopupButton as e, BorderTemplateIcon as t, ColorCommandButton as o, ColorPopupButton as r, FontFamilyCommandButton as n, FontSizeCommandButton as a, NumberFormatOption as l, S as i, numberFormatCategoryLabel as d } from "./index.mjs";
8
- import { a as s, c, i as m, n as g, o as p, r as u, s as h, t as b } from "./BbCPG2xTU1rpAM5l.mjs";
9
- import { IBorders as f, IRange as y, NumberFormat as x } from "@sheetxl/sdk";
10
- import { StaticBorderRenderer as S, StaticCellRenderer as v, useGridColorScheme as E, useModelListener as w, useModelSync as T } from "@sheetxl/react";
11
- import { DynamicIcon as K, useCallbackRef as C, useCommands as F, usePersistentState as k, useTranslator as A } from "@sheetxl/utils-react";
12
- import { forwardRef as O, memo as N, useCallback as z, useEffect as R, useMemo as B, useReducer as P, useRef as I, useState as M } from "react";
13
- import { CommandButton as H, ExhibitIconButton as V, ExhibitMenuItem as L, ExhibitPopupIconButton as U, PopupButtonType as $, SelectedIcon as j, defaultRenderPopupPanel as W } from "@sheetxl/utils-mui";
14
- import { Fragment as _, jsx as G, jsxs as Y } from "react/jsx-runtime";
15
- import { Box as q, Checkbox as Q, FormControl as J, FormControlLabel as Z, InputLabel as X, List as ee, ListItemButton as te, ListItemText as oe, MenuItem as re, Paper as ne, Select as ae, Tab as le, Tabs as ie, TextField as de, Typography as se, alpha as ce } from "@mui/material";
16
- import { messageKey as me } from "@sheetxl/utils";
17
- import ge from "clsx";
18
- var pe = {
19
- autoFocus: !1,
20
- scrollIntoView: !1
21
- }, ue = N((e) => {
22
- const { selection: t, height: o = 46, maxWidth: r = 260, ...n } = e, a = A(), { cell: l, createCell: i, disabled: d } = t, s = B(() => "number" == typeof l.getValue() ? l : i({
23
- value: 1234.56,
24
- style: l.getStyle()
25
- }), [l, i]);
26
- return Y(q, {
27
- sx: {
28
- display: "flex",
29
- flexDirection: "column",
30
- gap: .5
31
- },
32
- ...n,
33
- children: [G(se, {
34
- variant: "caption",
35
- component: "div",
36
- children: a("format.preview")
37
- }), G(v, {
38
- cell: s,
39
- disabled: d,
40
- style: {
41
- width: "100%",
42
- maxWidth: `${r}px`,
43
- height: `${o}px`,
44
- flex: "0 0 auto",
45
- border: "1px solid var(--sxl-color-base-300, rgb(224, 224, 224))"
46
- },
47
- propsBorder: { style: {
48
- height: "100%",
49
- width: "100%"
50
- } }
51
- })]
52
- });
53
- });
54
- ue.displayName = "FormatCellPreview";
55
- var { Builder: he } = x, be = {
56
- py: "2px",
57
- px: 1,
58
- minHeight: 0,
59
- "& .MuiListItemText-root": { my: 0 },
60
- "& .MuiListItemText-primary": {
61
- fontSize: "0.8125rem",
62
- lineHeight: 1.5
63
- },
64
- "& .MuiListItemText-secondary": {
65
- fontSize: "0.7rem",
66
- lineHeight: 1.3
67
- }
68
- }, fe = {
69
- border: (e) => `1px solid ${e.palette.divider}`,
70
- borderRadius: (e) => `${e.shape.borderRadius}px`,
71
- overflow: "auto",
72
- maxHeight: 260
73
- };
74
- function ye(e, t, o) {
75
- switch (t) {
76
- case "minus": return e("numberFormat.negMinus");
77
- case "red": return e("numberFormat.negRed");
78
- case "parens": return e("numberFormat.negParens");
79
- case "redParens": return e("numberFormat.negRedParens");
80
- default: return o;
81
- }
82
- }
83
- function xe(e, t, o) {
84
- const r = t?.getValue();
85
- return "Text" === e ? "string" == typeof r ? r : o : "Date" === e || "Time" === e ? "number" == typeof r ? r : 45658.625 : "number" == typeof r ? r : 1234.56;
86
- }
87
- function Se(e, t, o) {
88
- try {
89
- return o ? o.createCell({
90
- value: t,
91
- style: { numberFormat: e }
92
- }).getNumberFormat().displayText || "" : x.getEngine().format(e, t, {}).text ?? "";
93
- } catch {
94
- return "";
95
- }
96
- }
97
- var ve = N(O((e, t) => {
98
- const { value: o, onChange: r, context: n, onCommit: a, hideSample: s = !1, showQuickFormats: c = !1, disabled: g = !1, className: u, onKeyDown: b, ...f } = e, y = A(), [S, v] = M(() => he.parse(o));
99
- R(() => {
100
- he.build(S) !== o && v(he.parse(o));
101
- }, [o]);
102
- const E = n?.() ?? null, w = C((e) => {
103
- v(e), r(he.build(e));
104
- }, [r]), T = C((e) => {
105
- w({
106
- ...S,
107
- ...e
108
- });
109
- }, [S, w]), K = C(() => {
110
- r(o);
111
- }, [r, o]), F = C((e) => {
112
- if (e === S.category) return;
113
- const t = he.defaultCodeForCategory(e), o = he.isParametricCategory(e) ? he.parse(t) : {
114
- category: e,
115
- code: t
116
- };
117
- w(o);
118
- }, [S.category, w]), k = C((e) => {
119
- if (b?.(e), "Enter" === e.key) {
120
- if (e.target.closest("[role=\"combobox\"], [role=\"menuitem\"]")) return;
121
- e.preventDefault(), e.stopPropagation(), a?.();
122
- }
123
- }, [b, a]), D = (e, t, o) => (r) => {
124
- let n = t;
125
- switch (r.key) {
126
- case "ArrowDown":
127
- n = Math.min(e - 1, t + 1);
128
- break;
129
- case "ArrowUp":
130
- n = Math.max(0, t - 1);
131
- break;
132
- case "Home":
133
- n = 0;
134
- break;
135
- case "End":
136
- n = e - 1;
137
- break;
138
- default: return;
139
- }
140
- r.preventDefault(), n !== t && n >= 0 && o(n), r.currentTarget.querySelectorAll(".MuiListItemButton-root")[n]?.focus();
141
- }, O = S.category, N = xe(O, E, y("numberFormat.sampleText")), z = Se(o, N, E), B = G(m, {
142
- label: y("numberFormat.decimalPlaces"),
143
- disabled: g,
144
- value: S.decimalPlaces ?? 0,
145
- min: 0,
146
- max: 30,
147
- width: 140,
148
- onChange: (e) => T({ decimalPlaces: e })
149
- }), P = S.currencySymbol ?? "$", I = Y(J, {
150
- size: "small",
151
- sx: { width: 140 },
152
- children: [G(X, {
153
- shrink: !0,
154
- children: y("numberFormat.symbol")
155
- }), G(ae, {
156
- label: y("numberFormat.symbol"),
157
- notched: !0,
158
- disabled: g,
159
- value: P,
160
- onChange: (e) => T({ currencySymbol: e.target.value }),
161
- children: he.CURRENCY_SYMBOLS.map((e) => G(re, {
162
- value: e,
163
- onClick: h(P, e, K),
164
- children: e
165
- }, e))
166
- })]
167
- }), H = G(Z, {
168
- sx: { alignSelf: "center" },
169
- control: G(Q, {
170
- size: "small",
171
- disabled: g,
172
- checked: !!S.useSeparator,
173
- onChange: (e) => T({ useSeparator: e.target.checked })
174
- }),
175
- label: y("numberFormat.useSeparator")
176
- }), V = Y(q, {
177
- sx: {
178
- display: "flex",
179
- flexDirection: "column",
180
- minHeight: 0,
181
- flex: "1 1 auto"
182
- },
183
- children: [G(se, {
184
- variant: "caption",
185
- component: "div",
186
- sx: { mb: .5 },
187
- children: y("numberFormat.negativeNumbers")
188
- }), G(ee, {
189
- dense: !0,
190
- disablePadding: !0,
191
- sx: {
192
- ...fe,
193
- flex: "1 1 auto"
194
- },
195
- onKeyDown: D(he.NEGATIVE_STYLES.length, S.negativeStyle ?? 0, (e) => T({ negativeStyle: e })),
196
- children: he.NEGATIVE_STYLES.map((e, t) => {
197
- const o = Se(he.build({
198
- ...S,
199
- negativeStyle: t
200
- }), -function(e) {
201
- return "number" == typeof e ? Math.abs(e) : 1234.56;
202
- }(N), E);
203
- return G(te, {
204
- disabled: g,
205
- selected: (S.negativeStyle ?? 0) === t,
206
- onClick: () => T({ negativeStyle: t }),
207
- sx: be,
208
- children: G(oe, {
209
- primary: o || ye(y, e.key, e.label),
210
- slotProps: { primary: {
211
- noWrap: !0,
212
- sx: {
213
- color: e.red ? "error.main" : void 0,
214
- fontVariantNumeric: "tabular-nums"
215
- }
216
- } }
217
- })
218
- }, e.key);
219
- })
220
- })]
221
- }), $ = (e, t) => G(ee, {
222
- dense: !0,
223
- disablePadding: !0,
224
- sx: {
225
- ...fe,
226
- flex: "1 1 auto"
227
- },
228
- onKeyDown: D(e.length, e.indexOf(o), (t) => w({
229
- category: O,
230
- code: e[t]
231
- })),
232
- children: e.map((e) => G(te, {
233
- disabled: g,
234
- selected: o === e,
235
- onClick: () => w({
236
- category: O,
237
- code: e
238
- }),
239
- sx: be,
240
- children: G(oe, {
241
- primary: t?.[e] ?? Se(e, N, E) ?? e,
242
- secondary: t ? e : void 0,
243
- slotProps: {
244
- primary: { noWrap: !0 },
245
- secondary: { noWrap: !0 }
246
- }
247
- })
248
- }, e))
249
- }), ne = G(de, {
250
- label: y("numberFormat.typeCode"),
251
- size: "small",
252
- fullWidth: !0,
253
- disabled: g,
254
- value: o,
255
- error: !!o && !x.Parser.isValidFormat(o),
256
- helperText: o && !x.Parser.isValidFormat(o) ? y("numberFormat.invalidCode") : " ",
257
- onChange: (e) => w({
258
- category: "Custom",
259
- code: e.target.value
260
- }),
261
- slotProps: {
262
- inputLabel: { shrink: !0 },
263
- htmlInput: {
264
- spellCheck: !1,
265
- autoComplete: "off"
266
- }
267
- }
268
- }), le = (e) => G(q, {
269
- sx: {
270
- display: "flex",
271
- flexWrap: "wrap",
272
- gap: 1.5,
273
- alignItems: "flex-start"
274
- },
275
- children: e
276
- });
277
- let ie;
278
- switch (O) {
279
- case "General":
280
- ie = G(se, {
281
- variant: "body2",
282
- children: y("numberFormat.generalInfo")
283
- });
284
- break;
285
- case "Number":
286
- ie = Y(_, { children: [le(Y(_, { children: [B, H] })), V] });
287
- break;
288
- case "Currency":
289
- ie = Y(_, { children: [le(Y(_, { children: [B, I] })), V] });
290
- break;
291
- case "Accounting":
292
- ie = Y(_, { children: [le(Y(_, { children: [B, I] })), G(se, {
293
- variant: "caption",
294
- color: "text.secondary",
295
- children: y("numberFormat.accountingInfo")
296
- })] });
297
- break;
298
- case "Percentage":
299
- case "Scientific":
300
- ie = B;
301
- break;
302
- case "Date":
303
- ie = $(he.DATE_PRESETS);
304
- break;
305
- case "Time":
306
- ie = $(he.TIME_PRESETS);
307
- break;
308
- case "Fraction":
309
- ie = $(he.FRACTION_PRESETS, ((e) => ({
310
- "# ?/?": e("numberFormat.fractionOneDigit"),
311
- "# ??/??": e("numberFormat.fractionTwoDigits"),
312
- "# ???/???": e("numberFormat.fractionThreeDigits"),
313
- "# ?/2": e("numberFormat.fractionHalves"),
314
- "# ?/4": e("numberFormat.fractionQuarters"),
315
- "# ?/8": e("numberFormat.fractionEighths"),
316
- "# ??/16": e("numberFormat.fractionSixteenths"),
317
- "# ?/10": e("numberFormat.fractionTenths"),
318
- "# ??/100": e("numberFormat.fractionHundredths")
319
- }))(y));
320
- break;
321
- case "Special":
322
- ie = $(he.SPECIAL_PRESETS, ((e) => ({
323
- "00000": e("numberFormat.specialZip"),
324
- "00000-0000": e("numberFormat.specialZip4"),
325
- "[<=9999999]###-####;(###) ###-####": e("numberFormat.specialPhone"),
326
- "000-00-0000": e("numberFormat.specialSsn")
327
- }))(y));
328
- break;
329
- case "Text":
330
- ie = G(se, {
331
- variant: "body2",
332
- children: y("numberFormat.textInfo")
333
- });
334
- break;
335
- case "Custom":
336
- ie = Y(_, { children: [ne, $(he.DATE_PRESETS.concat(he.TIME_PRESETS))] });
337
- break;
338
- default: ie = null;
339
- }
340
- return Y(q, {
341
- ref: t,
342
- className: ge("sxl-number-format-panel", u),
343
- onKeyDown: k,
344
- sx: {
345
- display: "flex",
346
- flexDirection: "column",
347
- gap: 1.25
348
- },
349
- ...f,
350
- children: [
351
- s ? null : Y(q, { children: [G(se, {
352
- variant: "caption",
353
- component: "div",
354
- sx: { pl: .5 },
355
- children: y("numberFormat.sample")
356
- }), G(se, {
357
- variant: "body1",
358
- component: "div",
359
- sx: {
360
- borderRadius: (e) => `${e.shape.borderRadius}px`,
361
- padding: (e) => e.spacing(1),
362
- border: (e) => `1px solid ${e.palette.divider}`,
363
- minHeight: "1.6em",
364
- fontVariantNumeric: "tabular-nums",
365
- overflow: "hidden",
366
- textOverflow: "ellipsis",
367
- whiteSpace: "nowrap"
368
- },
369
- children: z || " "
370
- })] }),
371
- c ? G(i, {
372
- disabled: g,
373
- sx: {
374
- justifyContent: "flex-start",
375
- paddingBottom: 1
376
- }
377
- }) : null,
378
- G(p, {
379
- label: y("numberFormat.category"),
380
- sx: { marginBottom: .5 },
381
- children: G(U, {
382
- outlined: !0,
383
- disabled: g,
384
- sx: { width: "100%" },
385
- renderPopupPanel: (e) => {
386
- const { closeFloatAll: t } = e, r = he.CATEGORIES.map((e) => {
387
- const r = e === O, n = () => {
388
- ((e) => {
389
- e === O ? K() : F(e);
390
- })(e), t?.();
391
- };
392
- return G(L, {
393
- selected: r,
394
- icon: G(j, {
395
- selected: r,
396
- children: r ? void 0 : null
397
- }),
398
- sx: { display: "flex" },
399
- onMouseDown: (e) => {
400
- 0 === e.button && e.preventDefault();
401
- },
402
- onMouseUp: (e) => {
403
- 0 === e.button && n();
404
- },
405
- onKeyDown: (e) => {
406
- "Enter" !== e.key && " " !== e.key || n();
407
- },
408
- children: G(l, {
409
- label: d(y, e),
410
- sample: (a = e, "Custom" === a && a !== O ? "" : Se(a === O ? o : he.defaultCodeForCategory(a), xe(a, E, y("numberFormat.sampleText")), E))
411
- })
412
- }, e);
413
- var a;
414
- });
415
- return W({
416
- ...e,
417
- children: G(q, {
418
- sx: {
419
- overflow: "auto",
420
- flex: "1 1 100%"
421
- },
422
- children: r
423
- })
424
- });
425
- },
426
- icon: G(q, {
427
- sx: {
428
- display: "flex",
429
- flex: "1 1 100%",
430
- minWidth: 0,
431
- paddingLeft: "4px",
432
- paddingRight: "4px",
433
- fontSize: (e) => `${Math.round(e.typography.fontSize)}px`,
434
- lineHeight: 1.2,
435
- fontFamily: (e) => e.typography.fontFamily,
436
- color: (e) => e.palette.text.secondary
437
- },
438
- children: G(q, {
439
- sx: {
440
- overflow: "hidden",
441
- textOverflow: "ellipsis",
442
- whiteSpace: "pre"
443
- },
444
- children: d(y, O)
445
- })
446
- })
447
- })
448
- }),
449
- G(q, {
450
- sx: {
451
- display: "flex",
452
- flexDirection: "column",
453
- gap: 1.25,
454
- flex: "1 1 auto",
455
- minWidth: 0,
456
- minHeight: 0
457
- },
458
- children: ie
459
- })
460
- ]
461
- });
462
- }));
463
- ve.displayName = "NumberFormatPanel";
464
- var Ee = {
465
- axes: y.AxisSelection.Column,
466
- expandOnly: !0,
467
- skipCustomSize: !0
468
- }, we = (e) => e > 180 ? e - 360 : e, Te = (e) => {
469
- const t = Math.max(-90, Math.min(90, Math.round(e)));
470
- return t < 0 ? t + 360 : t;
471
- }, Ke = N((e) => {
472
- const { selection: t, disabled: o, className: r, ...n } = e, a = A(), { style: l, applyStyle: i } = t, d = o || t.disabled, g = l.getAlignment(), h = g.getIndent(), b = g.getStacked(), f = b ? 0 : g.getRotation(), y = C((e) => {
473
- i({ alignment: { indent: e } }, me("op.setAlignment"), Ee);
474
- }, [i]), x = C((e) => {
475
- i({ alignment: { rotation: Te(e) } }, me("op.setAlignment"));
476
- }, [i]);
477
- return Y(q, {
478
- className: ge("sxl-format-alignment-panel", r),
479
- sx: c,
480
- ...n,
481
- children: [
482
- G(p, {
483
- label: a("format.horizontalAlignment"),
484
- children: G(s, { children: Y(u, { children: [
485
- G(H, {
486
- commandKey: "formatAlignLeftToggle",
487
- groupKey: "horizontalAlignOptions",
488
- disabled: d
489
- }),
490
- G(H, {
491
- commandKey: "formatAlignCenterToggle",
492
- groupKey: "horizontalAlignOptions",
493
- disabled: d
494
- }),
495
- G(H, {
496
- commandKey: "formatAlignRightToggle",
497
- groupKey: "horizontalAlignOptions",
498
- disabled: d
499
- }),
500
- G(H, {
501
- commandKey: "formatAlignJustifyToggle",
502
- groupKey: "horizontalAlignOptions",
503
- disabled: d
504
- }),
505
- G(H, {
506
- commandKey: "formatAlignDistributedHorizontalToggle",
507
- groupKey: "horizontalAlignOptions",
508
- disabled: d
509
- }),
510
- G(H, {
511
- commandKey: "formatAlignCenterContinuousToggle",
512
- groupKey: "horizontalAlignOptions",
513
- disabled: d
514
- }),
515
- G(H, {
516
- commandKey: "formatAlignFillToggle",
517
- groupKey: "horizontalAlignOptions",
518
- disabled: d
519
- })
520
- ] }) })
521
- }),
522
- G(p, {
523
- label: a("format.indent"),
524
- children: Y(s, { children: [
525
- G(H, {
526
- commandKey: "formatIndentDecrease",
527
- groupKey: "horizontalAlignOptions",
528
- disabled: d
529
- }),
530
- G(H, {
531
- commandKey: "formatIndentIncrease",
532
- groupKey: "horizontalAlignOptions",
533
- disabled: d
534
- }),
535
- G(m, {
536
- label: a("format.indentUnit"),
537
- disabled: d,
538
- value: h,
539
- min: 0,
540
- max: 250,
541
- width: 104,
542
- onChange: y
543
- })
544
- ] })
545
- }),
546
- G(p, {
547
- label: a("format.verticalAlignment"),
548
- children: Y(u, { children: [
549
- G(H, {
550
- commandKey: "formatAlignTopToggle",
551
- groupKey: "verticalAlignOptions",
552
- disabled: d
553
- }),
554
- G(H, {
555
- commandKey: "formatAlignMiddleToggle",
556
- groupKey: "verticalAlignOptions",
557
- disabled: d
558
- }),
559
- G(H, {
560
- commandKey: "formatAlignBottomToggle",
561
- groupKey: "verticalAlignOptions",
562
- disabled: d
563
- }),
564
- G(H, {
565
- commandKey: "formatAlignJustifyVerticalToggle",
566
- groupKey: "verticalAlignOptions",
567
- disabled: d
568
- }),
569
- G(H, {
570
- commandKey: "formatAlignDistributedVerticalToggle",
571
- groupKey: "verticalAlignOptions",
572
- disabled: d
573
- })
574
- ] })
575
- }),
576
- G(p, {
577
- label: a("format.overflow"),
578
- children: Y(u, { children: [
579
- G(H, {
580
- commandKey: "formatTextOverflowWrapToggle",
581
- groupKey: "textOverflowOptions",
582
- disabled: d
583
- }),
584
- G(H, {
585
- commandKey: "formatTextOverflowShrinkToggle",
586
- groupKey: "textOverflowOptions",
587
- disabled: d
588
- }),
589
- G(H, {
590
- commandKey: "formatTextOverflowClipToggle",
591
- groupKey: "textOverflowOptions",
592
- disabled: d
593
- }),
594
- G(H, {
595
- commandKey: "formatTextOverflowVisibleToggle",
596
- groupKey: "textOverflowOptions",
597
- disabled: d
598
- })
599
- ] })
600
- }),
601
- G(p, {
602
- label: a("format.merge"),
603
- children: Y(u, { children: [
604
- G(H, {
605
- commandKey: "mergeToggle",
606
- groupKey: "mergeOptions",
607
- disabled: d
608
- }),
609
- G(H, {
610
- commandKey: "mergeHorizontal",
611
- groupKey: "mergeOptions",
612
- disabled: d
613
- }),
614
- G(H, {
615
- commandKey: "mergeVertical",
616
- groupKey: "mergeOptions",
617
- disabled: d
618
- }),
619
- G(H, {
620
- commandKey: "unmerge",
621
- groupKey: "mergeOptions",
622
- disabled: d
623
- })
624
- ] })
625
- }),
626
- G(p, {
627
- label: a("format.orientation"),
628
- children: Y(s, { children: [Y(u, { children: [
629
- G(H, {
630
- commandKey: "formatTextRotate0",
631
- groupKey: "textRotateOptions",
632
- disabled: d
633
- }),
634
- G(H, {
635
- commandKey: "formatTextRotate45",
636
- groupKey: "textRotateOptions",
637
- disabled: d
638
- }),
639
- G(H, {
640
- commandKey: "formatTextRotate315",
641
- groupKey: "textRotateOptions",
642
- disabled: d
643
- }),
644
- G(H, {
645
- commandKey: "formatTextRotate90",
646
- groupKey: "textRotateOptions",
647
- disabled: d
648
- }),
649
- G(H, {
650
- commandKey: "formatTextRotateVertical",
651
- groupKey: "textRotateOptions",
652
- disabled: d
653
- }),
654
- G(H, {
655
- commandKey: "formatTextRotate270",
656
- groupKey: "textRotateOptions",
657
- disabled: d
658
- })
659
- ] }), G(m, {
660
- label: a("format.degrees"),
661
- disabled: d || b,
662
- value: we(f),
663
- min: -90,
664
- max: 90,
665
- step: 5,
666
- width: 104,
667
- onChange: x
668
- })] })
669
- })
670
- ]
671
- });
672
- });
673
- Ke.displayName = "AlignmentPanel";
674
- var Ce = N((e) => {
675
- const { selection: t, disabled: r, className: l, ...i } = e, d = A(), m = r || t.disabled;
676
- return Y(q, {
677
- className: ge("sxl-format-font-panel", l),
678
- sx: c,
679
- ...i,
680
- children: [
681
- G(p, {
682
- label: d("format.fontFamily"),
683
- children: G(n, {
684
- commandKey: "formatFontFamily",
685
- disabled: m,
686
- sx: { width: "100%" }
687
- })
688
- }),
689
- G(p, {
690
- label: d("format.fontSize"),
691
- children: Y(s, { children: [
692
- G(a, {
693
- commandKey: "formatFontSize",
694
- disabled: m,
695
- sx: { width: 96 }
696
- }),
697
- G(H, {
698
- commandKey: "formatFontSizeIncrease",
699
- disabled: m
700
- }),
701
- G(H, {
702
- commandKey: "formatFontSizeDecrease",
703
- disabled: m
704
- })
705
- ] })
706
- }),
707
- G(p, {
708
- label: d("format.color"),
709
- children: G(s, { children: G(o, {
710
- commandKey: "formatFontColor",
711
- disabled: m
712
- }) })
713
- }),
714
- G(p, {
715
- label: d("format.effects"),
716
- children: Y(u, { children: [
717
- G(H, {
718
- commandKey: "formatBoldToggle",
719
- disabled: m
720
- }),
721
- G(H, {
722
- commandKey: "formatItalicToggle",
723
- disabled: m
724
- }),
725
- G(H, {
726
- commandKey: "formatUnderlinedToggle",
727
- groupKey: "underlineOptions",
728
- disabled: m
729
- }),
730
- G(H, {
731
- commandKey: "formatUnderlinedDoubleToggle",
732
- groupKey: "underlineOptions",
733
- disabled: m
734
- }),
735
- G(q, { sx: { width: "8px" } }),
736
- G(H, {
737
- commandKey: "formatStrikeThroughToggle",
738
- disabled: m
739
- }),
740
- G(H, {
741
- commandKey: "formatSuperscriptToggle",
742
- disabled: m
743
- }),
744
- G(H, {
745
- commandKey: "formatSubscriptToggle",
746
- disabled: m
747
- })
748
- ] })
749
- }),
750
- G(p, {
751
- label: d("format.accountingUnderline"),
752
- children: Y(u, { children: [G(H, {
753
- commandKey: "formatUnderlinedAccountingToggle",
754
- groupKey: "underlineOptions",
755
- disabled: m
756
- }), G(H, {
757
- commandKey: "formatUnderlinedAccountingDoubleToggle",
758
- groupKey: "underlineOptions",
759
- disabled: m
760
- })] })
761
- })
762
- ]
763
- });
764
- });
765
- Ce.displayName = "FontPanel";
766
- var Fe = Object.freeze([
767
- f.Edge.Top,
768
- f.Edge.Bottom,
769
- f.Edge.Left,
770
- f.Edge.Right,
771
- f.Edge.Horizontal,
772
- f.Edge.Vertical
773
- ]), ke = Object.freeze([]), Ae = Object.freeze([f.Edge.Horizontal, f.Edge.Vertical]), De = new Map([
774
- ...Fe,
775
- f.Edge.DiagonalUp,
776
- f.Edge.DiagonalDown
777
- ].map((e) => [e, Object.freeze([e])])), Oe = (e) => e === f.Edge.DiagonalUp || e === f.Edge.DiagonalDown;
778
- function Ne(e, t) {
779
- switch (t) {
780
- case f.Edge.Top: return e("border.top");
781
- case f.Edge.Left: return e("border.left");
782
- case f.Edge.Right: return e("border.right");
783
- case f.Edge.Bottom: return e("border.bottom");
784
- case f.Edge.Horizontal: return e("border.insideHorizontal");
785
- case f.Edge.Vertical: return e("border.insideVertical");
786
- case f.Edge.DiagonalUp: return e("border.diagonalUp");
787
- case f.Edge.DiagonalDown: return e("border.diagonalDown");
788
- default: return t;
789
- }
790
- }
791
- var ze = (e) => 0 === e ? "0px" : 1 === e ? "calc(100% - 1px)" : `calc(${100 * e}% - 0.5px)`, Re = (e, t) => {
792
- const o = "-7px", r = [];
793
- for (let e = 0; e <= t; e++) {
794
- const n = ze(e / t);
795
- r.push({
796
- left: n,
797
- top: o,
798
- width: "1px",
799
- height: "5px"
800
- }), r.push({
801
- left: n,
802
- bottom: o,
803
- width: "1px",
804
- height: "5px"
805
- });
806
- }
807
- for (let t = 0; t <= e; t++) {
808
- const n = ze(t / e);
809
- r.push({
810
- top: n,
811
- left: o,
812
- height: "1px",
813
- width: "5px"
814
- }), r.push({
815
- top: n,
816
- right: o,
817
- height: "1px",
818
- width: "5px"
819
- });
820
- }
821
- return r;
822
- }, Be = (e) => e === f.Edge.Left || e === f.Edge.Vertical || e === f.Edge.Right, Pe = (e) => {
823
- switch (e) {
824
- case f.Edge.Top:
825
- case f.Edge.Left: return 0;
826
- case f.Edge.Horizontal:
827
- case f.Edge.Vertical: return .5;
828
- default: return 1;
829
- }
830
- };
831
- var Ie = (e) => {
832
- const { edges: t, createBorder: o, onToggleEdges: r, omittedEdges: n, disabled: a = !1, height: l = 104, className: i, ...d } = e, s = A(), c = I(null), [m, g] = M(ke), p = z((e) => !n?.includes(e), [n]), u = z((e) => !a && p(e), [a, p]), h = p(f.Edge.Horizontal) ? 2 : 1, b = p(f.Edge.Vertical) ? 2 : 1, y = z((e) => o({
833
- top: 0 === e.rowIndex ? t.top : t.horizontal,
834
- bottom: e.rowIndex === h - 1 ? t.bottom : t.horizontal,
835
- left: 0 === e.colIndex ? t.left : t.vertical,
836
- right: e.colIndex === b - 1 ? t.right : t.vertical,
837
- diagonalUp: t.diagonalUp,
838
- diagonalDown: t.diagonalDown
839
- }), [
840
- t,
841
- o,
842
- h,
843
- b
844
- ]), x = z((e) => {
845
- const t = c.current;
846
- if (!t) return ke;
847
- const o = t.getBoundingClientRect();
848
- return function(e, t, o, r, n) {
849
- if (o <= 0 || r <= 0) return ke;
850
- const a = Math.min(10, o / 5, r / 5);
851
- if (Ae.every(n) && Math.abs(e - o / 2) <= a && Math.abs(t - r / 2) <= a) return Ae;
852
- const l = Math.abs(e) <= a, i = Math.abs(e - o) <= a, d = Math.abs(t) <= a, s = Math.abs(t - r) <= a;
853
- if ((l || i) && (d || s)) {
854
- const e = l === d ? f.Edge.DiagonalDown : f.Edge.DiagonalUp;
855
- if (n(e)) return De.get(e);
856
- }
857
- let c = null, m = Number.POSITIVE_INFINITY;
858
- for (const a of Fe) {
859
- if (!n(a)) continue;
860
- const l = Be(a), i = l ? r : o, d = l ? t : e, s = Math.max(0, -d, d - i), g = (l ? e : t) - Pe(a) * (l ? o : r), p = Math.hypot(s, g);
861
- p < m && (m = p, c = a);
862
- }
863
- return c && m <= a ? De.get(c) : ke;
864
- }(e.clientX - o.left, e.clientY - o.top, o.width, o.height, u);
865
- }, [u]);
866
- return G(q, {
867
- className: ge("sxl-border-preview", i),
868
- ...d,
869
- onPointerMove: (e) => g(x(e)),
870
- onPointerLeave: () => g(ke),
871
- onClick: (e) => {
872
- const t = x(e);
873
- t.length > 0 && r(t);
874
- },
875
- sx: {
876
- position: "relative",
877
- boxSizing: "border-box",
878
- height: `${l}px`,
879
- width: "100%",
880
- padding: "10px",
881
- cursor: m.length > 0 ? "pointer" : "default",
882
- borderRadius: (e) => `${e.shape.borderRadius}px`,
883
- border: (e) => `1px solid ${e.palette.divider}`,
884
- opacity: a ? .6 : 1
885
- },
886
- children: Y(q, {
887
- ref: c,
888
- sx: {
889
- position: "relative",
890
- width: "100%",
891
- height: "100%"
892
- },
893
- children: [
894
- G(q, {
895
- "aria-hidden": "true",
896
- sx: {
897
- position: "absolute",
898
- inset: 0,
899
- display: "grid",
900
- gridTemplateColumns: `repeat(${b}, 1fr)`,
901
- gridTemplateRows: `repeat(${h}, 1fr)`,
902
- gap: "2px",
903
- pointerEvents: "none",
904
- "& > div": { backgroundColor: (e) => ce(e.palette.text.primary, .05) }
905
- },
906
- children: Array.from({ length: h * b }, (e, t) => G("div", {}, t))
907
- }),
908
- G(q, {
909
- "aria-hidden": "true",
910
- sx: {
911
- position: "absolute",
912
- inset: 0,
913
- pointerEvents: "none",
914
- "& > div": {
915
- position: "absolute",
916
- backgroundColor: (e) => e.palette.text.secondary
917
- }
918
- },
919
- children: Re(h, b).map((e, t) => G("div", { style: e }, t))
920
- }),
921
- m.length > 0 ? Y(q, {
922
- "aria-hidden": "true",
923
- sx: {
924
- position: "absolute",
925
- inset: 0,
926
- pointerEvents: "none",
927
- opacity: .22,
928
- "& > div": {
929
- position: "absolute",
930
- borderRadius: "3px",
931
- backgroundColor: (e) => e.palette.text.primary
932
- },
933
- "& line": { stroke: (e) => e.palette.text.primary }
934
- },
935
- children: [m.filter((e) => !Oe(e)).map((e) => G("div", { style: Me(e) }, e)), m.some(Oe) ? G("svg", {
936
- viewBox: "0 0 100 100",
937
- preserveAspectRatio: "none",
938
- style: {
939
- position: "absolute",
940
- inset: 0,
941
- width: "100%",
942
- height: "100%",
943
- overflow: "visible"
944
- },
945
- children: m.filter(Oe).flatMap((e) => function(e, t, o) {
946
- const r = [];
947
- for (let n = 0; n < t; n++) for (let a = 0; a < o; a++) {
948
- const l = a / o * 100, i = (a + 1) / o * 100, d = n / t * 100, s = (n + 1) / t * 100, c = e === f.Edge.DiagonalDown;
949
- r.push(G("line", {
950
- x1: l,
951
- y1: c ? d : s,
952
- x2: i,
953
- y2: c ? s : d,
954
- strokeWidth: 6,
955
- strokeLinecap: "round",
956
- vectorEffect: "non-scaling-stroke"
957
- }, `${e}:${n}:${a}`));
958
- }
959
- return r;
960
- }(e, h, b))
961
- }) : null]
962
- }) : null,
963
- G(S, {
964
- getBorderAt: y,
965
- rowCount: h,
966
- columnCount: b,
967
- style: {
968
- position: "absolute",
969
- inset: 0,
970
- height: "100%",
971
- width: "100%"
972
- }
973
- }),
974
- Fe.filter(p).map((e) => G(q, {
975
- component: "button",
976
- type: "button",
977
- "aria-label": Ne(s, e),
978
- "aria-pressed": !!t[e],
979
- title: Ne(s, e),
980
- disabled: !u(e),
981
- onClick: (t) => {
982
- t.stopPropagation(), r(De.get(e));
983
- },
984
- sx: {
985
- position: "absolute",
986
- appearance: "none",
987
- background: "transparent",
988
- border: "none",
989
- padding: 0,
990
- pointerEvents: "none",
991
- borderRadius: "3px",
992
- "&:focus-visible": { outline: (e) => `2px solid ${e.palette.primary.main}` },
993
- ...Me(e)
994
- }
995
- }, e))
996
- ]
997
- })
998
- });
999
- };
1000
- function Me(e) {
1001
- const t = `calc(${100 * Pe(e)}% - 3px)`;
1002
- return Be(e) ? {
1003
- top: 0,
1004
- bottom: 0,
1005
- left: t,
1006
- width: "6px"
1007
- } : {
1008
- left: 0,
1009
- right: 0,
1010
- top: t,
1011
- height: "6px"
1012
- };
1013
- }
1014
- Ie.displayName = "BorderPreview";
1015
- var He = f.StrokeStyle.Thin, Ve = Object.freeze([
1016
- f.Edge.Left,
1017
- f.Edge.Top,
1018
- f.Edge.Right,
1019
- f.Edge.Bottom
1020
- ]), Le = Object.freeze([f.Edge.Horizontal, f.Edge.Vertical]), Ue = Object.freeze([...Ve, ...Le]), $e = Object.freeze([f.Edge.DiagonalUp, f.Edge.DiagonalDown]), je = Object.freeze([...Ue, ...$e]), We = (e, t, o) => {
1021
- const r = {
1022
- style: t,
1023
- color: o?.toString()
1024
- }, n = {};
1025
- for (const t of e) n[t] = r;
1026
- return n;
1027
- }, _e = (e) => {
1028
- const t = {};
1029
- for (const o of e) t[o] = null;
1030
- return t;
1031
- }, Ge = (e) => e ? e.toString() : null, Ye = N((o) => {
1032
- const { selection: n, disabled: a, className: l, ...i } = o, d = A(), { getEdgeStroke: m, createBorder: g, applyStyle: h, styles: b, schemeLookup: y, autoColor: x, darkMode: S, hasInnerHorizontal: v, hasInnerVertical: E } = n, w = a || n.disabled, T = C((e) => e === f.Edge.Horizontal ? !v : e === f.Edge.Vertical && !E, [v, E]), [F, k] = M(() => {
1033
- const e = m(f.Edge.Bottom)?.getStyle();
1034
- return e && e !== f.StrokeStyle.None ? e : He;
1035
- }), [D, O] = M(() => {
1036
- const e = m(f.Edge.Bottom);
1037
- return !e || e.isNone() ? null : e.getProperties().color ? e.getColor() : null;
1038
- }), N = C(() => b.recentColors(), [b]), z = C((e) => {
1039
- h({ borders: e }, me("op.setBorders"));
1040
- }, [h]), R = C((e) => {
1041
- 0 !== e.length && h([{ borders: _e(e) }, { borders: We(e, F, D) }], me("op.setBorders"));
1042
- }, [
1043
- h,
1044
- F,
1045
- D
1046
- ]), B = C((e) => {
1047
- 0 !== e.length && z(We(e, f.StrokeStyle.None, null));
1048
- }, [z]), P = C((e) => {
1049
- R(e.filter((e) => !T(e)));
1050
- }, [R, T]), I = {};
1051
- for (const e of je) {
1052
- const t = m(e);
1053
- t && !t.isNone() && (I[e] = t.getProperties());
1054
- }
1055
- const H = C((e) => {
1056
- const t = I[e];
1057
- return (t?.style ?? f.StrokeStyle.None) === F && Ge(t?.color) === Ge(D);
1058
- }, [
1059
- I,
1060
- F,
1061
- D
1062
- ]), L = (e) => {
1063
- const t = e.filter((e) => !T(e));
1064
- return t.length > 0 && t.every(H);
1065
- }, U = C((e) => {
1066
- const t = e.filter((e) => !T(e));
1067
- F === f.StrokeStyle.None || t.every(H) ? B(t) : R(t);
1068
- }, [
1069
- B,
1070
- R,
1071
- H,
1072
- T,
1073
- F
1074
- ]), j = (e) => We(e, F, D), W = (e, o, r) => G(V, {
1075
- disabled: w,
1076
- icon: G(t, {
1077
- border: e.length > 0 ? j(e) : null,
1078
- createBorder: g
1079
- }),
1080
- propsTooltip: {
1081
- label: o,
1082
- simple: !0
1083
- },
1084
- onClick: r
1085
- }), _ = (e, o) => {
1086
- const r = w || e.every(T);
1087
- return G(V, {
1088
- disabled: r,
1089
- selected: !r && F !== f.StrokeStyle.None && L(e),
1090
- icon: G(t, {
1091
- border: j(e),
1092
- createBorder: g
1093
- }),
1094
- propsTooltip: {
1095
- label: o,
1096
- simple: !0
1097
- },
1098
- onClick: () => U(e)
1099
- });
1100
- }, Q = (e) => _([e], Ne(d, e));
1101
- return Y(q, {
1102
- className: ge("sxl-format-border-panel", l),
1103
- sx: c,
1104
- ...i,
1105
- children: [
1106
- Y(s, { children: [G(r, {
1107
- disabled: w || F === f.StrokeStyle.None,
1108
- darkMode: S,
1109
- icon: G(K, { iconKey: "stroke.colored" }),
1110
- tooltip: d("border.colorTooltip"),
1111
- selectedColor: D,
1112
- onSelectColor: (e) => O(e),
1113
- propsPanel: {
1114
- disableAlpha: !0,
1115
- schemeLookup: y,
1116
- recentColors: N,
1117
- autoColor: x
1118
- }
1119
- }), G(e, {
1120
- disabled: w,
1121
- darkMode: S,
1122
- selectedStyle: F,
1123
- styleColor: D,
1124
- variant: $.Toolbar,
1125
- onSelectStyle: (e) => k(e ?? f.StrokeStyle.None)
1126
- })] }),
1127
- Y(u, {
1128
- sx: { justifyContent: "center" },
1129
- children: [
1130
- W(Ue, d("border.all"), () => P(Ue)),
1131
- W(Ve, d("border.outside"), () => P(Ve)),
1132
- W([], d("border.none"), () => z(null))
1133
- ]
1134
- }),
1135
- Y(p, {
1136
- sx: { px: 1.5 },
1137
- children: [Y(q, {
1138
- sx: {
1139
- display: "grid",
1140
- gridTemplateColumns: "auto minmax(0, 156px) auto",
1141
- justifyContent: "center",
1142
- columnGap: .5,
1143
- rowGap: .25,
1144
- minWidth: 0
1145
- },
1146
- children: [
1147
- Y(q, {
1148
- sx: {
1149
- display: "flex",
1150
- flexDirection: "column",
1151
- justifyContent: "space-between",
1152
- height: "104px"
1153
- },
1154
- children: [
1155
- Q(f.Edge.Top),
1156
- Q(f.Edge.Horizontal),
1157
- Q(f.Edge.Bottom)
1158
- ]
1159
- }),
1160
- G(Ie, {
1161
- edges: I,
1162
- createBorder: g,
1163
- disabled: w,
1164
- height: 104,
1165
- omittedEdges: Ue.filter(T),
1166
- onToggleEdges: U
1167
- }),
1168
- G(q, {
1169
- sx: {
1170
- display: "flex",
1171
- alignItems: "center"
1172
- },
1173
- children: _(Le, d("border.inner"))
1174
- }),
1175
- Q(f.Edge.DiagonalUp),
1176
- Y(q, {
1177
- sx: {
1178
- display: "flex",
1179
- justifyContent: "space-between",
1180
- minWidth: 0
1181
- },
1182
- children: [
1183
- Q(f.Edge.Left),
1184
- Q(f.Edge.Vertical),
1185
- Q(f.Edge.Right)
1186
- ]
1187
- }),
1188
- Q(f.Edge.DiagonalDown)
1189
- ]
1190
- }), G(se, {
1191
- variant: "caption",
1192
- component: "div",
1193
- sx: {
1194
- color: "text.secondary",
1195
- lineHeight: 1.4,
1196
- textAlign: "center"
1197
- },
1198
- children: d("format.borderDiagram")
1199
- })]
1200
- })
1201
- ]
1202
- });
1203
- });
1204
- Ye.displayName = "BorderPanel";
1205
- var qe = {
1206
- Number: "number",
1207
- Alignment: "alignment",
1208
- Font: "font",
1209
- Border: "border",
1210
- Fill: "fill"
1211
- }, Qe = "format.tab", Je = Object.freeze([
1212
- qe.Number,
1213
- qe.Alignment,
1214
- qe.Font,
1215
- qe.Border,
1216
- qe.Fill
1217
- ]), Ze = N((e) => {
1218
- const t = e.model, o = A();
1219
- T(t, "onSelectedSheetChange");
1220
- const r = t.getSelectedWorksheet();
1221
- if (!r) {
1222
- const { model: t, args: r, entryKey: n, frame: a, ref: l, ...i } = e;
1223
- return G(ne, {
1224
- square: !0,
1225
- ref: l,
1226
- sx: {
1227
- display: "flex",
1228
- flex: "1 1 auto",
1229
- padding: (e) => e.spacing(2, 2)
1230
- },
1231
- ...i,
1232
- children: o("format.noWorksheet")
1233
- });
1234
- }
1235
- return G(Xe, {
1236
- ...e,
1237
- sheet: r
1238
- });
1239
- });
1240
- Ze.displayName = "FormatTaskPane";
1241
- var Xe = N((e) => {
1242
- const { model: t, sheet: o, args: r, entryKey: n, frame: a, ref: l, ...i } = e, d = A(), s = ((e) => {
1243
- const [, t] = P((e) => e + 1, 0);
1244
- w(e, {
1245
- onSelectionChange: () => t(),
1246
- onStyleChange: () => t()
1247
- });
1248
- const [o] = F(["formatBoldToggle"]), r = E(), n = e.getSelectedCell(), a = e.getStyles(), l = e.getSelectedRanges(), i = C((t, o, r) => {
1249
- const n = Array.isArray(t) ? t : [t];
1250
- e.doBatch(() => {
1251
- for (const t of n) e.getSelectedRanges().getStyle().update(t, {
1252
- autoSelect: pe,
1253
- autoFit: r ?? !0
1254
- });
1255
- }, { description: o ?? me("op.updateStyle") });
1256
- }, [e]), d = C((t) => e.createCell(t), [e]), s = C((e) => a.getNormal().createStyle({ borders: e }).getBorders(), [a]), c = l.getCoords()[0], m = C((t) => {
1257
- if (!c) return null;
1258
- const o = (t, o) => e.getCell({
1259
- rowIndex: t,
1260
- colIndex: o
1261
- }).getStyle(!0).getBorders();
1262
- switch (t) {
1263
- case f.Edge.Top: return o(c.rowStart, c.colStart).getTop();
1264
- case f.Edge.Left: return o(c.rowStart, c.colStart).getLeft();
1265
- case f.Edge.Bottom: return o(c.rowEnd, c.colEnd).getBottom();
1266
- case f.Edge.Right: return o(c.rowEnd, c.colEnd).getRight();
1267
- case f.Edge.Horizontal: return c.rowEnd <= c.rowStart ? null : o(c.rowStart + 1, c.colStart).getTop();
1268
- case f.Edge.Vertical: return c.colEnd <= c.colStart ? null : o(c.rowStart, c.colStart + 1).getLeft();
1269
- case f.Edge.DiagonalUp: return o(c.rowStart, c.colStart).getDiagonalUp();
1270
- case f.Edge.DiagonalDown: return o(c.rowStart, c.colStart).getDiagonalDown();
1271
- default: return null;
1272
- }
1273
- }, [e, c]);
1274
- return {
1275
- sheet: e,
1276
- cell: n,
1277
- style: n.getStyle(),
1278
- styles: a,
1279
- schemeLookup: a.schemeLookup(),
1280
- autoColor: a.getNormal().getFont().getColor(),
1281
- darkMode: "dark" === r,
1282
- disabled: o?.disabled() ?? !1,
1283
- applyStyle: i,
1284
- createCell: d,
1285
- createBorder: s,
1286
- getEdgeStroke: m,
1287
- hasInnerHorizontal: l.getRowCount() > 1,
1288
- hasInnerVertical: l.getColumnCount() > 1
1289
- };
1290
- })(o), [c, m] = k(Qe, qe.Number), p = Je.includes(c) ? c : qe.Number;
1291
- R(() => {
1292
- const e = r?.tab;
1293
- e && m(e);
1294
- }, [r]);
1295
- const u = s.style.getNumberFormat(), h = "number" == typeof u ? x.resolve(u) : u ?? "General";
1296
- return Y(ne, {
1297
- square: !0,
1298
- ref: l,
1299
- sx: {
1300
- display: "flex",
1301
- flexDirection: "column",
1302
- flex: "1 1 auto",
1303
- width: "100%",
1304
- height: "100%",
1305
- minHeight: 0,
1306
- overflow: "hidden"
1307
- },
1308
- ...i,
1309
- children: [
1310
- G(q, {
1311
- sx: {
1312
- flexShrink: 0,
1313
- padding: (e) => e.spacing(1.5, 2)
1314
- },
1315
- children: G(ue, { selection: s })
1316
- }),
1317
- G(ie, {
1318
- value: p,
1319
- onChange: (e, t) => m(t),
1320
- variant: "scrollable",
1321
- scrollButtons: "auto",
1322
- allowScrollButtonsMobile: !0,
1323
- sx: {
1324
- minHeight: 0,
1325
- flexShrink: 0,
1326
- borderBottom: (e) => `1px solid ${e.palette.divider}`,
1327
- "& .MuiTab-root": {
1328
- textTransform: "none",
1329
- whiteSpace: "nowrap",
1330
- minHeight: 0,
1331
- minWidth: 0,
1332
- flex: "1 0 auto",
1333
- padding: "8px 4px"
1334
- }
1335
- },
1336
- children: Je.map((e) => G(le, {
1337
- value: e,
1338
- label: et(d, e)
1339
- }, e))
1340
- }),
1341
- Y(q, {
1342
- sx: {
1343
- flex: "1 1 auto",
1344
- minHeight: 0,
1345
- overflow: "auto",
1346
- padding: (e) => e.spacing(2.5, 2)
1347
- },
1348
- children: [
1349
- p === qe.Number ? G(ve, {
1350
- hideSample: !0,
1351
- showQuickFormats: !0,
1352
- value: h,
1353
- disabled: s.disabled,
1354
- context: () => s.cell,
1355
- onChange: (e) => {
1356
- s.applyStyle({ numberFormat: e }, me("op.setNumberFormat"));
1357
- }
1358
- }) : null,
1359
- p === qe.Alignment ? G(Ke, { selection: s }) : null,
1360
- p === qe.Font ? G(Ce, { selection: s }) : null,
1361
- p === qe.Fill ? G(b, { selection: g(s) }) : null,
1362
- p === qe.Border ? G(Ye, { selection: s }) : null
1363
- ]
1364
- })
1365
- ]
1366
- });
1367
- });
1368
- function et(e, t) {
1369
- switch (t) {
1370
- case qe.Number: return e("format.tabNumber");
1371
- case qe.Alignment: return e("format.tabAlignment");
1372
- case qe.Font: return e("format.tabFont");
1373
- case qe.Fill: return e("format.tabFill");
1374
- case qe.Border: return e("format.tabBorder");
1375
- default: return t;
1376
- }
1377
- }
1378
- Xe.displayName = "FormatTaskPaneBody";
1379
- export { Qe as FORMAT_TAB_KEY, qe as FormatTab, Ze as FormatTaskPane, Ze as default };