@sheetxl/studio-mui 0.7.6 → 0.7.7
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/LICENSE.md +1 -1
- package/browser/cjs/BCf8BQb2c8ANexW4.cjs +7 -0
- package/browser/cjs/BJ4pZo7s81ynDlzw.cjs +6 -0
- package/browser/cjs/{-u6vWH9DiYlO1rsa.cjs → Bf70UQlMT3b0NoOZ.cjs} +1 -1
- package/browser/cjs/Bpq9GrV7al7xxJ_d.cjs +6 -0
- package/browser/cjs/BxlQ6aLh5_jUvk9w.cjs +20 -0
- package/browser/cjs/{DefYX_aeMZivbpEt.cjs → CJSNNa8ySxzuEmoy.cjs} +2 -2
- package/browser/cjs/{Ce6JLd3qejgMgM3r.cjs → CUND2W1xMwqPOHwD.cjs} +3 -3
- package/browser/cjs/{7MV1n9Y0yXU0hKpM.cjs → Cg95aBJ4kuUq7jrz.cjs} +1 -1
- package/browser/cjs/Dcoq8P2O8-40waHl.cjs +6 -0
- package/browser/cjs/{B8-dSgXI2XZKFvtp.cjs → DeoOsY5TkIAydt9W.cjs} +2 -2
- package/browser/cjs/index.cjs +3 -3
- package/browser/cjs/{BdNRaXTgqRzPmg0L.cjs → j0lD5RrJ86CRlUNT.cjs} +2 -2
- package/browser/esm/{BnVbG5kg41edf8oz.mjs → 7tCRjNmDM5kf3BFa.mjs} +2 -2
- package/browser/esm/{Dg_NRblGOcetqhnC.mjs → BWxmPJd4f8qZMxaa.mjs} +4 -4
- package/browser/esm/{YfJJd16cfjuXpb8G.mjs → BbHGWXif6ytyfyHI.mjs} +1 -1
- package/browser/esm/{yQgfM4ehXrfnEoUK.mjs → BkhHyCmy1MwVFS1b.mjs} +2 -2
- package/browser/esm/{DVSjscO7zuDsOD4v.mjs → Bo3cXzeDcP_Q9YvX.mjs} +2 -2
- package/browser/esm/CRDu7VFAa8NGcoHj.mjs +49 -0
- package/browser/esm/{nwvZlIH9rheqctQz.mjs → Cd02kMBZDsozIA98.mjs} +12 -12
- package/browser/esm/CzdBzjYgP1i3pkPL.mjs +4455 -0
- package/browser/esm/DFppS_p4spncePDm.mjs +156 -0
- package/browser/esm/{miaBr4cu9WKLs8Is.mjs → db-2uDA7mYS4QpHj.mjs} +1 -1
- package/browser/esm/index.mjs +38 -37
- package/browser/esm/{CKLhWrNo1E4r3pG7.mjs → nzc1811Pk5-sKDu5.mjs} +7 -7
- package/licenses/dependencies.txt +75 -108
- package/node/assets/style.css +1 -1
- package/node/esm/BVKo3uc0IreLNkkN.mjs +157 -0
- package/node/esm/{Dln5o1FP_HWPs0Uf.mjs → BfnEq4EhLf8jJ0Gp.mjs} +1 -1
- package/node/esm/{CxbA2L1Ap9NSJcxm.mjs → BgR1PWucIb0Zucr4.mjs} +1 -1
- package/node/esm/{B9TRK2jd_Ki2RifT.mjs → BimlBylqyslj9fNg.mjs} +1 -1
- package/node/esm/{BTp8XtWh47Y1g1MM.mjs → BnGsbrQwjcaUFAdt.mjs} +13 -13
- package/node/esm/{CNCYE_ff8SnJJMPN.mjs → CQhaL28vV1X6Xt2N.mjs} +4 -4
- package/node/esm/{qpKmKMfv4DDofXKf.mjs → DB2ryaj4_Y8Lgyy_.mjs} +1 -1
- package/node/esm/{COoX8Ir66wNuWJ_m.mjs → X3qO0PKREgY9FMZU.mjs} +8 -8
- package/node/esm/index.mjs +1308 -1262
- package/node/esm/{CN79Z_qqLiF3V5r0.mjs → rOozeXREjiU8jjPd.mjs} +14 -14
- package/package.json +15 -16
- package/types/index.d.ts +17 -7
- package/browser/cjs/1-LY_VyMGQ9MfeNB.cjs +0 -20
- package/browser/cjs/BEmcHbiMOFhIa91S.cjs +0 -6
- package/browser/cjs/D7AH724IJJvos02e.cjs +0 -7
- package/browser/cjs/KOj1qev47_vzzRFV.cjs +0 -6
- package/browser/cjs/St8H4B5iT2fsqOb7.cjs +0 -6
- package/browser/cjs/TS1uQTjkemJ22p1Y.cjs +0 -6
- package/browser/esm/BNxVvFkY3b2mERJf.mjs +0 -64
- package/browser/esm/CJsYe8TqU6tqj4UH.mjs +0 -154
- package/browser/esm/DdLujAMc-Cefddif.mjs +0 -49
- package/browser/esm/beUKtp_qQMnuYcVk.mjs +0 -4452
- package/node/esm/BcB8nCbI5HW5jv5q.mjs +0 -65
- package/node/esm/C5WzmLTAphEQU3CU.mjs +0 -155
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.7
|
|
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 { useCallbackRef as v, KeyCodes as R, DynamicIcon as k, KeyModifiers as T } from "@sheetxl/utils-react";
|
|
14
|
+
import { InternalWindow as w, ExhibitOptionButton as F, ExhibitDivider as E } from "@sheetxl/utils-mui";
|
|
15
|
+
const K = { width: "1.5rem", height: "1.5rem" }, S = n((n2) => {
|
|
16
|
+
const { label: i2, value: r2, options: a2, onSelect: d2, tabIndex: u2 = 0, ...f2 } = n2, [m2, g2] = o(() => M(r2, a2));
|
|
17
|
+
l(() => {
|
|
18
|
+
g2(M(r2, a2));
|
|
19
|
+
}, [r2, a2]);
|
|
20
|
+
const C2 = v((e2) => {
|
|
21
|
+
g2(e2.target.value), d2?.(a2[e2.target.value]);
|
|
22
|
+
}, [d2, a2]), b2 = s(() => Object.keys(a2).map((t2) => e(x, { value: t2, children: t2 }, t2)), [a2]);
|
|
23
|
+
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 })] });
|
|
24
|
+
}), I = { Workbook: "workbook", Sheet: "sheet" }, D = { enter: 140, exit: 140 }, A = { Formulas: C.Content.Formulas, Values: C.Content.Values, Notes: C.Content.Notes, Comments: C.Content.Comments }, B = { ...A };
|
|
25
|
+
delete B.Values;
|
|
26
|
+
const $ = { "By Rows": true, "By Columns": false }, M = (e2, t2) => {
|
|
27
|
+
const n2 = Object.keys(t2);
|
|
28
|
+
for (let i2 = 0; i2 < n2.length; i2++) {
|
|
29
|
+
const o2 = n2[i2];
|
|
30
|
+
if (t2[o2] === e2) return o2;
|
|
31
|
+
}
|
|
32
|
+
}, P = n((n2) => {
|
|
33
|
+
const { replace: s2 = false, findText: x2, replaceText: h2, findOptions: O2, replaceOptions: y2, title: M2, onHide: P2, onFindOrReplace: W, ...z } = n2, L = i(null), V = i(null), N = i(null), j = i(null), H = i(null), U = i(null), G = (e2, t2) => {
|
|
34
|
+
if (!t2) return;
|
|
35
|
+
t2.start(e2, { center: false }), setTimeout(() => t2.stop(e2), 180);
|
|
36
|
+
}, [q, J] = o(false), [Q, X] = o(false), [Y, Z] = o(s2), [_, ee] = o(false), [te, ne] = o(false), [ie, oe] = o({ replaceText: null, replace: s2, replaceOptions: {}, findOptions: { text: null, matchCase: false, matchEntireCell: false, useRegex: false, orientation: b.Orientation.Row, fields: [C.Content.Formulas] }, scope: I.Sheet }), le = v(async (e2, t2, n3, i2) => {
|
|
37
|
+
if (!W) return;
|
|
38
|
+
const o2 = { ...ie };
|
|
39
|
+
o2.replaceOptions = { ...o2.replaceOptions }, o2.findOptions = { ...o2.findOptions }, o2.replaceOptions.maxCount = n3 ? void 0 : 1, o2.replace = t2, t2 && ie.findOptions.fields?.[0] === C.Content.Values && (o2.findOptions.fields = [C.Content.Formulas]), o2.findOptions.reverse = !e2;
|
|
40
|
+
const l2 = await W({ autoFocus: i2, ...o2 });
|
|
41
|
+
ee(0 === l2);
|
|
42
|
+
}, [ie, W]);
|
|
43
|
+
l(() => {
|
|
44
|
+
ee(false);
|
|
45
|
+
}, [ie, Q, Y]);
|
|
46
|
+
const re = v((e2, t2) => {
|
|
47
|
+
if (e2.keyCode === R.Enter) {
|
|
48
|
+
if (!ie.findOptions.text) return;
|
|
49
|
+
let n3 = true, i2 = false;
|
|
50
|
+
e2.shiftKey && (n3 = false), t2 ? (e2.ctrlKey && e2.altKey && (i2 = true), G(e2, i2 ? U.current : H.current)) : G(e2, n3 ? j.current : N.current), le(n3, t2, i2, false);
|
|
51
|
+
}
|
|
52
|
+
}, [ie]), se = i(null);
|
|
53
|
+
r(() => {
|
|
54
|
+
oe((e2) => {
|
|
55
|
+
const t2 = { ...e2 };
|
|
56
|
+
t2.findOptions.text = x2 && x2.length > 0 ? x2 : e2.findOptions.text ?? "", J(true), void 0 !== h2 && (t2.replaceText = h2), O2 && (t2.findOptions = { ...t2.findOptions, ...O2 }), t2.replaceText || (t2.replaceText = ""), t2.replaceOptions && (t2.replaceOptions = { ...t2.replaceOptions }), y2 && (t2.replaceOptions = { ...t2.replaceOptions, ...y2 }), ie.findOptions.fields?.[0] || (ie.findOptions.fields = [C.Content.Formulas]);
|
|
57
|
+
const n3 = !(!y2 && void 0 === h2);
|
|
58
|
+
return n3 && Z(n3), t2;
|
|
59
|
+
}), te || se.current?.focus();
|
|
60
|
+
}, [x2, h2, O2, y2]), l(() => {
|
|
61
|
+
Y ? (ie.findOptions.fields[0], C.Content.Values) : J(true);
|
|
62
|
+
}, [Y]), l(() => {
|
|
63
|
+
if (q && L.current && ie.findOptions.text === L.current.value) return L.current === document.activeElement || L.current.contains(document.activeElement) ? (L.current?.select(), void J(false)) : void L.current.addEventListener("focus", () => {
|
|
64
|
+
L.current?.select(), J(false);
|
|
65
|
+
}, { once: true });
|
|
66
|
+
}, [q, ie]);
|
|
67
|
+
const [ae, { width: ce }] = a();
|
|
68
|
+
return e(w, { ref: se, title: M2 ?? (Y ? "Find & Replace" : "Find"), initialPosition: { y: "35" }, autoFocusSel: ".input", onHide: P2, onFocus: () => ne(true), onBlur: () => {
|
|
69
|
+
ne(false), ee(false);
|
|
70
|
+
}, slotProps: { paper: { elevation: te ? 3 : 1 } }, ...z, children: t(d, { dividers: true, ref: ae, sx: { display: "flex", flexDirection: "column", paddingLeft: (e2) => e2.spacing(1.5), paddingRight: (e2) => e2.spacing(1.5) }, onKeyDown: (e2) => {
|
|
71
|
+
if ("h" === e2.key && e2.ctrlKey) Z(true), L.current?.contains(document.activeElement) && V.current?.focus();
|
|
72
|
+
else if ("f" === e2.key && e2.ctrlKey) L.current?.focus();
|
|
73
|
+
else if ("c" === e2.key && e2.altKey) oe((e3) => {
|
|
74
|
+
const t2 = { ...e3 };
|
|
75
|
+
return t2.findOptions.matchCase = !e3.findOptions.matchCase, t2;
|
|
76
|
+
});
|
|
77
|
+
else if ("e" === e2.key && e2.altKey) oe((e3) => {
|
|
78
|
+
const t2 = { ...e3 };
|
|
79
|
+
return t2.findOptions.matchEntireCell = !e3.findOptions.matchEntireCell, t2;
|
|
80
|
+
});
|
|
81
|
+
else {
|
|
82
|
+
if ("r" !== e2.key || !e2.altKey) return;
|
|
83
|
+
oe((e3) => {
|
|
84
|
+
const t2 = { ...e3 };
|
|
85
|
+
return t2.findOptions.useRegex = !e3.findOptions.useRegex, t2;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
e2.preventDefault();
|
|
89
|
+
}, 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(F, { selected: Q, onSelectToggle: (e2) => {
|
|
90
|
+
X(e2);
|
|
91
|
+
}, preventFocus: true, label: "Toggle Additional Options", icon: e(k, { iconKey: "FindOptions" }) }), e(F, { selected: Y, onSelectToggle: (e2) => {
|
|
92
|
+
Z(e2);
|
|
93
|
+
}, preventFocus: true, label: "Toggle Replace", icon: e(k, { iconKey: "FindReplaceToggle" }), shortcut: { key: Y ? "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: ce > 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(F, { style: K, selected: ie.findOptions.matchCase, onBlur: () => {
|
|
94
|
+
console.log("blur");
|
|
95
|
+
}, onSelectToggle: (e2) => {
|
|
96
|
+
oe((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(F, { style: K, selected: ie.findOptions.matchEntireCell, onSelectToggle: (e2) => {
|
|
101
|
+
oe((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(F, { style: K, selected: ie.findOptions.useRegex, onSelectToggle: (e2) => {
|
|
106
|
+
oe((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: L, 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) => _ ? `${e2.palette.error.main} !important` : void 0 }, "& .MuiInputLabel-outlined": { color: (e2) => _ ? `${e2.palette.error.main} !important` : void 0 } }, value: ie.findOptions.text ?? "", onChange: (e2) => {
|
|
111
|
+
oe((t2) => {
|
|
112
|
+
const n3 = { ...t2 };
|
|
113
|
+
return n3.findOptions.text = e2.target.value, n3;
|
|
114
|
+
});
|
|
115
|
+
}, onKeyDown: (e2) => re(e2, false), onContextMenu: (e2) => {
|
|
116
|
+
e2.stopPropagation();
|
|
117
|
+
} }), e(F, { selected: ie.findOptions.reverse, onSelectToggle: (e2) => {
|
|
118
|
+
le(false, false);
|
|
119
|
+
}, touchRippleRef: N, label: "", shortcut: { key: "Enter", modifiers: [T.Shift] }, icon: e(k, { iconKey: ie.findOptions.orientation !== b.Orientation.Column ? "ArrowBack" : "ArrowUpward" }), disabled: !ie.findOptions.text }), e(F, { selected: !ie.findOptions.reverse, onSelectToggle: (e2) => {
|
|
120
|
+
le(true, false);
|
|
121
|
+
}, touchRippleRef: j, label: "Next Match", shortcut: { key: "Enter" }, icon: e(k, { iconKey: ie.findOptions.orientation !== b.Orientation.Column ? "ArrowForward" : "ArrowDownward" }), disabled: !ie.findOptions.text })] }), e(g, { in: Y, timeout: D, onExit: () => {
|
|
122
|
+
L.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: V, 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: ie.replaceText ?? "", onChange: (e2) => {
|
|
124
|
+
oe((t2) => {
|
|
125
|
+
const n3 = { ...t2 };
|
|
126
|
+
return n3.replaceText = e2.target.value, n3;
|
|
127
|
+
});
|
|
128
|
+
}, onKeyDown: (e2) => re(e2, true), onContextMenu: (e2) => {
|
|
129
|
+
e2.stopPropagation();
|
|
130
|
+
} }), e(F, { onSelectToggle: (e2) => {
|
|
131
|
+
le(true, true);
|
|
132
|
+
}, touchRippleRef: H, label: "Replace", shortcut: { key: "Enter" }, icon: e(k, { iconKey: "FindReplace" }), disabled: !ie.findOptions.text }), e(F, { onSelectToggle: (e2) => {
|
|
133
|
+
le(true, true, true);
|
|
134
|
+
}, touchRippleRef: U, label: "Replace All", shortcut: { key: "Enter", modifiers: [T.Ctrl, T.Alt] }, icon: e(k, { iconKey: "FindReplaceAll" }), disabled: !ie.findOptions.text })] }) })] })] }), e(g, { in: Q, timeout: D, onExit: () => {
|
|
135
|
+
L.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: ce >= 383 ? "row" : "column", justifyContent: "space-evenly", alignItems: "center", gap: (e2) => e2.spacing(1), rowGap: (e2) => e2.spacing(2) }, tabIndex: -1, children: [e(S, { label: "Within", value: ie.scope, options: I, onSelect: (e2) => {
|
|
137
|
+
oe((t2) => {
|
|
138
|
+
const n3 = { ...t2 };
|
|
139
|
+
return n3.scope = e2, n3;
|
|
140
|
+
});
|
|
141
|
+
} }), e(S, { label: "Search", value: ie.findOptions.orientation !== b.Orientation.Column, options: $, onSelect: (e2) => {
|
|
142
|
+
oe((t2) => {
|
|
143
|
+
const n3 = { ...t2 };
|
|
144
|
+
return n3.findOptions.orientation = e2 ? b.Orientation.Row : b.Orientation.Column, n3;
|
|
145
|
+
});
|
|
146
|
+
} }), e(S, { label: "Look in", value: Y && ie.findOptions.fields?.[0] === C.Content.Values ? C.Content.Formulas : ie.findOptions.fields?.[0], options: Y ? B : A, onSelect: (e2) => {
|
|
147
|
+
oe((t2) => {
|
|
148
|
+
const n3 = { ...t2 };
|
|
149
|
+
return n3.findOptions.fields = [e2], n3;
|
|
150
|
+
});
|
|
151
|
+
} })] })] }) })] }) });
|
|
152
|
+
});
|
|
153
|
+
export {
|
|
154
|
+
P as FindReplaceWindow,
|
|
155
|
+
I as ScopeOptions,
|
|
156
|
+
P as default
|
|
157
|
+
};
|
|
@@ -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.7
|
|
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.7
|
|
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.7
|
|
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.7
|
|
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,36 +11,36 @@ import { Box as r, FormControl as p, TextField as c } from "@mui/material";
|
|
|
11
11
|
import { useCallbackRef as d } 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 { initialHyperlink: m2 = null, initialDisplay: f = null, onUpdateHyperlink: x, context: h, onOption: y, onValidateOption: T, onDone: k, options: C = g, defaultOption: O = C?.[0], cancelOption:
|
|
14
|
+
const { initialHyperlink: m2 = null, initialDisplay: f = null, onUpdateHyperlink: x, context: h, onOption: y, onValidateOption: T, onDone: k, options: C = g, defaultOption: O = C?.[0], cancelOption: b = "Cancel", sx: D, ...F } = n2, v = o(() => null !== (m2 ?? h?.()?.getHyperlink()), []), w = o(() => {
|
|
15
15
|
let t2 = null, e2 = null;
|
|
16
16
|
m2 && ("string" == typeof m2 ? e2 = m2 : t2 = m2);
|
|
17
17
|
const n3 = t2 ?? h?.()?.getHyperlink();
|
|
18
18
|
return { address: e2 ?? n3?.getAddress() ?? "", textToDisplay: n3?.getDisplayText() ?? "" };
|
|
19
|
-
}, [m2, h]), [
|
|
19
|
+
}, [m2, h]), [H, I] = a(w.address), [P, M] = a(() => {
|
|
20
20
|
const t2 = h?.().toTextUnformatted() ?? f;
|
|
21
|
-
return t2 ===
|
|
21
|
+
return t2 === w.address ? "" : t2;
|
|
22
22
|
}), [$, B] = a(false), L = i((t2) => {
|
|
23
23
|
M(t2.target.value);
|
|
24
24
|
}, []), W = i(async (t2, e2) => null, []), z = d(async (t2) => {
|
|
25
|
-
const e2 = "" ===
|
|
26
|
-
t2 !==
|
|
27
|
-
}, [
|
|
28
|
-
|
|
25
|
+
const e2 = "" === H ? null : { address: H };
|
|
26
|
+
t2 !== b && x?.(e2, P), y?.(t2, t2 === b, t2 === O), k?.();
|
|
27
|
+
}, [H, P, x, k, y, O, b]), A = d((t2) => {
|
|
28
|
+
I(t2.target.value), W(t2.target.value, null);
|
|
29
29
|
}, [T]), E = d(async (t2) => {
|
|
30
30
|
let e2 = await Promise.resolve(T?.(t2));
|
|
31
31
|
try {
|
|
32
|
-
false !== e2 && (e2 = await W(
|
|
32
|
+
false !== e2 && (e2 = await W(H, t2));
|
|
33
33
|
} catch (t3) {
|
|
34
34
|
}
|
|
35
35
|
return e2 ?? true;
|
|
36
36
|
}, [T]);
|
|
37
|
-
return t(u, { title: (
|
|
37
|
+
return t(u, { title: (v ? "Edit" : "Insert") + " Link", options: C, onDone: k, onOption: (t2) => z(t2), onValidateOption: E, defaultOption: O, cancelOption: b, autoFocusSel: ".autoFocus", sx: { width: "480px", ...D }, ...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(c, { label: "Address", placeholder: "Enter a url or cell reference.", onFocus: (t2) => {
|
|
38
38
|
$ || t2.target?.select(), B(true);
|
|
39
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } },
|
|
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: H, onChange: A, onContextMenu: (t2) => {
|
|
40
40
|
t2.stopPropagation();
|
|
41
|
-
} }) }), t(p, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(c, { label: "Display Text", placeholder:
|
|
41
|
+
} }) }), t(p, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(c, { label: "Display Text", placeholder: H?.startsWith("#") ? H.substring(1) : H, onFocus: () => {
|
|
42
42
|
B(true);
|
|
43
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } },
|
|
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: L, 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.7
|
|
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.
|
|
@@ -68,7 +68,7 @@ function _(s2) {
|
|
|
68
68
|
I2(t2);
|
|
69
69
|
}, 90)();
|
|
70
70
|
}, [v2, w2]);
|
|
71
|
-
return e(i, { style: { height: 440, width: "100%", display: "flex", flexDirection: "column" }, ...m2, children: [e(i, { sx: { display: "flex", alignItems: "center", justifyContent: "end", marginBottom: (e2) => e2.spacing(2), color: (e2) => e2.palette.text.secondary }, children: [t(n, {
|
|
71
|
+
return e(i, { style: { height: 440, width: "100%", display: "flex", flexDirection: "column" }, ...m2, children: [e(i, { sx: { display: "flex", alignItems: "center", justifyContent: "end", marginBottom: (e2) => e2.spacing(2), color: (e2) => e2.palette.text.secondary }, children: [t(n, { slotProps: { input: { sx: { backgroundImage: `linear-gradient(${y("#fff", C(5))}, ${y("#fff", C(5))})` }, endAdornment: t(o, { sx: { opacity: w2.length > 0 ? 1 : 0, display: w2.length > 0 ? "flex" : "none" }, position: "end", children: t(r, { "aria-label": "clear search", onClick: () => R2(""), edge: "end", children: t(p, { iconKey: "Close" }) }) }) }, htmlInput: { className: "input", autoFocus: true, spellCheck: false, placeholder: "Type to search key bindings", autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(1) } } }, sx: { flex: "1 1 40%", marginRight: (e2) => e2.spacing(1), "& .MuiOutlinedInput-notchedOutline": { borderColor: (e2) => z2 ? `${e2.palette.error.main} !important` : void 0 }, "& .MuiInputLabel-outlined": { color: (e2) => z2 ? `${e2.palette.error.main} !important` : void 0 } }, value: w2, onChange: (e2) => {
|
|
72
72
|
R2(e2.target.value);
|
|
73
73
|
}, onKeyDown: (e2) => {
|
|
74
74
|
e2.which === h.Escape && w2.length > 0 && (R2(""), e2.stopPropagation(), e2.preventDefault());
|
|
@@ -76,12 +76,12 @@ function _(s2) {
|
|
|
76
76
|
e2.stopPropagation();
|
|
77
77
|
} }), t(l, { sx: { flex: "1 1 60%" }, control: t(a, { checked: u2, onChange: () => g2(!u2) }), label: "Show commands without key bindings", labelPlacement: "start" })] }), t(i, { sx: { flex: "1 1 100%", borderRadius: (e2) => `${e2.shape.borderRadius}px`, border: (e2) => `solid ${e2.palette.divider} 1px`, paddingRight: "1px", overflow: "hidden", "* .MuiTableCell-head": { background: (e2) => e2.palette.background.paper, backgroundImage: `linear-gradient(${y("#fff", C(5))}, ${y("#fff", C(5))})` } }, children: t(T, { rowCount: K2.length, rowGetter: (e2) => K2[e2.index], columns: [{ width: 180, label: "Command", dataKey: "label" }, { width: 260, label: "Key Binding", dataKey: "shortcut" }, { width: 240, label: "Description", dataKey: "description", widthLess: 440 }] }) }), t(i, { sx: { display: "flex", flexShrink: "0", paddingLeft: (e2) => e2.spacing(1), paddingTop: (e2) => e2.spacing(1), paddingRight: (e2) => e2.spacing(1), userSelect: "none", justifyContent: "flex-end" }, children: t(d, { noWrap: true, component: "div", sx: { color: (e2) => z2 ? e2.palette.error.main : e2.palette.text.secondary }, children: `${0 === K2.length ? "No" : K2.length} shortcut key${1 === K2.length ? "" : "s"}${w2.length > 0 ? " found" : ""}` }) })] });
|
|
78
78
|
}
|
|
79
|
-
const
|
|
79
|
+
const V = (e2) => {
|
|
80
80
|
const { title: i2 = "Shortcut Keys", commands: n2, sx: o2, ...r2 } = e2;
|
|
81
81
|
return t(u, { isModal: true, onKeyDown: (e3) => {
|
|
82
82
|
e3.keyCode === h.F1 && e3.preventDefault();
|
|
83
83
|
}, sx: { width: "780px", ...o2 }, title: i2, autoFocusSel: ".input", ...r2, children: t(c, { dividers: true, children: t(_, { commands: n2, sx: { marginBottom: "8px" } }) }) });
|
|
84
84
|
};
|
|
85
85
|
export {
|
|
86
|
-
|
|
86
|
+
V as default
|
|
87
87
|
};
|
|
@@ -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.7
|
|
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.7
|
|
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,16 +7,16 @@
|
|
|
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 m, Select as u, 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, onInputOption: w, onDone: F, options:
|
|
16
|
-
w?.(V, e2), k?.(e2, e2 === $, e2 ===
|
|
17
|
-
}, [V, w, F, k, $,
|
|
15
|
+
const { initialValue: b2, context: T, onOption: k, onValidateOption: O, onInputOption: 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
|
+
w?.(V, e2), k?.(e2, e2 === $, e2 === P), F?.();
|
|
17
|
+
}, [V, w, F, k, $, P]), M = h(async (e2) => {
|
|
18
18
|
if (e2.keyCode === x.Enter) {
|
|
19
|
-
false !== await B?.(V, null) && L(
|
|
19
|
+
false !== await B?.(V, null) && L(P);
|
|
20
20
|
}
|
|
21
21
|
}, [V, L]), R = h((e2) => {
|
|
22
22
|
N(e2.target.value), B?.(e2.target.value, null);
|
|
@@ -43,9 +43,9 @@ const v = ["Ok", "Cancel"], b = o((o2) => {
|
|
|
43
43
|
const e2 = T();
|
|
44
44
|
return e2.createTemporaryCell({ value: e2.getValue() ?? 12345, style: { numberFormat: V } });
|
|
45
45
|
}, [E, V, T]);
|
|
46
|
-
return e(C, { title: "Number Format", options:
|
|
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(m, { children: "Category" }), e(u, { 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
47
|
j || e2.target?.select(), z(true);
|
|
48
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (e2) => e2.spacing(0.5) } },
|
|
48
|
+
}, 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
49
|
e2.stopPropagation();
|
|
50
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)" })] })] }) });
|
|
51
51
|
});
|