@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
|
@@ -3,19 +3,19 @@ import { CSSProperties } from "vue";
|
|
|
3
3
|
import { CustomRender } from "@gx-design-vue/pro-utils";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Menu/interface.d.ts
|
|
6
|
-
interface
|
|
6
|
+
interface ProMenuEmits {
|
|
7
7
|
'select': (info: LayoutSelectInfo) => void;
|
|
8
8
|
'openChange': (keys: string[]) => void;
|
|
9
9
|
'update:selectedKeys': (keys: string[]) => void;
|
|
10
10
|
'update:openKeys': (keys: string[]) => void;
|
|
11
11
|
}
|
|
12
|
-
interface
|
|
13
|
-
onSelect?:
|
|
14
|
-
onOpenChange?:
|
|
15
|
-
'onUpdate:selectedKeys'?:
|
|
16
|
-
'onUpdate:openKeys'?:
|
|
12
|
+
interface ProMenuEmitsProps {
|
|
13
|
+
onSelect?: ProMenuEmits['select'];
|
|
14
|
+
onOpenChange?: ProMenuEmits['openChange'];
|
|
15
|
+
'onUpdate:selectedKeys'?: ProMenuEmits['update:selectedKeys'];
|
|
16
|
+
'onUpdate:openKeys'?: ProMenuEmits['update:openKeys'];
|
|
17
17
|
}
|
|
18
|
-
interface
|
|
18
|
+
interface ProMenuProps extends ProMenuEmitsProps {
|
|
19
19
|
class?: string;
|
|
20
20
|
style?: CSSProperties;
|
|
21
21
|
/** 渲染位置:侧边 / 头部 */
|
|
@@ -39,12 +39,12 @@ interface LayoutMenuProps extends LayoutMenuEmitsProps {
|
|
|
39
39
|
/** 菜单项额外内容(等价 #menuItemExtra slot) */
|
|
40
40
|
menuItemExtra?: (slotProps: LayoutMenuItemSlotProps) => CustomRender;
|
|
41
41
|
}
|
|
42
|
-
interface
|
|
42
|
+
interface ProMenuSlots {
|
|
43
43
|
menuItemIcon?: (props: LayoutMenuItemSlotProps) => any;
|
|
44
44
|
menuItemLabel?: (props: LayoutMenuItemSlotProps) => any;
|
|
45
45
|
menuItemExtra?: (props: LayoutMenuItemSlotProps) => any;
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
declare const
|
|
47
|
+
/** ProMenu 的 slot key 列表,供 `getSlotsProps` 合并「prop > slot」。 */
|
|
48
|
+
declare const PRO_MENU_SLOT_KEYS: readonly ["menuItemIcon", "menuItemLabel", "menuItemExtra"];
|
|
49
49
|
//#endregion
|
|
50
|
-
export {
|
|
50
|
+
export { PRO_MENU_SLOT_KEYS, ProMenuEmits, ProMenuEmitsProps, ProMenuProps, ProMenuSlots };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/components/Menu/interface.ts
|
|
2
|
-
/**
|
|
3
|
-
const
|
|
2
|
+
/** ProMenu 的 slot key 列表,供 `getSlotsProps` 合并「prop > slot」。 */
|
|
3
|
+
const PRO_MENU_SLOT_KEYS = [
|
|
4
4
|
"menuItemIcon",
|
|
5
5
|
"menuItemLabel",
|
|
6
6
|
"menuItemExtra"
|
|
7
7
|
];
|
|
8
8
|
//#endregion
|
|
9
|
-
export {
|
|
9
|
+
export { PRO_MENU_SLOT_KEYS };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/components/Menu/overflow.d.ts
|
|
4
|
+
interface UseMenuOverflowOptions {
|
|
5
|
+
/** 是否启用溢出收起(仅 horizontal 模式) */
|
|
6
|
+
enabled: Ref<boolean>;
|
|
7
|
+
/** 一级菜单项总数(响应式) */
|
|
8
|
+
totalCount: Ref<number>;
|
|
9
|
+
/** 「...」触发器预估宽度(首次测量前的兜底) */
|
|
10
|
+
restWidth?: number;
|
|
11
|
+
/** 一级项 DOM 选择器(默认 [data-overflow-item]) */
|
|
12
|
+
itemSelector?: string;
|
|
13
|
+
/** 「...」触发器 DOM 选择器(默认 [data-overflow-rest]) */
|
|
14
|
+
restSelector?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 轻量水平菜单溢出收起 hook(思路参考 @v-c/overflow)。
|
|
18
|
+
*
|
|
19
|
+
* 防闪烁策略(解决「右侧内容/面包屑异步渲染 → 容器宽度后变 → 省略号延迟出现」):
|
|
20
|
+
*
|
|
21
|
+
* 1. 隐藏项样式由 Menu 的 li 负责,用 `position:absolute + opacity:0` 而非 `display:none` ——
|
|
22
|
+
* 元素脱离文档流(不挤占可见项)但 `offsetWidth` 仍可测,测量零延迟,无需临时改 style;
|
|
23
|
+
* 2. `lastVisibleIndex` 起步保守(0),首屏不「全显示」,靠 ResizeObserver 数据就绪后展开,
|
|
24
|
+
* 把闪烁方向从「全显示→收起」(刺眼)改为「少显示→展开」(温和);
|
|
25
|
+
* 3. `restReady` 闸门:「...」触发器始终在 DOM(量宽度),但只有一次「所有项宽度就绪」的
|
|
26
|
+
* 完整计算确认溢出,`restReady` 才为 true,「...」才显示 —— 避免基于错误容器宽度的省略号跳变;
|
|
27
|
+
* 4. 不赌固定帧数:去掉 `nextTick + rAF(N帧)` buffer,ResizeObserver 是唯一权威触发源,
|
|
28
|
+
* 容器宽度变化(右侧内容异步渲染)会自动重算(自纠正)。
|
|
29
|
+
*/
|
|
30
|
+
declare function useMenuOverflow(options: UseMenuOverflowOptions): {
|
|
31
|
+
containerRef: Ref<HTMLElement, HTMLElement>;
|
|
32
|
+
recalc: () => void;
|
|
33
|
+
lastVisibleIndex: Ref<number, number>;
|
|
34
|
+
isItemHidden: (index: number) => boolean;
|
|
35
|
+
restVisible: import("vue").ComputedRef<boolean>;
|
|
36
|
+
hiddenIndexes: import("vue").ComputedRef<number[]>;
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { useMenuOverflow };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
2
|
+
import { useResizeObserver } from "@vueuse/core";
|
|
3
|
+
//#region src/components/Menu/overflow.ts
|
|
4
|
+
/**
|
|
5
|
+
* 轻量水平菜单溢出收起 hook(思路参考 @v-c/overflow)。
|
|
6
|
+
*
|
|
7
|
+
* 防闪烁策略(解决「右侧内容/面包屑异步渲染 → 容器宽度后变 → 省略号延迟出现」):
|
|
8
|
+
*
|
|
9
|
+
* 1. 隐藏项样式由 Menu 的 li 负责,用 `position:absolute + opacity:0` 而非 `display:none` ——
|
|
10
|
+
* 元素脱离文档流(不挤占可见项)但 `offsetWidth` 仍可测,测量零延迟,无需临时改 style;
|
|
11
|
+
* 2. `lastVisibleIndex` 起步保守(0),首屏不「全显示」,靠 ResizeObserver 数据就绪后展开,
|
|
12
|
+
* 把闪烁方向从「全显示→收起」(刺眼)改为「少显示→展开」(温和);
|
|
13
|
+
* 3. `restReady` 闸门:「...」触发器始终在 DOM(量宽度),但只有一次「所有项宽度就绪」的
|
|
14
|
+
* 完整计算确认溢出,`restReady` 才为 true,「...」才显示 —— 避免基于错误容器宽度的省略号跳变;
|
|
15
|
+
* 4. 不赌固定帧数:去掉 `nextTick + rAF(N帧)` buffer,ResizeObserver 是唯一权威触发源,
|
|
16
|
+
* 容器宽度变化(右侧内容异步渲染)会自动重算(自纠正)。
|
|
17
|
+
*/
|
|
18
|
+
function useMenuOverflow(options) {
|
|
19
|
+
const { enabled, totalCount, restWidth = 48, itemSelector = "[data-overflow-item]", restSelector = "[data-overflow-rest]" } = options;
|
|
20
|
+
/** 绑定到水平菜单容器(ul) */
|
|
21
|
+
const containerRef = ref();
|
|
22
|
+
/** 最后一个可见项的下标;起步 0(只第 0 项可见),测量后展开。MAX_SAFE_INTEGER 表示全部可见 */
|
|
23
|
+
const lastVisibleIndex = ref(0);
|
|
24
|
+
/** 是否已完成一次「所有项宽度就绪」的完整计算;「...」文字在此前不显示 */
|
|
25
|
+
const restReady = ref(false);
|
|
26
|
+
let disposed = false;
|
|
27
|
+
function recalc() {
|
|
28
|
+
if (disposed) return;
|
|
29
|
+
if (!enabled.value) {
|
|
30
|
+
lastVisibleIndex.value = Number.MAX_SAFE_INTEGER;
|
|
31
|
+
restReady.value = false;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const container = containerRef.value;
|
|
35
|
+
if (!container) return;
|
|
36
|
+
const containerWidth = container.clientWidth;
|
|
37
|
+
if (!containerWidth) return;
|
|
38
|
+
const items = Array.from(container.querySelectorAll(itemSelector));
|
|
39
|
+
let total = container.querySelector(restSelector)?.offsetWidth ?? restWidth;
|
|
40
|
+
let visible = 0;
|
|
41
|
+
let allMeasured = true;
|
|
42
|
+
for (const el of items) {
|
|
43
|
+
const itemWidth = el.offsetWidth;
|
|
44
|
+
if (!itemWidth) {
|
|
45
|
+
allMeasured = false;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
if (total + itemWidth > containerWidth) break;
|
|
49
|
+
total += itemWidth;
|
|
50
|
+
visible++;
|
|
51
|
+
}
|
|
52
|
+
if (!allMeasured) {
|
|
53
|
+
lastVisibleIndex.value = Math.max(visible - 1, 0);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
lastVisibleIndex.value = visible >= totalCount.value ? Number.MAX_SAFE_INTEGER : Math.max(visible - 1, 0);
|
|
57
|
+
restReady.value = visible < totalCount.value;
|
|
58
|
+
}
|
|
59
|
+
useResizeObserver(containerRef, recalc);
|
|
60
|
+
watch([enabled, totalCount], recalc, { flush: "post" });
|
|
61
|
+
onBeforeUnmount(() => {
|
|
62
|
+
disposed = true;
|
|
63
|
+
});
|
|
64
|
+
/** 某个下标的一级项是否被收起(隐藏) */
|
|
65
|
+
function isItemHidden(index) {
|
|
66
|
+
return enabled.value && index > lastVisibleIndex.value;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
containerRef,
|
|
70
|
+
recalc,
|
|
71
|
+
lastVisibleIndex,
|
|
72
|
+
isItemHidden,
|
|
73
|
+
restVisible: computed(() => enabled.value && restReady.value && lastVisibleIndex.value < totalCount.value - 1),
|
|
74
|
+
hiddenIndexes: computed(() => {
|
|
75
|
+
if (!enabled.value || lastVisibleIndex.value === Number.MAX_SAFE_INTEGER) return [];
|
|
76
|
+
return Array.from({ length: totalCount.value }, (_, index) => index).filter((index) => index > lastVisibleIndex.value);
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { useMenuOverflow };
|
|
@@ -0,0 +1,12 @@
|
|
|
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/base.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Base 样式只放模式无关的结构约束。
|
|
8
|
+
* inline / horizontal 的颜色、尺寸、active bar 由各自文件覆盖。
|
|
9
|
+
*/
|
|
10
|
+
declare const genBaseStyle: GenerateStyle<MenuToken, CSSObject>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { genBaseStyle as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/components/Menu/style/base.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base 样式只放模式无关的结构约束。
|
|
4
|
+
* inline / horizontal 的颜色、尺寸、active bar 由各自文件覆盖。
|
|
5
|
+
*/
|
|
6
|
+
const genBaseStyle = (token) => {
|
|
7
|
+
const { componentCls } = token;
|
|
8
|
+
return { [`${componentCls}`]: {
|
|
9
|
+
boxSizing: "border-box",
|
|
10
|
+
margin: 0,
|
|
11
|
+
padding: 0,
|
|
12
|
+
fontSize: token.fontSize,
|
|
13
|
+
lineHeight: 0,
|
|
14
|
+
listStyle: "none",
|
|
15
|
+
outline: "none",
|
|
16
|
+
"ul, ol": {
|
|
17
|
+
margin: 0,
|
|
18
|
+
padding: 0,
|
|
19
|
+
listStyle: "none"
|
|
20
|
+
},
|
|
21
|
+
[`${componentCls}-node`]: {
|
|
22
|
+
margin: 0,
|
|
23
|
+
padding: 0,
|
|
24
|
+
listStyle: "none"
|
|
25
|
+
},
|
|
26
|
+
[`${componentCls}-item`]: {
|
|
27
|
+
position: "relative",
|
|
28
|
+
boxSizing: "border-box",
|
|
29
|
+
cursor: "pointer"
|
|
30
|
+
},
|
|
31
|
+
[`${componentCls}-icon`]: { color: "currentcolor" },
|
|
32
|
+
[`${componentCls}-title`]: { minWidth: 0 }
|
|
33
|
+
} };
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { genBaseStyle as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
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/horizontal.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Horizontal 模式样式(水平菜单)。
|
|
8
|
+
*
|
|
9
|
+
* 不独立注册 token key,由 index.ts 用数组合并进 ProMenu 命名空间
|
|
10
|
+
* (对齐 antdv-next menu/style/index.ts 的 `[base, horizontal, vertical, theme]` 合并方式)。
|
|
11
|
+
*
|
|
12
|
+
* 选择器统一加 `${componentCls}-horizontal ` 前缀,仅作用于水平态,不污染 inline。
|
|
13
|
+
* active bar 复用 `::after` borderBottom 透明→选中色贴底,并显式重置 inline 右侧 bar 的
|
|
14
|
+
* transform/insetBlock/borderInlineEnd,避免与 inline `::after` 叠加。
|
|
15
|
+
* popup(子菜单下拉)在 horizontal popover / popup-list 分组内独立处理 header token。
|
|
16
|
+
*/
|
|
17
|
+
declare const genHorizontalStyle: GenerateStyle<MenuToken, CSSObject>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { genHorizontalStyle as default };
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { unit } from "@antdv-next/cssinjs";
|
|
2
|
+
//#region src/components/Menu/style/horizontal.ts
|
|
3
|
+
/**
|
|
4
|
+
* Horizontal 模式样式(水平菜单)。
|
|
5
|
+
*
|
|
6
|
+
* 不独立注册 token key,由 index.ts 用数组合并进 ProMenu 命名空间
|
|
7
|
+
* (对齐 antdv-next menu/style/index.ts 的 `[base, horizontal, vertical, theme]` 合并方式)。
|
|
8
|
+
*
|
|
9
|
+
* 选择器统一加 `${componentCls}-horizontal ` 前缀,仅作用于水平态,不污染 inline。
|
|
10
|
+
* active bar 复用 `::after` borderBottom 透明→选中色贴底,并显式重置 inline 右侧 bar 的
|
|
11
|
+
* transform/insetBlock/borderInlineEnd,避免与 inline `::after` 叠加。
|
|
12
|
+
* popup(子菜单下拉)在 horizontal popover / popup-list 分组内独立处理 header token。
|
|
13
|
+
*/
|
|
14
|
+
const genHorizontalStyle = (token) => {
|
|
15
|
+
const { antCls, componentCls } = token;
|
|
16
|
+
const iconSize = unit(token.iconSize || token.fontSize);
|
|
17
|
+
const headerMenuItemHeight = token.headerHeightLayoutHeader || token.itemHeight || token.controlHeightLG;
|
|
18
|
+
const headerMenuPaddingInline = token.itemPaddingInline ?? token.padding;
|
|
19
|
+
const activeBarHeight = unit(token.activeBarHeight);
|
|
20
|
+
const titleGap = token.iconMarginInlineEnd ?? token.marginSM;
|
|
21
|
+
const popupIconSize = unit(token.menuItemIconSize || token.iconSize || token.fontSize);
|
|
22
|
+
const popupItemHeight = token.itemHeight || token.controlHeight;
|
|
23
|
+
const popupMenuItemMarginInline = token.itemMarginInline ?? token.marginXXS;
|
|
24
|
+
const popupMenuItemMarginBlock = token.itemMarginBlock ?? token.marginXXS;
|
|
25
|
+
const popupMenuBasePadding = token.itemPaddingInline ?? token.padding;
|
|
26
|
+
const popupMenuArrowSize = token.calc(token.fontSize).div(7).mul(5).equal();
|
|
27
|
+
const popupMenuArrowOffset = token.calc(popupMenuArrowSize).mul(.25).equal();
|
|
28
|
+
const popupMenuPaddingWithArrow = token.calc(popupMenuArrowSize).add(token.padding).add(token.marginXS).equal();
|
|
29
|
+
const popupMenuTitleGap = token.iconMarginInlineEnd ?? token.marginSM;
|
|
30
|
+
const popupItemWidth = token.itemWidth || `calc(100% - ${unit(token.calc(popupMenuItemMarginInline).mul(2).equal())})`;
|
|
31
|
+
return {
|
|
32
|
+
[`${componentCls}`]: {
|
|
33
|
+
[`&${componentCls}-horizontal`]: {
|
|
34
|
+
display: "flex",
|
|
35
|
+
alignItems: "stretch",
|
|
36
|
+
flex: "auto",
|
|
37
|
+
minWidth: 0,
|
|
38
|
+
height: headerMenuItemHeight,
|
|
39
|
+
lineHeight: unit(headerMenuItemHeight),
|
|
40
|
+
border: 0,
|
|
41
|
+
borderBottom: `${unit(token.activeBarBorderWidth ?? token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
|
42
|
+
boxShadow: "none",
|
|
43
|
+
whiteSpace: "nowrap",
|
|
44
|
+
overflow: "hidden",
|
|
45
|
+
"&::after": {
|
|
46
|
+
display: "block",
|
|
47
|
+
clear: "both",
|
|
48
|
+
height: 0,
|
|
49
|
+
content: "\"\\20\""
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
[`&${componentCls}-overflow`]: {
|
|
53
|
+
display: "flex",
|
|
54
|
+
flex: "auto",
|
|
55
|
+
minWidth: 0,
|
|
56
|
+
height: "100%",
|
|
57
|
+
[`${componentCls}-item, ${componentCls}-submenu`]: { flex: "none" }
|
|
58
|
+
},
|
|
59
|
+
[`&${componentCls}-horizontal ${componentCls}-node`]: {
|
|
60
|
+
display: "inline-flex",
|
|
61
|
+
verticalAlign: "bottom",
|
|
62
|
+
margin: 0,
|
|
63
|
+
padding: 0,
|
|
64
|
+
listStyle: "none"
|
|
65
|
+
},
|
|
66
|
+
[`&${componentCls}-horizontal ${componentCls}-item, &${componentCls}-horizontal ${componentCls}-submenu-title`]: {
|
|
67
|
+
display: "inline-flex",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
height: "100%",
|
|
70
|
+
minHeight: 0,
|
|
71
|
+
marginBlock: 0,
|
|
72
|
+
marginInline: 0,
|
|
73
|
+
paddingInline: headerMenuPaddingInline,
|
|
74
|
+
lineHeight: unit(headerMenuItemHeight),
|
|
75
|
+
whiteSpace: "nowrap",
|
|
76
|
+
textOverflow: "ellipsis",
|
|
77
|
+
color: token.headerColorTextMenu || token.itemColor,
|
|
78
|
+
borderRadius: token.headerItemBorderRadius ?? token.horizontalItemBorderRadius,
|
|
79
|
+
"&::after": {
|
|
80
|
+
position: "absolute",
|
|
81
|
+
insetBlock: "auto",
|
|
82
|
+
insetBlockEnd: 0,
|
|
83
|
+
insetInline: headerMenuPaddingInline,
|
|
84
|
+
borderInlineEnd: "none",
|
|
85
|
+
borderBottom: `${activeBarHeight} solid transparent`,
|
|
86
|
+
transform: "none",
|
|
87
|
+
opacity: 1,
|
|
88
|
+
transition: `border-color ${token.motionDurationSlow} ${token.motionEaseInOut}`,
|
|
89
|
+
content: "\"\""
|
|
90
|
+
},
|
|
91
|
+
[`&:not(${componentCls}-item-selected):not(${componentCls}-item-disabled):hover`]: {
|
|
92
|
+
color: token.headerColorTextMenuActive,
|
|
93
|
+
background: token.headerColorBgMenuItemHover || token.horizontalItemHoverBg,
|
|
94
|
+
"&::after": { borderBottomColor: token.headerColorTextMenuSelected }
|
|
95
|
+
},
|
|
96
|
+
[`&${componentCls}-item-active`]: {
|
|
97
|
+
color: token.headerColorTextSubMenuSelected,
|
|
98
|
+
"&::after": { borderBottomColor: token.headerColorTextMenuSelected }
|
|
99
|
+
},
|
|
100
|
+
[`&${componentCls}-item-selected`]: {
|
|
101
|
+
color: token.headerColorTextMenuSelected,
|
|
102
|
+
backgroundColor: token.headerColorBgMenuItemSelected,
|
|
103
|
+
"&::after": {
|
|
104
|
+
transform: "none",
|
|
105
|
+
opacity: 1,
|
|
106
|
+
borderBottomColor: token.headerColorTextMenuSelected
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
[`&${componentCls}-horizontal ${componentCls}-submenu-arrow, &${componentCls}-horizontal ${componentCls}-arrow`]: { display: "none" },
|
|
111
|
+
[`&${componentCls}-horizontal ${componentCls}-icon`]: {
|
|
112
|
+
display: "inline-flex",
|
|
113
|
+
flex: "none",
|
|
114
|
+
alignItems: "center",
|
|
115
|
+
justifyContent: "center",
|
|
116
|
+
minWidth: iconSize,
|
|
117
|
+
height: iconSize,
|
|
118
|
+
marginInlineEnd: titleGap,
|
|
119
|
+
color: "currentcolor",
|
|
120
|
+
fontSize: iconSize,
|
|
121
|
+
lineHeight: iconSize,
|
|
122
|
+
img: {
|
|
123
|
+
width: iconSize,
|
|
124
|
+
height: iconSize,
|
|
125
|
+
objectFit: "contain"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
[`&${componentCls}-horizontal ${componentCls}-title`]: {
|
|
129
|
+
flex: "auto",
|
|
130
|
+
minWidth: 0,
|
|
131
|
+
overflow: "hidden",
|
|
132
|
+
textOverflow: "ellipsis",
|
|
133
|
+
whiteSpace: "nowrap"
|
|
134
|
+
},
|
|
135
|
+
[`&${componentCls}-horizontal ${componentCls}-extra`]: {
|
|
136
|
+
flex: "none",
|
|
137
|
+
marginInlineStart: "auto",
|
|
138
|
+
paddingInlineStart: token.padding,
|
|
139
|
+
color: token.headerColorTextMenuSecondary || token.groupTitleColor
|
|
140
|
+
},
|
|
141
|
+
[`&${componentCls}-horizontal ${componentCls}-group-title`]: {
|
|
142
|
+
boxSizing: "border-box",
|
|
143
|
+
paddingBlock: token.paddingXXS,
|
|
144
|
+
paddingInlineStart: headerMenuPaddingInline,
|
|
145
|
+
paddingInlineEnd: token.padding,
|
|
146
|
+
color: token.headerColorTextMenuSecondary || token.groupTitleColor,
|
|
147
|
+
fontSize: token.groupTitleFontSize,
|
|
148
|
+
lineHeight: token.groupTitleLineHeight
|
|
149
|
+
},
|
|
150
|
+
[`&${componentCls}-horizontal ${componentCls}-divider`]: {
|
|
151
|
+
overflow: "hidden",
|
|
152
|
+
lineHeight: 0,
|
|
153
|
+
alignSelf: "center",
|
|
154
|
+
height: "60%",
|
|
155
|
+
marginInline: token.marginXS,
|
|
156
|
+
borderColor: token.colorSplit,
|
|
157
|
+
borderStyle: token.lineType,
|
|
158
|
+
borderWidth: 0,
|
|
159
|
+
borderInlineStartWidth: token.lineWidth,
|
|
160
|
+
borderTopWidth: 0,
|
|
161
|
+
padding: 0
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
[`${componentCls}-horizontal-popover${antCls}-popover`]: {
|
|
165
|
+
borderRadius: token.borderRadiusLG,
|
|
166
|
+
boxShadow: "none",
|
|
167
|
+
transformOrigin: "0 0",
|
|
168
|
+
zIndex: token.zIndexPopup,
|
|
169
|
+
[`&${componentCls}-submenu-placement-bottomLeft`]: { paddingBlockStart: token.paddingXS },
|
|
170
|
+
[`&${componentCls}-submenu-placement-nested`]: { paddingInlineStart: token.marginXXS },
|
|
171
|
+
[`${antCls}-popover-container, ${antCls}-popover-content, ${componentCls}-popover-content, ${componentCls}-popover-container`]: {
|
|
172
|
+
padding: 0,
|
|
173
|
+
background: "transparent",
|
|
174
|
+
borderRadius: token.borderRadiusLG,
|
|
175
|
+
boxShadow: "none"
|
|
176
|
+
},
|
|
177
|
+
[`${componentCls}-submenu-popup`]: {
|
|
178
|
+
position: "relative",
|
|
179
|
+
borderRadius: token.borderRadiusLG,
|
|
180
|
+
background: "transparent",
|
|
181
|
+
[`> ${componentCls}`]: {
|
|
182
|
+
borderRadius: token.borderRadiusLG,
|
|
183
|
+
boxShadow: token.boxShadowSecondary,
|
|
184
|
+
backgroundColor: token.headerColorBgMenuElevated || token.popupBg
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
[`${componentCls}-horizontal-popup-list`]: {
|
|
189
|
+
minWidth: token.dropdownWidth,
|
|
190
|
+
maxWidth: token.dropdownWidth,
|
|
191
|
+
maxHeight: `calc(100vh - ${unit(token.calc(token.controlHeightLG).mul(2.5).equal())})`,
|
|
192
|
+
padding: 0,
|
|
193
|
+
overflow: "hidden auto",
|
|
194
|
+
borderInlineEnd: 0,
|
|
195
|
+
color: token.headerColorTextMenu || token.itemColor,
|
|
196
|
+
background: token.headerColorBgMenuElevated || token.popupBg,
|
|
197
|
+
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
|
|
198
|
+
position: "relative",
|
|
199
|
+
display: "flex",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
boxSizing: "border-box",
|
|
202
|
+
width: popupItemWidth,
|
|
203
|
+
height: popupItemHeight,
|
|
204
|
+
minHeight: popupItemHeight,
|
|
205
|
+
marginBlock: popupMenuItemMarginBlock,
|
|
206
|
+
marginInline: popupMenuItemMarginInline,
|
|
207
|
+
paddingInline: popupMenuBasePadding,
|
|
208
|
+
overflow: "hidden",
|
|
209
|
+
color: token.headerColorTextMenu || token.itemColor,
|
|
210
|
+
lineHeight: unit(popupItemHeight),
|
|
211
|
+
whiteSpace: "nowrap",
|
|
212
|
+
textOverflow: "ellipsis",
|
|
213
|
+
cursor: "pointer",
|
|
214
|
+
borderRadius: token.subMenuItemBorderRadius,
|
|
215
|
+
transition: [
|
|
216
|
+
`border-color ${token.motionDurationSlow}`,
|
|
217
|
+
`color ${token.motionDurationSlow}`,
|
|
218
|
+
`background-color ${token.motionDurationSlow}`,
|
|
219
|
+
`padding ${token.motionDurationFast} ${token.motionEaseOut}`
|
|
220
|
+
].join(","),
|
|
221
|
+
"> *": { flex: "none" }
|
|
222
|
+
},
|
|
223
|
+
[`${componentCls}-submenu-title`]: { paddingInlineEnd: popupMenuPaddingWithArrow },
|
|
224
|
+
[`${componentCls}-icon`]: {
|
|
225
|
+
display: "inline-flex",
|
|
226
|
+
flex: "none",
|
|
227
|
+
alignItems: "center",
|
|
228
|
+
justifyContent: "center",
|
|
229
|
+
minWidth: popupIconSize,
|
|
230
|
+
height: popupIconSize,
|
|
231
|
+
marginInlineEnd: popupMenuTitleGap,
|
|
232
|
+
color: "currentcolor",
|
|
233
|
+
fontSize: popupIconSize,
|
|
234
|
+
lineHeight: popupIconSize,
|
|
235
|
+
transition: [
|
|
236
|
+
`font-size ${token.motionDurationMid} ${token.motionEaseOut}`,
|
|
237
|
+
`margin ${token.motionDurationSlow} ${token.motionEaseInOut}`,
|
|
238
|
+
`color ${token.motionDurationSlow}`
|
|
239
|
+
].join(","),
|
|
240
|
+
img: {
|
|
241
|
+
width: popupIconSize,
|
|
242
|
+
height: popupIconSize,
|
|
243
|
+
objectFit: "contain"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
[`${componentCls}-title`]: {
|
|
247
|
+
flex: "auto",
|
|
248
|
+
minWidth: 0,
|
|
249
|
+
overflow: "hidden",
|
|
250
|
+
textOverflow: "ellipsis",
|
|
251
|
+
whiteSpace: "nowrap",
|
|
252
|
+
transition: [
|
|
253
|
+
`opacity ${token.motionDurationSlow} ${token.motionEaseInOut}`,
|
|
254
|
+
`margin ${token.motionDurationSlow}`,
|
|
255
|
+
`color ${token.motionDurationSlow}`
|
|
256
|
+
].join(",")
|
|
257
|
+
},
|
|
258
|
+
[`${componentCls}-extra`]: {
|
|
259
|
+
flex: "none",
|
|
260
|
+
marginInlineStart: "auto",
|
|
261
|
+
paddingInlineStart: token.padding,
|
|
262
|
+
color: token.headerColorTextMenuSecondary || token.groupTitleColor
|
|
263
|
+
},
|
|
264
|
+
[`${componentCls}-arrow`]: {
|
|
265
|
+
position: "absolute",
|
|
266
|
+
top: "50%",
|
|
267
|
+
insetInlineEnd: token.margin,
|
|
268
|
+
width: popupMenuArrowSize,
|
|
269
|
+
color: "currentcolor",
|
|
270
|
+
transform: "translateY(-50%)",
|
|
271
|
+
transition: ["transform", "opacity"].map((prop) => `${prop} ${token.motionDurationSlow}`).join(","),
|
|
272
|
+
"&::before, &::after": {
|
|
273
|
+
position: "absolute",
|
|
274
|
+
width: token.calc(popupMenuArrowSize).mul(.6).equal(),
|
|
275
|
+
height: token.calc(popupMenuArrowSize).mul(.15).equal(),
|
|
276
|
+
backgroundColor: "currentcolor",
|
|
277
|
+
borderRadius: token.borderRadius,
|
|
278
|
+
transition: [
|
|
279
|
+
"background-color",
|
|
280
|
+
"transform",
|
|
281
|
+
"top",
|
|
282
|
+
"color"
|
|
283
|
+
].map((prop) => `${prop} ${token.motionDurationSlow} ${token.motionEaseInOut}`).join(","),
|
|
284
|
+
content: "\"\""
|
|
285
|
+
},
|
|
286
|
+
"&::before": { transform: `rotate(45deg) translateY(${unit(token.calc(popupMenuArrowOffset).mul(-1).equal())})` },
|
|
287
|
+
"&::after": { transform: `rotate(-45deg) translateY(${unit(popupMenuArrowOffset)})` }
|
|
288
|
+
},
|
|
289
|
+
[`${componentCls}-item:not(${componentCls}-item-selected):not(${componentCls}-item-active):hover,
|
|
290
|
+
${componentCls}-submenu-title:not(${componentCls}-item-selected):not(${componentCls}-item-active):hover`]: {
|
|
291
|
+
color: token.headerColorTextMenuActive,
|
|
292
|
+
backgroundColor: token.headerColorBgMenuItemHover
|
|
293
|
+
},
|
|
294
|
+
[`${componentCls}-item-active, ${componentCls}-submenu-active > ${componentCls}-submenu-title`]: { color: token.headerColorTextSubMenuSelected || token.headerColorTextMenuSelected },
|
|
295
|
+
[`${componentCls}-item-selected`]: {
|
|
296
|
+
color: token.headerColorTextMenuSelected,
|
|
297
|
+
backgroundColor: token.headerColorBgMenuItemSelected
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
//#endregion
|
|
303
|
+
export { genHorizontalStyle as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CSSProperties } from "vue";
|
|
2
|
+
import { ProFullToken } from "@gx-design-vue/pro-provider";
|
|
2
3
|
import { GetDefaultToken } from "antdv-next/dist/theme/internal";
|
|
3
4
|
|
|
4
|
-
//#region src/components/Menu/style/
|
|
5
|
+
//#region src/components/Menu/style/index.d.ts
|
|
5
6
|
/** Component only token. Which will handle additional calculation of alias token */
|
|
6
7
|
interface ComponentToken {
|
|
7
8
|
/**
|
|
@@ -59,6 +60,13 @@ interface ComponentToken {
|
|
|
59
60
|
* @descEN Hover color of menu item text
|
|
60
61
|
*/
|
|
61
62
|
itemHoverColor: string;
|
|
63
|
+
/** @deprecated Use `horizontalItemHoverColor` instead */
|
|
64
|
+
colorItemTextHoverHorizontal: string;
|
|
65
|
+
/**
|
|
66
|
+
* @desc 水平菜单项文字悬浮颜色
|
|
67
|
+
* @descEN Hover color of horizontal menu item text
|
|
68
|
+
*/
|
|
69
|
+
horizontalItemHoverColor: string;
|
|
62
70
|
/** @deprecated Use `itemSelectedColor` instead */
|
|
63
71
|
colorItemTextSelected: string;
|
|
64
72
|
/**
|
|
@@ -71,6 +79,13 @@ interface ComponentToken {
|
|
|
71
79
|
* @descEN Color of submenu title when submenu has selected item
|
|
72
80
|
*/
|
|
73
81
|
subMenuItemSelectedColor: string;
|
|
82
|
+
/** @deprecated Use `horizontalItemSelectedColor` instead */
|
|
83
|
+
colorItemTextSelectedHorizontal: string;
|
|
84
|
+
/**
|
|
85
|
+
* @desc 水平菜单项文字选中颜色
|
|
86
|
+
* @descEN Color of selected horizontal menu item text
|
|
87
|
+
*/
|
|
88
|
+
horizontalItemSelectedColor: string;
|
|
74
89
|
/** @deprecated Use `itemDisabledColor` instead */
|
|
75
90
|
colorItemTextDisabled: string;
|
|
76
91
|
/**
|
|
@@ -110,7 +125,7 @@ interface ComponentToken {
|
|
|
110
125
|
colorDangerItemBgSelected: string;
|
|
111
126
|
/**
|
|
112
127
|
* @desc 危险菜单项选中背景色
|
|
113
|
-
* @descEN Background color of selected danger
|
|
128
|
+
* @descEN Background color of selected danger item
|
|
114
129
|
*/
|
|
115
130
|
dangerItemSelectedBg: string;
|
|
116
131
|
/** @deprecated Use `itemBg` instead */
|
|
@@ -147,6 +162,13 @@ interface ComponentToken {
|
|
|
147
162
|
* @descEN Background color of menu item when selected
|
|
148
163
|
*/
|
|
149
164
|
itemSelectedBg: string;
|
|
165
|
+
/** @deprecated Use `horizontalItemSelectedBg` instead */
|
|
166
|
+
colorItemBgSelectedHorizontal: string;
|
|
167
|
+
/**
|
|
168
|
+
* @desc 水平菜单项选中态背景色
|
|
169
|
+
* @descEN Background color of horizontal menu item when selected
|
|
170
|
+
*/
|
|
171
|
+
horizontalItemSelectedBg: string;
|
|
150
172
|
/** @deprecated Use `activeBarWidth` instead */
|
|
151
173
|
colorActiveBarWidth: number | string;
|
|
152
174
|
/**
|
|
@@ -173,6 +195,11 @@ interface ComponentToken {
|
|
|
173
195
|
* @descEN Horizontal margin of menu item
|
|
174
196
|
*/
|
|
175
197
|
itemMarginInline: number;
|
|
198
|
+
/**
|
|
199
|
+
* @desc 横向菜单项悬浮态背景色
|
|
200
|
+
* @descEN Background color of horizontal menu item when hover
|
|
201
|
+
*/
|
|
202
|
+
horizontalItemHoverBg: string;
|
|
176
203
|
/**
|
|
177
204
|
* @desc 菜单项高度
|
|
178
205
|
* @descEN Height of menu item
|
|
@@ -285,13 +312,45 @@ interface ComponentToken {
|
|
|
285
312
|
darkDangerItemSelectedColor: string;
|
|
286
313
|
/**
|
|
287
314
|
* @desc 暗色模式下的危险菜单项激活态背景
|
|
288
|
-
* @descEN Background of active danger menu item
|
|
315
|
+
* @descEN Background of active danger menu item
|
|
289
316
|
*/
|
|
290
317
|
darkDangerItemActiveBg: string;
|
|
318
|
+
/**
|
|
319
|
+
* @desc 水平菜单项行高
|
|
320
|
+
* @descEN LineHeight of horizontal menu item
|
|
321
|
+
*/
|
|
322
|
+
horizontalLineHeight: CSSProperties['lineHeight'];
|
|
323
|
+
/**
|
|
324
|
+
* @desc 水平菜单项圆角
|
|
325
|
+
* @descEN Border radius of horizontal menu item
|
|
326
|
+
*/
|
|
327
|
+
horizontalItemBorderRadius: number;
|
|
291
328
|
/** @internal */
|
|
292
329
|
itemWidth: number | string;
|
|
293
330
|
}
|
|
294
|
-
|
|
331
|
+
interface MenuToken extends ProFullToken<'ProMenu'> {
|
|
332
|
+
/**
|
|
333
|
+
* @desc 水平菜单高度
|
|
334
|
+
* @descEN Height of horizontal menu
|
|
335
|
+
*/
|
|
336
|
+
menuHorizontalHeight: number | string;
|
|
337
|
+
/**
|
|
338
|
+
* @desc 菜单箭头尺寸
|
|
339
|
+
* @descEN Size of menu arrow
|
|
340
|
+
*/
|
|
341
|
+
menuArrowSize: number | string;
|
|
342
|
+
/**
|
|
343
|
+
* @desc 菜单箭头偏移量
|
|
344
|
+
* @descEN Offset of menu arrow
|
|
345
|
+
*/
|
|
346
|
+
menuArrowOffset: number | string;
|
|
347
|
+
/**
|
|
348
|
+
* @desc 子菜单背景色
|
|
349
|
+
* @descEN Background color of sub-menu
|
|
350
|
+
*/
|
|
351
|
+
menuSubMenuBg: string;
|
|
352
|
+
}
|
|
353
|
+
declare const prepareComponentToken: GetDefaultToken<'ProMenu'>;
|
|
295
354
|
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>];
|
|
296
355
|
//#endregion
|
|
297
|
-
export { ComponentToken, _default as default, prepareComponentToken };
|
|
356
|
+
export { ComponentToken, MenuToken, _default as default, prepareComponentToken };
|