@hkyhy/marsun-components-core 0.1.17 → 0.1.18
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/dist/components/Layout/ModulePageShell/index.d.ts +17 -0
- package/dist/components/Layout/ModulePageShell/index.js +42 -0
- package/dist/components/Layout/ModulePageShell/index.js.map +1 -0
- package/dist/components/Layout/ModulePageShell/style.module.scss.js +10 -0
- package/dist/components/Layout/ModulePageShell/style.module.scss.js.map +1 -0
- package/dist/components/Layout/PageHeaderLayout/index.d.ts +3 -1
- package/dist/components/Layout/PageHeaderLayout/index.js +43 -34
- package/dist/components/Layout/PageHeaderLayout/index.js.map +1 -1
- package/dist/components/Layout/PageHeaderLayout/style.module.scss.js +5 -4
- package/dist/components/Layout/PageHeaderLayout/style.module.scss.js.map +1 -1
- package/dist/components/Layout/PageShell/PageShellContext.d.ts +20 -0
- package/dist/components/Layout/PageShell/PageShellContext.js +39 -0
- package/dist/components/Layout/PageShell/PageShellContext.js.map +1 -0
- package/dist/components/Layout/PageShell/index.d.ts +2 -0
- package/dist/components/Layout/PageSpin/index.d.ts +9 -0
- package/dist/components/Layout/PageSpin/index.js +9 -0
- package/dist/components/Layout/PageSpin/index.js.map +1 -0
- package/dist/components/Layout/PageSpin/style.module.scss.js +7 -0
- package/dist/components/Layout/PageSpin/style.module.scss.js.map +1 -0
- package/dist/components/Layout/index.d.ts +6 -0
- package/dist/index.js +152 -144
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ModulePageShellProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: ReactNode;
|
|
5
|
+
breadcrumb?: ReactNode;
|
|
6
|
+
toolbar?: ReactNode;
|
|
7
|
+
/** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */
|
|
8
|
+
spinning?: boolean;
|
|
9
|
+
/** 是否同步 title/description/actions 到 PageShellProvider(App 顶栏),默认 true */
|
|
10
|
+
syncPageMeta?: boolean;
|
|
11
|
+
actions?: Record<string, unknown>[];
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
bodyClassName?: string;
|
|
15
|
+
};
|
|
16
|
+
declare const ModulePageShell: React.FC<ModulePageShellProps>;
|
|
17
|
+
export default ModulePageShell;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import l from "classnames";
|
|
3
|
+
import { useEffect as b } from "react";
|
|
4
|
+
import N from "../PageSpin/index.js";
|
|
5
|
+
import o from "./style.module.scss.js";
|
|
6
|
+
import { usePageShell as v } from "../PageShell/PageShellContext.js";
|
|
7
|
+
const w = ({
|
|
8
|
+
title: m,
|
|
9
|
+
description: r,
|
|
10
|
+
breadcrumb: s,
|
|
11
|
+
toolbar: d,
|
|
12
|
+
spinning: u = !1,
|
|
13
|
+
syncPageMeta: n = !0,
|
|
14
|
+
actions: i,
|
|
15
|
+
children: p,
|
|
16
|
+
className: t,
|
|
17
|
+
bodyClassName: g
|
|
18
|
+
}) => {
|
|
19
|
+
const { setPageMeta: a, pageLoading: c } = v(), f = !!(u || c);
|
|
20
|
+
return b(() => {
|
|
21
|
+
if (n)
|
|
22
|
+
return a({
|
|
23
|
+
title: m,
|
|
24
|
+
description: r,
|
|
25
|
+
actionItems: i
|
|
26
|
+
}), () => a({});
|
|
27
|
+
}, [m, r, i, n, a]), /* @__PURE__ */ h("div", { className: l("module-page-shell", o["module-page-shell"], t), children: [
|
|
28
|
+
s ? /* @__PURE__ */ e("div", { className: l("module-page-breadcrumb", o["module-page-breadcrumb"]), children: s }) : null,
|
|
29
|
+
d ? /* @__PURE__ */ e("div", { className: l("module-page-toolbar", o["module-page-toolbar"]), children: d }) : null,
|
|
30
|
+
/* @__PURE__ */ e(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: l("module-page-body", o["module-page-body"], g),
|
|
34
|
+
children: /* @__PURE__ */ e(N, { spinning: f, children: p })
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
w as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/ModulePageShell/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport { useEffect } from 'react';\nimport PageSpin from '../PageSpin';\nimport { usePageShell } from '../PageShell';\nimport styles from './style.module.scss';\n\nexport type ModulePageShellProps = {\n title?: string;\n description?: ReactNode;\n breadcrumb?: ReactNode;\n toolbar?: ReactNode;\n /** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */\n spinning?: boolean;\n /** 是否同步 title/description/actions 到 PageShellProvider(App 顶栏),默认 true */\n syncPageMeta?: boolean;\n actions?: Record<string, unknown>[];\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n};\n\nconst ModulePageShell: React.FC<ModulePageShellProps> = ({\n title,\n description,\n breadcrumb,\n toolbar,\n spinning = false,\n syncPageMeta = true,\n actions,\n children,\n className,\n bodyClassName,\n}) => {\n const { setPageMeta, pageLoading: ctxLoading } = usePageShell();\n const showSpinning = Boolean(spinning || ctxLoading);\n\n useEffect(() => {\n if (!syncPageMeta) return;\n setPageMeta({\n title,\n description,\n actionItems: actions,\n });\n return () => setPageMeta({});\n }, [title, description, actions, syncPageMeta, setPageMeta]);\n\n return (\n <div className={classNames('module-page-shell', styles['module-page-shell'], className)}>\n {breadcrumb ? (\n <div className={classNames('module-page-breadcrumb', styles['module-page-breadcrumb'])}>\n {breadcrumb}\n </div>\n ) : null}\n\n {toolbar ? (\n <div className={classNames('module-page-toolbar', styles['module-page-toolbar'])}>\n {toolbar}\n </div>\n ) : null}\n\n <div\n className={classNames('module-page-body', styles['module-page-body'], bodyClassName)}\n >\n <PageSpin spinning={showSpinning}>{children}</PageSpin>\n </div>\n </div>\n );\n};\n\nexport default ModulePageShell;\n"],"names":["ModulePageShell","title","description","breadcrumb","toolbar","spinning","syncPageMeta","actions","children","className","bodyClassName","setPageMeta","ctxLoading","usePageShell","showSpinning","useEffect","jsxs","classNames","styles","jsx","PageSpin"],"mappings":";;;;;;AAsBA,MAAMA,IAAkD,CAAC;AAAA,EACvD,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,cAAAC,IAAe;AAAA,EACf,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,MAAM;AACJ,QAAM,EAAE,aAAAC,GAAa,aAAaC,EAAA,IAAeC,EAAA,GAC3CC,IAAe,GAAQT,KAAYO;AAEzC,SAAAG,EAAU,MAAM;AACd,QAAKT;AACL,aAAAK,EAAY;AAAA,QACV,OAAAV;AAAA,QACA,aAAAC;AAAA,QACA,aAAaK;AAAA,MAAA,CACd,GACM,MAAMI,EAAY,EAAE;AAAA,EAC7B,GAAG,CAACV,GAAOC,GAAaK,GAASD,GAAcK,CAAW,CAAC,GAGzD,gBAAAK,EAAC,SAAI,WAAWC,EAAW,qBAAqBC,EAAO,mBAAmB,GAAGT,CAAS,GACnF,UAAA;AAAA,IAAAN,IACC,gBAAAgB,EAAC,OAAA,EAAI,WAAWF,EAAW,0BAA0BC,EAAO,wBAAwB,CAAC,GAClF,UAAAf,EAAA,CACH,IACE;AAAA,IAEHC,IACC,gBAAAe,EAAC,OAAA,EAAI,WAAWF,EAAW,uBAAuBC,EAAO,qBAAqB,CAAC,GAC5E,UAAAd,EAAA,CACH,IACE;AAAA,IAEJ,gBAAAe;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF,EAAW,oBAAoBC,EAAO,kBAAkB,GAAGR,CAAa;AAAA,QAEnF,UAAA,gBAAAS,EAACC,GAAA,EAAS,UAAUN,GAAe,UAAAN,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9C,GACF;AAEJ;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
"module-page-shell": "_module-page-shell_140iw_1",
|
|
3
|
+
"module-page-breadcrumb": "_module-page-breadcrumb_140iw_10",
|
|
4
|
+
"module-page-toolbar": "_module-page-toolbar_140iw_19",
|
|
5
|
+
"module-page-body": "_module-page-body_140iw_26"
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
e as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=style.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -5,8 +5,10 @@ export interface PageHeaderLayoutProps {
|
|
|
5
5
|
actions?: React.ReactNode;
|
|
6
6
|
/** 页面说明提示,显示在头部下方、内容区上方 */
|
|
7
7
|
description?: React.ReactNode;
|
|
8
|
+
/** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */
|
|
9
|
+
spinning?: boolean;
|
|
8
10
|
children?: React.ReactNode;
|
|
9
11
|
}
|
|
10
|
-
/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 +
|
|
12
|
+
/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 + 内容(body 内置 PageSpin) */
|
|
11
13
|
declare const PageHeaderLayout: React.FC<PageHeaderLayoutProps>;
|
|
12
14
|
export default PageHeaderLayout;
|
|
@@ -1,41 +1,50 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowLeft as
|
|
3
|
-
import { Button as
|
|
2
|
+
import { ArrowLeft as h } from "../../Icons/index.js";
|
|
3
|
+
import { Button as c } from "antd";
|
|
4
4
|
import a from "classnames";
|
|
5
|
+
import g from "../PageSpin/index.js";
|
|
5
6
|
import r from "./style.module.scss.js";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
import { usePageShell as u } from "../PageShell/PageShellContext.js";
|
|
8
|
+
const P = ({
|
|
9
|
+
title: l,
|
|
8
10
|
onBack: t,
|
|
9
|
-
actions:
|
|
10
|
-
description:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
actions: n,
|
|
12
|
+
description: i,
|
|
13
|
+
spinning: p = !1,
|
|
14
|
+
children: s
|
|
15
|
+
}) => {
|
|
16
|
+
const { pageLoading: d } = u(), m = !!(p || d);
|
|
17
|
+
return /* @__PURE__ */ o("div", { className: a("page-header-layout", r["page-header-layout"]), children: [
|
|
18
|
+
/* @__PURE__ */ o("div", { className: a("page-header-layout-root", r["page-header-layout-root"]), children: [
|
|
19
|
+
/* @__PURE__ */ o(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: a(
|
|
23
|
+
"page-header-layout-container",
|
|
24
|
+
r["page-header-layout-container"]
|
|
25
|
+
),
|
|
26
|
+
children: [
|
|
27
|
+
t && /* @__PURE__ */ e(c, { type: "text", icon: /* @__PURE__ */ e(h, {}), onClick: t }),
|
|
28
|
+
/* @__PURE__ */ e(
|
|
29
|
+
"h2",
|
|
30
|
+
{
|
|
31
|
+
className: a(
|
|
32
|
+
"page-header-layout-wrapper",
|
|
33
|
+
r["page-header-layout-wrapper"]
|
|
34
|
+
),
|
|
35
|
+
children: l
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ e("div", { children: n })
|
|
42
|
+
] }),
|
|
43
|
+
i && /* @__PURE__ */ e("div", { className: a("page-header-layout-inner", r["page-header-layout-inner"]), children: i }),
|
|
44
|
+
/* @__PURE__ */ e(g, { spinning: m, children: s })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
38
47
|
export {
|
|
39
|
-
|
|
48
|
+
P as default
|
|
40
49
|
};
|
|
41
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/PageHeaderLayout/index.tsx"],"sourcesContent":["import { ArrowLeft } from '@/components/Icons';\nimport { Button } from 'antd';\nimport classNames from 'classnames';\nimport React from 'react';\nimport styles from './style.module.scss';\n\nexport interface PageHeaderLayoutProps {\n title: string;\n onBack?: () => void;\n actions?: React.ReactNode;\n /** 页面说明提示,显示在头部下方、内容区上方 */\n description?: React.ReactNode;\n children?: React.ReactNode;\n}\n\n/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 +
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/PageHeaderLayout/index.tsx"],"sourcesContent":["import { ArrowLeft } from '@/components/Icons';\nimport { Button } from 'antd';\nimport classNames from 'classnames';\nimport React from 'react';\nimport PageSpin from '../PageSpin';\nimport { usePageShell } from '../PageShell';\nimport styles from './style.module.scss';\n\nexport interface PageHeaderLayoutProps {\n title: string;\n onBack?: () => void;\n actions?: React.ReactNode;\n /** 页面说明提示,显示在头部下方、内容区上方 */\n description?: React.ReactNode;\n /** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */\n spinning?: boolean;\n children?: React.ReactNode;\n}\n\n/** 页面头部布局:返回按钮 + 标题 + 操作区 + 说明提示 + 内容(body 内置 PageSpin) */\nconst PageHeaderLayout: React.FC<PageHeaderLayoutProps> = ({\n title,\n onBack,\n actions,\n description,\n spinning = false,\n children,\n}) => {\n const { pageLoading: ctxLoading } = usePageShell();\n const showSpinning = Boolean(spinning || ctxLoading);\n\n return (\n <div className={classNames('page-header-layout', styles['page-header-layout'])}>\n <div className={classNames('page-header-layout-root', styles['page-header-layout-root'])}>\n <div\n className={classNames(\n 'page-header-layout-container',\n styles['page-header-layout-container'],\n )}\n >\n {onBack && <Button type=\"text\" icon={<ArrowLeft />} onClick={onBack} />}\n <h2\n className={classNames(\n 'page-header-layout-wrapper',\n styles['page-header-layout-wrapper'],\n )}\n >\n {title}\n </h2>\n </div>\n <div>{actions}</div>\n </div>\n {description && (\n <div className={classNames('page-header-layout-inner', styles['page-header-layout-inner'])}>\n {description}\n </div>\n )}\n <PageSpin spinning={showSpinning}>{children}</PageSpin>\n </div>\n );\n};\n\nexport default PageHeaderLayout;\n"],"names":["PageHeaderLayout","title","onBack","actions","description","spinning","children","ctxLoading","usePageShell","showSpinning","jsxs","classNames","styles","jsx","Button","ArrowLeft","PageSpin"],"mappings":";;;;;;;AAoBA,MAAMA,IAAoD,CAAC;AAAA,EACzD,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC;AACF,MAAM;AACJ,QAAM,EAAE,aAAaC,EAAA,IAAeC,EAAA,GAC9BC,IAAe,GAAQJ,KAAYE;AAEzC,SACE,gBAAAG,EAAC,SAAI,WAAWC,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC,GAC3E,UAAA;AAAA,IAAA,gBAAAF,EAAC,SAAI,WAAWC,EAAW,2BAA2BC,EAAO,yBAAyB,CAAC,GACrF,UAAA;AAAA,MAAA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC;AAAA,YACT;AAAA,YACAC,EAAO,8BAA8B;AAAA,UAAA;AAAA,UAGtC,UAAA;AAAA,YAAAV,KAAU,gBAAAW,EAACC,KAAO,MAAK,QAAO,MAAM,gBAAAD,EAACE,GAAA,CAAA,CAAU,GAAI,SAASb,EAAA,CAAQ;AAAA,YACrE,gBAAAW;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWF;AAAA,kBACT;AAAA,kBACAC,EAAO,4BAA4B;AAAA,gBAAA;AAAA,gBAGpC,UAAAX;AAAA,cAAA;AAAA,YAAA;AAAA,UACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAY,EAAC,SAAK,UAAAV,EAAA,CAAQ;AAAA,IAAA,GAChB;AAAA,IACCC,KACC,gBAAAS,EAAC,OAAA,EAAI,WAAWF,EAAW,4BAA4BC,EAAO,0BAA0B,CAAC,GACtF,UAAAR,EAAA,CACH;AAAA,IAEF,gBAAAS,EAACG,GAAA,EAAS,UAAUP,GAAe,UAAAH,EAAA,CAAS;AAAA,EAAA,GAC9C;AAEJ;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const e = {
|
|
2
|
-
"page-header-layout
|
|
3
|
-
"page-header-layout-
|
|
4
|
-
"page-header-layout-
|
|
5
|
-
"page-header-layout-
|
|
2
|
+
"page-header-layout": "_page-header-layout_w8y3l_1",
|
|
3
|
+
"page-header-layout-root": "_page-header-layout-root_w8y3l_8",
|
|
4
|
+
"page-header-layout-container": "_page-header-layout-container_w8y3l_14",
|
|
5
|
+
"page-header-layout-wrapper": "_page-header-layout-wrapper_w8y3l_19",
|
|
6
|
+
"page-header-layout-inner": "_page-header-layout-inner_w8y3l_24"
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
8
9
|
e as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PageShellMeta = {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: ReactNode;
|
|
5
|
+
actionItems?: Record<string, unknown>[];
|
|
6
|
+
};
|
|
7
|
+
type PageShellContextValue = {
|
|
8
|
+
meta: PageShellMeta;
|
|
9
|
+
setPageMeta: (next: PageShellMeta) => void;
|
|
10
|
+
pageLoading: boolean;
|
|
11
|
+
setPageLoading: (loading: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function usePageShell(): PageShellContextValue;
|
|
14
|
+
/** 深层子组件向 Layout body Spin 注册 loading(卸载时自动清除) */
|
|
15
|
+
export declare function usePageShellLoading(spinning: boolean): void;
|
|
16
|
+
export type PageShellProviderProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export declare function PageShellProvider({ children }: PageShellProviderProps): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useCallback as r, useMemo as d, useContext as m, useEffect as L, createContext as M } from "react";
|
|
3
|
+
const c = {}, l = M({
|
|
4
|
+
meta: c,
|
|
5
|
+
setPageMeta: () => {
|
|
6
|
+
},
|
|
7
|
+
pageLoading: !1,
|
|
8
|
+
setPageLoading: () => {
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function S() {
|
|
12
|
+
return m(l);
|
|
13
|
+
}
|
|
14
|
+
function p(t) {
|
|
15
|
+
const { setPageLoading: e } = S();
|
|
16
|
+
L(() => (e(t), () => e(!1)), [t, e]);
|
|
17
|
+
}
|
|
18
|
+
function C({ children: t }) {
|
|
19
|
+
const [e, u] = g(c), [o, P] = g(!1), s = r((a) => {
|
|
20
|
+
u(a);
|
|
21
|
+
}, []), n = r((a) => {
|
|
22
|
+
P(a);
|
|
23
|
+
}, []), i = d(
|
|
24
|
+
() => ({
|
|
25
|
+
meta: e,
|
|
26
|
+
setPageMeta: s,
|
|
27
|
+
pageLoading: o,
|
|
28
|
+
setPageLoading: n
|
|
29
|
+
}),
|
|
30
|
+
[e, s, o, n]
|
|
31
|
+
);
|
|
32
|
+
return /* @__PURE__ */ f(l.Provider, { value: i, children: t });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
C as PageShellProvider,
|
|
36
|
+
S as usePageShell,
|
|
37
|
+
p as usePageShellLoading
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=PageShellContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageShellContext.js","sources":["../../../../src/components/Layout/PageShell/PageShellContext.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\n\nexport type PageShellMeta = {\n title?: string;\n description?: ReactNode;\n actionItems?: Record<string, unknown>[];\n};\n\ntype PageShellContextValue = {\n meta: PageShellMeta;\n setPageMeta: (next: PageShellMeta) => void;\n pageLoading: boolean;\n setPageLoading: (loading: boolean) => void;\n};\n\nconst EMPTY_META: PageShellMeta = {};\n\nconst PageShellContext = createContext<PageShellContextValue>({\n meta: EMPTY_META,\n setPageMeta: () => {},\n pageLoading: false,\n setPageLoading: () => {},\n});\n\nexport function usePageShell() {\n return useContext(PageShellContext);\n}\n\n/** 深层子组件向 Layout body Spin 注册 loading(卸载时自动清除) */\nexport function usePageShellLoading(spinning: boolean) {\n const { setPageLoading } = usePageShell();\n useEffect(() => {\n setPageLoading(spinning);\n return () => setPageLoading(false);\n }, [spinning, setPageLoading]);\n}\n\nexport type PageShellProviderProps = {\n children: ReactNode;\n};\n\nexport function PageShellProvider({ children }: PageShellProviderProps) {\n const [meta, setMeta] = useState<PageShellMeta>(EMPTY_META);\n const [pageLoading, setPageLoadingState] = useState(false);\n\n const setPageMeta = useCallback((next: PageShellMeta) => {\n setMeta(next);\n }, []);\n\n const setPageLoading = useCallback((loading: boolean) => {\n setPageLoadingState(loading);\n }, []);\n\n const value = useMemo(\n () => ({\n meta,\n setPageMeta,\n pageLoading,\n setPageLoading,\n }),\n [meta, setPageMeta, pageLoading, setPageLoading],\n );\n\n return <PageShellContext.Provider value={value}>{children}</PageShellContext.Provider>;\n}\n"],"names":["EMPTY_META","PageShellContext","createContext","usePageShell","useContext","usePageShellLoading","spinning","setPageLoading","useEffect","PageShellProvider","children","meta","setMeta","useState","pageLoading","setPageLoadingState","setPageMeta","useCallback","next","loading","value","useMemo","jsx"],"mappings":";;AAgBA,MAAMA,IAA4B,CAAA,GAE5BC,IAAmBC,EAAqC;AAAA,EAC5D,MAAMF;AAAA,EACN,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,aAAa;AAAA,EACb,gBAAgB,MAAM;AAAA,EAAC;AACzB,CAAC;AAEM,SAASG,IAAe;AAC7B,SAAOC,EAAWH,CAAgB;AACpC;AAGO,SAASI,EAAoBC,GAAmB;AACrD,QAAM,EAAE,gBAAAC,EAAA,IAAmBJ,EAAA;AAC3B,EAAAK,EAAU,OACRD,EAAeD,CAAQ,GAChB,MAAMC,EAAe,EAAK,IAChC,CAACD,GAAUC,CAAc,CAAC;AAC/B;AAMO,SAASE,EAAkB,EAAE,UAAAC,KAAoC;AACtE,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwBb,CAAU,GACpD,CAACc,GAAaC,CAAmB,IAAIF,EAAS,EAAK,GAEnDG,IAAcC,EAAY,CAACC,MAAwB;AACvD,IAAAN,EAAQM,CAAI;AAAA,EACd,GAAG,CAAA,CAAE,GAECX,IAAiBU,EAAY,CAACE,MAAqB;AACvD,IAAAJ,EAAoBI,CAAO;AAAA,EAC7B,GAAG,CAAA,CAAE,GAECC,IAAQC;AAAA,IACZ,OAAO;AAAA,MACL,MAAAV;AAAA,MACA,aAAAK;AAAA,MACA,aAAAF;AAAA,MACA,gBAAAP;AAAA,IAAA;AAAA,IAEF,CAACI,GAAMK,GAAaF,GAAaP,CAAc;AAAA,EAAA;AAGjD,SAAO,gBAAAe,EAACrB,EAAiB,UAAjB,EAA0B,OAAAmB,GAAe,UAAAV,EAAA,CAAS;AAC5D;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PageSpinProps = {
|
|
3
|
+
spinning: boolean;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
/** 模块页 body 区整页 Spin:参与 flex 高度链,遮罩 Filter + 主工作区 */
|
|
8
|
+
declare const PageSpin: React.FC<PageSpinProps>;
|
|
9
|
+
export default PageSpin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Spin as o } from "antd";
|
|
3
|
+
import a from "classnames";
|
|
4
|
+
import e from "./style.module.scss.js";
|
|
5
|
+
const n = ({ spinning: p, children: r, className: s }) => /* @__PURE__ */ m(o, { spinning: p, wrapperClassName: a(e["page-spin"], s), children: r });
|
|
6
|
+
export {
|
|
7
|
+
n as default
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Layout/PageSpin/index.tsx"],"sourcesContent":["import { Spin } from 'antd';\nimport classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport styles from './style.module.scss';\n\nexport type PageSpinProps = {\n spinning: boolean;\n children: ReactNode;\n className?: string;\n};\n\n/** 模块页 body 区整页 Spin:参与 flex 高度链,遮罩 Filter + 主工作区 */\nconst PageSpin: React.FC<PageSpinProps> = ({ spinning, children, className }) => (\n <Spin spinning={spinning} wrapperClassName={classNames(styles['page-spin'], className)}>\n {children}\n </Spin>\n);\n\nexport default PageSpin;\n"],"names":["PageSpin","spinning","children","className","jsx","Spin","classNames","styles"],"mappings":";;;;AAYA,MAAMA,IAAoC,CAAC,EAAE,UAAAC,GAAU,UAAAC,GAAU,WAAAC,QAC/D,gBAAAC,EAACC,GAAA,EAAK,UAAAJ,GAAoB,kBAAkBK,EAAWC,EAAO,WAAW,GAAGJ,CAAS,GAClF,UAAAD,EAAA,CACH;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export { default as PageHeaderLayout } from './PageHeaderLayout';
|
|
2
2
|
export type { PageHeaderLayoutProps } from './PageHeaderLayout';
|
|
3
|
+
export { default as PageSpin } from './PageSpin';
|
|
4
|
+
export type { PageSpinProps } from './PageSpin';
|
|
5
|
+
export { PageShellProvider, usePageShell, usePageShellLoading, } from './PageShell';
|
|
6
|
+
export type { PageShellMeta, PageShellProviderProps } from './PageShell';
|
|
7
|
+
export { default as ModulePageShell } from './ModulePageShell';
|
|
8
|
+
export type { ModulePageShellProps } from './ModulePageShell';
|