@sheetxl/scripting-mui 0.8.0-beta.1 → 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/index.mjs +312 -302
- package/node/esm/index.mjs +371 -362
- package/package.json +12 -13
- package/resources/locales/de/ui.msg.json +3 -0
- package/resources/locales/en/ui.msg.json +3 -0
- package/types/src/command/InsertScriptCommandButton.d.ts +2 -1
- package/types/src/template/TemplateSelectPanel.d.ts +9 -3
- package/types/src/utils/ScriptTemplates.d.ts +27 -0
- package/types/src/utils/index.d.ts +1 -2
- package/browser/cjs/index.cjs +0 -1
- package/types/src/utils/FetchDirectory.d.ts +0 -20
- package/types/src/utils/Utils.d.ts +0 -2
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.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.
|
|
@@ -7,28 +7,34 @@
|
|
|
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, defaultCreatePopupPanel as P
|
|
11
|
-
import { DefaultTaskPaneRegistry as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
import { alpha as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
10
|
+
import { AnimatedLoadingPanel as ee, CommandButton as O, CommandPopupButton as k, CommandToolbar as A, ExhibitDivider as j, ExhibitMenuItem as M, OverflowPalette as N, defaultCreatePopupPanel as P } from "@sheetxl/utils-mui";
|
|
11
|
+
import { DefaultTaskPaneRegistry as te, InputClipboardInjector as F, useModelSync as I, useWorkbook as L } from "@sheetxl/react";
|
|
12
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
13
|
+
import { alpha as V } from "@mui/system";
|
|
14
|
+
import { listResources as H, releaseChannel as ne } from "@sheetxl/utils";
|
|
15
|
+
import { VERSION as re } from "@sheetxl/sdk";
|
|
16
|
+
import { ScriptEditor as ie, ScriptingReactPlugin as ae } from "@sheetxl/scripting-react";
|
|
17
|
+
function oe(e) {
|
|
17
18
|
var t, n, r = "";
|
|
18
19
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
19
|
-
else if (typeof e == "object")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
else if (typeof e == "object") {
|
|
21
|
+
if (Array.isArray(e)) {
|
|
22
|
+
var i = e.length;
|
|
23
|
+
for (t = 0; t < i; t++) e[t] && (n = oe(e[t])) && (r && (r += " "), r += n);
|
|
24
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
25
|
+
}
|
|
23
26
|
return r;
|
|
24
27
|
}
|
|
25
|
-
function
|
|
26
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
28
|
+
function U() {
|
|
29
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = oe(e)) && (r && (r += " "), r += t);
|
|
27
30
|
return r;
|
|
28
31
|
}
|
|
29
|
-
var
|
|
32
|
+
var se = {
|
|
30
33
|
"insertFunction.fallbackLabel": "Function",
|
|
31
34
|
"insertFunction.insertNamed": "Insert {name}",
|
|
35
|
+
"insertScript.fallbackLabel": "Insert Script",
|
|
36
|
+
"insertScript.loadFailedRetry": "Couldn’t load templates. Retry",
|
|
37
|
+
"insertScript.loading": "Loading...",
|
|
32
38
|
"runScript.executeNamed": "Execute {name}",
|
|
33
39
|
"runScript.fallbackLabel": "Macro",
|
|
34
40
|
"templateSelect.blankSummary": "Start with an empty script.",
|
|
@@ -39,13 +45,13 @@ var re = {
|
|
|
39
45
|
"templateSelect.loadFailed": "Failed to load scripts",
|
|
40
46
|
"templateSelect.title": "Script Template",
|
|
41
47
|
"templateSelect.untitled": "Untitled"
|
|
42
|
-
}, { DefaultCommandCatalogService:
|
|
43
|
-
function
|
|
44
|
-
|
|
48
|
+
}, { DefaultCommandCatalogService: ce } = g, W = !1;
|
|
49
|
+
function G() {
|
|
50
|
+
W || (W = !0, ce.registerFromManifest("@sheetxl/scripting-mui", import.meta.url, { messages: se }));
|
|
45
51
|
}
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
let { groupKey: r, ...i } = e, o =
|
|
52
|
+
G();
|
|
53
|
+
var le = r(n((e, n) => {
|
|
54
|
+
let { groupKey: r, ...i } = e, o = L(), s = D(), [c, d] = l([]), [f, p] = l(!1);
|
|
49
55
|
a(() => {
|
|
50
56
|
let e = o?.getScripts();
|
|
51
57
|
e && (async () => {
|
|
@@ -61,16 +67,16 @@ var J = r(n((e, n) => {
|
|
|
61
67
|
}, h = [], g = c ? c.length : 0;
|
|
62
68
|
for (let e = 0; e < g; e++) {
|
|
63
69
|
let t = c[e];
|
|
64
|
-
h.push(
|
|
70
|
+
h.push(z(O, {
|
|
65
71
|
...m,
|
|
66
72
|
commandKey: "executeScript",
|
|
67
73
|
commandState: { declaration: t },
|
|
68
74
|
propsTooltip: { description: s("runScript.executeNamed", { name: t.getName() ?? s("runScript.fallbackLabel") }) },
|
|
69
|
-
icon:
|
|
75
|
+
icon: z(b, { iconKey: "ScriptMacro" }),
|
|
70
76
|
label: t.getName() ?? s("runScript.fallbackLabel")
|
|
71
77
|
}, `macro-${t.getName()}-${e}`));
|
|
72
78
|
}
|
|
73
|
-
let v =
|
|
79
|
+
let v = B(u, {
|
|
74
80
|
ref: n,
|
|
75
81
|
sx: {
|
|
76
82
|
display: "flex",
|
|
@@ -78,13 +84,13 @@ var J = r(n((e, n) => {
|
|
|
78
84
|
flex: "1 1 100%",
|
|
79
85
|
overflow: "hidden"
|
|
80
86
|
},
|
|
81
|
-
children: [h.length > 0 ?
|
|
87
|
+
children: [h.length > 0 ? B(R, { children: [z(u, {
|
|
82
88
|
sx: {
|
|
83
89
|
overflow: "auto",
|
|
84
90
|
flex: "1 1 100%"
|
|
85
91
|
},
|
|
86
92
|
children: h
|
|
87
|
-
}),
|
|
93
|
+
}), z(j, { orientation: "horizontal" })] }) : null, t(O, {
|
|
88
94
|
...m,
|
|
89
95
|
key: "show-editor",
|
|
90
96
|
commandKey: "showScriptEditor"
|
|
@@ -95,73 +101,68 @@ var J = r(n((e, n) => {
|
|
|
95
101
|
children: v
|
|
96
102
|
});
|
|
97
103
|
}));
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
let { groupKey: n, disabled: r, ...a } = e, o = T(["showScriptEditor"])[0], s = w("scriptsOptions")
|
|
101
|
-
|
|
104
|
+
le.displayName = "RunScriptPopupPanel";
|
|
105
|
+
var ue = r(n((e, t) => {
|
|
106
|
+
let { groupKey: n, disabled: r, ...a } = e, o = T(["showScriptEditor"])[0], s = w("scriptsOptions"), c = i((e) => {
|
|
107
|
+
let t = z(le, {
|
|
108
|
+
disabled: r,
|
|
109
|
+
groupKey: n,
|
|
110
|
+
...e
|
|
111
|
+
});
|
|
112
|
+
return P({
|
|
113
|
+
...e,
|
|
114
|
+
children: t
|
|
115
|
+
});
|
|
116
|
+
}, [r, n]);
|
|
117
|
+
return z(k, {
|
|
102
118
|
ref: t,
|
|
103
119
|
disabled: r,
|
|
104
|
-
createPopupPanel:
|
|
105
|
-
let t = B(J, {
|
|
106
|
-
disabled: r,
|
|
107
|
-
groupKey: n,
|
|
108
|
-
...e
|
|
109
|
-
});
|
|
110
|
-
return P({
|
|
111
|
-
...e,
|
|
112
|
-
children: t
|
|
113
|
-
});
|
|
114
|
-
}, [r, n]),
|
|
120
|
+
createPopupPanel: c,
|
|
115
121
|
selected: o?.getState(),
|
|
116
122
|
label: s?.getLabel?.(),
|
|
117
123
|
tooltip: s?.getDescription?.(),
|
|
118
124
|
quickCommand: "showScriptEditor",
|
|
119
125
|
...a
|
|
120
126
|
});
|
|
121
|
-
})),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
let n = e.
|
|
127
|
-
return n.
|
|
128
|
-
},
|
|
129
|
-
if (
|
|
130
|
-
let
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (!n.ok) throw new U(`Failed to retrieve directory at '${e}': ${n.statusText}`);
|
|
135
|
-
let r = await n.text();
|
|
136
|
-
if (r.trim().toLowerCase().startsWith("<!doctype html") || r.trim().toLowerCase().startsWith("<html")) throw new U(`Failed to retrieve directory at '${e}'`);
|
|
137
|
-
let i;
|
|
127
|
+
})), K = ne(re), q = `https://unpkg.com/@sheetxl/templates-scripting${K ? `@${K}` : ""}/dist`, de = "templates-scripting", fe = [
|
|
128
|
+
"formula",
|
|
129
|
+
"macro",
|
|
130
|
+
"autostart"
|
|
131
|
+
], pe = (e) => typeof e == "string" && e ? e : void 0, me = (e, t) => {
|
|
132
|
+
let n = (e.split("/").pop() ?? "").replace(/\.[^/.]+$/, "");
|
|
133
|
+
return t === "formula" ? n.toUpperCase() : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase());
|
|
134
|
+
}, he = async (e, t) => {
|
|
135
|
+
if (!/\.ts$/i.test(t.path)) return null;
|
|
136
|
+
let n = fe.includes(t.icon) ? t.icon : void 0, r = ((e, t) => {
|
|
137
|
+
let n = `${e}${e.endsWith("/") ? "" : "/"}${de}/${t}`;
|
|
138
|
+
return typeof document > "u" ? n : new URL(n, document.baseURI).href;
|
|
139
|
+
})(e, t.path), i;
|
|
138
140
|
try {
|
|
139
|
-
|
|
141
|
+
let e = await fetch(r);
|
|
142
|
+
if (!e.ok || (e.headers.get("content-type") ?? "").includes("text/html")) throw Error(e.ok ? "not found" : e.statusText || String(e.status));
|
|
143
|
+
i = await e.text();
|
|
140
144
|
} catch (e) {
|
|
141
|
-
|
|
145
|
+
return console.warn(`Script template '${r}' did not load: ${e?.message ?? e}`), null;
|
|
142
146
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
return
|
|
162
|
-
}, Y = { marginRight: "4px" }, X = "1em", ue = r((e) => {
|
|
163
|
-
let { disabled: t, snippet: n, description: r, handleInsert: i, sx: a, ...o } = e, s, c = n.metadata?.icon;
|
|
164
|
-
return s = B(b, c === "formula" ? {
|
|
147
|
+
return {
|
|
148
|
+
path: t.path,
|
|
149
|
+
title: pe(t.title) ?? me(t.path, n),
|
|
150
|
+
summary: pe(t.summary),
|
|
151
|
+
icon: n,
|
|
152
|
+
content: i
|
|
153
|
+
};
|
|
154
|
+
}, J = /* @__PURE__ */ new Map(), ge = (e = q) => {
|
|
155
|
+
let t = J.get(e);
|
|
156
|
+
return t || (t = (async () => {
|
|
157
|
+
let t = (await H("templates", de, e)).find((e) => e.meta?.schema !== void 0);
|
|
158
|
+
if (!t) throw Error(`No script templates found at '${e}'.`);
|
|
159
|
+
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
|
+
})(), J.set(e, t), t.catch(() => {
|
|
161
|
+
J.delete(e);
|
|
162
|
+
})), t;
|
|
163
|
+
}, Y = { marginRight: "4px" }, X = "1em", _e = r((e) => {
|
|
164
|
+
let { disabled: t, snippet: n, description: r, handleInsert: i, sx: a, ...o } = e, s, c = n.icon;
|
|
165
|
+
return s = z(b, c === "formula" ? {
|
|
165
166
|
iconKey: "ScriptFormula",
|
|
166
167
|
size: X,
|
|
167
168
|
style: Y
|
|
@@ -173,7 +174,7 @@ var ae = r(n((e, t) => {
|
|
|
173
174
|
iconKey: "ScriptAutoRun",
|
|
174
175
|
size: X,
|
|
175
176
|
style: Y
|
|
176
|
-
}),
|
|
177
|
+
}), z(M, {
|
|
177
178
|
sx: {
|
|
178
179
|
maxWidth: "460px",
|
|
179
180
|
display: "flex",
|
|
@@ -192,57 +193,69 @@ var ae = r(n((e, t) => {
|
|
|
192
193
|
e.keyCode !== x.Enter && e.keyCode !== x.Space || i(n);
|
|
193
194
|
},
|
|
194
195
|
...o,
|
|
195
|
-
children:
|
|
196
|
+
children: B(u, {
|
|
196
197
|
sx: {
|
|
197
198
|
display: "flex",
|
|
198
199
|
flex: "1 1 100%",
|
|
199
200
|
flexDirection: "column",
|
|
200
201
|
overflow: "hidden"
|
|
201
202
|
},
|
|
202
|
-
children: [
|
|
203
|
+
children: [z(m, {
|
|
203
204
|
component: "div",
|
|
204
|
-
children: n.
|
|
205
|
-
}),
|
|
205
|
+
children: n.title
|
|
206
|
+
}), z(m, {
|
|
206
207
|
variant: "caption",
|
|
207
208
|
component: "div",
|
|
208
209
|
sx: {
|
|
209
|
-
color: (e) =>
|
|
210
|
+
color: (e) => V(e.palette.text.secondary ?? e.palette.text.primary, .6),
|
|
210
211
|
overflow: "hidden",
|
|
211
212
|
textOverflow: "ellipsis"
|
|
212
213
|
},
|
|
213
|
-
children: n.
|
|
214
|
+
children: n.summary
|
|
214
215
|
})]
|
|
215
216
|
})
|
|
216
217
|
});
|
|
217
|
-
}),
|
|
218
|
-
let { groupKey: r, disabled: o, scriptPath: s =
|
|
218
|
+
}), ve = r(n((e, n) => {
|
|
219
|
+
let { groupKey: r, disabled: o, scriptPath: s = q, ...c } = e, d = D(), [f, p] = l([]), [m, h] = l("loading"), [g, v] = l(0), [y] = T(["insertScript"]), b = o || (y?.disabled() ?? !1);
|
|
219
220
|
a(() => {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
}, [s]);
|
|
229
|
-
let
|
|
230
|
-
if (
|
|
221
|
+
let e = !1;
|
|
222
|
+
return h("loading"), ge(s).then((t) => {
|
|
223
|
+
e || (p(t), h("ready"));
|
|
224
|
+
}, () => {
|
|
225
|
+
e || (p([]), h("error"));
|
|
226
|
+
}), () => {
|
|
227
|
+
e = !0;
|
|
228
|
+
};
|
|
229
|
+
}, [s, g]);
|
|
230
|
+
let S = i((e) => {
|
|
231
|
+
if (m === "loading") return z("div", { children: d("insertScript.loading") });
|
|
231
232
|
let n = {
|
|
232
233
|
variant: _.Menuitem,
|
|
233
234
|
groupKey: "scriptsOptions",
|
|
234
|
-
disabled:
|
|
235
|
+
disabled: b
|
|
235
236
|
}, r = (t) => {
|
|
236
|
-
|
|
237
|
-
}, i = [];
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
y?.execute(t.content), e.closeFloat?.();
|
|
238
|
+
}, i = () => v((e) => e + 1), a = [];
|
|
239
|
+
m === "error" && a.push(z(M, {
|
|
240
|
+
onMouseDown: (e) => {
|
|
241
|
+
e.button === 0 && e.preventDefault();
|
|
242
|
+
},
|
|
243
|
+
onMouseUp: (e) => {
|
|
244
|
+
e.button === 0 && i();
|
|
245
|
+
},
|
|
246
|
+
onKeyDown: (e) => {
|
|
247
|
+
e.keyCode !== x.Enter && e.keyCode !== x.Space || i();
|
|
248
|
+
},
|
|
249
|
+
children: d("insertScript.loadFailedRetry")
|
|
250
|
+
}, "retry"));
|
|
251
|
+
for (let e = 0; e < f.length; e++) {
|
|
252
|
+
let t = f[e];
|
|
253
|
+
t && a.push(z(_e, {
|
|
241
254
|
handleInsert: r,
|
|
242
255
|
snippet: t
|
|
243
256
|
}, t.path));
|
|
244
257
|
}
|
|
245
|
-
let
|
|
258
|
+
let o = B(u, {
|
|
246
259
|
sx: {
|
|
247
260
|
display: "flex",
|
|
248
261
|
flexDirection: "column",
|
|
@@ -250,13 +263,13 @@ var ae = r(n((e, t) => {
|
|
|
250
263
|
overflow: "hidden"
|
|
251
264
|
},
|
|
252
265
|
children: [
|
|
253
|
-
|
|
266
|
+
a.length > 0 ? B(R, { children: [z(u, {
|
|
254
267
|
sx: {
|
|
255
268
|
overflow: "auto",
|
|
256
269
|
flex: "1 1 100%"
|
|
257
270
|
},
|
|
258
|
-
children:
|
|
259
|
-
}),
|
|
271
|
+
children: a
|
|
272
|
+
}), z(j, { orientation: "horizontal" })] }) : null,
|
|
260
273
|
t(O, {
|
|
261
274
|
...n,
|
|
262
275
|
key: "showKeyboardShortcuts",
|
|
@@ -271,84 +284,79 @@ var ae = r(n((e, t) => {
|
|
|
271
284
|
});
|
|
272
285
|
return P({
|
|
273
286
|
...e,
|
|
274
|
-
children:
|
|
287
|
+
children: o
|
|
275
288
|
});
|
|
276
289
|
}, [
|
|
277
|
-
|
|
290
|
+
b,
|
|
278
291
|
r,
|
|
279
|
-
|
|
280
|
-
|
|
292
|
+
m,
|
|
293
|
+
f,
|
|
294
|
+
y,
|
|
295
|
+
d
|
|
281
296
|
]);
|
|
282
|
-
return
|
|
297
|
+
return z(k, {
|
|
283
298
|
ref: n,
|
|
284
|
-
disabled:
|
|
299
|
+
disabled: b,
|
|
285
300
|
groupKey: r,
|
|
286
|
-
label:
|
|
287
|
-
tooltip:
|
|
288
|
-
createPopupPanel:
|
|
289
|
-
icon:
|
|
301
|
+
label: y?.getLabel(r) ?? d("insertScript.fallbackLabel"),
|
|
302
|
+
tooltip: y?.getDescription(),
|
|
303
|
+
createPopupPanel: S,
|
|
304
|
+
icon: y?.getIcon() ?? "ScriptInsert",
|
|
290
305
|
...c
|
|
291
306
|
});
|
|
292
307
|
})), Z = r(n((e, t) => {
|
|
293
|
-
let { propsCommandButton: n, ...r } = e
|
|
294
|
-
|
|
308
|
+
let { propsCommandButton: n, ...r } = e, i = C((e) => {
|
|
309
|
+
let { propsCommandButton: t, propsCommandPopup: n } = e;
|
|
310
|
+
return z(R, { children: B("div", {
|
|
311
|
+
style: {
|
|
312
|
+
display: "flex",
|
|
313
|
+
flex: "1 1 100%"
|
|
314
|
+
},
|
|
315
|
+
children: [
|
|
316
|
+
z("div", { children: z(N, {
|
|
317
|
+
style: {},
|
|
318
|
+
children: z(O, {
|
|
319
|
+
...t,
|
|
320
|
+
commandKey: "saveScripts"
|
|
321
|
+
})
|
|
322
|
+
}) }),
|
|
323
|
+
z("div", { style: { flex: "1 1 100%" } }),
|
|
324
|
+
z("div", { children: z(N, {
|
|
325
|
+
style: {},
|
|
326
|
+
children: z(ve, { ...t })
|
|
327
|
+
}) })
|
|
328
|
+
]
|
|
329
|
+
}) });
|
|
330
|
+
}, []);
|
|
331
|
+
return z(A, {
|
|
295
332
|
ref: t,
|
|
296
333
|
propsCommandButton: n,
|
|
297
|
-
renderToolbarPalette:
|
|
298
|
-
let { propsCommandButton: t, propsCommandPopup: n } = e;
|
|
299
|
-
return B(z, { children: V("div", {
|
|
300
|
-
style: {
|
|
301
|
-
display: "flex",
|
|
302
|
-
flex: "1 1 100%"
|
|
303
|
-
},
|
|
304
|
-
children: [
|
|
305
|
-
B("div", { children: B(N, {
|
|
306
|
-
style: {},
|
|
307
|
-
children: B(O, {
|
|
308
|
-
...t,
|
|
309
|
-
commandKey: "saveScripts"
|
|
310
|
-
})
|
|
311
|
-
}) }),
|
|
312
|
-
B("div", { style: { flex: "1 1 100%" } }),
|
|
313
|
-
B("div", { children: B(N, {
|
|
314
|
-
style: {},
|
|
315
|
-
children: B(de, { ...t })
|
|
316
|
-
}) })
|
|
317
|
-
]
|
|
318
|
-
}) });
|
|
319
|
-
}, []),
|
|
334
|
+
renderToolbarPalette: i,
|
|
320
335
|
...r
|
|
321
336
|
});
|
|
322
337
|
}));
|
|
323
|
-
Z.displayName = "ScriptEditorToolbar",
|
|
324
|
-
var
|
|
325
|
-
let { scriptPath: n =
|
|
338
|
+
Z.displayName = "ScriptEditorToolbar", G();
|
|
339
|
+
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);
|
|
326
341
|
if (a(() => {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
} finally {
|
|
346
|
-
v(e), x(!1);
|
|
347
|
-
}
|
|
348
|
-
})();
|
|
349
|
-
}, [n, g]), y) return B(u, {
|
|
350
|
-
className: G(o, "script-select"),
|
|
351
|
-
...h,
|
|
342
|
+
let e = !1, t = {
|
|
343
|
+
path: null,
|
|
344
|
+
title: _("templateSelect.blankTitle"),
|
|
345
|
+
summary: _("templateSelect.blankSummary"),
|
|
346
|
+
content: ""
|
|
347
|
+
};
|
|
348
|
+
return C(!0), T(null), ge(n).then((n) => {
|
|
349
|
+
e || y([t, ...n]);
|
|
350
|
+
}, (n) => {
|
|
351
|
+
e || (y([t]), T(n instanceof Error ? n.message : _("templateSelect.loadFailed")));
|
|
352
|
+
}).finally(() => {
|
|
353
|
+
e || C(!1);
|
|
354
|
+
}), () => {
|
|
355
|
+
e = !0;
|
|
356
|
+
};
|
|
357
|
+
}, [n, _]), x) return z(u, {
|
|
358
|
+
className: U(s, "script-select"),
|
|
359
|
+
...g,
|
|
352
360
|
sx: [{
|
|
353
361
|
display: "flex",
|
|
354
362
|
justifyContent: "center",
|
|
@@ -356,15 +364,14 @@ var fe = r(n((e, t) => {
|
|
|
356
364
|
height: "100%",
|
|
357
365
|
background: (e) => e.palette.background.paper,
|
|
358
366
|
zIndex: 1e3,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
children: B(f, {})
|
|
367
|
+
...Array.isArray(o) ? {} : o
|
|
368
|
+
}, ...Array.isArray(o) ? o : []],
|
|
369
|
+
children: z(f, {})
|
|
363
370
|
});
|
|
364
|
-
let
|
|
365
|
-
|
|
366
|
-
className:
|
|
367
|
-
...
|
|
371
|
+
let E = null;
|
|
372
|
+
w && (E = B(u, {
|
|
373
|
+
className: U(s, "script-select", "error-results"),
|
|
374
|
+
...g,
|
|
368
375
|
sx: [{
|
|
369
376
|
display: "flex",
|
|
370
377
|
justifyContent: "center",
|
|
@@ -376,45 +383,43 @@ var fe = r(n((e, t) => {
|
|
|
376
383
|
padding: (e) => e.spacing(1),
|
|
377
384
|
border: (e) => `1px solid ${e.palette.error.main}`,
|
|
378
385
|
borderBottomLeftRadius: 1,
|
|
379
|
-
borderBottomRightRadius: 1
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
children: [B(m, {
|
|
386
|
+
borderBottomRightRadius: 1
|
|
387
|
+
}, ...Array.isArray(o) ? o : [o]],
|
|
388
|
+
children: [z(m, {
|
|
383
389
|
color: "error",
|
|
384
390
|
variant: "h6",
|
|
385
391
|
component: "div",
|
|
386
392
|
gutterBottom: !0,
|
|
387
|
-
children:
|
|
388
|
-
}),
|
|
393
|
+
children: _("templateSelect.errorTitle")
|
|
394
|
+
}), z(m, {
|
|
389
395
|
color: "error",
|
|
390
396
|
component: "div",
|
|
391
|
-
children:
|
|
397
|
+
children: w
|
|
392
398
|
})]
|
|
393
399
|
}));
|
|
394
|
-
let
|
|
395
|
-
let t = e.
|
|
396
|
-
return t === "macro" ?
|
|
400
|
+
let ee = (e) => {
|
|
401
|
+
let t = e.icon;
|
|
402
|
+
return t === "macro" ? z(b, {
|
|
397
403
|
iconKey: "ScriptMacro",
|
|
398
404
|
size: "1em"
|
|
399
|
-
}) : t === "formula" ?
|
|
405
|
+
}) : t === "formula" ? z(b, {
|
|
400
406
|
iconKey: "ScriptFormula",
|
|
401
407
|
size: "1em"
|
|
402
|
-
}) : t === "autostart" ?
|
|
408
|
+
}) : t === "autostart" ? z(b, {
|
|
403
409
|
iconKey: "ScriptAutoRun",
|
|
404
410
|
size: "1em"
|
|
405
411
|
}) : null;
|
|
406
412
|
};
|
|
407
|
-
return
|
|
413
|
+
return B(u, {
|
|
408
414
|
ref: t,
|
|
409
|
-
className:
|
|
415
|
+
className: U(s, "script-select"),
|
|
410
416
|
sx: {
|
|
411
417
|
background: (e) => e.palette.background.paper,
|
|
412
418
|
zIndex: 1e3,
|
|
413
|
-
|
|
414
|
-
...i
|
|
419
|
+
...o
|
|
415
420
|
},
|
|
416
|
-
...
|
|
417
|
-
children: [
|
|
421
|
+
...g,
|
|
422
|
+
children: [B(u, {
|
|
418
423
|
className: "script-select-content",
|
|
419
424
|
sx: {
|
|
420
425
|
p: 3,
|
|
@@ -422,39 +427,40 @@ var fe = r(n((e, t) => {
|
|
|
422
427
|
flex: "1 1 auto"
|
|
423
428
|
},
|
|
424
429
|
children: [
|
|
425
|
-
|
|
430
|
+
z(m, {
|
|
426
431
|
variant: "h6",
|
|
427
432
|
gutterBottom: !0,
|
|
428
|
-
children:
|
|
433
|
+
children: _("templateSelect.title")
|
|
429
434
|
}),
|
|
430
|
-
|
|
435
|
+
z(m, {
|
|
431
436
|
variant: "body2",
|
|
432
437
|
component: "div",
|
|
433
438
|
gutterBottom: !0,
|
|
434
439
|
sx: { color: "text.secondary" },
|
|
435
|
-
children:
|
|
440
|
+
children: _("templateSelect.intro")
|
|
436
441
|
}),
|
|
437
|
-
|
|
442
|
+
z(m, {
|
|
438
443
|
variant: "body2",
|
|
439
444
|
component: "div",
|
|
440
445
|
gutterBottom: !0,
|
|
441
446
|
sx: { color: "text.secondary" },
|
|
442
|
-
children:
|
|
447
|
+
children: _("templateSelect.intro2")
|
|
443
448
|
}),
|
|
444
|
-
|
|
449
|
+
z(u, {
|
|
445
450
|
sx: {
|
|
446
451
|
display: "grid",
|
|
447
|
-
gridTemplateColumns: `repeat(auto-fill, minmax(${
|
|
448
|
-
gap: `${
|
|
452
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${c}px, 1fr))`,
|
|
453
|
+
gap: `${h}px`,
|
|
449
454
|
padding: 2,
|
|
450
455
|
paddingLeft: "0px",
|
|
451
456
|
paddingRight: "0px"
|
|
452
457
|
},
|
|
453
|
-
children:
|
|
458
|
+
children: v.map((e, t) => B(d, {
|
|
454
459
|
variant: "outlined",
|
|
460
|
+
disabled: i,
|
|
455
461
|
sx: {
|
|
456
|
-
minWidth:
|
|
457
|
-
minHeight:
|
|
462
|
+
minWidth: c,
|
|
463
|
+
minHeight: p,
|
|
458
464
|
display: "flex",
|
|
459
465
|
flexDirection: "column",
|
|
460
466
|
justifyContent: "flex-start",
|
|
@@ -470,7 +476,7 @@ var fe = r(n((e, t) => {
|
|
|
470
476
|
...t === 1 && { gridColumn: "1" }
|
|
471
477
|
},
|
|
472
478
|
onClick: () => r?.(e),
|
|
473
|
-
children: [
|
|
479
|
+
children: [B(u, {
|
|
474
480
|
sx: {
|
|
475
481
|
display: "flex",
|
|
476
482
|
flexDirection: "row",
|
|
@@ -479,12 +485,12 @@ var fe = r(n((e, t) => {
|
|
|
479
485
|
width: "100%",
|
|
480
486
|
marginBottom: .5
|
|
481
487
|
},
|
|
482
|
-
children: [
|
|
488
|
+
children: [z(m, {
|
|
483
489
|
variant: "subtitle2",
|
|
484
490
|
component: "div",
|
|
485
|
-
children: e.
|
|
486
|
-
}),
|
|
487
|
-
}), e.
|
|
491
|
+
children: e.title || _("templateSelect.untitled")
|
|
492
|
+
}), ee(e)]
|
|
493
|
+
}), e.summary && z(m, {
|
|
488
494
|
variant: "body2",
|
|
489
495
|
component: "div",
|
|
490
496
|
sx: {
|
|
@@ -495,15 +501,15 @@ var fe = r(n((e, t) => {
|
|
|
495
501
|
textOverflow: "ellipsis",
|
|
496
502
|
alignItems: "flex-start"
|
|
497
503
|
},
|
|
498
|
-
children: e.
|
|
504
|
+
children: e.summary
|
|
499
505
|
})]
|
|
500
506
|
}, `${e.path}-${t}`))
|
|
501
507
|
})
|
|
502
508
|
]
|
|
503
|
-
}),
|
|
509
|
+
}), E]
|
|
504
510
|
});
|
|
505
511
|
}));
|
|
506
|
-
|
|
512
|
+
ye.displayName = "TemplateSelectPanel";
|
|
507
513
|
var Q = r(n((e, t) => {
|
|
508
514
|
let { className: n, sx: r, propsScriptEditor: s, readOnly: d = !1, frame: f, autoFocusSel: g, autoFocus: _ = !0, scripts: v, ...y } = e, b = h(), [x, S] = l(!1), w = c(!1), [T, D] = l({
|
|
509
515
|
message: "Loading",
|
|
@@ -526,7 +532,7 @@ var Q = r(n((e, t) => {
|
|
|
526
532
|
...t,
|
|
527
533
|
...e
|
|
528
534
|
}));
|
|
529
|
-
}, []), j = c(null), [M, N] = l(null), P = c(null),
|
|
535
|
+
}, []), j = c(null), [M, N] = l(null), P = c(null), te = C((e) => {
|
|
530
536
|
if (M) return M.focus(e), !0;
|
|
531
537
|
if (g) {
|
|
532
538
|
let t = j.current?.querySelectorAll?.(g);
|
|
@@ -537,7 +543,7 @@ var Q = r(n((e, t) => {
|
|
|
537
543
|
M,
|
|
538
544
|
g,
|
|
539
545
|
_
|
|
540
|
-
]),
|
|
546
|
+
]), F = o(() => z(ee, {
|
|
541
547
|
transitionDelay: "160ms",
|
|
542
548
|
style: {
|
|
543
549
|
position: "absolute",
|
|
@@ -545,7 +551,7 @@ var Q = r(n((e, t) => {
|
|
|
545
551
|
height: "100%"
|
|
546
552
|
},
|
|
547
553
|
transparentBackground: !1
|
|
548
|
-
}), []),
|
|
554
|
+
}), []), I = o(() => z(p, {
|
|
549
555
|
elevation: 1,
|
|
550
556
|
tabIndex: 0,
|
|
551
557
|
sx: {
|
|
@@ -558,9 +564,9 @@ var Q = r(n((e, t) => {
|
|
|
558
564
|
marginTop: (e) => e.spacing(1),
|
|
559
565
|
marginBottom: (e) => e.spacing(1)
|
|
560
566
|
},
|
|
561
|
-
children:
|
|
562
|
-
}), [b]),
|
|
563
|
-
className:
|
|
567
|
+
children: z(Z, {})
|
|
568
|
+
}), [b]), L = o(() => z(u, {
|
|
569
|
+
className: U("script-status-panel", "status-panel"),
|
|
564
570
|
sx: {
|
|
565
571
|
display: "flex",
|
|
566
572
|
alignItems: "stretch",
|
|
@@ -574,7 +580,7 @@ var Q = r(n((e, t) => {
|
|
|
574
580
|
margin: 0,
|
|
575
581
|
borderTop: `solid 1px ${b.palette.divider}`
|
|
576
582
|
},
|
|
577
|
-
children:
|
|
583
|
+
children: B("div", {
|
|
578
584
|
style: {
|
|
579
585
|
flex: "1 1 100%",
|
|
580
586
|
display: "flex",
|
|
@@ -583,7 +589,7 @@ var Q = r(n((e, t) => {
|
|
|
583
589
|
justifyContent: "center"
|
|
584
590
|
},
|
|
585
591
|
children: [
|
|
586
|
-
|
|
592
|
+
z(m, {
|
|
587
593
|
component: "div",
|
|
588
594
|
sx: {
|
|
589
595
|
userSelect: "none",
|
|
@@ -596,7 +602,7 @@ var Q = r(n((e, t) => {
|
|
|
596
602
|
variant: "caption",
|
|
597
603
|
children: T.message
|
|
598
604
|
}),
|
|
599
|
-
|
|
605
|
+
z(m, {
|
|
600
606
|
component: "div",
|
|
601
607
|
sx: {
|
|
602
608
|
userSelect: "none",
|
|
@@ -609,7 +615,7 @@ var Q = r(n((e, t) => {
|
|
|
609
615
|
variant: "caption",
|
|
610
616
|
children: T.dirty ? "Unsaved" : ""
|
|
611
617
|
}),
|
|
612
|
-
|
|
618
|
+
z(m, {
|
|
613
619
|
component: "div",
|
|
614
620
|
sx: {
|
|
615
621
|
userSelect: "none",
|
|
@@ -628,8 +634,8 @@ var Q = r(n((e, t) => {
|
|
|
628
634
|
})
|
|
629
635
|
]
|
|
630
636
|
})
|
|
631
|
-
}), [T]),
|
|
632
|
-
className:
|
|
637
|
+
}), [T]), R = o(() => B(u, {
|
|
638
|
+
className: U("script-editor-content"),
|
|
633
639
|
sx: {
|
|
634
640
|
display: "flex",
|
|
635
641
|
flex: "1 1 100%",
|
|
@@ -638,8 +644,8 @@ var Q = r(n((e, t) => {
|
|
|
638
644
|
boxSizing: "border-box"
|
|
639
645
|
},
|
|
640
646
|
children: [
|
|
641
|
-
|
|
642
|
-
|
|
647
|
+
I,
|
|
648
|
+
z(u, {
|
|
643
649
|
sx: {
|
|
644
650
|
display: "flex",
|
|
645
651
|
flex: "1 1 100%",
|
|
@@ -648,9 +654,9 @@ var Q = r(n((e, t) => {
|
|
|
648
654
|
position: "relative",
|
|
649
655
|
boxSizing: "border-box"
|
|
650
656
|
},
|
|
651
|
-
children:
|
|
657
|
+
children: z(ie, {
|
|
652
658
|
ref: j,
|
|
653
|
-
loadingPanel:
|
|
659
|
+
loadingPanel: F,
|
|
654
660
|
readOnly: d,
|
|
655
661
|
frame: f,
|
|
656
662
|
scripts: v,
|
|
@@ -660,23 +666,23 @@ var Q = r(n((e, t) => {
|
|
|
660
666
|
...s
|
|
661
667
|
})
|
|
662
668
|
}),
|
|
663
|
-
|
|
669
|
+
L
|
|
664
670
|
]
|
|
665
671
|
}), [
|
|
666
672
|
b,
|
|
673
|
+
I,
|
|
667
674
|
L,
|
|
668
|
-
R,
|
|
669
675
|
x,
|
|
670
|
-
|
|
676
|
+
F,
|
|
671
677
|
d,
|
|
672
678
|
s,
|
|
673
679
|
_,
|
|
674
680
|
g,
|
|
675
681
|
f,
|
|
676
682
|
A
|
|
677
|
-
]),
|
|
683
|
+
]), V = o(() => {
|
|
678
684
|
let e;
|
|
679
|
-
return O === null ?
|
|
685
|
+
return O === null ? F : (O.source === null && (e = z(ye, {
|
|
680
686
|
sx: {
|
|
681
687
|
display: "flex",
|
|
682
688
|
flex: "1 1 100%",
|
|
@@ -687,12 +693,13 @@ var Q = r(n((e, t) => {
|
|
|
687
693
|
width: "100%",
|
|
688
694
|
height: "100%"
|
|
689
695
|
},
|
|
696
|
+
disabled: d,
|
|
690
697
|
onScriptSelect: (e) => {
|
|
691
698
|
j.current?.insertSnippet(e.content), k({ source: e.content ?? "" }), requestAnimationFrame(() => j.current?.focus());
|
|
692
699
|
}
|
|
693
|
-
})),
|
|
700
|
+
})), z(u, {
|
|
694
701
|
tabIndex: 0,
|
|
695
|
-
className:
|
|
702
|
+
className: U("script-workspace", n),
|
|
696
703
|
sx: {
|
|
697
704
|
display: "flex",
|
|
698
705
|
flex: "1 1 100%",
|
|
@@ -706,13 +713,13 @@ var Q = r(n((e, t) => {
|
|
|
706
713
|
onPointerDown: (e) => {
|
|
707
714
|
e.isDefaultPrevented() || j.current?.focus();
|
|
708
715
|
},
|
|
709
|
-
children:
|
|
716
|
+
children: B(u, {
|
|
710
717
|
sx: {
|
|
711
718
|
flex: "1 1 100%",
|
|
712
719
|
position: "relative",
|
|
713
720
|
display: "flex"
|
|
714
721
|
},
|
|
715
|
-
children: [
|
|
722
|
+
children: [z(u, {
|
|
716
723
|
sx: {
|
|
717
724
|
display: "flex",
|
|
718
725
|
flex: "1 1 100%",
|
|
@@ -720,23 +727,24 @@ var Q = r(n((e, t) => {
|
|
|
720
727
|
minHeight: 0,
|
|
721
728
|
visibility: e ? "hidden" : "visible"
|
|
722
729
|
},
|
|
723
|
-
children:
|
|
730
|
+
children: R
|
|
724
731
|
}), e]
|
|
725
732
|
})
|
|
726
733
|
}));
|
|
727
734
|
}, [
|
|
728
|
-
|
|
729
|
-
|
|
735
|
+
I,
|
|
736
|
+
R,
|
|
730
737
|
n,
|
|
731
738
|
O,
|
|
732
|
-
|
|
733
|
-
|
|
739
|
+
F,
|
|
740
|
+
d
|
|
741
|
+
]), H = E(t, () => ({
|
|
734
742
|
isScriptWorkspaceElement: () => !0,
|
|
735
743
|
focus: (e) => {
|
|
736
|
-
|
|
744
|
+
te(e);
|
|
737
745
|
}
|
|
738
746
|
}), []);
|
|
739
|
-
return
|
|
747
|
+
return z(u, {
|
|
740
748
|
sx: {
|
|
741
749
|
display: "flex",
|
|
742
750
|
flexDirection: "row",
|
|
@@ -744,54 +752,56 @@ var Q = r(n((e, t) => {
|
|
|
744
752
|
position: "relative",
|
|
745
753
|
...r
|
|
746
754
|
},
|
|
747
|
-
ref:
|
|
755
|
+
ref: H,
|
|
748
756
|
...y,
|
|
749
757
|
onFocus: (e) => {
|
|
750
|
-
S(!0), w.current = !0,
|
|
758
|
+
S(!0), w.current = !0, H.current?.contains(e.target) && e.target !== H.current && N(e.target), e.relatedTarget && !P.current && (P.current = e.relatedTarget), y?.onFocus?.(e);
|
|
751
759
|
},
|
|
752
760
|
onBlur: (e) => {
|
|
753
|
-
|
|
761
|
+
H?.current?.contains(e.relatedTarget) || H?.current === e.relatedTarget || (P.current = null, w.current = !1, S(!1)), y?.onBlur?.(e);
|
|
754
762
|
},
|
|
755
|
-
children:
|
|
763
|
+
children: V
|
|
756
764
|
});
|
|
757
765
|
}));
|
|
758
766
|
Q.displayName = "ScriptWorkspace";
|
|
759
|
-
var { FocusActivation:
|
|
760
|
-
let t =
|
|
761
|
-
return t ?
|
|
762
|
-
spec:
|
|
767
|
+
var { FocusActivation: be, CommandScopeProvider: xe, CommandAnchorProvider: Se, useCommandScope: Ce } = g, we = { scopeName: "scriptEditor" }, Te = ({ children: e }) => {
|
|
768
|
+
let t = Ce(), n = c(null);
|
|
769
|
+
return t ? z(xe, {
|
|
770
|
+
spec: we,
|
|
763
771
|
elementRef: n,
|
|
764
772
|
region: !0,
|
|
765
|
-
children:
|
|
773
|
+
children: z(Ee, {
|
|
766
774
|
paneRef: n,
|
|
767
775
|
children: e
|
|
768
776
|
})
|
|
769
777
|
}) : e;
|
|
770
|
-
},
|
|
771
|
-
let n =
|
|
772
|
-
return r ?
|
|
778
|
+
}, Ee = ({ paneRef: e, children: t }) => {
|
|
779
|
+
let n = Ce(), r = o(() => n ? new be(n.getRoot(), n) : null, [n]);
|
|
780
|
+
return r ? B(Se, {
|
|
773
781
|
tracker: r,
|
|
774
782
|
keyBindings: !1,
|
|
775
783
|
debounce: 100,
|
|
776
784
|
elementRef: e,
|
|
777
|
-
children: [
|
|
785
|
+
children: [z(F, {}), z("div", {
|
|
778
786
|
className: "script-editor-pane",
|
|
779
787
|
style: { display: "contents" },
|
|
780
788
|
ref: e,
|
|
781
789
|
children: t
|
|
782
790
|
})]
|
|
783
791
|
}) : t;
|
|
784
|
-
},
|
|
785
|
-
let { model: t, entryKey: n, frame: r, ref: i, ...a } = e;
|
|
786
|
-
|
|
792
|
+
}, De = (e) => {
|
|
793
|
+
let { model: t, entryKey: n, frame: r, ref: i, ...a } = e, o = L() ?? t;
|
|
794
|
+
I(o, ["onProtectionChange"]);
|
|
795
|
+
let s = o?.getScripts().isReadOnly() ?? !1;
|
|
796
|
+
return z(Te, { children: z(Q, {
|
|
787
797
|
ref: i,
|
|
788
|
-
readOnly:
|
|
798
|
+
readOnly: s,
|
|
789
799
|
frame: r,
|
|
790
|
-
scripts:
|
|
800
|
+
scripts: o?.getScripts(),
|
|
791
801
|
...a
|
|
792
802
|
}) });
|
|
793
803
|
}, $ = r((e) => {
|
|
794
|
-
let { alwaysShow: t = !1, ...n } = e, [r, i] = s((e) => e + 1, 0), [o] = T(["showScriptEditor"], { onChange: () => i() }), c =
|
|
804
|
+
let { alwaysShow: t = !1, ...n } = e, [r, i] = s((e) => e + 1, 0), [o] = T(["showScriptEditor"], { onChange: () => i() }), c = L(), [u, d] = l(t);
|
|
795
805
|
return a(() => {
|
|
796
806
|
if (t) return void d(!0);
|
|
797
807
|
let e = c?.getScripts();
|
|
@@ -812,11 +822,11 @@ var { FocusActivation: pe, CommandScopeProvider: me, CommandAnchorProvider: he,
|
|
|
812
822
|
c,
|
|
813
823
|
o,
|
|
814
824
|
r
|
|
815
|
-
]), u ?
|
|
825
|
+
]), u ? B(R, { children: [z(j, {}), z(ue, { ...n })] }) : null;
|
|
816
826
|
});
|
|
817
|
-
$.displayName = "RunScriptContribution",
|
|
818
|
-
var
|
|
819
|
-
let { ...r } = e, i =
|
|
827
|
+
$.displayName = "RunScriptContribution", G();
|
|
828
|
+
var Oe = r(n((e, n) => {
|
|
829
|
+
let { ...r } = e, i = L(), o = D(), [s, c] = l([]);
|
|
820
830
|
a(() => {
|
|
821
831
|
let e = i?.getScripts();
|
|
822
832
|
if (!e) return;
|
|
@@ -838,16 +848,16 @@ var xe = r(n((e, n) => {
|
|
|
838
848
|
}, f = [], p = s ? s.length : 0;
|
|
839
849
|
for (let e = 0; e < p; e++) {
|
|
840
850
|
let t = s[e];
|
|
841
|
-
f.push(
|
|
851
|
+
f.push(z(O, {
|
|
842
852
|
...d,
|
|
843
853
|
commandKey: "insertFunction",
|
|
844
854
|
commandState: t,
|
|
845
855
|
propsTooltip: { description: o("insertFunction.insertNamed", { name: t.getName() ?? o("insertFunction.fallbackLabel") }) },
|
|
846
|
-
icon:
|
|
856
|
+
icon: z(b, { iconKey: "FormulaCustom" }),
|
|
847
857
|
label: t.getName() ?? o("insertFunction.fallbackLabel")
|
|
848
858
|
}, `function-${t.getName()}-${e}`));
|
|
849
859
|
}
|
|
850
|
-
let m =
|
|
860
|
+
let m = B(u, {
|
|
851
861
|
ref: n,
|
|
852
862
|
sx: {
|
|
853
863
|
display: "flex",
|
|
@@ -855,13 +865,13 @@ var xe = r(n((e, n) => {
|
|
|
855
865
|
flex: "1 1 100%",
|
|
856
866
|
overflow: "hidden"
|
|
857
867
|
},
|
|
858
|
-
children: [f.length > 0 ?
|
|
868
|
+
children: [f.length > 0 ? B(R, { children: [z(u, {
|
|
859
869
|
sx: {
|
|
860
870
|
overflow: "auto",
|
|
861
871
|
flex: "1 1 100%"
|
|
862
872
|
},
|
|
863
873
|
children: f
|
|
864
|
-
}),
|
|
874
|
+
}), z(j, { orientation: "horizontal" })] }) : null, t(O, {
|
|
865
875
|
...d,
|
|
866
876
|
key: "show-editor",
|
|
867
877
|
commandKey: "showScriptEditor"
|
|
@@ -872,36 +882,36 @@ var xe = r(n((e, n) => {
|
|
|
872
882
|
children: m
|
|
873
883
|
});
|
|
874
884
|
}));
|
|
875
|
-
|
|
876
|
-
var
|
|
877
|
-
let { disabled: n, groupKey: r, ...a } = e, o = w("customFunctionOptions")
|
|
878
|
-
|
|
885
|
+
Oe.displayName = "InsertFunctionPopupPanel";
|
|
886
|
+
var ke = r(n((e, t) => {
|
|
887
|
+
let { disabled: n, groupKey: r, ...a } = e, o = w("customFunctionOptions"), s = i((e) => {
|
|
888
|
+
let t = z(Oe, {
|
|
889
|
+
disabled: n,
|
|
890
|
+
groupKey: r,
|
|
891
|
+
...e
|
|
892
|
+
});
|
|
893
|
+
return P({
|
|
894
|
+
...e,
|
|
895
|
+
children: t
|
|
896
|
+
});
|
|
897
|
+
}, [n, r]);
|
|
898
|
+
return z(k, {
|
|
879
899
|
ref: t,
|
|
880
900
|
disabled: n,
|
|
881
|
-
createPopupPanel:
|
|
882
|
-
let t = B(xe, {
|
|
883
|
-
disabled: n,
|
|
884
|
-
groupKey: r,
|
|
885
|
-
...e
|
|
886
|
-
});
|
|
887
|
-
return P({
|
|
888
|
-
...e,
|
|
889
|
-
children: t
|
|
890
|
-
});
|
|
891
|
-
}, [n, r]),
|
|
901
|
+
createPopupPanel: s,
|
|
892
902
|
label: o?.getLabel?.(),
|
|
893
903
|
tooltip: o?.getDescription?.(),
|
|
894
904
|
icon: "FormulaCustom",
|
|
895
905
|
...a
|
|
896
906
|
});
|
|
897
907
|
}));
|
|
898
|
-
|
|
899
|
-
var
|
|
900
|
-
|
|
908
|
+
ke.displayName = "InsertFunctionContribution";
|
|
909
|
+
var Ae = () => {
|
|
910
|
+
ae(), y.register("plugin-scripts", { icons: {} }), te.registerTaskPane({
|
|
901
911
|
key: "scriptEditor",
|
|
902
912
|
getTitle: () => "Script (Typescript)",
|
|
903
913
|
getIcon: () => "ScriptRun",
|
|
904
|
-
component:
|
|
914
|
+
component: De,
|
|
905
915
|
keepMounted: !0
|
|
906
916
|
}, !0), v.register({ key: "scriptsOptions" }, !0), v.register({ key: "customFunctionOptions" }, !0), v.register({
|
|
907
917
|
key: "scripting.runScript.home",
|
|
@@ -921,7 +931,7 @@ var Ce = () => {
|
|
|
921
931
|
anchor: "formulaCategory.web",
|
|
922
932
|
order: 1
|
|
923
933
|
} },
|
|
924
|
-
render: (t) => e.createElement(
|
|
934
|
+
render: (t) => e.createElement(ke, { ...t })
|
|
925
935
|
}, !0);
|
|
926
936
|
};
|
|
927
|
-
export {
|
|
937
|
+
export { ve as InsertScriptCommandButton, ue as RunScriptCommandButton, Z as ScriptEditorToolbar, De as ScriptTaskPane, Q as ScriptWorkspace, Ae as ScriptingPlugin };
|