@sheetxl/studio-mui 0.8.0-beta.10 → 0.8.0-beta.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/esm/0BWO0bLZ8Vm_dKd2.mjs +582 -0
- package/browser/esm/BAbq4-I5f5oUiNaF.mjs +141 -0
- package/browser/esm/BED6h6YAwCf1HEQJ.mjs +161 -0
- package/browser/esm/{CEvZe2cZK-voZTif.mjs → BXhNFzyEGokTF-BL.mjs} +5 -5
- package/browser/esm/BYE9gCDWKyx6mnVs.mjs +381 -0
- package/browser/esm/{DBtc4lku0uHVcqWn.mjs → BjvD_4t2KGsZP5V8.mjs} +3 -3
- package/browser/esm/{DU3J8Gcf-WpBxNYg.mjs → BknfGJouygmnpFIU.mjs} +4 -4
- package/browser/esm/{D8al_cJ4U-NgzwoK.mjs → BlE_8o8tO2AgAlaj.mjs} +19 -17
- package/browser/esm/BokqKEpU6TFgfRs6.mjs +252 -0
- package/browser/esm/{DHY19rkSiiRZxShC.mjs → Brsh5yscJ_4uKFXp.mjs} +3 -3
- package/browser/esm/Bujtz_Guj88d03vI.mjs +831 -0
- package/browser/esm/Buqcl7J75MJrhpVE.mjs +1379 -0
- package/browser/esm/BvhYPwX3GrRaO9CM.mjs +319 -0
- package/browser/esm/C0wlMAIn9iREPK6w.mjs +87 -0
- package/browser/esm/C8JU4KsMasmLvojI.mjs +103 -0
- package/browser/esm/{CjznclrKqJRi7u9O.mjs → C9pIZVACtl9unFOp.mjs} +2 -2
- package/browser/esm/CBD4RiRKbbZtSXV-.mjs +318 -0
- package/browser/esm/{Blaj2R5hYxtLAW__.mjs → CEtXsBzEjEKk9GOj.mjs} +6 -6
- package/browser/esm/{CIu1bjPJe_x31Oww.mjs → COlZu93LRwuBvjE-.mjs} +3 -3
- package/browser/esm/{CoSiOS-og0zFw4Ws.mjs → CTjqDD-swFMZzI-Y.mjs} +2 -2
- package/browser/esm/CWkOgdL7mOKiTR62.mjs +975 -0
- package/browser/esm/ChSVxkPTIjgcC8PL.mjs +412 -0
- package/browser/esm/{5cbK03T_Oh3tNdR7.mjs → ClBvNPeNCAhuVWrG.mjs} +1 -1
- package/browser/esm/CyLn6zOOp_biA3xU.mjs +335 -0
- package/browser/esm/CynTY0oNtyJnoaBq.mjs +14 -0
- package/browser/esm/{xKiLJKiLxto8SayF.mjs → D3rRUK4dIM5gUSmj.mjs} +2 -2
- package/browser/esm/D9ISy7VkaRRFJl46.mjs +515 -0
- package/browser/esm/{fb126BNj3F8URR19.mjs → DDc6rDuU9JAo1DH_.mjs} +3 -3
- package/browser/esm/DDczwkXhz_MHub4z.mjs +197 -0
- package/browser/esm/{X1Db3b_7b_7OuCk6.mjs → DEv4pIEgYr5C7etm.mjs} +1 -1
- package/browser/esm/DG21x7RKDpge6zAE.mjs +31 -0
- package/browser/esm/DJOOed_OtB-XT7f3.mjs +437 -0
- package/browser/esm/{9eKCkvqpMQwqcXiw.mjs → DKtJxrpN0axtuQ0l.mjs} +1 -1
- package/browser/esm/DRSCS6aLiYmPjUz1.mjs +1543 -0
- package/browser/esm/{ByeL_BZuJ2kl8gtf.mjs → DTpRkgsTm_zYnWfW.mjs} +1 -1
- package/browser/esm/DV6i9RQZfJiKtEaJ.mjs +2552 -0
- package/browser/esm/DdcZrjMLWVukWcU5.mjs +7473 -0
- package/browser/esm/Di3BUxA0SqFWWgeg.mjs +94 -0
- package/browser/esm/DnGaP5F7mLwCGUYG.mjs +408 -0
- package/browser/esm/DpD4fg2WcyiKX_2K.mjs +414 -0
- package/browser/esm/{C1Rp2hZrApo5MUc8.mjs → Ds3XRkne7HxcXD8J.mjs} +2 -2
- package/browser/esm/{sFOAxZpxXo-qvDSp.mjs → DsoNMWDwHZP8UXQd.mjs} +1 -1
- package/browser/esm/G0Inqm6Eqw47dMpa.mjs +212 -0
- package/browser/esm/{B1Yp_uy1vFHcJB3U.mjs → HViD4Wfoi0mmqk9w.mjs} +1 -1
- package/browser/esm/LZoYSQAYV2wksnDv.mjs +386 -0
- package/browser/esm/{CtEFHbzYNvYjDYvi.mjs → QgaAIDUMmBQBsXP9.mjs} +8 -8
- package/browser/esm/{D6S8kVTzOjCn0-SK.mjs → YThnrg3PadGs7B4j.mjs} +51 -51
- package/browser/esm/index.mjs +1028 -170
- package/browser/esm/ttjcNHcFn8O6hfnd.mjs +1288 -0
- package/browser/esm/{yZxC4qUENOlMhVUH.mjs → w_JrR69vEpvoyeMy.mjs} +1 -1
- package/browser/esm/{DmCQbW4zwkT_Rq88.mjs → xFqkfN8QMCxvsetB.mjs} +1 -1
- package/browser/esm/{IQLeaAbtGTipUsOD.mjs → zqilJefihVd7At2T.mjs} +22 -21
- package/licenses/dependencies.txt +94 -94
- package/node/esm/{BYsG3KYVmxSe_CIQ.mjs → 1bf4gn-2vld4BZ9u.mjs} +1 -1
- package/node/esm/{CKu1AtRgyltyEdEN.mjs → 3WghtBXAvCDwcVrq.mjs} +1 -1
- package/node/esm/{cqzp431iNSLWictb.mjs → 4HmLH0bPVJCZLgik.mjs} +22 -22
- package/node/esm/{BYVLi0md4AYuDsB_.mjs → B0bdb_6p7fQI_ivo.mjs} +28 -28
- package/node/esm/BIMkjQUwG4Ih-6Sh.mjs +142 -0
- package/node/esm/BNg4QQY0WAPLE0q7.mjs +141 -0
- package/node/esm/BPzcW4BejRqso338.mjs +72 -0
- package/node/esm/BR45ogAR-hY2bE60.mjs +318 -0
- package/node/esm/BlN7G0DVC24zauig.mjs +197 -0
- package/node/esm/{ah3CUg4-VmNstGk_.mjs → Bph-sR3l6AYWeuxK.mjs} +2 -2
- package/node/esm/CPq-MIdEnc-53JpF.mjs +319 -0
- package/node/esm/CSAnTp5rwId0DUb8.mjs +380 -0
- package/node/esm/CWcv7UVXF8IUB0PC.mjs +1379 -0
- package/node/esm/{D9rzScOA9pEYFrtz.mjs → CYIoK22I6Yvv12_x.mjs} +20 -20
- package/node/esm/CZyA9uD4SkTvqp_G.mjs +1283 -0
- package/node/esm/{ci8d-mF1H9wnYzix.mjs → CjC6s3RUJQNCF7mP.mjs} +1 -1
- package/node/esm/{D6oQL8knsPpgdXuk.mjs → CuMePia6i_8yfJ6S.mjs} +9 -9
- package/node/esm/CvRbu8JPxFarsSR-.mjs +412 -0
- package/node/esm/{DNSjK5DAH3M14Qbc.mjs → CyafafEgfmjLqE5O.mjs} +1 -1
- package/node/esm/D-xqQ5qOSd6WrzwJ.mjs +94 -0
- package/node/esm/DLqBHdFp6wvm6EGs.mjs +212 -0
- package/node/esm/{BcwMb6CyVfvEwbHn.mjs → DMXLxp3T0E0SRTQc.mjs} +1 -1
- package/node/esm/{DZzvTQxIKr9LbEsA.mjs → DWqvf4H5F2wMnZ0L.mjs} +32 -30
- package/node/esm/DatM6eEYPpAtIMy-.mjs +405 -0
- package/node/esm/Db3dbaYLKUO66T9s.mjs +1689 -0
- package/node/esm/{B_jRGdwGFkudwmL-.mjs → DdEzhVqYTrGODXrz.mjs} +1 -1
- package/node/esm/DeZJlLk8WJ3BLtLs.mjs +975 -0
- package/node/esm/DfCuL8AUxMFoEG2s.mjs +519 -0
- package/node/esm/{Bb1sLMqXWKjdve23.mjs → Do-zCKziWhoG5eAv.mjs} +2 -2
- package/node/esm/{B8SQfjKjzYHLxzZR.mjs → DpJ2gmZJioCyq8La.mjs} +67 -67
- package/node/esm/{ETK6T6G0SIcFXDe5.mjs → XEDcegsv5AGKBfu2.mjs} +40 -40
- package/node/esm/index.mjs +8941 -13558
- package/node/esm/yCUxQuqVuC4DHKPx.mjs +385 -0
- package/node/esm/zITjZ7R4raDqhP-n.mjs +515 -0
- package/package.json +9 -9
- package/resources/locales/de/ui.msg.json +97 -0
- package/resources/locales/en/ui.msg.json +97 -0
- package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +4 -4
- package/types/src/anomalies/AnomaliesPlugin.d.ts +5 -0
- package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
- package/types/src/anomalies/index.d.ts +3 -0
- package/types/src/border/BorderTemplateIcon.d.ts +6 -1
- package/types/src/chart/ChartFormatPanel.d.ts +20 -0
- package/types/src/chart/ChartPlugin.d.ts +6 -0
- package/types/src/chart/index.d.ts +3 -0
- package/types/src/comments/CommentCard.d.ts +2 -2
- package/types/src/conditions/useFormulaOption.d.ts +2 -2
- package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
- package/types/src/format/BorderPreview.d.ts +11 -4
- package/types/src/format/useFormatSelection.d.ts +4 -4
- package/types/src/formulaBar/MobileFormulaBar.d.ts +18 -6
- package/types/src/formulaBar/MobileInputToolbar.d.ts +9 -3
- package/types/src/formulaBar/useFormulaBarSession.d.ts +6 -3
- package/types/src/index.d.ts +15 -6
- package/types/src/protection/ProtectedCellsPanel.d.ts +2 -2
- package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
- package/types/src/protection/index.d.ts +1 -1
- package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +2 -2
- package/types/src/workbook/DefaultRenderers.d.ts +2 -2
- package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
- package/browser/esm/Biy7bhzzzPb5sfRN.mjs +0 -152
- package/browser/esm/COv-m-c2byCgvU3M.mjs +0 -14861
- package/browser/esm/Die9NXVFveHvcCT-.mjs +0 -4205
- package/browser/esm/sam1KGQZ59B_fADz.mjs +0 -1941
- package/node/esm/BYwXhrEwkRAt9nJS.mjs +0 -71
- package/node/esm/Cmt8Wv806N7NmE4Y.mjs +0 -3344
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.11
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { CommentCard as e } from "./index.mjs";
|
|
8
|
+
import { getCommentCoords as t, useModelListener as l, useSheetComments as o } from "@sheetxl/react";
|
|
9
|
+
import { DynamicIcon as n, usePersistentState as r, useTranslator as s } from "@sheetxl/utils-react";
|
|
10
|
+
import { memo as c, useEffect as i, useMemo as a, useRef as d, useState as m } from "react";
|
|
11
|
+
import { SimpleTooltip as u } from "@sheetxl/utils-mui";
|
|
12
|
+
import { Fragment as x, jsx as f, jsxs as h } from "react/jsx-runtime";
|
|
13
|
+
import { Box as p, Button as g, IconButton as y, ToggleButton as v, ToggleButtonGroup as k, Typography as C } from "@mui/material";
|
|
14
|
+
import { CoordUtils as I, messageKey as b } from "@sheetxl/utils";
|
|
15
|
+
var w = {
|
|
16
|
+
all: b("comment.filter.all"),
|
|
17
|
+
open: b("comment.filter.open"),
|
|
18
|
+
resolved: b("comment.filter.resolved")
|
|
19
|
+
}, N = Object.keys(w), S = "comments.filter", P = {
|
|
20
|
+
add: b("comment.new"),
|
|
21
|
+
addPrompt: b("comment.addPrompt"),
|
|
22
|
+
noMatches: b("comment.noMatches")
|
|
23
|
+
}, D = (e, t) => e.coords.rowIndex - t.coords.rowIndex || e.coords.colIndex - t.coords.colIndex, M = c((c) => {
|
|
24
|
+
const { model: b, args: M, defaultFilter: T = "all", entryKey: W, frame: j, ref: q, ...R } = c, F = s(), [H, K] = m(() => b?.getSelectedWorksheet() ?? null);
|
|
25
|
+
l(b, { onSheetsChange() {
|
|
26
|
+
K(b?.getSelectedWorksheet() ?? null);
|
|
27
|
+
} });
|
|
28
|
+
const [V, $] = r(S, T), [z, B] = m(!1), O = z ? "all" : N.includes(V) ? V : T, X = o(H, { resolved: "all" === O ? void 0 : "resolved" === O }), Y = o(H), [A, E] = m(null), [G, J] = m(null), [L, Q] = m(null), U = d(0), Z = d(/* @__PURE__ */ new Map());
|
|
29
|
+
l(H?.getSelection(), { onChange() {
|
|
30
|
+
Q(H?.getSelectedCell().getCoords() ?? null);
|
|
31
|
+
} });
|
|
32
|
+
const [_, ee] = m(H);
|
|
33
|
+
_ !== H && (ee(H), E(null), J(null));
|
|
34
|
+
const te = (e) => `${e.rowIndex},${e.colIndex}`, le = (e) => {
|
|
35
|
+
J({
|
|
36
|
+
key: e,
|
|
37
|
+
request: ++U.current
|
|
38
|
+
});
|
|
39
|
+
}, oe = () => {
|
|
40
|
+
if (!H) return;
|
|
41
|
+
const e = H.getSelectedCell(), l = e.getCoords();
|
|
42
|
+
if (!l) return;
|
|
43
|
+
const o = e.getComments();
|
|
44
|
+
if (!o?.isNote()) {
|
|
45
|
+
if (o) return B(!0), void le(te(t(o)));
|
|
46
|
+
E(l), le(te(l));
|
|
47
|
+
}
|
|
48
|
+
}, [ne, re] = m(void 0);
|
|
49
|
+
if (M !== ne) {
|
|
50
|
+
re(M);
|
|
51
|
+
const e = M?.focus;
|
|
52
|
+
!e || e.isDeleted() || e.isNote() ? M?.insert && oe() : (B(!0), le(te(t(e))));
|
|
53
|
+
}
|
|
54
|
+
const se = a(() => {
|
|
55
|
+
const e = X.map((e) => {
|
|
56
|
+
const l = t(e);
|
|
57
|
+
return {
|
|
58
|
+
key: te(l),
|
|
59
|
+
coords: l,
|
|
60
|
+
comment: e
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
return A && !Y.some((e) => te(t(e)) === te(A)) && (e.push({
|
|
64
|
+
key: te(A),
|
|
65
|
+
coords: A,
|
|
66
|
+
comment: null
|
|
67
|
+
}), e.sort(D)), e;
|
|
68
|
+
}, [
|
|
69
|
+
X,
|
|
70
|
+
Y,
|
|
71
|
+
A
|
|
72
|
+
]), ce = L ? te(L) : null, ie = G?.key ?? null, ae = G?.request ?? 0;
|
|
73
|
+
if (i(() => {
|
|
74
|
+
ce && Z.current.get(ce)?.scrollIntoView?.({ block: "nearest" });
|
|
75
|
+
}, [ce]), i(() => {
|
|
76
|
+
ie && Z.current.get(ie)?.scrollIntoView?.({ block: "nearest" });
|
|
77
|
+
}, [ie, ae]), !b || !H) return null;
|
|
78
|
+
const de = H.getSelectedCell().getComments(), me = 0 === se.length && 0 === Y.length;
|
|
79
|
+
return h(p, {
|
|
80
|
+
ref: q,
|
|
81
|
+
...R,
|
|
82
|
+
className: "sxl-comments-pane",
|
|
83
|
+
sx: {
|
|
84
|
+
display: "flex",
|
|
85
|
+
flexDirection: "column",
|
|
86
|
+
width: "100%",
|
|
87
|
+
minWidth: 0,
|
|
88
|
+
flex: "1 1 auto",
|
|
89
|
+
height: "100%",
|
|
90
|
+
minHeight: 0,
|
|
91
|
+
overflowX: "hidden"
|
|
92
|
+
},
|
|
93
|
+
children: [me ? null : h(p, {
|
|
94
|
+
sx: {
|
|
95
|
+
display: "flex",
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
gap: 1,
|
|
98
|
+
flex: "0 0 auto",
|
|
99
|
+
px: 1.5,
|
|
100
|
+
py: 1,
|
|
101
|
+
borderBottom: 1,
|
|
102
|
+
borderColor: "divider"
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
f(k, {
|
|
106
|
+
className: "sxl-comments-filter",
|
|
107
|
+
size: "small",
|
|
108
|
+
exclusive: !0,
|
|
109
|
+
value: O,
|
|
110
|
+
onChange: (e, t) => {
|
|
111
|
+
t && (B(!1), $(t));
|
|
112
|
+
},
|
|
113
|
+
children: N.map((e) => f(v, {
|
|
114
|
+
value: e,
|
|
115
|
+
sx: {
|
|
116
|
+
textTransform: "none",
|
|
117
|
+
py: .25,
|
|
118
|
+
px: 1
|
|
119
|
+
},
|
|
120
|
+
children: F(w[e])
|
|
121
|
+
}, e))
|
|
122
|
+
}),
|
|
123
|
+
f(p, { sx: { flex: "1 1 auto" } }),
|
|
124
|
+
f(u, {
|
|
125
|
+
disableInteractive: !0,
|
|
126
|
+
title: F(P.add),
|
|
127
|
+
children: f("span", { children: f(y, {
|
|
128
|
+
className: "sxl-comments-add",
|
|
129
|
+
"aria-label": F(P.add),
|
|
130
|
+
disabled: !!de?.isNote(),
|
|
131
|
+
onClick: oe,
|
|
132
|
+
children: f(n, { iconKey: "Insert" })
|
|
133
|
+
}) })
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
}), h(p, {
|
|
137
|
+
className: "sxl-comments-list",
|
|
138
|
+
sx: {
|
|
139
|
+
flex: "1 1 auto",
|
|
140
|
+
minHeight: 0,
|
|
141
|
+
overflowY: "auto",
|
|
142
|
+
display: "flex",
|
|
143
|
+
flexDirection: "column",
|
|
144
|
+
gap: 1,
|
|
145
|
+
p: 1.5,
|
|
146
|
+
pl: me ? 1.5 : 3.5
|
|
147
|
+
},
|
|
148
|
+
children: [me ? h(x, { children: [
|
|
149
|
+
f(p, { sx: { flex: "1 1 0" } }),
|
|
150
|
+
h(p, {
|
|
151
|
+
className: "sxl-comments-empty",
|
|
152
|
+
sx: {
|
|
153
|
+
display: "flex",
|
|
154
|
+
flex: "0 0 auto",
|
|
155
|
+
flexDirection: "column",
|
|
156
|
+
alignItems: "center",
|
|
157
|
+
alignSelf: "center",
|
|
158
|
+
gap: 2.5,
|
|
159
|
+
maxWidth: "min(360px, 90%)"
|
|
160
|
+
},
|
|
161
|
+
children: [f(C, {
|
|
162
|
+
variant: "body2",
|
|
163
|
+
align: "center",
|
|
164
|
+
children: F(P.addPrompt)
|
|
165
|
+
}), f(g, {
|
|
166
|
+
variant: "contained",
|
|
167
|
+
sx: { textTransform: "none" },
|
|
168
|
+
disabled: !!de?.isNote(),
|
|
169
|
+
onClick: oe,
|
|
170
|
+
children: F(P.add)
|
|
171
|
+
})]
|
|
172
|
+
}),
|
|
173
|
+
f(p, { sx: { flex: "1.5 1 0" } })
|
|
174
|
+
] }) : 0 === se.length ? f(C, {
|
|
175
|
+
variant: "body2",
|
|
176
|
+
sx: { color: "text.secondary" },
|
|
177
|
+
children: F(P.noMatches)
|
|
178
|
+
}) : null, se.map((t) => f(e, {
|
|
179
|
+
ref: (e) => {
|
|
180
|
+
e ? Z.current.set(t.key, e) : Z.current.delete(t.key);
|
|
181
|
+
},
|
|
182
|
+
sheet: H,
|
|
183
|
+
coords: t.coords,
|
|
184
|
+
comment: t.comment,
|
|
185
|
+
highlighted: t.key === ce,
|
|
186
|
+
focusRequest: t.key === ie ? ae : 0,
|
|
187
|
+
onSelect: () => {
|
|
188
|
+
H.getRange(I.cellToRange(t.coords)).select();
|
|
189
|
+
},
|
|
190
|
+
onClose: () => E(null),
|
|
191
|
+
onPosted: () => E(null)
|
|
192
|
+
}, t.key))]
|
|
193
|
+
})]
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
M.displayName = "CommentsTaskPane";
|
|
197
|
+
export { S as COMMENTS_FILTER_KEY, M as CommentsTaskPane, M as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.11
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { a as e, i as o, n as l, r as i, t } from "./
|
|
7
|
+
import { a as e, i as o, n as l, r as i, t } from "./DpJ2gmZJioCyq8La.mjs";
|
|
8
8
|
import { VERSION as n } from "@sheetxl/sdk";
|
|
9
9
|
import { LogoTextNoPaddingIcon as a } from "@sheetxl/react";
|
|
10
10
|
import { DynamicIcon as r, useTranslator as d } from "@sheetxl/utils-react";
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.11
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { t as e } from "./CSAnTp5rwId0DUb8.mjs";
|
|
8
|
+
import { PresetChip as t } from "./index.mjs";
|
|
9
|
+
import { externalBookFileName as n, externalBookLocation as r } from "@sheetxl/sdk";
|
|
10
|
+
import { DynamicIcon as a, NotifierType as i, useNotifier as l, useTranslator as s } from "@sheetxl/utils-react";
|
|
11
|
+
import { forwardRef as o, memo as d, useMemo as c, useReducer as h, useState as x } from "react";
|
|
12
|
+
import { SimpleTooltip as m } from "@sheetxl/utils-mui";
|
|
13
|
+
import { jsx as u, jsxs as g } from "react/jsx-runtime";
|
|
14
|
+
import { Box as p, Button as k, FormControl as f, FormControlLabel as b, FormLabel as y, Radio as L, RadioGroup as w, Tab as v, Tabs as S, Typography as C } from "@mui/material";
|
|
15
|
+
import { messageKey as W } from "@sheetxl/utils";
|
|
16
|
+
var E = ({ item: e }) => {
|
|
17
|
+
const t = s(), n = e.getSheetNames(), r = [];
|
|
18
|
+
let a = !1;
|
|
19
|
+
for (let t = 0; t < n.length; t++) {
|
|
20
|
+
const i = e.getSheetData(t);
|
|
21
|
+
i && (r.push(n[t]), i.refreshError && (a = !0));
|
|
22
|
+
}
|
|
23
|
+
return g(p, {
|
|
24
|
+
sx: {
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "column",
|
|
27
|
+
gap: (e) => e.spacing(.5)
|
|
28
|
+
},
|
|
29
|
+
children: [
|
|
30
|
+
u(C, {
|
|
31
|
+
variant: "caption",
|
|
32
|
+
sx: { color: "text.secondary" },
|
|
33
|
+
children: r.length > 0 ? t("externalLink.cached", { sheets: r.join(", ") }) : t("externalLink.cachedNone")
|
|
34
|
+
}),
|
|
35
|
+
a ? u(C, {
|
|
36
|
+
variant: "caption",
|
|
37
|
+
sx: { color: "error.main" },
|
|
38
|
+
children: t("externalLink.refreshError")
|
|
39
|
+
}) : null,
|
|
40
|
+
u(C, {
|
|
41
|
+
variant: "caption",
|
|
42
|
+
sx: { color: "text.secondary" },
|
|
43
|
+
children: t("externalLink.dependents", { count: e.getDependents().length })
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}, M = d((e) => {
|
|
48
|
+
const { size: n = 28, ...r } = e, i = s();
|
|
49
|
+
return u(t, {
|
|
50
|
+
className: "sxl-external-link-chip",
|
|
51
|
+
title: i("externalLink.linkedWorkbook"),
|
|
52
|
+
sx: {
|
|
53
|
+
width: "auto",
|
|
54
|
+
minWidth: 1.7 * n + "px",
|
|
55
|
+
height: `${n}px`,
|
|
56
|
+
color: "text.secondary"
|
|
57
|
+
},
|
|
58
|
+
...r,
|
|
59
|
+
children: u(a, {
|
|
60
|
+
iconKey: "ExternalLinked",
|
|
61
|
+
size: Math.round(.7 * n)
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
M.displayName = "ExternalLinkChip";
|
|
66
|
+
var N = ({ item: e }) => {
|
|
67
|
+
const t = r(e);
|
|
68
|
+
if (!t) return null;
|
|
69
|
+
const n = Math.max(t.lastIndexOf("/"), t.lastIndexOf("\\")), a = -1 === n ? "" : t.substring(0, n + 1), i = -1 === n ? t : t.substring(n + 1);
|
|
70
|
+
return u(m, {
|
|
71
|
+
title: t,
|
|
72
|
+
children: g(p, {
|
|
73
|
+
className: "sxl-external-link-location",
|
|
74
|
+
sx: {
|
|
75
|
+
display: "flex",
|
|
76
|
+
alignItems: "baseline",
|
|
77
|
+
minWidth: 0,
|
|
78
|
+
typography: "subtitle2",
|
|
79
|
+
fontWeight: 600
|
|
80
|
+
},
|
|
81
|
+
children: [a ? u(C, {
|
|
82
|
+
variant: "subtitle2",
|
|
83
|
+
sx: {
|
|
84
|
+
fontWeight: 600,
|
|
85
|
+
minWidth: 0,
|
|
86
|
+
overflow: "hidden",
|
|
87
|
+
textOverflow: "ellipsis",
|
|
88
|
+
whiteSpace: "nowrap"
|
|
89
|
+
},
|
|
90
|
+
children: a
|
|
91
|
+
}) : null, u(C, {
|
|
92
|
+
variant: "subtitle2",
|
|
93
|
+
sx: {
|
|
94
|
+
fontWeight: 600,
|
|
95
|
+
flex: "0 0 auto",
|
|
96
|
+
whiteSpace: "nowrap"
|
|
97
|
+
},
|
|
98
|
+
children: i
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
}, A = d(o((t, r) => {
|
|
103
|
+
const { workbook: a, ...o } = t, d = s(), h = l(), x = c(() => ({
|
|
104
|
+
key: "external-link",
|
|
105
|
+
messageKeys: {
|
|
106
|
+
none: W("externalLink.none"),
|
|
107
|
+
delete: W("externalLink.breakLink"),
|
|
108
|
+
search: W("externalLink.search"),
|
|
109
|
+
clearSearch: W("externalLink.clearSearch"),
|
|
110
|
+
noMatches: W("externalLink.noMatches")
|
|
111
|
+
},
|
|
112
|
+
getItems: (e) => e.getExternalBooks().getItems(),
|
|
113
|
+
subscribe: (e, t) => {
|
|
114
|
+
const n = e.getExternalBooks().addListeners({ onCollectionChange: () => t.onChange() }, { transactional: !1 }), r = e.getCalculation().addListeners({ onComplete: () => t.onChange() }, { transactional: !1 }), a = e.addListeners({ onProtectionChange: () => t.onChange() }, { transactional: !1 });
|
|
115
|
+
return () => {
|
|
116
|
+
n?.(), r?.(), a?.();
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
isReadOnly: (e) => !e.getProtection().isStructureAllowed(),
|
|
120
|
+
getItemKey: (e) => e.getId(),
|
|
121
|
+
delete: (e, t) => {
|
|
122
|
+
e.breakLink();
|
|
123
|
+
},
|
|
124
|
+
getSearchText: (e) => [
|
|
125
|
+
n(e),
|
|
126
|
+
e.getDisplayName(),
|
|
127
|
+
...e.getSheetNames(),
|
|
128
|
+
...e.getSources().map((e) => e.target)
|
|
129
|
+
].join("\n"),
|
|
130
|
+
CardMedia: () => u(M, { size: 32 }),
|
|
131
|
+
getCardTitle: (e) => n(e),
|
|
132
|
+
CardSubtitle: N,
|
|
133
|
+
CardBody: (e) => u(E, { ...e })
|
|
134
|
+
}), []), m = !a.getProtection().isStructureAllowed(), f = a.getExternalBooks().getCount() > 0, b = c(() => {
|
|
135
|
+
const e = {
|
|
136
|
+
flex: "0 0 auto",
|
|
137
|
+
textTransform: "none",
|
|
138
|
+
whiteSpace: "nowrap"
|
|
139
|
+
};
|
|
140
|
+
return g(p, {
|
|
141
|
+
sx: {
|
|
142
|
+
display: "flex",
|
|
143
|
+
gap: .5,
|
|
144
|
+
flex: "0 0 auto"
|
|
145
|
+
},
|
|
146
|
+
children: [u(k, {
|
|
147
|
+
size: "small",
|
|
148
|
+
disabled: m || !f,
|
|
149
|
+
sx: e,
|
|
150
|
+
onClick: () => {
|
|
151
|
+
a.getExternalBooks().refreshAll().then((e) => {
|
|
152
|
+
const t = {
|
|
153
|
+
refreshed: 0,
|
|
154
|
+
failed: 0,
|
|
155
|
+
unavailable: 0
|
|
156
|
+
};
|
|
157
|
+
for (const n of e) t[n.status]++;
|
|
158
|
+
0 === t.refreshed && 0 === t.failed ? h.showMessage?.(d("externalLink.refreshUnavailable"), { type: i.Warning }) : h.showMessage?.(d("externalLink.refreshSummary", t), { type: t.failed ? i.Warning : i.Info });
|
|
159
|
+
}, (e) => {
|
|
160
|
+
h.showMessage?.(e.message, { type: i.Error });
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
children: d("externalLink.refreshAll")
|
|
164
|
+
}), u(k, {
|
|
165
|
+
size: "small",
|
|
166
|
+
disabled: m || !f,
|
|
167
|
+
sx: e,
|
|
168
|
+
onClick: () => {
|
|
169
|
+
try {
|
|
170
|
+
a.getExternalBooks().breakAll();
|
|
171
|
+
} catch (e) {
|
|
172
|
+
h.showMessage?.(e.message, { type: i.Error });
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
children: d("externalLink.breakAll")
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
}, [
|
|
179
|
+
a,
|
|
180
|
+
m,
|
|
181
|
+
f,
|
|
182
|
+
h,
|
|
183
|
+
d
|
|
184
|
+
]);
|
|
185
|
+
return u(e, {
|
|
186
|
+
ref: r,
|
|
187
|
+
workbook: a,
|
|
188
|
+
descriptor: x,
|
|
189
|
+
headerActions: b,
|
|
190
|
+
...o
|
|
191
|
+
});
|
|
192
|
+
}));
|
|
193
|
+
A.displayName = "ExternalLinksPanel";
|
|
194
|
+
var I = [
|
|
195
|
+
"userSet",
|
|
196
|
+
"always",
|
|
197
|
+
"never"
|
|
198
|
+
], T = {
|
|
199
|
+
userSet: W("externalLink.updateLinks.userSet"),
|
|
200
|
+
always: W("externalLink.updateLinks.always"),
|
|
201
|
+
never: W("externalLink.updateLinks.never")
|
|
202
|
+
}, z = d(o((e, t) => {
|
|
203
|
+
const { workbook: n, ...r } = e, a = s(), [i, l] = h((e) => e + 1, 0), o = n.getUpdateLinks() ?? "userSet", d = !n.getProtection().isStructureAllowed();
|
|
204
|
+
return g(p, {
|
|
205
|
+
ref: t,
|
|
206
|
+
...r,
|
|
207
|
+
sx: {
|
|
208
|
+
display: "flex",
|
|
209
|
+
flexDirection: "column",
|
|
210
|
+
boxSizing: "border-box",
|
|
211
|
+
gap: (e) => e.spacing(1.5),
|
|
212
|
+
padding: (e) => e.spacing(1.5),
|
|
213
|
+
overflowX: "hidden",
|
|
214
|
+
overflowY: "auto"
|
|
215
|
+
},
|
|
216
|
+
children: [g(f, {
|
|
217
|
+
disabled: d,
|
|
218
|
+
children: [u(y, {
|
|
219
|
+
sx: { typography: "body2" },
|
|
220
|
+
children: a("externalLink.updateLinks.label")
|
|
221
|
+
}), u(w, {
|
|
222
|
+
value: o,
|
|
223
|
+
onChange: (e, t) => {
|
|
224
|
+
n.setUpdateLinks(t), l();
|
|
225
|
+
},
|
|
226
|
+
children: I.map((e) => u(b, {
|
|
227
|
+
value: e,
|
|
228
|
+
control: u(L, { size: "small" }),
|
|
229
|
+
label: u(C, {
|
|
230
|
+
variant: "body2",
|
|
231
|
+
children: a(T[e])
|
|
232
|
+
})
|
|
233
|
+
}, e))
|
|
234
|
+
})]
|
|
235
|
+
}), u(C, {
|
|
236
|
+
variant: "caption",
|
|
237
|
+
sx: { color: "text.secondary" },
|
|
238
|
+
children: a("externalLink.updateLinks.note")
|
|
239
|
+
})]
|
|
240
|
+
});
|
|
241
|
+
}));
|
|
242
|
+
z.displayName = "ExternalLinkSettingsTab";
|
|
243
|
+
var B = {
|
|
244
|
+
links: W("externalLink.tab.links"),
|
|
245
|
+
settings: W("externalLink.tab.settings")
|
|
246
|
+
}, D = Object.keys(B), j = (e) => D.includes(e) ? e : null, H = d((e) => {
|
|
247
|
+
const { model: t, args: n, defaultTab: r = "links", entryKey: a, frame: i, ref: l, ...o } = e, d = s(), [c, h] = x(() => j(n?.tab) ?? r), [m, k] = x(n);
|
|
248
|
+
if (n !== m) {
|
|
249
|
+
k(n);
|
|
250
|
+
const e = j(n?.tab);
|
|
251
|
+
e && h(e);
|
|
252
|
+
}
|
|
253
|
+
return t ? g(p, {
|
|
254
|
+
ref: l,
|
|
255
|
+
...o,
|
|
256
|
+
sx: {
|
|
257
|
+
display: "flex",
|
|
258
|
+
flexDirection: "column",
|
|
259
|
+
width: "100%",
|
|
260
|
+
minWidth: 0,
|
|
261
|
+
flex: "1 1 auto",
|
|
262
|
+
height: "100%",
|
|
263
|
+
minHeight: 0,
|
|
264
|
+
overflowX: "hidden"
|
|
265
|
+
},
|
|
266
|
+
children: [u(S, {
|
|
267
|
+
value: c,
|
|
268
|
+
onChange: (e, t) => h(t),
|
|
269
|
+
variant: "fullWidth",
|
|
270
|
+
sx: {
|
|
271
|
+
width: "100%",
|
|
272
|
+
flex: "0 0 auto",
|
|
273
|
+
minHeight: "36px",
|
|
274
|
+
borderBottom: 1,
|
|
275
|
+
borderColor: "divider",
|
|
276
|
+
"& .MuiTab-root": {
|
|
277
|
+
minHeight: "36px",
|
|
278
|
+
textTransform: "none",
|
|
279
|
+
pt: .5,
|
|
280
|
+
pb: .5,
|
|
281
|
+
px: .5,
|
|
282
|
+
minWidth: 0
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
children: D.map((e) => u(v, {
|
|
286
|
+
value: e,
|
|
287
|
+
label: d(B[e])
|
|
288
|
+
}, e))
|
|
289
|
+
}), g(p, {
|
|
290
|
+
sx: {
|
|
291
|
+
flex: "1 1 auto",
|
|
292
|
+
minHeight: 0,
|
|
293
|
+
minWidth: 0,
|
|
294
|
+
width: "100%",
|
|
295
|
+
display: "flex",
|
|
296
|
+
flexDirection: "column"
|
|
297
|
+
},
|
|
298
|
+
children: ["links" === c ? u(A, {
|
|
299
|
+
workbook: t,
|
|
300
|
+
style: {
|
|
301
|
+
flex: "1 1 auto",
|
|
302
|
+
minHeight: 0,
|
|
303
|
+
minWidth: 0,
|
|
304
|
+
width: "100%"
|
|
305
|
+
}
|
|
306
|
+
}) : null, "settings" === c ? u(z, {
|
|
307
|
+
workbook: t,
|
|
308
|
+
style: {
|
|
309
|
+
flex: "1 1 auto",
|
|
310
|
+
minHeight: 0,
|
|
311
|
+
minWidth: 0,
|
|
312
|
+
width: "100%"
|
|
313
|
+
}
|
|
314
|
+
}) : null]
|
|
315
|
+
})]
|
|
316
|
+
}) : null;
|
|
317
|
+
});
|
|
318
|
+
H.displayName = "ExternalLinksTaskPane";
|
|
319
|
+
export { H as ExternalLinksTaskPane, H as default };
|