@blocklet/pages-kit-inner-components 0.5.56 → 0.6.1
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 +21 -23
- package/lib/cjs/chunks/{draft-data-CuZfaQ4s.js → draft-data-D44_IEV2.js} +1 -1
- package/lib/cjs/chunks/home-BYk01EUy.js +39 -0
- package/lib/cjs/chunks/index-BRgYwvuv.js +475 -0
- package/lib/cjs/chunks/publish-button-C8XPA4g_.js +1 -0
- package/lib/cjs/chunks/session-BRtsDvA-.js +1 -0
- package/lib/cjs/chunks/site-state-gSkcvhcV.js +57 -0
- package/lib/cjs/chunks/state-B6BF5wJ-.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/project-html.js +7 -7
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +3 -3
- package/lib/cjs/site-state.js +1 -1
- package/lib/cjs/theme.js +1 -1
- package/lib/es/add-component.js +385 -2356
- package/lib/es/chunks/{draft-data-CWM--ooz.js → draft-data-CafrGKeh.js} +1 -1
- package/lib/es/chunks/home-DW8SdyfO.js +594 -0
- package/lib/es/chunks/index-D5gXPe_7.js +2326 -0
- package/lib/es/chunks/publish-button-XSZrDaTQ.js +498 -0
- package/lib/es/chunks/session-C72Dq8zg.js +19 -0
- package/lib/es/chunks/site-state-W2H7XCSQ.js +2077 -0
- package/lib/es/chunks/state-0gvZF3k2.js +573 -0
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +5 -5
- package/lib/es/project-html.js +131 -141
- package/lib/es/resources.js +106 -107
- package/lib/es/setting.js +1772 -1489
- package/lib/es/site-state.js +1 -1
- package/lib/es/theme.js +50 -51
- package/package.json +46 -47
- package/lib/cjs/chunks/array-BqHuYyfx.js +0 -475
- package/lib/cjs/chunks/config-string-4bVR9Vc8.js +0 -1
- package/lib/cjs/chunks/home-BMjMYgq3.js +0 -38
- package/lib/cjs/chunks/publish-button-CGfGqrov.js +0 -1
- package/lib/cjs/chunks/session-BA7Qrcia.js +0 -1
- package/lib/cjs/chunks/site-state-BtZ8o3J2.js +0 -57
- package/lib/cjs/chunks/state-BVdbNJCA.js +0 -1
- package/lib/es/chunks/array-c6HYTLze.js +0 -2224
- package/lib/es/chunks/config-string-WMpFf-7V.js +0 -88
- package/lib/es/chunks/home-PDsc59QG.js +0 -566
- package/lib/es/chunks/publish-button-Ds7OBvxV.js +0 -462
- package/lib/es/chunks/session-CVblGhSp.js +0 -21
- package/lib/es/chunks/site-state-D-moj9fA.js +0 -2125
- package/lib/es/chunks/state-l--dTdHq.js +0 -603
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as oe } from "react/jsx-runtime";
|
|
2
|
+
import { u as ae, b as le } from "./state-0gvZF3k2.js";
|
|
3
|
+
import { useLocaleContext as G } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
+
import q from "@arcblock/ux/lib/Toast";
|
|
5
|
+
import { generateParamCombinations as ce } from "@blocklet/pages-kit/utils/route";
|
|
6
|
+
import { Warning as de, Sync as _, VisibilityOff as ee, KeyboardArrowDown as me, KeyboardArrowRight as ue } from "@mui/icons-material";
|
|
7
|
+
import { LoadingButton as te } from "@mui/lab";
|
|
8
|
+
import { createSvgIcon as pe, Dialog as ge, DialogTitle as he, Box as b, IconButton as fe, DialogContent as be, DialogActions as xe, Button as ye, Alert as we, List as ke, ListItem as M, ListItemButton as $, ListItemIcon as W, Checkbox as K, ListItemText as N, Tooltip as I, Collapse as Se, Chip as Pe } from "@mui/material";
|
|
9
|
+
import { produce as De } from "immer";
|
|
10
|
+
import Z from "lodash/difference";
|
|
11
|
+
import { useState as D, useMemo as C, useCallback as O, useImperativeHandle as Oe, useEffect as E, useRef as Ae } from "react";
|
|
12
|
+
import { useAsync as je } from "react-use";
|
|
13
|
+
import { L as ve } from "./home-DW8SdyfO.js";
|
|
14
|
+
import { p as Ce, g as Re } from "./index-D5gXPe_7.js";
|
|
15
|
+
function ze(s) {
|
|
16
|
+
const [u, g] = D(!1);
|
|
17
|
+
return /* @__PURE__ */ t(
|
|
18
|
+
te,
|
|
19
|
+
{
|
|
20
|
+
...s,
|
|
21
|
+
loading: s.loading || u,
|
|
22
|
+
onClick: (a) => {
|
|
23
|
+
const d = s.onClick?.(a);
|
|
24
|
+
d instanceof Promise && (g(!0), d.finally(() => {
|
|
25
|
+
g(!1);
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
const Te = pe(
|
|
32
|
+
/* @__PURE__ */ m("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
33
|
+
/* @__PURE__ */ t(
|
|
34
|
+
"path",
|
|
35
|
+
{
|
|
36
|
+
d: "M7.75732 16.2426L16.2426 7.75736",
|
|
37
|
+
stroke: "#4B5563",
|
|
38
|
+
strokeWidth: "1.5",
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
strokeLinejoin: "round"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ t(
|
|
44
|
+
"path",
|
|
45
|
+
{
|
|
46
|
+
d: "M16.2426 16.2426L7.75732 7.75735",
|
|
47
|
+
stroke: "#4B5563",
|
|
48
|
+
strokeWidth: "1.5",
|
|
49
|
+
strokeLinecap: "round",
|
|
50
|
+
strokeLinejoin: "round"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] }),
|
|
54
|
+
"Close"
|
|
55
|
+
);
|
|
56
|
+
function Le() {
|
|
57
|
+
const [s, u] = D(), g = C(() => s ? /* @__PURE__ */ t(ge, { ...s }) : null, [s]), a = O(() => {
|
|
58
|
+
u(void 0);
|
|
59
|
+
}, []), d = O(
|
|
60
|
+
({
|
|
61
|
+
title: y,
|
|
62
|
+
content: c,
|
|
63
|
+
cancelText: A = "Cancel",
|
|
64
|
+
okText: f = "Ok",
|
|
65
|
+
onOk: w,
|
|
66
|
+
onClose: l,
|
|
67
|
+
okIcon: R,
|
|
68
|
+
okColor: k = "primary",
|
|
69
|
+
cancelColor: h = "primary",
|
|
70
|
+
DialogContentProps: B,
|
|
71
|
+
form: F,
|
|
72
|
+
...H
|
|
73
|
+
}) => {
|
|
74
|
+
u({
|
|
75
|
+
...H,
|
|
76
|
+
open: !0,
|
|
77
|
+
children: /* @__PURE__ */ m("form", { onSubmit: (z) => z.preventDefault(), children: [
|
|
78
|
+
y && /* @__PURE__ */ m(
|
|
79
|
+
he,
|
|
80
|
+
{
|
|
81
|
+
className: "between",
|
|
82
|
+
zIndex: "appBar",
|
|
83
|
+
bgcolor: "background.paper",
|
|
84
|
+
sx: { borderBottom: (z) => `1px solid ${z.palette.divider}` },
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ t(b, { children: y }),
|
|
87
|
+
/* @__PURE__ */ t(
|
|
88
|
+
fe,
|
|
89
|
+
{
|
|
90
|
+
size: "small",
|
|
91
|
+
onClick: async () => {
|
|
92
|
+
a(), l?.();
|
|
93
|
+
},
|
|
94
|
+
children: /* @__PURE__ */ t(Te, {})
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
c && /* @__PURE__ */ t(
|
|
101
|
+
be,
|
|
102
|
+
{
|
|
103
|
+
...B,
|
|
104
|
+
sx: { mt: -3, ...B?.sx, bgcolor: "background.paper" },
|
|
105
|
+
children: /* @__PURE__ */ t(
|
|
106
|
+
b,
|
|
107
|
+
{
|
|
108
|
+
sx: {
|
|
109
|
+
pt: 3
|
|
110
|
+
},
|
|
111
|
+
children: c
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ m(xe, { sx: { bgcolor: "background.paper" }, children: [
|
|
117
|
+
/* @__PURE__ */ t(ye, { variant: "outlined", color: h || "primary", onClick: l ?? a, children: A }),
|
|
118
|
+
/* @__PURE__ */ t(
|
|
119
|
+
ze,
|
|
120
|
+
{
|
|
121
|
+
variant: "contained",
|
|
122
|
+
color: k || "primary",
|
|
123
|
+
startIcon: R,
|
|
124
|
+
loadingPosition: R ? "start" : "center",
|
|
125
|
+
onClick: async () => {
|
|
126
|
+
await w?.(), a();
|
|
127
|
+
},
|
|
128
|
+
type: "submit",
|
|
129
|
+
children: f
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] })
|
|
133
|
+
] }),
|
|
134
|
+
onClose: l ?? a
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
[a]
|
|
138
|
+
);
|
|
139
|
+
return { dialog: g, showDialog: d, closeDialog: a };
|
|
140
|
+
}
|
|
141
|
+
const Xe = ({
|
|
142
|
+
ref: s,
|
|
143
|
+
mode: u,
|
|
144
|
+
state: g
|
|
145
|
+
}) => {
|
|
146
|
+
const { t: a } = G(), [d, y] = D(!1), { dialog: c, showDialog: A } = Le(), f = ae(), w = O(
|
|
147
|
+
(R) => {
|
|
148
|
+
let k = [];
|
|
149
|
+
A({
|
|
150
|
+
title: a("maker.publishToProduction"),
|
|
151
|
+
content: /* @__PURE__ */ m(b, { sx: { minWidth: 300 }, children: [
|
|
152
|
+
/* @__PURE__ */ t(we, { color: "warning", icon: /* @__PURE__ */ t(de, {}), children: a("maker.publishToProductionTip") }),
|
|
153
|
+
/* @__PURE__ */ t(
|
|
154
|
+
b,
|
|
155
|
+
{
|
|
156
|
+
sx: {
|
|
157
|
+
maxHeight: "50vh",
|
|
158
|
+
overflow: "auto",
|
|
159
|
+
mt: 2
|
|
160
|
+
},
|
|
161
|
+
children: /* @__PURE__ */ t(
|
|
162
|
+
Ee,
|
|
163
|
+
{
|
|
164
|
+
state: g,
|
|
165
|
+
toMode: u,
|
|
166
|
+
onChange: (h) => k = h,
|
|
167
|
+
defaultRouteIds: R
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
] }),
|
|
173
|
+
okText: a("maker.publish"),
|
|
174
|
+
cancelText: a("common.cancel"),
|
|
175
|
+
onOk: async () => {
|
|
176
|
+
if (k?.length === 0) {
|
|
177
|
+
const h = a("maker.publishSelectPagesMessage");
|
|
178
|
+
throw q.error(h), new Error(h);
|
|
179
|
+
}
|
|
180
|
+
localStorage.setItem(le(f ?? ""), String((/* @__PURE__ */ new Date()).getTime())), y(!0);
|
|
181
|
+
try {
|
|
182
|
+
await Ce({ mode: u, routes: k }), q.success(a("maker.publishSuccessMessage"));
|
|
183
|
+
} catch (h) {
|
|
184
|
+
throw q.error(h.message), h;
|
|
185
|
+
} finally {
|
|
186
|
+
y(!1);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
[u, g, a, f, A]
|
|
192
|
+
);
|
|
193
|
+
Oe(s, () => ({
|
|
194
|
+
openPublishDialog: w
|
|
195
|
+
}));
|
|
196
|
+
const l = O(() => {
|
|
197
|
+
w();
|
|
198
|
+
}, [w]);
|
|
199
|
+
return /* @__PURE__ */ m(oe, { children: [
|
|
200
|
+
/* @__PURE__ */ t(
|
|
201
|
+
te,
|
|
202
|
+
{
|
|
203
|
+
color: "primary",
|
|
204
|
+
variant: "contained",
|
|
205
|
+
size: "small",
|
|
206
|
+
sx: { mr: 1 },
|
|
207
|
+
onClick: l,
|
|
208
|
+
loading: d,
|
|
209
|
+
disabled: d,
|
|
210
|
+
children: a("maker.publish")
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
c
|
|
214
|
+
] });
|
|
215
|
+
};
|
|
216
|
+
function Be({
|
|
217
|
+
routePathInfo: s,
|
|
218
|
+
checked: u,
|
|
219
|
+
onClick: g,
|
|
220
|
+
route: a
|
|
221
|
+
}) {
|
|
222
|
+
const { t: d } = G(), y = !s.routeMetaData?.publishedAt || s.routeMetaData?.updatedAt && new Date(s.routeMetaData?.updatedAt) > new Date(s.routeMetaData?.publishedAt);
|
|
223
|
+
return /* @__PURE__ */ t(
|
|
224
|
+
M,
|
|
225
|
+
{
|
|
226
|
+
sx: { pl: 4, pr: 3 },
|
|
227
|
+
disablePadding: !0,
|
|
228
|
+
secondaryAction: /* @__PURE__ */ m(
|
|
229
|
+
b,
|
|
230
|
+
{
|
|
231
|
+
sx: {
|
|
232
|
+
display: "flex",
|
|
233
|
+
alignItems: "center",
|
|
234
|
+
minWidth: "auto"
|
|
235
|
+
},
|
|
236
|
+
children: [
|
|
237
|
+
y && /* @__PURE__ */ t(
|
|
238
|
+
b,
|
|
239
|
+
{
|
|
240
|
+
className: "visible",
|
|
241
|
+
title: d("maker.pages.needPublish"),
|
|
242
|
+
sx: {
|
|
243
|
+
mr: 0.35,
|
|
244
|
+
color: "warning.main",
|
|
245
|
+
display: "flex",
|
|
246
|
+
alignItems: "center"
|
|
247
|
+
},
|
|
248
|
+
children: /* @__PURE__ */ t(I, { title: d("maker.pages.needPublish"), children: /* @__PURE__ */ t(_, { fontSize: "small", sx: { fontSize: "16px" } }) })
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
(!s.routeMetaData?.isPublic || !a.isPublic) && /* @__PURE__ */ t(
|
|
252
|
+
b,
|
|
253
|
+
{
|
|
254
|
+
className: "visible",
|
|
255
|
+
sx: {
|
|
256
|
+
color: "warning.main"
|
|
257
|
+
},
|
|
258
|
+
children: /* @__PURE__ */ t(I, { title: d("maker.pages.notPublic"), children: /* @__PURE__ */ t(ee, { fontSize: "small", sx: { fontSize: "16px" } }) })
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
children: /* @__PURE__ */ m($, { onClick: g, dense: !0, children: [
|
|
265
|
+
/* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: u, tabIndex: -1 }) }),
|
|
266
|
+
/* @__PURE__ */ t(
|
|
267
|
+
N,
|
|
268
|
+
{
|
|
269
|
+
primary: s.path,
|
|
270
|
+
slotProps: {
|
|
271
|
+
primary: {
|
|
272
|
+
fontSize: "0.8rem",
|
|
273
|
+
fontStyle: "italic",
|
|
274
|
+
overflow: "hidden",
|
|
275
|
+
textOverflow: "ellipsis",
|
|
276
|
+
whiteSpace: "nowrap",
|
|
277
|
+
pr: 1
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
] })
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
function Ee({
|
|
287
|
+
state: s,
|
|
288
|
+
toMode: u,
|
|
289
|
+
onChange: g,
|
|
290
|
+
defaultRouteIds: a
|
|
291
|
+
}) {
|
|
292
|
+
const { t: d, locale: y } = G(), [c, A] = D(!1), [f, w] = D(
|
|
293
|
+
() => a ? Object.fromEntries(a.filter((e) => !e.includes("-")).map((e) => [e, !0])) : {}
|
|
294
|
+
), [l, R] = D({}), [k, h] = D(
|
|
295
|
+
() => a ? Object.fromEntries(a.filter((e) => e.includes("-")).map((e) => [e, !0])) : {}
|
|
296
|
+
), [B, F] = D({}), { loading: H, error: z, value: S } = je(() => Re({ mode: u }), [u]);
|
|
297
|
+
if (z)
|
|
298
|
+
throw z;
|
|
299
|
+
const x = C(() => s.routeIds || [], [s]), J = C(() => S?.pageIds || [], [S]), j = C(() => !x || !s.routes ? [] : JSON.parse(JSON.stringify(x)).sort((n, i) => {
|
|
300
|
+
const r = s.routes?.[n], o = s.routes?.[i];
|
|
301
|
+
return r?.publishedAt && new Date(r.publishedAt).getTime() < new Date(r.updatedAt).getTime() ? -1 : o?.publishedAt && new Date(o.publishedAt).getTime() < new Date(o.updatedAt).getTime() ? 1 : new Date(r?.updatedAt ?? "").getTime() - new Date(o?.updatedAt ?? "").getTime();
|
|
302
|
+
}), [s, x]), V = C(() => {
|
|
303
|
+
if (!j) return [];
|
|
304
|
+
if (!l) return j;
|
|
305
|
+
const e = [...j].filter((n) => !l[n]);
|
|
306
|
+
return Object.values(l).forEach((n) => {
|
|
307
|
+
n.forEach((i) => {
|
|
308
|
+
e.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`);
|
|
309
|
+
});
|
|
310
|
+
}), e;
|
|
311
|
+
}, [j, l]), v = C(
|
|
312
|
+
() => !S || !J || !V ? [] : Z(J, V),
|
|
313
|
+
[V, S, J]
|
|
314
|
+
), L = C(
|
|
315
|
+
() => x ? [...x].concat(v) : v,
|
|
316
|
+
[x, v]
|
|
317
|
+
), Q = O(() => {
|
|
318
|
+
const e = {};
|
|
319
|
+
j?.forEach((n) => {
|
|
320
|
+
const i = s.routes?.[n];
|
|
321
|
+
if (i && i.params && i.params.length > 0 && i.paramsOptions && i.paramsOptions.length > 0) {
|
|
322
|
+
const r = ce({
|
|
323
|
+
basePath: i.path,
|
|
324
|
+
params: i.params,
|
|
325
|
+
routeId: i.id,
|
|
326
|
+
paramsOptions: i.paramsOptions,
|
|
327
|
+
currentIndex: 0,
|
|
328
|
+
currentParams: [],
|
|
329
|
+
currentOptionIds: [],
|
|
330
|
+
result: []
|
|
331
|
+
});
|
|
332
|
+
r.length > 0 && (e[i.id] = r);
|
|
333
|
+
}
|
|
334
|
+
}), R(e);
|
|
335
|
+
}, [j, s.routes]);
|
|
336
|
+
E(() => {
|
|
337
|
+
Q();
|
|
338
|
+
}, [Q]), E(() => {
|
|
339
|
+
F((e) => {
|
|
340
|
+
const n = { ...e };
|
|
341
|
+
return Object.keys(l).forEach((i) => {
|
|
342
|
+
l[i] && l[i]?.length > 0 && n[i] === void 0 && (n[i] = !0);
|
|
343
|
+
}), n;
|
|
344
|
+
});
|
|
345
|
+
}, [l]);
|
|
346
|
+
const U = Ae(!0);
|
|
347
|
+
E(() => {
|
|
348
|
+
h((e) => {
|
|
349
|
+
const n = { ...e };
|
|
350
|
+
return Object.keys(l).length === 0 || (Object.keys(l).forEach((i) => {
|
|
351
|
+
const r = l[i] || [], o = c || !!f[i];
|
|
352
|
+
r.forEach((T) => {
|
|
353
|
+
const p = `${i}-${T.paramOptionIds.join("-")}`;
|
|
354
|
+
U.current ? n[p] = o || e[p] || !1 : n[p] = o;
|
|
355
|
+
});
|
|
356
|
+
}), U.current = !1), n;
|
|
357
|
+
});
|
|
358
|
+
}, [f, l, c]);
|
|
359
|
+
const ne = (e, n) => {
|
|
360
|
+
n.stopPropagation(), F((i) => {
|
|
361
|
+
const r = { ...i };
|
|
362
|
+
return r[e] = !r[e], r;
|
|
363
|
+
});
|
|
364
|
+
}, X = O(
|
|
365
|
+
(e) => {
|
|
366
|
+
w((n) => {
|
|
367
|
+
const i = De(n, (r) => {
|
|
368
|
+
c ? (Object.assign(r, Object.fromEntries(L.map((o) => [o, !0]))), delete r[e]) : r[e] ? (delete r[e], v.includes(e) && (x || []).filter((o) => s.pages[o]?.slug === S?.pages[e]?.slug).forEach((o) => {
|
|
369
|
+
delete r[o];
|
|
370
|
+
})) : (r[e] = !0, x && x.includes(e) && v.filter((o) => S?.pages[o]?.slug === s.pages[e]?.slug).forEach((o) => {
|
|
371
|
+
r[o] = !0;
|
|
372
|
+
}));
|
|
373
|
+
});
|
|
374
|
+
return A(Z(L, Object.keys(i)).length === 0), i;
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
[c, L, v, s, S, x]
|
|
378
|
+
), ie = O(
|
|
379
|
+
(e, n) => {
|
|
380
|
+
const i = `${e}-${n.paramOptionIds.join("-")}`;
|
|
381
|
+
h((r) => {
|
|
382
|
+
const o = { ...r };
|
|
383
|
+
o[i] = !o[i];
|
|
384
|
+
const T = l[e]?.every((p) => o[`${e}-${p.paramOptionIds.join("-")}`]) ?? !1;
|
|
385
|
+
return w((p) => {
|
|
386
|
+
if (T && !p[e])
|
|
387
|
+
return { ...p, [e]: !0 };
|
|
388
|
+
if (!T && p[e]) {
|
|
389
|
+
const P = { ...p };
|
|
390
|
+
return delete P[e], P;
|
|
391
|
+
}
|
|
392
|
+
return p;
|
|
393
|
+
}), o;
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
[l]
|
|
397
|
+
), re = O(() => {
|
|
398
|
+
A((e) => (e && w({}), !e));
|
|
399
|
+
}, []);
|
|
400
|
+
return E(() => {
|
|
401
|
+
const e = c ? L : Object.keys(f), n = Object.entries(k).filter(([, r]) => r).map(([r]) => r).filter((r) => r !== void 0), i = Array.from(/* @__PURE__ */ new Set([...e, ...n]));
|
|
402
|
+
g(c ? null : i);
|
|
403
|
+
}, [c, f, k, L, g]), H ? /* @__PURE__ */ t(ve, { sx: { my: 4 } }) : /* @__PURE__ */ m(ke, { disablePadding: !0, sx: { maxWidth: 700 }, children: [
|
|
404
|
+
/* @__PURE__ */ t(M, { sx: { position: "sticky", top: 0, zIndex: 1 }, disablePadding: !0, children: /* @__PURE__ */ m($, { onClick: re, dense: !0, children: [
|
|
405
|
+
/* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: c, tabIndex: -1 }) }),
|
|
406
|
+
/* @__PURE__ */ t(N, { primary: d("common.all") })
|
|
407
|
+
] }) }),
|
|
408
|
+
j.map((e) => {
|
|
409
|
+
const n = s.routes?.[e];
|
|
410
|
+
if (!n) return null;
|
|
411
|
+
const i = !1, r = l && l[e] && l[e]?.length > 0, o = B[e] !== !1, T = l[e] || [], p = !n.publishedAt || n.updatedAt && new Date(n.updatedAt).getTime() > new Date(n.publishedAt).getTime();
|
|
412
|
+
return /* @__PURE__ */ m(b, { children: [
|
|
413
|
+
/* @__PURE__ */ t(
|
|
414
|
+
M,
|
|
415
|
+
{
|
|
416
|
+
sx: {
|
|
417
|
+
pr: 4
|
|
418
|
+
},
|
|
419
|
+
disablePadding: !0,
|
|
420
|
+
secondaryAction: /* @__PURE__ */ m(b, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
421
|
+
p && /* @__PURE__ */ t(I, { title: d("maker.pages.needPublish"), children: /* @__PURE__ */ t(_, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
|
|
422
|
+
!n.isPublic && /* @__PURE__ */ t(I, { title: d("maker.pages.notPublic"), children: /* @__PURE__ */ t(ee, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
|
|
423
|
+
i,
|
|
424
|
+
r && /* @__PURE__ */ t(
|
|
425
|
+
b,
|
|
426
|
+
{
|
|
427
|
+
onClick: (P) => ne(e, P),
|
|
428
|
+
sx: {
|
|
429
|
+
display: "inline-flex",
|
|
430
|
+
alignItems: "center",
|
|
431
|
+
mr: 0.35,
|
|
432
|
+
cursor: "pointer",
|
|
433
|
+
color: "info.main"
|
|
434
|
+
},
|
|
435
|
+
children: o ? /* @__PURE__ */ t(me, { fontSize: "small", sx: { fontSize: "18px" } }) : /* @__PURE__ */ t(ue, { fontSize: "small", sx: { fontSize: "18px" } })
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
] }),
|
|
439
|
+
children: /* @__PURE__ */ m($, { onClick: () => X(e), dense: !0, children: [
|
|
440
|
+
/* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: c || !!f[e], tabIndex: -1 }) }),
|
|
441
|
+
/* @__PURE__ */ t(
|
|
442
|
+
N,
|
|
443
|
+
{
|
|
444
|
+
primary: n.path,
|
|
445
|
+
slotProps: {
|
|
446
|
+
primary: { noWrap: !0, textOverflow: "ellipsis" },
|
|
447
|
+
secondary: { noWrap: !0, textOverflow: "ellipsis" }
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
] })
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
r && /* @__PURE__ */ t(Se, { in: o, children: /* @__PURE__ */ t(b, { children: T.map((P) => {
|
|
455
|
+
const Y = `${e}-${P.paramOptionIds.join("-")}`, se = k[Y] || !1;
|
|
456
|
+
return /* @__PURE__ */ t(
|
|
457
|
+
Be,
|
|
458
|
+
{
|
|
459
|
+
routePathInfo: P,
|
|
460
|
+
checked: c || se,
|
|
461
|
+
onClick: () => ie(e, P),
|
|
462
|
+
route: n
|
|
463
|
+
},
|
|
464
|
+
Y
|
|
465
|
+
);
|
|
466
|
+
}) }) })
|
|
467
|
+
] }, e);
|
|
468
|
+
}),
|
|
469
|
+
v.map((e) => {
|
|
470
|
+
const n = S?.pages[e];
|
|
471
|
+
return n ? /* @__PURE__ */ t(
|
|
472
|
+
M,
|
|
473
|
+
{
|
|
474
|
+
disablePadding: !0,
|
|
475
|
+
secondaryAction: /* @__PURE__ */ t(Pe, { color: "warning", label: "deleted", size: "small" }),
|
|
476
|
+
children: /* @__PURE__ */ m($, { onClick: () => X(e), dense: !0, children: [
|
|
477
|
+
/* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: c || !!f[e], tabIndex: -1 }) }),
|
|
478
|
+
/* @__PURE__ */ t(
|
|
479
|
+
N,
|
|
480
|
+
{
|
|
481
|
+
primary: n.slug,
|
|
482
|
+
secondary: n.locales?.[y]?.title,
|
|
483
|
+
slotProps: {
|
|
484
|
+
primary: { noWrap: !0, textOverflow: "ellipsis" },
|
|
485
|
+
secondary: { noWrap: !0, textOverflow: "ellipsis" }
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
)
|
|
489
|
+
] })
|
|
490
|
+
},
|
|
491
|
+
e
|
|
492
|
+
) : null;
|
|
493
|
+
})
|
|
494
|
+
] });
|
|
495
|
+
}
|
|
496
|
+
export {
|
|
497
|
+
Xe as default
|
|
498
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createAuthServiceSessionContext as t } from "@arcblock/did-connect/lib/Session";
|
|
2
|
+
import { useContext as i } from "react";
|
|
3
|
+
const { SessionProvider: l, SessionContext: r, SessionConsumer: S, withSession: f } = t();
|
|
4
|
+
function n() {
|
|
5
|
+
return i(r);
|
|
6
|
+
}
|
|
7
|
+
function u(...e) {
|
|
8
|
+
const { session: s } = n();
|
|
9
|
+
return e.includes(s.user?.role);
|
|
10
|
+
}
|
|
11
|
+
function m(...e) {
|
|
12
|
+
const { session: s } = n(), o = u(...e);
|
|
13
|
+
return window.blocklet?.tenantMode === "multiple" ? !!s.user : o;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
l as S,
|
|
17
|
+
m as a,
|
|
18
|
+
n as u
|
|
19
|
+
};
|