@zat-design/sisyphus-react 4.7.0-beta.1 → 4.7.0
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/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProEditTable/style/index.less +3 -0
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +184 -132
- package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +53 -14
- package/es/ProLayout/components/Layout/Menu/index.d.ts +1 -1
- package/es/ProLayout/components/Layout/Menu/index.js +2 -0
- package/es/ProLayout/components/Layout/Menu/style/index.less +6 -31
- package/es/ProLayout/index.js +3 -0
- package/es/ProLayout/propTypes.d.ts +5 -0
- package/es/ProLayout/style/index.less +24 -3
- package/es/ProLayout/style/variables.less +4 -0
- package/es/ProSelect/style/index.less +1 -1
- package/es/ProUpload/style/index.less +3 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from "react";
|
|
2
|
+
import { useContext, useEffect, useState } from "react";
|
|
3
3
|
import { Popover, Tooltip } from "antd";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import { Link as RouterLink } from "react-router-dom";
|
|
@@ -10,149 +10,201 @@ import { getUrlParams, getPathNameKey, findMenuItemByKey } from "../../../../uti
|
|
|
10
10
|
const Link = RouterLink;
|
|
11
11
|
const FoldMenu = (props) => {
|
|
12
12
|
const { style, dataSource, onMenuClick } = props;
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
menus,
|
|
15
|
+
iconfontUrl,
|
|
16
|
+
notice,
|
|
17
|
+
collapsed,
|
|
18
|
+
headerHeight,
|
|
19
|
+
collapsedMenuShowLabel = false
|
|
20
|
+
} = dataSource;
|
|
14
21
|
const pathNamePrefix = `/${window.location.pathname.split("/")[1]}`;
|
|
22
|
+
const [activeHoverKey, setActiveHoverKey] = useState(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setActiveHoverKey(null);
|
|
25
|
+
}, [collapsed, collapsedMenuShowLabel]);
|
|
26
|
+
const handleHoverOpenChange = (key, open) => {
|
|
27
|
+
setActiveHoverKey((current) => open ? key : current === key ? null : current);
|
|
28
|
+
};
|
|
15
29
|
const noticeCls = classnames({
|
|
16
30
|
"pro-layout-menu-tooltip": true,
|
|
17
31
|
"pro-layout-menu-tooltip-has-notice": notice,
|
|
18
|
-
"pro-layout-menu-tooltip-nav-open": collapsed
|
|
32
|
+
"pro-layout-menu-tooltip-nav-open": collapsed,
|
|
33
|
+
"pro-layout-menu-tooltip-show-label": collapsedMenuShowLabel
|
|
19
34
|
});
|
|
20
35
|
const { selectedPath, onSelected, menuSelectedPath } = useContext(LayoutContext) || {
|
|
21
36
|
selectedPath: "",
|
|
22
37
|
onSelected: () => {
|
|
23
38
|
}
|
|
24
39
|
};
|
|
25
|
-
return /* @__PURE__ */ jsx(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
const hasChildrenMenu = Array.isArray(children) && children.length;
|
|
36
|
-
const LiNode = /* @__PURE__ */ jsx("li", { id: (_a = url == null ? void 0 : url.split("/")) == null ? void 0 : _a[1], className: `${cls} pro-layout-menu-fold-li`, children: /* @__PURE__ */ jsxs("div", { children: [
|
|
37
|
-
imgUrl ? /* @__PURE__ */ jsx(
|
|
38
|
-
"img",
|
|
39
|
-
{
|
|
40
|
-
className: "pro-layout-icon",
|
|
41
|
-
src: pathNamePrefix === url ? imgActiveUrl || imgUrl : imgUrl,
|
|
42
|
-
alt: "icon"
|
|
43
|
-
}
|
|
44
|
-
) : /* @__PURE__ */ jsx(
|
|
45
|
-
ProIcon,
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: classnames("pro-layout-menu-fold", {
|
|
44
|
+
"pro-layout-menu-fold-show-label": collapsedMenuShowLabel
|
|
45
|
+
}),
|
|
46
|
+
style: { ...style },
|
|
47
|
+
children: /* @__PURE__ */ jsx(
|
|
48
|
+
"ul",
|
|
46
49
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
marginTop: headerHeight - 64,
|
|
64
|
-
height: `calc(100vh - ${headerHeight + (notice ? 32 : 0) + 12}px)`,
|
|
65
|
-
overflow: "hidden"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
placement: "rightTop",
|
|
69
|
-
children: /* @__PURE__ */ jsx(
|
|
70
|
-
"span",
|
|
71
|
-
{
|
|
72
|
-
onClick: (e) => {
|
|
73
|
-
const menuItem = findMenuItemByKey(menus, String(id));
|
|
74
|
-
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
|
75
|
-
let shouldActivate = true;
|
|
76
|
-
if (onMenuClick) {
|
|
77
|
-
const result = onMenuClick({
|
|
78
|
-
item: menuItem,
|
|
79
|
-
key: String(id),
|
|
80
|
-
keyPath: menuKeyPath
|
|
81
|
-
});
|
|
82
|
-
if (result === false) {
|
|
83
|
-
shouldActivate = false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (shouldActivate) {
|
|
87
|
-
onSelected({
|
|
88
|
-
selectedPath: toPath
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
children: LiNode
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
},
|
|
96
|
-
`${id}-${name}`
|
|
97
|
-
) : !collapsed ? /* @__PURE__ */ jsx(Tooltip, { placement: "right", title: name, children: /* @__PURE__ */ jsx(
|
|
98
|
-
"span",
|
|
99
|
-
{
|
|
100
|
-
onClickCapture: (e) => {
|
|
101
|
-
const menuItem = findMenuItemByKey(menus, String(id));
|
|
102
|
-
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
|
103
|
-
let shouldActivate = true;
|
|
104
|
-
if (onMenuClick) {
|
|
105
|
-
const result = onMenuClick({
|
|
106
|
-
item: menuItem,
|
|
107
|
-
key: String(id),
|
|
108
|
-
keyPath: menuKeyPath
|
|
109
|
-
});
|
|
110
|
-
if (result === false) {
|
|
111
|
-
shouldActivate = false;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (shouldActivate) {
|
|
115
|
-
onSelected({
|
|
116
|
-
selectedPath: toPath
|
|
50
|
+
className: "pro-layout-menu-fold-list",
|
|
51
|
+
style: { ...style },
|
|
52
|
+
onScroll: () => setActiveHoverKey(null),
|
|
53
|
+
children: menus.filter((item) => !item.hideInMenu).map((item, index) => {
|
|
54
|
+
var _a;
|
|
55
|
+
const { id, url, name, icon, imgUrl, imgActiveUrl, children } = item;
|
|
56
|
+
const hoverKey = String(id);
|
|
57
|
+
const hoverOpen = !collapsed && activeHoverKey === hoverKey;
|
|
58
|
+
const nameCharacters = Array.from(name || "");
|
|
59
|
+
const label = collapsedMenuShowLabel && !collapsed && nameCharacters.length > 4 ? `${nameCharacters.slice(0, 4).join("")}...` : name;
|
|
60
|
+
const toPath = item.redirectUrl || item.url;
|
|
61
|
+
const selectedMenu = getUrlParams("activeMenu");
|
|
62
|
+
const pathToMatch = menuSelectedPath ?? (selectedPath || selectedMenu || window.location.pathname);
|
|
63
|
+
const currentKeyIdPath = pathToMatch ? getPathNameKey({ menus, pathName: pathToMatch }) || [] : [];
|
|
64
|
+
const cls = classnames({
|
|
65
|
+
active: currentKeyIdPath.includes(id)
|
|
117
66
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
67
|
+
const hasChildrenMenu = Array.isArray(children) && children.length;
|
|
68
|
+
const LiNode = /* @__PURE__ */ jsx("li", { id: (_a = url == null ? void 0 : url.split("/")) == null ? void 0 : _a[1], className: `${cls} pro-layout-menu-fold-li`, children: /* @__PURE__ */ jsxs("div", { children: [
|
|
69
|
+
imgUrl ? /* @__PURE__ */ jsx(
|
|
70
|
+
"img",
|
|
71
|
+
{
|
|
72
|
+
className: "pro-layout-icon",
|
|
73
|
+
src: pathNamePrefix === url ? imgActiveUrl || imgUrl : imgUrl,
|
|
74
|
+
alt: "icon"
|
|
75
|
+
}
|
|
76
|
+
) : /* @__PURE__ */ jsx(
|
|
77
|
+
ProIcon,
|
|
78
|
+
{
|
|
79
|
+
type: icon || "",
|
|
80
|
+
size: "20px",
|
|
81
|
+
color: currentKeyIdPath.includes(id) ? "#fff" : void 0
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ jsx("h2", { title: name, "aria-label": name, children: label })
|
|
85
|
+
] }) });
|
|
86
|
+
return hasChildrenMenu ? /* @__PURE__ */ jsx(
|
|
87
|
+
Popover,
|
|
88
|
+
{
|
|
89
|
+
mouseEnterDelay: 0,
|
|
90
|
+
open: hoverOpen,
|
|
91
|
+
onOpenChange: (open) => handleHoverOpenChange(hoverKey, open),
|
|
92
|
+
content: /* @__PURE__ */ jsx(SideMenu, { dataSource: { ...dataSource, menus: item }, onMenuClick }),
|
|
93
|
+
color: "#fff",
|
|
94
|
+
classNames: { root: noticeCls },
|
|
95
|
+
styles: {
|
|
96
|
+
// 立即隐藏退场中的旧浮层,避免快速移动时动画叠加。
|
|
97
|
+
root: { display: hoverOpen ? void 0 : "none" },
|
|
98
|
+
content: {
|
|
99
|
+
marginTop: headerHeight - 64,
|
|
100
|
+
height: `calc(100vh - ${headerHeight + (notice ? 32 : 0) + 12}px)`,
|
|
101
|
+
overflow: "hidden"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
placement: "rightTop",
|
|
105
|
+
children: /* @__PURE__ */ jsx(
|
|
106
|
+
"span",
|
|
107
|
+
{
|
|
108
|
+
onClick: (e) => {
|
|
109
|
+
const menuItem = findMenuItemByKey(menus, String(id));
|
|
110
|
+
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
|
111
|
+
let shouldActivate = true;
|
|
112
|
+
if (onMenuClick) {
|
|
113
|
+
const result = onMenuClick({
|
|
114
|
+
item: menuItem,
|
|
115
|
+
key: String(id),
|
|
116
|
+
keyPath: menuKeyPath
|
|
117
|
+
});
|
|
118
|
+
if (result === false) {
|
|
119
|
+
shouldActivate = false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (shouldActivate) {
|
|
123
|
+
onSelected({
|
|
124
|
+
selectedPath: toPath
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
children: LiNode
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
},
|
|
132
|
+
`${id}-${name}`
|
|
133
|
+
) : !collapsed ? /* @__PURE__ */ jsx(
|
|
134
|
+
Tooltip,
|
|
135
|
+
{
|
|
136
|
+
placement: "right",
|
|
137
|
+
title: name,
|
|
138
|
+
mouseEnterDelay: 0,
|
|
139
|
+
open: hoverOpen,
|
|
140
|
+
onOpenChange: (open) => handleHoverOpenChange(hoverKey, open),
|
|
141
|
+
styles: { root: { display: hoverOpen ? void 0 : "none" } },
|
|
142
|
+
children: /* @__PURE__ */ jsx(
|
|
143
|
+
"span",
|
|
144
|
+
{
|
|
145
|
+
onClickCapture: (e) => {
|
|
146
|
+
const menuItem = findMenuItemByKey(menus, String(id));
|
|
147
|
+
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
|
148
|
+
let shouldActivate = true;
|
|
149
|
+
if (onMenuClick) {
|
|
150
|
+
const result = onMenuClick({
|
|
151
|
+
item: menuItem,
|
|
152
|
+
key: String(id),
|
|
153
|
+
keyPath: menuKeyPath
|
|
154
|
+
});
|
|
155
|
+
if (result === false) {
|
|
156
|
+
shouldActivate = false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (shouldActivate) {
|
|
160
|
+
onSelected({
|
|
161
|
+
selectedPath: toPath
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
children: /* @__PURE__ */ jsx(Link, { to: toPath, children: LiNode })
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
},
|
|
172
|
+
`${id}-${name}`
|
|
173
|
+
) : /* @__PURE__ */ jsx(
|
|
174
|
+
"span",
|
|
175
|
+
{
|
|
176
|
+
onClickCapture: (e) => {
|
|
177
|
+
const menuItem = findMenuItemByKey(menus, String(id));
|
|
178
|
+
const menuKeyPath = (menuItem == null ? void 0 : menuItem.keyIdPath) ? menuItem.keyIdPath.map((id2) => String(id2)) : [String(id)];
|
|
179
|
+
let shouldActivate = true;
|
|
180
|
+
if (onMenuClick) {
|
|
181
|
+
const result = onMenuClick({
|
|
182
|
+
item: menuItem,
|
|
183
|
+
key: String(id),
|
|
184
|
+
keyPath: menuKeyPath
|
|
185
|
+
});
|
|
186
|
+
if (result === false) {
|
|
187
|
+
shouldActivate = false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (shouldActivate) {
|
|
191
|
+
onSelected({
|
|
192
|
+
selectedPath: toPath
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
e.stopPropagation();
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
children: /* @__PURE__ */ jsx(Link, { to: toPath, children: LiNode })
|
|
200
|
+
},
|
|
201
|
+
`${id}-${name}`
|
|
202
|
+
);
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
);
|
|
156
208
|
};
|
|
157
209
|
var FoldMenu_default = FoldMenu;
|
|
158
210
|
export {
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
@import '../../../../../../style/variables.less';
|
|
2
|
+
@import '../../../../../style/variables.less';
|
|
2
3
|
|
|
3
4
|
.pro-layout-menu-fold-list {
|
|
4
5
|
padding-top: 4px;
|
|
6
|
+
overflow-x: hidden;
|
|
5
7
|
overflow-y: auto;
|
|
6
8
|
|
|
9
|
+
// 两种宽度共用细滚动条,菜单项不随滚动条出现而挤窄。
|
|
10
|
+
&::-webkit-scrollbar {
|
|
11
|
+
width: 4px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&::-webkit-scrollbar-thumb {
|
|
15
|
+
background: rgba(0, 0, 0, 0.2);
|
|
16
|
+
border-radius: 2px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
a {
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
li {
|
|
8
|
-
width:
|
|
24
|
+
width: @pro-layout-menu-fold-width;
|
|
9
25
|
min-height: 48px;
|
|
10
26
|
padding: 12px;
|
|
11
27
|
overflow: hidden;
|
|
12
28
|
text-overflow: ellipsis;
|
|
13
29
|
|
|
14
|
-
div {
|
|
30
|
+
> div {
|
|
15
31
|
display: flex;
|
|
16
32
|
align-items: center;
|
|
17
33
|
justify-content: center;
|
|
@@ -34,8 +50,14 @@
|
|
|
34
50
|
|
|
35
51
|
h2 {
|
|
36
52
|
display: none;
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
margin: 0;
|
|
54
|
+
padding: 0;
|
|
55
|
+
color: inherit;
|
|
56
|
+
font-size: 12px;
|
|
57
|
+
font-weight: normal;
|
|
58
|
+
line-height: 17px;
|
|
59
|
+
text-align: center;
|
|
60
|
+
white-space: nowrap;
|
|
39
61
|
opacity: 1;
|
|
40
62
|
transition:
|
|
41
63
|
opacity 0.3s cubic-bezier(0.645, 0.045, 0.355, 1),
|
|
@@ -54,14 +76,6 @@
|
|
|
54
76
|
color: #909090;
|
|
55
77
|
}
|
|
56
78
|
|
|
57
|
-
h2 {
|
|
58
|
-
display: inline-block;
|
|
59
|
-
padding-left: var(--zaui-space-size-sm, 8px);
|
|
60
|
-
color: var(--zaui-base-bg, #ffffff);
|
|
61
|
-
font-weight: normal;
|
|
62
|
-
font-size: var(--zaui-font-size-md, 14px);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
79
|
&.active {
|
|
66
80
|
background-color: var(--zaui-brand, #006aff);
|
|
67
81
|
|
|
@@ -74,6 +88,27 @@
|
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
|
|
91
|
+
.pro-layout-menu-fold-show-label .pro-layout-menu-fold-list {
|
|
92
|
+
padding-top: 8px;
|
|
93
|
+
|
|
94
|
+
li {
|
|
95
|
+
width: @pro-layout-menu-label-width;
|
|
96
|
+
height: 56px;
|
|
97
|
+
margin-bottom: 4px;
|
|
98
|
+
padding: 8px 4px;
|
|
99
|
+
|
|
100
|
+
> div {
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
gap: 3px;
|
|
103
|
+
|
|
104
|
+
h2 {
|
|
105
|
+
display: block;
|
|
106
|
+
width: 64px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
77
112
|
.pro-layout-menu-tooltip {
|
|
78
113
|
top: 64px !important;
|
|
79
114
|
transform: none !important;
|
|
@@ -92,13 +127,13 @@
|
|
|
92
127
|
|
|
93
128
|
.pro-layout-menu-tooltip.pro-layout-menu-tooltip-nav-open.@{ant-prefix}-popover-placement-rightBottom,
|
|
94
129
|
.pro-layout-menu-tooltip.pro-layout-menu-tooltip-nav-open.@{ant-prefix}-popover-placement-rightTop {
|
|
95
|
-
left:
|
|
130
|
+
left: @pro-layout-menu-open-width !important;
|
|
96
131
|
}
|
|
97
132
|
|
|
98
133
|
.pro-layout-menu-tooltip.@{ant-prefix}-popover-placement-rightBottom,
|
|
99
134
|
.pro-layout-menu-tooltip.@{ant-prefix}-popover-placement-rightTop {
|
|
100
135
|
position: fixed;
|
|
101
|
-
left:
|
|
136
|
+
left: (@pro-layout-menu-fold-width + 1px) !important;
|
|
102
137
|
z-index: 99;
|
|
103
138
|
padding-left: 0;
|
|
104
139
|
|
|
@@ -111,6 +146,10 @@
|
|
|
111
146
|
padding: 0;
|
|
112
147
|
}
|
|
113
148
|
|
|
149
|
+
.pro-layout-menu-tooltip.pro-layout-menu-tooltip-show-label {
|
|
150
|
+
left: (@pro-layout-menu-label-width + 1px) !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
114
153
|
.pro-layout-menu-tooltip .@{ant-prefix}-popover-content > .@{ant-prefix}-popover-arrow {
|
|
115
154
|
display: none;
|
|
116
155
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
2
|
import type { ProLayoutType } from '../../../propTypes';
|
|
3
|
-
type MenuProps = Pick<ProLayoutType, 'mode' | 'headerHeight' | 'dataSource' | 'iconfontUrl' | 'collapsed' | 'notice' | 'pure' | 'sideMenuFooterRender' | 'onMenuClick'> & {
|
|
3
|
+
type MenuProps = Pick<ProLayoutType, 'mode' | 'headerHeight' | 'dataSource' | 'iconfontUrl' | 'collapsed' | 'collapsedMenuShowLabel' | 'notice' | 'pure' | 'sideMenuFooterRender' | 'onMenuClick'> & {
|
|
4
4
|
sideMenuHeaderRender?: ReactNode;
|
|
5
5
|
onToggle?: () => void;
|
|
6
6
|
};
|
|
@@ -29,6 +29,7 @@ const Menu = (props) => {
|
|
|
29
29
|
dataSource,
|
|
30
30
|
iconfontUrl,
|
|
31
31
|
collapsed,
|
|
32
|
+
collapsedMenuShowLabel = false,
|
|
32
33
|
notice,
|
|
33
34
|
onToggle,
|
|
34
35
|
pure,
|
|
@@ -149,6 +150,7 @@ const Menu = (props) => {
|
|
|
149
150
|
height: headerHeight + (notice ? 32 : 0) + 48,
|
|
150
151
|
notice,
|
|
151
152
|
collapsed,
|
|
153
|
+
collapsedMenuShowLabel,
|
|
152
154
|
headerHeight
|
|
153
155
|
},
|
|
154
156
|
onMenuClick,
|
|
@@ -26,34 +26,9 @@
|
|
|
26
26
|
transform: rotate(45deg);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
&.pro-layout-menu-no-collapsed {
|
|
30
|
-
.pro-layout-menu-fold-li {
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
33
|
-
justify-content: center;
|
|
34
|
-
|
|
35
|
-
div {
|
|
36
|
-
width: 20px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
a {
|
|
40
|
-
width: 20px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
h2 {
|
|
44
|
-
display: inline-block;
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
opacity: 0;
|
|
47
|
-
transition:
|
|
48
|
-
opacity 0.3s cubic-bezier(0.645, 0.045, 0.355, 1),
|
|
49
|
-
color 0.3s;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
29
|
&.pro-layout-menu-collapsed {
|
|
55
30
|
.pro-layout-content {
|
|
56
|
-
margin-left:
|
|
31
|
+
margin-left: @pro-layout-menu-open-width !important;
|
|
57
32
|
|
|
58
33
|
.pro-layout-content {
|
|
59
34
|
margin-left: 0 !important;
|
|
@@ -84,7 +59,7 @@
|
|
|
84
59
|
top: 64px;
|
|
85
60
|
left: 0;
|
|
86
61
|
z-index: 50;
|
|
87
|
-
width:
|
|
62
|
+
width: @pro-layout-menu-fold-size;
|
|
88
63
|
height: 100vh;
|
|
89
64
|
min-height: 100%;
|
|
90
65
|
padding: 0;
|
|
@@ -96,14 +71,14 @@
|
|
|
96
71
|
width 0.3s cubic-bezier(0.2, 0, 0, 1) 0s;
|
|
97
72
|
|
|
98
73
|
&.pro-layout-menu-open {
|
|
99
|
-
width:
|
|
74
|
+
width: @pro-layout-menu-open-width;
|
|
100
75
|
background-color: #f7f9fd;
|
|
101
76
|
}
|
|
102
77
|
}
|
|
103
78
|
|
|
104
79
|
.pro-layout-menu.pro-layout-menu-open .pro-layout-menu-collapsed {
|
|
105
80
|
left: 0;
|
|
106
|
-
width:
|
|
81
|
+
width: @pro-layout-menu-open-width;
|
|
107
82
|
}
|
|
108
83
|
|
|
109
84
|
.pro-layout-menu.pro-layout-menu-open .pro-layout-menu-collapsed img {
|
|
@@ -118,7 +93,7 @@
|
|
|
118
93
|
display: flex;
|
|
119
94
|
align-items: center;
|
|
120
95
|
justify-content: center;
|
|
121
|
-
width:
|
|
96
|
+
width: @pro-layout-menu-fold-size;
|
|
122
97
|
height: 48px;
|
|
123
98
|
background: #f7f9fd;
|
|
124
99
|
transition: all 0.3s ease;
|
|
@@ -135,6 +110,6 @@
|
|
|
135
110
|
}
|
|
136
111
|
|
|
137
112
|
.pro-layout-menu-open ~ .pro-layout-content {
|
|
138
|
-
margin-left:
|
|
113
|
+
margin-left: @pro-layout-menu-open-width !important;
|
|
139
114
|
}
|
|
140
115
|
}
|
package/es/ProLayout/index.js
CHANGED
|
@@ -31,6 +31,7 @@ const ProLayout = (props) => {
|
|
|
31
31
|
target,
|
|
32
32
|
onCollapsedChange,
|
|
33
33
|
collapsed: propsCollapsed = false,
|
|
34
|
+
collapsedMenuShowLabel = false,
|
|
34
35
|
onMenuClick,
|
|
35
36
|
// Header组件需要的props
|
|
36
37
|
headerTitleRender,
|
|
@@ -243,6 +244,7 @@ const ProLayout = (props) => {
|
|
|
243
244
|
dataSource: Array.isArray(menus) ? { menus } : menus,
|
|
244
245
|
iconfontUrl,
|
|
245
246
|
collapsed,
|
|
247
|
+
collapsedMenuShowLabel,
|
|
246
248
|
notice,
|
|
247
249
|
onToggle: () => {
|
|
248
250
|
toggle();
|
|
@@ -275,6 +277,7 @@ const ProLayout = (props) => {
|
|
|
275
277
|
"pro-layout": true,
|
|
276
278
|
"pro-layout-light": true,
|
|
277
279
|
"pro-layout-pure": typeof pure === "boolean" ? pure : (pure == null ? void 0 : pure.topMenu) || (pure == null ? void 0 : pure.leftMenu),
|
|
280
|
+
"pro-layout-show-collapsed-menu-label": collapsedMenuShowLabel,
|
|
278
281
|
[`${className}`]: className
|
|
279
282
|
}),
|
|
280
283
|
style: {
|
|
@@ -218,6 +218,11 @@ interface ProLayoutBaseProps {
|
|
|
218
218
|
* @default false
|
|
219
219
|
*/
|
|
220
220
|
collapsed?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* @description 收起时显示菜单名称并使用 72px 侧栏;默认仅显示图标,宽度 48px
|
|
223
|
+
* @default false
|
|
224
|
+
*/
|
|
225
|
+
collapsedMenuShowLabel?: boolean;
|
|
221
226
|
/**
|
|
222
227
|
* @description 菜单拼接路径前缀
|
|
223
228
|
* @default ""
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '../../style/variables.less';
|
|
2
|
+
@import './variables.less';
|
|
2
3
|
@import '../components/Layout/index.less';
|
|
3
4
|
@import '../components/ProCollapse/style/index.less';
|
|
4
5
|
@import '../components/ProFooter/style/index.less';
|
|
@@ -6,6 +7,12 @@
|
|
|
6
7
|
@import '../components/TabsManager/style/index.less';
|
|
7
8
|
|
|
8
9
|
.pro-layout {
|
|
10
|
+
--pro-layout-menu-fold-width: @pro-layout-menu-fold-width;
|
|
11
|
+
|
|
12
|
+
&.pro-layout-show-collapsed-menu-label {
|
|
13
|
+
--pro-layout-menu-fold-width: @pro-layout-menu-label-width;
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
display: flex;
|
|
10
17
|
flex-direction: column;
|
|
11
18
|
min-height: 100vh;
|
|
@@ -138,6 +145,10 @@
|
|
|
138
145
|
color: #fff;
|
|
139
146
|
}
|
|
140
147
|
|
|
148
|
+
h2 {
|
|
149
|
+
color: var(--zaui-base-bg, #ffffff);
|
|
150
|
+
}
|
|
151
|
+
|
|
141
152
|
&::before {
|
|
142
153
|
position: absolute;
|
|
143
154
|
top: 4px;
|
|
@@ -174,6 +185,16 @@
|
|
|
174
185
|
}
|
|
175
186
|
}
|
|
176
187
|
|
|
188
|
+
.pro-layout-menu-fold-show-label .pro-layout-menu-fold-list li {
|
|
189
|
+
&.active::before,
|
|
190
|
+
&:hover::before {
|
|
191
|
+
top: 0;
|
|
192
|
+
left: 8px;
|
|
193
|
+
width: calc(100% - 16px);
|
|
194
|
+
height: 56px;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
177
198
|
.pro-layout-menu-collapsed {
|
|
178
199
|
background: #f7f9fd;
|
|
179
200
|
border-right: none;
|
|
@@ -291,7 +312,7 @@
|
|
|
291
312
|
.pro-layout-tabs-bar-wrapper {
|
|
292
313
|
// 与 pro-layout-content 对齐:同样的左右边距,无内边距让 tab 从左侧直接对齐
|
|
293
314
|
margin-right: var(--zaui-space-size-md, 16px);
|
|
294
|
-
margin-left:
|
|
315
|
+
margin-left: @pro-layout-menu-fold-size;
|
|
295
316
|
padding: 0;
|
|
296
317
|
// 滚动时固定在 header 和 notice 正下方
|
|
297
318
|
position: sticky;
|
|
@@ -314,7 +335,7 @@
|
|
|
314
335
|
|
|
315
336
|
// 菜单展开时与内容区同步右移
|
|
316
337
|
&.tabs-menu-open {
|
|
317
|
-
margin-left:
|
|
338
|
+
margin-left: @pro-layout-menu-open-width;
|
|
318
339
|
}
|
|
319
340
|
|
|
320
341
|
// Tab 存在时展开
|
|
@@ -337,7 +358,7 @@
|
|
|
337
358
|
margin-top: 0;
|
|
338
359
|
margin-right: var(--zaui-space-size-md, 16px);
|
|
339
360
|
margin-bottom: 0;
|
|
340
|
-
margin-left:
|
|
361
|
+
margin-left: @pro-layout-menu-fold-size;
|
|
341
362
|
padding: 0 var(--zaui-space-size-md, 16px);
|
|
342
363
|
background: #ffffff;
|
|
343
364
|
border-top: 1px solid rgb(235 236 238);
|