@gx-design-vue/pro-layout 0.1.0-alpha.2 → 0.1.0-alpha.21
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/ProLayout.d.ts +4 -536
- package/dist/ProLayout.js +489 -358
- package/dist/components/AppPage/context.d.ts +4 -3
- package/dist/components/AppPage/context.js +3 -5
- package/dist/components/AppPage/index.d.ts +29 -52
- package/dist/components/AppPage/index.js +71 -54
- package/dist/components/AppPage/style.d.ts +8 -7
- package/dist/components/AppPage/style.js +16 -17
- package/dist/components/Breadcrumb/index.d.ts +19 -0
- package/dist/components/Breadcrumb/index.js +129 -0
- package/dist/components/Breadcrumb/interface.d.ts +33 -0
- package/dist/components/Breadcrumb/interface.js +1 -0
- package/dist/components/CollapseButton/Arrow.d.ts +4 -0
- package/dist/components/{SiderMenu → CollapseButton}/Arrow.js +2 -4
- package/dist/components/CollapseButton/index.d.ts +7 -0
- package/dist/components/CollapseButton/index.js +45 -0
- package/dist/components/CollapseButton/interface.d.ts +19 -0
- package/dist/components/CollapseButton/interface.js +1 -0
- package/dist/components/Footer/index.d.ts +10 -0
- package/dist/components/Footer/index.js +69 -0
- package/dist/components/Footer/interface.d.ts +22 -0
- package/dist/components/Footer/interface.js +1 -0
- package/dist/components/FooterToolbar/index.d.ts +5 -72
- package/dist/components/FooterToolbar/index.js +77 -90
- package/dist/components/FooterToolbar/style.d.ts +10 -0
- package/dist/components/FooterToolbar/style.js +34 -0
- package/dist/components/Header/index.d.ts +7 -0
- package/dist/components/Header/index.js +140 -0
- package/dist/components/Header/interface.d.ts +41 -0
- package/dist/components/Header/interface.js +1 -0
- package/dist/components/Logo/index.d.ts +9 -0
- package/dist/components/Logo/index.js +63 -0
- package/dist/components/Logo/interface.d.ts +13 -0
- package/dist/components/Logo/interface.js +1 -0
- package/dist/components/Menu/iconRender.d.ts +10 -0
- package/dist/components/Menu/iconRender.js +23 -0
- package/dist/components/Menu/index.d.ts +13 -0
- package/dist/components/Menu/index.js +778 -0
- package/dist/components/Menu/interface.d.ts +50 -0
- package/dist/components/Menu/interface.js +9 -0
- package/dist/components/Menu/overflow.d.ts +39 -0
- package/dist/components/Menu/overflow.js +81 -0
- package/dist/components/Menu/style/base.d.ts +12 -0
- package/dist/components/Menu/style/base.js +36 -0
- package/dist/components/Menu/style/horizontal.d.ts +19 -0
- package/dist/components/Menu/style/horizontal.js +303 -0
- package/dist/components/Menu/style/index.d.ts +356 -0
- package/dist/components/Menu/style/index.js +147 -0
- package/dist/components/Menu/style/inline.d.ts +13 -0
- package/dist/components/Menu/style/inline.js +292 -0
- package/dist/components/PageContainer/PageHeader.d.ts +30 -36
- package/dist/components/PageContainer/PageHeader.js +80 -46
- package/dist/components/PageContainer/index.d.ts +8 -194
- package/dist/components/PageContainer/index.js +297 -209
- package/dist/components/PageContainer/style.d.ts +5 -0
- package/dist/components/PageContainer/style.js +142 -0
- package/dist/components/PageTransition/animate.d.ts +41 -0
- package/dist/components/PageTransition/animate.js +106 -0
- package/dist/components/PageTransition/index.d.ts +57 -0
- package/dist/components/PageTransition/index.js +66 -0
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/back.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/back.js +2 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/bounce.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/bounce.js +2 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/fade.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/fade.js +2 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/flip.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/flip.js +2 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/lightSpeed.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/lightSpeed.js +2 -4
- package/dist/components/PageTransition/keyFrame/roll.d.ts +10 -0
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/roll.js +2 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/rotate.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/rotate.js +2 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/slide.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/slide.js +2 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/zoom.d.ts +4 -4
- package/dist/components/{PageTranstion → PageTransition}/keyFrame/zoom.js +2 -4
- package/dist/components/PageTransition/style.d.ts +11 -0
- package/dist/components/{PageTranstion → PageTransition}/style.js +9 -13
- package/dist/components/Sider/index.d.ts +7 -0
- package/dist/components/Sider/index.js +206 -0
- package/dist/components/Sider/interface.d.ts +39 -0
- package/dist/components/Sider/interface.js +1 -0
- package/dist/components/Tabs/InnerTabs.d.ts +7 -0
- package/dist/components/Tabs/InnerTabs.js +117 -0
- package/dist/components/Tabs/contextMenu.d.ts +41 -0
- package/dist/components/Tabs/contextMenu.js +89 -0
- package/dist/components/Tabs/hooks/flipAnimate.d.ts +24 -0
- package/dist/components/Tabs/hooks/flipAnimate.js +40 -0
- package/dist/components/Tabs/hooks/useAutoScroll.d.ts +27 -0
- package/dist/components/Tabs/hooks/useAutoScroll.js +122 -0
- package/dist/components/Tabs/hooks/useTabDrag.d.ts +31 -0
- package/dist/components/Tabs/hooks/useTabDrag.js +252 -0
- package/dist/components/Tabs/index.d.ts +13 -0
- package/dist/components/Tabs/index.js +181 -0
- package/dist/components/Tabs/interface.d.ts +74 -0
- package/dist/components/Tabs/interface.js +1 -0
- package/dist/components/Tabs/style/index.d.ts +35 -0
- package/dist/components/Tabs/style/index.js +161 -0
- package/dist/components/WrapContent/index.d.ts +9 -0
- package/dist/components/WrapContent/index.js +26 -0
- package/dist/components/WrapContent/interface.d.ts +15 -0
- package/dist/components/WrapContent/interface.js +1 -0
- package/dist/context/index.d.ts +53 -0
- package/dist/context/index.js +5 -0
- package/dist/defaultConfig.d.ts +10 -0
- package/dist/defaultConfig.js +38 -0
- package/dist/hooks/useLayoutBase.d.ts +78 -0
- package/dist/hooks/useLayoutBase.js +86 -0
- package/dist/hooks/useMenu.d.ts +77 -0
- package/dist/hooks/useMenu.js +166 -0
- package/dist/hooks/useTabs.d.ts +54 -0
- package/dist/hooks/useTabs.js +388 -0
- package/dist/index.d.ts +22 -27
- package/dist/index.js +15 -24
- package/dist/interface.d.ts +516 -0
- package/dist/interface.js +34 -0
- package/dist/pro-layout.esm.js +5848 -5075
- package/dist/pro-layout.js +16 -37
- package/dist/style/breadcrumb.d.ts +8 -0
- package/dist/style/breadcrumb.js +77 -0
- package/dist/style/collapseButton.d.ts +8 -0
- package/dist/style/collapseButton.js +57 -0
- package/dist/style/content.d.ts +8 -0
- package/dist/style/content.js +29 -0
- package/dist/style/footer.d.ts +8 -0
- package/dist/style/footer.js +33 -0
- package/dist/style/header.d.ts +8 -0
- package/dist/style/header.js +76 -0
- package/dist/style/index.d.ts +3 -22
- package/dist/style/index.js +51 -55
- package/dist/style/logo.d.ts +8 -0
- package/dist/style/logo.js +76 -0
- package/dist/style/menu.d.ts +15 -0
- package/dist/style/menu.js +49 -0
- package/dist/style/rightContent.d.ts +12 -0
- package/dist/style/rightContent.js +74 -0
- package/dist/style/search.d.ts +12 -0
- package/dist/style/search.js +94 -0
- package/dist/style/sider.d.ts +8 -0
- package/dist/style/sider.js +92 -0
- package/dist/style/tabs.d.ts +14 -0
- package/dist/style/tabs.js +97 -0
- package/dist/theme/augment.d.ts +20 -0
- package/dist/theme/augment.js +1 -0
- package/dist/theme/interface/components.d.ts +20 -0
- package/dist/theme/interface/components.js +1 -0
- package/dist/utils/config.d.ts +12 -0
- package/dist/utils/config.js +18 -0
- package/dist/utils/menu.d.ts +111 -20
- package/dist/utils/menu.js +263 -118
- package/dist/utils/style.d.ts +4 -0
- package/dist/utils/style.js +21 -0
- package/dist/utils/themeComponents.d.ts +28 -0
- package/dist/utils/themeComponents.js +89 -0
- package/package.json +24 -15
- package/dist/Context/expose.d.ts +0 -6
- package/dist/Context/expose.js +0 -7
- package/dist/Context/index.d.ts +0 -43
- package/dist/Context/index.js +0 -18
- package/dist/WrapContent.d.ts +0 -100
- package/dist/WrapContent.js +0 -45
- package/dist/components/BaseMenu/index.d.ts +0 -255
- package/dist/components/BaseMenu/index.js +0 -381
- package/dist/components/BaseMenu/props.d.ts +0 -105
- package/dist/components/BaseMenu/props.js +0 -94
- package/dist/components/BaseMenu/style.d.ts +0 -6
- package/dist/components/BaseMenu/style.js +0 -155
- package/dist/components/BreadCrumb/Breadcrumb.d.ts +0 -33
- package/dist/components/BreadCrumb/Breadcrumb.js +0 -75
- package/dist/components/BreadCrumb/index.d.ts +0 -7
- package/dist/components/BreadCrumb/index.js +0 -44
- package/dist/components/BreadCrumb/style.d.ts +0 -8
- package/dist/components/BreadCrumb/style.js +0 -87
- package/dist/components/CollapsedIcon/index.d.ts +0 -33
- package/dist/components/CollapsedIcon/index.js +0 -51
- package/dist/components/CollapsedIcon/style.d.ts +0 -9
- package/dist/components/CollapsedIcon/style.js +0 -34
- package/dist/components/FooterToolbar/props.d.ts +0 -47
- package/dist/components/FooterToolbar/props.js +0 -33
- package/dist/components/FooterToolbar/style/index.d.ts +0 -14
- package/dist/components/FooterToolbar/style/index.js +0 -48
- package/dist/components/FooterToolbar/style/stylish.d.ts +0 -18
- package/dist/components/FooterToolbar/style/stylish.js +0 -16
- package/dist/components/GlobalFooter/index.d.ts +0 -73
- package/dist/components/GlobalFooter/index.js +0 -77
- package/dist/components/GlobalFooter/style.d.ts +0 -6
- package/dist/components/GlobalFooter/style.js +0 -29
- package/dist/components/GlobalHeader/DefaultHeader.d.ts +0 -164
- package/dist/components/GlobalHeader/DefaultHeader.js +0 -149
- package/dist/components/GlobalHeader/index.d.ts +0 -164
- package/dist/components/GlobalHeader/index.js +0 -78
- package/dist/components/GlobalHeader/props.d.ts +0 -70
- package/dist/components/GlobalHeader/props.js +0 -56
- package/dist/components/GlobalHeader/style/defaultHeader.d.ts +0 -6
- package/dist/components/GlobalHeader/style/defaultHeader.js +0 -108
- package/dist/components/GlobalHeader/style/header.d.ts +0 -6
- package/dist/components/GlobalHeader/style/header.js +0 -41
- package/dist/components/LogoContent/index.d.ts +0 -80
- package/dist/components/LogoContent/index.js +0 -90
- package/dist/components/LogoContent/props.d.ts +0 -57
- package/dist/components/LogoContent/props.js +0 -37
- package/dist/components/LogoContent/style.d.ts +0 -6
- package/dist/components/LogoContent/style.js +0 -63
- package/dist/components/PageContainer/props.d.ts +0 -138
- package/dist/components/PageContainer/props.js +0 -103
- package/dist/components/PageContainer/style/index.d.ts +0 -14
- package/dist/components/PageContainer/style/index.js +0 -52
- package/dist/components/PageContainer/style/pageHeader.d.ts +0 -6
- package/dist/components/PageContainer/style/pageHeader.js +0 -44
- package/dist/components/PageTranstion/index.d.ts +0 -40
- package/dist/components/PageTranstion/index.js +0 -71
- package/dist/components/PageTranstion/keyFrame/roll.d.ts +0 -10
- package/dist/components/PageTranstion/style.d.ts +0 -10
- package/dist/components/SiderMenu/Arrow.d.ts +0 -6
- package/dist/components/SiderMenu/SiderMenu.d.ts +0 -180
- package/dist/components/SiderMenu/SiderMenu.js +0 -265
- package/dist/components/SiderMenu/index.d.ts +0 -193
- package/dist/components/SiderMenu/index.js +0 -51
- package/dist/components/SiderMenu/props.d.ts +0 -77
- package/dist/components/SiderMenu/props.js +0 -67
- package/dist/components/SiderMenu/style/index.d.ts +0 -12
- package/dist/components/SiderMenu/style/index.js +0 -162
- package/dist/components/SiderMenu/typings.d.ts +0 -38
- package/dist/components/SiderMenu/typings.js +0 -1
- package/dist/components/TabsRoute/index.d.ts +0 -95
- package/dist/components/TabsRoute/index.js +0 -405
- package/dist/components/TabsRoute/props.d.ts +0 -78
- package/dist/components/TabsRoute/props.js +0 -47
- package/dist/components/TabsRoute/style.d.ts +0 -15
- package/dist/components/TabsRoute/style.js +0 -133
- package/dist/components/TabsRoute/utils/config.d.ts +0 -18
- package/dist/components/TabsRoute/utils/config.js +0 -64
- package/dist/config/animate.d.ts +0 -11
- package/dist/config/animate.js +0 -76
- package/dist/config/index.d.ts +0 -34
- package/dist/config/index.js +0 -30
- package/dist/hooks/collapsed/index.d.ts +0 -15
- package/dist/hooks/collapsed/index.js +0 -50
- package/dist/hooks/layout/useLayoutExpose.d.ts +0 -15
- package/dist/hooks/layout/useLayoutExpose.js +0 -22
- package/dist/hooks/layout/usePageContent.d.ts +0 -6
- package/dist/hooks/layout/usePageContent.js +0 -28
- package/dist/hooks/menu/context.d.ts +0 -21
- package/dist/hooks/menu/context.js +0 -7
- package/dist/hooks/menu/index.d.ts +0 -29
- package/dist/hooks/menu/index.js +0 -118
- package/dist/hooks/theme/index.d.ts +0 -11
- package/dist/hooks/theme/index.js +0 -13
- package/dist/props/collapsedProps.d.ts +0 -39
- package/dist/props/collapsedProps.js +0 -45
- package/dist/props/defaultSettings.d.ts +0 -62
- package/dist/props/defaultSettings.js +0 -56
- package/dist/props/index.d.ts +0 -226
- package/dist/props/index.js +0 -109
- package/dist/props/themeProps.d.ts +0 -14
- package/dist/props/themeProps.js +0 -10
- package/dist/types/Breadcrumb.d.ts +0 -22
- package/dist/types/Breadcrumb.js +0 -1
- package/dist/types/MenuTypings.d.ts +0 -46
- package/dist/types/MenuTypings.js +0 -1
- package/dist/types/RouteTypings.d.ts +0 -96
- package/dist/types/RouteTypings.js +0 -1
- package/dist/types/SlotsTypings.d.ts +0 -124
- package/dist/types/SlotsTypings.js +0 -32
- package/dist/types/typings.d.ts +0 -73
- package/dist/types/typings.js +0 -3
- package/dist/utils/index.d.ts +0 -7
- package/dist/utils/index.js +0 -17
- package/dist/utils/style/index.d.ts +0 -44
- package/dist/utils/style/index.js +0 -103
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GetDefaultToken } from "antdv-next/dist/theme/internal";
|
|
2
|
+
|
|
3
|
+
//#region src/components/Tabs/style/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* InnerTabs 组件级 Token —— 仅承载尺寸相关字段;
|
|
6
|
+
* 卡片配色复用全局扁平 token `tabsColor*`(见 pro-provider/theme),保持与 layout 主题一致。
|
|
7
|
+
*/
|
|
8
|
+
interface ComponentToken {
|
|
9
|
+
/** 单个页签高度 */
|
|
10
|
+
itemHeight: number | string;
|
|
11
|
+
/** 页签横向内边距 */
|
|
12
|
+
itemPaddingInline: number | string;
|
|
13
|
+
/** 页签纵向内边距 */
|
|
14
|
+
itemPaddingBlock: number | string;
|
|
15
|
+
/** 页签间距 */
|
|
16
|
+
itemGap: number | string;
|
|
17
|
+
/** 页签圆角 */
|
|
18
|
+
itemBorderRadius: number | string;
|
|
19
|
+
/** 标题字号 */
|
|
20
|
+
titleFontSize: number;
|
|
21
|
+
/** 标题最大宽度(超出省略) */
|
|
22
|
+
titleMaxWidth: number | string;
|
|
23
|
+
/** 关闭按钮尺寸 */
|
|
24
|
+
closeIconSize: number | string;
|
|
25
|
+
/** 关闭按钮命中区域尺寸 */
|
|
26
|
+
closeIconBoxSize: number | string;
|
|
27
|
+
/** 导航栏纵向内边距 */
|
|
28
|
+
navPaddingBlock: number | string;
|
|
29
|
+
/** 导航栏横向内边距 */
|
|
30
|
+
navPaddingInline: number | string;
|
|
31
|
+
}
|
|
32
|
+
declare const prepareComponentToken: GetDefaultToken<'InnerTabs'>;
|
|
33
|
+
declare const _default: (prefixCls: import("vue").Ref<string>, rootCls?: import("vue").Ref<string | undefined>) => readonly [import("vue").Ref<string, string>, import("vue").ComputedRef<string | undefined>];
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ComponentToken, _default as default, prepareComponentToken };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { proGenStyleHooks } from "@gx-design-vue/pro-provider";
|
|
2
|
+
import { unit as unit$1 } from "@antdv-next/cssinjs";
|
|
3
|
+
//#region src/components/Tabs/style/index.ts
|
|
4
|
+
const prepareComponentToken = (token) => ({
|
|
5
|
+
itemHeight: token.controlHeightSM,
|
|
6
|
+
itemPaddingInline: token.paddingXS,
|
|
7
|
+
itemPaddingBlock: 2,
|
|
8
|
+
itemGap: token.marginXS,
|
|
9
|
+
itemBorderRadius: token.borderRadiusSM,
|
|
10
|
+
titleFontSize: token.fontSizeSM,
|
|
11
|
+
titleMaxWidth: 120,
|
|
12
|
+
closeIconSize: token.fontSizeSM,
|
|
13
|
+
closeIconBoxSize: token.controlHeightXS,
|
|
14
|
+
navPaddingBlock: token.paddingXXS,
|
|
15
|
+
navPaddingInline: token.paddingSM
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* InnerTabs 样式:横向卡片式页签条(default / active 双态),无底部 ink-bar。
|
|
19
|
+
* 颜色取自扁平 token `tabsColor*`;mask-image 溢出淡出由组件内联 style 动态控制。
|
|
20
|
+
*/
|
|
21
|
+
const genInnerTabsStyle = (token) => {
|
|
22
|
+
const { componentCls } = token;
|
|
23
|
+
return { [componentCls]: {
|
|
24
|
+
display: "flex",
|
|
25
|
+
minWidth: 0,
|
|
26
|
+
[`${componentCls}-nav`]: {
|
|
27
|
+
position: "relative",
|
|
28
|
+
display: "flex",
|
|
29
|
+
flex: "1 1 auto",
|
|
30
|
+
minWidth: 0,
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
paddingBlock: token.navPaddingBlock
|
|
33
|
+
},
|
|
34
|
+
[`${componentCls}-nav-wrap`]: {
|
|
35
|
+
position: "relative",
|
|
36
|
+
flex: "1 1 auto",
|
|
37
|
+
minWidth: 0,
|
|
38
|
+
marginBlock: token.calc(token.marginXXS).mul(-1).equal(),
|
|
39
|
+
paddingBlock: token.marginXXS,
|
|
40
|
+
overflowX: "auto",
|
|
41
|
+
overflowY: "hidden",
|
|
42
|
+
overflowAnchor: "none",
|
|
43
|
+
whiteSpace: "nowrap",
|
|
44
|
+
scrollbarWidth: "none",
|
|
45
|
+
msOverflowStyle: "none",
|
|
46
|
+
"&::-webkit-scrollbar": { display: "none" }
|
|
47
|
+
},
|
|
48
|
+
[`${componentCls}-nav-list`]: {
|
|
49
|
+
display: "inline-flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
gap: token.itemGap,
|
|
52
|
+
overflowAnchor: "none"
|
|
53
|
+
},
|
|
54
|
+
[`${componentCls}-tab`]: {
|
|
55
|
+
display: "inline-flex",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
flex: "none",
|
|
58
|
+
boxSizing: "border-box",
|
|
59
|
+
height: token.itemHeight,
|
|
60
|
+
paddingInline: token.itemPaddingInline,
|
|
61
|
+
paddingBlock: token.itemPaddingBlock,
|
|
62
|
+
fontSize: token.titleFontSize,
|
|
63
|
+
lineHeight: 1,
|
|
64
|
+
color: token.tabsColorText,
|
|
65
|
+
backgroundColor: token.tabsColorBgContainer,
|
|
66
|
+
border: `${unit$1(token.lineWidth)} ${token.lineType} ${token.tabsColorBorder}`,
|
|
67
|
+
borderRadius: token.itemBorderRadius,
|
|
68
|
+
cursor: "pointer",
|
|
69
|
+
userSelect: "none",
|
|
70
|
+
transition: [
|
|
71
|
+
`color ${token.motionDurationMid} ${token.motionEaseInOut}`,
|
|
72
|
+
`background-color ${token.motionDurationMid} ${token.motionEaseInOut}`,
|
|
73
|
+
`border-color ${token.motionDurationMid} ${token.motionEaseInOut}`,
|
|
74
|
+
`box-shadow ${token.motionDurationMid} ${token.motionEaseInOut}`
|
|
75
|
+
].join(", "),
|
|
76
|
+
"&:hover": {
|
|
77
|
+
borderColor: token.tabsColorBorderHover,
|
|
78
|
+
backgroundColor: token.tabsColorBgContainerHover
|
|
79
|
+
},
|
|
80
|
+
[`&${componentCls}-tab-active`]: {
|
|
81
|
+
color: token.tabsColorTextActive,
|
|
82
|
+
borderColor: token.tabsColorBorderActive,
|
|
83
|
+
backgroundColor: token.tabsColorBgContainerActive,
|
|
84
|
+
"&:hover": {
|
|
85
|
+
color: token.tabsColorTextActive,
|
|
86
|
+
borderColor: token.tabsColorBorderActive,
|
|
87
|
+
backgroundColor: token.tabsColorBgContainerActive
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
[`&${componentCls}-tab-disabled`]: {
|
|
91
|
+
color: token.colorTextDisabled,
|
|
92
|
+
cursor: "not-allowed"
|
|
93
|
+
},
|
|
94
|
+
[`&${componentCls}-tab-dragging`]: {
|
|
95
|
+
zIndex: 1,
|
|
96
|
+
cursor: "grabbing",
|
|
97
|
+
color: token.tabsColorText,
|
|
98
|
+
backgroundColor: token.colorBgElevated,
|
|
99
|
+
borderColor: token.tabsColorBorderHover,
|
|
100
|
+
boxShadow: token.boxShadowSecondary,
|
|
101
|
+
opacity: 1,
|
|
102
|
+
transition: "none"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
[`${componentCls}-tab${componentCls}-tab-active`]: {
|
|
106
|
+
color: token.tabsColorTextActive,
|
|
107
|
+
borderColor: token.tabsColorBorderActive,
|
|
108
|
+
".ant-pro-layout-tabs-title-text": { color: token.tabsColorTextActive },
|
|
109
|
+
".ant-pro-layout-tabs-title-close": { color: token.tabsColorCloseIconActive }
|
|
110
|
+
},
|
|
111
|
+
[`${componentCls}-tab${componentCls}-tab-active:hover`]: {
|
|
112
|
+
color: token.tabsColorTextActive,
|
|
113
|
+
borderColor: token.tabsColorBorderActive
|
|
114
|
+
},
|
|
115
|
+
[`${componentCls}-tab-btn`]: {
|
|
116
|
+
display: "inline-block",
|
|
117
|
+
maxWidth: token.titleMaxWidth,
|
|
118
|
+
overflow: "hidden",
|
|
119
|
+
whiteSpace: "nowrap",
|
|
120
|
+
textOverflow: "ellipsis",
|
|
121
|
+
verticalAlign: "middle",
|
|
122
|
+
transition: `color ${token.motionDurationMid}`
|
|
123
|
+
},
|
|
124
|
+
[`${componentCls}-tab-close, ${componentCls}-tab-remove`]: {
|
|
125
|
+
display: "inline-flex",
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
justifyContent: "center",
|
|
128
|
+
flex: "0 0 auto",
|
|
129
|
+
width: token.closeIconBoxSize,
|
|
130
|
+
height: token.closeIconBoxSize,
|
|
131
|
+
marginInlineStart: token.marginXXS,
|
|
132
|
+
padding: 0,
|
|
133
|
+
fontSize: token.closeIconSize,
|
|
134
|
+
lineHeight: 1,
|
|
135
|
+
color: token.tabsColorCloseIcon,
|
|
136
|
+
borderRadius: token.borderRadiusSM,
|
|
137
|
+
cursor: "pointer",
|
|
138
|
+
transition: `all ${token.motionDurationMid}`,
|
|
139
|
+
"&:hover": {
|
|
140
|
+
color: token.tabsColorCloseIconHover,
|
|
141
|
+
backgroundColor: token.tabsColorCloseBgHover
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
[`${componentCls}-tab-active ${componentCls}-tab-close, ${componentCls}-tab-active ${componentCls}-tab-remove`]: {
|
|
145
|
+
color: token.tabsColorCloseIconActive,
|
|
146
|
+
"&:hover": {
|
|
147
|
+
color: token.tabsColorCloseIconActive,
|
|
148
|
+
backgroundColor: token.tabsColorCloseBgActiveHover
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
[`${componentCls}-extra`]: {
|
|
152
|
+
display: "inline-flex",
|
|
153
|
+
flex: "none",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
marginInlineStart: token.marginSM
|
|
156
|
+
}
|
|
157
|
+
} };
|
|
158
|
+
};
|
|
159
|
+
var style_default = proGenStyleHooks("InnerTabs", genInnerTabsStyle, prepareComponentToken);
|
|
160
|
+
//#endregion
|
|
161
|
+
export { style_default as default, prepareComponentToken };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LayoutContentEmits, LayoutContentProps, LayoutContentSlots } from "./interface.js";
|
|
2
|
+
import { SlotsType } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/components/WrapContent/index.d.ts
|
|
5
|
+
declare const WrapContent: import("vue").DefineSetupFnComponent<LayoutContentProps, LayoutContentEmits, SlotsType<LayoutContentSlots>, LayoutContentProps & {
|
|
6
|
+
[x: `on${Capitalize<string>}`]: (...args: unknown[]) => any;
|
|
7
|
+
}, import("vue").PublicProps>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { WrapContent as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useLayoutBase } from "../../hooks/useLayoutBase.js";
|
|
2
|
+
import { computed, createVNode, defineComponent } from "vue";
|
|
3
|
+
import { classNames } from "@gx-design-vue/pro-utils";
|
|
4
|
+
import { LayoutContent, Spin } from "antdv-next";
|
|
5
|
+
//#region src/components/WrapContent/index.tsx
|
|
6
|
+
const WrapContent = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
7
|
+
const { prefixCls, hasFooterToolbar, proClasses, proStyles } = useLayoutBase();
|
|
8
|
+
const contentClassNames = computed(() => classNames(`${prefixCls.value}-content`, proClasses.value.content, { [`${prefixCls.value}-content-has-footer-toolbar`]: hasFooterToolbar.value }));
|
|
9
|
+
return () => createVNode(LayoutContent, {
|
|
10
|
+
"class": contentClassNames.value,
|
|
11
|
+
"style": proStyles.value.content
|
|
12
|
+
}, { default: () => [createVNode("div", { "class": `${prefixCls.value}-content-inner` }, [props.loading != null && props.loading !== false && createVNode(Spin, {
|
|
13
|
+
"spinning": true,
|
|
14
|
+
"tip": void 0
|
|
15
|
+
}, null), slots.default?.()])] });
|
|
16
|
+
}, {
|
|
17
|
+
props: { loading: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
required: false,
|
|
20
|
+
default: void 0
|
|
21
|
+
} },
|
|
22
|
+
name: "WrapContent",
|
|
23
|
+
inheritAttrs: false
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { WrapContent as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LayoutBreadcrumbSlotProps } from "../../interface.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/WrapContent/interface.d.ts
|
|
4
|
+
type LayoutContentEmits = Record<string, never>;
|
|
5
|
+
interface LayoutContentEmitsProps {}
|
|
6
|
+
interface LayoutContentProps {
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface LayoutContentSlots {
|
|
10
|
+
default?: () => any;
|
|
11
|
+
/** 面包屑整块自定义(存在时整块替换默认面包屑) */
|
|
12
|
+
breadcrumb?: (props: LayoutBreadcrumbSlotProps) => any;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { LayoutContentEmits, LayoutContentEmitsProps, LayoutContentProps, LayoutContentSlots };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { GProLayoutProps, GProLayoutSlots, LayoutBreadcrumbConfig, LayoutClassNamesType, LayoutCollapseConfig, LayoutHeaderConfig, LayoutLogoConfig, LayoutPageContainerConfig, LayoutSiderConfig, LayoutStylesType, Meta } from "../interface.js";
|
|
2
|
+
import { LayoutMenuState } from "../hooks/useMenu.js";
|
|
3
|
+
import { UseTabsStateReturn } from "../hooks/useTabs.js";
|
|
4
|
+
import { ComputedRef, Ref } from "vue";
|
|
5
|
+
import { WatermarkProps } from "antdv-next";
|
|
6
|
+
|
|
7
|
+
//#region src/context/index.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* 布局上下文:由 `GProLayout` 计算后单向下发给内部组件 inject。
|
|
10
|
+
* 容器组件(如 GPageContainer)只读,不再反向修改。
|
|
11
|
+
*/
|
|
12
|
+
interface LayoutContextProps {
|
|
13
|
+
layout: ComputedRef<GProLayoutProps['layout']>;
|
|
14
|
+
header: ComputedRef<Required<LayoutHeaderConfig>>;
|
|
15
|
+
sider: ComputedRef<Required<LayoutSiderConfig>>;
|
|
16
|
+
logoConfig: ComputedRef<LayoutLogoConfig | null>;
|
|
17
|
+
siderWidth: ComputedRef<LayoutSiderConfig['width']>;
|
|
18
|
+
collapsedWidth: ComputedRef<LayoutCollapseConfig['width']>;
|
|
19
|
+
menuState: LayoutMenuState;
|
|
20
|
+
watermark: ComputedRef<WatermarkProps>;
|
|
21
|
+
breadcrumbConfig: ComputedRef<LayoutBreadcrumbConfig | null>;
|
|
22
|
+
pageContainerConfig: ComputedRef<LayoutPageContainerConfig>;
|
|
23
|
+
proStyles: ComputedRef<LayoutStylesType>;
|
|
24
|
+
proClasses: ComputedRef<LayoutClassNamesType>;
|
|
25
|
+
collapsed: Ref<boolean>;
|
|
26
|
+
collapseConfig: ComputedRef<LayoutCollapseConfig | null>;
|
|
27
|
+
isMobile: ComputedRef<boolean>;
|
|
28
|
+
contentFullscreen: Ref<boolean>;
|
|
29
|
+
renderRouterView: Ref<boolean>;
|
|
30
|
+
zIndex: Ref<number>;
|
|
31
|
+
currentMeta: ComputedRef<Meta>;
|
|
32
|
+
prefixCls: ComputedRef<string>;
|
|
33
|
+
hashId: Ref<string>;
|
|
34
|
+
cssVarCls: ComputedRef<string>;
|
|
35
|
+
rootCls: ComputedRef<string>;
|
|
36
|
+
hasFooterToolbar: Ref<boolean>;
|
|
37
|
+
tabsHeight: Ref<number>;
|
|
38
|
+
setTabsHeight: (value: number) => void;
|
|
39
|
+
/**
|
|
40
|
+
* PageContainer 级别的面包屑 slot 覆盖。
|
|
41
|
+
* 当 position='header' 时,PageContainer 的 breadcrumb slot 通过此 ref 传到 Header。
|
|
42
|
+
* Header 读取优先级:breadcrumbSlotOverride > ProLayout slot > 默认 Breadcrumb 组件。
|
|
43
|
+
*/
|
|
44
|
+
breadcrumbRender: Ref<GProLayoutSlots['breadcrumb'] | null>;
|
|
45
|
+
getPrefixCls: (suffixCls?: string) => string;
|
|
46
|
+
setHasFooterToolbar: (value: boolean) => void;
|
|
47
|
+
/** 导航到指定菜单名 */
|
|
48
|
+
navigate: (name: string) => void;
|
|
49
|
+
tabsState?: UseTabsStateReturn;
|
|
50
|
+
}
|
|
51
|
+
declare const useProvideLayoutContext: (ctx: LayoutContextProps) => LayoutContextProps, useInjectLayoutContext: () => LayoutContextProps;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { LayoutContextProps, useInjectLayoutContext, useProvideLayoutContext };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GProLayoutProps } from "./interface.js";
|
|
2
|
+
|
|
3
|
+
//#region src/defaultConfig.d.ts
|
|
4
|
+
type LayoutDefaultConfigSection<K extends keyof GProLayoutProps> = Partial<Exclude<NonNullable<GProLayoutProps[K]>, false>>;
|
|
5
|
+
type LayoutDefaultConfig = { [K in keyof Pick<GProLayoutProps, 'header' | 'sider' | 'footerConfig' | 'breadcrumb' | 'tabsConfig' | 'collapse' | 'logo' | 'pageContainer'>]: LayoutDefaultConfigSection<K> } & {
|
|
6
|
+
layout: GProLayoutProps['layout'];
|
|
7
|
+
};
|
|
8
|
+
declare const DEFAULT_LAYOUT_CONFIG: LayoutDefaultConfig;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DEFAULT_LAYOUT_CONFIG };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/defaultConfig.ts
|
|
2
|
+
const DEFAULT_LAYOUT_CONFIG = {
|
|
3
|
+
layout: "side",
|
|
4
|
+
header: {
|
|
5
|
+
height: 48,
|
|
6
|
+
fixed: true,
|
|
7
|
+
autoHide: false,
|
|
8
|
+
mainWidth: "100%"
|
|
9
|
+
},
|
|
10
|
+
sider: {
|
|
11
|
+
width: 215,
|
|
12
|
+
fixed: true,
|
|
13
|
+
breakpoint: false
|
|
14
|
+
},
|
|
15
|
+
footerConfig: {
|
|
16
|
+
links: [],
|
|
17
|
+
copyright: ""
|
|
18
|
+
},
|
|
19
|
+
breadcrumb: {
|
|
20
|
+
placement: "header",
|
|
21
|
+
showHome: true,
|
|
22
|
+
homePath: "/"
|
|
23
|
+
},
|
|
24
|
+
tabsConfig: {
|
|
25
|
+
type: "button",
|
|
26
|
+
fixed: true,
|
|
27
|
+
persistent: true,
|
|
28
|
+
fullscreenOnHide: false
|
|
29
|
+
},
|
|
30
|
+
collapse: {
|
|
31
|
+
width: 64,
|
|
32
|
+
placement: "sider"
|
|
33
|
+
},
|
|
34
|
+
logo: { title: "Antdv Next Pro" },
|
|
35
|
+
pageContainer: {}
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { DEFAULT_LAYOUT_CONFIG };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { LayoutBreadcrumbConfig, LayoutBreadcrumbSlotProps, LayoutCollapseConfig, LayoutHeaderConfig, LayoutLogoConfig, LayoutPageContainerConfig, LayoutSiderConfig } from "../interface.js";
|
|
2
|
+
import { LayoutMenuState } from "./useMenu.js";
|
|
3
|
+
import { UseTabsStateReturn } from "./useTabs.js";
|
|
4
|
+
import { LayoutContextProps } from "../context/index.js";
|
|
5
|
+
//#region src/hooks/useLayoutBase.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 从 LayoutContext 提取 Header / Sider 等子组件共享的基础响应式状态,
|
|
8
|
+
* 避免在每个组件中重复相同的解构与 computed 声明。
|
|
9
|
+
*/
|
|
10
|
+
declare function useLayoutBase(props?: {
|
|
11
|
+
proClasses?: Record<string, any>;
|
|
12
|
+
proStyles?: Record<string, any>;
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
}): {
|
|
15
|
+
layoutContext: LayoutContextProps;
|
|
16
|
+
layout: import("vue").ComputedRef<"top" | "side" | "mix" | "wide" | "simple">;
|
|
17
|
+
sider: import("vue").ComputedRef<Required<LayoutSiderConfig>>;
|
|
18
|
+
header: import("vue").ComputedRef<Required<LayoutHeaderConfig>>;
|
|
19
|
+
zIndex: import("vue").Ref<number, number>;
|
|
20
|
+
watermark: import("vue").ComputedRef<import("antdv-next").WatermarkProps>;
|
|
21
|
+
tabsState: UseTabsStateReturn;
|
|
22
|
+
tabsHeight: import("vue").Ref<number, number>;
|
|
23
|
+
setTabsHeight: (value: number) => void;
|
|
24
|
+
prefixCls: import("vue").ComputedRef<string>;
|
|
25
|
+
hashId: import("vue").Ref<string, string>;
|
|
26
|
+
cssVarCls: import("vue").ComputedRef<string>;
|
|
27
|
+
rootCls: import("vue").ComputedRef<string>;
|
|
28
|
+
menuState: LayoutMenuState;
|
|
29
|
+
siderWidth: import("vue").ComputedRef<string | number>;
|
|
30
|
+
collapsedWidth: import("vue").ComputedRef<number>;
|
|
31
|
+
collapseConfig: import("vue").ComputedRef<LayoutCollapseConfig>;
|
|
32
|
+
contentFullscreen: import("vue").Ref<boolean, boolean>;
|
|
33
|
+
renderRouterView: import("vue").Ref<boolean, boolean>;
|
|
34
|
+
collapsed: import("vue").ComputedRef<boolean>;
|
|
35
|
+
isMobile: import("vue").ComputedRef<boolean>;
|
|
36
|
+
logoConfig: import("vue").ComputedRef<LayoutLogoConfig>;
|
|
37
|
+
logoTitle: import("vue").ComputedRef<string>;
|
|
38
|
+
selectedKeys: import("vue").ComputedRef<string[]>;
|
|
39
|
+
openKeys: import("vue").ComputedRef<string[]>;
|
|
40
|
+
proClasses: import("vue").ComputedRef<{
|
|
41
|
+
siderHeader?: string;
|
|
42
|
+
siderFooter?: string;
|
|
43
|
+
footer?: string;
|
|
44
|
+
header?: string;
|
|
45
|
+
breadcrumb?: string;
|
|
46
|
+
sider?: string;
|
|
47
|
+
logo?: string;
|
|
48
|
+
content?: string;
|
|
49
|
+
root?: string;
|
|
50
|
+
siderChildren?: string;
|
|
51
|
+
logoImage?: string;
|
|
52
|
+
menu?: string;
|
|
53
|
+
tabs?: string;
|
|
54
|
+
}>;
|
|
55
|
+
proStyles: import("vue").ComputedRef<{
|
|
56
|
+
siderHeader?: import("vue").CSSProperties;
|
|
57
|
+
siderFooter?: import("vue").CSSProperties;
|
|
58
|
+
footer?: import("vue").CSSProperties;
|
|
59
|
+
header?: import("vue").CSSProperties;
|
|
60
|
+
breadcrumb?: import("vue").CSSProperties;
|
|
61
|
+
sider?: import("vue").CSSProperties;
|
|
62
|
+
logo?: import("vue").CSSProperties;
|
|
63
|
+
content?: import("vue").CSSProperties;
|
|
64
|
+
root?: import("vue").CSSProperties;
|
|
65
|
+
siderChildren?: import("vue").CSSProperties;
|
|
66
|
+
logoImage?: import("vue").CSSProperties;
|
|
67
|
+
menu?: import("vue").CSSProperties;
|
|
68
|
+
tabs?: import("vue").CSSProperties;
|
|
69
|
+
}>;
|
|
70
|
+
breadcrumbRender: import("vue").Ref<(props: LayoutBreadcrumbSlotProps) => any, (props: LayoutBreadcrumbSlotProps) => any>;
|
|
71
|
+
breadcrumbConfig: import("vue").ComputedRef<LayoutBreadcrumbConfig>;
|
|
72
|
+
pageContainerConfig: import("vue").ComputedRef<LayoutPageContainerConfig>;
|
|
73
|
+
hasFooterToolbar: import("vue").ComputedRef<boolean>;
|
|
74
|
+
navigate: (name: string) => void;
|
|
75
|
+
setHasFooterToolbar: (value: boolean) => void;
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { useLayoutBase };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useInjectLayoutContext } from "../context/index.js";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
//#region src/hooks/useLayoutBase.ts
|
|
4
|
+
/**
|
|
5
|
+
* 从 LayoutContext 提取 Header / Sider 等子组件共享的基础响应式状态,
|
|
6
|
+
* 避免在每个组件中重复相同的解构与 computed 声明。
|
|
7
|
+
*/
|
|
8
|
+
function useLayoutBase(props) {
|
|
9
|
+
const layoutContext = useInjectLayoutContext();
|
|
10
|
+
const sider = layoutContext?.sider;
|
|
11
|
+
const header = layoutContext?.header;
|
|
12
|
+
const zIndex = layoutContext?.zIndex;
|
|
13
|
+
const prefixCls = layoutContext?.prefixCls;
|
|
14
|
+
const hashId = layoutContext?.hashId;
|
|
15
|
+
const cssVarCls = layoutContext?.cssVarCls;
|
|
16
|
+
const rootCls = layoutContext?.rootCls;
|
|
17
|
+
const watermark = layoutContext?.watermark;
|
|
18
|
+
const menuState = layoutContext?.menuState;
|
|
19
|
+
const tabsState = layoutContext?.tabsState;
|
|
20
|
+
const tabsHeight = layoutContext?.tabsHeight;
|
|
21
|
+
const setTabsHeight = layoutContext?.setTabsHeight;
|
|
22
|
+
const siderWidth = layoutContext?.siderWidth;
|
|
23
|
+
const collapsedWidth = layoutContext?.collapsedWidth;
|
|
24
|
+
const breadcrumbRender = layoutContext?.breadcrumbRender;
|
|
25
|
+
const breadcrumbConfig = layoutContext?.breadcrumbConfig;
|
|
26
|
+
const pageContainerConfig = layoutContext?.pageContainerConfig;
|
|
27
|
+
const collapseConfig = layoutContext?.collapseConfig;
|
|
28
|
+
const contentFullscreen = layoutContext?.contentFullscreen;
|
|
29
|
+
const renderRouterView = layoutContext?.renderRouterView;
|
|
30
|
+
const navigate = layoutContext?.navigate;
|
|
31
|
+
const setHasFooterToolbar = layoutContext?.setHasFooterToolbar;
|
|
32
|
+
const layout = computed(() => layoutContext?.layout.value);
|
|
33
|
+
const collapsed = computed(() => props?.collapsed ?? layoutContext?.collapsed.value ?? false);
|
|
34
|
+
const isMobile = computed(() => layoutContext?.isMobile.value ?? false);
|
|
35
|
+
const logoConfig = computed(() => layoutContext?.logoConfig.value);
|
|
36
|
+
const logoTitle = computed(() => {
|
|
37
|
+
if (!logoConfig.value) return void 0;
|
|
38
|
+
return logoConfig.value.title;
|
|
39
|
+
});
|
|
40
|
+
const selectedKeys = computed(() => layoutContext?.menuState?.selectedKeys.value ?? []);
|
|
41
|
+
const openKeys = computed(() => layoutContext?.menuState?.openKeys.value ?? []);
|
|
42
|
+
const hasFooterToolbar = computed(() => layoutContext?.hasFooterToolbar?.value ?? false);
|
|
43
|
+
return {
|
|
44
|
+
layoutContext,
|
|
45
|
+
layout,
|
|
46
|
+
sider,
|
|
47
|
+
header,
|
|
48
|
+
zIndex,
|
|
49
|
+
watermark,
|
|
50
|
+
tabsState,
|
|
51
|
+
tabsHeight,
|
|
52
|
+
setTabsHeight,
|
|
53
|
+
prefixCls,
|
|
54
|
+
hashId,
|
|
55
|
+
cssVarCls,
|
|
56
|
+
rootCls,
|
|
57
|
+
menuState,
|
|
58
|
+
siderWidth,
|
|
59
|
+
collapsedWidth,
|
|
60
|
+
collapseConfig,
|
|
61
|
+
contentFullscreen,
|
|
62
|
+
renderRouterView,
|
|
63
|
+
collapsed,
|
|
64
|
+
isMobile,
|
|
65
|
+
logoConfig,
|
|
66
|
+
logoTitle,
|
|
67
|
+
selectedKeys,
|
|
68
|
+
openKeys,
|
|
69
|
+
proClasses: computed(() => ({
|
|
70
|
+
...layoutContext?.proClasses.value ?? {},
|
|
71
|
+
...props?.proClasses ?? {}
|
|
72
|
+
})),
|
|
73
|
+
proStyles: computed(() => ({
|
|
74
|
+
...layoutContext?.proStyles.value ?? {},
|
|
75
|
+
...props?.proStyles ?? {}
|
|
76
|
+
})),
|
|
77
|
+
breadcrumbRender,
|
|
78
|
+
breadcrumbConfig,
|
|
79
|
+
pageContainerConfig,
|
|
80
|
+
hasFooterToolbar,
|
|
81
|
+
navigate,
|
|
82
|
+
setHasFooterToolbar
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
export { useLayoutBase };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { BreadcrumbItemType, GProLayoutProps, LayoutMenuConfig, LayoutMenuRoute, Meta } from "../interface.js";
|
|
2
|
+
import { MenuLookupEntry, MenuMetaPatch, MenuRoutePatch, MenuTreeMutationOptions, ResolveRouteResult } from "../utils/menu.js";
|
|
3
|
+
import { ComputedRef, MaybeRefOrGetter, ShallowRef } from "vue";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/useMenu.d.ts
|
|
6
|
+
interface UseLayoutMenuOptions {
|
|
7
|
+
/** 菜单数据源;不传则回退 vue-router 的路由表 */
|
|
8
|
+
menus?: MaybeRefOrGetter<LayoutMenuRoute[] | undefined>;
|
|
9
|
+
/** 外部受控选中菜单;不传则由当前路由链自动推导 */
|
|
10
|
+
selectedKeys?: MaybeRefOrGetter<string[] | undefined>;
|
|
11
|
+
/** 外部受控展开菜单;不传则由当前路由链自动推导 */
|
|
12
|
+
openKeys?: MaybeRefOrGetter<string[] | undefined>;
|
|
13
|
+
/** 菜单配置(autoClose 等) */
|
|
14
|
+
config: MaybeRefOrGetter<LayoutMenuConfig>;
|
|
15
|
+
/** 布局模式;`mix` 模式强制分割头部/侧边菜单 */
|
|
16
|
+
layout?: MaybeRefOrGetter<GProLayoutProps['layout']>;
|
|
17
|
+
/** 移动端;移动端关闭菜单分割 */
|
|
18
|
+
isMobile?: MaybeRefOrGetter<boolean>;
|
|
19
|
+
/** 当前选中菜单名,默认取 `useRoute().name` */
|
|
20
|
+
currentName?: () => string | undefined;
|
|
21
|
+
}
|
|
22
|
+
interface LayoutMenuState {
|
|
23
|
+
/** 完整菜单路由树(清洗 + 排序后) */
|
|
24
|
+
menus: ShallowRef<LayoutMenuRoute[]>;
|
|
25
|
+
/** 扁平菜单列表(markRaw) */
|
|
26
|
+
flatMenus: ComputedRef<LayoutMenuRoute[]>;
|
|
27
|
+
/** 选中项(可写,导航时按匹配链同步) */
|
|
28
|
+
selectedKeys: ShallowRef<string[]>;
|
|
29
|
+
/** 展开项(可写,支持 v-model 与 autoClose) */
|
|
30
|
+
openKeys: ShallowRef<string[]>;
|
|
31
|
+
/** 面包屑路由 */
|
|
32
|
+
breadcrumbRoutes: ComputedRef<LayoutMenuRoute[]>;
|
|
33
|
+
/** 面包屑数据项 */
|
|
34
|
+
breadcrumbItems: ComputedRef<BreadcrumbItemType[]>;
|
|
35
|
+
/** 当前路由 meta */
|
|
36
|
+
currentMeta: ComputedRef<Meta>;
|
|
37
|
+
/** 头部菜单路由分支(mix 时为顶层、剥子级) */
|
|
38
|
+
headerMenus: ComputedRef<LayoutMenuRoute[]>;
|
|
39
|
+
/** 侧边菜单路由分支(mix 时为激活顶层的子级) */
|
|
40
|
+
siderMenus: ComputedRef<LayoutMenuRoute[]>;
|
|
41
|
+
/** 解析点击菜单后的跳转目标 */
|
|
42
|
+
resolveRoute: (name: string) => ResolveRouteResult;
|
|
43
|
+
/** name 查找表(供构造 LayoutSelectInfo.route) */
|
|
44
|
+
lookup: ComputedRef<Map<string, MenuLookupEntry>>;
|
|
45
|
+
/** 整体替换菜单树 */
|
|
46
|
+
setMenus: (menus: LayoutMenuRoute[]) => void;
|
|
47
|
+
/** 原地变更后的兜底刷新,会重新清洗排序 */
|
|
48
|
+
refreshMenus: () => void;
|
|
49
|
+
/** 批量提交菜单更新,避免多次重建索引 */
|
|
50
|
+
batchMenus: (updater: (menus: LayoutMenuRoute[]) => LayoutMenuRoute[], options?: MenuTreeMutationOptions) => void;
|
|
51
|
+
/** 追加菜单;不传 parentName 时追加到顶层 */
|
|
52
|
+
addMenu: (menu: LayoutMenuRoute, parentName?: string, index?: number) => void;
|
|
53
|
+
/** 按 name 更新菜单节点 */
|
|
54
|
+
updateMenu: (name: string, updater: MenuRoutePatch | ((route: LayoutMenuRoute) => LayoutMenuRoute), options?: MenuTreeMutationOptions) => void;
|
|
55
|
+
/** 按 name 更新 meta,适合标题 / 图标 / 样式 / 隐藏状态 */
|
|
56
|
+
setMenuMeta: (name: string, updater: MenuMetaPatch | ((meta: Meta) => Meta), options?: MenuTreeMutationOptions) => void;
|
|
57
|
+
/** 显示菜单 */
|
|
58
|
+
showMenu: (name: string) => void;
|
|
59
|
+
/** 隐藏菜单 */
|
|
60
|
+
hideMenu: (name: string) => void;
|
|
61
|
+
/** 删除菜单及其子树 */
|
|
62
|
+
removeMenu: (name: string) => void;
|
|
63
|
+
}
|
|
64
|
+
interface UseLayoutMenuReturn {
|
|
65
|
+
menuState: LayoutMenuState;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 菜单组合式:以 shallowRef 菜单树为总状态,派生选中 / 展开 / 面包屑 / 查找索引。
|
|
69
|
+
*
|
|
70
|
+
* 关键响应式(根治旧实现卡顿 / 内存问题):
|
|
71
|
+
* - `menus` / `selectedKeys` / `openKeys` 均为 shallowRef,可由 context 主动控制;
|
|
72
|
+
* - `lookup` 内携带 path,深层菜单更新走 O(1) 查找 + O(depth) 局部克隆;
|
|
73
|
+
* - 派生索引仅在 `menus` 根引用变化时重建,无 deep watch、无全量 cloneDeep。
|
|
74
|
+
*/
|
|
75
|
+
declare function useMenu(options: UseLayoutMenuOptions): UseLayoutMenuReturn;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { LayoutMenuState, UseLayoutMenuOptions, UseLayoutMenuReturn, useMenu };
|