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