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