@sheetxl/studio-mui 0.7.12 → 0.7.14
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/-SJdVflEYXFC2raH.cjs +6 -0
- package/browser/cjs/BE0n-qrL7I0lr2f8.cjs +7 -0
- package/browser/cjs/CAxeR5WYtM_OKUqg.cjs +6 -0
- package/browser/cjs/CC-q_GCvhI_uweI4.cjs +6 -0
- package/browser/cjs/{wyak0LMoe5SYbD51.cjs → CHc92OjHJrS2B3rB.cjs} +2 -2
- package/browser/cjs/CN5q08lr4Coj9gzy.cjs +6 -0
- package/browser/cjs/{CcsfLc43Qp-vN_dY.cjs → CYMqmv5IamB1x14k.cjs} +3 -3
- package/browser/cjs/CwHuP4ot4XxM1FbL.cjs +6 -0
- package/browser/cjs/{CMEmwUuGpnOyILAu.cjs → DjU4LQ7p0jFx8PsW.cjs} +1 -1
- package/browser/cjs/DqwSkMX3TSwbvSfO.cjs +20 -0
- package/browser/cjs/Ij3b1ONhNaWLtkRT.cjs +6 -0
- package/browser/cjs/NpKL7qsDwzMarfjO.cjs +6 -0
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/BLiSCviFgWhD9SmC.mjs +53 -0
- package/browser/esm/BNF5wwVTFO0bKhDb.mjs +50 -0
- package/browser/esm/BlDN4JPF9n_TeCyQ.mjs +155 -0
- package/browser/esm/{DK1cCQD1jHxZbFAp.mjs → BzS-7g64cdTk8pFd.mjs} +1 -1
- package/browser/esm/BzkODf-EDNHsbeYC.mjs +26 -0
- package/browser/esm/{B7ChnkonDRA2zazH.mjs → Cd127EllJy0H1x8s.mjs} +3 -3
- package/browser/esm/CfkKWfDbYhDDort6.mjs +46 -0
- package/browser/esm/{CRmCo9Jr1gvSFGVp.mjs → D8YtOXZWnL-YI48g.mjs} +2121 -2108
- package/browser/esm/DezB6LbrlA_MqNpH.mjs +50 -0
- package/browser/esm/{fsGSNDVe9urk2cLB.mjs → DlZXGLXt7KBqpCgX.mjs} +2 -2
- package/browser/esm/{aeHM-2IGRQaGFohd.mjs → XGwUZoREuZ029cPM.mjs} +28 -27
- package/browser/esm/aWQ7-rGmyvVU_nRK.mjs +25 -0
- package/browser/esm/index.mjs +2 -2
- package/licenses/dependencies.txt +142 -142
- package/node/esm/4D3fLVzYqPTas9nR.mjs +25 -0
- package/node/esm/B6-CF_32FCaDZJDm.mjs +52 -0
- package/node/esm/C21w0yQGlygcFqHI.mjs +156 -0
- package/node/esm/{H012qdl97RHln5MW.mjs → C62EF6LSsPD4LAL6.mjs} +1 -1
- package/node/esm/{Df6HNjgJTgShGC-O.mjs → C8TcDhw9hCrJxqfJ.mjs} +1 -1
- package/node/esm/{CwKoYwlrp9nnVHln.mjs → CM8Jkahi0myGVt_v.mjs} +22 -22
- package/node/esm/{CGaHni9C2sipjSMn.mjs → CREPL1yvIjmYpU-r.mjs} +9 -7
- package/node/esm/CeJ5myvgfYOUSKGq.mjs +26 -0
- package/node/esm/{BEFwnAOkyd0CWlex.mjs → D9PLpUGQqMmk1V9n.mjs} +13 -13
- package/node/esm/index.mjs +531 -523
- package/node/esm/{BSTIZiKBGgwjXLtp.mjs → xCdMLxN5xcpczFUI.mjs} +18 -18
- package/package.json +17 -15
- package/browser/cjs/BYfcSe1JgcohGr-C.cjs +0 -7
- package/browser/cjs/BZPmbh6TWeAN2tiY.cjs +0 -6
- package/browser/cjs/CrkutQSHB1Buy5oQ.cjs +0 -6
- package/browser/cjs/D2KC31HOMCGQMLvD.cjs +0 -6
- package/browser/cjs/DiQXaxwfHcQfkYKX.cjs +0 -6
- package/browser/cjs/Dmw2IW35YLNmLgvP.cjs +0 -20
- package/browser/cjs/bItCE_-c88dO7Izw.cjs +0 -6
- package/browser/cjs/fa-Q2vHsld47aqrE.cjs +0 -6
- package/browser/esm/BZPlU0oT2oGTQQgK.mjs +0 -46
- package/browser/esm/BzGH26JDt4xKZfM7.mjs +0 -49
- package/browser/esm/CA-_Kya2gsMrF9Ef.mjs +0 -26
- package/browser/esm/CGBRrUgnGzuP9FGo.mjs +0 -156
- package/browser/esm/csScKLYnqrrlL197.mjs +0 -25
- package/browser/esm/lm9H6CMj_7o_ra2l.mjs +0 -53
- package/node/esm/BqLlyKyVXFNiRaJv.mjs +0 -25
- package/node/esm/Cq6TadzONqFlX07d.mjs +0 -26
- package/node/esm/D71WQjM6hP5FzBql.mjs +0 -157
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
|
|
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 n, useRef as i, useState as o, useEffect as l, useLayoutEffect as r, useMemo as s } from "react";
|
|
9
|
+
import { useMeasure as a } from "react-use";
|
|
10
|
+
import { alpha as c, getOverlayAlpha as p } from "@mui/material/styles";
|
|
11
|
+
import { DialogContent as d, Box as u, TextField as f, InputAdornment as m, Collapse as g, MenuItem as x, FormControl as h, InputLabel as O, Select as y } from "@mui/material";
|
|
12
|
+
import { ICell as C, IRange as b } from "@sheetxl/sdk";
|
|
13
|
+
import { CommandContext as v } from "@sheetxl/react";
|
|
14
|
+
import { useCallbackRef as R, KeyCodes as F, DynamicIcon as k, KeyModifiers as T } from "@sheetxl/utils-react";
|
|
15
|
+
import { InternalWindow as w, ExhibitOptionButton as S, ExhibitDivider as E } from "@sheetxl/utils-mui";
|
|
16
|
+
const K = { width: "1.5rem", height: "1.5rem" }, I = n((n2) => {
|
|
17
|
+
const { label: i2, value: r2, options: a2, onSelect: d2, tabIndex: u2 = 0, ...f2 } = n2, [m2, g2] = o(() => M(r2, a2));
|
|
18
|
+
l(() => {
|
|
19
|
+
g2(M(r2, a2));
|
|
20
|
+
}, [r2, a2]);
|
|
21
|
+
const C2 = R((e2) => {
|
|
22
|
+
g2(e2.target.value), d2?.(a2[e2.target.value]);
|
|
23
|
+
}, [d2, a2]), b2 = s(() => Object.keys(a2).map((t2) => e(x, { value: t2, children: t2 }, t2)), [a2]);
|
|
24
|
+
return t(h, { sx: { minWidth: 135 }, size: "small", children: [e(O, { children: i2 }), e(y, { inputProps: { tabIndex: u2 }, value: m2, label: i2, onChange: C2, sx: { backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` }, ...f2, children: b2 })] });
|
|
25
|
+
}), D = { enter: 140, exit: 140 }, A = { Formulas: C.Content.Formulas, Values: C.Content.Values, Notes: C.Content.Notes, Comments: C.Content.Comments }, B = { ...A };
|
|
26
|
+
delete B.Values;
|
|
27
|
+
const $ = { "By Rows": true, "By Columns": false }, M = (e2, t2) => {
|
|
28
|
+
const n2 = Object.keys(t2);
|
|
29
|
+
for (let i2 = 0; i2 < n2.length; i2++) {
|
|
30
|
+
const o2 = n2[i2];
|
|
31
|
+
if (t2[o2] === e2) return o2;
|
|
32
|
+
}
|
|
33
|
+
}, P = n((n2) => {
|
|
34
|
+
const { initialValue: s2, context: x2, onInput: h2, title: O2, onHide: y2, autoFocus: M2, ...P2 } = n2, V = s2?.replace ?? false, z = s2?.findOptions, L = z.text ?? null, W = s2?.replaceOptions, N = s2?.replaceText ?? null, j = x2?.(), H = i(null), U = i(null), G = i(null), q = i(null), J = i(null), Q = i(null), X = (e2, t2) => {
|
|
35
|
+
if (!t2) return;
|
|
36
|
+
t2.start(e2, { center: false }), setTimeout(() => t2.stop(e2), 180);
|
|
37
|
+
}, [Y, Z] = o(false), [_, ee] = o(false), [te, ne] = o(V), [ie, oe] = o(false), [le, re] = o(false), [se, ae] = o({ replaceText: null, replace: V, replaceOptions: null, findOptions: { text: null, matchCase: false, matchEntireCell: false, useRegex: false, orientation: b.Orientation.Row, fields: [C.Content.Formulas] }, scope: v.FindScopeOptions.Sheet }), ce = R(async (e2, t2, n3, i2) => {
|
|
38
|
+
if (!j) return;
|
|
39
|
+
const o2 = { ...se };
|
|
40
|
+
o2.replaceOptions = { ...o2.replaceOptions }, o2.findOptions = { ...o2.findOptions }, o2.replaceOptions.maxCount = n3 ? void 0 : 1, o2.replace = t2, t2 && se.findOptions.fields?.[0] === C.Content.Values && (o2.findOptions.fields = [C.Content.Formulas]), o2.findOptions.reverse = !e2;
|
|
41
|
+
const l2 = await j({ autoFocus: i2, ...o2 });
|
|
42
|
+
oe(0 === l2);
|
|
43
|
+
}, [se, j]);
|
|
44
|
+
l(() => {
|
|
45
|
+
oe(false);
|
|
46
|
+
}, [se, _, te]);
|
|
47
|
+
const pe = R((e2, t2) => {
|
|
48
|
+
if (e2.keyCode === F.Enter) {
|
|
49
|
+
if (!se.findOptions.text) return;
|
|
50
|
+
let n3 = true, i2 = false;
|
|
51
|
+
e2.shiftKey && (n3 = false), t2 ? (e2.ctrlKey && e2.altKey && (i2 = true), X(e2, i2 ? Q.current : J.current)) : X(e2, n3 ? q.current : G.current), ce(n3, t2, i2, false);
|
|
52
|
+
}
|
|
53
|
+
}, [se]), de = i(null);
|
|
54
|
+
r(() => {
|
|
55
|
+
ae((e2) => {
|
|
56
|
+
const t2 = { ...e2 };
|
|
57
|
+
t2.findOptions.text = L && L.length > 0 ? L : e2.findOptions.text ?? "", Z(true), null !== N && (t2.replaceText = N ?? ""), z && (t2.findOptions = { ...t2.findOptions, ...z }), t2.replaceText || (t2.replaceText = ""), t2.replaceOptions && (t2.replaceOptions = { ...t2.replaceOptions }), W && (t2.replaceOptions = { ...t2.replaceOptions, ...W }), se.findOptions.fields?.[0] || (se.findOptions.fields = [C.Content.Formulas]);
|
|
58
|
+
const n3 = !(!V && !W && null === N);
|
|
59
|
+
return n3 && ne(n3), t2;
|
|
60
|
+
}), le || de.current?.focus();
|
|
61
|
+
}, [s2, V, L, N, z, W]), l(() => {
|
|
62
|
+
te ? (se.findOptions.fields[0], C.Content.Values) : Z(true);
|
|
63
|
+
}, [te]), l(() => {
|
|
64
|
+
if (Y && H.current && se.findOptions.text === H.current.value) return H.current === document.activeElement || H.current.contains(document.activeElement) ? (H.current?.select(), void Z(false)) : void H.current.addEventListener("focus", () => {
|
|
65
|
+
H.current?.select(), Z(false);
|
|
66
|
+
}, { once: true });
|
|
67
|
+
}, [Y, se]);
|
|
68
|
+
const [ue, { width: fe }] = a();
|
|
69
|
+
return e(w, { ref: de, title: O2 ?? (te ? "Find & Replace" : "Find"), initialPosition: { y: "35" }, autoFocusSel: ".input", onHide: y2, onFocus: () => re(true), onBlur: () => {
|
|
70
|
+
re(false), oe(false);
|
|
71
|
+
}, slotProps: { paper: { elevation: le ? 3 : 1 } }, ...P2, children: t(d, { dividers: true, ref: ue, sx: { display: "flex", flexDirection: "column", paddingLeft: (e2) => e2.spacing(1.5), paddingRight: (e2) => e2.spacing(1.5) }, onKeyDown: (e2) => {
|
|
72
|
+
if ("h" === e2.key && e2.ctrlKey) ne(true), H.current?.contains(document.activeElement) && U.current?.focus();
|
|
73
|
+
else if ("f" === e2.key && e2.ctrlKey) H.current?.focus();
|
|
74
|
+
else if ("c" === e2.key && e2.altKey) ae((e3) => {
|
|
75
|
+
const t2 = { ...e3 };
|
|
76
|
+
return t2.findOptions.matchCase = !e3.findOptions.matchCase, t2;
|
|
77
|
+
});
|
|
78
|
+
else if ("e" === e2.key && e2.altKey) ae((e3) => {
|
|
79
|
+
const t2 = { ...e3 };
|
|
80
|
+
return t2.findOptions.matchEntireCell = !e3.findOptions.matchEntireCell, t2;
|
|
81
|
+
});
|
|
82
|
+
else {
|
|
83
|
+
if ("r" !== e2.key || !e2.altKey) return;
|
|
84
|
+
ae((e3) => {
|
|
85
|
+
const t2 = { ...e3 };
|
|
86
|
+
return t2.findOptions.useRegex = !e3.findOptions.useRegex, t2;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
e2.preventDefault();
|
|
90
|
+
}, children: [t(u, { sx: { display: "flex", flexDirection: "row", gap: (e2) => e2.spacing(1) }, children: [t(u, { sx: { display: "flex", flexDirection: "row", alignItems: "start", gap: (e2) => e2.spacing(0.25), paddingTop: "3px" }, children: [e(S, { selected: _, onSelectToggle: (e2) => {
|
|
91
|
+
ee(e2);
|
|
92
|
+
}, preventFocus: true, label: "Toggle Additional Options", icon: e(k, { iconKey: "FindOptions" }) }), e(S, { selected: te, onSelectToggle: (e2) => {
|
|
93
|
+
ne(e2);
|
|
94
|
+
}, preventFocus: true, label: "Toggle Replace", icon: e(k, { iconKey: "FindReplaceToggle" }), shortcut: { key: te ? "F" : "H", modifiers: [T.Ctrl] } })] }), t(u, { sx: { display: "flex", flexDirection: "column", maxWidth: "100%", boxSizing: "border-box" }, children: [t(u, { sx: { display: "flex", flexDirection: "row", alignItems: "center" }, children: [e(f, { label: "Find", slotProps: { input: { sx: { paddingRight: (e2) => e2.spacing(1), minWidth: fe > 460 ? "20em" : void 0, backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` }, endAdornment: e(m, { position: "end", children: t(u, { sx: { display: "flex", alignItems: "center", flexDirection: "row", gap: "2px" }, children: [e(S, { style: K, selected: se.findOptions.matchCase, onBlur: () => {
|
|
95
|
+
}, onSelectToggle: (e2) => {
|
|
96
|
+
ae((t2) => {
|
|
97
|
+
const n3 = { ...t2 };
|
|
98
|
+
return n3.findOptions.matchCase = e2, n3;
|
|
99
|
+
});
|
|
100
|
+
}, label: "Match Case", shortcut: { key: "C", modifiers: [T.Alt] }, icon: e(k, { iconKey: "FindCaseSensitive", size: "1rem" }) }), e(S, { style: K, selected: se.findOptions.matchEntireCell, onSelectToggle: (e2) => {
|
|
101
|
+
ae((t2) => {
|
|
102
|
+
const n3 = { ...t2 };
|
|
103
|
+
return n3.findOptions.matchEntireCell = e2, n3;
|
|
104
|
+
});
|
|
105
|
+
}, label: "Match Entire Cell", shortcut: { key: "E", modifiers: [T.Alt] }, icon: e(k, { iconKey: "FindWholeWord", size: "1rem" }) }), e(S, { style: K, selected: se.findOptions.useRegex, onSelectToggle: (e2) => {
|
|
106
|
+
ae((t2) => {
|
|
107
|
+
const n3 = { ...t2 };
|
|
108
|
+
return n3.findOptions.useRegex = e2, n3;
|
|
109
|
+
});
|
|
110
|
+
}, label: "Use Regular Expression", shortcut: { key: "R", modifiers: [T.Alt] }, icon: e(k, { iconKey: "FindRegEx", size: "1rem" }) })] }) }) }, inputLabel: { shrink: true }, htmlInput: { draggable: false, ref: H, className: "input", autoFocus: true, spellCheck: false, autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1.25), paddingBottom: (e2) => e2.spacing(0.75) } } }, sx: { flex: "1 1 100%", marginRight: (e2) => e2.spacing(1), "& .MuiOutlinedInput-notchedOutline": { borderColor: (e2) => ie ? `${e2.palette.error.main} !important` : void 0 }, "& .MuiInputLabel-outlined": { color: (e2) => ie ? `${e2.palette.error.main} !important` : void 0 } }, value: se.findOptions.text ?? "", onChange: (e2) => {
|
|
111
|
+
ae((t2) => {
|
|
112
|
+
const n3 = { ...t2 };
|
|
113
|
+
return n3.findOptions.text = e2.target.value, n3;
|
|
114
|
+
});
|
|
115
|
+
}, onKeyDown: (e2) => pe(e2, false), onContextMenu: (e2) => {
|
|
116
|
+
e2.stopPropagation();
|
|
117
|
+
} }), e(S, { selected: se.findOptions.reverse, onSelectToggle: (e2) => {
|
|
118
|
+
ce(false, false);
|
|
119
|
+
}, touchRippleRef: G, label: "", shortcut: { key: "Enter", modifiers: [T.Shift] }, icon: e(k, { iconKey: se.findOptions.orientation !== b.Orientation.Column ? "ArrowBack" : "ArrowUpward" }), disabled: !se.findOptions.text }), e(S, { selected: !se.findOptions.reverse, onSelectToggle: (e2) => {
|
|
120
|
+
ce(true, false);
|
|
121
|
+
}, touchRippleRef: q, label: "Next Match", shortcut: { key: "Enter" }, icon: e(k, { iconKey: se.findOptions.orientation !== b.Orientation.Column ? "ArrowForward" : "ArrowDownward" }), disabled: !se.findOptions.text })] }), e(g, { in: te, timeout: D, onExit: () => {
|
|
122
|
+
H.current?.focus();
|
|
123
|
+
}, children: t(u, { sx: { display: "flex", flexDirection: "row", alignItems: "center", marginTop: (e2) => e2.spacing(2) }, children: [e(f, { label: "Replace", slotProps: { input: { sx: { paddingRight: (e2) => e2.spacing(1), backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` } }, inputLabel: { shrink: true }, htmlInput: { ref: U, className: "input", spellCheck: false, autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1.25), paddingBottom: (e2) => e2.spacing(0.75) } } }, sx: { flex: "1 1 100%", marginRight: (e2) => e2.spacing(1) }, value: se.replaceText ?? "", onChange: (e2) => {
|
|
124
|
+
ae((t2) => {
|
|
125
|
+
const n3 = { ...t2 };
|
|
126
|
+
return n3.replaceText = e2.target.value, n3;
|
|
127
|
+
});
|
|
128
|
+
}, onKeyDown: (e2) => pe(e2, true), onContextMenu: (e2) => {
|
|
129
|
+
e2.stopPropagation();
|
|
130
|
+
} }), e(S, { onSelectToggle: (e2) => {
|
|
131
|
+
ce(true, true);
|
|
132
|
+
}, touchRippleRef: J, label: "Replace", shortcut: { key: "Enter" }, icon: e(k, { iconKey: "FindReplace" }), disabled: !se.findOptions.text }), e(S, { onSelectToggle: (e2) => {
|
|
133
|
+
ce(true, true, true);
|
|
134
|
+
}, touchRippleRef: Q, label: "Replace All", shortcut: { key: "Enter", modifiers: [T.Ctrl, T.Alt] }, icon: e(k, { iconKey: "FindReplaceAll" }), disabled: !se.findOptions.text })] }) })] })] }), e(g, { in: _, timeout: D, onExit: () => {
|
|
135
|
+
H.current?.focus();
|
|
136
|
+
}, children: t(u, { sx: { minHeight: "10px", flex: "1 1 100%", display: "flex", flexDirection: "column", gap: (e2) => e2.spacing(1.5), marginTop: (e2) => e2.spacing(1) }, children: [e(E, { orientation: "horizontal", sx: { marginBottom: (e2) => e2.spacing(1.5) } }), t(u, { sx: { display: "flex", flexDirection: fe >= 383 ? "row" : "column", justifyContent: "space-evenly", alignItems: "center", gap: (e2) => e2.spacing(1), rowGap: (e2) => e2.spacing(2) }, tabIndex: -1, children: [e(I, { label: "Within", value: se.scope, options: v.FindScopeOptions, onSelect: (e2) => {
|
|
137
|
+
ae((t2) => {
|
|
138
|
+
const n3 = { ...t2 };
|
|
139
|
+
return n3.scope = e2, n3;
|
|
140
|
+
});
|
|
141
|
+
} }), e(I, { label: "Search", value: se.findOptions.orientation !== b.Orientation.Column, options: $, onSelect: (e2) => {
|
|
142
|
+
ae((t2) => {
|
|
143
|
+
const n3 = { ...t2 };
|
|
144
|
+
return n3.findOptions.orientation = e2 ? b.Orientation.Row : b.Orientation.Column, n3;
|
|
145
|
+
});
|
|
146
|
+
} }), e(I, { label: "Look in", value: te && se.findOptions.fields?.[0] === C.Content.Values ? C.Content.Formulas : se.findOptions.fields?.[0], options: te ? B : A, onSelect: (e2) => {
|
|
147
|
+
ae((t2) => {
|
|
148
|
+
const n3 = { ...t2 };
|
|
149
|
+
return n3.findOptions.fields = [e2], n3;
|
|
150
|
+
});
|
|
151
|
+
} })] })] }) })] }) });
|
|
152
|
+
});
|
|
153
|
+
export {
|
|
154
|
+
P as FindReplaceWindow,
|
|
155
|
+
P as default
|
|
156
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
|
|
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.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
|
|
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.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
|
|
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.
|
|
@@ -7,40 +7,40 @@
|
|
|
7
7
|
import { jsx as t, jsxs as e } from "react/jsx-runtime";
|
|
8
8
|
import { memo as n, useMemo as o, useState as a, useCallback as i } from "react";
|
|
9
9
|
import { alpha as l, getOverlayAlpha as s } from "@mui/material/styles";
|
|
10
|
-
import { Box as r, FormControl as p, TextField as
|
|
11
|
-
import { useCallbackRef as
|
|
10
|
+
import { Box as r, FormControl as p, TextField as d } from "@mui/material";
|
|
11
|
+
import { useCallbackRef as c } from "@sheetxl/utils-react";
|
|
12
12
|
import { OptionsDialog as u } from "@sheetxl/utils-mui";
|
|
13
13
|
const g = ["Ok", "Cancel"], m = n((n2) => {
|
|
14
|
-
const {
|
|
14
|
+
const { initialValue: m2 = null, context: f, onInput: x, onOption: h, onValidateOption: T, onDone: y, options: k = g, defaultOption: C = k?.[0], cancelOption: O = "Cancel", sx: b, ...F } = n2, v = o(() => null !== (m2 ?? f?.()?.getHyperlink()), []), w = o(() => {
|
|
15
15
|
let t2 = null, e2 = null;
|
|
16
16
|
m2 && ("string" == typeof m2 ? e2 = m2 : t2 = m2);
|
|
17
|
-
const n3 = t2 ??
|
|
17
|
+
const n3 = t2 ?? f?.()?.getHyperlink();
|
|
18
18
|
return { address: e2 ?? n3?.getAddress() ?? "", textToDisplay: n3?.getDisplayText() ?? "" };
|
|
19
|
-
}, [m2,
|
|
20
|
-
const t2 =
|
|
19
|
+
}, [m2, f]), [D, I] = a(w.address), [P, H] = a(() => {
|
|
20
|
+
const t2 = f?.().toTextUnformatted() ?? w.displayText;
|
|
21
21
|
return t2 === w.address ? "" : t2;
|
|
22
|
-
}), [
|
|
23
|
-
|
|
24
|
-
}, []),
|
|
25
|
-
const e2 = "" ===
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
I(t2.target.value),
|
|
29
|
-
}, [T]),
|
|
22
|
+
}), [M, $] = a(false), B = i((t2) => {
|
|
23
|
+
H(t2.target.value);
|
|
24
|
+
}, []), L = i(async (t2, e2) => null, []), V = c(async (t2) => {
|
|
25
|
+
const e2 = "" === D ? null : { address: D }, n3 = t2 === O;
|
|
26
|
+
n3 || x?.({ address: e2?.address ?? null, displayText: P ?? null }), h?.(t2, n3, t2 === C), y?.();
|
|
27
|
+
}, [D, P, f, x, y, h, C, O]), W = c((t2) => {
|
|
28
|
+
I(t2.target.value), L(t2.target.value, null);
|
|
29
|
+
}, [T]), z = c(async (t2) => {
|
|
30
30
|
let e2 = await Promise.resolve(T?.(t2));
|
|
31
31
|
try {
|
|
32
|
-
false !== e2 && (e2 = await
|
|
32
|
+
false !== e2 && (e2 = await L(D, t2));
|
|
33
33
|
} catch (t3) {
|
|
34
34
|
}
|
|
35
35
|
return e2 ?? true;
|
|
36
36
|
}, [T]);
|
|
37
|
-
return t(u, { title: (v ? "Edit" : "Insert") + " Link", options:
|
|
38
|
-
|
|
39
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, slotProps: { inputLabel: { shrink: true }, htmlInput: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value:
|
|
37
|
+
return t(u, { title: (v ? "Edit" : "Insert") + " Link", options: k, onDone: y, onOption: (t2) => V(t2), onValidateOption: z, defaultOption: C, cancelOption: O, autoFocusSel: ".autoFocus", sx: { width: "480px", ...b }, ...F, children: e(r, { sx: { paddingTop: (t2) => t2.spacing(1), paddingBottom: (t2) => t2.spacing(0), rowGap: (t2) => t2.spacing(1), display: "flex", flexDirection: "column" }, children: [t(p, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(d, { label: "Address", placeholder: "Enter a url or cell reference.", onFocus: (t2) => {
|
|
38
|
+
M || t2.target?.select(), $(true);
|
|
39
|
+
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, slotProps: { inputLabel: { shrink: true }, htmlInput: { className: "autoFocus", spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value: D, onChange: W, onContextMenu: (t2) => {
|
|
40
40
|
t2.stopPropagation();
|
|
41
|
-
} }) }), t(p, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(
|
|
42
|
-
|
|
43
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, slotProps: { inputLabel: { shrink: true }, htmlInput: { spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value: P, onChange:
|
|
41
|
+
} }) }), t(p, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(d, { label: "Display Text", placeholder: D?.startsWith("#") ? D.substring(1) : D, onFocus: () => {
|
|
42
|
+
$(true);
|
|
43
|
+
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, slotProps: { inputLabel: { shrink: true }, htmlInput: { spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value: P, onChange: B, onContextMenu: (t2) => {
|
|
44
44
|
t2.stopPropagation();
|
|
45
45
|
} }) })] }) });
|
|
46
46
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
|
|
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.
|
|
@@ -7,13 +7,14 @@
|
|
|
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
9
|
import { alpha as l, getOverlayAlpha as s } from "@mui/material/styles";
|
|
10
|
-
import { Box as p, FormControl as c, InputLabel as
|
|
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
12
|
import { useCallbackRef as h, KeyCodes as x } from "@sheetxl/utils-react";
|
|
13
13
|
import { OptionsDialog as C } from "@sheetxl/utils-mui";
|
|
14
14
|
const v = ["Ok", "Cancel"], b = o((o2) => {
|
|
15
|
-
const { initialValue: b2, context: T, onOption: k, onValidateOption: O,
|
|
16
|
-
|
|
15
|
+
const { initialValue: b2, context: T, onOption: k, onValidateOption: O, onInput: w, onDone: F, options: S = v, defaultOption: P = S?.[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
|
+
const t2 = e2 === $;
|
|
17
|
+
t2 || w?.(V, e2), k?.(e2, t2, e2 === P), F?.();
|
|
17
18
|
}, [V, w, F, k, $, P]), M = h(async (e2) => {
|
|
18
19
|
if (e2.keyCode === x.Enter) {
|
|
19
20
|
false !== await B?.(V, null) && L(P);
|
|
@@ -40,14 +41,15 @@ const v = ["Ok", "Cancel"], b = o((o2) => {
|
|
|
40
41
|
const o3 = y.Styles.lookupDefault(t2);
|
|
41
42
|
o3 && N(o3);
|
|
42
43
|
}, []), q = r(() => {
|
|
43
|
-
const e2 = T();
|
|
44
|
+
const e2 = T?.();
|
|
45
|
+
if (!e2) return null;
|
|
44
46
|
return e2.createTemporaryCell({ value: e2.getValue() ?? 12345, style: { numberFormat: V } });
|
|
45
47
|
}, [E, V, T]);
|
|
46
|
-
return e(C, { title: "Number Format", options: S, onDone: F, onOption: (e2) => L(e2), onValidateOption: W, defaultOption: P, 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(
|
|
48
|
+
return e(C, { title: "Number Format", options: S, onDone: F, onOption: (e2) => L(e2), onValidateOption: W, defaultOption: P, 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
49
|
j || e2.target?.select(), z(true);
|
|
48
50
|
}, sx: { "& .MuiFormHelperText-root": { marginTop: (e2) => e2.spacing(0.5) } }, slotProps: { inputLabel: { shrink: true }, htmlInput: { 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) => {
|
|
49
51
|
e2.stopPropagation();
|
|
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
|
|
52
|
+
} }) }), 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)" })] })] }) });
|
|
51
53
|
});
|
|
52
54
|
export {
|
|
53
55
|
b as NumberFormatDialog,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
|
|
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 n } from "react/jsx-runtime";
|
|
8
|
+
import { memo as t, useState as i } from "react";
|
|
9
|
+
import { Box as o, FormControlLabel as l, Checkbox as r } from "@mui/material";
|
|
10
|
+
import { Sort as a, IRange as s } from "@sheetxl/sdk";
|
|
11
|
+
import { useCallbackRef as c } from "@sheetxl/utils-react";
|
|
12
|
+
import { OptionsDialog as d } from "@sheetxl/utils-mui";
|
|
13
|
+
const m = t((t2) => {
|
|
14
|
+
const { initialValue: m2, context: u, onInput: p, onDone: h, ...v } = t2, C = u?.().range, O = u?.().cell.toString(), [f, H] = i(m2 ?? a.DefaultRangeOptions), b = c((e2) => {
|
|
15
|
+
let n2 = null;
|
|
16
|
+
"Sort" === e2 && (n2 = { ...m2, ...f }), p?.(n2), h?.(n2);
|
|
17
|
+
}, [f, h, p, m2]);
|
|
18
|
+
return e(d, { title: "Sort", options: ["Sort", "Cancel"], onDone: b, ...v, children: n(o, { sx: { display: "flex", flexDirection: "column" }, children: [e(l, { control: e(r, { checked: !f.reverse, onChange: () => H((e2) => ({ ...e2, reverse: !e2.reverse })) }), label: "Is Ascending", labelPlacement: "end" }), e(l, { control: e(r, { checked: f.hasHeader, onChange: () => H((e2) => ({ ...e2, hasHeader: !e2.hasHeader })) }), label: "Has Header", labelPlacement: "end" }), e(l, { control: e(r, { checked: f.collatorOptions?.sensitivity === a.CaseSensitiveOptions.sensitivity, onChange: () => H((e2) => ({ ...e2, collatorOptions: f.collatorOptions?.sensitivity === a.CaseSensitiveOptions.sensitivity ? a.CaseInsensitiveOptions : a.CaseSensitiveOptions })) }), label: "Case Sensitive", labelPlacement: "end" }), e(l, { control: e(r, { checked: f.orientation === s.Orientation.Row, onChange: () => H((e2) => {
|
|
19
|
+
const n2 = e2.orientation === s.Orientation.Row ? s.Orientation.Column : s.Orientation.Row;
|
|
20
|
+
return { ...C.getDefaultSortCriteria(n2, O).options, includeHidden: e2.includeHidden, reverse: e2.reverse, orientation: n2 };
|
|
21
|
+
}) }), label: "Row Sort", labelPlacement: "end" }), e(l, { control: e(r, { checked: f.includeHidden, onChange: () => H((e2) => ({ ...e2, includeHidden: !e2.includeHidden })) }), label: "Include Hidden", labelPlacement: "end" })] }) });
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
m as SortDialog,
|
|
25
|
+
m as default
|
|
26
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.14
|
|
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.
|
|
@@ -11,33 +11,33 @@ import { useCallbackRef as r } from "@sheetxl/utils-react";
|
|
|
11
11
|
import { OptionsDialog as s } from "@sheetxl/utils-mui";
|
|
12
12
|
import { NamedInput as d, RangeInput as p } from "./index.mjs";
|
|
13
13
|
const m = ["Ok", "Cancel"], u = a((a2) => {
|
|
14
|
-
const {
|
|
14
|
+
const { initialValue: u2 = null, context: c, onOption: g, onValidateOption: x, onDone: f, onInput: N, options: y = m, defaultOption: T = y?.[0], cancelOption: V = "Cancel", sx: h, ...O } = a2, v = n(() => c?.().getNames().findValidName("Range1"), []), C = n(() => {
|
|
15
15
|
if (!u2) return true;
|
|
16
|
-
}, []), [R, w] = l({ displayText: u2?.getName() ?? v, errorText: null }), [F,
|
|
16
|
+
}, []), [R, w] = l({ displayText: u2?.getName() ?? v, errorText: null }), [F, I] = l({ displayValue: u2?.getRanges() ?? c?.().selection() ?? null, errorText: null }), [D, j] = l(false), B = o(async (e2) => !R.errorText && !F.errorText, []), E = r((e2, t2, a3) => {
|
|
17
17
|
if (!t2) {
|
|
18
18
|
let e3 = null;
|
|
19
|
-
C ? e3 = c?.getNames().addReference(R?.displayText, F?.displayValue, false) : ("reference" === u2.getType() && u2.doBatch(() => {
|
|
19
|
+
C ? e3 = c?.().getNames().addReference(R?.displayText, F?.displayValue, false) : ("reference" === u2.getType() && u2.doBatch(() => {
|
|
20
20
|
u2.setName(R?.displayText), u2.setReference(F?.displayValue);
|
|
21
|
-
}, `Edit Named '${R?.displayText}'`), e3 = u2), e3 && (e3.select(), N(e3
|
|
21
|
+
}, `Edit Named '${R?.displayText}'`), e3 = u2), e3 && (e3.select(), N(e3));
|
|
22
22
|
}
|
|
23
23
|
g?.(e2, t2, a3), f?.();
|
|
24
|
-
}, [c, R, F, f, g, T,
|
|
24
|
+
}, [c, R, F, f, g, T, V, N]), L = r((e2) => {
|
|
25
25
|
let t2 = null;
|
|
26
26
|
try {
|
|
27
|
-
c?.getNames().validateName(e2);
|
|
27
|
+
c?.().getNames().validateName(e2);
|
|
28
28
|
} catch (e3) {
|
|
29
29
|
t2 = e3.message;
|
|
30
30
|
}
|
|
31
31
|
w({ displayText: e2, errorText: t2 });
|
|
32
32
|
}, []), b = r((e2) => {
|
|
33
|
-
u2 && u2.getName().toLowerCase() === e2.toLowerCase() || c?.getNames().validateName(e2);
|
|
33
|
+
u2 && u2.getName().toLowerCase() === e2.toLowerCase() || c?.().getNames().validateName(e2);
|
|
34
34
|
}, [c, u2]), k = o((e2) => {
|
|
35
|
-
|
|
35
|
+
I({ displayValue: e2 ?? null, errorText: null });
|
|
36
36
|
}, []);
|
|
37
|
-
return e(s, { title: (C ? "Define" : "Edit") + " Range", options: y, onOption: E, onValidateOption: B, defaultOption: T, cancelOption:
|
|
38
|
-
|
|
39
|
-
} }), e(p, { formName: "range", value: F.displayValue, onChangeInput: k, resolvedAddress: c.getNames().getRanges.bind(c.getNames()), onFocus: (e2) => {
|
|
40
|
-
|
|
37
|
+
return e(s, { title: (C ? "Define" : "Edit") + " Range", options: y, onOption: E, onValidateOption: B, defaultOption: T, cancelOption: V, autoFocusSel: ".autoFocus", sx: { width: "460px", ...h }, ...O, children: t(i, { sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(0), rowGap: (e2) => e2.spacing(1), range: "flex", flexDirection: "column" }, children: [e(d, { formName: "name", defaultInput: v, value: R.displayText, onChangeInput: L, onValidate: b, onFocus: (e2) => {
|
|
38
|
+
D || e2.target?.select(), j(true);
|
|
39
|
+
} }), e(p, { formName: "range", value: F.displayValue, onChangeInput: k, resolvedAddress: c ? c().getNames().getRanges.bind(c().getNames()) : void 0, onFocus: (e2) => {
|
|
40
|
+
D || e2.target?.select(), j(true);
|
|
41
41
|
} })] }) });
|
|
42
42
|
});
|
|
43
43
|
export {
|