@blocklet/pages-kit-inner-components 0.4.130 → 0.4.132
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 +1 -1
- package/lib/cjs/chunks/{array-3OBY1z8c.js → array-D-LDfLBW.js} +1 -1
- package/lib/cjs/chunks/{config-string-BOqUdy2S.js → config-string-BMi-8GXv.js} +1 -1
- package/lib/cjs/chunks/{draft-data-C4FzOyR5.js → draft-data-C-aBMmuZ.js} +1 -1
- package/lib/cjs/chunks/home-BWklFLCu.js +38 -0
- package/lib/cjs/chunks/publish-button-kozBI0aZ.js +1 -0
- package/lib/cjs/chunks/site-state-C8qhC6pw.js +57 -0
- package/lib/cjs/chunks/state-DPSTH2vo.js +1 -0
- package/lib/cjs/components.js +1 -1
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/project-html.js +1 -1
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/setting.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/add-component.js +3 -3
- package/lib/es/chunks/{array-CWudJ_mc.js → array-BfSgATE1.js} +1 -1
- package/lib/es/chunks/{config-string-CcDa1MHl.js → config-string-BObBTkZS.js} +1 -1
- package/lib/es/chunks/{draft-data-DoNjnkxB.js → draft-data-PScFOAJJ.js} +1 -1
- package/lib/es/chunks/home-qQe9H8C9.js +527 -0
- package/lib/es/chunks/publish-button-DMQRXAVS.js +455 -0
- package/lib/es/chunks/site-state-qF6lXjrQ.js +1833 -0
- package/lib/es/chunks/{state-DNndJ33Y.js → state-DGyH1TW3.js} +97 -97
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +11 -10
- package/lib/es/locales.js +39 -9
- package/lib/es/project-html.js +1 -1
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +2 -2
- package/lib/es/site-state.js +13 -12
- package/package.json +3 -3
- package/lib/cjs/chunks/home-B6yRf7rx.js +0 -38
- package/lib/cjs/chunks/publish-button-BcyFHcAL.js +0 -1
- package/lib/cjs/chunks/site-state-C5t-5c6U.js +0 -57
- package/lib/cjs/chunks/state-5jwYHuoB.js +0 -1
- package/lib/es/chunks/home-Crb2pbrM.js +0 -489
- package/lib/es/chunks/publish-button-CAJErJjj.js +0 -295
- package/lib/es/chunks/site-state-BLNi12iP.js +0 -1717
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as u, Fragment as H } from "react/jsx-runtime";
|
|
2
|
-
import { u as K, c as q } from "./state-DNndJ33Y.js";
|
|
3
|
-
import { useLocaleContext as J } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
-
import I from "@arcblock/ux/lib/Toast";
|
|
5
|
-
import { Warning as G, Sync as Q, VisibilityOff as U } from "@mui/icons-material";
|
|
6
|
-
import { LoadingButton as V } from "@mui/lab";
|
|
7
|
-
import { createSvgIcon as X, Dialog as Y, DialogTitle as Z, Box as j, IconButton as _, DialogContent as $, DialogActions as ee, Button as re, Alert as te, List as ie, ListItem as O, ListItemButton as S, ListItemIcon as z, Checkbox as E, ListItemText as W, Tooltip as R, Chip as ne } from "@mui/material";
|
|
8
|
-
import { produce as oe } from "immer";
|
|
9
|
-
import N from "lodash/difference";
|
|
10
|
-
import { useState as D, useMemo as L, useCallback as P, forwardRef as se, useImperativeHandle as le, useEffect as ae } from "react";
|
|
11
|
-
import { useAsync as ce } from "react-use";
|
|
12
|
-
import { L as de } from "./home-Crb2pbrM.js";
|
|
13
|
-
import { p as ue, g as me } from "./array-CWudJ_mc.js";
|
|
14
|
-
function pe(r) {
|
|
15
|
-
const [m, h] = D(!1);
|
|
16
|
-
return /* @__PURE__ */ e(
|
|
17
|
-
V,
|
|
18
|
-
{
|
|
19
|
-
...r,
|
|
20
|
-
loading: r.loading || m,
|
|
21
|
-
onClick: (l) => {
|
|
22
|
-
var p;
|
|
23
|
-
const d = (p = r.onClick) == null ? void 0 : p.call(r, l);
|
|
24
|
-
d instanceof Promise && (h(!0), d.finally(() => {
|
|
25
|
-
h(!1);
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
const ge = X(
|
|
32
|
-
/* @__PURE__ */ u("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
33
|
-
/* @__PURE__ */ e(
|
|
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__ */ e(
|
|
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 he() {
|
|
57
|
-
const [r, m] = D(), h = L(() => r ? /* @__PURE__ */ e(Y, { ...r }) : null, [r]), l = P(() => {
|
|
58
|
-
m(void 0);
|
|
59
|
-
}, []), d = P(
|
|
60
|
-
({
|
|
61
|
-
title: p,
|
|
62
|
-
content: c,
|
|
63
|
-
cancelText: v = "Cancel",
|
|
64
|
-
okText: f = "Ok",
|
|
65
|
-
onOk: g,
|
|
66
|
-
onClose: b,
|
|
67
|
-
okIcon: A,
|
|
68
|
-
okColor: t = "primary",
|
|
69
|
-
cancelColor: n = "primary",
|
|
70
|
-
DialogContentProps: k,
|
|
71
|
-
form: C,
|
|
72
|
-
...y
|
|
73
|
-
}) => {
|
|
74
|
-
m({
|
|
75
|
-
...y,
|
|
76
|
-
open: !0,
|
|
77
|
-
children: /* @__PURE__ */ u("form", { onSubmit: (B) => B.preventDefault(), children: [
|
|
78
|
-
p && /* @__PURE__ */ u(
|
|
79
|
-
Z,
|
|
80
|
-
{
|
|
81
|
-
className: "between",
|
|
82
|
-
zIndex: "appBar",
|
|
83
|
-
bgcolor: "background.paper",
|
|
84
|
-
sx: { borderBottom: "1px solid #E5E7EB" },
|
|
85
|
-
children: [
|
|
86
|
-
/* @__PURE__ */ e(j, { children: p }),
|
|
87
|
-
/* @__PURE__ */ e(
|
|
88
|
-
_,
|
|
89
|
-
{
|
|
90
|
-
size: "small",
|
|
91
|
-
onClick: async () => {
|
|
92
|
-
l(), b == null || b();
|
|
93
|
-
},
|
|
94
|
-
children: /* @__PURE__ */ e(ge, {})
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
c && /* @__PURE__ */ e($, { ...k, sx: { mt: -3, ...k == null ? void 0 : k.sx }, children: /* @__PURE__ */ e(j, { pt: 3, children: c }) }),
|
|
101
|
-
/* @__PURE__ */ u(ee, { children: [
|
|
102
|
-
/* @__PURE__ */ e(re, { variant: "outlined", color: n || "primary", onClick: b ?? l, children: v }),
|
|
103
|
-
/* @__PURE__ */ e(
|
|
104
|
-
pe,
|
|
105
|
-
{
|
|
106
|
-
variant: "contained",
|
|
107
|
-
color: t || "primary",
|
|
108
|
-
startIcon: A,
|
|
109
|
-
loadingPosition: A ? "start" : "center",
|
|
110
|
-
onClick: async () => {
|
|
111
|
-
await (g == null ? void 0 : g()), l();
|
|
112
|
-
},
|
|
113
|
-
type: "submit",
|
|
114
|
-
children: f
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
] })
|
|
118
|
-
] }),
|
|
119
|
-
onClose: b ?? l
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
[l]
|
|
123
|
-
);
|
|
124
|
-
return { dialog: h, showDialog: d, closeDialog: l };
|
|
125
|
-
}
|
|
126
|
-
const Ie = se(({ mode: r, state: m }, h) => {
|
|
127
|
-
const { t: l } = J(), [d, p] = D(!1), { dialog: c, showDialog: v } = he(), f = K(), g = P(
|
|
128
|
-
(A) => {
|
|
129
|
-
let t = [];
|
|
130
|
-
v({
|
|
131
|
-
title: l("maker.publishToProduction"),
|
|
132
|
-
content: /* @__PURE__ */ u(j, { sx: { minWidth: 300 }, children: [
|
|
133
|
-
/* @__PURE__ */ e(te, { color: "warning", icon: /* @__PURE__ */ e(G, {}), children: l("maker.publishToProductionTip") }),
|
|
134
|
-
/* @__PURE__ */ e(j, { maxHeight: "50vh", overflow: "auto", mt: 2, children: /* @__PURE__ */ e(
|
|
135
|
-
fe,
|
|
136
|
-
{
|
|
137
|
-
state: m,
|
|
138
|
-
toMode: r,
|
|
139
|
-
onChange: (n) => t = n,
|
|
140
|
-
defaultRouteIds: A
|
|
141
|
-
}
|
|
142
|
-
) })
|
|
143
|
-
] }),
|
|
144
|
-
okText: l("maker.publish"),
|
|
145
|
-
cancelText: l("common.cancel"),
|
|
146
|
-
onOk: async () => {
|
|
147
|
-
if ((t == null ? void 0 : t.length) === 0) {
|
|
148
|
-
const n = l("maker.publishSelectPagesMessage");
|
|
149
|
-
throw I.error(n), new Error(n);
|
|
150
|
-
}
|
|
151
|
-
localStorage.setItem(q(f ?? ""), String((/* @__PURE__ */ new Date()).getTime())), p(!0);
|
|
152
|
-
try {
|
|
153
|
-
await ue({ mode: r, routes: t }), I.success(l("maker.publishSuccessMessage"));
|
|
154
|
-
} catch (n) {
|
|
155
|
-
throw I.error(n.message), n;
|
|
156
|
-
} finally {
|
|
157
|
-
p(!1);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
[r, m, l, f, v]
|
|
163
|
-
);
|
|
164
|
-
le(h, () => ({
|
|
165
|
-
openPublishDialog: g
|
|
166
|
-
}));
|
|
167
|
-
const b = P(() => {
|
|
168
|
-
g();
|
|
169
|
-
}, [g]);
|
|
170
|
-
return /* @__PURE__ */ u(H, { children: [
|
|
171
|
-
/* @__PURE__ */ e(
|
|
172
|
-
V,
|
|
173
|
-
{
|
|
174
|
-
color: "primary",
|
|
175
|
-
variant: "contained",
|
|
176
|
-
size: "small",
|
|
177
|
-
sx: { mr: 1 },
|
|
178
|
-
onClick: b,
|
|
179
|
-
loading: d,
|
|
180
|
-
disabled: d,
|
|
181
|
-
children: l("maker.publishToProduction")
|
|
182
|
-
}
|
|
183
|
-
),
|
|
184
|
-
c
|
|
185
|
-
] });
|
|
186
|
-
});
|
|
187
|
-
function fe({
|
|
188
|
-
state: r,
|
|
189
|
-
toMode: m,
|
|
190
|
-
onChange: h,
|
|
191
|
-
defaultRouteIds: l
|
|
192
|
-
}) {
|
|
193
|
-
const { t: d, locale: p } = J(), [c, v] = D(!1), [f, g] = D(
|
|
194
|
-
() => l ? Object.fromEntries(l.map((i) => [i, !0])) : {}
|
|
195
|
-
), { loading: b, error: A, value: t } = ce(() => me({ mode: m }), [m]);
|
|
196
|
-
if (A)
|
|
197
|
-
throw A;
|
|
198
|
-
const n = L(() => r.routeIds || [], [r]), k = L(() => (t == null ? void 0 : t.pageIds) || [], [t]), C = L(() => !n || !r.routes ? [] : JSON.parse(JSON.stringify(n)).sort((a, w) => {
|
|
199
|
-
var x, T;
|
|
200
|
-
const o = (x = r.routes) == null ? void 0 : x[a], s = (T = r.routes) == null ? void 0 : T[w];
|
|
201
|
-
return o != null && o.publishedAt && new Date(o.publishedAt).getTime() < new Date(o.updatedAt).getTime() ? -1 : s != null && s.publishedAt && new Date(s.publishedAt).getTime() < new Date(s.updatedAt).getTime() ? 1 : new Date((o == null ? void 0 : o.updatedAt) ?? "").getTime() - new Date((s == null ? void 0 : s.updatedAt) ?? "").getTime();
|
|
202
|
-
}), [r, n]), y = L(
|
|
203
|
-
() => !t || !k || !n ? [] : N(k, n),
|
|
204
|
-
[n, t, k]
|
|
205
|
-
), B = L(
|
|
206
|
-
() => n ? [...n].concat(y) : y,
|
|
207
|
-
[n, y]
|
|
208
|
-
), M = P(
|
|
209
|
-
(i) => {
|
|
210
|
-
g((a) => {
|
|
211
|
-
const w = oe(a, (o) => {
|
|
212
|
-
c ? (Object.assign(o, Object.fromEntries(B.map((s) => [s, !0]))), delete o[i]) : o[i] ? (delete o[i], y.includes(i) && (n || []).filter((s) => {
|
|
213
|
-
var x, T;
|
|
214
|
-
return ((x = r.pages[s]) == null ? void 0 : x.slug) === ((T = t == null ? void 0 : t.pages[i]) == null ? void 0 : T.slug);
|
|
215
|
-
}).forEach((s) => {
|
|
216
|
-
delete o[s];
|
|
217
|
-
})) : (o[i] = !0, n && n.includes(i) && y.filter((s) => {
|
|
218
|
-
var x, T;
|
|
219
|
-
return ((x = t == null ? void 0 : t.pages[s]) == null ? void 0 : x.slug) === ((T = r.pages[i]) == null ? void 0 : T.slug);
|
|
220
|
-
}).forEach((s) => {
|
|
221
|
-
o[s] = !0;
|
|
222
|
-
}));
|
|
223
|
-
});
|
|
224
|
-
return v(N(B, Object.keys(w)).length === 0), w;
|
|
225
|
-
});
|
|
226
|
-
},
|
|
227
|
-
[c, B, y, r, t, n]
|
|
228
|
-
), F = P(() => {
|
|
229
|
-
v((i) => (i && g({}), !i));
|
|
230
|
-
}, []);
|
|
231
|
-
return ae(() => {
|
|
232
|
-
h(c ? null : Object.keys(f));
|
|
233
|
-
}, [c, f, h]), b ? /* @__PURE__ */ e(de, { sx: { my: 4 } }) : /* @__PURE__ */ u(ie, { disablePadding: !0, sx: { maxWidth: 500 }, children: [
|
|
234
|
-
/* @__PURE__ */ e(O, { sx: { position: "sticky", top: 0, bgcolor: "background.paper", zIndex: 1 }, disablePadding: !0, children: /* @__PURE__ */ u(S, { onClick: F, dense: !0, children: [
|
|
235
|
-
/* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(E, { edge: "start", checked: c, tabIndex: -1 }) }),
|
|
236
|
-
/* @__PURE__ */ e(W, { primary: d("common.all") })
|
|
237
|
-
] }) }),
|
|
238
|
-
C.map((i) => {
|
|
239
|
-
var s;
|
|
240
|
-
const a = (s = r.routes) == null ? void 0 : s[i];
|
|
241
|
-
if (!a) return null;
|
|
242
|
-
const w = !1, o = !a.publishedAt || a.updatedAt && new Date(a.updatedAt).getTime() > new Date(a.publishedAt).getTime();
|
|
243
|
-
return /* @__PURE__ */ e(
|
|
244
|
-
O,
|
|
245
|
-
{
|
|
246
|
-
disablePadding: !0,
|
|
247
|
-
secondaryAction: /* @__PURE__ */ u(H, { children: [
|
|
248
|
-
o && /* @__PURE__ */ e(R, { title: d("maker.pages.needPublish"), children: /* @__PURE__ */ e(Q, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
|
|
249
|
-
!a.isPublic && /* @__PURE__ */ e(R, { title: d("maker.pages.notPublic"), children: /* @__PURE__ */ e(U, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
|
|
250
|
-
w
|
|
251
|
-
] }),
|
|
252
|
-
children: /* @__PURE__ */ u(S, { onClick: () => M(i), dense: !0, children: [
|
|
253
|
-
/* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(E, { edge: "start", checked: c || !!f[i], tabIndex: -1 }) }),
|
|
254
|
-
/* @__PURE__ */ e(
|
|
255
|
-
W,
|
|
256
|
-
{
|
|
257
|
-
primary: a.path,
|
|
258
|
-
primaryTypographyProps: { noWrap: !0, textOverflow: "ellipsis" },
|
|
259
|
-
secondaryTypographyProps: { noWrap: !0, textOverflow: "ellipsis" }
|
|
260
|
-
}
|
|
261
|
-
)
|
|
262
|
-
] })
|
|
263
|
-
},
|
|
264
|
-
i
|
|
265
|
-
);
|
|
266
|
-
}),
|
|
267
|
-
y.map((i) => {
|
|
268
|
-
var w, o;
|
|
269
|
-
const a = t == null ? void 0 : t.pages[i];
|
|
270
|
-
return a ? /* @__PURE__ */ e(
|
|
271
|
-
O,
|
|
272
|
-
{
|
|
273
|
-
disablePadding: !0,
|
|
274
|
-
secondaryAction: /* @__PURE__ */ e(ne, { color: "warning", label: "deleted", size: "small" }),
|
|
275
|
-
children: /* @__PURE__ */ u(S, { onClick: () => M(i), dense: !0, children: [
|
|
276
|
-
/* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(E, { edge: "start", checked: c || !!f[i], tabIndex: -1 }) }),
|
|
277
|
-
/* @__PURE__ */ e(
|
|
278
|
-
W,
|
|
279
|
-
{
|
|
280
|
-
primary: a.slug,
|
|
281
|
-
secondary: (o = (w = a.locales) == null ? void 0 : w[p]) == null ? void 0 : o.title,
|
|
282
|
-
primaryTypographyProps: { noWrap: !0, textOverflow: "ellipsis" },
|
|
283
|
-
secondaryTypographyProps: { noWrap: !0, textOverflow: "ellipsis" }
|
|
284
|
-
}
|
|
285
|
-
)
|
|
286
|
-
] })
|
|
287
|
-
},
|
|
288
|
-
i
|
|
289
|
-
) : null;
|
|
290
|
-
})
|
|
291
|
-
] });
|
|
292
|
-
}
|
|
293
|
-
export {
|
|
294
|
-
Ie as default
|
|
295
|
-
};
|