@sheetxl/studio-mui 0.4.20 → 0.4.22
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/2d2J6QkipnGWfI99.cjs +6 -0
- package/browser/cjs/BY09bxecVOSMwQA3.cjs +6 -0
- package/browser/cjs/BYJI3FMxQ-z5UGsU.cjs +6 -0
- package/browser/cjs/B_nvuo0kEXu5G0Gf.cjs +7 -0
- package/browser/cjs/BfnxiVEhzO5reOYH.cjs +42 -0
- package/browser/cjs/Bil3fXnJ3lk7aGF5.cjs +6 -0
- package/browser/cjs/{DItuuqkIamMzp7Im.cjs → BzbKSVugPof6dqQI.cjs} +1 -1
- package/browser/cjs/CU0utErelA1oX0n8.cjs +6 -0
- package/browser/cjs/CWp8_mrz0htdOXMM.cjs +20 -0
- package/browser/cjs/D2Cp7gwb6bRupSZY.cjs +6 -0
- package/browser/cjs/DC70SHoaPVkOUEHx.cjs +6 -0
- package/browser/cjs/DRUx3PLS_NrkJ6Yw.cjs +18 -0
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/-0XEuwqNVFTlDKEX.mjs +25 -0
- package/browser/esm/-AR3L_VjwMbtQVbL.mjs +62 -0
- package/browser/esm/BLhZj1SgWlsmeviw.mjs +4443 -0
- package/browser/esm/{BW3_mz5_8i9VLBYB.mjs → BXNl9EEQzO53Hoh5.mjs} +87 -85
- package/browser/esm/BqnVpwK0Q2fKGA2S.mjs +53 -0
- package/browser/esm/D4rFOqwrrtVMpgbc.mjs +49 -0
- package/browser/esm/DEbllEGmvtLkCug_.mjs +2156 -0
- package/browser/esm/{C60ZnLCvtztDLuoT.mjs → DXRFs7VZM4IShMju.mjs} +100 -98
- package/browser/esm/{C5xUbwpUPDeNua-i.mjs → DeGATuYv4-5bhQcD.mjs} +1 -1
- package/browser/esm/{5u-JEG1IfQBstjq0.mjs → EMqbYi0X_krk5yOL.mjs} +11 -10
- package/browser/esm/fWsCG2WBM3kCpC5p.mjs +46 -0
- package/browser/esm/index.mjs +29 -29
- package/browser/esm/{CxXpPYi4eOFhBNt2.mjs → pARZF2O230qNvxWd.mjs} +27 -26
- package/licenses/dependencies.txt +0 -271
- package/node/esm/{D6A_o47zvz5ITIJK.mjs → 0JTY0jNrXiIiOqWY.mjs} +79 -78
- package/node/esm/{Ds5dinNcyNdC8ta6.mjs → BqQ6JNhQ1K321g9U.mjs} +13 -11
- package/node/esm/{CrDbLKJh9omVo_TF.mjs → Bu58psaOsDy_zPOJ.mjs} +29 -28
- package/node/esm/BzBHqe1ThbCP-l_d.mjs +88 -0
- package/node/esm/CE_I2ijQF8MeexHD.mjs +63 -0
- package/node/esm/{Bv12-Yyv0C86Iquy.mjs → CuomeW-4DDc1ywFW.mjs} +7 -6
- package/node/esm/DRt8kMDuCJn53CIE.mjs +46 -0
- package/node/esm/{CH6p2H0CMCoz4NgJ.mjs → DgHCTCARk1Gv_msN.mjs} +23 -22
- package/node/esm/{Bn5TJPQAEMY-lGpF.mjs → Do7y7aKPA48-93AV.mjs} +4 -3
- package/node/esm/{rlqvGCJlj4a2UcSM.mjs → X11ONmg6R1Y6hfue.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
|
@@ -1,45 +1,46 @@
|
|
|
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.22
|
|
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
|
-
import { jsx as t, jsxs as
|
|
8
|
-
import { memo as
|
|
9
|
-
import { alpha as
|
|
10
|
-
import { Box as r, FormControl as p, TextField as
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
import { jsx as t, jsxs as e } from "react/jsx-runtime";
|
|
8
|
+
import { memo as n, useMemo as o, useState as a, useCallback as i } from "react";
|
|
9
|
+
import { alpha as l, getOverlayAlpha as s } from "@mui/material/styles";
|
|
10
|
+
import { Box as r, FormControl as p, TextField as c } from "@mui/material";
|
|
11
|
+
import { useCallbackRef as d } from "@sheetxl/utils-react";
|
|
12
|
+
import { OptionsDialog as u } from "@sheetxl/utils-mui";
|
|
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: P = "Cancel", sx: b, ...D } = n2, F = o(() => null !== (m2 ?? h?.()?.getHyperlink()), []), I = o(() => {
|
|
15
|
+
let t2 = null, e2 = null;
|
|
16
|
+
m2 && ("string" == typeof m2 ? e2 = m2 : t2 = m2);
|
|
17
|
+
const n3 = t2 ?? h?.()?.getHyperlink();
|
|
18
|
+
return { address: e2 ?? n3?.getAddress() ?? "", textToDisplay: n3?.getDisplayText() ?? "" };
|
|
18
19
|
}, [m2, h]), [v, w] = a(I.address), [H, M] = a(() => {
|
|
19
20
|
const t2 = h?.().toTextUnformatted() ?? f;
|
|
20
21
|
return t2 === I.address ? "" : t2;
|
|
21
|
-
}), [$,
|
|
22
|
+
}), [$, B] = a(false), L = i((t2) => {
|
|
22
23
|
M(t2.target.value);
|
|
23
|
-
}, []),
|
|
24
|
-
const
|
|
25
|
-
t2 !== P && x?.(
|
|
26
|
-
}, [v, H, x, k, y, O, P]),
|
|
27
|
-
w(t2.target.value),
|
|
28
|
-
}, [T]),
|
|
29
|
-
let
|
|
24
|
+
}, []), W = i(async (t2, e2) => null, []), z = d(async (t2) => {
|
|
25
|
+
const e2 = "" === v ? null : { address: v };
|
|
26
|
+
t2 !== P && x?.(e2, H), y?.(t2, t2 === P, t2 === O), k?.();
|
|
27
|
+
}, [v, H, x, k, y, O, P]), A = d((t2) => {
|
|
28
|
+
w(t2.target.value), W(t2.target.value, null);
|
|
29
|
+
}, [T]), E = d(async (t2) => {
|
|
30
|
+
let e2 = await Promise.resolve(T?.(t2));
|
|
30
31
|
try {
|
|
31
|
-
false !==
|
|
32
|
+
false !== e2 && (e2 = await W(v, t2));
|
|
32
33
|
} catch (t3) {
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
+
return e2 ?? true;
|
|
35
36
|
}, [T]);
|
|
36
|
-
return t(u, { title: (F ? "Edit" : "Insert") + " Link", options: C, onDone: k, onOption: (t2) =>
|
|
37
|
-
$ || t2.target?.select(),
|
|
38
|
-
}, 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(${
|
|
37
|
+
return t(u, { title: (F ? "Edit" : "Insert") + " Link", options: C, onDone: k, onOption: (t2) => z(t2), onValidateOption: E, defaultOption: O, cancelOption: P, autoFocusSel: ".autoFocus", sx: { width: "480px", ...b }, ...D, 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
|
+
$ || t2.target?.select(), B(true);
|
|
39
|
+
}, 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(${l("#fff", s(5))}, ${l("#fff", s(5))})` } } }, value: v, onChange: A, onContextMenu: (t2) => {
|
|
39
40
|
t2.stopPropagation();
|
|
40
|
-
} }) }), t(p, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(
|
|
41
|
-
|
|
42
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { spellCheck: false, autoComplete: "off", sx: { paddingTop: (t2) => t2.spacing(1.25), paddingBottom: (t2) => t2.spacing(0.75), backgroundImage: `linear-gradient(${
|
|
41
|
+
} }) }), t(p, { sx: { paddingTop: (t2) => t2.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(c, { label: "Display Text", placeholder: v?.startsWith("#") ? v.substring(1) : v, onFocus: () => {
|
|
42
|
+
B(true);
|
|
43
|
+
}, sx: { "& .MuiFormHelperText-root": { marginTop: (t2) => t2.spacing(0.5) } }, InputLabelProps: { shrink: true }, InputProps: { inputProps: { 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: L, onContextMenu: (t2) => {
|
|
43
44
|
t2.stopPropagation();
|
|
44
45
|
} }) })] }) });
|
|
45
46
|
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.22
|
|
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 { jsxs as e, jsx as t } from "react/jsx-runtime";
|
|
8
|
+
import { Box as i, TextField as n, InputAdornment as r, IconButton as o, FormControlLabel as l, Checkbox as a, Typography as d, TableCell as s, DialogContent as c } from "@mui/material";
|
|
9
|
+
import { KeyCodes as h } from "@sheetxl/utils-react";
|
|
10
|
+
import { toShortcutElements as p, InternalWindow as m } from "@sheetxl/utils-mui";
|
|
11
|
+
import u, { useState as g, useMemo as f, useEffect as x } from "react";
|
|
12
|
+
import b from "clsx";
|
|
13
|
+
import { alpha as w, getOverlayAlpha as y, styled as R } from "@mui/material/styles";
|
|
14
|
+
import { Close as C } from "@mui/icons-material";
|
|
15
|
+
import { AutoSizer as k, Table as v, Column as $ } from "react-virtualized";
|
|
16
|
+
import { CommonUtils as D } from "@sheetxl/utils";
|
|
17
|
+
const I = "ReactVirtualizedDemo-flexContainer", K = "ReactVirtualizedDemo-tableRow", z = "ReactVirtualizedDemo-tableRowHover", H = "ReactVirtualizedDemo-tableCell", S = "ReactVirtualizedDemo-noClick";
|
|
18
|
+
class N extends u.PureComponent {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments), this.getRowClassName = ({ index: e2 }) => {
|
|
21
|
+
const { onRowClick: t2 } = this.props;
|
|
22
|
+
return b(K, I, { [z]: -1 !== e2 && null != t2 });
|
|
23
|
+
}, this.cellRenderer = ({ cellData: e2, dataKey: i2, columnIndex: n2, width: r2 }) => {
|
|
24
|
+
const { columns: o2, rowHeight: l2, onRowClick: a2 } = this.props;
|
|
25
|
+
let d2 = e2, c2 = { height: l2, paddingRight: "2px", paddingTop: "0px", paddingBottom: "0px", minWidth: `${r2}px`, maxWidth: `${r2}px` };
|
|
26
|
+
return "shortcut" === i2 ? d2 = p(e2) : "description" === i2 && (c2 = { ...c2, fontSize: ".75rem", display: "block", paddingTop: "4px", whiteSpace: "pre-line" }), t(s, { component: "div", className: b(H, I, { [S]: null == a2 }), variant: "body", style: c2, align: null != n2 && o2[n2].numeric ? "right" : "left", children: d2 });
|
|
27
|
+
}, this.headerRenderer = ({ label: e2, columnIndex: i2, width: n2 }) => {
|
|
28
|
+
const { headerHeight: r2, columns: o2 } = this.props, l2 = o2[i2];
|
|
29
|
+
return t(s, { component: "div", className: b(H, I, S), variant: "head", sx: { width: n2, height: r2, backgroundColor: (e3) => e3.palette.grey[300] }, align: l2.numeric ? "right" : "left", children: t("span", { children: l2.label }) });
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static {
|
|
33
|
+
this.defaultProps = { headerHeight: 40, rowHeight: 48 };
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
const { columns: e2, rowHeight: i2, headerHeight: n2, ...r2 } = this.props;
|
|
37
|
+
return t(k, { children: ({ height: o2, width: l2 }) => t(v, { height: o2, width: l2, rowHeight: i2, gridStyle: { direction: "inherit" }, headerHeight: n2, ...r2, rowClassName: this.getRowClassName, children: e2.map(({ dataKey: e3, width: i3, widthLess: n3, ...r3 }, o3) => {
|
|
38
|
+
const a2 = n3 ? l2 - n3 : i3;
|
|
39
|
+
return t($, { style: { flex: `1 1 ${a2}px` }, headerRenderer: (e4) => this.headerRenderer({ ...e4, width: a2, columnIndex: o3 }), className: I, cellDataGetter: ({ rowData: e4, columnData: t2, dataKey: i4 }) => e4[i4], cellRenderer: (e4) => this.cellRenderer({ ...e4, width: a2, columnIndex: o3 }), dataKey: e3, width: a2, ...r3 }, e3);
|
|
40
|
+
}) }) });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const T = R(N)(({ theme: e2 }) => ({ "& .ReactVirtualized__Table__headerRow": { ..."rtl" === e2.direction && { paddingLeft: "0 !important" }, ..."rtl" !== e2.direction && { paddingRight: void 0 } }, "& .ReactVirtualized__Table__Grid": { outline: "none" }, [`& .${I}`]: { display: "flex", alignItems: "center", boxSizing: "border-box" }, [`& .${K}`]: { cursor: "pointer" }, [`& .${z}`]: { "&:hover:not([disabled])": { backgroundColor: e2.palette.grey[200] } }, [`& .${H}`]: { flex: 1 }, [`& .${S}`]: { cursor: "initial" } }));
|
|
44
|
+
function _(s2) {
|
|
45
|
+
const { commands: c2, ...p2 } = s2, [m2, u2] = g(false), [b2, R2] = g(""), k2 = f(() => {
|
|
46
|
+
let e2 = c2.getAllCommands();
|
|
47
|
+
m2 || (e2 = e2.filter((e3) => e3.command.shortcut())), e2.sort((e3, t3) => e3.command.label().localeCompare(t3.command.label()));
|
|
48
|
+
const t2 = [], i2 = (e3) => e3.replace(/\n\n/g, "\n");
|
|
49
|
+
for (let n2 = 0; n2 < e2.length; n2++) {
|
|
50
|
+
const r2 = e2[n2].command, o2 = r2.shortcut();
|
|
51
|
+
if (Array.isArray(o2)) {
|
|
52
|
+
const e3 = o2;
|
|
53
|
+
for (let n3 = 0; n3 < e3.length; n3++) t2.push({ label: r2.label(), description: i2(r2.description()), shortcut: e3[n3] });
|
|
54
|
+
} else t2.push({ label: r2.label(), description: i2(r2.description()), shortcut: r2.shortcut() });
|
|
55
|
+
}
|
|
56
|
+
return t2;
|
|
57
|
+
}, [m2, c2]), [v2, $2] = g(null);
|
|
58
|
+
x(() => {
|
|
59
|
+
import("fuse.js").then((e2) => {
|
|
60
|
+
$2(new e2.default(k2, { threshold: 0, ignoreLocation: true, keys: ["label", "description"] }));
|
|
61
|
+
});
|
|
62
|
+
}, [k2]);
|
|
63
|
+
const [I2, K2] = g(k2), z2 = b2.length > 0 && 0 === I2.length;
|
|
64
|
+
x(() => {
|
|
65
|
+
v2 && D.debounce(() => {
|
|
66
|
+
if (0 === b2.trim().length) return void K2(k2);
|
|
67
|
+
const e2 = v2.search(b2.trim()), t2 = new Array(e2.length);
|
|
68
|
+
for (let i2 = 0; i2 < e2.length; i2++) t2[i2] = e2[i2].item;
|
|
69
|
+
K2(t2);
|
|
70
|
+
}, 90)();
|
|
71
|
+
}, [v2, b2]);
|
|
72
|
+
return e(i, { style: { height: 440, width: "100%", display: "flex", flexDirection: "column" }, ...p2, children: [e(i, { sx: { display: "flex", alignItems: "center", justifyContent: "end", marginBottom: (e2) => e2.spacing(2), color: (e2) => e2.palette.text.secondary }, children: [t(n, { InputProps: { sx: { backgroundImage: `linear-gradient(${w("#fff", y(5))}, ${w("#fff", y(5))})` }, inputProps: { 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) } }, endAdornment: t(r, { sx: { opacity: b2.length > 0 ? 1 : 0, display: b2.length > 0 ? "flex" : "none" }, position: "end", children: t(o, { "aria-label": "clear search", onClick: () => R2(""), edge: "end", children: t(C, {}) }) }) }, 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: b2, onChange: (e2) => {
|
|
73
|
+
R2(e2.target.value);
|
|
74
|
+
}, onKeyDown: (e2) => {
|
|
75
|
+
e2.which === h.Escape && b2.length > 0 && (R2(""), e2.stopPropagation(), e2.preventDefault());
|
|
76
|
+
}, onContextMenu: (e2) => {
|
|
77
|
+
e2.stopPropagation();
|
|
78
|
+
} }), t(l, { sx: { flex: "1 1 60%" }, control: t(a, { checked: m2, onChange: () => u2(!m2) }), 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(${w("#fff", y(5))}, ${w("#fff", y(5))})` } }, children: t(T, { rowCount: I2.length, rowGetter: (e2) => I2[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 === I2.length ? "No" : I2.length} shortcut key${1 === I2.length ? "" : "s"}${b2.length > 0 ? " found" : ""}` }) })] });
|
|
79
|
+
}
|
|
80
|
+
const P = (e2) => {
|
|
81
|
+
const { title: i2 = "Shortcut Keys", commands: n2, sx: r2, ...o2 } = e2;
|
|
82
|
+
return t(m, { isModal: true, onKeyDown: (e3) => {
|
|
83
|
+
e3.keyCode === h.F1 && e3.preventDefault();
|
|
84
|
+
}, sx: { width: "780px", ...r2 }, title: i2, autoFocusSel: ".input", ...o2, children: t(c, { dividers: true, children: t(_, { commands: n2, sx: { marginBottom: "8px" } }) }) });
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
P as default
|
|
88
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.22
|
|
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,5 +1,5 @@
|
|
|
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.22
|
|
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.
|
|
@@ -8,13 +8,14 @@ import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
|
8
8
|
import { useState as t } from "react";
|
|
9
9
|
import { Box as i, FormControlLabel as o, Checkbox as l } from "@mui/material";
|
|
10
10
|
import { Sort as r, IRange as a } from "@sheetxl/sdk";
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import { useCallbackRef as s } from "@sheetxl/utils-react";
|
|
12
|
+
import { OptionsDialog as c } from "@sheetxl/utils-mui";
|
|
13
|
+
const d = ({ range: d2, options: m, cell: p, onDone: u, ...h }) => {
|
|
13
14
|
const [v, C] = t(m ?? r.DefaultRangeOptions), O = s((e2) => {
|
|
14
15
|
let n2 = null;
|
|
15
|
-
"Sort" === e2 && (n2 = { ...m, options: v }),
|
|
16
|
-
}, [v,
|
|
17
|
-
return e(c, { title: "Sort", options: ["Sort", "Cancel"], onDone: O, ...
|
|
16
|
+
"Sort" === e2 && (n2 = { ...m, options: v }), u?.(n2);
|
|
17
|
+
}, [v, u, m]);
|
|
18
|
+
return e(c, { title: "Sort", options: ["Sort", "Cancel"], onDone: O, ...h, children: n(i, { sx: { display: "flex", flexDirection: "column" }, children: [e(o, { control: e(l, { checked: !v.reverse, onChange: () => C((e2) => ({ ...e2, reverse: !e2.reverse })) }), label: "Is Ascending", labelPlacement: "end" }), e(o, { control: e(l, { checked: v.hasHeader, onChange: () => C((e2) => ({ ...e2, hasHeader: !e2.hasHeader })) }), label: "Has Header", labelPlacement: "end" }), e(o, { control: e(l, { checked: v.collatorOptions?.sensitivity === r.CaseSensitiveOptions.sensitivity, onChange: () => C((e2) => ({ ...e2, collatorOptions: v.collatorOptions?.sensitivity === r.CaseSensitiveOptions.sensitivity ? r.CaseInsensitiveOptions : r.CaseSensitiveOptions })) }), label: "Case Sensitive", labelPlacement: "end" }), e(o, { control: e(l, { checked: v.orientation === a.Orientation.Row, onChange: () => C((e2) => {
|
|
18
19
|
const n2 = e2.orientation === a.Orientation.Row ? a.Orientation.Column : a.Orientation.Row;
|
|
19
20
|
return { ...d2.getDefaultSortCriteria(n2, p).options, includeHidden: e2.includeHidden, reverse: e2.reverse, orientation: n2 };
|
|
20
21
|
}) }), label: "Row Sort", labelPlacement: "end" }), e(o, { control: e(l, { checked: v.includeHidden, onChange: () => C((e2) => ({ ...e2, includeHidden: !e2.includeHidden })) }), label: "Include Hidden", labelPlacement: "end" })] }) });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.22
|
|
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 a, useMemo as n, useState as l, useCallback as o } from "react";
|
|
9
|
+
import { Box as i } from "@mui/material";
|
|
10
|
+
import { useCallbackRef as r } from "@sheetxl/utils-react";
|
|
11
|
+
import { OptionsDialog as s } from "@sheetxl/utils-mui";
|
|
12
|
+
import { NamedInput as d, RangeInput as p } from "./index.mjs";
|
|
13
|
+
const m = ["Ok", "Cancel"], u = a((a2) => {
|
|
14
|
+
const { value: u2 = null, context: c, onOption: g, onValidateOption: x, onDone: f, onUpdate: N, options: y = m, defaultOption: T = y?.[0], cancelOption: h = "Cancel", sx: O, ...V } = a2, v = n(() => c?.getNames().findValidName("Range1"), []), C = n(() => {
|
|
15
|
+
if (!u2) return true;
|
|
16
|
+
}, []), [R, w] = l({ displayText: u2?.getName() ?? v, errorText: null }), [F, D] = l({ displayValue: u2?.getRanges() ?? c?.selection() ?? null, errorText: null }), [I, j] = l(false), B = o(async (e2) => !R.errorText && !F.errorText, [c]), E = r((e2, t2, a3) => {
|
|
17
|
+
if (!t2) {
|
|
18
|
+
let e3 = null;
|
|
19
|
+
C ? e3 = c?.getNames().addReference(R?.displayText, F?.displayValue, false) : ("reference" === u2.getType() && u2.doBatch(() => {
|
|
20
|
+
u2.setName(R?.displayText), u2.setReference(F?.displayValue);
|
|
21
|
+
}, `Edit Named '${R?.displayText}'`), e3 = u2), e3 && (e3.select(), N(e3, C));
|
|
22
|
+
}
|
|
23
|
+
g?.(e2, t2, a3), f?.();
|
|
24
|
+
}, [c, R, F, f, g, T, h, N]), L = r((e2) => {
|
|
25
|
+
let t2 = null;
|
|
26
|
+
try {
|
|
27
|
+
c?.getNames().validateName(e2);
|
|
28
|
+
} catch (e3) {
|
|
29
|
+
t2 = e3.message;
|
|
30
|
+
}
|
|
31
|
+
w({ displayText: e2, errorText: t2 });
|
|
32
|
+
}, []), b = r((e2) => {
|
|
33
|
+
u2 && u2.getName().toLowerCase() === e2.toLowerCase() || c?.getNames().validateName(e2);
|
|
34
|
+
}, [c, u2]), k = o((e2) => {
|
|
35
|
+
D({ displayValue: e2 ?? null, errorText: null });
|
|
36
|
+
}, []);
|
|
37
|
+
return e(s, { title: (C ? "Define" : "Edit") + " Range", options: y, onOption: E, onValidateOption: B, defaultOption: T, cancelOption: h, autoFocusSel: ".autoFocus", sx: { width: "460px", ...O }, ...V, 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
|
+
I || e2.target?.select(), j(true);
|
|
39
|
+
} }), e(p, { formName: "range", value: F.displayValue, onChangeInput: k, resolvedAddress: c.getNames().getRanges.bind(c.getNames()), onFocus: (e2) => {
|
|
40
|
+
I || e2.target?.select(), j(true);
|
|
41
|
+
} })] }) });
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
u as NamedReferenceDialog,
|
|
45
|
+
u as default
|
|
46
|
+
};
|
|
@@ -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.22
|
|
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,17 +1,18 @@
|
|
|
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.22
|
|
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 { jsxs as e, jsx as t } from "react/jsx-runtime";
|
|
8
8
|
import { PureComponent as n, Component as i, memo as r, useState as o, useCallback as s, useLayoutEffect as a } from "react";
|
|
9
|
-
import { useTheme as l } from "@mui/material/styles
|
|
9
|
+
import { useTheme as l } from "@mui/material/styles";
|
|
10
10
|
import { Box as h } from "@mui/material";
|
|
11
11
|
import p from "tinycolor2";
|
|
12
12
|
import { Alpha as d, Hue as c } from "react-color/es/components/common/index.js";
|
|
13
13
|
import g from "react-color/es/components/sketch/SketchFields.js";
|
|
14
|
-
import {
|
|
14
|
+
import { ReactUtils as u } from "@sheetxl/utils-react";
|
|
15
|
+
import { C as b } from "./index.mjs";
|
|
15
16
|
class m extends (n || i) {
|
|
16
17
|
constructor(e2) {
|
|
17
18
|
super(e2), this.handleChange = (e3) => {
|
|
@@ -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.22
|
|
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
|
});
|