@gx-design-vue/pro-layout 0.1.0-alpha.20 → 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.js +1 -1
- package/dist/components/Breadcrumb/index.js +3 -2
- package/dist/components/Breadcrumb/interface.d.ts +1 -1
- package/dist/components/Header/index.js +6 -14
- package/dist/components/Logo/index.js +6 -1
- package/dist/components/Menu/iconRender.d.ts +1 -1
- package/dist/components/Menu/iconRender.js +1 -1
- package/dist/components/Menu/index.d.ts +9 -10
- package/dist/components/Menu/index.js +670 -114
- package/dist/components/Menu/interface.d.ts +11 -11
- package/dist/components/Menu/interface.js +3 -3
- 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/{siderMenu.d.ts → index.d.ts} +64 -5
- package/dist/components/Menu/style/index.js +147 -0
- package/dist/components/Menu/style/inline.d.ts +13 -0
- package/dist/components/Menu/style/{siderMenu.js → inline.js} +29 -115
- package/dist/components/PageContainer/index.js +2 -2
- package/dist/components/PageContainer/style.js +9 -6
- package/dist/components/Sider/index.js +18 -11
- package/dist/defaultConfig.js +1 -2
- package/dist/hooks/useLayoutBase.d.ts +15 -15
- package/dist/hooks/useMenu.d.ts +5 -5
- package/dist/hooks/useMenu.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/interface.d.ts +2 -6
- package/dist/interface.js +2 -2
- package/dist/pro-layout.esm.js +4777 -4469
- package/dist/pro-layout.js +3 -2
- package/dist/style/breadcrumb.js +2 -1
- package/dist/style/logo.js +6 -1
- package/dist/style/menu.d.ts +1 -1
- package/dist/style/menu.js +1 -1
- package/dist/theme/augment.d.ts +2 -2
- package/dist/theme/interface/components.d.ts +2 -2
- package/dist/utils/menu.d.ts +3 -3
- package/dist/utils/menu.js +2 -2
- package/dist/utils/themeComponents.d.ts +8 -4
- package/dist/utils/themeComponents.js +14 -4
- package/package.json +15 -15
- package/dist/components/Menu/SiderMenu.d.ts +0 -29
- package/dist/components/Menu/SiderMenu.js +0 -666
- package/dist/components/Menu/convert.d.ts +0 -14
- package/dist/components/Menu/convert.js +0 -50
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import genBaseStyle from "./base.js";
|
|
2
|
+
import genHorizontalStyle from "./horizontal.js";
|
|
3
|
+
import genInlineStyle from "./inline.js";
|
|
4
|
+
import { proGenStyleHooks, setAlpha } from "@gx-design-vue/pro-provider";
|
|
5
|
+
import { unit as unit$1 } from "@antdv-next/cssinjs";
|
|
6
|
+
import { mergeToken } from "antdv-next/dist/theme/internal";
|
|
7
|
+
//#region src/components/Menu/style/index.ts
|
|
8
|
+
function hasActiveBarWidth(activeBarWidth) {
|
|
9
|
+
if (activeBarWidth == null) return false;
|
|
10
|
+
if (typeof activeBarWidth === "number") return activeBarWidth !== 0;
|
|
11
|
+
const width = activeBarWidth.trim();
|
|
12
|
+
if (!width) return false;
|
|
13
|
+
const numericWidth = Number.parseFloat(width);
|
|
14
|
+
return Number.isNaN(numericWidth) || numericWidth !== 0;
|
|
15
|
+
}
|
|
16
|
+
const prepareComponentToken = (token) => {
|
|
17
|
+
const { colorPrimary, colorError, colorTextDisabled, colorErrorBg, colorText, colorTextDescription, colorBgContainer, colorFillAlter, colorFillContent, lineWidth, lineWidthBold, controlItemBgActive, colorBgTextHover, controlHeightLG, lineHeight, colorBgElevated, marginXXS, padding, fontSize, controlHeightSM, fontSizeLG, colorTextLightSolid, colorErrorHover } = token;
|
|
18
|
+
const activeBarWidth = token.activeBarWidth ?? 0;
|
|
19
|
+
const activeBarBorderWidth = token.activeBarBorderWidth ?? lineWidth;
|
|
20
|
+
const itemMarginInline = token.itemMarginInline ?? token.marginXXS;
|
|
21
|
+
const colorTextDark = setAlpha(colorTextLightSolid, .65);
|
|
22
|
+
return {
|
|
23
|
+
dropdownWidth: 160,
|
|
24
|
+
zIndexPopup: token.zIndexPopupBase + 50,
|
|
25
|
+
radiusItem: token.borderRadiusLG,
|
|
26
|
+
itemBorderRadius: token.borderRadiusLG,
|
|
27
|
+
radiusSubMenuItem: token.borderRadiusSM,
|
|
28
|
+
subMenuItemBorderRadius: token.borderRadiusSM,
|
|
29
|
+
colorItemText: colorText,
|
|
30
|
+
itemColor: colorText,
|
|
31
|
+
colorItemTextHover: colorText,
|
|
32
|
+
itemHoverColor: colorText,
|
|
33
|
+
colorItemTextHoverHorizontal: colorPrimary,
|
|
34
|
+
horizontalItemHoverColor: colorPrimary,
|
|
35
|
+
colorGroupTitle: colorTextDescription,
|
|
36
|
+
groupTitleColor: colorTextDescription,
|
|
37
|
+
colorItemTextSelected: colorPrimary,
|
|
38
|
+
itemSelectedColor: colorPrimary,
|
|
39
|
+
subMenuItemSelectedColor: colorPrimary,
|
|
40
|
+
colorItemTextSelectedHorizontal: colorPrimary,
|
|
41
|
+
horizontalItemSelectedColor: colorPrimary,
|
|
42
|
+
colorItemBg: colorBgContainer,
|
|
43
|
+
itemBg: colorBgContainer,
|
|
44
|
+
colorItemBgHover: colorBgTextHover,
|
|
45
|
+
itemHoverBg: colorBgTextHover,
|
|
46
|
+
colorItemBgActive: colorFillContent,
|
|
47
|
+
itemActiveBg: controlItemBgActive,
|
|
48
|
+
colorSubItemBg: colorFillAlter,
|
|
49
|
+
subMenuItemBg: colorFillAlter,
|
|
50
|
+
colorItemBgSelected: controlItemBgActive,
|
|
51
|
+
itemSelectedBg: controlItemBgActive,
|
|
52
|
+
colorItemBgSelectedHorizontal: "transparent",
|
|
53
|
+
horizontalItemSelectedBg: "transparent",
|
|
54
|
+
colorActiveBarWidth: 0,
|
|
55
|
+
activeBarWidth,
|
|
56
|
+
colorActiveBarHeight: lineWidthBold,
|
|
57
|
+
activeBarHeight: lineWidthBold,
|
|
58
|
+
colorActiveBarBorderSize: lineWidth,
|
|
59
|
+
activeBarBorderWidth,
|
|
60
|
+
colorItemTextDisabled: colorTextDisabled,
|
|
61
|
+
itemDisabledColor: colorTextDisabled,
|
|
62
|
+
colorDangerItemText: colorError,
|
|
63
|
+
dangerItemColor: colorError,
|
|
64
|
+
colorDangerItemTextHover: colorError,
|
|
65
|
+
dangerItemHoverColor: colorError,
|
|
66
|
+
colorDangerItemTextSelected: colorError,
|
|
67
|
+
dangerItemSelectedColor: colorError,
|
|
68
|
+
colorDangerItemBgActive: colorErrorBg,
|
|
69
|
+
dangerItemActiveBg: colorErrorBg,
|
|
70
|
+
colorDangerItemBgSelected: colorErrorBg,
|
|
71
|
+
dangerItemSelectedBg: colorErrorBg,
|
|
72
|
+
itemMarginInline,
|
|
73
|
+
horizontalItemHoverBg: "transparent",
|
|
74
|
+
itemHeight: controlHeightLG,
|
|
75
|
+
groupTitleLineHeight: lineHeight,
|
|
76
|
+
collapsedWidth: controlHeightLG * 2,
|
|
77
|
+
popupBg: colorBgElevated,
|
|
78
|
+
itemMarginBlock: marginXXS,
|
|
79
|
+
itemPaddingInline: padding,
|
|
80
|
+
iconSize: fontSize,
|
|
81
|
+
iconMarginInlineEnd: controlHeightSM - fontSize,
|
|
82
|
+
collapsedIconSize: fontSizeLG,
|
|
83
|
+
groupTitleFontSize: fontSize,
|
|
84
|
+
darkItemDisabledColor: setAlpha(colorTextLightSolid, .25),
|
|
85
|
+
darkItemColor: colorTextDark,
|
|
86
|
+
darkDangerItemColor: colorError,
|
|
87
|
+
darkItemBg: "#001529",
|
|
88
|
+
darkPopupBg: "#001529",
|
|
89
|
+
darkSubMenuItemBg: "#000c17",
|
|
90
|
+
darkItemSelectedColor: colorTextLightSolid,
|
|
91
|
+
darkItemSelectedBg: colorPrimary,
|
|
92
|
+
darkDangerItemSelectedBg: colorError,
|
|
93
|
+
darkItemHoverBg: "transparent",
|
|
94
|
+
darkGroupTitleColor: colorTextDark,
|
|
95
|
+
darkItemHoverColor: colorTextLightSolid,
|
|
96
|
+
darkDangerItemHoverColor: colorErrorHover,
|
|
97
|
+
darkDangerItemSelectedColor: colorTextLightSolid,
|
|
98
|
+
darkDangerItemActiveBg: colorError,
|
|
99
|
+
horizontalLineHeight: `${controlHeightLG * 1.15}px`,
|
|
100
|
+
horizontalItemBorderRadius: 0,
|
|
101
|
+
itemWidth: hasActiveBarWidth(activeBarWidth) ? `calc(100% + ${unit$1(activeBarBorderWidth)})` : `calc(100% - ${itemMarginInline * 2}px)`
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const genMenuStyle = (token) => {
|
|
105
|
+
const menuArrowSize = token.calc(token.fontSize).div(7).mul(5).equal();
|
|
106
|
+
const menuToken = mergeToken(token, {
|
|
107
|
+
menuArrowSize,
|
|
108
|
+
menuHorizontalHeight: token.calc(token.controlHeightLG).mul(1.15).equal(),
|
|
109
|
+
menuArrowOffset: token.calc(menuArrowSize).mul(.25).equal(),
|
|
110
|
+
menuSubMenuBg: token.colorBgElevated
|
|
111
|
+
});
|
|
112
|
+
return [
|
|
113
|
+
genBaseStyle(menuToken),
|
|
114
|
+
genInlineStyle(menuToken),
|
|
115
|
+
genHorizontalStyle(menuToken)
|
|
116
|
+
];
|
|
117
|
+
};
|
|
118
|
+
var style_default = proGenStyleHooks("ProMenu", genMenuStyle, prepareComponentToken, {
|
|
119
|
+
deprecatedTokens: [
|
|
120
|
+
["colorGroupTitle", "groupTitleColor"],
|
|
121
|
+
["radiusItem", "itemBorderRadius"],
|
|
122
|
+
["radiusSubMenuItem", "subMenuItemBorderRadius"],
|
|
123
|
+
["colorItemText", "itemColor"],
|
|
124
|
+
["colorItemTextHover", "itemHoverColor"],
|
|
125
|
+
["colorItemTextHoverHorizontal", "horizontalItemHoverColor"],
|
|
126
|
+
["colorItemTextSelected", "itemSelectedColor"],
|
|
127
|
+
["colorItemTextSelectedHorizontal", "horizontalItemSelectedColor"],
|
|
128
|
+
["colorItemTextDisabled", "itemDisabledColor"],
|
|
129
|
+
["colorDangerItemText", "dangerItemColor"],
|
|
130
|
+
["colorDangerItemTextHover", "dangerItemHoverColor"],
|
|
131
|
+
["colorDangerItemTextSelected", "dangerItemSelectedColor"],
|
|
132
|
+
["colorDangerItemBgActive", "dangerItemActiveBg"],
|
|
133
|
+
["colorDangerItemBgSelected", "dangerItemSelectedBg"],
|
|
134
|
+
["colorItemBg", "itemBg"],
|
|
135
|
+
["colorItemBgHover", "itemHoverBg"],
|
|
136
|
+
["colorSubItemBg", "subMenuItemBg"],
|
|
137
|
+
["colorItemBgActive", "itemActiveBg"],
|
|
138
|
+
["colorItemBgSelectedHorizontal", "horizontalItemSelectedBg"],
|
|
139
|
+
["colorActiveBarWidth", "activeBarWidth"],
|
|
140
|
+
["colorActiveBarHeight", "activeBarHeight"],
|
|
141
|
+
["colorActiveBarBorderSize", "activeBarBorderWidth"],
|
|
142
|
+
["colorItemBgSelected", "itemSelectedBg"]
|
|
143
|
+
],
|
|
144
|
+
unitless: { groupTitleLineHeight: true }
|
|
145
|
+
});
|
|
146
|
+
//#endregion
|
|
147
|
+
export { style_default as default, prepareComponentToken };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MenuToken } from "./index.js";
|
|
2
|
+
import { CSSObject } from "@antdv-next/cssinjs";
|
|
3
|
+
import { GenerateStyle } from "antdv-next/dist/theme/internal";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Menu/style/inline.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Inline 模式样式。
|
|
8
|
+
*
|
|
9
|
+
* 只处理 inline 模式结构、状态和侧边栏 token 映射。
|
|
10
|
+
*/
|
|
11
|
+
declare const genInlineStyle: GenerateStyle<MenuToken, CSSObject>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { genInlineStyle as default };
|
|
@@ -1,103 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/components/Menu/style/siderMenu.ts
|
|
4
|
-
function hasActiveBarWidth(activeBarWidth) {
|
|
5
|
-
if (activeBarWidth == null) return false;
|
|
6
|
-
if (typeof activeBarWidth === "number") return activeBarWidth !== 0;
|
|
7
|
-
const width = activeBarWidth.trim();
|
|
8
|
-
if (!width) return false;
|
|
9
|
-
const numericWidth = Number.parseFloat(width);
|
|
10
|
-
return Number.isNaN(numericWidth) || numericWidth !== 0;
|
|
11
|
-
}
|
|
12
|
-
const prepareComponentToken = (token) => {
|
|
13
|
-
const { colorPrimary, colorError, colorTextDisabled, colorErrorBg, colorText, colorTextDescription, colorBgContainer, colorFillAlter, colorFillContent, lineWidth, lineWidthBold, controlItemBgActive, colorBgTextHover, controlHeightLG, lineHeight, colorBgElevated, marginXXS, padding, fontSize, controlHeightSM, fontSizeLG, colorTextLightSolid, colorErrorHover } = token;
|
|
14
|
-
const activeBarWidth = token.activeBarWidth ?? 0;
|
|
15
|
-
const activeBarBorderWidth = token.activeBarBorderWidth ?? lineWidth;
|
|
16
|
-
const itemMarginInline = token.itemMarginInline ?? token.marginXXS;
|
|
17
|
-
const colorTextDark = setAlpha(colorTextLightSolid, .65);
|
|
18
|
-
return {
|
|
19
|
-
dropdownWidth: 160,
|
|
20
|
-
zIndexPopup: token.zIndexPopupBase + 50,
|
|
21
|
-
radiusItem: token.borderRadiusLG,
|
|
22
|
-
itemBorderRadius: token.borderRadiusLG,
|
|
23
|
-
radiusSubMenuItem: token.borderRadiusSM,
|
|
24
|
-
subMenuItemBorderRadius: token.borderRadiusSM,
|
|
25
|
-
colorItemText: colorText,
|
|
26
|
-
itemColor: colorText,
|
|
27
|
-
colorItemTextHover: colorText,
|
|
28
|
-
itemHoverColor: colorText,
|
|
29
|
-
colorGroupTitle: colorTextDescription,
|
|
30
|
-
groupTitleColor: colorTextDescription,
|
|
31
|
-
colorItemTextSelected: colorPrimary,
|
|
32
|
-
itemSelectedColor: colorPrimary,
|
|
33
|
-
subMenuItemSelectedColor: colorPrimary,
|
|
34
|
-
colorItemBg: colorBgContainer,
|
|
35
|
-
itemBg: colorBgContainer,
|
|
36
|
-
colorItemBgHover: colorBgTextHover,
|
|
37
|
-
itemHoverBg: colorBgTextHover,
|
|
38
|
-
colorItemBgActive: colorFillContent,
|
|
39
|
-
itemActiveBg: controlItemBgActive,
|
|
40
|
-
colorSubItemBg: colorFillAlter,
|
|
41
|
-
subMenuItemBg: colorFillAlter,
|
|
42
|
-
colorItemBgSelected: controlItemBgActive,
|
|
43
|
-
itemSelectedBg: controlItemBgActive,
|
|
44
|
-
colorActiveBarWidth: 0,
|
|
45
|
-
activeBarWidth,
|
|
46
|
-
colorActiveBarHeight: lineWidthBold,
|
|
47
|
-
activeBarHeight: lineWidthBold,
|
|
48
|
-
colorActiveBarBorderSize: lineWidth,
|
|
49
|
-
activeBarBorderWidth,
|
|
50
|
-
colorItemTextDisabled: colorTextDisabled,
|
|
51
|
-
itemDisabledColor: colorTextDisabled,
|
|
52
|
-
colorDangerItemText: colorError,
|
|
53
|
-
dangerItemColor: colorError,
|
|
54
|
-
colorDangerItemTextHover: colorError,
|
|
55
|
-
dangerItemHoverColor: colorError,
|
|
56
|
-
colorDangerItemTextSelected: colorError,
|
|
57
|
-
dangerItemSelectedColor: colorError,
|
|
58
|
-
colorDangerItemBgActive: colorErrorBg,
|
|
59
|
-
dangerItemActiveBg: colorErrorBg,
|
|
60
|
-
colorDangerItemBgSelected: colorErrorBg,
|
|
61
|
-
dangerItemSelectedBg: colorErrorBg,
|
|
62
|
-
itemMarginInline,
|
|
63
|
-
itemHeight: controlHeightLG,
|
|
64
|
-
groupTitleLineHeight: lineHeight,
|
|
65
|
-
collapsedWidth: controlHeightLG * 2,
|
|
66
|
-
popupBg: colorBgElevated,
|
|
67
|
-
itemMarginBlock: marginXXS,
|
|
68
|
-
itemPaddingInline: padding,
|
|
69
|
-
iconSize: fontSize,
|
|
70
|
-
iconMarginInlineEnd: controlHeightSM - fontSize,
|
|
71
|
-
collapsedIconSize: fontSizeLG,
|
|
72
|
-
groupTitleFontSize: fontSize,
|
|
73
|
-
darkItemDisabledColor: setAlpha(colorTextLightSolid, .25),
|
|
74
|
-
darkItemColor: colorTextDark,
|
|
75
|
-
darkDangerItemColor: colorError,
|
|
76
|
-
darkItemBg: "#001529",
|
|
77
|
-
darkPopupBg: "#001529",
|
|
78
|
-
darkSubMenuItemBg: "#000c17",
|
|
79
|
-
darkItemSelectedColor: colorTextLightSolid,
|
|
80
|
-
darkItemSelectedBg: colorPrimary,
|
|
81
|
-
darkDangerItemSelectedBg: colorError,
|
|
82
|
-
darkItemHoverBg: "transparent",
|
|
83
|
-
darkGroupTitleColor: colorTextDark,
|
|
84
|
-
darkItemHoverColor: colorTextLightSolid,
|
|
85
|
-
darkDangerItemHoverColor: colorErrorHover,
|
|
86
|
-
darkDangerItemSelectedColor: colorTextLightSolid,
|
|
87
|
-
darkDangerItemActiveBg: colorError,
|
|
88
|
-
itemWidth: hasActiveBarWidth(activeBarWidth) ? `calc(100% + ${unit$1(activeBarBorderWidth)})` : `calc(100% - ${itemMarginInline * 2}px)`
|
|
89
|
-
};
|
|
90
|
-
};
|
|
1
|
+
import { unit } from "@antdv-next/cssinjs";
|
|
2
|
+
//#region src/components/Menu/style/inline.ts
|
|
91
3
|
/**
|
|
92
|
-
*
|
|
4
|
+
* Inline 模式样式。
|
|
93
5
|
*
|
|
94
|
-
*
|
|
95
|
-
* 的结构修补样式混在一起。
|
|
6
|
+
* 只处理 inline 模式结构、状态和侧边栏 token 映射。
|
|
96
7
|
*/
|
|
97
|
-
const
|
|
8
|
+
const genInlineStyle = (token) => {
|
|
98
9
|
const { componentCls, antCls } = token;
|
|
99
|
-
const iconSize = unit
|
|
100
|
-
const collapsedIconSize = unit
|
|
10
|
+
const iconSize = unit(token.menuItemIconSize || token.iconSize || token.fontSize);
|
|
11
|
+
const collapsedIconSize = unit(token.collapsedIconSize || token.fontSizeLG);
|
|
101
12
|
const siderMenuItemHeight = token.siderMenuItemHeight || token.itemHeight || token.controlHeight;
|
|
102
13
|
const siderMenuItemMarginInline = token.siderMenuItemMarginInline ?? token.itemMarginInline ?? token.marginXXS;
|
|
103
14
|
const siderMenuItemMarginBlock = token.itemMarginBlock ?? token.marginXXS;
|
|
@@ -107,9 +18,13 @@ const genSiderMenuStyle = (token) => {
|
|
|
107
18
|
const siderMenuPaddingWithArrow = token.calc(siderMenuArrowSize).add(token.padding).add(token.marginXS).equal();
|
|
108
19
|
const siderMenuTitleGap = token.iconMarginInlineEnd ?? token.marginSM;
|
|
109
20
|
const activeBarWidth = token.activeBarWidth ?? 0;
|
|
110
|
-
const itemWidth = token.itemWidth || `calc(100% - ${unit
|
|
21
|
+
const itemWidth = token.itemWidth || `calc(100% - ${unit(token.calc(siderMenuItemMarginInline).mul(2).equal())})`;
|
|
111
22
|
return {
|
|
112
|
-
[`${componentCls}`]: {
|
|
23
|
+
[`${componentCls}-inline-collapsed-tooltip`]: {
|
|
24
|
+
pointerEvents: "none",
|
|
25
|
+
[`${componentCls}-icon, ${antCls}-icon`]: { display: "none" }
|
|
26
|
+
},
|
|
27
|
+
[`${componentCls}-inline`]: {
|
|
113
28
|
boxSizing: "border-box",
|
|
114
29
|
margin: 0,
|
|
115
30
|
padding: 0,
|
|
@@ -138,7 +53,7 @@ const genSiderMenuStyle = (token) => {
|
|
|
138
53
|
[`&${componentCls}-popup-list`]: {
|
|
139
54
|
minWidth: token.dropdownWidth,
|
|
140
55
|
maxWidth: token.dropdownWidth,
|
|
141
|
-
maxHeight: `calc(100vh - ${unit
|
|
56
|
+
maxHeight: `calc(100vh - ${unit(token.calc(token.controlHeightLG).mul(2.5).equal())})`,
|
|
142
57
|
padding: 0,
|
|
143
58
|
overflow: "hidden auto",
|
|
144
59
|
borderInlineEnd: 0,
|
|
@@ -159,11 +74,11 @@ const genSiderMenuStyle = (token) => {
|
|
|
159
74
|
minHeight: siderMenuItemHeight,
|
|
160
75
|
marginBlock: siderMenuItemMarginBlock,
|
|
161
76
|
marginInline: siderMenuItemMarginInline,
|
|
162
|
-
paddingInlineStart: `calc(${unit
|
|
77
|
+
paddingInlineStart: `calc(${unit(siderMenuBasePadding)} + var(--pro-menu-level, 0) * var(--pro-menu-indent, 24px))`,
|
|
163
78
|
paddingInlineEnd: siderMenuBasePadding,
|
|
164
79
|
overflow: "hidden",
|
|
165
80
|
color: token.siderColorTextMenu || token.itemColor,
|
|
166
|
-
lineHeight: unit
|
|
81
|
+
lineHeight: unit(siderMenuItemHeight),
|
|
167
82
|
whiteSpace: "nowrap",
|
|
168
83
|
textOverflow: "ellipsis",
|
|
169
84
|
cursor: "pointer",
|
|
@@ -178,7 +93,7 @@ const genSiderMenuStyle = (token) => {
|
|
|
178
93
|
position: "absolute",
|
|
179
94
|
insetBlock: 0,
|
|
180
95
|
insetInlineEnd: 0,
|
|
181
|
-
borderInlineEnd: `${unit
|
|
96
|
+
borderInlineEnd: `${unit(activeBarWidth)} solid ${token.itemSelectedColor}`,
|
|
182
97
|
transform: "scaleY(0.0001)",
|
|
183
98
|
opacity: 0,
|
|
184
99
|
transition: ["transform", "opacity"].map((prop) => `${prop} ${token.motionDurationMid} ${token.motionEaseOut}`).join(","),
|
|
@@ -190,7 +105,7 @@ const genSiderMenuStyle = (token) => {
|
|
|
190
105
|
},
|
|
191
106
|
[`&:not(${componentCls}-item-selected):not(${componentCls}-item-active):active`]: { backgroundColor: token.siderColorBgMenuItemActive || token.itemActiveBg },
|
|
192
107
|
"&:focus-visible": {
|
|
193
|
-
outline: `${unit
|
|
108
|
+
outline: `${unit(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`,
|
|
194
109
|
outlineOffset: 1
|
|
195
110
|
},
|
|
196
111
|
[`&${componentCls}-item-active`]: { color: token.siderColorTextSubMenuSelected || token.siderColorTextMenuSelected || token.subMenuItemSelectedColor },
|
|
@@ -211,7 +126,7 @@ const genSiderMenuStyle = (token) => {
|
|
|
211
126
|
},
|
|
212
127
|
[`&${componentCls}-item-collapsed`]: {
|
|
213
128
|
justifyContent: "center",
|
|
214
|
-
paddingInline: `calc(50% - ${iconSize} / 2 - ${unit
|
|
129
|
+
paddingInline: `calc(50% - ${iconSize} / 2 - ${unit(siderMenuItemMarginInline)})`,
|
|
215
130
|
textOverflow: "clip"
|
|
216
131
|
},
|
|
217
132
|
"> *": { flex: "none" }
|
|
@@ -291,23 +206,23 @@ const genSiderMenuStyle = (token) => {
|
|
|
291
206
|
].map((prop) => `${prop} ${token.motionDurationSlow} ${token.motionEaseInOut}`).join(","),
|
|
292
207
|
content: "\"\""
|
|
293
208
|
},
|
|
294
|
-
"&::before": { transform: `rotate(-45deg) translateX(${unit
|
|
295
|
-
"&::after": { transform: `rotate(45deg) translateX(${unit
|
|
209
|
+
"&::before": { transform: `rotate(-45deg) translateX(${unit(siderMenuArrowOffset)})` },
|
|
210
|
+
"&::after": { transform: `rotate(45deg) translateX(${unit(token.calc(siderMenuArrowOffset).mul(-1).equal())})` }
|
|
296
211
|
},
|
|
297
212
|
[`${componentCls}-item-open ${componentCls}-arrow`]: {
|
|
298
|
-
transform: `translateY(${unit
|
|
299
|
-
"&::before": { transform: `rotate(45deg) translateX(${unit
|
|
300
|
-
"&::after": { transform: `rotate(-45deg) translateX(${unit
|
|
213
|
+
transform: `translateY(${unit(token.calc(siderMenuArrowSize).mul(.2).mul(-1).equal())})`,
|
|
214
|
+
"&::before": { transform: `rotate(45deg) translateX(${unit(siderMenuArrowOffset)})` },
|
|
215
|
+
"&::after": { transform: `rotate(-45deg) translateX(${unit(token.calc(siderMenuArrowOffset).mul(-1).equal())})` }
|
|
301
216
|
},
|
|
302
217
|
[`${componentCls}-submenu-title-popup ${componentCls}-arrow`]: {
|
|
303
218
|
transform: "translateY(-50%)",
|
|
304
|
-
"&::before": { transform: `rotate(45deg) translateY(${unit
|
|
305
|
-
"&::after": { transform: `rotate(-45deg) translateY(${unit
|
|
219
|
+
"&::before": { transform: `rotate(45deg) translateY(${unit(token.calc(siderMenuArrowOffset).mul(-1).equal())})` },
|
|
220
|
+
"&::after": { transform: `rotate(-45deg) translateY(${unit(siderMenuArrowOffset)})` }
|
|
306
221
|
},
|
|
307
222
|
[`${componentCls}-group-title`]: {
|
|
308
223
|
boxSizing: "border-box",
|
|
309
224
|
paddingBlock: token.paddingXXS,
|
|
310
|
-
paddingInlineStart: `calc(${unit
|
|
225
|
+
paddingInlineStart: `calc(${unit(siderMenuBasePadding)} + var(--pro-menu-level, 0) * var(--pro-menu-indent, 24px))`,
|
|
311
226
|
paddingInlineEnd: token.padding,
|
|
312
227
|
color: token.siderColorTextMenuTitle || token.groupTitleColor || token.colorTextLabel,
|
|
313
228
|
fontSize: token.groupTitleFontSize || token.fontSizeSM,
|
|
@@ -325,7 +240,7 @@ const genSiderMenuStyle = (token) => {
|
|
|
325
240
|
padding: 0
|
|
326
241
|
}
|
|
327
242
|
},
|
|
328
|
-
[`${componentCls}-popover${antCls}-popover`]: {
|
|
243
|
+
[`${componentCls}-inline-popover${antCls}-popover`]: {
|
|
329
244
|
borderRadius: token.borderRadiusLG,
|
|
330
245
|
boxShadow: "none",
|
|
331
246
|
transformOrigin: "0 0",
|
|
@@ -373,6 +288,5 @@ const genSiderMenuStyle = (token) => {
|
|
|
373
288
|
}
|
|
374
289
|
};
|
|
375
290
|
};
|
|
376
|
-
var siderMenu_default = proGenStyleHooks("ProSiderMenu", genSiderMenuStyle, prepareComponentToken);
|
|
377
291
|
//#endregion
|
|
378
|
-
export {
|
|
292
|
+
export { genInlineStyle as default };
|
|
@@ -154,10 +154,10 @@ const ProPageContainer = /* @__PURE__ */ defineComponent((props, { slots, emit }
|
|
|
154
154
|
function renderContent() {
|
|
155
155
|
if (props.watermark || watermark?.value) {
|
|
156
156
|
let _slot;
|
|
157
|
-
return createVNode(Watermark, {
|
|
157
|
+
return createVNode(Watermark, mergeProps({
|
|
158
158
|
...watermark?.value,
|
|
159
159
|
...props.watermark
|
|
160
|
-
}, _isSlot(_slot = renderBody()) ? _slot : { default: () => [_slot] });
|
|
160
|
+
}, { "class": `${prefixCls.value}-watermark` }), _isSlot(_slot = renderBody()) ? _slot : { default: () => [_slot] });
|
|
161
161
|
}
|
|
162
162
|
return renderBody();
|
|
163
163
|
}
|
|
@@ -57,7 +57,8 @@ const genPageHeaderStyle = (token) => {
|
|
|
57
57
|
};
|
|
58
58
|
/** 内容区域样式:content / card / spinning / footer / height */
|
|
59
59
|
const genPageContentStyle = (token) => {
|
|
60
|
-
const { componentCls
|
|
60
|
+
const { componentCls } = token;
|
|
61
|
+
const watermarkCls = `${componentCls}-watermark`;
|
|
61
62
|
return { [componentCls]: {
|
|
62
63
|
position: "relative",
|
|
63
64
|
display: "flex",
|
|
@@ -66,7 +67,7 @@ const genPageContentStyle = (token) => {
|
|
|
66
67
|
flex: "1 0 auto",
|
|
67
68
|
minHeight: "100%",
|
|
68
69
|
[`${componentCls}-content`]: { flex: "1 0 auto" },
|
|
69
|
-
[`${componentCls}-content-inner,
|
|
70
|
+
[`${componentCls}-content-inner, & > ${watermarkCls}`]: { flex: "1 0 auto" },
|
|
70
71
|
[`${componentCls}-card`]: { flex: "1 0 auto" }
|
|
71
72
|
},
|
|
72
73
|
"&-height-full": {
|
|
@@ -78,7 +79,7 @@ const genPageContentStyle = (token) => {
|
|
|
78
79
|
flex: "1 1 auto",
|
|
79
80
|
minHeight: 0
|
|
80
81
|
},
|
|
81
|
-
[`${componentCls}-content-inner,
|
|
82
|
+
[`${componentCls}-content-inner, & > ${watermarkCls}`]: {
|
|
82
83
|
flex: "1 1 auto",
|
|
83
84
|
minHeight: 0
|
|
84
85
|
},
|
|
@@ -97,13 +98,15 @@ const genPageContentStyle = (token) => {
|
|
|
97
98
|
"&-inner": {
|
|
98
99
|
position: "relative",
|
|
99
100
|
padding: token.pageContainerPadding,
|
|
100
|
-
margin: token.pageContainerMargin
|
|
101
|
-
},
|
|
102
|
-
[`&-inner, & > ${antCls}-watermark`]: {
|
|
101
|
+
margin: token.pageContainerMargin,
|
|
103
102
|
display: "flex",
|
|
104
103
|
flexDirection: "column"
|
|
105
104
|
}
|
|
106
105
|
},
|
|
106
|
+
[`& > ${watermarkCls}`]: {
|
|
107
|
+
display: "flex",
|
|
108
|
+
flexDirection: "column"
|
|
109
|
+
},
|
|
107
110
|
"&-card": {},
|
|
108
111
|
"&-footer": {
|
|
109
112
|
flexShrink: 0,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useLayoutBase } from "../../hooks/useLayoutBase.js";
|
|
2
2
|
import LayoutCollapseButton from "../CollapseButton/index.js";
|
|
3
3
|
import LayoutLogo from "../Logo/index.js";
|
|
4
|
-
import
|
|
5
|
-
import { Fragment, computed, createVNode, defineComponent, isVNode, nextTick, onMounted, reactive, shallowRef
|
|
4
|
+
import ProMenu from "../Menu/index.js";
|
|
5
|
+
import { Fragment, computed, createVNode, defineComponent, isVNode, nextTick, onMounted, reactive, shallowRef } from "vue";
|
|
6
6
|
import { unit } from "@gx-design-vue/pro-provider";
|
|
7
7
|
import { classNames } from "@gx-design-vue/pro-utils";
|
|
8
|
+
import { useResizeObserver } from "@vueuse/core";
|
|
8
9
|
import { Drawer, LayoutSider as LayoutSider$1 } from "antdv-next";
|
|
9
10
|
import { GScrollbar } from "@gx-design-vue/scrollbar";
|
|
10
11
|
//#region src/components/Sider/index.tsx
|
|
@@ -12,7 +13,7 @@ function _isSlot(s) {
|
|
|
12
13
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
14
|
}
|
|
14
15
|
const LayoutSider = /* @__PURE__ */ defineComponent((props, { emit, slots }) => {
|
|
15
|
-
const { sider, layout, menuState, prefixCls, cssVarCls, rootCls, collapseConfig, collapsed, isMobile, logoConfig, logoTitle, selectedKeys, openKeys, proClasses, proStyles, siderWidth, collapsedWidth } = useLayoutBase(props);
|
|
16
|
+
const { sider, header, layout, menuState, prefixCls, cssVarCls, rootCls, collapseConfig, collapsed, isMobile, logoConfig, logoTitle, selectedKeys, openKeys, proClasses, proStyles, siderWidth, collapsedWidth } = useLayoutBase(props);
|
|
16
17
|
/** GScrollbar 组件引用,用于获取滚动容器 DOM */
|
|
17
18
|
const scrollbarRef = shallowRef();
|
|
18
19
|
/** 滚动阴影状态:上下边缘是否可继续滚动 */
|
|
@@ -30,11 +31,11 @@ const LayoutSider = /* @__PURE__ */ defineComponent((props, { emit, slots }) =>
|
|
|
30
31
|
onMounted(() => {
|
|
31
32
|
nextTick(() => updateScrollShadow());
|
|
32
33
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const scrollbarWrapEl = computed(() => scrollbarRef.value?.wrapRef);
|
|
35
|
+
const scrollbarViewEl = computed(() => scrollbarWrapEl.value?.firstElementChild);
|
|
36
|
+
useResizeObserver(scrollbarWrapEl, () => updateScrollShadow());
|
|
37
|
+
useResizeObserver(scrollbarViewEl, () => updateScrollShadow());
|
|
36
38
|
const siderMenus = computed(() => menuState?.siderMenus.value ?? []);
|
|
37
|
-
const hideWhenEmpty = computed(() => sider.value?.hideWhenEmpty && siderMenus.value.length === 0);
|
|
38
39
|
const siderClassNames = computed(() => classNames(`${prefixCls.value}-sider`, proClasses.value.sider, { [`${prefixCls.value}-sider-fixed`]: sider.value?.fixed }));
|
|
39
40
|
const siderChildrenClassNames = computed(() => classNames(`${prefixCls.value}-sider-children`, proClasses.value.siderChildren));
|
|
40
41
|
const siderHeaderClassNames = computed(() => classNames(`${prefixCls.value}-sider-header`, proClasses.value.siderHeader));
|
|
@@ -62,9 +63,16 @@ const LayoutSider = /* @__PURE__ */ defineComponent((props, { emit, slots }) =>
|
|
|
62
63
|
const collapseRender = slots.collapse || collapseConfig.value?.render;
|
|
63
64
|
const collapseIconRender = slots.collapseIcon || collapseConfig.value?.icon;
|
|
64
65
|
return createVNode(Fragment, null, [
|
|
65
|
-
|
|
66
|
+
[
|
|
67
|
+
"side",
|
|
68
|
+
"mix",
|
|
69
|
+
"wide"
|
|
70
|
+
].includes(layout.value ?? "") && logoConfig.value && createVNode("div", {
|
|
66
71
|
"class": siderHeaderClassNames.value,
|
|
67
|
-
"style":
|
|
72
|
+
"style": {
|
|
73
|
+
...proStyles.value.siderHeader,
|
|
74
|
+
...["mix", "wide"].includes(layout.value ?? "") && header.value?.height ? { height: unit(header.value.height) } : {}
|
|
75
|
+
}
|
|
68
76
|
}, [typeof logoRender === "function" ? logoRender?.({
|
|
69
77
|
collapsed: collapsed.value,
|
|
70
78
|
title: logoTitle.value
|
|
@@ -80,7 +88,7 @@ const LayoutSider = /* @__PURE__ */ defineComponent((props, { emit, slots }) =>
|
|
|
80
88
|
"onScroll": updateScrollShadow,
|
|
81
89
|
"data-top-shadow": scrollShadow.showTop,
|
|
82
90
|
"data-bottom-shadow": scrollShadow.showBottom
|
|
83
|
-
}, { default: () => [createVNode(
|
|
91
|
+
}, { default: () => [createVNode(ProMenu, {
|
|
84
92
|
"menus": siderMenus.value,
|
|
85
93
|
"selectedKeys": selectedKeys.value,
|
|
86
94
|
"openKeys": openKeys.value,
|
|
@@ -114,7 +122,6 @@ const LayoutSider = /* @__PURE__ */ defineComponent((props, { emit, slots }) =>
|
|
|
114
122
|
}
|
|
115
123
|
return () => {
|
|
116
124
|
let _slot2;
|
|
117
|
-
if (hideWhenEmpty.value) return null;
|
|
118
125
|
const breakpoint = sider.value?.breakpoint || void 0;
|
|
119
126
|
if (isMobile.value) {
|
|
120
127
|
let _slot;
|
package/dist/defaultConfig.js
CHANGED
|
@@ -13,7 +13,7 @@ declare function useLayoutBase(props?: {
|
|
|
13
13
|
collapsed?: boolean;
|
|
14
14
|
}): {
|
|
15
15
|
layoutContext: LayoutContextProps;
|
|
16
|
-
layout: import("vue").ComputedRef<"
|
|
16
|
+
layout: import("vue").ComputedRef<"top" | "side" | "mix" | "wide" | "simple">;
|
|
17
17
|
sider: import("vue").ComputedRef<Required<LayoutSiderConfig>>;
|
|
18
18
|
header: import("vue").ComputedRef<Required<LayoutHeaderConfig>>;
|
|
19
19
|
zIndex: import("vue").Ref<number, number>;
|
|
@@ -38,34 +38,34 @@ declare function useLayoutBase(props?: {
|
|
|
38
38
|
selectedKeys: import("vue").ComputedRef<string[]>;
|
|
39
39
|
openKeys: import("vue").ComputedRef<string[]>;
|
|
40
40
|
proClasses: import("vue").ComputedRef<{
|
|
41
|
-
root?: string;
|
|
42
|
-
header?: string;
|
|
43
|
-
sider?: string;
|
|
44
|
-
siderChildren?: string;
|
|
45
41
|
siderHeader?: string;
|
|
46
42
|
siderFooter?: string;
|
|
43
|
+
footer?: string;
|
|
44
|
+
header?: string;
|
|
45
|
+
breadcrumb?: string;
|
|
46
|
+
sider?: string;
|
|
47
47
|
logo?: string;
|
|
48
|
-
logoImage?: string;
|
|
49
48
|
content?: string;
|
|
50
|
-
|
|
49
|
+
root?: string;
|
|
50
|
+
siderChildren?: string;
|
|
51
|
+
logoImage?: string;
|
|
51
52
|
menu?: string;
|
|
52
53
|
tabs?: string;
|
|
53
|
-
breadcrumb?: string;
|
|
54
54
|
}>;
|
|
55
55
|
proStyles: import("vue").ComputedRef<{
|
|
56
|
-
root?: import("vue").CSSProperties;
|
|
57
|
-
header?: import("vue").CSSProperties;
|
|
58
|
-
sider?: import("vue").CSSProperties;
|
|
59
|
-
siderChildren?: import("vue").CSSProperties;
|
|
60
56
|
siderHeader?: import("vue").CSSProperties;
|
|
61
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
62
|
logo?: import("vue").CSSProperties;
|
|
63
|
-
logoImage?: import("vue").CSSProperties;
|
|
64
63
|
content?: import("vue").CSSProperties;
|
|
65
|
-
|
|
64
|
+
root?: import("vue").CSSProperties;
|
|
65
|
+
siderChildren?: import("vue").CSSProperties;
|
|
66
|
+
logoImage?: import("vue").CSSProperties;
|
|
66
67
|
menu?: import("vue").CSSProperties;
|
|
67
68
|
tabs?: import("vue").CSSProperties;
|
|
68
|
-
breadcrumb?: import("vue").CSSProperties;
|
|
69
69
|
}>;
|
|
70
70
|
breadcrumbRender: import("vue").Ref<(props: LayoutBreadcrumbSlotProps) => any, (props: LayoutBreadcrumbSlotProps) => any>;
|
|
71
71
|
breadcrumbConfig: import("vue").ComputedRef<LayoutBreadcrumbConfig>;
|
package/dist/hooks/useMenu.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ interface UseLayoutMenuOptions {
|
|
|
10
10
|
selectedKeys?: MaybeRefOrGetter<string[] | undefined>;
|
|
11
11
|
/** 外部受控展开菜单;不传则由当前路由链自动推导 */
|
|
12
12
|
openKeys?: MaybeRefOrGetter<string[] | undefined>;
|
|
13
|
-
/** 菜单配置(autoClose
|
|
13
|
+
/** 菜单配置(autoClose 等) */
|
|
14
14
|
config: MaybeRefOrGetter<LayoutMenuConfig>;
|
|
15
|
-
/**
|
|
15
|
+
/** 布局模式;`mix` 模式强制分割头部/侧边菜单 */
|
|
16
16
|
layout?: MaybeRefOrGetter<GProLayoutProps['layout']>;
|
|
17
|
-
/**
|
|
17
|
+
/** 移动端;移动端关闭菜单分割 */
|
|
18
18
|
isMobile?: MaybeRefOrGetter<boolean>;
|
|
19
19
|
/** 当前选中菜单名,默认取 `useRoute().name` */
|
|
20
20
|
currentName?: () => string | undefined;
|
|
@@ -34,9 +34,9 @@ interface LayoutMenuState {
|
|
|
34
34
|
breadcrumbItems: ComputedRef<BreadcrumbItemType[]>;
|
|
35
35
|
/** 当前路由 meta */
|
|
36
36
|
currentMeta: ComputedRef<Meta>;
|
|
37
|
-
/** 头部菜单路由分支(mix
|
|
37
|
+
/** 头部菜单路由分支(mix 时为顶层、剥子级) */
|
|
38
38
|
headerMenus: ComputedRef<LayoutMenuRoute[]>;
|
|
39
|
-
/** 侧边菜单路由分支(mix
|
|
39
|
+
/** 侧边菜单路由分支(mix 时为激活顶层的子级) */
|
|
40
40
|
siderMenus: ComputedRef<LayoutMenuRoute[]>;
|
|
41
41
|
/** 解析点击菜单后的跳转目标 */
|
|
42
42
|
resolveRoute: (name: string) => ResolveRouteResult;
|
package/dist/hooks/useMenu.js
CHANGED
|
@@ -33,7 +33,7 @@ function useMenu(options) {
|
|
|
33
33
|
const currentMeta = computed(() => lookup.value.get(currentName.value ?? "")?.route.meta ?? {});
|
|
34
34
|
const breadcrumbRoutes = computed(() => buildBreadcrumbRoutes(matchedChain.value, { current: lookup.value.get(currentName.value ?? "")?.route }));
|
|
35
35
|
const breadcrumbItems = computed(() => toBreadcrumbItems(breadcrumbRoutes.value));
|
|
36
|
-
const splitActive = computed(() => toValue(options.layout) === "mix" && !toValue(options.isMobile)
|
|
36
|
+
const splitActive = computed(() => toValue(options.layout) === "mix" && !toValue(options.isMobile));
|
|
37
37
|
const topName = computed(() => matchedChain.value[0]?.name);
|
|
38
38
|
const headerMenus = computed(() => splitActive.value ? menus.value.map((menu) => ({
|
|
39
39
|
...menu,
|