@blocklet/pages-kit-inner-components 0.5.36 → 0.5.38
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/{array-Ck0L_JhL.js → array-Cr5KF-hM.js} +1 -1
- package/lib/cjs/chunks/{config-string-CaLe_baf.js → config-string-BYZ5HfyY.js} +1 -1
- package/lib/cjs/chunks/{draft-data-CY1N7Ozn.js → draft-data-6zW9mu28.js} +1 -1
- package/lib/cjs/chunks/{home-CjWVwLEf.js → home-C0ZSLVcc.js} +3 -3
- package/lib/cjs/chunks/{publish-button-BDrUGRX4.js → publish-button-CPmErdXB.js} +1 -1
- package/lib/cjs/chunks/state-BWuBNdK8.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +4 -4
- package/lib/cjs/setting.js +2 -2
- package/lib/es/add-component.js +3 -3
- package/lib/es/chunks/{array-HCA75FfO.js → array-D34Qpnhk.js} +1 -1
- package/lib/es/chunks/{config-string-17RNX8vu.js → config-string-DgK7ETCs.js} +1 -1
- package/lib/es/chunks/{draft-data-CyeVe0kA.js → draft-data-B5kzDvTI.js} +1 -1
- package/lib/es/chunks/{home-COrN_x32.js → home-B1ALs6m4.js} +4 -4
- package/lib/es/chunks/{publish-button-WmGjhj6q.js → publish-button-9J9uRZtS.js} +3 -3
- package/lib/es/chunks/{state-Br2xp7Mf.js → state-BzwEX9VC.js} +38 -38
- package/lib/es/home.js +3 -3
- package/lib/es/project-html.js +25 -25
- package/lib/es/setting.js +154 -154
- package/package.json +3 -3
- package/lib/cjs/chunks/state-D4QeRw7n.js +0 -1
package/lib/es/setting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t, jsxs as O, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
-
import { t as ve, g as Te, b as ce, E as ot, n as Ke, h as xe } from "./chunks/state-
|
|
2
|
+
import { t as ve, g as Te, b as ce, E as ot, n as Ke, h as xe } from "./chunks/state-BzwEX9VC.js";
|
|
3
3
|
import de from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useLocaleContext as D } from "@arcblock/ux/lib/Locale/context";
|
|
5
5
|
import { CodeEditor as ge } from "@blocklet/code-editor";
|
|
@@ -7,12 +7,12 @@ import nt from "@mui/icons-material/AddRounded";
|
|
|
7
7
|
import st from "@mui/icons-material/ArrowDownward";
|
|
8
8
|
import ct from "@mui/icons-material/ArrowUpward";
|
|
9
9
|
import dt from "@mui/icons-material/DeleteOutline";
|
|
10
|
-
import { Typography as B, TextField as
|
|
10
|
+
import { Typography as B, TextField as N, Stack as R, FormLabel as le, Box as j, TableContainer as at, Paper as ee, Table as Be, TableHead as Fe, TableRow as oe, TableCell as ne, TableBody as Je, Button as E, IconButton as ae, InputAdornment as we, alpha as pe, Tooltip as G, buttonClasses as ut, Dialog as Me, Autocomplete as $e, FormControlLabel as pt, Switch as mt, MenuItem as me, DialogTitle as ft, DialogContent as ht, DialogActions as bt, Collapse as yt, Divider as vt, Popper as xt } from "@mui/material";
|
|
11
11
|
import A from "lodash/sortBy";
|
|
12
12
|
import { useCallback as C, useMemo as Q, useRef as J, useId as gt, useEffect as M, useState as X } from "react";
|
|
13
13
|
import { useUpdate as _e } from "react-use";
|
|
14
14
|
import { ColorItem as wt, ConfigColorDialog as Pt } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
|
-
import { C as kt } from "./chunks/config-string-
|
|
15
|
+
import { C as kt } from "./chunks/config-string-DgK7ETCs.js";
|
|
16
16
|
import Pe from "lodash/isEmpty";
|
|
17
17
|
import He from "lodash/set";
|
|
18
18
|
import * as fe from "yaml";
|
|
@@ -20,8 +20,8 @@ import { UploaderButton as Ye, UploaderProvider as ue, useUploader as St, getIma
|
|
|
20
20
|
import jt from "lodash/cloneDeep";
|
|
21
21
|
import he from "@arcblock/ux/lib/Toast";
|
|
22
22
|
import { CustomComponentRenderer as qe, transpileAndLoadScript as Rt, getPropertiesFromCode as zt } from "@blocklet/pages-kit/components";
|
|
23
|
-
import { parsePropertyValue as
|
|
24
|
-
import { unstable_useNumberInput as
|
|
23
|
+
import { parsePropertyValue as Vt } from "@blocklet/pages-kit/utils/property";
|
|
24
|
+
import { unstable_useNumberInput as Nt, ClickAwayListener as Dt } from "@mui/base";
|
|
25
25
|
import { VisibilityOffRounded as Ct, VisibilityRounded as Et, DeleteOutlineRounded as At, DragIndicatorRounded as Tt, TranslateRounded as Le, AddRounded as Ge, InfoRounded as Qe, StarRounded as Ut, SettingsRounded as Xe } from "@mui/icons-material";
|
|
26
26
|
import { getYjsValue as te } from "@syncedstore/core";
|
|
27
27
|
import { useUpdate as Wt, useReactive as Kt } from "ahooks";
|
|
@@ -69,12 +69,12 @@ function rr({
|
|
|
69
69
|
onChange: i,
|
|
70
70
|
disabled: l = !1,
|
|
71
71
|
itemLabel: p = "",
|
|
72
|
-
emptyHeight:
|
|
72
|
+
emptyHeight: b = 40,
|
|
73
73
|
property: a,
|
|
74
74
|
renderItem: g,
|
|
75
75
|
...P
|
|
76
76
|
}) {
|
|
77
|
-
const { t:
|
|
77
|
+
const { t: y, locale: v } = D(), x = _e(), o = C(
|
|
78
78
|
(f) => {
|
|
79
79
|
i(ve(f, a.type));
|
|
80
80
|
},
|
|
@@ -86,11 +86,11 @@ function rr({
|
|
|
86
86
|
if (!a || !a.subProperties)
|
|
87
87
|
return n();
|
|
88
88
|
const f = {};
|
|
89
|
-
A(Object.values(a.subProperties), "index").forEach(({ data:
|
|
89
|
+
A(Object.values(a.subProperties), "index").forEach(({ data: V }) => {
|
|
90
90
|
var U, W;
|
|
91
|
-
if (!
|
|
92
|
-
const T = ((W = (U =
|
|
93
|
-
f[
|
|
91
|
+
if (!V.key) return;
|
|
92
|
+
const T = ((W = (U = V.locales) == null ? void 0 : U[v]) == null ? void 0 : W.defaultValue) ?? "";
|
|
93
|
+
f[V.key] = T;
|
|
94
94
|
});
|
|
95
95
|
const z = [...s, f];
|
|
96
96
|
o(z), x();
|
|
@@ -106,7 +106,7 @@ function rr({
|
|
|
106
106
|
[o]
|
|
107
107
|
), w = C(
|
|
108
108
|
(f) => {
|
|
109
|
-
const S = s.filter((z,
|
|
109
|
+
const S = s.filter((z, V) => V !== f);
|
|
110
110
|
o(S), x();
|
|
111
111
|
},
|
|
112
112
|
[s, o, x]
|
|
@@ -163,13 +163,13 @@ function rr({
|
|
|
163
163
|
property: a,
|
|
164
164
|
onChange: (z) => u(S, z)
|
|
165
165
|
}) : /* @__PURE__ */ t(
|
|
166
|
-
|
|
166
|
+
N,
|
|
167
167
|
{
|
|
168
168
|
fullWidth: !0,
|
|
169
169
|
size: "small",
|
|
170
170
|
disabled: l,
|
|
171
171
|
value: f,
|
|
172
|
-
placeholder: p || `${
|
|
172
|
+
placeholder: p || `${y("item")} ${S + 1}`,
|
|
173
173
|
onChange: (z) => u(S, z.target.value),
|
|
174
174
|
...P
|
|
175
175
|
}
|
|
@@ -199,7 +199,7 @@ function rr({
|
|
|
199
199
|
a,
|
|
200
200
|
u,
|
|
201
201
|
p,
|
|
202
|
-
|
|
202
|
+
y,
|
|
203
203
|
l,
|
|
204
204
|
P,
|
|
205
205
|
w,
|
|
@@ -247,28 +247,28 @@ function rr({
|
|
|
247
247
|
backgroundColor: "action.hover"
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
|
-
children: I.map((
|
|
250
|
+
children: I.map((V) => /* @__PURE__ */ t(
|
|
251
251
|
ne,
|
|
252
252
|
{
|
|
253
|
-
width:
|
|
254
|
-
align:
|
|
253
|
+
width: V.width,
|
|
254
|
+
align: V.align || "left",
|
|
255
255
|
sx: {
|
|
256
256
|
borderBottom: "none"
|
|
257
257
|
},
|
|
258
|
-
children:
|
|
258
|
+
children: V.renderCell({
|
|
259
259
|
row: f,
|
|
260
260
|
index: S,
|
|
261
261
|
onChange: (T) => u(S, T)
|
|
262
262
|
})
|
|
263
263
|
},
|
|
264
|
-
`${S}-${
|
|
264
|
+
`${S}-${V.field}`
|
|
265
265
|
))
|
|
266
266
|
},
|
|
267
267
|
S
|
|
268
268
|
)) })
|
|
269
269
|
]
|
|
270
270
|
}
|
|
271
|
-
) }) : /* @__PURE__ */ t(de, { style: { fontSize: 12, height:
|
|
271
|
+
) }) : /* @__PURE__ */ t(de, { style: { fontSize: 12, height: b }, children: y("maker.properties.arrayEmpty") }),
|
|
272
272
|
/* @__PURE__ */ t(
|
|
273
273
|
E,
|
|
274
274
|
{
|
|
@@ -278,7 +278,7 @@ function rr({
|
|
|
278
278
|
disabled: l,
|
|
279
279
|
startIcon: /* @__PURE__ */ t(nt, {}),
|
|
280
280
|
onClick: d,
|
|
281
|
-
children:
|
|
281
|
+
children: y("maker.properties.addArrayItem")
|
|
282
282
|
}
|
|
283
283
|
)
|
|
284
284
|
] }) : /* @__PURE__ */ O(R, { width: "100%", gap: 1, children: [
|
|
@@ -332,8 +332,8 @@ function ir({
|
|
|
332
332
|
Pt,
|
|
333
333
|
{
|
|
334
334
|
ref: l,
|
|
335
|
-
onSave: ({ value: p },
|
|
336
|
-
r(p),
|
|
335
|
+
onSave: ({ value: p }, b) => {
|
|
336
|
+
r(p), b();
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
)
|
|
@@ -345,12 +345,12 @@ function lr({
|
|
|
345
345
|
onChange: i,
|
|
346
346
|
property: l,
|
|
347
347
|
component: p,
|
|
348
|
-
defaultLocale:
|
|
348
|
+
defaultLocale: b,
|
|
349
349
|
allComponents: a,
|
|
350
350
|
PropertyValueField: g,
|
|
351
351
|
onUpload: P
|
|
352
352
|
}) {
|
|
353
|
-
const { locale:
|
|
353
|
+
const { locale: y } = D(), v = J(null);
|
|
354
354
|
if (!Pe(l.subProperties)) {
|
|
355
355
|
const o = A(Object.values(l.subProperties || {}), "index").filter(
|
|
356
356
|
(s) => s.data.visible !== !1 && s.data.key
|
|
@@ -364,7 +364,7 @@ function lr({
|
|
|
364
364
|
r && typeof r == "object" ? c = r[h] : typeof r == "string" && (c = (l.type === "yaml" ? fe.parse(r || "") : JSON.parse(r || "{}"))[h]);
|
|
365
365
|
} catch {
|
|
366
366
|
}
|
|
367
|
-
c == null && (d.locales &&
|
|
367
|
+
c == null && (d.locales && y && d.locales[y] ? c = d.locales[y].defaultValue : d.locales && b && d.locales[b] && (c = d.locales[b].defaultValue));
|
|
368
368
|
const m = (k) => {
|
|
369
369
|
try {
|
|
370
370
|
let I = {};
|
|
@@ -458,7 +458,7 @@ function lr({
|
|
|
458
458
|
onChange: m,
|
|
459
459
|
size: "small",
|
|
460
460
|
fullWidth: !0,
|
|
461
|
-
defaultLocale:
|
|
461
|
+
defaultLocale: b,
|
|
462
462
|
allComponents: a
|
|
463
463
|
}
|
|
464
464
|
) })
|
|
@@ -498,7 +498,7 @@ function lr({
|
|
|
498
498
|
ge,
|
|
499
499
|
{
|
|
500
500
|
keyId: l.id,
|
|
501
|
-
locale:
|
|
501
|
+
locale: y,
|
|
502
502
|
language: l.type === "yaml" ? "yaml" : "json",
|
|
503
503
|
value: typeof r == "string" ? r : "",
|
|
504
504
|
onChange: (o) => {
|
|
@@ -548,7 +548,7 @@ function tt({
|
|
|
548
548
|
renderItem: i,
|
|
549
549
|
...l
|
|
550
550
|
}) {
|
|
551
|
-
const p = J(null),
|
|
551
|
+
const p = J(null), b = gt(), a = Wt(), g = A(Object.entries(r), (s) => s[1].index).map((s) => s[0]), P = J(g), y = C(
|
|
552
552
|
(s) => {
|
|
553
553
|
P.current = s, a();
|
|
554
554
|
},
|
|
@@ -556,15 +556,15 @@ function tt({
|
|
|
556
556
|
), v = C(
|
|
557
557
|
({ index: s }, { index: n }) => {
|
|
558
558
|
const d = [...P.current];
|
|
559
|
-
d.splice(n, 0, ...d.splice(s, 1)),
|
|
559
|
+
d.splice(n, 0, ...d.splice(s, 1)), y(d);
|
|
560
560
|
},
|
|
561
|
-
[
|
|
561
|
+
[y]
|
|
562
562
|
);
|
|
563
563
|
M(() => {
|
|
564
|
-
|
|
564
|
+
y(g);
|
|
565
565
|
}, [g.join("-")]);
|
|
566
566
|
const [{ isOver: x }, o] = et({
|
|
567
|
-
accept:
|
|
567
|
+
accept: b,
|
|
568
568
|
collect: (s) => ({
|
|
569
569
|
isOver: s.isOver()
|
|
570
570
|
}),
|
|
@@ -583,11 +583,11 @@ function tt({
|
|
|
583
583
|
}
|
|
584
584
|
});
|
|
585
585
|
return M(() => {
|
|
586
|
-
x ||
|
|
586
|
+
x || y(g);
|
|
587
587
|
}, [x]), o(p), /* @__PURE__ */ t(j, { ...l, ref: p, className: Qt(x && "isDragging"), children: P.current.map((s, n) => /* @__PURE__ */ t(
|
|
588
588
|
nr,
|
|
589
589
|
{
|
|
590
|
-
type:
|
|
590
|
+
type: b,
|
|
591
591
|
disabled: e,
|
|
592
592
|
id: s,
|
|
593
593
|
index: n,
|
|
@@ -607,10 +607,10 @@ function nr({
|
|
|
607
607
|
index: i,
|
|
608
608
|
type: l,
|
|
609
609
|
children: p,
|
|
610
|
-
itemIndex:
|
|
610
|
+
itemIndex: b,
|
|
611
611
|
move: a
|
|
612
612
|
}) {
|
|
613
|
-
const g = J(), [{ isDragging: P },
|
|
613
|
+
const g = J(), [{ isDragging: P }, y, v] = Xt({
|
|
614
614
|
type: l,
|
|
615
615
|
item: () => ({ id: r }),
|
|
616
616
|
canDrag: () => !e,
|
|
@@ -622,7 +622,7 @@ function nr({
|
|
|
622
622
|
var u;
|
|
623
623
|
if (!g.current)
|
|
624
624
|
return;
|
|
625
|
-
const n =
|
|
625
|
+
const n = b(o.id), d = i;
|
|
626
626
|
if (n === d)
|
|
627
627
|
return;
|
|
628
628
|
const h = (u = g.current) == null ? void 0 : u.getBoundingClientRect(), w = (h.bottom - h.top) / 2, m = s.getClientOffset().y - h.top;
|
|
@@ -631,10 +631,10 @@ function nr({
|
|
|
631
631
|
});
|
|
632
632
|
return typeof p == "function" ? p({
|
|
633
633
|
isDragging: P,
|
|
634
|
-
drag:
|
|
634
|
+
drag: y,
|
|
635
635
|
drop: (o) => (g.current = o, x(o)),
|
|
636
636
|
preview: v
|
|
637
|
-
}) : (
|
|
637
|
+
}) : (y(x(v(g))), /* @__PURE__ */ t(j, { ref: g, children: p }));
|
|
638
638
|
}
|
|
639
639
|
function sr({
|
|
640
640
|
drop: e,
|
|
@@ -642,11 +642,11 @@ function sr({
|
|
|
642
642
|
drag: i,
|
|
643
643
|
disabled: l,
|
|
644
644
|
isDragging: p,
|
|
645
|
-
children:
|
|
645
|
+
children: b,
|
|
646
646
|
onDelete: a,
|
|
647
647
|
onVisibilityChange: g,
|
|
648
648
|
visible: P = !0,
|
|
649
|
-
actions:
|
|
649
|
+
actions: y,
|
|
650
650
|
alwaysShowActions: v = !1
|
|
651
651
|
}) {
|
|
652
652
|
const { t: x } = D();
|
|
@@ -670,7 +670,7 @@ function sr({
|
|
|
670
670
|
opacity: 0.9999
|
|
671
671
|
// NOTE: make preview effective
|
|
672
672
|
},
|
|
673
|
-
children:
|
|
673
|
+
children: b
|
|
674
674
|
}
|
|
675
675
|
),
|
|
676
676
|
!l && /* @__PURE__ */ t(
|
|
@@ -701,7 +701,7 @@ function sr({
|
|
|
701
701
|
}
|
|
702
702
|
},
|
|
703
703
|
children: [
|
|
704
|
-
|
|
704
|
+
y,
|
|
705
705
|
g && /* @__PURE__ */ t(G, { title: x(P ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(E, { onClick: () => g(!P), children: P ? /* @__PURE__ */ t(Ct, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ t(Et, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
706
706
|
a && /* @__PURE__ */ t(G, { title: x("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(E, { onClick: a, children: /* @__PURE__ */ t(At, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
707
707
|
/* @__PURE__ */ t(G, { title: x("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(E, { ref: i, children: /* @__PURE__ */ t(Tt, { sx: { color: "grey.500" } }) }) })
|
|
@@ -722,19 +722,19 @@ function cr({
|
|
|
722
722
|
const [l, p] = X(!1);
|
|
723
723
|
return /* @__PURE__ */ O(R, { gap: 1, children: [
|
|
724
724
|
/* @__PURE__ */ t(
|
|
725
|
-
|
|
725
|
+
N,
|
|
726
726
|
{
|
|
727
727
|
label: e,
|
|
728
728
|
size: "small",
|
|
729
729
|
value: r,
|
|
730
|
-
onChange: (
|
|
730
|
+
onChange: (b) => i == null ? void 0 : i(b.target.value),
|
|
731
731
|
InputProps: {
|
|
732
732
|
endAdornment: /* @__PURE__ */ t(
|
|
733
733
|
Ye,
|
|
734
734
|
{
|
|
735
|
-
onChange: ({ response:
|
|
735
|
+
onChange: ({ response: b }) => {
|
|
736
736
|
var g;
|
|
737
|
-
const a = (g =
|
|
737
|
+
const a = (g = b == null ? void 0 : b.data) == null ? void 0 : g.filename;
|
|
738
738
|
a && (i == null || i(a));
|
|
739
739
|
}
|
|
740
740
|
}
|
|
@@ -760,8 +760,8 @@ function cr({
|
|
|
760
760
|
}
|
|
761
761
|
function be(e, r = "") {
|
|
762
762
|
return qt(e, (i, l, p) => {
|
|
763
|
-
const
|
|
764
|
-
return $t(l) ? Bt(i, be(l,
|
|
763
|
+
const b = r ? `${r}.${p}` : p;
|
|
764
|
+
return $t(l) ? Bt(i, be(l, b)) : i[b] = l, i;
|
|
765
765
|
}, {});
|
|
766
766
|
}
|
|
767
767
|
const dr = [
|
|
@@ -791,17 +791,17 @@ function ci({ componentId: e }) {
|
|
|
791
791
|
}
|
|
792
792
|
function ar({ value: e, componentId: r }) {
|
|
793
793
|
var x, o, s;
|
|
794
|
-
const { t: i } = D(), { localState: { currentLocale: l, customComponentPreviewerProperties: p }, state: { config: { defaultLocale:
|
|
794
|
+
const { t: i } = D(), { localState: { currentLocale: l, customComponentPreviewerProperties: p }, state: { config: { defaultLocale: b } }, localActions: { setCustomComponentPreviewerProperties: a } } = ce(), g = te(e).doc, P = xe(), y = Q(() => (p == null ? void 0 : p[r]) ?? {}, [r, p]), v = Kt({
|
|
795
795
|
componentId: r,
|
|
796
796
|
propertiesValue: {
|
|
797
|
-
...
|
|
797
|
+
...y
|
|
798
798
|
}
|
|
799
799
|
});
|
|
800
800
|
return M(() => {
|
|
801
801
|
v.componentId !== r && (v.componentId = r, v.propertiesValue = {
|
|
802
|
-
...
|
|
802
|
+
...y
|
|
803
803
|
});
|
|
804
|
-
}, [r,
|
|
804
|
+
}, [r, y, v]), M(() => {
|
|
805
805
|
if (v.componentId !== r)
|
|
806
806
|
return;
|
|
807
807
|
const n = Object.fromEntries(Object.values(e.properties ?? {}).map(({ data: d }) => {
|
|
@@ -809,9 +809,9 @@ function ar({ value: e, componentId: r }) {
|
|
|
809
809
|
return [
|
|
810
810
|
d.id,
|
|
811
811
|
{
|
|
812
|
-
value: ((h = v.propertiesValue[d.id]) == null ? void 0 : h.value) ??
|
|
812
|
+
value: ((h = v.propertiesValue[d.id]) == null ? void 0 : h.value) ?? Vt(d, ((c = (w = d.locales) == null ? void 0 : w[l]) == null ? void 0 : c.defaultValue) ?? ((u = (m = d.locales) == null ? void 0 : m[b]) == null ? void 0 : u.defaultValue), {
|
|
813
813
|
locale: l,
|
|
814
|
-
defaultLocale:
|
|
814
|
+
defaultLocale: b
|
|
815
815
|
})
|
|
816
816
|
}
|
|
817
817
|
];
|
|
@@ -822,7 +822,7 @@ function ar({ value: e, componentId: r }) {
|
|
|
822
822
|
/* @__PURE__ */ t(mr, {
|
|
823
823
|
config: e,
|
|
824
824
|
currentLocale: l,
|
|
825
|
-
defaultLocale:
|
|
825
|
+
defaultLocale: b,
|
|
826
826
|
allComponents: P,
|
|
827
827
|
onUpdateConfig: (n) => {
|
|
828
828
|
g.transact(() => {
|
|
@@ -832,7 +832,7 @@ function ar({ value: e, componentId: r }) {
|
|
|
832
832
|
}),
|
|
833
833
|
/* @__PURE__ */ O(R, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
834
834
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: i("renderer") }),
|
|
835
|
-
/* @__PURE__ */ O(
|
|
835
|
+
/* @__PURE__ */ O(N, {
|
|
836
836
|
hiddenLabel: !0,
|
|
837
837
|
size: "small",
|
|
838
838
|
select: !0,
|
|
@@ -855,9 +855,9 @@ function ar({ value: e, componentId: r }) {
|
|
|
855
855
|
/* @__PURE__ */ t(lt, {
|
|
856
856
|
config: e,
|
|
857
857
|
currentLocale: l,
|
|
858
|
-
defaultLocale:
|
|
858
|
+
defaultLocale: b,
|
|
859
859
|
allComponents: P,
|
|
860
|
-
propertiesValue:
|
|
860
|
+
propertiesValue: v.propertiesValue,
|
|
861
861
|
onChange: ({ value: n, id: d, path: h }) => {
|
|
862
862
|
const w = [...h, "data"];
|
|
863
863
|
if (!Ft(e, w)) {
|
|
@@ -877,13 +877,13 @@ function ur({ config: e }) {
|
|
|
877
877
|
const { t: r } = D();
|
|
878
878
|
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
879
879
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: r("basicInfo") }),
|
|
880
|
-
/* @__PURE__ */ t(
|
|
880
|
+
/* @__PURE__ */ t(N, {
|
|
881
881
|
label: r("name"),
|
|
882
882
|
size: "small",
|
|
883
883
|
value: e.name || "",
|
|
884
884
|
onChange: (i) => e.name = i.target.value
|
|
885
885
|
}),
|
|
886
|
-
/* @__PURE__ */ t(
|
|
886
|
+
/* @__PURE__ */ t(N, {
|
|
887
887
|
label: r("description"),
|
|
888
888
|
size: "small",
|
|
889
889
|
multiline: !0,
|
|
@@ -900,7 +900,7 @@ function ur({ config: e }) {
|
|
|
900
900
|
freeSolo: !0,
|
|
901
901
|
value: e.tags ?? [],
|
|
902
902
|
onChange: (i, l) => e.tags = l,
|
|
903
|
-
renderInput: (i) => /* @__PURE__ */ t(
|
|
903
|
+
renderInput: (i) => /* @__PURE__ */ t(N, { label: r("tags"), ...i })
|
|
904
904
|
}),
|
|
905
905
|
/* @__PURE__ */ t(cr, {
|
|
906
906
|
label: r("previewImage"),
|
|
@@ -909,9 +909,9 @@ function ur({ config: e }) {
|
|
|
909
909
|
})
|
|
910
910
|
] }) });
|
|
911
911
|
}
|
|
912
|
-
function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defaultLocale:
|
|
912
|
+
function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defaultLocale: b, allComponents: a, onUpdateConfig: g }) {
|
|
913
913
|
var v, x, o, s, n, d;
|
|
914
|
-
const { t: P } = D(),
|
|
914
|
+
const { t: P } = D(), y = Q(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? br : $, [e.type]);
|
|
915
915
|
return /* @__PURE__ */ t(sr, {
|
|
916
916
|
preview: r.preview,
|
|
917
917
|
drop: r.drop,
|
|
@@ -936,7 +936,7 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defau
|
|
|
936
936
|
},
|
|
937
937
|
alwaysShowActions: !0,
|
|
938
938
|
children: /* @__PURE__ */ O(R, { direction: "column", gap: 2, children: [
|
|
939
|
-
/* @__PURE__ */ t(
|
|
939
|
+
/* @__PURE__ */ t(N, {
|
|
940
940
|
label: P("key"),
|
|
941
941
|
size: "small",
|
|
942
942
|
required: !0,
|
|
@@ -977,11 +977,11 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defau
|
|
|
977
977
|
}
|
|
978
978
|
}),
|
|
979
979
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, children: [
|
|
980
|
-
/* @__PURE__ */ t(
|
|
980
|
+
/* @__PURE__ */ t(N, {
|
|
981
981
|
label: P("label"),
|
|
982
982
|
size: "small",
|
|
983
983
|
sx: { flex: 1 },
|
|
984
|
-
value: (((x = (v = e.locales) == null ? void 0 : v[p]) == null ? void 0 : x.name) ?? ((s = (o = e.locales) == null ? void 0 : o[
|
|
984
|
+
value: (((x = (v = e.locales) == null ? void 0 : v[p]) == null ? void 0 : x.name) ?? ((s = (o = e.locales) == null ? void 0 : o[b]) == null ? void 0 : s.name)) || "",
|
|
985
985
|
onChange: (h) => {
|
|
986
986
|
g((w) => {
|
|
987
987
|
var m;
|
|
@@ -990,7 +990,7 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defau
|
|
|
990
990
|
});
|
|
991
991
|
}
|
|
992
992
|
}),
|
|
993
|
-
/* @__PURE__ */ t(
|
|
993
|
+
/* @__PURE__ */ t(N, {
|
|
994
994
|
label: P("type"),
|
|
995
995
|
size: "small",
|
|
996
996
|
select: !0,
|
|
@@ -1010,9 +1010,9 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defau
|
|
|
1010
1010
|
})
|
|
1011
1011
|
] }),
|
|
1012
1012
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, children: [
|
|
1013
|
-
/* @__PURE__ */ t(
|
|
1013
|
+
/* @__PURE__ */ t(y, {
|
|
1014
1014
|
allComponents: a,
|
|
1015
|
-
defaultLocale:
|
|
1015
|
+
defaultLocale: b,
|
|
1016
1016
|
component: l,
|
|
1017
1017
|
property: e,
|
|
1018
1018
|
label: P("defaultValue"),
|
|
@@ -1041,7 +1041,7 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defau
|
|
|
1041
1041
|
function pr(e, r) {
|
|
1042
1042
|
const [i, l] = X(0);
|
|
1043
1043
|
return M(() => {
|
|
1044
|
-
const
|
|
1044
|
+
const b = setTimeout(() => {
|
|
1045
1045
|
if (e.current) {
|
|
1046
1046
|
let a = e.current.parentElement, g = 0;
|
|
1047
1047
|
for (; a; )
|
|
@@ -1049,23 +1049,23 @@ function pr(e, r) {
|
|
|
1049
1049
|
l(g);
|
|
1050
1050
|
}
|
|
1051
1051
|
}, 100);
|
|
1052
|
-
return () => clearTimeout(
|
|
1052
|
+
return () => clearTimeout(b);
|
|
1053
1053
|
}, [e, r]), i;
|
|
1054
1054
|
}
|
|
1055
|
-
function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, onUpdateConfig: p, useI18nEditor:
|
|
1055
|
+
function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, onUpdateConfig: p, useI18nEditor: b = !0 }) {
|
|
1056
1056
|
const { t: a } = D(), g = ke({ variant: "dialog" }), P = e.properties && A(Object.values(e.properties), "index");
|
|
1057
1057
|
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
1058
1058
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
1059
1059
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: a("properties") }),
|
|
1060
1060
|
/* @__PURE__ */ t(j, { flex: 1 }),
|
|
1061
|
-
|
|
1061
|
+
b && /* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Se(g), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
|
|
1062
1062
|
] }),
|
|
1063
1063
|
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ t(tt, {
|
|
1064
1064
|
component: R,
|
|
1065
1065
|
gap: 2,
|
|
1066
1066
|
list: e.properties,
|
|
1067
|
-
renderItem: (
|
|
1068
|
-
const o = ye(e.properties,
|
|
1067
|
+
renderItem: (y, v, x) => {
|
|
1068
|
+
const o = ye(e.properties, y.id);
|
|
1069
1069
|
return /* @__PURE__ */ t(ee, {
|
|
1070
1070
|
elevation: 0,
|
|
1071
1071
|
className: "property-container",
|
|
@@ -1076,7 +1076,7 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
|
|
|
1076
1076
|
borderColor: "divider"
|
|
1077
1077
|
},
|
|
1078
1078
|
children: /* @__PURE__ */ t(R, { gap: 2, children: /* @__PURE__ */ t(rt, {
|
|
1079
|
-
data:
|
|
1079
|
+
data: y,
|
|
1080
1080
|
params: x,
|
|
1081
1081
|
visible: o,
|
|
1082
1082
|
config: e,
|
|
@@ -1085,7 +1085,7 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
|
|
|
1085
1085
|
allComponents: l,
|
|
1086
1086
|
onUpdateConfig: p
|
|
1087
1087
|
}) })
|
|
1088
|
-
},
|
|
1088
|
+
}, y.id);
|
|
1089
1089
|
}
|
|
1090
1090
|
}) : /* @__PURE__ */ t(de, { style: { fontSize: 12 }, children: a("maker.properties.noProperties") }),
|
|
1091
1091
|
/* @__PURE__ */ t(E, {
|
|
@@ -1093,16 +1093,16 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
|
|
|
1093
1093
|
variant: "outlined",
|
|
1094
1094
|
className: "ignore-style-override",
|
|
1095
1095
|
onClick: () => {
|
|
1096
|
-
p((
|
|
1096
|
+
p((y) => {
|
|
1097
1097
|
var x;
|
|
1098
1098
|
const v = Ke();
|
|
1099
|
-
|
|
1099
|
+
y.properties ?? (y.properties = {}), (x = y.properties)[v] ?? (x[v] = { index: (P == null ? void 0 : P.length) || 0, data: { id: v } });
|
|
1100
1100
|
});
|
|
1101
1101
|
},
|
|
1102
1102
|
startIcon: /* @__PURE__ */ t(Ge, {}),
|
|
1103
1103
|
children: a("addObject", { object: a("property") })
|
|
1104
1104
|
}),
|
|
1105
|
-
|
|
1105
|
+
b && /* @__PURE__ */ t(it, { ...Ze(g), component: e })
|
|
1106
1106
|
] }) });
|
|
1107
1107
|
}
|
|
1108
1108
|
function fr({ property: e, allComponents: r }) {
|
|
@@ -1118,17 +1118,17 @@ function fr({ property: e, allComponents: r }) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allComponents: p }) {
|
|
1120
1120
|
var v;
|
|
1121
|
-
const [
|
|
1122
|
-
return
|
|
1121
|
+
const [b, a] = X(!1), { t: g, locale: P } = D(), y = typeof (e == null ? void 0 : e.componentId) == "string" ? (v = p[e.componentId]) == null ? void 0 : v.data : void 0;
|
|
1122
|
+
return y ? /* @__PURE__ */ O(j, { sx: { width: "100%", position: "relative" }, children: [
|
|
1123
1123
|
/* @__PURE__ */ t(ae, {
|
|
1124
1124
|
sx: { minWidth: 0 },
|
|
1125
|
-
disabled: !
|
|
1125
|
+
disabled: !y,
|
|
1126
1126
|
size: "small",
|
|
1127
|
-
onClick: () => a(!
|
|
1128
|
-
color:
|
|
1127
|
+
onClick: () => a(!b),
|
|
1128
|
+
color: b ? "primary" : "default",
|
|
1129
1129
|
children: /* @__PURE__ */ t(Xe, { fontSize: "small" })
|
|
1130
1130
|
}),
|
|
1131
|
-
|
|
1131
|
+
b && /* @__PURE__ */ t(yt, { in: b, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ O(ee, {
|
|
1132
1132
|
elevation: 1,
|
|
1133
1133
|
sx: {
|
|
1134
1134
|
mt: 1,
|
|
@@ -1140,7 +1140,7 @@ function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allCom
|
|
|
1140
1140
|
},
|
|
1141
1141
|
children: [
|
|
1142
1142
|
/* @__PURE__ */ t(j, { width: "100%", mb: 2, children: /* @__PURE__ */ t(lt, {
|
|
1143
|
-
config:
|
|
1143
|
+
config: y,
|
|
1144
1144
|
currentLocale: P,
|
|
1145
1145
|
defaultLocale: l,
|
|
1146
1146
|
allComponents: p,
|
|
@@ -1157,18 +1157,18 @@ function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allCom
|
|
|
1157
1157
|
}
|
|
1158
1158
|
function it({ type: e = "properties", component: r, ...i }) {
|
|
1159
1159
|
var x, o, s;
|
|
1160
|
-
const { t: l } = D(), { state: { components: p, supportedLocales:
|
|
1160
|
+
const { t: l } = D(), { state: { components: p, supportedLocales: b, config: { defaultLocale: a } } } = ce(), g = xe(), P = te(r).doc, y = e === "properties" ? r.properties : e === "parameters" && ((x = r.renderer) == null ? void 0 : x.type) === "component" ? (o = p[r.renderer.componentId]) == null ? void 0 : o.data.properties : void 0, v = ((s = r.renderer) == null ? void 0 : s.type) === "component" ? r : void 0;
|
|
1161
1161
|
return /* @__PURE__ */ O(Me, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
1162
1162
|
/* @__PURE__ */ t(ft, { children: l("i18nEditorTitle") }),
|
|
1163
|
-
/* @__PURE__ */ t(ht, { children:
|
|
1164
|
-
/* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(oe, { children:
|
|
1163
|
+
/* @__PURE__ */ t(ht, { children: y && /* @__PURE__ */ t(R, { children: /* @__PURE__ */ O(Be, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
1164
|
+
/* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(oe, { children: b.map(({ locale: n, name: d }) => /* @__PURE__ */ t(ne, { children: /* @__PURE__ */ O(B, { color: "text.primary", children: [
|
|
1165
1165
|
d,
|
|
1166
1166
|
a === n && /* @__PURE__ */ t(Ut, { sx: { fontSize: 12 } })
|
|
1167
1167
|
] }) }, n)) }) }),
|
|
1168
|
-
/* @__PURE__ */ t(Je, { children: A(Object.values(
|
|
1169
|
-
var h, w, c, m, u, k, I, f, S, z,
|
|
1168
|
+
/* @__PURE__ */ t(Je, { children: A(Object.values(y), "index").map(({ data: n }) => /* @__PURE__ */ t(oe, { children: b.map(({ locale: d }) => {
|
|
1169
|
+
var h, w, c, m, u, k, I, f, S, z, V, T, U, W, re, _, H, Y, q, L, Oe, je, Re, ze, Ve, Ne;
|
|
1170
1170
|
return /* @__PURE__ */ t(ne, { children: /* @__PURE__ */ t(R, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(Z, { children: [
|
|
1171
|
-
/* @__PURE__ */ t(
|
|
1171
|
+
/* @__PURE__ */ t(N, {
|
|
1172
1172
|
size: "small",
|
|
1173
1173
|
label: "Key",
|
|
1174
1174
|
value: n.key || "",
|
|
@@ -1178,7 +1178,7 @@ function it({ type: e = "properties", component: r, ...i }) {
|
|
|
1178
1178
|
});
|
|
1179
1179
|
}
|
|
1180
1180
|
}),
|
|
1181
|
-
/* @__PURE__ */ t(
|
|
1181
|
+
/* @__PURE__ */ t(N, {
|
|
1182
1182
|
size: "small",
|
|
1183
1183
|
label: l("label"),
|
|
1184
1184
|
value: (((w = (h = n.locales) == null ? void 0 : h[d]) == null ? void 0 : w.name) ?? ((m = (c = n.locales) == null ? void 0 : c[a]) == null ? void 0 : m.name)) || "",
|
|
@@ -1213,8 +1213,8 @@ function it({ type: e = "properties", component: r, ...i }) {
|
|
|
1213
1213
|
property: n,
|
|
1214
1214
|
size: "small",
|
|
1215
1215
|
fullWidth: !0,
|
|
1216
|
-
valueImmutable: se((W = (U = (T = (
|
|
1217
|
-
value: ((Y = (H = (_ = (re = v.renderer.properties) == null ? void 0 : re[n.id]) == null ? void 0 : _.locales) == null ? void 0 : H[d]) == null ? void 0 : Y.value) ?? ((je = (Oe = (L = (q = v.renderer.properties) == null ? void 0 : q[n.id]) == null ? void 0 : L.locales) == null ? void 0 : Oe[a]) == null ? void 0 : je.value) ?? ((ze = (Re = n.locales) == null ? void 0 : Re[d]) == null ? void 0 : ze.defaultValue) ?? ((
|
|
1216
|
+
valueImmutable: se((W = (U = (T = (V = v.renderer.properties) == null ? void 0 : V[n.id]) == null ? void 0 : T.locales) == null ? void 0 : U[d]) == null ? void 0 : W.value),
|
|
1217
|
+
value: ((Y = (H = (_ = (re = v.renderer.properties) == null ? void 0 : re[n.id]) == null ? void 0 : _.locales) == null ? void 0 : H[d]) == null ? void 0 : Y.value) ?? ((je = (Oe = (L = (q = v.renderer.properties) == null ? void 0 : q[n.id]) == null ? void 0 : L.locales) == null ? void 0 : Oe[a]) == null ? void 0 : je.value) ?? ((ze = (Re = n.locales) == null ? void 0 : Re[d]) == null ? void 0 : ze.defaultValue) ?? ((Ne = (Ve = n.locales) == null ? void 0 : Ve[a]) == null ? void 0 : Ne.defaultValue),
|
|
1218
1218
|
onChange: (F) => {
|
|
1219
1219
|
P.transact(() => {
|
|
1220
1220
|
var K, De, Ce, Ee, Ae;
|
|
@@ -1237,7 +1237,7 @@ const We = (e, r) => (i) => {
|
|
|
1237
1237
|
i.palette.secondary.main,
|
|
1238
1238
|
i.palette.success.main,
|
|
1239
1239
|
i.palette.warning.main
|
|
1240
|
-
], p = Math.min(l.length - 1, e),
|
|
1240
|
+
], p = Math.min(l.length - 1, e), b = l[p], a = pe(b, 0.5), g = pe(b, 1);
|
|
1241
1241
|
return {
|
|
1242
1242
|
// 保留原有的边框样式
|
|
1243
1243
|
borderColor: `${a} !important`,
|
|
@@ -1250,15 +1250,15 @@ const We = (e, r) => (i) => {
|
|
|
1250
1250
|
};
|
|
1251
1251
|
};
|
|
1252
1252
|
function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
1253
|
-
const { t: p, locale:
|
|
1253
|
+
const { t: p, locale: b } = D(), a = J(null), g = pr(a, e), P = C(() => {
|
|
1254
1254
|
if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
|
|
1255
1255
|
try {
|
|
1256
|
-
let
|
|
1256
|
+
let y = {};
|
|
1257
1257
|
A(Object.values(e.subProperties), "index").filter((o) => o.data.visible !== !1 && o.data.key).forEach(({ data: o }) => {
|
|
1258
1258
|
var n, d, h, w;
|
|
1259
1259
|
if (!o.key)
|
|
1260
1260
|
return;
|
|
1261
|
-
let s = ((d = (n = o.locales) == null ? void 0 : n[
|
|
1261
|
+
let s = ((d = (n = o.locales) == null ? void 0 : n[b]) == null ? void 0 : d.defaultValue) ?? ((w = (h = o.locales) == null ? void 0 : h[i]) == null ? void 0 : w.defaultValue);
|
|
1262
1262
|
if (o.type === "number")
|
|
1263
1263
|
s = Number(s);
|
|
1264
1264
|
else if (o.type === "boolean")
|
|
@@ -1269,22 +1269,22 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1269
1269
|
} catch (c) {
|
|
1270
1270
|
console.error("Error parsing nested value", s, c), s = {};
|
|
1271
1271
|
}
|
|
1272
|
-
|
|
1273
|
-
}), e.type === "array" && !Array.isArray(
|
|
1274
|
-
const x = ve(
|
|
1272
|
+
y[o.key] = s;
|
|
1273
|
+
}), e.type === "array" && !Array.isArray(y) && (y = Pe(y) ? [] : [y]);
|
|
1274
|
+
const x = ve(y, e.type);
|
|
1275
1275
|
r == null || r(x);
|
|
1276
|
-
} catch (
|
|
1277
|
-
console.error("Error converting structure to text:",
|
|
1276
|
+
} catch (y) {
|
|
1277
|
+
console.error("Error converting structure to text:", y);
|
|
1278
1278
|
}
|
|
1279
|
-
}, [e,
|
|
1279
|
+
}, [e, b, i, r]);
|
|
1280
1280
|
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(R, { direction: "column", gap: 1.5, sx: { width: "100%" }, ref: a, children: [
|
|
1281
1281
|
/* @__PURE__ */ t(vt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(B, { variant: "caption", color: "text.secondary", children: p("maker.properties.subProperties") }) }),
|
|
1282
1282
|
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ t(tt, {
|
|
1283
1283
|
component: R,
|
|
1284
1284
|
gap: 2,
|
|
1285
1285
|
list: e.subProperties,
|
|
1286
|
-
renderItem: (
|
|
1287
|
-
const o =
|
|
1286
|
+
renderItem: (y, v, x) => {
|
|
1287
|
+
const o = y.visible !== !1;
|
|
1288
1288
|
return /* @__PURE__ */ t(ee, {
|
|
1289
1289
|
elevation: 0,
|
|
1290
1290
|
className: "property-container",
|
|
@@ -1295,13 +1295,13 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1295
1295
|
"&": We(g)
|
|
1296
1296
|
},
|
|
1297
1297
|
children: /* @__PURE__ */ t(R, { gap: 2, children: /* @__PURE__ */ t(rt, {
|
|
1298
|
-
data:
|
|
1298
|
+
data: y,
|
|
1299
1299
|
params: x,
|
|
1300
1300
|
visible: o,
|
|
1301
1301
|
config: {
|
|
1302
1302
|
properties: e.subProperties
|
|
1303
1303
|
},
|
|
1304
|
-
currentLocale:
|
|
1304
|
+
currentLocale: b,
|
|
1305
1305
|
defaultLocale: i,
|
|
1306
1306
|
allComponents: l,
|
|
1307
1307
|
onUpdateConfig: (s) => {
|
|
@@ -1318,7 +1318,7 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
1320
|
}) })
|
|
1321
|
-
},
|
|
1321
|
+
}, y.id);
|
|
1322
1322
|
}
|
|
1323
1323
|
}) : /* @__PURE__ */ t(de, { style: { fontSize: 12, height: 100 }, children: p("maker.properties.noSubProperties") }),
|
|
1324
1324
|
/* @__PURE__ */ t(E, {
|
|
@@ -1329,15 +1329,15 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1329
1329
|
startIcon: /* @__PURE__ */ t(Ge, {}),
|
|
1330
1330
|
onClick: () => {
|
|
1331
1331
|
try {
|
|
1332
|
-
const
|
|
1333
|
-
index: Object.values(
|
|
1332
|
+
const y = e.subProperties || {}, v = Ke(), o = {
|
|
1333
|
+
index: Object.values(y).length,
|
|
1334
1334
|
data: {
|
|
1335
1335
|
id: v,
|
|
1336
1336
|
key: "",
|
|
1337
1337
|
type: "string",
|
|
1338
1338
|
visible: !0,
|
|
1339
1339
|
locales: {
|
|
1340
|
-
[
|
|
1340
|
+
[b]: {
|
|
1341
1341
|
name: "",
|
|
1342
1342
|
defaultValue: ""
|
|
1343
1343
|
}
|
|
@@ -1348,13 +1348,13 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1348
1348
|
}, s = {
|
|
1349
1349
|
...e,
|
|
1350
1350
|
subProperties: {
|
|
1351
|
-
...
|
|
1351
|
+
...y,
|
|
1352
1352
|
[v]: o
|
|
1353
1353
|
}
|
|
1354
1354
|
};
|
|
1355
1355
|
r == null || r(s, { forceUpdateProperty: !0 }), P();
|
|
1356
|
-
} catch (
|
|
1357
|
-
console.error("Error adding property:",
|
|
1356
|
+
} catch (y) {
|
|
1357
|
+
console.error("Error adding property:", y);
|
|
1358
1358
|
}
|
|
1359
1359
|
},
|
|
1360
1360
|
sx: {
|
|
@@ -1366,17 +1366,17 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1366
1366
|
})
|
|
1367
1367
|
] });
|
|
1368
1368
|
}
|
|
1369
|
-
function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p, defaultLocale:
|
|
1369
|
+
function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p, defaultLocale: b, allComponents: a, ...g }) {
|
|
1370
1370
|
var s, n, d, h, w;
|
|
1371
|
-
const { locale: P } = D(),
|
|
1371
|
+
const { locale: P } = D(), y = St(), v = J(null), x = () => {
|
|
1372
1372
|
var m;
|
|
1373
|
-
const c = (m =
|
|
1373
|
+
const c = (m = y == null ? void 0 : y.current) == null ? void 0 : m.getUploader();
|
|
1374
1374
|
c == null || c.open(), v.current && c.onceUploadSuccess(({ response: u }) => {
|
|
1375
1375
|
var I, f;
|
|
1376
1376
|
let k = ((I = u == null ? void 0 : u.data) == null ? void 0 : I.filename) || "";
|
|
1377
1377
|
k && (k = `mediakit://${k}`, i && !i.includes("mediakit://") && (k += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (f = v.current) == null || f.call(v, k);
|
|
1378
1378
|
});
|
|
1379
|
-
}, o = g.label ?? (((n = (s = r.locales) == null ? void 0 : s[P]) == null ? void 0 : n.name) || ((h = (d = r.locales) == null ? void 0 : d[
|
|
1379
|
+
}, o = g.label ?? (((n = (s = r.locales) == null ? void 0 : s[P]) == null ? void 0 : n.name) || ((h = (d = r.locales) == null ? void 0 : d[b]) == null ? void 0 : h.name) || r.key || r.id);
|
|
1380
1380
|
if (r.type === "number")
|
|
1381
1381
|
return /* @__PURE__ */ t(yr, {
|
|
1382
1382
|
...g,
|
|
@@ -1387,7 +1387,7 @@ function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p
|
|
|
1387
1387
|
}
|
|
1388
1388
|
});
|
|
1389
1389
|
if (r.type === "decimal")
|
|
1390
|
-
return /* @__PURE__ */ t(
|
|
1390
|
+
return /* @__PURE__ */ t(N, {
|
|
1391
1391
|
...g,
|
|
1392
1392
|
label: o,
|
|
1393
1393
|
type: "text",
|
|
@@ -1427,7 +1427,7 @@ function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p
|
|
|
1427
1427
|
},
|
|
1428
1428
|
property: r,
|
|
1429
1429
|
component: e,
|
|
1430
|
-
defaultLocale:
|
|
1430
|
+
defaultLocale: b,
|
|
1431
1431
|
allComponents: a,
|
|
1432
1432
|
PropertyValueField: $,
|
|
1433
1433
|
onUpload: (c) => {
|
|
@@ -1443,9 +1443,9 @@ function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p
|
|
|
1443
1443
|
dev: {
|
|
1444
1444
|
mode: "draft",
|
|
1445
1445
|
components: a,
|
|
1446
|
-
defaultLocale:
|
|
1446
|
+
defaultLocale: b
|
|
1447
1447
|
}
|
|
1448
|
-
}) }) : /* @__PURE__ */ t(
|
|
1448
|
+
}) }) : /* @__PURE__ */ t(N, { ...g, label: o, disabled: !0, placeholder: "Click right button select a component" });
|
|
1449
1449
|
}
|
|
1450
1450
|
if (r.type === "component")
|
|
1451
1451
|
return /* @__PURE__ */ O(R, { width: "100%", direction: "column", gap: 1, children: [
|
|
@@ -1461,7 +1461,7 @@ function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p
|
|
|
1461
1461
|
value: i,
|
|
1462
1462
|
valueImmutable: p,
|
|
1463
1463
|
onChange: l,
|
|
1464
|
-
defaultLocale:
|
|
1464
|
+
defaultLocale: b,
|
|
1465
1465
|
allComponents: a
|
|
1466
1466
|
})
|
|
1467
1467
|
] });
|
|
@@ -1469,7 +1469,7 @@ function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p
|
|
|
1469
1469
|
let c = r.type === "string" ? r.multiline : void 0;
|
|
1470
1470
|
r.type === "multiline" && (c = !0);
|
|
1471
1471
|
const m = r.type === "url" ? i == null ? void 0 : i.url : i;
|
|
1472
|
-
return /* @__PURE__ */ t(
|
|
1472
|
+
return /* @__PURE__ */ t(N, {
|
|
1473
1473
|
...g,
|
|
1474
1474
|
label: o,
|
|
1475
1475
|
value: typeof m == "string" ? m : "",
|
|
@@ -1484,12 +1484,12 @@ function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p
|
|
|
1484
1484
|
endAdornment: /* @__PURE__ */ O(we, { position: "end", children: [
|
|
1485
1485
|
/* @__PURE__ */ t(Ye, {
|
|
1486
1486
|
onChange: async ({ response: u }) => {
|
|
1487
|
-
var S, z,
|
|
1487
|
+
var S, z, V;
|
|
1488
1488
|
const k = ((S = u == null ? void 0 : u.data) == null ? void 0 : S.url) || ((z = u == null ? void 0 : u.data) == null ? void 0 : z.fileUrl);
|
|
1489
1489
|
let I;
|
|
1490
1490
|
k && (I = await It(k).catch(() => Ot(k)).catch(() => {
|
|
1491
1491
|
}));
|
|
1492
|
-
let f = ((
|
|
1492
|
+
let f = ((V = u == null ? void 0 : u.data) == null ? void 0 : V.filename) || "";
|
|
1493
1493
|
f && (f = `mediakit://${f}`), l == null || l({
|
|
1494
1494
|
url: k,
|
|
1495
1495
|
mediaKitUrl: f,
|
|
@@ -1518,14 +1518,14 @@ function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p
|
|
|
1518
1518
|
},
|
|
1519
1519
|
size: "small",
|
|
1520
1520
|
fullWidth: !0,
|
|
1521
|
-
defaultLocale:
|
|
1521
|
+
defaultLocale: b,
|
|
1522
1522
|
allComponents: a
|
|
1523
|
-
}, k.id) : null) }, m) : /* @__PURE__ */ t(
|
|
1523
|
+
}, k.id) : null) }, m) : /* @__PURE__ */ t(N, { size: g.size, fullWidth: !0, value: c, onChange: (k) => u(k.target.value) })
|
|
1524
1524
|
}) : (console.error("Unsupported property type", r.type), null);
|
|
1525
1525
|
}
|
|
1526
1526
|
function yr({ NumberProps: e, ...r }) {
|
|
1527
|
-
const { getInputProps: i } =
|
|
1528
|
-
return /* @__PURE__ */ t(
|
|
1527
|
+
const { getInputProps: i } = Nt(e), l = i();
|
|
1528
|
+
return /* @__PURE__ */ t(N, { ...r, inputProps: l });
|
|
1529
1529
|
}
|
|
1530
1530
|
const vr = `import React from '@blocklet/pages-kit/builtin/react'
|
|
1531
1531
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
@@ -1559,7 +1559,7 @@ function gr({ value: e }) {
|
|
|
1559
1559
|
}
|
|
1560
1560
|
function wr({ value: e }) {
|
|
1561
1561
|
var v, x, o;
|
|
1562
|
-
const { t: r } = D(), i = te(e).doc, { state: { components: l, config: { defaultLocale: p }, resources:
|
|
1562
|
+
const { t: r } = D(), i = te(e).doc, { state: { components: l, config: { defaultLocale: p }, resources: b }, localState: { currentLocale: a } } = ce(), g = xe(), P = ((v = l[e.renderer.componentId]) == null ? void 0 : v.data) ?? ((o = (x = b.components) == null ? void 0 : x[e.renderer.componentId]) == null ? void 0 : o.component), y = ke({ variant: "dialog" });
|
|
1563
1563
|
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 1, children: [
|
|
1564
1564
|
/* @__PURE__ */ t(Ie, {
|
|
1565
1565
|
allComponents: g,
|
|
@@ -1570,10 +1570,10 @@ function wr({ value: e }) {
|
|
|
1570
1570
|
P && /* @__PURE__ */ O(Z, { children: [
|
|
1571
1571
|
/* @__PURE__ */ O(R, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
1572
1572
|
/* @__PURE__ */ t(B, { variant: "subtitle2", children: r("parameters") }),
|
|
1573
|
-
/* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Se(
|
|
1573
|
+
/* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Se(y), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
|
|
1574
1574
|
] }),
|
|
1575
1575
|
P.properties && A(Object.values(P.properties), "index").map(({ data: s }) => {
|
|
1576
|
-
var n, d, h, w, c, m, u, k, I, f, S, z,
|
|
1576
|
+
var n, d, h, w, c, m, u, k, I, f, S, z, V, T, U, W;
|
|
1577
1577
|
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t($, {
|
|
1578
1578
|
allComponents: g,
|
|
1579
1579
|
defaultLocale: p,
|
|
@@ -1582,7 +1582,7 @@ function wr({ value: e }) {
|
|
|
1582
1582
|
fullWidth: !0,
|
|
1583
1583
|
size: "small",
|
|
1584
1584
|
valueImmutable: se((w = (h = (d = (n = e.renderer.properties) == null ? void 0 : n[s.id]) == null ? void 0 : d.locales) == null ? void 0 : h[a]) == null ? void 0 : w.value),
|
|
1585
|
-
value: ((k = (u = (m = (c = e.renderer.properties) == null ? void 0 : c[s.id]) == null ? void 0 : m.locales) == null ? void 0 : u[a]) == null ? void 0 : k.value) ?? ((z = (S = (f = (I = e.renderer.properties) == null ? void 0 : I[s.id]) == null ? void 0 : f.locales) == null ? void 0 : S[p]) == null ? void 0 : z.value) ?? ((T = (
|
|
1585
|
+
value: ((k = (u = (m = (c = e.renderer.properties) == null ? void 0 : c[s.id]) == null ? void 0 : m.locales) == null ? void 0 : u[a]) == null ? void 0 : k.value) ?? ((z = (S = (f = (I = e.renderer.properties) == null ? void 0 : I[s.id]) == null ? void 0 : f.locales) == null ? void 0 : S[p]) == null ? void 0 : z.value) ?? ((T = (V = s.locales) == null ? void 0 : V[a]) == null ? void 0 : T.defaultValue) ?? ((W = (U = s.locales) == null ? void 0 : U[p]) == null ? void 0 : W.defaultValue),
|
|
1586
1586
|
onChange: (re) => {
|
|
1587
1587
|
i.transact(() => {
|
|
1588
1588
|
var _, H, Y, q, L;
|
|
@@ -1591,13 +1591,13 @@ function wr({ value: e }) {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
}) }, s.id);
|
|
1593
1593
|
}),
|
|
1594
|
-
/* @__PURE__ */ t(it, { ...Ze(
|
|
1594
|
+
/* @__PURE__ */ t(it, { ...Ze(y), component: e, type: "parameters" })
|
|
1595
1595
|
] })
|
|
1596
1596
|
] }) });
|
|
1597
1597
|
}
|
|
1598
|
-
function Ie({ label: e, options: r, excludes: i, value: l, onChange: p, allComponents:
|
|
1598
|
+
function Ie({ label: e, options: r, excludes: i, value: l, onChange: p, allComponents: b, ...a }) {
|
|
1599
1599
|
var v;
|
|
1600
|
-
const { t: g } = D(), P = r ?? A(Object.values(Ht(
|
|
1600
|
+
const { t: g } = D(), P = r ?? A(Object.values(Ht(b, ...i ?? [])), "index").map((x) => x.data), y = (typeof l == "string" ? (v = b[l]) == null ? void 0 : v.data : void 0) ?? null;
|
|
1601
1601
|
return /* @__PURE__ */ t($e, {
|
|
1602
1602
|
...a,
|
|
1603
1603
|
size: "small",
|
|
@@ -1606,28 +1606,28 @@ function Ie({ label: e, options: r, excludes: i, value: l, onChange: p, allCompo
|
|
|
1606
1606
|
isOptionEqualToValue: (x, o) => x.id === o.id,
|
|
1607
1607
|
getOptionKey: (x) => x.id,
|
|
1608
1608
|
getOptionLabel: (x) => x.name || x.id,
|
|
1609
|
-
renderInput: (x) => /* @__PURE__ */ t(
|
|
1610
|
-
value:
|
|
1609
|
+
renderInput: (x) => /* @__PURE__ */ t(N, { label: e || g("component"), ...x }),
|
|
1610
|
+
value: y,
|
|
1611
1611
|
onChange: (x, o) => {
|
|
1612
1612
|
var n, d, h, w, c, m;
|
|
1613
1613
|
let s = {};
|
|
1614
1614
|
o && (s = {
|
|
1615
|
-
blockletId: (n =
|
|
1616
|
-
blockletTitle: (d =
|
|
1617
|
-
componentName: ((w = (h =
|
|
1615
|
+
blockletId: (n = b[o == null ? void 0 : o.id]) == null ? void 0 : n.blockletId,
|
|
1616
|
+
blockletTitle: (d = b[o == null ? void 0 : o.id]) == null ? void 0 : d.blockletTitle,
|
|
1617
|
+
componentName: ((w = (h = b[o == null ? void 0 : o.id]) == null ? void 0 : h.data) == null ? void 0 : w.name) || ((m = (c = b[o == null ? void 0 : o.id]) == null ? void 0 : c.data) == null ? void 0 : m.id)
|
|
1618
1618
|
}), p == null || p(x, o == null ? void 0 : o.id, s);
|
|
1619
1619
|
}
|
|
1620
1620
|
});
|
|
1621
1621
|
}
|
|
1622
|
-
function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l, currentLocale: p, onChange:
|
|
1623
|
-
const { t: g } = D(), [P,
|
|
1622
|
+
function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l, currentLocale: p, onChange: b, props: a }) {
|
|
1623
|
+
const { t: g } = D(), [P, y] = X(e == null ? void 0 : e.properties), [v, x] = X(null);
|
|
1624
1624
|
M(() => {
|
|
1625
1625
|
(() => {
|
|
1626
1626
|
var w, c;
|
|
1627
1627
|
((w = e == null ? void 0 : e.renderer) == null ? void 0 : w.type) === "react-component" && Pe(e == null ? void 0 : e.properties) ? Rt((c = e == null ? void 0 : e.renderer) == null ? void 0 : c.script).then((m) => {
|
|
1628
1628
|
const u = zt(m);
|
|
1629
|
-
|
|
1630
|
-
}) :
|
|
1629
|
+
y(u);
|
|
1630
|
+
}) : y(e == null ? void 0 : e.properties);
|
|
1631
1631
|
})();
|
|
1632
1632
|
}, [JSON.stringify(e)]);
|
|
1633
1633
|
const o = C(() => !e || !P ? {} : Object.values(P).reduce((h, { data: w }) => {
|
|
@@ -1668,7 +1668,7 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1668
1668
|
valueImmutable: se((w = l == null ? void 0 : l[h.id]) == null ? void 0 : w.value),
|
|
1669
1669
|
value: (a == null ? void 0 : a[h.key || h.id]) ?? ((c = n[h.id]) == null ? void 0 : c.value),
|
|
1670
1670
|
onChange: (m) => {
|
|
1671
|
-
|
|
1671
|
+
b({
|
|
1672
1672
|
path: ["properties", h.id],
|
|
1673
1673
|
id: h.id,
|
|
1674
1674
|
value: { value: m },
|
|
@@ -1698,7 +1698,7 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1698
1698
|
}).reduce((m, u) => m.then(() => {
|
|
1699
1699
|
const k = d[u], I = w.includes(u);
|
|
1700
1700
|
if (k != null && k.id && I)
|
|
1701
|
-
return
|
|
1701
|
+
return b({
|
|
1702
1702
|
path: ["properties", k.id],
|
|
1703
1703
|
id: k.id,
|
|
1704
1704
|
value: { value: h[u] },
|