@blocklet/pages-kit-inner-components 0.5.35 → 0.5.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/add-component.js +2 -2
- package/lib/cjs/chunks/{array-DxhrK2d5.js → array-Ck0L_JhL.js} +1 -1
- package/lib/cjs/chunks/{config-string-DqWgB7yO.js → config-string-CaLe_baf.js} +1 -1
- package/lib/cjs/chunks/{draft-data-DzN2u_NT.js → draft-data-CY1N7Ozn.js} +1 -1
- package/lib/cjs/chunks/{home-0fezWT4S.js → home-CjWVwLEf.js} +3 -3
- package/lib/cjs/chunks/{publish-button-D2jaaXXn.js → publish-button-BDrUGRX4.js} +1 -1
- package/lib/cjs/chunks/site-state-CIPfhJn5.js +57 -0
- package/lib/cjs/chunks/state-D4QeRw7n.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +1 -1
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +2 -2
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/add-component.js +4 -4
- package/lib/es/chunks/{array-D6qyZucY.js → array-HCA75FfO.js} +1 -1
- package/lib/es/chunks/{config-string-Btybe5Rd.js → config-string-17RNX8vu.js} +1 -1
- package/lib/es/chunks/{draft-data-DQ7_JyJX.js → draft-data-CyeVe0kA.js} +1 -1
- package/lib/es/chunks/{home-Dox9JwvF.js → home-COrN_x32.js} +4 -4
- package/lib/es/chunks/{publish-button-T2YJBoty.js → publish-button-WmGjhj6q.js} +3 -3
- package/lib/es/chunks/site-state-CfrteYXm.js +2137 -0
- package/lib/es/chunks/{state-NhsHvaKm.js → state-Br2xp7Mf.js} +179 -175
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +3 -3
- package/lib/es/project-html.js +1 -1
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +541 -534
- package/lib/es/site-state.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/chunks/site-state-D00xEf4T.js +0 -57
- package/lib/cjs/chunks/state-DoGBMTzI.js +0 -1
- package/lib/es/chunks/site-state-nXcBqjeR.js +0 -2076
package/lib/es/setting.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as t, jsxs as O, Fragment as
|
|
2
|
-
import { t as ve, g as Te, b as ce, E as ot, n as Ke, h as xe } from "./chunks/state-
|
|
1
|
+
import { jsx as t, jsxs as O, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import { t as ve, g as Te, b as ce, E as ot, n as Ke, h as xe } from "./chunks/state-Br2xp7Mf.js";
|
|
3
3
|
import de from "@arcblock/ux/lib/Empty";
|
|
4
|
-
import { useLocaleContext as
|
|
4
|
+
import { useLocaleContext as D } from "@arcblock/ux/lib/Locale/context";
|
|
5
5
|
import { CodeEditor as ge } from "@blocklet/code-editor";
|
|
6
6
|
import nt from "@mui/icons-material/AddRounded";
|
|
7
7
|
import st from "@mui/icons-material/ArrowDownward";
|
|
8
8
|
import ct from "@mui/icons-material/ArrowUpward";
|
|
9
9
|
import dt from "@mui/icons-material/DeleteOutline";
|
|
10
|
-
import { Typography as B, TextField as V, Stack as R, FormLabel as
|
|
10
|
+
import { Typography as B, TextField as V, Stack as R, FormLabel as le, Box as j, TableContainer as at, Paper as ee, Table as Be, TableHead as Fe, TableRow as oe, TableCell as ne, TableBody as Je, Button as E, IconButton as ae, InputAdornment as we, alpha as pe, Tooltip as G, buttonClasses as ut, Dialog as Me, Autocomplete as $e, FormControlLabel as pt, Switch as mt, MenuItem as me, DialogTitle as ft, DialogContent as ht, DialogActions as bt, Collapse as yt, Divider as vt, Popper as xt } from "@mui/material";
|
|
11
11
|
import A from "lodash/sortBy";
|
|
12
|
-
import { useCallback as
|
|
12
|
+
import { useCallback as C, useMemo as Q, useRef as J, useId as gt, useEffect as M, useState as X } from "react";
|
|
13
13
|
import { useUpdate as _e } from "react-use";
|
|
14
|
-
import { ColorItem as
|
|
15
|
-
import { C as kt } from "./chunks/config-string-
|
|
16
|
-
import
|
|
14
|
+
import { ColorItem as wt, ConfigColorDialog as Pt } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
|
+
import { C as kt } from "./chunks/config-string-17RNX8vu.js";
|
|
16
|
+
import Pe from "lodash/isEmpty";
|
|
17
17
|
import He from "lodash/set";
|
|
18
18
|
import * as fe from "yaml";
|
|
19
|
-
import { UploaderButton as Ye, UploaderProvider as ue, useUploader as
|
|
19
|
+
import { UploaderButton as Ye, UploaderProvider as ue, useUploader as St, getImageSize as It, getVideoSize as Ot } from "@blocklet/pages-kit/builtin/uploader";
|
|
20
20
|
import jt from "lodash/cloneDeep";
|
|
21
21
|
import he from "@arcblock/ux/lib/Toast";
|
|
22
22
|
import { CustomComponentRenderer as qe, transpileAndLoadScript as Rt, getPropertiesFromCode as zt } from "@blocklet/pages-kit/components";
|
|
23
23
|
import { parsePropertyValue as Nt } from "@blocklet/pages-kit/utils/property";
|
|
24
|
-
import { unstable_useNumberInput as Vt, ClickAwayListener as
|
|
25
|
-
import { VisibilityOffRounded as
|
|
26
|
-
import { getYjsValue as
|
|
24
|
+
import { unstable_useNumberInput as Vt, ClickAwayListener as Dt } from "@mui/base";
|
|
25
|
+
import { VisibilityOffRounded as Ct, VisibilityRounded as Et, DeleteOutlineRounded as At, DragIndicatorRounded as Tt, TranslateRounded as Le, AddRounded as Ge, InfoRounded as Qe, StarRounded as Ut, SettingsRounded as Xe } from "@mui/icons-material";
|
|
26
|
+
import { getYjsValue as te } from "@syncedstore/core";
|
|
27
27
|
import { useUpdate as Wt, useReactive as Kt } from "ahooks";
|
|
28
28
|
import Bt from "lodash/assign";
|
|
29
29
|
import Ft from "lodash/get";
|
|
@@ -35,7 +35,7 @@ import _t from "lodash/keyBy";
|
|
|
35
35
|
import Ht from "lodash/omit";
|
|
36
36
|
import Yt from "lodash/pick";
|
|
37
37
|
import qt from "lodash/reduce";
|
|
38
|
-
import { usePopupState as ke, bindTrigger as
|
|
38
|
+
import { usePopupState as ke, bindTrigger as Se, bindDialog as Ze, bindPopper as Lt } from "material-ui-popup-state/hooks";
|
|
39
39
|
import { ErrorBoundary as Gt } from "react-error-boundary";
|
|
40
40
|
import { cx as Qt } from "@emotion/css";
|
|
41
41
|
import { useDrop as et, useDrag as Xt } from "react-dnd";
|
|
@@ -68,75 +68,75 @@ function rr({
|
|
|
68
68
|
value: r,
|
|
69
69
|
onChange: i,
|
|
70
70
|
disabled: l = !1,
|
|
71
|
-
itemLabel:
|
|
71
|
+
itemLabel: p = "",
|
|
72
72
|
emptyHeight: y = 40,
|
|
73
73
|
property: a,
|
|
74
|
-
renderItem:
|
|
75
|
-
...
|
|
74
|
+
renderItem: g,
|
|
75
|
+
...P
|
|
76
76
|
}) {
|
|
77
|
-
const { t: b, locale:
|
|
78
|
-
(
|
|
79
|
-
i(ve(
|
|
77
|
+
const { t: b, locale: v } = D(), x = _e(), o = C(
|
|
78
|
+
(f) => {
|
|
79
|
+
i(ve(f, a.type));
|
|
80
80
|
},
|
|
81
81
|
[i, a.type]
|
|
82
|
-
),
|
|
83
|
-
const
|
|
84
|
-
o(
|
|
85
|
-
}, [
|
|
82
|
+
), s = Q(() => Array.isArray(r) ? r : [], [r]), n = C(() => {
|
|
83
|
+
const f = [...s, ""];
|
|
84
|
+
o(f), x();
|
|
85
|
+
}, [s, o, x]), d = C(() => {
|
|
86
86
|
if (!a || !a.subProperties)
|
|
87
|
-
return
|
|
88
|
-
const
|
|
87
|
+
return n();
|
|
88
|
+
const f = {};
|
|
89
89
|
A(Object.values(a.subProperties), "index").forEach(({ data: N }) => {
|
|
90
90
|
var U, W;
|
|
91
91
|
if (!N.key) return;
|
|
92
|
-
const T = ((W = (U = N.locales) == null ? void 0 : U[
|
|
93
|
-
|
|
92
|
+
const T = ((W = (U = N.locales) == null ? void 0 : U[v]) == null ? void 0 : W.defaultValue) ?? "";
|
|
93
|
+
f[N.key] = T;
|
|
94
94
|
});
|
|
95
|
-
const z = [...
|
|
96
|
-
o(z),
|
|
97
|
-
}, [
|
|
98
|
-
(
|
|
95
|
+
const z = [...s, f];
|
|
96
|
+
o(z), x();
|
|
97
|
+
}, [s, o, x, a, v, n]), h = C(
|
|
98
|
+
(f) => {
|
|
99
99
|
try {
|
|
100
|
-
const
|
|
101
|
-
Array.isArray(
|
|
102
|
-
} catch (
|
|
103
|
-
console.error("JSON解析错误:",
|
|
100
|
+
const S = JSON.parse(f);
|
|
101
|
+
Array.isArray(S) ? o(S) : console.error("JSON解析结果不是数组");
|
|
102
|
+
} catch (S) {
|
|
103
|
+
console.error("JSON解析错误:", S);
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
[o]
|
|
107
|
-
), w =
|
|
108
|
-
(
|
|
109
|
-
const
|
|
110
|
-
o(
|
|
107
|
+
), w = C(
|
|
108
|
+
(f) => {
|
|
109
|
+
const S = s.filter((z, N) => N !== f);
|
|
110
|
+
o(S), x();
|
|
111
111
|
},
|
|
112
|
-
[
|
|
113
|
-
), c =
|
|
114
|
-
(
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
|
|
112
|
+
[s, o, x]
|
|
113
|
+
), c = C(
|
|
114
|
+
(f) => {
|
|
115
|
+
if (f <= 0) return;
|
|
116
|
+
const S = [...s], z = S[f];
|
|
117
|
+
S[f] = S[f - 1], S[f - 1] = z, o(S), x();
|
|
118
118
|
},
|
|
119
|
-
[
|
|
120
|
-
),
|
|
121
|
-
(
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
|
|
119
|
+
[s, o, x]
|
|
120
|
+
), m = C(
|
|
121
|
+
(f) => {
|
|
122
|
+
if (f >= s.length - 1) return;
|
|
123
|
+
const S = [...s], z = S[f];
|
|
124
|
+
S[f] = S[f + 1], S[f + 1] = z, o(S), x();
|
|
125
125
|
},
|
|
126
|
-
[
|
|
127
|
-
),
|
|
128
|
-
(
|
|
129
|
-
const z = [...
|
|
130
|
-
z[
|
|
126
|
+
[s, o, x]
|
|
127
|
+
), u = C(
|
|
128
|
+
(f, S) => {
|
|
129
|
+
const z = [...s];
|
|
130
|
+
z[f] = S, o(z);
|
|
131
131
|
},
|
|
132
|
-
[
|
|
133
|
-
),
|
|
132
|
+
[s, o]
|
|
133
|
+
), k = a && a.subProperties && Object.keys(a.subProperties).length > 0, I = Q(() => [
|
|
134
134
|
{
|
|
135
135
|
field: "index",
|
|
136
136
|
headerName: "#",
|
|
137
137
|
width: 40,
|
|
138
138
|
align: "center",
|
|
139
|
-
renderCell: ({ index:
|
|
139
|
+
renderCell: ({ index: f }) => /* @__PURE__ */ t(
|
|
140
140
|
B,
|
|
141
141
|
{
|
|
142
142
|
variant: "body1",
|
|
@@ -150,28 +150,28 @@ function rr({
|
|
|
150
150
|
justifyContent: "center",
|
|
151
151
|
color: "text.secondary"
|
|
152
152
|
},
|
|
153
|
-
children:
|
|
153
|
+
children: f + 1
|
|
154
154
|
}
|
|
155
155
|
)
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
field: "content",
|
|
159
159
|
headerName: "",
|
|
160
|
-
renderCell: ({ row:
|
|
161
|
-
item:
|
|
162
|
-
index:
|
|
160
|
+
renderCell: ({ row: f, index: S }) => g && k ? g({
|
|
161
|
+
item: f,
|
|
162
|
+
index: S,
|
|
163
163
|
property: a,
|
|
164
|
-
onChange: (z) =>
|
|
164
|
+
onChange: (z) => u(S, z)
|
|
165
165
|
}) : /* @__PURE__ */ t(
|
|
166
166
|
V,
|
|
167
167
|
{
|
|
168
168
|
fullWidth: !0,
|
|
169
169
|
size: "small",
|
|
170
170
|
disabled: l,
|
|
171
|
-
value:
|
|
172
|
-
placeholder:
|
|
173
|
-
onChange: (z) =>
|
|
174
|
-
...
|
|
171
|
+
value: f,
|
|
172
|
+
placeholder: p || `${b("item")} ${S + 1}`,
|
|
173
|
+
onChange: (z) => u(S, z.target.value),
|
|
174
|
+
...P
|
|
175
175
|
}
|
|
176
176
|
)
|
|
177
177
|
},
|
|
@@ -181,35 +181,35 @@ function rr({
|
|
|
181
181
|
width: 30,
|
|
182
182
|
// 增加宽度以容纳更多按钮
|
|
183
183
|
align: "center",
|
|
184
|
-
renderCell: ({ index:
|
|
185
|
-
/* @__PURE__ */ t(er, { disabled: l ||
|
|
184
|
+
renderCell: ({ index: f }) => /* @__PURE__ */ O(R, { direction: "column", spacing: 0.25, children: [
|
|
185
|
+
/* @__PURE__ */ t(er, { disabled: l || f === 0, onClick: () => c(f) }),
|
|
186
186
|
/* @__PURE__ */ t(
|
|
187
187
|
tr,
|
|
188
188
|
{
|
|
189
|
-
disabled: l ||
|
|
190
|
-
onClick: () =>
|
|
189
|
+
disabled: l || f === s.length - 1,
|
|
190
|
+
onClick: () => m(f)
|
|
191
191
|
}
|
|
192
192
|
),
|
|
193
|
-
/* @__PURE__ */ t(Zt, { disabled: l, onClick: () => w(
|
|
193
|
+
/* @__PURE__ */ t(Zt, { disabled: l, onClick: () => w(f) })
|
|
194
194
|
] })
|
|
195
195
|
}
|
|
196
196
|
], [
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
g,
|
|
198
|
+
k,
|
|
199
199
|
a,
|
|
200
|
-
f,
|
|
201
200
|
u,
|
|
201
|
+
p,
|
|
202
202
|
b,
|
|
203
203
|
l,
|
|
204
|
-
|
|
204
|
+
P,
|
|
205
205
|
w,
|
|
206
206
|
c,
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
m,
|
|
208
|
+
s.length
|
|
209
209
|
]);
|
|
210
|
-
return
|
|
211
|
-
e && /* @__PURE__ */ t(
|
|
212
|
-
|
|
210
|
+
return k ? /* @__PURE__ */ O(R, { width: "100%", gap: 1, children: [
|
|
211
|
+
e && /* @__PURE__ */ t(le, { children: e }),
|
|
212
|
+
s.length > 0 ? /* @__PURE__ */ t(at, { component: ee, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ O(
|
|
213
213
|
Be,
|
|
214
214
|
{
|
|
215
215
|
size: "small",
|
|
@@ -227,28 +227,28 @@ function rr({
|
|
|
227
227
|
borderCollapse: "collapse"
|
|
228
228
|
},
|
|
229
229
|
children: [
|
|
230
|
-
/* @__PURE__ */ t(Fe, { sx: { display: "none" }, children: /* @__PURE__ */ t(
|
|
231
|
-
|
|
230
|
+
/* @__PURE__ */ t(Fe, { sx: { display: "none" }, children: /* @__PURE__ */ t(oe, { children: I.map((f) => /* @__PURE__ */ t(
|
|
231
|
+
ne,
|
|
232
232
|
{
|
|
233
|
-
width:
|
|
234
|
-
align:
|
|
233
|
+
width: f.width,
|
|
234
|
+
align: f.align || "left",
|
|
235
235
|
sx: { fontWeight: "bold" },
|
|
236
|
-
children:
|
|
236
|
+
children: f.renderHeader ? f.renderHeader() : f.headerName
|
|
237
237
|
},
|
|
238
|
-
|
|
238
|
+
f.field
|
|
239
239
|
)) }) }),
|
|
240
|
-
/* @__PURE__ */ t(Je, { children:
|
|
241
|
-
|
|
240
|
+
/* @__PURE__ */ t(Je, { children: s.map((f, S, z) => /* @__PURE__ */ t(
|
|
241
|
+
oe,
|
|
242
242
|
{
|
|
243
243
|
sx: {
|
|
244
|
-
borderBottom:
|
|
244
|
+
borderBottom: S < z.length - 1 ? "1px solid" : "none",
|
|
245
245
|
borderColor: "divider",
|
|
246
246
|
"&:hover": {
|
|
247
247
|
backgroundColor: "action.hover"
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
|
-
children:
|
|
251
|
-
|
|
250
|
+
children: I.map((N) => /* @__PURE__ */ t(
|
|
251
|
+
ne,
|
|
252
252
|
{
|
|
253
253
|
width: N.width,
|
|
254
254
|
align: N.align || "left",
|
|
@@ -256,15 +256,15 @@ function rr({
|
|
|
256
256
|
borderBottom: "none"
|
|
257
257
|
},
|
|
258
258
|
children: N.renderCell({
|
|
259
|
-
row:
|
|
260
|
-
index:
|
|
261
|
-
onChange: (T) =>
|
|
259
|
+
row: f,
|
|
260
|
+
index: S,
|
|
261
|
+
onChange: (T) => u(S, T)
|
|
262
262
|
})
|
|
263
263
|
},
|
|
264
|
-
`${
|
|
264
|
+
`${S}-${N.field}`
|
|
265
265
|
))
|
|
266
266
|
},
|
|
267
|
-
|
|
267
|
+
S
|
|
268
268
|
)) })
|
|
269
269
|
]
|
|
270
270
|
}
|
|
@@ -282,15 +282,15 @@ function rr({
|
|
|
282
282
|
}
|
|
283
283
|
)
|
|
284
284
|
] }) : /* @__PURE__ */ O(R, { width: "100%", gap: 1, children: [
|
|
285
|
-
e && /* @__PURE__ */ t(
|
|
285
|
+
e && /* @__PURE__ */ t(le, { children: e }),
|
|
286
286
|
/* @__PURE__ */ t(j, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ t(
|
|
287
287
|
ge,
|
|
288
288
|
{
|
|
289
289
|
keyId: a.id,
|
|
290
|
-
locale:
|
|
290
|
+
locale: v,
|
|
291
291
|
language: "json",
|
|
292
|
-
value: JSON.stringify(
|
|
293
|
-
onChange: (
|
|
292
|
+
value: JSON.stringify(s, null, 2),
|
|
293
|
+
onChange: (f) => h(f || ""),
|
|
294
294
|
fullScreenOptions: {
|
|
295
295
|
enableEscExit: !0,
|
|
296
296
|
targetContainer: () => document.getElementById("parameters-config-dialog") || null
|
|
@@ -306,7 +306,7 @@ function ir({
|
|
|
306
306
|
...i
|
|
307
307
|
}) {
|
|
308
308
|
const l = J(null);
|
|
309
|
-
return /* @__PURE__ */ O(
|
|
309
|
+
return /* @__PURE__ */ O(Z, { children: [
|
|
310
310
|
/* @__PURE__ */ t(
|
|
311
311
|
kt,
|
|
312
312
|
{
|
|
@@ -314,14 +314,14 @@ function ir({
|
|
|
314
314
|
value: e,
|
|
315
315
|
onChange: r,
|
|
316
316
|
InputProps: {
|
|
317
|
-
endAdornment: /* @__PURE__ */ t(
|
|
318
|
-
|
|
317
|
+
endAdornment: /* @__PURE__ */ t(we, { position: "end", children: /* @__PURE__ */ t(
|
|
318
|
+
wt,
|
|
319
319
|
{
|
|
320
320
|
color: e ?? "",
|
|
321
321
|
style: { width: "1.5rem", height: "1.5rem", padding: 0 },
|
|
322
322
|
onClick: () => {
|
|
323
|
-
var
|
|
324
|
-
(
|
|
323
|
+
var p;
|
|
324
|
+
(p = l.current) == null || p.open({ value: e ?? "" });
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
) })
|
|
@@ -329,11 +329,11 @@ function ir({
|
|
|
329
329
|
}
|
|
330
330
|
),
|
|
331
331
|
/* @__PURE__ */ t(
|
|
332
|
-
|
|
332
|
+
Pt,
|
|
333
333
|
{
|
|
334
334
|
ref: l,
|
|
335
|
-
onSave: ({ value:
|
|
336
|
-
r(
|
|
335
|
+
onSave: ({ value: p }, y) => {
|
|
336
|
+
r(p), y();
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
)
|
|
@@ -344,43 +344,43 @@ function lr({
|
|
|
344
344
|
value: r,
|
|
345
345
|
onChange: i,
|
|
346
346
|
property: l,
|
|
347
|
-
component:
|
|
347
|
+
component: p,
|
|
348
348
|
defaultLocale: y,
|
|
349
349
|
allComponents: a,
|
|
350
|
-
PropertyValueField:
|
|
351
|
-
onUpload:
|
|
350
|
+
PropertyValueField: g,
|
|
351
|
+
onUpload: P
|
|
352
352
|
}) {
|
|
353
|
-
const { locale: b } =
|
|
354
|
-
if (!
|
|
353
|
+
const { locale: b } = D(), v = J(null);
|
|
354
|
+
if (!Pe(l.subProperties)) {
|
|
355
355
|
const o = A(Object.values(l.subProperties || {}), "index").filter(
|
|
356
|
-
(
|
|
356
|
+
(s) => s.data.visible !== !1 && s.data.key
|
|
357
357
|
);
|
|
358
358
|
return /* @__PURE__ */ O(R, { width: "100%", children: [
|
|
359
|
-
/* @__PURE__ */ t(
|
|
360
|
-
/* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(j, { sx: { position: "relative" }, children: o.map((
|
|
361
|
-
const { data: d } =
|
|
359
|
+
/* @__PURE__ */ t(le, { sx: { px: 0.25, py: 0.5 }, children: e }),
|
|
360
|
+
/* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(j, { sx: { position: "relative" }, children: o.map((s, n) => {
|
|
361
|
+
const { data: d } = s, h = d.key ?? d.id, w = n === o.length - 1;
|
|
362
362
|
let c = null;
|
|
363
363
|
try {
|
|
364
|
-
r && typeof r == "object" ? c = r[
|
|
364
|
+
r && typeof r == "object" ? c = r[h] : typeof r == "string" && (c = (l.type === "yaml" ? fe.parse(r || "") : JSON.parse(r || "{}"))[h]);
|
|
365
365
|
} catch {
|
|
366
366
|
}
|
|
367
367
|
c == null && (d.locales && b && d.locales[b] ? c = d.locales[b].defaultValue : d.locales && y && d.locales[y] && (c = d.locales[y].defaultValue));
|
|
368
|
-
const
|
|
368
|
+
const m = (k) => {
|
|
369
369
|
try {
|
|
370
|
-
let
|
|
370
|
+
let I = {};
|
|
371
371
|
if (typeof r == "string")
|
|
372
372
|
try {
|
|
373
|
-
|
|
373
|
+
I = l.type === "yaml" ? fe.parse(r || "") : JSON.parse(r || "{}");
|
|
374
374
|
} catch {
|
|
375
375
|
}
|
|
376
|
-
else typeof r == "object" && r !== null && (
|
|
377
|
-
He(
|
|
378
|
-
const
|
|
379
|
-
i == null || i(
|
|
380
|
-
} catch (
|
|
381
|
-
console.error("Error updating property:",
|
|
376
|
+
else typeof r == "object" && r !== null && (I = { ...r });
|
|
377
|
+
He(I, h, k);
|
|
378
|
+
const f = ve(I, l.type);
|
|
379
|
+
i == null || i(f);
|
|
380
|
+
} catch (I) {
|
|
381
|
+
console.error("Error updating property:", I);
|
|
382
382
|
}
|
|
383
|
-
},
|
|
383
|
+
}, u = 8;
|
|
384
384
|
return /* @__PURE__ */ O(
|
|
385
385
|
j,
|
|
386
386
|
{
|
|
@@ -405,7 +405,7 @@ function lr({
|
|
|
405
405
|
{
|
|
406
406
|
sx: {
|
|
407
407
|
position: "absolute",
|
|
408
|
-
left:
|
|
408
|
+
left: u,
|
|
409
409
|
top: 0,
|
|
410
410
|
height: 16,
|
|
411
411
|
// 连接到字段中点的高度
|
|
@@ -420,7 +420,7 @@ function lr({
|
|
|
420
420
|
{
|
|
421
421
|
sx: {
|
|
422
422
|
position: "absolute",
|
|
423
|
-
left:
|
|
423
|
+
left: u,
|
|
424
424
|
top: 16,
|
|
425
425
|
// 连接到字段中点
|
|
426
426
|
width: 12,
|
|
@@ -435,7 +435,7 @@ function lr({
|
|
|
435
435
|
{
|
|
436
436
|
sx: {
|
|
437
437
|
position: "absolute",
|
|
438
|
-
left:
|
|
438
|
+
left: u,
|
|
439
439
|
top: 16,
|
|
440
440
|
// 从当前项中点
|
|
441
441
|
bottom: -8,
|
|
@@ -450,12 +450,12 @@ function lr({
|
|
|
450
450
|
}
|
|
451
451
|
),
|
|
452
452
|
/* @__PURE__ */ t(j, { sx: { flexGrow: 1 }, children: /* @__PURE__ */ t(
|
|
453
|
-
|
|
453
|
+
g,
|
|
454
454
|
{
|
|
455
|
-
component:
|
|
455
|
+
component: p,
|
|
456
456
|
property: d,
|
|
457
457
|
value: c,
|
|
458
|
-
onChange:
|
|
458
|
+
onChange: m,
|
|
459
459
|
size: "small",
|
|
460
460
|
fullWidth: !0,
|
|
461
461
|
defaultLocale: y,
|
|
@@ -483,7 +483,7 @@ function lr({
|
|
|
483
483
|
},
|
|
484
484
|
children: [
|
|
485
485
|
/* @__PURE__ */ t(
|
|
486
|
-
|
|
486
|
+
le,
|
|
487
487
|
{
|
|
488
488
|
sx: {
|
|
489
489
|
position: "absolute",
|
|
@@ -505,7 +505,7 @@ function lr({
|
|
|
505
505
|
i == null || i(o);
|
|
506
506
|
},
|
|
507
507
|
onUpload: (o) => {
|
|
508
|
-
|
|
508
|
+
v.current = o, P && P(o);
|
|
509
509
|
},
|
|
510
510
|
fullScreenOptions: {
|
|
511
511
|
enableEscExit: !0,
|
|
@@ -548,57 +548,57 @@ function tt({
|
|
|
548
548
|
renderItem: i,
|
|
549
549
|
...l
|
|
550
550
|
}) {
|
|
551
|
-
const
|
|
552
|
-
(
|
|
553
|
-
|
|
551
|
+
const p = J(null), y = gt(), a = Wt(), g = A(Object.entries(r), (s) => s[1].index).map((s) => s[0]), P = J(g), b = C(
|
|
552
|
+
(s) => {
|
|
553
|
+
P.current = s, a();
|
|
554
554
|
},
|
|
555
555
|
[a]
|
|
556
|
-
),
|
|
557
|
-
({ index:
|
|
558
|
-
const d = [...
|
|
559
|
-
d.splice(
|
|
556
|
+
), v = C(
|
|
557
|
+
({ index: s }, { index: n }) => {
|
|
558
|
+
const d = [...P.current];
|
|
559
|
+
d.splice(n, 0, ...d.splice(s, 1)), b(d);
|
|
560
560
|
},
|
|
561
561
|
[b]
|
|
562
562
|
);
|
|
563
|
-
|
|
564
|
-
b(
|
|
565
|
-
}, [
|
|
566
|
-
const [{ isOver:
|
|
563
|
+
M(() => {
|
|
564
|
+
b(g);
|
|
565
|
+
}, [g.join("-")]);
|
|
566
|
+
const [{ isOver: x }, o] = et({
|
|
567
567
|
accept: y,
|
|
568
|
-
collect: (
|
|
569
|
-
isOver:
|
|
568
|
+
collect: (s) => ({
|
|
569
|
+
isOver: s.isOver()
|
|
570
570
|
}),
|
|
571
571
|
canDrop: () => !e,
|
|
572
572
|
drop: () => {
|
|
573
573
|
var d;
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
const c = r[
|
|
574
|
+
const s = () => {
|
|
575
|
+
P.current.forEach((h, w) => {
|
|
576
|
+
const c = r[h];
|
|
577
577
|
c && (c.index = w);
|
|
578
578
|
});
|
|
579
|
-
},
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}) :
|
|
579
|
+
}, n = (d = te(r)) == null ? void 0 : d.doc;
|
|
580
|
+
n ? n.transact(() => {
|
|
581
|
+
s();
|
|
582
|
+
}) : s();
|
|
583
583
|
}
|
|
584
584
|
});
|
|
585
|
-
return
|
|
586
|
-
|
|
587
|
-
}, [
|
|
585
|
+
return M(() => {
|
|
586
|
+
x || b(g);
|
|
587
|
+
}, [x]), o(p), /* @__PURE__ */ t(j, { ...l, ref: p, className: Qt(x && "isDragging"), children: P.current.map((s, n) => /* @__PURE__ */ t(
|
|
588
588
|
nr,
|
|
589
589
|
{
|
|
590
590
|
type: y,
|
|
591
591
|
disabled: e,
|
|
592
|
-
id:
|
|
593
|
-
index:
|
|
594
|
-
itemIndex: (d) =>
|
|
595
|
-
move:
|
|
592
|
+
id: s,
|
|
593
|
+
index: n,
|
|
594
|
+
itemIndex: (d) => P.current.indexOf(d),
|
|
595
|
+
move: v,
|
|
596
596
|
children: (d) => {
|
|
597
|
-
const
|
|
598
|
-
return
|
|
597
|
+
const h = r[s];
|
|
598
|
+
return h ? i(h.data, n, d) : null;
|
|
599
599
|
}
|
|
600
600
|
},
|
|
601
|
-
|
|
601
|
+
s
|
|
602
602
|
)) });
|
|
603
603
|
}
|
|
604
604
|
function nr({
|
|
@@ -606,57 +606,57 @@ function nr({
|
|
|
606
606
|
id: r,
|
|
607
607
|
index: i,
|
|
608
608
|
type: l,
|
|
609
|
-
children:
|
|
609
|
+
children: p,
|
|
610
610
|
itemIndex: y,
|
|
611
611
|
move: a
|
|
612
612
|
}) {
|
|
613
|
-
const
|
|
613
|
+
const g = J(), [{ isDragging: P }, b, v] = Xt({
|
|
614
614
|
type: l,
|
|
615
615
|
item: () => ({ id: r }),
|
|
616
616
|
canDrag: () => !e,
|
|
617
617
|
collect: (o) => ({ isDragging: o.isDragging() })
|
|
618
|
-
}), [,
|
|
618
|
+
}), [, x] = et({
|
|
619
619
|
accept: l,
|
|
620
620
|
canDrop: () => !e,
|
|
621
|
-
hover(o,
|
|
622
|
-
var
|
|
623
|
-
if (!
|
|
621
|
+
hover(o, s) {
|
|
622
|
+
var u;
|
|
623
|
+
if (!g.current)
|
|
624
624
|
return;
|
|
625
|
-
const
|
|
626
|
-
if (
|
|
625
|
+
const n = y(o.id), d = i;
|
|
626
|
+
if (n === d)
|
|
627
627
|
return;
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
const h = (u = g.current) == null ? void 0 : u.getBoundingClientRect(), w = (h.bottom - h.top) / 2, m = s.getClientOffset().y - h.top;
|
|
629
|
+
n < d && m < w || n > d && m > w || a({ id: o.id, index: n }, { id: r, index: i });
|
|
630
630
|
}
|
|
631
631
|
});
|
|
632
|
-
return typeof
|
|
633
|
-
isDragging:
|
|
632
|
+
return typeof p == "function" ? p({
|
|
633
|
+
isDragging: P,
|
|
634
634
|
drag: b,
|
|
635
|
-
drop: (o) => (
|
|
636
|
-
preview:
|
|
637
|
-
}) : (b(v(
|
|
635
|
+
drop: (o) => (g.current = o, x(o)),
|
|
636
|
+
preview: v
|
|
637
|
+
}) : (b(x(v(g))), /* @__PURE__ */ t(j, { ref: g, children: p }));
|
|
638
638
|
}
|
|
639
639
|
function sr({
|
|
640
640
|
drop: e,
|
|
641
641
|
preview: r,
|
|
642
642
|
drag: i,
|
|
643
643
|
disabled: l,
|
|
644
|
-
isDragging:
|
|
644
|
+
isDragging: p,
|
|
645
645
|
children: y,
|
|
646
646
|
onDelete: a,
|
|
647
|
-
onVisibilityChange:
|
|
648
|
-
visible:
|
|
647
|
+
onVisibilityChange: g,
|
|
648
|
+
visible: P = !0,
|
|
649
649
|
actions: b,
|
|
650
|
-
alwaysShowActions:
|
|
650
|
+
alwaysShowActions: v = !1
|
|
651
651
|
}) {
|
|
652
|
-
const { t:
|
|
652
|
+
const { t: x } = D();
|
|
653
653
|
return /* @__PURE__ */ t(
|
|
654
654
|
j,
|
|
655
655
|
{
|
|
656
656
|
ref: e,
|
|
657
657
|
sx: {
|
|
658
658
|
":hover .hover-visible": { maxWidth: "100%" },
|
|
659
|
-
opacity:
|
|
659
|
+
opacity: P ? 1 : 0.5
|
|
660
660
|
},
|
|
661
661
|
children: /* @__PURE__ */ O(j, { sx: { position: "relative" }, children: [
|
|
662
662
|
/* @__PURE__ */ t(
|
|
@@ -666,7 +666,7 @@ function sr({
|
|
|
666
666
|
sx: {
|
|
667
667
|
flex: 1,
|
|
668
668
|
borderRadius: 0.5,
|
|
669
|
-
bgcolor:
|
|
669
|
+
bgcolor: p ? "action.hover" : "background.paper",
|
|
670
670
|
opacity: 0.9999
|
|
671
671
|
// NOTE: make preview effective
|
|
672
672
|
},
|
|
@@ -676,9 +676,9 @@ function sr({
|
|
|
676
676
|
!l && /* @__PURE__ */ t(
|
|
677
677
|
j,
|
|
678
678
|
{
|
|
679
|
-
className:
|
|
679
|
+
className: v ? "" : "hover-visible",
|
|
680
680
|
sx: {
|
|
681
|
-
maxWidth:
|
|
681
|
+
maxWidth: v ? "100%" : 0,
|
|
682
682
|
overflow: "hidden",
|
|
683
683
|
position: "absolute",
|
|
684
684
|
right: 2,
|
|
@@ -702,9 +702,9 @@ function sr({
|
|
|
702
702
|
},
|
|
703
703
|
children: [
|
|
704
704
|
b,
|
|
705
|
-
|
|
706
|
-
a && /* @__PURE__ */ t(G, { title:
|
|
707
|
-
/* @__PURE__ */ t(G, { title:
|
|
705
|
+
g && /* @__PURE__ */ t(G, { title: x(P ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(E, { onClick: () => g(!P), children: P ? /* @__PURE__ */ t(Ct, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ t(Et, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
706
|
+
a && /* @__PURE__ */ t(G, { title: x("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(E, { onClick: a, children: /* @__PURE__ */ t(At, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
707
|
+
/* @__PURE__ */ t(G, { title: x("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(E, { ref: i, children: /* @__PURE__ */ t(Tt, { sx: { color: "grey.500" } }) }) })
|
|
708
708
|
]
|
|
709
709
|
}
|
|
710
710
|
)
|
|
@@ -719,7 +719,7 @@ function cr({
|
|
|
719
719
|
value: r,
|
|
720
720
|
onChange: i
|
|
721
721
|
}) {
|
|
722
|
-
const [l,
|
|
722
|
+
const [l, p] = X(!1);
|
|
723
723
|
return /* @__PURE__ */ O(R, { gap: 1, children: [
|
|
724
724
|
/* @__PURE__ */ t(
|
|
725
725
|
V,
|
|
@@ -733,8 +733,8 @@ function cr({
|
|
|
733
733
|
Ye,
|
|
734
734
|
{
|
|
735
735
|
onChange: ({ response: y }) => {
|
|
736
|
-
var
|
|
737
|
-
const a = (
|
|
736
|
+
var g;
|
|
737
|
+
const a = (g = y == null ? void 0 : y.data) == null ? void 0 : g.filename;
|
|
738
738
|
a && (i == null || i(a));
|
|
739
739
|
}
|
|
740
740
|
}
|
|
@@ -752,15 +752,15 @@ function cr({
|
|
|
752
752
|
maxWidth: 100,
|
|
753
753
|
maxHeight: 100,
|
|
754
754
|
width: "100%",
|
|
755
|
-
onClick: () =>
|
|
755
|
+
onClick: () => p(!0)
|
|
756
756
|
}
|
|
757
757
|
),
|
|
758
|
-
/* @__PURE__ */ t(Me, { open: l, onClose: () =>
|
|
758
|
+
/* @__PURE__ */ t(Me, { open: l, onClose: () => p(!1), children: /* @__PURE__ */ t(j, { component: "img", sx: { objectFit: "contain" }, src: Te(r), alt: e }) })
|
|
759
759
|
] });
|
|
760
760
|
}
|
|
761
761
|
function be(e, r = "") {
|
|
762
|
-
return qt(e, (i, l,
|
|
763
|
-
const y = r ? `${r}.${
|
|
762
|
+
return qt(e, (i, l, p) => {
|
|
763
|
+
const y = r ? `${r}.${p}` : p;
|
|
764
764
|
return $t(l) ? Bt(i, be(l, y)) : i[y] = l, i;
|
|
765
765
|
}, {});
|
|
766
766
|
}
|
|
@@ -778,7 +778,7 @@ const dr = [
|
|
|
778
778
|
{ value: "component", label: "Component" },
|
|
779
779
|
{ value: "custom", label: "Custom (Render by a Component)" }
|
|
780
780
|
];
|
|
781
|
-
function
|
|
781
|
+
function ie(e, r, i) {
|
|
782
782
|
return !e || !i ? !1 : Object.values(e).some(({ data: l }) => l.id !== r && l.key === i);
|
|
783
783
|
}
|
|
784
784
|
function ye(e, r) {
|
|
@@ -787,54 +787,61 @@ function ye(e, r) {
|
|
|
787
787
|
}
|
|
788
788
|
function ci({ componentId: e }) {
|
|
789
789
|
const { state: { components: r } } = ce(), i = r[e], l = i == null ? void 0 : i.data;
|
|
790
|
-
return l ? /* @__PURE__ */ t(R, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ t(j, { p: 2, children: /* @__PURE__ */ t(Gt, { FallbackComponent: ot, resetKeys: [e], children: /* @__PURE__ */ t(ar, { value: l }) }) }) }) : null;
|
|
790
|
+
return l ? /* @__PURE__ */ t(R, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ t(j, { p: 2, children: /* @__PURE__ */ t(Gt, { FallbackComponent: ot, resetKeys: [e], children: /* @__PURE__ */ t(ar, { value: l, componentId: e }) }) }) }) : null;
|
|
791
791
|
}
|
|
792
|
-
function ar({ value: e }) {
|
|
793
|
-
var
|
|
794
|
-
const { t:
|
|
792
|
+
function ar({ value: e, componentId: r }) {
|
|
793
|
+
var x, o, s;
|
|
794
|
+
const { t: i } = D(), { localState: { currentLocale: l, customComponentPreviewerProperties: p }, state: { config: { defaultLocale: y } }, localActions: { setCustomComponentPreviewerProperties: a } } = ce(), g = te(e).doc, P = xe(), b = Q(() => (p == null ? void 0 : p[r]) ?? {}, [r, p]), v = Kt({
|
|
795
|
+
componentId: r,
|
|
795
796
|
propertiesValue: {
|
|
796
|
-
...
|
|
797
|
+
...b
|
|
797
798
|
}
|
|
798
799
|
});
|
|
799
|
-
return
|
|
800
|
-
|
|
801
|
-
|
|
800
|
+
return M(() => {
|
|
801
|
+
v.componentId !== r && (v.componentId = r, v.propertiesValue = {
|
|
802
|
+
...b
|
|
803
|
+
});
|
|
804
|
+
}, [r, b, v]), M(() => {
|
|
805
|
+
if (v.componentId !== r)
|
|
806
|
+
return;
|
|
807
|
+
const n = Object.fromEntries(Object.values(e.properties ?? {}).map(({ data: d }) => {
|
|
808
|
+
var h, w, c, m, u;
|
|
802
809
|
return [
|
|
803
|
-
|
|
810
|
+
d.id,
|
|
804
811
|
{
|
|
805
|
-
value: ((
|
|
806
|
-
locale:
|
|
807
|
-
defaultLocale:
|
|
812
|
+
value: ((h = v.propertiesValue[d.id]) == null ? void 0 : h.value) ?? Nt(d, ((c = (w = d.locales) == null ? void 0 : w[l]) == null ? void 0 : c.defaultValue) ?? ((u = (m = d.locales) == null ? void 0 : m[y]) == null ? void 0 : u.defaultValue), {
|
|
813
|
+
locale: l,
|
|
814
|
+
defaultLocale: y
|
|
808
815
|
})
|
|
809
816
|
}
|
|
810
817
|
];
|
|
811
818
|
}));
|
|
812
|
-
|
|
813
|
-
}, [JSON.stringify(
|
|
819
|
+
a(r, n);
|
|
820
|
+
}, [JSON.stringify(v.propertiesValue), r, v.componentId]), /* @__PURE__ */ t(R, { height: "100%", children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
814
821
|
/* @__PURE__ */ t(ur, { config: e }),
|
|
815
822
|
/* @__PURE__ */ t(mr, {
|
|
816
823
|
config: e,
|
|
817
|
-
currentLocale:
|
|
818
|
-
defaultLocale:
|
|
819
|
-
allComponents:
|
|
820
|
-
onUpdateConfig: (
|
|
821
|
-
|
|
822
|
-
|
|
824
|
+
currentLocale: l,
|
|
825
|
+
defaultLocale: y,
|
|
826
|
+
allComponents: P,
|
|
827
|
+
onUpdateConfig: (n) => {
|
|
828
|
+
g.transact(() => {
|
|
829
|
+
n(e);
|
|
823
830
|
});
|
|
824
831
|
}
|
|
825
832
|
}),
|
|
826
833
|
/* @__PURE__ */ O(R, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
827
|
-
/* @__PURE__ */ t(B, { variant: "subtitle1", children:
|
|
834
|
+
/* @__PURE__ */ t(B, { variant: "subtitle1", children: i("renderer") }),
|
|
828
835
|
/* @__PURE__ */ O(V, {
|
|
829
836
|
hiddenLabel: !0,
|
|
830
837
|
size: "small",
|
|
831
838
|
select: !0,
|
|
832
839
|
SelectProps: { autoWidth: !0 },
|
|
833
|
-
value: ((
|
|
834
|
-
onChange: (
|
|
835
|
-
|
|
836
|
-
const
|
|
837
|
-
e.renderer ?? (e.renderer = { type:
|
|
840
|
+
value: ((x = e.renderer) == null ? void 0 : x.type) || "react-component",
|
|
841
|
+
onChange: (n) => {
|
|
842
|
+
g.transact(() => {
|
|
843
|
+
const d = n.target.value;
|
|
844
|
+
e.renderer ?? (e.renderer = { type: d }), e.renderer.type = d;
|
|
838
845
|
});
|
|
839
846
|
},
|
|
840
847
|
children: [
|
|
@@ -843,31 +850,31 @@ function ar({ value: e }) {
|
|
|
843
850
|
]
|
|
844
851
|
})
|
|
845
852
|
] }),
|
|
846
|
-
((
|
|
847
|
-
((
|
|
853
|
+
((o = e.renderer) == null ? void 0 : o.type) === "component" && /* @__PURE__ */ t(wr, { value: e }),
|
|
854
|
+
((s = e.renderer) == null ? void 0 : s.type) === "react-component" && /* @__PURE__ */ t(gr, { value: e }),
|
|
848
855
|
/* @__PURE__ */ t(lt, {
|
|
849
856
|
config: e,
|
|
850
|
-
currentLocale:
|
|
851
|
-
defaultLocale:
|
|
852
|
-
allComponents:
|
|
853
|
-
propertiesValue:
|
|
854
|
-
onChange: ({ value:
|
|
855
|
-
const
|
|
856
|
-
if (!Ft(e,
|
|
857
|
-
he.warning(
|
|
858
|
-
key:
|
|
857
|
+
currentLocale: l,
|
|
858
|
+
defaultLocale: y,
|
|
859
|
+
allComponents: P,
|
|
860
|
+
propertiesValue: b,
|
|
861
|
+
onChange: ({ value: n, id: d, path: h }) => {
|
|
862
|
+
const w = [...h, "data"];
|
|
863
|
+
if (!Ft(e, w)) {
|
|
864
|
+
he.warning(i("cannotFindPropertyKey", {
|
|
865
|
+
key: w.join(".")
|
|
859
866
|
}));
|
|
860
867
|
return;
|
|
861
868
|
}
|
|
862
|
-
|
|
863
|
-
value:
|
|
869
|
+
v.propertiesValue[d] = {
|
|
870
|
+
value: n.value
|
|
864
871
|
};
|
|
865
872
|
}
|
|
866
873
|
})
|
|
867
874
|
] }) });
|
|
868
875
|
}
|
|
869
876
|
function ur({ config: e }) {
|
|
870
|
-
const { t: r } =
|
|
877
|
+
const { t: r } = D();
|
|
871
878
|
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
872
879
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: r("basicInfo") }),
|
|
873
880
|
/* @__PURE__ */ t(V, {
|
|
@@ -902,65 +909,65 @@ function ur({ config: e }) {
|
|
|
902
909
|
})
|
|
903
910
|
] }) });
|
|
904
911
|
}
|
|
905
|
-
function rt({ data: e, params: r, visible: i, config: l, currentLocale:
|
|
906
|
-
var
|
|
907
|
-
const { t:
|
|
912
|
+
function rt({ data: e, params: r, visible: i, config: l, currentLocale: p, defaultLocale: y, allComponents: a, onUpdateConfig: g }) {
|
|
913
|
+
var v, x, o, s, n, d;
|
|
914
|
+
const { t: P } = D(), b = Q(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? br : $, [e.type]);
|
|
908
915
|
return /* @__PURE__ */ t(sr, {
|
|
909
916
|
preview: r.preview,
|
|
910
917
|
drop: r.drop,
|
|
911
918
|
drag: r.drag,
|
|
912
919
|
isDragging: r.isDragging,
|
|
913
920
|
onDelete: () => {
|
|
914
|
-
|
|
915
|
-
if (
|
|
916
|
-
const c = Object.entries(
|
|
917
|
-
delete
|
|
918
|
-
|
|
921
|
+
g((h) => {
|
|
922
|
+
if (h.properties) {
|
|
923
|
+
const c = Object.entries(h.properties).sort(([, u], [, k]) => u.index - k.index);
|
|
924
|
+
delete h.properties[e.id], c.filter(([u]) => u !== e.id).forEach(([, u], k) => {
|
|
925
|
+
u.index = k;
|
|
919
926
|
});
|
|
920
927
|
}
|
|
921
928
|
});
|
|
922
929
|
},
|
|
923
930
|
visible: i,
|
|
924
|
-
onVisibilityChange: (
|
|
925
|
-
|
|
931
|
+
onVisibilityChange: (h) => {
|
|
932
|
+
g((w) => {
|
|
926
933
|
const c = w.properties[e.id].data;
|
|
927
|
-
c.visible =
|
|
934
|
+
c.visible = h;
|
|
928
935
|
});
|
|
929
936
|
},
|
|
930
937
|
alwaysShowActions: !0,
|
|
931
938
|
children: /* @__PURE__ */ O(R, { direction: "column", gap: 2, children: [
|
|
932
939
|
/* @__PURE__ */ t(V, {
|
|
933
|
-
label:
|
|
940
|
+
label: P("key"),
|
|
934
941
|
size: "small",
|
|
935
942
|
required: !0,
|
|
936
943
|
sx: {
|
|
937
944
|
width: "calc(100% - 80px - 8px)",
|
|
938
945
|
flex: 1,
|
|
939
946
|
"& .MuiOutlinedInput-root": {
|
|
940
|
-
borderColor: e.key ?
|
|
947
|
+
borderColor: e.key ? ie(l.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
|
|
941
948
|
},
|
|
942
949
|
"& .MuiFormLabel-root": {
|
|
943
|
-
color: e.key ?
|
|
950
|
+
color: e.key ? ie(l.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
|
|
944
951
|
},
|
|
945
952
|
"& .MuiFormLabel-root.Mui-focused": {
|
|
946
|
-
color: e.key ?
|
|
953
|
+
color: e.key ? ie(l.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
|
|
947
954
|
}
|
|
948
955
|
},
|
|
949
956
|
value: e.key || "",
|
|
950
|
-
onChange: (
|
|
951
|
-
|
|
957
|
+
onChange: (h) => {
|
|
958
|
+
g((w) => {
|
|
952
959
|
const c = w.properties[e.id].data;
|
|
953
|
-
c.key =
|
|
960
|
+
c.key = h.target.value.trim();
|
|
954
961
|
});
|
|
955
962
|
},
|
|
956
963
|
InputProps: {
|
|
957
|
-
endAdornment: !e.key || e.key &&
|
|
964
|
+
endAdornment: !e.key || e.key && ie(l.properties, e.id, e.key) ? /* @__PURE__ */ t(we, {
|
|
958
965
|
position: "end",
|
|
959
966
|
sx: {
|
|
960
967
|
width: 16,
|
|
961
968
|
ml: 0
|
|
962
969
|
},
|
|
963
|
-
children: /* @__PURE__ */ t(G, { title: e.key ?
|
|
970
|
+
children: /* @__PURE__ */ t(G, { title: e.key ? P("duplicateKey") : P("requiredKey"), children: /* @__PURE__ */ t(Qe, {
|
|
964
971
|
sx: {
|
|
965
972
|
color: e.key ? "warning.main" : "error.main",
|
|
966
973
|
fontSize: 16
|
|
@@ -971,35 +978,35 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defau
|
|
|
971
978
|
}),
|
|
972
979
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, children: [
|
|
973
980
|
/* @__PURE__ */ t(V, {
|
|
974
|
-
label:
|
|
981
|
+
label: P("label"),
|
|
975
982
|
size: "small",
|
|
976
983
|
sx: { flex: 1 },
|
|
977
|
-
value: (((
|
|
978
|
-
onChange: (
|
|
979
|
-
|
|
980
|
-
var
|
|
984
|
+
value: (((x = (v = e.locales) == null ? void 0 : v[p]) == null ? void 0 : x.name) ?? ((s = (o = e.locales) == null ? void 0 : o[y]) == null ? void 0 : s.name)) || "",
|
|
985
|
+
onChange: (h) => {
|
|
986
|
+
g((w) => {
|
|
987
|
+
var m;
|
|
981
988
|
const c = w.properties[e.id].data;
|
|
982
|
-
c.locales ?? (c.locales = {}), (
|
|
989
|
+
c.locales ?? (c.locales = {}), (m = c.locales)[p] ?? (m[p] = {}), c.locales[p].name = h.target.value;
|
|
983
990
|
});
|
|
984
991
|
}
|
|
985
992
|
}),
|
|
986
993
|
/* @__PURE__ */ t(V, {
|
|
987
|
-
label:
|
|
994
|
+
label: P("type"),
|
|
988
995
|
size: "small",
|
|
989
996
|
select: !0,
|
|
990
997
|
sx: { flex: 1 },
|
|
991
998
|
value: e.type === "string" && e.multiline ? "multiline" : e.type || "string",
|
|
992
|
-
onChange: (
|
|
993
|
-
|
|
999
|
+
onChange: (h) => {
|
|
1000
|
+
g((w) => {
|
|
994
1001
|
const c = w.properties[e.id].data;
|
|
995
1002
|
if (c.locales)
|
|
996
|
-
for (const
|
|
997
|
-
c.locales[
|
|
998
|
-
const
|
|
999
|
-
|
|
1003
|
+
for (const u of Object.keys(c.locales))
|
|
1004
|
+
c.locales[u].defaultValue = void 0;
|
|
1005
|
+
const m = h.target.value;
|
|
1006
|
+
m === "multiline" ? (c.type = "string", c.multiline = !0) : (typeof c.multiline < "u" && delete c.multiline, c.type = m);
|
|
1000
1007
|
});
|
|
1001
1008
|
},
|
|
1002
|
-
children: dr.map((
|
|
1009
|
+
children: dr.map((h) => /* @__PURE__ */ t(me, { value: h.value, children: h.label }, h.value))
|
|
1003
1010
|
})
|
|
1004
1011
|
] }),
|
|
1005
1012
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, children: [
|
|
@@ -1008,21 +1015,21 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defau
|
|
|
1008
1015
|
defaultLocale: y,
|
|
1009
1016
|
component: l,
|
|
1010
1017
|
property: e,
|
|
1011
|
-
label:
|
|
1018
|
+
label: P("defaultValue"),
|
|
1012
1019
|
size: "small",
|
|
1013
1020
|
fullWidth: !0,
|
|
1014
|
-
value: (d = (
|
|
1015
|
-
onChange: (
|
|
1016
|
-
|
|
1017
|
-
var
|
|
1018
|
-
const
|
|
1021
|
+
value: (d = (n = e.locales) == null ? void 0 : n[p]) == null ? void 0 : d.defaultValue,
|
|
1022
|
+
onChange: (h, w) => {
|
|
1023
|
+
g((c) => {
|
|
1024
|
+
var u;
|
|
1025
|
+
const m = c.properties[e.id].data;
|
|
1019
1026
|
if (w != null && w.forceUpdateProperty) {
|
|
1020
|
-
const
|
|
1021
|
-
Object.keys(
|
|
1022
|
-
|
|
1027
|
+
const k = be(m), I = be(h);
|
|
1028
|
+
Object.keys(I).forEach((f) => {
|
|
1029
|
+
k[f] || He(m, f, I[f]);
|
|
1023
1030
|
});
|
|
1024
1031
|
} else
|
|
1025
|
-
|
|
1032
|
+
m.locales ?? (m.locales = {}), (u = m.locales)[p] ?? (u[p] = {}), m.locales[p].defaultValue = h;
|
|
1026
1033
|
});
|
|
1027
1034
|
}
|
|
1028
1035
|
}),
|
|
@@ -1032,34 +1039,34 @@ function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defau
|
|
|
1032
1039
|
});
|
|
1033
1040
|
}
|
|
1034
1041
|
function pr(e, r) {
|
|
1035
|
-
const [i, l] =
|
|
1036
|
-
return
|
|
1042
|
+
const [i, l] = X(0);
|
|
1043
|
+
return M(() => {
|
|
1037
1044
|
const y = setTimeout(() => {
|
|
1038
1045
|
if (e.current) {
|
|
1039
|
-
let a = e.current.parentElement,
|
|
1046
|
+
let a = e.current.parentElement, g = 0;
|
|
1040
1047
|
for (; a; )
|
|
1041
|
-
a.classList.contains("property-container") &&
|
|
1042
|
-
l(
|
|
1048
|
+
a.classList.contains("property-container") && g++, a = a.parentElement;
|
|
1049
|
+
l(g);
|
|
1043
1050
|
}
|
|
1044
1051
|
}, 100);
|
|
1045
1052
|
return () => clearTimeout(y);
|
|
1046
1053
|
}, [e, r]), i;
|
|
1047
1054
|
}
|
|
1048
|
-
function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, onUpdateConfig:
|
|
1049
|
-
const { t: a } =
|
|
1055
|
+
function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, onUpdateConfig: p, useI18nEditor: y = !0 }) {
|
|
1056
|
+
const { t: a } = D(), g = ke({ variant: "dialog" }), P = e.properties && A(Object.values(e.properties), "index");
|
|
1050
1057
|
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
1051
1058
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
1052
1059
|
/* @__PURE__ */ t(B, { variant: "subtitle1", children: a("properties") }),
|
|
1053
1060
|
/* @__PURE__ */ t(j, { flex: 1 }),
|
|
1054
|
-
y && /* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...
|
|
1061
|
+
y && /* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Se(g), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
|
|
1055
1062
|
] }),
|
|
1056
1063
|
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ t(tt, {
|
|
1057
1064
|
component: R,
|
|
1058
1065
|
gap: 2,
|
|
1059
1066
|
list: e.properties,
|
|
1060
|
-
renderItem: (b,
|
|
1067
|
+
renderItem: (b, v, x) => {
|
|
1061
1068
|
const o = ye(e.properties, b.id);
|
|
1062
|
-
return /* @__PURE__ */ t(
|
|
1069
|
+
return /* @__PURE__ */ t(ee, {
|
|
1063
1070
|
elevation: 0,
|
|
1064
1071
|
className: "property-container",
|
|
1065
1072
|
sx: {
|
|
@@ -1070,13 +1077,13 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
|
|
|
1070
1077
|
},
|
|
1071
1078
|
children: /* @__PURE__ */ t(R, { gap: 2, children: /* @__PURE__ */ t(rt, {
|
|
1072
1079
|
data: b,
|
|
1073
|
-
params:
|
|
1080
|
+
params: x,
|
|
1074
1081
|
visible: o,
|
|
1075
1082
|
config: e,
|
|
1076
1083
|
currentLocale: r,
|
|
1077
1084
|
defaultLocale: i,
|
|
1078
1085
|
allComponents: l,
|
|
1079
|
-
onUpdateConfig:
|
|
1086
|
+
onUpdateConfig: p
|
|
1080
1087
|
}) })
|
|
1081
1088
|
}, b.id);
|
|
1082
1089
|
}
|
|
@@ -1086,32 +1093,32 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
|
|
|
1086
1093
|
variant: "outlined",
|
|
1087
1094
|
className: "ignore-style-override",
|
|
1088
1095
|
onClick: () => {
|
|
1089
|
-
|
|
1090
|
-
var
|
|
1091
|
-
const
|
|
1092
|
-
b.properties ?? (b.properties = {}), (
|
|
1096
|
+
p((b) => {
|
|
1097
|
+
var x;
|
|
1098
|
+
const v = Ke();
|
|
1099
|
+
b.properties ?? (b.properties = {}), (x = b.properties)[v] ?? (x[v] = { index: (P == null ? void 0 : P.length) || 0, data: { id: v } });
|
|
1093
1100
|
});
|
|
1094
1101
|
},
|
|
1095
1102
|
startIcon: /* @__PURE__ */ t(Ge, {}),
|
|
1096
1103
|
children: a("addObject", { object: a("property") })
|
|
1097
1104
|
}),
|
|
1098
|
-
y && /* @__PURE__ */ t(it, { ...Ze(
|
|
1105
|
+
y && /* @__PURE__ */ t(it, { ...Ze(g), component: e })
|
|
1099
1106
|
] }) });
|
|
1100
1107
|
}
|
|
1101
1108
|
function fr({ property: e, allComponents: r }) {
|
|
1102
1109
|
const i = ke({ variant: "popper" });
|
|
1103
|
-
return /* @__PURE__ */ O(
|
|
1104
|
-
/* @__PURE__ */ t(E, { sx: { minWidth: 0 }, ...
|
|
1105
|
-
/* @__PURE__ */ t(xt, { ...Lt(i), children: /* @__PURE__ */ t(
|
|
1110
|
+
return /* @__PURE__ */ O(Z, { children: [
|
|
1111
|
+
/* @__PURE__ */ t(E, { sx: { minWidth: 0 }, ...Se(i), children: /* @__PURE__ */ t(Xe, { fontSize: "small" }) }),
|
|
1112
|
+
/* @__PURE__ */ t(xt, { ...Lt(i), children: /* @__PURE__ */ t(Dt, { onClickAway: i.close, children: /* @__PURE__ */ t(ee, { children: /* @__PURE__ */ t(j, { width: 500, p: 2, children: /* @__PURE__ */ t(Ie, {
|
|
1106
1113
|
value: e.componentId,
|
|
1107
|
-
onChange: (l,
|
|
1114
|
+
onChange: (l, p) => e.componentId = p,
|
|
1108
1115
|
allComponents: r
|
|
1109
1116
|
}) }) }) }) })
|
|
1110
1117
|
] });
|
|
1111
1118
|
}
|
|
1112
|
-
function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allComponents:
|
|
1113
|
-
var
|
|
1114
|
-
const [y, a] =
|
|
1119
|
+
function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allComponents: p }) {
|
|
1120
|
+
var v;
|
|
1121
|
+
const [y, a] = X(!1), { t: g, locale: P } = D(), b = typeof (e == null ? void 0 : e.componentId) == "string" ? (v = p[e.componentId]) == null ? void 0 : v.data : void 0;
|
|
1115
1122
|
return b ? /* @__PURE__ */ O(j, { sx: { width: "100%", position: "relative" }, children: [
|
|
1116
1123
|
/* @__PURE__ */ t(ae, {
|
|
1117
1124
|
sx: { minWidth: 0 },
|
|
@@ -1121,7 +1128,7 @@ function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allCom
|
|
|
1121
1128
|
color: y ? "primary" : "default",
|
|
1122
1129
|
children: /* @__PURE__ */ t(Xe, { fontSize: "small" })
|
|
1123
1130
|
}),
|
|
1124
|
-
y && /* @__PURE__ */ t(yt, { in: y, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ O(
|
|
1131
|
+
y && /* @__PURE__ */ t(yt, { in: y, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ O(ee, {
|
|
1125
1132
|
elevation: 1,
|
|
1126
1133
|
sx: {
|
|
1127
1134
|
mt: 1,
|
|
@@ -1134,92 +1141,92 @@ function hr({ value: e, valueImmutable: r, onChange: i, defaultLocale: l, allCom
|
|
|
1134
1141
|
children: [
|
|
1135
1142
|
/* @__PURE__ */ t(j, { width: "100%", mb: 2, children: /* @__PURE__ */ t(lt, {
|
|
1136
1143
|
config: b,
|
|
1137
|
-
currentLocale:
|
|
1144
|
+
currentLocale: P,
|
|
1138
1145
|
defaultLocale: l,
|
|
1139
|
-
allComponents:
|
|
1146
|
+
allComponents: p,
|
|
1140
1147
|
propertiesValue: e == null ? void 0 : e.properties,
|
|
1141
|
-
onChange: ({ id:
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1148
|
+
onChange: ({ id: x, value: o }) => {
|
|
1149
|
+
const s = jt(o.value), n = JSON.parse(JSON.stringify(e));
|
|
1150
|
+
n != null && n.componentId && (r ? i == null || i({ ...n, properties: { ...n.properties, [x]: { value: s } } }) : (n.properties = n.properties ?? {}, n.properties[x] = { value: s }, i == null || i(n)));
|
|
1144
1151
|
}
|
|
1145
1152
|
}) }),
|
|
1146
|
-
/* @__PURE__ */ t(E, { size: "small", onClick: () => a(!1), sx: { mt: 1 }, children:
|
|
1153
|
+
/* @__PURE__ */ t(E, { size: "small", onClick: () => a(!1), sx: { mt: 1 }, children: g("close") })
|
|
1147
1154
|
]
|
|
1148
1155
|
}) })
|
|
1149
1156
|
] }) : null;
|
|
1150
1157
|
}
|
|
1151
1158
|
function it({ type: e = "properties", component: r, ...i }) {
|
|
1152
|
-
var
|
|
1153
|
-
const { t: l } =
|
|
1159
|
+
var x, o, s;
|
|
1160
|
+
const { t: l } = D(), { state: { components: p, supportedLocales: y, config: { defaultLocale: a } } } = ce(), g = xe(), P = te(r).doc, b = e === "properties" ? r.properties : e === "parameters" && ((x = r.renderer) == null ? void 0 : x.type) === "component" ? (o = p[r.renderer.componentId]) == null ? void 0 : o.data.properties : void 0, v = ((s = r.renderer) == null ? void 0 : s.type) === "component" ? r : void 0;
|
|
1154
1161
|
return /* @__PURE__ */ O(Me, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
1155
1162
|
/* @__PURE__ */ t(ft, { children: l("i18nEditorTitle") }),
|
|
1156
1163
|
/* @__PURE__ */ t(ht, { children: b && /* @__PURE__ */ t(R, { children: /* @__PURE__ */ O(Be, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
1157
|
-
/* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(
|
|
1164
|
+
/* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(oe, { children: y.map(({ locale: n, name: d }) => /* @__PURE__ */ t(ne, { children: /* @__PURE__ */ O(B, { color: "text.primary", children: [
|
|
1158
1165
|
d,
|
|
1159
|
-
a ===
|
|
1160
|
-
] }) },
|
|
1161
|
-
/* @__PURE__ */ t(Je, { children: A(Object.values(b), "index").map(({ data:
|
|
1162
|
-
var
|
|
1163
|
-
return /* @__PURE__ */ t(
|
|
1166
|
+
a === n && /* @__PURE__ */ t(Ut, { sx: { fontSize: 12 } })
|
|
1167
|
+
] }) }, n)) }) }),
|
|
1168
|
+
/* @__PURE__ */ t(Je, { children: A(Object.values(b), "index").map(({ data: n }) => /* @__PURE__ */ t(oe, { children: y.map(({ locale: d }) => {
|
|
1169
|
+
var h, w, c, m, u, k, I, f, S, z, N, T, U, W, re, _, H, Y, q, L, Oe, je, Re, ze, Ne, Ve;
|
|
1170
|
+
return /* @__PURE__ */ t(ne, { children: /* @__PURE__ */ t(R, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(Z, { children: [
|
|
1164
1171
|
/* @__PURE__ */ t(V, {
|
|
1165
1172
|
size: "small",
|
|
1166
1173
|
label: "Key",
|
|
1167
|
-
value:
|
|
1174
|
+
value: n.key || "",
|
|
1168
1175
|
onChange: (F) => {
|
|
1169
|
-
|
|
1170
|
-
|
|
1176
|
+
P.transact(() => {
|
|
1177
|
+
n.key = F.target.value.trim();
|
|
1171
1178
|
});
|
|
1172
1179
|
}
|
|
1173
1180
|
}),
|
|
1174
1181
|
/* @__PURE__ */ t(V, {
|
|
1175
1182
|
size: "small",
|
|
1176
1183
|
label: l("label"),
|
|
1177
|
-
value: (((w = (
|
|
1184
|
+
value: (((w = (h = n.locales) == null ? void 0 : h[d]) == null ? void 0 : w.name) ?? ((m = (c = n.locales) == null ? void 0 : c[a]) == null ? void 0 : m.name)) || "",
|
|
1178
1185
|
onChange: (F) => {
|
|
1179
|
-
|
|
1186
|
+
P.transact(() => {
|
|
1180
1187
|
var K;
|
|
1181
|
-
|
|
1188
|
+
n.locales ?? (n.locales = {}), (K = n.locales)[d] ?? (K[d] = {}), n.locales[d].name = F.target.value;
|
|
1182
1189
|
});
|
|
1183
1190
|
}
|
|
1184
1191
|
}),
|
|
1185
|
-
/* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(
|
|
1186
|
-
allComponents:
|
|
1192
|
+
/* @__PURE__ */ t(j, { children: /* @__PURE__ */ t($, {
|
|
1193
|
+
allComponents: g,
|
|
1187
1194
|
defaultLocale: a,
|
|
1188
1195
|
component: r,
|
|
1189
|
-
property:
|
|
1196
|
+
property: n,
|
|
1190
1197
|
size: "small",
|
|
1191
1198
|
fullWidth: !0,
|
|
1192
1199
|
label: "Default Value",
|
|
1193
|
-
valueImmutable: se((
|
|
1194
|
-
value: ((
|
|
1200
|
+
valueImmutable: se((k = (u = n.locales) == null ? void 0 : u[d]) == null ? void 0 : k.defaultValue),
|
|
1201
|
+
value: ((f = (I = n.locales) == null ? void 0 : I[d]) == null ? void 0 : f.defaultValue) ?? ((z = (S = n.locales) == null ? void 0 : S[a]) == null ? void 0 : z.defaultValue),
|
|
1195
1202
|
onChange: (F) => {
|
|
1196
|
-
|
|
1203
|
+
P.transact(() => {
|
|
1197
1204
|
var K;
|
|
1198
|
-
|
|
1205
|
+
n.locales ?? (n.locales = {}), (K = n.locales)[d] ?? (K[d] = {}), n.locales[d].defaultValue = F;
|
|
1199
1206
|
});
|
|
1200
1207
|
}
|
|
1201
1208
|
}) })
|
|
1202
|
-
] }) : e === "parameters" &&
|
|
1203
|
-
allComponents:
|
|
1209
|
+
] }) : e === "parameters" && v ? /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t($, {
|
|
1210
|
+
allComponents: g,
|
|
1204
1211
|
defaultLocale: a,
|
|
1205
1212
|
component: r,
|
|
1206
|
-
property:
|
|
1213
|
+
property: n,
|
|
1207
1214
|
size: "small",
|
|
1208
1215
|
fullWidth: !0,
|
|
1209
|
-
valueImmutable: se((W = (U = (T = (N =
|
|
1210
|
-
value: ((Y = (H = (_ = (
|
|
1216
|
+
valueImmutable: se((W = (U = (T = (N = v.renderer.properties) == null ? void 0 : N[n.id]) == null ? void 0 : T.locales) == null ? void 0 : U[d]) == null ? void 0 : W.value),
|
|
1217
|
+
value: ((Y = (H = (_ = (re = v.renderer.properties) == null ? void 0 : re[n.id]) == null ? void 0 : _.locales) == null ? void 0 : H[d]) == null ? void 0 : Y.value) ?? ((je = (Oe = (L = (q = v.renderer.properties) == null ? void 0 : q[n.id]) == null ? void 0 : L.locales) == null ? void 0 : Oe[a]) == null ? void 0 : je.value) ?? ((ze = (Re = n.locales) == null ? void 0 : Re[d]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Ne = n.locales) == null ? void 0 : Ne[a]) == null ? void 0 : Ve.defaultValue),
|
|
1211
1218
|
onChange: (F) => {
|
|
1212
|
-
|
|
1213
|
-
var K,
|
|
1214
|
-
(K =
|
|
1219
|
+
P.transact(() => {
|
|
1220
|
+
var K, De, Ce, Ee, Ae;
|
|
1221
|
+
(K = v.renderer).properties ?? (K.properties = {}), (De = v.renderer.properties)[Ce = n.id] ?? (De[Ce] = {}), (Ee = v.renderer.properties[n.id]).locales ?? (Ee.locales = {}), (Ae = v.renderer.properties[n.id].locales)[d] ?? (Ae[d] = {}), v.renderer.properties[n.id].locales[d].value = F;
|
|
1215
1222
|
});
|
|
1216
1223
|
}
|
|
1217
|
-
}) }) : null },
|
|
1218
|
-
}) },
|
|
1224
|
+
}) }) : null }, n.id) }, d);
|
|
1225
|
+
}) }, n.id)) })
|
|
1219
1226
|
] }) }) }),
|
|
1220
|
-
/* @__PURE__ */ t(bt, { children: /* @__PURE__ */ t(E, { onClick: (
|
|
1227
|
+
/* @__PURE__ */ t(bt, { children: /* @__PURE__ */ t(E, { onClick: (n) => {
|
|
1221
1228
|
var d;
|
|
1222
|
-
return (d = i.onClose) == null ? void 0 : d.call(i,
|
|
1229
|
+
return (d = i.onClose) == null ? void 0 : d.call(i, n, "escapeKeyDown");
|
|
1223
1230
|
}, children: l("close") }) })
|
|
1224
1231
|
] });
|
|
1225
1232
|
}
|
|
@@ -1230,7 +1237,7 @@ const We = (e, r) => (i) => {
|
|
|
1230
1237
|
i.palette.secondary.main,
|
|
1231
1238
|
i.palette.success.main,
|
|
1232
1239
|
i.palette.warning.main
|
|
1233
|
-
],
|
|
1240
|
+
], p = Math.min(l.length - 1, e), y = l[p], a = pe(y, 0.5), g = pe(y, 1);
|
|
1234
1241
|
return {
|
|
1235
1242
|
// 保留原有的边框样式
|
|
1236
1243
|
borderColor: `${a} !important`,
|
|
@@ -1238,58 +1245,58 @@ const We = (e, r) => (i) => {
|
|
|
1238
1245
|
// 稍粗的左侧边框
|
|
1239
1246
|
borderLeftColor: a,
|
|
1240
1247
|
// 使用透明度适应深色/浅色模式
|
|
1241
|
-
color:
|
|
1248
|
+
color: g,
|
|
1242
1249
|
...r
|
|
1243
1250
|
};
|
|
1244
1251
|
};
|
|
1245
1252
|
function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
1246
|
-
const { t:
|
|
1253
|
+
const { t: p, locale: y } = D(), a = J(null), g = pr(a, e), P = C(() => {
|
|
1247
1254
|
if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
|
|
1248
1255
|
try {
|
|
1249
1256
|
let b = {};
|
|
1250
1257
|
A(Object.values(e.subProperties), "index").filter((o) => o.data.visible !== !1 && o.data.key).forEach(({ data: o }) => {
|
|
1251
|
-
var
|
|
1258
|
+
var n, d, h, w;
|
|
1252
1259
|
if (!o.key)
|
|
1253
1260
|
return;
|
|
1254
|
-
let
|
|
1261
|
+
let s = ((d = (n = o.locales) == null ? void 0 : n[y]) == null ? void 0 : d.defaultValue) ?? ((w = (h = o.locales) == null ? void 0 : h[i]) == null ? void 0 : w.defaultValue);
|
|
1255
1262
|
if (o.type === "number")
|
|
1256
|
-
|
|
1263
|
+
s = Number(s);
|
|
1257
1264
|
else if (o.type === "boolean")
|
|
1258
|
-
|
|
1259
|
-
else if ((o.type === "json" || o.type === "yaml") && typeof
|
|
1265
|
+
s = s === !0 || s === "true";
|
|
1266
|
+
else if ((o.type === "json" || o.type === "yaml") && typeof s == "string")
|
|
1260
1267
|
try {
|
|
1261
|
-
o.type === "json" ?
|
|
1268
|
+
o.type === "json" ? s = JSON.parse(s) : s = fe.parse(s);
|
|
1262
1269
|
} catch (c) {
|
|
1263
|
-
console.error("Error parsing nested value",
|
|
1270
|
+
console.error("Error parsing nested value", s, c), s = {};
|
|
1264
1271
|
}
|
|
1265
|
-
b[o.key] =
|
|
1266
|
-
}), e.type === "array" && !Array.isArray(b) && (b =
|
|
1267
|
-
const
|
|
1268
|
-
r == null || r(
|
|
1272
|
+
b[o.key] = s;
|
|
1273
|
+
}), e.type === "array" && !Array.isArray(b) && (b = Pe(b) ? [] : [b]);
|
|
1274
|
+
const x = ve(b, e.type);
|
|
1275
|
+
r == null || r(x);
|
|
1269
1276
|
} catch (b) {
|
|
1270
1277
|
console.error("Error converting structure to text:", b);
|
|
1271
1278
|
}
|
|
1272
1279
|
}, [e, y, i, r]);
|
|
1273
1280
|
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(R, { direction: "column", gap: 1.5, sx: { width: "100%" }, ref: a, children: [
|
|
1274
|
-
/* @__PURE__ */ t(vt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(B, { variant: "caption", color: "text.secondary", children:
|
|
1281
|
+
/* @__PURE__ */ t(vt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(B, { variant: "caption", color: "text.secondary", children: p("maker.properties.subProperties") }) }),
|
|
1275
1282
|
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ t(tt, {
|
|
1276
1283
|
component: R,
|
|
1277
1284
|
gap: 2,
|
|
1278
1285
|
list: e.subProperties,
|
|
1279
|
-
renderItem: (b,
|
|
1286
|
+
renderItem: (b, v, x) => {
|
|
1280
1287
|
const o = b.visible !== !1;
|
|
1281
|
-
return /* @__PURE__ */ t(
|
|
1288
|
+
return /* @__PURE__ */ t(ee, {
|
|
1282
1289
|
elevation: 0,
|
|
1283
1290
|
className: "property-container",
|
|
1284
1291
|
sx: {
|
|
1285
1292
|
p: 1.25,
|
|
1286
1293
|
borderRadius: 1,
|
|
1287
1294
|
border: o ? "1px solid" : "1px dashed",
|
|
1288
|
-
"&": We(
|
|
1295
|
+
"&": We(g)
|
|
1289
1296
|
},
|
|
1290
1297
|
children: /* @__PURE__ */ t(R, { gap: 2, children: /* @__PURE__ */ t(rt, {
|
|
1291
1298
|
data: b,
|
|
1292
|
-
params:
|
|
1299
|
+
params: x,
|
|
1293
1300
|
visible: o,
|
|
1294
1301
|
config: {
|
|
1295
1302
|
properties: e.subProperties
|
|
@@ -1297,23 +1304,23 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1297
1304
|
currentLocale: y,
|
|
1298
1305
|
defaultLocale: i,
|
|
1299
1306
|
allComponents: l,
|
|
1300
|
-
onUpdateConfig: (
|
|
1307
|
+
onUpdateConfig: (s) => {
|
|
1301
1308
|
try {
|
|
1302
|
-
const
|
|
1303
|
-
n
|
|
1309
|
+
const n = { properties: e.subProperties || {} };
|
|
1310
|
+
s(n);
|
|
1304
1311
|
const d = {
|
|
1305
1312
|
...e,
|
|
1306
|
-
subProperties:
|
|
1313
|
+
subProperties: n.properties
|
|
1307
1314
|
};
|
|
1308
|
-
r == null || r(d, { forceUpdateProperty: !0 }),
|
|
1309
|
-
} catch (
|
|
1310
|
-
console.error("Error updating property:",
|
|
1315
|
+
r == null || r(d, { forceUpdateProperty: !0 }), P();
|
|
1316
|
+
} catch (n) {
|
|
1317
|
+
console.error("Error updating property:", n);
|
|
1311
1318
|
}
|
|
1312
1319
|
}
|
|
1313
1320
|
}) })
|
|
1314
1321
|
}, b.id);
|
|
1315
1322
|
}
|
|
1316
|
-
}) : /* @__PURE__ */ t(de, { style: { fontSize: 12, height: 100 }, children:
|
|
1323
|
+
}) : /* @__PURE__ */ t(de, { style: { fontSize: 12, height: 100 }, children: p("maker.properties.noSubProperties") }),
|
|
1317
1324
|
/* @__PURE__ */ t(E, {
|
|
1318
1325
|
fullWidth: !0,
|
|
1319
1326
|
variant: "outlined",
|
|
@@ -1322,10 +1329,10 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1322
1329
|
startIcon: /* @__PURE__ */ t(Ge, {}),
|
|
1323
1330
|
onClick: () => {
|
|
1324
1331
|
try {
|
|
1325
|
-
const b = e.subProperties || {},
|
|
1332
|
+
const b = e.subProperties || {}, v = Ke(), o = {
|
|
1326
1333
|
index: Object.values(b).length,
|
|
1327
1334
|
data: {
|
|
1328
|
-
id:
|
|
1335
|
+
id: v,
|
|
1329
1336
|
key: "",
|
|
1330
1337
|
type: "string",
|
|
1331
1338
|
visible: !0,
|
|
@@ -1338,62 +1345,62 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1338
1345
|
// 为嵌套属性预初始化
|
|
1339
1346
|
subProperties: {}
|
|
1340
1347
|
}
|
|
1341
|
-
},
|
|
1348
|
+
}, s = {
|
|
1342
1349
|
...e,
|
|
1343
1350
|
subProperties: {
|
|
1344
1351
|
...b,
|
|
1345
|
-
[
|
|
1352
|
+
[v]: o
|
|
1346
1353
|
}
|
|
1347
1354
|
};
|
|
1348
|
-
r == null || r(
|
|
1355
|
+
r == null || r(s, { forceUpdateProperty: !0 }), P();
|
|
1349
1356
|
} catch (b) {
|
|
1350
1357
|
console.error("Error adding property:", b);
|
|
1351
1358
|
}
|
|
1352
1359
|
},
|
|
1353
1360
|
sx: {
|
|
1354
|
-
"&": We(
|
|
1361
|
+
"&": We(g, {
|
|
1355
1362
|
// borderLeft: undefined,
|
|
1356
1363
|
})
|
|
1357
1364
|
},
|
|
1358
|
-
children:
|
|
1365
|
+
children: p("maker.properties.addSubProperty")
|
|
1359
1366
|
})
|
|
1360
1367
|
] });
|
|
1361
1368
|
}
|
|
1362
|
-
function
|
|
1363
|
-
var
|
|
1364
|
-
const { locale:
|
|
1365
|
-
var
|
|
1366
|
-
const c = (
|
|
1367
|
-
c == null || c.open(),
|
|
1368
|
-
var
|
|
1369
|
-
let
|
|
1370
|
-
|
|
1369
|
+
function $({ component: e, property: r, value: i, onChange: l, valueImmutable: p, defaultLocale: y, allComponents: a, ...g }) {
|
|
1370
|
+
var s, n, d, h, w;
|
|
1371
|
+
const { locale: P } = D(), b = St(), v = J(null), x = () => {
|
|
1372
|
+
var m;
|
|
1373
|
+
const c = (m = b == null ? void 0 : b.current) == null ? void 0 : m.getUploader();
|
|
1374
|
+
c == null || c.open(), v.current && c.onceUploadSuccess(({ response: u }) => {
|
|
1375
|
+
var I, f;
|
|
1376
|
+
let k = ((I = u == null ? void 0 : u.data) == null ? void 0 : I.filename) || "";
|
|
1377
|
+
k && (k = `mediakit://${k}`, i && !i.includes("mediakit://") && (k += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (f = v.current) == null || f.call(v, k);
|
|
1371
1378
|
});
|
|
1372
|
-
}, o =
|
|
1379
|
+
}, o = g.label ?? (((n = (s = r.locales) == null ? void 0 : s[P]) == null ? void 0 : n.name) || ((h = (d = r.locales) == null ? void 0 : d[y]) == null ? void 0 : h.name) || r.key || r.id);
|
|
1373
1380
|
if (r.type === "number")
|
|
1374
1381
|
return /* @__PURE__ */ t(yr, {
|
|
1375
|
-
...
|
|
1382
|
+
...g,
|
|
1376
1383
|
label: o,
|
|
1377
1384
|
NumberProps: {
|
|
1378
1385
|
value: ["number", "string"].includes(typeof i) ? i : null,
|
|
1379
|
-
onChange: (c,
|
|
1386
|
+
onChange: (c, m) => l == null ? void 0 : l(m)
|
|
1380
1387
|
}
|
|
1381
1388
|
});
|
|
1382
1389
|
if (r.type === "decimal")
|
|
1383
1390
|
return /* @__PURE__ */ t(V, {
|
|
1384
|
-
...
|
|
1391
|
+
...g,
|
|
1385
1392
|
label: o,
|
|
1386
1393
|
type: "text",
|
|
1387
1394
|
value: i ?? "",
|
|
1388
1395
|
onChange: (c) => {
|
|
1389
|
-
const
|
|
1390
|
-
if (
|
|
1391
|
-
l == null || l(
|
|
1396
|
+
const m = c.target.value;
|
|
1397
|
+
if (m === "" || m === "-") {
|
|
1398
|
+
l == null || l(m);
|
|
1392
1399
|
return;
|
|
1393
1400
|
}
|
|
1394
|
-
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(
|
|
1395
|
-
let
|
|
1396
|
-
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(
|
|
1401
|
+
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(m)) {
|
|
1402
|
+
let k = m;
|
|
1403
|
+
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(k) && (k = Number(k)), l == null || l(k);
|
|
1397
1404
|
}
|
|
1398
1405
|
}
|
|
1399
1406
|
});
|
|
@@ -1401,7 +1408,7 @@ function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1401
1408
|
return /* @__PURE__ */ t(pt, {
|
|
1402
1409
|
label: o,
|
|
1403
1410
|
labelPlacement: "start",
|
|
1404
|
-
control: /* @__PURE__ */ t(mt, { checked: i === !0, onChange: (c,
|
|
1411
|
+
control: /* @__PURE__ */ t(mt, { checked: i === !0, onChange: (c, m) => l == null ? void 0 : l(m) })
|
|
1405
1412
|
});
|
|
1406
1413
|
if (r.type === "color")
|
|
1407
1414
|
return /* @__PURE__ */ t(ir, {
|
|
@@ -1422,9 +1429,9 @@ function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1422
1429
|
component: e,
|
|
1423
1430
|
defaultLocale: y,
|
|
1424
1431
|
allComponents: a,
|
|
1425
|
-
PropertyValueField:
|
|
1432
|
+
PropertyValueField: $,
|
|
1426
1433
|
onUpload: (c) => {
|
|
1427
|
-
|
|
1434
|
+
v.current = c, x();
|
|
1428
1435
|
}
|
|
1429
1436
|
});
|
|
1430
1437
|
if (r.type === "custom") {
|
|
@@ -1432,27 +1439,27 @@ function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1432
1439
|
return c ? /* @__PURE__ */ t(j, { width: "100%", children: /* @__PURE__ */ t(qe, {
|
|
1433
1440
|
componentId: c.id,
|
|
1434
1441
|
props: { label: o, value: i, onChange: l },
|
|
1435
|
-
locale:
|
|
1442
|
+
locale: P,
|
|
1436
1443
|
dev: {
|
|
1437
1444
|
mode: "draft",
|
|
1438
1445
|
components: a,
|
|
1439
1446
|
defaultLocale: y
|
|
1440
1447
|
}
|
|
1441
|
-
}) }) : /* @__PURE__ */ t(V, { ...
|
|
1448
|
+
}) }) : /* @__PURE__ */ t(V, { ...g, label: o, disabled: !0, placeholder: "Click right button select a component" });
|
|
1442
1449
|
}
|
|
1443
1450
|
if (r.type === "component")
|
|
1444
1451
|
return /* @__PURE__ */ O(R, { width: "100%", direction: "column", gap: 1, children: [
|
|
1445
|
-
/* @__PURE__ */ t(
|
|
1452
|
+
/* @__PURE__ */ t(Ie, {
|
|
1446
1453
|
allComponents: a,
|
|
1447
1454
|
label: o,
|
|
1448
1455
|
value: i == null ? void 0 : i.componentId,
|
|
1449
|
-
onChange: (c,
|
|
1450
|
-
|
|
1456
|
+
onChange: (c, m) => {
|
|
1457
|
+
p || !i ? l == null || l({ ...i && JSON.parse(JSON.stringify(i)), componentId: m }) : typeof i == "object" && (i.componentId = m, l == null || l({ ...i && JSON.parse(JSON.stringify(i)), componentId: m }));
|
|
1451
1458
|
}
|
|
1452
1459
|
}),
|
|
1453
1460
|
(i == null ? void 0 : i.componentId) && /* @__PURE__ */ t(hr, {
|
|
1454
1461
|
value: i,
|
|
1455
|
-
valueImmutable:
|
|
1462
|
+
valueImmutable: p,
|
|
1456
1463
|
onChange: l,
|
|
1457
1464
|
defaultLocale: y,
|
|
1458
1465
|
allComponents: a
|
|
@@ -1461,33 +1468,33 @@ function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1461
1468
|
if (!r.type || ["string", "url", "multiline"].includes(r.type)) {
|
|
1462
1469
|
let c = r.type === "string" ? r.multiline : void 0;
|
|
1463
1470
|
r.type === "multiline" && (c = !0);
|
|
1464
|
-
const
|
|
1471
|
+
const m = r.type === "url" ? i == null ? void 0 : i.url : i;
|
|
1465
1472
|
return /* @__PURE__ */ t(V, {
|
|
1466
|
-
...
|
|
1473
|
+
...g,
|
|
1467
1474
|
label: o,
|
|
1468
|
-
value: typeof
|
|
1475
|
+
value: typeof m == "string" ? m : "",
|
|
1469
1476
|
multiline: c,
|
|
1470
1477
|
minRows: c ? 2 : void 0,
|
|
1471
1478
|
maxRows: c ? 10 : void 0,
|
|
1472
|
-
onChange: (
|
|
1479
|
+
onChange: (u) => l == null ? void 0 : l(r.type === "url" ? { ...i, url: u.target.value, mediaKitUrl: u.target.value } : u.target.value),
|
|
1473
1480
|
InputProps: r.type === "url" ? {
|
|
1474
1481
|
sx: {
|
|
1475
1482
|
pr: 0
|
|
1476
1483
|
},
|
|
1477
|
-
endAdornment: /* @__PURE__ */ O(
|
|
1484
|
+
endAdornment: /* @__PURE__ */ O(we, { position: "end", children: [
|
|
1478
1485
|
/* @__PURE__ */ t(Ye, {
|
|
1479
|
-
onChange: async ({ response:
|
|
1480
|
-
var
|
|
1481
|
-
const
|
|
1482
|
-
let
|
|
1483
|
-
|
|
1486
|
+
onChange: async ({ response: u }) => {
|
|
1487
|
+
var S, z, N;
|
|
1488
|
+
const k = ((S = u == null ? void 0 : u.data) == null ? void 0 : S.url) || ((z = u == null ? void 0 : u.data) == null ? void 0 : z.fileUrl);
|
|
1489
|
+
let I;
|
|
1490
|
+
k && (I = await It(k).catch(() => Ot(k)).catch(() => {
|
|
1484
1491
|
}));
|
|
1485
|
-
let
|
|
1486
|
-
|
|
1487
|
-
url:
|
|
1488
|
-
mediaKitUrl:
|
|
1489
|
-
width:
|
|
1490
|
-
height:
|
|
1492
|
+
let f = ((N = u == null ? void 0 : u.data) == null ? void 0 : N.filename) || "";
|
|
1493
|
+
f && (f = `mediakit://${f}`), l == null || l({
|
|
1494
|
+
url: k,
|
|
1495
|
+
mediaKitUrl: f,
|
|
1496
|
+
width: I == null ? void 0 : I.naturalWidth,
|
|
1497
|
+
height: I == null ? void 0 : I.naturalHeight
|
|
1491
1498
|
});
|
|
1492
1499
|
}
|
|
1493
1500
|
}),
|
|
@@ -1501,19 +1508,19 @@ function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1501
1508
|
value: Array.isArray(i) ? i : [],
|
|
1502
1509
|
onChange: (c) => l == null ? void 0 : l(c),
|
|
1503
1510
|
property: r,
|
|
1504
|
-
renderItem: ({ item: c, index:
|
|
1511
|
+
renderItem: ({ item: c, index: m, onChange: u }) => r.subProperties && Object.keys(r.subProperties).length > 0 ? /* @__PURE__ */ t(R, { gap: 1, width: "100%", children: A(Object.values(r.subProperties), "index").filter((k) => k.data.visible !== !1).map(({ data: k }) => k.key ? /* @__PURE__ */ t($, {
|
|
1505
1512
|
component: e,
|
|
1506
|
-
property:
|
|
1507
|
-
value: c[
|
|
1508
|
-
onChange: (
|
|
1509
|
-
const
|
|
1510
|
-
f
|
|
1513
|
+
property: k,
|
|
1514
|
+
value: c[k.key],
|
|
1515
|
+
onChange: (I) => {
|
|
1516
|
+
const f = { ...c, [k.key]: I };
|
|
1517
|
+
u(f);
|
|
1511
1518
|
},
|
|
1512
1519
|
size: "small",
|
|
1513
1520
|
fullWidth: !0,
|
|
1514
1521
|
defaultLocale: y,
|
|
1515
1522
|
allComponents: a
|
|
1516
|
-
},
|
|
1523
|
+
}, k.id) : null) }, m) : /* @__PURE__ */ t(V, { size: g.size, fullWidth: !0, value: c, onChange: (k) => u(k.target.value) })
|
|
1517
1524
|
}) : (console.error("Unsupported property type", r.type), null);
|
|
1518
1525
|
}
|
|
1519
1526
|
function yr({ NumberProps: e, ...r }) {
|
|
@@ -1532,10 +1539,10 @@ export default function () {
|
|
|
1532
1539
|
}`, xr = `console.log('hello')
|
|
1533
1540
|
`;
|
|
1534
1541
|
function gr({ value: e }) {
|
|
1535
|
-
const { locale: r } =
|
|
1536
|
-
return
|
|
1537
|
-
var
|
|
1538
|
-
(
|
|
1542
|
+
const { locale: r } = D(), i = _e(), l = te(e).doc;
|
|
1543
|
+
return M(() => {
|
|
1544
|
+
var p;
|
|
1545
|
+
(p = e.renderer) != null && p.script || (l.transact(() => {
|
|
1539
1546
|
e.renderer.script = e.renderer.type === "react-component" ? vr : xr;
|
|
1540
1547
|
}), i());
|
|
1541
1548
|
}, [e]), /* @__PURE__ */ t(j, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ t(ge, {
|
|
@@ -1543,172 +1550,172 @@ function gr({ value: e }) {
|
|
|
1543
1550
|
locale: r,
|
|
1544
1551
|
language: "typescript",
|
|
1545
1552
|
value: e.renderer.script || "",
|
|
1546
|
-
onChange: (
|
|
1553
|
+
onChange: (p) => e.renderer.script = p,
|
|
1547
1554
|
typeScriptNoValidation: !1,
|
|
1548
1555
|
fullScreenOptions: {
|
|
1549
1556
|
enableEscExit: !0
|
|
1550
1557
|
}
|
|
1551
1558
|
}, e.id) });
|
|
1552
1559
|
}
|
|
1553
|
-
function
|
|
1554
|
-
var
|
|
1555
|
-
const { t: r } =
|
|
1560
|
+
function wr({ value: e }) {
|
|
1561
|
+
var v, x, o;
|
|
1562
|
+
const { t: r } = D(), i = te(e).doc, { state: { components: l, config: { defaultLocale: p }, resources: y }, localState: { currentLocale: a } } = ce(), g = xe(), P = ((v = l[e.renderer.componentId]) == null ? void 0 : v.data) ?? ((o = (x = y.components) == null ? void 0 : x[e.renderer.componentId]) == null ? void 0 : o.component), b = ke({ variant: "dialog" });
|
|
1556
1563
|
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 1, children: [
|
|
1557
|
-
/* @__PURE__ */ t(
|
|
1558
|
-
allComponents:
|
|
1564
|
+
/* @__PURE__ */ t(Ie, {
|
|
1565
|
+
allComponents: g,
|
|
1559
1566
|
excludes: [e.id],
|
|
1560
1567
|
value: e.renderer.componentId,
|
|
1561
|
-
onChange: (
|
|
1568
|
+
onChange: (s, n) => e.renderer.componentId = n
|
|
1562
1569
|
}),
|
|
1563
|
-
|
|
1570
|
+
P && /* @__PURE__ */ O(Z, { children: [
|
|
1564
1571
|
/* @__PURE__ */ O(R, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
1565
1572
|
/* @__PURE__ */ t(B, { variant: "subtitle2", children: r("parameters") }),
|
|
1566
|
-
/* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...
|
|
1573
|
+
/* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Se(b), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
|
|
1567
1574
|
] }),
|
|
1568
|
-
|
|
1569
|
-
var
|
|
1570
|
-
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(
|
|
1571
|
-
allComponents:
|
|
1572
|
-
defaultLocale:
|
|
1573
|
-
component:
|
|
1574
|
-
property:
|
|
1575
|
+
P.properties && A(Object.values(P.properties), "index").map(({ data: s }) => {
|
|
1576
|
+
var n, d, h, w, c, m, u, k, I, f, S, z, N, T, U, W;
|
|
1577
|
+
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t($, {
|
|
1578
|
+
allComponents: g,
|
|
1579
|
+
defaultLocale: p,
|
|
1580
|
+
component: P,
|
|
1581
|
+
property: s,
|
|
1575
1582
|
fullWidth: !0,
|
|
1576
1583
|
size: "small",
|
|
1577
|
-
valueImmutable: se((w = (
|
|
1578
|
-
value: ((
|
|
1579
|
-
onChange: (
|
|
1584
|
+
valueImmutable: se((w = (h = (d = (n = e.renderer.properties) == null ? void 0 : n[s.id]) == null ? void 0 : d.locales) == null ? void 0 : h[a]) == null ? void 0 : w.value),
|
|
1585
|
+
value: ((k = (u = (m = (c = e.renderer.properties) == null ? void 0 : c[s.id]) == null ? void 0 : m.locales) == null ? void 0 : u[a]) == null ? void 0 : k.value) ?? ((z = (S = (f = (I = e.renderer.properties) == null ? void 0 : I[s.id]) == null ? void 0 : f.locales) == null ? void 0 : S[p]) == null ? void 0 : z.value) ?? ((T = (N = s.locales) == null ? void 0 : N[a]) == null ? void 0 : T.defaultValue) ?? ((W = (U = s.locales) == null ? void 0 : U[p]) == null ? void 0 : W.defaultValue),
|
|
1586
|
+
onChange: (re) => {
|
|
1580
1587
|
i.transact(() => {
|
|
1581
1588
|
var _, H, Y, q, L;
|
|
1582
|
-
(_ = e.renderer).properties ?? (_.properties = {}), (H = e.renderer.properties)[Y =
|
|
1589
|
+
(_ = e.renderer).properties ?? (_.properties = {}), (H = e.renderer.properties)[Y = s.id] ?? (H[Y] = {}), (q = e.renderer.properties[s.id]).locales ?? (q.locales = {}), (L = e.renderer.properties[s.id].locales)[a] ?? (L[a] = {}), e.renderer.properties[s.id].locales[a].value = re;
|
|
1583
1590
|
});
|
|
1584
1591
|
}
|
|
1585
|
-
}) },
|
|
1592
|
+
}) }, s.id);
|
|
1586
1593
|
}),
|
|
1587
1594
|
/* @__PURE__ */ t(it, { ...Ze(b), component: e, type: "parameters" })
|
|
1588
1595
|
] })
|
|
1589
1596
|
] }) });
|
|
1590
1597
|
}
|
|
1591
|
-
function
|
|
1592
|
-
var
|
|
1593
|
-
const { t:
|
|
1598
|
+
function Ie({ label: e, options: r, excludes: i, value: l, onChange: p, allComponents: y, ...a }) {
|
|
1599
|
+
var v;
|
|
1600
|
+
const { t: g } = D(), P = r ?? A(Object.values(Ht(y, ...i ?? [])), "index").map((x) => x.data), b = (typeof l == "string" ? (v = y[l]) == null ? void 0 : v.data : void 0) ?? null;
|
|
1594
1601
|
return /* @__PURE__ */ t($e, {
|
|
1595
1602
|
...a,
|
|
1596
1603
|
size: "small",
|
|
1597
|
-
options:
|
|
1604
|
+
options: P,
|
|
1598
1605
|
autoHighlight: !0,
|
|
1599
|
-
isOptionEqualToValue: (
|
|
1600
|
-
getOptionKey: (
|
|
1601
|
-
getOptionLabel: (
|
|
1602
|
-
renderInput: (
|
|
1606
|
+
isOptionEqualToValue: (x, o) => x.id === o.id,
|
|
1607
|
+
getOptionKey: (x) => x.id,
|
|
1608
|
+
getOptionLabel: (x) => x.name || x.id,
|
|
1609
|
+
renderInput: (x) => /* @__PURE__ */ t(V, { label: e || g("component"), ...x }),
|
|
1603
1610
|
value: b,
|
|
1604
|
-
onChange: (
|
|
1605
|
-
var
|
|
1606
|
-
let
|
|
1607
|
-
o && (
|
|
1608
|
-
blockletId: (
|
|
1611
|
+
onChange: (x, o) => {
|
|
1612
|
+
var n, d, h, w, c, m;
|
|
1613
|
+
let s = {};
|
|
1614
|
+
o && (s = {
|
|
1615
|
+
blockletId: (n = y[o == null ? void 0 : o.id]) == null ? void 0 : n.blockletId,
|
|
1609
1616
|
blockletTitle: (d = y[o == null ? void 0 : o.id]) == null ? void 0 : d.blockletTitle,
|
|
1610
|
-
componentName: ((w = (
|
|
1611
|
-
}),
|
|
1617
|
+
componentName: ((w = (h = y[o == null ? void 0 : o.id]) == null ? void 0 : h.data) == null ? void 0 : w.name) || ((m = (c = y[o == null ? void 0 : o.id]) == null ? void 0 : c.data) == null ? void 0 : m.id)
|
|
1618
|
+
}), p == null || p(x, o == null ? void 0 : o.id, s);
|
|
1612
1619
|
}
|
|
1613
1620
|
});
|
|
1614
1621
|
}
|
|
1615
|
-
function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l, currentLocale:
|
|
1616
|
-
const { t:
|
|
1617
|
-
|
|
1622
|
+
function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l, currentLocale: p, onChange: y, props: a }) {
|
|
1623
|
+
const { t: g } = D(), [P, b] = X(e == null ? void 0 : e.properties), [v, x] = X(null);
|
|
1624
|
+
M(() => {
|
|
1618
1625
|
(() => {
|
|
1619
1626
|
var w, c;
|
|
1620
|
-
((w = e == null ? void 0 : e.renderer) == null ? void 0 : w.type) === "react-component" &&
|
|
1621
|
-
const
|
|
1622
|
-
b(
|
|
1627
|
+
((w = e == null ? void 0 : e.renderer) == null ? void 0 : w.type) === "react-component" && Pe(e == null ? void 0 : e.properties) ? Rt((c = e == null ? void 0 : e.renderer) == null ? void 0 : c.script).then((m) => {
|
|
1628
|
+
const u = zt(m);
|
|
1629
|
+
b(u);
|
|
1623
1630
|
}) : b(e == null ? void 0 : e.properties);
|
|
1624
1631
|
})();
|
|
1625
1632
|
}, [JSON.stringify(e)]);
|
|
1626
|
-
const o =
|
|
1627
|
-
var
|
|
1633
|
+
const o = C(() => !e || !P ? {} : Object.values(P).reduce((h, { data: w }) => {
|
|
1634
|
+
var m, u, k, I, f;
|
|
1628
1635
|
const c = w.key || w.id;
|
|
1629
|
-
return
|
|
1636
|
+
return h[w.id] = {
|
|
1630
1637
|
key: c,
|
|
1631
|
-
value: (a == null ? void 0 : a[c]) ?? ((
|
|
1638
|
+
value: (a == null ? void 0 : a[c]) ?? ((m = l == null ? void 0 : l[w.id]) == null ? void 0 : m.value) ?? ((k = (u = w.locales) == null ? void 0 : u[p]) == null ? void 0 : k.defaultValue) ?? ((f = (I = w.locales) == null ? void 0 : I[i]) == null ? void 0 : f.defaultValue),
|
|
1632
1639
|
id: w.id,
|
|
1633
1640
|
type: w.type
|
|
1634
|
-
},
|
|
1635
|
-
}, {}), [JSON.stringify(
|
|
1636
|
-
if (!
|
|
1641
|
+
}, h;
|
|
1642
|
+
}, {}), [JSON.stringify(P), e, l, p, i]), s = Q(() => {
|
|
1643
|
+
if (!P)
|
|
1637
1644
|
return {
|
|
1638
1645
|
canUseProperties: [],
|
|
1639
1646
|
visibleProperties: [],
|
|
1640
1647
|
canUsePropertiesKeys: []
|
|
1641
1648
|
};
|
|
1642
|
-
const
|
|
1649
|
+
const h = A(Object.values(P), "index"), w = h.filter(({ data: u }) => u.key && ye(P, u.id)), c = h.filter(({ data: u }) => u.key && u.type !== "component"), m = c.map(({ data: u }) => u.key);
|
|
1643
1650
|
return {
|
|
1644
1651
|
canUseProperties: c,
|
|
1645
1652
|
visibleProperties: w,
|
|
1646
|
-
canUsePropertiesKeys:
|
|
1653
|
+
canUsePropertiesKeys: m
|
|
1647
1654
|
};
|
|
1648
|
-
}, [JSON.stringify(
|
|
1655
|
+
}, [JSON.stringify(P)]), n = o(), d = _t(n, "key");
|
|
1649
1656
|
return /* @__PURE__ */ t(ue, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
1650
|
-
/* @__PURE__ */ t(B, { variant: "subtitle1", children:
|
|
1651
|
-
!e ||
|
|
1652
|
-
/* @__PURE__ */ t(R, { gap: 2, children:
|
|
1657
|
+
/* @__PURE__ */ t(B, { variant: "subtitle1", children: g("maker.properties.parameters") }),
|
|
1658
|
+
!e || s.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ t(de, { style: { fontSize: 12 }, children: g("maker.properties.noParameters") }) : /* @__PURE__ */ O(Z, { children: [
|
|
1659
|
+
/* @__PURE__ */ t(R, { gap: 2, children: s.visibleProperties.map(({ data: h }) => {
|
|
1653
1660
|
var w, c;
|
|
1654
|
-
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(
|
|
1661
|
+
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t($, {
|
|
1655
1662
|
allComponents: r,
|
|
1656
1663
|
defaultLocale: i,
|
|
1657
1664
|
size: "small",
|
|
1658
1665
|
fullWidth: !0,
|
|
1659
1666
|
component: e,
|
|
1660
|
-
property:
|
|
1661
|
-
valueImmutable: se((w = l == null ? void 0 : l[
|
|
1662
|
-
value: (a == null ? void 0 : a[
|
|
1663
|
-
onChange: (
|
|
1667
|
+
property: h,
|
|
1668
|
+
valueImmutable: se((w = l == null ? void 0 : l[h.id]) == null ? void 0 : w.value),
|
|
1669
|
+
value: (a == null ? void 0 : a[h.key || h.id]) ?? ((c = n[h.id]) == null ? void 0 : c.value),
|
|
1670
|
+
onChange: (m) => {
|
|
1664
1671
|
y({
|
|
1665
|
-
path: ["properties",
|
|
1666
|
-
id:
|
|
1667
|
-
value: { value:
|
|
1668
|
-
shouldSync: Ue(
|
|
1672
|
+
path: ["properties", h.id],
|
|
1673
|
+
id: h.id,
|
|
1674
|
+
value: { value: m },
|
|
1675
|
+
shouldSync: Ue(h),
|
|
1669
1676
|
excludeKeys: [],
|
|
1670
|
-
key:
|
|
1677
|
+
key: h.key || h.id
|
|
1671
1678
|
});
|
|
1672
1679
|
}
|
|
1673
|
-
}) },
|
|
1680
|
+
}) }, h.id);
|
|
1674
1681
|
}) }),
|
|
1675
1682
|
/* @__PURE__ */ t(R, { gap: 2, sx: { width: "100%" }, children: /* @__PURE__ */ t(qe, {
|
|
1676
1683
|
componentId: (e == null ? void 0 : e.id) || "",
|
|
1677
1684
|
renderType: "setting",
|
|
1678
|
-
locale:
|
|
1679
|
-
properties:
|
|
1685
|
+
locale: p,
|
|
1686
|
+
properties: n,
|
|
1680
1687
|
dev: { mode: "draft", components: r, defaultLocale: i },
|
|
1681
1688
|
props: {
|
|
1682
|
-
...Yt(a ?? {},
|
|
1683
|
-
onChange: (
|
|
1684
|
-
const { canUsePropertiesKeys: w } =
|
|
1685
|
-
Object.keys(
|
|
1686
|
-
var
|
|
1687
|
-
return !Mt(m
|
|
1688
|
-
}).filter((
|
|
1689
|
-
var
|
|
1690
|
-
return !(
|
|
1691
|
-
}).reduce((
|
|
1692
|
-
const
|
|
1693
|
-
if (
|
|
1689
|
+
...Yt(a ?? {}, s.canUsePropertiesKeys),
|
|
1690
|
+
onChange: (h) => {
|
|
1691
|
+
const { canUsePropertiesKeys: w } = s;
|
|
1692
|
+
Object.keys(h).filter((m) => {
|
|
1693
|
+
var u;
|
|
1694
|
+
return !Mt(h[m], (u = d == null ? void 0 : d[m]) == null ? void 0 : u.value);
|
|
1695
|
+
}).filter((m) => {
|
|
1696
|
+
var u, k, I, f;
|
|
1697
|
+
return !(m === "locale" && !Jt(d[m], "locale") || ((u = d[m]) == null ? void 0 : u.type) === "component" || (((k = d[m]) == null ? void 0 : k.type) === "yaml" || ((I = d[m]) == null ? void 0 : I.type) === "json") && ye(P, (f = d[m]) == null ? void 0 : f.id));
|
|
1698
|
+
}).reduce((m, u) => m.then(() => {
|
|
1699
|
+
const k = d[u], I = w.includes(u);
|
|
1700
|
+
if (k != null && k.id && I)
|
|
1694
1701
|
return y({
|
|
1695
|
-
path: ["properties",
|
|
1696
|
-
id:
|
|
1697
|
-
value: { value:
|
|
1698
|
-
shouldSync: Ue(
|
|
1702
|
+
path: ["properties", k.id],
|
|
1703
|
+
id: k.id,
|
|
1704
|
+
value: { value: h[u] },
|
|
1705
|
+
shouldSync: Ue(k),
|
|
1699
1706
|
excludeKeys: [],
|
|
1700
|
-
key:
|
|
1707
|
+
key: k.key || k.id
|
|
1701
1708
|
}), Promise.resolve();
|
|
1702
|
-
const
|
|
1703
|
-
if (
|
|
1709
|
+
const f = `propertyNotFound${u}`;
|
|
1710
|
+
if (v === f)
|
|
1704
1711
|
return Promise.resolve();
|
|
1705
|
-
he.close(
|
|
1706
|
-
const
|
|
1707
|
-
key:
|
|
1712
|
+
he.close(v);
|
|
1713
|
+
const S = he.warning(g("maker.properties.propertyNotFound", {
|
|
1714
|
+
key: u
|
|
1708
1715
|
}), {
|
|
1709
|
-
key:
|
|
1716
|
+
key: f
|
|
1710
1717
|
});
|
|
1711
|
-
return
|
|
1718
|
+
return x(S), Promise.resolve();
|
|
1712
1719
|
}), Promise.resolve());
|
|
1713
1720
|
}
|
|
1714
1721
|
}
|
|
@@ -1718,11 +1725,11 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1718
1725
|
}
|
|
1719
1726
|
export {
|
|
1720
1727
|
ur as BasicInfo,
|
|
1721
|
-
|
|
1728
|
+
Ie as CustomComponentAutocomplete,
|
|
1722
1729
|
ci as CustomComponentSettings,
|
|
1723
1730
|
vr as DefaultReactComponentScriptTemplate,
|
|
1724
1731
|
xr as DefaultWebComponentScriptTemplate,
|
|
1725
1732
|
lt as ParametersConfig,
|
|
1726
1733
|
mr as PropertiesConfig,
|
|
1727
|
-
|
|
1734
|
+
$ as PropertyValueField
|
|
1728
1735
|
};
|