@blocklet/pages-kit-inner-components 0.5.54 → 0.5.55
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 +16 -16
- package/lib/cjs/chunks/{home-D71i_9kp.js → home-BMjMYgq3.js} +1 -1
- package/lib/cjs/chunks/publish-button-CGfGqrov.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/theme.js +1 -1
- package/lib/es/add-component.js +182 -183
- package/lib/es/chunks/{home-BDXQ7G7E.js → home-PDsc59QG.js} +1 -1
- package/lib/es/chunks/{publish-button-DBcyuR_L.js → publish-button-Ds7OBvxV.js} +11 -4
- package/lib/es/home.js +1 -1
- package/lib/es/theme.js +51 -53
- package/package.json +3 -3
- package/lib/cjs/chunks/publish-button-DlNNwjO1.js +0 -1
|
@@ -445,7 +445,7 @@ function H({
|
|
|
445
445
|
!((R = l.footer) != null && R.hidden) && /* @__PURE__ */ t(Wt, {})
|
|
446
446
|
] });
|
|
447
447
|
}
|
|
448
|
-
const ee = it(() => import("./publish-button-
|
|
448
|
+
const ee = it(() => import("./publish-button-Ds7OBvxV.js")), mt = nt(xt)`
|
|
449
449
|
&.sticky {
|
|
450
450
|
position: sticky;
|
|
451
451
|
top: 0;
|
|
@@ -10,7 +10,7 @@ import { produce as Oe } from "immer";
|
|
|
10
10
|
import ee from "lodash/difference";
|
|
11
11
|
import { useState as j, useMemo as R, useCallback as v, forwardRef as je, useImperativeHandle as ve, useEffect as $, useRef as Te } from "react";
|
|
12
12
|
import { useAsync as Re } from "react-use";
|
|
13
|
-
import { L as ze } from "./home-
|
|
13
|
+
import { L as ze } from "./home-PDsc59QG.js";
|
|
14
14
|
import { p as Le, g as Be } from "./array-c6HYTLze.js";
|
|
15
15
|
function Ee(s) {
|
|
16
16
|
const [y, w] = j(!1);
|
|
@@ -98,8 +98,15 @@ function Me() {
|
|
|
98
98
|
]
|
|
99
99
|
}
|
|
100
100
|
),
|
|
101
|
-
c && /* @__PURE__ */ t(
|
|
102
|
-
|
|
101
|
+
c && /* @__PURE__ */ t(
|
|
102
|
+
xe,
|
|
103
|
+
{
|
|
104
|
+
...L,
|
|
105
|
+
sx: { mt: -3, ...L == null ? void 0 : L.sx, bgcolor: "background.paper" },
|
|
106
|
+
children: /* @__PURE__ */ t(S, { pt: 3, children: c })
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ f(we, { sx: { bgcolor: "background.paper" }, children: [
|
|
103
110
|
/* @__PURE__ */ t(ke, { variant: "outlined", color: x || "primary", onClick: a ?? l, children: D }),
|
|
104
111
|
/* @__PURE__ */ t(
|
|
105
112
|
Ee,
|
|
@@ -360,7 +367,7 @@ function We({
|
|
|
360
367
|
const e = c ? E : Object.keys(h), r = Object.entries(k).filter(([, n]) => n).map(([n]) => n).filter((n) => n !== void 0), i = Array.from(/* @__PURE__ */ new Set([...e, ...r]));
|
|
361
368
|
w(c ? null : i);
|
|
362
369
|
}, [c, h, k, E, w]), V ? /* @__PURE__ */ t(ze, { sx: { my: 4 } }) : /* @__PURE__ */ f(De, { disablePadding: !0, sx: { maxWidth: 700 }, children: [
|
|
363
|
-
/* @__PURE__ */ t(W, { sx: { position: "sticky", top: 0,
|
|
370
|
+
/* @__PURE__ */ t(W, { sx: { position: "sticky", top: 0, zIndex: 1 }, disablePadding: !0, children: /* @__PURE__ */ f(K, { onClick: oe, dense: !0, children: [
|
|
364
371
|
/* @__PURE__ */ t(N, { children: /* @__PURE__ */ t(I, { edge: "start", checked: c, tabIndex: -1 }) }),
|
|
365
372
|
/* @__PURE__ */ t(F, { primary: u("common.all") })
|
|
366
373
|
] }) }),
|
package/lib/es/home.js
CHANGED
|
@@ -22,7 +22,7 @@ import "react-router-dom";
|
|
|
22
22
|
import "react-use";
|
|
23
23
|
import "ufo";
|
|
24
24
|
import "./chunks/array-c6HYTLze.js";
|
|
25
|
-
import { a as R, P as S, d as W, c as j, b as k, T as q, H as v } from "./chunks/home-
|
|
25
|
+
import { a as R, P as S, d as W, c as j, b as k, T as q, H as v } from "./chunks/home-PDsc59QG.js";
|
|
26
26
|
import "./chunks/session-CVblGhSp.js";
|
|
27
27
|
export {
|
|
28
28
|
R as HomeView,
|
package/lib/es/theme.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { ConfigProvider as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import
|
|
5
|
-
import { listItemIconClasses as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider as h } from "@arcblock/ux/lib/Config";
|
|
3
|
+
import { Icon as $ } from "@iconify-icon/react";
|
|
4
|
+
import y from "@iconify-icons/tabler/chevron-down";
|
|
5
|
+
import { listItemIconClasses as g, switchClasses as z, svgIconClasses as r, sliderClasses as o, outlinedInputClasses as m, inputBaseClasses as t, filledInputClasses as u, inputLabelClasses as s, inputClasses as a, selectClasses as v, autocompleteClasses as p, Box as S } from "@mui/material";
|
|
6
|
+
import { useMemo as M } from "react";
|
|
7
|
+
import { useLocation as I } from "react-router-dom";
|
|
8
|
+
import { S as C } from "./chunks/session-CVblGhSp.js";
|
|
9
|
+
import { translations as O } from "./locales.js";
|
|
10
|
+
var f;
|
|
11
|
+
const l = ((f = window.blocklet) == null ? void 0 : f.prefix) || "/", T = l.endsWith("/") ? `${l}admin` : `${l}/admin`, b = {
|
|
10
12
|
fontSize: "5rem",
|
|
11
13
|
"@media (max-width: 1536px)": {
|
|
12
14
|
fontSize: "5rem"
|
|
@@ -21,12 +23,12 @@ const o = ((x = window.blocklet) == null ? void 0 : x.prefix) || "/", $ = o.ends
|
|
|
21
23
|
fontSize: "2rem"
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
|
-
function
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
function x(e) {
|
|
27
|
+
return /* @__PURE__ */ n(S, { ...e, component: $, icon: y });
|
|
26
28
|
}
|
|
27
|
-
const
|
|
29
|
+
const L = {
|
|
28
30
|
typography: {
|
|
29
|
-
big: { ...
|
|
31
|
+
big: { ...b },
|
|
30
32
|
button: {
|
|
31
33
|
// @ts-ignore
|
|
32
34
|
textTransform: "none",
|
|
@@ -83,10 +85,10 @@ const I = {
|
|
|
83
85
|
styleOverrides: {
|
|
84
86
|
root: {
|
|
85
87
|
padding: 4,
|
|
86
|
-
[`.${
|
|
88
|
+
[`.${r.fontSizeMedium}`]: {
|
|
87
89
|
fontSize: "1.25rem"
|
|
88
90
|
},
|
|
89
|
-
[`.${
|
|
91
|
+
[`.${r.fontSizeSmall}`]: {
|
|
90
92
|
fontSize: "1.125rem"
|
|
91
93
|
}
|
|
92
94
|
}
|
|
@@ -96,10 +98,10 @@ const I = {
|
|
|
96
98
|
styleOverrides: {
|
|
97
99
|
root: {
|
|
98
100
|
padding: 4,
|
|
99
|
-
[`.${
|
|
101
|
+
[`.${r.fontSizeMedium}`]: {
|
|
100
102
|
fontSize: "1.25rem"
|
|
101
103
|
},
|
|
102
|
-
[`.${
|
|
104
|
+
[`.${r.fontSizeSmall}`]: {
|
|
103
105
|
fontSize: "1.125rem"
|
|
104
106
|
}
|
|
105
107
|
}
|
|
@@ -111,7 +113,7 @@ const I = {
|
|
|
111
113
|
height: 28,
|
|
112
114
|
width: 48,
|
|
113
115
|
padding: 8,
|
|
114
|
-
[`&.${
|
|
116
|
+
[`&.${z.sizeSmall}`]: {
|
|
115
117
|
height: 26,
|
|
116
118
|
width: 40,
|
|
117
119
|
padding: 8
|
|
@@ -123,7 +125,7 @@ const I = {
|
|
|
123
125
|
}
|
|
124
126
|
},
|
|
125
127
|
MuiAutocomplete: {
|
|
126
|
-
defaultProps: { popupIcon: /* @__PURE__ */
|
|
128
|
+
defaultProps: { popupIcon: /* @__PURE__ */ n(x, { fontSize: 14 }) },
|
|
127
129
|
variants: [
|
|
128
130
|
{
|
|
129
131
|
props: {},
|
|
@@ -176,7 +178,7 @@ const I = {
|
|
|
176
178
|
[`&.${t.hiddenLabel}`]: {
|
|
177
179
|
mt: 0,
|
|
178
180
|
pt: 0,
|
|
179
|
-
[`.${
|
|
181
|
+
[`.${v.select}.${a.input}:focus`]: {
|
|
180
182
|
bgcolor: "transparent"
|
|
181
183
|
}
|
|
182
184
|
}
|
|
@@ -194,7 +196,7 @@ const I = {
|
|
|
194
196
|
}
|
|
195
197
|
},
|
|
196
198
|
// filled
|
|
197
|
-
[`.${
|
|
199
|
+
[`.${u.root}`]: {
|
|
198
200
|
":before,:after": { display: "none" },
|
|
199
201
|
[`.${t.input}`]: {
|
|
200
202
|
pb: 0.5,
|
|
@@ -231,7 +233,7 @@ const I = {
|
|
|
231
233
|
}
|
|
232
234
|
},
|
|
233
235
|
// outlined
|
|
234
|
-
[`.${
|
|
236
|
+
[`.${m.root}`]: {
|
|
235
237
|
[`.${t.input}`]: {
|
|
236
238
|
py: 1.25,
|
|
237
239
|
px: 1,
|
|
@@ -302,12 +304,12 @@ const I = {
|
|
|
302
304
|
select: {
|
|
303
305
|
display: "flex",
|
|
304
306
|
alignItems: "center",
|
|
305
|
-
[`.${
|
|
307
|
+
[`.${g.root}`]: {
|
|
306
308
|
minWidth: 20
|
|
307
309
|
}
|
|
308
310
|
}
|
|
309
311
|
},
|
|
310
|
-
defaultProps: { variant: "filled", IconComponent:
|
|
312
|
+
defaultProps: { variant: "filled", IconComponent: x },
|
|
311
313
|
variants: [
|
|
312
314
|
{
|
|
313
315
|
props: {},
|
|
@@ -316,7 +318,7 @@ const I = {
|
|
|
316
318
|
borderRadius: 1,
|
|
317
319
|
lineHeight: "1.5rem",
|
|
318
320
|
// filled
|
|
319
|
-
[`&.${
|
|
321
|
+
[`&.${u.root}`]: {
|
|
320
322
|
":before,:after": { display: "none" },
|
|
321
323
|
[`.${t.input}`]: {
|
|
322
324
|
py: 0.5,
|
|
@@ -327,7 +329,7 @@ const I = {
|
|
|
327
329
|
}
|
|
328
330
|
},
|
|
329
331
|
// outlined
|
|
330
|
-
[`&.${
|
|
332
|
+
[`&.${m.root}`]: {
|
|
331
333
|
[`.${t.input}`]: {
|
|
332
334
|
py: 0.5,
|
|
333
335
|
borderRadius: 1,
|
|
@@ -347,16 +349,16 @@ const I = {
|
|
|
347
349
|
props: {},
|
|
348
350
|
style: ({ theme: e }) => e.unstable_sx({
|
|
349
351
|
height: 3,
|
|
350
|
-
[`.${
|
|
352
|
+
[`.${o.track}`]: {
|
|
351
353
|
borderWidth: 0
|
|
352
354
|
},
|
|
353
|
-
[`.${
|
|
355
|
+
[`.${o.thumb}`]: {
|
|
354
356
|
width: 16,
|
|
355
357
|
height: 16
|
|
356
358
|
},
|
|
357
|
-
[`&.${
|
|
359
|
+
[`&.${o.sizeSmall}`]: {
|
|
358
360
|
height: 2,
|
|
359
|
-
[`.${
|
|
361
|
+
[`.${o.thumb}`]: {
|
|
360
362
|
width: 12,
|
|
361
363
|
height: 12
|
|
362
364
|
}
|
|
@@ -452,36 +454,32 @@ const I = {
|
|
|
452
454
|
styleOverrides: {}
|
|
453
455
|
}
|
|
454
456
|
}
|
|
455
|
-
},
|
|
457
|
+
}, _ = {
|
|
456
458
|
typography: {
|
|
457
459
|
// @ts-ignore
|
|
458
|
-
big: { ...
|
|
460
|
+
big: { ...b },
|
|
459
461
|
button: {
|
|
460
462
|
// @ts-ignore
|
|
461
463
|
textTransform: "none",
|
|
462
464
|
WebkitTextTransform: "none"
|
|
463
465
|
}
|
|
464
466
|
}
|
|
465
|
-
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
children: /* @__PURE__ */ r(b, { serviceHost: o, protectedRoutes: [`${$}/*`], children: e })
|
|
482
|
-
}
|
|
483
|
-
);
|
|
467
|
+
}, U = ({
|
|
468
|
+
children: e,
|
|
469
|
+
isDashboard: i = !1
|
|
470
|
+
}) => {
|
|
471
|
+
const d = I().pathname.startsWith("/admin/maker") || i, c = M(() => d ? L : _, [d]);
|
|
472
|
+
return /* @__PURE__ */ n(
|
|
473
|
+
h,
|
|
474
|
+
{
|
|
475
|
+
theme: c,
|
|
476
|
+
translations: O,
|
|
477
|
+
fallbackLocale: "en",
|
|
478
|
+
injectFirst: !0,
|
|
479
|
+
children: /* @__PURE__ */ n(C, { serviceHost: l, protectedRoutes: [`${T}/*`], children: e })
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
};
|
|
484
483
|
export {
|
|
485
|
-
|
|
486
|
-
H as PageProvider
|
|
484
|
+
U as PagesKitThemeProvider
|
|
487
485
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit-inner-components",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.55",
|
|
4
4
|
"description": "Pages Kit inner components library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -204,8 +204,8 @@
|
|
|
204
204
|
"yaml": "^2.5.0",
|
|
205
205
|
"yjs": "^13.6.18",
|
|
206
206
|
"zustand": "^4.5.5",
|
|
207
|
-
"@blocklet/pages-kit": "^0.5.
|
|
208
|
-
"@blocklet/pages-kit-block-studio": "^0.5.
|
|
207
|
+
"@blocklet/pages-kit": "^0.5.55",
|
|
208
|
+
"@blocklet/pages-kit-block-studio": "^0.5.55"
|
|
209
209
|
},
|
|
210
210
|
"devDependencies": {
|
|
211
211
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("./state-BVdbNJCA.js"),W=require("@arcblock/ux/lib/Locale/context"),ee=require("@arcblock/ux/lib/Toast"),te=require("@blocklet/pages-kit/utils/route"),O=require("@mui/icons-material"),J=require("@mui/lab"),s=require("@mui/material"),se=require("immer"),ne=require("lodash/difference"),l=require("react"),ie=require("react-use"),re=require("./home-D71i_9kp.js"),U=require("./array-BqHuYyfx.js"),G=r=>r&&r.__esModule?r:{default:r},$=G(ee),H=G(ne);function oe(r){const[j,k]=l.useState(!1);return e.jsx(J.LoadingButton,{...r,loading:r.loading||j,onClick:u=>{var b;const p=(b=r.onClick)==null?void 0:b.call(r,u);p instanceof Promise&&(k(!0),p.finally(()=>{k(!1)}))}})}const ae=s.createSvgIcon(e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M7.75732 16.2426L16.2426 7.75736",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M16.2426 16.2426L7.75732 7.75735",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Close");function le(){const[r,j]=l.useState(),k=l.useMemo(()=>r?e.jsx(s.Dialog,{...r}):null,[r]),u=l.useCallback(()=>{j(void 0)},[]),p=l.useCallback(({title:b,content:d,cancelText:S="Cancel",okText:f="Ok",onOk:g,onClose:c,okIcon:P,okColor:w="primary",cancelColor:y="primary",DialogContentProps:A,form:E,...z})=>{j({...z,open:!0,children:e.jsxs("form",{onSubmit:v=>v.preventDefault(),children:[b&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:v=>`1px solid ${v.palette.divider}`},children:[e.jsx(s.Box,{children:b}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{u(),c==null||c()},children:e.jsx(ae,{})})]}),d&&e.jsx(s.DialogContent,{...A,sx:{mt:-3,...A==null?void 0:A.sx},children:e.jsx(s.Box,{pt:3,children:d})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:c??u,children:S}),e.jsx(oe,{variant:"contained",color:w||"primary",startIcon:P,loadingPosition:P?"start":"center",onClick:async()=>{await(g==null?void 0:g()),u()},type:"submit",children:f})]})]}),onClose:c??u})},[u]);return{dialog:k,showDialog:p,closeDialog:u}}const ce=l.forwardRef(({mode:r,state:j},k)=>{const{t:u}=W.useLocaleContext(),[p,b]=l.useState(!1),{dialog:d,showDialog:S}=le(),f=F.useProjectId(),g=l.useCallback(P=>{let w=[];S({title:u("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(O.Warning,{}),children:u("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(de,{state:j,toMode:r,onChange:y=>w=y,defaultRouteIds:P})})]}),okText:u("maker.publish"),cancelText:u("common.cancel"),onOk:async()=>{if((w==null?void 0:w.length)===0){const y=u("maker.publishSelectPagesMessage");throw $.default.error(y),new Error(y)}localStorage.setItem(F.getProjectPageVersionKey(f??""),String(new Date().getTime())),b(!0);try{await U.publishPages({mode:r,routes:w}),$.default.success(u("maker.publishSuccessMessage"))}catch(y){throw $.default.error(y.message),y}finally{b(!1)}}})},[r,j,u,f,S]);l.useImperativeHandle(k,()=>({openPublishDialog:g}));const c=l.useCallback(()=>{g()},[g]);return e.jsxs(e.Fragment,{children:[e.jsx(J.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:c,loading:p,disabled:p,children:u("maker.publish")}),d]})});function ue({routePathInfo:r,checked:j,onClick:k,route:u}){var d,S,f,g,c;const{t:p}=W.useLocaleContext(),b=!((d=r.routeMetaData)!=null&&d.publishedAt)||((S=r.routeMetaData)==null?void 0:S.updatedAt)&&new Date((f=r.routeMetaData)==null?void 0:f.updatedAt)>new Date((g=r.routeMetaData)==null?void 0:g.publishedAt);return e.jsx(s.ListItem,{sx:{pl:4,pr:3},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{display:"flex",alignItems:"center",sx:{minWidth:"auto"},children:[b&&e.jsx(s.Box,{mr:.35,className:"visible",color:"warning.main",sx:{display:"flex",alignItems:"center"},title:p("maker.pages.needPublish"),children:e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(O.Sync,{fontSize:"small",sx:{fontSize:"16px"}})})}),(!((c=r.routeMetaData)!=null&&c.isPublic)||!u.isPublic)&&e.jsx(s.Box,{className:"visible",color:"warning.main",children:e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(O.VisibilityOff,{fontSize:"small",sx:{fontSize:"16px"}})})})]}),children:e.jsxs(s.ListItemButton,{onClick:k,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:j,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:r.path,primaryTypographyProps:{fontSize:"0.8rem",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pr:1}})]})})}function de({state:r,toMode:j,onChange:k,defaultRouteIds:u}){const{t:p,locale:b}=W.useLocaleContext(),[d,S]=l.useState(!1),[f,g]=l.useState(()=>u?Object.fromEntries(u.filter(t=>!t.includes("-")).map(t=>[t,!0])):{}),[c,P]=l.useState({}),[w,y]=l.useState(()=>u?Object.fromEntries(u.filter(t=>t.includes("-")).map(t=>[t,!0])):{}),[A,E]=l.useState({}),{loading:z,error:v,value:x}=ie.useAsync(()=>U.getPages({mode:j}),[j]);if(v)throw v;const D=l.useMemo(()=>r.routeIds||[],[r]),I=l.useMemo(()=>(x==null?void 0:x.pageIds)||[],[x]),T=l.useMemo(()=>!D||!r.routes?[]:JSON.parse(JSON.stringify(D)).sort((o,i)=>{var h,m;const n=(h=r.routes)==null?void 0:h[o],a=(m=r.routes)==null?void 0:m[i];return n!=null&&n.publishedAt&&new Date(n.publishedAt).getTime()<new Date(n.updatedAt).getTime()?-1:a!=null&&a.publishedAt&&new Date(a.publishedAt).getTime()<new Date(a.updatedAt).getTime()?1:new Date((n==null?void 0:n.updatedAt)??"").getTime()-new Date((a==null?void 0:a.updatedAt)??"").getTime()}),[r,D]),q=l.useMemo(()=>{if(!T)return[];if(!c)return T;const t=[...T].filter(o=>!c[o]);return Object.values(c).forEach(o=>{o.forEach(i=>{t.push(`${i.originalRouteId}-${i.paramOptionIds.join("-")}`)})}),t},[T,c]),B=l.useMemo(()=>!x||!I||!q?[]:H.default(I,q),[q,x,I]),C=l.useMemo(()=>D?[...D].concat(B):B,[D,B]),_=l.useCallback(()=>{const t={};T==null||T.forEach(o=>{var n;const i=(n=r.routes)==null?void 0:n[o];if(i&&i.params&&i.params.length>0&&i.paramsOptions&&i.paramsOptions.length>0){const a=te.generateParamCombinations({basePath:i.path,params:i.params,routeId:i.id,paramsOptions:i.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});a.length>0&&(t[i.id]=a)}}),P(t)},[T,r.routes]);l.useEffect(()=>{_()},[_]),l.useEffect(()=>{E(t=>{const o={...t};return Object.keys(c).forEach(i=>{var n;c[i]&&((n=c[i])==null?void 0:n.length)>0&&o[i]===void 0&&(o[i]=!0)}),o})},[c]);const K=l.useRef(!0);l.useEffect(()=>{y(t=>{const o={...t};return Object.keys(c).length===0||(Object.keys(c).forEach(i=>{const n=c[i]||[],a=d||!!f[i];n.forEach(h=>{const m=`${i}-${h.paramOptionIds.join("-")}`;K.current?o[m]=a||t[m]||!1:o[m]=a})}),K.current=!1),o})},[f,c,d]);const Q=(t,o)=>{o.stopPropagation(),E(i=>{const n={...i};return n[t]=!n[t],n})},N=l.useCallback(t=>{g(o=>{const i=se.produce(o,n=>{d?(Object.assign(n,Object.fromEntries(C.map(a=>[a,!0]))),delete n[t]):n[t]?(delete n[t],B.includes(t)&&(D||[]).filter(a=>{var h,m;return((h=r.pages[a])==null?void 0:h.slug)===((m=x==null?void 0:x.pages[t])==null?void 0:m.slug)}).forEach(a=>{delete n[a]})):(n[t]=!0,D&&D.includes(t)&&B.filter(a=>{var h,m;return((h=x==null?void 0:x.pages[a])==null?void 0:h.slug)===((m=r.pages[t])==null?void 0:m.slug)}).forEach(a=>{n[a]=!0}))});return S(H.default(C,Object.keys(i)).length===0),i})},[d,C,B,r,x,D]),X=l.useCallback((t,o)=>{const i=`${t}-${o.paramOptionIds.join("-")}`;y(n=>{var m;const a={...n};a[i]=!a[i];const h=((m=c[t])==null?void 0:m.every(L=>a[`${t}-${L.paramOptionIds.join("-")}`]))??!1;return g(L=>{if(h&&!L[t])return{...L,[t]:!0};if(!h&&L[t]){const R={...L};return delete R[t],R}return L}),a})},[c]),Y=l.useCallback(()=>{S(t=>(t&&g({}),!t))},[]);return l.useEffect(()=>{const t=d?C:Object.keys(f),o=Object.entries(w).filter(([,n])=>n).map(([n])=>n).filter(n=>n!==void 0),i=Array.from(new Set([...t,...o]));k(d?null:i)},[d,f,w,C,k]),z?e.jsx(re.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:700},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:Y,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:p("common.all")})]})}),T.map(t=>{var L,R;const o=(L=r.routes)==null?void 0:L[t];if(!o)return null;const i=!1,n=c&&c[t]&&((R=c[t])==null?void 0:R.length)>0,a=A[t]!==!1,h=c[t]||[],m=!o.publishedAt||o.updatedAt&&new Date(o.updatedAt).getTime()>new Date(o.publishedAt).getTime();return e.jsxs(s.Box,{children:[e.jsx(s.ListItem,{sx:{pr:4},disablePadding:!0,secondaryAction:e.jsxs(s.Box,{sx:{display:"flex",alignItems:"center"},children:[m&&e.jsx(s.Tooltip,{title:p("maker.pages.needPublish"),children:e.jsx(O.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!o.isPublic&&e.jsx(s.Tooltip,{title:p("maker.pages.notPublic"),children:e.jsx(O.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),i,n&&e.jsx(s.Box,{onClick:M=>Q(t,M),sx:{display:"inline-flex",alignItems:"center",mr:.35,cursor:"pointer",color:"info.main"},children:a?e.jsx(O.KeyboardArrowDown,{fontSize:"small",sx:{fontSize:"18px"}}):e.jsx(O.KeyboardArrowRight,{fontSize:"small",sx:{fontSize:"18px"}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.path,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})}),n&&e.jsx(s.Collapse,{in:a,children:e.jsx(s.Box,{children:h.map(M=>{const V=`${t}-${M.paramOptionIds.join("-")}`,Z=w[V]||!1;return e.jsx(ue,{routePathInfo:M,checked:d||Z,onClick:()=>X(t,M),route:o},V)})})})]},t)}),B.map(t=>{var i,n;const o=x==null?void 0:x.pages[t];return o?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>N(t),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:d||!!f[t],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:o.slug,secondary:(n=(i=o.locales)==null?void 0:i[b])==null?void 0:n.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},t):null})]})}exports.default=ce;
|