@blocklet/pages-kit-inner-components 0.5.40 → 0.5.42
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-Cr5KF-hM.js → array-Cip5uTnI.js} +1 -1
- package/lib/cjs/chunks/{config-string-BYZ5HfyY.js → config-string-CEipCOnU.js} +1 -1
- package/lib/cjs/chunks/{draft-data-6zW9mu28.js → draft-data-F0V4PcIs.js} +1 -1
- package/lib/cjs/chunks/home-BCFoaIEZ.js +38 -0
- package/lib/cjs/chunks/{publish-button-B-H_3RtT.js → publish-button-Bbd4z1_d.js} +1 -1
- package/lib/cjs/chunks/site-state-CeQEnrvX.js +57 -0
- package/lib/cjs/chunks/state-UwRWAZRe.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +3 -3
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +2 -2
- package/lib/cjs/site-state.js +1 -1
- package/lib/cjs/theme.js +1 -1
- package/lib/es/add-component.js +3 -3
- package/lib/es/chunks/{array-D34Qpnhk.js → array-DM0x2Sjw.js} +1 -1
- package/lib/es/chunks/{config-string-DgK7ETCs.js → config-string-Dw6sJMn_.js} +1 -1
- package/lib/es/chunks/{draft-data-B5kzDvTI.js → draft-data-sTSk4UTm.js} +1 -1
- package/lib/es/chunks/home-ClxOpmCx.js +569 -0
- package/lib/es/chunks/{publish-button-CvQPEUZl.js → publish-button-CKXdANG9.js} +3 -3
- package/lib/es/chunks/{site-state-DI5PAxyt.js → site-state-BeEHvakk.js} +410 -399
- package/lib/es/chunks/{state-BzwEX9VC.js → state-COB6reM7.js} +98 -103
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +3 -3
- package/lib/es/project-html.js +70 -70
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +1152 -888
- package/lib/es/site-state.js +1 -1
- package/lib/es/theme.js +14 -11
- package/package.json +11 -11
- package/lib/cjs/chunks/home-DJPbdJux.js +0 -38
- package/lib/cjs/chunks/site-state-6tgRGL_9.js +0 -57
- package/lib/cjs/chunks/state-BWuBNdK8.js +0 -1
- package/lib/es/chunks/home-DpmpXDlo.js +0 -532
package/lib/es/setting.js
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
4
|
-
import { useLocaleContext as
|
|
5
|
-
import { CodeEditor as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { Typography as
|
|
11
|
-
import
|
|
12
|
-
import { useCallback as
|
|
13
|
-
import { useUpdate as
|
|
14
|
-
import { ColorItem as
|
|
15
|
-
import { C as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import * as
|
|
19
|
-
import { UploaderButton as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { CustomComponentRenderer as
|
|
23
|
-
import { parsePropertyValue as
|
|
24
|
-
import { unstable_useNumberInput as
|
|
25
|
-
import { VisibilityOffRounded as
|
|
26
|
-
import { getYjsValue as
|
|
27
|
-
import { useUpdate as
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import { usePopupState as
|
|
39
|
-
import { ErrorBoundary as
|
|
40
|
-
import { cx as
|
|
41
|
-
import { useDrop as
|
|
42
|
-
function
|
|
1
|
+
import { jsx as r, jsxs as O, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { t as ge, g as We, b as te, E as ur, n as Ke, h as Pe } from "./chunks/state-COB6reM7.js";
|
|
3
|
+
import ae from "@arcblock/ux/lib/Empty";
|
|
4
|
+
import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
+
import { CodeEditor as ke } from "@blocklet/code-editor";
|
|
6
|
+
import ar from "@mui/icons-material/AddRounded";
|
|
7
|
+
import pr from "@mui/icons-material/ArrowDownward";
|
|
8
|
+
import mr from "@mui/icons-material/ArrowUpward";
|
|
9
|
+
import fr from "@mui/icons-material/DeleteOutline";
|
|
10
|
+
import { Typography as W, TextField as R, Stack as j, FormLabel as se, Box as N, TableContainer as hr, Paper as ie, Table as Fe, TableHead as Me, TableRow as ce, TableCell as de, TableBody as Je, Button as A, IconButton as le, InputAdornment as pe, alpha as fe, Tooltip as Y, buttonClasses as br, Dialog as we, DialogTitle as _e, DialogContent as $e, DialogActions as He, FormControlLabel as Ge, Checkbox as yr, Autocomplete as Le, Switch as vr, MenuItem as he, Collapse as xr, Divider as gr, Popper as Pr } from "@mui/material";
|
|
11
|
+
import U from "lodash/sortBy";
|
|
12
|
+
import { useCallback as D, useMemo as re, useRef as H, useId as kr, useEffect as _, useState as G } from "react";
|
|
13
|
+
import { useUpdate as Ye } from "react-use";
|
|
14
|
+
import { ColorItem as wr, ConfigColorDialog as Sr } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
|
+
import { C as Ir } from "./chunks/config-string-Dw6sJMn_.js";
|
|
16
|
+
import J from "lodash/isEmpty";
|
|
17
|
+
import qe from "lodash/set";
|
|
18
|
+
import * as be from "yaml";
|
|
19
|
+
import { UploaderButton as Qe, UploaderProvider as me, useUploader as Or, getImageSize as Cr, getVideoSize as Nr } from "@blocklet/pages-kit/builtin/uploader";
|
|
20
|
+
import jr from "lodash/cloneDeep";
|
|
21
|
+
import ye from "@arcblock/ux/lib/Toast";
|
|
22
|
+
import { CustomComponentRenderer as Xe, transpileAndLoadScript as zr, getPropertiesFromCode as Rr } from "@blocklet/pages-kit/components";
|
|
23
|
+
import { parsePropertyValue as Vr } from "@blocklet/pages-kit/utils/property";
|
|
24
|
+
import { unstable_useNumberInput as Er, ClickAwayListener as Tr } from "@mui/base";
|
|
25
|
+
import { VisibilityOffRounded as Ar, VisibilityRounded as Dr, DeleteOutlineRounded as Wr, DragIndicatorRounded as Ur, TranslateRounded as Ze, AddRounded as er, InfoRounded as rr, PsychologyAlt as Br, StarRounded as Kr, SettingsRounded as tr } from "@mui/icons-material";
|
|
26
|
+
import { getYjsValue as ne } from "@syncedstore/core";
|
|
27
|
+
import { useUpdate as Fr, useReactive as Mr } from "ahooks";
|
|
28
|
+
import Jr from "lodash/assign";
|
|
29
|
+
import _r from "lodash/get";
|
|
30
|
+
import $r from "lodash/has";
|
|
31
|
+
import Hr from "lodash/isEqual";
|
|
32
|
+
import ue from "lodash/isNil";
|
|
33
|
+
import Gr from "lodash/isObject";
|
|
34
|
+
import Lr from "lodash/keyBy";
|
|
35
|
+
import Yr from "lodash/omit";
|
|
36
|
+
import qr from "lodash/pick";
|
|
37
|
+
import Qr from "lodash/reduce";
|
|
38
|
+
import { usePopupState as Se, bindTrigger as Ie, bindDialog as ir, bindPopper as Xr } from "material-ui-popup-state/hooks";
|
|
39
|
+
import { ErrorBoundary as Zr } from "react-error-boundary";
|
|
40
|
+
import { cx as et } from "@emotion/css";
|
|
41
|
+
import { useDrop as lr, useDrag as rt } from "react-dnd";
|
|
42
|
+
function tt({
|
|
43
43
|
onClick: e,
|
|
44
|
-
disabled:
|
|
44
|
+
disabled: t,
|
|
45
45
|
sx: i,
|
|
46
46
|
...l
|
|
47
47
|
}) {
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ r(le, { size: "small", color: "warning", variant: "outlined", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(fr, { fontSize: "small" }) });
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function it({
|
|
51
51
|
onClick: e,
|
|
52
|
-
disabled:
|
|
52
|
+
disabled: t,
|
|
53
53
|
sx: i,
|
|
54
54
|
...l
|
|
55
55
|
}) {
|
|
56
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ r(le, { size: "small", color: "primary", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(mr, { fontSize: "small" }) });
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function lt({
|
|
59
59
|
onClick: e,
|
|
60
|
-
disabled:
|
|
60
|
+
disabled: t,
|
|
61
61
|
sx: i,
|
|
62
62
|
...l
|
|
63
63
|
}) {
|
|
64
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ r(le, { size: "small", color: "primary", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(pr, { fontSize: "small" }) });
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function nt({
|
|
67
67
|
label: e,
|
|
68
|
-
value:
|
|
68
|
+
value: t,
|
|
69
69
|
onChange: i,
|
|
70
70
|
disabled: l = !1,
|
|
71
|
-
itemLabel:
|
|
72
|
-
emptyHeight:
|
|
73
|
-
property:
|
|
74
|
-
renderItem:
|
|
71
|
+
itemLabel: f = "",
|
|
72
|
+
emptyHeight: v = 40,
|
|
73
|
+
property: p,
|
|
74
|
+
renderItem: w,
|
|
75
75
|
...P
|
|
76
76
|
}) {
|
|
77
|
-
const { t:
|
|
78
|
-
(
|
|
79
|
-
i(
|
|
77
|
+
const { t: b, locale: g } = V(), x = Ye(), n = D(
|
|
78
|
+
(a) => {
|
|
79
|
+
i(ge(a, p.type));
|
|
80
80
|
},
|
|
81
|
-
[i,
|
|
82
|
-
),
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
}, [
|
|
86
|
-
if (!
|
|
87
|
-
return
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
if (!
|
|
92
|
-
const
|
|
93
|
-
|
|
81
|
+
[i, p.type]
|
|
82
|
+
), c = re(() => Array.isArray(t) ? t : [], [t]), s = D(() => {
|
|
83
|
+
const a = [...c, ""];
|
|
84
|
+
n(a), x();
|
|
85
|
+
}, [c, n, x]), u = D(() => {
|
|
86
|
+
if (!p || !p.subProperties)
|
|
87
|
+
return s();
|
|
88
|
+
const a = {};
|
|
89
|
+
U(Object.values(p.subProperties), "index").forEach(({ data: z }) => {
|
|
90
|
+
var T, B;
|
|
91
|
+
if (!z.key) return;
|
|
92
|
+
const E = ((B = (T = z.locales) == null ? void 0 : T[g]) == null ? void 0 : B.defaultValue) ?? "";
|
|
93
|
+
a[z.key] = E;
|
|
94
94
|
});
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
}, [
|
|
98
|
-
(
|
|
95
|
+
const C = [...c, a];
|
|
96
|
+
n(C), x();
|
|
97
|
+
}, [c, n, x, p, g, s]), d = D(
|
|
98
|
+
(a) => {
|
|
99
99
|
try {
|
|
100
|
-
const S = JSON.parse(
|
|
101
|
-
Array.isArray(S) ?
|
|
100
|
+
const S = JSON.parse(a);
|
|
101
|
+
Array.isArray(S) ? n(S) : console.error("JSON解析结果不是数组");
|
|
102
102
|
} catch (S) {
|
|
103
103
|
console.error("JSON解析错误:", S);
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
[
|
|
107
|
-
),
|
|
108
|
-
(
|
|
109
|
-
const S =
|
|
110
|
-
|
|
106
|
+
[n]
|
|
107
|
+
), k = D(
|
|
108
|
+
(a) => {
|
|
109
|
+
const S = c.filter((C, z) => z !== a);
|
|
110
|
+
n(S), x();
|
|
111
111
|
},
|
|
112
|
-
[
|
|
113
|
-
),
|
|
114
|
-
(
|
|
115
|
-
if (
|
|
116
|
-
const S = [...
|
|
117
|
-
S[
|
|
112
|
+
[c, n, x]
|
|
113
|
+
), o = D(
|
|
114
|
+
(a) => {
|
|
115
|
+
if (a <= 0) return;
|
|
116
|
+
const S = [...c], C = S[a];
|
|
117
|
+
S[a] = S[a - 1], S[a - 1] = C, n(S), x();
|
|
118
118
|
},
|
|
119
|
-
[
|
|
120
|
-
),
|
|
121
|
-
(
|
|
122
|
-
if (
|
|
123
|
-
const S = [...
|
|
124
|
-
S[
|
|
119
|
+
[c, n, x]
|
|
120
|
+
), h = D(
|
|
121
|
+
(a) => {
|
|
122
|
+
if (a >= c.length - 1) return;
|
|
123
|
+
const S = [...c], C = S[a];
|
|
124
|
+
S[a] = S[a + 1], S[a + 1] = C, n(S), x();
|
|
125
125
|
},
|
|
126
|
-
[
|
|
127
|
-
),
|
|
128
|
-
(
|
|
129
|
-
const
|
|
130
|
-
|
|
126
|
+
[c, n, x]
|
|
127
|
+
), m = D(
|
|
128
|
+
(a, S) => {
|
|
129
|
+
const C = [...c];
|
|
130
|
+
C[a] = S, n(C);
|
|
131
131
|
},
|
|
132
|
-
[
|
|
133
|
-
),
|
|
132
|
+
[c, n]
|
|
133
|
+
), y = p && p.subProperties && Object.keys(p.subProperties).length > 0, I = re(() => [
|
|
134
134
|
{
|
|
135
135
|
field: "index",
|
|
136
136
|
headerName: "#",
|
|
137
137
|
width: 40,
|
|
138
138
|
align: "center",
|
|
139
|
-
renderCell: ({ index:
|
|
140
|
-
|
|
139
|
+
renderCell: ({ index: a }) => /* @__PURE__ */ r(
|
|
140
|
+
W,
|
|
141
141
|
{
|
|
142
142
|
variant: "body1",
|
|
143
143
|
sx: {
|
|
@@ -150,27 +150,27 @@ function rr({
|
|
|
150
150
|
justifyContent: "center",
|
|
151
151
|
color: "text.secondary"
|
|
152
152
|
},
|
|
153
|
-
children:
|
|
153
|
+
children: a + 1
|
|
154
154
|
}
|
|
155
155
|
)
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
field: "content",
|
|
159
159
|
headerName: "",
|
|
160
|
-
renderCell: ({ row:
|
|
161
|
-
item:
|
|
160
|
+
renderCell: ({ row: a, index: S }) => w && y ? w({
|
|
161
|
+
item: a,
|
|
162
162
|
index: S,
|
|
163
|
-
property:
|
|
164
|
-
onChange: (
|
|
165
|
-
}) : /* @__PURE__ */
|
|
166
|
-
|
|
163
|
+
property: p,
|
|
164
|
+
onChange: (C) => m(S, C)
|
|
165
|
+
}) : /* @__PURE__ */ r(
|
|
166
|
+
R,
|
|
167
167
|
{
|
|
168
168
|
fullWidth: !0,
|
|
169
169
|
size: "small",
|
|
170
170
|
disabled: l,
|
|
171
|
-
value:
|
|
172
|
-
placeholder:
|
|
173
|
-
onChange: (
|
|
171
|
+
value: a,
|
|
172
|
+
placeholder: f || `${b("item")} ${S + 1}`,
|
|
173
|
+
onChange: (C) => m(S, C.target.value),
|
|
174
174
|
...P
|
|
175
175
|
}
|
|
176
176
|
)
|
|
@@ -181,36 +181,36 @@ function rr({
|
|
|
181
181
|
width: 30,
|
|
182
182
|
// 增加宽度以容纳更多按钮
|
|
183
183
|
align: "center",
|
|
184
|
-
renderCell: ({ index:
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
|
|
184
|
+
renderCell: ({ index: a }) => /* @__PURE__ */ O(j, { direction: "column", spacing: 0.25, children: [
|
|
185
|
+
/* @__PURE__ */ r(it, { disabled: l || a === 0, onClick: () => o(a) }),
|
|
186
|
+
/* @__PURE__ */ r(
|
|
187
|
+
lt,
|
|
188
188
|
{
|
|
189
|
-
disabled: l ||
|
|
190
|
-
onClick: () =>
|
|
189
|
+
disabled: l || a === c.length - 1,
|
|
190
|
+
onClick: () => h(a)
|
|
191
191
|
}
|
|
192
192
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ r(tt, { disabled: l, onClick: () => k(a) })
|
|
194
194
|
] })
|
|
195
195
|
}
|
|
196
196
|
], [
|
|
197
|
-
|
|
198
|
-
k,
|
|
199
|
-
a,
|
|
200
|
-
u,
|
|
201
|
-
p,
|
|
197
|
+
w,
|
|
202
198
|
y,
|
|
199
|
+
p,
|
|
200
|
+
m,
|
|
201
|
+
f,
|
|
202
|
+
b,
|
|
203
203
|
l,
|
|
204
204
|
P,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
k,
|
|
206
|
+
o,
|
|
207
|
+
h,
|
|
208
|
+
c.length
|
|
209
209
|
]);
|
|
210
|
-
return
|
|
211
|
-
e && /* @__PURE__ */
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
return y ? /* @__PURE__ */ O(j, { width: "100%", gap: 1, children: [
|
|
211
|
+
e && /* @__PURE__ */ r(se, { children: e }),
|
|
212
|
+
c.length > 0 ? /* @__PURE__ */ r(hr, { component: ie, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ O(
|
|
213
|
+
Fe,
|
|
214
214
|
{
|
|
215
215
|
size: "small",
|
|
216
216
|
sx: {
|
|
@@ -227,172 +227,172 @@ function rr({
|
|
|
227
227
|
borderCollapse: "collapse"
|
|
228
228
|
},
|
|
229
229
|
children: [
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
230
|
+
/* @__PURE__ */ r(Me, { sx: { display: "none" }, children: /* @__PURE__ */ r(ce, { children: I.map((a) => /* @__PURE__ */ r(
|
|
231
|
+
de,
|
|
232
232
|
{
|
|
233
|
-
width:
|
|
234
|
-
align:
|
|
233
|
+
width: a.width,
|
|
234
|
+
align: a.align || "left",
|
|
235
235
|
sx: { fontWeight: "bold" },
|
|
236
|
-
children:
|
|
236
|
+
children: a.renderHeader ? a.renderHeader() : a.headerName
|
|
237
237
|
},
|
|
238
|
-
|
|
238
|
+
a.field
|
|
239
239
|
)) }) }),
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
|
|
240
|
+
/* @__PURE__ */ r(Je, { children: c.map((a, S, C) => /* @__PURE__ */ r(
|
|
241
|
+
ce,
|
|
242
242
|
{
|
|
243
243
|
sx: {
|
|
244
|
-
borderBottom: S <
|
|
244
|
+
borderBottom: S < C.length - 1 ? "1px solid" : "none",
|
|
245
245
|
borderColor: "divider",
|
|
246
246
|
"&:hover": {
|
|
247
247
|
backgroundColor: "action.hover"
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
|
-
children: I.map((
|
|
251
|
-
|
|
250
|
+
children: I.map((z) => /* @__PURE__ */ r(
|
|
251
|
+
de,
|
|
252
252
|
{
|
|
253
|
-
width:
|
|
254
|
-
align:
|
|
253
|
+
width: z.width,
|
|
254
|
+
align: z.align || "left",
|
|
255
255
|
sx: {
|
|
256
256
|
borderBottom: "none"
|
|
257
257
|
},
|
|
258
|
-
children:
|
|
259
|
-
row:
|
|
258
|
+
children: z.renderCell({
|
|
259
|
+
row: a,
|
|
260
260
|
index: S,
|
|
261
|
-
onChange: (
|
|
261
|
+
onChange: (E) => m(S, E)
|
|
262
262
|
})
|
|
263
263
|
},
|
|
264
|
-
`${S}-${
|
|
264
|
+
`${S}-${z.field}`
|
|
265
265
|
))
|
|
266
266
|
},
|
|
267
267
|
S
|
|
268
268
|
)) })
|
|
269
269
|
]
|
|
270
270
|
}
|
|
271
|
-
) }) : /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
|
|
271
|
+
) }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height: v }, children: b("maker.properties.arrayEmpty") }),
|
|
272
|
+
/* @__PURE__ */ r(
|
|
273
|
+
A,
|
|
274
274
|
{
|
|
275
275
|
fullWidth: !0,
|
|
276
276
|
size: "small",
|
|
277
277
|
variant: "outlined",
|
|
278
278
|
disabled: l,
|
|
279
|
-
startIcon: /* @__PURE__ */
|
|
280
|
-
onClick:
|
|
281
|
-
children:
|
|
279
|
+
startIcon: /* @__PURE__ */ r(ar, {}),
|
|
280
|
+
onClick: u,
|
|
281
|
+
children: b("maker.properties.addArrayItem")
|
|
282
282
|
}
|
|
283
283
|
)
|
|
284
|
-
] }) : /* @__PURE__ */ O(
|
|
285
|
-
e && /* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
|
|
284
|
+
] }) : /* @__PURE__ */ O(j, { width: "100%", gap: 1, children: [
|
|
285
|
+
e && /* @__PURE__ */ r(se, { children: e }),
|
|
286
|
+
/* @__PURE__ */ r(N, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ r(
|
|
287
|
+
ke,
|
|
288
288
|
{
|
|
289
|
-
keyId:
|
|
290
|
-
locale:
|
|
289
|
+
keyId: p.id,
|
|
290
|
+
locale: g,
|
|
291
291
|
language: "json",
|
|
292
|
-
value: JSON.stringify(
|
|
293
|
-
onChange: (
|
|
292
|
+
value: JSON.stringify(c, null, 2),
|
|
293
|
+
onChange: (a) => d(a || ""),
|
|
294
294
|
fullScreenOptions: {
|
|
295
295
|
enableEscExit: !0,
|
|
296
296
|
targetContainer: () => document.getElementById("parameters-config-dialog") || null
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
|
-
|
|
299
|
+
p.id
|
|
300
300
|
) })
|
|
301
301
|
] });
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function ot({
|
|
304
304
|
value: e,
|
|
305
|
-
onChange:
|
|
305
|
+
onChange: t,
|
|
306
306
|
...i
|
|
307
307
|
}) {
|
|
308
|
-
const l =
|
|
309
|
-
return /* @__PURE__ */ O(
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
|
|
308
|
+
const l = H(null);
|
|
309
|
+
return /* @__PURE__ */ O(q, { children: [
|
|
310
|
+
/* @__PURE__ */ r(
|
|
311
|
+
Ir,
|
|
312
312
|
{
|
|
313
313
|
...i,
|
|
314
314
|
value: e,
|
|
315
|
-
onChange:
|
|
315
|
+
onChange: t,
|
|
316
316
|
InputProps: {
|
|
317
|
-
endAdornment: /* @__PURE__ */
|
|
318
|
-
|
|
317
|
+
endAdornment: /* @__PURE__ */ r(pe, { position: "end", children: /* @__PURE__ */ r(
|
|
318
|
+
wr,
|
|
319
319
|
{
|
|
320
320
|
color: e ?? "",
|
|
321
321
|
style: { width: "1.5rem", height: "1.5rem", padding: 0 },
|
|
322
322
|
onClick: () => {
|
|
323
|
-
var
|
|
324
|
-
(
|
|
323
|
+
var f;
|
|
324
|
+
(f = l.current) == null || f.open({ value: e ?? "" });
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
) })
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
|
|
331
|
+
/* @__PURE__ */ r(
|
|
332
|
+
Sr,
|
|
333
333
|
{
|
|
334
334
|
ref: l,
|
|
335
|
-
onSave: ({ value:
|
|
336
|
-
|
|
335
|
+
onSave: ({ value: f }, v) => {
|
|
336
|
+
t(f), v();
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
)
|
|
340
340
|
] });
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function st({
|
|
343
343
|
label: e,
|
|
344
|
-
value:
|
|
344
|
+
value: t,
|
|
345
345
|
onChange: i,
|
|
346
346
|
property: l,
|
|
347
|
-
component:
|
|
348
|
-
defaultLocale:
|
|
349
|
-
allComponents:
|
|
350
|
-
PropertyValueField:
|
|
347
|
+
component: f,
|
|
348
|
+
defaultLocale: v,
|
|
349
|
+
allComponents: p,
|
|
350
|
+
PropertyValueField: w,
|
|
351
351
|
onUpload: P
|
|
352
352
|
}) {
|
|
353
|
-
const { locale:
|
|
354
|
-
if (!
|
|
355
|
-
const
|
|
356
|
-
(
|
|
353
|
+
const { locale: b } = V(), g = H(null);
|
|
354
|
+
if (!J(l.subProperties)) {
|
|
355
|
+
const n = U(Object.values(l.subProperties || {}), "index").filter(
|
|
356
|
+
(c) => c.data.visible !== !1 && c.data.key
|
|
357
357
|
);
|
|
358
|
-
return /* @__PURE__ */ O(
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
const { data:
|
|
362
|
-
let
|
|
358
|
+
return /* @__PURE__ */ O(j, { width: "100%", children: [
|
|
359
|
+
/* @__PURE__ */ r(se, { sx: { px: 0.25, py: 0.5 }, children: e }),
|
|
360
|
+
/* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(N, { sx: { position: "relative" }, children: n.map((c, s) => {
|
|
361
|
+
const { data: u } = c, d = u.key ?? u.id, k = s === n.length - 1;
|
|
362
|
+
let o = null;
|
|
363
363
|
try {
|
|
364
|
-
|
|
364
|
+
t && typeof t == "object" ? o = t[d] : typeof t == "string" && (o = (l.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}"))[d]);
|
|
365
365
|
} catch {
|
|
366
366
|
}
|
|
367
|
-
|
|
368
|
-
const
|
|
367
|
+
o == null && (u.locales && b && u.locales[b] ? o = u.locales[b].defaultValue : u.locales && v && u.locales[v] && (o = u.locales[v].defaultValue));
|
|
368
|
+
const h = (y) => {
|
|
369
369
|
try {
|
|
370
370
|
let I = {};
|
|
371
|
-
if (typeof
|
|
371
|
+
if (typeof t == "string")
|
|
372
372
|
try {
|
|
373
|
-
I = l.type === "yaml" ?
|
|
373
|
+
I = l.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}");
|
|
374
374
|
} catch {
|
|
375
375
|
}
|
|
376
|
-
else typeof
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
i == null || i(
|
|
376
|
+
else typeof t == "object" && t !== null && (I = { ...t });
|
|
377
|
+
qe(I, d, y);
|
|
378
|
+
const a = ge(I, l.type);
|
|
379
|
+
i == null || i(a);
|
|
380
380
|
} catch (I) {
|
|
381
381
|
console.error("Error updating property:", I);
|
|
382
382
|
}
|
|
383
|
-
},
|
|
383
|
+
}, m = 8;
|
|
384
384
|
return /* @__PURE__ */ O(
|
|
385
|
-
|
|
385
|
+
N,
|
|
386
386
|
{
|
|
387
387
|
sx: {
|
|
388
|
-
mb:
|
|
388
|
+
mb: k ? 0 : 1,
|
|
389
389
|
// 底部边距,最后一项不需要
|
|
390
390
|
display: "flex",
|
|
391
391
|
flexDirection: "row"
|
|
392
392
|
},
|
|
393
393
|
children: [
|
|
394
394
|
/* @__PURE__ */ O(
|
|
395
|
-
|
|
395
|
+
N,
|
|
396
396
|
{
|
|
397
397
|
sx: {
|
|
398
398
|
position: "relative",
|
|
@@ -400,12 +400,12 @@ function lr({
|
|
|
400
400
|
flexShrink: 0
|
|
401
401
|
},
|
|
402
402
|
children: [
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
|
|
403
|
+
/* @__PURE__ */ r(
|
|
404
|
+
N,
|
|
405
405
|
{
|
|
406
406
|
sx: {
|
|
407
407
|
position: "absolute",
|
|
408
|
-
left:
|
|
408
|
+
left: m,
|
|
409
409
|
top: 0,
|
|
410
410
|
height: 16,
|
|
411
411
|
// 连接到字段中点的高度
|
|
@@ -415,12 +415,12 @@ function lr({
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
),
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
|
|
418
|
+
/* @__PURE__ */ r(
|
|
419
|
+
N,
|
|
420
420
|
{
|
|
421
421
|
sx: {
|
|
422
422
|
position: "absolute",
|
|
423
|
-
left:
|
|
423
|
+
left: m,
|
|
424
424
|
top: 16,
|
|
425
425
|
// 连接到字段中点
|
|
426
426
|
width: 12,
|
|
@@ -430,12 +430,12 @@ function lr({
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
),
|
|
433
|
-
!
|
|
434
|
-
|
|
433
|
+
!k && /* @__PURE__ */ r(
|
|
434
|
+
N,
|
|
435
435
|
{
|
|
436
436
|
sx: {
|
|
437
437
|
position: "absolute",
|
|
438
|
-
left:
|
|
438
|
+
left: m,
|
|
439
439
|
top: 16,
|
|
440
440
|
// 从当前项中点
|
|
441
441
|
bottom: -8,
|
|
@@ -449,28 +449,28 @@ function lr({
|
|
|
449
449
|
]
|
|
450
450
|
}
|
|
451
451
|
),
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
|
|
452
|
+
/* @__PURE__ */ r(N, { sx: { flexGrow: 1 }, children: /* @__PURE__ */ r(
|
|
453
|
+
w,
|
|
454
454
|
{
|
|
455
|
-
component:
|
|
456
|
-
property:
|
|
457
|
-
value:
|
|
458
|
-
onChange:
|
|
455
|
+
component: f,
|
|
456
|
+
property: u,
|
|
457
|
+
value: o,
|
|
458
|
+
onChange: h,
|
|
459
459
|
size: "small",
|
|
460
460
|
fullWidth: !0,
|
|
461
|
-
defaultLocale:
|
|
462
|
-
allComponents:
|
|
461
|
+
defaultLocale: v,
|
|
462
|
+
allComponents: p
|
|
463
463
|
}
|
|
464
464
|
) })
|
|
465
465
|
]
|
|
466
466
|
},
|
|
467
|
-
|
|
467
|
+
u.id
|
|
468
468
|
);
|
|
469
469
|
}) }) })
|
|
470
470
|
] });
|
|
471
471
|
}
|
|
472
|
-
return /* @__PURE__ */
|
|
473
|
-
|
|
472
|
+
return /* @__PURE__ */ r(j, { width: "100%", gap: 2, children: /* @__PURE__ */ O(
|
|
473
|
+
j,
|
|
474
474
|
{
|
|
475
475
|
sx: {
|
|
476
476
|
width: "100%",
|
|
@@ -482,8 +482,8 @@ function lr({
|
|
|
482
482
|
".monaco-editor,.overflow-guard": { borderRadius: 1 }
|
|
483
483
|
},
|
|
484
484
|
children: [
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
|
|
485
|
+
/* @__PURE__ */ r(
|
|
486
|
+
se,
|
|
487
487
|
{
|
|
488
488
|
sx: {
|
|
489
489
|
position: "absolute",
|
|
@@ -494,18 +494,18 @@ function lr({
|
|
|
494
494
|
children: e
|
|
495
495
|
}
|
|
496
496
|
),
|
|
497
|
-
/* @__PURE__ */
|
|
498
|
-
|
|
497
|
+
/* @__PURE__ */ r(
|
|
498
|
+
ke,
|
|
499
499
|
{
|
|
500
500
|
keyId: l.id,
|
|
501
|
-
locale:
|
|
501
|
+
locale: b,
|
|
502
502
|
language: l.type === "yaml" ? "yaml" : "json",
|
|
503
|
-
value: typeof
|
|
504
|
-
onChange: (
|
|
505
|
-
i == null || i(
|
|
503
|
+
value: typeof t == "string" ? t : "",
|
|
504
|
+
onChange: (n) => {
|
|
505
|
+
i == null || i(n);
|
|
506
506
|
},
|
|
507
|
-
onUpload: (
|
|
508
|
-
|
|
507
|
+
onUpload: (n) => {
|
|
508
|
+
g.current = n, P && P(n);
|
|
509
509
|
},
|
|
510
510
|
fullScreenOptions: {
|
|
511
511
|
enableEscExit: !0,
|
|
@@ -514,8 +514,8 @@ function lr({
|
|
|
514
514
|
},
|
|
515
515
|
l.id
|
|
516
516
|
),
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
|
|
517
|
+
/* @__PURE__ */ r(
|
|
518
|
+
N,
|
|
519
519
|
{
|
|
520
520
|
component: "fieldset",
|
|
521
521
|
sx: {
|
|
@@ -531,154 +531,154 @@ function lr({
|
|
|
531
531
|
px: 1,
|
|
532
532
|
py: 0
|
|
533
533
|
},
|
|
534
|
-
children: /* @__PURE__ */
|
|
534
|
+
children: /* @__PURE__ */ r(N, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ r(N, { component: "span", sx: { opacity: 0 }, children: e }) })
|
|
535
535
|
}
|
|
536
536
|
)
|
|
537
537
|
]
|
|
538
538
|
}
|
|
539
539
|
) });
|
|
540
540
|
}
|
|
541
|
-
const
|
|
541
|
+
const ct = ["string", "multiline", "json", "yaml", "url", "component", "custom", "array"];
|
|
542
542
|
function Ue(e) {
|
|
543
|
-
return e.type ? !
|
|
543
|
+
return e.type ? !ct.includes(e.type) : !1;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function nr({
|
|
546
546
|
disabled: e,
|
|
547
|
-
list:
|
|
547
|
+
list: t,
|
|
548
548
|
renderItem: i,
|
|
549
549
|
...l
|
|
550
550
|
}) {
|
|
551
|
-
const
|
|
552
|
-
(
|
|
553
|
-
P.current =
|
|
551
|
+
const f = H(null), v = kr(), p = Fr(), w = U(Object.entries(t), (c) => c[1].index).map((c) => c[0]), P = H(w), b = D(
|
|
552
|
+
(c) => {
|
|
553
|
+
P.current = c, p();
|
|
554
554
|
},
|
|
555
|
-
[
|
|
556
|
-
),
|
|
557
|
-
({ index:
|
|
558
|
-
const
|
|
559
|
-
|
|
555
|
+
[p]
|
|
556
|
+
), g = D(
|
|
557
|
+
({ index: c }, { index: s }) => {
|
|
558
|
+
const u = [...P.current];
|
|
559
|
+
u.splice(s, 0, ...u.splice(c, 1)), b(u);
|
|
560
560
|
},
|
|
561
|
-
[
|
|
561
|
+
[b]
|
|
562
562
|
);
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
}, [
|
|
566
|
-
const [{ isOver: x },
|
|
567
|
-
accept:
|
|
568
|
-
collect: (
|
|
569
|
-
isOver:
|
|
563
|
+
_(() => {
|
|
564
|
+
b(w);
|
|
565
|
+
}, [w.join("-")]);
|
|
566
|
+
const [{ isOver: x }, n] = lr({
|
|
567
|
+
accept: v,
|
|
568
|
+
collect: (c) => ({
|
|
569
|
+
isOver: c.isOver()
|
|
570
570
|
}),
|
|
571
571
|
canDrop: () => !e,
|
|
572
572
|
drop: () => {
|
|
573
|
-
var
|
|
574
|
-
const
|
|
575
|
-
P.current.forEach((
|
|
576
|
-
const
|
|
577
|
-
|
|
573
|
+
var u;
|
|
574
|
+
const c = () => {
|
|
575
|
+
P.current.forEach((d, k) => {
|
|
576
|
+
const o = t[d];
|
|
577
|
+
o && (o.index = k);
|
|
578
578
|
});
|
|
579
|
-
},
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}) :
|
|
579
|
+
}, s = (u = ne(t)) == null ? void 0 : u.doc;
|
|
580
|
+
s ? s.transact(() => {
|
|
581
|
+
c();
|
|
582
|
+
}) : c();
|
|
583
583
|
}
|
|
584
584
|
});
|
|
585
|
-
return
|
|
586
|
-
x ||
|
|
587
|
-
}, [x]),
|
|
588
|
-
|
|
585
|
+
return _(() => {
|
|
586
|
+
x || b(w);
|
|
587
|
+
}, [x]), n(f), /* @__PURE__ */ r(N, { ...l, ref: f, className: et(x && "isDragging"), children: P.current.map((c, s) => /* @__PURE__ */ r(
|
|
588
|
+
dt,
|
|
589
589
|
{
|
|
590
|
-
type:
|
|
590
|
+
type: v,
|
|
591
591
|
disabled: e,
|
|
592
|
-
id:
|
|
593
|
-
index:
|
|
594
|
-
itemIndex: (
|
|
595
|
-
move:
|
|
596
|
-
children: (
|
|
597
|
-
const
|
|
598
|
-
return
|
|
592
|
+
id: c,
|
|
593
|
+
index: s,
|
|
594
|
+
itemIndex: (u) => P.current.indexOf(u),
|
|
595
|
+
move: g,
|
|
596
|
+
children: (u) => {
|
|
597
|
+
const d = t[c];
|
|
598
|
+
return d ? i(d.data, s, u) : null;
|
|
599
599
|
}
|
|
600
600
|
},
|
|
601
|
-
|
|
601
|
+
c
|
|
602
602
|
)) });
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function dt({
|
|
605
605
|
disabled: e,
|
|
606
|
-
id:
|
|
606
|
+
id: t,
|
|
607
607
|
index: i,
|
|
608
608
|
type: l,
|
|
609
|
-
children:
|
|
610
|
-
itemIndex:
|
|
611
|
-
move:
|
|
609
|
+
children: f,
|
|
610
|
+
itemIndex: v,
|
|
611
|
+
move: p
|
|
612
612
|
}) {
|
|
613
|
-
const
|
|
613
|
+
const w = H(), [{ isDragging: P }, b, g] = rt({
|
|
614
614
|
type: l,
|
|
615
|
-
item: () => ({ id:
|
|
615
|
+
item: () => ({ id: t }),
|
|
616
616
|
canDrag: () => !e,
|
|
617
|
-
collect: (
|
|
618
|
-
}), [, x] =
|
|
617
|
+
collect: (n) => ({ isDragging: n.isDragging() })
|
|
618
|
+
}), [, x] = lr({
|
|
619
619
|
accept: l,
|
|
620
620
|
canDrop: () => !e,
|
|
621
|
-
hover(
|
|
622
|
-
var
|
|
623
|
-
if (!
|
|
621
|
+
hover(n, c) {
|
|
622
|
+
var m;
|
|
623
|
+
if (!w.current)
|
|
624
624
|
return;
|
|
625
|
-
const
|
|
626
|
-
if (
|
|
625
|
+
const s = v(n.id), u = i;
|
|
626
|
+
if (s === u)
|
|
627
627
|
return;
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
const d = (m = w.current) == null ? void 0 : m.getBoundingClientRect(), k = (d.bottom - d.top) / 2, h = c.getClientOffset().y - d.top;
|
|
629
|
+
s < u && h < k || s > u && h > k || p({ id: n.id, index: s }, { id: t, index: i });
|
|
630
630
|
}
|
|
631
631
|
});
|
|
632
|
-
return typeof
|
|
632
|
+
return typeof f == "function" ? f({
|
|
633
633
|
isDragging: P,
|
|
634
|
-
drag:
|
|
635
|
-
drop: (
|
|
636
|
-
preview:
|
|
637
|
-
}) : (
|
|
634
|
+
drag: b,
|
|
635
|
+
drop: (n) => (w.current = n, x(n)),
|
|
636
|
+
preview: g
|
|
637
|
+
}) : (b(x(g(w))), /* @__PURE__ */ r(N, { ref: w, children: f }));
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function ut({
|
|
640
640
|
drop: e,
|
|
641
|
-
preview:
|
|
641
|
+
preview: t,
|
|
642
642
|
drag: i,
|
|
643
643
|
disabled: l,
|
|
644
|
-
isDragging:
|
|
645
|
-
children:
|
|
646
|
-
onDelete:
|
|
647
|
-
onVisibilityChange:
|
|
644
|
+
isDragging: f,
|
|
645
|
+
children: v,
|
|
646
|
+
onDelete: p,
|
|
647
|
+
onVisibilityChange: w,
|
|
648
648
|
visible: P = !0,
|
|
649
|
-
actions:
|
|
650
|
-
alwaysShowActions:
|
|
649
|
+
actions: b,
|
|
650
|
+
alwaysShowActions: g = !1
|
|
651
651
|
}) {
|
|
652
|
-
const { t: x } =
|
|
653
|
-
return /* @__PURE__ */
|
|
654
|
-
|
|
652
|
+
const { t: x } = V();
|
|
653
|
+
return /* @__PURE__ */ r(
|
|
654
|
+
N,
|
|
655
655
|
{
|
|
656
656
|
ref: e,
|
|
657
657
|
sx: {
|
|
658
658
|
":hover .hover-visible": { maxWidth: "100%" },
|
|
659
659
|
opacity: P ? 1 : 0.5
|
|
660
660
|
},
|
|
661
|
-
children: /* @__PURE__ */ O(
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
|
|
661
|
+
children: /* @__PURE__ */ O(N, { sx: { position: "relative" }, children: [
|
|
662
|
+
/* @__PURE__ */ r(
|
|
663
|
+
N,
|
|
664
664
|
{
|
|
665
|
-
ref:
|
|
665
|
+
ref: t,
|
|
666
666
|
sx: {
|
|
667
667
|
flex: 1,
|
|
668
668
|
borderRadius: 0.5,
|
|
669
|
-
bgcolor:
|
|
669
|
+
bgcolor: f ? "action.hover" : "background.paper",
|
|
670
670
|
opacity: 0.9999
|
|
671
671
|
// NOTE: make preview effective
|
|
672
672
|
},
|
|
673
|
-
children:
|
|
673
|
+
children: v
|
|
674
674
|
}
|
|
675
675
|
),
|
|
676
|
-
!l && /* @__PURE__ */
|
|
677
|
-
|
|
676
|
+
!l && /* @__PURE__ */ r(
|
|
677
|
+
N,
|
|
678
678
|
{
|
|
679
|
-
className:
|
|
679
|
+
className: g ? "" : "hover-visible",
|
|
680
680
|
sx: {
|
|
681
|
-
maxWidth:
|
|
681
|
+
maxWidth: g ? "100%" : 0,
|
|
682
682
|
overflow: "hidden",
|
|
683
683
|
position: "absolute",
|
|
684
684
|
right: 2,
|
|
@@ -686,14 +686,14 @@ function sr({
|
|
|
686
686
|
transition: "max-width 0.3s ease-in-out"
|
|
687
687
|
},
|
|
688
688
|
children: /* @__PURE__ */ O(
|
|
689
|
-
|
|
689
|
+
j,
|
|
690
690
|
{
|
|
691
691
|
direction: "row",
|
|
692
692
|
sx: {
|
|
693
|
-
bgcolor: (
|
|
693
|
+
bgcolor: (n) => fe(n.palette.grey[200], 0.9),
|
|
694
694
|
borderRadius: 1,
|
|
695
695
|
p: 0.5,
|
|
696
|
-
[`.${
|
|
696
|
+
[`.${br.root}`]: {
|
|
697
697
|
minWidth: 24,
|
|
698
698
|
width: 24,
|
|
699
699
|
height: 24,
|
|
@@ -701,10 +701,10 @@ function sr({
|
|
|
701
701
|
}
|
|
702
702
|
},
|
|
703
703
|
children: [
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
/* @__PURE__ */
|
|
704
|
+
b,
|
|
705
|
+
w && /* @__PURE__ */ r(Y, { title: x(P ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: () => w(!P), children: P ? /* @__PURE__ */ r(Ar, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ r(Dr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
706
|
+
p && /* @__PURE__ */ r(Y, { title: x("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: p, children: /* @__PURE__ */ r(Wr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
707
|
+
/* @__PURE__ */ r(Y, { title: x("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { ref: i, children: /* @__PURE__ */ r(Ur, { sx: { color: "grey.500" } }) }) })
|
|
708
708
|
]
|
|
709
709
|
}
|
|
710
710
|
)
|
|
@@ -714,57 +714,300 @@ function sr({
|
|
|
714
714
|
}
|
|
715
715
|
);
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function at(e) {
|
|
718
|
+
const t = ["string", "json", "array", "url", "multiline"], i = ["style", "fontSize", "color", "content", "type"];
|
|
719
|
+
return !!(t.includes(e.type || "") && !i.includes(e.key || ""));
|
|
720
|
+
}
|
|
721
|
+
function pt(e, t, i) {
|
|
722
|
+
return e.locales && e.locales[t] && e.locales[t].name ? e.locales[t].name : i && e.locales && e.locales[i] && e.locales[i].name ? e.locales[i].name : e.key ? e.key : e.id;
|
|
723
|
+
}
|
|
724
|
+
const or = (e, t, i, l) => {
|
|
725
|
+
const f = {};
|
|
726
|
+
return U(Object.entries(e), ([, p]) => p.index).forEach(([p, w]) => {
|
|
727
|
+
const P = w.data;
|
|
728
|
+
if (!P) return;
|
|
729
|
+
const b = P.key || P.id, g = i ? pt(P, i, l || "") : b, x = t == null ? void 0 : t[P.id], n = {
|
|
730
|
+
key: b,
|
|
731
|
+
isNeedGenerate: (x == null ? void 0 : x.isNeedGenerate) ?? at(P),
|
|
732
|
+
// 如果存在使用现有值,否则默认勾选
|
|
733
|
+
describe: (x == null ? void 0 : x.describe) ?? "",
|
|
734
|
+
displayName: g
|
|
735
|
+
};
|
|
736
|
+
P.subProperties && !J(P.subProperties) && (n.subProperties = or(
|
|
737
|
+
P.subProperties,
|
|
738
|
+
x == null ? void 0 : x.subProperties,
|
|
739
|
+
i,
|
|
740
|
+
l
|
|
741
|
+
)), f[P.id] = n;
|
|
742
|
+
}), f;
|
|
743
|
+
};
|
|
744
|
+
function mt({
|
|
745
|
+
open: e,
|
|
746
|
+
onClose: t,
|
|
747
|
+
onConfirm: i,
|
|
748
|
+
component: l,
|
|
749
|
+
initialConfig: f,
|
|
750
|
+
locale: v,
|
|
751
|
+
defaultLocale: p,
|
|
752
|
+
title: w,
|
|
753
|
+
loading: P = !1
|
|
754
|
+
}) {
|
|
755
|
+
const { t: b } = V(), [g, x] = G(null);
|
|
756
|
+
_(() => {
|
|
757
|
+
if (e && l) {
|
|
758
|
+
const d = { properties: {} };
|
|
759
|
+
if (l.properties) {
|
|
760
|
+
const k = f == null ? void 0 : f.properties;
|
|
761
|
+
d.properties = or(l.properties, k, v, p);
|
|
762
|
+
}
|
|
763
|
+
x(d);
|
|
764
|
+
}
|
|
765
|
+
}, [e, l, f, v, p]);
|
|
766
|
+
const n = () => {
|
|
767
|
+
t();
|
|
768
|
+
}, c = () => {
|
|
769
|
+
g && (i(g), t());
|
|
770
|
+
}, s = (d, k, o) => {
|
|
771
|
+
if (!g || !d.length) return;
|
|
772
|
+
const h = JSON.parse(JSON.stringify(g));
|
|
773
|
+
let m = h.properties, y = null;
|
|
774
|
+
for (let a = 0; a < d.length - 1; a++) {
|
|
775
|
+
const S = d[a];
|
|
776
|
+
if (!S || !m[S])
|
|
777
|
+
return;
|
|
778
|
+
y = m;
|
|
779
|
+
const C = m[S];
|
|
780
|
+
C.subProperties || (C.subProperties = {}), m = C.subProperties;
|
|
781
|
+
}
|
|
782
|
+
const I = d[d.length - 1];
|
|
783
|
+
if (I) {
|
|
784
|
+
if ("isNeedGenerate" in o) {
|
|
785
|
+
const a = o.isNeedGenerate, S = {
|
|
786
|
+
...k,
|
|
787
|
+
...o
|
|
788
|
+
};
|
|
789
|
+
if (k.subProperties && !J(k.subProperties)) {
|
|
790
|
+
const C = (z, E) => {
|
|
791
|
+
const T = {};
|
|
792
|
+
return Object.entries(z).forEach(([B, K]) => {
|
|
793
|
+
const F = { ...K };
|
|
794
|
+
E !== null && (F.isNeedGenerate = E), K.subProperties && !J(K.subProperties) && (F.subProperties = C(
|
|
795
|
+
K.subProperties,
|
|
796
|
+
E !== null ? E : null
|
|
797
|
+
)), T[B] = F;
|
|
798
|
+
}), T;
|
|
799
|
+
};
|
|
800
|
+
S.subProperties = C(
|
|
801
|
+
k.subProperties,
|
|
802
|
+
a === !1 ? !1 : null
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
if (d.length === 1)
|
|
806
|
+
h.properties[I] = S;
|
|
807
|
+
else if (y && d.length >= 2) {
|
|
808
|
+
const C = d[d.length - 2];
|
|
809
|
+
C && y[C] && (y[C].subProperties || (y[C].subProperties = {}), y[C].subProperties[I] = S);
|
|
810
|
+
}
|
|
811
|
+
} else if (d.length === 1)
|
|
812
|
+
h.properties[I] = {
|
|
813
|
+
...k,
|
|
814
|
+
...o
|
|
815
|
+
};
|
|
816
|
+
else if (y && d.length >= 2) {
|
|
817
|
+
const a = d[d.length - 2];
|
|
818
|
+
a && y[a] && y[a].subProperties && (y[a].subProperties[I] = {
|
|
819
|
+
...k,
|
|
820
|
+
...o
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
x(h);
|
|
824
|
+
}
|
|
825
|
+
}, u = (d, k = [], o = !0) => {
|
|
826
|
+
if (!d || J(d))
|
|
827
|
+
return null;
|
|
828
|
+
const h = U(Object.entries(d), ([, m]) => m.displayName);
|
|
829
|
+
return /* @__PURE__ */ r(j, { spacing: 1.5, children: h.map(([m, y], I) => {
|
|
830
|
+
const a = [...k, m], S = I === h.length - 1, C = y.subProperties && !J(y.subProperties), z = y.displayName || m, E = !o;
|
|
831
|
+
return /* @__PURE__ */ r(N, { sx: { position: "relative" }, children: /* @__PURE__ */ O(j, { direction: "row", children: [
|
|
832
|
+
k.length > 0 && /* @__PURE__ */ O(
|
|
833
|
+
N,
|
|
834
|
+
{
|
|
835
|
+
sx: {
|
|
836
|
+
position: "relative",
|
|
837
|
+
width: 24,
|
|
838
|
+
flexShrink: 0
|
|
839
|
+
},
|
|
840
|
+
children: [
|
|
841
|
+
/* @__PURE__ */ r(
|
|
842
|
+
N,
|
|
843
|
+
{
|
|
844
|
+
sx: {
|
|
845
|
+
position: "absolute",
|
|
846
|
+
left: 8,
|
|
847
|
+
top: 0,
|
|
848
|
+
height: 16,
|
|
849
|
+
width: 0,
|
|
850
|
+
borderLeft: "1px dashed",
|
|
851
|
+
borderColor: "divider"
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
),
|
|
855
|
+
/* @__PURE__ */ r(
|
|
856
|
+
N,
|
|
857
|
+
{
|
|
858
|
+
sx: {
|
|
859
|
+
position: "absolute",
|
|
860
|
+
left: 8,
|
|
861
|
+
top: 16,
|
|
862
|
+
width: 12,
|
|
863
|
+
height: 0,
|
|
864
|
+
borderTop: "1px dashed",
|
|
865
|
+
borderColor: "divider"
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
),
|
|
869
|
+
!S && /* @__PURE__ */ r(
|
|
870
|
+
N,
|
|
871
|
+
{
|
|
872
|
+
sx: {
|
|
873
|
+
position: "absolute",
|
|
874
|
+
left: 8,
|
|
875
|
+
top: 16,
|
|
876
|
+
bottom: -12,
|
|
877
|
+
width: 0,
|
|
878
|
+
borderLeft: "1px dashed",
|
|
879
|
+
borderColor: "divider"
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ O(j, { spacing: 1.5, sx: { flexGrow: 1 }, children: [
|
|
887
|
+
/* @__PURE__ */ O(
|
|
888
|
+
j,
|
|
889
|
+
{
|
|
890
|
+
direction: { xs: "column", md: "row" },
|
|
891
|
+
alignItems: { xs: "flex-start", md: "center" },
|
|
892
|
+
spacing: 1.5,
|
|
893
|
+
width: "100%",
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ r(
|
|
896
|
+
Ge,
|
|
897
|
+
{
|
|
898
|
+
control: /* @__PURE__ */ r(
|
|
899
|
+
yr,
|
|
900
|
+
{
|
|
901
|
+
checked: y.isNeedGenerate,
|
|
902
|
+
disabled: E,
|
|
903
|
+
onChange: (T) => {
|
|
904
|
+
s(a, y, {
|
|
905
|
+
isNeedGenerate: T.target.checked
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
),
|
|
910
|
+
label: z,
|
|
911
|
+
sx: {
|
|
912
|
+
minWidth: "180px",
|
|
913
|
+
maxWidth: "280px",
|
|
914
|
+
mr: 2,
|
|
915
|
+
"& .MuiFormControlLabel-label": {
|
|
916
|
+
wordBreak: "break-word"
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
),
|
|
921
|
+
/* @__PURE__ */ r(
|
|
922
|
+
R,
|
|
923
|
+
{
|
|
924
|
+
size: "small",
|
|
925
|
+
fullWidth: !0,
|
|
926
|
+
label: b("maker.properties.llmPropertyDescribe"),
|
|
927
|
+
value: y.describe,
|
|
928
|
+
onChange: (T) => {
|
|
929
|
+
s(a, y, {
|
|
930
|
+
describe: T.target.value
|
|
931
|
+
});
|
|
932
|
+
},
|
|
933
|
+
disabled: !y.isNeedGenerate
|
|
934
|
+
}
|
|
935
|
+
)
|
|
936
|
+
]
|
|
937
|
+
}
|
|
938
|
+
),
|
|
939
|
+
C && /* @__PURE__ */ r(N, { sx: { ml: 3 }, children: u(
|
|
940
|
+
y.subProperties,
|
|
941
|
+
a,
|
|
942
|
+
y.isNeedGenerate && o
|
|
943
|
+
) })
|
|
944
|
+
] })
|
|
945
|
+
] }) }, m);
|
|
946
|
+
}) });
|
|
947
|
+
};
|
|
948
|
+
return /* @__PURE__ */ O(we, { open: e, onClose: n, maxWidth: "lg", fullWidth: !0, children: [
|
|
949
|
+
/* @__PURE__ */ r(_e, { children: w || b("maker.properties.llmConfigTitle") }),
|
|
950
|
+
/* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(N, { my: 3, children: P ? /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) : l ? g ? /* @__PURE__ */ O(j, { spacing: 3, children: [
|
|
951
|
+
/* @__PURE__ */ r(W, { variant: "subtitle2", children: b("maker.properties.llmConfigInstructions") }),
|
|
952
|
+
u(g.properties)
|
|
953
|
+
] }) : /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) : /* @__PURE__ */ r(W, { color: "error", children: b("maker.properties.componentNotFound") }) }) }),
|
|
954
|
+
/* @__PURE__ */ O(He, { children: [
|
|
955
|
+
/* @__PURE__ */ r(A, { onClick: n, children: b("common.cancel") }),
|
|
956
|
+
/* @__PURE__ */ r(A, { variant: "contained", onClick: c, disabled: !g || P, children: b("common.confirm") })
|
|
957
|
+
] })
|
|
958
|
+
] });
|
|
959
|
+
}
|
|
960
|
+
function ft({
|
|
718
961
|
label: e,
|
|
719
|
-
value:
|
|
962
|
+
value: t,
|
|
720
963
|
onChange: i
|
|
721
964
|
}) {
|
|
722
|
-
const [l,
|
|
723
|
-
return /* @__PURE__ */ O(
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
|
|
965
|
+
const [l, f] = G(!1);
|
|
966
|
+
return /* @__PURE__ */ O(j, { gap: 1, children: [
|
|
967
|
+
/* @__PURE__ */ r(
|
|
968
|
+
R,
|
|
726
969
|
{
|
|
727
970
|
label: e,
|
|
728
971
|
size: "small",
|
|
729
|
-
value:
|
|
730
|
-
onChange: (
|
|
972
|
+
value: t,
|
|
973
|
+
onChange: (v) => i == null ? void 0 : i(v.target.value),
|
|
731
974
|
InputProps: {
|
|
732
|
-
endAdornment: /* @__PURE__ */
|
|
733
|
-
|
|
975
|
+
endAdornment: /* @__PURE__ */ r(
|
|
976
|
+
Qe,
|
|
734
977
|
{
|
|
735
|
-
onChange: ({ response:
|
|
736
|
-
var
|
|
737
|
-
const
|
|
738
|
-
|
|
978
|
+
onChange: ({ response: v }) => {
|
|
979
|
+
var w;
|
|
980
|
+
const p = (w = v == null ? void 0 : v.data) == null ? void 0 : w.filename;
|
|
981
|
+
p && (i == null || i(p));
|
|
739
982
|
}
|
|
740
983
|
}
|
|
741
984
|
)
|
|
742
985
|
}
|
|
743
986
|
}
|
|
744
987
|
),
|
|
745
|
-
|
|
746
|
-
|
|
988
|
+
t && /* @__PURE__ */ r(
|
|
989
|
+
N,
|
|
747
990
|
{
|
|
748
991
|
component: "img",
|
|
749
992
|
sx: { objectFit: "contain", borderRadius: 1, cursor: "pointer" },
|
|
750
|
-
src:
|
|
993
|
+
src: We(t),
|
|
751
994
|
alt: e,
|
|
752
995
|
maxWidth: 100,
|
|
753
996
|
maxHeight: 100,
|
|
754
997
|
width: "100%",
|
|
755
|
-
onClick: () =>
|
|
998
|
+
onClick: () => f(!0)
|
|
756
999
|
}
|
|
757
1000
|
),
|
|
758
|
-
/* @__PURE__ */
|
|
1001
|
+
/* @__PURE__ */ r(we, { open: l, onClose: () => f(!1), children: /* @__PURE__ */ r(N, { component: "img", sx: { objectFit: "contain" }, src: We(t), alt: e }) })
|
|
759
1002
|
] });
|
|
760
1003
|
}
|
|
761
|
-
function
|
|
762
|
-
return
|
|
763
|
-
const
|
|
764
|
-
return
|
|
1004
|
+
function ve(e, t = "") {
|
|
1005
|
+
return Qr(e, (i, l, f) => {
|
|
1006
|
+
const v = t ? `${t}.${f}` : f;
|
|
1007
|
+
return Gr(l) ? Jr(i, ve(l, v)) : i[v] = l, i;
|
|
765
1008
|
}, {});
|
|
766
1009
|
}
|
|
767
|
-
const
|
|
1010
|
+
const ht = [
|
|
768
1011
|
{ value: "string", label: "Text" },
|
|
769
1012
|
{ value: "multiline", label: "Text (Multiline)" },
|
|
770
1013
|
{ value: "number", label: "Number" },
|
|
@@ -778,165 +1021,168 @@ const dr = [
|
|
|
778
1021
|
{ value: "component", label: "Component" },
|
|
779
1022
|
{ value: "custom", label: "Custom (Render by a Component)" }
|
|
780
1023
|
];
|
|
781
|
-
function
|
|
782
|
-
return !e || !i ? !1 : Object.values(e).some(({ data: l }) => l.id !==
|
|
1024
|
+
function oe(e, t, i) {
|
|
1025
|
+
return !e || !i ? !1 : Object.values(e).some(({ data: l }) => l.id !== t && l.key === i);
|
|
783
1026
|
}
|
|
784
|
-
function
|
|
1027
|
+
function xe(e, t) {
|
|
785
1028
|
var i;
|
|
786
|
-
return !e || !
|
|
1029
|
+
return !e || !t ? !1 : ((i = e[t]) == null ? void 0 : i.data.visible) ?? !0;
|
|
787
1030
|
}
|
|
788
|
-
function
|
|
789
|
-
const { state: { components:
|
|
790
|
-
return l ? /* @__PURE__ */
|
|
1031
|
+
function hi({ componentId: e }) {
|
|
1032
|
+
const { state: { components: t } } = te(), i = t[e], l = i == null ? void 0 : i.data;
|
|
1033
|
+
return l ? /* @__PURE__ */ r(j, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ r(N, { p: 2, children: /* @__PURE__ */ r(Zr, { FallbackComponent: ur, resetKeys: [e], children: /* @__PURE__ */ r(bt, { value: l, componentId: e }) }) }) }) : null;
|
|
791
1034
|
}
|
|
792
|
-
function
|
|
793
|
-
var x,
|
|
794
|
-
const { t: i } =
|
|
795
|
-
componentId:
|
|
1035
|
+
function bt({ value: e, componentId: t }) {
|
|
1036
|
+
var x, n, c;
|
|
1037
|
+
const { t: i } = V(), { localState: { currentLocale: l, customComponentPreviewerProperties: f }, state: { config: { defaultLocale: v } }, localActions: { setCustomComponentPreviewerProperties: p } } = te(), w = ne(e).doc, P = Pe(), b = re(() => (f == null ? void 0 : f[t]) ?? {}, [t, f]), g = Mr({
|
|
1038
|
+
componentId: t,
|
|
796
1039
|
propertiesValue: {
|
|
797
|
-
...
|
|
1040
|
+
...b
|
|
798
1041
|
}
|
|
799
1042
|
});
|
|
800
|
-
return
|
|
801
|
-
|
|
802
|
-
...
|
|
1043
|
+
return _(() => {
|
|
1044
|
+
g.componentId !== t && (g.componentId = t, g.propertiesValue = {
|
|
1045
|
+
...b
|
|
803
1046
|
});
|
|
804
|
-
}, [
|
|
805
|
-
if (
|
|
1047
|
+
}, [t, b, g]), _(() => {
|
|
1048
|
+
if (g.componentId !== t)
|
|
806
1049
|
return;
|
|
807
|
-
const
|
|
808
|
-
var
|
|
1050
|
+
const s = Object.fromEntries(Object.values(e.properties ?? {}).map(({ data: u }) => {
|
|
1051
|
+
var d, k, o, h, m;
|
|
809
1052
|
return [
|
|
810
|
-
|
|
1053
|
+
u.id,
|
|
811
1054
|
{
|
|
812
|
-
value: ((
|
|
1055
|
+
value: ((d = g.propertiesValue[u.id]) == null ? void 0 : d.value) ?? Vr(u, ((o = (k = u.locales) == null ? void 0 : k[l]) == null ? void 0 : o.defaultValue) ?? ((m = (h = u.locales) == null ? void 0 : h[v]) == null ? void 0 : m.defaultValue), {
|
|
813
1056
|
locale: l,
|
|
814
|
-
defaultLocale:
|
|
1057
|
+
defaultLocale: v
|
|
815
1058
|
})
|
|
816
1059
|
}
|
|
817
1060
|
];
|
|
818
1061
|
}));
|
|
819
|
-
|
|
820
|
-
}, [JSON.stringify(
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
1062
|
+
p(t, s);
|
|
1063
|
+
}, [JSON.stringify(g.propertiesValue), t, g.componentId]), /* @__PURE__ */ r(j, { height: "100%", children: /* @__PURE__ */ O(j, { gap: 2, children: [
|
|
1064
|
+
/* @__PURE__ */ r(yt, { config: e }),
|
|
1065
|
+
/* @__PURE__ */ r(xt, {
|
|
823
1066
|
config: e,
|
|
824
1067
|
currentLocale: l,
|
|
825
|
-
defaultLocale:
|
|
1068
|
+
defaultLocale: v,
|
|
826
1069
|
allComponents: P,
|
|
827
|
-
onUpdateConfig: (
|
|
828
|
-
|
|
829
|
-
|
|
1070
|
+
onUpdateConfig: (s) => {
|
|
1071
|
+
w.transact(() => {
|
|
1072
|
+
s(e);
|
|
830
1073
|
});
|
|
831
1074
|
}
|
|
832
1075
|
}),
|
|
833
|
-
/* @__PURE__ */ O(
|
|
834
|
-
/* @__PURE__ */
|
|
835
|
-
/* @__PURE__ */ O(
|
|
1076
|
+
/* @__PURE__ */ O(j, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
1077
|
+
/* @__PURE__ */ r(W, { variant: "subtitle1", children: i("renderer") }),
|
|
1078
|
+
/* @__PURE__ */ O(R, {
|
|
836
1079
|
hiddenLabel: !0,
|
|
837
1080
|
size: "small",
|
|
838
1081
|
select: !0,
|
|
839
1082
|
SelectProps: { autoWidth: !0 },
|
|
840
1083
|
value: ((x = e.renderer) == null ? void 0 : x.type) || "react-component",
|
|
841
|
-
onChange: (
|
|
842
|
-
|
|
843
|
-
const
|
|
844
|
-
e.renderer ?? (e.renderer = { type:
|
|
1084
|
+
onChange: (s) => {
|
|
1085
|
+
w.transact(() => {
|
|
1086
|
+
const u = s.target.value;
|
|
1087
|
+
e.renderer ?? (e.renderer = { type: u }), e.renderer.type = u;
|
|
845
1088
|
});
|
|
846
1089
|
},
|
|
847
1090
|
children: [
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
1091
|
+
/* @__PURE__ */ r(he, { value: "react-component", children: "React Component" }),
|
|
1092
|
+
/* @__PURE__ */ r(he, { value: "component", children: "Custom Component" })
|
|
850
1093
|
]
|
|
851
1094
|
})
|
|
852
1095
|
] }),
|
|
853
|
-
((
|
|
854
|
-
((
|
|
855
|
-
/* @__PURE__ */
|
|
1096
|
+
((n = e.renderer) == null ? void 0 : n.type) === "component" && /* @__PURE__ */ r(Ct, { value: e }),
|
|
1097
|
+
((c = e.renderer) == null ? void 0 : c.type) === "react-component" && /* @__PURE__ */ r(Ot, { value: e }),
|
|
1098
|
+
/* @__PURE__ */ r(dr, {
|
|
856
1099
|
config: e,
|
|
857
1100
|
currentLocale: l,
|
|
858
|
-
defaultLocale:
|
|
1101
|
+
defaultLocale: v,
|
|
859
1102
|
allComponents: P,
|
|
860
|
-
propertiesValue:
|
|
861
|
-
onChange: ({ value:
|
|
862
|
-
const
|
|
863
|
-
if (!
|
|
864
|
-
|
|
865
|
-
key:
|
|
1103
|
+
propertiesValue: g.propertiesValue,
|
|
1104
|
+
onChange: ({ value: s, id: u, path: d }) => {
|
|
1105
|
+
const k = [...d, "data"];
|
|
1106
|
+
if (!_r(e, k)) {
|
|
1107
|
+
ye.warning(i("cannotFindPropertyKey", {
|
|
1108
|
+
key: k.join(".")
|
|
866
1109
|
}));
|
|
867
1110
|
return;
|
|
868
1111
|
}
|
|
869
|
-
|
|
870
|
-
value:
|
|
1112
|
+
g.propertiesValue[u] = {
|
|
1113
|
+
value: s.value
|
|
871
1114
|
};
|
|
872
1115
|
}
|
|
873
1116
|
})
|
|
874
1117
|
] }) });
|
|
875
1118
|
}
|
|
876
|
-
function
|
|
877
|
-
const { t
|
|
878
|
-
return /* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
label:
|
|
1119
|
+
function yt({ config: e }) {
|
|
1120
|
+
const { t } = V();
|
|
1121
|
+
return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
|
|
1122
|
+
/* @__PURE__ */ r(W, { variant: "subtitle1", children: t("basicInfo") }),
|
|
1123
|
+
/* @__PURE__ */ r(R, {
|
|
1124
|
+
label: t("name"),
|
|
882
1125
|
size: "small",
|
|
883
1126
|
value: e.name || "",
|
|
884
1127
|
onChange: (i) => e.name = i.target.value
|
|
885
1128
|
}),
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
label:
|
|
1129
|
+
/* @__PURE__ */ r(R, {
|
|
1130
|
+
label: t("description"),
|
|
888
1131
|
size: "small",
|
|
889
1132
|
multiline: !0,
|
|
890
1133
|
minRows: 2,
|
|
891
1134
|
maxRows: 10,
|
|
892
1135
|
inputProps: { maxLength: 200 },
|
|
893
1136
|
value: e.description || "",
|
|
894
|
-
onChange: (i) => e.description = i.target.value
|
|
1137
|
+
onChange: (i) => e.description = i.target.value,
|
|
1138
|
+
InputProps: {
|
|
1139
|
+
endAdornment: /* @__PURE__ */ r(pe, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(Nt, { config: e }) })
|
|
1140
|
+
}
|
|
895
1141
|
}),
|
|
896
|
-
/* @__PURE__ */
|
|
1142
|
+
/* @__PURE__ */ r(Le, {
|
|
897
1143
|
size: "small",
|
|
898
1144
|
options: [],
|
|
899
1145
|
multiple: !0,
|
|
900
1146
|
freeSolo: !0,
|
|
901
1147
|
value: e.tags ?? [],
|
|
902
1148
|
onChange: (i, l) => e.tags = l,
|
|
903
|
-
renderInput: (i) => /* @__PURE__ */
|
|
1149
|
+
renderInput: (i) => /* @__PURE__ */ r(R, { label: t("tags"), ...i })
|
|
904
1150
|
}),
|
|
905
|
-
/* @__PURE__ */
|
|
906
|
-
label:
|
|
1151
|
+
/* @__PURE__ */ r(ft, {
|
|
1152
|
+
label: t("previewImage"),
|
|
907
1153
|
value: e.previewImage || "",
|
|
908
1154
|
onChange: (i) => e.previewImage = i
|
|
909
1155
|
})
|
|
910
1156
|
] }) });
|
|
911
1157
|
}
|
|
912
|
-
function
|
|
913
|
-
var
|
|
914
|
-
const { t: P } =
|
|
915
|
-
return /* @__PURE__ */
|
|
916
|
-
preview:
|
|
917
|
-
drop:
|
|
918
|
-
drag:
|
|
919
|
-
isDragging:
|
|
1158
|
+
function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defaultLocale: v, allComponents: p, onUpdateConfig: w }) {
|
|
1159
|
+
var g, x, n, c, s, u;
|
|
1160
|
+
const { t: P } = V(), b = re(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? kt : L, [e.type]);
|
|
1161
|
+
return /* @__PURE__ */ r(ut, {
|
|
1162
|
+
preview: t.preview,
|
|
1163
|
+
drop: t.drop,
|
|
1164
|
+
drag: t.drag,
|
|
1165
|
+
isDragging: t.isDragging,
|
|
920
1166
|
onDelete: () => {
|
|
921
|
-
|
|
922
|
-
if (
|
|
923
|
-
const
|
|
924
|
-
delete
|
|
925
|
-
|
|
1167
|
+
w((d) => {
|
|
1168
|
+
if (d.properties) {
|
|
1169
|
+
const o = Object.entries(d.properties).sort(([, m], [, y]) => m.index - y.index);
|
|
1170
|
+
delete d.properties[e.id], o.filter(([m]) => m !== e.id).forEach(([, m], y) => {
|
|
1171
|
+
m.index = y;
|
|
926
1172
|
});
|
|
927
1173
|
}
|
|
928
1174
|
});
|
|
929
1175
|
},
|
|
930
1176
|
visible: i,
|
|
931
|
-
onVisibilityChange: (
|
|
932
|
-
|
|
933
|
-
const
|
|
934
|
-
|
|
1177
|
+
onVisibilityChange: (d) => {
|
|
1178
|
+
w((k) => {
|
|
1179
|
+
const o = k.properties[e.id].data;
|
|
1180
|
+
o.visible = d;
|
|
935
1181
|
});
|
|
936
1182
|
},
|
|
937
1183
|
alwaysShowActions: !0,
|
|
938
|
-
children: /* @__PURE__ */ O(
|
|
939
|
-
/* @__PURE__ */
|
|
1184
|
+
children: /* @__PURE__ */ O(j, { direction: "column", gap: 2, children: [
|
|
1185
|
+
/* @__PURE__ */ r(R, {
|
|
940
1186
|
label: P("key"),
|
|
941
1187
|
size: "small",
|
|
942
1188
|
required: !0,
|
|
@@ -944,30 +1190,30 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defau
|
|
|
944
1190
|
width: "calc(100% - 80px - 8px)",
|
|
945
1191
|
flex: 1,
|
|
946
1192
|
"& .MuiOutlinedInput-root": {
|
|
947
|
-
borderColor: e.key ?
|
|
1193
|
+
borderColor: e.key ? oe(l.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
|
|
948
1194
|
},
|
|
949
1195
|
"& .MuiFormLabel-root": {
|
|
950
|
-
color: e.key ?
|
|
1196
|
+
color: e.key ? oe(l.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
|
|
951
1197
|
},
|
|
952
1198
|
"& .MuiFormLabel-root.Mui-focused": {
|
|
953
|
-
color: e.key ?
|
|
1199
|
+
color: e.key ? oe(l.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
|
|
954
1200
|
}
|
|
955
1201
|
},
|
|
956
1202
|
value: e.key || "",
|
|
957
|
-
onChange: (
|
|
958
|
-
|
|
959
|
-
const
|
|
960
|
-
|
|
1203
|
+
onChange: (d) => {
|
|
1204
|
+
w((k) => {
|
|
1205
|
+
const o = k.properties[e.id].data;
|
|
1206
|
+
o.key = d.target.value.trim();
|
|
961
1207
|
});
|
|
962
1208
|
},
|
|
963
1209
|
InputProps: {
|
|
964
|
-
endAdornment: !e.key || e.key &&
|
|
1210
|
+
endAdornment: !e.key || e.key && oe(l.properties, e.id, e.key) ? /* @__PURE__ */ r(pe, {
|
|
965
1211
|
position: "end",
|
|
966
1212
|
sx: {
|
|
967
1213
|
width: 16,
|
|
968
1214
|
ml: 0
|
|
969
1215
|
},
|
|
970
|
-
children: /* @__PURE__ */
|
|
1216
|
+
children: /* @__PURE__ */ r(Y, { title: e.key ? P("duplicateKey") : P("requiredKey"), children: /* @__PURE__ */ r(rr, {
|
|
971
1217
|
sx: {
|
|
972
1218
|
color: e.key ? "warning.main" : "error.main",
|
|
973
1219
|
fontSize: 16
|
|
@@ -976,159 +1222,159 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defau
|
|
|
976
1222
|
}) : null
|
|
977
1223
|
}
|
|
978
1224
|
}),
|
|
979
|
-
/* @__PURE__ */ O(
|
|
980
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ O(j, { direction: "row", gap: 1, children: [
|
|
1226
|
+
/* @__PURE__ */ r(R, {
|
|
981
1227
|
label: P("label"),
|
|
982
1228
|
size: "small",
|
|
983
1229
|
sx: { flex: 1 },
|
|
984
|
-
value: (((x = (
|
|
985
|
-
onChange: (
|
|
986
|
-
|
|
987
|
-
var
|
|
988
|
-
const
|
|
989
|
-
|
|
1230
|
+
value: (((x = (g = e.locales) == null ? void 0 : g[f]) == null ? void 0 : x.name) ?? ((c = (n = e.locales) == null ? void 0 : n[v]) == null ? void 0 : c.name)) || "",
|
|
1231
|
+
onChange: (d) => {
|
|
1232
|
+
w((k) => {
|
|
1233
|
+
var h;
|
|
1234
|
+
const o = k.properties[e.id].data;
|
|
1235
|
+
o.locales ?? (o.locales = {}), (h = o.locales)[f] ?? (h[f] = {}), o.locales[f].name = d.target.value;
|
|
990
1236
|
});
|
|
991
1237
|
}
|
|
992
1238
|
}),
|
|
993
|
-
/* @__PURE__ */
|
|
1239
|
+
/* @__PURE__ */ r(R, {
|
|
994
1240
|
label: P("type"),
|
|
995
1241
|
size: "small",
|
|
996
1242
|
select: !0,
|
|
997
1243
|
sx: { flex: 1 },
|
|
998
1244
|
value: e.type === "string" && e.multiline ? "multiline" : e.type || "string",
|
|
999
|
-
onChange: (
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1002
|
-
if (
|
|
1003
|
-
for (const
|
|
1004
|
-
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1245
|
+
onChange: (d) => {
|
|
1246
|
+
w((k) => {
|
|
1247
|
+
const o = k.properties[e.id].data;
|
|
1248
|
+
if (o.locales)
|
|
1249
|
+
for (const m of Object.keys(o.locales))
|
|
1250
|
+
o.locales[m].defaultValue = void 0;
|
|
1251
|
+
const h = d.target.value;
|
|
1252
|
+
h === "multiline" ? (o.type = "string", o.multiline = !0) : (typeof o.multiline < "u" && delete o.multiline, o.type = h);
|
|
1007
1253
|
});
|
|
1008
1254
|
},
|
|
1009
|
-
children:
|
|
1255
|
+
children: ht.map((d) => /* @__PURE__ */ r(he, { value: d.value, children: d.label }, d.value))
|
|
1010
1256
|
})
|
|
1011
1257
|
] }),
|
|
1012
|
-
/* @__PURE__ */ O(
|
|
1013
|
-
/* @__PURE__ */
|
|
1014
|
-
allComponents:
|
|
1015
|
-
defaultLocale:
|
|
1258
|
+
/* @__PURE__ */ O(j, { direction: "row", gap: 1, children: [
|
|
1259
|
+
/* @__PURE__ */ r(b, {
|
|
1260
|
+
allComponents: p,
|
|
1261
|
+
defaultLocale: v,
|
|
1016
1262
|
component: l,
|
|
1017
1263
|
property: e,
|
|
1018
1264
|
label: P("defaultValue"),
|
|
1019
1265
|
size: "small",
|
|
1020
1266
|
fullWidth: !0,
|
|
1021
|
-
value: (
|
|
1022
|
-
onChange: (
|
|
1023
|
-
|
|
1024
|
-
var
|
|
1025
|
-
const
|
|
1026
|
-
if (
|
|
1027
|
-
const
|
|
1028
|
-
Object.keys(I).forEach((
|
|
1029
|
-
|
|
1267
|
+
value: (u = (s = e.locales) == null ? void 0 : s[f]) == null ? void 0 : u.defaultValue,
|
|
1268
|
+
onChange: (d, k) => {
|
|
1269
|
+
w((o) => {
|
|
1270
|
+
var m;
|
|
1271
|
+
const h = o.properties[e.id].data;
|
|
1272
|
+
if (k != null && k.forceUpdateProperty) {
|
|
1273
|
+
const y = ve(h), I = ve(d);
|
|
1274
|
+
Object.keys(I).forEach((a) => {
|
|
1275
|
+
y[a] || qe(h, a, I[a]);
|
|
1030
1276
|
});
|
|
1031
1277
|
} else
|
|
1032
|
-
|
|
1278
|
+
h.locales ?? (h.locales = {}), (m = h.locales)[f] ?? (m[f] = {}), h.locales[f].defaultValue = d;
|
|
1033
1279
|
});
|
|
1034
1280
|
}
|
|
1035
1281
|
}),
|
|
1036
|
-
e.type === "custom" ? /* @__PURE__ */
|
|
1282
|
+
e.type === "custom" ? /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(gt, { property: e, allComponents: p }) }) : null
|
|
1037
1283
|
] })
|
|
1038
1284
|
] })
|
|
1039
1285
|
});
|
|
1040
1286
|
}
|
|
1041
|
-
function
|
|
1042
|
-
const [i, l] =
|
|
1043
|
-
return
|
|
1044
|
-
const
|
|
1287
|
+
function vt(e, t) {
|
|
1288
|
+
const [i, l] = G(0);
|
|
1289
|
+
return _(() => {
|
|
1290
|
+
const v = setTimeout(() => {
|
|
1045
1291
|
if (e.current) {
|
|
1046
|
-
let
|
|
1047
|
-
for (;
|
|
1048
|
-
|
|
1049
|
-
l(
|
|
1292
|
+
let p = e.current.parentElement, w = 0;
|
|
1293
|
+
for (; p; )
|
|
1294
|
+
p.classList.contains("property-container") && w++, p = p.parentElement;
|
|
1295
|
+
l(w);
|
|
1050
1296
|
}
|
|
1051
1297
|
}, 100);
|
|
1052
|
-
return () => clearTimeout(
|
|
1053
|
-
}, [e,
|
|
1298
|
+
return () => clearTimeout(v);
|
|
1299
|
+
}, [e, t]), i;
|
|
1054
1300
|
}
|
|
1055
|
-
function
|
|
1056
|
-
const { t:
|
|
1057
|
-
return /* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */ O(
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
/* @__PURE__ */
|
|
1061
|
-
|
|
1301
|
+
function xt({ config: e, currentLocale: t, defaultLocale: i, allComponents: l, onUpdateConfig: f, useI18nEditor: v = !0 }) {
|
|
1302
|
+
const { t: p } = V(), w = Se({ variant: "dialog" }), P = e.properties && U(Object.values(e.properties), "index");
|
|
1303
|
+
return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
|
|
1304
|
+
/* @__PURE__ */ O(j, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
1305
|
+
/* @__PURE__ */ r(W, { variant: "subtitle1", children: p("properties") }),
|
|
1306
|
+
/* @__PURE__ */ r(N, { flex: 1 }),
|
|
1307
|
+
v && /* @__PURE__ */ r(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(w), children: /* @__PURE__ */ r(Ze, { fontSize: "small" }) })
|
|
1062
1308
|
] }),
|
|
1063
|
-
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */
|
|
1064
|
-
component:
|
|
1309
|
+
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ r(nr, {
|
|
1310
|
+
component: j,
|
|
1065
1311
|
gap: 2,
|
|
1066
1312
|
list: e.properties,
|
|
1067
|
-
renderItem: (
|
|
1068
|
-
const
|
|
1069
|
-
return /* @__PURE__ */
|
|
1313
|
+
renderItem: (b, g, x) => {
|
|
1314
|
+
const n = xe(e.properties, b.id);
|
|
1315
|
+
return /* @__PURE__ */ r(ie, {
|
|
1070
1316
|
elevation: 0,
|
|
1071
1317
|
className: "property-container",
|
|
1072
1318
|
sx: {
|
|
1073
1319
|
p: 1.25,
|
|
1074
1320
|
borderRadius: 1,
|
|
1075
|
-
border:
|
|
1321
|
+
border: n ? "1px solid" : "1px dashed",
|
|
1076
1322
|
borderColor: "divider"
|
|
1077
1323
|
},
|
|
1078
|
-
children: /* @__PURE__ */
|
|
1079
|
-
data:
|
|
1324
|
+
children: /* @__PURE__ */ r(j, { gap: 2, children: /* @__PURE__ */ r(sr, {
|
|
1325
|
+
data: b,
|
|
1080
1326
|
params: x,
|
|
1081
|
-
visible:
|
|
1327
|
+
visible: n,
|
|
1082
1328
|
config: e,
|
|
1083
|
-
currentLocale:
|
|
1329
|
+
currentLocale: t,
|
|
1084
1330
|
defaultLocale: i,
|
|
1085
1331
|
allComponents: l,
|
|
1086
|
-
onUpdateConfig:
|
|
1332
|
+
onUpdateConfig: f
|
|
1087
1333
|
}) })
|
|
1088
|
-
},
|
|
1334
|
+
}, b.id);
|
|
1089
1335
|
}
|
|
1090
|
-
}) : /* @__PURE__ */
|
|
1091
|
-
/* @__PURE__ */
|
|
1336
|
+
}) : /* @__PURE__ */ r(ae, { style: { fontSize: 12 }, children: p("maker.properties.noProperties") }),
|
|
1337
|
+
/* @__PURE__ */ r(A, {
|
|
1092
1338
|
fullWidth: !0,
|
|
1093
1339
|
variant: "outlined",
|
|
1094
1340
|
className: "ignore-style-override",
|
|
1095
1341
|
onClick: () => {
|
|
1096
|
-
|
|
1342
|
+
f((b) => {
|
|
1097
1343
|
var x;
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1344
|
+
const g = Ke();
|
|
1345
|
+
b.properties ?? (b.properties = {}), (x = b.properties)[g] ?? (x[g] = { index: (P == null ? void 0 : P.length) || 0, data: { id: g } });
|
|
1100
1346
|
});
|
|
1101
1347
|
},
|
|
1102
|
-
startIcon: /* @__PURE__ */
|
|
1103
|
-
children:
|
|
1348
|
+
startIcon: /* @__PURE__ */ r(er, {}),
|
|
1349
|
+
children: p("addObject", { object: p("property") })
|
|
1104
1350
|
}),
|
|
1105
|
-
|
|
1351
|
+
v && /* @__PURE__ */ r(cr, { ...ir(w), component: e })
|
|
1106
1352
|
] }) });
|
|
1107
1353
|
}
|
|
1108
|
-
function
|
|
1109
|
-
const i =
|
|
1110
|
-
return /* @__PURE__ */ O(
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1354
|
+
function gt({ property: e, allComponents: t }) {
|
|
1355
|
+
const i = Se({ variant: "popper" });
|
|
1356
|
+
return /* @__PURE__ */ O(q, { children: [
|
|
1357
|
+
/* @__PURE__ */ r(A, { sx: { minWidth: 0 }, ...Ie(i), children: /* @__PURE__ */ r(tr, { fontSize: "small" }) }),
|
|
1358
|
+
/* @__PURE__ */ r(Pr, { ...Xr(i), children: /* @__PURE__ */ r(Tr, { onClickAway: i.close, children: /* @__PURE__ */ r(ie, { children: /* @__PURE__ */ r(N, { width: 500, p: 2, children: /* @__PURE__ */ r(Oe, {
|
|
1113
1359
|
value: e.componentId,
|
|
1114
|
-
onChange: (l,
|
|
1115
|
-
allComponents:
|
|
1360
|
+
onChange: (l, f) => e.componentId = f,
|
|
1361
|
+
allComponents: t
|
|
1116
1362
|
}) }) }) }) })
|
|
1117
1363
|
] });
|
|
1118
1364
|
}
|
|
1119
|
-
function
|
|
1120
|
-
var
|
|
1121
|
-
const [
|
|
1122
|
-
return
|
|
1123
|
-
/* @__PURE__ */
|
|
1365
|
+
function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: l, allComponents: f }) {
|
|
1366
|
+
var g;
|
|
1367
|
+
const [v, p] = G(!1), { t: w, locale: P } = V(), b = typeof (e == null ? void 0 : e.componentId) == "string" ? (g = f[e.componentId]) == null ? void 0 : g.data : void 0;
|
|
1368
|
+
return b ? /* @__PURE__ */ O(N, { sx: { width: "100%", position: "relative" }, children: [
|
|
1369
|
+
/* @__PURE__ */ r(le, {
|
|
1124
1370
|
sx: { minWidth: 0 },
|
|
1125
|
-
disabled: !
|
|
1371
|
+
disabled: !b,
|
|
1126
1372
|
size: "small",
|
|
1127
|
-
onClick: () =>
|
|
1128
|
-
color:
|
|
1129
|
-
children: /* @__PURE__ */
|
|
1373
|
+
onClick: () => p(!v),
|
|
1374
|
+
color: v ? "primary" : "default",
|
|
1375
|
+
children: /* @__PURE__ */ r(tr, { fontSize: "small" })
|
|
1130
1376
|
}),
|
|
1131
|
-
|
|
1377
|
+
v && /* @__PURE__ */ r(xr, { in: v, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ O(ie, {
|
|
1132
1378
|
elevation: 1,
|
|
1133
1379
|
sx: {
|
|
1134
1380
|
mt: 1,
|
|
@@ -1139,205 +1385,205 @@ function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allCom
|
|
|
1139
1385
|
width: "100%"
|
|
1140
1386
|
},
|
|
1141
1387
|
children: [
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
config:
|
|
1388
|
+
/* @__PURE__ */ r(N, { width: "100%", mb: 2, children: /* @__PURE__ */ r(dr, {
|
|
1389
|
+
config: b,
|
|
1144
1390
|
currentLocale: P,
|
|
1145
1391
|
defaultLocale: l,
|
|
1146
|
-
allComponents:
|
|
1392
|
+
allComponents: f,
|
|
1147
1393
|
propertiesValue: e == null ? void 0 : e.properties,
|
|
1148
|
-
onChange: ({ id: x, value:
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1394
|
+
onChange: ({ id: x, value: n }) => {
|
|
1395
|
+
const c = jr(n.value), s = JSON.parse(JSON.stringify(e));
|
|
1396
|
+
s != null && s.componentId && (t ? i == null || i({ ...s, properties: { ...s.properties, [x]: { value: c } } }) : (s.properties = s.properties ?? {}, s.properties[x] = { value: c }, i == null || i(s)));
|
|
1151
1397
|
}
|
|
1152
1398
|
}) }),
|
|
1153
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ r(A, { size: "small", onClick: () => p(!1), sx: { mt: 1 }, children: w("close") })
|
|
1154
1400
|
]
|
|
1155
1401
|
}) })
|
|
1156
1402
|
] }) : null;
|
|
1157
1403
|
}
|
|
1158
|
-
function
|
|
1159
|
-
var x,
|
|
1160
|
-
const { t: l } =
|
|
1161
|
-
return /* @__PURE__ */ O(
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
] }) },
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
var
|
|
1170
|
-
return /* @__PURE__ */
|
|
1171
|
-
/* @__PURE__ */
|
|
1404
|
+
function cr({ type: e = "properties", component: t, ...i }) {
|
|
1405
|
+
var x, n, c;
|
|
1406
|
+
const { t: l } = V(), { state: { components: f, supportedLocales: v, config: { defaultLocale: p } } } = te(), w = Pe(), P = ne(t).doc, b = e === "properties" ? t.properties : e === "parameters" && ((x = t.renderer) == null ? void 0 : x.type) === "component" ? (n = f[t.renderer.componentId]) == null ? void 0 : n.data.properties : void 0, g = ((c = t.renderer) == null ? void 0 : c.type) === "component" ? t : void 0;
|
|
1407
|
+
return /* @__PURE__ */ O(we, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
1408
|
+
/* @__PURE__ */ r(_e, { children: l("i18nEditorTitle") }),
|
|
1409
|
+
/* @__PURE__ */ r($e, { children: b && /* @__PURE__ */ r(j, { children: /* @__PURE__ */ O(Fe, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
1410
|
+
/* @__PURE__ */ r(Me, { children: /* @__PURE__ */ r(ce, { children: v.map(({ locale: s, name: u }) => /* @__PURE__ */ r(de, { children: /* @__PURE__ */ O(W, { color: "text.primary", children: [
|
|
1411
|
+
u,
|
|
1412
|
+
p === s && /* @__PURE__ */ r(Kr, { sx: { fontSize: 12 } })
|
|
1413
|
+
] }) }, s)) }) }),
|
|
1414
|
+
/* @__PURE__ */ r(Je, { children: U(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ r(ce, { children: v.map(({ locale: u }) => {
|
|
1415
|
+
var d, k, o, h, m, y, I, a, S, C, z, E, T, B, K, F, Q, X, Z, ee, Ce, Ne, je, ze, Re, Ve;
|
|
1416
|
+
return /* @__PURE__ */ r(de, { children: /* @__PURE__ */ r(j, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(q, { children: [
|
|
1417
|
+
/* @__PURE__ */ r(R, {
|
|
1172
1418
|
size: "small",
|
|
1173
1419
|
label: "Key",
|
|
1174
|
-
value:
|
|
1175
|
-
onChange: (
|
|
1420
|
+
value: s.key || "",
|
|
1421
|
+
onChange: ($) => {
|
|
1176
1422
|
P.transact(() => {
|
|
1177
|
-
|
|
1423
|
+
s.key = $.target.value.trim();
|
|
1178
1424
|
});
|
|
1179
1425
|
}
|
|
1180
1426
|
}),
|
|
1181
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ r(R, {
|
|
1182
1428
|
size: "small",
|
|
1183
1429
|
label: l("label"),
|
|
1184
|
-
value: (((
|
|
1185
|
-
onChange: (
|
|
1430
|
+
value: (((k = (d = s.locales) == null ? void 0 : d[u]) == null ? void 0 : k.name) ?? ((h = (o = s.locales) == null ? void 0 : o[p]) == null ? void 0 : h.name)) || "",
|
|
1431
|
+
onChange: ($) => {
|
|
1186
1432
|
P.transact(() => {
|
|
1187
|
-
var
|
|
1188
|
-
|
|
1433
|
+
var M;
|
|
1434
|
+
s.locales ?? (s.locales = {}), (M = s.locales)[u] ?? (M[u] = {}), s.locales[u].name = $.target.value;
|
|
1189
1435
|
});
|
|
1190
1436
|
}
|
|
1191
1437
|
}),
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
allComponents:
|
|
1194
|
-
defaultLocale:
|
|
1195
|
-
component:
|
|
1196
|
-
property:
|
|
1438
|
+
/* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(L, {
|
|
1439
|
+
allComponents: w,
|
|
1440
|
+
defaultLocale: p,
|
|
1441
|
+
component: t,
|
|
1442
|
+
property: s,
|
|
1197
1443
|
size: "small",
|
|
1198
1444
|
fullWidth: !0,
|
|
1199
1445
|
label: "Default Value",
|
|
1200
|
-
valueImmutable:
|
|
1201
|
-
value: ((
|
|
1202
|
-
onChange: (
|
|
1446
|
+
valueImmutable: ue((y = (m = s.locales) == null ? void 0 : m[u]) == null ? void 0 : y.defaultValue),
|
|
1447
|
+
value: ((a = (I = s.locales) == null ? void 0 : I[u]) == null ? void 0 : a.defaultValue) ?? ((C = (S = s.locales) == null ? void 0 : S[p]) == null ? void 0 : C.defaultValue),
|
|
1448
|
+
onChange: ($) => {
|
|
1203
1449
|
P.transact(() => {
|
|
1204
|
-
var
|
|
1205
|
-
|
|
1450
|
+
var M;
|
|
1451
|
+
s.locales ?? (s.locales = {}), (M = s.locales)[u] ?? (M[u] = {}), s.locales[u].defaultValue = $;
|
|
1206
1452
|
});
|
|
1207
1453
|
}
|
|
1208
1454
|
}) })
|
|
1209
|
-
] }) : e === "parameters" &&
|
|
1210
|
-
allComponents:
|
|
1211
|
-
defaultLocale:
|
|
1212
|
-
component:
|
|
1213
|
-
property:
|
|
1455
|
+
] }) : e === "parameters" && g ? /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(L, {
|
|
1456
|
+
allComponents: w,
|
|
1457
|
+
defaultLocale: p,
|
|
1458
|
+
component: t,
|
|
1459
|
+
property: s,
|
|
1214
1460
|
size: "small",
|
|
1215
1461
|
fullWidth: !0,
|
|
1216
|
-
valueImmutable:
|
|
1217
|
-
value: ((
|
|
1218
|
-
onChange: (
|
|
1462
|
+
valueImmutable: ue((B = (T = (E = (z = g.renderer.properties) == null ? void 0 : z[s.id]) == null ? void 0 : E.locales) == null ? void 0 : T[u]) == null ? void 0 : B.value),
|
|
1463
|
+
value: ((X = (Q = (F = (K = g.renderer.properties) == null ? void 0 : K[s.id]) == null ? void 0 : F.locales) == null ? void 0 : Q[u]) == null ? void 0 : X.value) ?? ((Ne = (Ce = (ee = (Z = g.renderer.properties) == null ? void 0 : Z[s.id]) == null ? void 0 : ee.locales) == null ? void 0 : Ce[p]) == null ? void 0 : Ne.value) ?? ((ze = (je = s.locales) == null ? void 0 : je[u]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Re = s.locales) == null ? void 0 : Re[p]) == null ? void 0 : Ve.defaultValue),
|
|
1464
|
+
onChange: ($) => {
|
|
1219
1465
|
P.transact(() => {
|
|
1220
|
-
var
|
|
1221
|
-
(
|
|
1466
|
+
var M, Ee, Te, Ae, De;
|
|
1467
|
+
(M = g.renderer).properties ?? (M.properties = {}), (Ee = g.renderer.properties)[Te = s.id] ?? (Ee[Te] = {}), (Ae = g.renderer.properties[s.id]).locales ?? (Ae.locales = {}), (De = g.renderer.properties[s.id].locales)[u] ?? (De[u] = {}), g.renderer.properties[s.id].locales[u].value = $;
|
|
1222
1468
|
});
|
|
1223
1469
|
}
|
|
1224
|
-
}) }) : null },
|
|
1225
|
-
}) },
|
|
1470
|
+
}) }) : null }, s.id) }, u);
|
|
1471
|
+
}) }, s.id)) })
|
|
1226
1472
|
] }) }) }),
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
var
|
|
1229
|
-
return (
|
|
1473
|
+
/* @__PURE__ */ r(He, { children: /* @__PURE__ */ r(A, { onClick: (s) => {
|
|
1474
|
+
var u;
|
|
1475
|
+
return (u = i.onClose) == null ? void 0 : u.call(i, s, "escapeKeyDown");
|
|
1230
1476
|
}, children: l("close") }) })
|
|
1231
1477
|
] });
|
|
1232
1478
|
}
|
|
1233
|
-
const
|
|
1479
|
+
const Be = (e, t) => (i) => {
|
|
1234
1480
|
const l = [
|
|
1235
1481
|
i.palette.info.main,
|
|
1236
1482
|
i.palette.primary.main,
|
|
1237
1483
|
i.palette.secondary.main,
|
|
1238
1484
|
i.palette.success.main,
|
|
1239
1485
|
i.palette.warning.main
|
|
1240
|
-
],
|
|
1486
|
+
], f = Math.min(l.length - 1, e), v = l[f], p = fe(v, 0.5), w = fe(v, 1);
|
|
1241
1487
|
return {
|
|
1242
1488
|
// 保留原有的边框样式
|
|
1243
|
-
borderColor: `${
|
|
1489
|
+
borderColor: `${p} !important`,
|
|
1244
1490
|
borderLeft: "3px solid !important",
|
|
1245
1491
|
// 稍粗的左侧边框
|
|
1246
|
-
borderLeftColor:
|
|
1492
|
+
borderLeftColor: p,
|
|
1247
1493
|
// 使用透明度适应深色/浅色模式
|
|
1248
|
-
color:
|
|
1249
|
-
...
|
|
1494
|
+
color: w,
|
|
1495
|
+
...t
|
|
1250
1496
|
};
|
|
1251
1497
|
};
|
|
1252
|
-
function
|
|
1253
|
-
const { t:
|
|
1498
|
+
function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
|
|
1499
|
+
const { t: f, locale: v } = V(), p = H(null), w = vt(p, e), P = D(() => {
|
|
1254
1500
|
if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
|
|
1255
1501
|
try {
|
|
1256
|
-
let
|
|
1257
|
-
|
|
1258
|
-
var
|
|
1259
|
-
if (!
|
|
1502
|
+
let b = {};
|
|
1503
|
+
U(Object.values(e.subProperties), "index").filter((n) => n.data.visible !== !1 && n.data.key).forEach(({ data: n }) => {
|
|
1504
|
+
var s, u, d, k;
|
|
1505
|
+
if (!n.key)
|
|
1260
1506
|
return;
|
|
1261
|
-
let
|
|
1262
|
-
if (
|
|
1263
|
-
|
|
1264
|
-
else if (
|
|
1265
|
-
|
|
1266
|
-
else if ((
|
|
1507
|
+
let c = ((u = (s = n.locales) == null ? void 0 : s[v]) == null ? void 0 : u.defaultValue) ?? ((k = (d = n.locales) == null ? void 0 : d[i]) == null ? void 0 : k.defaultValue);
|
|
1508
|
+
if (n.type === "number")
|
|
1509
|
+
c = Number(c);
|
|
1510
|
+
else if (n.type === "boolean")
|
|
1511
|
+
c = c === !0 || c === "true";
|
|
1512
|
+
else if ((n.type === "json" || n.type === "yaml") && typeof c == "string")
|
|
1267
1513
|
try {
|
|
1268
|
-
|
|
1269
|
-
} catch (
|
|
1270
|
-
console.error("Error parsing nested value",
|
|
1514
|
+
n.type === "json" ? c = JSON.parse(c) : c = be.parse(c);
|
|
1515
|
+
} catch (o) {
|
|
1516
|
+
console.error("Error parsing nested value", c, o), c = {};
|
|
1271
1517
|
}
|
|
1272
|
-
|
|
1273
|
-
}), e.type === "array" && !Array.isArray(
|
|
1274
|
-
const x =
|
|
1275
|
-
|
|
1276
|
-
} catch (
|
|
1277
|
-
console.error("Error converting structure to text:",
|
|
1518
|
+
b[n.key] = c;
|
|
1519
|
+
}), e.type === "array" && !Array.isArray(b) && (b = J(b) ? [] : [b]);
|
|
1520
|
+
const x = ge(b, e.type);
|
|
1521
|
+
t == null || t(x);
|
|
1522
|
+
} catch (b) {
|
|
1523
|
+
console.error("Error converting structure to text:", b);
|
|
1278
1524
|
}
|
|
1279
|
-
}, [e,
|
|
1280
|
-
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(
|
|
1281
|
-
/* @__PURE__ */
|
|
1282
|
-
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */
|
|
1283
|
-
component:
|
|
1525
|
+
}, [e, v, i, t]);
|
|
1526
|
+
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(j, { direction: "column", gap: 1.5, sx: { width: "100%" }, ref: p, children: [
|
|
1527
|
+
/* @__PURE__ */ r(gr, { sx: { mt: -1 }, children: /* @__PURE__ */ r(W, { variant: "caption", color: "text.secondary", children: f("maker.properties.subProperties") }) }),
|
|
1528
|
+
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ r(nr, {
|
|
1529
|
+
component: j,
|
|
1284
1530
|
gap: 2,
|
|
1285
1531
|
list: e.subProperties,
|
|
1286
|
-
renderItem: (
|
|
1287
|
-
const
|
|
1288
|
-
return /* @__PURE__ */
|
|
1532
|
+
renderItem: (b, g, x) => {
|
|
1533
|
+
const n = b.visible !== !1;
|
|
1534
|
+
return /* @__PURE__ */ r(ie, {
|
|
1289
1535
|
elevation: 0,
|
|
1290
1536
|
className: "property-container",
|
|
1291
1537
|
sx: {
|
|
1292
1538
|
p: 1.25,
|
|
1293
1539
|
borderRadius: 1,
|
|
1294
|
-
border:
|
|
1295
|
-
"&":
|
|
1540
|
+
border: n ? "1px solid" : "1px dashed",
|
|
1541
|
+
"&": Be(w)
|
|
1296
1542
|
},
|
|
1297
|
-
children: /* @__PURE__ */
|
|
1298
|
-
data:
|
|
1543
|
+
children: /* @__PURE__ */ r(j, { gap: 2, children: /* @__PURE__ */ r(sr, {
|
|
1544
|
+
data: b,
|
|
1299
1545
|
params: x,
|
|
1300
|
-
visible:
|
|
1546
|
+
visible: n,
|
|
1301
1547
|
config: {
|
|
1302
1548
|
properties: e.subProperties
|
|
1303
1549
|
},
|
|
1304
|
-
currentLocale:
|
|
1550
|
+
currentLocale: v,
|
|
1305
1551
|
defaultLocale: i,
|
|
1306
1552
|
allComponents: l,
|
|
1307
|
-
onUpdateConfig: (
|
|
1553
|
+
onUpdateConfig: (c) => {
|
|
1308
1554
|
try {
|
|
1309
|
-
const
|
|
1310
|
-
s
|
|
1311
|
-
const
|
|
1555
|
+
const s = { properties: e.subProperties || {} };
|
|
1556
|
+
c(s);
|
|
1557
|
+
const u = {
|
|
1312
1558
|
...e,
|
|
1313
|
-
subProperties:
|
|
1559
|
+
subProperties: s.properties
|
|
1314
1560
|
};
|
|
1315
|
-
|
|
1316
|
-
} catch (
|
|
1317
|
-
console.error("Error updating property:",
|
|
1561
|
+
t == null || t(u, { forceUpdateProperty: !0 }), P();
|
|
1562
|
+
} catch (s) {
|
|
1563
|
+
console.error("Error updating property:", s);
|
|
1318
1564
|
}
|
|
1319
1565
|
}
|
|
1320
1566
|
}) })
|
|
1321
|
-
},
|
|
1567
|
+
}, b.id);
|
|
1322
1568
|
}
|
|
1323
|
-
}) : /* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1569
|
+
}) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height: 100 }, children: f("maker.properties.noSubProperties") }),
|
|
1570
|
+
/* @__PURE__ */ r(A, {
|
|
1325
1571
|
fullWidth: !0,
|
|
1326
1572
|
variant: "outlined",
|
|
1327
1573
|
className: "ignore-style-override",
|
|
1328
1574
|
size: "small",
|
|
1329
|
-
startIcon: /* @__PURE__ */
|
|
1575
|
+
startIcon: /* @__PURE__ */ r(er, {}),
|
|
1330
1576
|
onClick: () => {
|
|
1331
1577
|
try {
|
|
1332
|
-
const
|
|
1333
|
-
index: Object.values(
|
|
1578
|
+
const b = e.subProperties || {}, g = Ke(), n = {
|
|
1579
|
+
index: Object.values(b).length,
|
|
1334
1580
|
data: {
|
|
1335
|
-
id:
|
|
1581
|
+
id: g,
|
|
1336
1582
|
key: "",
|
|
1337
1583
|
type: "string",
|
|
1338
1584
|
visible: !0,
|
|
1339
1585
|
locales: {
|
|
1340
|
-
[
|
|
1586
|
+
[v]: {
|
|
1341
1587
|
name: "",
|
|
1342
1588
|
defaultValue: ""
|
|
1343
1589
|
}
|
|
@@ -1345,189 +1591,189 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1345
1591
|
// 为嵌套属性预初始化
|
|
1346
1592
|
subProperties: {}
|
|
1347
1593
|
}
|
|
1348
|
-
},
|
|
1594
|
+
}, c = {
|
|
1349
1595
|
...e,
|
|
1350
1596
|
subProperties: {
|
|
1351
|
-
...
|
|
1352
|
-
[
|
|
1597
|
+
...b,
|
|
1598
|
+
[g]: n
|
|
1353
1599
|
}
|
|
1354
1600
|
};
|
|
1355
|
-
|
|
1356
|
-
} catch (
|
|
1357
|
-
console.error("Error adding property:",
|
|
1601
|
+
t == null || t(c, { forceUpdateProperty: !0 }), P();
|
|
1602
|
+
} catch (b) {
|
|
1603
|
+
console.error("Error adding property:", b);
|
|
1358
1604
|
}
|
|
1359
1605
|
},
|
|
1360
1606
|
sx: {
|
|
1361
|
-
"&":
|
|
1607
|
+
"&": Be(w, {
|
|
1362
1608
|
// borderLeft: undefined,
|
|
1363
1609
|
})
|
|
1364
1610
|
},
|
|
1365
|
-
children:
|
|
1611
|
+
children: f("maker.properties.addSubProperty")
|
|
1366
1612
|
})
|
|
1367
1613
|
] });
|
|
1368
1614
|
}
|
|
1369
|
-
function
|
|
1370
|
-
var s,
|
|
1371
|
-
const { locale: P } =
|
|
1372
|
-
var
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1375
|
-
var I,
|
|
1376
|
-
let
|
|
1377
|
-
|
|
1615
|
+
function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f, defaultLocale: v, allComponents: p, ...w }) {
|
|
1616
|
+
var c, s, u, d, k;
|
|
1617
|
+
const { locale: P } = V(), b = Or(), g = H(null), x = () => {
|
|
1618
|
+
var h;
|
|
1619
|
+
const o = (h = b == null ? void 0 : b.current) == null ? void 0 : h.getUploader();
|
|
1620
|
+
o == null || o.open(), g.current && o.onceUploadSuccess(({ response: m }) => {
|
|
1621
|
+
var I, a;
|
|
1622
|
+
let y = ((I = m == null ? void 0 : m.data) == null ? void 0 : I.filename) || "";
|
|
1623
|
+
y && (y = `mediakit://${y}`, i && !i.includes("mediakit://") && (y += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (a = g.current) == null || a.call(g, y);
|
|
1378
1624
|
});
|
|
1379
|
-
},
|
|
1380
|
-
if (
|
|
1381
|
-
return /* @__PURE__ */
|
|
1382
|
-
...
|
|
1383
|
-
label:
|
|
1625
|
+
}, n = w.label ?? (((s = (c = t.locales) == null ? void 0 : c[P]) == null ? void 0 : s.name) || ((d = (u = t.locales) == null ? void 0 : u[v]) == null ? void 0 : d.name) || t.key || t.id);
|
|
1626
|
+
if (t.type === "number")
|
|
1627
|
+
return /* @__PURE__ */ r(wt, {
|
|
1628
|
+
...w,
|
|
1629
|
+
label: n,
|
|
1384
1630
|
NumberProps: {
|
|
1385
1631
|
value: ["number", "string"].includes(typeof i) ? i : null,
|
|
1386
|
-
onChange: (
|
|
1632
|
+
onChange: (o, h) => l == null ? void 0 : l(h)
|
|
1387
1633
|
}
|
|
1388
1634
|
});
|
|
1389
|
-
if (
|
|
1390
|
-
return /* @__PURE__ */
|
|
1391
|
-
...
|
|
1392
|
-
label:
|
|
1635
|
+
if (t.type === "decimal")
|
|
1636
|
+
return /* @__PURE__ */ r(R, {
|
|
1637
|
+
...w,
|
|
1638
|
+
label: n,
|
|
1393
1639
|
type: "text",
|
|
1394
1640
|
value: i ?? "",
|
|
1395
|
-
onChange: (
|
|
1396
|
-
const
|
|
1397
|
-
if (
|
|
1398
|
-
l == null || l(
|
|
1641
|
+
onChange: (o) => {
|
|
1642
|
+
const h = o.target.value;
|
|
1643
|
+
if (h === "" || h === "-") {
|
|
1644
|
+
l == null || l(h);
|
|
1399
1645
|
return;
|
|
1400
1646
|
}
|
|
1401
|
-
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(
|
|
1402
|
-
let
|
|
1403
|
-
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(
|
|
1647
|
+
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(h)) {
|
|
1648
|
+
let y = h;
|
|
1649
|
+
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(y) && (y = Number(y)), l == null || l(y);
|
|
1404
1650
|
}
|
|
1405
1651
|
}
|
|
1406
1652
|
});
|
|
1407
|
-
if (
|
|
1408
|
-
return /* @__PURE__ */
|
|
1409
|
-
label:
|
|
1653
|
+
if (t.type === "boolean")
|
|
1654
|
+
return /* @__PURE__ */ r(Ge, {
|
|
1655
|
+
label: n,
|
|
1410
1656
|
labelPlacement: "start",
|
|
1411
|
-
control: /* @__PURE__ */
|
|
1657
|
+
control: /* @__PURE__ */ r(vr, { checked: i === !0, onChange: (o, h) => l == null ? void 0 : l(h) })
|
|
1412
1658
|
});
|
|
1413
|
-
if (
|
|
1414
|
-
return /* @__PURE__ */
|
|
1415
|
-
label:
|
|
1659
|
+
if (t.type === "color")
|
|
1660
|
+
return /* @__PURE__ */ r(ot, {
|
|
1661
|
+
label: n,
|
|
1416
1662
|
value: i,
|
|
1417
|
-
onChange: (
|
|
1418
|
-
l == null || l(
|
|
1663
|
+
onChange: (o) => {
|
|
1664
|
+
l == null || l(o);
|
|
1419
1665
|
}
|
|
1420
1666
|
});
|
|
1421
|
-
if (
|
|
1422
|
-
return /* @__PURE__ */
|
|
1423
|
-
label:
|
|
1667
|
+
if (t.type === "json" || t.type === "yaml")
|
|
1668
|
+
return /* @__PURE__ */ r(st, {
|
|
1669
|
+
label: n,
|
|
1424
1670
|
value: i,
|
|
1425
|
-
onChange: (
|
|
1426
|
-
l == null || l(
|
|
1671
|
+
onChange: (o) => {
|
|
1672
|
+
l == null || l(o);
|
|
1427
1673
|
},
|
|
1428
|
-
property:
|
|
1674
|
+
property: t,
|
|
1429
1675
|
component: e,
|
|
1430
|
-
defaultLocale:
|
|
1431
|
-
allComponents:
|
|
1432
|
-
PropertyValueField:
|
|
1433
|
-
onUpload: (
|
|
1434
|
-
|
|
1676
|
+
defaultLocale: v,
|
|
1677
|
+
allComponents: p,
|
|
1678
|
+
PropertyValueField: L,
|
|
1679
|
+
onUpload: (o) => {
|
|
1680
|
+
g.current = o, x();
|
|
1435
1681
|
}
|
|
1436
1682
|
});
|
|
1437
|
-
if (
|
|
1438
|
-
const
|
|
1439
|
-
return
|
|
1440
|
-
componentId:
|
|
1441
|
-
props: { label:
|
|
1683
|
+
if (t.type === "custom") {
|
|
1684
|
+
const o = (k = p[t.componentId]) == null ? void 0 : k.data;
|
|
1685
|
+
return o ? /* @__PURE__ */ r(N, { width: "100%", children: /* @__PURE__ */ r(Xe, {
|
|
1686
|
+
componentId: o.id,
|
|
1687
|
+
props: { label: n, value: i, onChange: l },
|
|
1442
1688
|
locale: P,
|
|
1443
1689
|
dev: {
|
|
1444
1690
|
mode: "draft",
|
|
1445
|
-
components:
|
|
1446
|
-
defaultLocale:
|
|
1691
|
+
components: p,
|
|
1692
|
+
defaultLocale: v
|
|
1447
1693
|
}
|
|
1448
|
-
}) }) : /* @__PURE__ */
|
|
1694
|
+
}) }) : /* @__PURE__ */ r(R, { ...w, label: n, disabled: !0, placeholder: "Click right button select a component" });
|
|
1449
1695
|
}
|
|
1450
|
-
if (
|
|
1451
|
-
return /* @__PURE__ */ O(
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
allComponents:
|
|
1454
|
-
label:
|
|
1696
|
+
if (t.type === "component")
|
|
1697
|
+
return /* @__PURE__ */ O(j, { width: "100%", direction: "column", gap: 1, children: [
|
|
1698
|
+
/* @__PURE__ */ r(Oe, {
|
|
1699
|
+
allComponents: p,
|
|
1700
|
+
label: n,
|
|
1455
1701
|
value: i == null ? void 0 : i.componentId,
|
|
1456
|
-
onChange: (
|
|
1457
|
-
|
|
1702
|
+
onChange: (o, h) => {
|
|
1703
|
+
f || !i ? l == null || l({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }) : typeof i == "object" && (i.componentId = h, l == null || l({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }));
|
|
1458
1704
|
}
|
|
1459
1705
|
}),
|
|
1460
|
-
(i == null ? void 0 : i.componentId) && /* @__PURE__ */
|
|
1706
|
+
(i == null ? void 0 : i.componentId) && /* @__PURE__ */ r(Pt, {
|
|
1461
1707
|
value: i,
|
|
1462
|
-
valueImmutable:
|
|
1708
|
+
valueImmutable: f,
|
|
1463
1709
|
onChange: l,
|
|
1464
|
-
defaultLocale:
|
|
1465
|
-
allComponents:
|
|
1710
|
+
defaultLocale: v,
|
|
1711
|
+
allComponents: p
|
|
1466
1712
|
})
|
|
1467
1713
|
] });
|
|
1468
|
-
if (!
|
|
1469
|
-
let
|
|
1470
|
-
|
|
1471
|
-
const
|
|
1472
|
-
return /* @__PURE__ */
|
|
1473
|
-
...
|
|
1474
|
-
label:
|
|
1475
|
-
value: typeof
|
|
1476
|
-
multiline:
|
|
1477
|
-
minRows:
|
|
1478
|
-
maxRows:
|
|
1479
|
-
onChange: (
|
|
1480
|
-
InputProps:
|
|
1714
|
+
if (!t.type || ["string", "url", "multiline"].includes(t.type)) {
|
|
1715
|
+
let o = t.type === "string" ? t.multiline : void 0;
|
|
1716
|
+
t.type === "multiline" && (o = !0);
|
|
1717
|
+
const h = t.type === "url" ? i == null ? void 0 : i.url : i;
|
|
1718
|
+
return /* @__PURE__ */ r(R, {
|
|
1719
|
+
...w,
|
|
1720
|
+
label: n,
|
|
1721
|
+
value: typeof h == "string" ? h : "",
|
|
1722
|
+
multiline: o,
|
|
1723
|
+
minRows: o ? 2 : void 0,
|
|
1724
|
+
maxRows: o ? 10 : void 0,
|
|
1725
|
+
onChange: (m) => l == null ? void 0 : l(t.type === "url" ? { ...i, url: m.target.value, mediaKitUrl: m.target.value } : m.target.value),
|
|
1726
|
+
InputProps: t.type === "url" ? {
|
|
1481
1727
|
sx: {
|
|
1482
1728
|
pr: 0
|
|
1483
1729
|
},
|
|
1484
|
-
endAdornment: /* @__PURE__ */ O(
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
onChange: async ({ response:
|
|
1487
|
-
var S,
|
|
1488
|
-
const
|
|
1730
|
+
endAdornment: /* @__PURE__ */ O(pe, { position: "end", children: [
|
|
1731
|
+
/* @__PURE__ */ r(Qe, {
|
|
1732
|
+
onChange: async ({ response: m }) => {
|
|
1733
|
+
var S, C, z;
|
|
1734
|
+
const y = ((S = m == null ? void 0 : m.data) == null ? void 0 : S.url) || ((C = m == null ? void 0 : m.data) == null ? void 0 : C.fileUrl);
|
|
1489
1735
|
let I;
|
|
1490
|
-
|
|
1736
|
+
y && (I = await Cr(y).catch(() => Nr(y)).catch(() => {
|
|
1491
1737
|
}));
|
|
1492
|
-
let
|
|
1493
|
-
|
|
1494
|
-
url:
|
|
1495
|
-
mediaKitUrl:
|
|
1738
|
+
let a = ((z = m == null ? void 0 : m.data) == null ? void 0 : z.filename) || "";
|
|
1739
|
+
a && (a = `mediakit://${a}`), l == null || l({
|
|
1740
|
+
url: y,
|
|
1741
|
+
mediaKitUrl: a,
|
|
1496
1742
|
width: I == null ? void 0 : I.naturalWidth,
|
|
1497
1743
|
height: I == null ? void 0 : I.naturalHeight
|
|
1498
1744
|
});
|
|
1499
1745
|
}
|
|
1500
1746
|
}),
|
|
1501
|
-
/* @__PURE__ */
|
|
1747
|
+
/* @__PURE__ */ r(Y, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ r(rr, { sx: { cursor: "default", mr: 1 }, fontSize: "small" }) })
|
|
1502
1748
|
] })
|
|
1503
1749
|
} : void 0
|
|
1504
1750
|
});
|
|
1505
1751
|
}
|
|
1506
|
-
return
|
|
1507
|
-
label:
|
|
1752
|
+
return t.type === "array" ? /* @__PURE__ */ r(nt, {
|
|
1753
|
+
label: n,
|
|
1508
1754
|
value: Array.isArray(i) ? i : [],
|
|
1509
|
-
onChange: (
|
|
1510
|
-
property:
|
|
1511
|
-
renderItem: ({ item:
|
|
1755
|
+
onChange: (o) => l == null ? void 0 : l(o),
|
|
1756
|
+
property: t,
|
|
1757
|
+
renderItem: ({ item: o, index: h, onChange: m }) => t.subProperties && Object.keys(t.subProperties).length > 0 ? /* @__PURE__ */ r(j, { gap: 1, width: "100%", children: U(Object.values(t.subProperties), "index").filter((y) => y.data.visible !== !1).map(({ data: y }) => y.key ? /* @__PURE__ */ r(L, {
|
|
1512
1758
|
component: e,
|
|
1513
|
-
property:
|
|
1514
|
-
value:
|
|
1759
|
+
property: y,
|
|
1760
|
+
value: o[y.key],
|
|
1515
1761
|
onChange: (I) => {
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1762
|
+
const a = { ...o, [y.key]: I };
|
|
1763
|
+
m(a);
|
|
1518
1764
|
},
|
|
1519
1765
|
size: "small",
|
|
1520
1766
|
fullWidth: !0,
|
|
1521
|
-
defaultLocale:
|
|
1522
|
-
allComponents:
|
|
1523
|
-
},
|
|
1524
|
-
}) : (console.error("Unsupported property type",
|
|
1767
|
+
defaultLocale: v,
|
|
1768
|
+
allComponents: p
|
|
1769
|
+
}, y.id) : null) }, h) : /* @__PURE__ */ r(R, { size: w.size, fullWidth: !0, value: o, onChange: (y) => m(y.target.value) })
|
|
1770
|
+
}) : (console.error("Unsupported property type", t.type), null);
|
|
1525
1771
|
}
|
|
1526
|
-
function
|
|
1527
|
-
const { getInputProps: i } =
|
|
1528
|
-
return /* @__PURE__ */
|
|
1772
|
+
function wt({ NumberProps: e, ...t }) {
|
|
1773
|
+
const { getInputProps: i } = Er(e), l = i();
|
|
1774
|
+
return /* @__PURE__ */ r(R, { ...t, inputProps: l });
|
|
1529
1775
|
}
|
|
1530
|
-
const
|
|
1776
|
+
const St = `import React from '@blocklet/pages-kit/builtin/react'
|
|
1531
1777
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
1532
1778
|
|
|
1533
1779
|
export default function () {
|
|
@@ -1536,184 +1782,184 @@ export default function () {
|
|
|
1536
1782
|
Hello World
|
|
1537
1783
|
</Box>
|
|
1538
1784
|
)
|
|
1539
|
-
}`,
|
|
1785
|
+
}`, It = `console.log('hello')
|
|
1540
1786
|
`;
|
|
1541
|
-
function
|
|
1542
|
-
const { locale:
|
|
1543
|
-
return
|
|
1544
|
-
var
|
|
1545
|
-
(
|
|
1546
|
-
e.renderer.script = e.renderer.type === "react-component" ?
|
|
1787
|
+
function Ot({ value: e }) {
|
|
1788
|
+
const { locale: t } = V(), i = Ye(), l = ne(e).doc;
|
|
1789
|
+
return _(() => {
|
|
1790
|
+
var f;
|
|
1791
|
+
(f = e.renderer) != null && f.script || (l.transact(() => {
|
|
1792
|
+
e.renderer.script = e.renderer.type === "react-component" ? St : It;
|
|
1547
1793
|
}), i());
|
|
1548
|
-
}, [e]), /* @__PURE__ */
|
|
1794
|
+
}, [e]), /* @__PURE__ */ r(N, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ r(ke, {
|
|
1549
1795
|
keyId: e.id,
|
|
1550
|
-
locale:
|
|
1796
|
+
locale: t,
|
|
1551
1797
|
language: "typescript",
|
|
1552
1798
|
value: e.renderer.script || "",
|
|
1553
|
-
onChange: (
|
|
1799
|
+
onChange: (f) => e.renderer.script = f,
|
|
1554
1800
|
typeScriptNoValidation: !1,
|
|
1555
1801
|
fullScreenOptions: {
|
|
1556
1802
|
enableEscExit: !0
|
|
1557
1803
|
}
|
|
1558
1804
|
}, e.id) });
|
|
1559
1805
|
}
|
|
1560
|
-
function
|
|
1561
|
-
var
|
|
1562
|
-
const { t
|
|
1563
|
-
return /* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
allComponents:
|
|
1806
|
+
function Ct({ value: e }) {
|
|
1807
|
+
var g, x, n;
|
|
1808
|
+
const { t } = V(), i = ne(e).doc, { state: { components: l, config: { defaultLocale: f }, resources: v }, localState: { currentLocale: p } } = te(), w = Pe(), P = ((g = l[e.renderer.componentId]) == null ? void 0 : g.data) ?? ((n = (x = v.components) == null ? void 0 : x[e.renderer.componentId]) == null ? void 0 : n.component), b = Se({ variant: "dialog" });
|
|
1809
|
+
return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 1, children: [
|
|
1810
|
+
/* @__PURE__ */ r(Oe, {
|
|
1811
|
+
allComponents: w,
|
|
1566
1812
|
excludes: [e.id],
|
|
1567
1813
|
value: e.renderer.componentId,
|
|
1568
|
-
onChange: (
|
|
1814
|
+
onChange: (c, s) => e.renderer.componentId = s
|
|
1569
1815
|
}),
|
|
1570
|
-
P && /* @__PURE__ */ O(
|
|
1571
|
-
/* @__PURE__ */ O(
|
|
1572
|
-
/* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1816
|
+
P && /* @__PURE__ */ O(q, { children: [
|
|
1817
|
+
/* @__PURE__ */ O(j, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
1818
|
+
/* @__PURE__ */ r(W, { variant: "subtitle2", children: t("parameters") }),
|
|
1819
|
+
/* @__PURE__ */ r(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(b), children: /* @__PURE__ */ r(Ze, { fontSize: "small" }) })
|
|
1574
1820
|
] }),
|
|
1575
|
-
P.properties &&
|
|
1576
|
-
var
|
|
1577
|
-
return /* @__PURE__ */
|
|
1578
|
-
allComponents:
|
|
1579
|
-
defaultLocale:
|
|
1821
|
+
P.properties && U(Object.values(P.properties), "index").map(({ data: c }) => {
|
|
1822
|
+
var s, u, d, k, o, h, m, y, I, a, S, C, z, E, T, B;
|
|
1823
|
+
return /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(L, {
|
|
1824
|
+
allComponents: w,
|
|
1825
|
+
defaultLocale: f,
|
|
1580
1826
|
component: P,
|
|
1581
|
-
property:
|
|
1827
|
+
property: c,
|
|
1582
1828
|
fullWidth: !0,
|
|
1583
1829
|
size: "small",
|
|
1584
|
-
valueImmutable:
|
|
1585
|
-
value: ((
|
|
1586
|
-
onChange: (
|
|
1830
|
+
valueImmutable: ue((k = (d = (u = (s = e.renderer.properties) == null ? void 0 : s[c.id]) == null ? void 0 : u.locales) == null ? void 0 : d[p]) == null ? void 0 : k.value),
|
|
1831
|
+
value: ((y = (m = (h = (o = e.renderer.properties) == null ? void 0 : o[c.id]) == null ? void 0 : h.locales) == null ? void 0 : m[p]) == null ? void 0 : y.value) ?? ((C = (S = (a = (I = e.renderer.properties) == null ? void 0 : I[c.id]) == null ? void 0 : a.locales) == null ? void 0 : S[f]) == null ? void 0 : C.value) ?? ((E = (z = c.locales) == null ? void 0 : z[p]) == null ? void 0 : E.defaultValue) ?? ((B = (T = c.locales) == null ? void 0 : T[f]) == null ? void 0 : B.defaultValue),
|
|
1832
|
+
onChange: (K) => {
|
|
1587
1833
|
i.transact(() => {
|
|
1588
|
-
var
|
|
1589
|
-
(
|
|
1834
|
+
var F, Q, X, Z, ee;
|
|
1835
|
+
(F = e.renderer).properties ?? (F.properties = {}), (Q = e.renderer.properties)[X = c.id] ?? (Q[X] = {}), (Z = e.renderer.properties[c.id]).locales ?? (Z.locales = {}), (ee = e.renderer.properties[c.id].locales)[p] ?? (ee[p] = {}), e.renderer.properties[c.id].locales[p].value = K;
|
|
1590
1836
|
});
|
|
1591
1837
|
}
|
|
1592
|
-
}) },
|
|
1838
|
+
}) }, c.id);
|
|
1593
1839
|
}),
|
|
1594
|
-
/* @__PURE__ */
|
|
1840
|
+
/* @__PURE__ */ r(cr, { ...ir(b), component: e, type: "parameters" })
|
|
1595
1841
|
] })
|
|
1596
1842
|
] }) });
|
|
1597
1843
|
}
|
|
1598
|
-
function
|
|
1599
|
-
var
|
|
1600
|
-
const { t:
|
|
1601
|
-
return /* @__PURE__ */
|
|
1602
|
-
...
|
|
1844
|
+
function Oe({ label: e, options: t, excludes: i, value: l, onChange: f, allComponents: v, ...p }) {
|
|
1845
|
+
var g;
|
|
1846
|
+
const { t: w } = V(), P = t ?? U(Object.values(Yr(v, ...i ?? [])), "index").map((x) => x.data), b = (typeof l == "string" ? (g = v[l]) == null ? void 0 : g.data : void 0) ?? null;
|
|
1847
|
+
return /* @__PURE__ */ r(Le, {
|
|
1848
|
+
...p,
|
|
1603
1849
|
size: "small",
|
|
1604
1850
|
options: P,
|
|
1605
1851
|
autoHighlight: !0,
|
|
1606
|
-
isOptionEqualToValue: (x,
|
|
1852
|
+
isOptionEqualToValue: (x, n) => x.id === n.id,
|
|
1607
1853
|
getOptionKey: (x) => x.id,
|
|
1608
1854
|
getOptionLabel: (x) => x.name || x.id,
|
|
1609
|
-
renderInput: (x) => /* @__PURE__ */
|
|
1610
|
-
value:
|
|
1611
|
-
onChange: (x,
|
|
1612
|
-
var
|
|
1613
|
-
let
|
|
1614
|
-
|
|
1615
|
-
blockletId: (
|
|
1616
|
-
blockletTitle: (
|
|
1617
|
-
componentName: ((
|
|
1618
|
-
}),
|
|
1855
|
+
renderInput: (x) => /* @__PURE__ */ r(R, { label: e || w("component"), ...x }),
|
|
1856
|
+
value: b,
|
|
1857
|
+
onChange: (x, n) => {
|
|
1858
|
+
var s, u, d, k, o, h;
|
|
1859
|
+
let c = {};
|
|
1860
|
+
n && (c = {
|
|
1861
|
+
blockletId: (s = v[n == null ? void 0 : n.id]) == null ? void 0 : s.blockletId,
|
|
1862
|
+
blockletTitle: (u = v[n == null ? void 0 : n.id]) == null ? void 0 : u.blockletTitle,
|
|
1863
|
+
componentName: ((k = (d = v[n == null ? void 0 : n.id]) == null ? void 0 : d.data) == null ? void 0 : k.name) || ((h = (o = v[n == null ? void 0 : n.id]) == null ? void 0 : o.data) == null ? void 0 : h.id)
|
|
1864
|
+
}), f == null || f(x, n == null ? void 0 : n.id, c);
|
|
1619
1865
|
}
|
|
1620
1866
|
});
|
|
1621
1867
|
}
|
|
1622
|
-
function
|
|
1623
|
-
const { t:
|
|
1624
|
-
|
|
1868
|
+
function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l, currentLocale: f, onChange: v, props: p }) {
|
|
1869
|
+
const { t: w } = V(), [P, b] = G(e == null ? void 0 : e.properties), [g, x] = G(null);
|
|
1870
|
+
_(() => {
|
|
1625
1871
|
(() => {
|
|
1626
|
-
var
|
|
1627
|
-
((
|
|
1628
|
-
const
|
|
1629
|
-
|
|
1630
|
-
}) :
|
|
1872
|
+
var k, o;
|
|
1873
|
+
((k = e == null ? void 0 : e.renderer) == null ? void 0 : k.type) === "react-component" && J(e == null ? void 0 : e.properties) ? zr((o = e == null ? void 0 : e.renderer) == null ? void 0 : o.script).then((h) => {
|
|
1874
|
+
const m = Rr(h);
|
|
1875
|
+
b(m);
|
|
1876
|
+
}) : b(e == null ? void 0 : e.properties);
|
|
1631
1877
|
})();
|
|
1632
1878
|
}, [JSON.stringify(e)]);
|
|
1633
|
-
const
|
|
1634
|
-
var
|
|
1635
|
-
const
|
|
1636
|
-
return
|
|
1637
|
-
key:
|
|
1638
|
-
value: (
|
|
1639
|
-
id:
|
|
1640
|
-
type:
|
|
1641
|
-
},
|
|
1642
|
-
}, {}), [JSON.stringify(P), e, l,
|
|
1879
|
+
const n = D(() => !e || !P ? {} : Object.values(P).reduce((d, { data: k }) => {
|
|
1880
|
+
var h, m, y, I, a;
|
|
1881
|
+
const o = k.key || k.id;
|
|
1882
|
+
return d[k.id] = {
|
|
1883
|
+
key: o,
|
|
1884
|
+
value: (p == null ? void 0 : p[o]) ?? ((h = l == null ? void 0 : l[k.id]) == null ? void 0 : h.value) ?? ((y = (m = k.locales) == null ? void 0 : m[f]) == null ? void 0 : y.defaultValue) ?? ((a = (I = k.locales) == null ? void 0 : I[i]) == null ? void 0 : a.defaultValue),
|
|
1885
|
+
id: k.id,
|
|
1886
|
+
type: k.type
|
|
1887
|
+
}, d;
|
|
1888
|
+
}, {}), [JSON.stringify(P), e, l, f, i]), c = re(() => {
|
|
1643
1889
|
if (!P)
|
|
1644
1890
|
return {
|
|
1645
1891
|
canUseProperties: [],
|
|
1646
1892
|
visibleProperties: [],
|
|
1647
1893
|
canUsePropertiesKeys: []
|
|
1648
1894
|
};
|
|
1649
|
-
const
|
|
1895
|
+
const d = U(Object.values(P), "index"), k = d.filter(({ data: m }) => m.key && xe(P, m.id)), o = d.filter(({ data: m }) => m.key && m.type !== "component"), h = o.map(({ data: m }) => m.key);
|
|
1650
1896
|
return {
|
|
1651
|
-
canUseProperties:
|
|
1652
|
-
visibleProperties:
|
|
1653
|
-
canUsePropertiesKeys:
|
|
1897
|
+
canUseProperties: o,
|
|
1898
|
+
visibleProperties: k,
|
|
1899
|
+
canUsePropertiesKeys: h
|
|
1654
1900
|
};
|
|
1655
|
-
}, [JSON.stringify(P)]),
|
|
1656
|
-
return /* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
!e ||
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
var
|
|
1661
|
-
return /* @__PURE__ */
|
|
1662
|
-
allComponents:
|
|
1901
|
+
}, [JSON.stringify(P)]), s = n(), u = Lr(s, "key");
|
|
1902
|
+
return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
|
|
1903
|
+
/* @__PURE__ */ r(W, { variant: "subtitle1", children: w("maker.properties.parameters") }),
|
|
1904
|
+
!e || c.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(ae, { style: { fontSize: 12 }, children: w("maker.properties.noParameters") }) : /* @__PURE__ */ O(q, { children: [
|
|
1905
|
+
/* @__PURE__ */ r(j, { gap: 2, children: c.visibleProperties.map(({ data: d }) => {
|
|
1906
|
+
var k, o;
|
|
1907
|
+
return /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(L, {
|
|
1908
|
+
allComponents: t,
|
|
1663
1909
|
defaultLocale: i,
|
|
1664
1910
|
size: "small",
|
|
1665
1911
|
fullWidth: !0,
|
|
1666
1912
|
component: e,
|
|
1667
|
-
property:
|
|
1668
|
-
valueImmutable:
|
|
1669
|
-
value: (
|
|
1670
|
-
onChange: (
|
|
1671
|
-
|
|
1672
|
-
path: ["properties",
|
|
1673
|
-
id:
|
|
1674
|
-
value: { value:
|
|
1675
|
-
shouldSync: Ue(
|
|
1913
|
+
property: d,
|
|
1914
|
+
valueImmutable: ue((k = l == null ? void 0 : l[d.id]) == null ? void 0 : k.value),
|
|
1915
|
+
value: (p == null ? void 0 : p[d.key || d.id]) ?? ((o = s[d.id]) == null ? void 0 : o.value),
|
|
1916
|
+
onChange: (h) => {
|
|
1917
|
+
v({
|
|
1918
|
+
path: ["properties", d.id],
|
|
1919
|
+
id: d.id,
|
|
1920
|
+
value: { value: h },
|
|
1921
|
+
shouldSync: Ue(d),
|
|
1676
1922
|
excludeKeys: [],
|
|
1677
|
-
key:
|
|
1923
|
+
key: d.key || d.id
|
|
1678
1924
|
});
|
|
1679
1925
|
}
|
|
1680
|
-
}) },
|
|
1926
|
+
}) }, d.id);
|
|
1681
1927
|
}) }),
|
|
1682
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ r(j, { gap: 2, sx: { width: "100%" }, children: /* @__PURE__ */ r(Xe, {
|
|
1683
1929
|
componentId: (e == null ? void 0 : e.id) || "",
|
|
1684
1930
|
renderType: "setting",
|
|
1685
|
-
locale:
|
|
1686
|
-
properties:
|
|
1687
|
-
dev: { mode: "draft", components:
|
|
1931
|
+
locale: f,
|
|
1932
|
+
properties: s,
|
|
1933
|
+
dev: { mode: "draft", components: t, defaultLocale: i },
|
|
1688
1934
|
props: {
|
|
1689
|
-
...
|
|
1690
|
-
onChange: (
|
|
1691
|
-
const { canUsePropertiesKeys:
|
|
1692
|
-
Object.keys(
|
|
1693
|
-
var
|
|
1694
|
-
return !
|
|
1695
|
-
}).filter((
|
|
1696
|
-
var
|
|
1697
|
-
return !(
|
|
1698
|
-
}).reduce((
|
|
1699
|
-
const
|
|
1700
|
-
if (
|
|
1701
|
-
return
|
|
1702
|
-
path: ["properties",
|
|
1703
|
-
id:
|
|
1704
|
-
value: { value:
|
|
1705
|
-
shouldSync: Ue(
|
|
1935
|
+
...qr(p ?? {}, c.canUsePropertiesKeys),
|
|
1936
|
+
onChange: (d) => {
|
|
1937
|
+
const { canUsePropertiesKeys: k } = c;
|
|
1938
|
+
Object.keys(d).filter((h) => {
|
|
1939
|
+
var m;
|
|
1940
|
+
return !Hr(d[h], (m = u == null ? void 0 : u[h]) == null ? void 0 : m.value);
|
|
1941
|
+
}).filter((h) => {
|
|
1942
|
+
var m, y, I, a;
|
|
1943
|
+
return !(h === "locale" && !$r(u[h], "locale") || ((m = u[h]) == null ? void 0 : m.type) === "component" || (((y = u[h]) == null ? void 0 : y.type) === "yaml" || ((I = u[h]) == null ? void 0 : I.type) === "json") && xe(P, (a = u[h]) == null ? void 0 : a.id));
|
|
1944
|
+
}).reduce((h, m) => h.then(() => {
|
|
1945
|
+
const y = u[m], I = k.includes(m);
|
|
1946
|
+
if (y != null && y.id && I)
|
|
1947
|
+
return v({
|
|
1948
|
+
path: ["properties", y.id],
|
|
1949
|
+
id: y.id,
|
|
1950
|
+
value: { value: d[m] },
|
|
1951
|
+
shouldSync: Ue(y),
|
|
1706
1952
|
excludeKeys: [],
|
|
1707
|
-
key:
|
|
1953
|
+
key: y.key || y.id
|
|
1708
1954
|
}), Promise.resolve();
|
|
1709
|
-
const
|
|
1710
|
-
if (
|
|
1955
|
+
const a = `propertyNotFound${m}`;
|
|
1956
|
+
if (g === a)
|
|
1711
1957
|
return Promise.resolve();
|
|
1712
|
-
|
|
1713
|
-
const S =
|
|
1714
|
-
key:
|
|
1958
|
+
ye.close(g);
|
|
1959
|
+
const S = ye.warning(w("maker.properties.propertyNotFound", {
|
|
1960
|
+
key: m
|
|
1715
1961
|
}), {
|
|
1716
|
-
key:
|
|
1962
|
+
key: a
|
|
1717
1963
|
});
|
|
1718
1964
|
return x(S), Promise.resolve();
|
|
1719
1965
|
}), Promise.resolve());
|
|
@@ -1723,13 +1969,31 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1723
1969
|
] })
|
|
1724
1970
|
] }) });
|
|
1725
1971
|
}
|
|
1972
|
+
function Nt({ config: e }) {
|
|
1973
|
+
const { t } = V(), { localState: { currentLocale: i }, state: { config: { defaultLocale: l } } } = te(), [f, v] = G(!1), p = (w) => {
|
|
1974
|
+
e.llmConfig = w;
|
|
1975
|
+
};
|
|
1976
|
+
return /* @__PURE__ */ O(q, { children: [
|
|
1977
|
+
/* @__PURE__ */ r(Y, { title: t("maker.properties.configDetailedDescription"), children: /* @__PURE__ */ r(le, { size: "small", color: "primary", onClick: () => v(!0), children: /* @__PURE__ */ r(Br, { fontSize: "small" }) }) }),
|
|
1978
|
+
f && /* @__PURE__ */ r(mt, {
|
|
1979
|
+
open: f,
|
|
1980
|
+
onClose: () => v(!1),
|
|
1981
|
+
onConfirm: p,
|
|
1982
|
+
component: e,
|
|
1983
|
+
initialConfig: e.llmConfig,
|
|
1984
|
+
locale: i,
|
|
1985
|
+
defaultLocale: l,
|
|
1986
|
+
title: t("maker.properties.llmConfigTitle")
|
|
1987
|
+
})
|
|
1988
|
+
] });
|
|
1989
|
+
}
|
|
1726
1990
|
export {
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1991
|
+
yt as BasicInfo,
|
|
1992
|
+
Oe as CustomComponentAutocomplete,
|
|
1993
|
+
hi as CustomComponentSettings,
|
|
1994
|
+
St as DefaultReactComponentScriptTemplate,
|
|
1995
|
+
It as DefaultWebComponentScriptTemplate,
|
|
1996
|
+
dr as ParametersConfig,
|
|
1997
|
+
xt as PropertiesConfig,
|
|
1998
|
+
L as PropertyValueField
|
|
1735
1999
|
};
|