@hi-ui/menu 4.0.9 → 4.1.1
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/CHANGELOG.md +21 -0
- package/lib/cjs/Menu.js +18 -14
- package/lib/cjs/MenuItem.js +56 -67
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/esm/Menu.js +15 -11
- package/lib/esm/MenuItem.js +54 -65
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/types/Menu.d.ts +13 -1
- package/lib/types/MenuItem.d.ts +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @hi-ui/menu
|
|
2
2
|
|
|
3
|
+
## 4.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2620](https://github.com/XiaoMi/hiui/pull/2620) [`863bcde00`](https://github.com/XiaoMi/hiui/commit/863bcde0033f8bb4c9866e6f975e52726e4a5825) Thanks [@aqiusen](https://github.com/aqiusen)! - fix: 修复 disabled 不生效问题
|
|
8
|
+
|
|
9
|
+
## 4.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#2576](https://github.com/XiaoMi/hiui/pull/2576) [`ccb1eec12`](https://github.com/XiaoMi/hiui/commit/ccb1eec122a33466536b365d443f175d1e16dc86) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加 render 和 extraHeader API
|
|
14
|
+
|
|
15
|
+
- [#2577](https://github.com/XiaoMi/hiui/pull/2577) [`2f094567e`](https://github.com/XiaoMi/hiui/commit/2f094567e678235e75ff5c443dce1ee09c3bd115) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加 size API
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`937052db3`](https://github.com/XiaoMi/hiui/commit/937052db36ecfa50fef53df13d159bee0d08fa41), [`ccb1eec12`](https://github.com/XiaoMi/hiui/commit/ccb1eec122a33466536b365d443f175d1e16dc86), [`eee5e6d16`](https://github.com/XiaoMi/hiui/commit/eee5e6d1658685a6119b5aa40038c572145b3b4e)]:
|
|
20
|
+
- @hi-ui/icons@4.0.14
|
|
21
|
+
- @hi-ui/popper@4.1.0
|
|
22
|
+
- @hi-ui/tree-utils@4.1.1
|
|
23
|
+
|
|
3
24
|
## 4.0.9
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/lib/cjs/Menu.js
CHANGED
|
@@ -25,12 +25,6 @@ var icons = require('@hi-ui/icons');
|
|
|
25
25
|
|
|
26
26
|
var env = require('@hi-ui/env');
|
|
27
27
|
|
|
28
|
-
var MenuItem = require('./MenuItem.js');
|
|
29
|
-
|
|
30
|
-
var context = require('./context.js');
|
|
31
|
-
|
|
32
|
-
var util = require('./util.js');
|
|
33
|
-
|
|
34
28
|
var useUncontrolledState = require('@hi-ui/use-uncontrolled-state');
|
|
35
29
|
|
|
36
30
|
var Tooltip = require('@hi-ui/tooltip');
|
|
@@ -47,6 +41,12 @@ var useMergeRefs = require('@hi-ui/use-merge-refs');
|
|
|
47
41
|
|
|
48
42
|
var useId = require('@hi-ui/use-id');
|
|
49
43
|
|
|
44
|
+
var MenuItem = require('./MenuItem.js');
|
|
45
|
+
|
|
46
|
+
var context = require('./context.js');
|
|
47
|
+
|
|
48
|
+
var util = require('./util.js');
|
|
49
|
+
|
|
50
50
|
function _interopDefaultLegacy(e) {
|
|
51
51
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
52
52
|
'default': e
|
|
@@ -98,8 +98,12 @@ var Menu = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
overlayClassName = _a.overlayClassName,
|
|
99
99
|
onCollapse = _a.onCollapse,
|
|
100
100
|
footerRender = _a.footerRender,
|
|
101
|
+
render = _a.render,
|
|
102
|
+
extraHeader = _a.extraHeader,
|
|
101
103
|
onClick = _a.onClick,
|
|
102
|
-
|
|
104
|
+
_a$size = _a.size,
|
|
105
|
+
size = _a$size === void 0 ? 'lg' : _a$size,
|
|
106
|
+
rest = tslib.__rest(_a, ["prefixCls", "role", "className", "data", "placement", "showCollapse", "expandedType", "showAllSubMenus", "defaultExpandAll", "defaultExpandedIds", "expandedIds", "onExpand", "defaultActiveId", "activeId", "onClickSubMenu", "collapsed", "defaultCollapsed", "overlayClassName", "onCollapse", "footerRender", "render", "extraHeader", "onClick", "size"]);
|
|
103
107
|
|
|
104
108
|
var _useUncontrolledState = useUncontrolledState.useUncontrolledState(defaultActiveId, activeIdProp, onClick),
|
|
105
109
|
activeId = _useUncontrolledState[0],
|
|
@@ -247,12 +251,12 @@ var Menu = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
247
251
|
}) : collapseNode);
|
|
248
252
|
};
|
|
249
253
|
|
|
250
|
-
var cls = classname.cx(prefixCls, className, prefixCls + "--" + placement, mini && prefixCls + "--mini", (expandedType === 'pop' || showAllSubMenus || mini) && prefixCls + "--popup");
|
|
254
|
+
var cls = classname.cx(prefixCls, className, prefixCls + "--" + placement, prefixCls + "--size-" + size, mini && prefixCls + "--mini", (expandedType === 'pop' || showAllSubMenus || mini) && prefixCls + "--popup");
|
|
251
255
|
return /*#__PURE__*/React__default["default"].createElement("div", Object.assign({
|
|
252
256
|
ref: useMergeRefs.useMergeRefs(ref, setContainerElement),
|
|
253
257
|
role: role,
|
|
254
258
|
className: cls
|
|
255
|
-
}, rest), /*#__PURE__*/React__default["default"].createElement(context["default"].Provider, {
|
|
259
|
+
}, rest), extraHeader, /*#__PURE__*/React__default["default"].createElement(context["default"].Provider, {
|
|
256
260
|
value: {
|
|
257
261
|
placement: placement,
|
|
258
262
|
expandedType: expandedType,
|
|
@@ -277,13 +281,16 @@ var Menu = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
277
281
|
}, /*#__PURE__*/React__default["default"].createElement(MenuItem.MenuItem, Object.assign({}, item, {
|
|
278
282
|
level: 1,
|
|
279
283
|
render: renderMenuItemMini,
|
|
280
|
-
raw: item
|
|
284
|
+
raw: item,
|
|
285
|
+
size: size
|
|
281
286
|
}))) : /*#__PURE__*/React__default["default"].createElement(MenuItem.MenuItem, Object.assign({
|
|
282
287
|
hidden: !showVertical && index >= tagMaxCount
|
|
283
288
|
}, item, {
|
|
289
|
+
render: render,
|
|
284
290
|
key: item.id,
|
|
285
291
|
level: 1,
|
|
286
|
-
raw: item
|
|
292
|
+
raw: item,
|
|
293
|
+
size: size
|
|
287
294
|
}));
|
|
288
295
|
}), showVertical || restTagList.length === 0 ? null : /*#__PURE__*/React__default["default"].createElement(MenuItem.MenuItem, {
|
|
289
296
|
key: MENU_MORE_ID,
|
|
@@ -304,9 +311,6 @@ if (env.__DEV__) {
|
|
|
304
311
|
|
|
305
312
|
|
|
306
313
|
var renderMenuItemMini = function renderMenuItemMini(menu) {
|
|
307
|
-
// if (typeof menu.icon !== 'undefined') {
|
|
308
|
-
// return menu.icon
|
|
309
|
-
// }
|
|
310
314
|
if (typeof menu.title === 'string') {
|
|
311
315
|
return menu.title.substring(0, 1);
|
|
312
316
|
}
|
package/lib/cjs/MenuItem.js
CHANGED
|
@@ -25,18 +25,18 @@ var env = require('@hi-ui/env');
|
|
|
25
25
|
|
|
26
26
|
var icons = require('@hi-ui/icons');
|
|
27
27
|
|
|
28
|
-
var context = require('./context.js');
|
|
29
|
-
|
|
30
28
|
var Popper = require('@hi-ui/popper');
|
|
31
29
|
|
|
32
|
-
var Expander = require('./Expander.js');
|
|
33
|
-
|
|
34
30
|
var typeAssertion = require('@hi-ui/type-assertion');
|
|
35
31
|
|
|
36
32
|
var arrayUtils = require('@hi-ui/array-utils');
|
|
37
33
|
|
|
38
34
|
var useMergeRefs = require('@hi-ui/use-merge-refs');
|
|
39
35
|
|
|
36
|
+
var context = require('./context.js');
|
|
37
|
+
|
|
38
|
+
var Expander = require('./Expander.js');
|
|
39
|
+
|
|
40
40
|
function _interopDefaultLegacy(e) {
|
|
41
41
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
42
42
|
'default': e
|
|
@@ -72,7 +72,9 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
72
72
|
hidden = _a$hidden === void 0 ? false : _a$hidden,
|
|
73
73
|
render = _a.render,
|
|
74
74
|
raw = _a.raw,
|
|
75
|
-
|
|
75
|
+
_a$size = _a.size,
|
|
76
|
+
size = _a$size === void 0 ? 'lg' : _a$size,
|
|
77
|
+
rest = tslib.__rest(_a, ["prefixCls", "className", "icon", "title", "disabled", "id", "level", "children", "parentIds", "hidden", "render", "raw", "size"]);
|
|
76
78
|
|
|
77
79
|
var itemRef = React.useRef(null);
|
|
78
80
|
|
|
@@ -102,14 +104,9 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
102
104
|
className: classname.cx(prefixCls + "-item__inner", (_cx2 = {}, _cx2[prefixCls + "-item__inner--active"] = activeId === id, _cx2[prefixCls + "-item__inner--active-p"] = activeParents === null || activeParents === void 0 ? void 0 : activeParents.includes(id), _cx2[prefixCls + "-item__inner--expanded"] = expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id), _cx2)),
|
|
103
105
|
onClick: function onClick() {
|
|
104
106
|
if (typeAssertion.isArrayNonEmpty(children)) {
|
|
105
|
-
|
|
106
|
-
clickSubMenu(id);
|
|
107
|
-
}
|
|
107
|
+
!disabled && (clickSubMenu === null || clickSubMenu === void 0 ? void 0 : clickSubMenu(id));
|
|
108
108
|
} else {
|
|
109
|
-
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
clickMenu(id, raw);
|
|
112
|
-
}
|
|
109
|
+
!disabled && (clickMenu === null || clickMenu === void 0 ? void 0 : clickMenu(id, raw));
|
|
113
110
|
|
|
114
111
|
if (closeAllPopper && !(placement === 'vertical' && expandedType === 'collapse' && mini === false)) {
|
|
115
112
|
closeAllPopper();
|
|
@@ -127,7 +124,7 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
127
124
|
id: id,
|
|
128
125
|
icon: icon,
|
|
129
126
|
title: title
|
|
130
|
-
}) : title), hasChildren && !mini && placement === 'vertical' && expandedType === 'collapse' && !showAllSubMenus && ((expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
127
|
+
}) : title), hasChildren && !mini && placement === 'vertical' && expandedType === 'collapse' && !showAllSubMenus && (!disabled && (expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
131
128
|
prefixCls: prefixCls + "-item",
|
|
132
129
|
direction: "up"
|
|
133
130
|
}) : /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
@@ -139,14 +136,14 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
139
136
|
prefixCls: prefixCls + "-item"
|
|
140
137
|
}) : null, hasChildren && placement === 'horizontal' && level > 1 ? /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
141
138
|
prefixCls: prefixCls + "-item"
|
|
142
|
-
}) : null, hasChildren && placement === 'horizontal' && level === 1 && ((expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
139
|
+
}) : null, hasChildren && placement === 'horizontal' && level === 1 && (!disabled && (expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
143
140
|
prefixCls: prefixCls + "-item",
|
|
144
141
|
direction: "up"
|
|
145
142
|
}) : /*#__PURE__*/React__default["default"].createElement(Arrow, {
|
|
146
143
|
prefixCls: prefixCls + "-item",
|
|
147
144
|
direction: "down"
|
|
148
145
|
}))), hasChildren && placement === 'vertical' && !mini && !showAllSubMenus && expandedType === 'collapse' ? /*#__PURE__*/React__default["default"].createElement(Expander.Expander, {
|
|
149
|
-
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id))
|
|
146
|
+
visible: !disabled && !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id))
|
|
150
147
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
151
148
|
className: prefixCls + "-submenu"
|
|
152
149
|
}, children.map(function (child) {
|
|
@@ -154,7 +151,9 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
154
151
|
key: child.id,
|
|
155
152
|
level: level + 1,
|
|
156
153
|
parentIds: _parentIds,
|
|
157
|
-
raw: child
|
|
154
|
+
raw: child,
|
|
155
|
+
render: render,
|
|
156
|
+
size: size
|
|
158
157
|
}));
|
|
159
158
|
}))) : null), hasChildren && placement === 'vertical' && mini && !showAllSubMenus && expandedType === 'collapse' && (level === 1 ? /*#__PURE__*/React__default["default"].createElement(Popper__default["default"], {
|
|
160
159
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -163,18 +162,18 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
163
162
|
gutterGap: 16,
|
|
164
163
|
className: overlayClassName,
|
|
165
164
|
onClose: function onClose() {
|
|
166
|
-
|
|
167
|
-
closePopper(id);
|
|
168
|
-
}
|
|
165
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
169
166
|
}
|
|
170
167
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
171
|
-
className: prefixCls + "-popmenu"
|
|
168
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
172
169
|
}, children.map(function (child) {
|
|
173
170
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem, Object.assign({}, child, {
|
|
174
171
|
key: child.id,
|
|
175
172
|
level: level + 1,
|
|
176
173
|
parentIds: _parentIds,
|
|
177
|
-
raw: child
|
|
174
|
+
raw: child,
|
|
175
|
+
render: render,
|
|
176
|
+
size: size
|
|
178
177
|
}));
|
|
179
178
|
}))) : /*#__PURE__*/React__default["default"].createElement(Popper__default["default"], {
|
|
180
179
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -184,18 +183,18 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
184
183
|
disabledPortal: true,
|
|
185
184
|
className: overlayClassName,
|
|
186
185
|
onClose: function onClose() {
|
|
187
|
-
|
|
188
|
-
closePopper(id);
|
|
189
|
-
}
|
|
186
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
190
187
|
}
|
|
191
188
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
192
|
-
className: prefixCls + "-popmenu"
|
|
189
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
193
190
|
}, children.map(function (child) {
|
|
194
191
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem, Object.assign({}, child, {
|
|
195
192
|
key: child.id,
|
|
196
193
|
level: level + 1,
|
|
197
194
|
parentIds: _parentIds,
|
|
198
|
-
raw: child
|
|
195
|
+
raw: child,
|
|
196
|
+
render: render,
|
|
197
|
+
size: size
|
|
199
198
|
}));
|
|
200
199
|
})))), hasChildren && placement === 'vertical' && !showAllSubMenus && expandedType === 'pop' && (level === 1 ? /*#__PURE__*/React__default["default"].createElement(Popper__default["default"], {
|
|
201
200
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -204,18 +203,18 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
204
203
|
gutterGap: 16,
|
|
205
204
|
className: overlayClassName,
|
|
206
205
|
onClose: function onClose() {
|
|
207
|
-
|
|
208
|
-
closePopper(id);
|
|
209
|
-
}
|
|
206
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
210
207
|
}
|
|
211
208
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
212
|
-
className: prefixCls + "-popmenu"
|
|
209
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
213
210
|
}, children.map(function (child) {
|
|
214
211
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem, Object.assign({}, child, {
|
|
215
212
|
key: child.id,
|
|
216
213
|
level: level + 1,
|
|
217
214
|
parentIds: _parentIds,
|
|
218
|
-
raw: child
|
|
215
|
+
raw: child,
|
|
216
|
+
render: render,
|
|
217
|
+
size: size
|
|
219
218
|
}));
|
|
220
219
|
}))) : /*#__PURE__*/React__default["default"].createElement(Popper__default["default"], {
|
|
221
220
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -225,18 +224,18 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
225
224
|
gutterGap: 16,
|
|
226
225
|
className: overlayClassName,
|
|
227
226
|
onClose: function onClose() {
|
|
228
|
-
|
|
229
|
-
closePopper(id);
|
|
230
|
-
}
|
|
227
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
231
228
|
}
|
|
232
229
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
233
|
-
className: prefixCls + "-popmenu"
|
|
230
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
234
231
|
}, children.map(function (child) {
|
|
235
232
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem, Object.assign({}, child, {
|
|
236
233
|
key: child.id,
|
|
237
234
|
level: level + 1,
|
|
238
235
|
parentIds: _parentIds,
|
|
239
|
-
raw: child
|
|
236
|
+
raw: child,
|
|
237
|
+
render: render,
|
|
238
|
+
size: size
|
|
240
239
|
}));
|
|
241
240
|
})))), hasChildren && placement === 'vertical' && showAllSubMenus ? /*#__PURE__*/React__default["default"].createElement(Popper__default["default"], {
|
|
242
241
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -245,9 +244,7 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
245
244
|
gutterGap: 16,
|
|
246
245
|
className: overlayClassName,
|
|
247
246
|
onClose: function onClose() {
|
|
248
|
-
|
|
249
|
-
closePopper(id);
|
|
250
|
-
}
|
|
247
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
251
248
|
}
|
|
252
249
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
253
250
|
className: prefixCls + "-fat-menu"
|
|
@@ -262,15 +259,12 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
262
259
|
|
|
263
260
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
264
261
|
onClick: function onClick() {
|
|
265
|
-
if (
|
|
266
|
-
clickMenu(item.id, item);
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
if (closePopper) {
|
|
270
|
-
closePopper(id);
|
|
262
|
+
if (!item.disabled) {
|
|
263
|
+
clickMenu === null || clickMenu === void 0 ? void 0 : clickMenu(item.id, item);
|
|
264
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
271
265
|
}
|
|
272
266
|
},
|
|
273
|
-
className: classname.cx(prefixCls + "-item", (_cx3 = {}, _cx3[prefixCls + "-item--active"] = activeId === item.id, _cx3)),
|
|
267
|
+
className: classname.cx(prefixCls + "-item", (_cx3 = {}, _cx3[prefixCls + "-item--active"] = activeId === item.id, _cx3[prefixCls + "-item--disabled"] = item.disabled, _cx3)),
|
|
274
268
|
key: item.id
|
|
275
269
|
}, item.title);
|
|
276
270
|
})) : null);
|
|
@@ -281,18 +275,18 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
281
275
|
gutterGap: level === 1 ? 8 : 16,
|
|
282
276
|
className: overlayClassName,
|
|
283
277
|
onClose: function onClose() {
|
|
284
|
-
|
|
285
|
-
closePopper(id);
|
|
286
|
-
}
|
|
278
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
287
279
|
}
|
|
288
280
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
289
|
-
className: prefixCls + "-popmenu"
|
|
281
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
290
282
|
}, children.map(function (child) {
|
|
291
283
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem, Object.assign({}, child, {
|
|
292
284
|
key: child.id,
|
|
293
285
|
level: level + 1,
|
|
294
286
|
parentIds: _parentIds,
|
|
295
|
-
raw: child
|
|
287
|
+
raw: child,
|
|
288
|
+
render: render,
|
|
289
|
+
size: size
|
|
296
290
|
}));
|
|
297
291
|
}))) : /*#__PURE__*/React__default["default"].createElement(Popper__default["default"], {
|
|
298
292
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -302,18 +296,18 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
302
296
|
gutterGap: level === 1 ? 8 : 16,
|
|
303
297
|
className: overlayClassName,
|
|
304
298
|
onClose: function onClose() {
|
|
305
|
-
|
|
306
|
-
closePopper(id);
|
|
307
|
-
}
|
|
299
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
308
300
|
}
|
|
309
301
|
}, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
310
|
-
className: prefixCls + "-popmenu"
|
|
302
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
311
303
|
}, children.map(function (child) {
|
|
312
304
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem, Object.assign({}, child, {
|
|
313
305
|
key: child.id,
|
|
314
306
|
level: level + 1,
|
|
315
307
|
parentIds: _parentIds,
|
|
316
|
-
raw: child
|
|
308
|
+
raw: child,
|
|
309
|
+
render: render,
|
|
310
|
+
size: size
|
|
317
311
|
}));
|
|
318
312
|
})))), hasChildren && placement === 'horizontal' && showAllSubMenus ? /*#__PURE__*/React__default["default"].createElement(Popper__default["default"], {
|
|
319
313
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -322,9 +316,7 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
322
316
|
gutterGap: 8,
|
|
323
317
|
className: overlayClassName,
|
|
324
318
|
onClose: function onClose() {
|
|
325
|
-
|
|
326
|
-
closePopper(id);
|
|
327
|
-
}
|
|
319
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
328
320
|
}
|
|
329
321
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
330
322
|
className: prefixCls + "-fat-menu"
|
|
@@ -338,14 +330,11 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
338
330
|
var _cx4;
|
|
339
331
|
|
|
340
332
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
341
|
-
className: classname.cx(prefixCls + "-item", (_cx4 = {}, _cx4[prefixCls + "-item--active"] = activeId === item.id, _cx4)),
|
|
333
|
+
className: classname.cx(prefixCls + "-item", (_cx4 = {}, _cx4[prefixCls + "-item--active"] = activeId === item.id, _cx4[prefixCls + "-item--disabled"] = item.disabled, _cx4)),
|
|
342
334
|
onClick: function onClick() {
|
|
343
|
-
if (
|
|
344
|
-
clickMenu(item.id, item);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (closePopper) {
|
|
348
|
-
closePopper(id);
|
|
335
|
+
if (!item.disabled) {
|
|
336
|
+
clickMenu === null || clickMenu === void 0 ? void 0 : clickMenu(item.id, item);
|
|
337
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
349
338
|
}
|
|
350
339
|
},
|
|
351
340
|
key: item.id
|
|
@@ -361,7 +350,7 @@ if (env.__DEV__) {
|
|
|
361
350
|
var Arrow = function Arrow(_ref) {
|
|
362
351
|
var prefixCls = _ref.prefixCls,
|
|
363
352
|
direction = _ref.direction;
|
|
364
|
-
var icon
|
|
353
|
+
var icon;
|
|
365
354
|
|
|
366
355
|
switch (direction) {
|
|
367
356
|
case 'up':
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
var css_248z = ".hi-v4-menu-fat-menu {background-color: var(--hi-v4-color-static-white, #fff);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);display: -webkit-box;display: -ms-flexbox;display: flex;color: var(--hi-v4-color-gray-700, #1f2733);border-radius: var(--hi-v4-border-radius-md, 4px);-ms-flex-wrap: wrap;flex-wrap: wrap; }.hi-v4-menu-fat-menu__group:not(:last-of-type) {margin-right: var(--hi-v4-spacing-18, 36px); }.hi-v4-menu-fat-menu .hi-v4-menu-group-item {height: 40px;margin: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-6, 12px);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-menu-fat-menu .hi-v4-menu-item {height: 40px;margin: 0;border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px); }.hi-v4-menu-fat-menu .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-menu-fat-menu .hi-v4-menu-item:not(.hi-v4-menu-item--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu-fat-menu ul {padding: 0;margin: 0; }.hi-v4-menu-fat-menu ul li {list-style-type: none; }.hi-v4-menu-popmenu {background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-menu-popmenu .hi-v4-menu-item {height: 40px;margin: 0; }.hi-v4-menu-popmenu .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;margin-bottom: var(--hi-v4-spacing-4, 8px);padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu-popmenu .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width: 100%;padding-right: var(--hi-v4-spacing-4, 8px); }.hi-v4-menu {background-color: var(--hi-v4-color-static-white, #fff);color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);line-height: var(--hi-v4-text-lineheight-md, 1.375rem);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-menu ul {margin: 0;padding: 0; }.hi-v4-menu-item {list-style: none;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: pointer;-webkit-transition: all 0.3s;transition: all 0.3s; }.hi-v4-menu-item__icon {color: var(--hi-v4-color-gray-500, #929aa6);-webkit-margin-end: var(--hi-v4-spacing-4, 8px);margin-inline-end: var(--hi-v4-spacing-4, 8px); }.hi-v4-menu-item__icon svg[class^=hi-v4-icon] {font-size: var(--hi-v4-text-size-lg, 1rem); }.hi-v4-menu-item__arrow {color: var(--hi-v4-color-gray-500, #929aa6);font-size: var(--hi-v4-text-size-lg, 1rem); }.hi-v4-menu-item__indent {display: inline-block;width: 24px;height: 100%;-ms-flex-negative: 0;flex-shrink: 0; }.hi-v4-menu__wrapper {padding: 0;margin: 0; }.hi-v4-menu--horizontal {width: 100%;overflow: hidden; }.hi-v4-menu--horizontal .hi-v4-menu__wrapper {display: -webkit-box;display: -ms-flexbox;display: flex;overflow: visible;width: -webkit-max-content;width: -moz-max-content;width: max-content;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-menu--horizontal .hi-v4-menu-item {padding: 0 var(--hi-v4-spacing-10, 20px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;align-items: center;height: 56px;border: none;font-size: var(--hi-v4-text-size-lg, 1rem); }.hi-v4-menu--horizontal .hi-v4-menu-item__arrow {-webkit-margin-start: var(--hi-v4-spacing-2, 4px);margin-inline-start: var(--hi-v4-spacing-2, 4px); }.hi-v4-menu--horizontal .hi-v4-menu-item:hover {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item:hover .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item__inner {height: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom: 2px solid transparent; }.hi-v4-menu--horizontal .hi-v4-menu-item__inner--expanded {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;white-space: nowrap;max-width: none; }.hi-v4-menu--vertical {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: var(--hi-v4-spacing-4, 8px);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box;height: 100%;-webkit-transition: width 0.3s;transition: width 0.3s; }.hi-v4-menu--vertical .hi-v4-menu__wrapper {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: auto; }.hi-v4-menu--vertical.hi-v4-menu--mini {width: 56px;overflow-x: hidden; }.hi-v4-menu--vertical.hi-v4-menu--popup .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu--vertical .hi-v4-menu__toggle {width: 40px;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;border-radius: var(--hi-v4-border-radius-md, 4px);color: var(--hi-v4-color-gray-500, #929aa6);height: 40px;-ms-flex-negative: 0;flex-shrink: 0;-webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);transition-duration: var(--hi-v4-motion-duration-normal, 200ms);-webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));-webkit-transition-property: background-color;transition-property: background-color; }.hi-v4-menu--vertical .hi-v4-menu__toggle:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu--vertical .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;margin-bottom: var(--hi-v4-spacing-4, 8px);padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px);-webkit-transition: all 0.3s;transition: all 0.3s; }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu--vertical .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-indent: 0.5px; }";
|
|
15
|
+
var css_248z = ".hi-v4-menu-fat-menu {background-color: var(--hi-v4-color-static-white, #fff);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);display: -webkit-box;display: -ms-flexbox;display: flex;color: var(--hi-v4-color-gray-700, #1f2733);border-radius: var(--hi-v4-border-radius-md, 4px);-ms-flex-wrap: wrap;flex-wrap: wrap;}.hi-v4-menu-fat-menu__group:not(:last-of-type) {margin-right: var(--hi-v4-spacing-18, 36px);}.hi-v4-menu-fat-menu .hi-v4-menu-group-item {height: 40px;margin: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-6, 12px);color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-menu-fat-menu .hi-v4-menu-item {height: 40px;margin: 0;border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);}.hi-v4-menu-fat-menu .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-menu-fat-menu .hi-v4-menu-item:not(.hi-v4-menu-item--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu-fat-menu .hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu-fat-menu ul {padding: 0;margin: 0;}.hi-v4-menu-fat-menu ul li {list-style-type: none;}.hi-v4-menu-popmenu {background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-menu-popmenu .hi-v4-menu-item {height: 40px;margin: 0;}.hi-v4-menu-popmenu .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;margin-bottom: var(--hi-v4-spacing-4, 8px);padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px);}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu-popmenu .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu-popmenu .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width: 100%;padding-right: var(--hi-v4-spacing-4, 8px);}.hi-v4-menu {background-color: var(--hi-v4-color-static-white, #fff);color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);line-height: var(--hi-v4-text-lineheight-md, 1.375rem);-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-menu ul {margin: 0;padding: 0;}.hi-v4-menu-item {list-style: none;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: pointer;-webkit-transition: all 0.3s;transition: all 0.3s;}.hi-v4-menu-item__icon {color: var(--hi-v4-color-gray-500, #929aa6);-webkit-margin-end: var(--hi-v4-spacing-4, 8px);margin-inline-end: var(--hi-v4-spacing-4, 8px);}.hi-v4-menu-item__icon svg[class^=hi-v4-icon] {font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-menu-item__arrow {color: var(--hi-v4-color-gray-500, #929aa6);font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-menu-item__indent {display: inline-block;width: 24px;height: 100%;-ms-flex-negative: 0;flex-shrink: 0;}.hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu__wrapper {padding: 0;margin: 0;}.hi-v4-menu--horizontal {width: 100%;overflow: hidden;}.hi-v4-menu--horizontal .hi-v4-menu__wrapper {display: -webkit-box;display: -ms-flexbox;display: flex;overflow: visible;width: -webkit-max-content;width: -moz-max-content;width: max-content;-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-menu--horizontal .hi-v4-menu-item {padding: 0 var(--hi-v4-spacing-10, 20px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;align-items: center;height: 56px;border: none;font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-menu--horizontal .hi-v4-menu-item__arrow {-webkit-margin-start: var(--hi-v4-spacing-2, 4px);margin-inline-start: var(--hi-v4-spacing-2, 4px);}.hi-v4-menu--horizontal .hi-v4-menu-item:hover {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item:hover .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item__inner {height: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom: 2px solid transparent;}.hi-v4-menu--horizontal .hi-v4-menu-item__inner--expanded {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;white-space: nowrap;max-width: none;}.hi-v4-menu--horizontal .hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu--horizontal .hi-v4-menu-item--disabled:hover .hi-v4-menu-item__inner {border-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-menu--horizontal .hi-v4-menu-item--disabled .hi-v4-menu-item__content {color: var(--hi-v4-color-gray-400, #c9ced6);}.hi-v4-menu--vertical {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: var(--hi-v4-spacing-4, 8px);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box;height: 100%;-webkit-transition: width 0.3s;transition: width 0.3s;}.hi-v4-menu--vertical .hi-v4-menu__wrapper {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: auto;}.hi-v4-menu--vertical.hi-v4-menu--mini {width: 56px;overflow-x: hidden;}.hi-v4-menu--vertical.hi-v4-menu--popup .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu--vertical .hi-v4-menu__toggle {width: 40px;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;border-radius: var(--hi-v4-border-radius-md, 4px);color: var(--hi-v4-color-gray-500, #929aa6);height: 40px;-ms-flex-negative: 0;flex-shrink: 0;-webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);transition-duration: var(--hi-v4-motion-duration-normal, 200ms);-webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));-webkit-transition-property: background-color;transition-property: background-color;}.hi-v4-menu--vertical .hi-v4-menu__toggle:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu--vertical .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px);-webkit-transition: all 0.3s;transition: all 0.3s;}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--vertical .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu--vertical .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-indent: 0.5px;}.hi-v4-menu--vertical .hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu--size-lg .hi-v4-menu-item__inner {height: var(--hi-v4-height-10, 40px);margin-bottom: var(--hi-v4-spacing-4, 8px);}.hi-v4-menu--size-md .hi-v4-menu-item__inner {height: var(--hi-v4-height-9, 36px);margin-bottom: var(--hi-v4-spacing-2, 4px);}.hi-v4-menu--size-sm .hi-v4-menu-item__inner {height: var(--hi-v4-height-8, 32px);margin-bottom: var(--hi-v4-spacing-1, 2px);}";
|
|
16
16
|
|
|
17
17
|
var __styleInject__ = require('style-inject')["default"];
|
|
18
18
|
|
package/lib/esm/Menu.js
CHANGED
|
@@ -12,9 +12,6 @@ import React, { forwardRef, useState, useEffect, useCallback, useMemo, useLayout
|
|
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
13
|
import { MenuUnfoldOutlined, MenuFoldOutlined } from '@hi-ui/icons';
|
|
14
14
|
import { __DEV__ } from '@hi-ui/env';
|
|
15
|
-
import { MenuItem } from './MenuItem.js';
|
|
16
|
-
import MenuContext from './context.js';
|
|
17
|
-
import { getAncestorIds } from './util.js';
|
|
18
15
|
import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
|
|
19
16
|
import Tooltip from '@hi-ui/tooltip';
|
|
20
17
|
import { useUncontrolledToggle } from '@hi-ui/use-toggle';
|
|
@@ -23,6 +20,9 @@ import { isArrayNonEmpty, isFunction } from '@hi-ui/type-assertion';
|
|
|
23
20
|
import { useResizeObserver } from '@hi-ui/use-resize-observer';
|
|
24
21
|
import { useMergeRefs } from '@hi-ui/use-merge-refs';
|
|
25
22
|
import { uuid } from '@hi-ui/use-id';
|
|
23
|
+
import { MenuItem } from './MenuItem.js';
|
|
24
|
+
import MenuContext from './context.js';
|
|
25
|
+
import { getAncestorIds } from './util.js';
|
|
26
26
|
var MENU_PREFIX = getPrefixCls('menu');
|
|
27
27
|
var DEFAULT_EXPANDED_IDS = [];
|
|
28
28
|
var NOOP_ARRAY = [];
|
|
@@ -64,8 +64,12 @@ var Menu = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
64
64
|
overlayClassName = _a.overlayClassName,
|
|
65
65
|
onCollapse = _a.onCollapse,
|
|
66
66
|
footerRender = _a.footerRender,
|
|
67
|
+
render = _a.render,
|
|
68
|
+
extraHeader = _a.extraHeader,
|
|
67
69
|
onClick = _a.onClick,
|
|
68
|
-
|
|
70
|
+
_a$size = _a.size,
|
|
71
|
+
size = _a$size === void 0 ? 'lg' : _a$size,
|
|
72
|
+
rest = __rest(_a, ["prefixCls", "role", "className", "data", "placement", "showCollapse", "expandedType", "showAllSubMenus", "defaultExpandAll", "defaultExpandedIds", "expandedIds", "onExpand", "defaultActiveId", "activeId", "onClickSubMenu", "collapsed", "defaultCollapsed", "overlayClassName", "onCollapse", "footerRender", "render", "extraHeader", "onClick", "size"]);
|
|
69
73
|
|
|
70
74
|
var _useUncontrolledState = useUncontrolledState(defaultActiveId, activeIdProp, onClick),
|
|
71
75
|
activeId = _useUncontrolledState[0],
|
|
@@ -213,12 +217,12 @@ var Menu = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
213
217
|
}) : collapseNode);
|
|
214
218
|
};
|
|
215
219
|
|
|
216
|
-
var cls = cx(prefixCls, className, prefixCls + "--" + placement, mini && prefixCls + "--mini", (expandedType === 'pop' || showAllSubMenus || mini) && prefixCls + "--popup");
|
|
220
|
+
var cls = cx(prefixCls, className, prefixCls + "--" + placement, prefixCls + "--size-" + size, mini && prefixCls + "--mini", (expandedType === 'pop' || showAllSubMenus || mini) && prefixCls + "--popup");
|
|
217
221
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
218
222
|
ref: useMergeRefs(ref, setContainerElement),
|
|
219
223
|
role: role,
|
|
220
224
|
className: cls
|
|
221
|
-
}, rest), /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
225
|
+
}, rest), extraHeader, /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
222
226
|
value: {
|
|
223
227
|
placement: placement,
|
|
224
228
|
expandedType: expandedType,
|
|
@@ -243,13 +247,16 @@ var Menu = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
243
247
|
}, /*#__PURE__*/React.createElement(MenuItem, Object.assign({}, item, {
|
|
244
248
|
level: 1,
|
|
245
249
|
render: renderMenuItemMini,
|
|
246
|
-
raw: item
|
|
250
|
+
raw: item,
|
|
251
|
+
size: size
|
|
247
252
|
}))) : /*#__PURE__*/React.createElement(MenuItem, Object.assign({
|
|
248
253
|
hidden: !showVertical && index >= tagMaxCount
|
|
249
254
|
}, item, {
|
|
255
|
+
render: render,
|
|
250
256
|
key: item.id,
|
|
251
257
|
level: 1,
|
|
252
|
-
raw: item
|
|
258
|
+
raw: item,
|
|
259
|
+
size: size
|
|
253
260
|
}));
|
|
254
261
|
}), showVertical || restTagList.length === 0 ? null : /*#__PURE__*/React.createElement(MenuItem, {
|
|
255
262
|
key: MENU_MORE_ID,
|
|
@@ -270,9 +277,6 @@ if (__DEV__) {
|
|
|
270
277
|
|
|
271
278
|
|
|
272
279
|
var renderMenuItemMini = function renderMenuItemMini(menu) {
|
|
273
|
-
// if (typeof menu.icon !== 'undefined') {
|
|
274
|
-
// return menu.icon
|
|
275
|
-
// }
|
|
276
280
|
if (typeof menu.title === 'string') {
|
|
277
281
|
return menu.title.substring(0, 1);
|
|
278
282
|
}
|
package/lib/esm/MenuItem.js
CHANGED
|
@@ -12,12 +12,12 @@ import React, { forwardRef, useRef, useContext } from 'react';
|
|
|
12
12
|
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
13
|
import { __DEV__ } from '@hi-ui/env';
|
|
14
14
|
import { RightOutlined, DownOutlined, UpOutlined } from '@hi-ui/icons';
|
|
15
|
-
import MenuContext from './context.js';
|
|
16
15
|
import Popper from '@hi-ui/popper';
|
|
17
|
-
import { Expander } from './Expander.js';
|
|
18
16
|
import { isArrayNonEmpty, isFunction } from '@hi-ui/type-assertion';
|
|
19
17
|
import { times } from '@hi-ui/array-utils';
|
|
20
18
|
import { useMergeRefs } from '@hi-ui/use-merge-refs';
|
|
19
|
+
import MenuContext from './context.js';
|
|
20
|
+
import { Expander } from './Expander.js';
|
|
21
21
|
var MENU_PREFIX = getPrefixCls('menu');
|
|
22
22
|
var hiddenStyle = {
|
|
23
23
|
position: 'absolute',
|
|
@@ -43,7 +43,9 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
43
43
|
hidden = _a$hidden === void 0 ? false : _a$hidden,
|
|
44
44
|
render = _a.render,
|
|
45
45
|
raw = _a.raw,
|
|
46
|
-
|
|
46
|
+
_a$size = _a.size,
|
|
47
|
+
size = _a$size === void 0 ? 'lg' : _a$size,
|
|
48
|
+
rest = __rest(_a, ["prefixCls", "className", "icon", "title", "disabled", "id", "level", "children", "parentIds", "hidden", "render", "raw", "size"]);
|
|
47
49
|
|
|
48
50
|
var itemRef = useRef(null);
|
|
49
51
|
|
|
@@ -73,14 +75,9 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
73
75
|
className: cx(prefixCls + "-item__inner", (_cx2 = {}, _cx2[prefixCls + "-item__inner--active"] = activeId === id, _cx2[prefixCls + "-item__inner--active-p"] = activeParents === null || activeParents === void 0 ? void 0 : activeParents.includes(id), _cx2[prefixCls + "-item__inner--expanded"] = expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id), _cx2)),
|
|
74
76
|
onClick: function onClick() {
|
|
75
77
|
if (isArrayNonEmpty(children)) {
|
|
76
|
-
|
|
77
|
-
clickSubMenu(id);
|
|
78
|
-
}
|
|
78
|
+
!disabled && (clickSubMenu === null || clickSubMenu === void 0 ? void 0 : clickSubMenu(id));
|
|
79
79
|
} else {
|
|
80
|
-
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
clickMenu(id, raw);
|
|
83
|
-
}
|
|
80
|
+
!disabled && (clickMenu === null || clickMenu === void 0 ? void 0 : clickMenu(id, raw));
|
|
84
81
|
|
|
85
82
|
if (closeAllPopper && !(placement === 'vertical' && expandedType === 'collapse' && mini === false)) {
|
|
86
83
|
closeAllPopper();
|
|
@@ -98,7 +95,7 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
98
95
|
id: id,
|
|
99
96
|
icon: icon,
|
|
100
97
|
title: title
|
|
101
|
-
}) : title), hasChildren && !mini && placement === 'vertical' && expandedType === 'collapse' && !showAllSubMenus && ((expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React.createElement(Arrow, {
|
|
98
|
+
}) : title), hasChildren && !mini && placement === 'vertical' && expandedType === 'collapse' && !showAllSubMenus && (!disabled && (expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React.createElement(Arrow, {
|
|
102
99
|
prefixCls: prefixCls + "-item",
|
|
103
100
|
direction: "up"
|
|
104
101
|
}) : /*#__PURE__*/React.createElement(Arrow, {
|
|
@@ -110,14 +107,14 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
110
107
|
prefixCls: prefixCls + "-item"
|
|
111
108
|
}) : null, hasChildren && placement === 'horizontal' && level > 1 ? /*#__PURE__*/React.createElement(Arrow, {
|
|
112
109
|
prefixCls: prefixCls + "-item"
|
|
113
|
-
}) : null, hasChildren && placement === 'horizontal' && level === 1 && ((expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React.createElement(Arrow, {
|
|
110
|
+
}) : null, hasChildren && placement === 'horizontal' && level === 1 && (!disabled && (expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)) ? /*#__PURE__*/React.createElement(Arrow, {
|
|
114
111
|
prefixCls: prefixCls + "-item",
|
|
115
112
|
direction: "up"
|
|
116
113
|
}) : /*#__PURE__*/React.createElement(Arrow, {
|
|
117
114
|
prefixCls: prefixCls + "-item",
|
|
118
115
|
direction: "down"
|
|
119
116
|
}))), hasChildren && placement === 'vertical' && !mini && !showAllSubMenus && expandedType === 'collapse' ? /*#__PURE__*/React.createElement(Expander, {
|
|
120
|
-
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id))
|
|
117
|
+
visible: !disabled && !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id))
|
|
121
118
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
122
119
|
className: prefixCls + "-submenu"
|
|
123
120
|
}, children.map(function (child) {
|
|
@@ -125,7 +122,9 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
125
122
|
key: child.id,
|
|
126
123
|
level: level + 1,
|
|
127
124
|
parentIds: _parentIds,
|
|
128
|
-
raw: child
|
|
125
|
+
raw: child,
|
|
126
|
+
render: render,
|
|
127
|
+
size: size
|
|
129
128
|
}));
|
|
130
129
|
}))) : null), hasChildren && placement === 'vertical' && mini && !showAllSubMenus && expandedType === 'collapse' && (level === 1 ? /*#__PURE__*/React.createElement(Popper, {
|
|
131
130
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -134,18 +133,18 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
134
133
|
gutterGap: 16,
|
|
135
134
|
className: overlayClassName,
|
|
136
135
|
onClose: function onClose() {
|
|
137
|
-
|
|
138
|
-
closePopper(id);
|
|
139
|
-
}
|
|
136
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
140
137
|
}
|
|
141
138
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
142
|
-
className: prefixCls + "-popmenu"
|
|
139
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
143
140
|
}, children.map(function (child) {
|
|
144
141
|
return /*#__PURE__*/React.createElement(MenuItem, Object.assign({}, child, {
|
|
145
142
|
key: child.id,
|
|
146
143
|
level: level + 1,
|
|
147
144
|
parentIds: _parentIds,
|
|
148
|
-
raw: child
|
|
145
|
+
raw: child,
|
|
146
|
+
render: render,
|
|
147
|
+
size: size
|
|
149
148
|
}));
|
|
150
149
|
}))) : /*#__PURE__*/React.createElement(Popper, {
|
|
151
150
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -155,18 +154,18 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
155
154
|
disabledPortal: true,
|
|
156
155
|
className: overlayClassName,
|
|
157
156
|
onClose: function onClose() {
|
|
158
|
-
|
|
159
|
-
closePopper(id);
|
|
160
|
-
}
|
|
157
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
161
158
|
}
|
|
162
159
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
163
|
-
className: prefixCls + "-popmenu"
|
|
160
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
164
161
|
}, children.map(function (child) {
|
|
165
162
|
return /*#__PURE__*/React.createElement(MenuItem, Object.assign({}, child, {
|
|
166
163
|
key: child.id,
|
|
167
164
|
level: level + 1,
|
|
168
165
|
parentIds: _parentIds,
|
|
169
|
-
raw: child
|
|
166
|
+
raw: child,
|
|
167
|
+
render: render,
|
|
168
|
+
size: size
|
|
170
169
|
}));
|
|
171
170
|
})))), hasChildren && placement === 'vertical' && !showAllSubMenus && expandedType === 'pop' && (level === 1 ? /*#__PURE__*/React.createElement(Popper, {
|
|
172
171
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -175,18 +174,18 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
175
174
|
gutterGap: 16,
|
|
176
175
|
className: overlayClassName,
|
|
177
176
|
onClose: function onClose() {
|
|
178
|
-
|
|
179
|
-
closePopper(id);
|
|
180
|
-
}
|
|
177
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
181
178
|
}
|
|
182
179
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
183
|
-
className: prefixCls + "-popmenu"
|
|
180
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
184
181
|
}, children.map(function (child) {
|
|
185
182
|
return /*#__PURE__*/React.createElement(MenuItem, Object.assign({}, child, {
|
|
186
183
|
key: child.id,
|
|
187
184
|
level: level + 1,
|
|
188
185
|
parentIds: _parentIds,
|
|
189
|
-
raw: child
|
|
186
|
+
raw: child,
|
|
187
|
+
render: render,
|
|
188
|
+
size: size
|
|
190
189
|
}));
|
|
191
190
|
}))) : /*#__PURE__*/React.createElement(Popper, {
|
|
192
191
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -196,18 +195,18 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
196
195
|
gutterGap: 16,
|
|
197
196
|
className: overlayClassName,
|
|
198
197
|
onClose: function onClose() {
|
|
199
|
-
|
|
200
|
-
closePopper(id);
|
|
201
|
-
}
|
|
198
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
202
199
|
}
|
|
203
200
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
204
|
-
className: prefixCls + "-popmenu"
|
|
201
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
205
202
|
}, children.map(function (child) {
|
|
206
203
|
return /*#__PURE__*/React.createElement(MenuItem, Object.assign({}, child, {
|
|
207
204
|
key: child.id,
|
|
208
205
|
level: level + 1,
|
|
209
206
|
parentIds: _parentIds,
|
|
210
|
-
raw: child
|
|
207
|
+
raw: child,
|
|
208
|
+
render: render,
|
|
209
|
+
size: size
|
|
211
210
|
}));
|
|
212
211
|
})))), hasChildren && placement === 'vertical' && showAllSubMenus ? /*#__PURE__*/React.createElement(Popper, {
|
|
213
212
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -216,9 +215,7 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
216
215
|
gutterGap: 16,
|
|
217
216
|
className: overlayClassName,
|
|
218
217
|
onClose: function onClose() {
|
|
219
|
-
|
|
220
|
-
closePopper(id);
|
|
221
|
-
}
|
|
218
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
222
219
|
}
|
|
223
220
|
}, /*#__PURE__*/React.createElement("div", {
|
|
224
221
|
className: prefixCls + "-fat-menu"
|
|
@@ -233,15 +230,12 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
233
230
|
|
|
234
231
|
return /*#__PURE__*/React.createElement("div", {
|
|
235
232
|
onClick: function onClick() {
|
|
236
|
-
if (
|
|
237
|
-
clickMenu(item.id, item);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (closePopper) {
|
|
241
|
-
closePopper(id);
|
|
233
|
+
if (!item.disabled) {
|
|
234
|
+
clickMenu === null || clickMenu === void 0 ? void 0 : clickMenu(item.id, item);
|
|
235
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
242
236
|
}
|
|
243
237
|
},
|
|
244
|
-
className: cx(prefixCls + "-item", (_cx3 = {}, _cx3[prefixCls + "-item--active"] = activeId === item.id, _cx3)),
|
|
238
|
+
className: cx(prefixCls + "-item", (_cx3 = {}, _cx3[prefixCls + "-item--active"] = activeId === item.id, _cx3[prefixCls + "-item--disabled"] = item.disabled, _cx3)),
|
|
245
239
|
key: item.id
|
|
246
240
|
}, item.title);
|
|
247
241
|
})) : null);
|
|
@@ -252,18 +246,18 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
252
246
|
gutterGap: level === 1 ? 8 : 16,
|
|
253
247
|
className: overlayClassName,
|
|
254
248
|
onClose: function onClose() {
|
|
255
|
-
|
|
256
|
-
closePopper(id);
|
|
257
|
-
}
|
|
249
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
258
250
|
}
|
|
259
251
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
260
|
-
className: prefixCls + "-popmenu"
|
|
252
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
261
253
|
}, children.map(function (child) {
|
|
262
254
|
return /*#__PURE__*/React.createElement(MenuItem, Object.assign({}, child, {
|
|
263
255
|
key: child.id,
|
|
264
256
|
level: level + 1,
|
|
265
257
|
parentIds: _parentIds,
|
|
266
|
-
raw: child
|
|
258
|
+
raw: child,
|
|
259
|
+
render: render,
|
|
260
|
+
size: size
|
|
267
261
|
}));
|
|
268
262
|
}))) : /*#__PURE__*/React.createElement(Popper, {
|
|
269
263
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -273,18 +267,18 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
273
267
|
gutterGap: level === 1 ? 8 : 16,
|
|
274
268
|
className: overlayClassName,
|
|
275
269
|
onClose: function onClose() {
|
|
276
|
-
|
|
277
|
-
closePopper(id);
|
|
278
|
-
}
|
|
270
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
279
271
|
}
|
|
280
272
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
281
|
-
className: prefixCls + "-popmenu"
|
|
273
|
+
className: prefixCls + "-popmenu " + prefixCls + "--size-" + size
|
|
282
274
|
}, children.map(function (child) {
|
|
283
275
|
return /*#__PURE__*/React.createElement(MenuItem, Object.assign({}, child, {
|
|
284
276
|
key: child.id,
|
|
285
277
|
level: level + 1,
|
|
286
278
|
parentIds: _parentIds,
|
|
287
|
-
raw: child
|
|
279
|
+
raw: child,
|
|
280
|
+
render: render,
|
|
281
|
+
size: size
|
|
288
282
|
}));
|
|
289
283
|
})))), hasChildren && placement === 'horizontal' && showAllSubMenus ? /*#__PURE__*/React.createElement(Popper, {
|
|
290
284
|
visible: !!(expandedIds === null || expandedIds === void 0 ? void 0 : expandedIds.includes(id)),
|
|
@@ -293,9 +287,7 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
293
287
|
gutterGap: 8,
|
|
294
288
|
className: overlayClassName,
|
|
295
289
|
onClose: function onClose() {
|
|
296
|
-
|
|
297
|
-
closePopper(id);
|
|
298
|
-
}
|
|
290
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
299
291
|
}
|
|
300
292
|
}, /*#__PURE__*/React.createElement("div", {
|
|
301
293
|
className: prefixCls + "-fat-menu"
|
|
@@ -309,14 +301,11 @@ var MenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
309
301
|
var _cx4;
|
|
310
302
|
|
|
311
303
|
return /*#__PURE__*/React.createElement("div", {
|
|
312
|
-
className: cx(prefixCls + "-item", (_cx4 = {}, _cx4[prefixCls + "-item--active"] = activeId === item.id, _cx4)),
|
|
304
|
+
className: cx(prefixCls + "-item", (_cx4 = {}, _cx4[prefixCls + "-item--active"] = activeId === item.id, _cx4[prefixCls + "-item--disabled"] = item.disabled, _cx4)),
|
|
313
305
|
onClick: function onClick() {
|
|
314
|
-
if (
|
|
315
|
-
clickMenu(item.id, item);
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
if (closePopper) {
|
|
319
|
-
closePopper(id);
|
|
306
|
+
if (!item.disabled) {
|
|
307
|
+
clickMenu === null || clickMenu === void 0 ? void 0 : clickMenu(item.id, item);
|
|
308
|
+
closePopper === null || closePopper === void 0 ? void 0 : closePopper(id);
|
|
320
309
|
}
|
|
321
310
|
},
|
|
322
311
|
key: item.id
|
|
@@ -332,7 +321,7 @@ if (__DEV__) {
|
|
|
332
321
|
var Arrow = function Arrow(_ref) {
|
|
333
322
|
var prefixCls = _ref.prefixCls,
|
|
334
323
|
direction = _ref.direction;
|
|
335
|
-
var icon
|
|
324
|
+
var icon;
|
|
336
325
|
|
|
337
326
|
switch (direction) {
|
|
338
327
|
case 'up':
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import __styleInject__ from 'style-inject';
|
|
11
|
-
var css_248z = ".hi-v4-menu-fat-menu {background-color: var(--hi-v4-color-static-white, #fff);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);display: -webkit-box;display: -ms-flexbox;display: flex;color: var(--hi-v4-color-gray-700, #1f2733);border-radius: var(--hi-v4-border-radius-md, 4px);-ms-flex-wrap: wrap;flex-wrap: wrap; }.hi-v4-menu-fat-menu__group:not(:last-of-type) {margin-right: var(--hi-v4-spacing-18, 36px); }.hi-v4-menu-fat-menu .hi-v4-menu-group-item {height: 40px;margin: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-6, 12px);color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-menu-fat-menu .hi-v4-menu-item {height: 40px;margin: 0;border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px); }.hi-v4-menu-fat-menu .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-menu-fat-menu .hi-v4-menu-item:not(.hi-v4-menu-item--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu-fat-menu ul {padding: 0;margin: 0; }.hi-v4-menu-fat-menu ul li {list-style-type: none; }.hi-v4-menu-popmenu {background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-menu-popmenu .hi-v4-menu-item {height: 40px;margin: 0; }.hi-v4-menu-popmenu .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;margin-bottom: var(--hi-v4-spacing-4, 8px);padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu-popmenu .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu-popmenu .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width: 100%;padding-right: var(--hi-v4-spacing-4, 8px); }.hi-v4-menu {background-color: var(--hi-v4-color-static-white, #fff);color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);line-height: var(--hi-v4-text-lineheight-md, 1.375rem);-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-menu ul {margin: 0;padding: 0; }.hi-v4-menu-item {list-style: none;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: pointer;-webkit-transition: all 0.3s;transition: all 0.3s; }.hi-v4-menu-item__icon {color: var(--hi-v4-color-gray-500, #929aa6);-webkit-margin-end: var(--hi-v4-spacing-4, 8px);margin-inline-end: var(--hi-v4-spacing-4, 8px); }.hi-v4-menu-item__icon svg[class^=hi-v4-icon] {font-size: var(--hi-v4-text-size-lg, 1rem); }.hi-v4-menu-item__arrow {color: var(--hi-v4-color-gray-500, #929aa6);font-size: var(--hi-v4-text-size-lg, 1rem); }.hi-v4-menu-item__indent {display: inline-block;width: 24px;height: 100%;-ms-flex-negative: 0;flex-shrink: 0; }.hi-v4-menu__wrapper {padding: 0;margin: 0; }.hi-v4-menu--horizontal {width: 100%;overflow: hidden; }.hi-v4-menu--horizontal .hi-v4-menu__wrapper {display: -webkit-box;display: -ms-flexbox;display: flex;overflow: visible;width: -webkit-max-content;width: -moz-max-content;width: max-content;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-menu--horizontal .hi-v4-menu-item {padding: 0 var(--hi-v4-spacing-10, 20px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;align-items: center;height: 56px;border: none;font-size: var(--hi-v4-text-size-lg, 1rem); }.hi-v4-menu--horizontal .hi-v4-menu-item__arrow {-webkit-margin-start: var(--hi-v4-spacing-2, 4px);margin-inline-start: var(--hi-v4-spacing-2, 4px); }.hi-v4-menu--horizontal .hi-v4-menu-item:hover {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item:hover .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item__inner {height: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom: 2px solid transparent; }.hi-v4-menu--horizontal .hi-v4-menu-item__inner--expanded {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--horizontal .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;white-space: nowrap;max-width: none; }.hi-v4-menu--vertical {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: var(--hi-v4-spacing-4, 8px);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box;height: 100%;-webkit-transition: width 0.3s;transition: width 0.3s; }.hi-v4-menu--vertical .hi-v4-menu__wrapper {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: auto; }.hi-v4-menu--vertical.hi-v4-menu--mini {width: 56px;overflow-x: hidden; }.hi-v4-menu--vertical.hi-v4-menu--popup .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu--vertical .hi-v4-menu__toggle {width: 40px;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;border-radius: var(--hi-v4-border-radius-md, 4px);color: var(--hi-v4-color-gray-500, #929aa6);height: 40px;-ms-flex-negative: 0;flex-shrink: 0;-webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);transition-duration: var(--hi-v4-motion-duration-normal, 200ms);-webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));-webkit-transition-property: background-color;transition-property: background-color; }.hi-v4-menu--vertical .hi-v4-menu__toggle:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu--vertical .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;margin-bottom: var(--hi-v4-spacing-4, 8px);padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px);-webkit-transition: all 0.3s;transition: all 0.3s; }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }.hi-v4-menu--vertical .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-menu--vertical .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-indent: 0.5px; }";
|
|
11
|
+
var css_248z = ".hi-v4-menu-fat-menu {background-color: var(--hi-v4-color-static-white, #fff);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);display: -webkit-box;display: -ms-flexbox;display: flex;color: var(--hi-v4-color-gray-700, #1f2733);border-radius: var(--hi-v4-border-radius-md, 4px);-ms-flex-wrap: wrap;flex-wrap: wrap;}.hi-v4-menu-fat-menu__group:not(:last-of-type) {margin-right: var(--hi-v4-spacing-18, 36px);}.hi-v4-menu-fat-menu .hi-v4-menu-group-item {height: 40px;margin: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-6, 12px);color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-menu-fat-menu .hi-v4-menu-item {height: 40px;margin: 0;border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);}.hi-v4-menu-fat-menu .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-menu-fat-menu .hi-v4-menu-item:not(.hi-v4-menu-item--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu-fat-menu .hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu-fat-menu ul {padding: 0;margin: 0;}.hi-v4-menu-fat-menu ul li {list-style-type: none;}.hi-v4-menu-popmenu {background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);margin: 0;font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-menu-popmenu .hi-v4-menu-item {height: 40px;margin: 0;}.hi-v4-menu-popmenu .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;height: 40px;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;margin-bottom: var(--hi-v4-spacing-4, 8px);padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px);}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu-popmenu .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu-popmenu .hi-v4-menu-item__inner--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu-popmenu .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width: 100%;padding-right: var(--hi-v4-spacing-4, 8px);}.hi-v4-menu {background-color: var(--hi-v4-color-static-white, #fff);color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);line-height: var(--hi-v4-text-lineheight-md, 1.375rem);-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-menu ul {margin: 0;padding: 0;}.hi-v4-menu-item {list-style: none;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: pointer;-webkit-transition: all 0.3s;transition: all 0.3s;}.hi-v4-menu-item__icon {color: var(--hi-v4-color-gray-500, #929aa6);-webkit-margin-end: var(--hi-v4-spacing-4, 8px);margin-inline-end: var(--hi-v4-spacing-4, 8px);}.hi-v4-menu-item__icon svg[class^=hi-v4-icon] {font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-menu-item__arrow {color: var(--hi-v4-color-gray-500, #929aa6);font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-menu-item__indent {display: inline-block;width: 24px;height: 100%;-ms-flex-negative: 0;flex-shrink: 0;}.hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu__wrapper {padding: 0;margin: 0;}.hi-v4-menu--horizontal {width: 100%;overflow: hidden;}.hi-v4-menu--horizontal .hi-v4-menu__wrapper {display: -webkit-box;display: -ms-flexbox;display: flex;overflow: visible;width: -webkit-max-content;width: -moz-max-content;width: max-content;-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-menu--horizontal .hi-v4-menu-item {padding: 0 var(--hi-v4-spacing-10, 20px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;-webkit-box-align: center;-ms-flex-align: center;align-items: center;height: 56px;border: none;font-size: var(--hi-v4-text-size-lg, 1rem);}.hi-v4-menu--horizontal .hi-v4-menu-item__arrow {-webkit-margin-start: var(--hi-v4-spacing-2, 4px);margin-inline-start: var(--hi-v4-spacing-2, 4px);}.hi-v4-menu--horizontal .hi-v4-menu-item:hover {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item:hover .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__inner {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item__inner {height: 100%;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom: 2px solid transparent;}.hi-v4-menu--horizontal .hi-v4-menu-item__inner--expanded {border-bottom: 2px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--horizontal .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;white-space: nowrap;max-width: none;}.hi-v4-menu--horizontal .hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu--horizontal .hi-v4-menu-item--disabled:hover .hi-v4-menu-item__inner {border-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-menu--horizontal .hi-v4-menu-item--disabled .hi-v4-menu-item__content {color: var(--hi-v4-color-gray-400, #c9ced6);}.hi-v4-menu--vertical {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;padding: var(--hi-v4-spacing-4, 8px);width: 216px;-webkit-box-sizing: border-box;box-sizing: border-box;height: 100%;-webkit-transition: width 0.3s;transition: width 0.3s;}.hi-v4-menu--vertical .hi-v4-menu__wrapper {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: auto;}.hi-v4-menu--vertical.hi-v4-menu--mini {width: 56px;overflow-x: hidden;}.hi-v4-menu--vertical.hi-v4-menu--popup .hi-v4-menu-item__inner--expanded {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu--vertical .hi-v4-menu__toggle {width: 40px;cursor: pointer;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;border-radius: var(--hi-v4-border-radius-md, 4px);color: var(--hi-v4-color-gray-500, #929aa6);height: 40px;-ms-flex-negative: 0;flex-shrink: 0;-webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);transition-duration: var(--hi-v4-motion-duration-normal, 200ms);-webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));-webkit-transition-property: background-color;transition-property: background-color;}.hi-v4-menu--vertical .hi-v4-menu__toggle:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu--vertical .hi-v4-menu-item__inner {-webkit-box-sizing: border-box;box-sizing: border-box;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;padding: 0 var(--hi-v4-spacing-4, 8px) 0 var(--hi-v4-spacing-6, 12px);border-radius: var(--hi-v4-border-radius-md, 4px);-webkit-transition: all 0.3s;transition: all 0.3s;}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--vertical .hi-v4-menu-item__inner--active-p .hi-v4-menu-item__icon {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-menu--vertical .hi-v4-menu-item__inner:not(.hi-v4-menu-item__inner--active):hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-menu--vertical .hi-v4-menu-item__content {-webkit-box-flex: 1;-ms-flex: 1 1;flex: 1 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-indent: 0.5px;}.hi-v4-menu--vertical .hi-v4-menu-item--disabled {color: var(--hi-v4-color-gray-400, #c9ced6);cursor: not-allowed;}.hi-v4-menu--size-lg .hi-v4-menu-item__inner {height: var(--hi-v4-height-10, 40px);margin-bottom: var(--hi-v4-spacing-4, 8px);}.hi-v4-menu--size-md .hi-v4-menu-item__inner {height: var(--hi-v4-height-9, 36px);margin-bottom: var(--hi-v4-spacing-2, 4px);}.hi-v4-menu--size-sm .hi-v4-menu-item__inner {height: var(--hi-v4-height-8, 32px);margin-bottom: var(--hi-v4-spacing-1, 2px);}";
|
|
12
12
|
|
|
13
13
|
__styleInject__(css_248z);
|
|
14
14
|
|
package/lib/types/Menu.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HiBaseHTMLProps } from '@hi-ui/core';
|
|
2
|
+
import { HiBaseHTMLProps, HiBaseSizeEnum } from '@hi-ui/core';
|
|
3
3
|
import { MenuDataItem, MenuFooterRenderProps } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* 菜单
|
|
@@ -82,4 +82,16 @@ export interface MenuProps extends Omit<HiBaseHTMLProps<'div'>, 'onClick'> {
|
|
|
82
82
|
* 底部渲染器
|
|
83
83
|
*/
|
|
84
84
|
footerRender?: (props: MenuFooterRenderProps) => React.ReactNode;
|
|
85
|
+
/**
|
|
86
|
+
* 自定义渲染菜单项
|
|
87
|
+
*/
|
|
88
|
+
render?: (menuItem: MenuDataItem) => React.ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* 额外的头部内容
|
|
91
|
+
*/
|
|
92
|
+
extraHeader?: React.ReactNode;
|
|
93
|
+
/**
|
|
94
|
+
* 设置菜单项的尺寸
|
|
95
|
+
*/
|
|
96
|
+
size?: HiBaseSizeEnum;
|
|
85
97
|
}
|
package/lib/types/MenuItem.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HiBaseHTMLProps } from '@hi-ui/core';
|
|
2
|
+
import { HiBaseHTMLProps, HiBaseSizeEnum } from '@hi-ui/core';
|
|
3
3
|
import { MenuDataItem } from './types';
|
|
4
4
|
export declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLLIElement | null>>;
|
|
5
5
|
export interface MenuItemProps extends Omit<HiBaseHTMLProps<'li'>, 'id'> {
|
|
@@ -12,4 +12,5 @@ export interface MenuItemProps extends Omit<HiBaseHTMLProps<'li'>, 'id'> {
|
|
|
12
12
|
parentIds?: React.ReactText[];
|
|
13
13
|
render?: (node: MenuDataItem) => React.ReactNode;
|
|
14
14
|
raw?: MenuDataItem;
|
|
15
|
+
size?: HiBaseSizeEnum;
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/menu",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"@hi-ui/array-utils": "^4.0.1",
|
|
47
47
|
"@hi-ui/classname": "^4.0.1",
|
|
48
48
|
"@hi-ui/env": "^4.0.1",
|
|
49
|
-
"@hi-ui/icons": "^4.0.
|
|
50
|
-
"@hi-ui/popper": "^4.0
|
|
49
|
+
"@hi-ui/icons": "^4.0.14",
|
|
50
|
+
"@hi-ui/popper": "^4.1.0",
|
|
51
51
|
"@hi-ui/times": "^4.0.1",
|
|
52
52
|
"@hi-ui/tooltip": "^4.0.5",
|
|
53
|
-
"@hi-ui/tree-utils": "^4.
|
|
53
|
+
"@hi-ui/tree-utils": "^4.1.1",
|
|
54
54
|
"@hi-ui/type-assertion": "^4.0.1",
|
|
55
55
|
"@hi-ui/use-id": "^4.0.1",
|
|
56
56
|
"@hi-ui/use-merge-refs": "^4.0.1",
|