@blocklet/pages-kit-inner-components 0.4.157 → 0.4.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/add-component.js +13 -13
- package/lib/cjs/chunks/{array-6wh7d5gC.js → array-CRb2HQOz.js} +2 -2
- package/lib/cjs/chunks/{config-string-DnwpUGUo.js → config-string-CN-vvf1B.js} +1 -1
- package/lib/cjs/chunks/{draft-data-DPZIakr4.js → draft-data-DPemVsYf.js} +1 -1
- package/lib/cjs/chunks/home-C9XNYTJ6.js +38 -0
- package/lib/cjs/chunks/{publish-button-Cr534T09.js → publish-button-D_fgYKpB.js} +1 -1
- package/lib/cjs/chunks/state-tJl9YPbn.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/setting.js +1 -1
- package/lib/cjs/theme.js +1 -239
- package/lib/es/add-component.js +299 -299
- package/lib/es/chunks/{array-DudMqbtU.js → array-MChdTfwz.js} +1 -4
- package/lib/es/chunks/{config-string-CNgatAMw.js → config-string-ivAnKlqs.js} +1 -1
- package/lib/es/chunks/{draft-data-DB1pDB18.js → draft-data-ClUGStC_.js} +1 -1
- package/lib/es/chunks/home-DLCpie9E.js +527 -0
- package/lib/es/chunks/{publish-button-BauXdoix.js → publish-button-Dur9W9gN.js} +3 -3
- package/lib/es/chunks/{state-BcZbsEn6.js → state-bs1ORWYm.js} +87 -80
- package/lib/es/home.js +3 -3
- package/lib/es/locales.js +8 -0
- package/lib/es/setting.js +37 -37
- package/lib/es/theme.js +416 -703
- package/package.json +18 -18
- package/lib/cjs/chunks/home-B5XHNRCN.js +0 -38
- package/lib/cjs/chunks/state-D4MG-uJB.js +0 -1
- package/lib/es/chunks/home-Bqe3w7ou.js +0 -533
|
@@ -68,11 +68,11 @@ function Ye({
|
|
|
68
68
|
children: a,
|
|
69
69
|
waitingSynced: f
|
|
70
70
|
}) {
|
|
71
|
-
const [I, w] = E(!1), { locale: h } = Z(), S = V(), e = `${S}:MakerLocalState`, o = `${S}:${t}`, [
|
|
71
|
+
const [I, w] = E(!1), { locale: h } = Z(), S = V(), e = `${S}:MakerLocalState`, o = `${S}:${t}`, [r, s] = ne(e, {
|
|
72
72
|
defaultValue: {},
|
|
73
73
|
listenStorageChange: !0
|
|
74
|
-
}), c = ce(
|
|
75
|
-
c.current =
|
|
74
|
+
}), c = ce(r);
|
|
75
|
+
c.current = r;
|
|
76
76
|
const i = v(
|
|
77
77
|
() => H({
|
|
78
78
|
dataSourceIds: [],
|
|
@@ -103,19 +103,19 @@ function Ye({
|
|
|
103
103
|
{ doc: d }
|
|
104
104
|
),
|
|
105
105
|
[d]
|
|
106
|
-
), [j, x] = E(null), [R,
|
|
106
|
+
), [j, x] = E(null), [R, T] = E(!1), [$, _] = E(void 0), M = k(async () => {
|
|
107
107
|
if (S) {
|
|
108
|
-
|
|
108
|
+
T(!0);
|
|
109
109
|
try {
|
|
110
110
|
const l = await Ie(S);
|
|
111
111
|
x(l);
|
|
112
112
|
} catch (l) {
|
|
113
113
|
console.error("Failed to fetch project:", l);
|
|
114
114
|
} finally {
|
|
115
|
-
|
|
115
|
+
T(!1);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
}, [S]),
|
|
118
|
+
}, [S]), G = k(
|
|
119
119
|
async (l, u) => {
|
|
120
120
|
var P;
|
|
121
121
|
if (_(void 0), !!S) {
|
|
@@ -136,39 +136,39 @@ function Ye({
|
|
|
136
136
|
[S, j]
|
|
137
137
|
);
|
|
138
138
|
O(() => {
|
|
139
|
-
S &&
|
|
140
|
-
}, [S,
|
|
139
|
+
S && M();
|
|
140
|
+
}, [S, M]);
|
|
141
141
|
const W = v(
|
|
142
142
|
() => ({
|
|
143
143
|
doc: d,
|
|
144
144
|
state: i,
|
|
145
145
|
localState: {
|
|
146
|
-
...
|
|
146
|
+
...r,
|
|
147
147
|
// always use the locale from the context
|
|
148
148
|
currentLocale: h
|
|
149
149
|
},
|
|
150
|
-
setLocalState: (l) =>
|
|
150
|
+
setLocalState: (l) => s(typeof l == "function" ? (u) => l(u ?? {}) : l),
|
|
151
151
|
undoManager: y,
|
|
152
152
|
projectState: {
|
|
153
153
|
project: j,
|
|
154
154
|
isLoadingProject: R,
|
|
155
|
-
error:
|
|
155
|
+
error: $
|
|
156
156
|
},
|
|
157
|
-
updateProject:
|
|
157
|
+
updateProject: G,
|
|
158
158
|
forceSync: g
|
|
159
159
|
}),
|
|
160
160
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
161
|
[
|
|
162
162
|
d,
|
|
163
163
|
i,
|
|
164
|
-
JSON.stringify(
|
|
164
|
+
JSON.stringify(r),
|
|
165
165
|
// resolve the problem of react warning
|
|
166
|
-
|
|
166
|
+
s,
|
|
167
167
|
y,
|
|
168
168
|
j,
|
|
169
169
|
R,
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
G,
|
|
171
|
+
$,
|
|
172
172
|
h,
|
|
173
173
|
g
|
|
174
174
|
]
|
|
@@ -179,19 +179,19 @@ function Ye({
|
|
|
179
179
|
l.meta.set("localState", { currentPageId: u, currentLocale: P, pages: m });
|
|
180
180
|
}), y.on("stack-item-popped", ({ stackItem: l }) => {
|
|
181
181
|
const u = l.meta.get("localState");
|
|
182
|
-
u &&
|
|
182
|
+
u && s((P) => ({ ...P, ...u }));
|
|
183
183
|
});
|
|
184
|
-
}, [y,
|
|
185
|
-
p.awareness.setLocalState(
|
|
186
|
-
}, [p,
|
|
184
|
+
}, [y, s]), O(() => {
|
|
185
|
+
p.awareness.setLocalState(r);
|
|
186
|
+
}, [p, r]), O(() => {
|
|
187
187
|
p.once("synced", () => w(!0));
|
|
188
188
|
const l = () => {
|
|
189
|
-
|
|
189
|
+
s((m) => ({
|
|
190
190
|
...m,
|
|
191
191
|
networkStatus: void 0
|
|
192
192
|
}));
|
|
193
193
|
}, u = () => {
|
|
194
|
-
|
|
194
|
+
s((m) => ({
|
|
195
195
|
...m,
|
|
196
196
|
networkStatus: "offline"
|
|
197
197
|
}));
|
|
@@ -201,7 +201,7 @@ function Ye({
|
|
|
201
201
|
return p.on("status", P), window.addEventListener("online", l), window.addEventListener("offline", u), () => {
|
|
202
202
|
p.off("status", P), window.removeEventListener("online", l), window.removeEventListener("offline", u);
|
|
203
203
|
};
|
|
204
|
-
}, [p,
|
|
204
|
+
}, [p, s]), f && !I ? null : /* @__PURE__ */ L(B.Provider, { value: W, children: a });
|
|
205
205
|
}
|
|
206
206
|
const ve = () => {
|
|
207
207
|
const n = ie(B);
|
|
@@ -210,8 +210,8 @@ const ve = () => {
|
|
|
210
210
|
const t = te(n.state), { setLocalState: a, localState: f } = n, I = de(), w = V(), h = v(
|
|
211
211
|
() => ({
|
|
212
212
|
setCurrentSectionId: (e, o) => {
|
|
213
|
-
var
|
|
214
|
-
e === f.currentPageId && o === ((
|
|
213
|
+
var r, s;
|
|
214
|
+
e === f.currentPageId && o === ((s = (r = f.pages) == null ? void 0 : r[e]) == null ? void 0 : s.currentSectionId) || (I(b("/admin/maker", w ?? "", "pages", e)), a(
|
|
215
215
|
(c) => C(c, (i) => {
|
|
216
216
|
var d;
|
|
217
217
|
i.currentPageId = e, i.currentComponentId = void 0, i.customComponentPreviewerProperties = {}, o !== void 0 && (i.pages ?? (i.pages = {}), (d = i.pages)[e] ?? (d[e] = {}), i.pages[e].currentSectionId = o ?? void 0), o ? window.sessionStorage.setItem("iframe_show_id", `"${o}"`) : window.sessionStorage.removeItem("iframe_show_id");
|
|
@@ -220,40 +220,40 @@ const ve = () => {
|
|
|
220
220
|
},
|
|
221
221
|
setCurrentComponentId: (e) => {
|
|
222
222
|
e !== f.currentComponentId && (I(b("/admin/maker", w ?? "", "components", e)), a(
|
|
223
|
-
(o) => C(o, (
|
|
224
|
-
|
|
223
|
+
(o) => C(o, (r) => {
|
|
224
|
+
r.currentPageId = void 0, r.currentComponentId = e, r.customComponentPreviewerProperties = {};
|
|
225
225
|
})
|
|
226
226
|
));
|
|
227
227
|
},
|
|
228
228
|
setCurrentRouteId: ({ routeId: e, dynamicParams: o }) => {
|
|
229
229
|
a(
|
|
230
|
-
(
|
|
231
|
-
|
|
230
|
+
(r) => C(r, (s) => {
|
|
231
|
+
s.currentRouteId = e, s.currentDynamicParams = o;
|
|
232
232
|
})
|
|
233
233
|
);
|
|
234
234
|
},
|
|
235
235
|
setCustomComponentPreviewerProperties: (() => {
|
|
236
236
|
const e = {}, o = N(() => {
|
|
237
237
|
a(
|
|
238
|
-
(
|
|
239
|
-
|
|
240
|
-
...
|
|
238
|
+
(r) => C(r, (s) => {
|
|
239
|
+
s.customComponentPreviewerProperties = {
|
|
240
|
+
...s == null ? void 0 : s.customComponentPreviewerProperties,
|
|
241
241
|
...e
|
|
242
242
|
}, Object.keys(e).forEach((c) => delete e[c]);
|
|
243
243
|
})
|
|
244
244
|
);
|
|
245
245
|
}, 5);
|
|
246
|
-
return (
|
|
247
|
-
Object.assign(e,
|
|
246
|
+
return (r) => {
|
|
247
|
+
Object.assign(e, r), o();
|
|
248
248
|
};
|
|
249
249
|
})(),
|
|
250
250
|
setRouteGenerateProcess: (e) => {
|
|
251
251
|
a(
|
|
252
|
-
(o) => C(o, (
|
|
253
|
-
e ?
|
|
254
|
-
...
|
|
252
|
+
(o) => C(o, (r) => {
|
|
253
|
+
e ? r.routeGenerateProcess = {
|
|
254
|
+
...r.routeGenerateProcess,
|
|
255
255
|
...e
|
|
256
|
-
} :
|
|
256
|
+
} : r.routeGenerateProcess = {};
|
|
257
257
|
})
|
|
258
258
|
);
|
|
259
259
|
},
|
|
@@ -265,6 +265,13 @@ const ve = () => {
|
|
|
265
265
|
};
|
|
266
266
|
})
|
|
267
267
|
);
|
|
268
|
+
},
|
|
269
|
+
setCurrentThemeMode: (e) => {
|
|
270
|
+
a(
|
|
271
|
+
(o) => C(o, (r) => {
|
|
272
|
+
r.currentThemeMode = e;
|
|
273
|
+
})
|
|
274
|
+
);
|
|
268
275
|
}
|
|
269
276
|
}),
|
|
270
277
|
[a, I, w]
|
|
@@ -272,13 +279,13 @@ const ve = () => {
|
|
|
272
279
|
() => ({
|
|
273
280
|
addPage: (e, o) => {
|
|
274
281
|
var c, i, d, p, g, y;
|
|
275
|
-
const
|
|
282
|
+
const r = (e == null ? void 0 : e.id) ?? A(), s = {
|
|
276
283
|
...e,
|
|
277
|
-
id:
|
|
284
|
+
id: r,
|
|
278
285
|
createdAt: (e == null ? void 0 : e.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
279
286
|
updatedAt: (e == null ? void 0 : e.updatedAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
280
287
|
publishedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
281
|
-
slug: (e == null ? void 0 : e.slug) ?? `/${
|
|
288
|
+
slug: (e == null ? void 0 : e.slug) ?? `/${r}`,
|
|
282
289
|
sections: (e == null ? void 0 : e.sections) ?? {},
|
|
283
290
|
sectionIds: (e == null ? void 0 : e.sectionIds) ?? [],
|
|
284
291
|
isPublic: (e == null ? void 0 : e.isPublic) ?? !0,
|
|
@@ -292,17 +299,17 @@ const ve = () => {
|
|
|
292
299
|
}
|
|
293
300
|
};
|
|
294
301
|
return n.doc.transact(() => {
|
|
295
|
-
t.pages[
|
|
296
|
-
}),
|
|
302
|
+
t.pages[s.id] = s, t.pageIds.splice(o ?? t.pageIds.length, 0, s.id);
|
|
303
|
+
}), s;
|
|
297
304
|
},
|
|
298
305
|
addRoute: (e, o) => {
|
|
299
|
-
const
|
|
306
|
+
const r = (e == null ? void 0 : e.id) ?? A(), s = {
|
|
300
307
|
...e,
|
|
301
|
-
id:
|
|
308
|
+
id: r,
|
|
302
309
|
createdAt: (e == null ? void 0 : e.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
303
310
|
updatedAt: (e == null ? void 0 : e.updatedAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
304
311
|
publishedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
305
|
-
path: (e == null ? void 0 : e.path) ?? `/${
|
|
312
|
+
path: (e == null ? void 0 : e.path) ?? `/${r}`,
|
|
306
313
|
handler: (e == null ? void 0 : e.handler) ?? "Pages Kit",
|
|
307
314
|
isPublic: (e == null ? void 0 : e.isPublic) ?? !0,
|
|
308
315
|
params: (e == null ? void 0 : e.params) ?? [],
|
|
@@ -311,17 +318,17 @@ const ve = () => {
|
|
|
311
318
|
dataSource: (e == null ? void 0 : e.dataSource) ?? {}
|
|
312
319
|
};
|
|
313
320
|
return n.doc.transact(() => {
|
|
314
|
-
t.routes ?? (t.routes = {}), t.routeIds ?? (t.routeIds = []), t.routes[
|
|
315
|
-
}),
|
|
321
|
+
t.routes ?? (t.routes = {}), t.routeIds ?? (t.routeIds = []), t.routes[s.id] = s, t.routeIds.splice(o ?? t.routeIds.length, 0, s.id);
|
|
322
|
+
}), s;
|
|
316
323
|
},
|
|
317
324
|
deleteRoute: (e) => {
|
|
318
|
-
var
|
|
325
|
+
var r;
|
|
319
326
|
if (!e)
|
|
320
327
|
return;
|
|
321
|
-
const o = (
|
|
328
|
+
const o = (r = t.routeIds) == null ? void 0 : r.indexOf(e);
|
|
322
329
|
o !== void 0 && o !== -1 && n.doc.transact(() => {
|
|
323
|
-
var
|
|
324
|
-
(
|
|
330
|
+
var s, c;
|
|
331
|
+
(s = t.routeIds) == null || s.splice(o, 1), (c = t.routes) == null || delete c[e];
|
|
325
332
|
});
|
|
326
333
|
},
|
|
327
334
|
deletePage: (e) => {
|
|
@@ -331,12 +338,12 @@ const ve = () => {
|
|
|
331
338
|
});
|
|
332
339
|
},
|
|
333
340
|
movePage: (e, o) => {
|
|
334
|
-
const { pageIds:
|
|
335
|
-
|
|
341
|
+
const { pageIds: r } = t, s = r.indexOf(e);
|
|
342
|
+
s >= 0 && r.splice(o, 0, ...r.splice(s, 1));
|
|
336
343
|
},
|
|
337
|
-
addSection: (e, o,
|
|
338
|
-
const
|
|
339
|
-
if (!
|
|
344
|
+
addSection: (e, o, r) => {
|
|
345
|
+
const s = t.pages[e];
|
|
346
|
+
if (!s)
|
|
340
347
|
throw new Error(`Page ${e} is not exists`);
|
|
341
348
|
const c = {
|
|
342
349
|
...o,
|
|
@@ -345,40 +352,40 @@ const ve = () => {
|
|
|
345
352
|
llmConfig: o.llmConfig ?? {}
|
|
346
353
|
};
|
|
347
354
|
return n.doc.transact(() => {
|
|
348
|
-
|
|
355
|
+
s.sections[c.id] = c, s.sectionIds.splice(r ?? s.sectionIds.length, 0, c.id);
|
|
349
356
|
}), c;
|
|
350
357
|
},
|
|
351
358
|
deleteSection: (e, o) => {
|
|
352
|
-
const
|
|
353
|
-
if (!
|
|
359
|
+
const r = t.pages[e];
|
|
360
|
+
if (!r)
|
|
354
361
|
throw new Error(`Page ${e} is not exists`);
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
362
|
+
const s = r.sectionIds.indexOf(o);
|
|
363
|
+
s !== -1 && n.doc.transact(() => {
|
|
364
|
+
r.sectionIds.splice(s, 1), delete r.sections[o];
|
|
358
365
|
});
|
|
359
366
|
},
|
|
360
|
-
toggleSectionVisibility: (e, o,
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
367
|
+
toggleSectionVisibility: (e, o, r) => {
|
|
368
|
+
const s = t.pages[e];
|
|
369
|
+
if (!s)
|
|
363
370
|
throw new Error(`Page ${e} is not exists`);
|
|
364
|
-
const c =
|
|
365
|
-
c && (c.visibility =
|
|
371
|
+
const c = s.sections[o];
|
|
372
|
+
c && (c.visibility = r);
|
|
366
373
|
},
|
|
367
|
-
moveSection: (e, o,
|
|
368
|
-
const
|
|
369
|
-
if (!
|
|
374
|
+
moveSection: (e, o, r) => {
|
|
375
|
+
const s = t.pages[e];
|
|
376
|
+
if (!s)
|
|
370
377
|
throw new Error(`Page ${e} is not exists`);
|
|
371
|
-
const { sectionIds: c } =
|
|
372
|
-
i >= 0 && c.splice(
|
|
378
|
+
const { sectionIds: c } = s, i = c.indexOf(o);
|
|
379
|
+
i >= 0 && c.splice(r, 0, ...c.splice(i, 1));
|
|
373
380
|
},
|
|
374
381
|
addDataSource: (e) => {
|
|
375
|
-
const o = e.id ?? A(),
|
|
382
|
+
const o = e.id ?? A(), r = {
|
|
376
383
|
...e ?? {},
|
|
377
384
|
id: o,
|
|
378
385
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
379
386
|
};
|
|
380
387
|
return n.doc.transact(() => {
|
|
381
|
-
t.dataSourceIds ?? (t.dataSourceIds = []), t.dataSources ?? (t.dataSources = {}), t.dataSourceIds.push(o), t.dataSources[o] =
|
|
388
|
+
t.dataSourceIds ?? (t.dataSourceIds = []), t.dataSources ?? (t.dataSources = {}), t.dataSourceIds.push(o), t.dataSources[o] = r;
|
|
382
389
|
}), t.dataSources[o];
|
|
383
390
|
},
|
|
384
391
|
deleteDataSource: (e) => {
|
|
@@ -402,15 +409,15 @@ const ve = () => {
|
|
|
402
409
|
return e ? t.pages[e] : void 0;
|
|
403
410
|
},
|
|
404
411
|
get currentSection() {
|
|
405
|
-
var
|
|
412
|
+
var s, c, i;
|
|
406
413
|
const {
|
|
407
414
|
localState: { currentPageId: e, ...o }
|
|
408
415
|
} = n;
|
|
409
416
|
if (!e)
|
|
410
417
|
return;
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
return (i = t.pages[e]) == null ? void 0 : i.sections[
|
|
418
|
+
const r = (c = (s = o.pages) == null ? void 0 : s[e]) == null ? void 0 : c.currentSectionId;
|
|
419
|
+
if (r)
|
|
420
|
+
return (i = t.pages[e]) == null ? void 0 : i.sections[r];
|
|
414
421
|
},
|
|
415
422
|
get currentRoute() {
|
|
416
423
|
var o;
|
package/lib/es/home.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import "./chunks/state-
|
|
2
|
+
import "./chunks/state-bs1ORWYm.js";
|
|
3
3
|
import "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import "@arcblock/ux/lib/Result";
|
|
5
5
|
import "@blocklet/pages-kit/builtin/page/header";
|
|
@@ -21,8 +21,8 @@ import "react-helmet";
|
|
|
21
21
|
import "react-router-dom";
|
|
22
22
|
import "react-use";
|
|
23
23
|
import "ufo";
|
|
24
|
-
import "./chunks/array-
|
|
25
|
-
import { a as D, P as R, d as S, c as W, b as j, T as k, H as q } from "./chunks/home-
|
|
24
|
+
import "./chunks/array-MChdTfwz.js";
|
|
25
|
+
import { a as D, P as R, d as S, c as W, b as j, T as k, H as q } from "./chunks/home-DLCpie9E.js";
|
|
26
26
|
export {
|
|
27
27
|
D as HomeView,
|
|
28
28
|
R as PageRoutes,
|
package/lib/es/locales.js
CHANGED
|
@@ -103,6 +103,10 @@ const t = e({
|
|
|
103
103
|
configColor: "Config color",
|
|
104
104
|
configColorMuiTheme: "Theme Color",
|
|
105
105
|
configColorCustomColor: "Custom Color",
|
|
106
|
+
configColorMuiThemeInfo: "Use theme color, it will automatically adapt to the theme color and dark mode",
|
|
107
|
+
configColorMuiThemeWithAlternateColor: " (includes light and dark modes)",
|
|
108
|
+
configColorLightMode: "Light Mode",
|
|
109
|
+
configColorDarkMode: "Dark Mode",
|
|
106
110
|
import: "Import",
|
|
107
111
|
importDialog: {
|
|
108
112
|
upload: {
|
|
@@ -584,6 +588,10 @@ const t = e({
|
|
|
584
588
|
configColor: "设置颜色",
|
|
585
589
|
configColorMuiTheme: "主题色",
|
|
586
590
|
configColorCustomColor: "自定义颜色",
|
|
591
|
+
configColorMuiThemeInfo: "使用主题色会自动适应主题配色及亮暗模式",
|
|
592
|
+
configColorMuiThemeWithAlternateColor: " (包含亮/暗两种模式)",
|
|
593
|
+
configColorLightMode: "亮色模式",
|
|
594
|
+
configColorDarkMode: "暗黑模式",
|
|
587
595
|
import: "导入",
|
|
588
596
|
importDialog: {
|
|
589
597
|
upload: {
|
package/lib/es/setting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t, jsxs as O, Fragment as X } from "react/jsx-runtime";
|
|
2
|
-
import { t as ye, g as Te, b as ce, E as ot, n as Ke, f as ve } from "./chunks/state-
|
|
2
|
+
import { t as ye, g as Te, b as ce, E as ot, n as Ke, f as ve } from "./chunks/state-bs1ORWYm.js";
|
|
3
3
|
import de from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useLocaleContext as C } from "@arcblock/ux/lib/Locale/context";
|
|
5
5
|
import { CodeEditor as xe } from "@blocklet/code-editor";
|
|
@@ -7,12 +7,12 @@ import nt from "@mui/icons-material/AddRounded";
|
|
|
7
7
|
import st from "@mui/icons-material/ArrowDownward";
|
|
8
8
|
import ct from "@mui/icons-material/ArrowUpward";
|
|
9
9
|
import dt from "@mui/icons-material/DeleteOutline";
|
|
10
|
-
import { Typography as
|
|
10
|
+
import { Typography as B, TextField as V, Stack as R, FormLabel as ie, Box as j, TableContainer as at, Paper as Z, Table as Be, TableHead as Fe, TableRow as le, TableCell as oe, TableBody as Je, Button as E, IconButton as ae, InputAdornment as ge, alpha as ue, Tooltip as G, buttonClasses as ut, Dialog as Me, Autocomplete as $e, FormControlLabel as pt, Switch as mt, MenuItem as pe, DialogTitle as ft, DialogContent as ht, DialogActions as bt, Collapse as yt, Divider as vt, Popper as xt } from "@mui/material";
|
|
11
11
|
import A from "lodash/sortBy";
|
|
12
|
-
import { useCallback as D, useMemo as ne, useRef as
|
|
12
|
+
import { useCallback as D, useMemo as ne, useRef as J, useId as gt, useEffect as $, useState as Q } from "react";
|
|
13
13
|
import { useUpdate as _e } from "react-use";
|
|
14
14
|
import { ColorItem as Pt, ConfigColorDialog as wt } from "@blocklet/pages-kit/builtin/color-picker";
|
|
15
|
-
import { C as kt } from "./chunks/config-string-
|
|
15
|
+
import { C as kt } from "./chunks/config-string-ivAnKlqs.js";
|
|
16
16
|
import Pe from "lodash/isEmpty";
|
|
17
17
|
import He from "lodash/set";
|
|
18
18
|
import * as me from "yaml";
|
|
@@ -137,7 +137,7 @@ function rr({
|
|
|
137
137
|
width: 40,
|
|
138
138
|
align: "center",
|
|
139
139
|
renderCell: ({ index: p }) => /* @__PURE__ */ t(
|
|
140
|
-
|
|
140
|
+
B,
|
|
141
141
|
{
|
|
142
142
|
variant: "body1",
|
|
143
143
|
sx: {
|
|
@@ -305,7 +305,7 @@ function ir({
|
|
|
305
305
|
onChange: r,
|
|
306
306
|
...i
|
|
307
307
|
}) {
|
|
308
|
-
const l =
|
|
308
|
+
const l = J(null);
|
|
309
309
|
return /* @__PURE__ */ O(X, { children: [
|
|
310
310
|
/* @__PURE__ */ t(
|
|
311
311
|
kt,
|
|
@@ -350,7 +350,7 @@ function lr({
|
|
|
350
350
|
PropertyValueField: x,
|
|
351
351
|
onUpload: g
|
|
352
352
|
}) {
|
|
353
|
-
const { locale: b } = C(), k =
|
|
353
|
+
const { locale: b } = C(), k = J(null);
|
|
354
354
|
if (!Pe(l.subProperties)) {
|
|
355
355
|
const o = A(Object.values(l.subProperties || {}), "index").filter(
|
|
356
356
|
(n) => n.data.visible !== !1 && n.data.key
|
|
@@ -548,7 +548,7 @@ function tt({
|
|
|
548
548
|
renderItem: i,
|
|
549
549
|
...l
|
|
550
550
|
}) {
|
|
551
|
-
const u =
|
|
551
|
+
const u = J(null), y = gt(), a = Wt(), x = A(Object.entries(r), (n) => n[1].index).map((n) => n[0]), g = J(x), b = D(
|
|
552
552
|
(n) => {
|
|
553
553
|
g.current = n, a();
|
|
554
554
|
},
|
|
@@ -610,7 +610,7 @@ function nr({
|
|
|
610
610
|
itemIndex: y,
|
|
611
611
|
move: a
|
|
612
612
|
}) {
|
|
613
|
-
const x =
|
|
613
|
+
const x = J(), [{ isDragging: g }, b, k] = Xt({
|
|
614
614
|
type: l,
|
|
615
615
|
item: () => ({ id: r }),
|
|
616
616
|
canDrag: () => !e,
|
|
@@ -824,7 +824,7 @@ function ar({ value: e }) {
|
|
|
824
824
|
}
|
|
825
825
|
}),
|
|
826
826
|
/* @__PURE__ */ O(R, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
827
|
-
/* @__PURE__ */ t(
|
|
827
|
+
/* @__PURE__ */ t(B, { variant: "subtitle1", children: r("renderer") }),
|
|
828
828
|
/* @__PURE__ */ O(V, {
|
|
829
829
|
hiddenLabel: !0,
|
|
830
830
|
size: "small",
|
|
@@ -869,7 +869,7 @@ function ar({ value: e }) {
|
|
|
869
869
|
function ur({ config: e }) {
|
|
870
870
|
const { t: r } = C();
|
|
871
871
|
return /* @__PURE__ */ t(we, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
872
|
-
/* @__PURE__ */ t(
|
|
872
|
+
/* @__PURE__ */ t(B, { variant: "subtitle1", children: r("basicInfo") }),
|
|
873
873
|
/* @__PURE__ */ t(V, {
|
|
874
874
|
label: r("name"),
|
|
875
875
|
size: "small",
|
|
@@ -904,7 +904,7 @@ function ur({ config: e }) {
|
|
|
904
904
|
}
|
|
905
905
|
function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defaultLocale: y, allComponents: a, onUpdateConfig: x }) {
|
|
906
906
|
var k, v, o, n, s, d;
|
|
907
|
-
const { t: g } = C(), b = ne(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? br :
|
|
907
|
+
const { t: g } = C(), b = ne(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? br : M, [e.type]);
|
|
908
908
|
return /* @__PURE__ */ t(sr, {
|
|
909
909
|
preview: r.preview,
|
|
910
910
|
drop: r.drop,
|
|
@@ -1049,7 +1049,7 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
|
|
|
1049
1049
|
const { t: a } = C(), x = ke({ variant: "dialog" }), g = e.properties && A(Object.values(e.properties), "index");
|
|
1050
1050
|
return /* @__PURE__ */ t(we, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
1051
1051
|
/* @__PURE__ */ O(R, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
1052
|
-
/* @__PURE__ */ t(
|
|
1052
|
+
/* @__PURE__ */ t(B, { variant: "subtitle1", children: a("properties") }),
|
|
1053
1053
|
/* @__PURE__ */ t(j, { flex: 1 }),
|
|
1054
1054
|
y && /* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(x), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
|
|
1055
1055
|
] }),
|
|
@@ -1154,10 +1154,10 @@ function it({ type: e = "properties", component: r, ...i }) {
|
|
|
1154
1154
|
return /* @__PURE__ */ O(Me, { ...i, fullWidth: !0, maxWidth: "lg", children: [
|
|
1155
1155
|
/* @__PURE__ */ t(ft, { children: l("i18nEditorTitle") }),
|
|
1156
1156
|
/* @__PURE__ */ t(ht, { children: b && /* @__PURE__ */ t(R, { children: /* @__PURE__ */ O(Be, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
|
|
1157
|
-
/* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(le, { children: y.map(({ locale: s, name: d }) => /* @__PURE__ */
|
|
1157
|
+
/* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(le, { children: y.map(({ locale: s, name: d }) => /* @__PURE__ */ t(oe, { children: /* @__PURE__ */ O(B, { color: "text.primary", children: [
|
|
1158
1158
|
d,
|
|
1159
|
-
a === s && /* @__PURE__ */ t(Ut, { sx: { fontSize: 12
|
|
1160
|
-
] }, s)) }) }),
|
|
1159
|
+
a === s && /* @__PURE__ */ t(Ut, { sx: { fontSize: 12 } })
|
|
1160
|
+
] }) }, s)) }) }),
|
|
1161
1161
|
/* @__PURE__ */ t(Je, { children: A(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ t(le, { children: y.map(({ locale: d }) => {
|
|
1162
1162
|
var m, w, c, h, f, P, S, p, I, z, N, T, U, W, te, _, H, Y, q, L, Oe, je, Re, ze, Ne, Ve;
|
|
1163
1163
|
return /* @__PURE__ */ t(oe, { children: /* @__PURE__ */ t(R, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(X, { children: [
|
|
@@ -1165,9 +1165,9 @@ function it({ type: e = "properties", component: r, ...i }) {
|
|
|
1165
1165
|
size: "small",
|
|
1166
1166
|
label: "Key",
|
|
1167
1167
|
value: s.key || "",
|
|
1168
|
-
onChange: (
|
|
1168
|
+
onChange: (F) => {
|
|
1169
1169
|
g.transact(() => {
|
|
1170
|
-
s.key =
|
|
1170
|
+
s.key = F.target.value.trim();
|
|
1171
1171
|
});
|
|
1172
1172
|
}
|
|
1173
1173
|
}),
|
|
@@ -1175,14 +1175,14 @@ function it({ type: e = "properties", component: r, ...i }) {
|
|
|
1175
1175
|
size: "small",
|
|
1176
1176
|
label: l("label"),
|
|
1177
1177
|
value: (((w = (m = s.locales) == null ? void 0 : m[d]) == null ? void 0 : w.name) ?? ((h = (c = s.locales) == null ? void 0 : c[a]) == null ? void 0 : h.name)) || "",
|
|
1178
|
-
onChange: (
|
|
1178
|
+
onChange: (F) => {
|
|
1179
1179
|
g.transact(() => {
|
|
1180
1180
|
var K;
|
|
1181
|
-
s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].name =
|
|
1181
|
+
s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].name = F.target.value;
|
|
1182
1182
|
});
|
|
1183
1183
|
}
|
|
1184
1184
|
}),
|
|
1185
|
-
/* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(
|
|
1185
|
+
/* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
|
|
1186
1186
|
allComponents: x,
|
|
1187
1187
|
defaultLocale: a,
|
|
1188
1188
|
component: r,
|
|
@@ -1192,14 +1192,14 @@ function it({ type: e = "properties", component: r, ...i }) {
|
|
|
1192
1192
|
label: "Default Value",
|
|
1193
1193
|
valueImmutable: se((P = (f = s.locales) == null ? void 0 : f[d]) == null ? void 0 : P.defaultValue),
|
|
1194
1194
|
value: ((p = (S = s.locales) == null ? void 0 : S[d]) == null ? void 0 : p.defaultValue) ?? ((z = (I = s.locales) == null ? void 0 : I[a]) == null ? void 0 : z.defaultValue),
|
|
1195
|
-
onChange: (
|
|
1195
|
+
onChange: (F) => {
|
|
1196
1196
|
g.transact(() => {
|
|
1197
1197
|
var K;
|
|
1198
|
-
s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].defaultValue =
|
|
1198
|
+
s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].defaultValue = F;
|
|
1199
1199
|
});
|
|
1200
1200
|
}
|
|
1201
1201
|
}) })
|
|
1202
|
-
] }) : e === "parameters" && k ? /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(
|
|
1202
|
+
] }) : e === "parameters" && k ? /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
|
|
1203
1203
|
allComponents: x,
|
|
1204
1204
|
defaultLocale: a,
|
|
1205
1205
|
component: r,
|
|
@@ -1208,10 +1208,10 @@ function it({ type: e = "properties", component: r, ...i }) {
|
|
|
1208
1208
|
fullWidth: !0,
|
|
1209
1209
|
valueImmutable: se((W = (U = (T = (N = k.renderer.properties) == null ? void 0 : N[s.id]) == null ? void 0 : T.locales) == null ? void 0 : U[d]) == null ? void 0 : W.value),
|
|
1210
1210
|
value: ((Y = (H = (_ = (te = k.renderer.properties) == null ? void 0 : te[s.id]) == null ? void 0 : _.locales) == null ? void 0 : H[d]) == null ? void 0 : Y.value) ?? ((je = (Oe = (L = (q = k.renderer.properties) == null ? void 0 : q[s.id]) == null ? void 0 : L.locales) == null ? void 0 : Oe[a]) == null ? void 0 : je.value) ?? ((ze = (Re = s.locales) == null ? void 0 : Re[d]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Ne = s.locales) == null ? void 0 : Ne[a]) == null ? void 0 : Ve.defaultValue),
|
|
1211
|
-
onChange: (
|
|
1211
|
+
onChange: (F) => {
|
|
1212
1212
|
g.transact(() => {
|
|
1213
1213
|
var K, Ce, De, Ee, Ae;
|
|
1214
|
-
(K = k.renderer).properties ?? (K.properties = {}), (Ce = k.renderer.properties)[De = s.id] ?? (Ce[De] = {}), (Ee = k.renderer.properties[s.id]).locales ?? (Ee.locales = {}), (Ae = k.renderer.properties[s.id].locales)[d] ?? (Ae[d] = {}), k.renderer.properties[s.id].locales[d].value =
|
|
1214
|
+
(K = k.renderer).properties ?? (K.properties = {}), (Ce = k.renderer.properties)[De = s.id] ?? (Ce[De] = {}), (Ee = k.renderer.properties[s.id]).locales ?? (Ee.locales = {}), (Ae = k.renderer.properties[s.id].locales)[d] ?? (Ae[d] = {}), k.renderer.properties[s.id].locales[d].value = F;
|
|
1215
1215
|
});
|
|
1216
1216
|
}
|
|
1217
1217
|
}) }) : null }, s.id) }, d);
|
|
@@ -1243,7 +1243,7 @@ const We = (e, r) => (i) => {
|
|
|
1243
1243
|
};
|
|
1244
1244
|
};
|
|
1245
1245
|
function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
1246
|
-
const { t: u, locale: y } = C(), a =
|
|
1246
|
+
const { t: u, locale: y } = C(), a = J(null), x = pr(a, e), g = D(() => {
|
|
1247
1247
|
if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
|
|
1248
1248
|
try {
|
|
1249
1249
|
let b = {};
|
|
@@ -1271,7 +1271,7 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
}, [e, y, i, r]);
|
|
1273
1273
|
return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(R, { direction: "column", gap: 1.5, sx: { width: "100%" }, ref: a, children: [
|
|
1274
|
-
/* @__PURE__ */ t(vt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(
|
|
1274
|
+
/* @__PURE__ */ t(vt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(B, { variant: "caption", color: "text.secondary", children: u("maker.properties.subProperties") }) }),
|
|
1275
1275
|
e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ t(tt, {
|
|
1276
1276
|
component: R,
|
|
1277
1277
|
gap: 2,
|
|
@@ -1359,9 +1359,9 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
|
|
|
1359
1359
|
})
|
|
1360
1360
|
] });
|
|
1361
1361
|
}
|
|
1362
|
-
function
|
|
1362
|
+
function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u, defaultLocale: y, allComponents: a, ...x }) {
|
|
1363
1363
|
var n, s, d, m, w;
|
|
1364
|
-
const { locale: g } = C(), b = It(), k =
|
|
1364
|
+
const { locale: g } = C(), b = It(), k = J(null), v = () => {
|
|
1365
1365
|
var h;
|
|
1366
1366
|
const c = (h = b == null ? void 0 : b.current) == null ? void 0 : h.getUploader();
|
|
1367
1367
|
c == null || c.open(), k.current && c.onceUploadSuccess(({ response: f }) => {
|
|
@@ -1422,7 +1422,7 @@ function J({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1422
1422
|
component: e,
|
|
1423
1423
|
defaultLocale: y,
|
|
1424
1424
|
allComponents: a,
|
|
1425
|
-
PropertyValueField:
|
|
1425
|
+
PropertyValueField: M,
|
|
1426
1426
|
onUpload: (c) => {
|
|
1427
1427
|
k.current = c, v();
|
|
1428
1428
|
}
|
|
@@ -1501,7 +1501,7 @@ function J({ component: e, property: r, value: i, onChange: l, valueImmutable: u
|
|
|
1501
1501
|
value: Array.isArray(i) ? i : [],
|
|
1502
1502
|
onChange: (c) => l == null ? void 0 : l(c),
|
|
1503
1503
|
property: r,
|
|
1504
|
-
renderItem: ({ item: c, index: h, onChange: f }) => r.subProperties && Object.keys(r.subProperties).length > 0 ? /* @__PURE__ */ t(R, { gap: 1, width: "100%", children: A(Object.values(r.subProperties), "index").filter((P) => P.data.visible !== !1).map(({ data: P }) => P.key ? /* @__PURE__ */ t(
|
|
1504
|
+
renderItem: ({ item: c, index: h, onChange: f }) => r.subProperties && Object.keys(r.subProperties).length > 0 ? /* @__PURE__ */ t(R, { gap: 1, width: "100%", children: A(Object.values(r.subProperties), "index").filter((P) => P.data.visible !== !1).map(({ data: P }) => P.key ? /* @__PURE__ */ t(M, {
|
|
1505
1505
|
component: e,
|
|
1506
1506
|
property: P,
|
|
1507
1507
|
value: c[P.key],
|
|
@@ -1562,12 +1562,12 @@ function Pr({ value: e }) {
|
|
|
1562
1562
|
}),
|
|
1563
1563
|
g && /* @__PURE__ */ O(X, { children: [
|
|
1564
1564
|
/* @__PURE__ */ O(R, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
1565
|
-
/* @__PURE__ */ t(
|
|
1565
|
+
/* @__PURE__ */ t(B, { variant: "subtitle2", children: r("parameters") }),
|
|
1566
1566
|
/* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(b), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
|
|
1567
1567
|
] }),
|
|
1568
1568
|
g.properties && A(Object.values(g.properties), "index").map(({ data: n }) => {
|
|
1569
1569
|
var s, d, m, w, c, h, f, P, S, p, I, z, N, T, U, W;
|
|
1570
|
-
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(
|
|
1570
|
+
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
|
|
1571
1571
|
allComponents: x,
|
|
1572
1572
|
defaultLocale: u,
|
|
1573
1573
|
component: g,
|
|
@@ -1647,11 +1647,11 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
|
|
|
1647
1647
|
};
|
|
1648
1648
|
}, [JSON.stringify(g)]), s = o(), d = _t(s, "key");
|
|
1649
1649
|
return /* @__PURE__ */ t(we, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
|
|
1650
|
-
/* @__PURE__ */ t(
|
|
1650
|
+
/* @__PURE__ */ t(B, { variant: "subtitle1", children: x("maker.properties.parameters") }),
|
|
1651
1651
|
!e || n.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ t(de, { style: { fontSize: 12 }, children: x("maker.properties.noParameters") }) : /* @__PURE__ */ O(X, { children: [
|
|
1652
1652
|
/* @__PURE__ */ t(R, { gap: 2, children: n.visibleProperties.map(({ data: m }) => {
|
|
1653
1653
|
var w, c;
|
|
1654
|
-
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(
|
|
1654
|
+
return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
|
|
1655
1655
|
allComponents: r,
|
|
1656
1656
|
defaultLocale: i,
|
|
1657
1657
|
size: "small",
|
|
@@ -1724,5 +1724,5 @@ export {
|
|
|
1724
1724
|
xr as DefaultWebComponentScriptTemplate,
|
|
1725
1725
|
lt as ParametersConfig,
|
|
1726
1726
|
mr as PropertiesConfig,
|
|
1727
|
-
|
|
1727
|
+
M as PropertyValueField
|
|
1728
1728
|
};
|