@sheetxl/studio-mui 0.4.20 → 0.4.21
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/cjs/B1KlR2XYFpYbKjYS.cjs +20 -0
- package/browser/cjs/{DItuuqkIamMzp7Im.cjs → B1RMsexbz4bNlty_.cjs} +1 -1
- package/browser/cjs/B32faQpVaX1tkPuc.cjs +6 -0
- package/browser/cjs/B3XiHrRxW1LxML7F.cjs +6 -0
- package/browser/cjs/BGikYpeNpjwvXUdQ.cjs +18 -0
- package/browser/cjs/BY5l7DteiFtb2AKy.cjs +6 -0
- package/browser/cjs/Bb0Hd2RE7iVWVbm8.cjs +6 -0
- package/browser/cjs/C3EZkRIKfQURg9hX.cjs +6 -0
- package/browser/cjs/C7r573AdygYrVVEJ.cjs +7 -0
- package/browser/cjs/DEEknE8ARp0mc7fk.cjs +6 -0
- package/browser/cjs/DZwzUUHda3jr5jo4.cjs +6 -0
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/veQZSq7ekc6G1FZT.cjs +42 -0
- package/browser/esm/B84RbTkXZiq6XIdH.mjs +49 -0
- package/browser/esm/{C5xUbwpUPDeNua-i.mjs → BLy-hRTZkVfaGrcr.mjs} +1 -1
- package/browser/esm/Bapmv0WdnDq3Jl_q.mjs +53 -0
- package/browser/esm/C0OuiugFYjsjbY8q.mjs +46 -0
- package/browser/esm/{5u-JEG1IfQBstjq0.mjs → CGVN-NJF8ZTm9apo.mjs} +11 -10
- package/browser/esm/CcLpUDzJOdfqQ8Kf.mjs +25 -0
- package/browser/esm/Csg-hJrzm9r4vJrm.mjs +2156 -0
- package/browser/esm/{C60ZnLCvtztDLuoT.mjs → DHf2N2UY78nZFge3.mjs} +100 -98
- package/browser/esm/Dlc8L0qha0mZFIkY.mjs +62 -0
- package/browser/esm/{BW3_mz5_8i9VLBYB.mjs → Dv-0R5pQwEnowzoO.mjs} +87 -85
- package/browser/esm/index.mjs +29 -29
- package/browser/esm/mVKwmIdSj4ua1Qce.mjs +4443 -0
- package/browser/esm/{CxXpPYi4eOFhBNt2.mjs → sHK4zKkWLGt2hVmW.mjs} +27 -26
- package/licenses/dependencies.txt +71 -342
- package/node/esm/{CrDbLKJh9omVo_TF.mjs → 49Eux5a_I5wZ-jfq.mjs} +29 -28
- package/node/esm/{Bn5TJPQAEMY-lGpF.mjs → B00pGeZ7sj6QOFgF.mjs} +4 -3
- package/node/esm/{D6A_o47zvz5ITIJK.mjs → BEtxwx_Ji4aFNg8V.mjs} +79 -78
- package/node/esm/{Ds5dinNcyNdC8ta6.mjs → BTcBIT144Lil18l-.mjs} +13 -11
- package/node/esm/{Bv12-Yyv0C86Iquy.mjs → Bw_f4uhXHpg1RA6Z.mjs} +7 -6
- package/node/esm/CGrG-gsnGd-Pn_T2.mjs +88 -0
- package/node/esm/CiUfb3MQCUC2McDP.mjs +46 -0
- package/node/esm/D1bjybdBQ28bumrW.mjs +63 -0
- package/node/esm/{CH6p2H0CMCoz4NgJ.mjs → Dcnd4LiYyGf2eaNl.mjs} +23 -22
- package/node/esm/{rlqvGCJlj4a2UcSM.mjs → DiLUM75s3D56Y6Fx.mjs} +11 -10
- package/node/esm/index.mjs +2381 -18514
- package/package.json +8 -8
- package/browser/cjs/-Z37a-mzY5SKXy--.cjs +0 -6
- package/browser/cjs/B384kb1_rsiCsdZG.cjs +0 -6
- package/browser/cjs/B8nWvy4zDv1CZsr_.cjs +0 -110
- package/browser/cjs/BBnMJiXp9lru0Rcq.cjs +0 -6
- package/browser/cjs/BFbHTu65n1oE-l0N.cjs +0 -6
- package/browser/cjs/BQMSHnQdWtqeakER.cjs +0 -6
- package/browser/cjs/BvjA0ybox6653eb5.cjs +0 -6
- package/browser/cjs/Cocgl4ghzWE9yVYS.cjs +0 -161
- package/browser/cjs/D21Q1NdM1zQ7uFlH.cjs +0 -6
- package/browser/cjs/D4LmaKqYiwjxp0Hs.cjs +0 -15
- package/browser/cjs/D6egUillMqBwTaEq.cjs +0 -6
- package/browser/cjs/D9lY6pd9tRxPeLKs.cjs +0 -18
- package/browser/cjs/DNqIYSqRYZkUpFxW.cjs +0 -7
- package/browser/cjs/DUImSlPsM-OipgBZ.cjs +0 -6
- package/browser/cjs/DUVLcBcwkTsuLb6q.cjs +0 -6
- package/browser/cjs/Db7IyKXFzo8IocDa.cjs +0 -145
- package/browser/cjs/DsHPj69dMFG09uD_.cjs +0 -16
- package/browser/cjs/DypblOPNMRx5Twgx.cjs +0 -12
- package/browser/cjs/QK7YNBstmN86K-xL.cjs +0 -6
- package/browser/cjs/VNWvn2kP6ZF0Snzw.cjs +0 -11
- package/browser/cjs/dc1YAArM3bSHvRcF.cjs +0 -7
- package/browser/cjs/mInXvB8P6r6q7pRY.cjs +0 -11
- package/browser/cjs/nop6N-Oi_LKy1Bpc.cjs +0 -42
- package/browser/cjs/s45oNHeIvJVeRjn5.cjs +0 -6
- package/browser/esm/1y10o01h14oGJtKG.mjs +0 -43
- package/browser/esm/BFpc8KBa-fb0nLSt.mjs +0 -46
- package/browser/esm/Bmjhrc6YMmfx_1Yi.mjs +0 -1703
- package/browser/esm/BnlJVFlQeWerd3KW.mjs +0 -3803
- package/browser/esm/BpuH_QvBidPOXgAR.mjs +0 -392
- package/browser/esm/CAiWSkkPRgUjk8CN.mjs +0 -424
- package/browser/esm/CW8taieVozHhyBOC.mjs +0 -1467
- package/browser/esm/CzyEerZmfWrW3i3U.mjs +0 -59
- package/browser/esm/D0FBHwm0Oz_wf0tR.mjs +0 -12
- package/browser/esm/DM9GPrZpbCcKOnyU.mjs +0 -1352
- package/browser/esm/DO1doKZhwYiL7vbF.mjs +0 -1672
- package/browser/esm/DS3anstzAV3EJBRw.mjs +0 -84
- package/browser/esm/DuEmdSQsXlkCWZIB.mjs +0 -1366
- package/browser/esm/FvK-pQsicRjtrKoS.mjs +0 -48
- package/browser/esm/KCTJzQeDChqf1yBO.mjs +0 -52
- package/browser/esm/P-3pIbidOtRCNsw3.mjs +0 -23
- package/browser/esm/W3EFMOPLR1aNXWvF.mjs +0 -2250
- package/browser/esm/Z_Sh-N3xHHWLCbEw.mjs +0 -23412
- package/browser/esm/mOmzoYDWAtgYndCA.mjs +0 -13391
- package/browser/esm/tnJECoiQzUzgUQZE.mjs +0 -44
- package/node/esm/54SjtcD6mOreKcCy.mjs +0 -1719
- package/node/esm/B2BlMiDOVpIp1FDQ.mjs +0 -1706
- package/node/esm/BNEvR1srnnwBgnrF.mjs +0 -1479
- package/node/esm/BZ20_F64yjZgn-_G.mjs +0 -1246
- package/node/esm/BfzRLuswtxg9uDsX.mjs +0 -78
- package/node/esm/C0ZBbkFa-24tJTnw.mjs +0 -60
- package/node/esm/CEVO60fX3MAPG0Hg.mjs +0 -1378
- package/node/esm/CdFmhVFplZFgBvTo.mjs +0 -44
- package/node/esm/Cx4mn0YEVkG-M1VL.mjs +0 -553
- package/node/esm/DDWek3aquTe_okr_.mjs +0 -392
- package/node/esm/DSLWcwr4qgHARs36.mjs +0 -13464
- package/node/esm/iXG86MN0JrtJkpqe.mjs +0 -44
- package/node/esm/m2teXjBzZLfLDFPx.mjs +0 -46
- package/node/esm/oykDy4erHC0NNHHq.mjs +0 -3776
- package/node/esm/sVOd1y3oNBREsKJ7.mjs +0 -86
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
8
|
+
import { memo as o, useState as n, useRef as i, useReducer as a, useMemo as l } from "react";
|
|
9
|
+
import { useMeasure as r } from "react-use";
|
|
10
|
+
import { DialogContent as s, Box as c } from "@mui/material";
|
|
11
|
+
import { DefaultNotifier as d, useCommand as m, useCallbackRef as g, CommandButtonType as p } from "@sheetxl/utils-react";
|
|
12
|
+
import { InternalWindow as h, ExhibitDivider as u, CommandButton as x, themeIcon as f, InsertTableIcon as y } from "@sheetxl/utils-mui";
|
|
13
|
+
import { useModelListener as b } from "@sheetxl/react";
|
|
14
|
+
import { NamedInput as w, RangeInput as S, TableStyleOptionsPanel as C, TableStylePreview as N } from "./index.mjs";
|
|
15
|
+
const v = o((o2) => {
|
|
16
|
+
const { title: v2, onHide: R, autoFocusSel: T = ".range-input input", context: F, notifier: D = d, command: H, commands: B, ...I } = o2, [P, j] = n(false), [z, L] = n(false), O = i(null), [E, A] = a((e2) => e2 + 1, 0), [M, { width: V }] = r();
|
|
17
|
+
m(H);
|
|
18
|
+
const W = F ?? H.context(), k = W.table(), [q, G] = n(() => k ? W.getNames().getRanges(k.getRange()) : null), J = l(() => k?.getName() ?? "", [k]);
|
|
19
|
+
b(W.table(), { onAnchorCoordsChange(e2) {
|
|
20
|
+
G(W.getNames().getRanges(e2.getRange()));
|
|
21
|
+
}, onProtectedChange(e2) {
|
|
22
|
+
A();
|
|
23
|
+
} });
|
|
24
|
+
const K = g((e2) => {
|
|
25
|
+
W?.table().setName(e2);
|
|
26
|
+
}, [W]), Q = g((e2) => {
|
|
27
|
+
W?.table().resize(e2.at(0));
|
|
28
|
+
}, [W]);
|
|
29
|
+
let U = null;
|
|
30
|
+
return W.table() || (U = e("div", { style: { position: "absolute", top: "0", left: "0", width: "100%", height: "100%", opacity: 1, display: "flex", alignItems: "center", justifyItems: "center", justifyContent: "center", boxSizing: "border-box" }, children: e("div", { children: "No table selected" }) })), e(h, { ref: O, title: v2 ?? "Table Details", initialPosition: { y: "35" }, autoFocusSel: T, onHide: R, onFocus: () => j(true), onBlur: (e2) => {
|
|
31
|
+
O?.current?.contains(e2.relatedTarget) || j(false);
|
|
32
|
+
}, PaperProps: { elevation: P ? 3 : 1 }, ...I, children: t(s, { dividers: true, ref: M, sx: { display: "flex", flexDirection: "column", position: "relative", paddingLeft: (e2) => e2.spacing(1.5), paddingRight: (e2) => e2.spacing(1.5) }, children: [t(c, { sx: { display: "flex", flexDirection: "column", transition: "opacity 60ms", opacity: W.table() ? 1 : 0 }, children: [e(c, { sx: { display: "flex", flexDirection: "row", gap: (e2) => e2.spacing(1) }, children: e(c, { sx: { display: "flex", flexDirection: "column", maxWidth: "100%", boxSizing: "border-box", paddingLeft: (e2) => e2.spacing(2), paddingRight: (e2) => e2.spacing(2) }, children: t(c, { sx: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [e(w, { formName: "name", defaultInput: J, value: k?.getName() ?? "No table", onChangeInput: K, onValidate: (e2) => {
|
|
33
|
+
k && k.getName().toLowerCase() === e2.toLowerCase() || W?.getNames().validateName(e2);
|
|
34
|
+
}, disabled: k?.isProtected() ?? true, onFocus: (e2) => {
|
|
35
|
+
z || e2.target?.select(), L(true);
|
|
36
|
+
} }), e(S, { formName: "range", value: q, onChangeInput: Q, resolvedAddress: W.getNames().getRanges.bind(W.getNames()), disabled: k?.isProtected() ?? true, onFocus: (e2) => {
|
|
37
|
+
z || e2.target?.select(), L(true);
|
|
38
|
+
} })] }) }) }), t(c, { sx: { minHeight: "10px", flex: "1 1 100%", display: "flex", flexDirection: "column", gap: (e2) => e2.spacing(0.5), marginTop: (e2) => e2.spacing(1) }, children: [e(u, { orientation: "horizontal", sx: { marginTop: (e2) => e2.spacing(1.5), marginBottom: (e2) => e2.spacing(0.75) } }), e(C, { disabled: k?.isProtected(), styleOptions: k?.getStyleOptions() ?? null, onStyleOptionsChange: (e2) => {
|
|
39
|
+
k.updateStyleOptions(e2);
|
|
40
|
+
}, showHeaderRow: k?.getShowHeaders(), onShowHeaderRowChange: (e2) => {
|
|
41
|
+
try {
|
|
42
|
+
k.setShowHeaders(e2);
|
|
43
|
+
} catch (e3) {
|
|
44
|
+
D.showError(e3);
|
|
45
|
+
}
|
|
46
|
+
}, showTotalRow: k?.getShowTotals(), onShowTotalRowChange: (e2) => {
|
|
47
|
+
try {
|
|
48
|
+
k.setShowTotals(e2);
|
|
49
|
+
} catch (e3) {
|
|
50
|
+
D.showError(e3);
|
|
51
|
+
}
|
|
52
|
+
}, showFilterButton: k?.getFilter() ? k.getShowFilterButton() : null, onShowFilterButtonChange: (e2) => {
|
|
53
|
+
try {
|
|
54
|
+
k.setShowFilterButton(e2);
|
|
55
|
+
} catch (e3) {
|
|
56
|
+
D.showError(e3);
|
|
57
|
+
}
|
|
58
|
+
} }), e(c, { sx: { display: "flex", alignItems: "center", justifyContent: "center", flexDirection: "column", marginTop: (e2) => e2.spacing(2), marginBottom: (e2) => e2.spacing(1) }, children: e(N, { table: k, styles: W.styles(), bodyStyle: W.bodyStyle(), cellHeight: 30, isLive: true }) }), e(u, { orientation: "horizontal" }), t(c, { sx: { display: "flex", flexDirection: "column", justifyContent: "center" }, children: [e(x, { variant: p.Menuitem, command: B.getCommand("convertTableToRange"), commandState: k, icon: f(e(y, {})) }), e(x, { variant: p.Menuitem, commandState: k, command: B.getCommand("deleteTable"), icon: f(e(y, {})) })] })] })] }), U] }) });
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
v as TableDetailsWindow,
|
|
62
|
+
v as default
|
|
63
|
+
};
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
7
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
8
8
|
import { memo as o, useState as a, useCallback as n, useEffect as i, useMemo as r } from "react";
|
|
9
|
-
import { alpha as l, getOverlayAlpha as s } from "@mui/material/styles
|
|
10
|
-
import { Box as p, FormControl as c, InputLabel as
|
|
9
|
+
import { alpha as l, getOverlayAlpha as s } from "@mui/material/styles";
|
|
10
|
+
import { Box as p, FormControl as c, InputLabel as u, Select as m, TextField as d, Typography as g, MenuItem as f } from "@mui/material";
|
|
11
11
|
import { NumberFormat as y } from "@sheetxl/sdk";
|
|
12
|
-
import {
|
|
12
|
+
import { useCallbackRef as h, KeyCodes as x } from "@sheetxl/utils-react";
|
|
13
|
+
import { OptionsDialog as C } from "@sheetxl/utils-mui";
|
|
13
14
|
const v = ["Ok", "Cancel"], b = o((o2) => {
|
|
14
|
-
const { initialValue: b2, context: T, onOption: k, onValidateOption: O, onInputOption: w, onDone: F, options: P = v, defaultOption: S = P?.[0], cancelOption: $ = "Cancel", sx: D, ...I } = o2, [
|
|
15
|
-
w?.(
|
|
16
|
-
}, [
|
|
17
|
-
if (e2.keyCode ===
|
|
18
|
-
false !== await B?.(
|
|
15
|
+
const { initialValue: b2, context: T, onOption: k, onValidateOption: O, onInputOption: w, onDone: F, options: P = v, defaultOption: S = P?.[0], cancelOption: $ = "Cancel", sx: D, ...I } = o2, [V, N] = a(b2), [j, z] = a(false), B = n(async (e2, t2) => true, []), L = h(async (e2) => {
|
|
16
|
+
w?.(V, e2), k?.(e2, e2 === $, e2 === S), F?.();
|
|
17
|
+
}, [V, w, F, k, $, S]), M = h(async (e2) => {
|
|
18
|
+
if (e2.keyCode === x.Enter) {
|
|
19
|
+
false !== await B?.(V, null) && L(S);
|
|
19
20
|
}
|
|
20
|
-
}, [
|
|
21
|
-
|
|
22
|
-
}, [O]), W =
|
|
21
|
+
}, [V, L]), R = h((e2) => {
|
|
22
|
+
N(e2.target.value), B?.(e2.target.value, null);
|
|
23
|
+
}, [O]), W = h(async (e2) => {
|
|
23
24
|
let t2 = await Promise.resolve(O?.(e2));
|
|
24
25
|
try {
|
|
25
|
-
false !== t2 && (t2 = await Promise.resolve(B?.(
|
|
26
|
+
false !== t2 && (t2 = await Promise.resolve(B?.(V, e2)) ?? true);
|
|
26
27
|
} catch (e3) {
|
|
27
28
|
}
|
|
28
29
|
return t2 ?? true;
|
|
29
|
-
}, [O]), [E, G] = a(y.Styles.lookupStyle(
|
|
30
|
+
}, [O]), [E, G] = a(y.Styles.lookupStyle(V).formatType ?? y.Type.Custom);
|
|
30
31
|
i(() => {
|
|
31
|
-
G(y.Styles.lookupStyle(
|
|
32
|
-
}, [
|
|
32
|
+
G(y.Styles.lookupStyle(V).formatType ?? y.Type.Custom);
|
|
33
|
+
}, [V]);
|
|
33
34
|
const H = r(() => {
|
|
34
35
|
const t2 = y.Styles.lookupPrimary(), o3 = (t3) => e(f, { value: t3, children: t3 }, t3), a2 = Object.keys(t2).map((e2) => o3(t2[e2].formatType));
|
|
35
36
|
return a2.push(o3(y.Type.Custom)), a2;
|
|
@@ -37,14 +38,14 @@ const v = ["Ok", "Cancel"], b = o((o2) => {
|
|
|
37
38
|
const t2 = e2.target.value;
|
|
38
39
|
G(t2);
|
|
39
40
|
const o3 = y.Styles.lookupDefault(t2);
|
|
40
|
-
o3 &&
|
|
41
|
+
o3 && N(o3);
|
|
41
42
|
}, []), q = r(() => {
|
|
42
43
|
const e2 = T();
|
|
43
|
-
return e2.createTemporaryCell({ value: e2.getValue() ?? 12345, style: { numberFormat:
|
|
44
|
-
}, [E,
|
|
45
|
-
return e(C, { title: "Number Format", options: P, onDone: F, onOption: (e2) => L(e2), onValidateOption: W, defaultOption: S, cancelOption: $, autoFocusSel: ".autoFocus", sx: { width: "580px", ...D }, ...I, children: t(p, { sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(0), rowGap: (e2) => e2.spacing(1), display: "flex", flexDirection: "column" }, children: [t(c, { sx: { minWidth: 135 }, size: "small", children: [e(
|
|
46
|
-
|
|
47
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (e2) => e2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1.25), paddingBottom: (e2) => e2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value:
|
|
44
|
+
return e2.createTemporaryCell({ value: e2.getValue() ?? 12345, style: { numberFormat: V } });
|
|
45
|
+
}, [E, V, T]);
|
|
46
|
+
return e(C, { title: "Number Format", options: P, onDone: F, onOption: (e2) => L(e2), onValidateOption: W, defaultOption: S, cancelOption: $, autoFocusSel: ".autoFocus", sx: { width: "580px", ...D }, ...I, children: t(p, { sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(0), rowGap: (e2) => e2.spacing(1), display: "flex", flexDirection: "column" }, children: [t(c, { sx: { minWidth: 135 }, size: "small", children: [e(u, { children: "Category" }), e(m, { value: E, label: "Category", onChange: K, sx: { backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` }, children: H })] }), e(c, { sx: { paddingTop: (e2) => e2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: e(d, { label: "Code", onFocus: (e2) => {
|
|
47
|
+
j || e2.target?.select(), z(true);
|
|
48
|
+
}, sx: { "& .MuiFormHelperText-root": { marginTop: (e2) => e2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1.25), paddingBottom: (e2) => e2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value: V, onChange: R, onKeyDown: M, onContextMenu: (e2) => {
|
|
48
49
|
e2.stopPropagation();
|
|
49
50
|
} }) }), t(p, { children: [e(g, { variant: "caption", component: "div", sx: { paddingLeft: (e2) => e2.spacing(2) }, children: "Preview" }), e(g, { variant: "body2", component: "div", sx: { borderRadius: (e2) => `${e2.shape.borderRadius}px`, padding: (e2) => e2.spacing(1), border: (e2) => `1px solid ${e2.palette.grey[400]}` }, children: q.getNumberFormat().displayText || "(empty)" })] })] }) });
|
|
50
51
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
7
|
import { jsx as t } from "react/jsx-runtime";
|
|
8
8
|
import { memo as n, useMemo as o, useState as e, useCallback as a } from "react";
|
|
9
|
-
import { alpha as i, getOverlayAlpha as s } from "@mui/material/styles
|
|
9
|
+
import { alpha as i, getOverlayAlpha as s } from "@mui/material/styles";
|
|
10
10
|
import { Box as l, FormControl as r, TextField as p } from "@mui/material";
|
|
11
|
-
import {
|
|
11
|
+
import { useCallbackRef as c } from "@sheetxl/utils-react";
|
|
12
|
+
import { OptionsDialog as m } from "@sheetxl/utils-mui";
|
|
12
13
|
const u = ["Ok", "Cancel"], d = n((n2) => {
|
|
13
14
|
const { initialComments: d2 = null, onUpdateComments: g, context: f, onOption: x, onValidateOption: h, onDone: C, options: O = u, defaultOption: y = O?.[0], cancelOption: w = "Cancel", sx: F, ...P } = n2, T = o(() => {
|
|
14
15
|
const t2 = d2 ?? f?.()?.getComments();
|
|
@@ -21,7 +22,7 @@ const u = ["Ok", "Cancel"], d = n((n2) => {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
return n3;
|
|
24
|
-
}, []), [k, v] = e(T), [I, b] = e(false),
|
|
25
|
+
}, []), [k, v] = e(T), [I, b] = e(false), D = a(async (t2, n3) => null, []), B = c(async (t2) => {
|
|
25
26
|
const n3 = "" === k ? [] : k.split("\n");
|
|
26
27
|
if (t2 !== w) {
|
|
27
28
|
const t3 = [];
|
|
@@ -30,19 +31,19 @@ const u = ["Ok", "Cancel"], d = n((n2) => {
|
|
|
30
31
|
g?.(o2);
|
|
31
32
|
}
|
|
32
33
|
x?.(t2, t2 === w, t2 === y), C?.();
|
|
33
|
-
}, [k, g, C, x, y, w]),
|
|
34
|
-
v(t2.target.value),
|
|
35
|
-
}, [h]),
|
|
34
|
+
}, [k, g, C, x, y, w]), E = c((t2) => {
|
|
35
|
+
v(t2.target.value), D(t2.target.value, null);
|
|
36
|
+
}, [h]), M = c(async (t2) => {
|
|
36
37
|
let n3 = await Promise.resolve(h?.(t2));
|
|
37
38
|
try {
|
|
38
|
-
false !== n3 && (n3 = await
|
|
39
|
+
false !== n3 && (n3 = await D(k, t2));
|
|
39
40
|
} catch (t3) {
|
|
40
41
|
}
|
|
41
42
|
return n3 ?? true;
|
|
42
43
|
}, [h, k]);
|
|
43
|
-
return t(m, { title: (T ? "Edit" : "Insert") + " Comments", options: O, onDone: C, onOption: (t2) =>
|
|
44
|
+
return t(m, { title: (T ? "Edit" : "Insert") + " Comments", options: O, onDone: C, onOption: (t2) => B(t2), onValidateOption: M, defaultOption: y, cancelOption: w, autoFocusSel: ".autoFocus", sx: { width: "480px", ...F }, ...P, children: t(l, { sx: { paddingTop: (t2) => t2.spacing(1), paddingBottom: (t2) => t2.spacing(0), rowGap: (t2) => t2.spacing(1), display: "flex", flexDirection: "column" }, children: t(r, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(p, { label: "Comments", placeholder: "Enter a comment.", onFocus: (t2) => {
|
|
44
45
|
I || t2.target?.select(), b(true);
|
|
45
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${i("#fff", s(5))}, ${i("#fff", s(5))})` } } }, value: k, onChange:
|
|
46
|
+
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${i("#fff", s(5))}, ${i("#fff", s(5))})` } } }, value: k, onChange: E, onContextMenu: (t2) => {
|
|
46
47
|
t2.stopPropagation();
|
|
47
48
|
} }) }) }) });
|
|
48
49
|
});
|