@sheetxl/studio-mui 0.4.10 → 0.4.11
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/B29yIlf_FSHx9q3M.cjs +7 -0
- package/browser/cjs/B783moVfFT70yQuK.cjs +7 -0
- package/browser/cjs/BCtVyhxIZSUPH_Z4.cjs +7 -0
- package/browser/cjs/BE6O6K7i1mHBC3et.cjs +7 -0
- package/browser/cjs/BQ-G2ABc3FYN-D50.cjs +7 -0
- package/browser/cjs/BabvaPi1dUIPt5AG.cjs +7 -0
- package/browser/cjs/BbvcxaJzfy7H6xfa.cjs +7 -0
- package/browser/cjs/Bhh0dqxUzzOzHWMc.cjs +7 -0
- package/browser/cjs/CH50hiw_7LBSC6dR.cjs +7 -0
- package/browser/cjs/Cfb0T6htsh82UPK-.cjs +7 -0
- package/browser/cjs/CisYglNTHGrj9oMH.cjs +7 -0
- package/browser/cjs/Clbakb5VUTDTlofM.cjs +7 -0
- package/browser/cjs/D7xmeRe-f7IifEKc.cjs +7 -0
- package/browser/cjs/DCV-6w2JGk_faE3x.cjs +7 -0
- package/browser/cjs/DY2PuDSgw0TrB5-_.cjs +7 -0
- package/browser/cjs/Df5v6knUJ4dqHmmo.cjs +7 -0
- package/browser/cjs/DyzVC_iq7ceqC2fj.cjs +7 -0
- package/browser/cjs/QB_8kWYEsfOH_HwK.cjs +7 -0
- package/browser/cjs/aOmlMJRAkQEF59EX.cjs +7 -0
- package/browser/cjs/index.cjs +10 -4
- package/browser/cjs/li-J7BWV6WUzY5aq.cjs +7 -0
- package/browser/cjs/u0WmWLGlCwhnhL9i.cjs +7 -0
- package/browser/cjs/uoBAuXnlUz8scSA1.cjs +7 -0
- package/browser/cjs/xp2ZII-PuLk9tHK3.cjs +7 -0
- package/browser/cjs/xq-CJbsvm7BQO8lK.cjs +7 -0
- package/browser/esm/12Ttun7hzbiInyVr.mjs +7 -0
- package/browser/esm/7jSMnphGrNRPUa_S.mjs +7 -0
- package/browser/esm/AnCmK-idMDJ2vI8H.mjs +7 -0
- package/browser/esm/B-Ut_yUCD9THCz0T.mjs +7 -0
- package/browser/esm/BTD5k7gtFcqDwslB.mjs +7 -0
- package/browser/esm/BVRUNnRvnt7aVCDD.mjs +7 -0
- package/browser/esm/BauTkiamxm0HDt6M.mjs +7 -0
- package/browser/esm/BcIp2mxLBfjUBE0q.mjs +7 -0
- package/browser/esm/Bi_0z0hyhFuz5Ta3.mjs +7 -0
- package/browser/esm/BkDEdK7zOlsoUKCZ.mjs +7 -0
- package/browser/esm/BpGexBYtmHbTIJz2.mjs +7 -0
- package/browser/esm/CJawFB555VEY-Vge.mjs +7 -0
- package/browser/esm/CWogLlWYHiL4W6CH.mjs +7 -0
- package/browser/esm/Cr46Bo9bGoz0LbWq.mjs +7 -0
- package/browser/esm/Csk8rXNpaXmf5g7O.mjs +7 -0
- package/browser/esm/Cu-5HDPN8B0qE77-.mjs +7 -0
- package/browser/esm/CzgR8PxJ_89IC4Mr.mjs +7 -0
- package/browser/esm/DMUXpRbV3ahdB1lN.mjs +7 -0
- package/browser/esm/DiIX5KzrWnbDWjGE.mjs +7 -0
- package/browser/esm/Djo2IS-ivmVSrO3v.mjs +7 -0
- package/browser/esm/Hy95ExHvIFgzxQb-.mjs +7 -0
- package/browser/esm/Z1_72ZY8rW2Mc3g_.mjs +7 -0
- package/browser/esm/_ZR9nT54xwy-C6ow.mjs +7 -0
- package/browser/esm/csxyptiqbJZO0pQA.mjs +7 -0
- package/browser/esm/index.mjs +8 -83
- package/licenses/dependencies.txt +145 -145
- package/node/esm/{D9XxEDOFeim_xxQE.mjs → 8THCZRGNmI2nPqMR.mjs} +2 -2
- package/node/esm/{DAGXTtxswgRevXcg.mjs → BDm0y2dv7wLZhYj1.mjs} +1 -1
- package/node/esm/{bMROCCq764fn-xgi.mjs → BPylexVHXa-t0sqJ.mjs} +6 -6
- package/node/esm/{BCPBJsft-CxWAdC2.mjs → BQYQg7lfqFbWaf8x.mjs} +2 -2
- package/node/esm/{BvRJoxdFTieQ7fmr.mjs → BSUbQzac78SXiAJe.mjs} +1 -1
- package/node/esm/{CvPEjDQ6QhtpTabY.mjs → BeNXnrWMr5S34Oxb.mjs} +1 -1
- package/node/esm/{tOKSFYpLW-UAq6Gt.mjs → C6jxZQrvMLctjLZM.mjs} +4 -4
- package/node/esm/{usxl4NgDVOQ7LrDb.mjs → CCZepFZNn1pIXrnd.mjs} +1 -1
- package/node/esm/{FBYT_1wWMsovwFUH.mjs → CXSwyUs6BuNGCic0.mjs} +13 -13
- package/node/esm/{CcretMZPKGn3lnR4.mjs → CaV6SH-PMyHlXUhx.mjs} +1 -1
- package/node/esm/{wsJBzsqfI7PB1hMT.mjs → D481dAOp77EZbV5s.mjs} +2 -2
- package/node/esm/{DhG888jHVhaxSY8F.mjs → DHj9iDuBImdwscIb.mjs} +25 -25
- package/node/esm/{BGArlD6RNgEObMgD.mjs → DIGsHHDexzj0uG_T.mjs} +5 -5
- package/node/esm/{DxbGK6Zl1UgjOa4-.mjs → DLiw-2C_tqGgJIQ6.mjs} +2 -2
- package/node/esm/{sAnM1xQCuHDSOmip.mjs → DNJVdt9TbBsUE8Jm.mjs} +1 -1
- package/node/esm/{BBg45DshIWHYXywC.mjs → DaCmut490aSCGvX8.mjs} +1 -1
- package/node/esm/{BmkBQUrL_kkRhzTh.mjs → Dd2OFQJQyYp6bAeP.mjs} +1 -1
- package/node/esm/{Clurk3ikkAHRiukp.mjs → DkpAjhQeaZn_Ipxg.mjs} +2 -2
- package/node/esm/{p6vc6u8VPkFyCsYx.mjs → DyMCnCG9LzH5Mgw0.mjs} +2 -2
- package/node/esm/{Dc--wbPxmu3D8pbK.mjs → RV-AvxVzzFKWjYFM.mjs} +38 -38
- package/node/esm/{BPqOHRFTv--y9umX.mjs → Ui3_6RhrEZQDOXwg.mjs} +8 -8
- package/node/esm/index.mjs +5265 -4998
- package/node/esm/{M1FpuPZr9_2AafMV.mjs → qI75rORek8T0-Kpf.mjs} +2 -2
- package/package.json +8 -8
- package/types/index.d.ts +11 -0
- package/browser/cjs/BKTBvSy7O4Xw2cgz.cjs +0 -12
- package/browser/cjs/BpePzZJYiqMlY5Tv.cjs +0 -6
- package/browser/cjs/C1kdA0ggDPxfA1rZ.cjs +0 -7
- package/browser/cjs/C3Ou4UjGdLm76uIO.cjs +0 -6
- package/browser/cjs/CFxDNxEIdtHFQI9Y.cjs +0 -7
- package/browser/cjs/CYBKL0vexMAhOhAv.cjs +0 -15
- package/browser/cjs/CdVTdaOLyLtwVswE.cjs +0 -6
- package/browser/cjs/ClsxZKYLxWzS4vf3.cjs +0 -12
- package/browser/cjs/Co1amcDxMGmeSblk.cjs +0 -161
- package/browser/cjs/CoKAO1N3hI6MCu8D.cjs +0 -6
- package/browser/cjs/CtsmtdeQOqFBoICs.cjs +0 -6
- package/browser/cjs/CuB7GbiZyoeSvc0Z.cjs +0 -6
- package/browser/cjs/D-N-VqvFR1gHQx1f.cjs +0 -11
- package/browser/cjs/DDFf-jFPulia8BBq.cjs +0 -11
- package/browser/cjs/Db8DWa6iDZSqedMi.cjs +0 -90
- package/browser/cjs/DeGIeKT9CooiCmKo.cjs +0 -6
- package/browser/cjs/LWz4eqzOyIvcl3ew.cjs +0 -6
- package/browser/cjs/bzV_pbhf0GMpQZ5j.cjs +0 -16
- package/browser/cjs/fCiaIJ9GEGrJHKcW.cjs +0 -18
- package/browser/cjs/g_d3i2WIzavP1fkJ.cjs +0 -6
- package/browser/cjs/jtJTqrtVCIIZdMGs.cjs +0 -6
- package/browser/cjs/lKYJYMC7FrPq5kHP.cjs +0 -42
- package/browser/cjs/niDPoiECJADuYx3e.cjs +0 -145
- package/browser/cjs/olo9IZBG5nwaup_7.cjs +0 -6
- package/browser/cjs/zKQuLycAjgd_X11q.cjs +0 -6
- package/browser/esm/3hWSR1m3EU7D5hi-.mjs +0 -1352
- package/browser/esm/536uCif-OpzkPpDe.mjs +0 -84
- package/browser/esm/BAKeXjQwj8pB6HZf.mjs +0 -3803
- package/browser/esm/BCEAVoasUKP7howp.mjs +0 -25
- package/browser/esm/BKPv5CXZmlt0Bt9q.mjs +0 -52
- package/browser/esm/BpaKIplfXogRA7Dy.mjs +0 -424
- package/browser/esm/C7S8lmNi8dvBvaaL.mjs +0 -13391
- package/browser/esm/C8g1cXW8UUjZ5aXU.mjs +0 -43
- package/browser/esm/CDg8_cQCaixUeVW5.mjs +0 -59
- package/browser/esm/COdRj-kRolpDnJJt.mjs +0 -153
- package/browser/esm/C_SmA3bhMniSBiJM.mjs +0 -2251
- package/browser/esm/CfhFPyNuH7O_8Ma5.mjs +0 -46
- package/browser/esm/Cq7Bvqjn_f2hb4Yu.mjs +0 -1703
- package/browser/esm/Cu4sFU_zvi2DcKL0.mjs +0 -864
- package/browser/esm/DRlIFEu_74fHh0Nd.mjs +0 -44
- package/browser/esm/DW_hf-cH6FfKvA2U.mjs +0 -1366
- package/browser/esm/D_9FRFbybIoGcpk5.mjs +0 -640
- package/browser/esm/DssrQc6563EzuV2p.mjs +0 -1467
- package/browser/esm/TCkOSlTdkEa2IszR.mjs +0 -392
- package/browser/esm/XunxgPz4pxTyfYZa.mjs +0 -19979
- package/browser/esm/YJTooL6WwG9eY3LG.mjs +0 -48
- package/browser/esm/ej-oxHSoVFxjTvis.mjs +0 -2410
- package/browser/esm/fbwdS1S_4A9RYV7u.mjs +0 -1672
- package/browser/esm/tZtCH_zqvCEW6mXy.mjs +0 -23
- package/browser/esm/tbB-JzXGTPYVXdKc.mjs +0 -52
- package/node/esm/BmYPa_c9Yu9hUbtH.mjs +0 -312
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as k } from "react/jsx-runtime";
|
|
2
|
-
import { memo as D, useState as i, useCallback as N } from "react";
|
|
3
|
-
import { Box as j, FormControlLabel as w, Checkbox as F } from "@mui/material";
|
|
4
|
-
import { T as v, a1 as y, aj as B } from "./XunxgPz4pxTyfYZa.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.10
|
|
7
|
-
*
|
|
8
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
9
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
10
|
-
*/
|
|
11
|
-
const H = ["Ok", "Cancel"], L = D((g) => {
|
|
12
|
-
const { tableOptions: e, context: r, onOption: p, onValidateOption: I, onDone: c, options: d = H, defaultOption: t = d?.[0], cancelOption: s = "Cancel", sx: u, ...x } = g, [b, h] = i(!1), [n, f] = i(() => e?.hasHeader ?? !1), [l, O] = i(() => e?.ranges ?? null), C = v((a) => {
|
|
13
|
-
const m = { ...e, hasHeader: n, ranges: l };
|
|
14
|
-
p?.(a, a === s, a === t), c?.({ option: a, tableOptions: m });
|
|
15
|
-
}, [c, p, t, s, n, l, e]), T = N(async (a, m) => null, []);
|
|
16
|
-
return o(y, { title: "Insert Table", options: d, onDone: C, onValidateOption: T, defaultOption: t, cancelOption: s, autoFocusSel: ".range-input input", sx: { width: "360px", ...u }, ...x, children: k(j, { sx: { paddingTop: (a) => a.spacing(1), paddingBottom: (a) => a.spacing(0), rowGap: (a) => a.spacing(1), display: "flex", flexDirection: "column" }, children: [o(B, { formName: "range", value: l, onChangeInput: (a) => O(a), resolvedAddress: r.getNames().getRanges.bind(r.getNames()), onFocus: (a) => {
|
|
17
|
-
b || a.target?.select(), h(!0);
|
|
18
|
-
} }), o(w, { control: o(F, { checked: n, onChange: () => f(!n) }), label: "Table has headers", labelPlacement: "end" })] }) });
|
|
19
|
-
});
|
|
20
|
-
export {
|
|
21
|
-
L as TableNewDialog,
|
|
22
|
-
L as default
|
|
23
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as y } from "react/jsx-runtime";
|
|
2
|
-
import { memo as G, useState as x, useCallback as O, useEffect as H, useMemo as S } from "react";
|
|
3
|
-
import { Box as w, FormControl as P, InputLabel as K, Select as q, TextField as A, Typography as I, MenuItem as J } from "@mui/material";
|
|
4
|
-
import { NumberFormat as n } from "@sheetxl/sdk";
|
|
5
|
-
import { T as l, a4 as Q, a1 as U, a5 as p } from "./XunxgPz4pxTyfYZa.mjs";
|
|
6
|
-
import { alpha as c } from "@mui/system";
|
|
7
|
-
/**
|
|
8
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.10
|
|
9
|
-
*
|
|
10
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
11
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
12
|
-
*/
|
|
13
|
-
const X = ["Ok", "Cancel"], te = G((D) => {
|
|
14
|
-
const { initialValue: $, context: h, onOption: b, onValidateOption: u, onInputOption: C, onDone: m, options: T = X, defaultOption: i = T?.[0], cancelOption: d = "Cancel", sx: N, ...M } = D, [a, v] = x($), [V, j] = x(!1), g = O(async (e, o) => !0, []), f = l(async (e) => {
|
|
15
|
-
C?.(a, e), b?.(e, e === d, e === i), m?.();
|
|
16
|
-
}, [a, C, m, b, d, i]), B = l(async (e) => {
|
|
17
|
-
e.keyCode === Q.Enter && await g?.(a, null) !== !1 && f(i);
|
|
18
|
-
}, [a, f]), L = l((e) => {
|
|
19
|
-
v(e.target.value), g?.(e.target.value, null);
|
|
20
|
-
}, [u]), z = l(async (e) => {
|
|
21
|
-
let o = await Promise.resolve(u?.(e));
|
|
22
|
-
try {
|
|
23
|
-
o !== !1 && (o = await Promise.resolve(g?.(a, e)) ?? !0);
|
|
24
|
-
} catch {
|
|
25
|
-
}
|
|
26
|
-
return o ?? !0;
|
|
27
|
-
}, [u]), [k, F] = x(n.Styles.lookupStyle(a).formatType ?? n.Type.Custom);
|
|
28
|
-
H(() => {
|
|
29
|
-
F(n.Styles.lookupStyle(a).formatType ?? n.Type.Custom);
|
|
30
|
-
}, [a]);
|
|
31
|
-
const E = S(() => {
|
|
32
|
-
const e = n.Styles.lookupPrimary(), o = (r) => t(J, { value: r, children: r }, r), s = Object.keys(e).map((r) => o(e[r].formatType));
|
|
33
|
-
return s.push(o(n.Type.Custom)), s;
|
|
34
|
-
}, []), R = O((e) => {
|
|
35
|
-
const o = e.target.value;
|
|
36
|
-
F(o);
|
|
37
|
-
const s = n.Styles.lookupDefault(o);
|
|
38
|
-
s && v(s);
|
|
39
|
-
}, []), W = S(() => {
|
|
40
|
-
const e = h();
|
|
41
|
-
return e.createTemporaryCell({ value: e.getValue() ?? 12345, style: { numberFormat: a } });
|
|
42
|
-
}, [k, a, h]);
|
|
43
|
-
return t(U, { title: "Number Format", options: T, onDone: m, onOption: (e) => f(e), onValidateOption: z, defaultOption: i, cancelOption: d, autoFocusSel: ".autoFocus", sx: { width: "580px", ...N }, ...M, children: y(w, { sx: { paddingTop: (e) => e.spacing(1), paddingBottom: (e) => e.spacing(0), rowGap: (e) => e.spacing(1), display: "flex", flexDirection: "column" }, children: [y(P, { sx: { minWidth: 135 }, size: "small", children: [t(K, { children: "Category" }), t(q, { value: k, label: "Category", onChange: R, sx: { backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` }, children: E })] }), t(P, { sx: { paddingTop: (e) => e.spacing(1.5), minWidth: 135, width: "100%" }, size: "small", children: t(A, { label: "Code", onFocus: (e) => {
|
|
44
|
-
V || e.target?.select(), j(!0);
|
|
45
|
-
}, sx: { "& .MuiFormHelperText-root": { marginTop: (e) => e.spacing(0.5) } }, InputLabelProps: { shrink: !0 }, InputProps: { inputProps: { className: "autoFocus", spellCheck: !1, autoComplete: "off", sx: { paddingTop: (e) => e.spacing(1.25), paddingBottom: (e) => e.spacing(0.75), backgroundImage: `linear-gradient(${c("#fff", p(5))}, ${c("#fff", p(5))})` } } }, value: a, onChange: L, onKeyDown: B, onContextMenu: (e) => {
|
|
46
|
-
e.stopPropagation();
|
|
47
|
-
} }) }), y(w, { children: [t(I, { variant: "caption", component: "div", sx: { paddingLeft: (e) => e.spacing(2) }, children: "Preview" }), t(I, { variant: "body2", component: "div", sx: { borderRadius: (e) => `${e.shape.borderRadius}px`, padding: (e) => e.spacing(1), border: (e) => `1px solid ${e.palette.grey[400]}` }, children: W.getNumberFormat().displayText || "(empty)" })] })] }) });
|
|
48
|
-
});
|
|
49
|
-
export {
|
|
50
|
-
te as NumberFormatDialog,
|
|
51
|
-
te as default
|
|
52
|
-
};
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.10
|
|
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 o, Fragment as t } from "react/jsx-runtime";
|
|
8
|
-
import n, { forwardRef as r, useState as a, useCallback as s, isValidElement as i, memo as l, createElement as c, useMemo as d, useRef as p, useEffect as m, useLayoutEffect as k } from "react";
|
|
9
|
-
import u from "clsx";
|
|
10
|
-
import { mergeRefs as h } from "react-merge-refs";
|
|
11
|
-
import { ErrorBoundary as b } from "react-error-boundary";
|
|
12
|
-
import { useSnackbar as g, SnackbarContent as w, SnackbarProvider as f } from "notistack";
|
|
13
|
-
import { useTheme as y, ThemeProvider as x } from "@mui/material/styles/index.js";
|
|
14
|
-
import { Card as C, CardActions as D, Typography as W, IconButton as E, Collapse as v, Box as S, SvgIcon as M, CssBaseline as T } from "@mui/material";
|
|
15
|
-
import { PartialError as L, CommonUtils as O, UndoManager as F, Workbook as I } from "@sheetxl/sdk";
|
|
16
|
-
import { _ as P, P as A, E as j, a as N, t as R, j as _, d as U, F as H, T as K, WorkbookIO as $, U as G, b as z, N as q, W as V, k as B, K as X, r as J, l as Y, V as Z, AppearanceCommandButton as Q, e as ee, Y as oe, c as te, X as ne, f as re, g as ae, useResolvedThemeMode as se, ThemeMode as ie, u as le, h as ce, i as de, L as pe, m as me, y as ke, HelpCommandButton as ue, o as he, n as be, $ as ge, p as we, WorkbookTitle as fe, WorkbookElement as ye, M as xe, s as Ce } from "./index.mjs";
|
|
17
|
-
import { useMeasure as De } from "react-use";
|
|
18
|
-
import { ExpandMore as We, Close as Ee, CancelOutlined as ve } from "@mui/icons-material";
|
|
19
|
-
const Se = { card: "_card_1a398_7", actionRoot: "_actionRoot_1a398_11", icons: "_icons_1a398_16", expand: "_expand_1a398_22", expandOpen: "_expandOpen_1a398_29", stackTraceContainer: "_stackTraceContainer_1a398_33" }, Me = r((t2, n2) => {
|
|
20
|
-
const { id: r2, message: l2, iconVariant: c2, error: d2, hideIconVariant: p2, ...m2 } = t2, { closeSnackbar: k2 } = g(), h2 = y(), [b2, f2] = a(false), x2 = s(() => {
|
|
21
|
-
f2((e2) => !e2);
|
|
22
|
-
}, []), S2 = s(() => {
|
|
23
|
-
k2(r2);
|
|
24
|
-
}, [r2, k2]);
|
|
25
|
-
let M2 = d2?.message;
|
|
26
|
-
return !M2 && i(l2) && (M2 = l2), M2 || "string" != typeof l2 || (M2 = l2), M2 || (M2 = `Unknown Error: ${l2}`), e(w, { ref: n2, className: u(Se.root, "error-snackbar"), children: o(C, { className: Se.card, style: { backgroundColor: h2.palette.error.dark, border: `1px solid ${h2.palette.error.dark}` }, children: [o(D, { className: Se.actionRoot, children: [p2 ? null : c2?.error, e(W, { variant: "body2", component: "div", className: Se.typography, style: { color: h2.palette.text.primary }, children: M2 }), e("div", { style: { flex: "1 1 auto" } }), o("div", { className: Se.icons, children: [d2 ? e(E, { "aria-label": "Show more", size: "small", className: u(Se.expand, { [Se.expandOpen]: b2 }), style: { color: h2.palette.action.active }, onClick: x2, children: e(We, {}) }) : null, e(E, { size: "small", className: Se.expand, style: { color: h2.palette.action.active }, onClick: S2, children: e(Ee, { fontSize: "small" }) })] })] }), d2 ? e(v, { in: b2, timeout: "auto", unmountOnExit: true, children: e("div", { className: Se.stackTraceContainer, style: { backgroundColor: h2.palette.error.light, borderTop: `1px solid ${h2.palette.error.main}` }, children: e(P, { error: d2, hideLineNumbers: true }) }) }) : null] }) });
|
|
27
|
-
});
|
|
28
|
-
Me.displayName = "ToastError";
|
|
29
|
-
const Te = l(r((n2, r2) => {
|
|
30
|
-
const { commands: a2, commandHook: s2, scope: i2 = "workbook", disabled: l2 = false, ...d2 } = n2, p2 = A((n3) => {
|
|
31
|
-
const r3 = { variant: R.Menuitem, parentFloat: n3.floatReference, commandHook: s2, scope: i2, disabled: l2 }, d3 = o(t, { children: [e(j, { ...r3, command: a2.getCommand("newWorkbook"), icon: N(e(_, {})) }), e(U, { orientation: "horizontal" }), e(j, { ...r3, command: a2.getCommand("openWorkbook"), icon: N(e(H, {})) }), e(K, { ...r3, commands: a2, quickCommand: "saveWorkbook", icon: N(e(V, {})), createPopupPanel: (o2) => {
|
|
32
|
-
const t2 = { ...r3, parentFloat: o2.floatReference, scope: "saveWorkbook" }, n4 = [];
|
|
33
|
-
return $.getWriteFormats().forEach((o3) => {
|
|
34
|
-
if (o3.isDefault) return;
|
|
35
|
-
let r4 = null;
|
|
36
|
-
"CSV" === o3.key ? r4 = N(e(G, {})) : "Excel" === o3.key && (r4 = N(e(z, {})));
|
|
37
|
-
const s3 = a2.getCommand(`saveWorkbookAs${o3.key}`);
|
|
38
|
-
s3 ? n4.push(c(j, { ...t2, key: o3.key, command: s3, icon: r4 })) : console.warn(`Unable to resolve command: 'saveWorkbookAs${o3.key}'`);
|
|
39
|
-
}), q({ ...o2, children: n4, onClick: () => {
|
|
40
|
-
o2.closeFloatAll();
|
|
41
|
-
} });
|
|
42
|
-
} })] });
|
|
43
|
-
return q({ ...n3, children: d3, onClick: (e2) => {
|
|
44
|
-
e2.isDefaultPrevented || n3.closeFloatAll();
|
|
45
|
-
} });
|
|
46
|
-
}, [l2, a2, s2, i2]), m2 = "File";
|
|
47
|
-
return e(K, { commands: a2, disabled: l2, commandHook: s2, scope: i2, label: m2, tooltip: "Options for saving and loading the workbook.", sx: { paddingBottom: "0px", "& button": { paddingTop: "0px", paddingBottom: "0px", height: (e2) => `calc(1.25rem + ${e2.spacing(2)}px)` } }, ...d2, createPopupPanel: p2, icon: e(B, { className: "label", icon: null, label: m2 }) });
|
|
48
|
-
}));
|
|
49
|
-
Te.displayName = "StandaloneFileCommandButton";
|
|
50
|
-
const Le = e(Y, { label: "SheetXL", description: "Visit me at sheetxl.com.", children: e(S, { sx: { width: "24px", height: "24px", marginBottom: "4px", marginLeft: "6px" }, children: e(Z, { onClick: () => {
|
|
51
|
-
window?.open("https://www.sheetxl.com", "_blank");
|
|
52
|
-
}, style: { width: "24px", height: "24px", cursor: "pointer" } }) }) }), Oe = l(r((t2, n2) => {
|
|
53
|
-
const { commands: r2, workbook: a2, logo: s2 = Le, mainElement: i2, showFileMenu: l2 = true, showAppearanceMenu: c2 = true, ...m2 } = t2, { reference: k2 } = X(), [u2, { width: b2 }] = De(), g2 = b2 < 530, w2 = l2 ? e(Te, { commands: r2, commandHook: { beforeExecute() {
|
|
54
|
-
k2?.closeAll();
|
|
55
|
-
}, onError(e2, o2, t3) {
|
|
56
|
-
} } }) : null, f2 = c2 ? e(Q, { commands: r2, commandHook: { beforeExecute() {
|
|
57
|
-
k2?.closeAll();
|
|
58
|
-
}, onError(e2, o2, t3) {
|
|
59
|
-
} } }) : null, y2 = d(() => ({ paddingLeft: (e2) => e2.spacing(1), paddingRight: (e2) => e2.spacing(1) }), []), x2 = p(null);
|
|
60
|
-
return e(S, { ref: h([x2, u2, n2]), ...m2, children: J({ commands: r2, renderCompact: g2, workbook: a2, selectWrapper: (t3) => o(S, { sx: { display: "flex", flex: "1", flexDirection: "row", alignItems: "stretch", gap: (e2) => e2.spacing(1), paddingLeft: (e2) => e2.spacing(1), paddingRight: (e2) => e2.spacing(1) }, children: [o(S, { sx: { display: "flex", flexDirection: "row", alignItems: "center", flex: "1 1 100%", gap: (e2) => e2.spacing(0.5) }, children: [s2, o(S, { sx: { display: "flex", flexDirection: "row", alignItems: "center", gap: (e2) => e2.spacing(0.25) }, children: [w2, t3] })] }), e(S, { sx: { display: "flex", flexDirection: "row", flex: "1 1 300%", overflow: "hidden", alignItems: "center", justifyContent: "center" }, children: i2 }), e(S, { sx: { display: "flex", alignItems: "center", justifyContent: "end", flex: g2 && !f2 ? "0 0 auto" : "1 1 100%" }, children: f2 })] }), selectProps: y2, toolbarsProps: { Home: { sx: {} } } }) });
|
|
61
|
-
}));
|
|
62
|
-
Oe.displayName = "StudioToolbar";
|
|
63
|
-
const Fe = l(r((r2, i2) => {
|
|
64
|
-
const { workbook: l2, setWorkbook: c2, refWorkbookTitle: k2, titleWorkbook: u2, setWorkbookTitle: h2, titlePlaceHolder: b2, children: w2, undoManager: f2, commands: y2, importExportDisabled: x2, themeOptions: C2 } = r2, D2 = g(), W2 = D2 ? D2.enqueueSnackbar : () => {
|
|
65
|
-
}, v2 = D2 ? D2.closeSnackbar : () => {
|
|
66
|
-
}, [S2, M2] = a({ isMounted: false, label: null, starting: /* @__PURE__ */ new Map(), running: /* @__PURE__ */ new Map() }), T2 = s(() => {
|
|
67
|
-
M2((e2) => ({ ...e2, isMounted: true }));
|
|
68
|
-
}, []), O2 = s(() => {
|
|
69
|
-
M2((e2) => ({ ...e2, isMounted: false }));
|
|
70
|
-
}, []), F2 = ce(), I2 = de(), P2 = pe(), j2 = p(/* @__PURE__ */ new Set()), N2 = d(() => {
|
|
71
|
-
const o2 = (o3, t2) => {
|
|
72
|
-
if (t2?.onceKey) {
|
|
73
|
-
if (j2.current.has(t2.onceKey)) return;
|
|
74
|
-
const e2 = new Set(j2.current);
|
|
75
|
-
e2.add(t2.onceKey), j2.current = e2;
|
|
76
|
-
}
|
|
77
|
-
const n2 = { variant: t2?.type ?? he.Info, anchorOrigin: { vertical: "top", horizontal: "center" }, preventDuplicate: t2?.preventDuplicate, persist: t2?.persist ?? t2?.type === he.Error, action: (o4) => e(E, { onClick: () => v2(o4), children: e(ve, {}) }) };
|
|
78
|
-
t2?.enqueueProps && Object.assign(n2, t2.enqueueProps), o3 || console.log("message is 'null'", t2), W2(o3 ?? "Alert", n2);
|
|
79
|
-
};
|
|
80
|
-
return { showMessage: o2, showBusy: (e2, o3) => {
|
|
81
|
-
let t2 = null;
|
|
82
|
-
const n2 = new Promise((e3) => {
|
|
83
|
-
t2 = e3;
|
|
84
|
-
});
|
|
85
|
-
return M2((o4) => {
|
|
86
|
-
const r3 = new Map(o4.starting);
|
|
87
|
-
r3.set(n2, t2);
|
|
88
|
-
return { ...o4, label: e2, starting: r3 };
|
|
89
|
-
}), n2;
|
|
90
|
-
}, showWindow: (e2, o3, t2) => {
|
|
91
|
-
const n2 = { ...o3, onKeyDown: (e3) => {
|
|
92
|
-
y2?.dispatchToFocusedCommand(e3), e3.isDefaultPrevented() || e3.isPropagationStopped() || o3?.onKeyDown?.(e3);
|
|
93
|
-
} };
|
|
94
|
-
return F2(e2, { sort: () => import("./wsJBzsqfI7PB1hMT.mjs"), numberFormat: () => import("./tOKSFYpLW-UAq6Gt.mjs"), hyperlink: () => import("./p6vc6u8VPkFyCsYx.mjs"), comments: () => import("./D9XxEDOFeim_xxQE.mjs"), find: () => import("./Dc--wbPxmu3D8pbK.mjs"), tableDetails: () => import("./DhG888jHVhaxSY8F.mjs"), tableNew: () => import("./bMROCCq764fn-xgi.mjs"), namedDetails: () => import("./M1FpuPZr9_2AafMV.mjs") }[e2], n2, t2);
|
|
95
|
-
}, showOptions: I2, showInputOptions: P2, showError: (e2) => {
|
|
96
|
-
let t2, n2 = he.Error, r3 = "Unknown Error";
|
|
97
|
-
"string" == typeof e2 ? r3 = e2 : e2 instanceof Error && (t2 = e2, e2.message && (r3 = e2.message)), e2 instanceof L && (n2 = he.Info), o2(r3, { type: n2, enqueueProps: { error: t2 } });
|
|
98
|
-
} };
|
|
99
|
-
}, []), R2 = s(() => {
|
|
100
|
-
}, []), _2 = ((e2) => {
|
|
101
|
-
const { workbook: o2, setWorkbook: t2, importExportDisabled: r3, workbookTitle: a2 = "export", setWorkbookTitle: i3, notifier: l3, requestWorkbookTitle: c3, themeOptions: p2, undoManager: k3, commands: u3, onExecute: h3 } = e2, b3 = A(p2?.onModeChange, [p2?.onModeChange]), g2 = A(p2?.onEnabledDarkGridChange, [p2?.onEnabledDarkGridChange]), w3 = A(p2?.onEnabledDarkImagesChange, [p2?.onEnabledDarkImagesChange]), f3 = A(async (e3 = null, o3 = null) => {
|
|
102
|
-
const t3 = [];
|
|
103
|
-
let n2, r4 = null, a3 = null;
|
|
104
|
-
if ("string" == typeof e3 ? a3 = e3 : r4 = e3, n2 = r4 ? e3 : await ee.openFileDialog(a3 ?? $.getAllReadFormatTypeAsString().join(",")), !n2) return null;
|
|
105
|
-
const s2 = { source: n2, createWorkbookOptions: o3, onWarning: (e4) => {
|
|
106
|
-
t3.push(e4);
|
|
107
|
-
} }, i4 = await $.read(s2, l3);
|
|
108
|
-
return t3.length > 0 && (l3?.showMessage?.("Some elements were not able to be imported. See console for details."), console.warn("Import warnings:\n" + t3.join("\n"))), i4;
|
|
109
|
-
}, [h3, l3, o2]), y3 = A(async (e3, o3, t3) => {
|
|
110
|
-
if (!o3 && c3) {
|
|
111
|
-
const o4 = await c3("Enter Workbook name to " + (t3.isDefault ? "Save." : `Export as ${t3.description}.`));
|
|
112
|
-
return null !== o4 && $.writeFile(o4, e3, { formatType: t3.key });
|
|
113
|
-
}
|
|
114
|
-
return $.writeFile(o3, e3, { formatType: t3.key });
|
|
115
|
-
}, [l3, o2, c3]), x3 = s(() => ({ contains: (e3) => true, focus() {
|
|
116
|
-
} }), []), C3 = d(() => {
|
|
117
|
-
const e3 = [];
|
|
118
|
-
r3 || ($.getWriteFormats().forEach((t3) => {
|
|
119
|
-
const n3 = t3.isDefault, r4 = { label: n3 ? "Save Workbook" : `Save Workbook as ${t3.description}`, scopedLabels: { workbook: "Save", saveWorkbook: `as ${t3.description}` }, tags: t3.tags, description: `Save the workbook to the desktop${n3 ? "" : ` as ${t3.description}`}.` };
|
|
120
|
-
n3 && (r4.shortcut = { key: "S", modifiers: [te.Ctrl] }, e3.push(new oe("saveWorkbookAs", x3, { label: "Save Workbook As…", scopedLabels: { workbook: "Save as…", saveWorkbook: "as…" }, shortcut: [{ key: "S", modifiers: [te.Shift, te.Ctrl] }, { key: "F12" }], description: "Save the workbook to the desktop with the provided name." }, () => {
|
|
121
|
-
y3(o2, null, t3).catch((e4) => {
|
|
122
|
-
l3?.showError?.(e4);
|
|
123
|
-
});
|
|
124
|
-
})));
|
|
125
|
-
const s2 = n3 ? "saveWorkbook" : `saveWorkbookAs${t3.key}`;
|
|
126
|
-
e3.push(new oe(s2, x3, r4, (e4) => {
|
|
127
|
-
y3(o2, e4 ?? a2, t3).catch((e5) => {
|
|
128
|
-
l3?.showError?.(e5);
|
|
129
|
-
});
|
|
130
|
-
}));
|
|
131
|
-
}), e3.push(new oe("openWorkbook", x3, { label: "Open Workbook…", scopedLabels: { workbook: "Open…" }, description: "Open a workbook from the desktop.", shortcut: { key: "O", modifiers: [te.Ctrl] } }, async (e4 = null) => {
|
|
132
|
-
const n3 = { date1904: o2.isDate1904(), ...o2.options };
|
|
133
|
-
try {
|
|
134
|
-
const r4 = await f3(e4, n3);
|
|
135
|
-
if (!r4) return;
|
|
136
|
-
const a3 = r4.title, s2 = r4.workbook, c4 = s2.getSelectedSheet();
|
|
137
|
-
if ("text/csv" === r4.formatType.mimeType) {
|
|
138
|
-
const e5 = o2.findValidSheetName(a3);
|
|
139
|
-
await o2.doBatch(async () => {
|
|
140
|
-
const t3 = c4.getUsedRange();
|
|
141
|
-
if (!t3) return void l3?.showMessage("The file appears to be blank.");
|
|
142
|
-
const n4 = o2.getSheets().add({ name: e5, autoSelect: true }).getRange({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 });
|
|
143
|
-
await n4.copyFrom(t3);
|
|
144
|
-
}, `Import CSV '${a3}'`);
|
|
145
|
-
} else o2?.close(), i3?.(a3), t2(s2);
|
|
146
|
-
} catch (e5) {
|
|
147
|
-
l3?.showError?.(e5);
|
|
148
|
-
}
|
|
149
|
-
})), e3.push(new oe("openWorkbookFromUrl", x3, { label: "Open Workbook From Web", scopedLabels: { insert: "From Web", workbook: "From Web…" }, description: "Open a workbook from the web." }, async function(e4) {
|
|
150
|
-
if (!e4) {
|
|
151
|
-
const o3 = await l3?.showInputOptions?.({ title: "Open Workbook from the Web", description: "Enter the web address for the workbook to open.", inputLabel: "Address", initialValue: "https://www.sheetxl.com/examples/features-checklist.xlsx", inputProps: { style: { minWidth: "440px" } }, options: ["Open"] });
|
|
152
|
-
if ("Open" !== o3.option) return;
|
|
153
|
-
e4 = o3.input;
|
|
154
|
-
}
|
|
155
|
-
e4 && console.log("openWorkbookFromUrl", e4);
|
|
156
|
-
})));
|
|
157
|
-
let n2 = [];
|
|
158
|
-
return p2 && (n2 = [new oe("themeMode", x3, { label: "Light/Dark Mode", scopedLabels: { appearance: "Light/Dark Mode" }, description: "Toggle the application styling between light and dark mode." }), new oe("defaultThemeMode", x3, { label: "Use System Light/Dark Mode", scopedLabels: { appearance: "Use System Default" }, description: "Use the system settings to determine styling for light and dark mode." }), new oe("enableDarkGrid", x3, { label: "Enable Dark Grid", description: "Allow the grid to render in dark mode if dark mode is being used. This is ensures that the grid will render the colors as specified in another tools (for example Excel)." }), new oe("enableDarkImages", x3, { label: "Enable Dark Images", description: "Allow the images to render in dark mode if dark mode is being used. This is ensures that the images will render the colors as specified in another tools (for example Excel). This only has any effect if the grid is in dark mode." })]), [...e3, ...n2, new ne("help", x3, { label: "Show Help", description: "Provide Help.", shortcut: { key: "F1" } }, () => {
|
|
159
|
-
}), new ne("showKeyboardShortcuts", x3, { label: "Keyboard Shortcuts", description: "Show keyboard shortcuts.", shortcut: { key: "/", modifiers: [te.Ctrl] } }, () => {
|
|
160
|
-
}), new oe("gotoUrlGithub", x3, { label: "Github", description: "Download examples, explore source code, and leave a star." }, () => {
|
|
161
|
-
window?.open("https://github.com/sheetxl/sheetxl");
|
|
162
|
-
}), new oe("gotoUrlDiscord", x3, { label: "Discord", description: "Join our community on discord." }, () => {
|
|
163
|
-
window?.open("https://discord.gg/NTKdwUgK9p");
|
|
164
|
-
}), new oe("gotoUrlDocumentation", x3, { label: "Documentation", description: "Read the documentation." }, () => {
|
|
165
|
-
window?.open("https://www.sheetxl.com/docs");
|
|
166
|
-
}), new oe("gotoUrlIssue", x3, { label: "Create Issue", description: "Create an issue to identify a bug or a feature request." }, () => {
|
|
167
|
-
window?.open("https://github.com/sheetxl/sheetxl/issues");
|
|
168
|
-
})];
|
|
169
|
-
}, [o2, a2, l3, r3, p2, u3, k3]), D3 = d(() => {
|
|
170
|
-
let e3 = null;
|
|
171
|
-
return e3 = u3 ? u3.createChildGroup(x3, "standaloneWorkbook", false) : new re(x3, "standaloneWorkbook"), e3.addCommands(C3, true), e3;
|
|
172
|
-
}, [u3, C3]);
|
|
173
|
-
ae({ manager: k3, commands: D3, notifier: l3 });
|
|
174
|
-
const { themeMode: W3 } = se();
|
|
175
|
-
m(() => {
|
|
176
|
-
if (!p2 || !D3) return;
|
|
177
|
-
const e3 = "dark" === p2.mode || !p2.mode && "dark" === W3;
|
|
178
|
-
D3.getCommand("themeMode").update({ state: p2.mode ?? null, label: e3 ? "Dark Mode" : "Light Mode", scopedLabels: { appearance: e3 ? "Dark Mode" : "Light Mode" } }).updateCallback(() => {
|
|
179
|
-
b3(e3 ? ie.Light : ie.Dark);
|
|
180
|
-
}), D3.getCommand("defaultThemeMode").update({ state: !p2.mode }).updateCallback(() => {
|
|
181
|
-
b3(null);
|
|
182
|
-
}), D3.getCommand("enableDarkGrid").update({ state: p2.enableDarkGrid }).updateCallback(() => {
|
|
183
|
-
g2(!p2.enableDarkGrid);
|
|
184
|
-
}), D3.getCommand("enableDarkImages").update({ state: p2.enableDarkImages }).updateCallback(() => {
|
|
185
|
-
w3(!p2.enableDarkImages);
|
|
186
|
-
});
|
|
187
|
-
}, [W3, p2, C3]);
|
|
188
|
-
const { showModal: E2 } = le();
|
|
189
|
-
return m(() => {
|
|
190
|
-
const e3 = () => new Promise((e4, o3) => {
|
|
191
|
-
const t3 = n.lazy(() => import("./Clurk3ikkAHRiukp.mjs")), r4 = E2(t3, { title: "Shortcut Keys Reference", commands: D3, onDone: () => {
|
|
192
|
-
r4.hide();
|
|
193
|
-
}, TransitionProps: { onExited: () => {
|
|
194
|
-
e4(true);
|
|
195
|
-
} } });
|
|
196
|
-
});
|
|
197
|
-
D3.getCommand("showKeyboardShortcuts").updateCallback(() => e3()), D3.getCommand("help").updateCallback(() => e3());
|
|
198
|
-
}, [C3, D3]), D3;
|
|
199
|
-
})({ workbook: l2, setWorkbook: c2, importExportDisabled: x2, workbookTitle: u2, setWorkbookTitle: h2, commands: y2, requestWorkbookTitle: (e2) => new Promise((o2) => {
|
|
200
|
-
k2.current ? k2.current.requestWorkbookTitle((e3, t2) => {
|
|
201
|
-
o2(e3);
|
|
202
|
-
}, { selectAll: true, requestReason: e2 }) : o2(b2);
|
|
203
|
-
}), themeOptions: C2, undoManager: f2, notifier: N2, onExecute: R2 });
|
|
204
|
-
m(() => {
|
|
205
|
-
S2.starting.size <= 0 || !S2.isMounted || M2((e2) => {
|
|
206
|
-
const o2 = new Map(e2.running);
|
|
207
|
-
e2.starting.forEach((e3, t2) => {
|
|
208
|
-
const n2 = () => {
|
|
209
|
-
M2((e4) => {
|
|
210
|
-
const o3 = new Map(e4.running);
|
|
211
|
-
o3.delete(t2);
|
|
212
|
-
return { ...e4, running: o3 };
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
o2.set(t2, n2), e3(n2);
|
|
216
|
-
});
|
|
217
|
-
return { ...e2, starting: /* @__PURE__ */ new Map(), running: o2 };
|
|
218
|
-
});
|
|
219
|
-
}, [S2]);
|
|
220
|
-
const [U2, H2] = a(null);
|
|
221
|
-
m(() => {
|
|
222
|
-
0 !== S2.starting.size || 0 !== S2.running.size ? H2(e(me, { icon: e(ke, { sx: { transform: "scale(0.7)", marginLeft: "-6px" } }), panel: true, label: S2.label, onMount: T2, onUnmount: O2, sx: { position: "absolute", left: "0", top: "0", width: "100%", height: "100%", zIndex: "9999" } })) : H2(null);
|
|
223
|
-
}, [S2.starting, S2.running]);
|
|
224
|
-
const K2 = d(() => e(ue, { commands: _2, disableHover: true, sx: { padding: "0" }, buttonProps: { sx: { maxHeight: "22px" } } }), [_2]), G2 = { notifier: N2, commands: _2 };
|
|
225
|
-
return l2 && (G2.statusBarProps = { childrenEnd: K2 }), o(t, { children: [U2, w2 ? n.cloneElement(w2, G2) : null] });
|
|
226
|
-
}));
|
|
227
|
-
Fe.displayName = "SnackbarAndCommandsWrapper";
|
|
228
|
-
const Ie = l(r((t2, n2) => {
|
|
229
|
-
const { className: r2, sx: i2, style: l2, onElementLoad: c2, onError: g2, undoManager: w2, errorPanel: y2 = be, onKeyDown: C2, workbook: D2, createWorkbookOptions: W2, onWorkbookChange: E2, logo: v2, importExportDisabled: L2 = false, themeOptions: P2, autoFocus: j2 = false, commands: N2, title: R2, onTitleChange: _2, titleProps: U2, renderLoadingPanel: H2, ...K2 } = t2, G2 = p(null), z2 = A(E2, [E2]), q2 = A(_2 ?? U2?.onTitleChange, [_2 ?? U2?.onTitleChange]), V2 = U2?.placeHolder ?? "Untitled", B2 = P2?.mode, { themeMode: X2, source: J2 } = se({ mode: B2 }), Y2 = d(() => ({ ...P2, light: ge(false, O.deepMerge(P2?.theme ?? {}, P2?.light ?? {})), dark: ge(true, O.deepMerge(P2?.theme ?? {}, P2?.dark ?? {})) }), [P2]), Z2 = X2 === ie.Dark, [Q2, ee2] = a(null);
|
|
230
|
-
m(() => {
|
|
231
|
-
ee2(w2 ?? new F());
|
|
232
|
-
}, [w2]);
|
|
233
|
-
const [oe2, te2] = a(null), [ne2, ae2] = a(null), le2 = we();
|
|
234
|
-
k(() => {
|
|
235
|
-
if (!D2 || 0 === Object.keys(D2).length && !O.isPromiseLike(D2)) {
|
|
236
|
-
const e2 = { theme: le2.getDefaultTheme(), ...W2 };
|
|
237
|
-
ae2(new I(e2));
|
|
238
|
-
} else ae2(D2);
|
|
239
|
-
}, [D2]), k(() => {
|
|
240
|
-
if (!ne2) return;
|
|
241
|
-
if (ne2 instanceof I) return te2({ workbook: ne2 }), void (D2 !== ne2 && z2?.(ne2));
|
|
242
|
-
(async () => {
|
|
243
|
-
try {
|
|
244
|
-
let e2, o2 = await Promise.resolve(ne2);
|
|
245
|
-
o2 && o2.source && (o2 = await $.read(o2)), o2.workbook ? (ue2(o2.title), e2 = o2.workbook) : e2 = o2, z2?.(e2), te2({ workbook: e2 });
|
|
246
|
-
} catch (e2) {
|
|
247
|
-
z2?.(null), te2({ error: e2 });
|
|
248
|
-
}
|
|
249
|
-
})();
|
|
250
|
-
}, [ne2]);
|
|
251
|
-
const [ce2, de2] = a(null);
|
|
252
|
-
m(() => {
|
|
253
|
-
if (!Q2 || !oe2) return;
|
|
254
|
-
Q2.clear();
|
|
255
|
-
const e2 = oe2?.workbook?.getTransactions();
|
|
256
|
-
if (!e2) return;
|
|
257
|
-
return e2.addListener({ onCommitEnd: (o2) => {
|
|
258
|
-
o2.getDescription() ? Q2.addUndoOperation({ description: o2.getDescription(), undo: () => (e2.revert(o2.getId()), ce2.source?.focus(), () => {
|
|
259
|
-
e2.restore(o2.getId()), ce2.source?.focus();
|
|
260
|
-
}) }) : console.warn("commit has no description", o2);
|
|
261
|
-
} });
|
|
262
|
-
}, [Q2, oe2, ce2]);
|
|
263
|
-
const pe2 = A((e2) => {
|
|
264
|
-
e2 ? Q2.setRepeatableOperation({ description: e2.label(), repeat: async () => e2.execute() }) : Q2.setRepeatableOperation(null);
|
|
265
|
-
}, [Q2]), [ke2, ue2] = a(R2 ?? U2?.title ?? "");
|
|
266
|
-
m(() => {
|
|
267
|
-
ue2(R2 ?? U2?.title ?? "");
|
|
268
|
-
}, [R2 ?? U2?.title]), m(() => {
|
|
269
|
-
q2?.(ke2);
|
|
270
|
-
}, [ke2]);
|
|
271
|
-
const [he2, De2] = a(null), We2 = d(() => {
|
|
272
|
-
const e2 = () => ({ contains: (e3) => true, focus() {
|
|
273
|
-
} });
|
|
274
|
-
return N2 ? N2.createChildGroup(e2, "application", false) : new re(e2, "application");
|
|
275
|
-
}, [N2]), Ee2 = A((e2) => {
|
|
276
|
-
De2(e2.source.getViewportElement()), de2(e2), We2.activate("sheet"), c2?.(e2);
|
|
277
|
-
}, [We2]);
|
|
278
|
-
m(() => {
|
|
279
|
-
ce2 && j2 && ce2.source?.focus("object" == typeof j2 ? j2 : void 0);
|
|
280
|
-
}, [ce2]);
|
|
281
|
-
const ve2 = p(null), Se2 = s((o2) => {
|
|
282
|
-
let t3 = null;
|
|
283
|
-
return U2?.hidden || (t3 = e(fe, { ...U2, style: { maxWidth: "100%", ...U2?.style }, workbook: G2.current, ref: ve2, title: ke2, placeHolder: V2, onTitleChange: (e2) => {
|
|
284
|
-
ue2(e2);
|
|
285
|
-
} })), e(Oe, { ...o2, logo: v2, mainElement: t3, showFileMenu: !L2, showAppearanceMenu: !!(Y2?.onEnabledDarkGridChange || Y2?.onEnabledDarkImagesChange || Y2?.onModeChange) });
|
|
286
|
-
}, [v2, ke2, U2, Y2, L2, We2]);
|
|
287
|
-
m(() => {
|
|
288
|
-
const e2 = (e3) => e3.preventDefault();
|
|
289
|
-
return G2.current?.addEventListener("wheel", e2, { passive: false }), () => {
|
|
290
|
-
G2.current?.removeEventListener("wheel", e2);
|
|
291
|
-
};
|
|
292
|
-
}, []);
|
|
293
|
-
const Te2 = d(() => {
|
|
294
|
-
const o2 = { transparentBackground: true };
|
|
295
|
-
return e(S, { sx: i2, style: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, display: "flex", alignItems: "center", justifyContent: "center", ...l2 }, children: H2?.(o2) ?? e(me, { ...o2 }) });
|
|
296
|
-
}, [i2, l2, H2]), Le2 = s(({ error: o2 }) => (g2?.(o2), e(y2, { sx: i2, style: l2, error: o2 ?? "Unable to display empty workbook." })), [i2, l2, g2]), Ie2 = d(() => ({ ...i2, "& .SnackbarContainer-root": { position: "absolute !important" }, "& .notistack-Snackbar": { minWidth: "unset" }, "& .notistack-MuiContent *": { fontFamily: (e2) => e2.typography.fontFamily }, "& #notistack-snackbar": { maxWidth: "560px", whiteSpace: "pre-wrap" }, "*": { userSelect: "none" } }), [i2]), Pe = h([G2, n2]), Ae = d(() => {
|
|
297
|
-
if (!oe2) return Te2;
|
|
298
|
-
if (oe2.error || !oe2.workbook) return Le2({ error: oe2.error });
|
|
299
|
-
let o2 = null, t3 = null, n3 = false;
|
|
300
|
-
return Y2 && (o2 = Z2 ? Y2.dark : Y2.light, t3 = Z2 && Y2.enableDarkGrid ? Y2.dark : Y2.light, n3 = Y2.enableDarkImages), e(ye, { sx: Ie2, style: l2, tabIndex: 0, autoFocus: true, workbook: oe2.workbook, ref: Pe, renderToolbar: Se2, onElementLoad: Ee2, onRepeatCommandChange: pe2, onKeyDown: (e2) => {
|
|
301
|
-
C2?.(e2);
|
|
302
|
-
}, renderLoadingPanel: H2, gridTheme: t3, headersTheme: o2, enableDarkImages: n3, className: u(r2, "sheetxl-workbook"), onContextMenu: (e2) => e2.preventDefault(), ...K2 }, "WorkbookElement");
|
|
303
|
-
}, [oe2, ke2, Q2, Te2, H2, Y2, K2, Se2, Ie2]);
|
|
304
|
-
let je = e(b, { fallbackRender: Le2, children: e(f, { maxSnack: 3, domRoot: he2, anchorOrigin: { vertical: "bottom", horizontal: "right" }, autoHideDuration: 3500, onClose: (e2, o2, t3) => {
|
|
305
|
-
G2.current?.focus();
|
|
306
|
-
}, Components: { error: Me }, iconVariant: { success: e(M, { style: { marginRight: "8px" }, children: e("path", { d: "M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z" }) }), error: e(Ce, { style: { marginRight: "8px" } }) }, children: e(xe, { children: e(Fe, { workbook: oe2?.workbook, setWorkbook: ae2, importExportDisabled: L2, titlePlaceHolder: V2, titleWorkbook: ke2, setWorkbookTitle: ue2, refWorkbookTitle: ve2, commands: We2, undoManager: Q2, themeOptions: Y2, children: Ae }) }) }) });
|
|
307
|
-
return Y2 && (je = o(x, { theme: Z2 ? Y2.dark : Y2.light, children: [Y2.cssBaseline ? e(T, {}) : null, je] })), je;
|
|
308
|
-
}));
|
|
309
|
-
Ie.displayName = "EagerStudio";
|
|
310
|
-
export {
|
|
311
|
-
Ie as default
|
|
312
|
-
};
|