@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.
- package/browser/esm/0BWO0bLZ8Vm_dKd2.mjs +582 -0
- package/browser/esm/BAbq4-I5f5oUiNaF.mjs +141 -0
- package/browser/esm/BED6h6YAwCf1HEQJ.mjs +161 -0
- package/browser/esm/{CEvZe2cZK-voZTif.mjs → BXhNFzyEGokTF-BL.mjs} +5 -5
- package/browser/esm/BYE9gCDWKyx6mnVs.mjs +381 -0
- package/browser/esm/{DBtc4lku0uHVcqWn.mjs → BjvD_4t2KGsZP5V8.mjs} +3 -3
- package/browser/esm/{DU3J8Gcf-WpBxNYg.mjs → BknfGJouygmnpFIU.mjs} +4 -4
- package/browser/esm/{D8al_cJ4U-NgzwoK.mjs → BlE_8o8tO2AgAlaj.mjs} +19 -17
- package/browser/esm/BokqKEpU6TFgfRs6.mjs +252 -0
- package/browser/esm/{DHY19rkSiiRZxShC.mjs → Brsh5yscJ_4uKFXp.mjs} +3 -3
- package/browser/esm/Bujtz_Guj88d03vI.mjs +831 -0
- package/browser/esm/Buqcl7J75MJrhpVE.mjs +1379 -0
- package/browser/esm/BvhYPwX3GrRaO9CM.mjs +319 -0
- package/browser/esm/C0wlMAIn9iREPK6w.mjs +87 -0
- package/browser/esm/C8JU4KsMasmLvojI.mjs +103 -0
- package/browser/esm/{CjznclrKqJRi7u9O.mjs → C9pIZVACtl9unFOp.mjs} +2 -2
- package/browser/esm/CBD4RiRKbbZtSXV-.mjs +318 -0
- package/browser/esm/{Blaj2R5hYxtLAW__.mjs → CEtXsBzEjEKk9GOj.mjs} +6 -6
- package/browser/esm/{CIu1bjPJe_x31Oww.mjs → COlZu93LRwuBvjE-.mjs} +3 -3
- package/browser/esm/{CoSiOS-og0zFw4Ws.mjs → CTjqDD-swFMZzI-Y.mjs} +2 -2
- package/browser/esm/CWkOgdL7mOKiTR62.mjs +975 -0
- package/browser/esm/ChSVxkPTIjgcC8PL.mjs +412 -0
- package/browser/esm/{5cbK03T_Oh3tNdR7.mjs → ClBvNPeNCAhuVWrG.mjs} +1 -1
- package/browser/esm/CyLn6zOOp_biA3xU.mjs +335 -0
- package/browser/esm/CynTY0oNtyJnoaBq.mjs +14 -0
- package/browser/esm/{xKiLJKiLxto8SayF.mjs → D3rRUK4dIM5gUSmj.mjs} +2 -2
- package/browser/esm/D9ISy7VkaRRFJl46.mjs +515 -0
- package/browser/esm/{fb126BNj3F8URR19.mjs → DDc6rDuU9JAo1DH_.mjs} +3 -3
- package/browser/esm/DDczwkXhz_MHub4z.mjs +197 -0
- package/browser/esm/{X1Db3b_7b_7OuCk6.mjs → DEv4pIEgYr5C7etm.mjs} +1 -1
- package/browser/esm/DG21x7RKDpge6zAE.mjs +31 -0
- package/browser/esm/DJOOed_OtB-XT7f3.mjs +437 -0
- package/browser/esm/{9eKCkvqpMQwqcXiw.mjs → DKtJxrpN0axtuQ0l.mjs} +1 -1
- package/browser/esm/DRSCS6aLiYmPjUz1.mjs +1543 -0
- package/browser/esm/{ByeL_BZuJ2kl8gtf.mjs → DTpRkgsTm_zYnWfW.mjs} +1 -1
- package/browser/esm/DV6i9RQZfJiKtEaJ.mjs +2552 -0
- package/browser/esm/DdcZrjMLWVukWcU5.mjs +7473 -0
- package/browser/esm/Di3BUxA0SqFWWgeg.mjs +94 -0
- package/browser/esm/DnGaP5F7mLwCGUYG.mjs +408 -0
- package/browser/esm/DpD4fg2WcyiKX_2K.mjs +414 -0
- package/browser/esm/{C1Rp2hZrApo5MUc8.mjs → Ds3XRkne7HxcXD8J.mjs} +2 -2
- package/browser/esm/{sFOAxZpxXo-qvDSp.mjs → DsoNMWDwHZP8UXQd.mjs} +1 -1
- package/browser/esm/G0Inqm6Eqw47dMpa.mjs +212 -0
- package/browser/esm/{B1Yp_uy1vFHcJB3U.mjs → HViD4Wfoi0mmqk9w.mjs} +1 -1
- package/browser/esm/LZoYSQAYV2wksnDv.mjs +386 -0
- package/browser/esm/{CtEFHbzYNvYjDYvi.mjs → QgaAIDUMmBQBsXP9.mjs} +8 -8
- package/browser/esm/{D6S8kVTzOjCn0-SK.mjs → YThnrg3PadGs7B4j.mjs} +51 -51
- package/browser/esm/index.mjs +1028 -170
- package/browser/esm/ttjcNHcFn8O6hfnd.mjs +1288 -0
- package/browser/esm/{yZxC4qUENOlMhVUH.mjs → w_JrR69vEpvoyeMy.mjs} +1 -1
- package/browser/esm/{DmCQbW4zwkT_Rq88.mjs → xFqkfN8QMCxvsetB.mjs} +1 -1
- package/browser/esm/{IQLeaAbtGTipUsOD.mjs → zqilJefihVd7At2T.mjs} +22 -21
- package/licenses/dependencies.txt +94 -94
- package/node/esm/{BYsG3KYVmxSe_CIQ.mjs → 1bf4gn-2vld4BZ9u.mjs} +1 -1
- package/node/esm/{CKu1AtRgyltyEdEN.mjs → 3WghtBXAvCDwcVrq.mjs} +1 -1
- package/node/esm/{cqzp431iNSLWictb.mjs → 4HmLH0bPVJCZLgik.mjs} +22 -22
- package/node/esm/{BYVLi0md4AYuDsB_.mjs → B0bdb_6p7fQI_ivo.mjs} +28 -28
- package/node/esm/BIMkjQUwG4Ih-6Sh.mjs +142 -0
- package/node/esm/BNg4QQY0WAPLE0q7.mjs +141 -0
- package/node/esm/BPzcW4BejRqso338.mjs +72 -0
- package/node/esm/BR45ogAR-hY2bE60.mjs +318 -0
- package/node/esm/BlN7G0DVC24zauig.mjs +197 -0
- package/node/esm/{ah3CUg4-VmNstGk_.mjs → Bph-sR3l6AYWeuxK.mjs} +2 -2
- package/node/esm/CPq-MIdEnc-53JpF.mjs +319 -0
- package/node/esm/CSAnTp5rwId0DUb8.mjs +380 -0
- package/node/esm/CWcv7UVXF8IUB0PC.mjs +1379 -0
- package/node/esm/{D9rzScOA9pEYFrtz.mjs → CYIoK22I6Yvv12_x.mjs} +20 -20
- package/node/esm/CZyA9uD4SkTvqp_G.mjs +1283 -0
- package/node/esm/{ci8d-mF1H9wnYzix.mjs → CjC6s3RUJQNCF7mP.mjs} +1 -1
- package/node/esm/{D6oQL8knsPpgdXuk.mjs → CuMePia6i_8yfJ6S.mjs} +9 -9
- package/node/esm/CvRbu8JPxFarsSR-.mjs +412 -0
- package/node/esm/{DNSjK5DAH3M14Qbc.mjs → CyafafEgfmjLqE5O.mjs} +1 -1
- package/node/esm/D-xqQ5qOSd6WrzwJ.mjs +94 -0
- package/node/esm/DLqBHdFp6wvm6EGs.mjs +212 -0
- package/node/esm/{BcwMb6CyVfvEwbHn.mjs → DMXLxp3T0E0SRTQc.mjs} +1 -1
- package/node/esm/{DZzvTQxIKr9LbEsA.mjs → DWqvf4H5F2wMnZ0L.mjs} +32 -30
- package/node/esm/DatM6eEYPpAtIMy-.mjs +405 -0
- package/node/esm/Db3dbaYLKUO66T9s.mjs +1689 -0
- package/node/esm/{B_jRGdwGFkudwmL-.mjs → DdEzhVqYTrGODXrz.mjs} +1 -1
- package/node/esm/DeZJlLk8WJ3BLtLs.mjs +975 -0
- package/node/esm/DfCuL8AUxMFoEG2s.mjs +519 -0
- package/node/esm/{Bb1sLMqXWKjdve23.mjs → Do-zCKziWhoG5eAv.mjs} +2 -2
- package/node/esm/{B8SQfjKjzYHLxzZR.mjs → DpJ2gmZJioCyq8La.mjs} +67 -67
- package/node/esm/{ETK6T6G0SIcFXDe5.mjs → XEDcegsv5AGKBfu2.mjs} +40 -40
- package/node/esm/index.mjs +8941 -13558
- package/node/esm/yCUxQuqVuC4DHKPx.mjs +385 -0
- package/node/esm/zITjZ7R4raDqhP-n.mjs +515 -0
- package/package.json +9 -9
- package/resources/locales/de/ui.msg.json +97 -0
- package/resources/locales/en/ui.msg.json +97 -0
- package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +4 -4
- package/types/src/anomalies/AnomaliesPlugin.d.ts +5 -0
- package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
- package/types/src/anomalies/index.d.ts +3 -0
- package/types/src/border/BorderTemplateIcon.d.ts +6 -1
- package/types/src/chart/ChartFormatPanel.d.ts +20 -0
- package/types/src/chart/ChartPlugin.d.ts +6 -0
- package/types/src/chart/index.d.ts +3 -0
- package/types/src/comments/CommentCard.d.ts +2 -2
- package/types/src/conditions/useFormulaOption.d.ts +2 -2
- package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
- package/types/src/format/BorderPreview.d.ts +11 -4
- package/types/src/format/useFormatSelection.d.ts +4 -4
- package/types/src/formulaBar/MobileFormulaBar.d.ts +18 -6
- package/types/src/formulaBar/MobileInputToolbar.d.ts +9 -3
- package/types/src/formulaBar/useFormulaBarSession.d.ts +6 -3
- package/types/src/index.d.ts +15 -6
- package/types/src/protection/ProtectedCellsPanel.d.ts +2 -2
- package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
- package/types/src/protection/index.d.ts +1 -1
- package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +2 -2
- package/types/src/workbook/DefaultRenderers.d.ts +2 -2
- package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
- package/browser/esm/Biy7bhzzzPb5sfRN.mjs +0 -152
- package/browser/esm/COv-m-c2byCgvU3M.mjs +0 -14861
- package/browser/esm/Die9NXVFveHvcCT-.mjs +0 -4205
- package/browser/esm/sam1KGQZ59B_fADz.mjs +0 -1941
- package/node/esm/BYwXhrEwkRAt9nJS.mjs +0 -71
- package/node/esm/Cmt8Wv806N7NmE4Y.mjs +0 -3344
|
@@ -0,0 +1,1379 @@
|
|
|
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 { r as e, t } from "./Bujtz_Guj88d03vI.mjs";
|
|
8
|
+
import { t as n } from "./C8JU4KsMasmLvojI.mjs";
|
|
9
|
+
import { t as r } from "./ClBvNPeNCAhuVWrG.mjs";
|
|
10
|
+
import { a as i, c as a, i as o, n as s, o as c, t as l } from "./0BWO0bLZ8Vm_dKd2.mjs";
|
|
11
|
+
import { a as u, c as d, i as f, n as p, o as m, r as h, s as g, t as _ } from "./BvhYPwX3GrRaO9CM.mjs";
|
|
12
|
+
import { IBorders as v, IRange as y, NumberFormat as b } from "@sheetxl/sdk";
|
|
13
|
+
import { StaticBorderRenderer as x, StaticCellRenderer as S, useGridColorScheme as C, useModelListener as w, useModelSync as T } from "@sheetxl/react";
|
|
14
|
+
import { DynamicIcon as ee, useCallbackRef as E, useCommands as D, usePersistentState as te, useTranslator as O } from "@sheetxl/utils-react";
|
|
15
|
+
import { forwardRef as k, memo as A, useCallback as j, useEffect as M, useMemo as N, useReducer as P, useRef as F, useState as I } from "react";
|
|
16
|
+
import { CommandButton as L, ExhibitIconButton as ne, ExhibitMenuItem as R, ExhibitPopupIconButton as re, PopupButtonType as ie, SelectedIcon as ae, defaultCreatePopupPanel as oe } from "@sheetxl/utils-mui";
|
|
17
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
18
|
+
import { Box as H, Checkbox as se, FormControl as U, FormControlLabel as ce, InputLabel as le, List as ue, ListItemButton as de, ListItemText as fe, MenuItem as pe, Paper as W, Select as me, Tab as he, Tabs as G, TextField as ge, Typography as K, alpha as q } from "@mui/material";
|
|
19
|
+
import { messageKey as J } from "@sheetxl/utils";
|
|
20
|
+
var _e = {
|
|
21
|
+
autoFocus: !1,
|
|
22
|
+
scrollIntoView: !1
|
|
23
|
+
}, ve = A((e) => {
|
|
24
|
+
let { selection: t, height: n = 46, maxWidth: r = 260, ...i } = e, a = O(), { cell: o, createCell: s, disabled: c } = t, l = N(() => typeof o.getValue() == "number" ? o : s({
|
|
25
|
+
value: 1234.56,
|
|
26
|
+
style: o.getStyle()
|
|
27
|
+
}), [o, s]);
|
|
28
|
+
return V(H, {
|
|
29
|
+
sx: {
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
gap: .5
|
|
33
|
+
},
|
|
34
|
+
...i,
|
|
35
|
+
children: [B(K, {
|
|
36
|
+
variant: "caption",
|
|
37
|
+
component: "div",
|
|
38
|
+
children: a("format.preview")
|
|
39
|
+
}), B(S, {
|
|
40
|
+
cell: l,
|
|
41
|
+
disabled: c,
|
|
42
|
+
style: {
|
|
43
|
+
width: "100%",
|
|
44
|
+
maxWidth: `${r}px`,
|
|
45
|
+
height: `${n}px`,
|
|
46
|
+
flex: "0 0 auto",
|
|
47
|
+
border: "1px solid var(--sxl-color-base-300, rgb(224, 224, 224))"
|
|
48
|
+
},
|
|
49
|
+
propsBorder: { style: {
|
|
50
|
+
height: "100%",
|
|
51
|
+
width: "100%"
|
|
52
|
+
} }
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
ve.displayName = "FormatCellPreview";
|
|
57
|
+
var { Builder: Y } = b, ye = {
|
|
58
|
+
py: "2px",
|
|
59
|
+
px: 1,
|
|
60
|
+
minHeight: 0,
|
|
61
|
+
"& .MuiListItemText-root": { my: 0 },
|
|
62
|
+
"& .MuiListItemText-primary": {
|
|
63
|
+
fontSize: "0.8125rem",
|
|
64
|
+
lineHeight: 1.5
|
|
65
|
+
},
|
|
66
|
+
"& .MuiListItemText-secondary": {
|
|
67
|
+
fontSize: "0.7rem",
|
|
68
|
+
lineHeight: 1.3
|
|
69
|
+
}
|
|
70
|
+
}, be = {
|
|
71
|
+
border: (e) => `1px solid ${e.palette.divider}`,
|
|
72
|
+
borderRadius: (e) => `${e.shape.borderRadius}px`,
|
|
73
|
+
overflow: "auto",
|
|
74
|
+
maxHeight: 260
|
|
75
|
+
};
|
|
76
|
+
function xe(e, t, n) {
|
|
77
|
+
switch (t) {
|
|
78
|
+
case "minus": return e("numberFormat.negMinus");
|
|
79
|
+
case "red": return e("numberFormat.negRed");
|
|
80
|
+
case "parens": return e("numberFormat.negParens");
|
|
81
|
+
case "redParens": return e("numberFormat.negRedParens");
|
|
82
|
+
default: return n;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function Se(e, t, n) {
|
|
86
|
+
let r = t?.getValue();
|
|
87
|
+
return e === "Text" ? typeof r == "string" ? r : n : e === "Date" || e === "Time" ? typeof r == "number" ? r : 45658.625 : typeof r == "number" ? r : 1234.56;
|
|
88
|
+
}
|
|
89
|
+
function X(e, t, n) {
|
|
90
|
+
try {
|
|
91
|
+
return n ? n.createCell({
|
|
92
|
+
value: t,
|
|
93
|
+
style: { numberFormat: e }
|
|
94
|
+
}).getNumberFormat().displayText || "" : b.getEngine().format(e, t, {}).text ?? "";
|
|
95
|
+
} catch {
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
var Ce = A(k((e, t) => {
|
|
100
|
+
let { value: n, onChange: a, context: s, onCommit: l, hideSample: u = !1, showQuickFormats: d = !1, disabled: p = !1, className: h, onKeyDown: _, ...v } = e, y = O(), [x, S] = I(() => Y.parse(n));
|
|
101
|
+
M(() => {
|
|
102
|
+
Y.build(x) !== n && S(Y.parse(n));
|
|
103
|
+
}, [n]);
|
|
104
|
+
let C = s?.() ?? null, w = E((e) => {
|
|
105
|
+
S(e), a(Y.build(e));
|
|
106
|
+
}, [a]), T = E((e) => {
|
|
107
|
+
w({
|
|
108
|
+
...x,
|
|
109
|
+
...e
|
|
110
|
+
});
|
|
111
|
+
}, [x, w]), ee = E(() => {
|
|
112
|
+
a(n);
|
|
113
|
+
}, [a, n]), D = E((e) => {
|
|
114
|
+
if (e === x.category) return;
|
|
115
|
+
let t = Y.defaultCodeForCategory(e), n = Y.isParametricCategory(e) ? Y.parse(t) : {
|
|
116
|
+
category: e,
|
|
117
|
+
code: t
|
|
118
|
+
};
|
|
119
|
+
w(n);
|
|
120
|
+
}, [x.category, w]), te = E((e) => {
|
|
121
|
+
if (_?.(e), e.key === "Enter") {
|
|
122
|
+
if (e.target.closest("[role=\"combobox\"], [role=\"menuitem\"]")) return;
|
|
123
|
+
e.preventDefault(), e.stopPropagation(), l?.();
|
|
124
|
+
}
|
|
125
|
+
}, [_, l]), k = (e, t, n) => (r) => {
|
|
126
|
+
let i = t;
|
|
127
|
+
switch (r.key) {
|
|
128
|
+
case "ArrowDown":
|
|
129
|
+
i = Math.min(e - 1, t + 1);
|
|
130
|
+
break;
|
|
131
|
+
case "ArrowUp":
|
|
132
|
+
i = Math.max(0, t - 1);
|
|
133
|
+
break;
|
|
134
|
+
case "Home":
|
|
135
|
+
i = 0;
|
|
136
|
+
break;
|
|
137
|
+
case "End":
|
|
138
|
+
i = e - 1;
|
|
139
|
+
break;
|
|
140
|
+
default: return;
|
|
141
|
+
}
|
|
142
|
+
r.preventDefault(), i !== t && i >= 0 && n(i), r.currentTarget.querySelectorAll(".MuiListItemButton-root")[i]?.focus();
|
|
143
|
+
}, A = x.category, j = Se(A, C, y("numberFormat.sampleText")), N = X(n, j, C), P = B(f, {
|
|
144
|
+
label: y("numberFormat.decimalPlaces"),
|
|
145
|
+
disabled: p,
|
|
146
|
+
value: x.decimalPlaces ?? 0,
|
|
147
|
+
min: 0,
|
|
148
|
+
max: 30,
|
|
149
|
+
width: 140,
|
|
150
|
+
onChange: (e) => T({ decimalPlaces: e })
|
|
151
|
+
}), F = x.currencySymbol ?? "$", L = V(U, {
|
|
152
|
+
size: "small",
|
|
153
|
+
sx: { width: 140 },
|
|
154
|
+
children: [B(le, {
|
|
155
|
+
shrink: !0,
|
|
156
|
+
children: y("numberFormat.symbol")
|
|
157
|
+
}), B(me, {
|
|
158
|
+
label: y("numberFormat.symbol"),
|
|
159
|
+
notched: !0,
|
|
160
|
+
disabled: p,
|
|
161
|
+
value: F,
|
|
162
|
+
onChange: (e) => T({ currencySymbol: e.target.value }),
|
|
163
|
+
children: Y.CURRENCY_SYMBOLS.map((e) => B(pe, {
|
|
164
|
+
value: e,
|
|
165
|
+
onClick: g(F, e, ee),
|
|
166
|
+
children: e
|
|
167
|
+
}, e))
|
|
168
|
+
})]
|
|
169
|
+
}), ne = B(ce, {
|
|
170
|
+
sx: { alignSelf: "center" },
|
|
171
|
+
control: B(se, {
|
|
172
|
+
size: "small",
|
|
173
|
+
disabled: p,
|
|
174
|
+
checked: !!x.useSeparator,
|
|
175
|
+
onChange: (e) => T({ useSeparator: e.target.checked })
|
|
176
|
+
}),
|
|
177
|
+
label: y("numberFormat.useSeparator")
|
|
178
|
+
}), ie = V(H, {
|
|
179
|
+
sx: {
|
|
180
|
+
display: "flex",
|
|
181
|
+
flexDirection: "column",
|
|
182
|
+
minHeight: 0,
|
|
183
|
+
flex: "1 1 auto"
|
|
184
|
+
},
|
|
185
|
+
children: [B(K, {
|
|
186
|
+
variant: "caption",
|
|
187
|
+
component: "div",
|
|
188
|
+
sx: { mb: .5 },
|
|
189
|
+
children: y("numberFormat.negativeNumbers")
|
|
190
|
+
}), B(ue, {
|
|
191
|
+
dense: !0,
|
|
192
|
+
disablePadding: !0,
|
|
193
|
+
sx: {
|
|
194
|
+
...be,
|
|
195
|
+
flex: "1 1 auto"
|
|
196
|
+
},
|
|
197
|
+
onKeyDown: k(Y.NEGATIVE_STYLES.length, x.negativeStyle ?? 0, (e) => T({ negativeStyle: e })),
|
|
198
|
+
children: Y.NEGATIVE_STYLES.map((e, t) => {
|
|
199
|
+
let n = X(Y.build({
|
|
200
|
+
...x,
|
|
201
|
+
negativeStyle: t
|
|
202
|
+
}), -function(e) {
|
|
203
|
+
return typeof e == "number" ? Math.abs(e) : 1234.56;
|
|
204
|
+
}(j), C);
|
|
205
|
+
return B(de, {
|
|
206
|
+
disabled: p,
|
|
207
|
+
selected: (x.negativeStyle ?? 0) === t,
|
|
208
|
+
onClick: () => T({ negativeStyle: t }),
|
|
209
|
+
sx: ye,
|
|
210
|
+
children: B(fe, {
|
|
211
|
+
primary: n || xe(y, e.key, e.label),
|
|
212
|
+
slotProps: { primary: {
|
|
213
|
+
noWrap: !0,
|
|
214
|
+
sx: {
|
|
215
|
+
color: e.red ? "error.main" : void 0,
|
|
216
|
+
fontVariantNumeric: "tabular-nums"
|
|
217
|
+
}
|
|
218
|
+
} }
|
|
219
|
+
})
|
|
220
|
+
}, e.key);
|
|
221
|
+
})
|
|
222
|
+
})]
|
|
223
|
+
}), W = (e, t) => B(ue, {
|
|
224
|
+
dense: !0,
|
|
225
|
+
disablePadding: !0,
|
|
226
|
+
sx: {
|
|
227
|
+
...be,
|
|
228
|
+
flex: "1 1 auto"
|
|
229
|
+
},
|
|
230
|
+
onKeyDown: k(e.length, e.indexOf(n), (t) => w({
|
|
231
|
+
category: A,
|
|
232
|
+
code: e[t]
|
|
233
|
+
})),
|
|
234
|
+
children: e.map((e) => B(de, {
|
|
235
|
+
disabled: p,
|
|
236
|
+
selected: n === e,
|
|
237
|
+
onClick: () => w({
|
|
238
|
+
category: A,
|
|
239
|
+
code: e
|
|
240
|
+
}),
|
|
241
|
+
sx: ye,
|
|
242
|
+
children: B(fe, {
|
|
243
|
+
primary: t?.[e] ?? X(e, j, C) ?? e,
|
|
244
|
+
secondary: t ? e : void 0,
|
|
245
|
+
slotProps: {
|
|
246
|
+
primary: { noWrap: !0 },
|
|
247
|
+
secondary: { noWrap: !0 }
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
}, e))
|
|
251
|
+
}), he = B(ge, {
|
|
252
|
+
label: y("numberFormat.typeCode"),
|
|
253
|
+
size: "small",
|
|
254
|
+
fullWidth: !0,
|
|
255
|
+
disabled: p,
|
|
256
|
+
value: n,
|
|
257
|
+
error: !!n && !b.Parser.isValidFormat(n),
|
|
258
|
+
helperText: n && !b.Parser.isValidFormat(n) ? y("numberFormat.invalidCode") : " ",
|
|
259
|
+
onChange: (e) => w({
|
|
260
|
+
category: "Custom",
|
|
261
|
+
code: e.target.value
|
|
262
|
+
}),
|
|
263
|
+
slotProps: {
|
|
264
|
+
inputLabel: { shrink: !0 },
|
|
265
|
+
htmlInput: {
|
|
266
|
+
spellCheck: !1,
|
|
267
|
+
autoComplete: "off"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}), G = (e) => B(H, {
|
|
271
|
+
sx: {
|
|
272
|
+
display: "flex",
|
|
273
|
+
flexWrap: "wrap",
|
|
274
|
+
gap: 1.5,
|
|
275
|
+
alignItems: "flex-start"
|
|
276
|
+
},
|
|
277
|
+
children: e
|
|
278
|
+
}), q;
|
|
279
|
+
switch (A) {
|
|
280
|
+
case "General":
|
|
281
|
+
q = B(K, {
|
|
282
|
+
variant: "body2",
|
|
283
|
+
children: y("numberFormat.generalInfo")
|
|
284
|
+
});
|
|
285
|
+
break;
|
|
286
|
+
case "Number":
|
|
287
|
+
q = V(z, { children: [G(V(z, { children: [P, ne] })), ie] });
|
|
288
|
+
break;
|
|
289
|
+
case "Currency":
|
|
290
|
+
q = V(z, { children: [G(V(z, { children: [P, L] })), ie] });
|
|
291
|
+
break;
|
|
292
|
+
case "Accounting":
|
|
293
|
+
q = V(z, { children: [G(V(z, { children: [P, L] })), B(K, {
|
|
294
|
+
variant: "caption",
|
|
295
|
+
color: "text.secondary",
|
|
296
|
+
children: y("numberFormat.accountingInfo")
|
|
297
|
+
})] });
|
|
298
|
+
break;
|
|
299
|
+
case "Percentage":
|
|
300
|
+
case "Scientific":
|
|
301
|
+
q = P;
|
|
302
|
+
break;
|
|
303
|
+
case "Date":
|
|
304
|
+
q = W(Y.DATE_PRESETS);
|
|
305
|
+
break;
|
|
306
|
+
case "Time":
|
|
307
|
+
q = W(Y.TIME_PRESETS);
|
|
308
|
+
break;
|
|
309
|
+
case "Fraction":
|
|
310
|
+
q = W(Y.FRACTION_PRESETS, ((e) => ({
|
|
311
|
+
"# ?/?": e("numberFormat.fractionOneDigit"),
|
|
312
|
+
"# ??/??": e("numberFormat.fractionTwoDigits"),
|
|
313
|
+
"# ???/???": e("numberFormat.fractionThreeDigits"),
|
|
314
|
+
"# ?/2": e("numberFormat.fractionHalves"),
|
|
315
|
+
"# ?/4": e("numberFormat.fractionQuarters"),
|
|
316
|
+
"# ?/8": e("numberFormat.fractionEighths"),
|
|
317
|
+
"# ??/16": e("numberFormat.fractionSixteenths"),
|
|
318
|
+
"# ?/10": e("numberFormat.fractionTenths"),
|
|
319
|
+
"# ??/100": e("numberFormat.fractionHundredths")
|
|
320
|
+
}))(y));
|
|
321
|
+
break;
|
|
322
|
+
case "Special":
|
|
323
|
+
q = W(Y.SPECIAL_PRESETS, ((e) => ({
|
|
324
|
+
"00000": e("numberFormat.specialZip"),
|
|
325
|
+
"00000-0000": e("numberFormat.specialZip4"),
|
|
326
|
+
"[<=9999999]###-####;(###) ###-####": e("numberFormat.specialPhone"),
|
|
327
|
+
"000-00-0000": e("numberFormat.specialSsn")
|
|
328
|
+
}))(y));
|
|
329
|
+
break;
|
|
330
|
+
case "Text":
|
|
331
|
+
q = B(K, {
|
|
332
|
+
variant: "body2",
|
|
333
|
+
children: y("numberFormat.textInfo")
|
|
334
|
+
});
|
|
335
|
+
break;
|
|
336
|
+
case "Custom":
|
|
337
|
+
q = V(z, { children: [he, W(Y.DATE_PRESETS.concat(Y.TIME_PRESETS))] });
|
|
338
|
+
break;
|
|
339
|
+
default: q = null;
|
|
340
|
+
}
|
|
341
|
+
return V(H, {
|
|
342
|
+
ref: t,
|
|
343
|
+
className: r("sxl-number-format-panel", h),
|
|
344
|
+
onKeyDown: te,
|
|
345
|
+
sx: {
|
|
346
|
+
display: "flex",
|
|
347
|
+
flexDirection: "column",
|
|
348
|
+
gap: 1.25
|
|
349
|
+
},
|
|
350
|
+
...v,
|
|
351
|
+
children: [
|
|
352
|
+
u ? null : V(H, { children: [B(K, {
|
|
353
|
+
variant: "caption",
|
|
354
|
+
component: "div",
|
|
355
|
+
sx: { pl: .5 },
|
|
356
|
+
children: y("numberFormat.sample")
|
|
357
|
+
}), B(K, {
|
|
358
|
+
variant: "body1",
|
|
359
|
+
component: "div",
|
|
360
|
+
sx: {
|
|
361
|
+
borderRadius: (e) => `${e.shape.borderRadius}px`,
|
|
362
|
+
padding: (e) => e.spacing(1),
|
|
363
|
+
border: (e) => `1px solid ${e.palette.divider}`,
|
|
364
|
+
minHeight: "1.6em",
|
|
365
|
+
fontVariantNumeric: "tabular-nums",
|
|
366
|
+
overflow: "hidden",
|
|
367
|
+
textOverflow: "ellipsis",
|
|
368
|
+
whiteSpace: "nowrap"
|
|
369
|
+
},
|
|
370
|
+
children: N || " "
|
|
371
|
+
})] }),
|
|
372
|
+
d ? B(o, {
|
|
373
|
+
disabled: p,
|
|
374
|
+
sx: {
|
|
375
|
+
justifyContent: "flex-start",
|
|
376
|
+
paddingBottom: 1
|
|
377
|
+
}
|
|
378
|
+
}) : null,
|
|
379
|
+
B(m, {
|
|
380
|
+
label: y("numberFormat.category"),
|
|
381
|
+
sx: { marginBottom: .5 },
|
|
382
|
+
children: B(re, {
|
|
383
|
+
outlined: !0,
|
|
384
|
+
disabled: p,
|
|
385
|
+
sx: { width: "100%" },
|
|
386
|
+
createPopupPanel: (e) => {
|
|
387
|
+
let { closeFloatAll: t } = e, r = Y.CATEGORIES.map((e) => {
|
|
388
|
+
let r = e === A, a = () => {
|
|
389
|
+
((e) => {
|
|
390
|
+
e === A ? ee() : D(e);
|
|
391
|
+
})(e), t?.();
|
|
392
|
+
};
|
|
393
|
+
return B(R, {
|
|
394
|
+
selected: r,
|
|
395
|
+
icon: B(ae, {
|
|
396
|
+
selected: r,
|
|
397
|
+
children: r ? void 0 : null
|
|
398
|
+
}),
|
|
399
|
+
sx: { display: "flex" },
|
|
400
|
+
onMouseDown: (e) => {
|
|
401
|
+
e.button === 0 && e.preventDefault();
|
|
402
|
+
},
|
|
403
|
+
onMouseUp: (e) => {
|
|
404
|
+
e.button === 0 && a();
|
|
405
|
+
},
|
|
406
|
+
onKeyDown: (e) => {
|
|
407
|
+
e.key !== "Enter" && e.key !== " " || a();
|
|
408
|
+
},
|
|
409
|
+
children: B(i, {
|
|
410
|
+
label: c(y, e),
|
|
411
|
+
sample: (o = e, o === "Custom" && o !== A ? "" : X(o === A ? n : Y.defaultCodeForCategory(o), Se(o, C, y("numberFormat.sampleText")), C))
|
|
412
|
+
})
|
|
413
|
+
}, e);
|
|
414
|
+
var o;
|
|
415
|
+
});
|
|
416
|
+
return oe({
|
|
417
|
+
...e,
|
|
418
|
+
children: B(H, {
|
|
419
|
+
sx: {
|
|
420
|
+
overflow: "auto",
|
|
421
|
+
flex: "1 1 100%"
|
|
422
|
+
},
|
|
423
|
+
children: r
|
|
424
|
+
})
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
icon: B(H, {
|
|
428
|
+
sx: {
|
|
429
|
+
display: "flex",
|
|
430
|
+
flex: "1 1 100%",
|
|
431
|
+
minWidth: 0,
|
|
432
|
+
paddingLeft: "4px",
|
|
433
|
+
paddingRight: "4px",
|
|
434
|
+
fontSize: (e) => `${Math.round(e.typography.fontSize)}px`,
|
|
435
|
+
lineHeight: 1.2,
|
|
436
|
+
fontFamily: (e) => e.typography.fontFamily,
|
|
437
|
+
color: (e) => e.palette.text.secondary
|
|
438
|
+
},
|
|
439
|
+
children: B(H, {
|
|
440
|
+
sx: {
|
|
441
|
+
overflow: "hidden",
|
|
442
|
+
textOverflow: "ellipsis",
|
|
443
|
+
whiteSpace: "pre"
|
|
444
|
+
},
|
|
445
|
+
children: c(y, A)
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
})
|
|
449
|
+
}),
|
|
450
|
+
B(H, {
|
|
451
|
+
sx: {
|
|
452
|
+
display: "flex",
|
|
453
|
+
flexDirection: "column",
|
|
454
|
+
gap: 1.25,
|
|
455
|
+
flex: "1 1 auto",
|
|
456
|
+
minWidth: 0,
|
|
457
|
+
minHeight: 0
|
|
458
|
+
},
|
|
459
|
+
children: q
|
|
460
|
+
})
|
|
461
|
+
]
|
|
462
|
+
});
|
|
463
|
+
}));
|
|
464
|
+
Ce.displayName = "NumberFormatPanel";
|
|
465
|
+
var we = {
|
|
466
|
+
axes: y.AxisSelection.Column,
|
|
467
|
+
expandOnly: !0,
|
|
468
|
+
skipCustomSize: !0
|
|
469
|
+
}, Te = (e) => e > 180 ? e - 360 : e, Ee = (e) => {
|
|
470
|
+
let t = Math.max(-90, Math.min(90, Math.round(e)));
|
|
471
|
+
return t < 0 ? t + 360 : t;
|
|
472
|
+
}, De = A((e) => {
|
|
473
|
+
let { selection: t, disabled: n, className: i, ...a } = e, o = O(), { style: s, applyStyle: c } = t, l = n || t.disabled, p = s.getAlignment(), g = p.getIndent(), _ = p.getStacked(), v = _ ? 0 : p.getRotation(), y = E((e) => {
|
|
474
|
+
c({ alignment: { indent: e } }, J("op.setAlignment"), we);
|
|
475
|
+
}, [c]), b = E((e) => {
|
|
476
|
+
c({ alignment: { rotation: Ee(e) } }, J("op.setAlignment"));
|
|
477
|
+
}, [c]);
|
|
478
|
+
return V(H, {
|
|
479
|
+
className: r("sxl-format-alignment-panel", i),
|
|
480
|
+
sx: d,
|
|
481
|
+
...a,
|
|
482
|
+
children: [
|
|
483
|
+
B(m, {
|
|
484
|
+
label: o("format.horizontalAlignment"),
|
|
485
|
+
children: B(u, { children: V(h, { children: [
|
|
486
|
+
B(L, {
|
|
487
|
+
commandKey: "formatAlignLeftToggle",
|
|
488
|
+
groupKey: "horizontalAlignOptions",
|
|
489
|
+
disabled: l
|
|
490
|
+
}),
|
|
491
|
+
B(L, {
|
|
492
|
+
commandKey: "formatAlignCenterToggle",
|
|
493
|
+
groupKey: "horizontalAlignOptions",
|
|
494
|
+
disabled: l
|
|
495
|
+
}),
|
|
496
|
+
B(L, {
|
|
497
|
+
commandKey: "formatAlignRightToggle",
|
|
498
|
+
groupKey: "horizontalAlignOptions",
|
|
499
|
+
disabled: l
|
|
500
|
+
}),
|
|
501
|
+
B(L, {
|
|
502
|
+
commandKey: "formatAlignJustifyToggle",
|
|
503
|
+
groupKey: "horizontalAlignOptions",
|
|
504
|
+
disabled: l
|
|
505
|
+
}),
|
|
506
|
+
B(L, {
|
|
507
|
+
commandKey: "formatAlignDistributedHorizontalToggle",
|
|
508
|
+
groupKey: "horizontalAlignOptions",
|
|
509
|
+
disabled: l
|
|
510
|
+
}),
|
|
511
|
+
B(L, {
|
|
512
|
+
commandKey: "formatAlignCenterContinuousToggle",
|
|
513
|
+
groupKey: "horizontalAlignOptions",
|
|
514
|
+
disabled: l
|
|
515
|
+
}),
|
|
516
|
+
B(L, {
|
|
517
|
+
commandKey: "formatAlignFillToggle",
|
|
518
|
+
groupKey: "horizontalAlignOptions",
|
|
519
|
+
disabled: l
|
|
520
|
+
})
|
|
521
|
+
] }) })
|
|
522
|
+
}),
|
|
523
|
+
B(m, {
|
|
524
|
+
label: o("format.indent"),
|
|
525
|
+
children: V(u, { children: [
|
|
526
|
+
B(L, {
|
|
527
|
+
commandKey: "formatIndentDecrease",
|
|
528
|
+
groupKey: "horizontalAlignOptions",
|
|
529
|
+
disabled: l
|
|
530
|
+
}),
|
|
531
|
+
B(L, {
|
|
532
|
+
commandKey: "formatIndentIncrease",
|
|
533
|
+
groupKey: "horizontalAlignOptions",
|
|
534
|
+
disabled: l
|
|
535
|
+
}),
|
|
536
|
+
B(f, {
|
|
537
|
+
label: o("format.indentUnit"),
|
|
538
|
+
disabled: l,
|
|
539
|
+
value: g,
|
|
540
|
+
min: 0,
|
|
541
|
+
max: 250,
|
|
542
|
+
width: 104,
|
|
543
|
+
onChange: y
|
|
544
|
+
})
|
|
545
|
+
] })
|
|
546
|
+
}),
|
|
547
|
+
B(m, {
|
|
548
|
+
label: o("format.verticalAlignment"),
|
|
549
|
+
children: V(h, { children: [
|
|
550
|
+
B(L, {
|
|
551
|
+
commandKey: "formatAlignTopToggle",
|
|
552
|
+
groupKey: "verticalAlignOptions",
|
|
553
|
+
disabled: l
|
|
554
|
+
}),
|
|
555
|
+
B(L, {
|
|
556
|
+
commandKey: "formatAlignMiddleToggle",
|
|
557
|
+
groupKey: "verticalAlignOptions",
|
|
558
|
+
disabled: l
|
|
559
|
+
}),
|
|
560
|
+
B(L, {
|
|
561
|
+
commandKey: "formatAlignBottomToggle",
|
|
562
|
+
groupKey: "verticalAlignOptions",
|
|
563
|
+
disabled: l
|
|
564
|
+
}),
|
|
565
|
+
B(L, {
|
|
566
|
+
commandKey: "formatAlignJustifyVerticalToggle",
|
|
567
|
+
groupKey: "verticalAlignOptions",
|
|
568
|
+
disabled: l
|
|
569
|
+
}),
|
|
570
|
+
B(L, {
|
|
571
|
+
commandKey: "formatAlignDistributedVerticalToggle",
|
|
572
|
+
groupKey: "verticalAlignOptions",
|
|
573
|
+
disabled: l
|
|
574
|
+
})
|
|
575
|
+
] })
|
|
576
|
+
}),
|
|
577
|
+
B(m, {
|
|
578
|
+
label: o("format.overflow"),
|
|
579
|
+
children: V(h, { children: [
|
|
580
|
+
B(L, {
|
|
581
|
+
commandKey: "formatTextOverflowWrapToggle",
|
|
582
|
+
groupKey: "textOverflowOptions",
|
|
583
|
+
disabled: l
|
|
584
|
+
}),
|
|
585
|
+
B(L, {
|
|
586
|
+
commandKey: "formatTextOverflowShrinkToggle",
|
|
587
|
+
groupKey: "textOverflowOptions",
|
|
588
|
+
disabled: l
|
|
589
|
+
}),
|
|
590
|
+
B(L, {
|
|
591
|
+
commandKey: "formatTextOverflowClipToggle",
|
|
592
|
+
groupKey: "textOverflowOptions",
|
|
593
|
+
disabled: l
|
|
594
|
+
}),
|
|
595
|
+
B(L, {
|
|
596
|
+
commandKey: "formatTextOverflowVisibleToggle",
|
|
597
|
+
groupKey: "textOverflowOptions",
|
|
598
|
+
disabled: l
|
|
599
|
+
})
|
|
600
|
+
] })
|
|
601
|
+
}),
|
|
602
|
+
B(m, {
|
|
603
|
+
label: o("format.merge"),
|
|
604
|
+
children: V(h, { children: [
|
|
605
|
+
B(L, {
|
|
606
|
+
commandKey: "mergeToggle",
|
|
607
|
+
groupKey: "mergeOptions",
|
|
608
|
+
disabled: l
|
|
609
|
+
}),
|
|
610
|
+
B(L, {
|
|
611
|
+
commandKey: "mergeHorizontal",
|
|
612
|
+
groupKey: "mergeOptions",
|
|
613
|
+
disabled: l
|
|
614
|
+
}),
|
|
615
|
+
B(L, {
|
|
616
|
+
commandKey: "mergeVertical",
|
|
617
|
+
groupKey: "mergeOptions",
|
|
618
|
+
disabled: l
|
|
619
|
+
}),
|
|
620
|
+
B(L, {
|
|
621
|
+
commandKey: "unmerge",
|
|
622
|
+
groupKey: "mergeOptions",
|
|
623
|
+
disabled: l
|
|
624
|
+
})
|
|
625
|
+
] })
|
|
626
|
+
}),
|
|
627
|
+
B(m, {
|
|
628
|
+
label: o("format.orientation"),
|
|
629
|
+
children: V(u, { children: [V(h, { children: [
|
|
630
|
+
B(L, {
|
|
631
|
+
commandKey: "formatTextRotate0",
|
|
632
|
+
groupKey: "textRotateOptions",
|
|
633
|
+
disabled: l
|
|
634
|
+
}),
|
|
635
|
+
B(L, {
|
|
636
|
+
commandKey: "formatTextRotate45",
|
|
637
|
+
groupKey: "textRotateOptions",
|
|
638
|
+
disabled: l
|
|
639
|
+
}),
|
|
640
|
+
B(L, {
|
|
641
|
+
commandKey: "formatTextRotate315",
|
|
642
|
+
groupKey: "textRotateOptions",
|
|
643
|
+
disabled: l
|
|
644
|
+
}),
|
|
645
|
+
B(L, {
|
|
646
|
+
commandKey: "formatTextRotate90",
|
|
647
|
+
groupKey: "textRotateOptions",
|
|
648
|
+
disabled: l
|
|
649
|
+
}),
|
|
650
|
+
B(L, {
|
|
651
|
+
commandKey: "formatTextRotateVertical",
|
|
652
|
+
groupKey: "textRotateOptions",
|
|
653
|
+
disabled: l
|
|
654
|
+
}),
|
|
655
|
+
B(L, {
|
|
656
|
+
commandKey: "formatTextRotate270",
|
|
657
|
+
groupKey: "textRotateOptions",
|
|
658
|
+
disabled: l
|
|
659
|
+
})
|
|
660
|
+
] }), B(f, {
|
|
661
|
+
label: o("format.degrees"),
|
|
662
|
+
disabled: l || _,
|
|
663
|
+
value: Te(v),
|
|
664
|
+
min: -90,
|
|
665
|
+
max: 90,
|
|
666
|
+
step: 5,
|
|
667
|
+
width: 104,
|
|
668
|
+
onChange: b
|
|
669
|
+
})] })
|
|
670
|
+
})
|
|
671
|
+
]
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
De.displayName = "AlignmentPanel";
|
|
675
|
+
var Oe = A((e) => {
|
|
676
|
+
let { selection: t, disabled: n, className: i, ...o } = e, c = O(), f = n || t.disabled;
|
|
677
|
+
return V(H, {
|
|
678
|
+
className: r("sxl-format-font-panel", i),
|
|
679
|
+
sx: d,
|
|
680
|
+
...o,
|
|
681
|
+
children: [
|
|
682
|
+
B(m, {
|
|
683
|
+
label: c("format.fontFamily"),
|
|
684
|
+
children: B(l, {
|
|
685
|
+
commandKey: "formatFontFamily",
|
|
686
|
+
disabled: f,
|
|
687
|
+
sx: { width: "100%" }
|
|
688
|
+
})
|
|
689
|
+
}),
|
|
690
|
+
B(m, {
|
|
691
|
+
label: c("format.fontSize"),
|
|
692
|
+
children: V(u, { children: [
|
|
693
|
+
B(a, {
|
|
694
|
+
commandKey: "formatFontSize",
|
|
695
|
+
disabled: f,
|
|
696
|
+
sx: { width: 96 }
|
|
697
|
+
}),
|
|
698
|
+
B(L, {
|
|
699
|
+
commandKey: "formatFontSizeIncrease",
|
|
700
|
+
disabled: f
|
|
701
|
+
}),
|
|
702
|
+
B(L, {
|
|
703
|
+
commandKey: "formatFontSizeDecrease",
|
|
704
|
+
disabled: f
|
|
705
|
+
})
|
|
706
|
+
] })
|
|
707
|
+
}),
|
|
708
|
+
B(m, {
|
|
709
|
+
label: c("format.color"),
|
|
710
|
+
children: B(u, { children: B(s, {
|
|
711
|
+
commandKey: "formatFontColor",
|
|
712
|
+
disabled: f
|
|
713
|
+
}) })
|
|
714
|
+
}),
|
|
715
|
+
B(m, {
|
|
716
|
+
label: c("format.effects"),
|
|
717
|
+
children: V(h, { children: [
|
|
718
|
+
B(L, {
|
|
719
|
+
commandKey: "formatBoldToggle",
|
|
720
|
+
disabled: f
|
|
721
|
+
}),
|
|
722
|
+
B(L, {
|
|
723
|
+
commandKey: "formatItalicToggle",
|
|
724
|
+
disabled: f
|
|
725
|
+
}),
|
|
726
|
+
B(L, {
|
|
727
|
+
commandKey: "formatUnderlinedToggle",
|
|
728
|
+
groupKey: "underlineOptions",
|
|
729
|
+
disabled: f
|
|
730
|
+
}),
|
|
731
|
+
B(L, {
|
|
732
|
+
commandKey: "formatUnderlinedDoubleToggle",
|
|
733
|
+
groupKey: "underlineOptions",
|
|
734
|
+
disabled: f
|
|
735
|
+
}),
|
|
736
|
+
B(H, { sx: { width: "8px" } }),
|
|
737
|
+
B(L, {
|
|
738
|
+
commandKey: "formatStrikeThroughToggle",
|
|
739
|
+
disabled: f
|
|
740
|
+
}),
|
|
741
|
+
B(L, {
|
|
742
|
+
commandKey: "formatSuperscriptToggle",
|
|
743
|
+
disabled: f
|
|
744
|
+
}),
|
|
745
|
+
B(L, {
|
|
746
|
+
commandKey: "formatSubscriptToggle",
|
|
747
|
+
disabled: f
|
|
748
|
+
})
|
|
749
|
+
] })
|
|
750
|
+
}),
|
|
751
|
+
B(m, {
|
|
752
|
+
label: c("format.accountingUnderline"),
|
|
753
|
+
children: V(h, { children: [B(L, {
|
|
754
|
+
commandKey: "formatUnderlinedAccountingToggle",
|
|
755
|
+
groupKey: "underlineOptions",
|
|
756
|
+
disabled: f
|
|
757
|
+
}), B(L, {
|
|
758
|
+
commandKey: "formatUnderlinedAccountingDoubleToggle",
|
|
759
|
+
groupKey: "underlineOptions",
|
|
760
|
+
disabled: f
|
|
761
|
+
})] })
|
|
762
|
+
})
|
|
763
|
+
]
|
|
764
|
+
});
|
|
765
|
+
});
|
|
766
|
+
Oe.displayName = "FontPanel";
|
|
767
|
+
var ke = Object.freeze([
|
|
768
|
+
v.Edge.Top,
|
|
769
|
+
v.Edge.Bottom,
|
|
770
|
+
v.Edge.Left,
|
|
771
|
+
v.Edge.Right,
|
|
772
|
+
v.Edge.Horizontal,
|
|
773
|
+
v.Edge.Vertical
|
|
774
|
+
]), Z = Object.freeze([]), Ae = Object.freeze([v.Edge.Horizontal, v.Edge.Vertical]), je = new Map([
|
|
775
|
+
...ke,
|
|
776
|
+
v.Edge.DiagonalUp,
|
|
777
|
+
v.Edge.DiagonalDown
|
|
778
|
+
].map((e) => [e, Object.freeze([e])])), Me = (e) => e === v.Edge.DiagonalUp || e === v.Edge.DiagonalDown;
|
|
779
|
+
function Ne(e, t) {
|
|
780
|
+
switch (t) {
|
|
781
|
+
case v.Edge.Top: return e("border.top");
|
|
782
|
+
case v.Edge.Left: return e("border.left");
|
|
783
|
+
case v.Edge.Right: return e("border.right");
|
|
784
|
+
case v.Edge.Bottom: return e("border.bottom");
|
|
785
|
+
case v.Edge.Horizontal: return e("border.insideHorizontal");
|
|
786
|
+
case v.Edge.Vertical: return e("border.insideVertical");
|
|
787
|
+
case v.Edge.DiagonalUp: return e("border.diagonalUp");
|
|
788
|
+
case v.Edge.DiagonalDown: return e("border.diagonalDown");
|
|
789
|
+
default: return t;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
var Pe = (e) => e === 0 ? "0px" : e === 1 ? "calc(100% - 1px)" : `calc(${100 * e}% - 0.5px)`, Fe = (e, t) => {
|
|
793
|
+
let n = "-7px", r = [];
|
|
794
|
+
for (let e = 0; e <= t; e++) {
|
|
795
|
+
let i = Pe(e / t);
|
|
796
|
+
r.push({
|
|
797
|
+
left: i,
|
|
798
|
+
top: n,
|
|
799
|
+
width: "1px",
|
|
800
|
+
height: "5px"
|
|
801
|
+
}), r.push({
|
|
802
|
+
left: i,
|
|
803
|
+
bottom: n,
|
|
804
|
+
width: "1px",
|
|
805
|
+
height: "5px"
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
for (let t = 0; t <= e; t++) {
|
|
809
|
+
let i = Pe(t / e);
|
|
810
|
+
r.push({
|
|
811
|
+
top: i,
|
|
812
|
+
left: n,
|
|
813
|
+
height: "1px",
|
|
814
|
+
width: "5px"
|
|
815
|
+
}), r.push({
|
|
816
|
+
top: i,
|
|
817
|
+
right: n,
|
|
818
|
+
height: "1px",
|
|
819
|
+
width: "5px"
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
return r;
|
|
823
|
+
}, Ie = (e) => e === v.Edge.Left || e === v.Edge.Vertical || e === v.Edge.Right, Le = (e) => {
|
|
824
|
+
switch (e) {
|
|
825
|
+
case v.Edge.Top:
|
|
826
|
+
case v.Edge.Left: return 0;
|
|
827
|
+
case v.Edge.Horizontal:
|
|
828
|
+
case v.Edge.Vertical: return .5;
|
|
829
|
+
default: return 1;
|
|
830
|
+
}
|
|
831
|
+
}, Re = (e) => {
|
|
832
|
+
let { edges: t, createBorder: n, onToggleEdges: i, omittedEdges: a, disabled: o = !1, height: s = 104, className: c, ...l } = e, u = O(), d = F(null), [f, p] = I(Z), m = j((e) => !a?.includes(e), [a]), h = j((e) => !o && m(e), [o, m]), g = m(v.Edge.Horizontal) ? 2 : 1, _ = m(v.Edge.Vertical) ? 2 : 1, y = j((e) => n({
|
|
833
|
+
top: e.rowIndex === 0 ? t.top : t.horizontal,
|
|
834
|
+
bottom: e.rowIndex === g - 1 ? t.bottom : t.horizontal,
|
|
835
|
+
left: e.colIndex === 0 ? t.left : t.vertical,
|
|
836
|
+
right: e.colIndex === _ - 1 ? t.right : t.vertical,
|
|
837
|
+
diagonalUp: t.diagonalUp,
|
|
838
|
+
diagonalDown: t.diagonalDown
|
|
839
|
+
}), [
|
|
840
|
+
t,
|
|
841
|
+
n,
|
|
842
|
+
g,
|
|
843
|
+
_
|
|
844
|
+
]), b = j((e) => {
|
|
845
|
+
let t = d.current;
|
|
846
|
+
if (!t) return Z;
|
|
847
|
+
let n = t.getBoundingClientRect();
|
|
848
|
+
return function(e, t, n, r, i) {
|
|
849
|
+
if (n <= 0 || r <= 0) return Z;
|
|
850
|
+
let a = Math.min(10, n / 5, r / 5);
|
|
851
|
+
if (Ae.every(i) && Math.abs(e - n / 2) <= a && Math.abs(t - r / 2) <= a) return Ae;
|
|
852
|
+
let o = Math.abs(e) <= a, s = Math.abs(e - n) <= a, c = Math.abs(t) <= a, l = Math.abs(t - r) <= a;
|
|
853
|
+
if ((o || s) && (c || l)) {
|
|
854
|
+
let e = o === c ? v.Edge.DiagonalDown : v.Edge.DiagonalUp;
|
|
855
|
+
if (i(e)) return je.get(e);
|
|
856
|
+
}
|
|
857
|
+
let u = null, d = Infinity;
|
|
858
|
+
for (let a of ke) {
|
|
859
|
+
if (!i(a)) continue;
|
|
860
|
+
let o = Ie(a), s = o ? r : n, c = o ? t : e, l = Math.max(0, -c, c - s), f = (o ? e : t) - Le(a) * (o ? n : r), p = Math.hypot(l, f);
|
|
861
|
+
p < d && (d = p, u = a);
|
|
862
|
+
}
|
|
863
|
+
return u && d <= a ? je.get(u) : Z;
|
|
864
|
+
}(e.clientX - n.left, e.clientY - n.top, n.width, n.height, h);
|
|
865
|
+
}, [h]);
|
|
866
|
+
return B(H, {
|
|
867
|
+
className: r("sxl-border-preview", c),
|
|
868
|
+
...l,
|
|
869
|
+
onPointerMove: (e) => p(b(e)),
|
|
870
|
+
onPointerLeave: () => p(Z),
|
|
871
|
+
onClick: (e) => {
|
|
872
|
+
let t = b(e);
|
|
873
|
+
t.length > 0 && i(t);
|
|
874
|
+
},
|
|
875
|
+
sx: {
|
|
876
|
+
position: "relative",
|
|
877
|
+
boxSizing: "border-box",
|
|
878
|
+
height: `${s}px`,
|
|
879
|
+
width: "100%",
|
|
880
|
+
padding: "10px",
|
|
881
|
+
cursor: f.length > 0 ? "pointer" : "default",
|
|
882
|
+
borderRadius: (e) => `${e.shape.borderRadius}px`,
|
|
883
|
+
border: (e) => `1px solid ${e.palette.divider}`,
|
|
884
|
+
opacity: o ? .6 : 1
|
|
885
|
+
},
|
|
886
|
+
children: V(H, {
|
|
887
|
+
ref: d,
|
|
888
|
+
sx: {
|
|
889
|
+
position: "relative",
|
|
890
|
+
width: "100%",
|
|
891
|
+
height: "100%"
|
|
892
|
+
},
|
|
893
|
+
children: [
|
|
894
|
+
B(H, {
|
|
895
|
+
"aria-hidden": "true",
|
|
896
|
+
sx: {
|
|
897
|
+
position: "absolute",
|
|
898
|
+
inset: 0,
|
|
899
|
+
display: "grid",
|
|
900
|
+
gridTemplateColumns: `repeat(${_}, 1fr)`,
|
|
901
|
+
gridTemplateRows: `repeat(${g}, 1fr)`,
|
|
902
|
+
gap: "2px",
|
|
903
|
+
pointerEvents: "none",
|
|
904
|
+
"& > div": { backgroundColor: (e) => q(e.palette.text.primary, .05) }
|
|
905
|
+
},
|
|
906
|
+
children: Array.from({ length: g * _ }, (e, t) => B("div", {}, t))
|
|
907
|
+
}),
|
|
908
|
+
B(H, {
|
|
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: Fe(g, _).map((e, t) => B("div", { style: e }, t))
|
|
920
|
+
}),
|
|
921
|
+
f.length > 0 ? V(H, {
|
|
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: [f.filter((e) => !Me(e)).map((e) => B("div", { style: ze(e) }, e)), f.some(Me) ? B("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: f.filter(Me).flatMap((e) => function(e, t, n) {
|
|
946
|
+
let r = [];
|
|
947
|
+
for (let i = 0; i < t; i++) for (let a = 0; a < n; a++) {
|
|
948
|
+
let o = a / n * 100, s = (a + 1) / n * 100, c = i / t * 100, l = (i + 1) / t * 100, u = e === v.Edge.DiagonalDown;
|
|
949
|
+
r.push(B("line", {
|
|
950
|
+
x1: o,
|
|
951
|
+
y1: u ? c : l,
|
|
952
|
+
x2: s,
|
|
953
|
+
y2: u ? l : c,
|
|
954
|
+
strokeWidth: 6,
|
|
955
|
+
strokeLinecap: "round",
|
|
956
|
+
vectorEffect: "non-scaling-stroke"
|
|
957
|
+
}, `${e}:${i}:${a}`));
|
|
958
|
+
}
|
|
959
|
+
return r;
|
|
960
|
+
}(e, g, _))
|
|
961
|
+
}) : null]
|
|
962
|
+
}) : null,
|
|
963
|
+
B(x, {
|
|
964
|
+
getBorderAt: y,
|
|
965
|
+
rowCount: g,
|
|
966
|
+
columnCount: _,
|
|
967
|
+
style: {
|
|
968
|
+
position: "absolute",
|
|
969
|
+
inset: 0,
|
|
970
|
+
height: "100%",
|
|
971
|
+
width: "100%"
|
|
972
|
+
}
|
|
973
|
+
}),
|
|
974
|
+
ke.filter(m).map((e) => B(H, {
|
|
975
|
+
component: "button",
|
|
976
|
+
type: "button",
|
|
977
|
+
"aria-label": Ne(u, e),
|
|
978
|
+
"aria-pressed": !!t[e],
|
|
979
|
+
title: Ne(u, e),
|
|
980
|
+
disabled: !h(e),
|
|
981
|
+
onClick: (t) => {
|
|
982
|
+
t.stopPropagation(), i(je.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
|
+
...ze(e)
|
|
994
|
+
}
|
|
995
|
+
}, e))
|
|
996
|
+
]
|
|
997
|
+
})
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
function ze(e) {
|
|
1001
|
+
let t = `calc(${100 * Le(e)}% - 3px)`;
|
|
1002
|
+
return Ie(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
|
+
Re.displayName = "BorderPreview";
|
|
1015
|
+
var Be = v.StrokeStyle.Thin, Ve = Object.freeze([
|
|
1016
|
+
v.Edge.Left,
|
|
1017
|
+
v.Edge.Top,
|
|
1018
|
+
v.Edge.Right,
|
|
1019
|
+
v.Edge.Bottom
|
|
1020
|
+
]), He = Object.freeze([v.Edge.Horizontal, v.Edge.Vertical]), Q = Object.freeze([...Ve, ...He]), Ue = Object.freeze([v.Edge.DiagonalUp, v.Edge.DiagonalDown]), We = Object.freeze([...Q, ...Ue]), Ge = (e, t, n) => {
|
|
1021
|
+
let r = {
|
|
1022
|
+
style: t,
|
|
1023
|
+
color: n?.toString()
|
|
1024
|
+
}, i = {};
|
|
1025
|
+
for (let t of e) i[t] = r;
|
|
1026
|
+
return i;
|
|
1027
|
+
}, Ke = (e) => {
|
|
1028
|
+
let t = {};
|
|
1029
|
+
for (let n of e) t[n] = null;
|
|
1030
|
+
return t;
|
|
1031
|
+
}, qe = (e) => e ? e.toString() : null, Je = A((i) => {
|
|
1032
|
+
let { selection: a, disabled: o, className: s, ...c } = i, l = O(), { getEdgeStroke: f, createBorder: p, applyStyle: g, styles: _, schemeLookup: y, autoColor: b, darkMode: x, hasInnerHorizontal: S, hasInnerVertical: C } = a, w = o || a.disabled, T = E((e) => e === v.Edge.Horizontal ? !S : e === v.Edge.Vertical && !C, [S, C]), [D, te] = I(() => {
|
|
1033
|
+
let e = f(v.Edge.Bottom)?.getStyle();
|
|
1034
|
+
return e && e !== v.StrokeStyle.None ? e : Be;
|
|
1035
|
+
}), [k, A] = I(() => {
|
|
1036
|
+
let e = f(v.Edge.Bottom);
|
|
1037
|
+
return !e || e.isNone() ? null : e.getProperties().color ? e.getColor() : null;
|
|
1038
|
+
}), j = E(() => _.recentColors(), [_]), M = E((e) => {
|
|
1039
|
+
g({ borders: e }, J("op.setBorders"));
|
|
1040
|
+
}, [g]), N = E((e) => {
|
|
1041
|
+
e.length !== 0 && g([{ borders: Ke(e) }, { borders: Ge(e, D, k) }], J("op.setBorders"));
|
|
1042
|
+
}, [
|
|
1043
|
+
g,
|
|
1044
|
+
D,
|
|
1045
|
+
k
|
|
1046
|
+
]), P = E((e) => {
|
|
1047
|
+
e.length !== 0 && M(Ge(e, v.StrokeStyle.None, null));
|
|
1048
|
+
}, [M]), F = E((e) => {
|
|
1049
|
+
N(e.filter((e) => !T(e)));
|
|
1050
|
+
}, [N, T]), L = {};
|
|
1051
|
+
for (let e of We) {
|
|
1052
|
+
let t = f(e);
|
|
1053
|
+
t && !t.isNone() && (L[e] = t.getProperties());
|
|
1054
|
+
}
|
|
1055
|
+
let R = E((e) => {
|
|
1056
|
+
let t = L[e];
|
|
1057
|
+
return (t?.style ?? v.StrokeStyle.None) === D && qe(t?.color) === qe(k);
|
|
1058
|
+
}, [
|
|
1059
|
+
L,
|
|
1060
|
+
D,
|
|
1061
|
+
k
|
|
1062
|
+
]), re = (e) => {
|
|
1063
|
+
let t = e.filter((e) => !T(e));
|
|
1064
|
+
return t.length > 0 && t.every(R);
|
|
1065
|
+
}, ae = E((e) => {
|
|
1066
|
+
let t = e.filter((e) => !T(e));
|
|
1067
|
+
D === v.StrokeStyle.None || t.every(R) ? P(t) : N(t);
|
|
1068
|
+
}, [
|
|
1069
|
+
P,
|
|
1070
|
+
N,
|
|
1071
|
+
R,
|
|
1072
|
+
T,
|
|
1073
|
+
D
|
|
1074
|
+
]), oe = (e) => Ge(e, D, k), z = (e, t, r) => B(ne, {
|
|
1075
|
+
disabled: w,
|
|
1076
|
+
icon: B(n, {
|
|
1077
|
+
border: e.length > 0 ? oe(e) : null,
|
|
1078
|
+
createBorder: p
|
|
1079
|
+
}),
|
|
1080
|
+
propsTooltip: {
|
|
1081
|
+
label: t,
|
|
1082
|
+
simple: !0
|
|
1083
|
+
},
|
|
1084
|
+
onClick: r
|
|
1085
|
+
}), se = (e, t) => {
|
|
1086
|
+
let r = w || e.every(T);
|
|
1087
|
+
return B(ne, {
|
|
1088
|
+
disabled: r,
|
|
1089
|
+
selected: !r && D !== v.StrokeStyle.None && re(e),
|
|
1090
|
+
icon: B(n, {
|
|
1091
|
+
border: oe(e),
|
|
1092
|
+
createBorder: p
|
|
1093
|
+
}),
|
|
1094
|
+
propsTooltip: {
|
|
1095
|
+
label: t,
|
|
1096
|
+
simple: !0
|
|
1097
|
+
},
|
|
1098
|
+
onClick: () => ae(e)
|
|
1099
|
+
});
|
|
1100
|
+
}, U = (e) => se([e], Ne(l, e));
|
|
1101
|
+
return V(H, {
|
|
1102
|
+
className: r("sxl-format-border-panel", s),
|
|
1103
|
+
sx: d,
|
|
1104
|
+
...c,
|
|
1105
|
+
children: [
|
|
1106
|
+
V(u, { children: [B(e, {
|
|
1107
|
+
disabled: w || D === v.StrokeStyle.None,
|
|
1108
|
+
darkMode: x,
|
|
1109
|
+
icon: B(ee, { iconKey: "stroke.colored" }),
|
|
1110
|
+
tooltip: l("border.colorTooltip"),
|
|
1111
|
+
selectedColor: k,
|
|
1112
|
+
onSelectColor: (e) => A(e),
|
|
1113
|
+
propsPanel: {
|
|
1114
|
+
disableAlpha: !0,
|
|
1115
|
+
schemeLookup: y,
|
|
1116
|
+
recentColors: j,
|
|
1117
|
+
autoColor: b
|
|
1118
|
+
}
|
|
1119
|
+
}), B(t, {
|
|
1120
|
+
disabled: w,
|
|
1121
|
+
darkMode: x,
|
|
1122
|
+
selectedStyle: D,
|
|
1123
|
+
styleColor: k,
|
|
1124
|
+
variant: ie.Toolbar,
|
|
1125
|
+
onSelectStyle: (e) => te(e ?? v.StrokeStyle.None)
|
|
1126
|
+
})] }),
|
|
1127
|
+
V(h, {
|
|
1128
|
+
sx: { justifyContent: "center" },
|
|
1129
|
+
children: [
|
|
1130
|
+
z(Q, l("border.all"), () => F(Q)),
|
|
1131
|
+
z(Ve, l("border.outside"), () => F(Ve)),
|
|
1132
|
+
z([], l("border.none"), () => M(null))
|
|
1133
|
+
]
|
|
1134
|
+
}),
|
|
1135
|
+
V(m, {
|
|
1136
|
+
sx: { px: 1.5 },
|
|
1137
|
+
children: [V(H, {
|
|
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
|
+
V(H, {
|
|
1148
|
+
sx: {
|
|
1149
|
+
display: "flex",
|
|
1150
|
+
flexDirection: "column",
|
|
1151
|
+
justifyContent: "space-between",
|
|
1152
|
+
height: "104px"
|
|
1153
|
+
},
|
|
1154
|
+
children: [
|
|
1155
|
+
U(v.Edge.Top),
|
|
1156
|
+
U(v.Edge.Horizontal),
|
|
1157
|
+
U(v.Edge.Bottom)
|
|
1158
|
+
]
|
|
1159
|
+
}),
|
|
1160
|
+
B(Re, {
|
|
1161
|
+
edges: L,
|
|
1162
|
+
createBorder: p,
|
|
1163
|
+
disabled: w,
|
|
1164
|
+
height: 104,
|
|
1165
|
+
omittedEdges: Q.filter(T),
|
|
1166
|
+
onToggleEdges: ae
|
|
1167
|
+
}),
|
|
1168
|
+
B(H, {
|
|
1169
|
+
sx: {
|
|
1170
|
+
display: "flex",
|
|
1171
|
+
alignItems: "center"
|
|
1172
|
+
},
|
|
1173
|
+
children: se(He, l("border.inner"))
|
|
1174
|
+
}),
|
|
1175
|
+
U(v.Edge.DiagonalUp),
|
|
1176
|
+
V(H, {
|
|
1177
|
+
sx: {
|
|
1178
|
+
display: "flex",
|
|
1179
|
+
justifyContent: "space-between",
|
|
1180
|
+
minWidth: 0
|
|
1181
|
+
},
|
|
1182
|
+
children: [
|
|
1183
|
+
U(v.Edge.Left),
|
|
1184
|
+
U(v.Edge.Vertical),
|
|
1185
|
+
U(v.Edge.Right)
|
|
1186
|
+
]
|
|
1187
|
+
}),
|
|
1188
|
+
U(v.Edge.DiagonalDown)
|
|
1189
|
+
]
|
|
1190
|
+
}), B(K, {
|
|
1191
|
+
variant: "caption",
|
|
1192
|
+
component: "div",
|
|
1193
|
+
sx: {
|
|
1194
|
+
color: "text.secondary",
|
|
1195
|
+
lineHeight: 1.4,
|
|
1196
|
+
textAlign: "center"
|
|
1197
|
+
},
|
|
1198
|
+
children: l("format.borderDiagram")
|
|
1199
|
+
})]
|
|
1200
|
+
})
|
|
1201
|
+
]
|
|
1202
|
+
});
|
|
1203
|
+
});
|
|
1204
|
+
Je.displayName = "BorderPanel";
|
|
1205
|
+
var $ = {
|
|
1206
|
+
Number: "number",
|
|
1207
|
+
Alignment: "alignment",
|
|
1208
|
+
Font: "font",
|
|
1209
|
+
Border: "border",
|
|
1210
|
+
Fill: "fill"
|
|
1211
|
+
}, Ye = "format.tab", Xe = Object.freeze([
|
|
1212
|
+
$.Number,
|
|
1213
|
+
$.Alignment,
|
|
1214
|
+
$.Font,
|
|
1215
|
+
$.Border,
|
|
1216
|
+
$.Fill
|
|
1217
|
+
]), Ze = A((e) => {
|
|
1218
|
+
let t = e.model, n = O();
|
|
1219
|
+
T(t, "onSelectedSheetChange");
|
|
1220
|
+
let r = t.getSelectedWorksheet();
|
|
1221
|
+
if (!r) {
|
|
1222
|
+
let { model: t, args: r, entryKey: i, frame: a, ref: o, ...s } = e;
|
|
1223
|
+
return B(W, {
|
|
1224
|
+
square: !0,
|
|
1225
|
+
ref: o,
|
|
1226
|
+
sx: {
|
|
1227
|
+
display: "flex",
|
|
1228
|
+
flex: "1 1 auto",
|
|
1229
|
+
padding: (e) => e.spacing(2, 2)
|
|
1230
|
+
},
|
|
1231
|
+
...s,
|
|
1232
|
+
children: n("format.noWorksheet")
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
return B(Qe, {
|
|
1236
|
+
...e,
|
|
1237
|
+
sheet: r
|
|
1238
|
+
});
|
|
1239
|
+
});
|
|
1240
|
+
Ze.displayName = "FormatTaskPane";
|
|
1241
|
+
var Qe = A((e) => {
|
|
1242
|
+
let { model: t, sheet: n, args: r, entryKey: i, frame: a, ref: o, ...s } = e, c = O(), l = ((e) => {
|
|
1243
|
+
let [, t] = P((e) => e + 1, 0);
|
|
1244
|
+
w(e, {
|
|
1245
|
+
onSelectionChange: () => t(),
|
|
1246
|
+
onStyleChange: () => t()
|
|
1247
|
+
});
|
|
1248
|
+
let [n] = D(["formatBoldToggle"]), r = C(), i = e.getSelectedCell(), a = e.getStyles(), o = e.getSelectedRanges(), s = E((t, n, r) => {
|
|
1249
|
+
let i = Array.isArray(t) ? t : [t];
|
|
1250
|
+
e.doBatch(() => {
|
|
1251
|
+
for (let t of i) e.getSelectedRanges().getStyle().update(t, {
|
|
1252
|
+
autoSelect: _e,
|
|
1253
|
+
autoFit: r ?? !0
|
|
1254
|
+
});
|
|
1255
|
+
}, { description: n ?? J("op.updateStyle") });
|
|
1256
|
+
}, [e]), c = E((t) => e.createCell(t), [e]), l = E((e) => a.getNormal().createStyle({ borders: e }).getBorders(), [a]), u = o.getCoords()[0], d = E((t) => {
|
|
1257
|
+
if (!u) return null;
|
|
1258
|
+
let n = (t, n) => e.getCell({
|
|
1259
|
+
rowIndex: t,
|
|
1260
|
+
colIndex: n
|
|
1261
|
+
}).getStyle(!0).getBorders();
|
|
1262
|
+
switch (t) {
|
|
1263
|
+
case v.Edge.Top: return n(u.rowStart, u.colStart).getTop();
|
|
1264
|
+
case v.Edge.Left: return n(u.rowStart, u.colStart).getLeft();
|
|
1265
|
+
case v.Edge.Bottom: return n(u.rowEnd, u.colEnd).getBottom();
|
|
1266
|
+
case v.Edge.Right: return n(u.rowEnd, u.colEnd).getRight();
|
|
1267
|
+
case v.Edge.Horizontal: return u.rowEnd <= u.rowStart ? null : n(u.rowStart + 1, u.colStart).getTop();
|
|
1268
|
+
case v.Edge.Vertical: return u.colEnd <= u.colStart ? null : n(u.rowStart, u.colStart + 1).getLeft();
|
|
1269
|
+
case v.Edge.DiagonalUp: return n(u.rowStart, u.colStart).getDiagonalUp();
|
|
1270
|
+
case v.Edge.DiagonalDown: return n(u.rowStart, u.colStart).getDiagonalDown();
|
|
1271
|
+
default: return null;
|
|
1272
|
+
}
|
|
1273
|
+
}, [e, u]);
|
|
1274
|
+
return {
|
|
1275
|
+
sheet: e,
|
|
1276
|
+
cell: i,
|
|
1277
|
+
style: i.getStyle(),
|
|
1278
|
+
styles: a,
|
|
1279
|
+
schemeLookup: a.schemeLookup(),
|
|
1280
|
+
autoColor: a.getNormal().getFont().getColor(),
|
|
1281
|
+
darkMode: r === "dark",
|
|
1282
|
+
disabled: n?.disabled() ?? !1,
|
|
1283
|
+
applyStyle: s,
|
|
1284
|
+
createCell: c,
|
|
1285
|
+
createBorder: l,
|
|
1286
|
+
getEdgeStroke: d,
|
|
1287
|
+
hasInnerHorizontal: o.getRowCount() > 1,
|
|
1288
|
+
hasInnerVertical: o.getColumnCount() > 1
|
|
1289
|
+
};
|
|
1290
|
+
})(n), [u, d] = te(Ye, $.Number), f = Xe.includes(u) ? u : $.Number;
|
|
1291
|
+
M(() => {
|
|
1292
|
+
let e = r?.tab;
|
|
1293
|
+
e && d(e);
|
|
1294
|
+
}, [r]);
|
|
1295
|
+
let m = l.style.getNumberFormat(), h = typeof m == "number" ? b.resolve(m) : m ?? "General";
|
|
1296
|
+
return V(W, {
|
|
1297
|
+
square: !0,
|
|
1298
|
+
ref: o,
|
|
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
|
+
...s,
|
|
1309
|
+
children: [
|
|
1310
|
+
B(H, {
|
|
1311
|
+
sx: {
|
|
1312
|
+
flexShrink: 0,
|
|
1313
|
+
padding: (e) => e.spacing(1.5, 2)
|
|
1314
|
+
},
|
|
1315
|
+
children: B(ve, { selection: l })
|
|
1316
|
+
}),
|
|
1317
|
+
B(G, {
|
|
1318
|
+
value: f,
|
|
1319
|
+
onChange: (e, t) => d(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: Xe.map((e) => B(he, {
|
|
1337
|
+
value: e,
|
|
1338
|
+
label: $e(c, e)
|
|
1339
|
+
}, e))
|
|
1340
|
+
}),
|
|
1341
|
+
V(H, {
|
|
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
|
+
f === $.Number ? B(Ce, {
|
|
1350
|
+
hideSample: !0,
|
|
1351
|
+
showQuickFormats: !0,
|
|
1352
|
+
value: h,
|
|
1353
|
+
disabled: l.disabled,
|
|
1354
|
+
context: () => l.cell,
|
|
1355
|
+
onChange: (e) => {
|
|
1356
|
+
l.applyStyle({ numberFormat: e }, J("op.setNumberFormat"));
|
|
1357
|
+
}
|
|
1358
|
+
}) : null,
|
|
1359
|
+
f === $.Alignment ? B(De, { selection: l }) : null,
|
|
1360
|
+
f === $.Font ? B(Oe, { selection: l }) : null,
|
|
1361
|
+
f === $.Fill ? B(_, { selection: p(l) }) : null,
|
|
1362
|
+
f === $.Border ? B(Je, { selection: l }) : null
|
|
1363
|
+
]
|
|
1364
|
+
})
|
|
1365
|
+
]
|
|
1366
|
+
});
|
|
1367
|
+
});
|
|
1368
|
+
function $e(e, t) {
|
|
1369
|
+
switch (t) {
|
|
1370
|
+
case $.Number: return e("format.tabNumber");
|
|
1371
|
+
case $.Alignment: return e("format.tabAlignment");
|
|
1372
|
+
case $.Font: return e("format.tabFont");
|
|
1373
|
+
case $.Fill: return e("format.tabFill");
|
|
1374
|
+
case $.Border: return e("format.tabBorder");
|
|
1375
|
+
default: return t;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
Qe.displayName = "FormatTaskPaneBody";
|
|
1379
|
+
export { Ye as FORMAT_TAB_KEY, $ as FormatTab, Ze as FormatTaskPane, Ze as default };
|