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