@blocklet/pages-kit-inner-components 0.5.42 → 0.5.43
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/lib/cjs/setting.js +2 -2
- package/lib/es/setting.js +284 -284
- package/package.json +3 -3
package/lib/es/setting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r, jsxs as O, Fragment as q } from "react/jsx-runtime";
|
|
2
|
-
import { t as ge, g as We, b as
|
|
2
|
+
import { t as ge, g as We, b as ue, E as ur, n as Ke, h as Pe } from "./chunks/state-COB6reM7.js";
|
|
3
3
|
import ae from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
|
|
5
5
|
import { CodeEditor as ke } from "@blocklet/code-editor";
|
|
@@ -7,7 +7,7 @@ import ar from "@mui/icons-material/AddRounded";
|
|
|
7
7
|
import pr from "@mui/icons-material/ArrowDownward";
|
|
8
8
|
import mr from "@mui/icons-material/ArrowUpward";
|
|
9
9
|
import fr from "@mui/icons-material/DeleteOutline";
|
|
10
|
-
import { Typography as W, TextField as R, Stack as j, FormLabel as
|
|
10
|
+
import { Typography as W, TextField as R, Stack as j, FormLabel as oe, Box as N, TableContainer as hr, Paper as te, Table as Fe, TableHead as Me, TableRow as se, TableCell as ce, TableBody as Je, Button as A, IconButton as ie, InputAdornment as pe, alpha as fe, Tooltip as Y, buttonClasses as br, Dialog as we, DialogTitle as _e, DialogContent as $e, DialogActions as He, FormControlLabel as Ge, Checkbox as yr, Autocomplete as Le, Switch as vr, MenuItem as he, Collapse as xr, Divider as gr, Popper as Pr } from "@mui/material";
|
|
11
11
|
import U from "lodash/sortBy";
|
|
12
12
|
import { useCallback as D, useMemo as re, useRef as H, useId as kr, useEffect as _, useState as G } from "react";
|
|
13
13
|
import { useUpdate as Ye } from "react-use";
|
|
@@ -29,7 +29,7 @@ import Jr from "lodash/assign";
|
|
|
29
29
|
import _r from "lodash/get";
|
|
30
30
|
import $r from "lodash/has";
|
|
31
31
|
import Hr from "lodash/isEqual";
|
|
32
|
-
import
|
|
32
|
+
import de from "lodash/isNil";
|
|
33
33
|
import Gr from "lodash/isObject";
|
|
34
34
|
import Lr from "lodash/keyBy";
|
|
35
35
|
import Yr from "lodash/omit";
|
|
@@ -38,51 +38,51 @@ import Qr from "lodash/reduce";
|
|
|
38
38
|
import { usePopupState as Se, bindTrigger as Ie, bindDialog as ir, bindPopper as Xr } from "material-ui-popup-state/hooks";
|
|
39
39
|
import { ErrorBoundary as Zr } from "react-error-boundary";
|
|
40
40
|
import { cx as et } from "@emotion/css";
|
|
41
|
-
import { useDrop as
|
|
41
|
+
import { useDrop as nr, useDrag as rt } from "react-dnd";
|
|
42
42
|
function tt({
|
|
43
43
|
onClick: e,
|
|
44
44
|
disabled: t,
|
|
45
45
|
sx: i,
|
|
46
|
-
...
|
|
46
|
+
...n
|
|
47
47
|
}) {
|
|
48
|
-
return /* @__PURE__ */ r(
|
|
48
|
+
return /* @__PURE__ */ r(ie, { size: "small", color: "warning", variant: "outlined", disabled: t, onClick: e, ...n, children: /* @__PURE__ */ r(fr, { fontSize: "small" }) });
|
|
49
49
|
}
|
|
50
50
|
function it({
|
|
51
51
|
onClick: e,
|
|
52
52
|
disabled: t,
|
|
53
53
|
sx: i,
|
|
54
|
-
...
|
|
54
|
+
...n
|
|
55
55
|
}) {
|
|
56
|
-
return /* @__PURE__ */ r(
|
|
56
|
+
return /* @__PURE__ */ r(ie, { size: "small", color: "primary", disabled: t, onClick: e, ...n, children: /* @__PURE__ */ r(mr, { fontSize: "small" }) });
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function nt({
|
|
59
59
|
onClick: e,
|
|
60
60
|
disabled: t,
|
|
61
61
|
sx: i,
|
|
62
|
-
...
|
|
62
|
+
...n
|
|
63
63
|
}) {
|
|
64
|
-
return /* @__PURE__ */ r(
|
|
64
|
+
return /* @__PURE__ */ r(ie, { size: "small", color: "primary", disabled: t, onClick: e, ...n, children: /* @__PURE__ */ r(pr, { fontSize: "small" }) });
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function lt({
|
|
67
67
|
label: e,
|
|
68
68
|
value: t,
|
|
69
69
|
onChange: i,
|
|
70
|
-
disabled:
|
|
70
|
+
disabled: n = !1,
|
|
71
71
|
itemLabel: f = "",
|
|
72
|
-
emptyHeight:
|
|
72
|
+
emptyHeight: x = 40,
|
|
73
73
|
property: p,
|
|
74
74
|
renderItem: w,
|
|
75
75
|
...P
|
|
76
76
|
}) {
|
|
77
|
-
const { t: b, locale: g } = V(),
|
|
77
|
+
const { t: b, locale: g } = V(), v = Ye(), l = D(
|
|
78
78
|
(a) => {
|
|
79
79
|
i(ge(a, p.type));
|
|
80
80
|
},
|
|
81
81
|
[i, p.type]
|
|
82
82
|
), c = re(() => Array.isArray(t) ? t : [], [t]), s = D(() => {
|
|
83
83
|
const a = [...c, ""];
|
|
84
|
-
|
|
85
|
-
}, [c,
|
|
84
|
+
l(a), v();
|
|
85
|
+
}, [c, l, v]), u = D(() => {
|
|
86
86
|
if (!p || !p.subProperties)
|
|
87
87
|
return s();
|
|
88
88
|
const a = {};
|
|
@@ -93,43 +93,43 @@ function nt({
|
|
|
93
93
|
a[z.key] = E;
|
|
94
94
|
});
|
|
95
95
|
const C = [...c, a];
|
|
96
|
-
|
|
97
|
-
}, [c,
|
|
96
|
+
l(C), v();
|
|
97
|
+
}, [c, l, v, p, g, s]), d = D(
|
|
98
98
|
(a) => {
|
|
99
99
|
try {
|
|
100
100
|
const S = JSON.parse(a);
|
|
101
|
-
Array.isArray(S) ?
|
|
101
|
+
Array.isArray(S) ? l(S) : console.error("JSON解析结果不是数组");
|
|
102
102
|
} catch (S) {
|
|
103
103
|
console.error("JSON解析错误:", S);
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
[
|
|
106
|
+
[l]
|
|
107
107
|
), k = D(
|
|
108
108
|
(a) => {
|
|
109
109
|
const S = c.filter((C, z) => z !== a);
|
|
110
|
-
|
|
110
|
+
l(S), v();
|
|
111
111
|
},
|
|
112
|
-
[c,
|
|
112
|
+
[c, l, v]
|
|
113
113
|
), o = D(
|
|
114
114
|
(a) => {
|
|
115
115
|
if (a <= 0) return;
|
|
116
116
|
const S = [...c], C = S[a];
|
|
117
|
-
S[a] = S[a - 1], S[a - 1] = C,
|
|
117
|
+
S[a] = S[a - 1], S[a - 1] = C, l(S), v();
|
|
118
118
|
},
|
|
119
|
-
[c,
|
|
119
|
+
[c, l, v]
|
|
120
120
|
), h = D(
|
|
121
121
|
(a) => {
|
|
122
122
|
if (a >= c.length - 1) return;
|
|
123
123
|
const S = [...c], C = S[a];
|
|
124
|
-
S[a] = S[a + 1], S[a + 1] = C,
|
|
124
|
+
S[a] = S[a + 1], S[a + 1] = C, l(S), v();
|
|
125
125
|
},
|
|
126
|
-
[c,
|
|
126
|
+
[c, l, v]
|
|
127
127
|
), m = D(
|
|
128
128
|
(a, S) => {
|
|
129
129
|
const C = [...c];
|
|
130
|
-
C[a] = S,
|
|
130
|
+
C[a] = S, l(C);
|
|
131
131
|
},
|
|
132
|
-
[c,
|
|
132
|
+
[c, l]
|
|
133
133
|
), y = p && p.subProperties && Object.keys(p.subProperties).length > 0, I = re(() => [
|
|
134
134
|
{
|
|
135
135
|
field: "index",
|
|
@@ -167,7 +167,7 @@ function nt({
|
|
|
167
167
|
{
|
|
168
168
|
fullWidth: !0,
|
|
169
169
|
size: "small",
|
|
170
|
-
disabled:
|
|
170
|
+
disabled: n,
|
|
171
171
|
value: a,
|
|
172
172
|
placeholder: f || `${b("item")} ${S + 1}`,
|
|
173
173
|
onChange: (C) => m(S, C.target.value),
|
|
@@ -182,15 +182,15 @@ function nt({
|
|
|
182
182
|
// 增加宽度以容纳更多按钮
|
|
183
183
|
align: "center",
|
|
184
184
|
renderCell: ({ index: a }) => /* @__PURE__ */ O(j, { direction: "column", spacing: 0.25, children: [
|
|
185
|
-
/* @__PURE__ */ r(it, { disabled:
|
|
185
|
+
/* @__PURE__ */ r(it, { disabled: n || a === 0, onClick: () => o(a) }),
|
|
186
186
|
/* @__PURE__ */ r(
|
|
187
|
-
|
|
187
|
+
nt,
|
|
188
188
|
{
|
|
189
|
-
disabled:
|
|
189
|
+
disabled: n || a === c.length - 1,
|
|
190
190
|
onClick: () => h(a)
|
|
191
191
|
}
|
|
192
192
|
),
|
|
193
|
-
/* @__PURE__ */ r(tt, { disabled:
|
|
193
|
+
/* @__PURE__ */ r(tt, { disabled: n, onClick: () => k(a) })
|
|
194
194
|
] })
|
|
195
195
|
}
|
|
196
196
|
], [
|
|
@@ -200,7 +200,7 @@ function nt({
|
|
|
200
200
|
m,
|
|
201
201
|
f,
|
|
202
202
|
b,
|
|
203
|
-
|
|
203
|
+
n,
|
|
204
204
|
P,
|
|
205
205
|
k,
|
|
206
206
|
o,
|
|
@@ -208,8 +208,8 @@ function nt({
|
|
|
208
208
|
c.length
|
|
209
209
|
]);
|
|
210
210
|
return y ? /* @__PURE__ */ O(j, { width: "100%", gap: 1, children: [
|
|
211
|
-
e && /* @__PURE__ */ r(
|
|
212
|
-
c.length > 0 ? /* @__PURE__ */ r(hr, { component:
|
|
211
|
+
e && /* @__PURE__ */ r(oe, { children: e }),
|
|
212
|
+
c.length > 0 ? /* @__PURE__ */ r(hr, { component: te, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ O(
|
|
213
213
|
Fe,
|
|
214
214
|
{
|
|
215
215
|
size: "small",
|
|
@@ -227,8 +227,8 @@ function nt({
|
|
|
227
227
|
borderCollapse: "collapse"
|
|
228
228
|
},
|
|
229
229
|
children: [
|
|
230
|
-
/* @__PURE__ */ r(Me, { sx: { display: "none" }, children: /* @__PURE__ */ r(
|
|
231
|
-
|
|
230
|
+
/* @__PURE__ */ r(Me, { sx: { display: "none" }, children: /* @__PURE__ */ r(se, { children: I.map((a) => /* @__PURE__ */ r(
|
|
231
|
+
ce,
|
|
232
232
|
{
|
|
233
233
|
width: a.width,
|
|
234
234
|
align: a.align || "left",
|
|
@@ -238,7 +238,7 @@ function nt({
|
|
|
238
238
|
a.field
|
|
239
239
|
)) }) }),
|
|
240
240
|
/* @__PURE__ */ r(Je, { children: c.map((a, S, C) => /* @__PURE__ */ r(
|
|
241
|
-
|
|
241
|
+
se,
|
|
242
242
|
{
|
|
243
243
|
sx: {
|
|
244
244
|
borderBottom: S < C.length - 1 ? "1px solid" : "none",
|
|
@@ -248,7 +248,7 @@ function nt({
|
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
250
|
children: I.map((z) => /* @__PURE__ */ r(
|
|
251
|
-
|
|
251
|
+
ce,
|
|
252
252
|
{
|
|
253
253
|
width: z.width,
|
|
254
254
|
align: z.align || "left",
|
|
@@ -268,21 +268,21 @@ function nt({
|
|
|
268
268
|
)) })
|
|
269
269
|
]
|
|
270
270
|
}
|
|
271
|
-
) }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height:
|
|
271
|
+
) }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height: x }, children: b("maker.properties.arrayEmpty") }),
|
|
272
272
|
/* @__PURE__ */ r(
|
|
273
273
|
A,
|
|
274
274
|
{
|
|
275
275
|
fullWidth: !0,
|
|
276
276
|
size: "small",
|
|
277
277
|
variant: "outlined",
|
|
278
|
-
disabled:
|
|
278
|
+
disabled: n,
|
|
279
279
|
startIcon: /* @__PURE__ */ r(ar, {}),
|
|
280
280
|
onClick: u,
|
|
281
281
|
children: b("maker.properties.addArrayItem")
|
|
282
282
|
}
|
|
283
283
|
)
|
|
284
284
|
] }) : /* @__PURE__ */ O(j, { width: "100%", gap: 1, children: [
|
|
285
|
-
e && /* @__PURE__ */ r(
|
|
285
|
+
e && /* @__PURE__ */ r(oe, { children: e }),
|
|
286
286
|
/* @__PURE__ */ r(N, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ r(
|
|
287
287
|
ke,
|
|
288
288
|
{
|
|
@@ -305,7 +305,7 @@ function ot({
|
|
|
305
305
|
onChange: t,
|
|
306
306
|
...i
|
|
307
307
|
}) {
|
|
308
|
-
const
|
|
308
|
+
const n = H(null);
|
|
309
309
|
return /* @__PURE__ */ O(q, { children: [
|
|
310
310
|
/* @__PURE__ */ r(
|
|
311
311
|
Ir,
|
|
@@ -321,7 +321,7 @@ function ot({
|
|
|
321
321
|
style: { width: "1.5rem", height: "1.5rem", padding: 0 },
|
|
322
322
|
onClick: () => {
|
|
323
323
|
var f;
|
|
324
|
-
(f =
|
|
324
|
+
(f = n.current) == null || f.open({ value: e ?? "" });
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
) })
|
|
@@ -331,9 +331,9 @@ function ot({
|
|
|
331
331
|
/* @__PURE__ */ r(
|
|
332
332
|
Sr,
|
|
333
333
|
{
|
|
334
|
-
ref:
|
|
335
|
-
onSave: ({ value: f },
|
|
336
|
-
t(f),
|
|
334
|
+
ref: n,
|
|
335
|
+
onSave: ({ value: f }, x) => {
|
|
336
|
+
t(f), x();
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
)
|
|
@@ -343,39 +343,39 @@ function st({
|
|
|
343
343
|
label: e,
|
|
344
344
|
value: t,
|
|
345
345
|
onChange: i,
|
|
346
|
-
property:
|
|
346
|
+
property: n,
|
|
347
347
|
component: f,
|
|
348
|
-
defaultLocale:
|
|
348
|
+
defaultLocale: x,
|
|
349
349
|
allComponents: p,
|
|
350
350
|
PropertyValueField: w,
|
|
351
351
|
onUpload: P
|
|
352
352
|
}) {
|
|
353
353
|
const { locale: b } = V(), g = H(null);
|
|
354
|
-
if (!J(
|
|
355
|
-
const
|
|
354
|
+
if (!J(n.subProperties)) {
|
|
355
|
+
const l = U(Object.values(n.subProperties || {}), "index").filter(
|
|
356
356
|
(c) => c.data.visible !== !1 && c.data.key
|
|
357
357
|
);
|
|
358
358
|
return /* @__PURE__ */ O(j, { width: "100%", children: [
|
|
359
|
-
/* @__PURE__ */ r(
|
|
360
|
-
/* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(N, { sx: { position: "relative" }, children:
|
|
361
|
-
const { data: u } = c, d = u.key ?? u.id, k = s ===
|
|
359
|
+
/* @__PURE__ */ r(oe, { sx: { px: 0.25, py: 0.5 }, children: e }),
|
|
360
|
+
/* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(N, { sx: { position: "relative" }, children: l.map((c, s) => {
|
|
361
|
+
const { data: u } = c, d = u.key ?? u.id, k = s === l.length - 1;
|
|
362
362
|
let o = null;
|
|
363
363
|
try {
|
|
364
|
-
t && typeof t == "object" ? o = t[d] : typeof t == "string" && (o = (
|
|
364
|
+
t && typeof t == "object" ? o = t[d] : typeof t == "string" && (o = (n.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}"))[d]);
|
|
365
365
|
} catch {
|
|
366
366
|
}
|
|
367
|
-
o == null && (u.locales && b && u.locales[b] ? o = u.locales[b].defaultValue : u.locales &&
|
|
367
|
+
o == null && (u.locales && b && u.locales[b] ? o = u.locales[b].defaultValue : u.locales && x && u.locales[x] && (o = u.locales[x].defaultValue));
|
|
368
368
|
const h = (y) => {
|
|
369
369
|
try {
|
|
370
370
|
let I = {};
|
|
371
371
|
if (typeof t == "string")
|
|
372
372
|
try {
|
|
373
|
-
I =
|
|
373
|
+
I = n.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}");
|
|
374
374
|
} catch {
|
|
375
375
|
}
|
|
376
376
|
else typeof t == "object" && t !== null && (I = { ...t });
|
|
377
377
|
qe(I, d, y);
|
|
378
|
-
const a = ge(I,
|
|
378
|
+
const a = ge(I, n.type);
|
|
379
379
|
i == null || i(a);
|
|
380
380
|
} catch (I) {
|
|
381
381
|
console.error("Error updating property:", I);
|
|
@@ -458,7 +458,7 @@ function st({
|
|
|
458
458
|
onChange: h,
|
|
459
459
|
size: "small",
|
|
460
460
|
fullWidth: !0,
|
|
461
|
-
defaultLocale:
|
|
461
|
+
defaultLocale: x,
|
|
462
462
|
allComponents: p
|
|
463
463
|
}
|
|
464
464
|
) })
|
|
@@ -483,7 +483,7 @@ function st({
|
|
|
483
483
|
},
|
|
484
484
|
children: [
|
|
485
485
|
/* @__PURE__ */ r(
|
|
486
|
-
|
|
486
|
+
oe,
|
|
487
487
|
{
|
|
488
488
|
sx: {
|
|
489
489
|
position: "absolute",
|
|
@@ -497,22 +497,22 @@ function st({
|
|
|
497
497
|
/* @__PURE__ */ r(
|
|
498
498
|
ke,
|
|
499
499
|
{
|
|
500
|
-
keyId:
|
|
500
|
+
keyId: n.id,
|
|
501
501
|
locale: b,
|
|
502
|
-
language:
|
|
502
|
+
language: n.type === "yaml" ? "yaml" : "json",
|
|
503
503
|
value: typeof t == "string" ? t : "",
|
|
504
|
-
onChange: (
|
|
505
|
-
i == null || i(
|
|
504
|
+
onChange: (l) => {
|
|
505
|
+
i == null || i(l);
|
|
506
506
|
},
|
|
507
|
-
onUpload: (
|
|
508
|
-
g.current =
|
|
507
|
+
onUpload: (l) => {
|
|
508
|
+
g.current = l, P && P(l);
|
|
509
509
|
},
|
|
510
510
|
fullScreenOptions: {
|
|
511
511
|
enableEscExit: !0,
|
|
512
512
|
targetContainer: () => document.getElementById("parameters-config-dialog") || null
|
|
513
513
|
}
|
|
514
514
|
},
|
|
515
|
-
|
|
515
|
+
n.id
|
|
516
516
|
),
|
|
517
517
|
/* @__PURE__ */ r(
|
|
518
518
|
N,
|
|
@@ -542,13 +542,13 @@ const ct = ["string", "multiline", "json", "yaml", "url", "component", "custom",
|
|
|
542
542
|
function Ue(e) {
|
|
543
543
|
return e.type ? !ct.includes(e.type) : !1;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function lr({
|
|
546
546
|
disabled: e,
|
|
547
547
|
list: t,
|
|
548
548
|
renderItem: i,
|
|
549
|
-
...
|
|
549
|
+
...n
|
|
550
550
|
}) {
|
|
551
|
-
const f = H(null),
|
|
551
|
+
const f = H(null), x = kr(), p = Fr(), w = U(Object.entries(t), (c) => c[1].index).map((c) => c[0]), P = H(w), b = D(
|
|
552
552
|
(c) => {
|
|
553
553
|
P.current = c, p();
|
|
554
554
|
},
|
|
@@ -563,8 +563,8 @@ function nr({
|
|
|
563
563
|
_(() => {
|
|
564
564
|
b(w);
|
|
565
565
|
}, [w.join("-")]);
|
|
566
|
-
const [{ isOver:
|
|
567
|
-
accept:
|
|
566
|
+
const [{ isOver: v }, l] = nr({
|
|
567
|
+
accept: x,
|
|
568
568
|
collect: (c) => ({
|
|
569
569
|
isOver: c.isOver()
|
|
570
570
|
}),
|
|
@@ -583,11 +583,11 @@ function nr({
|
|
|
583
583
|
}
|
|
584
584
|
});
|
|
585
585
|
return _(() => {
|
|
586
|
-
|
|
587
|
-
}, [
|
|
586
|
+
v || b(w);
|
|
587
|
+
}, [v]), l(f), /* @__PURE__ */ r(N, { ...n, ref: f, className: et(v && "isDragging"), children: P.current.map((c, s) => /* @__PURE__ */ r(
|
|
588
588
|
dt,
|
|
589
589
|
{
|
|
590
|
-
type:
|
|
590
|
+
type: x,
|
|
591
591
|
disabled: e,
|
|
592
592
|
id: c,
|
|
593
593
|
index: s,
|
|
@@ -605,51 +605,51 @@ function dt({
|
|
|
605
605
|
disabled: e,
|
|
606
606
|
id: t,
|
|
607
607
|
index: i,
|
|
608
|
-
type:
|
|
608
|
+
type: n,
|
|
609
609
|
children: f,
|
|
610
|
-
itemIndex:
|
|
610
|
+
itemIndex: x,
|
|
611
611
|
move: p
|
|
612
612
|
}) {
|
|
613
613
|
const w = H(), [{ isDragging: P }, b, g] = rt({
|
|
614
|
-
type:
|
|
614
|
+
type: n,
|
|
615
615
|
item: () => ({ id: t }),
|
|
616
616
|
canDrag: () => !e,
|
|
617
|
-
collect: (
|
|
618
|
-
}), [,
|
|
619
|
-
accept:
|
|
617
|
+
collect: (l) => ({ isDragging: l.isDragging() })
|
|
618
|
+
}), [, v] = nr({
|
|
619
|
+
accept: n,
|
|
620
620
|
canDrop: () => !e,
|
|
621
|
-
hover(
|
|
621
|
+
hover(l, c) {
|
|
622
622
|
var m;
|
|
623
623
|
if (!w.current)
|
|
624
624
|
return;
|
|
625
|
-
const s =
|
|
625
|
+
const s = x(l.id), u = i;
|
|
626
626
|
if (s === u)
|
|
627
627
|
return;
|
|
628
628
|
const d = (m = w.current) == null ? void 0 : m.getBoundingClientRect(), k = (d.bottom - d.top) / 2, h = c.getClientOffset().y - d.top;
|
|
629
|
-
s < u && h < k || s > u && h > k || p({ id:
|
|
629
|
+
s < u && h < k || s > u && h > k || p({ id: l.id, index: s }, { id: t, index: i });
|
|
630
630
|
}
|
|
631
631
|
});
|
|
632
632
|
return typeof f == "function" ? f({
|
|
633
633
|
isDragging: P,
|
|
634
634
|
drag: b,
|
|
635
|
-
drop: (
|
|
635
|
+
drop: (l) => (w.current = l, v(l)),
|
|
636
636
|
preview: g
|
|
637
|
-
}) : (b(
|
|
637
|
+
}) : (b(v(g(w))), /* @__PURE__ */ r(N, { ref: w, children: f }));
|
|
638
638
|
}
|
|
639
639
|
function ut({
|
|
640
640
|
drop: e,
|
|
641
641
|
preview: t,
|
|
642
642
|
drag: i,
|
|
643
|
-
disabled:
|
|
643
|
+
disabled: n,
|
|
644
644
|
isDragging: f,
|
|
645
|
-
children:
|
|
645
|
+
children: x,
|
|
646
646
|
onDelete: p,
|
|
647
647
|
onVisibilityChange: w,
|
|
648
648
|
visible: P = !0,
|
|
649
649
|
actions: b,
|
|
650
650
|
alwaysShowActions: g = !1
|
|
651
651
|
}) {
|
|
652
|
-
const { t:
|
|
652
|
+
const { t: v } = V();
|
|
653
653
|
return /* @__PURE__ */ r(
|
|
654
654
|
N,
|
|
655
655
|
{
|
|
@@ -670,10 +670,10 @@ function ut({
|
|
|
670
670
|
opacity: 0.9999
|
|
671
671
|
// NOTE: make preview effective
|
|
672
672
|
},
|
|
673
|
-
children:
|
|
673
|
+
children: x
|
|
674
674
|
}
|
|
675
675
|
),
|
|
676
|
-
!
|
|
676
|
+
!n && /* @__PURE__ */ r(
|
|
677
677
|
N,
|
|
678
678
|
{
|
|
679
679
|
className: g ? "" : "hover-visible",
|
|
@@ -690,7 +690,7 @@ function ut({
|
|
|
690
690
|
{
|
|
691
691
|
direction: "row",
|
|
692
692
|
sx: {
|
|
693
|
-
bgcolor: (
|
|
693
|
+
bgcolor: (l) => fe(l.palette.grey[200], 0.9),
|
|
694
694
|
borderRadius: 1,
|
|
695
695
|
p: 0.5,
|
|
696
696
|
[`.${br.root}`]: {
|
|
@@ -702,9 +702,9 @@ function ut({
|
|
|
702
702
|
},
|
|
703
703
|
children: [
|
|
704
704
|
b,
|
|
705
|
-
w && /* @__PURE__ */ r(Y, { title:
|
|
706
|
-
p && /* @__PURE__ */ r(Y, { title:
|
|
707
|
-
/* @__PURE__ */ r(Y, { title:
|
|
705
|
+
w && /* @__PURE__ */ r(Y, { title: v(P ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: () => w(!P), children: P ? /* @__PURE__ */ r(Ar, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ r(Dr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
706
|
+
p && /* @__PURE__ */ r(Y, { title: v("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: p, children: /* @__PURE__ */ r(Wr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
707
|
+
/* @__PURE__ */ r(Y, { title: v("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { ref: i, children: /* @__PURE__ */ r(Ur, { sx: { color: "grey.500" } }) }) })
|
|
708
708
|
]
|
|
709
709
|
}
|
|
710
710
|
)
|
|
@@ -721,49 +721,49 @@ function at(e) {
|
|
|
721
721
|
function pt(e, t, i) {
|
|
722
722
|
return e.locales && e.locales[t] && e.locales[t].name ? e.locales[t].name : i && e.locales && e.locales[i] && e.locales[i].name ? e.locales[i].name : e.key ? e.key : e.id;
|
|
723
723
|
}
|
|
724
|
-
const or = (e, t, i,
|
|
724
|
+
const or = (e, t, i, n) => {
|
|
725
725
|
const f = {};
|
|
726
726
|
return U(Object.entries(e), ([, p]) => p.index).forEach(([p, w]) => {
|
|
727
727
|
const P = w.data;
|
|
728
728
|
if (!P) return;
|
|
729
|
-
const b = P.key || P.id, g = i ? pt(P, i,
|
|
729
|
+
const b = P.key || P.id, g = i ? pt(P, i, n || "") : b, v = t == null ? void 0 : t[P.id], l = {
|
|
730
730
|
key: b,
|
|
731
|
-
isNeedGenerate: (
|
|
731
|
+
isNeedGenerate: (v == null ? void 0 : v.isNeedGenerate) ?? at(P),
|
|
732
732
|
// 如果存在使用现有值,否则默认勾选
|
|
733
|
-
describe: (
|
|
733
|
+
describe: (v == null ? void 0 : v.describe) ?? "",
|
|
734
734
|
displayName: g
|
|
735
735
|
};
|
|
736
|
-
P.subProperties && !J(P.subProperties) && (
|
|
736
|
+
P.subProperties && !J(P.subProperties) && (l.subProperties = or(
|
|
737
737
|
P.subProperties,
|
|
738
|
-
|
|
738
|
+
v == null ? void 0 : v.subProperties,
|
|
739
739
|
i,
|
|
740
|
-
|
|
741
|
-
)), f[P.id] =
|
|
740
|
+
n
|
|
741
|
+
)), f[P.id] = l;
|
|
742
742
|
}), f;
|
|
743
743
|
};
|
|
744
744
|
function mt({
|
|
745
745
|
open: e,
|
|
746
746
|
onClose: t,
|
|
747
747
|
onConfirm: i,
|
|
748
|
-
component:
|
|
748
|
+
component: n,
|
|
749
749
|
initialConfig: f,
|
|
750
|
-
locale:
|
|
750
|
+
locale: x,
|
|
751
751
|
defaultLocale: p,
|
|
752
752
|
title: w,
|
|
753
753
|
loading: P = !1
|
|
754
754
|
}) {
|
|
755
|
-
const { t: b } = V(), [g,
|
|
755
|
+
const { t: b } = V(), [g, v] = G(null);
|
|
756
756
|
_(() => {
|
|
757
|
-
if (e &&
|
|
757
|
+
if (e && n) {
|
|
758
758
|
const d = { properties: {} };
|
|
759
|
-
if (
|
|
759
|
+
if (n.properties) {
|
|
760
760
|
const k = f == null ? void 0 : f.properties;
|
|
761
|
-
d.properties = or(
|
|
761
|
+
d.properties = or(n.properties, k, x, p);
|
|
762
762
|
}
|
|
763
|
-
|
|
763
|
+
v(d);
|
|
764
764
|
}
|
|
765
|
-
}, [e,
|
|
766
|
-
const
|
|
765
|
+
}, [e, n, f, x, p]);
|
|
766
|
+
const l = () => {
|
|
767
767
|
t();
|
|
768
768
|
}, c = () => {
|
|
769
769
|
g && (i(g), t());
|
|
@@ -820,7 +820,7 @@ function mt({
|
|
|
820
820
|
...o
|
|
821
821
|
});
|
|
822
822
|
}
|
|
823
|
-
|
|
823
|
+
v(h);
|
|
824
824
|
}
|
|
825
825
|
}, u = (d, k = [], o = !0) => {
|
|
826
826
|
if (!d || J(d))
|
|
@@ -945,14 +945,14 @@ function mt({
|
|
|
945
945
|
] }) }, m);
|
|
946
946
|
}) });
|
|
947
947
|
};
|
|
948
|
-
return /* @__PURE__ */ O(we, { open: e, onClose:
|
|
948
|
+
return /* @__PURE__ */ O(we, { open: e, onClose: l, maxWidth: "lg", fullWidth: !0, children: [
|
|
949
949
|
/* @__PURE__ */ r(_e, { children: w || b("maker.properties.llmConfigTitle") }),
|
|
950
|
-
/* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(N, { my: 3, children: P ? /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) :
|
|
950
|
+
/* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(N, { my: 3, children: P ? /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) : n ? g ? /* @__PURE__ */ O(j, { spacing: 3, children: [
|
|
951
951
|
/* @__PURE__ */ r(W, { variant: "subtitle2", children: b("maker.properties.llmConfigInstructions") }),
|
|
952
952
|
u(g.properties)
|
|
953
953
|
] }) : /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) : /* @__PURE__ */ r(W, { color: "error", children: b("maker.properties.componentNotFound") }) }) }),
|
|
954
954
|
/* @__PURE__ */ O(He, { children: [
|
|
955
|
-
/* @__PURE__ */ r(A, { onClick:
|
|
955
|
+
/* @__PURE__ */ r(A, { onClick: l, children: b("common.cancel") }),
|
|
956
956
|
/* @__PURE__ */ r(A, { variant: "contained", onClick: c, disabled: !g || P, children: b("common.confirm") })
|
|
957
957
|
] })
|
|
958
958
|
] });
|
|
@@ -962,7 +962,7 @@ function ft({
|
|
|
962
962
|
value: t,
|
|
963
963
|
onChange: i
|
|
964
964
|
}) {
|
|
965
|
-
const [
|
|
965
|
+
const [n, f] = G(!1);
|
|
966
966
|
return /* @__PURE__ */ O(j, { gap: 1, children: [
|
|
967
967
|
/* @__PURE__ */ r(
|
|
968
968
|
R,
|
|
@@ -970,14 +970,14 @@ function ft({
|
|
|
970
970
|
label: e,
|
|
971
971
|
size: "small",
|
|
972
972
|
value: t,
|
|
973
|
-
onChange: (
|
|
973
|
+
onChange: (x) => i == null ? void 0 : i(x.target.value),
|
|
974
974
|
InputProps: {
|
|
975
975
|
endAdornment: /* @__PURE__ */ r(
|
|
976
976
|
Qe,
|
|
977
977
|
{
|
|
978
|
-
onChange: ({ response:
|
|
978
|
+
onChange: ({ response: x }) => {
|
|
979
979
|
var w;
|
|
980
|
-
const p = (w =
|
|
980
|
+
const p = (w = x == null ? void 0 : x.data) == null ? void 0 : w.filename;
|
|
981
981
|
p && (i == null || i(p));
|
|
982
982
|
}
|
|
983
983
|
}
|
|
@@ -998,13 +998,13 @@ function ft({
|
|
|
998
998
|
onClick: () => f(!0)
|
|
999
999
|
}
|
|
1000
1000
|
),
|
|
1001
|
-
/* @__PURE__ */ r(we, { open:
|
|
1001
|
+
/* @__PURE__ */ r(we, { open: n, onClose: () => f(!1), children: /* @__PURE__ */ r(N, { component: "img", sx: { objectFit: "contain" }, src: We(t), alt: e }) })
|
|
1002
1002
|
] });
|
|
1003
1003
|
}
|
|
1004
1004
|
function ve(e, t = "") {
|
|
1005
|
-
return Qr(e, (i,
|
|
1006
|
-
const
|
|
1007
|
-
return Gr(
|
|
1005
|
+
return Qr(e, (i, n, f) => {
|
|
1006
|
+
const x = t ? `${t}.${f}` : f;
|
|
1007
|
+
return Gr(n) ? Jr(i, ve(n, x)) : i[x] = n, i;
|
|
1008
1008
|
}, {});
|
|
1009
1009
|
}
|
|
1010
1010
|
const ht = [
|
|
@@ -1021,20 +1021,20 @@ const ht = [
|
|
|
1021
1021
|
{ value: "component", label: "Component" },
|
|
1022
1022
|
{ value: "custom", label: "Custom (Render by a Component)" }
|
|
1023
1023
|
];
|
|
1024
|
-
function
|
|
1025
|
-
return !e || !i ? !1 : Object.values(e).some(({ data:
|
|
1024
|
+
function le(e, t, i) {
|
|
1025
|
+
return !e || !i ? !1 : Object.values(e).some(({ data: n }) => n.id !== t && n.key === i);
|
|
1026
1026
|
}
|
|
1027
1027
|
function xe(e, t) {
|
|
1028
1028
|
var i;
|
|
1029
1029
|
return !e || !t ? !1 : ((i = e[t]) == null ? void 0 : i.data.visible) ?? !0;
|
|
1030
1030
|
}
|
|
1031
1031
|
function hi({ componentId: e }) {
|
|
1032
|
-
const { state: { components: t } } =
|
|
1033
|
-
return
|
|
1032
|
+
const { state: { components: t } } = ue(), i = t[e], n = i == null ? void 0 : i.data;
|
|
1033
|
+
return n ? /* @__PURE__ */ r(j, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ r(N, { p: 2, children: /* @__PURE__ */ r(Zr, { FallbackComponent: ur, resetKeys: [e], children: /* @__PURE__ */ r(bt, { value: n, componentId: e }) }) }) }) : null;
|
|
1034
1034
|
}
|
|
1035
1035
|
function bt({ value: e, componentId: t }) {
|
|
1036
|
-
var
|
|
1037
|
-
const { t: i } = V(), { localState: { currentLocale:
|
|
1036
|
+
var v, l, c;
|
|
1037
|
+
const { t: i } = V(), { localState: { currentLocale: n, customComponentPreviewerProperties: f }, state: { config: { defaultLocale: x } }, localActions: { setCustomComponentPreviewerProperties: p } } = ue(), w = ne(e).doc, P = Pe(), b = re(() => (f == null ? void 0 : f[t]) ?? {}, [t, f]), g = Mr({
|
|
1038
1038
|
componentId: t,
|
|
1039
1039
|
propertiesValue: {
|
|
1040
1040
|
...b
|
|
@@ -1052,9 +1052,9 @@ function bt({ value: e, componentId: t }) {
|
|
|
1052
1052
|
return [
|
|
1053
1053
|
u.id,
|
|
1054
1054
|
{
|
|
1055
|
-
value: ((d = g.propertiesValue[u.id]) == null ? void 0 : d.value) ?? Vr(u, ((o = (k = u.locales) == null ? void 0 : k[
|
|
1056
|
-
locale:
|
|
1057
|
-
defaultLocale:
|
|
1055
|
+
value: ((d = g.propertiesValue[u.id]) == null ? void 0 : d.value) ?? Vr(u, ((o = (k = u.locales) == null ? void 0 : k[n]) == null ? void 0 : o.defaultValue) ?? ((m = (h = u.locales) == null ? void 0 : h[x]) == null ? void 0 : m.defaultValue), {
|
|
1056
|
+
locale: n,
|
|
1057
|
+
defaultLocale: x
|
|
1058
1058
|
})
|
|
1059
1059
|
}
|
|
1060
1060
|
];
|
|
@@ -1064,8 +1064,8 @@ function bt({ value: e, componentId: t }) {
|
|
|
1064
1064
|
/* @__PURE__ */ r(yt, { config: e }),
|
|
1065
1065
|
/* @__PURE__ */ r(xt, {
|
|
1066
1066
|
config: e,
|
|
1067
|
-
currentLocale:
|
|
1068
|
-
defaultLocale:
|
|
1067
|
+
currentLocale: n,
|
|
1068
|
+
defaultLocale: x,
|
|
1069
1069
|
allComponents: P,
|
|
1070
1070
|
onUpdateConfig: (s) => {
|
|
1071
1071
|
w.transact(() => {
|
|
@@ -1080,7 +1080,7 @@ function bt({ value: e, componentId: t }) {
|
|
|
1080
1080
|
size: "small",
|
|
1081
1081
|
select: !0,
|
|
1082
1082
|
SelectProps: { autoWidth: !0 },
|
|
1083
|
-
value: ((
|
|
1083
|
+
value: ((v = e.renderer) == null ? void 0 : v.type) || "react-component",
|
|
1084
1084
|
onChange: (s) => {
|
|
1085
1085
|
w.transact(() => {
|
|
1086
1086
|
const u = s.target.value;
|
|
@@ -1093,12 +1093,12 @@ function bt({ value: e, componentId: t }) {
|
|
|
1093
1093
|
]
|
|
1094
1094
|
})
|
|
1095
1095
|
] }),
|
|
1096
|
-
((
|
|
1096
|
+
((l = e.renderer) == null ? void 0 : l.type) === "component" && /* @__PURE__ */ r(Ct, { value: e }),
|
|
1097
1097
|
((c = e.renderer) == null ? void 0 : c.type) === "react-component" && /* @__PURE__ */ r(Ot, { value: e }),
|
|
1098
1098
|
/* @__PURE__ */ r(dr, {
|
|
1099
1099
|
config: e,
|
|
1100
|
-
currentLocale:
|
|
1101
|
-
defaultLocale:
|
|
1100
|
+
currentLocale: n,
|
|
1101
|
+
defaultLocale: x,
|
|
1102
1102
|
allComponents: P,
|
|
1103
1103
|
propertiesValue: g.propertiesValue,
|
|
1104
1104
|
onChange: ({ value: s, id: u, path: d }) => {
|
|
@@ -1145,7 +1145,7 @@ function yt({ config: e }) {
|
|
|
1145
1145
|
multiple: !0,
|
|
1146
1146
|
freeSolo: !0,
|
|
1147
1147
|
value: e.tags ?? [],
|
|
1148
|
-
onChange: (i,
|
|
1148
|
+
onChange: (i, n) => e.tags = n,
|
|
1149
1149
|
renderInput: (i) => /* @__PURE__ */ r(R, { label: t("tags"), ...i })
|
|
1150
1150
|
}),
|
|
1151
1151
|
/* @__PURE__ */ r(ft, {
|
|
@@ -1155,8 +1155,8 @@ function yt({ config: e }) {
|
|
|
1155
1155
|
})
|
|
1156
1156
|
] }) });
|
|
1157
1157
|
}
|
|
1158
|
-
function sr({ data: e, params: t, visible: i, config:
|
|
1159
|
-
var g,
|
|
1158
|
+
function sr({ data: e, params: t, visible: i, config: n, currentLocale: f, defaultLocale: x, allComponents: p, onUpdateConfig: w }) {
|
|
1159
|
+
var g, v, l, c, s, u;
|
|
1160
1160
|
const { t: P } = V(), b = re(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? kt : L, [e.type]);
|
|
1161
1161
|
return /* @__PURE__ */ r(ut, {
|
|
1162
1162
|
preview: t.preview,
|
|
@@ -1190,13 +1190,13 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
|
|
|
1190
1190
|
width: "calc(100% - 80px - 8px)",
|
|
1191
1191
|
flex: 1,
|
|
1192
1192
|
"& .MuiOutlinedInput-root": {
|
|
1193
|
-
borderColor: e.key ?
|
|
1193
|
+
borderColor: e.key ? le(n.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
|
|
1194
1194
|
},
|
|
1195
1195
|
"& .MuiFormLabel-root": {
|
|
1196
|
-
color: e.key ?
|
|
1196
|
+
color: e.key ? le(n.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
|
|
1197
1197
|
},
|
|
1198
1198
|
"& .MuiFormLabel-root.Mui-focused": {
|
|
1199
|
-
color: e.key ?
|
|
1199
|
+
color: e.key ? le(n.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
|
|
1200
1200
|
}
|
|
1201
1201
|
},
|
|
1202
1202
|
value: e.key || "",
|
|
@@ -1207,7 +1207,7 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
|
|
|
1207
1207
|
});
|
|
1208
1208
|
},
|
|
1209
1209
|
InputProps: {
|
|
1210
|
-
endAdornment: !e.key || e.key &&
|
|
1210
|
+
endAdornment: !e.key || e.key && le(n.properties, e.id, e.key) ? /* @__PURE__ */ r(pe, {
|
|
1211
1211
|
position: "end",
|
|
1212
1212
|
sx: {
|
|
1213
1213
|
width: 16,
|
|
@@ -1227,7 +1227,7 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
|
|
|
1227
1227
|
label: P("label"),
|
|
1228
1228
|
size: "small",
|
|
1229
1229
|
sx: { flex: 1 },
|
|
1230
|
-
value: (((
|
|
1230
|
+
value: (((v = (g = e.locales) == null ? void 0 : g[f]) == null ? void 0 : v.name) ?? ((c = (l = e.locales) == null ? void 0 : l[x]) == null ? void 0 : c.name)) || "",
|
|
1231
1231
|
onChange: (d) => {
|
|
1232
1232
|
w((k) => {
|
|
1233
1233
|
var h;
|
|
@@ -1258,8 +1258,8 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
|
|
|
1258
1258
|
/* @__PURE__ */ O(j, { direction: "row", gap: 1, children: [
|
|
1259
1259
|
/* @__PURE__ */ r(b, {
|
|
1260
1260
|
allComponents: p,
|
|
1261
|
-
defaultLocale:
|
|
1262
|
-
component:
|
|
1261
|
+
defaultLocale: x,
|
|
1262
|
+
component: n,
|
|
1263
1263
|
property: e,
|
|
1264
1264
|
label: P("defaultValue"),
|
|
1265
1265
|
size: "small",
|
|
@@ -1285,50 +1285,50 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
|
|
|
1285
1285
|
});
|
|
1286
1286
|
}
|
|
1287
1287
|
function vt(e, t) {
|
|
1288
|
-
const [i,
|
|
1288
|
+
const [i, n] = G(0);
|
|
1289
1289
|
return _(() => {
|
|
1290
|
-
const
|
|
1290
|
+
const x = setTimeout(() => {
|
|
1291
1291
|
if (e.current) {
|
|
1292
1292
|
let p = e.current.parentElement, w = 0;
|
|
1293
1293
|
for (; p; )
|
|
1294
1294
|
p.classList.contains("property-container") && w++, p = p.parentElement;
|
|
1295
|
-
|
|
1295
|
+
n(w);
|
|
1296
1296
|
}
|
|
1297
1297
|
}, 100);
|
|
1298
|
-
return () => clearTimeout(
|
|
1298
|
+
return () => clearTimeout(x);
|
|
1299
1299
|
}, [e, t]), i;
|
|
1300
1300
|
}
|
|
1301
|
-
function xt({ config: e, currentLocale: t, defaultLocale: i, allComponents:
|
|
1301
|
+
function xt({ config: e, currentLocale: t, defaultLocale: i, allComponents: n, onUpdateConfig: f, useI18nEditor: x = !0 }) {
|
|
1302
1302
|
const { t: p } = V(), w = Se({ variant: "dialog" }), P = e.properties && U(Object.values(e.properties), "index");
|
|
1303
1303
|
return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
|
|
1304
1304
|
/* @__PURE__ */ O(j, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
1305
1305
|
/* @__PURE__ */ r(W, { variant: "subtitle1", children: p("properties") }),
|
|
1306
1306
|
/* @__PURE__ */ r(N, { flex: 1 }),
|
|
1307
|
-
|
|
1307
|
+
x && /* @__PURE__ */ r(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(w), children: /* @__PURE__ */ r(Ze, { fontSize: "small" }) })
|
|
1308
1308
|
] }),
|
|
1309
|
-
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ r(
|
|
1309
|
+
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ r(lr, {
|
|
1310
1310
|
component: j,
|
|
1311
1311
|
gap: 2,
|
|
1312
1312
|
list: e.properties,
|
|
1313
|
-
renderItem: (b, g,
|
|
1314
|
-
const
|
|
1315
|
-
return /* @__PURE__ */ r(
|
|
1313
|
+
renderItem: (b, g, v) => {
|
|
1314
|
+
const l = xe(e.properties, b.id);
|
|
1315
|
+
return /* @__PURE__ */ r(te, {
|
|
1316
1316
|
elevation: 0,
|
|
1317
1317
|
className: "property-container",
|
|
1318
1318
|
sx: {
|
|
1319
1319
|
p: 1.25,
|
|
1320
1320
|
borderRadius: 1,
|
|
1321
|
-
border:
|
|
1321
|
+
border: l ? "1px solid" : "1px dashed",
|
|
1322
1322
|
borderColor: "divider"
|
|
1323
1323
|
},
|
|
1324
1324
|
children: /* @__PURE__ */ r(j, { gap: 2, children: /* @__PURE__ */ r(sr, {
|
|
1325
1325
|
data: b,
|
|
1326
|
-
params:
|
|
1327
|
-
visible:
|
|
1326
|
+
params: v,
|
|
1327
|
+
visible: l,
|
|
1328
1328
|
config: e,
|
|
1329
1329
|
currentLocale: t,
|
|
1330
1330
|
defaultLocale: i,
|
|
1331
|
-
allComponents:
|
|
1331
|
+
allComponents: n,
|
|
1332
1332
|
onUpdateConfig: f
|
|
1333
1333
|
}) })
|
|
1334
1334
|
}, b.id);
|
|
@@ -1340,41 +1340,41 @@ function xt({ config: e, currentLocale: t, defaultLocale: i, allComponents: l, o
|
|
|
1340
1340
|
className: "ignore-style-override",
|
|
1341
1341
|
onClick: () => {
|
|
1342
1342
|
f((b) => {
|
|
1343
|
-
var
|
|
1343
|
+
var v;
|
|
1344
1344
|
const g = Ke();
|
|
1345
|
-
b.properties ?? (b.properties = {}), (
|
|
1345
|
+
b.properties ?? (b.properties = {}), (v = b.properties)[g] ?? (v[g] = { index: (P == null ? void 0 : P.length) || 0, data: { id: g } });
|
|
1346
1346
|
});
|
|
1347
1347
|
},
|
|
1348
1348
|
startIcon: /* @__PURE__ */ r(er, {}),
|
|
1349
1349
|
children: p("addObject", { object: p("property") })
|
|
1350
1350
|
}),
|
|
1351
|
-
|
|
1351
|
+
x && /* @__PURE__ */ r(cr, { ...ir(w), component: e })
|
|
1352
1352
|
] }) });
|
|
1353
1353
|
}
|
|
1354
1354
|
function gt({ property: e, allComponents: t }) {
|
|
1355
1355
|
const i = Se({ variant: "popper" });
|
|
1356
1356
|
return /* @__PURE__ */ O(q, { children: [
|
|
1357
1357
|
/* @__PURE__ */ r(A, { sx: { minWidth: 0 }, ...Ie(i), children: /* @__PURE__ */ r(tr, { fontSize: "small" }) }),
|
|
1358
|
-
/* @__PURE__ */ r(Pr, { ...Xr(i), children: /* @__PURE__ */ r(Tr, { onClickAway: i.close, children: /* @__PURE__ */ r(
|
|
1358
|
+
/* @__PURE__ */ r(Pr, { ...Xr(i), children: /* @__PURE__ */ r(Tr, { onClickAway: i.close, children: /* @__PURE__ */ r(te, { children: /* @__PURE__ */ r(N, { width: 500, p: 2, children: /* @__PURE__ */ r(Oe, {
|
|
1359
1359
|
value: e.componentId,
|
|
1360
|
-
onChange: (
|
|
1360
|
+
onChange: (n, f) => e.componentId = f,
|
|
1361
1361
|
allComponents: t
|
|
1362
1362
|
}) }) }) }) })
|
|
1363
1363
|
] });
|
|
1364
1364
|
}
|
|
1365
|
-
function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale:
|
|
1365
|
+
function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: n, allComponents: f }) {
|
|
1366
1366
|
var g;
|
|
1367
|
-
const [
|
|
1367
|
+
const [x, p] = G(!1), { t: w, locale: P } = V(), b = typeof (e == null ? void 0 : e.componentId) == "string" ? (g = f[e.componentId]) == null ? void 0 : g.data : void 0;
|
|
1368
1368
|
return b ? /* @__PURE__ */ O(N, { sx: { width: "100%", position: "relative" }, children: [
|
|
1369
|
-
/* @__PURE__ */ r(
|
|
1369
|
+
/* @__PURE__ */ r(ie, {
|
|
1370
1370
|
sx: { minWidth: 0 },
|
|
1371
1371
|
disabled: !b,
|
|
1372
1372
|
size: "small",
|
|
1373
|
-
onClick: () => p(!
|
|
1374
|
-
color:
|
|
1373
|
+
onClick: () => p(!x),
|
|
1374
|
+
color: x ? "primary" : "default",
|
|
1375
1375
|
children: /* @__PURE__ */ r(tr, { fontSize: "small" })
|
|
1376
1376
|
}),
|
|
1377
|
-
|
|
1377
|
+
x && /* @__PURE__ */ r(xr, { in: x, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ O(te, {
|
|
1378
1378
|
elevation: 1,
|
|
1379
1379
|
sx: {
|
|
1380
1380
|
mt: 1,
|
|
@@ -1388,12 +1388,12 @@ function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: l, allCom
|
|
|
1388
1388
|
/* @__PURE__ */ r(N, { width: "100%", mb: 2, children: /* @__PURE__ */ r(dr, {
|
|
1389
1389
|
config: b,
|
|
1390
1390
|
currentLocale: P,
|
|
1391
|
-
defaultLocale:
|
|
1391
|
+
defaultLocale: n,
|
|
1392
1392
|
allComponents: f,
|
|
1393
1393
|
propertiesValue: e == null ? void 0 : e.properties,
|
|
1394
|
-
onChange: ({ id:
|
|
1395
|
-
const c = jr(
|
|
1396
|
-
s != null && s.componentId && (t ? i == null || i({ ...s, properties: { ...s.properties, [
|
|
1394
|
+
onChange: ({ id: v, value: l }) => {
|
|
1395
|
+
const c = jr(l.value), s = JSON.parse(JSON.stringify(e));
|
|
1396
|
+
s != null && s.componentId && (t ? i == null || i({ ...s, properties: { ...s.properties, [v]: { value: c } } }) : (s.properties = s.properties ?? {}, s.properties[v] = { value: c }, i == null || i(s)));
|
|
1397
1397
|
}
|
|
1398
1398
|
}) }),
|
|
1399
1399
|
/* @__PURE__ */ r(A, { size: "small", onClick: () => p(!1), sx: { mt: 1 }, children: w("close") })
|
|
@@ -1402,18 +1402,18 @@ function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: l, allCom
|
|
|
1402
1402
|
] }) : null;
|
|
1403
1403
|
}
|
|
1404
1404
|
function cr({ type: e = "properties", component: t, ...i }) {
|
|
1405
|
-
var
|
|
1406
|
-
const { t:
|
|
1405
|
+
var v, l, c;
|
|
1406
|
+
const { t: n } = V(), { state: { components: f, supportedLocales: x, config: { defaultLocale: p } } } = ue(), w = Pe(), P = ne(t).doc, b = e === "properties" ? t.properties : e === "parameters" && ((v = t.renderer) == null ? void 0 : v.type) === "component" ? (l = f[t.renderer.componentId]) == null ? void 0 : l.data.properties : void 0, g = ((c = t.renderer) == null ? void 0 : c.type) === "component" ? t : void 0;
|
|
1407
1407
|
return /* @__PURE__ */ O(we, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
1408
|
-
/* @__PURE__ */ r(_e, { children:
|
|
1408
|
+
/* @__PURE__ */ r(_e, { children: n("i18nEditorTitle") }),
|
|
1409
1409
|
/* @__PURE__ */ r($e, { children: b && /* @__PURE__ */ r(j, { children: /* @__PURE__ */ O(Fe, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
1410
|
-
/* @__PURE__ */ r(Me, { children: /* @__PURE__ */ r(
|
|
1410
|
+
/* @__PURE__ */ r(Me, { children: /* @__PURE__ */ r(se, { children: x.map(({ locale: s, name: u }) => /* @__PURE__ */ r(ce, { children: /* @__PURE__ */ O(W, { color: "text.primary", children: [
|
|
1411
1411
|
u,
|
|
1412
1412
|
p === s && /* @__PURE__ */ r(Kr, { sx: { fontSize: 12 } })
|
|
1413
1413
|
] }) }, s)) }) }),
|
|
1414
|
-
/* @__PURE__ */ r(Je, { children: U(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ r(
|
|
1414
|
+
/* @__PURE__ */ r(Je, { children: U(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ r(se, { children: x.map(({ locale: u }) => {
|
|
1415
1415
|
var d, k, o, h, m, y, I, a, S, C, z, E, T, B, K, F, Q, X, Z, ee, Ce, Ne, je, ze, Re, Ve;
|
|
1416
|
-
return /* @__PURE__ */ r(
|
|
1416
|
+
return /* @__PURE__ */ r(ce, { children: /* @__PURE__ */ r(j, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(q, { children: [
|
|
1417
1417
|
/* @__PURE__ */ r(R, {
|
|
1418
1418
|
size: "small",
|
|
1419
1419
|
label: "Key",
|
|
@@ -1426,7 +1426,7 @@ function cr({ type: e = "properties", component: t, ...i }) {
|
|
|
1426
1426
|
}),
|
|
1427
1427
|
/* @__PURE__ */ r(R, {
|
|
1428
1428
|
size: "small",
|
|
1429
|
-
label:
|
|
1429
|
+
label: n("label"),
|
|
1430
1430
|
value: (((k = (d = s.locales) == null ? void 0 : d[u]) == null ? void 0 : k.name) ?? ((h = (o = s.locales) == null ? void 0 : o[p]) == null ? void 0 : h.name)) || "",
|
|
1431
1431
|
onChange: ($) => {
|
|
1432
1432
|
P.transact(() => {
|
|
@@ -1443,7 +1443,7 @@ function cr({ type: e = "properties", component: t, ...i }) {
|
|
|
1443
1443
|
size: "small",
|
|
1444
1444
|
fullWidth: !0,
|
|
1445
1445
|
label: "Default Value",
|
|
1446
|
-
valueImmutable:
|
|
1446
|
+
valueImmutable: de((y = (m = s.locales) == null ? void 0 : m[u]) == null ? void 0 : y.defaultValue),
|
|
1447
1447
|
value: ((a = (I = s.locales) == null ? void 0 : I[u]) == null ? void 0 : a.defaultValue) ?? ((C = (S = s.locales) == null ? void 0 : S[p]) == null ? void 0 : C.defaultValue),
|
|
1448
1448
|
onChange: ($) => {
|
|
1449
1449
|
P.transact(() => {
|
|
@@ -1459,7 +1459,7 @@ function cr({ type: e = "properties", component: t, ...i }) {
|
|
|
1459
1459
|
property: s,
|
|
1460
1460
|
size: "small",
|
|
1461
1461
|
fullWidth: !0,
|
|
1462
|
-
valueImmutable:
|
|
1462
|
+
valueImmutable: de((B = (T = (E = (z = g.renderer.properties) == null ? void 0 : z[s.id]) == null ? void 0 : E.locales) == null ? void 0 : T[u]) == null ? void 0 : B.value),
|
|
1463
1463
|
value: ((X = (Q = (F = (K = g.renderer.properties) == null ? void 0 : K[s.id]) == null ? void 0 : F.locales) == null ? void 0 : Q[u]) == null ? void 0 : X.value) ?? ((Ne = (Ce = (ee = (Z = g.renderer.properties) == null ? void 0 : Z[s.id]) == null ? void 0 : ee.locales) == null ? void 0 : Ce[p]) == null ? void 0 : Ne.value) ?? ((ze = (je = s.locales) == null ? void 0 : je[u]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Re = s.locales) == null ? void 0 : Re[p]) == null ? void 0 : Ve.defaultValue),
|
|
1464
1464
|
onChange: ($) => {
|
|
1465
1465
|
P.transact(() => {
|
|
@@ -1473,17 +1473,17 @@ function cr({ type: e = "properties", component: t, ...i }) {
|
|
|
1473
1473
|
/* @__PURE__ */ r(He, { children: /* @__PURE__ */ r(A, { onClick: (s) => {
|
|
1474
1474
|
var u;
|
|
1475
1475
|
return (u = i.onClose) == null ? void 0 : u.call(i, s, "escapeKeyDown");
|
|
1476
|
-
}, children:
|
|
1476
|
+
}, children: n("close") }) })
|
|
1477
1477
|
] });
|
|
1478
1478
|
}
|
|
1479
1479
|
const Be = (e, t) => (i) => {
|
|
1480
|
-
const
|
|
1480
|
+
const n = [
|
|
1481
1481
|
i.palette.info.main,
|
|
1482
1482
|
i.palette.primary.main,
|
|
1483
1483
|
i.palette.secondary.main,
|
|
1484
1484
|
i.palette.success.main,
|
|
1485
1485
|
i.palette.warning.main
|
|
1486
|
-
], f = Math.min(
|
|
1486
|
+
], f = Math.min(n.length - 1, e), x = n[f], p = fe(x, 0.5), w = fe(x, 1);
|
|
1487
1487
|
return {
|
|
1488
1488
|
// 保留原有的边框样式
|
|
1489
1489
|
borderColor: `${p} !important`,
|
|
@@ -1495,61 +1495,61 @@ const Be = (e, t) => (i) => {
|
|
|
1495
1495
|
...t
|
|
1496
1496
|
};
|
|
1497
1497
|
};
|
|
1498
|
-
function kt({ property: e, onChange: t, defaultLocale: i, allComponents:
|
|
1499
|
-
const { t: f, locale:
|
|
1498
|
+
function kt({ property: e, onChange: t, defaultLocale: i, allComponents: n }) {
|
|
1499
|
+
const { t: f, locale: x } = V(), p = H(null), w = vt(p, e), P = D(() => {
|
|
1500
1500
|
if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
|
|
1501
1501
|
try {
|
|
1502
1502
|
let b = {};
|
|
1503
|
-
U(Object.values(e.subProperties), "index").filter((
|
|
1503
|
+
U(Object.values(e.subProperties), "index").filter((l) => l.data.visible !== !1 && l.data.key).forEach(({ data: l }) => {
|
|
1504
1504
|
var s, u, d, k;
|
|
1505
|
-
if (!
|
|
1505
|
+
if (!l.key)
|
|
1506
1506
|
return;
|
|
1507
|
-
let c = ((u = (s =
|
|
1508
|
-
if (
|
|
1507
|
+
let c = ((u = (s = l.locales) == null ? void 0 : s[x]) == null ? void 0 : u.defaultValue) ?? ((k = (d = l.locales) == null ? void 0 : d[i]) == null ? void 0 : k.defaultValue);
|
|
1508
|
+
if (l.type === "number")
|
|
1509
1509
|
c = Number(c);
|
|
1510
|
-
else if (
|
|
1510
|
+
else if (l.type === "boolean")
|
|
1511
1511
|
c = c === !0 || c === "true";
|
|
1512
|
-
else if ((
|
|
1512
|
+
else if ((l.type === "json" || l.type === "yaml") && typeof c == "string")
|
|
1513
1513
|
try {
|
|
1514
|
-
|
|
1514
|
+
l.type === "json" ? c = JSON.parse(c) : c = be.parse(c);
|
|
1515
1515
|
} catch (o) {
|
|
1516
1516
|
console.error("Error parsing nested value", c, o), c = {};
|
|
1517
1517
|
}
|
|
1518
|
-
b[
|
|
1518
|
+
b[l.key] = c;
|
|
1519
1519
|
}), e.type === "array" && !Array.isArray(b) && (b = J(b) ? [] : [b]);
|
|
1520
|
-
const
|
|
1521
|
-
t == null || t(
|
|
1520
|
+
const v = ge(b, e.type);
|
|
1521
|
+
t == null || t(v);
|
|
1522
1522
|
} catch (b) {
|
|
1523
1523
|
console.error("Error converting structure to text:", b);
|
|
1524
1524
|
}
|
|
1525
|
-
}, [e,
|
|
1525
|
+
}, [e, x, i, t]);
|
|
1526
1526
|
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(j, { direction: "column", gap: 1.5, sx: { width: "100%" }, ref: p, children: [
|
|
1527
1527
|
/* @__PURE__ */ r(gr, { sx: { mt: -1 }, children: /* @__PURE__ */ r(W, { variant: "caption", color: "text.secondary", children: f("maker.properties.subProperties") }) }),
|
|
1528
|
-
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ r(
|
|
1528
|
+
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ r(lr, {
|
|
1529
1529
|
component: j,
|
|
1530
1530
|
gap: 2,
|
|
1531
1531
|
list: e.subProperties,
|
|
1532
|
-
renderItem: (b, g,
|
|
1533
|
-
const
|
|
1534
|
-
return /* @__PURE__ */ r(
|
|
1532
|
+
renderItem: (b, g, v) => {
|
|
1533
|
+
const l = b.visible !== !1;
|
|
1534
|
+
return /* @__PURE__ */ r(te, {
|
|
1535
1535
|
elevation: 0,
|
|
1536
1536
|
className: "property-container",
|
|
1537
1537
|
sx: {
|
|
1538
1538
|
p: 1.25,
|
|
1539
1539
|
borderRadius: 1,
|
|
1540
|
-
border:
|
|
1540
|
+
border: l ? "1px solid" : "1px dashed",
|
|
1541
1541
|
"&": Be(w)
|
|
1542
1542
|
},
|
|
1543
1543
|
children: /* @__PURE__ */ r(j, { gap: 2, children: /* @__PURE__ */ r(sr, {
|
|
1544
1544
|
data: b,
|
|
1545
|
-
params:
|
|
1546
|
-
visible:
|
|
1545
|
+
params: v,
|
|
1546
|
+
visible: l,
|
|
1547
1547
|
config: {
|
|
1548
1548
|
properties: e.subProperties
|
|
1549
1549
|
},
|
|
1550
|
-
currentLocale:
|
|
1550
|
+
currentLocale: x,
|
|
1551
1551
|
defaultLocale: i,
|
|
1552
|
-
allComponents:
|
|
1552
|
+
allComponents: n,
|
|
1553
1553
|
onUpdateConfig: (c) => {
|
|
1554
1554
|
try {
|
|
1555
1555
|
const s = { properties: e.subProperties || {} };
|
|
@@ -1575,7 +1575,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
|
|
|
1575
1575
|
startIcon: /* @__PURE__ */ r(er, {}),
|
|
1576
1576
|
onClick: () => {
|
|
1577
1577
|
try {
|
|
1578
|
-
const b = e.subProperties || {}, g = Ke(),
|
|
1578
|
+
const b = e.subProperties || {}, g = Ke(), l = {
|
|
1579
1579
|
index: Object.values(b).length,
|
|
1580
1580
|
data: {
|
|
1581
1581
|
id: g,
|
|
@@ -1583,7 +1583,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
|
|
|
1583
1583
|
type: "string",
|
|
1584
1584
|
visible: !0,
|
|
1585
1585
|
locales: {
|
|
1586
|
-
[
|
|
1586
|
+
[x]: {
|
|
1587
1587
|
name: "",
|
|
1588
1588
|
defaultValue: ""
|
|
1589
1589
|
}
|
|
@@ -1595,7 +1595,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
|
|
|
1595
1595
|
...e,
|
|
1596
1596
|
subProperties: {
|
|
1597
1597
|
...b,
|
|
1598
|
-
[g]:
|
|
1598
|
+
[g]: l
|
|
1599
1599
|
}
|
|
1600
1600
|
};
|
|
1601
1601
|
t == null || t(c, { forceUpdateProperty: !0 }), P();
|
|
@@ -1612,9 +1612,9 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
|
|
|
1612
1612
|
})
|
|
1613
1613
|
] });
|
|
1614
1614
|
}
|
|
1615
|
-
function L({ component: e, property: t, value: i, onChange:
|
|
1615
|
+
function L({ component: e, property: t, value: i, onChange: n, valueImmutable: f, defaultLocale: x, allComponents: p, ...w }) {
|
|
1616
1616
|
var c, s, u, d, k;
|
|
1617
|
-
const { locale: P } = V(), b = Or(), g = H(null),
|
|
1617
|
+
const { locale: P } = V(), b = Or(), g = H(null), v = () => {
|
|
1618
1618
|
var h;
|
|
1619
1619
|
const o = (h = b == null ? void 0 : b.current) == null ? void 0 : h.getUploader();
|
|
1620
1620
|
o == null || o.open(), g.current && o.onceUploadSuccess(({ response: m }) => {
|
|
@@ -1622,92 +1622,92 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
|
|
|
1622
1622
|
let y = ((I = m == null ? void 0 : m.data) == null ? void 0 : I.filename) || "";
|
|
1623
1623
|
y && (y = `mediakit://${y}`, i && !i.includes("mediakit://") && (y += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (a = g.current) == null || a.call(g, y);
|
|
1624
1624
|
});
|
|
1625
|
-
},
|
|
1625
|
+
}, l = w.label ?? (((s = (c = t.locales) == null ? void 0 : c[P]) == null ? void 0 : s.name) || ((d = (u = t.locales) == null ? void 0 : u[x]) == null ? void 0 : d.name) || t.key || t.id);
|
|
1626
1626
|
if (t.type === "number")
|
|
1627
1627
|
return /* @__PURE__ */ r(wt, {
|
|
1628
1628
|
...w,
|
|
1629
|
-
label:
|
|
1629
|
+
label: l,
|
|
1630
1630
|
NumberProps: {
|
|
1631
1631
|
value: ["number", "string"].includes(typeof i) ? i : null,
|
|
1632
|
-
onChange: (o, h) =>
|
|
1632
|
+
onChange: (o, h) => n == null ? void 0 : n(h)
|
|
1633
1633
|
}
|
|
1634
1634
|
});
|
|
1635
1635
|
if (t.type === "decimal")
|
|
1636
1636
|
return /* @__PURE__ */ r(R, {
|
|
1637
1637
|
...w,
|
|
1638
|
-
label:
|
|
1638
|
+
label: l,
|
|
1639
1639
|
type: "text",
|
|
1640
1640
|
value: i ?? "",
|
|
1641
1641
|
onChange: (o) => {
|
|
1642
1642
|
const h = o.target.value;
|
|
1643
1643
|
if (h === "" || h === "-") {
|
|
1644
|
-
|
|
1644
|
+
n == null || n(h);
|
|
1645
1645
|
return;
|
|
1646
1646
|
}
|
|
1647
1647
|
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(h)) {
|
|
1648
1648
|
let y = h;
|
|
1649
|
-
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(y) && (y = Number(y)),
|
|
1649
|
+
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(y) && (y = Number(y)), n == null || n(y);
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
});
|
|
1653
1653
|
if (t.type === "boolean")
|
|
1654
1654
|
return /* @__PURE__ */ r(Ge, {
|
|
1655
|
-
label:
|
|
1655
|
+
label: l,
|
|
1656
1656
|
labelPlacement: "start",
|
|
1657
|
-
control: /* @__PURE__ */ r(vr, { checked: i === !0, onChange: (o, h) =>
|
|
1657
|
+
control: /* @__PURE__ */ r(vr, { checked: i === !0, onChange: (o, h) => n == null ? void 0 : n(h) })
|
|
1658
1658
|
});
|
|
1659
1659
|
if (t.type === "color")
|
|
1660
1660
|
return /* @__PURE__ */ r(ot, {
|
|
1661
|
-
label:
|
|
1661
|
+
label: l,
|
|
1662
1662
|
value: i,
|
|
1663
1663
|
onChange: (o) => {
|
|
1664
|
-
|
|
1664
|
+
n == null || n(o);
|
|
1665
1665
|
}
|
|
1666
1666
|
});
|
|
1667
1667
|
if (t.type === "json" || t.type === "yaml")
|
|
1668
1668
|
return /* @__PURE__ */ r(st, {
|
|
1669
|
-
label:
|
|
1669
|
+
label: l,
|
|
1670
1670
|
value: i,
|
|
1671
1671
|
onChange: (o) => {
|
|
1672
|
-
|
|
1672
|
+
n == null || n(o);
|
|
1673
1673
|
},
|
|
1674
1674
|
property: t,
|
|
1675
1675
|
component: e,
|
|
1676
|
-
defaultLocale:
|
|
1676
|
+
defaultLocale: x,
|
|
1677
1677
|
allComponents: p,
|
|
1678
1678
|
PropertyValueField: L,
|
|
1679
1679
|
onUpload: (o) => {
|
|
1680
|
-
g.current = o,
|
|
1680
|
+
g.current = o, v();
|
|
1681
1681
|
}
|
|
1682
1682
|
});
|
|
1683
1683
|
if (t.type === "custom") {
|
|
1684
1684
|
const o = (k = p[t.componentId]) == null ? void 0 : k.data;
|
|
1685
1685
|
return o ? /* @__PURE__ */ r(N, { width: "100%", children: /* @__PURE__ */ r(Xe, {
|
|
1686
1686
|
componentId: o.id,
|
|
1687
|
-
props: { label:
|
|
1687
|
+
props: { label: l, value: i, onChange: n },
|
|
1688
1688
|
locale: P,
|
|
1689
1689
|
dev: {
|
|
1690
1690
|
mode: "draft",
|
|
1691
1691
|
components: p,
|
|
1692
|
-
defaultLocale:
|
|
1692
|
+
defaultLocale: x
|
|
1693
1693
|
}
|
|
1694
|
-
}) }) : /* @__PURE__ */ r(R, { ...w, label:
|
|
1694
|
+
}) }) : /* @__PURE__ */ r(R, { ...w, label: l, disabled: !0, placeholder: "Click right button select a component" });
|
|
1695
1695
|
}
|
|
1696
1696
|
if (t.type === "component")
|
|
1697
1697
|
return /* @__PURE__ */ O(j, { width: "100%", direction: "column", gap: 1, children: [
|
|
1698
1698
|
/* @__PURE__ */ r(Oe, {
|
|
1699
1699
|
allComponents: p,
|
|
1700
|
-
label:
|
|
1700
|
+
label: l,
|
|
1701
1701
|
value: i == null ? void 0 : i.componentId,
|
|
1702
1702
|
onChange: (o, h) => {
|
|
1703
|
-
f || !i ?
|
|
1703
|
+
f || !i ? n == null || n({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }) : typeof i == "object" && (i.componentId = h, n == null || n({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }));
|
|
1704
1704
|
}
|
|
1705
1705
|
}),
|
|
1706
1706
|
(i == null ? void 0 : i.componentId) && /* @__PURE__ */ r(Pt, {
|
|
1707
1707
|
value: i,
|
|
1708
1708
|
valueImmutable: f,
|
|
1709
|
-
onChange:
|
|
1710
|
-
defaultLocale:
|
|
1709
|
+
onChange: n,
|
|
1710
|
+
defaultLocale: x,
|
|
1711
1711
|
allComponents: p
|
|
1712
1712
|
})
|
|
1713
1713
|
] });
|
|
@@ -1717,12 +1717,12 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
|
|
|
1717
1717
|
const h = t.type === "url" ? i == null ? void 0 : i.url : i;
|
|
1718
1718
|
return /* @__PURE__ */ r(R, {
|
|
1719
1719
|
...w,
|
|
1720
|
-
label:
|
|
1720
|
+
label: l,
|
|
1721
1721
|
value: typeof h == "string" ? h : "",
|
|
1722
1722
|
multiline: o,
|
|
1723
1723
|
minRows: o ? 2 : void 0,
|
|
1724
1724
|
maxRows: o ? 10 : void 0,
|
|
1725
|
-
onChange: (m) =>
|
|
1725
|
+
onChange: (m) => n == null ? void 0 : n(t.type === "url" ? { ...i, url: m.target.value, mediaKitUrl: m.target.value } : m.target.value),
|
|
1726
1726
|
InputProps: t.type === "url" ? {
|
|
1727
1727
|
sx: {
|
|
1728
1728
|
pr: 0
|
|
@@ -1736,7 +1736,7 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
|
|
|
1736
1736
|
y && (I = await Cr(y).catch(() => Nr(y)).catch(() => {
|
|
1737
1737
|
}));
|
|
1738
1738
|
let a = ((z = m == null ? void 0 : m.data) == null ? void 0 : z.filename) || "";
|
|
1739
|
-
a && (a = `mediakit://${a}`),
|
|
1739
|
+
a && (a = `mediakit://${a}`), n == null || n({
|
|
1740
1740
|
url: y,
|
|
1741
1741
|
mediaKitUrl: a,
|
|
1742
1742
|
width: I == null ? void 0 : I.naturalWidth,
|
|
@@ -1749,10 +1749,10 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
|
|
|
1749
1749
|
} : void 0
|
|
1750
1750
|
});
|
|
1751
1751
|
}
|
|
1752
|
-
return t.type === "array" ? /* @__PURE__ */ r(
|
|
1753
|
-
label:
|
|
1752
|
+
return t.type === "array" ? /* @__PURE__ */ r(lt, {
|
|
1753
|
+
label: l,
|
|
1754
1754
|
value: Array.isArray(i) ? i : [],
|
|
1755
|
-
onChange: (o) =>
|
|
1755
|
+
onChange: (o) => n == null ? void 0 : n(o),
|
|
1756
1756
|
property: t,
|
|
1757
1757
|
renderItem: ({ item: o, index: h, onChange: m }) => t.subProperties && Object.keys(t.subProperties).length > 0 ? /* @__PURE__ */ r(j, { gap: 1, width: "100%", children: U(Object.values(t.subProperties), "index").filter((y) => y.data.visible !== !1).map(({ data: y }) => y.key ? /* @__PURE__ */ r(L, {
|
|
1758
1758
|
component: e,
|
|
@@ -1764,14 +1764,14 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
|
|
|
1764
1764
|
},
|
|
1765
1765
|
size: "small",
|
|
1766
1766
|
fullWidth: !0,
|
|
1767
|
-
defaultLocale:
|
|
1767
|
+
defaultLocale: x,
|
|
1768
1768
|
allComponents: p
|
|
1769
1769
|
}, y.id) : null) }, h) : /* @__PURE__ */ r(R, { size: w.size, fullWidth: !0, value: o, onChange: (y) => m(y.target.value) })
|
|
1770
1770
|
}) : (console.error("Unsupported property type", t.type), null);
|
|
1771
1771
|
}
|
|
1772
1772
|
function wt({ NumberProps: e, ...t }) {
|
|
1773
|
-
const { getInputProps: i } = Er(e),
|
|
1774
|
-
return /* @__PURE__ */ r(R, { ...t, inputProps:
|
|
1773
|
+
const { getInputProps: i } = Er(e), n = i();
|
|
1774
|
+
return /* @__PURE__ */ r(R, { ...t, inputProps: n });
|
|
1775
1775
|
}
|
|
1776
1776
|
const St = `import React from '@blocklet/pages-kit/builtin/react'
|
|
1777
1777
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
@@ -1785,10 +1785,10 @@ export default function () {
|
|
|
1785
1785
|
}`, It = `console.log('hello')
|
|
1786
1786
|
`;
|
|
1787
1787
|
function Ot({ value: e }) {
|
|
1788
|
-
const { locale: t } = V(), i = Ye(),
|
|
1788
|
+
const { locale: t } = V(), i = Ye(), n = ne(e).doc;
|
|
1789
1789
|
return _(() => {
|
|
1790
1790
|
var f;
|
|
1791
|
-
(f = e.renderer) != null && f.script || (
|
|
1791
|
+
(f = e.renderer) != null && f.script || (n.transact(() => {
|
|
1792
1792
|
e.renderer.script = e.renderer.type === "react-component" ? St : It;
|
|
1793
1793
|
}), i());
|
|
1794
1794
|
}, [e]), /* @__PURE__ */ r(N, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ r(ke, {
|
|
@@ -1804,8 +1804,8 @@ function Ot({ value: e }) {
|
|
|
1804
1804
|
}, e.id) });
|
|
1805
1805
|
}
|
|
1806
1806
|
function Ct({ value: e }) {
|
|
1807
|
-
var g,
|
|
1808
|
-
const { t } = V(), i = ne(e).doc, { state: { components:
|
|
1807
|
+
var g, v, l;
|
|
1808
|
+
const { t } = V(), i = ne(e).doc, { state: { components: n, config: { defaultLocale: f }, resources: x }, localState: { currentLocale: p } } = ue(), w = Pe(), P = ((g = n[e.renderer.componentId]) == null ? void 0 : g.data) ?? ((l = (v = x.components) == null ? void 0 : v[e.renderer.componentId]) == null ? void 0 : l.component), b = Se({ variant: "dialog" });
|
|
1809
1809
|
return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 1, children: [
|
|
1810
1810
|
/* @__PURE__ */ r(Oe, {
|
|
1811
1811
|
allComponents: w,
|
|
@@ -1827,7 +1827,7 @@ function Ct({ value: e }) {
|
|
|
1827
1827
|
property: c,
|
|
1828
1828
|
fullWidth: !0,
|
|
1829
1829
|
size: "small",
|
|
1830
|
-
valueImmutable:
|
|
1830
|
+
valueImmutable: de((k = (d = (u = (s = e.renderer.properties) == null ? void 0 : s[c.id]) == null ? void 0 : u.locales) == null ? void 0 : d[p]) == null ? void 0 : k.value),
|
|
1831
1831
|
value: ((y = (m = (h = (o = e.renderer.properties) == null ? void 0 : o[c.id]) == null ? void 0 : h.locales) == null ? void 0 : m[p]) == null ? void 0 : y.value) ?? ((C = (S = (a = (I = e.renderer.properties) == null ? void 0 : I[c.id]) == null ? void 0 : a.locales) == null ? void 0 : S[f]) == null ? void 0 : C.value) ?? ((E = (z = c.locales) == null ? void 0 : z[p]) == null ? void 0 : E.defaultValue) ?? ((B = (T = c.locales) == null ? void 0 : T[f]) == null ? void 0 : B.defaultValue),
|
|
1832
1832
|
onChange: (K) => {
|
|
1833
1833
|
i.transact(() => {
|
|
@@ -1841,32 +1841,32 @@ function Ct({ value: e }) {
|
|
|
1841
1841
|
] })
|
|
1842
1842
|
] }) });
|
|
1843
1843
|
}
|
|
1844
|
-
function Oe({ label: e, options: t, excludes: i, value:
|
|
1844
|
+
function Oe({ label: e, options: t, excludes: i, value: n, onChange: f, allComponents: x, ...p }) {
|
|
1845
1845
|
var g;
|
|
1846
|
-
const { t: w } = V(), P = t ?? U(Object.values(Yr(
|
|
1846
|
+
const { t: w } = V(), P = t ?? U(Object.values(Yr(x, ...i ?? [])), "index").map((v) => v.data), b = (typeof n == "string" ? (g = x[n]) == null ? void 0 : g.data : void 0) ?? null;
|
|
1847
1847
|
return /* @__PURE__ */ r(Le, {
|
|
1848
1848
|
...p,
|
|
1849
1849
|
size: "small",
|
|
1850
1850
|
options: P,
|
|
1851
1851
|
autoHighlight: !0,
|
|
1852
|
-
isOptionEqualToValue: (
|
|
1853
|
-
getOptionKey: (
|
|
1854
|
-
getOptionLabel: (
|
|
1855
|
-
renderInput: (
|
|
1852
|
+
isOptionEqualToValue: (v, l) => v.id === l.id,
|
|
1853
|
+
getOptionKey: (v) => v.id,
|
|
1854
|
+
getOptionLabel: (v) => v.name || v.id,
|
|
1855
|
+
renderInput: (v) => /* @__PURE__ */ r(R, { label: e || w("component"), ...v }),
|
|
1856
1856
|
value: b,
|
|
1857
|
-
onChange: (
|
|
1857
|
+
onChange: (v, l) => {
|
|
1858
1858
|
var s, u, d, k, o, h;
|
|
1859
1859
|
let c = {};
|
|
1860
|
-
|
|
1861
|
-
blockletId: (s =
|
|
1862
|
-
blockletTitle: (u =
|
|
1863
|
-
componentName: ((k = (d =
|
|
1864
|
-
}), f == null || f(
|
|
1860
|
+
l && (c = {
|
|
1861
|
+
blockletId: (s = x[l == null ? void 0 : l.id]) == null ? void 0 : s.blockletId,
|
|
1862
|
+
blockletTitle: (u = x[l == null ? void 0 : l.id]) == null ? void 0 : u.blockletTitle,
|
|
1863
|
+
componentName: ((k = (d = x[l == null ? void 0 : l.id]) == null ? void 0 : d.data) == null ? void 0 : k.name) || ((h = (o = x[l == null ? void 0 : l.id]) == null ? void 0 : o.data) == null ? void 0 : h.id)
|
|
1864
|
+
}), f == null || f(v, l == null ? void 0 : l.id, c);
|
|
1865
1865
|
}
|
|
1866
1866
|
});
|
|
1867
1867
|
}
|
|
1868
|
-
function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue:
|
|
1869
|
-
const { t: w } = V(), [P, b] = G(e == null ? void 0 : e.properties), [g,
|
|
1868
|
+
function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: n, currentLocale: f, onChange: x, props: p }) {
|
|
1869
|
+
const { t: w } = V(), [P, b] = G(e == null ? void 0 : e.properties), [g, v] = G(null);
|
|
1870
1870
|
_(() => {
|
|
1871
1871
|
(() => {
|
|
1872
1872
|
var k, o;
|
|
@@ -1876,16 +1876,16 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
|
|
|
1876
1876
|
}) : b(e == null ? void 0 : e.properties);
|
|
1877
1877
|
})();
|
|
1878
1878
|
}, [JSON.stringify(e)]);
|
|
1879
|
-
const
|
|
1879
|
+
const l = D(() => !e || !P ? {} : Object.values(P).reduce((d, { data: k }) => {
|
|
1880
1880
|
var h, m, y, I, a;
|
|
1881
1881
|
const o = k.key || k.id;
|
|
1882
1882
|
return d[k.id] = {
|
|
1883
1883
|
key: o,
|
|
1884
|
-
value: (p == null ? void 0 : p[o]) ?? ((h =
|
|
1884
|
+
value: (p == null ? void 0 : p[o]) ?? ((h = n == null ? void 0 : n[k.id]) == null ? void 0 : h.value) ?? ((y = (m = k.locales) == null ? void 0 : m[f]) == null ? void 0 : y.defaultValue) ?? ((a = (I = k.locales) == null ? void 0 : I[i]) == null ? void 0 : a.defaultValue),
|
|
1885
1885
|
id: k.id,
|
|
1886
1886
|
type: k.type
|
|
1887
1887
|
}, d;
|
|
1888
|
-
}, {}), [JSON.stringify(P), e,
|
|
1888
|
+
}, {}), [JSON.stringify(P), e, n, f, i]), c = re(() => {
|
|
1889
1889
|
if (!P)
|
|
1890
1890
|
return {
|
|
1891
1891
|
canUseProperties: [],
|
|
@@ -1898,7 +1898,7 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
|
|
|
1898
1898
|
visibleProperties: k,
|
|
1899
1899
|
canUsePropertiesKeys: h
|
|
1900
1900
|
};
|
|
1901
|
-
}, [JSON.stringify(P)]), s =
|
|
1901
|
+
}, [JSON.stringify(P)]), s = l(), u = Lr(s, "key");
|
|
1902
1902
|
return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
|
|
1903
1903
|
/* @__PURE__ */ r(W, { variant: "subtitle1", children: w("maker.properties.parameters") }),
|
|
1904
1904
|
!e || c.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(ae, { style: { fontSize: 12 }, children: w("maker.properties.noParameters") }) : /* @__PURE__ */ O(q, { children: [
|
|
@@ -1911,10 +1911,10 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
|
|
|
1911
1911
|
fullWidth: !0,
|
|
1912
1912
|
component: e,
|
|
1913
1913
|
property: d,
|
|
1914
|
-
valueImmutable:
|
|
1914
|
+
valueImmutable: de((k = n == null ? void 0 : n[d.id]) == null ? void 0 : k.value),
|
|
1915
1915
|
value: (p == null ? void 0 : p[d.key || d.id]) ?? ((o = s[d.id]) == null ? void 0 : o.value),
|
|
1916
1916
|
onChange: (h) => {
|
|
1917
|
-
|
|
1917
|
+
x({
|
|
1918
1918
|
path: ["properties", d.id],
|
|
1919
1919
|
id: d.id,
|
|
1920
1920
|
value: { value: h },
|
|
@@ -1944,7 +1944,7 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
|
|
|
1944
1944
|
}).reduce((h, m) => h.then(() => {
|
|
1945
1945
|
const y = u[m], I = k.includes(m);
|
|
1946
1946
|
if (y != null && y.id && I)
|
|
1947
|
-
return
|
|
1947
|
+
return x({
|
|
1948
1948
|
path: ["properties", y.id],
|
|
1949
1949
|
id: y.id,
|
|
1950
1950
|
value: { value: d[m] },
|
|
@@ -1961,7 +1961,7 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
|
|
|
1961
1961
|
}), {
|
|
1962
1962
|
key: a
|
|
1963
1963
|
});
|
|
1964
|
-
return
|
|
1964
|
+
return v(S), Promise.resolve();
|
|
1965
1965
|
}), Promise.resolve());
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
@@ -1970,19 +1970,19 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
|
|
|
1970
1970
|
] }) });
|
|
1971
1971
|
}
|
|
1972
1972
|
function Nt({ config: e }) {
|
|
1973
|
-
const { t
|
|
1974
|
-
e.llmConfig =
|
|
1973
|
+
const { t, locale: i } = V(), [n, f] = G(!1), x = (p) => {
|
|
1974
|
+
e.llmConfig = p;
|
|
1975
1975
|
};
|
|
1976
1976
|
return /* @__PURE__ */ O(q, { children: [
|
|
1977
|
-
/* @__PURE__ */ r(Y, { title: t("maker.properties.configDetailedDescription"), children: /* @__PURE__ */ r(
|
|
1978
|
-
|
|
1979
|
-
open:
|
|
1980
|
-
onClose: () =>
|
|
1981
|
-
onConfirm:
|
|
1977
|
+
/* @__PURE__ */ r(Y, { title: t("maker.properties.configDetailedDescription"), children: /* @__PURE__ */ r(ie, { size: "small", color: "primary", onClick: () => f(!0), children: /* @__PURE__ */ r(Br, { fontSize: "small" }) }) }),
|
|
1978
|
+
n && /* @__PURE__ */ r(mt, {
|
|
1979
|
+
open: n,
|
|
1980
|
+
onClose: () => f(!1),
|
|
1981
|
+
onConfirm: x,
|
|
1982
1982
|
component: e,
|
|
1983
1983
|
initialConfig: e.llmConfig,
|
|
1984
1984
|
locale: i,
|
|
1985
|
-
defaultLocale:
|
|
1985
|
+
defaultLocale: "en",
|
|
1986
1986
|
title: t("maker.properties.llmConfigTitle")
|
|
1987
1987
|
})
|
|
1988
1988
|
] });
|