@v-c/menu 1.0.6 → 1.0.7
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/Menu.cjs +6 -1
- package/dist/Menu.js +6 -1
- package/dist/SubMenu/index.cjs +25 -11
- package/dist/SubMenu/index.d.ts +1 -2
- package/dist/SubMenu/index.js +25 -11
- package/dist/context/MenuContext.cjs +1 -1
- package/dist/context/MenuContext.js +1 -1
- package/dist/interface.d.ts +1 -0
- package/package.json +4 -4
package/dist/Menu.cjs
CHANGED
|
@@ -255,7 +255,12 @@ var Menu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, att
|
|
|
255
255
|
[`${props.prefixCls || defaults.prefixCls}-rtl`]: isRtl.value
|
|
256
256
|
}, props.rootClass),
|
|
257
257
|
"style": _attrs.style,
|
|
258
|
-
"data": wrappedChildList
|
|
258
|
+
"data": wrappedChildList
|
|
259
|
+
}, {
|
|
260
|
+
dir: props.direction,
|
|
261
|
+
role: "menu",
|
|
262
|
+
tabindex: _attrs.tabindex ?? 0
|
|
263
|
+
}, {
|
|
259
264
|
"renderRawItem": (node) => {
|
|
260
265
|
return node;
|
|
261
266
|
},
|
package/dist/Menu.js
CHANGED
|
@@ -247,7 +247,12 @@ var Menu_default = /* @__PURE__ */ defineComponent((props, { slots, expose, attr
|
|
|
247
247
|
[`${props.prefixCls || defaults.prefixCls}-rtl`]: isRtl.value
|
|
248
248
|
}, props.rootClass),
|
|
249
249
|
"style": _attrs.style,
|
|
250
|
-
"data": wrappedChildList
|
|
250
|
+
"data": wrappedChildList
|
|
251
|
+
}, {
|
|
252
|
+
dir: props.direction,
|
|
253
|
+
role: "menu",
|
|
254
|
+
tabindex: _attrs.tabindex ?? 0
|
|
255
|
+
}, {
|
|
251
256
|
"renderRawItem": (node) => {
|
|
252
257
|
return node;
|
|
253
258
|
},
|
package/dist/SubMenu/index.cjs
CHANGED
|
@@ -8,8 +8,10 @@ const require_PathContext = require("../context/PathContext.cjs");
|
|
|
8
8
|
const require_Icon = require("../Icon.cjs");
|
|
9
9
|
const require_IdContext = require("../context/IdContext.cjs");
|
|
10
10
|
const require_PrivateContext = require("../context/PrivateContext.cjs");
|
|
11
|
+
const require_useMemoCallback = require("../hooks/useMemoCallback.cjs");
|
|
11
12
|
const require_useActive = require("../hooks/useActive.cjs");
|
|
12
13
|
const require_useDirectionStyle = require("../hooks/useDirectionStyle.cjs");
|
|
14
|
+
const require_warnUtil = require("../utils/warnUtil.cjs");
|
|
13
15
|
const require_commonUtil = require("../utils/commonUtil.cjs");
|
|
14
16
|
const require_SubMenuList = require("./SubMenuList.cjs");
|
|
15
17
|
const require_InlineSubMenuList = require("./InlineSubMenuList.cjs");
|
|
@@ -48,6 +50,7 @@ var InternalSubMenu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
48
50
|
const subMenuPrefixCls = (0, vue.computed)(() => `${prefixCls.value}-submenu`);
|
|
49
51
|
const mergedDisabled = (0, vue.computed)(() => !!(contextDisabled.value || props?.disabled));
|
|
50
52
|
if (process.env.NODE_ENV !== "production" && props?.warnKey) (0, _v_c_util_dist_warning.default)(false, "SubMenu should not leave undefined `key`.");
|
|
53
|
+
const mergedItemIcon = (0, vue.computed)(() => props?.itemIcon ?? menuContext?.value?.itemIcon);
|
|
51
54
|
const mergedExpandIcon = (0, vue.computed)(() => props?.expandIcon ?? contextExpandIcon.value);
|
|
52
55
|
const originOpen = (0, vue.computed)(() => {
|
|
53
56
|
const key = props?.eventKey;
|
|
@@ -96,6 +99,10 @@ var InternalSubMenu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
96
99
|
});
|
|
97
100
|
if (mode.value === "inline" && key) onOpenChange(key, !originOpen.value);
|
|
98
101
|
};
|
|
102
|
+
const onMergedItemClick = require_useMemoCallback.default((info) => {
|
|
103
|
+
props?.onClick?.(require_warnUtil.warnItemProp(info));
|
|
104
|
+
menuContext?.value?.onItemClick?.(info);
|
|
105
|
+
});
|
|
99
106
|
const onPopupVisibleChange = (newVisible) => {
|
|
100
107
|
const key = props?.eventKey;
|
|
101
108
|
if (mode.value !== "inline" && key) onOpenChange(key, newVisible);
|
|
@@ -193,7 +200,14 @@ var InternalSubMenu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
193
200
|
open: open.value,
|
|
194
201
|
disabled: mergedDisabled.value
|
|
195
202
|
});
|
|
196
|
-
return
|
|
203
|
+
return (0, vue.createVNode)(require_MenuContext.default, {
|
|
204
|
+
"classes": classes,
|
|
205
|
+
"styles": styles,
|
|
206
|
+
"onItemClick": onMergedItemClick,
|
|
207
|
+
"mode": mode.value === "horizontal" ? "vertical" : mode.value,
|
|
208
|
+
"itemIcon": mergedItemIcon.value,
|
|
209
|
+
"expandIcon": mergedExpandIcon.value
|
|
210
|
+
}, _isSlot(listNode) ? listNode : { default: () => [listNode] });
|
|
197
211
|
};
|
|
198
212
|
}, {
|
|
199
213
|
props: {
|
|
@@ -235,11 +249,6 @@ var InternalSubMenu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
235
249
|
required: false,
|
|
236
250
|
default: void 0
|
|
237
251
|
},
|
|
238
|
-
popupRender: {
|
|
239
|
-
type: Function,
|
|
240
|
-
required: false,
|
|
241
|
-
default: void 0
|
|
242
|
-
},
|
|
243
252
|
type: {
|
|
244
253
|
type: String,
|
|
245
254
|
required: false,
|
|
@@ -306,6 +315,11 @@ var InternalSubMenu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots,
|
|
|
306
315
|
required: false,
|
|
307
316
|
default: void 0
|
|
308
317
|
},
|
|
318
|
+
popupRender: {
|
|
319
|
+
type: Function,
|
|
320
|
+
required: false,
|
|
321
|
+
default: void 0
|
|
322
|
+
},
|
|
309
323
|
onClick: {
|
|
310
324
|
type: Function,
|
|
311
325
|
required: false,
|
|
@@ -399,11 +413,6 @@ var SubMenu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots }) => {
|
|
|
399
413
|
required: false,
|
|
400
414
|
default: void 0
|
|
401
415
|
},
|
|
402
|
-
popupRender: {
|
|
403
|
-
type: Function,
|
|
404
|
-
required: false,
|
|
405
|
-
default: void 0
|
|
406
|
-
},
|
|
407
416
|
type: {
|
|
408
417
|
type: String,
|
|
409
418
|
required: false,
|
|
@@ -470,6 +479,11 @@ var SubMenu = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots }) => {
|
|
|
470
479
|
required: false,
|
|
471
480
|
default: void 0
|
|
472
481
|
},
|
|
482
|
+
popupRender: {
|
|
483
|
+
type: Function,
|
|
484
|
+
required: false,
|
|
485
|
+
default: void 0
|
|
486
|
+
},
|
|
473
487
|
onClick: {
|
|
474
488
|
type: Function,
|
|
475
489
|
required: false,
|
package/dist/SubMenu/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { SubMenuType } from '../interface';
|
|
1
2
|
import { VueNode } from '@v-c/util/dist/type';
|
|
2
3
|
import { CSSProperties } from 'vue';
|
|
3
|
-
import { PopupRender, SubMenuType } from '../interface';
|
|
4
4
|
export type SemanticName = 'list' | 'listTitle';
|
|
5
5
|
export interface SubMenuProps extends Omit<SubMenuType, 'key' | 'children' | 'label'> {
|
|
6
6
|
classes?: Partial<Record<SemanticName, string>>;
|
|
@@ -12,7 +12,6 @@ export interface SubMenuProps extends Omit<SubMenuType, 'key' | 'children' | 'la
|
|
|
12
12
|
eventKey?: string;
|
|
13
13
|
/** @private Do not use. Private warning empty usage */
|
|
14
14
|
warnKey?: boolean;
|
|
15
|
-
popupRender?: PopupRender;
|
|
16
15
|
}
|
|
17
16
|
declare const SubMenu: import('vue').DefineSetupFnComponent<SubMenuProps, {}, {}, SubMenuProps & {}, import('vue').PublicProps>;
|
|
18
17
|
export default SubMenu;
|
package/dist/SubMenu/index.js
CHANGED
|
@@ -3,8 +3,10 @@ import { PathTrackerContext, useFullPath, useMeasure, usePathUserContext } from
|
|
|
3
3
|
import Icon_default from "../Icon.js";
|
|
4
4
|
import { useMenuId } from "../context/IdContext.js";
|
|
5
5
|
import { usePrivateContext } from "../context/PrivateContext.js";
|
|
6
|
+
import useMemoCallback from "../hooks/useMemoCallback.js";
|
|
6
7
|
import useActive from "../hooks/useActive.js";
|
|
7
8
|
import useDirectionStyle from "../hooks/useDirectionStyle.js";
|
|
9
|
+
import { warnItemProp } from "../utils/warnUtil.js";
|
|
8
10
|
import { parseChildren } from "../utils/commonUtil.js";
|
|
9
11
|
import SubMenuList_default from "./SubMenuList.js";
|
|
10
12
|
import InlineSubMenuList_default from "./InlineSubMenuList.js";
|
|
@@ -41,6 +43,7 @@ var InternalSubMenu = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
41
43
|
const subMenuPrefixCls = computed(() => `${prefixCls.value}-submenu`);
|
|
42
44
|
const mergedDisabled = computed(() => !!(contextDisabled.value || props?.disabled));
|
|
43
45
|
if (process.env.NODE_ENV !== "production" && props?.warnKey) warning$1(false, "SubMenu should not leave undefined `key`.");
|
|
46
|
+
const mergedItemIcon = computed(() => props?.itemIcon ?? menuContext?.value?.itemIcon);
|
|
44
47
|
const mergedExpandIcon = computed(() => props?.expandIcon ?? contextExpandIcon.value);
|
|
45
48
|
const originOpen = computed(() => {
|
|
46
49
|
const key = props?.eventKey;
|
|
@@ -89,6 +92,10 @@ var InternalSubMenu = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
89
92
|
});
|
|
90
93
|
if (mode.value === "inline" && key) onOpenChange(key, !originOpen.value);
|
|
91
94
|
};
|
|
95
|
+
const onMergedItemClick = useMemoCallback((info) => {
|
|
96
|
+
props?.onClick?.(warnItemProp(info));
|
|
97
|
+
menuContext?.value?.onItemClick?.(info);
|
|
98
|
+
});
|
|
92
99
|
const onPopupVisibleChange = (newVisible) => {
|
|
93
100
|
const key = props?.eventKey;
|
|
94
101
|
if (mode.value !== "inline" && key) onOpenChange(key, newVisible);
|
|
@@ -186,7 +193,14 @@ var InternalSubMenu = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
186
193
|
open: open.value,
|
|
187
194
|
disabled: mergedDisabled.value
|
|
188
195
|
});
|
|
189
|
-
return
|
|
196
|
+
return createVNode(MenuContext_default, {
|
|
197
|
+
"classes": classes,
|
|
198
|
+
"styles": styles,
|
|
199
|
+
"onItemClick": onMergedItemClick,
|
|
200
|
+
"mode": mode.value === "horizontal" ? "vertical" : mode.value,
|
|
201
|
+
"itemIcon": mergedItemIcon.value,
|
|
202
|
+
"expandIcon": mergedExpandIcon.value
|
|
203
|
+
}, _isSlot(listNode) ? listNode : { default: () => [listNode] });
|
|
190
204
|
};
|
|
191
205
|
}, {
|
|
192
206
|
props: {
|
|
@@ -228,11 +242,6 @@ var InternalSubMenu = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
228
242
|
required: false,
|
|
229
243
|
default: void 0
|
|
230
244
|
},
|
|
231
|
-
popupRender: {
|
|
232
|
-
type: Function,
|
|
233
|
-
required: false,
|
|
234
|
-
default: void 0
|
|
235
|
-
},
|
|
236
245
|
type: {
|
|
237
246
|
type: String,
|
|
238
247
|
required: false,
|
|
@@ -299,6 +308,11 @@ var InternalSubMenu = /* @__PURE__ */ defineComponent((props, { slots, attrs })
|
|
|
299
308
|
required: false,
|
|
300
309
|
default: void 0
|
|
301
310
|
},
|
|
311
|
+
popupRender: {
|
|
312
|
+
type: Function,
|
|
313
|
+
required: false,
|
|
314
|
+
default: void 0
|
|
315
|
+
},
|
|
302
316
|
onClick: {
|
|
303
317
|
type: Function,
|
|
304
318
|
required: false,
|
|
@@ -392,11 +406,6 @@ var SubMenu_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
392
406
|
required: false,
|
|
393
407
|
default: void 0
|
|
394
408
|
},
|
|
395
|
-
popupRender: {
|
|
396
|
-
type: Function,
|
|
397
|
-
required: false,
|
|
398
|
-
default: void 0
|
|
399
|
-
},
|
|
400
409
|
type: {
|
|
401
410
|
type: String,
|
|
402
411
|
required: false,
|
|
@@ -463,6 +472,11 @@ var SubMenu_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
463
472
|
required: false,
|
|
464
473
|
default: void 0
|
|
465
474
|
},
|
|
475
|
+
popupRender: {
|
|
476
|
+
type: Function,
|
|
477
|
+
required: false,
|
|
478
|
+
default: void 0
|
|
479
|
+
},
|
|
466
480
|
onClick: {
|
|
467
481
|
type: Function,
|
|
468
482
|
required: false,
|
|
@@ -11,7 +11,7 @@ function mergeProps(origin, target) {
|
|
|
11
11
|
const clone = { ...origin };
|
|
12
12
|
Object.keys(target).forEach((key) => {
|
|
13
13
|
const value = target[key];
|
|
14
|
-
if (value !== void 0)
|
|
14
|
+
if (value !== void 0) clone[key] = value;
|
|
15
15
|
});
|
|
16
16
|
return clone;
|
|
17
17
|
}
|
package/dist/interface.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface SubMenuType extends ItemSharedProps {
|
|
|
19
19
|
popupClassName?: string;
|
|
20
20
|
popupOffset?: number[];
|
|
21
21
|
popupStyle?: CSSProperties;
|
|
22
|
+
popupRender?: PopupRender;
|
|
22
23
|
onClick?: MenuClickEventHandler;
|
|
23
24
|
onTitleClick?: (info: MenuTitleInfo) => void;
|
|
24
25
|
onTitleMouseEnter?: MenuHoverEventHandler;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/menu",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"description": "menu ui component for vue",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"vue": "^3.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@v-c/
|
|
29
|
-
"@v-c/
|
|
30
|
-
"@v-c/util": "^1.0.
|
|
28
|
+
"@v-c/overflow": "^1.0.3",
|
|
29
|
+
"@v-c/trigger": "^1.0.6",
|
|
30
|
+
"@v-c/util": "^1.0.9"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "vite build",
|