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