@sheetxl/studio-mui 0.4.20 → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/B1KlR2XYFpYbKjYS.cjs +20 -0
- package/browser/cjs/{DItuuqkIamMzp7Im.cjs → B1RMsexbz4bNlty_.cjs} +1 -1
- package/browser/cjs/B32faQpVaX1tkPuc.cjs +6 -0
- package/browser/cjs/B3XiHrRxW1LxML7F.cjs +6 -0
- package/browser/cjs/BGikYpeNpjwvXUdQ.cjs +18 -0
- package/browser/cjs/BY5l7DteiFtb2AKy.cjs +6 -0
- package/browser/cjs/Bb0Hd2RE7iVWVbm8.cjs +6 -0
- package/browser/cjs/C3EZkRIKfQURg9hX.cjs +6 -0
- package/browser/cjs/C7r573AdygYrVVEJ.cjs +7 -0
- package/browser/cjs/DEEknE8ARp0mc7fk.cjs +6 -0
- package/browser/cjs/DZwzUUHda3jr5jo4.cjs +6 -0
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/veQZSq7ekc6G1FZT.cjs +42 -0
- package/browser/esm/B84RbTkXZiq6XIdH.mjs +49 -0
- package/browser/esm/{C5xUbwpUPDeNua-i.mjs → BLy-hRTZkVfaGrcr.mjs} +1 -1
- package/browser/esm/Bapmv0WdnDq3Jl_q.mjs +53 -0
- package/browser/esm/C0OuiugFYjsjbY8q.mjs +46 -0
- package/browser/esm/{5u-JEG1IfQBstjq0.mjs → CGVN-NJF8ZTm9apo.mjs} +11 -10
- package/browser/esm/CcLpUDzJOdfqQ8Kf.mjs +25 -0
- package/browser/esm/Csg-hJrzm9r4vJrm.mjs +2156 -0
- package/browser/esm/{C60ZnLCvtztDLuoT.mjs → DHf2N2UY78nZFge3.mjs} +100 -98
- package/browser/esm/Dlc8L0qha0mZFIkY.mjs +62 -0
- package/browser/esm/{BW3_mz5_8i9VLBYB.mjs → Dv-0R5pQwEnowzoO.mjs} +87 -85
- package/browser/esm/index.mjs +29 -29
- package/browser/esm/mVKwmIdSj4ua1Qce.mjs +4443 -0
- package/browser/esm/{CxXpPYi4eOFhBNt2.mjs → sHK4zKkWLGt2hVmW.mjs} +27 -26
- package/licenses/dependencies.txt +71 -342
- package/node/esm/{CrDbLKJh9omVo_TF.mjs → 49Eux5a_I5wZ-jfq.mjs} +29 -28
- package/node/esm/{Bn5TJPQAEMY-lGpF.mjs → B00pGeZ7sj6QOFgF.mjs} +4 -3
- package/node/esm/{D6A_o47zvz5ITIJK.mjs → BEtxwx_Ji4aFNg8V.mjs} +79 -78
- package/node/esm/{Ds5dinNcyNdC8ta6.mjs → BTcBIT144Lil18l-.mjs} +13 -11
- package/node/esm/{Bv12-Yyv0C86Iquy.mjs → Bw_f4uhXHpg1RA6Z.mjs} +7 -6
- package/node/esm/CGrG-gsnGd-Pn_T2.mjs +88 -0
- package/node/esm/CiUfb3MQCUC2McDP.mjs +46 -0
- package/node/esm/D1bjybdBQ28bumrW.mjs +63 -0
- package/node/esm/{CH6p2H0CMCoz4NgJ.mjs → Dcnd4LiYyGf2eaNl.mjs} +23 -22
- package/node/esm/{rlqvGCJlj4a2UcSM.mjs → DiLUM75s3D56Y6Fx.mjs} +11 -10
- package/node/esm/index.mjs +2381 -18514
- package/package.json +8 -8
- package/browser/cjs/-Z37a-mzY5SKXy--.cjs +0 -6
- package/browser/cjs/B384kb1_rsiCsdZG.cjs +0 -6
- package/browser/cjs/B8nWvy4zDv1CZsr_.cjs +0 -110
- package/browser/cjs/BBnMJiXp9lru0Rcq.cjs +0 -6
- package/browser/cjs/BFbHTu65n1oE-l0N.cjs +0 -6
- package/browser/cjs/BQMSHnQdWtqeakER.cjs +0 -6
- package/browser/cjs/BvjA0ybox6653eb5.cjs +0 -6
- package/browser/cjs/Cocgl4ghzWE9yVYS.cjs +0 -161
- package/browser/cjs/D21Q1NdM1zQ7uFlH.cjs +0 -6
- package/browser/cjs/D4LmaKqYiwjxp0Hs.cjs +0 -15
- package/browser/cjs/D6egUillMqBwTaEq.cjs +0 -6
- package/browser/cjs/D9lY6pd9tRxPeLKs.cjs +0 -18
- package/browser/cjs/DNqIYSqRYZkUpFxW.cjs +0 -7
- package/browser/cjs/DUImSlPsM-OipgBZ.cjs +0 -6
- package/browser/cjs/DUVLcBcwkTsuLb6q.cjs +0 -6
- package/browser/cjs/Db7IyKXFzo8IocDa.cjs +0 -145
- package/browser/cjs/DsHPj69dMFG09uD_.cjs +0 -16
- package/browser/cjs/DypblOPNMRx5Twgx.cjs +0 -12
- package/browser/cjs/QK7YNBstmN86K-xL.cjs +0 -6
- package/browser/cjs/VNWvn2kP6ZF0Snzw.cjs +0 -11
- package/browser/cjs/dc1YAArM3bSHvRcF.cjs +0 -7
- package/browser/cjs/mInXvB8P6r6q7pRY.cjs +0 -11
- package/browser/cjs/nop6N-Oi_LKy1Bpc.cjs +0 -42
- package/browser/cjs/s45oNHeIvJVeRjn5.cjs +0 -6
- package/browser/esm/1y10o01h14oGJtKG.mjs +0 -43
- package/browser/esm/BFpc8KBa-fb0nLSt.mjs +0 -46
- package/browser/esm/Bmjhrc6YMmfx_1Yi.mjs +0 -1703
- package/browser/esm/BnlJVFlQeWerd3KW.mjs +0 -3803
- package/browser/esm/BpuH_QvBidPOXgAR.mjs +0 -392
- package/browser/esm/CAiWSkkPRgUjk8CN.mjs +0 -424
- package/browser/esm/CW8taieVozHhyBOC.mjs +0 -1467
- package/browser/esm/CzyEerZmfWrW3i3U.mjs +0 -59
- package/browser/esm/D0FBHwm0Oz_wf0tR.mjs +0 -12
- package/browser/esm/DM9GPrZpbCcKOnyU.mjs +0 -1352
- package/browser/esm/DO1doKZhwYiL7vbF.mjs +0 -1672
- package/browser/esm/DS3anstzAV3EJBRw.mjs +0 -84
- package/browser/esm/DuEmdSQsXlkCWZIB.mjs +0 -1366
- package/browser/esm/FvK-pQsicRjtrKoS.mjs +0 -48
- package/browser/esm/KCTJzQeDChqf1yBO.mjs +0 -52
- package/browser/esm/P-3pIbidOtRCNsw3.mjs +0 -23
- package/browser/esm/W3EFMOPLR1aNXWvF.mjs +0 -2250
- package/browser/esm/Z_Sh-N3xHHWLCbEw.mjs +0 -23412
- package/browser/esm/mOmzoYDWAtgYndCA.mjs +0 -13391
- package/browser/esm/tnJECoiQzUzgUQZE.mjs +0 -44
- package/node/esm/54SjtcD6mOreKcCy.mjs +0 -1719
- package/node/esm/B2BlMiDOVpIp1FDQ.mjs +0 -1706
- package/node/esm/BNEvR1srnnwBgnrF.mjs +0 -1479
- package/node/esm/BZ20_F64yjZgn-_G.mjs +0 -1246
- package/node/esm/BfzRLuswtxg9uDsX.mjs +0 -78
- package/node/esm/C0ZBbkFa-24tJTnw.mjs +0 -60
- package/node/esm/CEVO60fX3MAPG0Hg.mjs +0 -1378
- package/node/esm/CdFmhVFplZFgBvTo.mjs +0 -44
- package/node/esm/Cx4mn0YEVkG-M1VL.mjs +0 -553
- package/node/esm/DDWek3aquTe_okr_.mjs +0 -392
- package/node/esm/DSLWcwr4qgHARs36.mjs +0 -13464
- package/node/esm/iXG86MN0JrtJkpqe.mjs +0 -44
- package/node/esm/m2teXjBzZLfLDFPx.mjs +0 -46
- package/node/esm/oykDy4erHC0NNHHq.mjs +0 -3776
- package/node/esm/sVOd1y3oNBREsKJ7.mjs +0 -86
|
@@ -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.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
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
|
});
|
|
@@ -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.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
7
|
import { 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,61 +1,62 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { jsx as e, jsxs as
|
|
8
|
-
import { memo as
|
|
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
9
|
import { useMeasure as a } from "react-use";
|
|
10
|
-
import { alpha as c, getOverlayAlpha as p } from "@mui/material/styles
|
|
10
|
+
import { alpha as c, getOverlayAlpha as p } from "@mui/material/styles";
|
|
11
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
12
|
import { ArrowBack as y, ArrowUpward as b, ArrowForward as T, ArrowDownward as v } from "@mui/icons-material";
|
|
13
13
|
import { ICell as k, IRange as R } from "@sheetxl/sdk";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
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));
|
|
17
18
|
l(() => {
|
|
18
19
|
g2(U(r2, a2));
|
|
19
20
|
}, [r2, a2]);
|
|
20
21
|
const y2 = E((e2) => {
|
|
21
22
|
g2(e2.target.value), d2?.(a2[e2.target.value]);
|
|
22
|
-
}, [d2, a2]), b2 = s(() => Object.keys(a2).map((
|
|
23
|
-
return
|
|
24
|
-
}),
|
|
25
|
-
delete
|
|
26
|
-
const G = { "By Rows": true, "By Columns": false }, U = (e2,
|
|
27
|
-
const
|
|
28
|
-
for (let i2 = 0; i2 <
|
|
29
|
-
const o2 =
|
|
30
|
-
if (
|
|
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;
|
|
31
32
|
}
|
|
32
|
-
}, X =
|
|
33
|
-
const { replace: s2 = false, findText: x2, replaceText: h2, findOptions: O2, replaceOptions: C2, title: U2, onHide: X2, onFindOrReplace: q, ...J } =
|
|
34
|
-
if (!
|
|
35
|
-
|
|
36
|
-
}, [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:
|
|
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) => {
|
|
37
38
|
if (!q) return;
|
|
38
39
|
const o2 = { ...fe };
|
|
39
|
-
o2.replaceOptions = { ...o2.replaceOptions }, o2.findOptions = { ...o2.findOptions }, o2.replaceOptions.maxCount =
|
|
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;
|
|
40
41
|
const l2 = await q({ autoFocus: i2, ...o2 });
|
|
41
42
|
pe(0 === l2);
|
|
42
43
|
}, [fe, q]);
|
|
43
44
|
l(() => {
|
|
44
45
|
pe(false);
|
|
45
46
|
}, [fe, le, se]);
|
|
46
|
-
const xe = E((e2,
|
|
47
|
+
const xe = E((e2, t2) => {
|
|
47
48
|
if (e2.keyCode === S.Enter) {
|
|
48
49
|
if (!fe.findText) return;
|
|
49
|
-
let
|
|
50
|
-
e2.shiftKey && (
|
|
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);
|
|
51
52
|
}
|
|
52
53
|
}, [fe]), he = i(null);
|
|
53
54
|
r(() => {
|
|
54
55
|
me((e2) => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
return
|
|
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;
|
|
59
60
|
}), de || he.current?.focus();
|
|
60
61
|
}, [x2, h2, O2, C2]), l(() => {
|
|
61
62
|
se ? (fe.findOptions.fields[0], k.Content.Values) : oe(true);
|
|
@@ -65,91 +66,91 @@ const G = { "By Rows": true, "By Columns": false }, U = (e2, n2) => {
|
|
|
65
66
|
}, { once: true });
|
|
66
67
|
}, [ie, fe]);
|
|
67
68
|
const [Oe, { width: Ce }] = a();
|
|
68
|
-
return e(
|
|
69
|
+
return e(I, { ref: he, title: U2 ?? (se ? "Find & Replace" : "Find"), initialPosition: { y: "35" }, autoFocusSel: ".input", onHide: X2, onFocus: () => ue(true), onBlur: () => {
|
|
69
70
|
ue(false), pe(false);
|
|
70
|
-
}, PaperProps: { elevation: de ? 3 : 1 }, ...J, children:
|
|
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) => {
|
|
71
72
|
if ("h" === e2.key && e2.ctrlKey) ae(true), Q.current?.contains(document.activeElement) && Y.current?.focus();
|
|
72
73
|
else if ("f" === e2.key && e2.ctrlKey) Q.current?.focus();
|
|
73
74
|
else if ("c" === e2.key && e2.altKey) me((e3) => {
|
|
74
|
-
const
|
|
75
|
-
return
|
|
75
|
+
const t2 = { ...e3 };
|
|
76
|
+
return t2.findOptions.matchCase = !e3.findOptions.matchCase, t2;
|
|
76
77
|
});
|
|
77
78
|
else if ("e" === e2.key && e2.altKey) me((e3) => {
|
|
78
|
-
const
|
|
79
|
-
return
|
|
79
|
+
const t2 = { ...e3 };
|
|
80
|
+
return t2.findOptions.matchEntireCell = !e3.findOptions.matchEntireCell, t2;
|
|
80
81
|
});
|
|
81
82
|
else {
|
|
82
83
|
if ("r" !== e2.key || !e2.altKey) return;
|
|
83
84
|
me((e3) => {
|
|
84
|
-
const
|
|
85
|
-
return
|
|
85
|
+
const t2 = { ...e3 };
|
|
86
|
+
return t2.findOptions.useRegex = !e3.findOptions.useRegex, t2;
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
e2.preventDefault();
|
|
89
|
-
}, children: [
|
|
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) => {
|
|
90
91
|
re(e2);
|
|
91
|
-
}, preventFocus: true, label: "Toggle Additional Options", icon:
|
|
92
|
+
}, preventFocus: true, label: "Toggle Additional Options", icon: D(e(P, {})) }), e(w, { selected: se, onSelectToggle: (e2) => {
|
|
92
93
|
ae(e2);
|
|
93
|
-
}, preventFocus: true, label: "Toggle Replace", icon:
|
|
94
|
-
me((
|
|
95
|
-
const
|
|
96
|
-
return
|
|
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;
|
|
97
98
|
});
|
|
98
|
-
}, label: "Match Case", shortcut: { key: "C", modifiers: [
|
|
99
|
-
me((
|
|
100
|
-
const
|
|
101
|
-
return
|
|
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;
|
|
102
103
|
});
|
|
103
|
-
}, label: "Match Entire Cell", shortcut: { key: "E", modifiers: [
|
|
104
|
-
me((
|
|
105
|
-
const
|
|
106
|
-
return
|
|
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;
|
|
107
108
|
});
|
|
108
|
-
}, label: "Use Regular Expression", shortcut: { key: "R", modifiers: [
|
|
109
|
-
me((
|
|
110
|
-
const
|
|
111
|
-
return
|
|
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;
|
|
112
113
|
});
|
|
113
114
|
}, onKeyDown: (e2) => xe(e2, false), onContextMenu: (e2) => {
|
|
114
115
|
e2.stopPropagation();
|
|
115
|
-
} }), e(
|
|
116
|
+
} }), e(w, { selected: fe.findOptions.reverse, onSelectToggle: (e2) => {
|
|
116
117
|
ge(false, false);
|
|
117
|
-
}, touchRippleRef: Z, label: "", shortcut: { key: "Enter", modifiers: [
|
|
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) => {
|
|
118
119
|
ge(true, false);
|
|
119
|
-
}, touchRippleRef: _, label: "Next Match", shortcut: { key: "Enter" }, icon:
|
|
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: () => {
|
|
120
121
|
Q.current?.focus();
|
|
121
|
-
}, children:
|
|
122
|
-
me((
|
|
123
|
-
const
|
|
124
|
-
return
|
|
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;
|
|
125
126
|
});
|
|
126
127
|
}, onKeyDown: (e2) => xe(e2, true), onContextMenu: (e2) => {
|
|
127
128
|
e2.stopPropagation();
|
|
128
|
-
} }), e(
|
|
129
|
+
} }), e(w, { onSelectToggle: (e2) => {
|
|
129
130
|
ge(true, true);
|
|
130
|
-
}, touchRippleRef: ee, label: "Replace", shortcut: { key: "Enter" }, icon:
|
|
131
|
+
}, touchRippleRef: ee, label: "Replace", shortcut: { key: "Enter" }, icon: D(e(B, {})), disabled: !fe.findText }), e(w, { onSelectToggle: (e2) => {
|
|
131
132
|
ge(true, true, true);
|
|
132
|
-
}, touchRippleRef:
|
|
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: () => {
|
|
133
134
|
Q.current?.focus();
|
|
134
|
-
}, children:
|
|
135
|
-
me((
|
|
136
|
-
const
|
|
137
|
-
return
|
|
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;
|
|
138
139
|
});
|
|
139
|
-
} }), e(
|
|
140
|
-
me((
|
|
141
|
-
const
|
|
142
|
-
return
|
|
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;
|
|
143
144
|
});
|
|
144
|
-
} }), e(
|
|
145
|
-
me((
|
|
146
|
-
const
|
|
147
|
-
return
|
|
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;
|
|
148
149
|
});
|
|
149
150
|
} })] })] }) })] }) });
|
|
150
151
|
});
|
|
151
152
|
export {
|
|
152
153
|
X as FindReplaceWindow,
|
|
153
|
-
|
|
154
|
+
W as ScopeOptions,
|
|
154
155
|
X as default
|
|
155
156
|
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
7
|
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
8
|
-
import { memo as t, useState as
|
|
8
|
+
import { memo as t, useState as o, useCallback as a } from "react";
|
|
9
9
|
import { Box as i, FormControlLabel as l, Checkbox as s } from "@mui/material";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
import { useCallbackRef as r } from "@sheetxl/utils-react";
|
|
11
|
+
import { OptionsDialog as p } from "@sheetxl/utils-mui";
|
|
12
|
+
import { RangeInput as c } from "./index.mjs";
|
|
13
|
+
const m = ["Ok", "Cancel"], d = t((t2) => {
|
|
14
|
+
const { tableOptions: d2, context: u, onOption: g, onValidateOption: f, onDone: h, options: x = m, defaultOption: O = x?.[0], cancelOption: b = "Cancel", sx: C, ...D } = t2, [N, T] = o(false), [j, k] = o(() => d2?.hasHeader ?? false), [v, w] = o(() => d2?.ranges ?? null), y = r((e2) => {
|
|
15
|
+
const n2 = { ...d2, hasHeader: j, ranges: v };
|
|
16
|
+
g?.(e2, e2 === b, e2 === O), h?.({ option: e2, tableOptions: n2 });
|
|
17
|
+
}, [h, g, O, b, j, v, d2]), F = a(async (e2, n2) => null, []);
|
|
18
|
+
return e(p, { title: "Insert Table", options: x, onDone: y, onValidateOption: F, defaultOption: O, cancelOption: b, autoFocusSel: ".range-input input", sx: { width: "360px", ...C }, ...D, children: n(i, { sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(0), rowGap: (e2) => e2.spacing(1), display: "flex", flexDirection: "column" }, children: [e(c, { formName: "range", value: v, onChangeInput: (e2) => w(e2), resolvedAddress: u.getNames().getRanges.bind(u.getNames()), onFocus: (e2) => {
|
|
17
19
|
N || e2.target?.select(), T(true);
|
|
18
20
|
} }), e(l, { control: e(s, { checked: j, onChange: () => k(!j) }), label: "Table has headers", labelPlacement: "end" })] }) });
|
|
19
21
|
});
|
|
20
22
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
d as TableNewDialog,
|
|
24
|
+
d as default
|
|
23
25
|
};
|
|
@@ -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.21
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -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,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { 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,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.21
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
8
|
+
import { memo as 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
|
+
};
|