@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 { BorderStylePopupButton as e, BorderTemplateIcon as t, ColorCommandButton as o, ColorPopupButton as r, E as n, FontFamilyCommandButton as a, FontSizeCommandButton as l, NumberFormatOption 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 "./BR45ogAR-hY2bE60.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, defaultCreatePopupPanel 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: a, onCommit: l, 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 = a?.() ?? 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(), l?.();
|
|
122
|
+
}
|
|
123
|
+
}, [b, l]), 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(n, {
|
|
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
|
+
createPopupPanel: (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(i, {
|
|
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: n, ...i } = e, d = A(), m = r || t.disabled;
|
|
676
|
+
return Y(q, {
|
|
677
|
+
className: ge("sxl-format-font-panel", n),
|
|
678
|
+
sx: c,
|
|
679
|
+
...i,
|
|
680
|
+
children: [
|
|
681
|
+
G(p, {
|
|
682
|
+
label: d("format.fontFamily"),
|
|
683
|
+
children: G(a, {
|
|
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(l, {
|
|
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 };
|