@sheetxl/studio-mui 0.4.7 → 0.4.8
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/{D2F5d-KqoX6K87V-.cjs → B9VxvukbesYhdTdA.cjs} +2 -2
- package/browser/cjs/{6ahm9L_JadTVTVKM.cjs → BA7HloSCkIjbJehh.cjs} +2 -2
- package/browser/cjs/BJN1sH87EvdxRpOd.cjs +12 -0
- package/browser/cjs/{ZmZmJzyx8f56di-3.cjs → BXt_O5ZSE2LpILmE.cjs} +3 -3
- package/browser/cjs/{C0rgKqf5wJGFF0Pn.cjs → BZUPFYECmoclErqJ.cjs} +2 -2
- package/browser/cjs/{DK6e7OLzcRQFuNAR.cjs → Ba7K1ZdzfgXpvg7P.cjs} +1 -1
- package/browser/cjs/{D0g5Yi1sFZedrm8U.cjs → C1NVH5bp1otDYHTC.cjs} +2 -2
- package/browser/cjs/{BbvqKmxn6Rum-bk6.cjs → C1wsDeHNaWiFlCZh.cjs} +6 -6
- package/browser/cjs/{sia-JpDs1OJx3UqA.cjs → C7YVj8dlBBL_wOM9.cjs} +1 -1
- package/browser/cjs/{DQRGxRYSOKOEByUm.cjs → CPtvdlvWWilf8Vep.cjs} +2 -2
- package/browser/cjs/{CnIoJa4rGjDIRDt_.cjs → CTokFqp-O-Uhl0LW.cjs} +1 -1
- package/browser/cjs/{x0gHCGm4Ua404wtj.cjs → CeRQ0zAM1Xczv7Gm.cjs} +2 -2
- package/browser/cjs/{CzHIyuIwxVQd9I_P.cjs → CiJS-8DphNBc_B9t.cjs} +2 -2
- package/browser/cjs/{x5DxzBmBRyolQW8p.cjs → Cuyl2HX5ovut6vef.cjs} +2 -2
- package/browser/cjs/Czcg6yLU8uVHew0l.cjs +6 -0
- package/browser/cjs/D7ntR8K8guZD6yMH.cjs +6 -0
- package/browser/cjs/{BULArqiBp4j5hxyx.cjs → DIKyZ-hkjeexXMzY.cjs} +1 -1
- package/browser/cjs/{ojTdNwa8dIIVVsYa.cjs → DNjiEJT8EtVysR2q.cjs} +1 -1
- package/browser/cjs/DTaaqEmMOO2QrfZF.cjs +87 -0
- package/browser/cjs/{CmX_3VyTiwTzdJhI.cjs → DkfygXp4ZgvLr3Yw.cjs} +2 -2
- package/browser/cjs/{BnHBKznz1O8QEPEE.cjs → NRKyHbS2cOhmoSox.cjs} +2 -2
- package/browser/cjs/{B5H9gNIHdOkSXNhX.cjs → dYzaARxDkWvC98N4.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/{CArewr_CDpxiRR66.cjs → k4ZW48PahXgf2WQD.cjs} +1 -1
- package/browser/cjs/z_x7DWNrjsFa45Nh.cjs +6 -0
- package/browser/cjs/{D5hBXjLlXQHJlC_R.cjs → znXBy3z9cM6mLfO7.cjs} +1 -1
- package/browser/esm/ABtrpK9yMoHh6oPr.mjs +864 -0
- package/browser/esm/{CAgqX2BO2DbnSbS0.mjs → BG3qcQNY_GZt3VHB.mjs} +2 -2
- package/browser/esm/{C2ogJhUgj6tBd2Ze.mjs → BG8pohDV-03DRiXx.mjs} +13 -13
- package/browser/esm/{DBhNx8LLdmzo5Avs.mjs → BYftsJS-zhpjBq1k.mjs} +2 -2
- package/browser/esm/{CJ46XJddcTe9sn3Q.mjs → Bd0yhfN0EoE3uahv.mjs} +2 -2
- package/browser/esm/{ww-U-PglTS7Dtu3g.mjs → CAvo3HCB981DM5OF.mjs} +2 -2
- package/browser/esm/{CIEN20sJj9GKW3yE.mjs → CHNZIKe6NNdfdZOr.mjs} +1 -1
- package/browser/esm/{D0TAETGiUzsAjxPY.mjs → CJxkcbtPJNL_Gloc.mjs} +16 -16
- package/browser/esm/{PjZRDfcmhPXxjS2K.mjs → COU2bYtN0WpsI4PY.mjs} +1 -1
- package/browser/esm/{CevfhoT-xtAPuMWS.mjs → CWtcMBj9hNKDPN_v.mjs} +2 -2
- package/browser/esm/{CMiuTssM0lBVhuJS.mjs → CzXTFr7g6RYXxPM1.mjs} +6 -6
- package/browser/esm/{DJJZ-Mz0hVMWcKq8.mjs → DIxDU9Lfq3hPWFPl.mjs} +2 -2
- package/browser/esm/{BSQXNtEzcvD1nZ07.mjs → DJBG1-2QdNbZKe_4.mjs} +7971 -7961
- package/browser/esm/{vs0v9un-v2S9Jnlo.mjs → DL8nFbYrab-MKQmF.mjs} +4 -4
- package/browser/esm/{DXbciCQNKY4_r5Et.mjs → DWOLWdzUONLf1nae.mjs} +1 -1
- package/browser/esm/{CRCvnu8AKE7fJq05.mjs → DatUamvfhoqxlf8D.mjs} +2 -2
- package/browser/esm/{BRio-IBtU98oZf5v.mjs → DdVyaTOGGjRcamT8.mjs} +1 -1
- package/browser/esm/{BgQK3a-xYWlmvNDD.mjs → DdzcCdPQ_zZbqH2p.mjs} +2 -2
- package/browser/esm/{DHsxjQ98xXj3tRTJ.mjs → DoDQcFwr66QfXlYi.mjs} +1 -1
- package/browser/esm/{54Y6CqDofk0Ryz8B.mjs → DwLP5jvXe3rwi5r2.mjs} +3 -3
- package/browser/esm/{D3DJPz0louDEmOOg.mjs → Dz_iWDlTCAECBFSF.mjs} +7 -7
- package/browser/esm/{BUxotxJXTYkCxXGj.mjs → GYPCajr96WY2V_je.mjs} +1 -1
- package/browser/esm/{BadcJIpfDDb6Oula.mjs → eq540RbNc68EuIvk.mjs} +1 -1
- package/browser/esm/index.mjs +26 -25
- package/browser/esm/{Ip_kfHi5bomcrUk6.mjs → lk_a0cAuz5HJsQKm.mjs} +1 -1
- package/browser/esm/{B5ZVjFCvGZMlskn5.mjs → zMjWIB_wUonhfIad.mjs} +2 -2
- package/licenses/dependencies.txt +6 -6
- package/node/esm/{D9INCGl89jNGldla.mjs → 0CnPehqlnzEMqDVS.mjs} +1 -1
- package/node/esm/{BeiZhSUAA8NyCua8.mjs → BFxNXzqwDw9mTzzX.mjs} +1 -1
- package/node/esm/{CTgcSkLGEwSlcrWM.mjs → BKkexYXFkC5jI1D4.mjs} +1 -1
- package/node/esm/{RPVynz_rpfz9lkAQ.mjs → BXF0I0KwKWFhkYfM.mjs} +7 -7
- package/node/esm/{CiFa6r-hL-KsSx0I.mjs → BpwzpczDCk32RxzY.mjs} +1 -1
- package/node/esm/{C2SG9zLSqOGo3vCR.mjs → C74xiDKgQep36e0D.mjs} +5 -5
- package/node/esm/{DQfxpSzOhUDp1tes.mjs → CE2Wff_Jx8m74lIm.mjs} +1 -1
- package/node/esm/{BK_IZrqK3_Xz2rfA.mjs → CVy5rNrHziJk0Xxc.mjs} +1 -1
- package/node/esm/{B_-60k30GZTVFJCG.mjs → ChbG8iQjvpz3jA7T.mjs} +1 -1
- package/node/esm/{xQKjfFNNUiXBnIeG.mjs → Cjw96KqgMSYqwdC4.mjs} +1 -1
- package/node/esm/{1YvclnJ1eNd7ibD-.mjs → ClUQ790AiAE9XIkY.mjs} +1 -1
- package/node/esm/{ClSJpKVPQuTKvJtg.mjs → D-Wu9vRF_DAsmME4.mjs} +14 -14
- package/node/esm/{DEtck55hesGlXNoj.mjs → D0ePiwz-m6oHmiUC.mjs} +1 -1
- package/node/esm/{BdwO--U2p6MiyekK.mjs → D4GNfE_QjFh3c9sT.mjs} +1 -1
- package/node/esm/DBDh50h4q3jgV4kn.mjs +312 -0
- package/node/esm/{BcfUxPgXAV1if9NT.mjs → DCLyoPsjP2qTWbca.mjs} +1 -1
- package/node/esm/{HAKu1GEoK2wZht5-.mjs → DTp1I9pWjg3-VyHr.mjs} +2 -2
- package/node/esm/{CJhxYk5D_7vcD7QG.mjs → DkTySui4bQaZlvaP.mjs} +1 -1
- package/node/esm/{BkzwNHPzd0DSf0FL.mjs → Dm3qRN9_dIcmeeTB.mjs} +19 -19
- package/node/esm/{DW9fZUq5TEVyK05B.mjs → cZHe3atogTKTMgvX.mjs} +1 -1
- package/node/esm/index.mjs +231 -221
- package/node/esm/{CVheJHEYC7Bxc-m9.mjs → q2jb3DavC5pzi-mZ.mjs} +1 -1
- package/node/esm/{DKqYePntZxW3fh6x.mjs → wxIEXtYch2hJq7Rz.mjs} +1 -1
- package/node/esm/{C-WOcvkTBKxqQfEZ.mjs → zfM7ir63qYOCXQWg.mjs} +20 -20
- package/package.json +8 -8
- package/types/index.d.ts +118 -81
- package/browser/cjs/Bi9ti1geH1gSoYX2.cjs +0 -6
- package/browser/cjs/Bt1aI3vb7h-PM53z.cjs +0 -6
- package/browser/cjs/CxMQIx_-k_XCclct.cjs +0 -87
- package/browser/cjs/DFkeNYQoyIagEEQ9.cjs +0 -6
- package/browser/cjs/iEu_JcRmrN7o_Gnt.cjs +0 -12
- package/browser/esm/BQoEwYUY9khnxsGk.mjs +0 -860
- package/node/esm/BlIGyiGNQyArtF2L.mjs +0 -308
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.7
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/
|
|
7
|
-
import { jsx as e, jsxs as o, Fragment as t } from "react/jsx-runtime";
|
|
8
|
-
import r, { forwardRef as n, useState as a, useCallback as s, memo as i, createElement as l, useMemo as c, useRef as d, useEffect as p, useLayoutEffect as m } from "react";
|
|
9
|
-
import h from "clsx";
|
|
10
|
-
import { mergeRefs as u } from "react-merge-refs";
|
|
11
|
-
import { ErrorBoundary as k } from "react-error-boundary";
|
|
12
|
-
import { useSnackbar as g, SnackbarContent as b, SnackbarProvider as f } from "notistack";
|
|
13
|
-
import { useTheme as w, ThemeProvider as y } from "@mui/material/styles/index.js";
|
|
14
|
-
import { Card as x, CardActions as C, Typography as M, IconButton as W, Collapse as L, Box as v, SvgIcon as S, CssBaseline as E } from "@mui/material";
|
|
15
|
-
import { PartialError as D, CommonUtils as T, UndoManager as F, Workbook as O } from "@sheetxl/sdk";
|
|
16
|
-
import { _ as I, P, E as A, a as N, t as j, j as R, d as _, F as U, T as H, WorkbookIO as K, U as G, b as $, N as z, W as q, k as V, K as B, r as X, l as J, V as Y, AppearanceCommandButton as Z, e as Q, Y as ee, c as oe, X as te, f as re, g as ne, useResolvedThemeMode as ae, ThemeMode as se, u as ie, h as le, i as ce, L as de, m as pe, y as me, HelpCommandButton as he, o as ue, n as ke, $ as ge, p as be, WorkbookTitle as fe, WorkbookElement as we, M as ye, s as xe } from "./index.mjs";
|
|
17
|
-
import { useMeasure as Ce } from "react-use";
|
|
18
|
-
import { ExpandMore as Me, Close as We, CancelOutlined as Le } from "@mui/icons-material";
|
|
19
|
-
const ve = { card: "_card_1a398_7", actionRoot: "_actionRoot_1a398_11", icons: "_icons_1a398_16", expand: "_expand_1a398_22", expandOpen: "_expandOpen_1a398_29", stackTraceContainer: "_stackTraceContainer_1a398_33" }, Se = n((t2, r2) => {
|
|
20
|
-
const { id: n2, message: i2, iconVariant: l2, error: c2, hideIconVariant: d2, ...p2 } = t2, { closeSnackbar: m2 } = g(), u2 = w(), [k2, f2] = a(false), y2 = s(() => {
|
|
21
|
-
f2((e2) => !e2);
|
|
22
|
-
}, []), v2 = s(() => {
|
|
23
|
-
m2(n2);
|
|
24
|
-
}, [n2, m2]), S2 = c2?.message || String(i2);
|
|
25
|
-
return e(b, { ref: r2, className: h(ve.root, "error-snackbar"), children: o(x, { className: ve.card, style: { backgroundColor: u2.palette.error.dark, border: `1px solid ${u2.palette.error.dark}` }, children: [o(C, { className: ve.actionRoot, children: [d2 ? null : l2?.error, e(M, { variant: "body2", component: "div", className: ve.typography, style: { color: u2.palette.text.primary }, children: S2 }), e("div", { style: { flex: "1 1 auto" } }), o("div", { className: ve.icons, children: [c2 ? e(W, { "aria-label": "Show more", size: "small", className: h(ve.expand, { [ve.expandOpen]: k2 }), style: { color: u2.palette.action.active }, onClick: y2, children: e(Me, {}) }) : null, e(W, { size: "small", className: ve.expand, style: { color: u2.palette.action.active }, onClick: v2, children: e(We, { fontSize: "small" }) })] })] }), c2 ? e(L, { in: k2, timeout: "auto", unmountOnExit: true, children: e("div", { className: ve.stackTraceContainer, style: { backgroundColor: u2.palette.error.light, borderTop: `1px solid ${u2.palette.error.main}` }, children: e(I, { error: c2, hideLineNumbers: true }) }) }) : null] }) });
|
|
26
|
-
});
|
|
27
|
-
Se.displayName = "ToastError";
|
|
28
|
-
const Ee = i(n((r2, n2) => {
|
|
29
|
-
const { commands: a2, commandHook: s2, scope: i2 = "workbook", disabled: c2 = false, ...d2 } = r2, p2 = P((r3) => {
|
|
30
|
-
const n3 = { variant: j.Menuitem, parentFloat: r3.floatReference, commandHook: s2, scope: i2, disabled: c2 }, d3 = o(t, { children: [e(A, { ...n3, command: a2.getCommand("newWorkbook"), icon: N(e(R, {})) }), e(_, { orientation: "horizontal" }), e(A, { ...n3, command: a2.getCommand("openWorkbook"), icon: N(e(U, {})) }), e(H, { ...n3, commands: a2, quickCommand: "saveWorkbook", icon: N(e(q, {})), createPopupPanel: (o2) => {
|
|
31
|
-
const t2 = { ...n3, parentFloat: o2.floatReference, scope: "saveWorkbook" }, r4 = [];
|
|
32
|
-
return K.getWriteFormats().forEach((o3) => {
|
|
33
|
-
if (o3.isDefault) return;
|
|
34
|
-
let n4 = null;
|
|
35
|
-
"CSV" === o3.key ? n4 = N(e(G, {})) : "Excel" === o3.key && (n4 = N(e($, {})));
|
|
36
|
-
const s3 = a2.getCommand(`saveWorkbookAs${o3.key}`);
|
|
37
|
-
s3 ? r4.push(l(A, { ...t2, key: o3.key, command: s3, icon: n4 })) : console.warn(`Unable to resolve command: 'saveWorkbookAs${o3.key}'`);
|
|
38
|
-
}), z({ ...o2, children: r4, onClick: () => {
|
|
39
|
-
o2.closeFloatAll();
|
|
40
|
-
} });
|
|
41
|
-
} })] });
|
|
42
|
-
return z({ ...r3, children: d3, onClick: (e2) => {
|
|
43
|
-
e2.isDefaultPrevented || r3.closeFloatAll();
|
|
44
|
-
} });
|
|
45
|
-
}, [c2, a2, s2, i2]), m2 = "File";
|
|
46
|
-
return e(H, { commands: a2, disabled: c2, 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(V, { className: "label", icon: null, label: m2 }) });
|
|
47
|
-
}));
|
|
48
|
-
Ee.displayName = "StandaloneFileCommandButton";
|
|
49
|
-
const De = e(J, { label: "SheetXL", description: "Visit me at sheetxl.com.", children: e(v, { sx: { width: "24px", height: "24px", marginBottom: "4px", marginLeft: "6px" }, children: e(Y, { onClick: () => {
|
|
50
|
-
window?.open("https://www.sheetxl.com", "_blank");
|
|
51
|
-
}, style: { width: "24px", height: "24px", cursor: "pointer" } }) }) }), Te = i(n((t2, r2) => {
|
|
52
|
-
const { commands: n2, workbook: a2, logo: s2 = De, mainElement: i2, showFileMenu: l2 = true, showAppearanceMenu: p2 = true, ...m2 } = t2, { reference: h2 } = B(), [k2, { width: g2 }] = Ce(), b2 = g2 < 530, f2 = l2 ? e(Ee, { commands: n2, commandHook: { beforeExecute() {
|
|
53
|
-
h2?.closeAll();
|
|
54
|
-
}, onError(e2, o2, t3) {
|
|
55
|
-
} } }) : null, w2 = p2 ? e(Z, { commands: n2, commandHook: { beforeExecute() {
|
|
56
|
-
h2?.closeAll();
|
|
57
|
-
}, onError(e2, o2, t3) {
|
|
58
|
-
} } }) : null, y2 = c(() => ({ paddingLeft: (e2) => e2.spacing(1), paddingRight: (e2) => e2.spacing(1) }), []), x2 = d(null);
|
|
59
|
-
return e(v, { ref: u([x2, k2, r2]), ...m2, children: X({ commands: n2, renderCompact: b2, workbook: a2, selectWrapper: (t3) => o(v, { 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(v, { sx: { display: "flex", flexDirection: "row", alignItems: "center", flex: "1 1 100%", gap: (e2) => e2.spacing(0.5) }, children: [s2, o(v, { sx: { display: "flex", flexDirection: "row", alignItems: "center", gap: (e2) => e2.spacing(0.25) }, children: [f2, t3] })] }), e(v, { sx: { display: "flex", flexDirection: "row", flex: "1 1 300%", overflow: "hidden", alignItems: "center", justifyContent: "center" }, children: i2 }), e(v, { sx: { display: "flex", alignItems: "center", justifyContent: "end", flex: b2 && !w2 ? "0 0 auto" : "1 1 100%" }, children: w2 })] }), selectProps: y2, toolbarsProps: { Home: { sx: {} } } }) });
|
|
60
|
-
}));
|
|
61
|
-
Te.displayName = "StandaloneWorkbookToolbar";
|
|
62
|
-
const Fe = i(n((n2, i2) => {
|
|
63
|
-
const { workbook: l2, setWorkbook: m2, refWorkbookTitle: h2, titleWorkbook: u2, setWorkbookTitle: k2, titlePlaceHolder: b2, children: f2, undoManager: w2, commands: y2, importExportDisabled: x2, themeModeOptions: C2 } = n2, M2 = g(), L2 = M2 ? M2.enqueueSnackbar : () => {
|
|
64
|
-
}, v2 = M2 ? M2.closeSnackbar : () => {
|
|
65
|
-
}, [S2, E2] = a({ isMounted: false, label: null, starting: /* @__PURE__ */ new Map(), running: /* @__PURE__ */ new Map() }), T2 = s(() => {
|
|
66
|
-
E2((e2) => ({ ...e2, isMounted: true }));
|
|
67
|
-
}, []), F2 = s(() => {
|
|
68
|
-
E2((e2) => ({ ...e2, isMounted: false }));
|
|
69
|
-
}, []), O2 = le(), I2 = ce(), A2 = de(), N2 = d(/* @__PURE__ */ new Set()), j2 = c(() => {
|
|
70
|
-
const o2 = (o3, t2) => {
|
|
71
|
-
if (t2?.onceKey) {
|
|
72
|
-
if (N2.current.has(t2.onceKey)) return;
|
|
73
|
-
const e2 = new Set(N2.current);
|
|
74
|
-
e2.add(t2.onceKey), N2.current = e2;
|
|
75
|
-
}
|
|
76
|
-
const r2 = { variant: t2?.type ?? ue.Info, anchorOrigin: { vertical: "top", horizontal: "center" }, preventDuplicate: t2?.preventDuplicate, persist: t2?.persist ?? t2?.type === ue.Error, action: (o4) => e(W, { onClick: () => v2(o4), children: e(Le, {}) }) };
|
|
77
|
-
t2?.enqueueProps && Object.assign(r2, t2.enqueueProps), o3 || console.log("message is 'null'", t2), L2(o3 ?? "Alert", r2);
|
|
78
|
-
};
|
|
79
|
-
return { showMessage: o2, showBusy: (e2, o3) => {
|
|
80
|
-
let t2 = null;
|
|
81
|
-
const r2 = new Promise((e3) => {
|
|
82
|
-
t2 = e3;
|
|
83
|
-
});
|
|
84
|
-
return E2((o4) => {
|
|
85
|
-
const n3 = new Map(o4.starting);
|
|
86
|
-
n3.set(r2, t2);
|
|
87
|
-
return { ...o4, label: e2, starting: n3 };
|
|
88
|
-
}), r2;
|
|
89
|
-
}, showWindow: (e2, o3, t2) => {
|
|
90
|
-
const r2 = { ...o3, onKeyDown: (e3) => {
|
|
91
|
-
y2?.dispatchToFocusedCommand(e3), e3.isDefaultPrevented() || e3.isPropagationStopped() || o3?.onKeyDown?.(e3);
|
|
92
|
-
} };
|
|
93
|
-
return O2(e2, { sort: () => import("./BcfUxPgXAV1if9NT.mjs"), numberFormat: () => import("./CTgcSkLGEwSlcrWM.mjs"), hyperlink: () => import("./1YvclnJ1eNd7ibD-.mjs"), comments: () => import("./DEtck55hesGlXNoj.mjs"), find: () => import("./C-WOcvkTBKxqQfEZ.mjs"), tableDetails: () => import("./ClSJpKVPQuTKvJtg.mjs"), tableNew: () => import("./BeiZhSUAA8NyCua8.mjs"), namedDetails: () => import("./BK_IZrqK3_Xz2rfA.mjs") }[e2], r2, t2);
|
|
94
|
-
}, showOptions: I2, showInputOptions: A2, showError: (e2) => {
|
|
95
|
-
let t2, r2 = ue.Error, n3 = "Unknown Error";
|
|
96
|
-
"string" == typeof e2 ? n3 = e2 : e2 instanceof Error && (t2 = e2, e2.message && (n3 = e2.message)), e2 instanceof D && (r2 = ue.Info), o2(n3, { type: r2, enqueueProps: { error: t2 } });
|
|
97
|
-
} };
|
|
98
|
-
}, []), R2 = s(() => {
|
|
99
|
-
}, []), _2 = ((e2) => {
|
|
100
|
-
const { workbook: o2, setWorkbook: t2, importExportDisabled: n3, workbookTitle: a2 = "export", setWorkbookTitle: i3, notifier: l3, requestWorkbookTitle: d2, themeModeOptions: m3, undoManager: h3, commands: u3, onExecute: k3 } = e2, g2 = P(m3?.onForceModeChange, [m3?.onForceModeChange]), b3 = P(m3?.onForceLightGridChange, [m3?.onForceLightGridChange]), f3 = P(m3?.onForceLightImagesChange, [m3?.onForceLightImagesChange]), w3 = P(async (e3 = null, o3 = null) => {
|
|
101
|
-
const t3 = [];
|
|
102
|
-
let r2, n4 = null, a3 = null;
|
|
103
|
-
if ("string" == typeof e3 ? a3 = e3 : n4 = e3, r2 = n4 ? e3 : await Q.openFileDialog(a3 ?? K.getAllReadFormatTypeAsString().join(",")), !r2) return null;
|
|
104
|
-
const s2 = { source: r2, constructorOptions: o3, onWarning: (e4) => {
|
|
105
|
-
t3.push(e4);
|
|
106
|
-
} }, i4 = await K.read(s2, l3);
|
|
107
|
-
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;
|
|
108
|
-
}, [k3, l3, o2]), y3 = P(async (e3, o3, t3) => {
|
|
109
|
-
if (!o3 && d2) {
|
|
110
|
-
const o4 = await d2("Enter Workbook name to " + (t3.isDefault ? "Save." : `Export as ${t3.description}.`));
|
|
111
|
-
return null !== o4 && K.writeFile(o4, e3, { formatType: t3.key });
|
|
112
|
-
}
|
|
113
|
-
return K.writeFile(o3, e3, { formatType: t3.key });
|
|
114
|
-
}, [l3, o2, d2]), x3 = s(() => ({ contains: (e3) => true, focus() {
|
|
115
|
-
} }), []), C3 = c(() => {
|
|
116
|
-
const e3 = [];
|
|
117
|
-
n3 || (K.getWriteFormats().forEach((t3) => {
|
|
118
|
-
const r3 = t3.isDefault, n4 = { label: r3 ? "Save Workbook" : `Save Workbook as ${t3.description}`, scopedLabels: { workbook: "Save", saveWorkbook: `as ${t3.description}` }, tags: t3.tags, description: `Save the workbook to the desktop${r3 ? "" : ` as ${t3.description}`}.` };
|
|
119
|
-
r3 && (n4.shortcut = { key: "S", modifiers: [oe.Ctrl] }, e3.push(new ee("saveWorkbookAs", x3, { label: "Save Workbook As…", scopedLabels: { workbook: "Save as…", saveWorkbook: "as…" }, shortcut: [{ key: "S", modifiers: [oe.Shift, oe.Ctrl] }, { key: "F12" }], description: "Save the workbook to the desktop with the provided name." }, () => {
|
|
120
|
-
y3(o2, null, t3).catch((e4) => {
|
|
121
|
-
l3?.showError?.(e4);
|
|
122
|
-
});
|
|
123
|
-
})));
|
|
124
|
-
const s2 = r3 ? "saveWorkbook" : `saveWorkbookAs${t3.key}`;
|
|
125
|
-
e3.push(new ee(s2, x3, n4, (e4) => {
|
|
126
|
-
y3(o2, e4 ?? a2, t3).catch((e5) => {
|
|
127
|
-
l3?.showError?.(e5);
|
|
128
|
-
});
|
|
129
|
-
}));
|
|
130
|
-
}), e3.push(new ee("openWorkbook", x3, { label: "Open Workbook…", scopedLabels: { workbook: "Open…" }, description: "Open a workbook from the desktop.", shortcut: { key: "O", modifiers: [oe.Ctrl] } }, async (e4 = null) => {
|
|
131
|
-
const r3 = { date1904: o2.isDate1904(), ...o2.options };
|
|
132
|
-
try {
|
|
133
|
-
const n4 = await w3(e4, r3);
|
|
134
|
-
if (!n4) return;
|
|
135
|
-
const a3 = n4.title, s2 = n4.workbook, c2 = s2.getSelectedSheet();
|
|
136
|
-
if ("text/csv" === n4.formatType.mimeType) {
|
|
137
|
-
const e5 = o2.findValidSheetName(a3);
|
|
138
|
-
await o2.doBatch(async () => {
|
|
139
|
-
const t3 = c2.getUsedRange();
|
|
140
|
-
if (!t3) return void l3?.showMessage("The file appears to be blank.");
|
|
141
|
-
const r4 = o2.getSheets().add({ name: e5, autoSelect: true }).getRange({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 });
|
|
142
|
-
await r4.copyFrom(t3);
|
|
143
|
-
}, `Import CSV '${a3}'`);
|
|
144
|
-
} else o2?.close(), i3?.(a3), t2(s2);
|
|
145
|
-
} catch (e5) {
|
|
146
|
-
l3?.showError?.(e5);
|
|
147
|
-
}
|
|
148
|
-
})), e3.push(new ee("openWorkbookFromUrl", x3, { label: "Open Workbook From Web", scopedLabels: { insert: "From Web", workbook: "From Web…" }, description: "Open a workbook from the web." }, async function(e4) {
|
|
149
|
-
if (!e4) {
|
|
150
|
-
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"] });
|
|
151
|
-
if ("Open" !== o3.option) return;
|
|
152
|
-
e4 = o3.input;
|
|
153
|
-
}
|
|
154
|
-
e4 && console.log("openWorkbookFromUrl", e4);
|
|
155
|
-
})));
|
|
156
|
-
let r2 = [];
|
|
157
|
-
return m3 && (r2 = [new ee("themeMode", x3, { label: "Light/Dark Mode", scopedLabels: { appearance: "Light/Dark Mode" }, description: "Toggle the application styling between light and dark mode." }), new ee("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 ee("forceLightGrid", x3, { label: "Force Light Grid", description: "Force the grid to always render in light 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 ee("forceLightImages", x3, { label: "Force Light Images", description: "Force the images to always render in light 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, ...r2, new te("help", x3, { label: "Show Help", description: "Provide Help.", shortcut: { key: "F1" } }, () => {
|
|
158
|
-
}), new te("showKeyboardShortcuts", x3, { label: "Keyboard Shortcuts", description: "Show keyboard shortcuts.", shortcut: { key: "/", modifiers: [oe.Ctrl] } }, () => {
|
|
159
|
-
}), new ee("gotoUrlGithub", x3, { label: "Github", description: "Download examples, explore source code, and leave a star." }, () => {
|
|
160
|
-
window?.open("https://github.com/sheetxl/sheetxl");
|
|
161
|
-
}), new ee("gotoUrlDiscord", x3, { label: "Discord", description: "Join our community on discord." }, () => {
|
|
162
|
-
window?.open("https://discord.gg/NTKdwUgK9p");
|
|
163
|
-
}), new ee("gotoUrlDocumentation", x3, { label: "Documentation", description: "Read the documentation." }, () => {
|
|
164
|
-
window?.open("https://www.sheetxl.com/docs");
|
|
165
|
-
}), new ee("gotoUrlIssue", x3, { label: "Create Issue", description: "Create an issue to identify a bug or a feature request." }, () => {
|
|
166
|
-
window?.open("https://github.com/sheetxl/sheetxl/issues");
|
|
167
|
-
})];
|
|
168
|
-
}, [o2, a2, l3, n3, m3, u3, h3]), M3 = c(() => {
|
|
169
|
-
let e3 = null;
|
|
170
|
-
return e3 = u3 ? u3.createChildGroup(x3, "standaloneWorkbook", false) : new re(x3, "standaloneWorkbook"), e3.addCommands(C3, true), e3;
|
|
171
|
-
}, [u3, C3]);
|
|
172
|
-
ne({ manager: h3, commands: M3, notifier: l3 });
|
|
173
|
-
const { themeMode: W2 } = ae();
|
|
174
|
-
p(() => {
|
|
175
|
-
if (!m3 || !M3) return;
|
|
176
|
-
const e3 = "dark" === m3.forceMode || !m3.forceMode && "dark" === W2;
|
|
177
|
-
M3.getCommand("themeMode").update({ state: m3.forceMode ?? null, label: e3 ? "Dark Mode" : "Light Mode", scopedLabels: { appearance: e3 ? "Dark Mode" : "Light Mode" } }).updateCallback(() => {
|
|
178
|
-
g2(e3 ? se.Light : se.Dark);
|
|
179
|
-
}), M3.getCommand("defaultThemeMode").update({ state: !m3.forceMode }).updateCallback(() => {
|
|
180
|
-
g2(null);
|
|
181
|
-
}), M3.getCommand("forceLightGrid").update({ state: m3.forceLightGrid }).updateCallback(() => {
|
|
182
|
-
b3(!m3.forceLightGrid);
|
|
183
|
-
}), M3.getCommand("forceLightImages").update({ state: m3.forceLightImages }).updateCallback(() => {
|
|
184
|
-
f3(!m3.forceLightImages);
|
|
185
|
-
});
|
|
186
|
-
}, [W2, m3, C3]);
|
|
187
|
-
const { showModal: L3 } = ie();
|
|
188
|
-
return p(() => {
|
|
189
|
-
const e3 = () => new Promise((e4, o3) => {
|
|
190
|
-
const t3 = r.lazy(() => import("./D9INCGl89jNGldla.mjs")), n4 = L3(t3, { title: "Shortcut Keys Reference", commands: M3, onDone: () => {
|
|
191
|
-
n4.hide();
|
|
192
|
-
}, TransitionProps: { onExited: () => {
|
|
193
|
-
e4(true);
|
|
194
|
-
} } });
|
|
195
|
-
});
|
|
196
|
-
M3.getCommand("showKeyboardShortcuts").updateCallback(() => e3()), M3.getCommand("help").updateCallback(() => e3());
|
|
197
|
-
}, [C3, M3]), M3;
|
|
198
|
-
})({ workbook: l2, setWorkbook: m2, importExportDisabled: x2, workbookTitle: u2, setWorkbookTitle: k2, commands: y2, requestWorkbookTitle: (e2) => new Promise((o2) => {
|
|
199
|
-
h2.current ? h2.current.requestWorkbookTitle((e3, t2) => {
|
|
200
|
-
o2(e3);
|
|
201
|
-
}, { selectAll: true, requestReason: e2 }) : o2(b2);
|
|
202
|
-
}), themeModeOptions: C2, undoManager: w2, notifier: j2, onExecute: R2 });
|
|
203
|
-
p(() => {
|
|
204
|
-
S2.starting.size <= 0 || !S2.isMounted || E2((e2) => {
|
|
205
|
-
const o2 = new Map(e2.running);
|
|
206
|
-
e2.starting.forEach((e3, t2) => {
|
|
207
|
-
const r2 = () => {
|
|
208
|
-
E2((e4) => {
|
|
209
|
-
const o3 = new Map(e4.running);
|
|
210
|
-
o3.delete(t2);
|
|
211
|
-
return { ...e4, running: o3 };
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
o2.set(t2, r2), e3(r2);
|
|
215
|
-
});
|
|
216
|
-
return { ...e2, starting: /* @__PURE__ */ new Map(), running: o2 };
|
|
217
|
-
});
|
|
218
|
-
}, [S2]);
|
|
219
|
-
const [U2, H2] = a(null);
|
|
220
|
-
p(() => {
|
|
221
|
-
0 !== S2.starting.size || 0 !== S2.running.size ? H2(e(pe, { icon: e(me, { sx: { transform: "scale(0.7)", marginLeft: "-6px" } }), panel: true, label: S2.label, onMount: T2, onUnmount: F2, sx: { position: "absolute", left: "0", top: "0", width: "100%", height: "100%", zIndex: "9999" } })) : H2(null);
|
|
222
|
-
}, [S2.starting, S2.running]);
|
|
223
|
-
const G2 = c(() => e(he, { commands: _2, disableHover: true, sx: { padding: "0" }, buttonProps: { sx: { maxHeight: "22px" } } }), [_2]), $2 = { notifier: j2, commands: _2 };
|
|
224
|
-
return l2 && ($2.statusBarProps = { childrenEnd: G2 }), o(t, { children: [U2, f2 ? r.cloneElement(f2, $2) : null] });
|
|
225
|
-
}));
|
|
226
|
-
Fe.displayName = "SnackbarAndCommandsWrapper";
|
|
227
|
-
const Oe = i(n((t2, r2) => {
|
|
228
|
-
const { className: n2, sx: i2, style: l2, onElementLoad: g2, onError: b2, undoManager: w2, errorPanel: x2 = ke, onKeyDown: C2, workbook: M2, createWorkbookOptions: W2, onWorkbookChange: L2, logo: v2, importExportDisabled: D2 = false, themeModeOptions: I2, autoFocus: A2 = false, commands: N2, title: j2, onTitleChange: R2, titleProps: _2, ...U2 } = t2, H2 = d(null), G2 = P(L2, [L2]), $2 = P(R2 ?? _2?.onTitleChange, [R2 ?? _2?.onTitleChange]), z2 = _2?.placeHolder ?? "Untitled", q2 = I2?.forceMode, { themeMode: V2, source: B2 } = ae({ mode: q2 }), X2 = c(() => ({ ...I2, light: ge(false, T.deepMerge(I2?.theme ?? {}, I2?.light ?? {})), dark: ge(true, T.deepMerge(I2?.theme ?? {}, I2?.dark ?? {})) }), [I2]), J2 = V2 === se.Dark, [Y2, Z2] = a(null);
|
|
229
|
-
p(() => {
|
|
230
|
-
Z2(w2 ?? new F());
|
|
231
|
-
}, [w2]);
|
|
232
|
-
const [Q2, ee2] = a(null), [oe2, te2] = a(null), ne2 = be();
|
|
233
|
-
m(() => {
|
|
234
|
-
if (!M2 || 0 === Object.keys(M2).length && !T.isPromiseLike(M2)) {
|
|
235
|
-
const e2 = { theme: ne2.getDefaultTheme(), ...W2 };
|
|
236
|
-
te2(new O(e2));
|
|
237
|
-
} else te2(M2);
|
|
238
|
-
}, [M2]), m(() => {
|
|
239
|
-
if (!oe2) return;
|
|
240
|
-
if (oe2 instanceof O) return ee2({ workbook: oe2 }), void (M2 !== oe2 && G2?.(oe2));
|
|
241
|
-
(async () => {
|
|
242
|
-
try {
|
|
243
|
-
let e2, o2 = await Promise.resolve(oe2);
|
|
244
|
-
o2 && o2.source && (o2 = await K.read(o2)), o2.workbook ? (me2(o2.title), e2 = o2.workbook) : e2 = o2, G2?.(e2), ee2({ workbook: e2 });
|
|
245
|
-
} catch (e2) {
|
|
246
|
-
G2?.(null), ee2({ error: e2 });
|
|
247
|
-
}
|
|
248
|
-
})();
|
|
249
|
-
}, [oe2]);
|
|
250
|
-
const [ie2, le2] = a(null);
|
|
251
|
-
p(() => {
|
|
252
|
-
if (!Y2 || !Q2) return;
|
|
253
|
-
Y2.clear();
|
|
254
|
-
const e2 = Q2?.workbook?.getTransactions();
|
|
255
|
-
if (!e2) return;
|
|
256
|
-
return e2.addListener({ onCommitEnd: (o2) => {
|
|
257
|
-
o2.getDescription() ? Y2.addUndoOperation({ description: o2.getDescription(), undo: () => (e2.revert(o2.getId()), ie2.source?.focus(), () => {
|
|
258
|
-
e2.restore(o2.getId()), ie2.source?.focus();
|
|
259
|
-
}) }) : console.warn("commit has no description", o2);
|
|
260
|
-
} });
|
|
261
|
-
}, [Y2, Q2, ie2]);
|
|
262
|
-
const ce2 = P((e2) => {
|
|
263
|
-
e2 ? Y2.setRepeatableOperation({ description: e2.label(), repeat: async () => e2.execute() }) : Y2.setRepeatableOperation(null);
|
|
264
|
-
}, [Y2]), [de2, me2] = a(j2 ?? _2?.title ?? "");
|
|
265
|
-
p(() => {
|
|
266
|
-
me2(j2 ?? _2?.title ?? "");
|
|
267
|
-
}, [j2 ?? _2?.title]), p(() => {
|
|
268
|
-
$2?.(de2);
|
|
269
|
-
}, [de2]);
|
|
270
|
-
const [he2, ue2] = a(null), Ce2 = c(() => {
|
|
271
|
-
const e2 = () => ({ contains: (e3) => true, focus() {
|
|
272
|
-
} });
|
|
273
|
-
return N2 ? N2.createChildGroup(e2, "application", false) : new re(e2, "application");
|
|
274
|
-
}, [N2]), Me2 = P((e2) => {
|
|
275
|
-
ue2(e2.source.getViewportElement()), le2(e2), Ce2.activate("sheet"), g2?.(e2);
|
|
276
|
-
}, [Ce2]);
|
|
277
|
-
p(() => {
|
|
278
|
-
ie2 && A2 && ie2.source?.focus("object" == typeof A2 ? A2 : void 0);
|
|
279
|
-
}, [ie2]);
|
|
280
|
-
const We2 = d(null), Le2 = s((o2) => {
|
|
281
|
-
let t3 = null;
|
|
282
|
-
return _2?.hidden || (t3 = e(fe, { ..._2, style: { maxWidth: "100%", ..._2?.style }, workbook: H2.current, ref: We2, title: de2, placeHolder: z2, onTitleChange: (e2) => {
|
|
283
|
-
me2(e2);
|
|
284
|
-
} })), e(Te, { ...o2, logo: v2, mainElement: t3, showFileMenu: !D2, showAppearanceMenu: !!(X2?.onForceLightGridChange || X2?.onForceLightImagesChange || X2?.onForceModeChange) });
|
|
285
|
-
}, [v2, de2, _2, X2, D2, Ce2]);
|
|
286
|
-
p(() => {
|
|
287
|
-
const e2 = (e3) => e3.preventDefault();
|
|
288
|
-
return H2.current?.addEventListener("wheel", e2, { passive: false }), () => {
|
|
289
|
-
H2.current?.removeEventListener("wheel", e2);
|
|
290
|
-
};
|
|
291
|
-
}, []);
|
|
292
|
-
const ve2 = c(() => e(pe, { transparentBackground: true, sx: i2, style: l2 }), [i2, l2]), Ee2 = s(({ error: o2 }) => (b2?.(o2), e(x2, { sx: i2, style: l2, error: o2 ?? "Unable to display empty workbook." })), [i2, l2, b2]), De2 = c(() => ({ ...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]), Oe2 = u([H2, r2]), Ie = c(() => {
|
|
293
|
-
if (!Q2) return ve2;
|
|
294
|
-
if (Q2.error || !Q2.workbook) return Ee2({ error: Q2.error });
|
|
295
|
-
let o2 = null, t3 = null, r3 = false;
|
|
296
|
-
return X2 && (o2 = J2 ? X2.dark : X2.light, t3 = J2 && !X2.forceLightGrid ? X2.dark : X2.light, r3 = X2.forceLightImages), e(we, { sx: De2, style: l2, tabIndex: 0, autoFocus: true, workbook: Q2.workbook, ref: Oe2, renderToolbar: Le2, onElementLoad: Me2, onRepeatCommandChange: ce2, onKeyDown: (e2) => {
|
|
297
|
-
C2?.(e2);
|
|
298
|
-
}, gridTheme: t3, headersTheme: o2, forceLightImages: r3, className: h(n2, "sheetxl-workbook"), onContextMenu: (e2) => e2.preventDefault(), ...U2 }, "WorkbookElement");
|
|
299
|
-
}, [Q2, de2, Y2, ve2, X2, U2, Le2, De2]);
|
|
300
|
-
let Pe = e(k, { fallbackRender: Ee2, children: e(f, { maxSnack: 3, domRoot: he2, anchorOrigin: { vertical: "bottom", horizontal: "right" }, autoHideDuration: 3500, onClose: (e2, o2, t3) => {
|
|
301
|
-
H2.current?.focus();
|
|
302
|
-
}, Components: { error: Se }, iconVariant: { success: e(S, { 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(xe, { style: { marginRight: "8px" } }) }, children: e(ye, { children: e(Fe, { workbook: Q2?.workbook, setWorkbook: te2, importExportDisabled: D2, titlePlaceHolder: z2, titleWorkbook: de2, setWorkbookTitle: me2, refWorkbookTitle: We2, commands: Ce2, undoManager: Y2, themeModeOptions: X2, children: Ie }) }) }) });
|
|
303
|
-
return X2 && (Pe = o(y, { theme: J2 ? X2.dark : X2.light, children: [X2.cssBaseline ? e(E, {}) : null, Pe] })), Pe;
|
|
304
|
-
}));
|
|
305
|
-
Oe.displayName = "EagerStandaloneWorkbook";
|
|
306
|
-
export {
|
|
307
|
-
Oe as default
|
|
308
|
-
};
|