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