@blocklet/pages-kit-inner-components 0.6.59 → 0.6.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/add-component.js +1 -1
- package/lib/cjs/chunks/{draft-data-Bhf423Y1.js → draft-data-DfZ81oCU.js} +1 -1
- package/lib/cjs/chunks/{home-2t0FjInN.js → home-gw0__LTx.js} +2 -2
- package/lib/cjs/chunks/{index-BwUYb5CK.js → index-DE9KwERm.js} +1 -1
- package/lib/cjs/chunks/{publish-button-BFUtnsXK.js → publish-button-Dyb0OEO7.js} +1 -1
- package/lib/cjs/chunks/{site-state-BfeN81ZD.js → site-state-BRYYpS9Q.js} +1 -1
- package/lib/cjs/chunks/{state-DH94MEh-.js → state-BP5DoD6I.js} +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +2 -2
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +2 -2
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/add-component.js +2 -2
- package/lib/es/chunks/{draft-data-oEuh4Tps.js → draft-data-BtzZ0_tq.js} +1 -1
- package/lib/es/chunks/{home-DUJ_lpjz.js → home-DlOdSXsa.js} +3 -3
- package/lib/es/chunks/{index-D06Hm7OJ.js → index-4Fpt-5aq.js} +1 -1
- package/lib/es/chunks/{publish-button-CDFjcpWg.js → publish-button-DL1vj8rF.js} +3 -3
- package/lib/es/chunks/{site-state-CVKixevr.js → site-state-DYm1fKT3.js} +3 -2
- package/lib/es/chunks/{state-DdT-7UdS.js → state-Biqa_a5U.js} +3 -2
- package/lib/es/home.js +3 -3
- package/lib/es/locales.js +4 -0
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +902 -885
- package/lib/es/site-state.js +1 -1
- package/package.json +12 -12
package/lib/es/setting.js
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { Box as P, Alert as
|
|
3
|
-
import { t as xe, f as
|
|
1
|
+
import { jsx as r, jsxs as C, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { Box as P, Alert as Ze, Typography as A, TextField as V, Stack as k, FormLabel as ee, TableContainer as er, Paper as _, Table as ze, TableHead as je, TableRow as re, TableCell as te, TableBody as Ve, Button as D, IconButton as G, FormControlLabel as ge, Switch as Re, InputAdornment as H, alpha as ce, Tooltip as B, buttonClasses as rr, Dialog as ye, DialogTitle as Ee, DialogContent as De, DialogActions as Ae, Checkbox as tr, Autocomplete as Te, MenuItem as de, Collapse as nr, Divider as ir, Popper as or } from "@mui/material";
|
|
3
|
+
import { t as xe, f as ne, a as oe, h as ve } from "./chunks/state-Biqa_a5U.js";
|
|
4
4
|
import Y from "@arcblock/ux/lib/Empty";
|
|
5
5
|
import { useLocaleContext as R } from "@arcblock/ux/lib/Locale/context";
|
|
6
6
|
import { CodeEditor as Ce } from "@blocklet/code-editor";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
7
|
+
import lr from "@mui/icons-material/AddRounded";
|
|
8
|
+
import sr from "@mui/icons-material/ArrowDownward";
|
|
9
|
+
import ar from "@mui/icons-material/ArrowUpward";
|
|
10
|
+
import cr from "@mui/icons-material/DeleteOutline";
|
|
11
11
|
import T from "lodash/sortBy";
|
|
12
|
-
import { useCallback as W, useMemo as
|
|
13
|
-
import { useUpdate as We, useDebounce as
|
|
14
|
-
import { ColorItem as
|
|
15
|
-
import { getImageSize as
|
|
16
|
-
import { Icon as
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import * as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { CustomComponentRenderer as
|
|
23
|
-
import { parsePropertyValue as
|
|
24
|
-
import { unstable_useNumberInput as
|
|
25
|
-
import { VisibilityOffRounded as
|
|
12
|
+
import { useCallback as W, useMemo as $, useState as K, useEffect as L, useImperativeHandle as dr, useRef as le } from "react";
|
|
13
|
+
import { useUpdate as We, useDebounce as ur } from "react-use";
|
|
14
|
+
import { ColorItem as pr, ConfigColorDialog as mr } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
|
+
import { getImageSize as ue, getVideoSize as pe, UploaderButton as Pe, UploaderProvider as se, useUploader as hr } from "@blocklet/pages-kit/builtin/uploader";
|
|
16
|
+
import { Icon as fr } from "@iconify-icon/react";
|
|
17
|
+
import U from "lodash/isEmpty";
|
|
18
|
+
import Ke from "lodash/set";
|
|
19
|
+
import * as me from "yaml";
|
|
20
|
+
import he from "lodash/cloneDeep";
|
|
21
|
+
import fe from "@arcblock/ux/lib/Toast";
|
|
22
|
+
import { CustomComponentRenderer as Ue, transpileAndLoadScript as br, getPropertiesFromCode as gr } from "@blocklet/pages-kit/components";
|
|
23
|
+
import { parsePropertyValue as yr } from "@blocklet/pages-kit/utils/property";
|
|
24
|
+
import { unstable_useNumberInput as xr, ClickAwayListener as vr } from "@mui/base";
|
|
25
|
+
import { SyncRounded as Cr, SyncDisabledRounded as Pr, VisibilityOffRounded as kr, VisibilityRounded as wr, DeleteOutlineRounded as Sr, DragIndicatorRounded as Ir, TranslateRounded as Be, AddRounded as Le, InfoRounded as Me, PsychologyAlt as Or, StarRounded as Nr, SettingsRounded as Fe } from "@mui/icons-material";
|
|
26
26
|
import { getYjsValue as q } from "@syncedstore/core";
|
|
27
|
-
import { useReactive as
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import { usePopupState as ke, bindTrigger as we, bindDialog as Je, bindPopper as
|
|
39
|
-
import { ErrorBoundary as
|
|
40
|
-
import { useSensors as
|
|
41
|
-
import { SortableContext as
|
|
42
|
-
import { CSS as
|
|
43
|
-
import { nextId as
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(
|
|
27
|
+
import { useReactive as zr } from "ahooks";
|
|
28
|
+
import jr from "lodash/assign";
|
|
29
|
+
import Vr from "lodash/get";
|
|
30
|
+
import Rr from "lodash/has";
|
|
31
|
+
import Er from "lodash/isEqual";
|
|
32
|
+
import ie from "lodash/isNil";
|
|
33
|
+
import Dr from "lodash/isObject";
|
|
34
|
+
import Ar from "lodash/keyBy";
|
|
35
|
+
import Tr from "lodash/omit";
|
|
36
|
+
import Wr from "lodash/pick";
|
|
37
|
+
import Kr from "lodash/reduce";
|
|
38
|
+
import { usePopupState as ke, bindTrigger as we, bindDialog as Je, bindPopper as Ur } from "material-ui-popup-state/hooks";
|
|
39
|
+
import { ErrorBoundary as Br } from "react-error-boundary";
|
|
40
|
+
import { useSensors as Lr, useSensor as Ie, PointerSensor as Mr, KeyboardSensor as Fr, DndContext as Jr, closestCorners as Hr, DragOverlay as $r } from "@dnd-kit/core";
|
|
41
|
+
import { SortableContext as _r, verticalListSortingStrategy as Gr, useSortable as Yr } from "@dnd-kit/sortable";
|
|
42
|
+
import { CSS as qr } from "@dnd-kit/utilities";
|
|
43
|
+
import { nextId as He } from "@blocklet/pages-kit/utils/common";
|
|
44
|
+
function Qr({ error: e }) {
|
|
45
|
+
return /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(Ze, { severity: "error", children: e.message }) });
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Xr({
|
|
48
48
|
onClick: e,
|
|
49
49
|
disabled: t,
|
|
50
|
-
sx:
|
|
51
|
-
...
|
|
50
|
+
sx: i,
|
|
51
|
+
...s
|
|
52
52
|
}) {
|
|
53
|
-
return /* @__PURE__ */ r(G, { size: "small", color: "warning", variant: "outlined", disabled: t, onClick: e, ...
|
|
53
|
+
return /* @__PURE__ */ r(G, { size: "small", color: "warning", variant: "outlined", disabled: t, onClick: e, ...s, children: /* @__PURE__ */ r(cr, { fontSize: "small" }) });
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Zr({
|
|
56
56
|
onClick: e,
|
|
57
57
|
disabled: t,
|
|
58
|
-
sx:
|
|
59
|
-
...
|
|
58
|
+
sx: i,
|
|
59
|
+
...s
|
|
60
60
|
}) {
|
|
61
|
-
return /* @__PURE__ */ r(G, { size: "small", color: "primary", disabled: t, onClick: e, ...
|
|
61
|
+
return /* @__PURE__ */ r(G, { size: "small", color: "primary", disabled: t, onClick: e, ...s, children: /* @__PURE__ */ r(ar, { fontSize: "small" }) });
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function et({
|
|
64
64
|
onClick: e,
|
|
65
65
|
disabled: t,
|
|
66
|
-
sx:
|
|
67
|
-
...
|
|
66
|
+
sx: i,
|
|
67
|
+
...s
|
|
68
68
|
}) {
|
|
69
|
-
return /* @__PURE__ */ r(G, { size: "small", color: "primary", disabled: t, onClick: e, ...
|
|
69
|
+
return /* @__PURE__ */ r(G, { size: "small", color: "primary", disabled: t, onClick: e, ...s, children: /* @__PURE__ */ r(sr, { fontSize: "small" }) });
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function rt({
|
|
72
72
|
label: e,
|
|
73
73
|
value: t,
|
|
74
|
-
onChange:
|
|
75
|
-
disabled:
|
|
74
|
+
onChange: i,
|
|
75
|
+
disabled: s = !1,
|
|
76
76
|
itemLabel: h = "",
|
|
77
77
|
emptyHeight: p = 40,
|
|
78
|
-
property:
|
|
79
|
-
renderItem:
|
|
78
|
+
property: u,
|
|
79
|
+
renderItem: y,
|
|
80
80
|
...m
|
|
81
81
|
}) {
|
|
82
|
-
const { t:
|
|
83
|
-
(
|
|
84
|
-
|
|
82
|
+
const { t: c, locale: a } = R(), l = We(), o = W(
|
|
83
|
+
(g) => {
|
|
84
|
+
i(xe(g, u.type));
|
|
85
85
|
},
|
|
86
|
-
[
|
|
87
|
-
),
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
}, [
|
|
91
|
-
if (!
|
|
86
|
+
[i, u.type]
|
|
87
|
+
), n = $(() => Array.isArray(t) ? t : [], [t]), f = W(() => {
|
|
88
|
+
const g = [...n, ""];
|
|
89
|
+
o(g), l();
|
|
90
|
+
}, [n, o, l]), b = W(() => {
|
|
91
|
+
if (!u || !u.subProperties)
|
|
92
92
|
return f();
|
|
93
|
-
const
|
|
94
|
-
T(Object.values(
|
|
95
|
-
if (!
|
|
96
|
-
const E =
|
|
97
|
-
|
|
93
|
+
const g = {};
|
|
94
|
+
T(Object.values(u.subProperties), "index").forEach(({ data: j }) => {
|
|
95
|
+
if (!j.key) return;
|
|
96
|
+
const E = j.locales?.[a]?.defaultValue ?? "";
|
|
97
|
+
g[j.key] = E;
|
|
98
98
|
});
|
|
99
|
-
const O = [...
|
|
100
|
-
|
|
101
|
-
}, [
|
|
102
|
-
(
|
|
99
|
+
const O = [...n, g];
|
|
100
|
+
o(O), l();
|
|
101
|
+
}, [n, o, l, u, a, f]), d = W(
|
|
102
|
+
(g) => {
|
|
103
103
|
try {
|
|
104
|
-
const
|
|
105
|
-
Array.isArray(
|
|
106
|
-
} catch (
|
|
107
|
-
console.error("JSON解析错误:",
|
|
104
|
+
const v = JSON.parse(g);
|
|
105
|
+
Array.isArray(v) ? o(v) : console.error("JSON解析结果不是数组");
|
|
106
|
+
} catch (v) {
|
|
107
|
+
console.error("JSON解析错误:", v);
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
[
|
|
111
|
-
),
|
|
112
|
-
(
|
|
113
|
-
const
|
|
114
|
-
|
|
110
|
+
[o]
|
|
111
|
+
), x = W(
|
|
112
|
+
(g) => {
|
|
113
|
+
const v = n.filter((O, j) => j !== g);
|
|
114
|
+
o(v), l();
|
|
115
115
|
},
|
|
116
|
-
[
|
|
116
|
+
[n, o, l]
|
|
117
117
|
), w = W(
|
|
118
|
-
(
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
118
|
+
(g) => {
|
|
119
|
+
if (g <= 0) return;
|
|
120
|
+
const v = [...n], O = v[g];
|
|
121
|
+
v[g] = v[g - 1], v[g - 1] = O, o(v), l();
|
|
122
122
|
},
|
|
123
|
-
[
|
|
123
|
+
[n, o, l]
|
|
124
124
|
), N = W(
|
|
125
|
-
(
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
|
|
125
|
+
(g) => {
|
|
126
|
+
if (g >= n.length - 1) return;
|
|
127
|
+
const v = [...n], O = v[g];
|
|
128
|
+
v[g] = v[g + 1], v[g + 1] = O, o(v), l();
|
|
129
129
|
},
|
|
130
|
-
[
|
|
130
|
+
[n, o, l]
|
|
131
131
|
), S = W(
|
|
132
|
-
(
|
|
133
|
-
const O = [...
|
|
134
|
-
O[
|
|
132
|
+
(g, v) => {
|
|
133
|
+
const O = [...n];
|
|
134
|
+
O[g] = v, o(O);
|
|
135
135
|
},
|
|
136
|
-
[
|
|
137
|
-
), I =
|
|
136
|
+
[n, o]
|
|
137
|
+
), I = u && u.subProperties && Object.keys(u.subProperties).length > 0, z = $(() => [
|
|
138
138
|
{
|
|
139
139
|
field: "index",
|
|
140
140
|
headerName: "#",
|
|
141
141
|
width: 40,
|
|
142
142
|
align: "center",
|
|
143
|
-
renderCell: ({ index:
|
|
144
|
-
|
|
143
|
+
renderCell: ({ index: g }) => /* @__PURE__ */ r(
|
|
144
|
+
A,
|
|
145
145
|
{
|
|
146
146
|
variant: "body1",
|
|
147
147
|
sx: {
|
|
@@ -154,27 +154,27 @@ function Xr({
|
|
|
154
154
|
justifyContent: "center",
|
|
155
155
|
color: "text.secondary"
|
|
156
156
|
},
|
|
157
|
-
children:
|
|
157
|
+
children: g + 1
|
|
158
158
|
}
|
|
159
159
|
)
|
|
160
160
|
},
|
|
161
161
|
{
|
|
162
162
|
field: "content",
|
|
163
163
|
headerName: "",
|
|
164
|
-
renderCell: ({ row:
|
|
165
|
-
item:
|
|
166
|
-
index:
|
|
167
|
-
property:
|
|
168
|
-
onChange: (O) => S(
|
|
164
|
+
renderCell: ({ row: g, index: v }) => y && I ? y({
|
|
165
|
+
item: g,
|
|
166
|
+
index: v,
|
|
167
|
+
property: u,
|
|
168
|
+
onChange: (O) => S(v, O)
|
|
169
169
|
}) : /* @__PURE__ */ r(
|
|
170
170
|
V,
|
|
171
171
|
{
|
|
172
172
|
fullWidth: !0,
|
|
173
173
|
size: "small",
|
|
174
|
-
disabled:
|
|
175
|
-
value:
|
|
176
|
-
placeholder: h || `${
|
|
177
|
-
onChange: (O) => S(
|
|
174
|
+
disabled: s,
|
|
175
|
+
value: g,
|
|
176
|
+
placeholder: h || `${c("item")} ${v + 1}`,
|
|
177
|
+
onChange: (O) => S(v, O.target.value),
|
|
178
178
|
...m
|
|
179
179
|
}
|
|
180
180
|
)
|
|
@@ -185,33 +185,33 @@ function Xr({
|
|
|
185
185
|
width: 30,
|
|
186
186
|
// 增加宽度以容纳更多按钮
|
|
187
187
|
align: "center",
|
|
188
|
-
renderCell: ({ index:
|
|
189
|
-
/* @__PURE__ */ r(
|
|
188
|
+
renderCell: ({ index: g }) => /* @__PURE__ */ C(k, { direction: "column", spacing: 0.25, children: [
|
|
189
|
+
/* @__PURE__ */ r(Zr, { disabled: s || g === 0, onClick: () => w(g) }),
|
|
190
190
|
/* @__PURE__ */ r(
|
|
191
|
-
|
|
191
|
+
et,
|
|
192
192
|
{
|
|
193
|
-
disabled:
|
|
194
|
-
onClick: () => N(
|
|
193
|
+
disabled: s || g === n.length - 1,
|
|
194
|
+
onClick: () => N(g)
|
|
195
195
|
}
|
|
196
196
|
),
|
|
197
|
-
/* @__PURE__ */ r(
|
|
197
|
+
/* @__PURE__ */ r(Xr, { disabled: s, onClick: () => x(g) })
|
|
198
198
|
] })
|
|
199
199
|
}
|
|
200
200
|
], [
|
|
201
|
-
|
|
201
|
+
y,
|
|
202
202
|
I,
|
|
203
|
-
|
|
203
|
+
u,
|
|
204
204
|
S,
|
|
205
205
|
h,
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
c,
|
|
207
|
+
s,
|
|
208
208
|
m,
|
|
209
|
-
|
|
209
|
+
x,
|
|
210
210
|
w,
|
|
211
211
|
N,
|
|
212
|
-
|
|
212
|
+
n.length
|
|
213
213
|
]);
|
|
214
|
-
return I ? /* @__PURE__ */
|
|
214
|
+
return I ? /* @__PURE__ */ C(
|
|
215
215
|
k,
|
|
216
216
|
{
|
|
217
217
|
sx: {
|
|
@@ -219,9 +219,9 @@ function Xr({
|
|
|
219
219
|
gap: 1
|
|
220
220
|
},
|
|
221
221
|
children: [
|
|
222
|
-
e && /* @__PURE__ */ r(
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
e && /* @__PURE__ */ r(ee, { children: e }),
|
|
223
|
+
n.length > 0 ? /* @__PURE__ */ r(er, { component: _, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ C(
|
|
224
|
+
ze,
|
|
225
225
|
{
|
|
226
226
|
size: "small",
|
|
227
227
|
sx: {
|
|
@@ -238,63 +238,63 @@ function Xr({
|
|
|
238
238
|
borderCollapse: "collapse"
|
|
239
239
|
},
|
|
240
240
|
children: [
|
|
241
|
-
/* @__PURE__ */ r(
|
|
242
|
-
|
|
241
|
+
/* @__PURE__ */ r(je, { sx: { display: "none" }, children: /* @__PURE__ */ r(re, { children: z.map((g) => /* @__PURE__ */ r(
|
|
242
|
+
te,
|
|
243
243
|
{
|
|
244
|
-
width:
|
|
245
|
-
align:
|
|
244
|
+
width: g.width,
|
|
245
|
+
align: g.align || "left",
|
|
246
246
|
sx: { fontWeight: "bold" },
|
|
247
|
-
children:
|
|
247
|
+
children: g.renderHeader ? g.renderHeader() : g.headerName
|
|
248
248
|
},
|
|
249
|
-
|
|
249
|
+
g.field
|
|
250
250
|
)) }) }),
|
|
251
|
-
/* @__PURE__ */ r(Ve, { children:
|
|
252
|
-
|
|
251
|
+
/* @__PURE__ */ r(Ve, { children: n.map((g, v, O) => /* @__PURE__ */ r(
|
|
252
|
+
re,
|
|
253
253
|
{
|
|
254
254
|
sx: {
|
|
255
|
-
borderBottom:
|
|
255
|
+
borderBottom: v < O.length - 1 ? "1px solid" : "none",
|
|
256
256
|
borderColor: "divider",
|
|
257
257
|
"&:hover": {
|
|
258
258
|
backgroundColor: "action.hover"
|
|
259
259
|
}
|
|
260
260
|
},
|
|
261
|
-
children:
|
|
262
|
-
|
|
261
|
+
children: z.map((j) => /* @__PURE__ */ r(
|
|
262
|
+
te,
|
|
263
263
|
{
|
|
264
|
-
width:
|
|
265
|
-
align:
|
|
264
|
+
width: j.width,
|
|
265
|
+
align: j.align || "left",
|
|
266
266
|
sx: {
|
|
267
267
|
borderBottom: "none"
|
|
268
268
|
},
|
|
269
|
-
children:
|
|
270
|
-
row:
|
|
271
|
-
index:
|
|
272
|
-
onChange: (E) => S(
|
|
269
|
+
children: j.renderCell({
|
|
270
|
+
row: g,
|
|
271
|
+
index: v,
|
|
272
|
+
onChange: (E) => S(v, E)
|
|
273
273
|
})
|
|
274
274
|
},
|
|
275
|
-
`${
|
|
275
|
+
`${v}-${j.field}`
|
|
276
276
|
))
|
|
277
277
|
},
|
|
278
|
-
|
|
278
|
+
v
|
|
279
279
|
)) })
|
|
280
280
|
]
|
|
281
281
|
}
|
|
282
|
-
) }) : /* @__PURE__ */ r(Y, { style: { fontSize: 12, height: p }, children:
|
|
282
|
+
) }) : /* @__PURE__ */ r(Y, { style: { fontSize: 12, height: p }, children: c("maker.properties.arrayEmpty") }),
|
|
283
283
|
/* @__PURE__ */ r(
|
|
284
|
-
|
|
284
|
+
D,
|
|
285
285
|
{
|
|
286
286
|
fullWidth: !0,
|
|
287
287
|
size: "small",
|
|
288
288
|
variant: "outlined",
|
|
289
|
-
disabled:
|
|
290
|
-
startIcon: /* @__PURE__ */ r(
|
|
291
|
-
onClick:
|
|
292
|
-
children:
|
|
289
|
+
disabled: s,
|
|
290
|
+
startIcon: /* @__PURE__ */ r(lr, {}),
|
|
291
|
+
onClick: b,
|
|
292
|
+
children: c("maker.properties.addArrayItem")
|
|
293
293
|
}
|
|
294
294
|
)
|
|
295
295
|
]
|
|
296
296
|
}
|
|
297
|
-
) : /* @__PURE__ */
|
|
297
|
+
) : /* @__PURE__ */ C(
|
|
298
298
|
k,
|
|
299
299
|
{
|
|
300
300
|
sx: {
|
|
@@ -302,74 +302,74 @@ function Xr({
|
|
|
302
302
|
gap: 1
|
|
303
303
|
},
|
|
304
304
|
children: [
|
|
305
|
-
e && /* @__PURE__ */ r(
|
|
305
|
+
e && /* @__PURE__ */ r(ee, { children: e }),
|
|
306
306
|
/* @__PURE__ */ r(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ r(
|
|
307
307
|
Ce,
|
|
308
308
|
{
|
|
309
|
-
keyId:
|
|
310
|
-
locale:
|
|
309
|
+
keyId: u.id,
|
|
310
|
+
locale: a,
|
|
311
311
|
language: "json",
|
|
312
|
-
value: JSON.stringify(
|
|
313
|
-
onChange: (
|
|
312
|
+
value: JSON.stringify(n, null, 2),
|
|
313
|
+
onChange: (g) => d(g || ""),
|
|
314
314
|
fullScreenOptions: {
|
|
315
315
|
enableEscExit: !0,
|
|
316
316
|
targetContainer: () => document.getElementById("parameters-config-dialog") || null
|
|
317
317
|
}
|
|
318
318
|
},
|
|
319
|
-
|
|
319
|
+
u.id
|
|
320
320
|
) })
|
|
321
321
|
]
|
|
322
322
|
}
|
|
323
323
|
);
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function tt({
|
|
326
326
|
ref: e,
|
|
327
327
|
showMarkdown: t,
|
|
328
|
-
markdown:
|
|
329
|
-
onMarkdownChange:
|
|
328
|
+
markdown: i,
|
|
329
|
+
onMarkdownChange: s,
|
|
330
330
|
showUploader: h,
|
|
331
331
|
value: p,
|
|
332
|
-
meta:
|
|
333
|
-
onChange:
|
|
332
|
+
meta: u,
|
|
333
|
+
onChange: y,
|
|
334
334
|
...m
|
|
335
335
|
}) {
|
|
336
|
-
const [
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}, [p,
|
|
340
|
-
const
|
|
341
|
-
if (
|
|
342
|
-
const
|
|
343
|
-
if (!
|
|
344
|
-
|
|
336
|
+
const [c, a] = K("");
|
|
337
|
+
L(() => {
|
|
338
|
+
a(p || "");
|
|
339
|
+
}, [p, a]);
|
|
340
|
+
const l = async () => {
|
|
341
|
+
if (c !== p) {
|
|
342
|
+
const n = ne(c);
|
|
343
|
+
if (!n) {
|
|
344
|
+
y(c, void 0);
|
|
345
345
|
return;
|
|
346
346
|
}
|
|
347
|
-
const f = await
|
|
347
|
+
const f = await ue(n).catch(() => pe(n)).catch(() => {
|
|
348
348
|
});
|
|
349
|
-
|
|
349
|
+
y(c, { ...f, filename: c });
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
|
-
|
|
352
|
+
ur(
|
|
353
353
|
() => {
|
|
354
|
-
|
|
354
|
+
c !== p && y(c);
|
|
355
355
|
},
|
|
356
356
|
300,
|
|
357
|
-
[
|
|
358
|
-
),
|
|
359
|
-
submit:
|
|
357
|
+
[c]
|
|
358
|
+
), dr(e, () => ({
|
|
359
|
+
submit: l
|
|
360
360
|
}));
|
|
361
|
-
const
|
|
362
|
-
return h && (
|
|
361
|
+
const o = {};
|
|
362
|
+
return h && (o.InputProps = {
|
|
363
363
|
sx: { pr: 0 },
|
|
364
|
-
endAdornment: /* @__PURE__ */ r(
|
|
364
|
+
endAdornment: /* @__PURE__ */ r(H, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ r(
|
|
365
365
|
Pe,
|
|
366
366
|
{
|
|
367
|
-
onChange: async ({ response:
|
|
368
|
-
const f =
|
|
369
|
-
let
|
|
370
|
-
|
|
371
|
-
})),
|
|
372
|
-
...
|
|
367
|
+
onChange: async ({ response: n }) => {
|
|
368
|
+
const f = n?.data?.filename, b = ne(f) || "";
|
|
369
|
+
let d = {};
|
|
370
|
+
b && (d = await ue(b).catch(() => pe(b)).catch(() => {
|
|
371
|
+
})), y(f, {
|
|
372
|
+
...d,
|
|
373
373
|
filename: f
|
|
374
374
|
});
|
|
375
375
|
}
|
|
@@ -381,7 +381,7 @@ function Zr({
|
|
|
381
381
|
size: "small",
|
|
382
382
|
fullWidth: !0,
|
|
383
383
|
...m,
|
|
384
|
-
label: /* @__PURE__ */
|
|
384
|
+
label: /* @__PURE__ */ C(
|
|
385
385
|
k,
|
|
386
386
|
{
|
|
387
387
|
direction: "row",
|
|
@@ -391,17 +391,17 @@ function Zr({
|
|
|
391
391
|
},
|
|
392
392
|
children: [
|
|
393
393
|
m.label,
|
|
394
|
-
t && /* @__PURE__ */
|
|
394
|
+
t && /* @__PURE__ */ C(F, { children: [
|
|
395
395
|
" (",
|
|
396
396
|
/* @__PURE__ */ r(
|
|
397
397
|
ge,
|
|
398
398
|
{
|
|
399
|
-
checked:
|
|
400
|
-
label: /* @__PURE__ */ r(P, { component:
|
|
399
|
+
checked: i,
|
|
400
|
+
label: /* @__PURE__ */ r(P, { component: fr, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
|
|
401
401
|
labelPlacement: "start",
|
|
402
402
|
control: /* @__PURE__ */ r(Re, { size: "small" }),
|
|
403
403
|
sx: { ml: 0.25, pr: 1 },
|
|
404
|
-
onChange: (
|
|
404
|
+
onChange: (n, f) => s?.(f)
|
|
405
405
|
}
|
|
406
406
|
),
|
|
407
407
|
")"
|
|
@@ -409,11 +409,11 @@ function Zr({
|
|
|
409
409
|
]
|
|
410
410
|
}
|
|
411
411
|
),
|
|
412
|
-
value:
|
|
413
|
-
onChange: (
|
|
414
|
-
...
|
|
415
|
-
onKeyDown: (
|
|
416
|
-
|
|
412
|
+
value: c,
|
|
413
|
+
onChange: (n) => a(n.target.value),
|
|
414
|
+
...o,
|
|
415
|
+
onKeyDown: (n) => {
|
|
416
|
+
n.keyCode !== 229 && n.key === "Enter" && l();
|
|
417
417
|
},
|
|
418
418
|
slotProps: {
|
|
419
419
|
inputLabel: { shrink: !0, ...m.InputLabelProps }
|
|
@@ -421,23 +421,23 @@ function Zr({
|
|
|
421
421
|
}
|
|
422
422
|
);
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function nt({
|
|
425
425
|
value: e,
|
|
426
426
|
onChange: t,
|
|
427
|
-
disableGradient:
|
|
428
|
-
...
|
|
427
|
+
disableGradient: i = !1,
|
|
428
|
+
...s
|
|
429
429
|
}) {
|
|
430
|
-
const h =
|
|
431
|
-
return /* @__PURE__ */
|
|
430
|
+
const h = le(null);
|
|
431
|
+
return /* @__PURE__ */ C(F, { children: [
|
|
432
432
|
/* @__PURE__ */ r(
|
|
433
|
-
|
|
433
|
+
tt,
|
|
434
434
|
{
|
|
435
|
-
...
|
|
435
|
+
...s,
|
|
436
436
|
value: e,
|
|
437
437
|
onChange: t,
|
|
438
438
|
InputProps: {
|
|
439
|
-
endAdornment: /* @__PURE__ */ r(
|
|
440
|
-
|
|
439
|
+
endAdornment: /* @__PURE__ */ r(H, { position: "end", children: /* @__PURE__ */ r(
|
|
440
|
+
pr,
|
|
441
441
|
{
|
|
442
442
|
color: e ?? "",
|
|
443
443
|
style: { width: "1.5rem", height: "1.5rem", padding: 0 },
|
|
@@ -450,76 +450,76 @@ function et({
|
|
|
450
450
|
}
|
|
451
451
|
),
|
|
452
452
|
/* @__PURE__ */ r(
|
|
453
|
-
|
|
453
|
+
mr,
|
|
454
454
|
{
|
|
455
455
|
ref: h,
|
|
456
|
-
onSave: ({ value: p },
|
|
457
|
-
t(p),
|
|
456
|
+
onSave: ({ value: p }, u) => {
|
|
457
|
+
t(p), u();
|
|
458
458
|
},
|
|
459
|
-
disableGradient:
|
|
459
|
+
disableGradient: i
|
|
460
460
|
}
|
|
461
461
|
)
|
|
462
462
|
] });
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function it({
|
|
465
465
|
label: e,
|
|
466
466
|
value: t,
|
|
467
|
-
onChange:
|
|
468
|
-
property:
|
|
467
|
+
onChange: i,
|
|
468
|
+
property: s,
|
|
469
469
|
component: h,
|
|
470
470
|
defaultLocale: p,
|
|
471
|
-
allComponents:
|
|
472
|
-
PropertyValueField:
|
|
471
|
+
allComponents: u,
|
|
472
|
+
PropertyValueField: y,
|
|
473
473
|
onUpload: m
|
|
474
474
|
}) {
|
|
475
|
-
const { locale:
|
|
476
|
-
if (!
|
|
477
|
-
const
|
|
478
|
-
(
|
|
475
|
+
const { locale: c } = R(), a = le(null);
|
|
476
|
+
if (!U(s.subProperties)) {
|
|
477
|
+
const o = T(Object.values(s.subProperties || {}), "index").filter(
|
|
478
|
+
(n) => n.data.visible !== !1 && n.data.key
|
|
479
479
|
);
|
|
480
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ C(
|
|
481
481
|
k,
|
|
482
482
|
{
|
|
483
483
|
sx: {
|
|
484
484
|
width: "100%"
|
|
485
485
|
},
|
|
486
486
|
children: [
|
|
487
|
-
/* @__PURE__ */ r(
|
|
488
|
-
/* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(P, { sx: { position: "relative" }, children:
|
|
489
|
-
const { data:
|
|
487
|
+
/* @__PURE__ */ r(ee, { sx: { px: 0.25, py: 0.5 }, children: e }),
|
|
488
|
+
/* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(P, { sx: { position: "relative" }, children: o.map((n, f) => {
|
|
489
|
+
const { data: b } = n, d = b.key ?? b.id, x = f === o.length - 1;
|
|
490
490
|
let w = null;
|
|
491
491
|
try {
|
|
492
|
-
t && typeof t == "object" ? w = t[
|
|
492
|
+
t && typeof t == "object" ? w = t[d] : typeof t == "string" && (w = (s.type === "yaml" ? me.parse(t || "") : JSON.parse(t || "{}"))[d]);
|
|
493
493
|
} catch {
|
|
494
494
|
}
|
|
495
|
-
w == null && (
|
|
495
|
+
w == null && (b.locales && c && b.locales[c] ? w = b.locales[c].defaultValue : b.locales && p && b.locales[p] && (w = b.locales[p].defaultValue));
|
|
496
496
|
const N = (I) => {
|
|
497
497
|
try {
|
|
498
|
-
let
|
|
498
|
+
let z = {};
|
|
499
499
|
if (typeof t == "string")
|
|
500
500
|
try {
|
|
501
|
-
|
|
501
|
+
z = s.type === "yaml" ? me.parse(t || "") : JSON.parse(t || "{}");
|
|
502
502
|
} catch {
|
|
503
503
|
}
|
|
504
|
-
else typeof t == "object" && t !== null && (
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
} catch (
|
|
509
|
-
console.error("Error updating property:",
|
|
504
|
+
else typeof t == "object" && t !== null && (z = { ...t });
|
|
505
|
+
Ke(z, d, I);
|
|
506
|
+
const g = xe(z, s.type);
|
|
507
|
+
i?.(g);
|
|
508
|
+
} catch (z) {
|
|
509
|
+
console.error("Error updating property:", z);
|
|
510
510
|
}
|
|
511
511
|
}, S = 8;
|
|
512
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ C(
|
|
513
513
|
P,
|
|
514
514
|
{
|
|
515
515
|
sx: {
|
|
516
|
-
mb:
|
|
516
|
+
mb: x ? 0 : 1,
|
|
517
517
|
// 底部边距,最后一项不需要
|
|
518
518
|
display: "flex",
|
|
519
519
|
flexDirection: "row"
|
|
520
520
|
},
|
|
521
521
|
children: [
|
|
522
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ C(
|
|
523
523
|
P,
|
|
524
524
|
{
|
|
525
525
|
sx: {
|
|
@@ -558,7 +558,7 @@ function rt({
|
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
),
|
|
561
|
-
!
|
|
561
|
+
!x && /* @__PURE__ */ r(
|
|
562
562
|
P,
|
|
563
563
|
{
|
|
564
564
|
sx: {
|
|
@@ -578,21 +578,21 @@ function rt({
|
|
|
578
578
|
}
|
|
579
579
|
),
|
|
580
580
|
/* @__PURE__ */ r(P, { sx: { flexGrow: 1 }, children: /* @__PURE__ */ r(
|
|
581
|
-
|
|
581
|
+
y,
|
|
582
582
|
{
|
|
583
583
|
component: h,
|
|
584
|
-
property:
|
|
584
|
+
property: b,
|
|
585
585
|
value: w,
|
|
586
586
|
onChange: N,
|
|
587
587
|
size: "small",
|
|
588
588
|
fullWidth: !0,
|
|
589
589
|
defaultLocale: p,
|
|
590
|
-
allComponents:
|
|
590
|
+
allComponents: u
|
|
591
591
|
}
|
|
592
592
|
) })
|
|
593
593
|
]
|
|
594
594
|
},
|
|
595
|
-
|
|
595
|
+
b.id
|
|
596
596
|
);
|
|
597
597
|
}) }) })
|
|
598
598
|
]
|
|
@@ -606,7 +606,7 @@ function rt({
|
|
|
606
606
|
width: "100%",
|
|
607
607
|
gap: 2
|
|
608
608
|
},
|
|
609
|
-
children: /* @__PURE__ */
|
|
609
|
+
children: /* @__PURE__ */ C(
|
|
610
610
|
k,
|
|
611
611
|
{
|
|
612
612
|
sx: {
|
|
@@ -620,7 +620,7 @@ function rt({
|
|
|
620
620
|
},
|
|
621
621
|
children: [
|
|
622
622
|
/* @__PURE__ */ r(
|
|
623
|
-
|
|
623
|
+
ee,
|
|
624
624
|
{
|
|
625
625
|
sx: {
|
|
626
626
|
position: "absolute",
|
|
@@ -634,22 +634,22 @@ function rt({
|
|
|
634
634
|
/* @__PURE__ */ r(
|
|
635
635
|
Ce,
|
|
636
636
|
{
|
|
637
|
-
keyId:
|
|
638
|
-
locale:
|
|
639
|
-
language:
|
|
637
|
+
keyId: s.id,
|
|
638
|
+
locale: c,
|
|
639
|
+
language: s.type === "yaml" ? "yaml" : "json",
|
|
640
640
|
value: typeof t == "string" ? t : "",
|
|
641
|
-
onChange: (
|
|
642
|
-
|
|
641
|
+
onChange: (o) => {
|
|
642
|
+
i?.(o);
|
|
643
643
|
},
|
|
644
|
-
onUpload: (
|
|
645
|
-
|
|
644
|
+
onUpload: (o) => {
|
|
645
|
+
a.current = o, m && m(o);
|
|
646
646
|
},
|
|
647
647
|
fullScreenOptions: {
|
|
648
648
|
enableEscExit: !0,
|
|
649
649
|
targetContainer: () => document.getElementById("parameters-config-dialog") || null
|
|
650
650
|
}
|
|
651
651
|
},
|
|
652
|
-
|
|
652
|
+
s.id
|
|
653
653
|
),
|
|
654
654
|
/* @__PURE__ */ r(
|
|
655
655
|
P,
|
|
@@ -677,46 +677,45 @@ function rt({
|
|
|
677
677
|
}
|
|
678
678
|
);
|
|
679
679
|
}
|
|
680
|
-
const tt = ["string", "multiline", "json", "yaml", "url", "component", "custom", "array"];
|
|
681
680
|
function Oe(e) {
|
|
682
|
-
return e.
|
|
681
|
+
return !!e.shared;
|
|
683
682
|
}
|
|
684
|
-
function
|
|
683
|
+
function $e({
|
|
685
684
|
disabled: e,
|
|
686
685
|
list: t,
|
|
687
|
-
renderItem:
|
|
688
|
-
...
|
|
686
|
+
renderItem: i,
|
|
687
|
+
...s
|
|
689
688
|
}) {
|
|
690
|
-
const h = T(Object.entries(t), ([, f]) => f.index), p = h.map(([f]) => f), [
|
|
691
|
-
Ie(
|
|
689
|
+
const h = T(Object.entries(t), ([, f]) => f.index), p = h.map(([f]) => f), [u, y] = K(null), [m, c] = K(null), a = Lr(
|
|
690
|
+
Ie(Mr, {
|
|
692
691
|
activationConstraint: {
|
|
693
692
|
distance: 8
|
|
694
693
|
// 8px movement required to start drag
|
|
695
694
|
}
|
|
696
695
|
}),
|
|
697
|
-
Ie(
|
|
696
|
+
Ie(Fr)
|
|
698
697
|
);
|
|
699
|
-
return /* @__PURE__ */
|
|
700
|
-
|
|
698
|
+
return /* @__PURE__ */ C(
|
|
699
|
+
Jr,
|
|
701
700
|
{
|
|
702
|
-
sensors:
|
|
703
|
-
collisionDetection:
|
|
701
|
+
sensors: a,
|
|
702
|
+
collisionDetection: Hr,
|
|
704
703
|
onDragStart: (f) => {
|
|
705
|
-
const { active:
|
|
706
|
-
|
|
704
|
+
const { active: b } = f, d = t[b.id];
|
|
705
|
+
d && (c(b.id), y(d.data));
|
|
707
706
|
},
|
|
708
707
|
onDragOver: () => {
|
|
709
708
|
},
|
|
710
709
|
onDragEnd: (f) => {
|
|
711
|
-
const { active:
|
|
712
|
-
if (
|
|
710
|
+
const { active: b, over: d } = f;
|
|
711
|
+
if (c(null), y(null), !d || b.id === d.id)
|
|
713
712
|
return;
|
|
714
|
-
const
|
|
715
|
-
if (t[
|
|
713
|
+
const x = b.id, w = d.id;
|
|
714
|
+
if (t[x] && t[w]) {
|
|
716
715
|
const N = () => {
|
|
717
|
-
const
|
|
718
|
-
O &&
|
|
719
|
-
|
|
716
|
+
const z = Object.entries(t).sort(([, j], [, E]) => j.index - E.index), g = z.findIndex(([j]) => j === x), v = z.findIndex(([j]) => j === w), [O] = z.splice(g, 1);
|
|
717
|
+
O && z.splice(v, 0, O), z.forEach(([, j], E) => {
|
|
718
|
+
j.index = E;
|
|
720
719
|
});
|
|
721
720
|
}, S = q(t)?.doc;
|
|
722
721
|
S ? S.transact(() => {
|
|
@@ -725,7 +724,7 @@ function He({
|
|
|
725
724
|
}
|
|
726
725
|
},
|
|
727
726
|
children: [
|
|
728
|
-
/* @__PURE__ */ r(
|
|
727
|
+
/* @__PURE__ */ r(_r, { items: p, strategy: Gr, children: /* @__PURE__ */ r(k, { ...s, children: h.map(([f, b], d) => /* @__PURE__ */ r(ot, { id: f, disabled: e, isDragging: m === f, children: i(b.data, d, {
|
|
729
728
|
isDragging: m === f,
|
|
730
729
|
drag: null,
|
|
731
730
|
// Legacy compatibility
|
|
@@ -734,7 +733,7 @@ function He({
|
|
|
734
733
|
preview: null
|
|
735
734
|
// Legacy compatibility
|
|
736
735
|
}) }, f)) }) }),
|
|
737
|
-
/* @__PURE__ */ r(
|
|
736
|
+
/* @__PURE__ */ r($r, { children: u && m ? /* @__PURE__ */ r(
|
|
738
737
|
P,
|
|
739
738
|
{
|
|
740
739
|
sx: {
|
|
@@ -746,7 +745,7 @@ function He({
|
|
|
746
745
|
boxShadow: 2,
|
|
747
746
|
maxWidth: 400
|
|
748
747
|
},
|
|
749
|
-
children:
|
|
748
|
+
children: i(u, 0, {
|
|
750
749
|
isDragging: !0,
|
|
751
750
|
drag: null,
|
|
752
751
|
drop: null,
|
|
@@ -758,33 +757,35 @@ function He({
|
|
|
758
757
|
}
|
|
759
758
|
);
|
|
760
759
|
}
|
|
761
|
-
function
|
|
760
|
+
function ot({
|
|
762
761
|
id: e,
|
|
763
762
|
disabled: t,
|
|
764
|
-
isDragging:
|
|
765
|
-
children:
|
|
763
|
+
isDragging: i,
|
|
764
|
+
children: s
|
|
766
765
|
}) {
|
|
767
|
-
const { attributes: h, listeners: p, setNodeRef:
|
|
766
|
+
const { attributes: h, listeners: p, setNodeRef: u, transform: y, transition: m } = Yr({
|
|
768
767
|
id: e,
|
|
769
768
|
disabled: t
|
|
770
|
-
}),
|
|
771
|
-
transform:
|
|
769
|
+
}), c = {
|
|
770
|
+
transform: qr.Transform.toString(y),
|
|
772
771
|
transition: m,
|
|
773
|
-
opacity:
|
|
772
|
+
opacity: i ? 0.5 : 1
|
|
774
773
|
};
|
|
775
|
-
return /* @__PURE__ */ r(P, { ref:
|
|
774
|
+
return /* @__PURE__ */ r(P, { ref: u, style: c, ...h, ...p, children: s });
|
|
776
775
|
}
|
|
777
|
-
function
|
|
776
|
+
function lt({
|
|
778
777
|
disabled: e,
|
|
779
778
|
isDragging: t,
|
|
780
|
-
children:
|
|
781
|
-
onDelete:
|
|
779
|
+
children: i,
|
|
780
|
+
onDelete: s,
|
|
782
781
|
onVisibilityChange: h,
|
|
783
782
|
visible: p = !0,
|
|
784
|
-
|
|
785
|
-
|
|
783
|
+
onSharedChange: u,
|
|
784
|
+
shared: y = !1,
|
|
785
|
+
actions: m,
|
|
786
|
+
alwaysShowActions: c = !1
|
|
786
787
|
}) {
|
|
787
|
-
const { t:
|
|
788
|
+
const { t: a } = R();
|
|
788
789
|
return /* @__PURE__ */ r(
|
|
789
790
|
P,
|
|
790
791
|
{
|
|
@@ -792,7 +793,7 @@ function it({
|
|
|
792
793
|
":hover .hover-visible": { maxWidth: "100%" },
|
|
793
794
|
opacity: p ? 1 : 0.5
|
|
794
795
|
},
|
|
795
|
-
children: /* @__PURE__ */
|
|
796
|
+
children: /* @__PURE__ */ C(P, { sx: { position: "relative" }, children: [
|
|
796
797
|
/* @__PURE__ */ r(
|
|
797
798
|
P,
|
|
798
799
|
{
|
|
@@ -803,30 +804,30 @@ function it({
|
|
|
803
804
|
opacity: 0.9999
|
|
804
805
|
// NOTE: make preview effective
|
|
805
806
|
},
|
|
806
|
-
children:
|
|
807
|
+
children: i
|
|
807
808
|
}
|
|
808
809
|
),
|
|
809
810
|
!e && /* @__PURE__ */ r(
|
|
810
811
|
P,
|
|
811
812
|
{
|
|
812
|
-
className:
|
|
813
|
+
className: c ? "" : "hover-visible",
|
|
813
814
|
sx: {
|
|
814
|
-
maxWidth:
|
|
815
|
+
maxWidth: c ? "100%" : 0,
|
|
815
816
|
overflow: "hidden",
|
|
816
817
|
position: "absolute",
|
|
817
818
|
right: 2,
|
|
818
819
|
top: 2,
|
|
819
820
|
transition: "max-width 0.3s ease-in-out"
|
|
820
821
|
},
|
|
821
|
-
children: /* @__PURE__ */
|
|
822
|
+
children: /* @__PURE__ */ C(
|
|
822
823
|
k,
|
|
823
824
|
{
|
|
824
825
|
direction: "row",
|
|
825
826
|
sx: {
|
|
826
|
-
bgcolor: (
|
|
827
|
+
bgcolor: (l) => ce(l.palette.grey[200], 0.9),
|
|
827
828
|
borderRadius: 1,
|
|
828
829
|
p: 0.5,
|
|
829
|
-
[`.${
|
|
830
|
+
[`.${rr.root}`]: {
|
|
830
831
|
minWidth: 24,
|
|
831
832
|
width: 24,
|
|
832
833
|
height: 24,
|
|
@@ -834,10 +835,11 @@ function it({
|
|
|
834
835
|
}
|
|
835
836
|
},
|
|
836
837
|
children: [
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
/* @__PURE__ */ r(
|
|
838
|
+
m,
|
|
839
|
+
u && /* @__PURE__ */ r(B, { title: a(y ? "disableSharing" : "enableSharing"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(D, { onClick: () => u(!y), children: y ? /* @__PURE__ */ r(Cr, { sx: { fontSize: "1.25rem", color: "primary.main" } }) : /* @__PURE__ */ r(Pr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
840
|
+
h && /* @__PURE__ */ r(B, { title: a(p ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(D, { onClick: () => h(!p), children: p ? /* @__PURE__ */ r(kr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ r(wr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
841
|
+
s && /* @__PURE__ */ r(B, { title: a("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(D, { onClick: s, children: /* @__PURE__ */ r(Sr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
842
|
+
/* @__PURE__ */ r(B, { title: a("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(D, { children: /* @__PURE__ */ r(Ir, { sx: { color: "grey.500" } }) }) })
|
|
841
843
|
]
|
|
842
844
|
}
|
|
843
845
|
)
|
|
@@ -847,122 +849,122 @@ function it({
|
|
|
847
849
|
}
|
|
848
850
|
);
|
|
849
851
|
}
|
|
850
|
-
function
|
|
851
|
-
const t = ["string", "json", "array", "url", "multiline"],
|
|
852
|
-
return !!(t.includes(e.type || "") && !
|
|
852
|
+
function st(e) {
|
|
853
|
+
const t = ["string", "json", "array", "url", "multiline"], i = ["style", "fontSize", "color", "content", "type"];
|
|
854
|
+
return !!(t.includes(e.type || "") && !i.includes(e.key || ""));
|
|
853
855
|
}
|
|
854
|
-
function
|
|
855
|
-
return e.locales && e.locales[t] && e.locales[t].name ? e.locales[t].name :
|
|
856
|
+
function at(e, t, i) {
|
|
857
|
+
return e.locales && e.locales[t] && e.locales[t].name ? e.locales[t].name : i && e.locales && e.locales[i] && e.locales[i].name ? e.locales[i].name : e.key ? e.key : e.id;
|
|
856
858
|
}
|
|
857
|
-
const
|
|
859
|
+
const _e = (e, t, i, s) => {
|
|
858
860
|
const h = {};
|
|
859
|
-
return T(Object.entries(e), ([,
|
|
860
|
-
const m =
|
|
861
|
+
return T(Object.entries(e), ([, u]) => u.index).forEach(([u, y]) => {
|
|
862
|
+
const m = y.data;
|
|
861
863
|
if (!m) return;
|
|
862
|
-
const
|
|
863
|
-
key:
|
|
864
|
-
isNeedGenerate:
|
|
864
|
+
const c = m.key || m.id, a = i ? at(m, i, s || "") : c, l = t?.[m.id], o = {
|
|
865
|
+
key: c,
|
|
866
|
+
isNeedGenerate: l?.isNeedGenerate ?? st(m),
|
|
865
867
|
// 如果存在使用现有值,否则默认勾选
|
|
866
|
-
describe:
|
|
867
|
-
displayName:
|
|
868
|
+
describe: l?.describe ?? "",
|
|
869
|
+
displayName: a
|
|
868
870
|
};
|
|
869
|
-
m.subProperties && !
|
|
871
|
+
m.subProperties && !U(m.subProperties) && (o.subProperties = _e(
|
|
870
872
|
m.subProperties,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
)), h[m.id] =
|
|
873
|
+
l?.subProperties,
|
|
874
|
+
i,
|
|
875
|
+
s
|
|
876
|
+
)), h[m.id] = o;
|
|
875
877
|
}), h;
|
|
876
878
|
};
|
|
877
|
-
function
|
|
879
|
+
function ct({
|
|
878
880
|
open: e,
|
|
879
881
|
onClose: t,
|
|
880
|
-
onConfirm:
|
|
881
|
-
component:
|
|
882
|
+
onConfirm: i,
|
|
883
|
+
component: s,
|
|
882
884
|
initialConfig: h,
|
|
883
885
|
locale: p,
|
|
884
|
-
defaultLocale:
|
|
885
|
-
title:
|
|
886
|
+
defaultLocale: u,
|
|
887
|
+
title: y,
|
|
886
888
|
loading: m = !1
|
|
887
889
|
}) {
|
|
888
|
-
const { t:
|
|
889
|
-
|
|
890
|
-
if (e &&
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
const
|
|
894
|
-
|
|
890
|
+
const { t: c } = R(), [a, l] = K(null);
|
|
891
|
+
L(() => {
|
|
892
|
+
if (e && s) {
|
|
893
|
+
const d = { properties: {} };
|
|
894
|
+
if (s.properties) {
|
|
895
|
+
const x = h?.properties;
|
|
896
|
+
d.properties = _e(s.properties, x, p, u);
|
|
895
897
|
}
|
|
896
|
-
|
|
898
|
+
l(d);
|
|
897
899
|
}
|
|
898
|
-
}, [e,
|
|
899
|
-
const
|
|
900
|
+
}, [e, s, h, p, u]);
|
|
901
|
+
const o = () => {
|
|
900
902
|
t();
|
|
901
|
-
},
|
|
902
|
-
|
|
903
|
-
}, f = (
|
|
904
|
-
if (!
|
|
905
|
-
const N = JSON.parse(JSON.stringify(
|
|
903
|
+
}, n = () => {
|
|
904
|
+
a && (i(a), t());
|
|
905
|
+
}, f = (d, x, w) => {
|
|
906
|
+
if (!a || !d.length) return;
|
|
907
|
+
const N = JSON.parse(JSON.stringify(a));
|
|
906
908
|
let S = N.properties, I = null;
|
|
907
|
-
for (let
|
|
908
|
-
const
|
|
909
|
-
if (!
|
|
909
|
+
for (let g = 0; g < d.length - 1; g++) {
|
|
910
|
+
const v = d[g];
|
|
911
|
+
if (!v || !S[v])
|
|
910
912
|
return;
|
|
911
913
|
I = S;
|
|
912
|
-
const O = S[
|
|
914
|
+
const O = S[v];
|
|
913
915
|
O.subProperties || (O.subProperties = {}), S = O.subProperties;
|
|
914
916
|
}
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
+
const z = d[d.length - 1];
|
|
918
|
+
if (z) {
|
|
917
919
|
if ("isNeedGenerate" in w) {
|
|
918
|
-
const
|
|
919
|
-
...
|
|
920
|
+
const g = w.isNeedGenerate, v = {
|
|
921
|
+
...x,
|
|
920
922
|
...w
|
|
921
923
|
};
|
|
922
|
-
if (
|
|
923
|
-
const O = (
|
|
924
|
-
const
|
|
925
|
-
return Object.entries(
|
|
926
|
-
const
|
|
927
|
-
E !== null && (
|
|
924
|
+
if (x.subProperties && !U(x.subProperties)) {
|
|
925
|
+
const O = (j, E) => {
|
|
926
|
+
const J = {};
|
|
927
|
+
return Object.entries(j).forEach(([Xe, Q]) => {
|
|
928
|
+
const ae = { ...Q };
|
|
929
|
+
E !== null && (ae.isNeedGenerate = E), Q.subProperties && !U(Q.subProperties) && (ae.subProperties = O(
|
|
928
930
|
Q.subProperties,
|
|
929
931
|
E !== null ? E : null
|
|
930
|
-
)),
|
|
931
|
-
}),
|
|
932
|
+
)), J[Xe] = ae;
|
|
933
|
+
}), J;
|
|
932
934
|
};
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
935
|
+
v.subProperties = O(
|
|
936
|
+
x.subProperties,
|
|
937
|
+
g === !1 ? !1 : null
|
|
936
938
|
);
|
|
937
939
|
}
|
|
938
|
-
if (
|
|
939
|
-
N.properties[
|
|
940
|
-
else if (I &&
|
|
941
|
-
const O =
|
|
942
|
-
O && I[O] && (I[O].subProperties || (I[O].subProperties = {}), I[O].subProperties[
|
|
940
|
+
if (d.length === 1)
|
|
941
|
+
N.properties[z] = v;
|
|
942
|
+
else if (I && d.length >= 2) {
|
|
943
|
+
const O = d[d.length - 2];
|
|
944
|
+
O && I[O] && (I[O].subProperties || (I[O].subProperties = {}), I[O].subProperties[z] = v);
|
|
943
945
|
}
|
|
944
|
-
} else if (
|
|
945
|
-
N.properties[
|
|
946
|
-
...
|
|
946
|
+
} else if (d.length === 1)
|
|
947
|
+
N.properties[z] = {
|
|
948
|
+
...x,
|
|
947
949
|
...w
|
|
948
950
|
};
|
|
949
|
-
else if (I &&
|
|
950
|
-
const
|
|
951
|
-
|
|
952
|
-
...
|
|
951
|
+
else if (I && d.length >= 2) {
|
|
952
|
+
const g = d[d.length - 2];
|
|
953
|
+
g && I[g] && I[g].subProperties && (I[g].subProperties[z] = {
|
|
954
|
+
...x,
|
|
953
955
|
...w
|
|
954
956
|
});
|
|
955
957
|
}
|
|
956
|
-
|
|
958
|
+
l(N);
|
|
957
959
|
}
|
|
958
|
-
},
|
|
959
|
-
if (!
|
|
960
|
-
return /* @__PURE__ */ r(Y, { children:
|
|
961
|
-
const N = T(Object.entries(
|
|
962
|
-
return /* @__PURE__ */ r(k, { spacing: 1.5, children: N.map(([S, I],
|
|
963
|
-
const
|
|
964
|
-
return /* @__PURE__ */ r(P, { sx: { position: "relative" }, children: /* @__PURE__ */
|
|
965
|
-
|
|
960
|
+
}, b = (d, x = [], w = !0) => {
|
|
961
|
+
if (!d || U(d))
|
|
962
|
+
return /* @__PURE__ */ r(Y, { children: c("maker.properties.noProperties") });
|
|
963
|
+
const N = T(Object.entries(d), ([, S]) => S.displayName);
|
|
964
|
+
return /* @__PURE__ */ r(k, { spacing: 1.5, children: N.map(([S, I], z) => {
|
|
965
|
+
const g = [...x, S], v = z === N.length - 1, O = I.subProperties && !U(I.subProperties), j = I.displayName || S, E = !w;
|
|
966
|
+
return /* @__PURE__ */ r(P, { sx: { position: "relative" }, children: /* @__PURE__ */ C(k, { direction: "row", children: [
|
|
967
|
+
x.length > 0 && /* @__PURE__ */ C(
|
|
966
968
|
P,
|
|
967
969
|
{
|
|
968
970
|
sx: {
|
|
@@ -999,7 +1001,7 @@ function st({
|
|
|
999
1001
|
}
|
|
1000
1002
|
}
|
|
1001
1003
|
),
|
|
1002
|
-
!
|
|
1004
|
+
!v && /* @__PURE__ */ r(
|
|
1003
1005
|
P,
|
|
1004
1006
|
{
|
|
1005
1007
|
sx: {
|
|
@@ -1016,8 +1018,8 @@ function st({
|
|
|
1016
1018
|
]
|
|
1017
1019
|
}
|
|
1018
1020
|
),
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ C(k, { spacing: 1.5, sx: { flexGrow: 1 }, children: [
|
|
1022
|
+
/* @__PURE__ */ C(
|
|
1021
1023
|
k,
|
|
1022
1024
|
{
|
|
1023
1025
|
direction: { xs: "column", md: "row" },
|
|
@@ -1031,18 +1033,18 @@ function st({
|
|
|
1031
1033
|
ge,
|
|
1032
1034
|
{
|
|
1033
1035
|
control: /* @__PURE__ */ r(
|
|
1034
|
-
|
|
1036
|
+
tr,
|
|
1035
1037
|
{
|
|
1036
1038
|
checked: I.isNeedGenerate,
|
|
1037
1039
|
disabled: E,
|
|
1038
|
-
onChange: (
|
|
1039
|
-
f(
|
|
1040
|
-
isNeedGenerate:
|
|
1040
|
+
onChange: (J) => {
|
|
1041
|
+
f(g, I, {
|
|
1042
|
+
isNeedGenerate: J.target.checked
|
|
1041
1043
|
});
|
|
1042
1044
|
}
|
|
1043
1045
|
}
|
|
1044
1046
|
),
|
|
1045
|
-
label:
|
|
1047
|
+
label: j,
|
|
1046
1048
|
sx: {
|
|
1047
1049
|
minWidth: "180px",
|
|
1048
1050
|
maxWidth: "280px",
|
|
@@ -1058,11 +1060,11 @@ function st({
|
|
|
1058
1060
|
{
|
|
1059
1061
|
size: "small",
|
|
1060
1062
|
fullWidth: !0,
|
|
1061
|
-
label:
|
|
1063
|
+
label: c("maker.properties.llmPropertyDescribe"),
|
|
1062
1064
|
value: I.describe,
|
|
1063
|
-
onChange: (
|
|
1064
|
-
f(
|
|
1065
|
-
describe:
|
|
1065
|
+
onChange: (J) => {
|
|
1066
|
+
f(g, I, {
|
|
1067
|
+
describe: J.target.value
|
|
1066
1068
|
});
|
|
1067
1069
|
},
|
|
1068
1070
|
disabled: !I.isNeedGenerate
|
|
@@ -1071,42 +1073,42 @@ function st({
|
|
|
1071
1073
|
]
|
|
1072
1074
|
}
|
|
1073
1075
|
),
|
|
1074
|
-
O && /* @__PURE__ */ r(P, { sx: { ml: 3 }, children:
|
|
1076
|
+
O && /* @__PURE__ */ r(P, { sx: { ml: 3 }, children: b(
|
|
1075
1077
|
I.subProperties,
|
|
1076
|
-
|
|
1078
|
+
g,
|
|
1077
1079
|
I.isNeedGenerate && w
|
|
1078
1080
|
) })
|
|
1079
1081
|
] })
|
|
1080
1082
|
] }) }, S);
|
|
1081
1083
|
}) });
|
|
1082
1084
|
};
|
|
1083
|
-
return /* @__PURE__ */
|
|
1084
|
-
/* @__PURE__ */ r(Ee, { children:
|
|
1085
|
-
/* @__PURE__ */ r(
|
|
1085
|
+
return /* @__PURE__ */ C(ye, { open: e, onClose: o, maxWidth: "lg", fullWidth: !0, children: [
|
|
1086
|
+
/* @__PURE__ */ r(Ee, { children: y || c("maker.properties.llmConfigTitle") }),
|
|
1087
|
+
/* @__PURE__ */ r(De, { children: /* @__PURE__ */ r(
|
|
1086
1088
|
P,
|
|
1087
1089
|
{
|
|
1088
1090
|
sx: {
|
|
1089
1091
|
my: 3
|
|
1090
1092
|
},
|
|
1091
|
-
children: m ? /* @__PURE__ */ r(
|
|
1092
|
-
/* @__PURE__ */ r(
|
|
1093
|
-
|
|
1094
|
-
] }) : /* @__PURE__ */ r(
|
|
1093
|
+
children: m ? /* @__PURE__ */ r(A, { children: c("maker.properties.loading") }) : s ? a ? /* @__PURE__ */ C(k, { spacing: 3, children: [
|
|
1094
|
+
/* @__PURE__ */ r(A, { variant: "subtitle2", children: c("maker.properties.llmConfigInstructions") }),
|
|
1095
|
+
b(a.properties)
|
|
1096
|
+
] }) : /* @__PURE__ */ r(A, { children: c("maker.properties.loading") }) : /* @__PURE__ */ r(A, { color: "error", children: c("maker.properties.componentNotFound") })
|
|
1095
1097
|
}
|
|
1096
1098
|
) }),
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */ r(
|
|
1099
|
-
/* @__PURE__ */ r(
|
|
1099
|
+
/* @__PURE__ */ C(Ae, { children: [
|
|
1100
|
+
/* @__PURE__ */ r(D, { onClick: o, children: c("common.cancel") }),
|
|
1101
|
+
/* @__PURE__ */ r(D, { variant: "contained", onClick: n, disabled: !a || m, children: c("common.confirm") })
|
|
1100
1102
|
] })
|
|
1101
1103
|
] });
|
|
1102
1104
|
}
|
|
1103
|
-
function
|
|
1105
|
+
function dt({
|
|
1104
1106
|
label: e,
|
|
1105
1107
|
value: t,
|
|
1106
|
-
onChange:
|
|
1108
|
+
onChange: i
|
|
1107
1109
|
}) {
|
|
1108
|
-
const [
|
|
1109
|
-
return /* @__PURE__ */
|
|
1110
|
+
const [s, h] = K(!1);
|
|
1111
|
+
return /* @__PURE__ */ C(
|
|
1110
1112
|
k,
|
|
1111
1113
|
{
|
|
1112
1114
|
sx: {
|
|
@@ -1119,18 +1121,18 @@ function at({
|
|
|
1119
1121
|
label: e,
|
|
1120
1122
|
size: "small",
|
|
1121
1123
|
value: t,
|
|
1122
|
-
onChange: (p) =>
|
|
1124
|
+
onChange: (p) => i?.(p.target.value),
|
|
1123
1125
|
slotProps: {
|
|
1124
1126
|
input: {
|
|
1125
1127
|
sx: {
|
|
1126
1128
|
pr: 0
|
|
1127
1129
|
},
|
|
1128
|
-
endAdornment: /* @__PURE__ */ r(
|
|
1130
|
+
endAdornment: /* @__PURE__ */ r(H, { position: "end", children: /* @__PURE__ */ r(
|
|
1129
1131
|
Pe,
|
|
1130
1132
|
{
|
|
1131
1133
|
onChange: ({ response: p }) => {
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1134
|
+
const u = p?.data?.filename;
|
|
1135
|
+
u && i?.(u);
|
|
1134
1136
|
}
|
|
1135
1137
|
}
|
|
1136
1138
|
) })
|
|
@@ -1142,7 +1144,7 @@ function at({
|
|
|
1142
1144
|
P,
|
|
1143
1145
|
{
|
|
1144
1146
|
component: "img",
|
|
1145
|
-
src:
|
|
1147
|
+
src: ne(t),
|
|
1146
1148
|
alt: e,
|
|
1147
1149
|
onClick: () => h(!0),
|
|
1148
1150
|
sx: {
|
|
@@ -1155,18 +1157,18 @@ function at({
|
|
|
1155
1157
|
}
|
|
1156
1158
|
}
|
|
1157
1159
|
),
|
|
1158
|
-
/* @__PURE__ */ r(ye, { open:
|
|
1160
|
+
/* @__PURE__ */ r(ye, { open: s, onClose: () => h(!1), children: /* @__PURE__ */ r(P, { component: "img", sx: { objectFit: "contain" }, src: ne(t), alt: e }) })
|
|
1159
1161
|
]
|
|
1160
1162
|
}
|
|
1161
1163
|
);
|
|
1162
1164
|
}
|
|
1163
|
-
function
|
|
1164
|
-
return
|
|
1165
|
+
function be(e, t = "") {
|
|
1166
|
+
return Kr(e, (i, s, h) => {
|
|
1165
1167
|
const p = t ? `${t}.${h}` : h;
|
|
1166
|
-
return
|
|
1168
|
+
return Dr(s) ? jr(i, be(s, p)) : i[p] = s, i;
|
|
1167
1169
|
}, {});
|
|
1168
1170
|
}
|
|
1169
|
-
const
|
|
1171
|
+
const ut = [
|
|
1170
1172
|
{ value: "string", label: "Text" },
|
|
1171
1173
|
{ value: "multiline", label: "Text (Multiline)" },
|
|
1172
1174
|
{ value: "number", label: "Number" },
|
|
@@ -1180,15 +1182,18 @@ const ct = [
|
|
|
1180
1182
|
{ value: "component", label: "Component" },
|
|
1181
1183
|
{ value: "custom", label: "Custom (Render by a Component)" }
|
|
1182
1184
|
];
|
|
1183
|
-
function X(e, t,
|
|
1184
|
-
return !e || !
|
|
1185
|
+
function X(e, t, i) {
|
|
1186
|
+
return !e || !i ? !1 : Object.values(e).some(({ data: s }) => s.id !== t && s.key === i);
|
|
1185
1187
|
}
|
|
1186
|
-
function
|
|
1188
|
+
function Z(e, t) {
|
|
1187
1189
|
return !e || !t ? !1 : e[t]?.data.visible ?? !0;
|
|
1188
1190
|
}
|
|
1189
|
-
function
|
|
1190
|
-
|
|
1191
|
-
|
|
1191
|
+
function Ge(e, t) {
|
|
1192
|
+
return !e || !t ? !1 : e[t]?.data.shared ?? !1;
|
|
1193
|
+
}
|
|
1194
|
+
function hn({ componentId: e }) {
|
|
1195
|
+
const { state: { components: t } } = oe(), s = t[e]?.data;
|
|
1196
|
+
return s ? /* @__PURE__ */ r(k, {
|
|
1192
1197
|
sx: {
|
|
1193
1198
|
maxHeight: "100%",
|
|
1194
1199
|
overflow: "auto"
|
|
@@ -1197,56 +1202,56 @@ function pn({ componentId: e }) {
|
|
|
1197
1202
|
sx: {
|
|
1198
1203
|
p: 2
|
|
1199
1204
|
},
|
|
1200
|
-
children: /* @__PURE__ */ r(
|
|
1205
|
+
children: /* @__PURE__ */ r(Br, { FallbackComponent: Qr, resetKeys: [e], children: /* @__PURE__ */ r(pt, { value: s, componentId: e }) })
|
|
1201
1206
|
})
|
|
1202
1207
|
}) : null;
|
|
1203
1208
|
}
|
|
1204
|
-
function
|
|
1205
|
-
const { t:
|
|
1209
|
+
function pt({ value: e, componentId: t }) {
|
|
1210
|
+
const { t: i } = R(), { localState: { currentLocale: s, customComponentPreviewerProperties: h }, state: { config: { defaultLocale: p } }, localActions: { setCustomComponentPreviewerProperties: u } } = oe(), y = q(e).doc, m = ve(), c = $(() => h?.[t] ?? {}, [t, h]), a = zr({
|
|
1206
1211
|
componentId: t,
|
|
1207
1212
|
propertiesValue: {
|
|
1208
|
-
...
|
|
1213
|
+
...c
|
|
1209
1214
|
}
|
|
1210
1215
|
});
|
|
1211
|
-
return
|
|
1212
|
-
|
|
1213
|
-
...
|
|
1216
|
+
return L(() => {
|
|
1217
|
+
a.componentId !== t && (a.componentId = t, a.propertiesValue = {
|
|
1218
|
+
...c
|
|
1214
1219
|
});
|
|
1215
|
-
}, [t,
|
|
1216
|
-
if (
|
|
1220
|
+
}, [t, c, a]), L(() => {
|
|
1221
|
+
if (a.componentId !== t)
|
|
1217
1222
|
return;
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1223
|
+
const l = Object.fromEntries(Object.values(e.properties ?? {}).map(({ data: o }) => [
|
|
1224
|
+
o.id,
|
|
1220
1225
|
{
|
|
1221
|
-
value:
|
|
1222
|
-
locale:
|
|
1226
|
+
value: a.propertiesValue[o.id]?.value ?? yr(o, o.locales?.[s]?.defaultValue ?? o.locales?.[p]?.defaultValue, {
|
|
1227
|
+
locale: s,
|
|
1223
1228
|
defaultLocale: p
|
|
1224
1229
|
})
|
|
1225
1230
|
}
|
|
1226
1231
|
]));
|
|
1227
|
-
|
|
1228
|
-
}, [JSON.stringify(
|
|
1232
|
+
u(t, l);
|
|
1233
|
+
}, [JSON.stringify(a.propertiesValue), t, a.componentId]), /* @__PURE__ */ r(k, {
|
|
1229
1234
|
sx: {
|
|
1230
1235
|
height: "100%"
|
|
1231
1236
|
},
|
|
1232
|
-
children: /* @__PURE__ */
|
|
1237
|
+
children: /* @__PURE__ */ C(k, {
|
|
1233
1238
|
sx: {
|
|
1234
1239
|
gap: 2
|
|
1235
1240
|
},
|
|
1236
1241
|
children: [
|
|
1237
|
-
/* @__PURE__ */ r(
|
|
1238
|
-
/* @__PURE__ */ r(
|
|
1242
|
+
/* @__PURE__ */ r(mt, { config: e }),
|
|
1243
|
+
/* @__PURE__ */ r(ft, {
|
|
1239
1244
|
config: e,
|
|
1240
|
-
currentLocale:
|
|
1245
|
+
currentLocale: s,
|
|
1241
1246
|
defaultLocale: p,
|
|
1242
1247
|
allComponents: m,
|
|
1243
|
-
onUpdateConfig: (
|
|
1244
|
-
|
|
1245
|
-
|
|
1248
|
+
onUpdateConfig: (l) => {
|
|
1249
|
+
y.transact(() => {
|
|
1250
|
+
l(e);
|
|
1246
1251
|
});
|
|
1247
1252
|
}
|
|
1248
1253
|
}),
|
|
1249
|
-
/* @__PURE__ */
|
|
1254
|
+
/* @__PURE__ */ C(k, {
|
|
1250
1255
|
direction: "row",
|
|
1251
1256
|
sx: {
|
|
1252
1257
|
gap: 2,
|
|
@@ -1254,46 +1259,46 @@ function dt({ value: e, componentId: t }) {
|
|
|
1254
1259
|
alignItems: "center"
|
|
1255
1260
|
},
|
|
1256
1261
|
children: [
|
|
1257
|
-
/* @__PURE__ */ r(
|
|
1258
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ r(A, { variant: "subtitle1", children: i("renderer") }),
|
|
1263
|
+
/* @__PURE__ */ C(V, {
|
|
1259
1264
|
hiddenLabel: !0,
|
|
1260
1265
|
size: "small",
|
|
1261
1266
|
select: !0,
|
|
1262
1267
|
value: e.renderer?.type || "react-component",
|
|
1263
|
-
onChange: (
|
|
1264
|
-
|
|
1265
|
-
const
|
|
1266
|
-
e.renderer ??= { type:
|
|
1268
|
+
onChange: (l) => {
|
|
1269
|
+
y.transact(() => {
|
|
1270
|
+
const o = l.target.value;
|
|
1271
|
+
e.renderer ??= { type: o }, e.renderer.type = o;
|
|
1267
1272
|
});
|
|
1268
1273
|
},
|
|
1269
1274
|
slotProps: {
|
|
1270
1275
|
select: { autoWidth: !0 }
|
|
1271
1276
|
},
|
|
1272
1277
|
children: [
|
|
1273
|
-
/* @__PURE__ */ r(
|
|
1274
|
-
/* @__PURE__ */ r(
|
|
1278
|
+
/* @__PURE__ */ r(de, { value: "react-component", children: "React Component" }),
|
|
1279
|
+
/* @__PURE__ */ r(de, { value: "component", children: "Custom Component" })
|
|
1275
1280
|
]
|
|
1276
1281
|
})
|
|
1277
1282
|
]
|
|
1278
1283
|
}),
|
|
1279
|
-
e.renderer?.type === "component" && /* @__PURE__ */ r(
|
|
1280
|
-
e.renderer?.type === "react-component" && /* @__PURE__ */ r(
|
|
1281
|
-
/* @__PURE__ */ r(
|
|
1284
|
+
e.renderer?.type === "component" && /* @__PURE__ */ r(kt, { value: e }),
|
|
1285
|
+
e.renderer?.type === "react-component" && /* @__PURE__ */ r(Pt, { value: e }),
|
|
1286
|
+
/* @__PURE__ */ r(Qe, {
|
|
1282
1287
|
config: e,
|
|
1283
|
-
currentLocale:
|
|
1288
|
+
currentLocale: s,
|
|
1284
1289
|
defaultLocale: p,
|
|
1285
1290
|
allComponents: m,
|
|
1286
|
-
propertiesValue:
|
|
1287
|
-
onChange: ({ value:
|
|
1288
|
-
const f = [...
|
|
1289
|
-
if (!
|
|
1290
|
-
|
|
1291
|
+
propertiesValue: a.propertiesValue,
|
|
1292
|
+
onChange: ({ value: l, id: o, path: n }) => {
|
|
1293
|
+
const f = [...n, "data"];
|
|
1294
|
+
if (!Vr(e, f)) {
|
|
1295
|
+
fe.warning(i("cannotFindPropertyKey", {
|
|
1291
1296
|
key: f.join(".")
|
|
1292
1297
|
}));
|
|
1293
1298
|
return;
|
|
1294
1299
|
}
|
|
1295
|
-
|
|
1296
|
-
value:
|
|
1300
|
+
a.propertiesValue[o] = {
|
|
1301
|
+
value: l.value
|
|
1297
1302
|
};
|
|
1298
1303
|
}
|
|
1299
1304
|
})
|
|
@@ -1301,19 +1306,19 @@ function dt({ value: e, componentId: t }) {
|
|
|
1301
1306
|
})
|
|
1302
1307
|
});
|
|
1303
1308
|
}
|
|
1304
|
-
function
|
|
1309
|
+
function mt({ config: e }) {
|
|
1305
1310
|
const { t } = R();
|
|
1306
|
-
return /* @__PURE__ */ r(
|
|
1311
|
+
return /* @__PURE__ */ r(se, { children: /* @__PURE__ */ C(k, {
|
|
1307
1312
|
sx: {
|
|
1308
1313
|
gap: 2
|
|
1309
1314
|
},
|
|
1310
1315
|
children: [
|
|
1311
|
-
/* @__PURE__ */ r(
|
|
1316
|
+
/* @__PURE__ */ r(A, { variant: "subtitle1", children: t("basicInfo") }),
|
|
1312
1317
|
/* @__PURE__ */ r(V, {
|
|
1313
1318
|
label: t("name"),
|
|
1314
1319
|
size: "small",
|
|
1315
1320
|
value: e.name || "",
|
|
1316
|
-
onChange: (
|
|
1321
|
+
onChange: (i) => e.name = i.target.value
|
|
1317
1322
|
}),
|
|
1318
1323
|
/* @__PURE__ */ r(V, {
|
|
1319
1324
|
label: t("description"),
|
|
@@ -1322,10 +1327,10 @@ function ut({ config: e }) {
|
|
|
1322
1327
|
minRows: 2,
|
|
1323
1328
|
maxRows: 10,
|
|
1324
1329
|
value: e.description || "",
|
|
1325
|
-
onChange: (
|
|
1330
|
+
onChange: (i) => e.description = i.target.value,
|
|
1326
1331
|
slotProps: {
|
|
1327
1332
|
input: {
|
|
1328
|
-
endAdornment: /* @__PURE__ */ r(
|
|
1333
|
+
endAdornment: /* @__PURE__ */ r(H, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(wt, { config: e }) })
|
|
1329
1334
|
},
|
|
1330
1335
|
htmlInput: { maxLength: 200 }
|
|
1331
1336
|
}
|
|
@@ -1336,81 +1341,88 @@ function ut({ config: e }) {
|
|
|
1336
1341
|
multiple: !0,
|
|
1337
1342
|
freeSolo: !0,
|
|
1338
1343
|
value: e.tags ?? [],
|
|
1339
|
-
onChange: (
|
|
1340
|
-
renderInput: (
|
|
1344
|
+
onChange: (i, s) => e.tags = s,
|
|
1345
|
+
renderInput: (i) => /* @__PURE__ */ r(V, { label: t("tags"), ...i })
|
|
1341
1346
|
}),
|
|
1342
|
-
/* @__PURE__ */ r(
|
|
1347
|
+
/* @__PURE__ */ r(dt, {
|
|
1343
1348
|
label: t("previewImage"),
|
|
1344
1349
|
value: e.previewImage || "",
|
|
1345
|
-
onChange: (
|
|
1350
|
+
onChange: (i) => e.previewImage = i
|
|
1346
1351
|
})
|
|
1347
1352
|
]
|
|
1348
1353
|
}) });
|
|
1349
1354
|
}
|
|
1350
|
-
function
|
|
1351
|
-
const { t:
|
|
1352
|
-
return /* @__PURE__ */ r(
|
|
1355
|
+
function Ye({ data: e, params: t, visible: i, shared: s, config: h, currentLocale: p, defaultLocale: u, allComponents: y, onUpdateConfig: m }) {
|
|
1356
|
+
const { t: c } = R(), a = $(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? yt : M, [e.type]);
|
|
1357
|
+
return /* @__PURE__ */ r(lt, {
|
|
1353
1358
|
preview: t.preview,
|
|
1354
1359
|
drop: t.drop,
|
|
1355
1360
|
drag: t.drag,
|
|
1356
1361
|
isDragging: t.isDragging,
|
|
1357
1362
|
onDelete: () => {
|
|
1358
|
-
|
|
1359
|
-
if (
|
|
1360
|
-
const
|
|
1361
|
-
delete
|
|
1362
|
-
|
|
1363
|
+
m((l) => {
|
|
1364
|
+
if (l.properties) {
|
|
1365
|
+
const n = Object.entries(l.properties).sort(([, b], [, d]) => b.index - d.index);
|
|
1366
|
+
delete l.properties[e.id], n.filter(([b]) => b !== e.id).forEach(([, b], d) => {
|
|
1367
|
+
b.index = d;
|
|
1363
1368
|
});
|
|
1364
1369
|
}
|
|
1365
1370
|
});
|
|
1366
1371
|
},
|
|
1367
|
-
visible:
|
|
1368
|
-
onVisibilityChange: (
|
|
1369
|
-
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1372
|
+
visible: i,
|
|
1373
|
+
onVisibilityChange: (l) => {
|
|
1374
|
+
m((o) => {
|
|
1375
|
+
const n = o.properties[e.id].data;
|
|
1376
|
+
n.visible = l;
|
|
1377
|
+
});
|
|
1378
|
+
},
|
|
1379
|
+
shared: s,
|
|
1380
|
+
onSharedChange: (l) => {
|
|
1381
|
+
m((o) => {
|
|
1382
|
+
const n = o.properties[e.id].data;
|
|
1383
|
+
n.shared = l;
|
|
1372
1384
|
});
|
|
1373
1385
|
},
|
|
1374
1386
|
alwaysShowActions: !0,
|
|
1375
|
-
children: /* @__PURE__ */
|
|
1387
|
+
children: /* @__PURE__ */ C(k, {
|
|
1376
1388
|
direction: "column",
|
|
1377
1389
|
sx: {
|
|
1378
1390
|
gap: 2
|
|
1379
1391
|
},
|
|
1380
1392
|
children: [
|
|
1381
1393
|
/* @__PURE__ */ r(V, {
|
|
1382
|
-
label:
|
|
1394
|
+
label: c("key"),
|
|
1383
1395
|
size: "small",
|
|
1384
1396
|
required: !0,
|
|
1385
1397
|
sx: {
|
|
1386
|
-
width: "calc(100% -
|
|
1398
|
+
width: "calc(100% - 104px - 8px)",
|
|
1387
1399
|
flex: 1,
|
|
1388
1400
|
"& .MuiOutlinedInput-root": {
|
|
1389
|
-
borderColor: e.key ? X(
|
|
1401
|
+
borderColor: e.key ? X(h.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
|
|
1390
1402
|
},
|
|
1391
1403
|
"& .MuiFormLabel-root": {
|
|
1392
|
-
color: e.key ? X(
|
|
1404
|
+
color: e.key ? X(h.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
|
|
1393
1405
|
},
|
|
1394
1406
|
"& .MuiFormLabel-root.Mui-focused": {
|
|
1395
|
-
color: e.key ? X(
|
|
1407
|
+
color: e.key ? X(h.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
|
|
1396
1408
|
}
|
|
1397
1409
|
},
|
|
1398
1410
|
value: e.key || "",
|
|
1399
|
-
onChange: (
|
|
1400
|
-
|
|
1401
|
-
const
|
|
1402
|
-
|
|
1411
|
+
onChange: (l) => {
|
|
1412
|
+
m((o) => {
|
|
1413
|
+
const n = o.properties[e.id].data;
|
|
1414
|
+
n.key = l.target.value.trim();
|
|
1403
1415
|
});
|
|
1404
1416
|
},
|
|
1405
1417
|
slotProps: {
|
|
1406
1418
|
input: {
|
|
1407
|
-
endAdornment: !e.key || e.key && X(
|
|
1419
|
+
endAdornment: !e.key || e.key && X(h.properties, e.id, e.key) ? /* @__PURE__ */ r(H, {
|
|
1408
1420
|
position: "end",
|
|
1409
1421
|
sx: {
|
|
1410
1422
|
width: 16,
|
|
1411
1423
|
ml: 0
|
|
1412
1424
|
},
|
|
1413
|
-
children: /* @__PURE__ */ r(
|
|
1425
|
+
children: /* @__PURE__ */ r(B, { title: e.key ? c("duplicateKey") : c("requiredKey"), children: /* @__PURE__ */ r(Me, {
|
|
1414
1426
|
sx: {
|
|
1415
1427
|
color: e.key ? "warning.main" : "error.main",
|
|
1416
1428
|
fontSize: 16
|
|
@@ -1420,101 +1432,101 @@ function Ge({ data: e, params: t, visible: n, config: l, currentLocale: h, defau
|
|
|
1420
1432
|
}
|
|
1421
1433
|
}
|
|
1422
1434
|
}),
|
|
1423
|
-
/* @__PURE__ */
|
|
1435
|
+
/* @__PURE__ */ C(k, {
|
|
1424
1436
|
direction: "row",
|
|
1425
1437
|
sx: {
|
|
1426
1438
|
gap: 1
|
|
1427
1439
|
},
|
|
1428
1440
|
children: [
|
|
1429
1441
|
/* @__PURE__ */ r(V, {
|
|
1430
|
-
label:
|
|
1442
|
+
label: c("label"),
|
|
1431
1443
|
size: "small",
|
|
1432
1444
|
sx: { flex: 1 },
|
|
1433
|
-
value: (e.locales?.[
|
|
1434
|
-
onChange: (
|
|
1435
|
-
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1445
|
+
value: (e.locales?.[p]?.name ?? e.locales?.[u]?.name) || "",
|
|
1446
|
+
onChange: (l) => {
|
|
1447
|
+
m((o) => {
|
|
1448
|
+
const n = o.properties[e.id].data;
|
|
1449
|
+
n.locales ??= {}, n.locales[p] ??= {}, n.locales[p].name = l.target.value;
|
|
1438
1450
|
});
|
|
1439
1451
|
}
|
|
1440
1452
|
}),
|
|
1441
1453
|
/* @__PURE__ */ r(V, {
|
|
1442
|
-
label:
|
|
1454
|
+
label: c("type"),
|
|
1443
1455
|
size: "small",
|
|
1444
1456
|
select: !0,
|
|
1445
1457
|
sx: { flex: 1 },
|
|
1446
1458
|
value: e.type === "string" && e.multiline ? "multiline" : e.type || "string",
|
|
1447
|
-
onChange: (
|
|
1448
|
-
|
|
1449
|
-
const
|
|
1450
|
-
if (
|
|
1451
|
-
for (const
|
|
1452
|
-
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1459
|
+
onChange: (l) => {
|
|
1460
|
+
m((o) => {
|
|
1461
|
+
const n = o.properties[e.id].data;
|
|
1462
|
+
if (n.locales)
|
|
1463
|
+
for (const b of Object.keys(n.locales))
|
|
1464
|
+
n.locales[b].defaultValue = void 0;
|
|
1465
|
+
const f = l.target.value;
|
|
1466
|
+
f === "multiline" ? (n.type = "string", n.multiline = !0) : (typeof n.multiline < "u" && delete n.multiline, n.type = f);
|
|
1455
1467
|
});
|
|
1456
1468
|
},
|
|
1457
|
-
children:
|
|
1469
|
+
children: ut.map((l) => /* @__PURE__ */ r(de, { value: l.value, children: l.label }, l.value))
|
|
1458
1470
|
})
|
|
1459
1471
|
]
|
|
1460
1472
|
}),
|
|
1461
|
-
/* @__PURE__ */
|
|
1473
|
+
/* @__PURE__ */ C(k, {
|
|
1462
1474
|
direction: "row",
|
|
1463
1475
|
sx: {
|
|
1464
1476
|
gap: 1
|
|
1465
1477
|
},
|
|
1466
1478
|
children: [
|
|
1467
|
-
/* @__PURE__ */ r(
|
|
1468
|
-
allComponents:
|
|
1469
|
-
defaultLocale:
|
|
1470
|
-
component:
|
|
1479
|
+
/* @__PURE__ */ r(a, {
|
|
1480
|
+
allComponents: y,
|
|
1481
|
+
defaultLocale: u,
|
|
1482
|
+
component: h,
|
|
1471
1483
|
property: e,
|
|
1472
|
-
label:
|
|
1484
|
+
label: c("defaultValue"),
|
|
1473
1485
|
size: "small",
|
|
1474
1486
|
fullWidth: !0,
|
|
1475
|
-
value: e.locales?.[
|
|
1476
|
-
onChange: (
|
|
1477
|
-
|
|
1478
|
-
const
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
Object.keys(
|
|
1482
|
-
|
|
1487
|
+
value: e.locales?.[p]?.defaultValue,
|
|
1488
|
+
onChange: (l, o) => {
|
|
1489
|
+
m((n) => {
|
|
1490
|
+
const f = n.properties[e.id].data;
|
|
1491
|
+
if (o?.forceUpdateProperty) {
|
|
1492
|
+
const b = be(f), d = be(l);
|
|
1493
|
+
Object.keys(d).forEach((x) => {
|
|
1494
|
+
b[x] || Ke(f, x, d[x]);
|
|
1483
1495
|
});
|
|
1484
1496
|
} else
|
|
1485
|
-
|
|
1497
|
+
f.locales ??= {}, f.locales[p] ??= {}, f.locales[p].defaultValue = l;
|
|
1486
1498
|
});
|
|
1487
1499
|
}
|
|
1488
1500
|
}),
|
|
1489
|
-
e.type === "custom" ? /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(
|
|
1501
|
+
e.type === "custom" ? /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(bt, { property: e, allComponents: y }) }) : null
|
|
1490
1502
|
]
|
|
1491
1503
|
})
|
|
1492
1504
|
]
|
|
1493
1505
|
})
|
|
1494
1506
|
});
|
|
1495
1507
|
}
|
|
1496
|
-
function
|
|
1497
|
-
const [
|
|
1498
|
-
return
|
|
1508
|
+
function ht(e, t) {
|
|
1509
|
+
const [i, s] = K(0);
|
|
1510
|
+
return L(() => {
|
|
1499
1511
|
const p = setTimeout(() => {
|
|
1500
1512
|
if (e.current) {
|
|
1501
|
-
let
|
|
1502
|
-
for (;
|
|
1503
|
-
|
|
1504
|
-
|
|
1513
|
+
let u = e.current.parentElement, y = 0;
|
|
1514
|
+
for (; u; )
|
|
1515
|
+
u.classList.contains("property-container") && y++, u = u.parentElement;
|
|
1516
|
+
s(y);
|
|
1505
1517
|
}
|
|
1506
1518
|
}, 100);
|
|
1507
1519
|
return () => clearTimeout(p);
|
|
1508
|
-
}, [e, t]),
|
|
1520
|
+
}, [e, t]), i;
|
|
1509
1521
|
}
|
|
1510
|
-
function
|
|
1511
|
-
const { t:
|
|
1512
|
-
return /* @__PURE__ */ r(
|
|
1522
|
+
function ft({ config: e, currentLocale: t, defaultLocale: i, allComponents: s, onUpdateConfig: h, useI18nEditor: p = !0 }) {
|
|
1523
|
+
const { t: u } = R(), y = ke({ variant: "dialog" }), m = e.properties && T(Object.values(e.properties), "index");
|
|
1524
|
+
return /* @__PURE__ */ r(se, { children: /* @__PURE__ */ C(k, {
|
|
1513
1525
|
sx: {
|
|
1514
1526
|
gap: 2
|
|
1515
1527
|
},
|
|
1516
1528
|
children: [
|
|
1517
|
-
/* @__PURE__ */
|
|
1529
|
+
/* @__PURE__ */ C(k, {
|
|
1518
1530
|
direction: "row",
|
|
1519
1531
|
sx: {
|
|
1520
1532
|
gap: 1,
|
|
@@ -1522,94 +1534,95 @@ function mt({ config: e, currentLocale: t, defaultLocale: n, allComponents: l, o
|
|
|
1522
1534
|
justifyContent: "space-between"
|
|
1523
1535
|
},
|
|
1524
1536
|
children: [
|
|
1525
|
-
/* @__PURE__ */ r(
|
|
1537
|
+
/* @__PURE__ */ r(A, { variant: "subtitle1", children: u("properties") }),
|
|
1526
1538
|
/* @__PURE__ */ r(P, {
|
|
1527
1539
|
sx: {
|
|
1528
1540
|
flex: 1
|
|
1529
1541
|
}
|
|
1530
1542
|
}),
|
|
1531
|
-
p && /* @__PURE__ */ r(
|
|
1543
|
+
p && /* @__PURE__ */ r(D, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...we(y), children: /* @__PURE__ */ r(Be, { fontSize: "small" }) })
|
|
1532
1544
|
]
|
|
1533
1545
|
}),
|
|
1534
|
-
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ r(
|
|
1546
|
+
e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ r($e, {
|
|
1535
1547
|
component: k,
|
|
1536
1548
|
gap: 2,
|
|
1537
1549
|
list: e.properties,
|
|
1538
|
-
renderItem: (
|
|
1539
|
-
const
|
|
1540
|
-
return /* @__PURE__ */ r(
|
|
1550
|
+
renderItem: (c, a, l) => {
|
|
1551
|
+
const o = Z(e.properties, c.id), n = Ge(e.properties, c.id);
|
|
1552
|
+
return /* @__PURE__ */ r(_, {
|
|
1541
1553
|
elevation: 0,
|
|
1542
1554
|
className: "property-container",
|
|
1543
1555
|
sx: {
|
|
1544
1556
|
p: 1.25,
|
|
1545
1557
|
borderRadius: 1,
|
|
1546
|
-
border:
|
|
1558
|
+
border: o ? "1px solid" : "1px dashed",
|
|
1547
1559
|
borderColor: "divider"
|
|
1548
1560
|
},
|
|
1549
1561
|
children: /* @__PURE__ */ r(k, {
|
|
1550
1562
|
sx: {
|
|
1551
1563
|
gap: 2
|
|
1552
1564
|
},
|
|
1553
|
-
children: /* @__PURE__ */ r(
|
|
1554
|
-
data:
|
|
1555
|
-
params:
|
|
1556
|
-
visible:
|
|
1565
|
+
children: /* @__PURE__ */ r(Ye, {
|
|
1566
|
+
data: c,
|
|
1567
|
+
params: l,
|
|
1568
|
+
visible: o,
|
|
1569
|
+
shared: n,
|
|
1557
1570
|
config: e,
|
|
1558
1571
|
currentLocale: t,
|
|
1559
|
-
defaultLocale:
|
|
1560
|
-
allComponents:
|
|
1572
|
+
defaultLocale: i,
|
|
1573
|
+
allComponents: s,
|
|
1561
1574
|
onUpdateConfig: h
|
|
1562
1575
|
})
|
|
1563
1576
|
})
|
|
1564
|
-
},
|
|
1577
|
+
}, c.id);
|
|
1565
1578
|
}
|
|
1566
|
-
}) : /* @__PURE__ */ r(Y, { style: { fontSize: 12 }, children:
|
|
1567
|
-
/* @__PURE__ */ r(
|
|
1579
|
+
}) : /* @__PURE__ */ r(Y, { style: { fontSize: 12 }, children: u("maker.properties.noProperties") }),
|
|
1580
|
+
/* @__PURE__ */ r(D, {
|
|
1568
1581
|
fullWidth: !0,
|
|
1569
1582
|
variant: "outlined",
|
|
1570
1583
|
className: "ignore-style-override",
|
|
1571
1584
|
onClick: () => {
|
|
1572
|
-
h((
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1585
|
+
h((c) => {
|
|
1586
|
+
const a = He();
|
|
1587
|
+
c.properties ??= {}, c.properties[a] ??= { index: m?.length || 0, data: { id: a, shared: !1 } };
|
|
1575
1588
|
});
|
|
1576
1589
|
},
|
|
1577
1590
|
startIcon: /* @__PURE__ */ r(Le, {}),
|
|
1578
|
-
children:
|
|
1591
|
+
children: u("addObject", { object: u("property") })
|
|
1579
1592
|
}),
|
|
1580
|
-
p && /* @__PURE__ */ r(
|
|
1593
|
+
p && /* @__PURE__ */ r(qe, { ...Je(y), component: e })
|
|
1581
1594
|
]
|
|
1582
1595
|
}) });
|
|
1583
1596
|
}
|
|
1584
|
-
function
|
|
1585
|
-
const
|
|
1586
|
-
return /* @__PURE__ */
|
|
1587
|
-
/* @__PURE__ */ r(
|
|
1588
|
-
/* @__PURE__ */ r(
|
|
1597
|
+
function bt({ property: e, allComponents: t }) {
|
|
1598
|
+
const i = ke({ variant: "popper" });
|
|
1599
|
+
return /* @__PURE__ */ C(F, { children: [
|
|
1600
|
+
/* @__PURE__ */ r(D, { sx: { minWidth: 0 }, ...we(i), children: /* @__PURE__ */ r(Fe, { fontSize: "small" }) }),
|
|
1601
|
+
/* @__PURE__ */ r(or, { ...Ur(i), children: /* @__PURE__ */ r(vr, { onClickAway: i.close, children: /* @__PURE__ */ r(_, { children: /* @__PURE__ */ r(P, {
|
|
1589
1602
|
sx: {
|
|
1590
1603
|
width: 500,
|
|
1591
1604
|
p: 2
|
|
1592
1605
|
},
|
|
1593
1606
|
children: /* @__PURE__ */ r(Se, {
|
|
1594
1607
|
value: e.componentId,
|
|
1595
|
-
onChange: (
|
|
1608
|
+
onChange: (s, h) => e.componentId = h,
|
|
1596
1609
|
allComponents: t
|
|
1597
1610
|
})
|
|
1598
1611
|
}) }) }) })
|
|
1599
1612
|
] });
|
|
1600
1613
|
}
|
|
1601
|
-
function
|
|
1602
|
-
const [p,
|
|
1603
|
-
return
|
|
1614
|
+
function gt({ value: e, valueImmutable: t, onChange: i, defaultLocale: s, allComponents: h }) {
|
|
1615
|
+
const [p, u] = K(!1), { t: y, locale: m } = R(), c = typeof e?.componentId == "string" ? h[e.componentId]?.data : void 0;
|
|
1616
|
+
return c ? /* @__PURE__ */ C(P, { sx: { width: "100%", position: "relative" }, children: [
|
|
1604
1617
|
/* @__PURE__ */ r(G, {
|
|
1605
1618
|
sx: { minWidth: 0 },
|
|
1606
|
-
disabled: !
|
|
1619
|
+
disabled: !c,
|
|
1607
1620
|
size: "small",
|
|
1608
|
-
onClick: () =>
|
|
1621
|
+
onClick: () => u(!p),
|
|
1609
1622
|
color: p ? "primary" : "default",
|
|
1610
1623
|
children: /* @__PURE__ */ r(Fe, { fontSize: "small" })
|
|
1611
1624
|
}),
|
|
1612
|
-
p && /* @__PURE__ */ r(
|
|
1625
|
+
p && /* @__PURE__ */ r(nr, { in: p, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ C(_, {
|
|
1613
1626
|
elevation: 1,
|
|
1614
1627
|
sx: {
|
|
1615
1628
|
mt: 1,
|
|
@@ -1625,207 +1638,208 @@ function ft({ value: e, valueImmutable: t, onChange: n, defaultLocale: l, allCom
|
|
|
1625
1638
|
width: "100%",
|
|
1626
1639
|
mb: 2
|
|
1627
1640
|
},
|
|
1628
|
-
children: /* @__PURE__ */ r(
|
|
1629
|
-
config:
|
|
1641
|
+
children: /* @__PURE__ */ r(Qe, {
|
|
1642
|
+
config: c,
|
|
1630
1643
|
currentLocale: m,
|
|
1631
|
-
defaultLocale:
|
|
1644
|
+
defaultLocale: s,
|
|
1632
1645
|
allComponents: h,
|
|
1633
1646
|
propertiesValue: e?.properties,
|
|
1634
|
-
onChange: ({ id:
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1647
|
+
onChange: ({ id: a, value: l }) => {
|
|
1648
|
+
const o = he(l.value), n = JSON.parse(JSON.stringify(e));
|
|
1649
|
+
n?.componentId && (t ? i?.({ ...n, properties: { ...n.properties, [a]: { value: o } } }) : (n.properties = n.properties ?? {}, n.properties[a] = { value: o }, i?.(n)));
|
|
1637
1650
|
}
|
|
1638
1651
|
})
|
|
1639
1652
|
}),
|
|
1640
|
-
/* @__PURE__ */ r(
|
|
1653
|
+
/* @__PURE__ */ r(D, { size: "small", onClick: () => u(!1), sx: { mt: 1 }, children: y("close") })
|
|
1641
1654
|
]
|
|
1642
1655
|
}) })
|
|
1643
1656
|
] }) : null;
|
|
1644
1657
|
}
|
|
1645
|
-
function
|
|
1646
|
-
const { t:
|
|
1647
|
-
return /* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */ r(Ee, { children:
|
|
1649
|
-
/* @__PURE__ */ r(
|
|
1650
|
-
/* @__PURE__ */ r(
|
|
1658
|
+
function qe({ type: e = "properties", component: t, ...i }) {
|
|
1659
|
+
const { t: s } = R(), { state: { components: h, supportedLocales: p, config: { defaultLocale: u } } } = oe(), y = ve(), m = q(t).doc, c = e === "properties" ? t.properties : e === "parameters" && t.renderer?.type === "component" ? h[t.renderer.componentId]?.data.properties : void 0, a = t.renderer?.type === "component" ? t : void 0;
|
|
1660
|
+
return /* @__PURE__ */ C(ye, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
1661
|
+
/* @__PURE__ */ r(Ee, { children: s("i18nEditorTitle") }),
|
|
1662
|
+
/* @__PURE__ */ r(De, { children: c && /* @__PURE__ */ r(k, { children: /* @__PURE__ */ C(ze, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
1663
|
+
/* @__PURE__ */ r(je, { children: /* @__PURE__ */ r(re, { children: p.map(({ locale: l, name: o }) => /* @__PURE__ */ r(te, { children: /* @__PURE__ */ C(A, {
|
|
1651
1664
|
sx: {
|
|
1652
1665
|
color: "text.primary"
|
|
1653
1666
|
},
|
|
1654
1667
|
children: [
|
|
1655
|
-
|
|
1656
|
-
|
|
1668
|
+
o,
|
|
1669
|
+
u === l && /* @__PURE__ */ r(Nr, { sx: { fontSize: 12 } })
|
|
1657
1670
|
]
|
|
1658
|
-
}) },
|
|
1659
|
-
/* @__PURE__ */ r(Ve, { children: T(Object.values(
|
|
1671
|
+
}) }, l)) }) }),
|
|
1672
|
+
/* @__PURE__ */ r(Ve, { children: T(Object.values(c), "index").map(({ data: l }) => /* @__PURE__ */ r(re, { children: p.map(({ locale: o }) => /* @__PURE__ */ r(te, { children: /* @__PURE__ */ r(k, {
|
|
1660
1673
|
sx: {
|
|
1661
1674
|
gap: 1
|
|
1662
1675
|
},
|
|
1663
|
-
children: e === "properties" ? /* @__PURE__ */
|
|
1676
|
+
children: e === "properties" ? /* @__PURE__ */ C(F, { children: [
|
|
1664
1677
|
/* @__PURE__ */ r(V, {
|
|
1665
1678
|
size: "small",
|
|
1666
1679
|
label: "Key",
|
|
1667
|
-
value:
|
|
1668
|
-
onChange: (
|
|
1680
|
+
value: l.key || "",
|
|
1681
|
+
onChange: (n) => {
|
|
1669
1682
|
m.transact(() => {
|
|
1670
|
-
|
|
1683
|
+
l.key = n.target.value.trim();
|
|
1671
1684
|
});
|
|
1672
1685
|
}
|
|
1673
1686
|
}),
|
|
1674
1687
|
/* @__PURE__ */ r(V, {
|
|
1675
1688
|
size: "small",
|
|
1676
|
-
label:
|
|
1677
|
-
value: (
|
|
1678
|
-
onChange: (
|
|
1689
|
+
label: s("label"),
|
|
1690
|
+
value: (l.locales?.[o]?.name ?? l.locales?.[u]?.name) || "",
|
|
1691
|
+
onChange: (n) => {
|
|
1679
1692
|
m.transact(() => {
|
|
1680
|
-
|
|
1693
|
+
l.locales ??= {}, l.locales[o] ??= {}, l.locales[o].name = n.target.value;
|
|
1681
1694
|
});
|
|
1682
1695
|
}
|
|
1683
1696
|
}),
|
|
1684
|
-
/* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(
|
|
1685
|
-
allComponents:
|
|
1686
|
-
defaultLocale:
|
|
1697
|
+
/* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(M, {
|
|
1698
|
+
allComponents: y,
|
|
1699
|
+
defaultLocale: u,
|
|
1687
1700
|
component: t,
|
|
1688
|
-
property:
|
|
1701
|
+
property: l,
|
|
1689
1702
|
size: "small",
|
|
1690
1703
|
fullWidth: !0,
|
|
1691
1704
|
label: "Default Value",
|
|
1692
|
-
valueImmutable:
|
|
1693
|
-
value:
|
|
1694
|
-
onChange: (
|
|
1705
|
+
valueImmutable: ie(l.locales?.[o]?.defaultValue),
|
|
1706
|
+
value: l.locales?.[o]?.defaultValue ?? l.locales?.[u]?.defaultValue,
|
|
1707
|
+
onChange: (n) => {
|
|
1695
1708
|
m.transact(() => {
|
|
1696
|
-
|
|
1709
|
+
l.locales ??= {}, l.locales[o] ??= {}, l.locales[o].defaultValue = n;
|
|
1697
1710
|
});
|
|
1698
1711
|
}
|
|
1699
1712
|
}) })
|
|
1700
|
-
] }) : e === "parameters" &&
|
|
1701
|
-
allComponents:
|
|
1702
|
-
defaultLocale:
|
|
1713
|
+
] }) : e === "parameters" && a ? /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(M, {
|
|
1714
|
+
allComponents: y,
|
|
1715
|
+
defaultLocale: u,
|
|
1703
1716
|
component: t,
|
|
1704
|
-
property:
|
|
1717
|
+
property: l,
|
|
1705
1718
|
size: "small",
|
|
1706
1719
|
fullWidth: !0,
|
|
1707
|
-
valueImmutable:
|
|
1708
|
-
value:
|
|
1709
|
-
onChange: (
|
|
1720
|
+
valueImmutable: ie(a.renderer.properties?.[l.id]?.locales?.[o]?.value),
|
|
1721
|
+
value: a.renderer.properties?.[l.id]?.locales?.[o]?.value ?? a.renderer.properties?.[l.id]?.locales?.[u]?.value ?? l.locales?.[o]?.defaultValue ?? l.locales?.[u]?.defaultValue,
|
|
1722
|
+
onChange: (n) => {
|
|
1710
1723
|
m.transact(() => {
|
|
1711
|
-
|
|
1724
|
+
a.renderer.properties ??= {}, a.renderer.properties[l.id] ??= {}, a.renderer.properties[l.id].locales ??= {}, a.renderer.properties[l.id].locales[o] ??= {}, a.renderer.properties[l.id].locales[o].value = n;
|
|
1712
1725
|
});
|
|
1713
1726
|
}
|
|
1714
1727
|
}) }) : null
|
|
1715
|
-
},
|
|
1728
|
+
}, l.id) }, o)) }, l.id)) })
|
|
1716
1729
|
] }) }) }),
|
|
1717
|
-
/* @__PURE__ */ r(
|
|
1730
|
+
/* @__PURE__ */ r(Ae, { children: /* @__PURE__ */ r(D, { onClick: (l) => i.onClose?.(l, "escapeKeyDown"), children: s("close") }) })
|
|
1718
1731
|
] });
|
|
1719
1732
|
}
|
|
1720
|
-
const Ne = (e, t) => (
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
], h = Math.min(
|
|
1733
|
+
const Ne = (e, t) => (i) => {
|
|
1734
|
+
const s = [
|
|
1735
|
+
i.palette.info.main,
|
|
1736
|
+
i.palette.primary.main,
|
|
1737
|
+
i.palette.secondary.main,
|
|
1738
|
+
i.palette.success.main,
|
|
1739
|
+
i.palette.warning.main
|
|
1740
|
+
], h = Math.min(s.length - 1, e), p = s[h], u = ce(p, 0.5), y = ce(p, 1);
|
|
1728
1741
|
return {
|
|
1729
1742
|
// 保留原有的边框样式
|
|
1730
|
-
borderColor: `${
|
|
1743
|
+
borderColor: `${u} !important`,
|
|
1731
1744
|
borderLeft: "3px solid !important",
|
|
1732
1745
|
// 稍粗的左侧边框
|
|
1733
|
-
borderLeftColor:
|
|
1746
|
+
borderLeftColor: u,
|
|
1734
1747
|
// 使用透明度适应深色/浅色模式
|
|
1735
|
-
color:
|
|
1748
|
+
color: y,
|
|
1736
1749
|
...t
|
|
1737
1750
|
};
|
|
1738
1751
|
};
|
|
1739
|
-
function
|
|
1740
|
-
const { t: h, locale: p } = R(),
|
|
1752
|
+
function yt({ property: e, onChange: t, defaultLocale: i, allComponents: s }) {
|
|
1753
|
+
const { t: h, locale: p } = R(), u = le(null), y = ht(u, e), m = W(() => {
|
|
1741
1754
|
if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
|
|
1742
1755
|
try {
|
|
1743
|
-
let
|
|
1744
|
-
T(Object.values(e.subProperties), "index").filter((
|
|
1745
|
-
if (!
|
|
1756
|
+
let c = {};
|
|
1757
|
+
T(Object.values(e.subProperties), "index").filter((o) => o.data.visible !== !1 && o.data.key).forEach(({ data: o }) => {
|
|
1758
|
+
if (!o.key)
|
|
1746
1759
|
return;
|
|
1747
|
-
let
|
|
1748
|
-
if (
|
|
1749
|
-
|
|
1750
|
-
else if (
|
|
1751
|
-
|
|
1752
|
-
else if ((
|
|
1760
|
+
let n = o.locales?.[p]?.defaultValue ?? o.locales?.[i]?.defaultValue;
|
|
1761
|
+
if (o.type === "number")
|
|
1762
|
+
n = Number(n);
|
|
1763
|
+
else if (o.type === "boolean")
|
|
1764
|
+
n = n === !0 || n === "true";
|
|
1765
|
+
else if ((o.type === "json" || o.type === "yaml") && typeof n == "string")
|
|
1753
1766
|
try {
|
|
1754
|
-
|
|
1767
|
+
o.type === "json" ? n = JSON.parse(n) : n = me.parse(n);
|
|
1755
1768
|
} catch (f) {
|
|
1756
|
-
console.error("Error parsing nested value",
|
|
1769
|
+
console.error("Error parsing nested value", n, f), n = {};
|
|
1757
1770
|
}
|
|
1758
|
-
|
|
1759
|
-
}), e.type === "array" && !Array.isArray(
|
|
1760
|
-
const
|
|
1761
|
-
t?.(
|
|
1762
|
-
} catch (
|
|
1763
|
-
console.error("Error converting structure to text:",
|
|
1771
|
+
c[o.key] = n;
|
|
1772
|
+
}), e.type === "array" && !Array.isArray(c) && (c = U(c) ? [] : [c]);
|
|
1773
|
+
const l = xe(c, e.type);
|
|
1774
|
+
t?.(l);
|
|
1775
|
+
} catch (c) {
|
|
1776
|
+
console.error("Error converting structure to text:", c);
|
|
1764
1777
|
}
|
|
1765
|
-
}, [e, p,
|
|
1766
|
-
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */
|
|
1778
|
+
}, [e, p, i, t]);
|
|
1779
|
+
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ C(k, {
|
|
1767
1780
|
direction: "column",
|
|
1768
|
-
ref:
|
|
1781
|
+
ref: u,
|
|
1769
1782
|
sx: {
|
|
1770
1783
|
gap: 1.5,
|
|
1771
1784
|
width: "100%"
|
|
1772
1785
|
},
|
|
1773
1786
|
children: [
|
|
1774
|
-
/* @__PURE__ */ r(
|
|
1787
|
+
/* @__PURE__ */ r(ir, { sx: { mt: -1 }, children: /* @__PURE__ */ r(A, {
|
|
1775
1788
|
variant: "caption",
|
|
1776
1789
|
sx: {
|
|
1777
1790
|
color: "text.secondary"
|
|
1778
1791
|
},
|
|
1779
1792
|
children: h("maker.properties.subProperties")
|
|
1780
1793
|
}) }),
|
|
1781
|
-
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ r(
|
|
1794
|
+
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ r($e, {
|
|
1782
1795
|
component: k,
|
|
1783
1796
|
gap: 2,
|
|
1784
1797
|
list: e.subProperties,
|
|
1785
|
-
renderItem: (
|
|
1786
|
-
const
|
|
1787
|
-
return /* @__PURE__ */ r(
|
|
1798
|
+
renderItem: (c, a, l) => {
|
|
1799
|
+
const o = c.visible !== !1, n = c.shared ?? !1;
|
|
1800
|
+
return /* @__PURE__ */ r(_, {
|
|
1788
1801
|
elevation: 0,
|
|
1789
1802
|
className: "property-container",
|
|
1790
1803
|
sx: {
|
|
1791
1804
|
p: 1.25,
|
|
1792
1805
|
borderRadius: 1,
|
|
1793
|
-
border:
|
|
1794
|
-
"&": Ne(
|
|
1806
|
+
border: o ? "1px solid" : "1px dashed",
|
|
1807
|
+
"&": Ne(y)
|
|
1795
1808
|
},
|
|
1796
1809
|
children: /* @__PURE__ */ r(k, {
|
|
1797
1810
|
sx: {
|
|
1798
1811
|
gap: 2
|
|
1799
1812
|
},
|
|
1800
|
-
children: /* @__PURE__ */ r(
|
|
1801
|
-
data:
|
|
1802
|
-
params:
|
|
1803
|
-
visible:
|
|
1813
|
+
children: /* @__PURE__ */ r(Ye, {
|
|
1814
|
+
data: c,
|
|
1815
|
+
params: l,
|
|
1816
|
+
visible: o,
|
|
1817
|
+
shared: n,
|
|
1804
1818
|
config: {
|
|
1805
1819
|
properties: e.subProperties
|
|
1806
1820
|
},
|
|
1807
1821
|
currentLocale: p,
|
|
1808
|
-
defaultLocale:
|
|
1809
|
-
allComponents:
|
|
1810
|
-
onUpdateConfig: (
|
|
1822
|
+
defaultLocale: i,
|
|
1823
|
+
allComponents: s,
|
|
1824
|
+
onUpdateConfig: (f) => {
|
|
1811
1825
|
try {
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
const
|
|
1826
|
+
const b = { properties: e.subProperties || {} };
|
|
1827
|
+
f(b);
|
|
1828
|
+
const d = {
|
|
1815
1829
|
...e,
|
|
1816
|
-
subProperties:
|
|
1830
|
+
subProperties: b.properties
|
|
1817
1831
|
};
|
|
1818
|
-
t?.(
|
|
1819
|
-
} catch (
|
|
1820
|
-
console.error("Error updating property:",
|
|
1832
|
+
t?.(d, { forceUpdateProperty: !0 }), m();
|
|
1833
|
+
} catch (b) {
|
|
1834
|
+
console.error("Error updating property:", b);
|
|
1821
1835
|
}
|
|
1822
1836
|
}
|
|
1823
1837
|
})
|
|
1824
1838
|
})
|
|
1825
|
-
},
|
|
1839
|
+
}, c.id);
|
|
1826
1840
|
}
|
|
1827
1841
|
}) : /* @__PURE__ */ r(Y, { style: { fontSize: 12, height: 100 }, children: h("maker.properties.noSubProperties") }),
|
|
1828
|
-
/* @__PURE__ */ r(
|
|
1842
|
+
/* @__PURE__ */ r(D, {
|
|
1829
1843
|
fullWidth: !0,
|
|
1830
1844
|
variant: "outlined",
|
|
1831
1845
|
className: "ignore-style-override",
|
|
@@ -1833,13 +1847,14 @@ function bt({ property: e, onChange: t, defaultLocale: n, allComponents: l }) {
|
|
|
1833
1847
|
startIcon: /* @__PURE__ */ r(Le, {}),
|
|
1834
1848
|
onClick: () => {
|
|
1835
1849
|
try {
|
|
1836
|
-
const
|
|
1837
|
-
index: Object.values(
|
|
1850
|
+
const c = e.subProperties || {}, a = He(), o = {
|
|
1851
|
+
index: Object.values(c).length,
|
|
1838
1852
|
data: {
|
|
1839
|
-
id:
|
|
1853
|
+
id: a,
|
|
1840
1854
|
key: "",
|
|
1841
1855
|
type: "string",
|
|
1842
1856
|
visible: !0,
|
|
1857
|
+
shared: !1,
|
|
1843
1858
|
locales: {
|
|
1844
1859
|
[p]: {
|
|
1845
1860
|
name: "",
|
|
@@ -1849,20 +1864,20 @@ function bt({ property: e, onChange: t, defaultLocale: n, allComponents: l }) {
|
|
|
1849
1864
|
// 为嵌套属性预初始化
|
|
1850
1865
|
subProperties: {}
|
|
1851
1866
|
}
|
|
1852
|
-
},
|
|
1867
|
+
}, n = {
|
|
1853
1868
|
...e,
|
|
1854
1869
|
subProperties: {
|
|
1855
|
-
...
|
|
1856
|
-
[
|
|
1870
|
+
...c,
|
|
1871
|
+
[a]: o
|
|
1857
1872
|
}
|
|
1858
1873
|
};
|
|
1859
|
-
t?.(
|
|
1860
|
-
} catch (
|
|
1861
|
-
console.error("Error adding property:",
|
|
1874
|
+
t?.(n, { forceUpdateProperty: !0 }), m();
|
|
1875
|
+
} catch (c) {
|
|
1876
|
+
console.error("Error adding property:", c);
|
|
1862
1877
|
}
|
|
1863
1878
|
},
|
|
1864
1879
|
sx: {
|
|
1865
|
-
"&": Ne(
|
|
1880
|
+
"&": Ne(y, {
|
|
1866
1881
|
// borderLeft: undefined,
|
|
1867
1882
|
})
|
|
1868
1883
|
},
|
|
@@ -1871,91 +1886,91 @@ function bt({ property: e, onChange: t, defaultLocale: n, allComponents: l }) {
|
|
|
1871
1886
|
]
|
|
1872
1887
|
});
|
|
1873
1888
|
}
|
|
1874
|
-
function
|
|
1875
|
-
const { locale: m } = R(),
|
|
1876
|
-
const
|
|
1877
|
-
|
|
1878
|
-
let
|
|
1879
|
-
|
|
1889
|
+
function M({ component: e, property: t, value: i, onChange: s, valueImmutable: h, defaultLocale: p, allComponents: u, ...y }) {
|
|
1890
|
+
const { locale: m } = R(), c = hr(), a = le(null), l = () => {
|
|
1891
|
+
const n = c?.current?.getUploader();
|
|
1892
|
+
n?.open(), a.current && n.onceUploadSuccess(({ response: f }) => {
|
|
1893
|
+
let b = f?.data?.filename || "";
|
|
1894
|
+
b && (b = `mediakit://${b}`, i && !i.includes("mediakit://") && (b += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), a.current?.(b);
|
|
1880
1895
|
});
|
|
1881
|
-
},
|
|
1896
|
+
}, o = y.label ?? (t.locales?.[m]?.name || t.locales?.[p]?.name || t.key || t.id);
|
|
1882
1897
|
if (t.type === "number")
|
|
1883
|
-
return /* @__PURE__ */ r(
|
|
1884
|
-
...
|
|
1885
|
-
label:
|
|
1898
|
+
return /* @__PURE__ */ r(xt, {
|
|
1899
|
+
...y,
|
|
1900
|
+
label: o,
|
|
1886
1901
|
NumberProps: {
|
|
1887
|
-
value: ["number", "string"].includes(typeof
|
|
1888
|
-
onChange: (
|
|
1902
|
+
value: ["number", "string"].includes(typeof i) ? i : null,
|
|
1903
|
+
onChange: (n, f) => s?.(f)
|
|
1889
1904
|
}
|
|
1890
1905
|
});
|
|
1891
1906
|
if (t.type === "decimal")
|
|
1892
1907
|
return /* @__PURE__ */ r(V, {
|
|
1893
|
-
...
|
|
1894
|
-
label:
|
|
1908
|
+
...y,
|
|
1909
|
+
label: o,
|
|
1895
1910
|
type: "text",
|
|
1896
|
-
value:
|
|
1897
|
-
onChange: (
|
|
1898
|
-
const f =
|
|
1911
|
+
value: i ?? "",
|
|
1912
|
+
onChange: (n) => {
|
|
1913
|
+
const f = n.target.value;
|
|
1899
1914
|
if (f === "" || f === "-") {
|
|
1900
|
-
|
|
1915
|
+
s?.(f);
|
|
1901
1916
|
return;
|
|
1902
1917
|
}
|
|
1903
1918
|
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(f)) {
|
|
1904
|
-
let
|
|
1905
|
-
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(
|
|
1919
|
+
let d = f;
|
|
1920
|
+
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(d) && (d = Number(d)), s?.(d);
|
|
1906
1921
|
}
|
|
1907
1922
|
}
|
|
1908
1923
|
});
|
|
1909
1924
|
if (t.type === "boolean")
|
|
1910
1925
|
return /* @__PURE__ */ r(ge, {
|
|
1911
|
-
label:
|
|
1926
|
+
label: o,
|
|
1912
1927
|
labelPlacement: "start",
|
|
1913
|
-
control: /* @__PURE__ */ r(Re, { checked:
|
|
1928
|
+
control: /* @__PURE__ */ r(Re, { checked: i === !0, onChange: (n, f) => s?.(f) })
|
|
1914
1929
|
});
|
|
1915
1930
|
if (t.type === "color")
|
|
1916
|
-
return /* @__PURE__ */ r(
|
|
1917
|
-
label:
|
|
1918
|
-
value:
|
|
1919
|
-
onChange: (
|
|
1920
|
-
|
|
1931
|
+
return /* @__PURE__ */ r(nt, {
|
|
1932
|
+
label: o,
|
|
1933
|
+
value: i,
|
|
1934
|
+
onChange: (n) => {
|
|
1935
|
+
s?.(n);
|
|
1921
1936
|
}
|
|
1922
1937
|
});
|
|
1923
1938
|
if (t.type === "json" || t.type === "yaml")
|
|
1924
|
-
return /* @__PURE__ */ r(
|
|
1925
|
-
label:
|
|
1926
|
-
value:
|
|
1927
|
-
onChange: (
|
|
1928
|
-
|
|
1939
|
+
return /* @__PURE__ */ r(it, {
|
|
1940
|
+
label: o,
|
|
1941
|
+
value: i,
|
|
1942
|
+
onChange: (n) => {
|
|
1943
|
+
s?.(n);
|
|
1929
1944
|
},
|
|
1930
1945
|
property: t,
|
|
1931
1946
|
component: e,
|
|
1932
1947
|
defaultLocale: p,
|
|
1933
|
-
allComponents:
|
|
1934
|
-
PropertyValueField:
|
|
1935
|
-
onUpload: (
|
|
1936
|
-
|
|
1948
|
+
allComponents: u,
|
|
1949
|
+
PropertyValueField: M,
|
|
1950
|
+
onUpload: (n) => {
|
|
1951
|
+
a.current = n, l();
|
|
1937
1952
|
}
|
|
1938
1953
|
});
|
|
1939
1954
|
if (t.type === "custom") {
|
|
1940
|
-
const
|
|
1941
|
-
return
|
|
1955
|
+
const n = u[t.componentId]?.data;
|
|
1956
|
+
return n ? /* @__PURE__ */ r(P, {
|
|
1942
1957
|
sx: {
|
|
1943
1958
|
width: "100%"
|
|
1944
1959
|
},
|
|
1945
|
-
children: /* @__PURE__ */ r(
|
|
1946
|
-
componentId:
|
|
1947
|
-
props: { label:
|
|
1960
|
+
children: /* @__PURE__ */ r(Ue, {
|
|
1961
|
+
componentId: n.id,
|
|
1962
|
+
props: { label: o, value: i, onChange: s },
|
|
1948
1963
|
locale: m,
|
|
1949
1964
|
dev: {
|
|
1950
1965
|
mode: "draft",
|
|
1951
|
-
components:
|
|
1966
|
+
components: u,
|
|
1952
1967
|
defaultLocale: p
|
|
1953
1968
|
}
|
|
1954
1969
|
})
|
|
1955
|
-
}) : /* @__PURE__ */ r(V, { ...
|
|
1970
|
+
}) : /* @__PURE__ */ r(V, { ...y, label: o, disabled: !0, placeholder: "Click right button select a component" });
|
|
1956
1971
|
}
|
|
1957
1972
|
if (t.type === "component")
|
|
1958
|
-
return /* @__PURE__ */
|
|
1973
|
+
return /* @__PURE__ */ C(k, {
|
|
1959
1974
|
direction: "column",
|
|
1960
1975
|
sx: {
|
|
1961
1976
|
width: "100%",
|
|
@@ -1963,40 +1978,40 @@ function L({ component: e, property: t, value: n, onChange: l, valueImmutable: h
|
|
|
1963
1978
|
},
|
|
1964
1979
|
children: [
|
|
1965
1980
|
/* @__PURE__ */ r(Se, {
|
|
1966
|
-
allComponents:
|
|
1967
|
-
label:
|
|
1968
|
-
value:
|
|
1969
|
-
onChange: (
|
|
1970
|
-
h || !
|
|
1981
|
+
allComponents: u,
|
|
1982
|
+
label: o,
|
|
1983
|
+
value: i?.componentId,
|
|
1984
|
+
onChange: (n, f) => {
|
|
1985
|
+
h || !i ? s?.({ ...i && JSON.parse(JSON.stringify(i)), componentId: f }) : typeof i == "object" && (i.componentId = f, s?.({ ...i && JSON.parse(JSON.stringify(i)), componentId: f }));
|
|
1971
1986
|
}
|
|
1972
1987
|
}),
|
|
1973
|
-
|
|
1974
|
-
value:
|
|
1988
|
+
i?.componentId && /* @__PURE__ */ r(gt, {
|
|
1989
|
+
value: i,
|
|
1975
1990
|
valueImmutable: h,
|
|
1976
|
-
onChange:
|
|
1991
|
+
onChange: s,
|
|
1977
1992
|
defaultLocale: p,
|
|
1978
|
-
allComponents:
|
|
1993
|
+
allComponents: u
|
|
1979
1994
|
})
|
|
1980
1995
|
]
|
|
1981
1996
|
});
|
|
1982
1997
|
if (!t.type || ["string", "url", "multiline"].includes(t.type)) {
|
|
1983
|
-
let
|
|
1984
|
-
t.type === "multiline" && (
|
|
1985
|
-
const f = t.type === "url" ?
|
|
1998
|
+
let n = t.type === "string" ? t.multiline : void 0;
|
|
1999
|
+
t.type === "multiline" && (n = !0);
|
|
2000
|
+
const f = t.type === "url" ? i?.url : i;
|
|
1986
2001
|
return /* @__PURE__ */ r(V, {
|
|
1987
|
-
...
|
|
1988
|
-
label:
|
|
2002
|
+
...y,
|
|
2003
|
+
label: o,
|
|
1989
2004
|
value: typeof f == "string" ? f : "",
|
|
1990
|
-
multiline:
|
|
1991
|
-
minRows:
|
|
1992
|
-
maxRows:
|
|
1993
|
-
onChange: (
|
|
2005
|
+
multiline: n,
|
|
2006
|
+
minRows: n ? 2 : void 0,
|
|
2007
|
+
maxRows: n ? 10 : void 0,
|
|
2008
|
+
onChange: (b) => s?.(t.type === "url" ? { ...i, url: b.target.value, mediaKitUrl: b.target.value } : b.target.value),
|
|
1994
2009
|
slotProps: {
|
|
1995
2010
|
input: t.type === "url" ? {
|
|
1996
2011
|
sx: {
|
|
1997
2012
|
pr: 0
|
|
1998
2013
|
},
|
|
1999
|
-
endAdornment: /* @__PURE__ */
|
|
2014
|
+
endAdornment: /* @__PURE__ */ C(H, {
|
|
2000
2015
|
position: "end",
|
|
2001
2016
|
sx: {
|
|
2002
2017
|
display: "flex",
|
|
@@ -2005,63 +2020,63 @@ function L({ component: e, property: t, value: n, onChange: l, valueImmutable: h
|
|
|
2005
2020
|
},
|
|
2006
2021
|
children: [
|
|
2007
2022
|
/* @__PURE__ */ r(Pe, {
|
|
2008
|
-
onChange: async ({ response:
|
|
2009
|
-
const
|
|
2010
|
-
let
|
|
2011
|
-
|
|
2023
|
+
onChange: async ({ response: b }) => {
|
|
2024
|
+
const d = b?.data?.url || b?.data?.fileUrl;
|
|
2025
|
+
let x;
|
|
2026
|
+
d && (x = await ue(d).catch(() => pe(d)).catch(() => {
|
|
2012
2027
|
}));
|
|
2013
|
-
let w =
|
|
2014
|
-
w && (w = `mediakit://${w}`),
|
|
2015
|
-
url:
|
|
2028
|
+
let w = b?.data?.filename || "";
|
|
2029
|
+
w && (w = `mediakit://${w}`), s?.({
|
|
2030
|
+
url: d,
|
|
2016
2031
|
mediaKitUrl: w,
|
|
2017
|
-
width:
|
|
2018
|
-
height:
|
|
2032
|
+
width: x?.naturalWidth,
|
|
2033
|
+
height: x?.naturalHeight
|
|
2019
2034
|
});
|
|
2020
2035
|
}
|
|
2021
2036
|
}),
|
|
2022
|
-
/* @__PURE__ */ r(
|
|
2037
|
+
/* @__PURE__ */ r(B, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ r(Me, { sx: { cursor: "default", mr: 1 }, fontSize: "small" }) })
|
|
2023
2038
|
]
|
|
2024
2039
|
})
|
|
2025
2040
|
} : void 0
|
|
2026
2041
|
}
|
|
2027
2042
|
});
|
|
2028
2043
|
}
|
|
2029
|
-
return t.type === "array" ? /* @__PURE__ */ r(
|
|
2030
|
-
label:
|
|
2031
|
-
value: Array.isArray(
|
|
2032
|
-
onChange: (
|
|
2044
|
+
return t.type === "array" ? /* @__PURE__ */ r(rt, {
|
|
2045
|
+
label: o,
|
|
2046
|
+
value: Array.isArray(i) ? i : [],
|
|
2047
|
+
onChange: (n) => s?.(n),
|
|
2033
2048
|
property: t,
|
|
2034
|
-
renderItem: ({ item:
|
|
2049
|
+
renderItem: ({ item: n, index: f, onChange: b }) => t.subProperties && Object.keys(t.subProperties).length > 0 ? /* @__PURE__ */ r(k, {
|
|
2035
2050
|
sx: {
|
|
2036
2051
|
gap: 1,
|
|
2037
2052
|
width: "100%"
|
|
2038
2053
|
},
|
|
2039
|
-
children: T(Object.values(t.subProperties), "index").filter((
|
|
2054
|
+
children: T(Object.values(t.subProperties), "index").filter((d) => d.data.visible !== !1).map(({ data: d }) => d.key ? /* @__PURE__ */ r(M, {
|
|
2040
2055
|
component: e,
|
|
2041
|
-
property:
|
|
2042
|
-
value:
|
|
2043
|
-
onChange: (
|
|
2044
|
-
const w = { ...
|
|
2045
|
-
|
|
2056
|
+
property: d,
|
|
2057
|
+
value: n[d.key],
|
|
2058
|
+
onChange: (x) => {
|
|
2059
|
+
const w = { ...n, [d.key]: x };
|
|
2060
|
+
b(w);
|
|
2046
2061
|
},
|
|
2047
2062
|
size: "small",
|
|
2048
2063
|
fullWidth: !0,
|
|
2049
2064
|
defaultLocale: p,
|
|
2050
|
-
allComponents:
|
|
2051
|
-
},
|
|
2052
|
-
}, f) : /* @__PURE__ */ r(V, { size:
|
|
2065
|
+
allComponents: u
|
|
2066
|
+
}, d.id) : null)
|
|
2067
|
+
}, f) : /* @__PURE__ */ r(V, { size: y.size, fullWidth: !0, value: n, onChange: (d) => b(d.target.value) })
|
|
2053
2068
|
}) : (console.error("Unsupported property type", t.type), null);
|
|
2054
2069
|
}
|
|
2055
|
-
function
|
|
2056
|
-
const { getInputProps:
|
|
2070
|
+
function xt({ NumberProps: e, ...t }) {
|
|
2071
|
+
const { getInputProps: i } = xr(e), s = i();
|
|
2057
2072
|
return /* @__PURE__ */ r(V, {
|
|
2058
2073
|
...t,
|
|
2059
2074
|
slotProps: {
|
|
2060
|
-
htmlInput:
|
|
2075
|
+
htmlInput: s
|
|
2061
2076
|
}
|
|
2062
2077
|
});
|
|
2063
2078
|
}
|
|
2064
|
-
const
|
|
2079
|
+
const vt = `import React from '@blocklet/pages-kit/builtin/react'
|
|
2065
2080
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
2066
2081
|
|
|
2067
2082
|
export default function () {
|
|
@@ -2070,14 +2085,14 @@ export default function () {
|
|
|
2070
2085
|
Hello World
|
|
2071
2086
|
</Box>
|
|
2072
2087
|
)
|
|
2073
|
-
}`,
|
|
2088
|
+
}`, Ct = `console.log('hello')
|
|
2074
2089
|
`;
|
|
2075
|
-
function
|
|
2076
|
-
const { locale: t } = R(),
|
|
2077
|
-
return
|
|
2078
|
-
e.renderer?.script || (
|
|
2079
|
-
e.renderer.script = e.renderer.type === "react-component" ?
|
|
2080
|
-
}),
|
|
2090
|
+
function Pt({ value: e }) {
|
|
2091
|
+
const { locale: t } = R(), i = We(), s = q(e).doc;
|
|
2092
|
+
return L(() => {
|
|
2093
|
+
e.renderer?.script || (s.transact(() => {
|
|
2094
|
+
e.renderer.script = e.renderer.type === "react-component" ? vt : Ct;
|
|
2095
|
+
}), i());
|
|
2081
2096
|
}, [e]), /* @__PURE__ */ r(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ r(Ce, {
|
|
2082
2097
|
keyId: e.id,
|
|
2083
2098
|
locale: t,
|
|
@@ -2090,173 +2105,175 @@ function vt({ value: e }) {
|
|
|
2090
2105
|
}
|
|
2091
2106
|
}, e.id) });
|
|
2092
2107
|
}
|
|
2093
|
-
function
|
|
2094
|
-
const { t } = R(),
|
|
2095
|
-
return /* @__PURE__ */ r(
|
|
2108
|
+
function kt({ value: e }) {
|
|
2109
|
+
const { t } = R(), i = q(e).doc, { state: { components: s, config: { defaultLocale: h }, resources: p }, localState: { currentLocale: u } } = oe(), y = ve(), m = s[e.renderer.componentId]?.data ?? p.components?.[e.renderer.componentId]?.component, c = ke({ variant: "dialog" });
|
|
2110
|
+
return /* @__PURE__ */ r(se, { children: /* @__PURE__ */ C(k, {
|
|
2096
2111
|
sx: {
|
|
2097
2112
|
gap: 1
|
|
2098
2113
|
},
|
|
2099
2114
|
children: [
|
|
2100
2115
|
/* @__PURE__ */ r(Se, {
|
|
2101
|
-
allComponents:
|
|
2116
|
+
allComponents: y,
|
|
2102
2117
|
excludes: [e.id],
|
|
2103
2118
|
value: e.renderer.componentId,
|
|
2104
|
-
onChange: (
|
|
2119
|
+
onChange: (a, l) => e.renderer.componentId = l
|
|
2105
2120
|
}),
|
|
2106
|
-
m && /* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2121
|
+
m && /* @__PURE__ */ C(F, { children: [
|
|
2122
|
+
/* @__PURE__ */ C(k, {
|
|
2108
2123
|
direction: "row",
|
|
2109
2124
|
sx: {
|
|
2110
2125
|
justifyContent: "space-between",
|
|
2111
2126
|
alignItems: "center"
|
|
2112
2127
|
},
|
|
2113
2128
|
children: [
|
|
2114
|
-
/* @__PURE__ */ r(
|
|
2115
|
-
/* @__PURE__ */ r(
|
|
2129
|
+
/* @__PURE__ */ r(A, { variant: "subtitle2", children: t("parameters") }),
|
|
2130
|
+
/* @__PURE__ */ r(D, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...we(c), children: /* @__PURE__ */ r(Be, { fontSize: "small" }) })
|
|
2116
2131
|
]
|
|
2117
2132
|
}),
|
|
2118
|
-
m.properties && T(Object.values(m.properties), "index").map(({ data:
|
|
2119
|
-
allComponents:
|
|
2133
|
+
m.properties && T(Object.values(m.properties), "index").map(({ data: a }) => /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(M, {
|
|
2134
|
+
allComponents: y,
|
|
2120
2135
|
defaultLocale: h,
|
|
2121
2136
|
component: m,
|
|
2122
|
-
property:
|
|
2137
|
+
property: a,
|
|
2123
2138
|
fullWidth: !0,
|
|
2124
2139
|
size: "small",
|
|
2125
|
-
valueImmutable:
|
|
2126
|
-
value: e.renderer.properties?.[
|
|
2127
|
-
onChange: (
|
|
2128
|
-
|
|
2129
|
-
e.renderer.properties ??= {}, e.renderer.properties[
|
|
2140
|
+
valueImmutable: ie(e.renderer.properties?.[a.id]?.locales?.[u]?.value),
|
|
2141
|
+
value: e.renderer.properties?.[a.id]?.locales?.[u]?.value ?? e.renderer.properties?.[a.id]?.locales?.[h]?.value ?? a.locales?.[u]?.defaultValue ?? a.locales?.[h]?.defaultValue,
|
|
2142
|
+
onChange: (l) => {
|
|
2143
|
+
i.transact(() => {
|
|
2144
|
+
e.renderer.properties ??= {}, e.renderer.properties[a.id] ??= {}, e.renderer.properties[a.id].locales ??= {}, e.renderer.properties[a.id].locales[u] ??= {}, e.renderer.properties[a.id].locales[u].value = l;
|
|
2130
2145
|
});
|
|
2131
2146
|
}
|
|
2132
|
-
}) },
|
|
2133
|
-
/* @__PURE__ */ r(
|
|
2147
|
+
}) }, a.id)),
|
|
2148
|
+
/* @__PURE__ */ r(qe, { ...Je(c), component: e, type: "parameters" })
|
|
2134
2149
|
] })
|
|
2135
2150
|
]
|
|
2136
2151
|
}) });
|
|
2137
2152
|
}
|
|
2138
|
-
function Se({ label: e, options: t, excludes:
|
|
2139
|
-
const { t:
|
|
2153
|
+
function Se({ label: e, options: t, excludes: i, value: s, onChange: h, allComponents: p, ...u }) {
|
|
2154
|
+
const { t: y } = R(), m = t ?? T(Object.values(Tr(p, ...i ?? [])), "index").map((a) => a.data), c = (typeof s == "string" ? p[s]?.data : void 0) ?? null;
|
|
2140
2155
|
return /* @__PURE__ */ r(Te, {
|
|
2141
|
-
...
|
|
2156
|
+
...u,
|
|
2142
2157
|
size: "small",
|
|
2143
2158
|
options: m,
|
|
2144
2159
|
autoHighlight: !0,
|
|
2145
|
-
isOptionEqualToValue: (
|
|
2146
|
-
getOptionKey: (
|
|
2147
|
-
getOptionLabel: (
|
|
2148
|
-
renderInput: (
|
|
2149
|
-
value:
|
|
2150
|
-
onChange: (
|
|
2151
|
-
let
|
|
2152
|
-
|
|
2153
|
-
blockletId: p[
|
|
2154
|
-
blockletTitle: p[
|
|
2155
|
-
componentName: p[
|
|
2156
|
-
}), h?.(
|
|
2160
|
+
isOptionEqualToValue: (a, l) => a.id === l.id,
|
|
2161
|
+
getOptionKey: (a) => a.id,
|
|
2162
|
+
getOptionLabel: (a) => a.name || a.id,
|
|
2163
|
+
renderInput: (a) => /* @__PURE__ */ r(V, { label: e || y("component"), ...a }),
|
|
2164
|
+
value: c,
|
|
2165
|
+
onChange: (a, l) => {
|
|
2166
|
+
let o = {};
|
|
2167
|
+
l && (o = {
|
|
2168
|
+
blockletId: p[l?.id]?.blockletId,
|
|
2169
|
+
blockletTitle: p[l?.id]?.blockletTitle,
|
|
2170
|
+
componentName: p[l?.id]?.data?.name || p[l?.id]?.data?.id
|
|
2171
|
+
}), h?.(a, l?.id, o);
|
|
2157
2172
|
}
|
|
2158
2173
|
});
|
|
2159
2174
|
}
|
|
2160
|
-
function
|
|
2161
|
-
const { t:
|
|
2162
|
-
|
|
2175
|
+
function Qe({ config: e, allComponents: t, defaultLocale: i, propertiesValue: s, currentLocale: h, onChange: p, props: u }) {
|
|
2176
|
+
const { t: y } = R(), [m, c] = K(he(e?.properties)), [a, l] = K(null);
|
|
2177
|
+
L(() => {
|
|
2163
2178
|
(() => {
|
|
2164
|
-
e?.renderer?.type === "react-component" &&
|
|
2165
|
-
const w =
|
|
2166
|
-
|
|
2167
|
-
}) :
|
|
2179
|
+
e?.renderer?.type === "react-component" && U(e?.properties) ? br(e?.renderer?.script).then((x) => {
|
|
2180
|
+
const w = gr(x);
|
|
2181
|
+
c(w);
|
|
2182
|
+
}) : c(he(e?.properties));
|
|
2168
2183
|
})();
|
|
2169
2184
|
}, [JSON.stringify(e)]);
|
|
2170
|
-
const
|
|
2171
|
-
const w =
|
|
2172
|
-
return
|
|
2185
|
+
const o = W(() => !e || !m ? {} : Object.values(m).reduce((d, { data: x }) => {
|
|
2186
|
+
const w = x.key || x.id;
|
|
2187
|
+
return d[x.id] = {
|
|
2173
2188
|
key: w,
|
|
2174
|
-
value:
|
|
2175
|
-
id:
|
|
2176
|
-
type:
|
|
2177
|
-
|
|
2178
|
-
|
|
2189
|
+
value: u?.[w] ?? s?.[x.id]?.value ?? x.locales?.[h]?.defaultValue ?? x.locales?.[i]?.defaultValue,
|
|
2190
|
+
id: x.id,
|
|
2191
|
+
type: x.type,
|
|
2192
|
+
visible: Z(m, x.id),
|
|
2193
|
+
shared: Ge(m, x.id)
|
|
2194
|
+
}, d;
|
|
2195
|
+
}, {}), [JSON.stringify(m), e, s, h, i]), n = $(() => {
|
|
2179
2196
|
if (!m)
|
|
2180
2197
|
return {
|
|
2181
2198
|
canUseProperties: [],
|
|
2182
2199
|
visibleProperties: [],
|
|
2183
2200
|
canUsePropertiesKeys: []
|
|
2184
2201
|
};
|
|
2185
|
-
const
|
|
2202
|
+
const d = T(Object.values(m), "index"), x = d.filter(({ data: S }) => S.key && Z(m, S.id)), w = d.filter(({ data: S }) => S.key && S.type !== "component"), N = w.map(({ data: S }) => S.key);
|
|
2186
2203
|
return {
|
|
2187
2204
|
canUseProperties: w,
|
|
2188
|
-
visibleProperties:
|
|
2205
|
+
visibleProperties: x,
|
|
2189
2206
|
canUsePropertiesKeys: N
|
|
2190
2207
|
};
|
|
2191
|
-
}, [JSON.stringify(m)]), f =
|
|
2192
|
-
return /* @__PURE__ */ r(
|
|
2208
|
+
}, [JSON.stringify(m)]), f = o(), b = Ar(f, "key");
|
|
2209
|
+
return /* @__PURE__ */ r(se, { children: /* @__PURE__ */ C(k, {
|
|
2193
2210
|
sx: {
|
|
2194
2211
|
gap: 2
|
|
2195
2212
|
},
|
|
2196
2213
|
children: [
|
|
2197
|
-
/* @__PURE__ */ r(
|
|
2198
|
-
!e ||
|
|
2214
|
+
/* @__PURE__ */ r(A, { variant: "subtitle1", children: y("maker.properties.parameters") }),
|
|
2215
|
+
!e || n.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(Y, { style: { fontSize: 12 }, children: y("maker.properties.noParameters") }) : /* @__PURE__ */ C(F, { children: [
|
|
2199
2216
|
/* @__PURE__ */ r(k, {
|
|
2200
2217
|
sx: {
|
|
2201
2218
|
gap: 2
|
|
2202
2219
|
},
|
|
2203
|
-
children:
|
|
2220
|
+
children: n.visibleProperties.map(({ data: d }) => /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(M, {
|
|
2204
2221
|
allComponents: t,
|
|
2205
|
-
defaultLocale:
|
|
2222
|
+
defaultLocale: i,
|
|
2206
2223
|
size: "small",
|
|
2207
2224
|
fullWidth: !0,
|
|
2208
2225
|
component: e,
|
|
2209
|
-
property:
|
|
2210
|
-
valueImmutable:
|
|
2211
|
-
value:
|
|
2212
|
-
onChange: (
|
|
2226
|
+
property: d,
|
|
2227
|
+
valueImmutable: ie(s?.[d.id]?.value),
|
|
2228
|
+
value: u?.[d.key || d.id] ?? f[d.id]?.value,
|
|
2229
|
+
onChange: (x) => {
|
|
2213
2230
|
p({
|
|
2214
|
-
path: ["properties",
|
|
2215
|
-
id:
|
|
2216
|
-
value: { value:
|
|
2217
|
-
shouldSync: Oe(
|
|
2231
|
+
path: ["properties", d.id],
|
|
2232
|
+
id: d.id,
|
|
2233
|
+
value: { value: x },
|
|
2234
|
+
shouldSync: Oe(d),
|
|
2218
2235
|
excludeKeys: [],
|
|
2219
|
-
key:
|
|
2236
|
+
key: d.key || d.id
|
|
2220
2237
|
});
|
|
2221
2238
|
}
|
|
2222
|
-
}) },
|
|
2239
|
+
}) }, d.id))
|
|
2223
2240
|
}),
|
|
2224
2241
|
/* @__PURE__ */ r(k, {
|
|
2225
2242
|
sx: {
|
|
2226
2243
|
gap: 2,
|
|
2227
2244
|
width: "100%"
|
|
2228
2245
|
},
|
|
2229
|
-
children: /* @__PURE__ */ r(
|
|
2246
|
+
children: /* @__PURE__ */ r(Ue, {
|
|
2230
2247
|
componentId: e?.id || "",
|
|
2231
2248
|
renderType: "setting",
|
|
2232
2249
|
locale: h,
|
|
2233
2250
|
properties: f,
|
|
2234
|
-
dev: { mode: "draft", components: t, defaultLocale:
|
|
2251
|
+
dev: { mode: "draft", components: t, defaultLocale: i },
|
|
2235
2252
|
props: {
|
|
2236
|
-
...
|
|
2237
|
-
onChange: (
|
|
2238
|
-
const { canUsePropertiesKeys:
|
|
2239
|
-
Object.keys(
|
|
2240
|
-
const I =
|
|
2241
|
-
if (I?.id &&
|
|
2253
|
+
...Wr(u ?? {}, n.canUsePropertiesKeys),
|
|
2254
|
+
onChange: (d) => {
|
|
2255
|
+
const { canUsePropertiesKeys: x } = n;
|
|
2256
|
+
Object.keys(d).filter((N) => !Er(d[N], b?.[N]?.value)).filter((N) => !(N === "locale" && !Rr(b[N], "locale") || b[N]?.type === "component" || (b[N]?.type === "yaml" || b[N]?.type === "json") && Z(m, b[N]?.id))).reduce((N, S) => N.then(() => {
|
|
2257
|
+
const I = b[S], z = x.includes(S);
|
|
2258
|
+
if (I?.id && z)
|
|
2242
2259
|
return p({
|
|
2243
2260
|
path: ["properties", I.id],
|
|
2244
2261
|
id: I.id,
|
|
2245
|
-
value: { value:
|
|
2262
|
+
value: { value: d[S] },
|
|
2246
2263
|
shouldSync: Oe(I),
|
|
2247
2264
|
excludeKeys: [],
|
|
2248
2265
|
key: I.key || I.id
|
|
2249
2266
|
}), Promise.resolve();
|
|
2250
|
-
const
|
|
2251
|
-
if (
|
|
2267
|
+
const g = `propertyNotFound${S}`;
|
|
2268
|
+
if (a === g)
|
|
2252
2269
|
return Promise.resolve();
|
|
2253
|
-
|
|
2254
|
-
const
|
|
2270
|
+
fe.close(a);
|
|
2271
|
+
const v = fe.warning(y("maker.properties.propertyNotFound", {
|
|
2255
2272
|
key: S
|
|
2256
2273
|
}), {
|
|
2257
|
-
key:
|
|
2274
|
+
key: g
|
|
2258
2275
|
});
|
|
2259
|
-
return
|
|
2276
|
+
return l(v), Promise.resolve();
|
|
2260
2277
|
}), Promise.resolve());
|
|
2261
2278
|
}
|
|
2262
2279
|
}
|
|
@@ -2264,33 +2281,33 @@ function qe({ config: e, allComponents: t, defaultLocale: n, propertiesValue: l,
|
|
|
2264
2281
|
})
|
|
2265
2282
|
] })
|
|
2266
2283
|
]
|
|
2267
|
-
}) });
|
|
2284
|
+
}, h) });
|
|
2268
2285
|
}
|
|
2269
|
-
function
|
|
2270
|
-
const { t, locale:
|
|
2271
|
-
e.llmConfig =
|
|
2286
|
+
function wt({ config: e }) {
|
|
2287
|
+
const { t, locale: i } = R(), [s, h] = K(!1), p = (u) => {
|
|
2288
|
+
e.llmConfig = u;
|
|
2272
2289
|
};
|
|
2273
|
-
return /* @__PURE__ */
|
|
2274
|
-
/* @__PURE__ */ r(
|
|
2275
|
-
|
|
2276
|
-
open:
|
|
2290
|
+
return /* @__PURE__ */ C(F, { children: [
|
|
2291
|
+
/* @__PURE__ */ r(B, { title: t("maker.properties.configLLMDescription"), children: /* @__PURE__ */ r(G, { color: "primary", onClick: () => h(!0), size: "small", children: /* @__PURE__ */ r(Or, {}) }) }),
|
|
2292
|
+
s && /* @__PURE__ */ r(ct, {
|
|
2293
|
+
open: s,
|
|
2277
2294
|
onClose: () => h(!1),
|
|
2278
2295
|
onConfirm: p,
|
|
2279
2296
|
component: e,
|
|
2280
2297
|
initialConfig: e.llmConfig,
|
|
2281
|
-
locale:
|
|
2298
|
+
locale: i,
|
|
2282
2299
|
defaultLocale: "en",
|
|
2283
2300
|
title: t("maker.properties.llmConfigTitle")
|
|
2284
2301
|
})
|
|
2285
2302
|
] });
|
|
2286
2303
|
}
|
|
2287
2304
|
export {
|
|
2288
|
-
|
|
2305
|
+
mt as BasicInfo,
|
|
2289
2306
|
Se as CustomComponentAutocomplete,
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2307
|
+
hn as CustomComponentSettings,
|
|
2308
|
+
vt as DefaultReactComponentScriptTemplate,
|
|
2309
|
+
Ct as DefaultWebComponentScriptTemplate,
|
|
2310
|
+
Qe as ParametersConfig,
|
|
2311
|
+
ft as PropertiesConfig,
|
|
2312
|
+
M as PropertyValueField
|
|
2296
2313
|
};
|