@sheetxl/studio-mui 0.7.4 → 0.7.6
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/README.md +9 -5
- package/browser/cjs/{DwzNkpi_T8XJi3Cd.cjs → -u6vWH9DiYlO1rsa.cjs} +1 -1
- package/browser/cjs/1-LY_VyMGQ9MfeNB.cjs +20 -0
- package/browser/cjs/{B6o1iQp5wuulPhxo.cjs → 7MV1n9Y0yXU0hKpM.cjs} +1 -1
- package/browser/cjs/{BY3gQcuJkcK9yhlk.cjs → B8-dSgXI2XZKFvtp.cjs} +2 -2
- package/browser/cjs/BEmcHbiMOFhIa91S.cjs +6 -0
- package/browser/cjs/{CflDY3SthBCQg-9F.cjs → BdNRaXTgqRzPmg0L.cjs} +2 -2
- package/browser/cjs/{D5l5wPl8rDYzrVey.cjs → Ce6JLd3qejgMgM3r.cjs} +7 -7
- package/browser/cjs/{qd_yuub025U26HmN.cjs → D7AH724IJJvos02e.cjs} +1 -1
- package/browser/cjs/{yETr27p_AmaFufvo.cjs → DefYX_aeMZivbpEt.cjs} +2 -2
- package/browser/cjs/{HfdfBnRHde6LrsMc.cjs → KOj1qev47_vzzRFV.cjs} +1 -1
- package/browser/cjs/{BY1UZBLCxYes25sM.cjs → St8H4B5iT2fsqOb7.cjs} +1 -1
- package/browser/cjs/TS1uQTjkemJ22p1Y.cjs +6 -0
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/BNxVvFkY3b2mERJf.mjs +64 -0
- package/browser/esm/{BqypjhYAei9BoIkg.mjs → BnVbG5kg41edf8oz.mjs} +2 -2
- package/browser/esm/{DUTXM-jsPX1poBAb.mjs → CJsYe8TqU6tqj4UH.mjs} +55 -56
- package/browser/esm/{CwE4P36bJkqx4fG2.mjs → CKLhWrNo1E4r3pG7.mjs} +1 -1
- package/browser/esm/{DpeZ0TCk2XtCsW7D.mjs → DVSjscO7zuDsOD4v.mjs} +2 -2
- package/browser/esm/{CX5p76lvGB80Gn7j.mjs → DdLujAMc-Cefddif.mjs} +1 -1
- package/browser/esm/{BMrxZUxFZxs_TprK.mjs → Dg_NRblGOcetqhnC.mjs} +17 -18
- package/browser/esm/{C43cFXvNQttM0tuv.mjs → YfJJd16cfjuXpb8G.mjs} +1 -1
- package/browser/esm/beUKtp_qQMnuYcVk.mjs +4452 -0
- package/browser/esm/index.mjs +68 -71
- package/browser/esm/{C-TjWH0Ll_dg6TXG.mjs → miaBr4cu9WKLs8Is.mjs} +1 -1
- package/browser/esm/{UKbQrJIwqIMUQ4dz.mjs → nwvZlIH9rheqctQz.mjs} +1 -1
- package/browser/esm/{DDCO6hne0WaKAsyz.mjs → yQgfM4ehXrfnEoUK.mjs} +2 -2
- package/node/esm/{DmbC0_ocWCB60DUY.mjs → B9TRK2jd_Ki2RifT.mjs} +1 -1
- package/node/esm/{g5IsTuP_M7p1bN41.mjs → BTp8XtWh47Y1g1MM.mjs} +1 -1
- package/node/esm/BcB8nCbI5HW5jv5q.mjs +65 -0
- package/node/esm/C5WzmLTAphEQU3CU.mjs +155 -0
- package/node/esm/{C0x0sq_I7hdqCuBB.mjs → CN79Z_qqLiF3V5r0.mjs} +1 -1
- package/node/esm/{x7VDppl2hKDhIcfj.mjs → CNCYE_ff8SnJJMPN.mjs} +41 -42
- package/node/esm/{nZVauB5xkNLVTaod.mjs → COoX8Ir66wNuWJ_m.mjs} +1 -1
- package/node/esm/{VjNnErE5lO5hNix_.mjs → CxbA2L1Ap9NSJcxm.mjs} +1 -1
- package/node/esm/{CdEdm8ItFMvEzr0O.mjs → Dln5o1FP_HWPs0Uf.mjs} +1 -1
- package/node/esm/index.mjs +1405 -1452
- package/node/esm/{DhjwHPKOhF-WGawL.mjs → qpKmKMfv4DDofXKf.mjs} +1 -1
- package/package.json +21 -10
- package/types/index.d.ts +14 -92
- package/browser/cjs/BCNKSDS1DahImiBd.cjs +0 -20
- package/browser/cjs/BrJIDDxcCb7loSqZ.cjs +0 -6
- package/browser/cjs/hRcxITGib5rp_kTW.cjs +0 -6
- package/browser/esm/BXa5jJK06vkHLfz_.mjs +0 -64
- package/browser/esm/zTa4aYOOiAsmWpM1.mjs +0 -4489
- package/node/esm/DUoSsHJRuVxAeHW-.mjs +0 -156
- package/node/esm/DuFKPKejduTq6L6F.mjs +0 -65
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.4
|
|
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 C } from "@mui/material";
|
|
12
|
-
import { ArrowBack as y, ArrowUpward as b, ArrowForward as T, ArrowDownward as v } from "@mui/icons-material";
|
|
13
|
-
import { ICell as k, IRange as R } from "@sheetxl/sdk";
|
|
14
|
-
import { useCallbackRef as E, KeyCodes as S, KeyModifiers as F } from "@sheetxl/utils-react";
|
|
15
|
-
import { InternalWindow as I, ExhibitOptionButton as w, themeIcon as D, FindOptionsIcon as P, FindReplaceToggleIcon as K, FindCaseSensitiveIcon as $, FindWholeWordIcon as A, FindRegExIcon as M, FindReplaceIcon as B, FindReplaceAllIcon as L, ExhibitDivider as V } from "@sheetxl/utils-mui";
|
|
16
|
-
const N = n((n2) => {
|
|
17
|
-
const { label: i2, value: r2, options: a2, onSelect: d2, tabIndex: u2 = 0, ...f2 } = n2, [m2, g2] = o(() => U(r2, a2));
|
|
18
|
-
l(() => {
|
|
19
|
-
g2(U(r2, a2));
|
|
20
|
-
}, [r2, a2]);
|
|
21
|
-
const y2 = E((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(C, { inputProps: { tabIndex: u2 }, value: m2, label: i2, onChange: y2, sx: { backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` }, ...f2, children: b2 })] });
|
|
25
|
-
}), W = { Workbook: "workbook", Sheet: "sheet" }, j = { enter: 140, exit: 140 }, H = { Formulas: k.Content.Formulas, Values: k.Content.Values, Notes: k.Content.Notes, Comments: k.Content.Comments }, z = { ...H };
|
|
26
|
-
delete z.Values;
|
|
27
|
-
const G = { "By Rows": true, "By Columns": false }, U = (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
|
-
}, X = n((n2) => {
|
|
34
|
-
const { replace: s2 = false, findText: x2, replaceText: h2, findOptions: O2, replaceOptions: C2, title: U2, onHide: X2, onFindOrReplace: q, ...J } = n2, Q = i(null), Y = i(null), Z = i(null), _ = i(null), ee = i(null), te = i(null), ne = (e2, t2) => {
|
|
35
|
-
if (!t2) return;
|
|
36
|
-
t2.start(e2, { center: false }), setTimeout(() => t2.stop(e2), 180);
|
|
37
|
-
}, [ie, oe] = o(false), [le, re] = o(false), [se, ae] = o(s2), [ce, pe] = o(false), [de, ue] = o(false), [fe, me] = o({ findText: null, replaceText: null, replace: s2, replaceOptions: {}, findOptions: { matchCase: false, matchEntireCell: false, useRegex: false, orientation: R.Orientation.Row, fields: [k.Content.Formulas] }, scope: W.Sheet }), ge = E(async (e2, t2, n3, i2) => {
|
|
38
|
-
if (!q) return;
|
|
39
|
-
const o2 = { ...fe };
|
|
40
|
-
o2.replaceOptions = { ...o2.replaceOptions }, o2.findOptions = { ...o2.findOptions }, o2.replaceOptions.maxCount = n3 ? void 0 : 1, o2.replace = t2, t2 && fe.findOptions.fields?.[0] === k.Content.Values && (o2.findOptions.fields = [k.Content.Formulas]), o2.findOptions.reverse = !e2;
|
|
41
|
-
const l2 = await q({ autoFocus: i2, ...o2 });
|
|
42
|
-
pe(0 === l2);
|
|
43
|
-
}, [fe, q]);
|
|
44
|
-
l(() => {
|
|
45
|
-
pe(false);
|
|
46
|
-
}, [fe, le, se]);
|
|
47
|
-
const xe = E((e2, t2) => {
|
|
48
|
-
if (e2.keyCode === S.Enter) {
|
|
49
|
-
if (!fe.findText) return;
|
|
50
|
-
let n3 = true, i2 = false;
|
|
51
|
-
e2.shiftKey && (n3 = false), t2 ? (e2.ctrlKey && e2.altKey && (i2 = true), ne(e2, i2 ? te.current : ee.current)) : ne(e2, n3 ? _.current : Z.current), ge(n3, t2, i2, false);
|
|
52
|
-
}
|
|
53
|
-
}, [fe]), he = i(null);
|
|
54
|
-
r(() => {
|
|
55
|
-
me((e2) => {
|
|
56
|
-
const t2 = { ...e2 };
|
|
57
|
-
t2.findText = x2 && x2.length > 0 ? x2 : e2.findText ?? "", oe(true), void 0 !== h2 && (t2.replaceText = h2), O2 && (t2.findOptions = { ...t2.findOptions, ...O2 }), t2.replaceText || (t2.replaceText = ""), t2.replaceOptions && (t2.replaceOptions = { ...t2.replaceOptions }), C2 && (t2.replaceOptions = { ...t2.replaceOptions, ...C2 }), fe.findOptions.fields?.[0] || (fe.findOptions.fields = [k.Content.Formulas]);
|
|
58
|
-
const n3 = !(!C2 && void 0 === h2);
|
|
59
|
-
return n3 && ae(n3), t2;
|
|
60
|
-
}), de || he.current?.focus();
|
|
61
|
-
}, [x2, h2, O2, C2]), l(() => {
|
|
62
|
-
se ? (fe.findOptions.fields[0], k.Content.Values) : oe(true);
|
|
63
|
-
}, [se]), l(() => {
|
|
64
|
-
if (ie && Q.current && fe.findText === Q.current.value) return Q.current === document.activeElement || Q.current.contains(document.activeElement) ? (Q.current?.select(), void oe(false)) : void Q.current.addEventListener("focus", () => {
|
|
65
|
-
Q.current?.select(), oe(false);
|
|
66
|
-
}, { once: true });
|
|
67
|
-
}, [ie, fe]);
|
|
68
|
-
const [Oe, { width: Ce }] = a();
|
|
69
|
-
return e(I, { ref: he, title: U2 ?? (se ? "Find & Replace" : "Find"), initialPosition: { y: "35" }, autoFocusSel: ".input", onHide: X2, onFocus: () => ue(true), onBlur: () => {
|
|
70
|
-
ue(false), pe(false);
|
|
71
|
-
}, PaperProps: { elevation: de ? 3 : 1 }, ...J, children: t(d, { dividers: true, ref: Oe, 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) ae(true), Q.current?.contains(document.activeElement) && Y.current?.focus();
|
|
73
|
-
else if ("f" === e2.key && e2.ctrlKey) Q.current?.focus();
|
|
74
|
-
else if ("c" === e2.key && e2.altKey) me((e3) => {
|
|
75
|
-
const t2 = { ...e3 };
|
|
76
|
-
return t2.findOptions.matchCase = !e3.findOptions.matchCase, t2;
|
|
77
|
-
});
|
|
78
|
-
else if ("e" === e2.key && e2.altKey) me((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
|
-
me((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(w, { selected: le, onSelectToggle: (e2) => {
|
|
91
|
-
re(e2);
|
|
92
|
-
}, preventFocus: true, label: "Toggle Additional Options", icon: D(e(P, {})) }), e(w, { selected: se, onSelectToggle: (e2) => {
|
|
93
|
-
ae(e2);
|
|
94
|
-
}, preventFocus: true, label: "Toggle Replace", icon: D(e(K, {})), shortcut: { key: se ? "F" : "H", modifiers: [F.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", InputLabelProps: { shrink: true }, InputProps: { sx: { paddingRight: (e2) => e2.spacing(1), minWidth: Ce > 460 ? "20em" : void 0, backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` }, inputProps: { draggable: false, ref: Q, className: "input", autoFocus: true, spellCheck: false, autoComplete: "off", sx: { paddingTop: (e2) => e2.spacing(1.25), paddingBottom: (e2) => e2.spacing(0.75) } }, endAdornment: e(m, { sx: { transform: "scale(0.75) translateX(16px)" }, position: "end", children: t(u, { sx: { display: "flex", alignItems: "center", flexDirection: "row", gap: "1px" }, children: [e(w, { selected: fe.findOptions.matchCase, onSelectToggle: (e2) => {
|
|
95
|
-
me((t2) => {
|
|
96
|
-
const n3 = { ...t2 };
|
|
97
|
-
return n3.findOptions.matchCase = e2, n3;
|
|
98
|
-
});
|
|
99
|
-
}, label: "Match Case", shortcut: { key: "C", modifiers: [F.Alt] }, icon: D(e($, {})) }), e(w, { selected: fe.findOptions.matchEntireCell, onSelectToggle: (e2) => {
|
|
100
|
-
me((t2) => {
|
|
101
|
-
const n3 = { ...t2 };
|
|
102
|
-
return n3.findOptions.matchEntireCell = e2, n3;
|
|
103
|
-
});
|
|
104
|
-
}, label: "Match Entire Cell", shortcut: { key: "E", modifiers: [F.Alt] }, icon: D(e(A, {})) }), e(w, { selected: fe.findOptions.useRegex, onSelectToggle: (e2) => {
|
|
105
|
-
me((t2) => {
|
|
106
|
-
const n3 = { ...t2 };
|
|
107
|
-
return n3.findOptions.useRegex = e2, n3;
|
|
108
|
-
});
|
|
109
|
-
}, label: "Use Regular Expression", shortcut: { key: "R", modifiers: [F.Alt] }, icon: D(e(M, {})) })] }) }) }, sx: { flex: "1 1 100%", marginRight: (e2) => e2.spacing(1), "& .MuiOutlinedInput-notchedOutline": { borderColor: (e2) => ce ? `${e2.palette.error.main} !important` : void 0 }, "& .MuiInputLabel-outlined": { color: (e2) => ce ? `${e2.palette.error.main} !important` : void 0 } }, value: fe.findText ?? "", onChange: (e2) => {
|
|
110
|
-
me((t2) => {
|
|
111
|
-
const n3 = { ...t2 };
|
|
112
|
-
return n3.findText = e2.target.value, n3;
|
|
113
|
-
});
|
|
114
|
-
}, onKeyDown: (e2) => xe(e2, false), onContextMenu: (e2) => {
|
|
115
|
-
e2.stopPropagation();
|
|
116
|
-
} }), e(w, { selected: fe.findOptions.reverse, onSelectToggle: (e2) => {
|
|
117
|
-
ge(false, false);
|
|
118
|
-
}, touchRippleRef: Z, label: "", shortcut: { key: "Enter", modifiers: [F.Shift] }, icon: D(fe.findOptions.orientation !== R.Orientation.Column ? e(y, {}) : e(b, {})), disabled: !fe.findText }), e(w, { selected: !fe.findOptions.reverse, onSelectToggle: (e2) => {
|
|
119
|
-
ge(true, false);
|
|
120
|
-
}, touchRippleRef: _, label: "Next Match", shortcut: { key: "Enter" }, icon: D(fe.findOptions.orientation !== R.Orientation.Column ? e(T, {}) : e(v, {})), disabled: !fe.findText })] }), e(g, { in: se, timeout: j, onExit: () => {
|
|
121
|
-
Q.current?.focus();
|
|
122
|
-
}, children: t(u, { sx: { display: "flex", flexDirection: "row", alignItems: "center", marginTop: (e2) => e2.spacing(2) }, children: [e(f, { label: "Replace", InputLabelProps: { shrink: true }, InputProps: { sx: { paddingRight: (e2) => e2.spacing(1), backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` }, inputProps: { ref: Y, 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: fe.replaceText ?? "", onChange: (e2) => {
|
|
123
|
-
me((t2) => {
|
|
124
|
-
const n3 = { ...t2 };
|
|
125
|
-
return n3.replaceText = e2.target.value, n3;
|
|
126
|
-
});
|
|
127
|
-
}, onKeyDown: (e2) => xe(e2, true), onContextMenu: (e2) => {
|
|
128
|
-
e2.stopPropagation();
|
|
129
|
-
} }), e(w, { onSelectToggle: (e2) => {
|
|
130
|
-
ge(true, true);
|
|
131
|
-
}, touchRippleRef: ee, label: "Replace", shortcut: { key: "Enter" }, icon: D(e(B, {})), disabled: !fe.findText }), e(w, { onSelectToggle: (e2) => {
|
|
132
|
-
ge(true, true, true);
|
|
133
|
-
}, touchRippleRef: te, label: "Replace All", shortcut: { key: "Enter", modifiers: [F.Ctrl, F.Alt] }, icon: D(e(L, {})), disabled: !fe.findText })] }) })] })] }), e(g, { in: le, timeout: j, onExit: () => {
|
|
134
|
-
Q.current?.focus();
|
|
135
|
-
}, children: t(u, { sx: { minHeight: "10px", flex: "1 1 100%", display: "flex", flexDirection: "column", gap: (e2) => e2.spacing(0.5), marginTop: (e2) => e2.spacing(1) }, children: [e(V, { orientation: "horizontal", sx: { marginBottom: (e2) => e2.spacing(1.5) } }), t(u, { sx: { display: "flex", flexDirection: Ce >= 413 ? "row" : "column", justifyContent: "space-evenly", alignItems: "center", rowGap: (e2) => e2.spacing(2) }, tabIndex: -1, children: [e(N, { label: "Within", value: fe.scope, options: W, onSelect: (e2) => {
|
|
136
|
-
me((t2) => {
|
|
137
|
-
const n3 = { ...t2 };
|
|
138
|
-
return n3.scope = e2, n3;
|
|
139
|
-
});
|
|
140
|
-
} }), e(N, { label: "Search", value: fe.findOptions.orientation !== R.Orientation.Column, options: G, onSelect: (e2) => {
|
|
141
|
-
me((t2) => {
|
|
142
|
-
const n3 = { ...t2 };
|
|
143
|
-
return n3.findOptions.orientation = e2 ? R.Orientation.Row : R.Orientation.Column, n3;
|
|
144
|
-
});
|
|
145
|
-
} }), e(N, { label: "Look in", value: se && fe.findOptions.fields?.[0] === k.Content.Values ? k.Content.Formulas : fe.findOptions.fields?.[0], options: se ? z : H, onSelect: (e2) => {
|
|
146
|
-
me((t2) => {
|
|
147
|
-
const n3 = { ...t2 };
|
|
148
|
-
return n3.findOptions.fields = [e2], n3;
|
|
149
|
-
});
|
|
150
|
-
} })] })] }) })] }) });
|
|
151
|
-
});
|
|
152
|
-
export {
|
|
153
|
-
X as FindReplaceWindow,
|
|
154
|
-
W as ScopeOptions,
|
|
155
|
-
X as default
|
|
156
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.4
|
|
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 { useCommand as d, useCallbackRef as m, useNotifier 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, command: D, commands: H, ...B } = o2, [I, P] = n(false), [j, z] = n(false), L = i(null), [O, E] = a((e2) => e2 + 1, 0), [A, { width: M }] = r();
|
|
17
|
-
d(D);
|
|
18
|
-
const V = F ?? D.context(), W = V.table(), [k, q] = n(() => W ? V.getNames().getRanges(W.getRange()) : null), G = l(() => W?.getName() ?? "", [W]);
|
|
19
|
-
b(V.table(), { onAnchorCoordsChange(e2) {
|
|
20
|
-
q(V.getNames().getRanges(e2.getRange()));
|
|
21
|
-
}, onProtectedChange(e2) {
|
|
22
|
-
E();
|
|
23
|
-
} });
|
|
24
|
-
const J = m((e2) => {
|
|
25
|
-
V?.table().setName(e2);
|
|
26
|
-
}, [V]), K = m((e2) => {
|
|
27
|
-
V?.table().resize(e2.at(0));
|
|
28
|
-
}, [V]);
|
|
29
|
-
let Q = null;
|
|
30
|
-
V.table() || (Q = 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" }) }));
|
|
31
|
-
const U = g();
|
|
32
|
-
return e(h, { ref: L, title: v2 ?? "Table Details", initialPosition: { y: "35" }, autoFocusSel: T, onHide: R, onFocus: () => P(true), onBlur: (e2) => {
|
|
33
|
-
L?.current?.contains(e2.relatedTarget) || P(false);
|
|
34
|
-
}, PaperProps: { elevation: I ? 3 : 1 }, ...B, children: t(s, { dividers: true, ref: A, 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: V.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: G, value: W?.getName() ?? "No table", onChangeInput: J, onValidate: (e2) => {
|
|
35
|
-
W && W.getName().toLowerCase() === e2.toLowerCase() || V?.getNames().validateName(e2);
|
|
36
|
-
}, disabled: W?.isProtected() ?? true, onFocus: (e2) => {
|
|
37
|
-
j || e2.target?.select(), z(true);
|
|
38
|
-
} }), e(S, { formName: "range", value: k, onChangeInput: K, resolvedAddress: V.getNames().getRanges.bind(V.getNames()), disabled: W?.isProtected() ?? true, onFocus: (e2) => {
|
|
39
|
-
j || e2.target?.select(), z(true);
|
|
40
|
-
} })] }) }) }), 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: W?.isProtected(), styleOptions: W?.getStyleOptions() ?? null, onStyleOptionsChange: (e2) => {
|
|
41
|
-
W.updateStyleOptions(e2);
|
|
42
|
-
}, showHeaderRow: W?.getShowHeaders(), onShowHeaderRowChange: (e2) => {
|
|
43
|
-
try {
|
|
44
|
-
W.setShowHeaders(e2);
|
|
45
|
-
} catch (e3) {
|
|
46
|
-
U.showError(e3);
|
|
47
|
-
}
|
|
48
|
-
}, showTotalRow: W?.getShowTotals(), onShowTotalRowChange: (e2) => {
|
|
49
|
-
try {
|
|
50
|
-
W.setShowTotals(e2);
|
|
51
|
-
} catch (e3) {
|
|
52
|
-
U.showError(e3);
|
|
53
|
-
}
|
|
54
|
-
}, showFilterButton: W?.getFilter() ? W.getShowFilterButton() : null, onShowFilterButtonChange: (e2) => {
|
|
55
|
-
try {
|
|
56
|
-
W.setShowFilterButton(e2);
|
|
57
|
-
} catch (e3) {
|
|
58
|
-
U.showError(e3);
|
|
59
|
-
}
|
|
60
|
-
} }), 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: W, styles: V.styles(), bodyStyle: V.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: H.getCommand("convertTableToRange"), commandState: W, icon: f(e(y, {})) }), e(x, { variant: p.Menuitem, commandState: W, command: H.getCommand("deleteTable"), icon: f(e(y, {})) })] })] })] }), Q] }) });
|
|
61
|
-
});
|
|
62
|
-
export {
|
|
63
|
-
v as TableDetailsWindow,
|
|
64
|
-
v as default
|
|
65
|
-
};
|