@blocklet/pages-kit-inner-components 0.1.0 → 0.1.2
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/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +4 -4
- package/lib/cjs/site-state.js +1 -1
- package/lib/cjs/theme.js +239 -0
- package/lib/{draft-data-BR6QMafP.mjs → draft-data-Bbv-4GaF.mjs} +1 -1
- package/lib/{draft-data-DY34VJHh.js → draft-data-CgY7-dem.js} +1 -1
- package/lib/es/home.js +10 -8
- package/lib/es/locales.js +16 -4
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +946 -821
- package/lib/es/site-state.js +1 -1
- package/lib/es/theme.js +767 -0
- package/lib/home-D7i9eFDB.js +542 -0
- package/lib/{home-eQg2nzvF.mjs → home-DSngH2He.mjs} +698 -682
- package/lib/{publish-button-CKgx9XuN.mjs → publish-button-B0t_3Z4M.mjs} +2 -2
- package/lib/{publish-button-B-kvMf2a.js → publish-button-CrxBSa6-.js} +1 -1
- package/lib/{site-state-CrZeDXXY.mjs → site-state-BcfhbQn3.mjs} +304 -294
- package/lib/site-state-kBaXBQhY.js +1 -0
- package/lib/state-BQClQU2N.js +1 -0
- package/lib/state-C0vjPuun.mjs +407 -0
- package/package.json +26 -22
- package/lib/home-DhKwQuXD.js +0 -542
- package/lib/site-state-Ur6wK5g3.js +0 -1
- package/lib/state-BfVA6vd8.mjs +0 -378
- package/lib/state-C6F-M3XT.js +0 -1
package/lib/es/setting.js
CHANGED
|
@@ -1,147 +1,148 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { g as
|
|
3
|
-
import { TextField as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import
|
|
6
|
-
import { useLocaleContext as
|
|
7
|
-
import { styled as
|
|
8
|
-
import { cx as
|
|
9
|
-
import { useReactive as
|
|
10
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as w, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { g as re, i as Te, b as Ke, h as le, E as tt, n as rt, j as ae } from "../state-C0vjPuun.mjs";
|
|
3
|
+
import { TextField as O, Stack as D, FormControlLabel as Ne, Switch as Be, Box as P, InputAdornment as oe, Dialog as pe, DialogTitle as Ue, DialogContent as We, DialogActions as Ve, Button as A, alpha as it, Tooltip as Q, buttonClasses as nt, Typography as V, Autocomplete as Fe, Paper as me, MenuItem as R, FormLabel as lt, Popper as _e, Table as ot, TableHead as st, TableRow as Oe, TableCell as ze, TableBody as ct } from "@mui/material";
|
|
4
|
+
import { forwardRef as Ee, useState as ie, useEffect as X, useImperativeHandle as He, lazy as dt, useCallback as ne, Suspense as ut, useRef as Z, useId as at, useMemo as pt } from "react";
|
|
5
|
+
import he from "@arcblock/ux/lib/Empty";
|
|
6
|
+
import { useLocaleContext as j } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
+
import { styled as mt } from "@arcblock/ux/lib/Theme";
|
|
8
|
+
import { cx as ht } from "@emotion/css";
|
|
9
|
+
import { useReactive as ft, useBoolean as bt, useUpdate as yt } from "ahooks";
|
|
10
|
+
import Re from "gradient-parser";
|
|
11
11
|
import "lodash/without";
|
|
12
|
-
import
|
|
13
|
-
import { red as
|
|
14
|
-
import { getImageSize as
|
|
15
|
-
import { Icon as
|
|
16
|
-
import { useDebounce as
|
|
17
|
-
import { sortBy as
|
|
18
|
-
import
|
|
19
|
-
import { CodeEditor as
|
|
20
|
-
import { CustomComponentRenderer as
|
|
21
|
-
import { ClickAwayListener as
|
|
22
|
-
import { DeleteOutlineRounded as
|
|
12
|
+
import vt from "tinycolor2";
|
|
13
|
+
import { red as xt, pink as gt, purple as kt, indigo as It, blue as wt, cyan as St, teal as Pt, green as Ct, lime as Dt, yellow as Ot, amber as zt, orange as Rt, brown as jt, grey as At, blueGrey as Tt } from "@mui/material/colors";
|
|
14
|
+
import { getImageSize as de, getVideoSize as ue, UploaderButton as fe, UploaderProvider as be, useUploader as Kt } from "./uploader.js";
|
|
15
|
+
import { Icon as Nt } from "@iconify-icon/react";
|
|
16
|
+
import { useDebounce as Bt, useUpdate as Ut } from "react-use";
|
|
17
|
+
import { sortBy as F, omit as Wt, isNil as L, isEmpty as Vt } from "lodash";
|
|
18
|
+
import je from "@arcblock/ux/lib/Toast";
|
|
19
|
+
import { CodeEditor as Je } from "@blocklet/code-editor";
|
|
20
|
+
import { CustomComponentRenderer as Me, transpileAndLoadScript as Ft, getPropertiesFromCode as _t } from "@blocklet/pages-kit/components";
|
|
21
|
+
import { ClickAwayListener as $e, unstable_useNumberInput as Et } from "@mui/base";
|
|
22
|
+
import { VisibilityOffRounded as Ht, VisibilityRounded as Jt, DeleteOutlineRounded as Mt, DragIndicatorRounded as $t, AddRounded as Yt, TranslateRounded as Ye, InfoRounded as Ge, SettingsRounded as qe, StarRounded as Gt } from "@mui/icons-material";
|
|
23
23
|
import { getYjsValue as _ } from "@syncedstore/core";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
import qt from "lodash/has";
|
|
25
|
+
import Qt from "lodash/keyBy";
|
|
26
|
+
import Xt from "lodash/pick";
|
|
27
|
+
import { usePopupState as se, bindTrigger as ce, bindDialog as Qe, bindPopper as Xe } from "material-ui-popup-state/hooks";
|
|
28
|
+
import { ErrorBoundary as Zt } from "react-error-boundary";
|
|
29
|
+
import Lt from "lodash/sortBy";
|
|
30
|
+
import { useDrop as Ze, useDrag as er } from "react-dnd";
|
|
31
|
+
xt[300], gt[300], kt[300], // deepPurple['300'],
|
|
32
|
+
It[300], wt[300], // lightBlue['300'],
|
|
33
|
+
St[300], Pt[300], Ct[300], // lightGreen['300'],
|
|
34
|
+
Dt[300], Ot[300], zt[300], Rt[300], // deepOrange['300'],
|
|
35
|
+
jt[300], At[300], Tt[300];
|
|
36
|
+
const tr = Ee(function({ showMarkdown: r, markdown: i, onMarkdownChange: n, showUploader: u, value: v, meta: c, onChange: a, ...k }, l) {
|
|
37
|
+
const [y, f] = ie("");
|
|
38
|
+
X(() => {
|
|
39
|
+
f(v || "");
|
|
40
|
+
}, [v, f]);
|
|
41
|
+
const p = async () => {
|
|
42
|
+
if (y !== v) {
|
|
43
|
+
const o = re(y);
|
|
44
|
+
if (!o) {
|
|
45
|
+
a(y, void 0);
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
+
const s = await de(o).catch(() => ue(o)).catch(() => {
|
|
48
49
|
});
|
|
49
|
-
|
|
50
|
+
a(y, { ...s, filename: y });
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
|
-
|
|
53
|
+
Bt(
|
|
53
54
|
() => {
|
|
54
|
-
|
|
55
|
+
y !== v && a(y);
|
|
55
56
|
},
|
|
56
57
|
300,
|
|
57
|
-
[
|
|
58
|
-
),
|
|
59
|
-
submit:
|
|
58
|
+
[y]
|
|
59
|
+
), He(l, () => ({
|
|
60
|
+
submit: p
|
|
60
61
|
}));
|
|
61
|
-
const
|
|
62
|
-
return
|
|
62
|
+
const x = {};
|
|
63
|
+
return u && (x.InputProps = {
|
|
63
64
|
sx: { pr: 0 },
|
|
64
|
-
endAdornment: /* @__PURE__ */ e(
|
|
65
|
-
|
|
65
|
+
endAdornment: /* @__PURE__ */ e(oe, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ e(
|
|
66
|
+
fe,
|
|
66
67
|
{
|
|
67
|
-
onChange: async ({ response:
|
|
68
|
-
var
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
})),
|
|
73
|
-
...
|
|
74
|
-
filename:
|
|
68
|
+
onChange: async ({ response: o }) => {
|
|
69
|
+
var b;
|
|
70
|
+
const s = (b = o == null ? void 0 : o.data) == null ? void 0 : b.filename, g = re(s) || "";
|
|
71
|
+
let I = {};
|
|
72
|
+
g && (I = await de(g).catch(() => ue(g)).catch(() => {
|
|
73
|
+
})), a(s, {
|
|
74
|
+
...I,
|
|
75
|
+
filename: s
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
) })
|
|
79
80
|
}), /* @__PURE__ */ e(
|
|
80
|
-
|
|
81
|
+
O,
|
|
81
82
|
{
|
|
82
83
|
size: "small",
|
|
83
84
|
fullWidth: !0,
|
|
84
|
-
...
|
|
85
|
-
label: /* @__PURE__ */
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
...k,
|
|
86
|
+
label: /* @__PURE__ */ w(D, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
87
|
+
k.label,
|
|
88
|
+
r && /* @__PURE__ */ w(U, { children: [
|
|
88
89
|
" (",
|
|
89
90
|
/* @__PURE__ */ e(
|
|
90
|
-
|
|
91
|
+
Ne,
|
|
91
92
|
{
|
|
92
|
-
checked:
|
|
93
|
-
label: /* @__PURE__ */ e(
|
|
93
|
+
checked: i,
|
|
94
|
+
label: /* @__PURE__ */ e(P, { component: Nt, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
|
|
94
95
|
labelPlacement: "start",
|
|
95
|
-
control: /* @__PURE__ */ e(
|
|
96
|
+
control: /* @__PURE__ */ e(Be, { size: "small" }),
|
|
96
97
|
sx: { ml: 0.25, pr: 1 },
|
|
97
|
-
onChange: (
|
|
98
|
+
onChange: (o, s) => n == null ? void 0 : n(s)
|
|
98
99
|
}
|
|
99
100
|
),
|
|
100
101
|
")"
|
|
101
102
|
] })
|
|
102
103
|
] }),
|
|
103
|
-
InputLabelProps: { shrink: !0, ...
|
|
104
|
-
value:
|
|
105
|
-
onChange: (
|
|
106
|
-
...
|
|
107
|
-
onKeyDown: (
|
|
108
|
-
|
|
104
|
+
InputLabelProps: { shrink: !0, ...k.InputLabelProps },
|
|
105
|
+
value: y,
|
|
106
|
+
onChange: (o) => f(o.target.value),
|
|
107
|
+
...x,
|
|
108
|
+
onKeyDown: (o) => {
|
|
109
|
+
o.keyCode !== 229 && o.key === "Enter" && p();
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
);
|
|
112
|
-
}),
|
|
113
|
-
function
|
|
113
|
+
}), rr = dt(() => import("react-best-gradient-color-picker"));
|
|
114
|
+
function ir(t) {
|
|
114
115
|
try {
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
const
|
|
116
|
+
const i = Re.parse(t).map((u) => {
|
|
117
|
+
const v = u.colorStops.map((c) => {
|
|
118
|
+
if (c.type !== "rgba") {
|
|
119
|
+
const a = vt(c.value).toRgb();
|
|
119
120
|
return {
|
|
120
|
-
...
|
|
121
|
-
value: [
|
|
121
|
+
...c,
|
|
122
|
+
value: [a.r, a.g, a.b, a.a],
|
|
122
123
|
type: "rgba"
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
|
-
return
|
|
126
|
+
return c;
|
|
126
127
|
});
|
|
127
128
|
return {
|
|
128
|
-
...
|
|
129
|
-
colorStops:
|
|
129
|
+
...u,
|
|
130
|
+
colorStops: v
|
|
130
131
|
};
|
|
131
132
|
});
|
|
132
|
-
return
|
|
133
|
+
return Re.stringify(i);
|
|
133
134
|
} catch {
|
|
134
|
-
return
|
|
135
|
+
return Ke(t) ? t : "";
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
return
|
|
141
|
-
|
|
138
|
+
function nr({ color: t, sx: r = {}, ...i }) {
|
|
139
|
+
Ke(t);
|
|
140
|
+
const n = {};
|
|
141
|
+
return Te(t) ? n.backgroundImage = t : n.backgroundColor = t, /* @__PURE__ */ e(
|
|
142
|
+
P,
|
|
142
143
|
{
|
|
143
144
|
sx: {
|
|
144
|
-
...
|
|
145
|
+
...r,
|
|
145
146
|
width: "100%",
|
|
146
147
|
paddingBottom: "100%",
|
|
147
148
|
cursor: "pointer",
|
|
@@ -151,41 +152,41 @@ function Xt({ color: t, sx: i = {}, ...n }) {
|
|
|
151
152
|
"&:hover": {
|
|
152
153
|
opacity: 0.75
|
|
153
154
|
},
|
|
154
|
-
...
|
|
155
|
+
...n
|
|
155
156
|
},
|
|
156
|
-
...
|
|
157
|
+
...i
|
|
157
158
|
}
|
|
158
159
|
);
|
|
159
160
|
}
|
|
160
|
-
const
|
|
161
|
-
const
|
|
161
|
+
const lr = Ee(function({ onSave: r }, i) {
|
|
162
|
+
const n = ft({
|
|
162
163
|
value: ""
|
|
163
|
-
}), { t:
|
|
164
|
-
|
|
165
|
-
const [
|
|
166
|
-
|
|
167
|
-
}, [
|
|
168
|
-
|
|
164
|
+
}), { t: u } = j(), v = {};
|
|
165
|
+
n.value ? Te(n.value) ? v.backgroundImage = n.value : v.backgroundColor = n.value : v.border = "1px solid #ccc";
|
|
166
|
+
const [c, { setFalse: a, setTrue: k }] = bt(!1), l = ne(() => {
|
|
167
|
+
a();
|
|
168
|
+
}, [a]), y = () => {
|
|
169
|
+
r({ value: n.value }, l);
|
|
169
170
|
};
|
|
170
|
-
return
|
|
171
|
-
open({ value:
|
|
172
|
-
|
|
171
|
+
return He(i, () => ({
|
|
172
|
+
open({ value: f } = { value: "" }) {
|
|
173
|
+
n.value = f, k();
|
|
173
174
|
},
|
|
174
175
|
close() {
|
|
175
|
-
|
|
176
|
+
l();
|
|
176
177
|
}
|
|
177
|
-
})), /* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */ e(
|
|
179
|
-
/* @__PURE__ */ e(
|
|
180
|
-
/* @__PURE__ */ e(
|
|
181
|
-
/* @__PURE__ */ e(
|
|
182
|
-
|
|
178
|
+
})), /* @__PURE__ */ w(pe, { open: c, onClose: l, hideBackdrop: !0, children: [
|
|
179
|
+
/* @__PURE__ */ e(Ue, { children: u("maker.configBackground") }),
|
|
180
|
+
/* @__PURE__ */ e(We, { sx: { width: 600 }, children: /* @__PURE__ */ w(P, { width: "100%", display: "flex", children: [
|
|
181
|
+
/* @__PURE__ */ e(P, { flex: 1, mr: 1, sx: v, children: !n.value && /* @__PURE__ */ e(he, { children: u("error.notConfig") }) }),
|
|
182
|
+
/* @__PURE__ */ e(ut, { children: /* @__PURE__ */ e(
|
|
183
|
+
rr,
|
|
183
184
|
{
|
|
184
185
|
width: 200,
|
|
185
186
|
height: 200,
|
|
186
|
-
value:
|
|
187
|
-
onChange: (
|
|
188
|
-
|
|
187
|
+
value: ir(n.value),
|
|
188
|
+
onChange: (f) => {
|
|
189
|
+
n.value = f;
|
|
189
190
|
},
|
|
190
191
|
hidePresets: !0,
|
|
191
192
|
hideAdvancedSliders: !0,
|
|
@@ -194,13 +195,13 @@ const Zt = Ve(function({ onSave: i }, n) {
|
|
|
194
195
|
}
|
|
195
196
|
) })
|
|
196
197
|
] }) }),
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */ e(
|
|
199
|
-
/* @__PURE__ */ e(
|
|
198
|
+
/* @__PURE__ */ w(Ve, { children: [
|
|
199
|
+
/* @__PURE__ */ e(A, { variant: "outlined", size: "small", onClick: l, children: u("common.cancel") }),
|
|
200
|
+
/* @__PURE__ */ e(A, { variant: "contained", size: "small", onClick: y, children: u("maker.save") })
|
|
200
201
|
] })
|
|
201
202
|
] });
|
|
202
203
|
});
|
|
203
|
-
|
|
204
|
+
mt(P)`
|
|
204
205
|
.color-item {
|
|
205
206
|
position: relative;
|
|
206
207
|
}
|
|
@@ -221,28 +222,28 @@ ct(w)`
|
|
|
221
222
|
right: 0;
|
|
222
223
|
}
|
|
223
224
|
`;
|
|
224
|
-
function
|
|
225
|
+
function or({
|
|
225
226
|
value: t,
|
|
226
|
-
onChange:
|
|
227
|
-
...
|
|
227
|
+
onChange: r,
|
|
228
|
+
...i
|
|
228
229
|
}) {
|
|
229
|
-
const
|
|
230
|
-
return /* @__PURE__ */
|
|
230
|
+
const n = Z(null);
|
|
231
|
+
return /* @__PURE__ */ w(U, { children: [
|
|
231
232
|
/* @__PURE__ */ e(
|
|
232
|
-
|
|
233
|
+
tr,
|
|
233
234
|
{
|
|
234
|
-
...
|
|
235
|
+
...i,
|
|
235
236
|
value: t,
|
|
236
|
-
onChange:
|
|
237
|
+
onChange: r,
|
|
237
238
|
InputProps: {
|
|
238
|
-
endAdornment: /* @__PURE__ */ e(
|
|
239
|
-
|
|
239
|
+
endAdornment: /* @__PURE__ */ e(oe, { position: "end", children: /* @__PURE__ */ e(
|
|
240
|
+
nr,
|
|
240
241
|
{
|
|
241
242
|
color: t ?? "",
|
|
242
243
|
style: { width: "1.5rem", height: "1.5rem", padding: 0 },
|
|
243
244
|
onClick: () => {
|
|
244
|
-
var
|
|
245
|
-
(
|
|
245
|
+
var u;
|
|
246
|
+
(u = n.current) == null || u.open({ value: t ?? "" });
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
249
|
) })
|
|
@@ -250,258 +251,285 @@ function Lt({
|
|
|
250
251
|
}
|
|
251
252
|
),
|
|
252
253
|
/* @__PURE__ */ e(
|
|
253
|
-
|
|
254
|
+
lr,
|
|
254
255
|
{
|
|
255
|
-
ref:
|
|
256
|
-
onSave: ({ value:
|
|
257
|
-
|
|
256
|
+
ref: n,
|
|
257
|
+
onSave: ({ value: u }, v) => {
|
|
258
|
+
r(u), v();
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
)
|
|
261
262
|
] });
|
|
262
263
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
264
|
+
const Ae = ["string", "multiline", "json", "yaml", "component", "custom", "url"];
|
|
265
|
+
function sr({
|
|
265
266
|
disabled: t,
|
|
266
|
-
list:
|
|
267
|
-
renderItem:
|
|
268
|
-
...
|
|
267
|
+
list: r,
|
|
268
|
+
renderItem: i,
|
|
269
|
+
...n
|
|
269
270
|
}) {
|
|
270
|
-
const
|
|
271
|
-
(
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
[p]
|
|
275
|
-
), h = te(
|
|
276
|
-
({ index: s }, { index: l }) => {
|
|
277
|
-
const o = [...v.current];
|
|
278
|
-
o.splice(l, 0, ...o.splice(s, 1)), c(o);
|
|
271
|
+
const u = Z(null), v = at(), c = yt(), a = Lt(Object.entries(r), (x) => x[1].index).map((x) => x[0]), k = Z(a), l = ne(
|
|
272
|
+
(x) => {
|
|
273
|
+
k.current = x, c();
|
|
279
274
|
},
|
|
280
275
|
[c]
|
|
276
|
+
), y = ne(
|
|
277
|
+
({ index: x }, { index: o }) => {
|
|
278
|
+
const s = [...k.current];
|
|
279
|
+
s.splice(o, 0, ...s.splice(x, 1)), l(s);
|
|
280
|
+
},
|
|
281
|
+
[l]
|
|
281
282
|
);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}, [
|
|
285
|
-
const [{ isOver:
|
|
286
|
-
accept:
|
|
287
|
-
collect: (
|
|
288
|
-
isOver:
|
|
283
|
+
X(() => {
|
|
284
|
+
l(a);
|
|
285
|
+
}, [a.join("-")]);
|
|
286
|
+
const [{ isOver: f }, p] = Ze({
|
|
287
|
+
accept: v,
|
|
288
|
+
collect: (x) => ({
|
|
289
|
+
isOver: x.isOver()
|
|
289
290
|
}),
|
|
290
291
|
canDrop: () => !t,
|
|
291
292
|
drop: () => {
|
|
292
|
-
var
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
|
|
293
|
+
var s;
|
|
294
|
+
const x = () => {
|
|
295
|
+
k.current.forEach((g, I) => {
|
|
296
|
+
const b = r[g];
|
|
297
|
+
b && (b.index = I);
|
|
297
298
|
});
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}) :
|
|
299
|
+
}, o = (s = _(r)) == null ? void 0 : s.doc;
|
|
300
|
+
o ? o.transact(() => {
|
|
301
|
+
x();
|
|
302
|
+
}) : x();
|
|
302
303
|
}
|
|
303
304
|
});
|
|
304
|
-
return
|
|
305
|
-
|
|
306
|
-
}, [
|
|
307
|
-
|
|
305
|
+
return X(() => {
|
|
306
|
+
f || l(a);
|
|
307
|
+
}, [f]), p(u), /* @__PURE__ */ e(P, { ...n, ref: u, className: ht(f && "isDragging"), children: k.current.map((x, o) => /* @__PURE__ */ e(
|
|
308
|
+
cr,
|
|
308
309
|
{
|
|
309
|
-
type:
|
|
310
|
+
type: v,
|
|
310
311
|
disabled: t,
|
|
311
|
-
id:
|
|
312
|
-
index:
|
|
313
|
-
itemIndex: (
|
|
314
|
-
move:
|
|
315
|
-
children: (
|
|
316
|
-
const
|
|
317
|
-
return
|
|
312
|
+
id: x,
|
|
313
|
+
index: o,
|
|
314
|
+
itemIndex: (s) => k.current.indexOf(s),
|
|
315
|
+
move: y,
|
|
316
|
+
children: (s) => {
|
|
317
|
+
const g = r[x];
|
|
318
|
+
return g ? i(g.data, o, s) : null;
|
|
318
319
|
}
|
|
319
320
|
},
|
|
320
|
-
|
|
321
|
+
x
|
|
321
322
|
)) });
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
+
function cr({
|
|
324
325
|
disabled: t,
|
|
325
|
-
id:
|
|
326
|
-
index:
|
|
327
|
-
type:
|
|
328
|
-
children:
|
|
329
|
-
itemIndex:
|
|
330
|
-
move:
|
|
326
|
+
id: r,
|
|
327
|
+
index: i,
|
|
328
|
+
type: n,
|
|
329
|
+
children: u,
|
|
330
|
+
itemIndex: v,
|
|
331
|
+
move: c
|
|
331
332
|
}) {
|
|
332
|
-
const
|
|
333
|
-
type:
|
|
334
|
-
item: () => ({ id:
|
|
333
|
+
const a = Z(), [{ isDragging: k }, l, y] = er({
|
|
334
|
+
type: n,
|
|
335
|
+
item: () => ({ id: r }),
|
|
335
336
|
canDrag: () => !t,
|
|
336
|
-
collect: (
|
|
337
|
-
}), [,
|
|
338
|
-
accept:
|
|
337
|
+
collect: (p) => ({ isDragging: p.isDragging() })
|
|
338
|
+
}), [, f] = Ze({
|
|
339
|
+
accept: n,
|
|
339
340
|
canDrop: () => !t,
|
|
340
|
-
hover(
|
|
341
|
-
var
|
|
342
|
-
if (!
|
|
341
|
+
hover(p, x) {
|
|
342
|
+
var h;
|
|
343
|
+
if (!a.current)
|
|
343
344
|
return;
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
345
|
+
const o = v(p.id), s = i;
|
|
346
|
+
if (o === s)
|
|
346
347
|
return;
|
|
347
|
-
const
|
|
348
|
-
|
|
348
|
+
const g = (h = a.current) == null ? void 0 : h.getBoundingClientRect(), I = (g.bottom - g.top) / 2, d = x.getClientOffset().y - g.top;
|
|
349
|
+
o < s && d < I || o > s && d > I || c({ id: p.id, index: o }, { id: r, index: i });
|
|
349
350
|
}
|
|
350
351
|
});
|
|
351
|
-
return typeof
|
|
352
|
-
isDragging:
|
|
353
|
-
drag:
|
|
354
|
-
drop: (
|
|
355
|
-
preview:
|
|
356
|
-
}) : (
|
|
352
|
+
return typeof u == "function" ? u({
|
|
353
|
+
isDragging: k,
|
|
354
|
+
drag: l,
|
|
355
|
+
drop: (p) => (a.current = p, f(p)),
|
|
356
|
+
preview: y
|
|
357
|
+
}) : (l(f(y(a))), /* @__PURE__ */ e(P, { ref: a, children: u }));
|
|
357
358
|
}
|
|
358
|
-
function
|
|
359
|
+
function dr({
|
|
359
360
|
drop: t,
|
|
360
|
-
preview:
|
|
361
|
-
drag:
|
|
362
|
-
disabled:
|
|
363
|
-
isDragging:
|
|
364
|
-
children:
|
|
365
|
-
onDelete:
|
|
366
|
-
|
|
361
|
+
preview: r,
|
|
362
|
+
drag: i,
|
|
363
|
+
disabled: n,
|
|
364
|
+
isDragging: u,
|
|
365
|
+
children: v,
|
|
366
|
+
onDelete: c,
|
|
367
|
+
onVisibilityChange: a,
|
|
368
|
+
visible: k = !0,
|
|
369
|
+
actions: l,
|
|
370
|
+
alwaysShowActions: y = !1
|
|
367
371
|
}) {
|
|
368
|
-
const { t:
|
|
369
|
-
return /* @__PURE__ */ e(
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
},
|
|
381
|
-
children: b
|
|
382
|
-
}
|
|
383
|
-
),
|
|
384
|
-
!r && /* @__PURE__ */ e(
|
|
385
|
-
w,
|
|
386
|
-
{
|
|
387
|
-
className: "hover-visible",
|
|
388
|
-
sx: { maxHeight: 0, overflow: "hidden", position: "absolute", right: 2, top: 2 },
|
|
389
|
-
children: /* @__PURE__ */ k(
|
|
390
|
-
S,
|
|
372
|
+
const { t: f } = j();
|
|
373
|
+
return /* @__PURE__ */ e(
|
|
374
|
+
P,
|
|
375
|
+
{
|
|
376
|
+
ref: t,
|
|
377
|
+
sx: {
|
|
378
|
+
":hover .hover-visible": { maxWidth: "100%" },
|
|
379
|
+
opacity: k ? 1 : 0.5
|
|
380
|
+
},
|
|
381
|
+
children: /* @__PURE__ */ w(P, { sx: { position: "relative" }, children: [
|
|
382
|
+
/* @__PURE__ */ e(
|
|
383
|
+
P,
|
|
391
384
|
{
|
|
392
|
-
|
|
385
|
+
ref: r,
|
|
393
386
|
sx: {
|
|
394
|
-
|
|
395
|
-
borderRadius:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
width: 24,
|
|
400
|
-
height: 24,
|
|
401
|
-
p: 0
|
|
402
|
-
}
|
|
387
|
+
flex: 1,
|
|
388
|
+
borderRadius: 0.5,
|
|
389
|
+
bgcolor: u ? "action.hover" : "background.paper",
|
|
390
|
+
opacity: 0.9999
|
|
391
|
+
// NOTE: make preview effective
|
|
403
392
|
},
|
|
404
|
-
children:
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
393
|
+
children: v
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
!n && /* @__PURE__ */ e(
|
|
397
|
+
P,
|
|
398
|
+
{
|
|
399
|
+
className: y ? "" : "hover-visible",
|
|
400
|
+
sx: {
|
|
401
|
+
maxWidth: y ? "100%" : 0,
|
|
402
|
+
overflow: "hidden",
|
|
403
|
+
position: "absolute",
|
|
404
|
+
right: 2,
|
|
405
|
+
top: 2,
|
|
406
|
+
transition: "max-width 0.3s ease-in-out"
|
|
407
|
+
},
|
|
408
|
+
children: /* @__PURE__ */ w(
|
|
409
|
+
D,
|
|
410
|
+
{
|
|
411
|
+
direction: "row",
|
|
412
|
+
sx: {
|
|
413
|
+
bgcolor: (p) => it(p.palette.grey[200], 0.9),
|
|
414
|
+
borderRadius: 1,
|
|
415
|
+
p: 0.5,
|
|
416
|
+
[`.${nt.root}`]: {
|
|
417
|
+
minWidth: 24,
|
|
418
|
+
width: 24,
|
|
419
|
+
height: 24,
|
|
420
|
+
p: 0
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
children: [
|
|
424
|
+
l,
|
|
425
|
+
a && /* @__PURE__ */ e(Q, { title: f(k ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { onClick: () => a(!k), children: k ? /* @__PURE__ */ e(Ht, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ e(Jt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
426
|
+
c && /* @__PURE__ */ e(Q, { title: f("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { onClick: c, children: /* @__PURE__ */ e(Mt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
|
|
427
|
+
/* @__PURE__ */ e(Q, { title: f("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { ref: i, children: /* @__PURE__ */ e($t, { sx: { color: "grey.500" } }) }) })
|
|
428
|
+
]
|
|
429
|
+
}
|
|
430
|
+
)
|
|
409
431
|
}
|
|
410
432
|
)
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
433
|
+
] })
|
|
434
|
+
}
|
|
435
|
+
);
|
|
414
436
|
}
|
|
415
|
-
function
|
|
437
|
+
function ur({
|
|
416
438
|
label: t,
|
|
417
|
-
value:
|
|
418
|
-
onChange:
|
|
439
|
+
value: r,
|
|
440
|
+
onChange: i
|
|
419
441
|
}) {
|
|
420
|
-
const [
|
|
421
|
-
return /* @__PURE__ */
|
|
442
|
+
const [n, u] = ie(!1);
|
|
443
|
+
return /* @__PURE__ */ w(D, { gap: 1, children: [
|
|
422
444
|
/* @__PURE__ */ e(
|
|
423
|
-
|
|
445
|
+
O,
|
|
424
446
|
{
|
|
425
447
|
label: t,
|
|
426
448
|
size: "small",
|
|
427
|
-
value:
|
|
428
|
-
onChange: (
|
|
449
|
+
value: r,
|
|
450
|
+
onChange: (v) => i == null ? void 0 : i(v.target.value),
|
|
429
451
|
InputProps: {
|
|
430
452
|
endAdornment: /* @__PURE__ */ e(
|
|
431
|
-
|
|
453
|
+
fe,
|
|
432
454
|
{
|
|
433
|
-
onChange: ({ response:
|
|
434
|
-
var
|
|
435
|
-
const
|
|
436
|
-
|
|
455
|
+
onChange: ({ response: v }) => {
|
|
456
|
+
var a;
|
|
457
|
+
const c = (a = v == null ? void 0 : v.data) == null ? void 0 : a.filename;
|
|
458
|
+
c && (i == null || i(c));
|
|
437
459
|
}
|
|
438
460
|
}
|
|
439
461
|
)
|
|
440
462
|
}
|
|
441
463
|
}
|
|
442
464
|
),
|
|
443
|
-
|
|
444
|
-
|
|
465
|
+
r && /* @__PURE__ */ e(
|
|
466
|
+
P,
|
|
445
467
|
{
|
|
446
468
|
component: "img",
|
|
447
469
|
sx: { objectFit: "contain", borderRadius: 1, cursor: "pointer" },
|
|
448
|
-
src:
|
|
470
|
+
src: re(r),
|
|
449
471
|
alt: t,
|
|
450
472
|
maxWidth: 100,
|
|
451
473
|
maxHeight: 100,
|
|
452
474
|
width: "100%",
|
|
453
|
-
onClick: () =>
|
|
475
|
+
onClick: () => u(!0)
|
|
454
476
|
}
|
|
455
477
|
),
|
|
456
|
-
/* @__PURE__ */ e(
|
|
478
|
+
/* @__PURE__ */ e(pe, { open: n, onClose: () => u(!1), children: /* @__PURE__ */ e(P, { component: "img", sx: { objectFit: "contain" }, src: re(r), alt: t }) })
|
|
457
479
|
] });
|
|
458
480
|
}
|
|
459
|
-
function
|
|
481
|
+
function te(t, r, i) {
|
|
482
|
+
return !t || !i ? !1 : Object.values(t).some(({ data: n }) => n.id !== r && n.key === i);
|
|
483
|
+
}
|
|
484
|
+
function Le(t, r) {
|
|
485
|
+
var i;
|
|
486
|
+
return !t || !r ? !1 : ((i = t[r]) == null ? void 0 : i.data.visible) ?? !0;
|
|
487
|
+
}
|
|
488
|
+
function Zr({ componentId: t }) {
|
|
460
489
|
const {
|
|
461
|
-
state: { components:
|
|
462
|
-
} =
|
|
463
|
-
return
|
|
490
|
+
state: { components: r }
|
|
491
|
+
} = le(), i = r[t], n = i == null ? void 0 : i.data;
|
|
492
|
+
return n ? /* @__PURE__ */ e(D, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ e(P, { p: 2, children: /* @__PURE__ */ e(Zt, { FallbackComponent: tt, resetKeys: [t], children: /* @__PURE__ */ e(ar, { value: n }) }) }) }) : null;
|
|
464
493
|
}
|
|
465
|
-
function
|
|
466
|
-
var
|
|
467
|
-
const { t:
|
|
468
|
-
localState: { currentLocale: n },
|
|
494
|
+
function ar({ value: t }) {
|
|
495
|
+
var k, l, y;
|
|
496
|
+
const { t: r } = j(), {
|
|
497
|
+
localState: { currentLocale: i, componentDebugProps: n },
|
|
469
498
|
state: {
|
|
470
|
-
config: { defaultLocale:
|
|
499
|
+
config: { defaultLocale: u }
|
|
471
500
|
},
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
/* @__PURE__ */ e(nr, { config: t }),
|
|
501
|
+
localActions: { setComponentDebugProps: v }
|
|
502
|
+
} = le(), c = _(t).doc, a = ae();
|
|
503
|
+
return /* @__PURE__ */ e(D, { height: "100%", children: /* @__PURE__ */ w(D, { gap: 2, children: [
|
|
504
|
+
/* @__PURE__ */ e(pr, { config: t }),
|
|
477
505
|
/* @__PURE__ */ e(
|
|
478
|
-
|
|
506
|
+
mr,
|
|
479
507
|
{
|
|
480
508
|
config: t,
|
|
481
|
-
currentLocale:
|
|
482
|
-
defaultLocale:
|
|
483
|
-
allComponents:
|
|
484
|
-
onUpdateConfig: (
|
|
485
|
-
|
|
486
|
-
|
|
509
|
+
currentLocale: i,
|
|
510
|
+
defaultLocale: u,
|
|
511
|
+
allComponents: a,
|
|
512
|
+
onUpdateConfig: (f) => {
|
|
513
|
+
c.transact(() => {
|
|
514
|
+
f(t);
|
|
487
515
|
});
|
|
488
516
|
}
|
|
489
517
|
}
|
|
490
518
|
),
|
|
491
|
-
/* @__PURE__ */
|
|
492
|
-
/* @__PURE__ */ e(
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
|
|
519
|
+
/* @__PURE__ */ w(D, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
520
|
+
/* @__PURE__ */ e(V, { variant: "subtitle1", children: r("renderer") }),
|
|
521
|
+
/* @__PURE__ */ w(
|
|
522
|
+
O,
|
|
495
523
|
{
|
|
496
524
|
hiddenLabel: !0,
|
|
497
525
|
size: "small",
|
|
498
526
|
select: !0,
|
|
499
527
|
SelectProps: { autoWidth: !0 },
|
|
500
|
-
value: ((
|
|
501
|
-
onChange: (
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
t.renderer ?? (t.renderer = { type:
|
|
528
|
+
value: ((k = t.renderer) == null ? void 0 : k.type) || "react-component",
|
|
529
|
+
onChange: (f) => {
|
|
530
|
+
c.transact(() => {
|
|
531
|
+
const p = f.target.value;
|
|
532
|
+
t.renderer ?? (t.renderer = { type: p }), t.renderer.type = p;
|
|
505
533
|
});
|
|
506
534
|
},
|
|
507
535
|
children: [
|
|
@@ -511,459 +539,526 @@ function lr({ value: t }) {
|
|
|
511
539
|
}
|
|
512
540
|
)
|
|
513
541
|
] }),
|
|
514
|
-
((
|
|
542
|
+
((l = t.renderer) == null ? void 0 : l.type) === "component" ? /* @__PURE__ */ e(gr, { value: t }) : ((y = t.renderer) == null ? void 0 : y.type) === "react-component" ? /* @__PURE__ */ e(xr, { value: t }) : null,
|
|
515
543
|
/* @__PURE__ */ e(
|
|
516
|
-
|
|
544
|
+
kr,
|
|
517
545
|
{
|
|
518
546
|
config: t,
|
|
519
|
-
currentLocale:
|
|
520
|
-
defaultLocale:
|
|
521
|
-
allComponents:
|
|
522
|
-
onChange: (
|
|
523
|
-
|
|
547
|
+
currentLocale: i,
|
|
548
|
+
defaultLocale: u,
|
|
549
|
+
allComponents: a,
|
|
550
|
+
onChange: ({ key: f, value: p }) => {
|
|
551
|
+
v({
|
|
552
|
+
[f]: p.value
|
|
553
|
+
});
|
|
524
554
|
},
|
|
525
|
-
props: {
|
|
555
|
+
props: {
|
|
556
|
+
...n
|
|
557
|
+
}
|
|
526
558
|
}
|
|
527
559
|
)
|
|
528
560
|
] }) });
|
|
529
561
|
}
|
|
530
|
-
function
|
|
531
|
-
const { t:
|
|
532
|
-
return /* @__PURE__ */ e(
|
|
533
|
-
/* @__PURE__ */ e(
|
|
562
|
+
function pr({ config: t }) {
|
|
563
|
+
const { t: r } = j();
|
|
564
|
+
return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
|
|
565
|
+
/* @__PURE__ */ e(V, { variant: "subtitle1", children: r("basicInfo") }),
|
|
534
566
|
/* @__PURE__ */ e(
|
|
535
|
-
|
|
567
|
+
O,
|
|
536
568
|
{
|
|
537
|
-
label:
|
|
569
|
+
label: r("name"),
|
|
538
570
|
size: "small",
|
|
539
571
|
value: t.name || "",
|
|
540
|
-
onChange: (
|
|
572
|
+
onChange: (i) => t.name = i.target.value
|
|
541
573
|
}
|
|
542
574
|
),
|
|
543
575
|
/* @__PURE__ */ e(
|
|
544
|
-
|
|
576
|
+
O,
|
|
545
577
|
{
|
|
546
|
-
label:
|
|
578
|
+
label: r("description"),
|
|
547
579
|
size: "small",
|
|
548
580
|
multiline: !0,
|
|
549
581
|
minRows: 2,
|
|
550
582
|
maxRows: 10,
|
|
551
583
|
inputProps: { maxLength: 200 },
|
|
552
584
|
value: t.description || "",
|
|
553
|
-
onChange: (
|
|
585
|
+
onChange: (i) => t.description = i.target.value
|
|
554
586
|
}
|
|
555
587
|
),
|
|
556
588
|
/* @__PURE__ */ e(
|
|
557
|
-
|
|
589
|
+
Fe,
|
|
558
590
|
{
|
|
559
591
|
size: "small",
|
|
560
592
|
options: [],
|
|
561
593
|
multiple: !0,
|
|
562
594
|
freeSolo: !0,
|
|
563
595
|
value: t.tags ?? [],
|
|
564
|
-
onChange: (
|
|
565
|
-
renderInput: (
|
|
596
|
+
onChange: (i, n) => t.tags = n,
|
|
597
|
+
renderInput: (i) => /* @__PURE__ */ e(O, { label: r("tags"), ...i })
|
|
566
598
|
}
|
|
567
599
|
),
|
|
568
600
|
/* @__PURE__ */ e(
|
|
569
|
-
|
|
601
|
+
ur,
|
|
570
602
|
{
|
|
571
|
-
label:
|
|
603
|
+
label: r("previewImage"),
|
|
572
604
|
value: t.previewImage || "",
|
|
573
|
-
onChange: (
|
|
605
|
+
onChange: (i) => t.previewImage = i
|
|
574
606
|
}
|
|
575
607
|
)
|
|
576
608
|
] }) });
|
|
577
609
|
}
|
|
578
|
-
function
|
|
610
|
+
function mr({
|
|
579
611
|
config: t,
|
|
580
|
-
currentLocale:
|
|
581
|
-
defaultLocale:
|
|
582
|
-
allComponents:
|
|
583
|
-
onUpdateConfig:
|
|
584
|
-
useI18nEditor:
|
|
612
|
+
currentLocale: r,
|
|
613
|
+
defaultLocale: i,
|
|
614
|
+
allComponents: n,
|
|
615
|
+
onUpdateConfig: u,
|
|
616
|
+
useI18nEditor: v = !0
|
|
585
617
|
}) {
|
|
586
|
-
const { t:
|
|
587
|
-
return /* @__PURE__ */ e(
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
/* @__PURE__ */ e(
|
|
590
|
-
/* @__PURE__ */ e(
|
|
618
|
+
const { t: c } = j(), a = se({ variant: "dialog" }), k = t.properties && F(Object.values(t.properties), "index");
|
|
619
|
+
return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
|
|
620
|
+
/* @__PURE__ */ w(D, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
621
|
+
/* @__PURE__ */ e(V, { variant: "subtitle1", children: c("properties") }),
|
|
622
|
+
/* @__PURE__ */ e(P, { flex: 1 }),
|
|
591
623
|
/* @__PURE__ */ e(
|
|
592
|
-
|
|
624
|
+
A,
|
|
593
625
|
{
|
|
594
626
|
onClick: () => {
|
|
595
|
-
|
|
596
|
-
var
|
|
597
|
-
const
|
|
598
|
-
|
|
627
|
+
u((l) => {
|
|
628
|
+
var f;
|
|
629
|
+
const y = rt();
|
|
630
|
+
l.properties ?? (l.properties = {}), (f = l.properties)[y] ?? (f[y] = { index: (k == null ? void 0 : k.length) || 0, data: { id: y } });
|
|
599
631
|
});
|
|
600
632
|
},
|
|
601
|
-
startIcon: /* @__PURE__ */ e(
|
|
602
|
-
children:
|
|
633
|
+
startIcon: /* @__PURE__ */ e(Yt, {}),
|
|
634
|
+
children: c("addObject", { object: c("property") })
|
|
603
635
|
}
|
|
604
636
|
),
|
|
605
|
-
|
|
637
|
+
v && /* @__PURE__ */ e(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...ce(a), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) })
|
|
606
638
|
] }),
|
|
607
|
-
t.properties && /* @__PURE__ */ e(
|
|
608
|
-
|
|
639
|
+
t.properties && Object.keys(t.properties).length > 0 ? /* @__PURE__ */ e(
|
|
640
|
+
sr,
|
|
609
641
|
{
|
|
610
|
-
component:
|
|
642
|
+
component: D,
|
|
611
643
|
gap: 2,
|
|
612
644
|
list: t.properties,
|
|
613
|
-
renderItem: (
|
|
614
|
-
var
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
value: c.key || "",
|
|
641
|
-
onChange: (y) => {
|
|
642
|
-
a((I) => {
|
|
643
|
-
const g = I.properties[c.id].data;
|
|
644
|
-
g.key = y.target.value.trim();
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
),
|
|
649
|
-
/* @__PURE__ */ e(
|
|
650
|
-
D,
|
|
651
|
-
{
|
|
652
|
-
label: p("label"),
|
|
653
|
-
size: "small",
|
|
654
|
-
sx: { flex: 1 },
|
|
655
|
-
value: (((s = (f = c.locales) == null ? void 0 : f[i]) == null ? void 0 : s.name) ?? ((o = (l = c.locales) == null ? void 0 : l[n]) == null ? void 0 : o.name)) || "",
|
|
656
|
-
onChange: (y) => {
|
|
657
|
-
a((I) => {
|
|
658
|
-
var C;
|
|
659
|
-
const g = I.properties[c.id].data;
|
|
660
|
-
g.locales ?? (g.locales = {}), (C = g.locales)[i] ?? (C[i] = {}), g.locales[i].name = y.target.value;
|
|
645
|
+
renderItem: (l, y, f) => {
|
|
646
|
+
var x, o, s, g, I, b;
|
|
647
|
+
const p = Le(t.properties, l.id);
|
|
648
|
+
return /* @__PURE__ */ e(
|
|
649
|
+
me,
|
|
650
|
+
{
|
|
651
|
+
elevation: 0,
|
|
652
|
+
sx: {
|
|
653
|
+
p: 1.25,
|
|
654
|
+
bgcolor: "background.paper",
|
|
655
|
+
borderRadius: 1,
|
|
656
|
+
border: p ? "1px solid" : "1px dashed",
|
|
657
|
+
borderColor: "divider"
|
|
658
|
+
},
|
|
659
|
+
children: /* @__PURE__ */ e(D, { gap: 2, children: /* @__PURE__ */ e(
|
|
660
|
+
dr,
|
|
661
|
+
{
|
|
662
|
+
preview: f.preview,
|
|
663
|
+
drop: f.drop,
|
|
664
|
+
drag: f.drag,
|
|
665
|
+
isDragging: f.isDragging,
|
|
666
|
+
onDelete: () => {
|
|
667
|
+
u((d) => {
|
|
668
|
+
if (d.properties) {
|
|
669
|
+
const m = Object.entries(d.properties).sort(([, C], [, z]) => C.index - z.index);
|
|
670
|
+
delete d.properties[l.id], m.filter(([C]) => C !== l.id).forEach(([, C], z) => {
|
|
671
|
+
C.index = z;
|
|
661
672
|
});
|
|
662
673
|
}
|
|
663
|
-
}
|
|
664
|
-
),
|
|
665
|
-
/* @__PURE__ */ k(
|
|
666
|
-
D,
|
|
667
|
-
{
|
|
668
|
-
label: p("type"),
|
|
669
|
-
size: "small",
|
|
670
|
-
select: !0,
|
|
671
|
-
sx: { flex: 1 },
|
|
672
|
-
value: c.type === "string" && c.multiline ? "multiline" : c.type || "string",
|
|
673
|
-
onChange: (y) => {
|
|
674
|
-
a((I) => {
|
|
675
|
-
const g = I.properties[c.id].data;
|
|
676
|
-
if (g.locales)
|
|
677
|
-
for (const P of Object.keys(g.locales))
|
|
678
|
-
g.locales[P].defaultValue = void 0;
|
|
679
|
-
const C = y.target.value;
|
|
680
|
-
C === "multiline" ? (g.type = "string", g.multiline = !0) : (typeof g.multiline < "u" && delete g.multiline, g.type = C);
|
|
681
|
-
});
|
|
682
|
-
},
|
|
683
|
-
children: [
|
|
684
|
-
/* @__PURE__ */ e(R, { value: "string", children: "Text" }),
|
|
685
|
-
/* @__PURE__ */ e(R, { value: "multiline", children: "Text (Multiline)" }),
|
|
686
|
-
/* @__PURE__ */ e(R, { value: "number", children: "Number" }),
|
|
687
|
-
/* @__PURE__ */ e(R, { value: "decimal", children: "Decimal" }),
|
|
688
|
-
/* @__PURE__ */ e(R, { value: "boolean", children: "Boolean" }),
|
|
689
|
-
/* @__PURE__ */ e(R, { value: "color", children: "Color" }),
|
|
690
|
-
/* @__PURE__ */ e(R, { value: "url", children: "URL (Upload)" }),
|
|
691
|
-
/* @__PURE__ */ e(R, { value: "json", children: "JSON" }),
|
|
692
|
-
/* @__PURE__ */ e(R, { value: "yaml", children: "YAML" }),
|
|
693
|
-
/* @__PURE__ */ e(R, { value: "component", children: "Component" }),
|
|
694
|
-
/* @__PURE__ */ e(R, { value: "custom", children: "Custom (Render by a Component)" })
|
|
695
|
-
]
|
|
696
|
-
}
|
|
697
|
-
)
|
|
698
|
-
] })
|
|
699
|
-
}
|
|
700
|
-
),
|
|
701
|
-
/* @__PURE__ */ k(S, { direction: "row", gap: 1, children: [
|
|
702
|
-
/* @__PURE__ */ e(
|
|
703
|
-
W,
|
|
704
|
-
{
|
|
705
|
-
allComponents: r,
|
|
706
|
-
defaultLocale: n,
|
|
707
|
-
component: t,
|
|
708
|
-
property: c,
|
|
709
|
-
label: p("defaultValue"),
|
|
710
|
-
size: "small",
|
|
711
|
-
fullWidth: !0,
|
|
712
|
-
value: (x = (d = c.locales) == null ? void 0 : d[i]) == null ? void 0 : x.defaultValue,
|
|
713
|
-
onChange: (y) => {
|
|
714
|
-
a((I) => {
|
|
715
|
-
var C;
|
|
716
|
-
const g = I.properties[c.id].data;
|
|
717
|
-
g.locales ?? (g.locales = {}), (C = g.locales)[i] ?? (C[i] = {}), g.locales[i].defaultValue = y;
|
|
718
674
|
});
|
|
719
|
-
}
|
|
675
|
+
},
|
|
676
|
+
visible: p,
|
|
677
|
+
onVisibilityChange: (d) => {
|
|
678
|
+
u((h) => {
|
|
679
|
+
const m = h.properties[l.id].data;
|
|
680
|
+
m.visible = d;
|
|
681
|
+
});
|
|
682
|
+
},
|
|
683
|
+
alwaysShowActions: !0,
|
|
684
|
+
children: /* @__PURE__ */ w(D, { direction: "column", gap: 2, children: [
|
|
685
|
+
/* @__PURE__ */ e(
|
|
686
|
+
O,
|
|
687
|
+
{
|
|
688
|
+
label: c("key"),
|
|
689
|
+
size: "small",
|
|
690
|
+
required: !0,
|
|
691
|
+
sx: {
|
|
692
|
+
width: "calc(100% - 80px - 8px)",
|
|
693
|
+
flex: 1,
|
|
694
|
+
"& .MuiOutlinedInput-root": {
|
|
695
|
+
borderColor: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : void 0 : "error.main"
|
|
696
|
+
},
|
|
697
|
+
"& .MuiFormLabel-root": {
|
|
698
|
+
color: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : "text.secondary" : "error.main"
|
|
699
|
+
},
|
|
700
|
+
"& .MuiFormLabel-root.Mui-focused": {
|
|
701
|
+
color: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : "primary.main" : "error.main"
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
value: l.key || "",
|
|
705
|
+
onChange: (d) => {
|
|
706
|
+
u((h) => {
|
|
707
|
+
const m = h.properties[l.id].data;
|
|
708
|
+
m.key = d.target.value.trim();
|
|
709
|
+
});
|
|
710
|
+
},
|
|
711
|
+
InputProps: {
|
|
712
|
+
endAdornment: !l.key || l.key && te(t.properties, l.id, l.key) ? /* @__PURE__ */ e(
|
|
713
|
+
oe,
|
|
714
|
+
{
|
|
715
|
+
position: "end",
|
|
716
|
+
sx: {
|
|
717
|
+
width: 16,
|
|
718
|
+
ml: 0
|
|
719
|
+
},
|
|
720
|
+
children: /* @__PURE__ */ e(Q, { title: l.key ? c("duplicateKey") : c("requiredKey"), children: /* @__PURE__ */ e(
|
|
721
|
+
Ge,
|
|
722
|
+
{
|
|
723
|
+
sx: {
|
|
724
|
+
color: l.key ? "warning.main" : "error.main",
|
|
725
|
+
fontSize: 16
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
) })
|
|
729
|
+
}
|
|
730
|
+
) : null
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
),
|
|
734
|
+
/* @__PURE__ */ w(D, { direction: "row", gap: 1, children: [
|
|
735
|
+
/* @__PURE__ */ e(
|
|
736
|
+
O,
|
|
737
|
+
{
|
|
738
|
+
label: c("label"),
|
|
739
|
+
size: "small",
|
|
740
|
+
sx: { flex: 1 },
|
|
741
|
+
value: (((o = (x = l.locales) == null ? void 0 : x[r]) == null ? void 0 : o.name) ?? ((g = (s = l.locales) == null ? void 0 : s[i]) == null ? void 0 : g.name)) || "",
|
|
742
|
+
onChange: (d) => {
|
|
743
|
+
u((h) => {
|
|
744
|
+
var S;
|
|
745
|
+
const m = h.properties[l.id].data;
|
|
746
|
+
m.locales ?? (m.locales = {}), (S = m.locales)[r] ?? (S[r] = {}), m.locales[r].name = d.target.value;
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
/* @__PURE__ */ w(
|
|
752
|
+
O,
|
|
753
|
+
{
|
|
754
|
+
label: c("type"),
|
|
755
|
+
size: "small",
|
|
756
|
+
select: !0,
|
|
757
|
+
sx: { flex: 1 },
|
|
758
|
+
value: l.type === "string" && l.multiline ? "multiline" : l.type || "string",
|
|
759
|
+
onChange: (d) => {
|
|
760
|
+
u((h) => {
|
|
761
|
+
const m = h.properties[l.id].data;
|
|
762
|
+
if (m.locales)
|
|
763
|
+
for (const C of Object.keys(m.locales))
|
|
764
|
+
m.locales[C].defaultValue = void 0;
|
|
765
|
+
const S = d.target.value;
|
|
766
|
+
S === "multiline" ? (m.type = "string", m.multiline = !0) : (typeof m.multiline < "u" && delete m.multiline, m.type = S);
|
|
767
|
+
});
|
|
768
|
+
},
|
|
769
|
+
children: [
|
|
770
|
+
/* @__PURE__ */ e(R, { value: "string", children: "Text" }),
|
|
771
|
+
/* @__PURE__ */ e(R, { value: "multiline", children: "Text (Multiline)" }),
|
|
772
|
+
/* @__PURE__ */ e(R, { value: "number", children: "Number" }),
|
|
773
|
+
/* @__PURE__ */ e(R, { value: "decimal", children: "Decimal" }),
|
|
774
|
+
/* @__PURE__ */ e(R, { value: "boolean", children: "Boolean" }),
|
|
775
|
+
/* @__PURE__ */ e(R, { value: "color", children: "Color" }),
|
|
776
|
+
/* @__PURE__ */ e(R, { value: "url", children: "URL (Upload)" }),
|
|
777
|
+
/* @__PURE__ */ e(R, { value: "json", children: "JSON" }),
|
|
778
|
+
/* @__PURE__ */ e(R, { value: "yaml", children: "YAML" }),
|
|
779
|
+
/* @__PURE__ */ e(R, { value: "component", children: "Component" }),
|
|
780
|
+
/* @__PURE__ */ e(R, { value: "custom", children: "Custom (Render by a Component)" })
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
)
|
|
784
|
+
] }),
|
|
785
|
+
/* @__PURE__ */ w(D, { direction: "row", gap: 1, children: [
|
|
786
|
+
/* @__PURE__ */ e(
|
|
787
|
+
W,
|
|
788
|
+
{
|
|
789
|
+
allComponents: n,
|
|
790
|
+
defaultLocale: i,
|
|
791
|
+
component: t,
|
|
792
|
+
property: l,
|
|
793
|
+
label: c("defaultValue"),
|
|
794
|
+
size: "small",
|
|
795
|
+
fullWidth: !0,
|
|
796
|
+
value: (b = (I = l.locales) == null ? void 0 : I[r]) == null ? void 0 : b.defaultValue,
|
|
797
|
+
onChange: (d) => {
|
|
798
|
+
u((h) => {
|
|
799
|
+
var S;
|
|
800
|
+
const m = h.properties[l.id].data;
|
|
801
|
+
m.locales ?? (m.locales = {}), (S = m.locales)[r] ?? (S[r] = {}), m.locales[r].defaultValue = d;
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
l.type === "custom" ? /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(hr, { property: l, allComponents: n }) }) : null
|
|
807
|
+
] })
|
|
808
|
+
] })
|
|
720
809
|
}
|
|
721
|
-
)
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
810
|
+
) })
|
|
811
|
+
},
|
|
812
|
+
l.id
|
|
813
|
+
);
|
|
725
814
|
}
|
|
726
815
|
}
|
|
727
|
-
),
|
|
728
|
-
|
|
816
|
+
) : /* @__PURE__ */ e(he, { style: { fontSize: 12 }, children: c("maker.properties.noProperties") }),
|
|
817
|
+
v && /* @__PURE__ */ e(et, { ...Qe(a), component: t })
|
|
729
818
|
] }) });
|
|
730
819
|
}
|
|
731
|
-
function
|
|
820
|
+
function hr({
|
|
732
821
|
property: t,
|
|
733
|
-
allComponents:
|
|
822
|
+
allComponents: r
|
|
734
823
|
}) {
|
|
735
|
-
const
|
|
736
|
-
return /* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */ e(
|
|
738
|
-
/* @__PURE__ */ e(
|
|
739
|
-
|
|
824
|
+
const i = se({ variant: "popper" });
|
|
825
|
+
return /* @__PURE__ */ w(U, { children: [
|
|
826
|
+
/* @__PURE__ */ e(A, { sx: { minWidth: 0 }, ...ce(i), children: /* @__PURE__ */ e(qe, { fontSize: "small" }) }),
|
|
827
|
+
/* @__PURE__ */ e(_e, { ...Xe(i), children: /* @__PURE__ */ e($e, { onClickAway: i.close, children: /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(P, { width: 500, p: 2, children: /* @__PURE__ */ e(
|
|
828
|
+
ye,
|
|
740
829
|
{
|
|
741
830
|
value: t.componentId,
|
|
742
|
-
onChange: (
|
|
743
|
-
allComponents:
|
|
831
|
+
onChange: (n, u) => t.componentId = u,
|
|
832
|
+
allComponents: r
|
|
744
833
|
}
|
|
745
834
|
) }) }) }) })
|
|
746
835
|
] });
|
|
747
836
|
}
|
|
748
|
-
function
|
|
837
|
+
function fr({
|
|
749
838
|
value: t,
|
|
750
|
-
valueImmutable:
|
|
751
|
-
onChange:
|
|
752
|
-
defaultLocale:
|
|
753
|
-
allComponents:
|
|
839
|
+
valueImmutable: r,
|
|
840
|
+
onChange: i,
|
|
841
|
+
defaultLocale: n,
|
|
842
|
+
allComponents: u
|
|
754
843
|
}) {
|
|
755
|
-
var
|
|
756
|
-
const
|
|
757
|
-
return
|
|
758
|
-
/* @__PURE__ */ e(
|
|
844
|
+
var k;
|
|
845
|
+
const v = se({ variant: "popper" }), { locale: c } = j(), a = typeof (t == null ? void 0 : t.componentId) == "string" ? (k = u[t.componentId]) == null ? void 0 : k.data : void 0;
|
|
846
|
+
return a ? /* @__PURE__ */ w(U, { children: [
|
|
847
|
+
/* @__PURE__ */ e(A, { sx: { minWidth: 0 }, disabled: !a, ...ce(v), children: /* @__PURE__ */ e(qe, { fontSize: "small" }) }),
|
|
759
848
|
/* @__PURE__ */ e(
|
|
760
|
-
|
|
849
|
+
_e,
|
|
761
850
|
{
|
|
762
|
-
...
|
|
851
|
+
...Xe(v),
|
|
763
852
|
sx: {
|
|
764
853
|
zIndex: 1e3
|
|
765
854
|
},
|
|
766
|
-
children: /* @__PURE__ */ e(
|
|
767
|
-
/* @__PURE__ */ e(
|
|
768
|
-
/* @__PURE__ */ e(
|
|
769
|
-
var
|
|
770
|
-
return /* @__PURE__ */ e(
|
|
855
|
+
children: /* @__PURE__ */ e($e, { onClickAway: v.close, children: /* @__PURE__ */ e(me, { children: /* @__PURE__ */ w(P, { width: 500, p: 2, children: [
|
|
856
|
+
/* @__PURE__ */ e(V, { variant: "subtitle1", children: "Parameters" }),
|
|
857
|
+
/* @__PURE__ */ e(D, { gap: 1, children: (a == null ? void 0 : a.properties) && F(Object.values(a.properties), "index").map(({ data: l }) => {
|
|
858
|
+
var y, f, p, x, o, s, g, I;
|
|
859
|
+
return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
|
|
771
860
|
W,
|
|
772
861
|
{
|
|
773
|
-
allComponents:
|
|
774
|
-
defaultLocale:
|
|
862
|
+
allComponents: u,
|
|
863
|
+
defaultLocale: n,
|
|
775
864
|
size: "small",
|
|
776
865
|
fullWidth: !0,
|
|
777
|
-
component:
|
|
778
|
-
property:
|
|
779
|
-
valueImmutable:
|
|
780
|
-
value: ((
|
|
781
|
-
onChange: (
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
784
|
-
|
|
866
|
+
component: a,
|
|
867
|
+
property: l,
|
|
868
|
+
valueImmutable: L((f = (y = t.properties) == null ? void 0 : y[l.id]) == null ? void 0 : f.value),
|
|
869
|
+
value: ((x = (p = t.properties) == null ? void 0 : p[l.id]) == null ? void 0 : x.value) ?? ((s = (o = l.locales) == null ? void 0 : o[c]) == null ? void 0 : s.defaultValue) ?? ((I = (g = l.locales) == null ? void 0 : g[n]) == null ? void 0 : I.defaultValue),
|
|
870
|
+
onChange: (b) => {
|
|
871
|
+
if (r) {
|
|
872
|
+
const d = JSON.parse(JSON.stringify(t));
|
|
873
|
+
i == null || i({ ...d, properties: { ...d.properties, [l.id]: { value: b } } });
|
|
785
874
|
} else
|
|
786
|
-
_(
|
|
787
|
-
t.properties ?? (t.properties = {}), t.properties[
|
|
875
|
+
_(a).doc.transact(() => {
|
|
876
|
+
t.properties ?? (t.properties = {}), t.properties[l.id] = { value: b };
|
|
788
877
|
});
|
|
789
878
|
}
|
|
790
879
|
}
|
|
791
|
-
) },
|
|
880
|
+
) }, l.id);
|
|
792
881
|
}) })
|
|
793
882
|
] }) }) })
|
|
794
883
|
}
|
|
795
884
|
)
|
|
796
885
|
] }) : null;
|
|
797
886
|
}
|
|
798
|
-
function
|
|
887
|
+
function et({
|
|
799
888
|
type: t = "properties",
|
|
800
|
-
component:
|
|
801
|
-
...
|
|
889
|
+
component: r,
|
|
890
|
+
...i
|
|
802
891
|
}) {
|
|
803
|
-
var
|
|
804
|
-
const { t:
|
|
892
|
+
var f, p, x;
|
|
893
|
+
const { t: n } = j(), {
|
|
805
894
|
state: {
|
|
806
|
-
components:
|
|
807
|
-
supportedLocales:
|
|
808
|
-
config: { defaultLocale:
|
|
895
|
+
components: u,
|
|
896
|
+
supportedLocales: v,
|
|
897
|
+
config: { defaultLocale: c }
|
|
809
898
|
}
|
|
810
|
-
} =
|
|
811
|
-
return /* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */ e(
|
|
813
|
-
/* @__PURE__ */ e(
|
|
814
|
-
/* @__PURE__ */ e(
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
] },
|
|
818
|
-
/* @__PURE__ */ e(
|
|
819
|
-
var
|
|
820
|
-
return /* @__PURE__ */ e(
|
|
899
|
+
} = le(), a = ae(), k = _(r).doc, l = t === "properties" ? r.properties : t === "parameters" && ((f = r.renderer) == null ? void 0 : f.type) === "component" ? (p = u[r.renderer.componentId]) == null ? void 0 : p.data.properties : void 0, y = ((x = r.renderer) == null ? void 0 : x.type) === "component" ? r : void 0;
|
|
900
|
+
return /* @__PURE__ */ w(pe, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
901
|
+
/* @__PURE__ */ e(Ue, { children: n("i18nEditorTitle") }),
|
|
902
|
+
/* @__PURE__ */ e(We, { children: l && /* @__PURE__ */ e(D, { children: /* @__PURE__ */ w(ot, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
903
|
+
/* @__PURE__ */ e(st, { children: /* @__PURE__ */ e(Oe, { children: v.map(({ locale: o, name: s }) => /* @__PURE__ */ w(ze, { children: [
|
|
904
|
+
s,
|
|
905
|
+
c === o && /* @__PURE__ */ e(Gt, { sx: { fontSize: 12, color: "text.secondary" } })
|
|
906
|
+
] }, o)) }) }),
|
|
907
|
+
/* @__PURE__ */ e(ct, { children: F(Object.values(l), "index").map(({ data: o }) => /* @__PURE__ */ e(Oe, { children: v.map(({ locale: s }) => {
|
|
908
|
+
var g, I, b, d, h, m, S, C, z, T, K, E, H, J, ee, M, $, Y, G, q, ve, xe, ge, ke, Ie, we;
|
|
909
|
+
return /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(D, { gap: 1, children: t === "properties" ? /* @__PURE__ */ w(U, { children: [
|
|
821
910
|
/* @__PURE__ */ e(
|
|
822
|
-
|
|
911
|
+
O,
|
|
823
912
|
{
|
|
824
913
|
size: "small",
|
|
825
914
|
label: "Key",
|
|
826
|
-
value:
|
|
915
|
+
value: o.key || "",
|
|
827
916
|
onChange: (B) => {
|
|
828
|
-
|
|
829
|
-
|
|
917
|
+
k.transact(() => {
|
|
918
|
+
o.key = B.target.value.trim();
|
|
830
919
|
});
|
|
831
920
|
}
|
|
832
921
|
}
|
|
833
922
|
),
|
|
834
923
|
/* @__PURE__ */ e(
|
|
835
|
-
|
|
924
|
+
O,
|
|
836
925
|
{
|
|
837
926
|
size: "small",
|
|
838
|
-
label:
|
|
839
|
-
value: (((
|
|
927
|
+
label: n("label"),
|
|
928
|
+
value: (((I = (g = o.locales) == null ? void 0 : g[s]) == null ? void 0 : I.name) ?? ((d = (b = o.locales) == null ? void 0 : b[c]) == null ? void 0 : d.name)) || "",
|
|
840
929
|
onChange: (B) => {
|
|
841
|
-
|
|
842
|
-
var
|
|
843
|
-
|
|
930
|
+
k.transact(() => {
|
|
931
|
+
var N;
|
|
932
|
+
o.locales ?? (o.locales = {}), (N = o.locales)[s] ?? (N[s] = {}), o.locales[s].name = B.target.value;
|
|
844
933
|
});
|
|
845
934
|
}
|
|
846
935
|
}
|
|
847
936
|
),
|
|
848
|
-
/* @__PURE__ */ e(
|
|
937
|
+
/* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
|
|
849
938
|
W,
|
|
850
939
|
{
|
|
851
|
-
allComponents:
|
|
852
|
-
defaultLocale:
|
|
853
|
-
component:
|
|
854
|
-
property:
|
|
940
|
+
allComponents: a,
|
|
941
|
+
defaultLocale: c,
|
|
942
|
+
component: r,
|
|
943
|
+
property: o,
|
|
855
944
|
size: "small",
|
|
856
945
|
fullWidth: !0,
|
|
857
946
|
label: "Default Value",
|
|
858
|
-
valueImmutable:
|
|
859
|
-
value: ((
|
|
947
|
+
valueImmutable: L((m = (h = o.locales) == null ? void 0 : h[s]) == null ? void 0 : m.defaultValue),
|
|
948
|
+
value: ((C = (S = o.locales) == null ? void 0 : S[s]) == null ? void 0 : C.defaultValue) ?? ((T = (z = o.locales) == null ? void 0 : z[c]) == null ? void 0 : T.defaultValue),
|
|
860
949
|
onChange: (B) => {
|
|
861
|
-
|
|
862
|
-
var
|
|
863
|
-
|
|
950
|
+
k.transact(() => {
|
|
951
|
+
var N;
|
|
952
|
+
o.locales ?? (o.locales = {}), (N = o.locales)[s] ?? (N[s] = {}), o.locales[s].defaultValue = B;
|
|
864
953
|
});
|
|
865
954
|
}
|
|
866
955
|
}
|
|
867
956
|
) })
|
|
868
|
-
] }) : t === "parameters" &&
|
|
957
|
+
] }) : t === "parameters" && y ? /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
|
|
869
958
|
W,
|
|
870
959
|
{
|
|
871
|
-
allComponents:
|
|
872
|
-
defaultLocale:
|
|
873
|
-
component:
|
|
874
|
-
property:
|
|
960
|
+
allComponents: a,
|
|
961
|
+
defaultLocale: c,
|
|
962
|
+
component: r,
|
|
963
|
+
property: o,
|
|
875
964
|
size: "small",
|
|
876
965
|
fullWidth: !0,
|
|
877
|
-
valueImmutable:
|
|
878
|
-
(J = (
|
|
966
|
+
valueImmutable: L(
|
|
967
|
+
(J = (H = (E = (K = y.renderer.properties) == null ? void 0 : K[o.id]) == null ? void 0 : E.locales) == null ? void 0 : H[s]) == null ? void 0 : J.value
|
|
879
968
|
),
|
|
880
|
-
value: ((
|
|
969
|
+
value: ((Y = ($ = (M = (ee = y.renderer.properties) == null ? void 0 : ee[o.id]) == null ? void 0 : M.locales) == null ? void 0 : $[s]) == null ? void 0 : Y.value) ?? ((xe = (ve = (q = (G = y.renderer.properties) == null ? void 0 : G[o.id]) == null ? void 0 : q.locales) == null ? void 0 : ve[c]) == null ? void 0 : xe.value) ?? ((ke = (ge = o.locales) == null ? void 0 : ge[s]) == null ? void 0 : ke.defaultValue) ?? ((we = (Ie = o.locales) == null ? void 0 : Ie[c]) == null ? void 0 : we.defaultValue),
|
|
881
970
|
onChange: (B) => {
|
|
882
|
-
|
|
883
|
-
var
|
|
884
|
-
(
|
|
971
|
+
k.transact(() => {
|
|
972
|
+
var N, Se, Pe, Ce, De;
|
|
973
|
+
(N = y.renderer).properties ?? (N.properties = {}), (Se = y.renderer.properties)[Pe = o.id] ?? (Se[Pe] = {}), (Ce = y.renderer.properties[o.id]).locales ?? (Ce.locales = {}), (De = y.renderer.properties[o.id].locales)[s] ?? (De[s] = {}), y.renderer.properties[o.id].locales[s].value = B;
|
|
885
974
|
});
|
|
886
975
|
}
|
|
887
976
|
}
|
|
888
|
-
) }) : null },
|
|
889
|
-
}) },
|
|
977
|
+
) }) : null }, o.id) }, s);
|
|
978
|
+
}) }, o.id)) })
|
|
890
979
|
] }) }) }),
|
|
891
|
-
/* @__PURE__ */ e(
|
|
892
|
-
var
|
|
893
|
-
return (
|
|
894
|
-
}, children:
|
|
980
|
+
/* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(A, { onClick: (o) => {
|
|
981
|
+
var s;
|
|
982
|
+
return (s = i.onClose) == null ? void 0 : s.call(i, o, "escapeKeyDown");
|
|
983
|
+
}, children: n("close") }) })
|
|
895
984
|
] });
|
|
896
985
|
}
|
|
897
986
|
function W({
|
|
898
987
|
component: t,
|
|
899
|
-
property:
|
|
900
|
-
value:
|
|
901
|
-
onChange:
|
|
902
|
-
valueImmutable:
|
|
903
|
-
defaultLocale:
|
|
904
|
-
allComponents:
|
|
905
|
-
...
|
|
988
|
+
property: r,
|
|
989
|
+
value: i,
|
|
990
|
+
onChange: n,
|
|
991
|
+
valueImmutable: u,
|
|
992
|
+
defaultLocale: v,
|
|
993
|
+
allComponents: c,
|
|
994
|
+
...a
|
|
906
995
|
}) {
|
|
907
|
-
var
|
|
908
|
-
const { locale:
|
|
909
|
-
|
|
996
|
+
var x, o, s, g, I;
|
|
997
|
+
const { locale: k } = j(), l = Kt(), y = Z(null), f = () => {
|
|
998
|
+
var d;
|
|
999
|
+
const b = (d = l == null ? void 0 : l.current) == null ? void 0 : d.getUploader();
|
|
1000
|
+
b == null || b.open(), y.current && b.onceUploadSuccess(({ response: h }) => {
|
|
1001
|
+
var S, C;
|
|
1002
|
+
let m = ((S = h == null ? void 0 : h.data) == null ? void 0 : S.filename) || "";
|
|
1003
|
+
m && (m = `mediakit://${m}`, i && !i.includes("mediakit://") && (m += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (C = y.current) == null || C.call(y, m);
|
|
1004
|
+
});
|
|
1005
|
+
}, p = a.label || ((o = (x = r.locales) == null ? void 0 : x[k]) == null ? void 0 : o.name) || ((g = (s = r.locales) == null ? void 0 : s[v]) == null ? void 0 : g.name) || r.key || r.id;
|
|
1006
|
+
if (r.type === "number")
|
|
910
1007
|
return /* @__PURE__ */ e(
|
|
911
|
-
|
|
1008
|
+
br,
|
|
912
1009
|
{
|
|
913
|
-
...
|
|
914
|
-
label:
|
|
1010
|
+
...a,
|
|
1011
|
+
label: p,
|
|
915
1012
|
NumberProps: {
|
|
916
|
-
value: ["number", "string"].includes(typeof
|
|
917
|
-
onChange: (
|
|
1013
|
+
value: ["number", "string"].includes(typeof i) ? i : null,
|
|
1014
|
+
onChange: (b, d) => n == null ? void 0 : n(d)
|
|
918
1015
|
}
|
|
919
1016
|
}
|
|
920
1017
|
);
|
|
921
|
-
if (
|
|
922
|
-
return null;
|
|
923
|
-
if (i.type === "decimal")
|
|
1018
|
+
if (r.type === "decimal")
|
|
924
1019
|
return /* @__PURE__ */ e(
|
|
925
|
-
|
|
1020
|
+
O,
|
|
926
1021
|
{
|
|
927
|
-
...
|
|
928
|
-
label:
|
|
1022
|
+
...a,
|
|
1023
|
+
label: p,
|
|
929
1024
|
type: "text",
|
|
930
|
-
value:
|
|
931
|
-
onChange: (
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
|
|
1025
|
+
value: i ?? "",
|
|
1026
|
+
onChange: (b) => {
|
|
1027
|
+
const d = b.target.value;
|
|
1028
|
+
if (d === "" || d === "-") {
|
|
1029
|
+
n == null || n(d);
|
|
935
1030
|
return;
|
|
936
1031
|
}
|
|
937
|
-
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(
|
|
938
|
-
let
|
|
939
|
-
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(
|
|
1032
|
+
if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(d)) {
|
|
1033
|
+
let m = d;
|
|
1034
|
+
/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(m) && (m = Number(m)), n == null || n(m);
|
|
940
1035
|
}
|
|
941
1036
|
}
|
|
942
1037
|
}
|
|
943
1038
|
);
|
|
944
|
-
if (
|
|
1039
|
+
if (r.type === "boolean")
|
|
945
1040
|
return /* @__PURE__ */ e(
|
|
946
|
-
|
|
1041
|
+
Ne,
|
|
947
1042
|
{
|
|
948
|
-
label:
|
|
1043
|
+
label: p,
|
|
949
1044
|
labelPlacement: "start",
|
|
950
|
-
control: /* @__PURE__ */ e(
|
|
1045
|
+
control: /* @__PURE__ */ e(Be, { checked: i === !0, onChange: (b, d) => n == null ? void 0 : n(d) })
|
|
951
1046
|
}
|
|
952
1047
|
);
|
|
953
|
-
if (
|
|
1048
|
+
if (r.type === "color")
|
|
954
1049
|
return /* @__PURE__ */ e(
|
|
955
|
-
|
|
1050
|
+
or,
|
|
956
1051
|
{
|
|
957
|
-
label:
|
|
958
|
-
value:
|
|
959
|
-
onChange: (
|
|
960
|
-
|
|
1052
|
+
label: p,
|
|
1053
|
+
value: i,
|
|
1054
|
+
onChange: (b) => {
|
|
1055
|
+
n == null || n(b);
|
|
961
1056
|
}
|
|
962
1057
|
}
|
|
963
1058
|
);
|
|
964
|
-
if (
|
|
965
|
-
return /* @__PURE__ */
|
|
966
|
-
|
|
1059
|
+
if (r.type === "json" || r.type === "yaml")
|
|
1060
|
+
return /* @__PURE__ */ w(
|
|
1061
|
+
D,
|
|
967
1062
|
{
|
|
968
1063
|
sx: {
|
|
969
1064
|
width: "100%",
|
|
@@ -976,7 +1071,7 @@ function W({
|
|
|
976
1071
|
},
|
|
977
1072
|
children: [
|
|
978
1073
|
/* @__PURE__ */ e(
|
|
979
|
-
|
|
1074
|
+
lt,
|
|
980
1075
|
{
|
|
981
1076
|
sx: {
|
|
982
1077
|
position: "absolute",
|
|
@@ -984,25 +1079,25 @@ function W({
|
|
|
984
1079
|
top: 0,
|
|
985
1080
|
transform: "translate(0px, -7px) scale(0.75)"
|
|
986
1081
|
},
|
|
987
|
-
children:
|
|
1082
|
+
children: p
|
|
988
1083
|
}
|
|
989
1084
|
),
|
|
990
1085
|
/* @__PURE__ */ e(
|
|
991
|
-
|
|
1086
|
+
Je,
|
|
992
1087
|
{
|
|
993
|
-
keyId:
|
|
994
|
-
locale:
|
|
995
|
-
language:
|
|
996
|
-
value: typeof
|
|
997
|
-
onChange: (
|
|
998
|
-
onUpload: (
|
|
999
|
-
|
|
1088
|
+
keyId: r.id,
|
|
1089
|
+
locale: k,
|
|
1090
|
+
language: r.type === "yaml" ? "yaml" : "json",
|
|
1091
|
+
value: typeof i == "string" ? i : "",
|
|
1092
|
+
onChange: (b) => n == null ? void 0 : n(b),
|
|
1093
|
+
onUpload: (b) => {
|
|
1094
|
+
y.current = b, f();
|
|
1000
1095
|
}
|
|
1001
1096
|
},
|
|
1002
|
-
|
|
1097
|
+
r.id
|
|
1003
1098
|
),
|
|
1004
1099
|
/* @__PURE__ */ e(
|
|
1005
|
-
|
|
1100
|
+
P,
|
|
1006
1101
|
{
|
|
1007
1102
|
component: "fieldset",
|
|
1008
1103
|
sx: {
|
|
@@ -1018,104 +1113,104 @@ function W({
|
|
|
1018
1113
|
px: 1,
|
|
1019
1114
|
py: 0
|
|
1020
1115
|
},
|
|
1021
|
-
children: /* @__PURE__ */ e(
|
|
1116
|
+
children: /* @__PURE__ */ e(P, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ e(P, { component: "span", sx: { opacity: 0 }, children: a.label }) })
|
|
1022
1117
|
}
|
|
1023
1118
|
)
|
|
1024
1119
|
]
|
|
1025
1120
|
}
|
|
1026
1121
|
);
|
|
1027
|
-
if (
|
|
1028
|
-
const
|
|
1029
|
-
return
|
|
1030
|
-
|
|
1122
|
+
if (r.type === "custom") {
|
|
1123
|
+
const b = (I = c[r.componentId]) == null ? void 0 : I.data;
|
|
1124
|
+
return b ? /* @__PURE__ */ e(P, { width: "100%", children: /* @__PURE__ */ e(
|
|
1125
|
+
Me,
|
|
1031
1126
|
{
|
|
1032
|
-
componentId:
|
|
1033
|
-
props: { label:
|
|
1034
|
-
locale:
|
|
1127
|
+
componentId: b.id,
|
|
1128
|
+
props: { label: p, value: i, onChange: n },
|
|
1129
|
+
locale: k,
|
|
1035
1130
|
dev: {
|
|
1036
1131
|
mode: "draft",
|
|
1037
|
-
components:
|
|
1038
|
-
defaultLocale:
|
|
1132
|
+
components: c,
|
|
1133
|
+
defaultLocale: v
|
|
1039
1134
|
}
|
|
1040
1135
|
}
|
|
1041
|
-
) }) : /* @__PURE__ */ e(
|
|
1136
|
+
) }) : /* @__PURE__ */ e(O, { ...a, label: p, disabled: !0, placeholder: "Click right button select a component" });
|
|
1042
1137
|
}
|
|
1043
|
-
if (
|
|
1044
|
-
return /* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */ e(
|
|
1046
|
-
|
|
1138
|
+
if (r.type === "component")
|
|
1139
|
+
return /* @__PURE__ */ w(D, { width: "100%", direction: "row", gap: 1, children: [
|
|
1140
|
+
/* @__PURE__ */ e(P, { flex: 1, children: /* @__PURE__ */ e(
|
|
1141
|
+
ye,
|
|
1047
1142
|
{
|
|
1048
|
-
allComponents:
|
|
1049
|
-
label:
|
|
1050
|
-
value:
|
|
1051
|
-
onChange: (
|
|
1052
|
-
|
|
1143
|
+
allComponents: c,
|
|
1144
|
+
label: p,
|
|
1145
|
+
value: i == null ? void 0 : i.componentId,
|
|
1146
|
+
onChange: (b, d) => {
|
|
1147
|
+
u || !i ? n == null || n({ ...i && JSON.parse(JSON.stringify(i)), componentId: d }) : typeof i == "object" && (i.componentId = d);
|
|
1053
1148
|
}
|
|
1054
1149
|
}
|
|
1055
1150
|
) }),
|
|
1056
|
-
/* @__PURE__ */ e(
|
|
1057
|
-
|
|
1151
|
+
/* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
|
|
1152
|
+
fr,
|
|
1058
1153
|
{
|
|
1059
|
-
value:
|
|
1060
|
-
valueImmutable:
|
|
1061
|
-
onChange:
|
|
1062
|
-
defaultLocale:
|
|
1063
|
-
allComponents:
|
|
1154
|
+
value: i,
|
|
1155
|
+
valueImmutable: u,
|
|
1156
|
+
onChange: n,
|
|
1157
|
+
defaultLocale: v,
|
|
1158
|
+
allComponents: c
|
|
1064
1159
|
}
|
|
1065
1160
|
) })
|
|
1066
1161
|
] });
|
|
1067
|
-
if (!
|
|
1068
|
-
const
|
|
1162
|
+
if (!r.type || ["string", "url"].includes(r.type)) {
|
|
1163
|
+
const b = r.type === "string" ? r.multiline : void 0, d = r.type === "url" ? i == null ? void 0 : i.url : i;
|
|
1069
1164
|
return /* @__PURE__ */ e(
|
|
1070
|
-
|
|
1165
|
+
O,
|
|
1071
1166
|
{
|
|
1072
|
-
...
|
|
1073
|
-
label:
|
|
1074
|
-
value: typeof
|
|
1075
|
-
multiline:
|
|
1076
|
-
minRows:
|
|
1077
|
-
maxRows:
|
|
1078
|
-
onChange: (
|
|
1079
|
-
|
|
1167
|
+
...a,
|
|
1168
|
+
label: p,
|
|
1169
|
+
value: typeof d == "string" ? d : "",
|
|
1170
|
+
multiline: b,
|
|
1171
|
+
minRows: b ? 2 : void 0,
|
|
1172
|
+
maxRows: b ? 10 : void 0,
|
|
1173
|
+
onChange: (h) => n == null ? void 0 : n(
|
|
1174
|
+
r.type === "url" ? { ...i, url: h.target.value, mediaKitUrl: h.target.value } : h.target.value
|
|
1080
1175
|
),
|
|
1081
|
-
InputProps:
|
|
1176
|
+
InputProps: r.type === "url" ? {
|
|
1082
1177
|
sx: { pr: 0 },
|
|
1083
|
-
endAdornment: /* @__PURE__ */
|
|
1178
|
+
endAdornment: /* @__PURE__ */ w(oe, { position: "end", children: [
|
|
1084
1179
|
/* @__PURE__ */ e(
|
|
1085
|
-
|
|
1180
|
+
fe,
|
|
1086
1181
|
{
|
|
1087
|
-
onChange: async ({ response:
|
|
1088
|
-
var
|
|
1089
|
-
const
|
|
1090
|
-
let
|
|
1091
|
-
|
|
1182
|
+
onChange: async ({ response: h }) => {
|
|
1183
|
+
var z, T, K;
|
|
1184
|
+
const m = ((z = h == null ? void 0 : h.data) == null ? void 0 : z.url) || ((T = h == null ? void 0 : h.data) == null ? void 0 : T.fileUrl);
|
|
1185
|
+
let S;
|
|
1186
|
+
m && (S = await de(m).catch(() => ue(m)).catch(() => {
|
|
1092
1187
|
}));
|
|
1093
|
-
let C = ((
|
|
1094
|
-
C && (C = `mediakit://${C}`),
|
|
1095
|
-
url:
|
|
1188
|
+
let C = ((K = h == null ? void 0 : h.data) == null ? void 0 : K.filename) || "";
|
|
1189
|
+
C && (C = `mediakit://${C}`), n == null || n({
|
|
1190
|
+
url: m,
|
|
1096
1191
|
mediaKitUrl: C,
|
|
1097
|
-
width:
|
|
1098
|
-
height:
|
|
1192
|
+
width: S == null ? void 0 : S.naturalWidth,
|
|
1193
|
+
height: S == null ? void 0 : S.naturalHeight
|
|
1099
1194
|
});
|
|
1100
1195
|
}
|
|
1101
1196
|
}
|
|
1102
1197
|
),
|
|
1103
|
-
/* @__PURE__ */ e(
|
|
1198
|
+
/* @__PURE__ */ e(Q, { 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__ */ e(Ge, { sx: { cursor: "default" }, fontSize: "small" }) })
|
|
1104
1199
|
] })
|
|
1105
1200
|
} : void 0
|
|
1106
1201
|
}
|
|
1107
1202
|
);
|
|
1108
1203
|
}
|
|
1109
|
-
return console.error("Unsupported property type",
|
|
1204
|
+
return console.error("Unsupported property type", r.type), null;
|
|
1110
1205
|
}
|
|
1111
|
-
function
|
|
1206
|
+
function br({
|
|
1112
1207
|
NumberProps: t,
|
|
1113
|
-
...
|
|
1208
|
+
...r
|
|
1114
1209
|
}) {
|
|
1115
|
-
const { getInputProps:
|
|
1116
|
-
return /* @__PURE__ */ e(
|
|
1210
|
+
const { getInputProps: i } = Et(t), n = i();
|
|
1211
|
+
return /* @__PURE__ */ e(O, { ...r, inputProps: n });
|
|
1117
1212
|
}
|
|
1118
|
-
const
|
|
1213
|
+
const yr = `import React from '@blocklet/pages-kit/builtin/react'
|
|
1119
1214
|
import { Box } from '@blocklet/pages-kit/builtin/mui/material'
|
|
1120
1215
|
|
|
1121
1216
|
export default function () {
|
|
@@ -1124,212 +1219,242 @@ export default function () {
|
|
|
1124
1219
|
Hello World
|
|
1125
1220
|
</Box>
|
|
1126
1221
|
)
|
|
1127
|
-
}`,
|
|
1222
|
+
}`, vr = `console.log('hello')
|
|
1128
1223
|
`;
|
|
1129
|
-
function
|
|
1224
|
+
function xr({
|
|
1130
1225
|
value: t
|
|
1131
1226
|
}) {
|
|
1132
|
-
const { locale:
|
|
1133
|
-
return
|
|
1134
|
-
var
|
|
1135
|
-
(
|
|
1136
|
-
t.renderer.script = t.renderer.type === "react-component" ?
|
|
1137
|
-
}),
|
|
1138
|
-
}, [t]), /* @__PURE__ */ e(
|
|
1139
|
-
|
|
1227
|
+
const { locale: r } = j(), i = Ut(), n = _(t).doc;
|
|
1228
|
+
return X(() => {
|
|
1229
|
+
var u;
|
|
1230
|
+
(u = t.renderer) != null && u.script || (n.transact(() => {
|
|
1231
|
+
t.renderer.script = t.renderer.type === "react-component" ? yr : vr;
|
|
1232
|
+
}), i());
|
|
1233
|
+
}, [t]), /* @__PURE__ */ e(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
|
|
1234
|
+
Je,
|
|
1140
1235
|
{
|
|
1141
1236
|
keyId: t.id,
|
|
1142
|
-
locale:
|
|
1237
|
+
locale: r,
|
|
1143
1238
|
language: "typescript",
|
|
1144
1239
|
value: t.renderer.script || "",
|
|
1145
|
-
onChange: (
|
|
1240
|
+
onChange: (u) => t.renderer.script = u,
|
|
1146
1241
|
typeScriptNoValidation: !1
|
|
1147
1242
|
},
|
|
1148
1243
|
t.id
|
|
1149
1244
|
) });
|
|
1150
1245
|
}
|
|
1151
|
-
function
|
|
1152
|
-
var
|
|
1153
|
-
const { t:
|
|
1246
|
+
function gr({ value: t }) {
|
|
1247
|
+
var y, f, p;
|
|
1248
|
+
const { t: r } = j(), i = _(t).doc, {
|
|
1154
1249
|
state: {
|
|
1155
|
-
components:
|
|
1156
|
-
config: { defaultLocale:
|
|
1157
|
-
resources:
|
|
1250
|
+
components: n,
|
|
1251
|
+
config: { defaultLocale: u },
|
|
1252
|
+
resources: v
|
|
1158
1253
|
},
|
|
1159
|
-
localState: { currentLocale:
|
|
1160
|
-
} =
|
|
1161
|
-
return /* @__PURE__ */
|
|
1254
|
+
localState: { currentLocale: c }
|
|
1255
|
+
} = le(), a = ae(), k = ((y = n[t.renderer.componentId]) == null ? void 0 : y.data) ?? ((p = (f = v.components) == null ? void 0 : f[t.renderer.componentId]) == null ? void 0 : p.component), l = se({ variant: "dialog" });
|
|
1256
|
+
return /* @__PURE__ */ w(D, { gap: 1, children: [
|
|
1162
1257
|
/* @__PURE__ */ e(
|
|
1163
|
-
|
|
1258
|
+
ye,
|
|
1164
1259
|
{
|
|
1165
|
-
allComponents:
|
|
1260
|
+
allComponents: a,
|
|
1166
1261
|
excludes: [t.id],
|
|
1167
1262
|
value: t.renderer.componentId,
|
|
1168
|
-
onChange: (
|
|
1263
|
+
onChange: (x, o) => t.renderer.componentId = o
|
|
1169
1264
|
}
|
|
1170
1265
|
),
|
|
1171
|
-
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */ e(
|
|
1174
|
-
/* @__PURE__ */ e(
|
|
1266
|
+
k && /* @__PURE__ */ w(U, { children: [
|
|
1267
|
+
/* @__PURE__ */ w(D, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
1268
|
+
/* @__PURE__ */ e(V, { variant: "subtitle2", children: r("parameters") }),
|
|
1269
|
+
/* @__PURE__ */ e(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...ce(l), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) })
|
|
1175
1270
|
] }),
|
|
1176
|
-
|
|
1177
|
-
var
|
|
1178
|
-
return /* @__PURE__ */ e(
|
|
1271
|
+
k.properties && F(Object.values(k.properties), "index").map(({ data: x }) => {
|
|
1272
|
+
var o, s, g, I, b, d, h, m, S, C, z, T, K, E, H, J;
|
|
1273
|
+
return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
|
|
1179
1274
|
W,
|
|
1180
1275
|
{
|
|
1181
|
-
allComponents:
|
|
1182
|
-
defaultLocale:
|
|
1183
|
-
component:
|
|
1184
|
-
property:
|
|
1276
|
+
allComponents: a,
|
|
1277
|
+
defaultLocale: u,
|
|
1278
|
+
component: k,
|
|
1279
|
+
property: x,
|
|
1185
1280
|
fullWidth: !0,
|
|
1186
1281
|
size: "small",
|
|
1187
|
-
valueImmutable:
|
|
1188
|
-
value: ((
|
|
1189
|
-
onChange: (
|
|
1190
|
-
|
|
1191
|
-
var
|
|
1192
|
-
(
|
|
1282
|
+
valueImmutable: L((I = (g = (s = (o = t.renderer.properties) == null ? void 0 : o[x.id]) == null ? void 0 : s.locales) == null ? void 0 : g[c]) == null ? void 0 : I.value),
|
|
1283
|
+
value: ((m = (h = (d = (b = t.renderer.properties) == null ? void 0 : b[x.id]) == null ? void 0 : d.locales) == null ? void 0 : h[c]) == null ? void 0 : m.value) ?? ((T = (z = (C = (S = t.renderer.properties) == null ? void 0 : S[x.id]) == null ? void 0 : C.locales) == null ? void 0 : z[u]) == null ? void 0 : T.value) ?? ((E = (K = x.locales) == null ? void 0 : K[c]) == null ? void 0 : E.defaultValue) ?? ((J = (H = x.locales) == null ? void 0 : H[u]) == null ? void 0 : J.defaultValue),
|
|
1284
|
+
onChange: (ee) => {
|
|
1285
|
+
i.transact(() => {
|
|
1286
|
+
var M, $, Y, G, q;
|
|
1287
|
+
(M = t.renderer).properties ?? (M.properties = {}), ($ = t.renderer.properties)[Y = x.id] ?? ($[Y] = {}), (G = t.renderer.properties[x.id]).locales ?? (G.locales = {}), (q = t.renderer.properties[x.id].locales)[c] ?? (q[c] = {}), t.renderer.properties[x.id].locales[c].value = ee;
|
|
1193
1288
|
});
|
|
1194
1289
|
}
|
|
1195
1290
|
}
|
|
1196
|
-
) },
|
|
1291
|
+
) }, x.id);
|
|
1197
1292
|
}),
|
|
1198
|
-
/* @__PURE__ */ e(
|
|
1293
|
+
/* @__PURE__ */ e(et, { ...Qe(l), component: t, type: "parameters" })
|
|
1199
1294
|
] })
|
|
1200
1295
|
] });
|
|
1201
1296
|
}
|
|
1202
|
-
function
|
|
1297
|
+
function ye({
|
|
1203
1298
|
label: t,
|
|
1204
|
-
options:
|
|
1205
|
-
excludes:
|
|
1206
|
-
value:
|
|
1207
|
-
onChange:
|
|
1208
|
-
allComponents:
|
|
1209
|
-
...
|
|
1299
|
+
options: r,
|
|
1300
|
+
excludes: i,
|
|
1301
|
+
value: n,
|
|
1302
|
+
onChange: u,
|
|
1303
|
+
allComponents: v,
|
|
1304
|
+
...c
|
|
1210
1305
|
}) {
|
|
1211
|
-
var
|
|
1212
|
-
const { t:
|
|
1306
|
+
var y;
|
|
1307
|
+
const { t: a } = j(), k = r ?? F(Object.values(Wt(v, ...i ?? [])), "index").map((f) => f.data), l = (typeof n == "string" ? (y = v[n]) == null ? void 0 : y.data : void 0) ?? null;
|
|
1213
1308
|
return /* @__PURE__ */ e(
|
|
1214
|
-
|
|
1309
|
+
Fe,
|
|
1215
1310
|
{
|
|
1216
|
-
...
|
|
1311
|
+
...c,
|
|
1217
1312
|
size: "small",
|
|
1218
|
-
options:
|
|
1313
|
+
options: k,
|
|
1219
1314
|
autoHighlight: !0,
|
|
1220
|
-
isOptionEqualToValue: (
|
|
1221
|
-
getOptionKey: (
|
|
1222
|
-
getOptionLabel: (
|
|
1223
|
-
renderInput: (
|
|
1224
|
-
value:
|
|
1225
|
-
onChange: (
|
|
1226
|
-
var
|
|
1227
|
-
let
|
|
1228
|
-
|
|
1229
|
-
blockletId: (
|
|
1230
|
-
blockletTitle: (
|
|
1231
|
-
componentName: ((
|
|
1232
|
-
}),
|
|
1315
|
+
isOptionEqualToValue: (f, p) => f.id === p.id,
|
|
1316
|
+
getOptionKey: (f) => f.id,
|
|
1317
|
+
getOptionLabel: (f) => f.name || f.id,
|
|
1318
|
+
renderInput: (f) => /* @__PURE__ */ e(O, { label: t || a("component"), ...f }),
|
|
1319
|
+
value: l,
|
|
1320
|
+
onChange: (f, p) => {
|
|
1321
|
+
var o, s, g, I, b, d;
|
|
1322
|
+
let x = {};
|
|
1323
|
+
p && (x = {
|
|
1324
|
+
blockletId: (o = v[p == null ? void 0 : p.id]) == null ? void 0 : o.blockletId,
|
|
1325
|
+
blockletTitle: (s = v[p == null ? void 0 : p.id]) == null ? void 0 : s.blockletTitle,
|
|
1326
|
+
componentName: ((I = (g = v[p == null ? void 0 : p.id]) == null ? void 0 : g.data) == null ? void 0 : I.name) || ((d = (b = v[p == null ? void 0 : p.id]) == null ? void 0 : b.data) == null ? void 0 : d.id)
|
|
1327
|
+
}), u == null || u(f, p == null ? void 0 : p.id, x);
|
|
1233
1328
|
}
|
|
1234
1329
|
}
|
|
1235
1330
|
);
|
|
1236
1331
|
}
|
|
1237
|
-
function
|
|
1332
|
+
function kr({
|
|
1238
1333
|
config: t,
|
|
1239
|
-
allComponents:
|
|
1240
|
-
defaultLocale:
|
|
1241
|
-
propertiesValue:
|
|
1242
|
-
currentLocale:
|
|
1243
|
-
onChange:
|
|
1244
|
-
props:
|
|
1334
|
+
allComponents: r,
|
|
1335
|
+
defaultLocale: i,
|
|
1336
|
+
propertiesValue: n,
|
|
1337
|
+
currentLocale: u,
|
|
1338
|
+
onChange: v,
|
|
1339
|
+
props: c
|
|
1245
1340
|
}) {
|
|
1246
|
-
const { t:
|
|
1247
|
-
|
|
1341
|
+
const { t: a } = j(), [k, l] = ie(t == null ? void 0 : t.properties), [y, f] = ie(null);
|
|
1342
|
+
X(() => {
|
|
1248
1343
|
(() => {
|
|
1249
|
-
var
|
|
1250
|
-
((
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1253
|
-
}) :
|
|
1344
|
+
var I, b;
|
|
1345
|
+
((I = t == null ? void 0 : t.renderer) == null ? void 0 : I.type) === "react-component" && Vt(t == null ? void 0 : t.properties) ? Ft((b = t == null ? void 0 : t.renderer) == null ? void 0 : b.script).then((d) => {
|
|
1346
|
+
const h = _t(d);
|
|
1347
|
+
l(h);
|
|
1348
|
+
}) : l(t == null ? void 0 : t.properties);
|
|
1254
1349
|
})();
|
|
1255
|
-
}, [t]);
|
|
1256
|
-
const
|
|
1257
|
-
(
|
|
1258
|
-
var d,
|
|
1259
|
-
const
|
|
1260
|
-
return
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
id:
|
|
1264
|
-
type:
|
|
1265
|
-
},
|
|
1350
|
+
}, [JSON.stringify(t)]);
|
|
1351
|
+
const p = ne(() => !t || !k ? {} : Object.values(k).reduce(
|
|
1352
|
+
(g, { data: I }) => {
|
|
1353
|
+
var d, h, m, S, C;
|
|
1354
|
+
const b = I.key || I.id;
|
|
1355
|
+
return g[I.id] = {
|
|
1356
|
+
key: b,
|
|
1357
|
+
value: (c == null ? void 0 : c[b]) ?? ((d = n == null ? void 0 : n[I.id]) == null ? void 0 : d.value) ?? ((m = (h = I.locales) == null ? void 0 : h[u]) == null ? void 0 : m.defaultValue) ?? ((C = (S = I.locales) == null ? void 0 : S[i]) == null ? void 0 : C.defaultValue),
|
|
1358
|
+
id: I.id,
|
|
1359
|
+
type: I.type
|
|
1360
|
+
}, g;
|
|
1266
1361
|
},
|
|
1267
1362
|
{}
|
|
1268
|
-
), [
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
dev: { mode: "draft", components: i, defaultLocale: n },
|
|
1304
|
-
props: {
|
|
1305
|
-
...p,
|
|
1306
|
-
onChange: (s) => {
|
|
1307
|
-
Object.keys(s).filter((o) => {
|
|
1308
|
-
var d;
|
|
1309
|
-
return s[o] !== ((d = f == null ? void 0 : f[o]) == null ? void 0 : d.value);
|
|
1310
|
-
}).filter((o) => !(o === "locale" && !Ut(f[o], "locale"))).forEach((o) => {
|
|
1311
|
-
const d = f[o];
|
|
1312
|
-
d != null && d.id ? b({
|
|
1313
|
-
path: ["properties", d.id],
|
|
1314
|
-
value: { value: s[o] },
|
|
1315
|
-
shouldSync: !(!d.type || De.includes(d.type)),
|
|
1363
|
+
), [JSON.stringify(k), t, n, u, i]), x = pt(() => {
|
|
1364
|
+
if (!k)
|
|
1365
|
+
return {
|
|
1366
|
+
canUseProperties: [],
|
|
1367
|
+
visibleProperties: [],
|
|
1368
|
+
canUsePropertiesKeys: []
|
|
1369
|
+
};
|
|
1370
|
+
const g = F(Object.values(k), "index"), I = g.filter(({ data: h }) => h.key && Le(k, h.id)), b = g.filter(({ data: h }) => h.key), d = b.map(({ data: h }) => h.key);
|
|
1371
|
+
return {
|
|
1372
|
+
canUseProperties: b,
|
|
1373
|
+
visibleProperties: I,
|
|
1374
|
+
canUsePropertiesKeys: d
|
|
1375
|
+
};
|
|
1376
|
+
}, [JSON.stringify(k)]), o = p(), s = Qt(o, "key");
|
|
1377
|
+
return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
|
|
1378
|
+
/* @__PURE__ */ e(V, { variant: "subtitle1", children: a("maker.properties.parameters") }),
|
|
1379
|
+
!t || x.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ e(he, { style: { fontSize: 12 }, children: a("maker.properties.noParameters") }) : /* @__PURE__ */ w(U, { children: [
|
|
1380
|
+
/* @__PURE__ */ e(D, { gap: 2, children: x.visibleProperties.map(({ data: g }) => {
|
|
1381
|
+
var I, b;
|
|
1382
|
+
return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
|
|
1383
|
+
W,
|
|
1384
|
+
{
|
|
1385
|
+
allComponents: r,
|
|
1386
|
+
defaultLocale: i,
|
|
1387
|
+
size: "small",
|
|
1388
|
+
fullWidth: !0,
|
|
1389
|
+
component: t,
|
|
1390
|
+
property: g,
|
|
1391
|
+
valueImmutable: L((I = n == null ? void 0 : n[g.id]) == null ? void 0 : I.value),
|
|
1392
|
+
value: (c == null ? void 0 : c[g.key || g.id]) ?? ((b = o[g.id]) == null ? void 0 : b.value),
|
|
1393
|
+
onChange: (d) => {
|
|
1394
|
+
v({
|
|
1395
|
+
path: ["properties", g.id],
|
|
1396
|
+
value: { value: d },
|
|
1397
|
+
shouldSync: !(!g.type || Ae.includes(g.type)),
|
|
1316
1398
|
excludeKeys: [],
|
|
1317
|
-
key:
|
|
1318
|
-
})
|
|
1319
|
-
}
|
|
1399
|
+
key: g.key || g.id
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
) }, g.id);
|
|
1404
|
+
}) }),
|
|
1405
|
+
/* @__PURE__ */ e(D, { gap: 2, sx: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
1406
|
+
Me,
|
|
1407
|
+
{
|
|
1408
|
+
componentId: (t == null ? void 0 : t.id) || "",
|
|
1409
|
+
renderType: "setting",
|
|
1410
|
+
locale: u,
|
|
1411
|
+
properties: o,
|
|
1412
|
+
dev: { mode: "draft", components: r, defaultLocale: i },
|
|
1413
|
+
props: {
|
|
1414
|
+
...Xt(c ?? {}, x.canUsePropertiesKeys),
|
|
1415
|
+
onChange: (g) => {
|
|
1416
|
+
const { canUsePropertiesKeys: I } = x;
|
|
1417
|
+
Object.keys(g).filter((d) => {
|
|
1418
|
+
var h;
|
|
1419
|
+
return g[d] !== ((h = s == null ? void 0 : s[d]) == null ? void 0 : h.value);
|
|
1420
|
+
}).filter((d) => !(d === "locale" && !qt(s[d], "locale"))).reduce((d, h) => d.then(() => {
|
|
1421
|
+
const m = s[h], S = I.includes(h);
|
|
1422
|
+
if (m != null && m.id && S)
|
|
1423
|
+
return v({
|
|
1424
|
+
path: ["properties", m.id],
|
|
1425
|
+
value: { value: g[h] },
|
|
1426
|
+
shouldSync: !(!m.type || Ae.includes(m.type)),
|
|
1427
|
+
excludeKeys: [],
|
|
1428
|
+
key: m.key || m.id
|
|
1429
|
+
}), Promise.resolve();
|
|
1430
|
+
const C = `propertyNotFound${h}`;
|
|
1431
|
+
if (y === C)
|
|
1432
|
+
return Promise.resolve();
|
|
1433
|
+
je.close(y);
|
|
1434
|
+
const z = je.warning(
|
|
1435
|
+
a("maker.properties.propertyNotFound", {
|
|
1436
|
+
key: h
|
|
1437
|
+
}),
|
|
1438
|
+
{
|
|
1439
|
+
key: C
|
|
1440
|
+
}
|
|
1441
|
+
);
|
|
1442
|
+
return f(z), Promise.resolve();
|
|
1443
|
+
}), Promise.resolve());
|
|
1444
|
+
}
|
|
1320
1445
|
}
|
|
1321
1446
|
}
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
] });
|
|
1447
|
+
) })
|
|
1448
|
+
] })
|
|
1449
|
+
] }) });
|
|
1325
1450
|
}
|
|
1326
1451
|
export {
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1452
|
+
pr as BasicInfo,
|
|
1453
|
+
ye as CustomComponentAutocomplete,
|
|
1454
|
+
Zr as CustomComponentSettings,
|
|
1455
|
+
yr as DefaultReactComponentScriptTemplate,
|
|
1456
|
+
vr as DefaultWebComponentScriptTemplate,
|
|
1457
|
+
kr as ParametersConfig,
|
|
1458
|
+
mr as PropertiesConfig,
|
|
1334
1459
|
W as PropertyValueField
|
|
1335
1460
|
};
|