@sheetxl/scripting-mui 0.8.0-beta.11 → 0.8.0-beta.13
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/index.mjs +170 -157
- package/node/esm/index.mjs +108 -95
- package/package.json +8 -8
- package/resources/locales/de/ui.msg.json +1 -0
- package/resources/locales/en/ui.msg.json +1 -0
package/browser/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/scripting-mui - Scripting MUI - MUI script workspace, toolbar and run-script plugin for SheetXL. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/scripting-mui - Scripting MUI - MUI script workspace, toolbar and run-script plugin for SheetXL. - v0.8.0-beta.13
|
|
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.
|
|
@@ -7,29 +7,29 @@
|
|
|
7
7
|
import e, { createElement as t, forwardRef as n, memo as r, useCallback as i, useEffect as a, useMemo as o, useReducer as s, useRef as c, useState as l } from "react";
|
|
8
8
|
import { Box as u, Button as d, CircularProgress as f, Paper as p, Typography as m, useTheme as h } from "@mui/material";
|
|
9
9
|
import { Command as g, CommandButtonType as _, DefaultCommandButtonRegistry as v, DefaultIconService as y, DynamicIcon as b, KeyCodes as x, ReactUtils as S, useCallbackRef as C, useCommandButtonEntry as w, useCommands as T, useImperativeElement as E, useTranslator as D } from "@sheetxl/utils-react";
|
|
10
|
-
import { AnimatedLoadingPanel as ee, CommandButton as O, CommandPopupButton as k, CommandToolbar as A, ExhibitDivider as j, ExhibitMenuItem as M, OverflowPalette as N,
|
|
11
|
-
import { DefaultTaskPaneRegistry as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
import { alpha as
|
|
14
|
-
import { listResources as
|
|
15
|
-
import { VERSION as
|
|
16
|
-
import { ScriptEditor as
|
|
17
|
-
function
|
|
10
|
+
import { AnimatedLoadingPanel as ee, CommandButton as O, CommandPopupButton as k, CommandToolbar as A, ExhibitDivider as j, ExhibitMenuItem as M, OverflowPalette as N, defaultRenderPopupPanel as P } from "@sheetxl/utils-mui";
|
|
11
|
+
import { DefaultTaskPaneRegistry as F, InputClipboardInjector as I, useModelSync as L, useWorkbook as R } from "@sheetxl/react";
|
|
12
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
13
|
+
import { alpha as H } from "@mui/system";
|
|
14
|
+
import { listResources as U, releaseChannel as te } from "@sheetxl/utils";
|
|
15
|
+
import { VERSION as ne } from "@sheetxl/sdk";
|
|
16
|
+
import { ScriptEditor as re, ScriptingReactPlugin as ie } from "@sheetxl/scripting-react";
|
|
17
|
+
function W(e) {
|
|
18
18
|
var t, n, r = "";
|
|
19
19
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
20
20
|
else if (typeof e == "object") {
|
|
21
21
|
if (Array.isArray(e)) {
|
|
22
22
|
var i = e.length;
|
|
23
|
-
for (t = 0; t < i; t++) e[t] && (n =
|
|
23
|
+
for (t = 0; t < i; t++) e[t] && (n = W(e[t])) && (r && (r += " "), r += n);
|
|
24
24
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
25
25
|
}
|
|
26
26
|
return r;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
28
|
+
function G() {
|
|
29
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = W(e)) && (r && (r += " "), r += t);
|
|
30
30
|
return r;
|
|
31
31
|
}
|
|
32
|
-
var
|
|
32
|
+
var ae = {
|
|
33
33
|
"insertFunction.fallbackLabel": "Function",
|
|
34
34
|
"insertFunction.insertNamed": "Insert {name}",
|
|
35
35
|
"insertScript.fallbackLabel": "Insert Script",
|
|
@@ -43,15 +43,16 @@ var se = {
|
|
|
43
43
|
"templateSelect.intro": "Choose from a template to provide a starting point to automate tasks or create user defined functions.",
|
|
44
44
|
"templateSelect.intro2": "Templates provide a foundation to customize and meet your specific needs.",
|
|
45
45
|
"templateSelect.loadFailed": "Failed to load scripts",
|
|
46
|
+
"templateSelect.retry": "Retry",
|
|
46
47
|
"templateSelect.title": "Script Template",
|
|
47
48
|
"templateSelect.untitled": "Untitled"
|
|
48
|
-
}, { DefaultCommandCatalogService:
|
|
49
|
-
function
|
|
50
|
-
|
|
49
|
+
}, { DefaultCommandCatalogService: oe } = g, se = !1;
|
|
50
|
+
function K() {
|
|
51
|
+
se || (se = !0, oe.registerFromManifest("@sheetxl/scripting-mui", import.meta.url, { messages: ae }));
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
let { groupKey: r, ...i } = e, o =
|
|
53
|
+
K();
|
|
54
|
+
var ce = r(n((e, n) => {
|
|
55
|
+
let { groupKey: r, ...i } = e, o = R(), s = D(), [c, d] = l([]), [f, p] = l(!1);
|
|
55
56
|
a(() => {
|
|
56
57
|
let e = o?.getScripts();
|
|
57
58
|
e && (async () => {
|
|
@@ -67,16 +68,16 @@ var le = r(n((e, n) => {
|
|
|
67
68
|
}, h = [], g = c ? c.length : 0;
|
|
68
69
|
for (let e = 0; e < g; e++) {
|
|
69
70
|
let t = c[e];
|
|
70
|
-
h.push(
|
|
71
|
+
h.push(B(O, {
|
|
71
72
|
...m,
|
|
72
73
|
commandKey: "executeScript",
|
|
73
74
|
commandState: { declaration: t },
|
|
74
75
|
propsTooltip: { description: s("runScript.executeNamed", { name: t.getName() ?? s("runScript.fallbackLabel") }) },
|
|
75
|
-
icon:
|
|
76
|
+
icon: B(b, { iconKey: "ScriptMacro" }),
|
|
76
77
|
label: t.getName() ?? s("runScript.fallbackLabel")
|
|
77
78
|
}, `macro-${t.getName()}-${e}`));
|
|
78
79
|
}
|
|
79
|
-
let v =
|
|
80
|
+
let v = V(u, {
|
|
80
81
|
ref: n,
|
|
81
82
|
sx: {
|
|
82
83
|
display: "flex",
|
|
@@ -84,13 +85,13 @@ var le = r(n((e, n) => {
|
|
|
84
85
|
flex: "1 1 100%",
|
|
85
86
|
overflow: "hidden"
|
|
86
87
|
},
|
|
87
|
-
children: [h.length > 0 ?
|
|
88
|
+
children: [h.length > 0 ? V(z, { children: [B(u, {
|
|
88
89
|
sx: {
|
|
89
90
|
overflow: "auto",
|
|
90
91
|
flex: "1 1 100%"
|
|
91
92
|
},
|
|
92
93
|
children: h
|
|
93
|
-
}),
|
|
94
|
+
}), B(j, { orientation: "horizontal" })] }) : null, t(O, {
|
|
94
95
|
...m,
|
|
95
96
|
key: "show-editor",
|
|
96
97
|
commandKey: "showScriptEditor"
|
|
@@ -101,10 +102,10 @@ var le = r(n((e, n) => {
|
|
|
101
102
|
children: v
|
|
102
103
|
});
|
|
103
104
|
}));
|
|
104
|
-
|
|
105
|
-
var
|
|
105
|
+
ce.displayName = "RunScriptPopupPanel";
|
|
106
|
+
var le = r(n((e, t) => {
|
|
106
107
|
let { groupKey: n, disabled: r, ...a } = e, o = T(["showScriptEditor"])[0], s = w("scriptsOptions"), c = i((e) => {
|
|
107
|
-
let t =
|
|
108
|
+
let t = B(ce, {
|
|
108
109
|
disabled: r,
|
|
109
110
|
groupKey: n,
|
|
110
111
|
...e
|
|
@@ -114,17 +115,17 @@ var ue = r(n((e, t) => {
|
|
|
114
115
|
children: t
|
|
115
116
|
});
|
|
116
117
|
}, [r, n]);
|
|
117
|
-
return
|
|
118
|
+
return B(k, {
|
|
118
119
|
ref: t,
|
|
119
120
|
disabled: r,
|
|
120
|
-
|
|
121
|
+
renderPopupPanel: c,
|
|
121
122
|
selected: o?.getState(),
|
|
122
123
|
label: s?.getLabel?.(),
|
|
123
124
|
tooltip: s?.getDescription?.(),
|
|
124
125
|
quickCommand: "showScriptEditor",
|
|
125
126
|
...a
|
|
126
127
|
});
|
|
127
|
-
})),
|
|
128
|
+
})), ue = te(ne), q = `https://unpkg.com/@sheetxl/templates-scripting${ue ? `@${ue}` : ""}/dist`, de = "templates-scripting", fe = [
|
|
128
129
|
"formula",
|
|
129
130
|
"macro",
|
|
130
131
|
"autostart"
|
|
@@ -154,7 +155,7 @@ var ue = r(n((e, t) => {
|
|
|
154
155
|
}, J = /* @__PURE__ */ new Map(), ge = (e = q) => {
|
|
155
156
|
let t = J.get(e);
|
|
156
157
|
return t || (t = (async () => {
|
|
157
|
-
let t = (await
|
|
158
|
+
let t = (await U("templates", de, e)).find((e) => e.meta?.schema !== void 0);
|
|
158
159
|
if (!t) throw Error(`No script templates found at '${e}'.`);
|
|
159
160
|
return Math.floor(Number(t.meta?.schema)) === 1 ? (await Promise.all(t.entries.map((t) => he(e, t)))).filter((e) => e !== null) : (console.warn(`Script template catalog at '${e}' has schema ${t.meta?.schema}; expected 1.`), []);
|
|
160
161
|
})(), J.set(e, t), t.catch(() => {
|
|
@@ -162,7 +163,7 @@ var ue = r(n((e, t) => {
|
|
|
162
163
|
})), t;
|
|
163
164
|
}, Y = { marginRight: "4px" }, X = "1em", _e = r((e) => {
|
|
164
165
|
let { disabled: t, snippet: n, description: r, handleInsert: i, sx: a, ...o } = e, s, c = n.icon;
|
|
165
|
-
return s =
|
|
166
|
+
return s = B(b, c === "formula" ? {
|
|
166
167
|
iconKey: "ScriptFormula",
|
|
167
168
|
size: X,
|
|
168
169
|
style: Y
|
|
@@ -174,7 +175,7 @@ var ue = r(n((e, t) => {
|
|
|
174
175
|
iconKey: "ScriptAutoRun",
|
|
175
176
|
size: X,
|
|
176
177
|
style: Y
|
|
177
|
-
}),
|
|
178
|
+
}), B(M, {
|
|
178
179
|
sx: {
|
|
179
180
|
maxWidth: "460px",
|
|
180
181
|
display: "flex",
|
|
@@ -193,21 +194,21 @@ var ue = r(n((e, t) => {
|
|
|
193
194
|
e.keyCode !== x.Enter && e.keyCode !== x.Space || i(n);
|
|
194
195
|
},
|
|
195
196
|
...o,
|
|
196
|
-
children:
|
|
197
|
+
children: V(u, {
|
|
197
198
|
sx: {
|
|
198
199
|
display: "flex",
|
|
199
200
|
flex: "1 1 100%",
|
|
200
201
|
flexDirection: "column",
|
|
201
202
|
overflow: "hidden"
|
|
202
203
|
},
|
|
203
|
-
children: [
|
|
204
|
+
children: [B(m, {
|
|
204
205
|
component: "div",
|
|
205
206
|
children: n.title
|
|
206
|
-
}),
|
|
207
|
+
}), B(m, {
|
|
207
208
|
variant: "caption",
|
|
208
209
|
component: "div",
|
|
209
210
|
sx: {
|
|
210
|
-
color: (e) =>
|
|
211
|
+
color: (e) => H(e.palette.text.secondary ?? e.palette.text.primary, .6),
|
|
211
212
|
overflow: "hidden",
|
|
212
213
|
textOverflow: "ellipsis"
|
|
213
214
|
},
|
|
@@ -228,7 +229,7 @@ var ue = r(n((e, t) => {
|
|
|
228
229
|
};
|
|
229
230
|
}, [s, g]);
|
|
230
231
|
let S = i((e) => {
|
|
231
|
-
if (m === "loading") return
|
|
232
|
+
if (m === "loading") return B("div", { children: d("insertScript.loading") });
|
|
232
233
|
let n = {
|
|
233
234
|
variant: _.Menuitem,
|
|
234
235
|
groupKey: "scriptsOptions",
|
|
@@ -236,7 +237,7 @@ var ue = r(n((e, t) => {
|
|
|
236
237
|
}, r = (t) => {
|
|
237
238
|
y?.execute(t.content), e.closeFloat?.();
|
|
238
239
|
}, i = () => v((e) => e + 1), a = [];
|
|
239
|
-
m === "error" && a.push(
|
|
240
|
+
m === "error" && a.push(B(M, {
|
|
240
241
|
onMouseDown: (e) => {
|
|
241
242
|
e.button === 0 && e.preventDefault();
|
|
242
243
|
},
|
|
@@ -250,12 +251,12 @@ var ue = r(n((e, t) => {
|
|
|
250
251
|
}, "retry"));
|
|
251
252
|
for (let e = 0; e < f.length; e++) {
|
|
252
253
|
let t = f[e];
|
|
253
|
-
t && a.push(
|
|
254
|
+
t && a.push(B(_e, {
|
|
254
255
|
handleInsert: r,
|
|
255
256
|
snippet: t
|
|
256
257
|
}, t.path));
|
|
257
258
|
}
|
|
258
|
-
let o =
|
|
259
|
+
let o = V(u, {
|
|
259
260
|
sx: {
|
|
260
261
|
display: "flex",
|
|
261
262
|
flexDirection: "column",
|
|
@@ -263,13 +264,13 @@ var ue = r(n((e, t) => {
|
|
|
263
264
|
overflow: "hidden"
|
|
264
265
|
},
|
|
265
266
|
children: [
|
|
266
|
-
a.length > 0 ?
|
|
267
|
+
a.length > 0 ? V(z, { children: [B(u, {
|
|
267
268
|
sx: {
|
|
268
269
|
overflow: "auto",
|
|
269
270
|
flex: "1 1 100%"
|
|
270
271
|
},
|
|
271
272
|
children: a
|
|
272
|
-
}),
|
|
273
|
+
}), B(j, { orientation: "horizontal" })] }) : null,
|
|
273
274
|
t(O, {
|
|
274
275
|
...n,
|
|
275
276
|
key: "showKeyboardShortcuts",
|
|
@@ -294,50 +295,50 @@ var ue = r(n((e, t) => {
|
|
|
294
295
|
y,
|
|
295
296
|
d
|
|
296
297
|
]);
|
|
297
|
-
return
|
|
298
|
+
return B(k, {
|
|
298
299
|
ref: n,
|
|
299
300
|
disabled: b,
|
|
300
301
|
groupKey: r,
|
|
301
302
|
label: y?.getLabel(r) ?? d("insertScript.fallbackLabel"),
|
|
302
303
|
tooltip: y?.getDescription(),
|
|
303
|
-
|
|
304
|
+
renderPopupPanel: S,
|
|
304
305
|
icon: y?.getIcon() ?? "ScriptInsert",
|
|
305
306
|
...c
|
|
306
307
|
});
|
|
307
308
|
})), Z = r(n((e, t) => {
|
|
308
309
|
let { propsCommandButton: n, ...r } = e, i = C((e) => {
|
|
309
310
|
let { propsCommandButton: t, propsCommandPopup: n } = e;
|
|
310
|
-
return z
|
|
311
|
+
return B(z, { children: V("div", {
|
|
311
312
|
style: {
|
|
312
313
|
display: "flex",
|
|
313
314
|
flex: "1 1 100%"
|
|
314
315
|
},
|
|
315
316
|
children: [
|
|
316
|
-
|
|
317
|
+
B("div", { children: B(N, {
|
|
317
318
|
style: {},
|
|
318
|
-
children:
|
|
319
|
+
children: B(O, {
|
|
319
320
|
...t,
|
|
320
321
|
commandKey: "saveScripts"
|
|
321
322
|
})
|
|
322
323
|
}) }),
|
|
323
|
-
|
|
324
|
-
|
|
324
|
+
B("div", { style: { flex: "1 1 100%" } }),
|
|
325
|
+
B("div", { children: B(N, {
|
|
325
326
|
style: {},
|
|
326
|
-
children:
|
|
327
|
+
children: B(ve, { ...t })
|
|
327
328
|
}) })
|
|
328
329
|
]
|
|
329
330
|
}) });
|
|
330
331
|
}, []);
|
|
331
|
-
return
|
|
332
|
+
return B(A, {
|
|
332
333
|
ref: t,
|
|
333
334
|
propsCommandButton: n,
|
|
334
335
|
renderToolbarPalette: i,
|
|
335
336
|
...r
|
|
336
337
|
});
|
|
337
338
|
}));
|
|
338
|
-
Z.displayName = "ScriptEditorToolbar",
|
|
339
|
+
Z.displayName = "ScriptEditorToolbar", K();
|
|
339
340
|
var ye = r(n((e, t) => {
|
|
340
|
-
let { scriptPath: n = q, onScriptSelect: r, disabled: i = !1, sx: o = S.EmptyCssProperties, className: s, buttonMinWidth: c = 210, buttonMinHeight: p = 80, gap: h = 12, ...g } = e, _ = D(), [v, y] = l([]), [x, C] = l(!0), [w, T] = l(null);
|
|
341
|
+
let { scriptPath: n = q, onScriptSelect: r, disabled: i = !1, sx: o = S.EmptyCssProperties, className: s, buttonMinWidth: c = 210, buttonMinHeight: p = 80, gap: h = 12, ...g } = e, _ = D(), [v, y] = l([]), [x, C] = l(!0), [w, T] = l(null), [E, ee] = l(0);
|
|
341
342
|
if (a(() => {
|
|
342
343
|
let e = !1, t = {
|
|
343
344
|
path: null,
|
|
@@ -354,8 +355,12 @@ var ye = r(n((e, t) => {
|
|
|
354
355
|
}), () => {
|
|
355
356
|
e = !0;
|
|
356
357
|
};
|
|
357
|
-
}, [
|
|
358
|
-
|
|
358
|
+
}, [
|
|
359
|
+
n,
|
|
360
|
+
_,
|
|
361
|
+
E
|
|
362
|
+
]), x) return B(u, {
|
|
363
|
+
className: G(s, "script-select"),
|
|
359
364
|
...g,
|
|
360
365
|
sx: [{
|
|
361
366
|
display: "flex",
|
|
@@ -366,60 +371,68 @@ var ye = r(n((e, t) => {
|
|
|
366
371
|
zIndex: 1e3,
|
|
367
372
|
...Array.isArray(o) ? {} : o
|
|
368
373
|
}, ...Array.isArray(o) ? o : []],
|
|
369
|
-
children:
|
|
374
|
+
children: B(f, {})
|
|
370
375
|
});
|
|
371
|
-
let
|
|
372
|
-
w && (
|
|
373
|
-
className:
|
|
374
|
-
|
|
375
|
-
sx: [{
|
|
376
|
+
let O = null;
|
|
377
|
+
w && (O = V(u, {
|
|
378
|
+
className: "error-results",
|
|
379
|
+
sx: {
|
|
376
380
|
display: "flex",
|
|
377
|
-
justifyContent: "center",
|
|
378
|
-
alignItems: "center",
|
|
379
|
-
background: (e) => e.palette.error.light,
|
|
380
|
-
flex: "0",
|
|
381
|
-
zIndex: 1e3,
|
|
382
381
|
flexDirection: "column",
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
382
|
+
alignItems: "center",
|
|
383
|
+
flex: "none",
|
|
384
|
+
gap: .5,
|
|
385
|
+
padding: 1.5,
|
|
386
|
+
background: (e) => H(e.palette.error.main, e.palette.mode === "dark" ? .16 : .06),
|
|
387
|
+
borderTop: (e) => `1px solid ${H(e.palette.error.main, .4)}`
|
|
388
|
+
},
|
|
389
|
+
children: [
|
|
390
|
+
B(m, {
|
|
391
|
+
color: "error",
|
|
392
|
+
variant: "subtitle1",
|
|
393
|
+
component: "div",
|
|
394
|
+
children: _("templateSelect.errorTitle")
|
|
395
|
+
}),
|
|
396
|
+
B(m, {
|
|
397
|
+
variant: "body2",
|
|
398
|
+
component: "div",
|
|
399
|
+
sx: {
|
|
400
|
+
color: "text.secondary",
|
|
401
|
+
textAlign: "center"
|
|
402
|
+
},
|
|
403
|
+
children: w
|
|
404
|
+
}),
|
|
405
|
+
B(d, {
|
|
406
|
+
size: "small",
|
|
407
|
+
color: "error",
|
|
408
|
+
onClick: () => ee((e) => e + 1),
|
|
409
|
+
children: _("templateSelect.retry")
|
|
410
|
+
})
|
|
411
|
+
]
|
|
399
412
|
}));
|
|
400
|
-
let
|
|
413
|
+
let k = (e) => {
|
|
401
414
|
let t = e.icon;
|
|
402
|
-
return t === "macro" ?
|
|
415
|
+
return t === "macro" ? B(b, {
|
|
403
416
|
iconKey: "ScriptMacro",
|
|
404
417
|
size: "1em"
|
|
405
|
-
}) : t === "formula" ?
|
|
418
|
+
}) : t === "formula" ? B(b, {
|
|
406
419
|
iconKey: "ScriptFormula",
|
|
407
420
|
size: "1em"
|
|
408
|
-
}) : t === "autostart" ?
|
|
421
|
+
}) : t === "autostart" ? B(b, {
|
|
409
422
|
iconKey: "ScriptAutoRun",
|
|
410
423
|
size: "1em"
|
|
411
424
|
}) : null;
|
|
412
425
|
};
|
|
413
|
-
return
|
|
426
|
+
return V(u, {
|
|
414
427
|
ref: t,
|
|
415
|
-
className:
|
|
428
|
+
className: G(s, "script-select"),
|
|
416
429
|
sx: {
|
|
417
430
|
background: (e) => e.palette.background.paper,
|
|
418
431
|
zIndex: 1e3,
|
|
419
432
|
...o
|
|
420
433
|
},
|
|
421
434
|
...g,
|
|
422
|
-
children: [
|
|
435
|
+
children: [V(u, {
|
|
423
436
|
className: "script-select-content",
|
|
424
437
|
sx: {
|
|
425
438
|
p: 3,
|
|
@@ -427,26 +440,26 @@ var ye = r(n((e, t) => {
|
|
|
427
440
|
flex: "1 1 auto"
|
|
428
441
|
},
|
|
429
442
|
children: [
|
|
430
|
-
|
|
443
|
+
B(m, {
|
|
431
444
|
variant: "h6",
|
|
432
445
|
gutterBottom: !0,
|
|
433
446
|
children: _("templateSelect.title")
|
|
434
447
|
}),
|
|
435
|
-
|
|
448
|
+
B(m, {
|
|
436
449
|
variant: "body2",
|
|
437
450
|
component: "div",
|
|
438
451
|
gutterBottom: !0,
|
|
439
452
|
sx: { color: "text.secondary" },
|
|
440
453
|
children: _("templateSelect.intro")
|
|
441
454
|
}),
|
|
442
|
-
|
|
455
|
+
B(m, {
|
|
443
456
|
variant: "body2",
|
|
444
457
|
component: "div",
|
|
445
458
|
gutterBottom: !0,
|
|
446
459
|
sx: { color: "text.secondary" },
|
|
447
460
|
children: _("templateSelect.intro2")
|
|
448
461
|
}),
|
|
449
|
-
|
|
462
|
+
B(u, {
|
|
450
463
|
sx: {
|
|
451
464
|
display: "grid",
|
|
452
465
|
gridTemplateColumns: `repeat(auto-fill, minmax(${c}px, 1fr))`,
|
|
@@ -455,7 +468,7 @@ var ye = r(n((e, t) => {
|
|
|
455
468
|
paddingLeft: "0px",
|
|
456
469
|
paddingRight: "0px"
|
|
457
470
|
},
|
|
458
|
-
children: v.map((e, t) =>
|
|
471
|
+
children: v.map((e, t) => V(d, {
|
|
459
472
|
variant: "outlined",
|
|
460
473
|
disabled: i,
|
|
461
474
|
sx: {
|
|
@@ -476,7 +489,7 @@ var ye = r(n((e, t) => {
|
|
|
476
489
|
...t === 1 && { gridColumn: "1" }
|
|
477
490
|
},
|
|
478
491
|
onClick: () => r?.(e),
|
|
479
|
-
children: [
|
|
492
|
+
children: [V(u, {
|
|
480
493
|
sx: {
|
|
481
494
|
display: "flex",
|
|
482
495
|
flexDirection: "row",
|
|
@@ -485,12 +498,12 @@ var ye = r(n((e, t) => {
|
|
|
485
498
|
width: "100%",
|
|
486
499
|
marginBottom: .5
|
|
487
500
|
},
|
|
488
|
-
children: [
|
|
501
|
+
children: [B(m, {
|
|
489
502
|
variant: "subtitle2",
|
|
490
503
|
component: "div",
|
|
491
504
|
children: e.title || _("templateSelect.untitled")
|
|
492
|
-
}),
|
|
493
|
-
}), e.summary &&
|
|
505
|
+
}), k(e)]
|
|
506
|
+
}), e.summary && B(m, {
|
|
494
507
|
variant: "body2",
|
|
495
508
|
component: "div",
|
|
496
509
|
sx: {
|
|
@@ -506,7 +519,7 @@ var ye = r(n((e, t) => {
|
|
|
506
519
|
}, `${e.path}-${t}`))
|
|
507
520
|
})
|
|
508
521
|
]
|
|
509
|
-
}),
|
|
522
|
+
}), O]
|
|
510
523
|
});
|
|
511
524
|
}));
|
|
512
525
|
ye.displayName = "TemplateSelectPanel";
|
|
@@ -532,7 +545,7 @@ var Q = r(n((e, t) => {
|
|
|
532
545
|
...t,
|
|
533
546
|
...e
|
|
534
547
|
}));
|
|
535
|
-
}, []), j = c(null), [M, N] = l(null), P = c(null),
|
|
548
|
+
}, []), j = c(null), [M, N] = l(null), P = c(null), F = C((e) => {
|
|
536
549
|
if (M) return M.focus(e), !0;
|
|
537
550
|
if (g) {
|
|
538
551
|
let t = j.current?.querySelectorAll?.(g);
|
|
@@ -543,7 +556,7 @@ var Q = r(n((e, t) => {
|
|
|
543
556
|
M,
|
|
544
557
|
g,
|
|
545
558
|
_
|
|
546
|
-
]),
|
|
559
|
+
]), I = o(() => B(ee, {
|
|
547
560
|
transitionDelay: "160ms",
|
|
548
561
|
style: {
|
|
549
562
|
position: "absolute",
|
|
@@ -551,7 +564,7 @@ var Q = r(n((e, t) => {
|
|
|
551
564
|
height: "100%"
|
|
552
565
|
},
|
|
553
566
|
transparentBackground: !1
|
|
554
|
-
}), []),
|
|
567
|
+
}), []), L = o(() => B(p, {
|
|
555
568
|
elevation: 1,
|
|
556
569
|
tabIndex: 0,
|
|
557
570
|
sx: {
|
|
@@ -564,9 +577,9 @@ var Q = r(n((e, t) => {
|
|
|
564
577
|
marginTop: (e) => e.spacing(1),
|
|
565
578
|
marginBottom: (e) => e.spacing(1)
|
|
566
579
|
},
|
|
567
|
-
children:
|
|
568
|
-
}), [b]),
|
|
569
|
-
className:
|
|
580
|
+
children: B(Z, {})
|
|
581
|
+
}), [b]), R = o(() => B(u, {
|
|
582
|
+
className: G("script-status-panel", "status-panel"),
|
|
570
583
|
sx: {
|
|
571
584
|
display: "flex",
|
|
572
585
|
alignItems: "stretch",
|
|
@@ -580,7 +593,7 @@ var Q = r(n((e, t) => {
|
|
|
580
593
|
margin: 0,
|
|
581
594
|
borderTop: `solid 1px ${b.palette.divider}`
|
|
582
595
|
},
|
|
583
|
-
children:
|
|
596
|
+
children: V("div", {
|
|
584
597
|
style: {
|
|
585
598
|
flex: "1 1 100%",
|
|
586
599
|
display: "flex",
|
|
@@ -589,7 +602,7 @@ var Q = r(n((e, t) => {
|
|
|
589
602
|
justifyContent: "center"
|
|
590
603
|
},
|
|
591
604
|
children: [
|
|
592
|
-
|
|
605
|
+
B(m, {
|
|
593
606
|
component: "div",
|
|
594
607
|
sx: {
|
|
595
608
|
userSelect: "none",
|
|
@@ -602,7 +615,7 @@ var Q = r(n((e, t) => {
|
|
|
602
615
|
variant: "caption",
|
|
603
616
|
children: T.message
|
|
604
617
|
}),
|
|
605
|
-
|
|
618
|
+
B(m, {
|
|
606
619
|
component: "div",
|
|
607
620
|
sx: {
|
|
608
621
|
userSelect: "none",
|
|
@@ -615,7 +628,7 @@ var Q = r(n((e, t) => {
|
|
|
615
628
|
variant: "caption",
|
|
616
629
|
children: T.dirty ? "Unsaved" : ""
|
|
617
630
|
}),
|
|
618
|
-
|
|
631
|
+
B(m, {
|
|
619
632
|
component: "div",
|
|
620
633
|
sx: {
|
|
621
634
|
userSelect: "none",
|
|
@@ -634,8 +647,8 @@ var Q = r(n((e, t) => {
|
|
|
634
647
|
})
|
|
635
648
|
]
|
|
636
649
|
})
|
|
637
|
-
}), [T]),
|
|
638
|
-
className:
|
|
650
|
+
}), [T]), z = o(() => V(u, {
|
|
651
|
+
className: G("script-editor-content"),
|
|
639
652
|
sx: {
|
|
640
653
|
display: "flex",
|
|
641
654
|
flex: "1 1 100%",
|
|
@@ -644,8 +657,8 @@ var Q = r(n((e, t) => {
|
|
|
644
657
|
boxSizing: "border-box"
|
|
645
658
|
},
|
|
646
659
|
children: [
|
|
647
|
-
|
|
648
|
-
|
|
660
|
+
L,
|
|
661
|
+
B(u, {
|
|
649
662
|
sx: {
|
|
650
663
|
display: "flex",
|
|
651
664
|
flex: "1 1 100%",
|
|
@@ -654,9 +667,9 @@ var Q = r(n((e, t) => {
|
|
|
654
667
|
position: "relative",
|
|
655
668
|
boxSizing: "border-box"
|
|
656
669
|
},
|
|
657
|
-
children:
|
|
670
|
+
children: B(re, {
|
|
658
671
|
ref: j,
|
|
659
|
-
loadingPanel:
|
|
672
|
+
loadingPanel: I,
|
|
660
673
|
readOnly: d,
|
|
661
674
|
frame: f,
|
|
662
675
|
scripts: v,
|
|
@@ -666,23 +679,23 @@ var Q = r(n((e, t) => {
|
|
|
666
679
|
...s
|
|
667
680
|
})
|
|
668
681
|
}),
|
|
669
|
-
|
|
682
|
+
R
|
|
670
683
|
]
|
|
671
684
|
}), [
|
|
672
685
|
b,
|
|
673
|
-
I,
|
|
674
686
|
L,
|
|
687
|
+
R,
|
|
675
688
|
x,
|
|
676
|
-
|
|
689
|
+
I,
|
|
677
690
|
d,
|
|
678
691
|
s,
|
|
679
692
|
_,
|
|
680
693
|
g,
|
|
681
694
|
f,
|
|
682
695
|
A
|
|
683
|
-
]),
|
|
696
|
+
]), H = o(() => {
|
|
684
697
|
let e;
|
|
685
|
-
return O === null ?
|
|
698
|
+
return O === null ? I : (O.source === null && (e = B(ye, {
|
|
686
699
|
sx: {
|
|
687
700
|
display: "flex",
|
|
688
701
|
flex: "1 1 100%",
|
|
@@ -697,9 +710,9 @@ var Q = r(n((e, t) => {
|
|
|
697
710
|
onScriptSelect: (e) => {
|
|
698
711
|
j.current?.insertSnippet(e.content), k({ source: e.content ?? "" }), requestAnimationFrame(() => j.current?.focus());
|
|
699
712
|
}
|
|
700
|
-
})),
|
|
713
|
+
})), B(u, {
|
|
701
714
|
tabIndex: 0,
|
|
702
|
-
className:
|
|
715
|
+
className: G("script-workspace", n),
|
|
703
716
|
sx: {
|
|
704
717
|
display: "flex",
|
|
705
718
|
flex: "1 1 100%",
|
|
@@ -713,13 +726,13 @@ var Q = r(n((e, t) => {
|
|
|
713
726
|
onPointerDown: (e) => {
|
|
714
727
|
e.isDefaultPrevented() || j.current?.focus();
|
|
715
728
|
},
|
|
716
|
-
children:
|
|
729
|
+
children: V(u, {
|
|
717
730
|
sx: {
|
|
718
731
|
flex: "1 1 100%",
|
|
719
732
|
position: "relative",
|
|
720
733
|
display: "flex"
|
|
721
734
|
},
|
|
722
|
-
children: [
|
|
735
|
+
children: [B(u, {
|
|
723
736
|
sx: {
|
|
724
737
|
display: "flex",
|
|
725
738
|
flex: "1 1 100%",
|
|
@@ -727,24 +740,24 @@ var Q = r(n((e, t) => {
|
|
|
727
740
|
minHeight: 0,
|
|
728
741
|
visibility: e ? "hidden" : "visible"
|
|
729
742
|
},
|
|
730
|
-
children:
|
|
743
|
+
children: z
|
|
731
744
|
}), e]
|
|
732
745
|
})
|
|
733
746
|
}));
|
|
734
747
|
}, [
|
|
735
|
-
|
|
736
|
-
|
|
748
|
+
L,
|
|
749
|
+
z,
|
|
737
750
|
n,
|
|
738
751
|
O,
|
|
739
|
-
|
|
752
|
+
I,
|
|
740
753
|
d
|
|
741
|
-
]),
|
|
754
|
+
]), U = E(t, () => ({
|
|
742
755
|
isScriptWorkspaceElement: () => !0,
|
|
743
756
|
focus: (e) => {
|
|
744
|
-
|
|
757
|
+
F(e);
|
|
745
758
|
}
|
|
746
759
|
}), []);
|
|
747
|
-
return
|
|
760
|
+
return B(u, {
|
|
748
761
|
sx: {
|
|
749
762
|
display: "flex",
|
|
750
763
|
flexDirection: "row",
|
|
@@ -752,37 +765,37 @@ var Q = r(n((e, t) => {
|
|
|
752
765
|
position: "relative",
|
|
753
766
|
...r
|
|
754
767
|
},
|
|
755
|
-
ref:
|
|
768
|
+
ref: U,
|
|
756
769
|
...y,
|
|
757
770
|
onFocus: (e) => {
|
|
758
|
-
S(!0), w.current = !0,
|
|
771
|
+
S(!0), w.current = !0, U.current?.contains(e.target) && e.target !== U.current && N(e.target), e.relatedTarget && !P.current && (P.current = e.relatedTarget), y?.onFocus?.(e);
|
|
759
772
|
},
|
|
760
773
|
onBlur: (e) => {
|
|
761
|
-
|
|
774
|
+
U?.current?.contains(e.relatedTarget) || U?.current === e.relatedTarget || (P.current = null, w.current = !1, S(!1)), y?.onBlur?.(e);
|
|
762
775
|
},
|
|
763
|
-
children:
|
|
776
|
+
children: H
|
|
764
777
|
});
|
|
765
778
|
}));
|
|
766
779
|
Q.displayName = "ScriptWorkspace";
|
|
767
780
|
var { FocusActivation: be, CommandScopeProvider: xe, CommandAnchorProvider: Se, useCommandScope: Ce } = g, we = { scopeName: "scriptEditor" }, Te = ({ children: e }) => {
|
|
768
781
|
let t = Ce(), n = c(null);
|
|
769
|
-
return t ?
|
|
782
|
+
return t ? B(xe, {
|
|
770
783
|
spec: we,
|
|
771
784
|
elementRef: n,
|
|
772
785
|
region: !0,
|
|
773
|
-
children:
|
|
786
|
+
children: B(Ee, {
|
|
774
787
|
paneRef: n,
|
|
775
788
|
children: e
|
|
776
789
|
})
|
|
777
790
|
}) : e;
|
|
778
791
|
}, Ee = ({ paneRef: e, children: t }) => {
|
|
779
792
|
let n = Ce(), r = o(() => n ? new be(n.getRoot(), n) : null, [n]);
|
|
780
|
-
return r ?
|
|
793
|
+
return r ? V(Se, {
|
|
781
794
|
tracker: r,
|
|
782
795
|
keyBindings: !1,
|
|
783
796
|
debounce: 100,
|
|
784
797
|
elementRef: e,
|
|
785
|
-
children: [
|
|
798
|
+
children: [B(I, {}), B("div", {
|
|
786
799
|
className: "script-editor-pane",
|
|
787
800
|
style: { display: "contents" },
|
|
788
801
|
ref: e,
|
|
@@ -790,10 +803,10 @@ var { FocusActivation: be, CommandScopeProvider: xe, CommandAnchorProvider: Se,
|
|
|
790
803
|
})]
|
|
791
804
|
}) : t;
|
|
792
805
|
}, De = (e) => {
|
|
793
|
-
let { model: t, entryKey: n, frame: r, ref: i, ...a } = e, o =
|
|
794
|
-
|
|
806
|
+
let { model: t, entryKey: n, frame: r, ref: i, ...a } = e, o = R() ?? t;
|
|
807
|
+
L(o, ["onProtectionChange"]);
|
|
795
808
|
let s = o?.getScripts().isReadOnly() ?? !1;
|
|
796
|
-
return
|
|
809
|
+
return B(Te, { children: B(Q, {
|
|
797
810
|
ref: i,
|
|
798
811
|
readOnly: s,
|
|
799
812
|
frame: r,
|
|
@@ -801,7 +814,7 @@ var { FocusActivation: be, CommandScopeProvider: xe, CommandAnchorProvider: Se,
|
|
|
801
814
|
...a
|
|
802
815
|
}) });
|
|
803
816
|
}, $ = r((e) => {
|
|
804
|
-
let { alwaysShow: t = !1, ...n } = e, [r, i] = s((e) => e + 1, 0), [o] = T(["showScriptEditor"], { onChange: () => i() }), c =
|
|
817
|
+
let { alwaysShow: t = !1, ...n } = e, [r, i] = s((e) => e + 1, 0), [o] = T(["showScriptEditor"], { onChange: () => i() }), c = R(), [u, d] = l(t);
|
|
805
818
|
return a(() => {
|
|
806
819
|
if (t) return void d(!0);
|
|
807
820
|
let e = c?.getScripts();
|
|
@@ -822,11 +835,11 @@ var { FocusActivation: be, CommandScopeProvider: xe, CommandAnchorProvider: Se,
|
|
|
822
835
|
c,
|
|
823
836
|
o,
|
|
824
837
|
r
|
|
825
|
-
]), u ?
|
|
838
|
+
]), u ? V(z, { children: [B(j, {}), B(le, { ...n })] }) : null;
|
|
826
839
|
});
|
|
827
|
-
$.displayName = "RunScriptContribution",
|
|
840
|
+
$.displayName = "RunScriptContribution", K();
|
|
828
841
|
var Oe = r(n((e, n) => {
|
|
829
|
-
let { ...r } = e, i =
|
|
842
|
+
let { ...r } = e, i = R(), o = D(), [s, c] = l([]);
|
|
830
843
|
a(() => {
|
|
831
844
|
let e = i?.getScripts();
|
|
832
845
|
if (!e) return;
|
|
@@ -848,16 +861,16 @@ var Oe = r(n((e, n) => {
|
|
|
848
861
|
}, f = [], p = s ? s.length : 0;
|
|
849
862
|
for (let e = 0; e < p; e++) {
|
|
850
863
|
let t = s[e];
|
|
851
|
-
f.push(
|
|
864
|
+
f.push(B(O, {
|
|
852
865
|
...d,
|
|
853
866
|
commandKey: "insertFunction",
|
|
854
867
|
commandState: t,
|
|
855
868
|
propsTooltip: { description: o("insertFunction.insertNamed", { name: t.getName() ?? o("insertFunction.fallbackLabel") }) },
|
|
856
|
-
icon:
|
|
869
|
+
icon: B(b, { iconKey: "FormulaCustom" }),
|
|
857
870
|
label: t.getName() ?? o("insertFunction.fallbackLabel")
|
|
858
871
|
}, `function-${t.getName()}-${e}`));
|
|
859
872
|
}
|
|
860
|
-
let m =
|
|
873
|
+
let m = V(u, {
|
|
861
874
|
ref: n,
|
|
862
875
|
sx: {
|
|
863
876
|
display: "flex",
|
|
@@ -865,13 +878,13 @@ var Oe = r(n((e, n) => {
|
|
|
865
878
|
flex: "1 1 100%",
|
|
866
879
|
overflow: "hidden"
|
|
867
880
|
},
|
|
868
|
-
children: [f.length > 0 ?
|
|
881
|
+
children: [f.length > 0 ? V(z, { children: [B(u, {
|
|
869
882
|
sx: {
|
|
870
883
|
overflow: "auto",
|
|
871
884
|
flex: "1 1 100%"
|
|
872
885
|
},
|
|
873
886
|
children: f
|
|
874
|
-
}),
|
|
887
|
+
}), B(j, { orientation: "horizontal" })] }) : null, t(O, {
|
|
875
888
|
...d,
|
|
876
889
|
key: "show-editor",
|
|
877
890
|
commandKey: "showScriptEditor"
|
|
@@ -885,7 +898,7 @@ var Oe = r(n((e, n) => {
|
|
|
885
898
|
Oe.displayName = "InsertFunctionPopupPanel";
|
|
886
899
|
var ke = r(n((e, t) => {
|
|
887
900
|
let { disabled: n, groupKey: r, ...a } = e, o = w("customFunctionOptions"), s = i((e) => {
|
|
888
|
-
let t =
|
|
901
|
+
let t = B(Oe, {
|
|
889
902
|
disabled: n,
|
|
890
903
|
groupKey: r,
|
|
891
904
|
...e
|
|
@@ -895,10 +908,10 @@ var ke = r(n((e, t) => {
|
|
|
895
908
|
children: t
|
|
896
909
|
});
|
|
897
910
|
}, [n, r]);
|
|
898
|
-
return
|
|
911
|
+
return B(k, {
|
|
899
912
|
ref: t,
|
|
900
913
|
disabled: n,
|
|
901
|
-
|
|
914
|
+
renderPopupPanel: s,
|
|
902
915
|
label: o?.getLabel?.(),
|
|
903
916
|
tooltip: o?.getDescription?.(),
|
|
904
917
|
icon: "FormulaCustom",
|
|
@@ -907,7 +920,7 @@ var ke = r(n((e, t) => {
|
|
|
907
920
|
}));
|
|
908
921
|
ke.displayName = "InsertFunctionContribution";
|
|
909
922
|
var Ae = () => {
|
|
910
|
-
|
|
923
|
+
ie(), y.register("plugin-scripts", { icons: {} }), F.registerTaskPane({
|
|
911
924
|
key: "scriptEditor",
|
|
912
925
|
getTitle: () => "Script (Typescript)",
|
|
913
926
|
getIcon: () => "ScriptRun",
|
|
@@ -934,4 +947,4 @@ var Ae = () => {
|
|
|
934
947
|
render: (t) => e.createElement(ke, { ...t })
|
|
935
948
|
}, !0);
|
|
936
949
|
};
|
|
937
|
-
export { ve as InsertScriptCommandButton,
|
|
950
|
+
export { ve as InsertScriptCommandButton, le as RunScriptCommandButton, Z as ScriptEditorToolbar, De as ScriptTaskPane, Q as ScriptWorkspace, Ae as ScriptingPlugin };
|