@v-c/menu 1.0.0 → 1.0.2
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/Divider.cjs +7 -4
- package/dist/Divider.js +1 -1
- package/dist/Icon.cjs +9 -6
- package/dist/Icon.js +3 -3
- package/dist/Menu.cjs +27 -24
- package/dist/Menu.js +10 -10
- package/dist/MenuItem.cjs +35 -31
- package/dist/MenuItem.js +14 -13
- package/dist/MenuItemGroup.cjs +20 -15
- package/dist/MenuItemGroup.js +7 -5
- package/dist/SubMenu/InlineSubMenuList.cjs +6 -3
- package/dist/SubMenu/PopupTrigger.cjs +16 -12
- package/dist/SubMenu/PopupTrigger.js +3 -2
- package/dist/SubMenu/SubMenuList.cjs +6 -3
- package/dist/SubMenu/index.cjs +34 -29
- package/dist/SubMenu/index.js +22 -20
- package/dist/context/IdContext.cjs +1 -0
- package/dist/context/MenuContext.cjs +13 -10
- package/dist/context/MenuContext.js +6 -6
- package/dist/context/PathContext.cjs +1 -0
- package/dist/context/PrivateContext.cjs +1 -0
- package/dist/hooks/useAccessibility.cjs +7 -4
- package/dist/hooks/useActive.cjs +4 -1
- package/dist/hooks/useDirectionStyle.cjs +4 -1
- package/dist/hooks/useKeyRecords.cjs +4 -1
- package/dist/hooks/useMemoCallback.cjs +4 -1
- package/dist/index.cjs +4 -1
- package/dist/interface.cjs +1 -0
- package/dist/placements.cjs +4 -1
- package/dist/utils/commonUtil.cjs +3 -2
- package/dist/utils/motionUtil.cjs +1 -0
- package/dist/utils/nodeUtil.cjs +5 -4
- package/dist/utils/nodeUtil.js +1 -1
- package/dist/utils/timeUtil.cjs +1 -0
- package/dist/utils/warnUtil.cjs +4 -3
- package/dist/utils/warnUtil.js +1 -1
- package/package.json +4 -4
package/dist/Divider.cjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
const require_MenuContext = require("./context/MenuContext.cjs");
|
|
4
7
|
const require_PathContext = require("./context/PathContext.cjs");
|
|
5
8
|
let vue = require("vue");
|
|
6
|
-
let
|
|
9
|
+
let _v_c_util = require("@v-c/util");
|
|
7
10
|
var Divider = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
8
11
|
const menuContext = require_MenuContext.useMenuContext();
|
|
9
12
|
const measure = require_PathContext.useMeasure();
|
|
@@ -12,14 +15,14 @@ var Divider = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
|
12
15
|
if (measure) return null;
|
|
13
16
|
return (0, vue.createVNode)("li", {
|
|
14
17
|
"role": "separator",
|
|
15
|
-
"class": (0,
|
|
18
|
+
"class": (0, _v_c_util.clsx)(`${prefixCls}-item-divider`, props.class),
|
|
16
19
|
"style": props.style
|
|
17
20
|
}, null);
|
|
18
21
|
};
|
|
19
22
|
}, {
|
|
20
23
|
props: {
|
|
21
24
|
style: {
|
|
22
|
-
type:
|
|
25
|
+
type: Object,
|
|
23
26
|
required: false,
|
|
24
27
|
default: void 0
|
|
25
28
|
},
|
package/dist/Divider.js
CHANGED
package/dist/Icon.cjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
|
-
let
|
|
7
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
5
8
|
var Icon = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots }) => {
|
|
6
9
|
return () => {
|
|
7
10
|
const { icon, props: iconProps } = props;
|
|
@@ -14,22 +17,22 @@ var Icon = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots }) => {
|
|
|
14
17
|
iconNode = null;
|
|
15
18
|
return children;
|
|
16
19
|
}
|
|
17
|
-
iconNode = (0,
|
|
20
|
+
iconNode = (0, _v_c_util_dist_props_util.filterEmpty)(childIcons ? Array.isArray(childIcons) ? childIcons : [childIcons] : []);
|
|
18
21
|
} else if (typeof icon !== "boolean") iconNode = icon;
|
|
19
22
|
return iconNode || children || null;
|
|
20
23
|
};
|
|
21
24
|
}, { props: {
|
|
22
25
|
icon: {
|
|
23
26
|
type: [
|
|
27
|
+
Object,
|
|
28
|
+
Function,
|
|
24
29
|
String,
|
|
25
30
|
Number,
|
|
26
31
|
null,
|
|
27
32
|
Boolean,
|
|
28
|
-
Array
|
|
29
|
-
Function
|
|
33
|
+
Array
|
|
30
34
|
],
|
|
31
35
|
required: false,
|
|
32
|
-
skipCheck: true,
|
|
33
36
|
default: void 0
|
|
34
37
|
},
|
|
35
38
|
props: {
|
package/dist/Icon.js
CHANGED
|
@@ -19,15 +19,15 @@ var Icon_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
19
19
|
}, { props: {
|
|
20
20
|
icon: {
|
|
21
21
|
type: [
|
|
22
|
+
Object,
|
|
23
|
+
Function,
|
|
22
24
|
String,
|
|
23
25
|
Number,
|
|
24
26
|
null,
|
|
25
27
|
Boolean,
|
|
26
|
-
Array
|
|
27
|
-
Function
|
|
28
|
+
Array
|
|
28
29
|
],
|
|
29
30
|
required: false,
|
|
30
|
-
skipCheck: true,
|
|
31
31
|
default: void 0
|
|
32
32
|
},
|
|
33
33
|
props: {
|
package/dist/Menu.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
const require_MenuContext = require("./context/MenuContext.cjs");
|
|
4
7
|
const require_PathContext = require("./context/PathContext.cjs");
|
|
@@ -12,14 +15,14 @@ const require_MenuItem = require("./MenuItem.cjs");
|
|
|
12
15
|
const require_index = require("./SubMenu/index.cjs");
|
|
13
16
|
const require_nodeUtil = require("./utils/nodeUtil.cjs");
|
|
14
17
|
let vue = require("vue");
|
|
15
|
-
let
|
|
16
|
-
let
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
|
|
18
|
+
let _v_c_util = require("@v-c/util");
|
|
19
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
20
|
+
let _v_c_overflow = require("@v-c/overflow");
|
|
21
|
+
_v_c_overflow = require_rolldown_runtime.__toESM(_v_c_overflow);
|
|
22
|
+
let _v_c_util_dist_hooks_useId = require("@v-c/util/dist/hooks/useId");
|
|
23
|
+
_v_c_util_dist_hooks_useId = require_rolldown_runtime.__toESM(_v_c_util_dist_hooks_useId);
|
|
24
|
+
let _v_c_util_dist_isEqual = require("@v-c/util/dist/isEqual");
|
|
25
|
+
_v_c_util_dist_isEqual = require_rolldown_runtime.__toESM(_v_c_util_dist_isEqual);
|
|
23
26
|
function _isSlot(s) {
|
|
24
27
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
25
28
|
}
|
|
@@ -37,7 +40,7 @@ var defaults = {
|
|
|
37
40
|
};
|
|
38
41
|
var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, attrs: _attrs }) => {
|
|
39
42
|
const containerRef = (0, vue.shallowRef)();
|
|
40
|
-
const uuid = (0,
|
|
43
|
+
const uuid = (0, _v_c_util_dist_hooks_useId.default)(props?.id ? `vc-menu-uuid-${props.id}` : "vc-menu-uuid");
|
|
41
44
|
const isRtl = (0, vue.computed)(() => props?.direction === "rtl");
|
|
42
45
|
const childList = (0, vue.shallowRef)([]);
|
|
43
46
|
const mergedOverflowIndicator = (0, vue.computed)(() => props.overflowedIndicator ?? defaults.overflowedIndicator);
|
|
@@ -151,7 +154,7 @@ var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, att
|
|
|
151
154
|
const subPathKeys = getSubPathKeys(key);
|
|
152
155
|
newOpenKeys = newOpenKeys.filter((k) => !subPathKeys.has(k));
|
|
153
156
|
}
|
|
154
|
-
if (!(0,
|
|
157
|
+
if (!(0, _v_c_util_dist_isEqual.default)(mergedOpenKeys.value, newOpenKeys, true)) triggerOpenKeys(newOpenKeys, true);
|
|
155
158
|
};
|
|
156
159
|
const triggerAccessibilityOpen = (key, open) => {
|
|
157
160
|
onInternalOpenChange(key, open ?? !mergedOpenKeys.value.includes(key));
|
|
@@ -226,12 +229,11 @@ var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, att
|
|
|
226
229
|
}
|
|
227
230
|
});
|
|
228
231
|
return () => {
|
|
229
|
-
const children = (0,
|
|
230
|
-
|
|
232
|
+
const children = (0, _v_c_util_dist_props_util.filterEmpty)(slots.default?.());
|
|
233
|
+
childList.value = require_nodeUtil.parseItems(children, props?.items, EMPTY_LIST, props?._internalComponents || {}, props?.prefixCls || defaults.prefixCls, {
|
|
231
234
|
labelRender: props?.labelRender,
|
|
232
235
|
extraRender: props?.extraRender
|
|
233
236
|
});
|
|
234
|
-
if (childList.value.length !== parsedChildList.length || !(0, __v_c_util_dist_isEqual.default)(childList.value.map((n) => n?.key), parsedChildList.map((n) => n?.key))) childList.value = parsedChildList;
|
|
235
237
|
const measureChildList = require_nodeUtil.parseItems(children, props?.items, EMPTY_LIST, {}, props?.prefixCls || defaults.prefixCls);
|
|
236
238
|
const wrappedChildList = internalMode.value !== "horizontal" || props?.disabledOverflow ? childList.value : childList.value.map((child, index) => (0, vue.createVNode)(require_MenuContext.default, {
|
|
237
239
|
"key": child.key,
|
|
@@ -239,12 +241,12 @@ var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, att
|
|
|
239
241
|
"classes": props.classes,
|
|
240
242
|
"styles": props.styles
|
|
241
243
|
}, _isSlot(child) ? child : { default: () => [child] }));
|
|
242
|
-
const container = (0, vue.createVNode)(
|
|
244
|
+
const container = (0, vue.createVNode)(_v_c_overflow.default, (0, vue.mergeProps)({
|
|
243
245
|
"ref": containerRef,
|
|
244
246
|
"prefixCls": `${props.prefixCls || defaults.prefixCls}-overflow`,
|
|
245
247
|
"component": "ul",
|
|
246
248
|
"itemComponent": require_MenuItem.default,
|
|
247
|
-
"class": (0,
|
|
249
|
+
"class": (0, _v_c_util.classNames)(props.prefixCls || defaults.prefixCls, `${props.prefixCls || defaults.prefixCls}-root`, `${props.prefixCls || defaults.prefixCls}-${internalMode.value}`, _attrs.class || "", {
|
|
248
250
|
[`${props.prefixCls || defaults.prefixCls}-inline-collapsed`]: internalInlineCollapsed.value,
|
|
249
251
|
[`${props.prefixCls || defaults.prefixCls}-rtl`]: isRtl.value
|
|
250
252
|
}, props.rootClass),
|
|
@@ -264,7 +266,7 @@ var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, att
|
|
|
264
266
|
"popupClassName": props.overflowedIndicatorPopupClassName
|
|
265
267
|
}, _isSlot(originOmitItems) ? originOmitItems : { default: () => [originOmitItems] });
|
|
266
268
|
},
|
|
267
|
-
"maxCount": internalMode.value !== "horizontal" || props?.disabledOverflow ?
|
|
269
|
+
"maxCount": internalMode.value !== "horizontal" || props?.disabledOverflow ? _v_c_overflow.default.INVALIDATE : _v_c_overflow.default.RESPONSIVE,
|
|
268
270
|
"ssr": "full",
|
|
269
271
|
"data-menu-list": true,
|
|
270
272
|
"onVisibleChange": (newLastIndex) => {
|
|
@@ -420,32 +422,34 @@ var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, att
|
|
|
420
422
|
},
|
|
421
423
|
itemIcon: {
|
|
422
424
|
type: [
|
|
425
|
+
Object,
|
|
426
|
+
Function,
|
|
423
427
|
String,
|
|
424
428
|
Number,
|
|
425
429
|
null,
|
|
426
430
|
Boolean,
|
|
427
|
-
Array
|
|
428
|
-
Function
|
|
431
|
+
Array
|
|
429
432
|
],
|
|
430
433
|
required: false,
|
|
431
|
-
skipCheck: true,
|
|
432
434
|
default: void 0
|
|
433
435
|
},
|
|
434
436
|
expandIcon: {
|
|
435
437
|
type: [
|
|
438
|
+
Object,
|
|
439
|
+
Function,
|
|
436
440
|
String,
|
|
437
441
|
Number,
|
|
438
442
|
null,
|
|
439
443
|
Boolean,
|
|
440
|
-
Array
|
|
441
|
-
Function
|
|
444
|
+
Array
|
|
442
445
|
],
|
|
443
446
|
required: false,
|
|
444
|
-
skipCheck: true,
|
|
445
447
|
default: void 0
|
|
446
448
|
},
|
|
447
449
|
overflowedIndicator: {
|
|
448
450
|
type: [
|
|
451
|
+
Object,
|
|
452
|
+
Function,
|
|
449
453
|
String,
|
|
450
454
|
Number,
|
|
451
455
|
null,
|
|
@@ -453,7 +457,6 @@ var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, att
|
|
|
453
457
|
Array
|
|
454
458
|
],
|
|
455
459
|
required: false,
|
|
456
|
-
skipCheck: true,
|
|
457
460
|
default: void 0
|
|
458
461
|
},
|
|
459
462
|
overflowedIndicatorPopupClassName: {
|
package/dist/Menu.js
CHANGED
|
@@ -32,7 +32,7 @@ var defaults = {
|
|
|
32
32
|
};
|
|
33
33
|
var Menu_default = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs: _attrs }) => {
|
|
34
34
|
const containerRef = shallowRef();
|
|
35
|
-
const uuid = useId(props?.id ? `
|
|
35
|
+
const uuid = useId(props?.id ? `vc-menu-uuid-${props.id}` : "vc-menu-uuid");
|
|
36
36
|
const isRtl = computed(() => props?.direction === "rtl");
|
|
37
37
|
const childList = shallowRef([]);
|
|
38
38
|
const mergedOverflowIndicator = computed(() => props.overflowedIndicator ?? defaults.overflowedIndicator);
|
|
@@ -222,11 +222,10 @@ var Menu_default = /* @__PURE__ */ defineComponent((props, { slots, expose, attr
|
|
|
222
222
|
});
|
|
223
223
|
return () => {
|
|
224
224
|
const children = filterEmpty(slots.default?.());
|
|
225
|
-
|
|
225
|
+
childList.value = parseItems(children, props?.items, EMPTY_LIST, props?._internalComponents || {}, props?.prefixCls || defaults.prefixCls, {
|
|
226
226
|
labelRender: props?.labelRender,
|
|
227
227
|
extraRender: props?.extraRender
|
|
228
228
|
});
|
|
229
|
-
if (childList.value.length !== parsedChildList.length || !isEqual(childList.value.map((n) => n?.key), parsedChildList.map((n) => n?.key))) childList.value = parsedChildList;
|
|
230
229
|
const measureChildList = parseItems(children, props?.items, EMPTY_LIST, {}, props?.prefixCls || defaults.prefixCls);
|
|
231
230
|
const wrappedChildList = internalMode.value !== "horizontal" || props?.disabledOverflow ? childList.value : childList.value.map((child, index) => createVNode(MenuContext_default, {
|
|
232
231
|
"key": child.key,
|
|
@@ -415,32 +414,34 @@ var Menu_default = /* @__PURE__ */ defineComponent((props, { slots, expose, attr
|
|
|
415
414
|
},
|
|
416
415
|
itemIcon: {
|
|
417
416
|
type: [
|
|
417
|
+
Object,
|
|
418
|
+
Function,
|
|
418
419
|
String,
|
|
419
420
|
Number,
|
|
420
421
|
null,
|
|
421
422
|
Boolean,
|
|
422
|
-
Array
|
|
423
|
-
Function
|
|
423
|
+
Array
|
|
424
424
|
],
|
|
425
425
|
required: false,
|
|
426
|
-
skipCheck: true,
|
|
427
426
|
default: void 0
|
|
428
427
|
},
|
|
429
428
|
expandIcon: {
|
|
430
429
|
type: [
|
|
430
|
+
Object,
|
|
431
|
+
Function,
|
|
431
432
|
String,
|
|
432
433
|
Number,
|
|
433
434
|
null,
|
|
434
435
|
Boolean,
|
|
435
|
-
Array
|
|
436
|
-
Function
|
|
436
|
+
Array
|
|
437
437
|
],
|
|
438
438
|
required: false,
|
|
439
|
-
skipCheck: true,
|
|
440
439
|
default: void 0
|
|
441
440
|
},
|
|
442
441
|
overflowedIndicator: {
|
|
443
442
|
type: [
|
|
443
|
+
Object,
|
|
444
|
+
Function,
|
|
444
445
|
String,
|
|
445
446
|
Number,
|
|
446
447
|
null,
|
|
@@ -448,7 +449,6 @@ var Menu_default = /* @__PURE__ */ defineComponent((props, { slots, expose, attr
|
|
|
448
449
|
Array
|
|
449
450
|
],
|
|
450
451
|
required: false,
|
|
451
|
-
skipCheck: true,
|
|
452
452
|
default: void 0
|
|
453
453
|
},
|
|
454
454
|
overflowedIndicatorPopupClassName: {
|
package/dist/MenuItem.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
const require_MenuContext = require("./context/MenuContext.cjs");
|
|
4
7
|
const require_PathContext = require("./context/PathContext.cjs");
|
|
@@ -9,30 +12,29 @@ const require_useActive = require("./hooks/useActive.cjs");
|
|
|
9
12
|
const require_useDirectionStyle = require("./hooks/useDirectionStyle.cjs");
|
|
10
13
|
const require_warnUtil = require("./utils/warnUtil.cjs");
|
|
11
14
|
let vue = require("vue");
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
|
|
15
|
+
let _v_c_util = require("@v-c/util");
|
|
16
|
+
let _v_c_util_dist_omit = require("@v-c/util/dist/omit");
|
|
17
|
+
_v_c_util_dist_omit = require_rolldown_runtime.__toESM(_v_c_util_dist_omit);
|
|
18
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
19
|
+
let _v_c_overflow = require("@v-c/overflow");
|
|
20
|
+
_v_c_overflow = require_rolldown_runtime.__toESM(_v_c_overflow);
|
|
21
|
+
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
22
|
+
_v_c_util_dist_KeyCode = require_rolldown_runtime.__toESM(_v_c_util_dist_KeyCode);
|
|
20
23
|
var LegacyMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, attrs }) => {
|
|
21
24
|
return () => {
|
|
22
|
-
const { title, attribute
|
|
25
|
+
const { title, attribute, ...restProps } = attrs;
|
|
23
26
|
const { elementRef } = props;
|
|
24
|
-
const passedProps = (0,
|
|
27
|
+
const passedProps = (0, _v_c_util_dist_omit.default)(restProps, [
|
|
25
28
|
"eventKey",
|
|
26
29
|
"popupClassName",
|
|
27
30
|
"popupOffset",
|
|
28
31
|
"onTitleClick"
|
|
29
32
|
]);
|
|
30
|
-
(0,
|
|
31
|
-
return (0, vue.createVNode)(
|
|
33
|
+
(0, _v_c_util.warning)(!attribute, "`attribute` of Menu.Item is deprecated. Please pass attribute directly.");
|
|
34
|
+
return (0, vue.createVNode)(_v_c_overflow.default.Item, (0, vue.mergeProps)(attribute, { "title": typeof title === "string" ? title : void 0 }, passedProps, { "ref": elementRef }), { default: () => [slots?.default?.()] });
|
|
32
35
|
};
|
|
33
36
|
}, {
|
|
34
37
|
props: { elementRef: {
|
|
35
|
-
type: null,
|
|
36
38
|
required: false,
|
|
37
39
|
default: void 0
|
|
38
40
|
} },
|
|
@@ -40,7 +42,7 @@ var LegacyMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, a
|
|
|
40
42
|
inheritAttrs: false
|
|
41
43
|
});
|
|
42
44
|
var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, attrs }) => {
|
|
43
|
-
const { eventKey } = (0,
|
|
45
|
+
const { eventKey } = (0, _v_c_util_dist_props_util.toPropsRefs)(props, "eventKey");
|
|
44
46
|
const domDataId = require_IdContext.useMenuId(eventKey);
|
|
45
47
|
const menuContext = require_MenuContext.useMenuContext();
|
|
46
48
|
const privateContext = require_PrivateContext.usePrivateContext();
|
|
@@ -48,7 +50,7 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
48
50
|
const elementRef = (0, vue.shallowRef)();
|
|
49
51
|
const mergedDisabled = (0, vue.computed)(() => props.disabled ?? menuContext?.value?.disabled);
|
|
50
52
|
const connectedKeys = require_PathContext.useFullPath(eventKey);
|
|
51
|
-
if (process.env.NODE_ENV !== "production" && props.warnKey) (0,
|
|
53
|
+
if (process.env.NODE_ENV !== "production" && props.warnKey) (0, _v_c_util.warning)(false, "MenuItem should not leave undefined `key`.");
|
|
52
54
|
const getEventInfo = (e) => {
|
|
53
55
|
return {
|
|
54
56
|
key: eventKey.value,
|
|
@@ -69,7 +71,7 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
69
71
|
};
|
|
70
72
|
const onInternalKeyDown = (e) => {
|
|
71
73
|
props?.onKeyDown?.(e);
|
|
72
|
-
if (e.which ===
|
|
74
|
+
if (e.which === _v_c_util_dist_KeyCode.default.ENTER) {
|
|
73
75
|
const info = getEventInfo(e);
|
|
74
76
|
props?.onClick?.(require_warnUtil.warnItemProp(info));
|
|
75
77
|
menuContext?.value?.onItemClick?.(info);
|
|
@@ -80,7 +82,7 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
80
82
|
props?.onFocus?.(e);
|
|
81
83
|
};
|
|
82
84
|
return () => {
|
|
83
|
-
const { role, disabled, itemIcon
|
|
85
|
+
const { role, disabled, itemIcon, ...restProps } = props;
|
|
84
86
|
const optionRoleProps = {};
|
|
85
87
|
if (role === "option") optionRoleProps["aria-selected"] = selected.value;
|
|
86
88
|
const { prefixCls, overflowDisabled, itemIcon: contextItemIcon } = menuContext?.value ?? {};
|
|
@@ -96,14 +98,14 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
96
98
|
"role": role === null ? "none" : role || "menuitem",
|
|
97
99
|
"tabIndex": disabled ? null : -1,
|
|
98
100
|
"data-menu-id": overflowDisabled && domDataId.value ? null : domDataId.value
|
|
99
|
-
}, (0,
|
|
101
|
+
}, (0, _v_c_util_dist_omit.default)({
|
|
100
102
|
...restProps,
|
|
101
103
|
...attrs
|
|
102
104
|
}, ["extra"]), activeProps, optionRoleProps, {
|
|
103
105
|
"component": "li",
|
|
104
106
|
"aria-disabled": disabled,
|
|
105
107
|
"style": [directionStyle.value, props?.style],
|
|
106
|
-
"className": (0,
|
|
108
|
+
"className": (0, _v_c_util.clsx)(itemCls, {
|
|
107
109
|
[`${itemCls}-active`]: active.value,
|
|
108
110
|
[`${itemCls}-selected`]: selected.value,
|
|
109
111
|
[`${itemCls}-disabled`]: mergedDisabled.value
|
|
@@ -165,19 +167,21 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
165
167
|
},
|
|
166
168
|
itemIcon: {
|
|
167
169
|
type: [
|
|
170
|
+
Object,
|
|
171
|
+
Function,
|
|
168
172
|
String,
|
|
169
173
|
Number,
|
|
170
174
|
null,
|
|
171
175
|
Boolean,
|
|
172
|
-
Array
|
|
173
|
-
Function
|
|
176
|
+
Array
|
|
174
177
|
],
|
|
175
178
|
required: false,
|
|
176
|
-
skipCheck: true,
|
|
177
179
|
default: void 0
|
|
178
180
|
},
|
|
179
181
|
extra: {
|
|
180
182
|
type: [
|
|
183
|
+
Object,
|
|
184
|
+
Function,
|
|
181
185
|
String,
|
|
182
186
|
Number,
|
|
183
187
|
null,
|
|
@@ -185,7 +189,6 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
185
189
|
Array
|
|
186
190
|
],
|
|
187
191
|
required: false,
|
|
188
|
-
skipCheck: true,
|
|
189
192
|
default: void 0
|
|
190
193
|
},
|
|
191
194
|
onMouseEnter: {
|
|
@@ -204,7 +207,7 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
204
207
|
default: void 0
|
|
205
208
|
},
|
|
206
209
|
style: {
|
|
207
|
-
type:
|
|
210
|
+
type: Object,
|
|
208
211
|
required: false,
|
|
209
212
|
default: void 0
|
|
210
213
|
},
|
|
@@ -218,7 +221,7 @@ var InternalMenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
218
221
|
inheritAttrs: false
|
|
219
222
|
});
|
|
220
223
|
var MenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, attrs }) => {
|
|
221
|
-
const { eventKey } = (0,
|
|
224
|
+
const { eventKey } = (0, _v_c_util_dist_props_util.toPropsRefs)(props, "eventKey");
|
|
222
225
|
const measure = require_PathContext.useMeasure();
|
|
223
226
|
const connectedKeyPath = require_PathContext.useFullPath(eventKey);
|
|
224
227
|
(0, vue.watch)([connectedKeyPath], (_n, _o, onCleanup) => {
|
|
@@ -278,19 +281,21 @@ var MenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, attrs }
|
|
|
278
281
|
},
|
|
279
282
|
itemIcon: {
|
|
280
283
|
type: [
|
|
284
|
+
Object,
|
|
285
|
+
Function,
|
|
281
286
|
String,
|
|
282
287
|
Number,
|
|
283
288
|
null,
|
|
284
289
|
Boolean,
|
|
285
|
-
Array
|
|
286
|
-
Function
|
|
290
|
+
Array
|
|
287
291
|
],
|
|
288
292
|
required: false,
|
|
289
|
-
skipCheck: true,
|
|
290
293
|
default: void 0
|
|
291
294
|
},
|
|
292
295
|
extra: {
|
|
293
296
|
type: [
|
|
297
|
+
Object,
|
|
298
|
+
Function,
|
|
294
299
|
String,
|
|
295
300
|
Number,
|
|
296
301
|
null,
|
|
@@ -298,7 +303,6 @@ var MenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, attrs }
|
|
|
298
303
|
Array
|
|
299
304
|
],
|
|
300
305
|
required: false,
|
|
301
|
-
skipCheck: true,
|
|
302
306
|
default: void 0
|
|
303
307
|
},
|
|
304
308
|
onMouseEnter: {
|
|
@@ -317,7 +321,7 @@ var MenuItem = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, attrs }
|
|
|
317
321
|
default: void 0
|
|
318
322
|
},
|
|
319
323
|
style: {
|
|
320
|
-
type:
|
|
324
|
+
type: Object,
|
|
321
325
|
required: false,
|
|
322
326
|
default: void 0
|
|
323
327
|
},
|
package/dist/MenuItem.js
CHANGED
|
@@ -14,7 +14,7 @@ import Overflow from "@v-c/overflow";
|
|
|
14
14
|
import KeyCode from "@v-c/util/dist/KeyCode";
|
|
15
15
|
var LegacyMenuItem = /* @__PURE__ */ defineComponent((props, { slots, attrs }) => {
|
|
16
16
|
return () => {
|
|
17
|
-
const { title, attribute
|
|
17
|
+
const { title, attribute, ...restProps } = attrs;
|
|
18
18
|
const { elementRef } = props;
|
|
19
19
|
const passedProps = omit(restProps, [
|
|
20
20
|
"eventKey",
|
|
@@ -27,7 +27,6 @@ var LegacyMenuItem = /* @__PURE__ */ defineComponent((props, { slots, attrs }) =
|
|
|
27
27
|
};
|
|
28
28
|
}, {
|
|
29
29
|
props: { elementRef: {
|
|
30
|
-
type: null,
|
|
31
30
|
required: false,
|
|
32
31
|
default: void 0
|
|
33
32
|
} },
|
|
@@ -75,7 +74,7 @@ var InternalMenuItem = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
75
74
|
props?.onFocus?.(e);
|
|
76
75
|
};
|
|
77
76
|
return () => {
|
|
78
|
-
const { role, disabled, itemIcon
|
|
77
|
+
const { role, disabled, itemIcon, ...restProps } = props;
|
|
79
78
|
const optionRoleProps = {};
|
|
80
79
|
if (role === "option") optionRoleProps["aria-selected"] = selected.value;
|
|
81
80
|
const { prefixCls, overflowDisabled, itemIcon: contextItemIcon } = menuContext?.value ?? {};
|
|
@@ -160,19 +159,21 @@ var InternalMenuItem = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
160
159
|
},
|
|
161
160
|
itemIcon: {
|
|
162
161
|
type: [
|
|
162
|
+
Object,
|
|
163
|
+
Function,
|
|
163
164
|
String,
|
|
164
165
|
Number,
|
|
165
166
|
null,
|
|
166
167
|
Boolean,
|
|
167
|
-
Array
|
|
168
|
-
Function
|
|
168
|
+
Array
|
|
169
169
|
],
|
|
170
170
|
required: false,
|
|
171
|
-
skipCheck: true,
|
|
172
171
|
default: void 0
|
|
173
172
|
},
|
|
174
173
|
extra: {
|
|
175
174
|
type: [
|
|
175
|
+
Object,
|
|
176
|
+
Function,
|
|
176
177
|
String,
|
|
177
178
|
Number,
|
|
178
179
|
null,
|
|
@@ -180,7 +181,6 @@ var InternalMenuItem = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
180
181
|
Array
|
|
181
182
|
],
|
|
182
183
|
required: false,
|
|
183
|
-
skipCheck: true,
|
|
184
184
|
default: void 0
|
|
185
185
|
},
|
|
186
186
|
onMouseEnter: {
|
|
@@ -199,7 +199,7 @@ var InternalMenuItem = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
199
199
|
default: void 0
|
|
200
200
|
},
|
|
201
201
|
style: {
|
|
202
|
-
type:
|
|
202
|
+
type: Object,
|
|
203
203
|
required: false,
|
|
204
204
|
default: void 0
|
|
205
205
|
},
|
|
@@ -273,19 +273,21 @@ var MenuItem_default = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
273
273
|
},
|
|
274
274
|
itemIcon: {
|
|
275
275
|
type: [
|
|
276
|
+
Object,
|
|
277
|
+
Function,
|
|
276
278
|
String,
|
|
277
279
|
Number,
|
|
278
280
|
null,
|
|
279
281
|
Boolean,
|
|
280
|
-
Array
|
|
281
|
-
Function
|
|
282
|
+
Array
|
|
282
283
|
],
|
|
283
284
|
required: false,
|
|
284
|
-
skipCheck: true,
|
|
285
285
|
default: void 0
|
|
286
286
|
},
|
|
287
287
|
extra: {
|
|
288
288
|
type: [
|
|
289
|
+
Object,
|
|
290
|
+
Function,
|
|
289
291
|
String,
|
|
290
292
|
Number,
|
|
291
293
|
null,
|
|
@@ -293,7 +295,6 @@ var MenuItem_default = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
293
295
|
Array
|
|
294
296
|
],
|
|
295
297
|
required: false,
|
|
296
|
-
skipCheck: true,
|
|
297
298
|
default: void 0
|
|
298
299
|
},
|
|
299
300
|
onMouseEnter: {
|
|
@@ -312,7 +313,7 @@ var MenuItem_default = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
312
313
|
default: void 0
|
|
313
314
|
},
|
|
314
315
|
style: {
|
|
315
|
-
type:
|
|
316
|
+
type: Object,
|
|
316
317
|
required: false,
|
|
317
318
|
default: void 0
|
|
318
319
|
},
|