@blocklet/pages-kit-inner-components 0.6.7 → 0.6.9
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/add-component.js +1 -1
- package/lib/cjs/chunks/components-CacZMc0_.js +57 -0
- package/lib/cjs/chunks/{draft-data-D44_IEV2.js → draft-data-CVjF01PQ.js} +1 -1
- package/lib/cjs/chunks/{home-BYk01EUy.js → home-BarvCpAK.js} +2 -2
- package/lib/cjs/chunks/index-DH8UBqWG.js +475 -0
- package/lib/cjs/chunks/{publish-button-C8XPA4g_.js → publish-button-CNo2gT6Q.js} +1 -1
- package/lib/cjs/chunks/site-state-BkjuFb4-.js +1 -0
- package/lib/cjs/chunks/state-DCxHc_MB.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +6 -9
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +2 -2
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/add-component.js +2 -2
- package/lib/es/chunks/components-BWQM8y6L.js +608 -0
- package/lib/es/chunks/{draft-data-CafrGKeh.js → draft-data-BiayOfQz.js} +1 -1
- package/lib/es/chunks/{home-DW8SdyfO.js → home-DBc-g4K0.js} +3 -3
- package/lib/es/chunks/{index-D5gXPe_7.js → index-DaF8ujCZ.js} +675 -763
- package/lib/es/chunks/{publish-button-XSZrDaTQ.js → publish-button-DiKDLFU8.js} +3 -3
- package/lib/es/chunks/site-state-BMW2lUR1.js +1586 -0
- package/lib/es/chunks/{state-0gvZF3k2.js → state-C3hsEhCe.js} +117 -121
- package/lib/es/components.js +11 -10
- package/lib/es/home.js +3 -3
- package/lib/es/project-html.js +132 -121
- package/lib/es/resources.js +28 -29
- package/lib/es/setting.js +148 -145
- package/lib/es/site-state.js +16 -15
- package/package.json +3 -3
- package/lib/cjs/chunks/index-BRgYwvuv.js +0 -475
- package/lib/cjs/chunks/site-state-BlQzwACl.js +0 -57
- package/lib/cjs/chunks/state-B6BF5wJ-.js +0 -1
- package/lib/es/chunks/site-state-BdLTu3Od.js +0 -2123
package/lib/es/setting.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as r, jsxs as v, Fragment as F } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { Box as P, Alert as Qe, Typography as T, TextField as z, Stack as k, FormLabel as ee, TableContainer as Xe, Paper as G, Table as Oe, TableHead as Ne, TableRow as re, TableCell as te, TableBody as je, Button as E, IconButton as Y, FormControlLabel as be, Switch as ze, InputAdornment as $, alpha as ae, Tooltip as _, buttonClasses as Ze, Dialog as ge, DialogTitle as Ve, DialogContent as Re, DialogActions as Ee, Checkbox as er, Autocomplete as Ae, MenuItem as ce, Collapse as rr, Divider as tr, Popper as nr } from "@mui/material";
|
|
3
|
+
import { t as ye, f as ne, a as oe, h as xe } from "./chunks/state-C3hsEhCe.js";
|
|
4
|
+
import q from "@arcblock/ux/lib/Empty";
|
|
4
5
|
import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
-
import { CodeEditor as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { Typography as A, TextField as z, Stack as k, FormLabel as re, Box as P, TableContainer as tr, Paper as Y, Table as Oe, TableHead as Ne, TableRow as te, TableCell as ne, TableBody as je, Button as E, IconButton as q, FormControlLabel as xe, Switch as ze, InputAdornment as $, alpha as ae, Tooltip as _, buttonClasses as nr, Dialog as ve, DialogTitle as Ve, DialogContent as Re, DialogActions as Ee, Checkbox as ir, Autocomplete as Te, MenuItem as ce, Collapse as or, Divider as lr, Popper as sr } from "@mui/material";
|
|
6
|
+
import { CodeEditor as ve } from "@blocklet/code-editor";
|
|
7
|
+
import ir from "@mui/icons-material/AddRounded";
|
|
8
|
+
import or from "@mui/icons-material/ArrowDownward";
|
|
9
|
+
import lr from "@mui/icons-material/ArrowUpward";
|
|
10
|
+
import sr from "@mui/icons-material/DeleteOutline";
|
|
11
11
|
import D from "lodash/sortBy";
|
|
12
|
-
import { useCallback as
|
|
13
|
-
import { useUpdate as
|
|
12
|
+
import { useCallback as A, useMemo as H, useState as B, useEffect as U, useImperativeHandle as ar, useRef as M, useId as cr } from "react";
|
|
13
|
+
import { useUpdate as Te, useDebounce as dr } from "react-use";
|
|
14
14
|
import { ColorItem as ur, ConfigColorDialog as pr } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
15
|
import { getImageSize as de, getVideoSize as ue, UploaderButton as Ce, UploaderProvider as le, useUploader as mr } from "@blocklet/pages-kit/builtin/uploader";
|
|
16
16
|
import { Icon as hr } from "@iconify-icon/react";
|
|
@@ -31,8 +31,8 @@ import Vr from "lodash/has";
|
|
|
31
31
|
import Rr from "lodash/isEqual";
|
|
32
32
|
import ie from "lodash/isNil";
|
|
33
33
|
import Er from "lodash/isObject";
|
|
34
|
-
import
|
|
35
|
-
import
|
|
34
|
+
import Ar from "lodash/keyBy";
|
|
35
|
+
import Tr from "lodash/omit";
|
|
36
36
|
import Dr from "lodash/pick";
|
|
37
37
|
import Wr from "lodash/reduce";
|
|
38
38
|
import { usePopupState as Pe, bindTrigger as ke, bindDialog as Le, bindPopper as Ur } from "material-ui-popup-state/hooks";
|
|
@@ -40,31 +40,34 @@ import { ErrorBoundary as Kr } from "react-error-boundary";
|
|
|
40
40
|
import { cx as Br } from "@emotion/css";
|
|
41
41
|
import { useDrop as Fe, useDrag as Mr } from "react-dnd";
|
|
42
42
|
import { nextId as Je } from "@blocklet/pages-kit/utils/common";
|
|
43
|
-
function Lr({
|
|
43
|
+
function Lr({ error: e }) {
|
|
44
|
+
return /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(Qe, { severity: "error", children: e.message }) });
|
|
45
|
+
}
|
|
46
|
+
function Fr({
|
|
44
47
|
onClick: e,
|
|
45
48
|
disabled: t,
|
|
46
49
|
sx: o,
|
|
47
50
|
...l
|
|
48
51
|
}) {
|
|
49
|
-
return /* @__PURE__ */ r(
|
|
52
|
+
return /* @__PURE__ */ r(Y, { size: "small", color: "warning", variant: "outlined", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(sr, { fontSize: "small" }) });
|
|
50
53
|
}
|
|
51
|
-
function
|
|
54
|
+
function Jr({
|
|
52
55
|
onClick: e,
|
|
53
56
|
disabled: t,
|
|
54
57
|
sx: o,
|
|
55
58
|
...l
|
|
56
59
|
}) {
|
|
57
|
-
return /* @__PURE__ */ r(
|
|
60
|
+
return /* @__PURE__ */ r(Y, { size: "small", color: "primary", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(lr, { fontSize: "small" }) });
|
|
58
61
|
}
|
|
59
|
-
function
|
|
62
|
+
function _r({
|
|
60
63
|
onClick: e,
|
|
61
64
|
disabled: t,
|
|
62
65
|
sx: o,
|
|
63
66
|
...l
|
|
64
67
|
}) {
|
|
65
|
-
return /* @__PURE__ */ r(
|
|
68
|
+
return /* @__PURE__ */ r(Y, { size: "small", color: "primary", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(or, { fontSize: "small" }) });
|
|
66
69
|
}
|
|
67
|
-
function
|
|
70
|
+
function $r({
|
|
68
71
|
label: e,
|
|
69
72
|
value: t,
|
|
70
73
|
onChange: o,
|
|
@@ -75,15 +78,15 @@ function _r({
|
|
|
75
78
|
renderItem: b,
|
|
76
79
|
...m
|
|
77
80
|
}) {
|
|
78
|
-
const { t: c, locale: s } = V(), a =
|
|
81
|
+
const { t: c, locale: s } = V(), a = Te(), i = A(
|
|
79
82
|
(y) => {
|
|
80
|
-
o(
|
|
83
|
+
o(ye(y, d.type));
|
|
81
84
|
},
|
|
82
85
|
[o, d.type]
|
|
83
|
-
), n = H(() => Array.isArray(t) ? t : [], [t]), f =
|
|
86
|
+
), n = H(() => Array.isArray(t) ? t : [], [t]), f = A(() => {
|
|
84
87
|
const y = [...n, ""];
|
|
85
88
|
i(y), a();
|
|
86
|
-
}, [n, i, a]), g =
|
|
89
|
+
}, [n, i, a]), g = A(() => {
|
|
87
90
|
if (!d || !d.subProperties)
|
|
88
91
|
return f();
|
|
89
92
|
const y = {};
|
|
@@ -94,7 +97,7 @@ function _r({
|
|
|
94
97
|
});
|
|
95
98
|
const O = [...n, y];
|
|
96
99
|
i(O), a();
|
|
97
|
-
}, [n, i, a, d, s, f]), u =
|
|
100
|
+
}, [n, i, a, d, s, f]), u = A(
|
|
98
101
|
(y) => {
|
|
99
102
|
try {
|
|
100
103
|
const C = JSON.parse(y);
|
|
@@ -104,27 +107,27 @@ function _r({
|
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
[i]
|
|
107
|
-
), x =
|
|
110
|
+
), x = A(
|
|
108
111
|
(y) => {
|
|
109
112
|
const C = n.filter((O, R) => R !== y);
|
|
110
113
|
i(C), a();
|
|
111
114
|
},
|
|
112
115
|
[n, i, a]
|
|
113
|
-
), I =
|
|
116
|
+
), I = A(
|
|
114
117
|
(y) => {
|
|
115
118
|
if (y <= 0) return;
|
|
116
119
|
const C = [...n], O = C[y];
|
|
117
120
|
C[y] = C[y - 1], C[y - 1] = O, i(C), a();
|
|
118
121
|
},
|
|
119
122
|
[n, i, a]
|
|
120
|
-
), N =
|
|
123
|
+
), N = A(
|
|
121
124
|
(y) => {
|
|
122
125
|
if (y >= n.length - 1) return;
|
|
123
126
|
const C = [...n], O = C[y];
|
|
124
127
|
C[y] = C[y + 1], C[y + 1] = O, i(C), a();
|
|
125
128
|
},
|
|
126
129
|
[n, i, a]
|
|
127
|
-
), S =
|
|
130
|
+
), S = A(
|
|
128
131
|
(y, C) => {
|
|
129
132
|
const O = [...n];
|
|
130
133
|
O[y] = C, i(O);
|
|
@@ -137,7 +140,7 @@ function _r({
|
|
|
137
140
|
width: 40,
|
|
138
141
|
align: "center",
|
|
139
142
|
renderCell: ({ index: y }) => /* @__PURE__ */ r(
|
|
140
|
-
|
|
143
|
+
T,
|
|
141
144
|
{
|
|
142
145
|
variant: "body1",
|
|
143
146
|
sx: {
|
|
@@ -182,15 +185,15 @@ function _r({
|
|
|
182
185
|
// 增加宽度以容纳更多按钮
|
|
183
186
|
align: "center",
|
|
184
187
|
renderCell: ({ index: y }) => /* @__PURE__ */ v(k, { direction: "column", spacing: 0.25, children: [
|
|
185
|
-
/* @__PURE__ */ r(
|
|
188
|
+
/* @__PURE__ */ r(Jr, { disabled: l || y === 0, onClick: () => I(y) }),
|
|
186
189
|
/* @__PURE__ */ r(
|
|
187
|
-
|
|
190
|
+
_r,
|
|
188
191
|
{
|
|
189
192
|
disabled: l || y === n.length - 1,
|
|
190
193
|
onClick: () => N(y)
|
|
191
194
|
}
|
|
192
195
|
),
|
|
193
|
-
/* @__PURE__ */ r(
|
|
196
|
+
/* @__PURE__ */ r(Fr, { disabled: l, onClick: () => x(y) })
|
|
194
197
|
] })
|
|
195
198
|
}
|
|
196
199
|
], [
|
|
@@ -215,8 +218,8 @@ function _r({
|
|
|
215
218
|
gap: 1
|
|
216
219
|
},
|
|
217
220
|
children: [
|
|
218
|
-
e && /* @__PURE__ */ r(
|
|
219
|
-
n.length > 0 ? /* @__PURE__ */ r(
|
|
221
|
+
e && /* @__PURE__ */ r(ee, { children: e }),
|
|
222
|
+
n.length > 0 ? /* @__PURE__ */ r(Xe, { component: G, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ v(
|
|
220
223
|
Oe,
|
|
221
224
|
{
|
|
222
225
|
size: "small",
|
|
@@ -234,8 +237,8 @@ function _r({
|
|
|
234
237
|
borderCollapse: "collapse"
|
|
235
238
|
},
|
|
236
239
|
children: [
|
|
237
|
-
/* @__PURE__ */ r(Ne, { sx: { display: "none" }, children: /* @__PURE__ */ r(
|
|
238
|
-
|
|
240
|
+
/* @__PURE__ */ r(Ne, { sx: { display: "none" }, children: /* @__PURE__ */ r(re, { children: j.map((y) => /* @__PURE__ */ r(
|
|
241
|
+
te,
|
|
239
242
|
{
|
|
240
243
|
width: y.width,
|
|
241
244
|
align: y.align || "left",
|
|
@@ -245,7 +248,7 @@ function _r({
|
|
|
245
248
|
y.field
|
|
246
249
|
)) }) }),
|
|
247
250
|
/* @__PURE__ */ r(je, { children: n.map((y, C, O) => /* @__PURE__ */ r(
|
|
248
|
-
|
|
251
|
+
re,
|
|
249
252
|
{
|
|
250
253
|
sx: {
|
|
251
254
|
borderBottom: C < O.length - 1 ? "1px solid" : "none",
|
|
@@ -255,7 +258,7 @@ function _r({
|
|
|
255
258
|
}
|
|
256
259
|
},
|
|
257
260
|
children: j.map((R) => /* @__PURE__ */ r(
|
|
258
|
-
|
|
261
|
+
te,
|
|
259
262
|
{
|
|
260
263
|
width: R.width,
|
|
261
264
|
align: R.align || "left",
|
|
@@ -275,7 +278,7 @@ function _r({
|
|
|
275
278
|
)) })
|
|
276
279
|
]
|
|
277
280
|
}
|
|
278
|
-
) }) : /* @__PURE__ */ r(
|
|
281
|
+
) }) : /* @__PURE__ */ r(q, { style: { fontSize: 12, height: p }, children: c("maker.properties.arrayEmpty") }),
|
|
279
282
|
/* @__PURE__ */ r(
|
|
280
283
|
E,
|
|
281
284
|
{
|
|
@@ -283,7 +286,7 @@ function _r({
|
|
|
283
286
|
size: "small",
|
|
284
287
|
variant: "outlined",
|
|
285
288
|
disabled: l,
|
|
286
|
-
startIcon: /* @__PURE__ */ r(
|
|
289
|
+
startIcon: /* @__PURE__ */ r(ir, {}),
|
|
287
290
|
onClick: g,
|
|
288
291
|
children: c("maker.properties.addArrayItem")
|
|
289
292
|
}
|
|
@@ -298,9 +301,9 @@ function _r({
|
|
|
298
301
|
gap: 1
|
|
299
302
|
},
|
|
300
303
|
children: [
|
|
301
|
-
e && /* @__PURE__ */ r(
|
|
304
|
+
e && /* @__PURE__ */ r(ee, { children: e }),
|
|
302
305
|
/* @__PURE__ */ r(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ r(
|
|
303
|
-
|
|
306
|
+
ve,
|
|
304
307
|
{
|
|
305
308
|
keyId: d.id,
|
|
306
309
|
locale: s,
|
|
@@ -318,7 +321,7 @@ function _r({
|
|
|
318
321
|
}
|
|
319
322
|
);
|
|
320
323
|
}
|
|
321
|
-
function
|
|
324
|
+
function Hr({
|
|
322
325
|
ref: e,
|
|
323
326
|
showMarkdown: t,
|
|
324
327
|
markdown: o,
|
|
@@ -335,7 +338,7 @@ function $r({
|
|
|
335
338
|
}, [p, s]);
|
|
336
339
|
const a = async () => {
|
|
337
340
|
if (c !== p) {
|
|
338
|
-
const n =
|
|
341
|
+
const n = ne(c);
|
|
339
342
|
if (!n) {
|
|
340
343
|
b(c, void 0);
|
|
341
344
|
return;
|
|
@@ -361,7 +364,7 @@ function $r({
|
|
|
361
364
|
Ce,
|
|
362
365
|
{
|
|
363
366
|
onChange: async ({ response: n }) => {
|
|
364
|
-
const f = n?.data?.filename, g =
|
|
367
|
+
const f = n?.data?.filename, g = ne(f) || "";
|
|
365
368
|
let u = {};
|
|
366
369
|
g && (u = await de(g).catch(() => ue(g)).catch(() => {
|
|
367
370
|
})), b(f, {
|
|
@@ -390,7 +393,7 @@ function $r({
|
|
|
390
393
|
t && /* @__PURE__ */ v(F, { children: [
|
|
391
394
|
" (",
|
|
392
395
|
/* @__PURE__ */ r(
|
|
393
|
-
|
|
396
|
+
be,
|
|
394
397
|
{
|
|
395
398
|
checked: o,
|
|
396
399
|
label: /* @__PURE__ */ r(P, { component: hr, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
|
|
@@ -417,7 +420,7 @@ function $r({
|
|
|
417
420
|
}
|
|
418
421
|
);
|
|
419
422
|
}
|
|
420
|
-
function
|
|
423
|
+
function Gr({
|
|
421
424
|
value: e,
|
|
422
425
|
onChange: t,
|
|
423
426
|
...o
|
|
@@ -425,7 +428,7 @@ function Hr({
|
|
|
425
428
|
const l = M(null);
|
|
426
429
|
return /* @__PURE__ */ v(F, { children: [
|
|
427
430
|
/* @__PURE__ */ r(
|
|
428
|
-
|
|
431
|
+
Hr,
|
|
429
432
|
{
|
|
430
433
|
...o,
|
|
431
434
|
value: e,
|
|
@@ -455,7 +458,7 @@ function Hr({
|
|
|
455
458
|
)
|
|
456
459
|
] });
|
|
457
460
|
}
|
|
458
|
-
function
|
|
461
|
+
function Yr({
|
|
459
462
|
label: e,
|
|
460
463
|
value: t,
|
|
461
464
|
onChange: o,
|
|
@@ -478,7 +481,7 @@ function Gr({
|
|
|
478
481
|
width: "100%"
|
|
479
482
|
},
|
|
480
483
|
children: [
|
|
481
|
-
/* @__PURE__ */ r(
|
|
484
|
+
/* @__PURE__ */ r(ee, { sx: { px: 0.25, py: 0.5 }, children: e }),
|
|
482
485
|
/* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(P, { sx: { position: "relative" }, children: i.map((n, f) => {
|
|
483
486
|
const { data: g } = n, u = g.key ?? g.id, x = f === i.length - 1;
|
|
484
487
|
let I = null;
|
|
@@ -497,7 +500,7 @@ function Gr({
|
|
|
497
500
|
}
|
|
498
501
|
else typeof t == "object" && t !== null && (j = { ...t });
|
|
499
502
|
De(j, u, w);
|
|
500
|
-
const y =
|
|
503
|
+
const y = ye(j, l.type);
|
|
501
504
|
o?.(y);
|
|
502
505
|
} catch (j) {
|
|
503
506
|
console.error("Error updating property:", j);
|
|
@@ -614,7 +617,7 @@ function Gr({
|
|
|
614
617
|
},
|
|
615
618
|
children: [
|
|
616
619
|
/* @__PURE__ */ r(
|
|
617
|
-
|
|
620
|
+
ee,
|
|
618
621
|
{
|
|
619
622
|
sx: {
|
|
620
623
|
position: "absolute",
|
|
@@ -626,7 +629,7 @@ function Gr({
|
|
|
626
629
|
}
|
|
627
630
|
),
|
|
628
631
|
/* @__PURE__ */ r(
|
|
629
|
-
|
|
632
|
+
ve,
|
|
630
633
|
{
|
|
631
634
|
keyId: l.id,
|
|
632
635
|
locale: c,
|
|
@@ -671,9 +674,9 @@ function Gr({
|
|
|
671
674
|
}
|
|
672
675
|
);
|
|
673
676
|
}
|
|
674
|
-
const
|
|
677
|
+
const qr = ["string", "multiline", "json", "yaml", "url", "component", "custom", "array"];
|
|
675
678
|
function Ie(e) {
|
|
676
|
-
return e.type ? !
|
|
679
|
+
return e.type ? !qr.includes(e.type) : !1;
|
|
677
680
|
}
|
|
678
681
|
function _e({
|
|
679
682
|
disabled: e,
|
|
@@ -681,12 +684,12 @@ function _e({
|
|
|
681
684
|
renderItem: o,
|
|
682
685
|
...l
|
|
683
686
|
}) {
|
|
684
|
-
const h = M(null), p = cr(), d = Or(), b = D(Object.entries(t), (n) => n[1].index).map((n) => n[0]), m = M(b), c =
|
|
687
|
+
const h = M(null), p = cr(), d = Or(), b = D(Object.entries(t), (n) => n[1].index).map((n) => n[0]), m = M(b), c = A(
|
|
685
688
|
(n) => {
|
|
686
689
|
m.current = n, d();
|
|
687
690
|
},
|
|
688
691
|
[d]
|
|
689
|
-
), s =
|
|
692
|
+
), s = A(
|
|
690
693
|
({ index: n }, { index: f }) => {
|
|
691
694
|
const g = [...m.current];
|
|
692
695
|
g.splice(f, 0, ...g.splice(n, 1)), c(g);
|
|
@@ -717,7 +720,7 @@ function _e({
|
|
|
717
720
|
return U(() => {
|
|
718
721
|
a || c(b);
|
|
719
722
|
}, [a]), i(h), /* @__PURE__ */ r(P, { ...l, ref: h, className: Br(a && "isDragging"), children: m.current.map((n, f) => /* @__PURE__ */ r(
|
|
720
|
-
|
|
723
|
+
Qr,
|
|
721
724
|
{
|
|
722
725
|
type: p,
|
|
723
726
|
disabled: e,
|
|
@@ -733,7 +736,7 @@ function _e({
|
|
|
733
736
|
n
|
|
734
737
|
)) });
|
|
735
738
|
}
|
|
736
|
-
function
|
|
739
|
+
function Qr({
|
|
737
740
|
disabled: e,
|
|
738
741
|
id: t,
|
|
739
742
|
index: o,
|
|
@@ -767,7 +770,7 @@ function qr({
|
|
|
767
770
|
preview: s
|
|
768
771
|
}) : (c(a(s(b))), /* @__PURE__ */ r(P, { ref: b, children: h }));
|
|
769
772
|
}
|
|
770
|
-
function
|
|
773
|
+
function Xr({
|
|
771
774
|
drop: e,
|
|
772
775
|
preview: t,
|
|
773
776
|
drag: o,
|
|
@@ -824,7 +827,7 @@ function Qr({
|
|
|
824
827
|
bgcolor: (i) => ae(i.palette.grey[200], 0.9),
|
|
825
828
|
borderRadius: 1,
|
|
826
829
|
p: 0.5,
|
|
827
|
-
[`.${
|
|
830
|
+
[`.${Ze.root}`]: {
|
|
828
831
|
minWidth: 24,
|
|
829
832
|
width: 24,
|
|
830
833
|
height: 24,
|
|
@@ -845,11 +848,11 @@ function Qr({
|
|
|
845
848
|
}
|
|
846
849
|
);
|
|
847
850
|
}
|
|
848
|
-
function
|
|
851
|
+
function Zr(e) {
|
|
849
852
|
const t = ["string", "json", "array", "url", "multiline"], o = ["style", "fontSize", "color", "content", "type"];
|
|
850
853
|
return !!(t.includes(e.type || "") && !o.includes(e.key || ""));
|
|
851
854
|
}
|
|
852
|
-
function
|
|
855
|
+
function et(e, t, o) {
|
|
853
856
|
return e.locales && e.locales[t] && e.locales[t].name ? e.locales[t].name : o && e.locales && e.locales[o] && e.locales[o].name ? e.locales[o].name : e.key ? e.key : e.id;
|
|
854
857
|
}
|
|
855
858
|
const $e = (e, t, o, l) => {
|
|
@@ -857,9 +860,9 @@ const $e = (e, t, o, l) => {
|
|
|
857
860
|
return D(Object.entries(e), ([, d]) => d.index).forEach(([d, b]) => {
|
|
858
861
|
const m = b.data;
|
|
859
862
|
if (!m) return;
|
|
860
|
-
const c = m.key || m.id, s = o ?
|
|
863
|
+
const c = m.key || m.id, s = o ? et(m, o, l || "") : c, a = t?.[m.id], i = {
|
|
861
864
|
key: c,
|
|
862
|
-
isNeedGenerate: a?.isNeedGenerate ??
|
|
865
|
+
isNeedGenerate: a?.isNeedGenerate ?? Zr(m),
|
|
863
866
|
// 如果存在使用现有值,否则默认勾选
|
|
864
867
|
describe: a?.describe ?? "",
|
|
865
868
|
displayName: s
|
|
@@ -872,7 +875,7 @@ const $e = (e, t, o, l) => {
|
|
|
872
875
|
)), h[m.id] = i;
|
|
873
876
|
}), h;
|
|
874
877
|
};
|
|
875
|
-
function
|
|
878
|
+
function rt({
|
|
876
879
|
open: e,
|
|
877
880
|
onClose: t,
|
|
878
881
|
onConfirm: o,
|
|
@@ -955,7 +958,7 @@ function et({
|
|
|
955
958
|
}
|
|
956
959
|
}, g = (u, x = [], I = !0) => {
|
|
957
960
|
if (!u || K(u))
|
|
958
|
-
return /* @__PURE__ */ r(
|
|
961
|
+
return /* @__PURE__ */ r(q, { children: c("maker.properties.noProperties") });
|
|
959
962
|
const N = D(Object.entries(u), ([, S]) => S.displayName);
|
|
960
963
|
return /* @__PURE__ */ r(k, { spacing: 1.5, children: N.map(([S, w], j) => {
|
|
961
964
|
const y = [...x, S], C = j === N.length - 1, O = w.subProperties && !K(w.subProperties), R = w.displayName || S, W = !I;
|
|
@@ -1026,10 +1029,10 @@ function et({
|
|
|
1026
1029
|
},
|
|
1027
1030
|
children: [
|
|
1028
1031
|
/* @__PURE__ */ r(
|
|
1029
|
-
|
|
1032
|
+
be,
|
|
1030
1033
|
{
|
|
1031
1034
|
control: /* @__PURE__ */ r(
|
|
1032
|
-
|
|
1035
|
+
er,
|
|
1033
1036
|
{
|
|
1034
1037
|
checked: w.isNeedGenerate,
|
|
1035
1038
|
disabled: W,
|
|
@@ -1078,7 +1081,7 @@ function et({
|
|
|
1078
1081
|
] }) }, S);
|
|
1079
1082
|
}) });
|
|
1080
1083
|
};
|
|
1081
|
-
return /* @__PURE__ */ v(
|
|
1084
|
+
return /* @__PURE__ */ v(ge, { open: e, onClose: i, maxWidth: "lg", fullWidth: !0, children: [
|
|
1082
1085
|
/* @__PURE__ */ r(Ve, { children: b || c("maker.properties.llmConfigTitle") }),
|
|
1083
1086
|
/* @__PURE__ */ r(Re, { children: /* @__PURE__ */ r(
|
|
1084
1087
|
P,
|
|
@@ -1086,10 +1089,10 @@ function et({
|
|
|
1086
1089
|
sx: {
|
|
1087
1090
|
my: 3
|
|
1088
1091
|
},
|
|
1089
|
-
children: m ? /* @__PURE__ */ r(
|
|
1090
|
-
/* @__PURE__ */ r(
|
|
1092
|
+
children: m ? /* @__PURE__ */ r(T, { children: c("maker.properties.loading") }) : l ? s ? /* @__PURE__ */ v(k, { spacing: 3, children: [
|
|
1093
|
+
/* @__PURE__ */ r(T, { variant: "subtitle2", children: c("maker.properties.llmConfigInstructions") }),
|
|
1091
1094
|
g(s.properties)
|
|
1092
|
-
] }) : /* @__PURE__ */ r(
|
|
1095
|
+
] }) : /* @__PURE__ */ r(T, { children: c("maker.properties.loading") }) : /* @__PURE__ */ r(T, { color: "error", children: c("maker.properties.componentNotFound") })
|
|
1093
1096
|
}
|
|
1094
1097
|
) }),
|
|
1095
1098
|
/* @__PURE__ */ v(Ee, { children: [
|
|
@@ -1098,7 +1101,7 @@ function et({
|
|
|
1098
1101
|
] })
|
|
1099
1102
|
] });
|
|
1100
1103
|
}
|
|
1101
|
-
function
|
|
1104
|
+
function tt({
|
|
1102
1105
|
label: e,
|
|
1103
1106
|
value: t,
|
|
1104
1107
|
onChange: o
|
|
@@ -1140,7 +1143,7 @@ function rt({
|
|
|
1140
1143
|
P,
|
|
1141
1144
|
{
|
|
1142
1145
|
component: "img",
|
|
1143
|
-
src:
|
|
1146
|
+
src: ne(t),
|
|
1144
1147
|
alt: e,
|
|
1145
1148
|
onClick: () => h(!0),
|
|
1146
1149
|
sx: {
|
|
@@ -1153,7 +1156,7 @@ function rt({
|
|
|
1153
1156
|
}
|
|
1154
1157
|
}
|
|
1155
1158
|
),
|
|
1156
|
-
/* @__PURE__ */ r(
|
|
1159
|
+
/* @__PURE__ */ r(ge, { open: l, onClose: () => h(!1), children: /* @__PURE__ */ r(P, { component: "img", sx: { objectFit: "contain" }, src: ne(t), alt: e }) })
|
|
1157
1160
|
]
|
|
1158
1161
|
}
|
|
1159
1162
|
);
|
|
@@ -1164,7 +1167,7 @@ function he(e, t = "") {
|
|
|
1164
1167
|
return Er(l) ? jr(o, he(l, p)) : o[p] = l, o;
|
|
1165
1168
|
}, {});
|
|
1166
1169
|
}
|
|
1167
|
-
const
|
|
1170
|
+
const nt = [
|
|
1168
1171
|
{ value: "string", label: "Text" },
|
|
1169
1172
|
{ value: "multiline", label: "Text (Multiline)" },
|
|
1170
1173
|
{ value: "number", label: "Number" },
|
|
@@ -1184,7 +1187,7 @@ function Z(e, t, o) {
|
|
|
1184
1187
|
function fe(e, t) {
|
|
1185
1188
|
return !e || !t ? !1 : e[t]?.data.visible ?? !0;
|
|
1186
1189
|
}
|
|
1187
|
-
function
|
|
1190
|
+
function on({ componentId: e }) {
|
|
1188
1191
|
const { state: { components: t } } = oe(), l = t[e]?.data;
|
|
1189
1192
|
return l ? /* @__PURE__ */ r(k, {
|
|
1190
1193
|
sx: {
|
|
@@ -1195,12 +1198,12 @@ function nn({ componentId: e }) {
|
|
|
1195
1198
|
sx: {
|
|
1196
1199
|
p: 2
|
|
1197
1200
|
},
|
|
1198
|
-
children: /* @__PURE__ */ r(Kr, { FallbackComponent:
|
|
1201
|
+
children: /* @__PURE__ */ r(Kr, { FallbackComponent: Lr, resetKeys: [e], children: /* @__PURE__ */ r(it, { value: l, componentId: e }) })
|
|
1199
1202
|
})
|
|
1200
1203
|
}) : null;
|
|
1201
1204
|
}
|
|
1202
|
-
function
|
|
1203
|
-
const { t: o } = V(), { localState: { currentLocale: l, customComponentPreviewerProperties: h }, state: { config: { defaultLocale: p } }, localActions: { setCustomComponentPreviewerProperties: d } } = oe(), b = Q(e).doc, m =
|
|
1205
|
+
function it({ value: e, componentId: t }) {
|
|
1206
|
+
const { t: o } = V(), { localState: { currentLocale: l, customComponentPreviewerProperties: h }, state: { config: { defaultLocale: p } }, localActions: { setCustomComponentPreviewerProperties: d } } = oe(), b = Q(e).doc, m = xe(), c = H(() => h?.[t] ?? {}, [t, h]), s = Nr({
|
|
1204
1207
|
componentId: t,
|
|
1205
1208
|
propertiesValue: {
|
|
1206
1209
|
...c
|
|
@@ -1232,8 +1235,8 @@ function nt({ value: e, componentId: t }) {
|
|
|
1232
1235
|
gap: 2
|
|
1233
1236
|
},
|
|
1234
1237
|
children: [
|
|
1235
|
-
/* @__PURE__ */ r(
|
|
1236
|
-
/* @__PURE__ */ r(
|
|
1238
|
+
/* @__PURE__ */ r(ot, { config: e }),
|
|
1239
|
+
/* @__PURE__ */ r(st, {
|
|
1237
1240
|
config: e,
|
|
1238
1241
|
currentLocale: l,
|
|
1239
1242
|
defaultLocale: p,
|
|
@@ -1252,7 +1255,7 @@ function nt({ value: e, componentId: t }) {
|
|
|
1252
1255
|
alignItems: "center"
|
|
1253
1256
|
},
|
|
1254
1257
|
children: [
|
|
1255
|
-
/* @__PURE__ */ r(
|
|
1258
|
+
/* @__PURE__ */ r(T, { variant: "subtitle1", children: o("renderer") }),
|
|
1256
1259
|
/* @__PURE__ */ v(z, {
|
|
1257
1260
|
hiddenLabel: !0,
|
|
1258
1261
|
size: "small",
|
|
@@ -1274,8 +1277,8 @@ function nt({ value: e, componentId: t }) {
|
|
|
1274
1277
|
})
|
|
1275
1278
|
]
|
|
1276
1279
|
}),
|
|
1277
|
-
e.renderer?.type === "component" && /* @__PURE__ */ r(
|
|
1278
|
-
e.renderer?.type === "react-component" && /* @__PURE__ */ r(
|
|
1280
|
+
e.renderer?.type === "component" && /* @__PURE__ */ r(ft, { value: e }),
|
|
1281
|
+
e.renderer?.type === "react-component" && /* @__PURE__ */ r(ht, { value: e }),
|
|
1279
1282
|
/* @__PURE__ */ r(Ye, {
|
|
1280
1283
|
config: e,
|
|
1281
1284
|
currentLocale: l,
|
|
@@ -1299,14 +1302,14 @@ function nt({ value: e, componentId: t }) {
|
|
|
1299
1302
|
})
|
|
1300
1303
|
});
|
|
1301
1304
|
}
|
|
1302
|
-
function
|
|
1305
|
+
function ot({ config: e }) {
|
|
1303
1306
|
const { t } = V();
|
|
1304
1307
|
return /* @__PURE__ */ r(le, { children: /* @__PURE__ */ v(k, {
|
|
1305
1308
|
sx: {
|
|
1306
1309
|
gap: 2
|
|
1307
1310
|
},
|
|
1308
1311
|
children: [
|
|
1309
|
-
/* @__PURE__ */ r(
|
|
1312
|
+
/* @__PURE__ */ r(T, { variant: "subtitle1", children: t("basicInfo") }),
|
|
1310
1313
|
/* @__PURE__ */ r(z, {
|
|
1311
1314
|
label: t("name"),
|
|
1312
1315
|
size: "small",
|
|
@@ -1323,12 +1326,12 @@ function it({ config: e }) {
|
|
|
1323
1326
|
onChange: (o) => e.description = o.target.value,
|
|
1324
1327
|
slotProps: {
|
|
1325
1328
|
input: {
|
|
1326
|
-
endAdornment: /* @__PURE__ */ r($, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(
|
|
1329
|
+
endAdornment: /* @__PURE__ */ r($, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(bt, { config: e }) })
|
|
1327
1330
|
},
|
|
1328
1331
|
htmlInput: { maxLength: 200 }
|
|
1329
1332
|
}
|
|
1330
1333
|
}),
|
|
1331
|
-
/* @__PURE__ */ r(
|
|
1334
|
+
/* @__PURE__ */ r(Ae, {
|
|
1332
1335
|
size: "small",
|
|
1333
1336
|
options: [],
|
|
1334
1337
|
multiple: !0,
|
|
@@ -1337,7 +1340,7 @@ function it({ config: e }) {
|
|
|
1337
1340
|
onChange: (o, l) => e.tags = l,
|
|
1338
1341
|
renderInput: (o) => /* @__PURE__ */ r(z, { label: t("tags"), ...o })
|
|
1339
1342
|
}),
|
|
1340
|
-
/* @__PURE__ */ r(
|
|
1343
|
+
/* @__PURE__ */ r(tt, {
|
|
1341
1344
|
label: t("previewImage"),
|
|
1342
1345
|
value: e.previewImage || "",
|
|
1343
1346
|
onChange: (o) => e.previewImage = o
|
|
@@ -1346,8 +1349,8 @@ function it({ config: e }) {
|
|
|
1346
1349
|
}) });
|
|
1347
1350
|
}
|
|
1348
1351
|
function He({ data: e, params: t, visible: o, config: l, currentLocale: h, defaultLocale: p, allComponents: d, onUpdateConfig: b }) {
|
|
1349
|
-
const { t: m } = V(), c = H(() => e.type === "json" || e.type === "yaml" || e.type === "array" ?
|
|
1350
|
-
return /* @__PURE__ */ r(
|
|
1352
|
+
const { t: m } = V(), c = H(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? dt : L, [e.type]);
|
|
1353
|
+
return /* @__PURE__ */ r(Xr, {
|
|
1351
1354
|
preview: t.preview,
|
|
1352
1355
|
drop: t.drop,
|
|
1353
1356
|
drag: t.drag,
|
|
@@ -1452,7 +1455,7 @@ function He({ data: e, params: t, visible: o, config: l, currentLocale: h, defau
|
|
|
1452
1455
|
n === "multiline" ? (i.type = "string", i.multiline = !0) : (typeof i.multiline < "u" && delete i.multiline, i.type = n);
|
|
1453
1456
|
});
|
|
1454
1457
|
},
|
|
1455
|
-
children:
|
|
1458
|
+
children: nt.map((s) => /* @__PURE__ */ r(ce, { value: s.value, children: s.label }, s.value))
|
|
1456
1459
|
})
|
|
1457
1460
|
]
|
|
1458
1461
|
}),
|
|
@@ -1484,14 +1487,14 @@ function He({ data: e, params: t, visible: o, config: l, currentLocale: h, defau
|
|
|
1484
1487
|
});
|
|
1485
1488
|
}
|
|
1486
1489
|
}),
|
|
1487
|
-
e.type === "custom" ? /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(
|
|
1490
|
+
e.type === "custom" ? /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(at, { property: e, allComponents: d }) }) : null
|
|
1488
1491
|
]
|
|
1489
1492
|
})
|
|
1490
1493
|
]
|
|
1491
1494
|
})
|
|
1492
1495
|
});
|
|
1493
1496
|
}
|
|
1494
|
-
function
|
|
1497
|
+
function lt(e, t) {
|
|
1495
1498
|
const [o, l] = B(0);
|
|
1496
1499
|
return U(() => {
|
|
1497
1500
|
const p = setTimeout(() => {
|
|
@@ -1505,7 +1508,7 @@ function ot(e, t) {
|
|
|
1505
1508
|
return () => clearTimeout(p);
|
|
1506
1509
|
}, [e, t]), o;
|
|
1507
1510
|
}
|
|
1508
|
-
function
|
|
1511
|
+
function st({ config: e, currentLocale: t, defaultLocale: o, allComponents: l, onUpdateConfig: h, useI18nEditor: p = !0 }) {
|
|
1509
1512
|
const { t: d } = V(), b = Pe({ variant: "dialog" }), m = e.properties && D(Object.values(e.properties), "index");
|
|
1510
1513
|
return /* @__PURE__ */ r(le, { children: /* @__PURE__ */ v(k, {
|
|
1511
1514
|
sx: {
|
|
@@ -1520,7 +1523,7 @@ function lt({ config: e, currentLocale: t, defaultLocale: o, allComponents: l, o
|
|
|
1520
1523
|
justifyContent: "space-between"
|
|
1521
1524
|
},
|
|
1522
1525
|
children: [
|
|
1523
|
-
/* @__PURE__ */ r(
|
|
1526
|
+
/* @__PURE__ */ r(T, { variant: "subtitle1", children: d("properties") }),
|
|
1524
1527
|
/* @__PURE__ */ r(P, {
|
|
1525
1528
|
sx: {
|
|
1526
1529
|
flex: 1
|
|
@@ -1535,7 +1538,7 @@ function lt({ config: e, currentLocale: t, defaultLocale: o, allComponents: l, o
|
|
|
1535
1538
|
list: e.properties,
|
|
1536
1539
|
renderItem: (c, s, a) => {
|
|
1537
1540
|
const i = fe(e.properties, c.id);
|
|
1538
|
-
return /* @__PURE__ */ r(
|
|
1541
|
+
return /* @__PURE__ */ r(G, {
|
|
1539
1542
|
elevation: 0,
|
|
1540
1543
|
className: "property-container",
|
|
1541
1544
|
sx: {
|
|
@@ -1561,7 +1564,7 @@ function lt({ config: e, currentLocale: t, defaultLocale: o, allComponents: l, o
|
|
|
1561
1564
|
})
|
|
1562
1565
|
}, c.id);
|
|
1563
1566
|
}
|
|
1564
|
-
}) : /* @__PURE__ */ r(
|
|
1567
|
+
}) : /* @__PURE__ */ r(q, { style: { fontSize: 12 }, children: d("maker.properties.noProperties") }),
|
|
1565
1568
|
/* @__PURE__ */ r(E, {
|
|
1566
1569
|
fullWidth: !0,
|
|
1567
1570
|
variant: "outlined",
|
|
@@ -1579,11 +1582,11 @@ function lt({ config: e, currentLocale: t, defaultLocale: o, allComponents: l, o
|
|
|
1579
1582
|
]
|
|
1580
1583
|
}) });
|
|
1581
1584
|
}
|
|
1582
|
-
function
|
|
1585
|
+
function at({ property: e, allComponents: t }) {
|
|
1583
1586
|
const o = Pe({ variant: "popper" });
|
|
1584
1587
|
return /* @__PURE__ */ v(F, { children: [
|
|
1585
1588
|
/* @__PURE__ */ r(E, { sx: { minWidth: 0 }, ...ke(o), children: /* @__PURE__ */ r(Me, { fontSize: "small" }) }),
|
|
1586
|
-
/* @__PURE__ */ r(
|
|
1589
|
+
/* @__PURE__ */ r(nr, { ...Ur(o), children: /* @__PURE__ */ r(vr, { onClickAway: o.close, children: /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(P, {
|
|
1587
1590
|
sx: {
|
|
1588
1591
|
width: 500,
|
|
1589
1592
|
p: 2
|
|
@@ -1596,10 +1599,10 @@ function st({ property: e, allComponents: t }) {
|
|
|
1596
1599
|
}) }) }) })
|
|
1597
1600
|
] });
|
|
1598
1601
|
}
|
|
1599
|
-
function
|
|
1602
|
+
function ct({ value: e, valueImmutable: t, onChange: o, defaultLocale: l, allComponents: h }) {
|
|
1600
1603
|
const [p, d] = B(!1), { t: b, locale: m } = V(), c = typeof e?.componentId == "string" ? h[e.componentId]?.data : void 0;
|
|
1601
1604
|
return c ? /* @__PURE__ */ v(P, { sx: { width: "100%", position: "relative" }, children: [
|
|
1602
|
-
/* @__PURE__ */ r(
|
|
1605
|
+
/* @__PURE__ */ r(Y, {
|
|
1603
1606
|
sx: { minWidth: 0 },
|
|
1604
1607
|
disabled: !c,
|
|
1605
1608
|
size: "small",
|
|
@@ -1607,7 +1610,7 @@ function at({ value: e, valueImmutable: t, onChange: o, defaultLocale: l, allCom
|
|
|
1607
1610
|
color: p ? "primary" : "default",
|
|
1608
1611
|
children: /* @__PURE__ */ r(Me, { fontSize: "small" })
|
|
1609
1612
|
}),
|
|
1610
|
-
p && /* @__PURE__ */ r(
|
|
1613
|
+
p && /* @__PURE__ */ r(rr, { in: p, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ v(G, {
|
|
1611
1614
|
elevation: 1,
|
|
1612
1615
|
sx: {
|
|
1613
1616
|
mt: 1,
|
|
@@ -1641,11 +1644,11 @@ function at({ value: e, valueImmutable: t, onChange: o, defaultLocale: l, allCom
|
|
|
1641
1644
|
] }) : null;
|
|
1642
1645
|
}
|
|
1643
1646
|
function Ge({ type: e = "properties", component: t, ...o }) {
|
|
1644
|
-
const { t: l } = V(), { state: { components: h, supportedLocales: p, config: { defaultLocale: d } } } = oe(), b =
|
|
1645
|
-
return /* @__PURE__ */ v(
|
|
1647
|
+
const { t: l } = V(), { state: { components: h, supportedLocales: p, config: { defaultLocale: d } } } = oe(), b = xe(), m = Q(t).doc, c = e === "properties" ? t.properties : e === "parameters" && t.renderer?.type === "component" ? h[t.renderer.componentId]?.data.properties : void 0, s = t.renderer?.type === "component" ? t : void 0;
|
|
1648
|
+
return /* @__PURE__ */ v(ge, { ...o, fullWidth: !0, maxWidth: "lg", children: [
|
|
1646
1649
|
/* @__PURE__ */ r(Ve, { children: l("i18nEditorTitle") }),
|
|
1647
1650
|
/* @__PURE__ */ r(Re, { children: c && /* @__PURE__ */ r(k, { children: /* @__PURE__ */ v(Oe, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
1648
|
-
/* @__PURE__ */ r(Ne, { children: /* @__PURE__ */ r(
|
|
1651
|
+
/* @__PURE__ */ r(Ne, { children: /* @__PURE__ */ r(re, { children: p.map(({ locale: a, name: i }) => /* @__PURE__ */ r(te, { children: /* @__PURE__ */ v(T, {
|
|
1649
1652
|
sx: {
|
|
1650
1653
|
color: "text.primary"
|
|
1651
1654
|
},
|
|
@@ -1654,7 +1657,7 @@ function Ge({ type: e = "properties", component: t, ...o }) {
|
|
|
1654
1657
|
d === a && /* @__PURE__ */ r(Sr, { sx: { fontSize: 12 } })
|
|
1655
1658
|
]
|
|
1656
1659
|
}) }, a)) }) }),
|
|
1657
|
-
/* @__PURE__ */ r(je, { children: D(Object.values(c), "index").map(({ data: a }) => /* @__PURE__ */ r(
|
|
1660
|
+
/* @__PURE__ */ r(je, { children: D(Object.values(c), "index").map(({ data: a }) => /* @__PURE__ */ r(re, { children: p.map(({ locale: i }) => /* @__PURE__ */ r(te, { children: /* @__PURE__ */ r(k, {
|
|
1658
1661
|
sx: {
|
|
1659
1662
|
gap: 1
|
|
1660
1663
|
},
|
|
@@ -1734,8 +1737,8 @@ const Se = (e, t) => (o) => {
|
|
|
1734
1737
|
...t
|
|
1735
1738
|
};
|
|
1736
1739
|
};
|
|
1737
|
-
function
|
|
1738
|
-
const { t: h, locale: p } = V(), d = M(null), b =
|
|
1740
|
+
function dt({ property: e, onChange: t, defaultLocale: o, allComponents: l }) {
|
|
1741
|
+
const { t: h, locale: p } = V(), d = M(null), b = lt(d, e), m = A(() => {
|
|
1739
1742
|
if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
|
|
1740
1743
|
try {
|
|
1741
1744
|
let c = {};
|
|
@@ -1755,7 +1758,7 @@ function ct({ property: e, onChange: t, defaultLocale: o, allComponents: l }) {
|
|
|
1755
1758
|
}
|
|
1756
1759
|
c[i.key] = n;
|
|
1757
1760
|
}), e.type === "array" && !Array.isArray(c) && (c = K(c) ? [] : [c]);
|
|
1758
|
-
const a =
|
|
1761
|
+
const a = ye(c, e.type);
|
|
1759
1762
|
t?.(a);
|
|
1760
1763
|
} catch (c) {
|
|
1761
1764
|
console.error("Error converting structure to text:", c);
|
|
@@ -1769,7 +1772,7 @@ function ct({ property: e, onChange: t, defaultLocale: o, allComponents: l }) {
|
|
|
1769
1772
|
width: "100%"
|
|
1770
1773
|
},
|
|
1771
1774
|
children: [
|
|
1772
|
-
/* @__PURE__ */ r(
|
|
1775
|
+
/* @__PURE__ */ r(tr, { sx: { mt: -1 }, children: /* @__PURE__ */ r(T, {
|
|
1773
1776
|
variant: "caption",
|
|
1774
1777
|
sx: {
|
|
1775
1778
|
color: "text.secondary"
|
|
@@ -1782,7 +1785,7 @@ function ct({ property: e, onChange: t, defaultLocale: o, allComponents: l }) {
|
|
|
1782
1785
|
list: e.subProperties,
|
|
1783
1786
|
renderItem: (c, s, a) => {
|
|
1784
1787
|
const i = c.visible !== !1;
|
|
1785
|
-
return /* @__PURE__ */ r(
|
|
1788
|
+
return /* @__PURE__ */ r(G, {
|
|
1786
1789
|
elevation: 0,
|
|
1787
1790
|
className: "property-container",
|
|
1788
1791
|
sx: {
|
|
@@ -1822,7 +1825,7 @@ function ct({ property: e, onChange: t, defaultLocale: o, allComponents: l }) {
|
|
|
1822
1825
|
})
|
|
1823
1826
|
}, c.id);
|
|
1824
1827
|
}
|
|
1825
|
-
}) : /* @__PURE__ */ r(
|
|
1828
|
+
}) : /* @__PURE__ */ r(q, { style: { fontSize: 12, height: 100 }, children: h("maker.properties.noSubProperties") }),
|
|
1826
1829
|
/* @__PURE__ */ r(E, {
|
|
1827
1830
|
fullWidth: !0,
|
|
1828
1831
|
variant: "outlined",
|
|
@@ -1878,7 +1881,7 @@ function L({ component: e, property: t, value: o, onChange: l, valueImmutable: h
|
|
|
1878
1881
|
});
|
|
1879
1882
|
}, i = b.label ?? (t.locales?.[m]?.name || t.locales?.[p]?.name || t.key || t.id);
|
|
1880
1883
|
if (t.type === "number")
|
|
1881
|
-
return /* @__PURE__ */ r(
|
|
1884
|
+
return /* @__PURE__ */ r(ut, {
|
|
1882
1885
|
...b,
|
|
1883
1886
|
label: i,
|
|
1884
1887
|
NumberProps: {
|
|
@@ -1905,13 +1908,13 @@ function L({ component: e, property: t, value: o, onChange: l, valueImmutable: h
|
|
|
1905
1908
|
}
|
|
1906
1909
|
});
|
|
1907
1910
|
if (t.type === "boolean")
|
|
1908
|
-
return /* @__PURE__ */ r(
|
|
1911
|
+
return /* @__PURE__ */ r(be, {
|
|
1909
1912
|
label: i,
|
|
1910
1913
|
labelPlacement: "start",
|
|
1911
1914
|
control: /* @__PURE__ */ r(ze, { checked: o === !0, onChange: (n, f) => l?.(f) })
|
|
1912
1915
|
});
|
|
1913
1916
|
if (t.type === "color")
|
|
1914
|
-
return /* @__PURE__ */ r(
|
|
1917
|
+
return /* @__PURE__ */ r(Gr, {
|
|
1915
1918
|
label: i,
|
|
1916
1919
|
value: o,
|
|
1917
1920
|
onChange: (n) => {
|
|
@@ -1919,7 +1922,7 @@ function L({ component: e, property: t, value: o, onChange: l, valueImmutable: h
|
|
|
1919
1922
|
}
|
|
1920
1923
|
});
|
|
1921
1924
|
if (t.type === "json" || t.type === "yaml")
|
|
1922
|
-
return /* @__PURE__ */ r(
|
|
1925
|
+
return /* @__PURE__ */ r(Yr, {
|
|
1923
1926
|
label: i,
|
|
1924
1927
|
value: o,
|
|
1925
1928
|
onChange: (n) => {
|
|
@@ -1968,7 +1971,7 @@ function L({ component: e, property: t, value: o, onChange: l, valueImmutable: h
|
|
|
1968
1971
|
h || !o ? l?.({ ...o && JSON.parse(JSON.stringify(o)), componentId: f }) : typeof o == "object" && (o.componentId = f, l?.({ ...o && JSON.parse(JSON.stringify(o)), componentId: f }));
|
|
1969
1972
|
}
|
|
1970
1973
|
}),
|
|
1971
|
-
o?.componentId && /* @__PURE__ */ r(
|
|
1974
|
+
o?.componentId && /* @__PURE__ */ r(ct, {
|
|
1972
1975
|
value: o,
|
|
1973
1976
|
valueImmutable: h,
|
|
1974
1977
|
onChange: l,
|
|
@@ -2024,7 +2027,7 @@ function L({ component: e, property: t, value: o, onChange: l, valueImmutable: h
|
|
|
2024
2027
|
}
|
|
2025
2028
|
});
|
|
2026
2029
|
}
|
|
2027
|
-
return t.type === "array" ? /* @__PURE__ */ r(
|
|
2030
|
+
return t.type === "array" ? /* @__PURE__ */ r($r, {
|
|
2028
2031
|
label: i,
|
|
2029
2032
|
value: Array.isArray(o) ? o : [],
|
|
2030
2033
|
onChange: (n) => l?.(n),
|
|
@@ -2050,7 +2053,7 @@ function L({ component: e, property: t, value: o, onChange: l, valueImmutable: h
|
|
|
2050
2053
|
}, f) : /* @__PURE__ */ r(z, { size: b.size, fullWidth: !0, value: n, onChange: (u) => g(u.target.value) })
|
|
2051
2054
|
}) : (console.error("Unsupported property type", t.type), null);
|
|
2052
2055
|
}
|
|
2053
|
-
function
|
|
2056
|
+
function ut({ NumberProps: e, ...t }) {
|
|
2054
2057
|
const { getInputProps: o } = xr(e), l = o();
|
|
2055
2058
|
return /* @__PURE__ */ r(z, {
|
|
2056
2059
|
...t,
|
|
@@ -2059,7 +2062,7 @@ function dt({ NumberProps: e, ...t }) {
|
|
|
2059
2062
|
}
|
|
2060
2063
|
});
|
|
2061
2064
|
}
|
|
2062
|
-
const
|
|
2065
|
+
const pt = `import React from '@blocklet/pages-kit/builtin/react'
|
|
2063
2066
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
2064
2067
|
|
|
2065
2068
|
export default function () {
|
|
@@ -2068,15 +2071,15 @@ export default function () {
|
|
|
2068
2071
|
Hello World
|
|
2069
2072
|
</Box>
|
|
2070
2073
|
)
|
|
2071
|
-
}`,
|
|
2074
|
+
}`, mt = `console.log('hello')
|
|
2072
2075
|
`;
|
|
2073
|
-
function
|
|
2074
|
-
const { locale: t } = V(), o =
|
|
2076
|
+
function ht({ value: e }) {
|
|
2077
|
+
const { locale: t } = V(), o = Te(), l = Q(e).doc;
|
|
2075
2078
|
return U(() => {
|
|
2076
2079
|
e.renderer?.script || (l.transact(() => {
|
|
2077
|
-
e.renderer.script = e.renderer.type === "react-component" ?
|
|
2080
|
+
e.renderer.script = e.renderer.type === "react-component" ? pt : mt;
|
|
2078
2081
|
}), o());
|
|
2079
|
-
}, [e]), /* @__PURE__ */ r(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ r(
|
|
2082
|
+
}, [e]), /* @__PURE__ */ r(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ r(ve, {
|
|
2080
2083
|
keyId: e.id,
|
|
2081
2084
|
locale: t,
|
|
2082
2085
|
language: "typescript",
|
|
@@ -2088,8 +2091,8 @@ function mt({ value: e }) {
|
|
|
2088
2091
|
}
|
|
2089
2092
|
}, e.id) });
|
|
2090
2093
|
}
|
|
2091
|
-
function
|
|
2092
|
-
const { t } = V(), o = Q(e).doc, { state: { components: l, config: { defaultLocale: h }, resources: p }, localState: { currentLocale: d } } = oe(), b =
|
|
2094
|
+
function ft({ value: e }) {
|
|
2095
|
+
const { t } = V(), o = Q(e).doc, { state: { components: l, config: { defaultLocale: h }, resources: p }, localState: { currentLocale: d } } = oe(), b = xe(), m = l[e.renderer.componentId]?.data ?? p.components?.[e.renderer.componentId]?.component, c = Pe({ variant: "dialog" });
|
|
2093
2096
|
return /* @__PURE__ */ r(le, { children: /* @__PURE__ */ v(k, {
|
|
2094
2097
|
sx: {
|
|
2095
2098
|
gap: 1
|
|
@@ -2109,7 +2112,7 @@ function ht({ value: e }) {
|
|
|
2109
2112
|
alignItems: "center"
|
|
2110
2113
|
},
|
|
2111
2114
|
children: [
|
|
2112
|
-
/* @__PURE__ */ r(
|
|
2115
|
+
/* @__PURE__ */ r(T, { variant: "subtitle2", children: t("parameters") }),
|
|
2113
2116
|
/* @__PURE__ */ r(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...ke(c), children: /* @__PURE__ */ r(Ue, { fontSize: "small" }) })
|
|
2114
2117
|
]
|
|
2115
2118
|
}),
|
|
@@ -2134,8 +2137,8 @@ function ht({ value: e }) {
|
|
|
2134
2137
|
}) });
|
|
2135
2138
|
}
|
|
2136
2139
|
function we({ label: e, options: t, excludes: o, value: l, onChange: h, allComponents: p, ...d }) {
|
|
2137
|
-
const { t: b } = V(), m = t ?? D(Object.values(
|
|
2138
|
-
return /* @__PURE__ */ r(
|
|
2140
|
+
const { t: b } = V(), m = t ?? D(Object.values(Tr(p, ...o ?? [])), "index").map((s) => s.data), c = (typeof l == "string" ? p[l]?.data : void 0) ?? null;
|
|
2141
|
+
return /* @__PURE__ */ r(Ae, {
|
|
2139
2142
|
...d,
|
|
2140
2143
|
size: "small",
|
|
2141
2144
|
options: m,
|
|
@@ -2165,7 +2168,7 @@ function Ye({ config: e, allComponents: t, defaultLocale: o, propertiesValue: l,
|
|
|
2165
2168
|
}) : c(e?.properties);
|
|
2166
2169
|
})();
|
|
2167
2170
|
}, [JSON.stringify(e)]);
|
|
2168
|
-
const i =
|
|
2171
|
+
const i = A(() => !e || !m ? {} : Object.values(m).reduce((u, { data: x }) => {
|
|
2169
2172
|
const I = x.key || x.id;
|
|
2170
2173
|
return u[x.id] = {
|
|
2171
2174
|
key: I,
|
|
@@ -2186,14 +2189,14 @@ function Ye({ config: e, allComponents: t, defaultLocale: o, propertiesValue: l,
|
|
|
2186
2189
|
visibleProperties: x,
|
|
2187
2190
|
canUsePropertiesKeys: N
|
|
2188
2191
|
};
|
|
2189
|
-
}, [JSON.stringify(m)]), f = i(), g =
|
|
2192
|
+
}, [JSON.stringify(m)]), f = i(), g = Ar(f, "key");
|
|
2190
2193
|
return /* @__PURE__ */ r(le, { children: /* @__PURE__ */ v(k, {
|
|
2191
2194
|
sx: {
|
|
2192
2195
|
gap: 2
|
|
2193
2196
|
},
|
|
2194
2197
|
children: [
|
|
2195
|
-
/* @__PURE__ */ r(
|
|
2196
|
-
!e || n.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(
|
|
2198
|
+
/* @__PURE__ */ r(T, { variant: "subtitle1", children: b("maker.properties.parameters") }),
|
|
2199
|
+
!e || n.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(q, { style: { fontSize: 12 }, children: b("maker.properties.noParameters") }) : /* @__PURE__ */ v(F, { children: [
|
|
2197
2200
|
/* @__PURE__ */ r(k, {
|
|
2198
2201
|
sx: {
|
|
2199
2202
|
gap: 2
|
|
@@ -2264,13 +2267,13 @@ function Ye({ config: e, allComponents: t, defaultLocale: o, propertiesValue: l,
|
|
|
2264
2267
|
]
|
|
2265
2268
|
}) });
|
|
2266
2269
|
}
|
|
2267
|
-
function
|
|
2270
|
+
function bt({ config: e }) {
|
|
2268
2271
|
const { t, locale: o } = V(), [l, h] = B(!1), p = (d) => {
|
|
2269
2272
|
e.llmConfig = d;
|
|
2270
2273
|
};
|
|
2271
2274
|
return /* @__PURE__ */ v(F, { children: [
|
|
2272
|
-
/* @__PURE__ */ r(_, { title: t("maker.properties.configLLMDescription"), children: /* @__PURE__ */ r(
|
|
2273
|
-
l && /* @__PURE__ */ r(
|
|
2275
|
+
/* @__PURE__ */ r(_, { title: t("maker.properties.configLLMDescription"), children: /* @__PURE__ */ r(Y, { color: "primary", onClick: () => h(!0), size: "small", children: /* @__PURE__ */ r(Ir, {}) }) }),
|
|
2276
|
+
l && /* @__PURE__ */ r(rt, {
|
|
2274
2277
|
open: l,
|
|
2275
2278
|
onClose: () => h(!1),
|
|
2276
2279
|
onConfirm: p,
|
|
@@ -2283,12 +2286,12 @@ function ft({ config: e }) {
|
|
|
2283
2286
|
] });
|
|
2284
2287
|
}
|
|
2285
2288
|
export {
|
|
2286
|
-
|
|
2289
|
+
ot as BasicInfo,
|
|
2287
2290
|
we as CustomComponentAutocomplete,
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
+
on as CustomComponentSettings,
|
|
2292
|
+
pt as DefaultReactComponentScriptTemplate,
|
|
2293
|
+
mt as DefaultWebComponentScriptTemplate,
|
|
2291
2294
|
Ye as ParametersConfig,
|
|
2292
|
-
|
|
2295
|
+
st as PropertiesConfig,
|
|
2293
2296
|
L as PropertyValueField
|
|
2294
2297
|
};
|