@keyblade/pro-components 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,59 @@
1
1
  import type { IProMenuItem } from './interface';
2
- import type { ComponentInternalInstance, ExtractPropTypes, PropType, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, App } from 'vue';
2
+ import type { ComponentInternalInstance, VNodeRef, VNode, RendererNode, RendererElement, Slot, ComponentPublicInstance, ComponentOptionsBase, ExtractPropTypes, PropType, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, VNodeProps, AllowedComponentProps, ComponentCustomProps, App } from 'vue';
3
3
  declare const ProMenu: {
4
4
  new (...args: any[]): {
5
5
  $: ComponentInternalInstance;
6
6
  $data: {};
7
- $props: Partial<{}> & Omit<Readonly<ExtractPropTypes<{
8
- collapsed: {
9
- type: PropType<boolean>;
10
- required: true;
11
- };
12
- selectedKeys: {
13
- type: PropType<string[]>;
14
- required: true;
15
- };
16
- items: {
17
- type: PropType<IProMenuItem[]>;
18
- required: true;
19
- };
20
- }>> & {
7
+ $props: {
8
+ readonly items: IProMenuItem[];
9
+ key?: string | number | symbol | undefined;
10
+ ref?: VNodeRef | undefined;
11
+ ref_for?: boolean | undefined;
12
+ ref_key?: string | undefined;
13
+ onVnodeBeforeMount?: ((vnode: VNode<RendererNode, RendererElement, {
14
+ [key: string]: any;
15
+ }>) => void) | ((vnode: VNode<RendererNode, RendererElement, {
16
+ [key: string]: any;
17
+ }>) => void)[] | undefined;
18
+ onVnodeMounted?: ((vnode: VNode<RendererNode, RendererElement, {
19
+ [key: string]: any;
20
+ }>) => void) | ((vnode: VNode<RendererNode, RendererElement, {
21
+ [key: string]: any;
22
+ }>) => void)[] | undefined;
23
+ onVnodeBeforeUpdate?: ((vnode: VNode<RendererNode, RendererElement, {
24
+ [key: string]: any;
25
+ }>, oldVNode: VNode<RendererNode, RendererElement, {
26
+ [key: string]: any;
27
+ }>) => void) | ((vnode: VNode<RendererNode, RendererElement, {
28
+ [key: string]: any;
29
+ }>, oldVNode: VNode<RendererNode, RendererElement, {
30
+ [key: string]: any;
31
+ }>) => void)[] | undefined;
32
+ onVnodeUpdated?: ((vnode: VNode<RendererNode, RendererElement, {
33
+ [key: string]: any;
34
+ }>, oldVNode: VNode<RendererNode, RendererElement, {
35
+ [key: string]: any;
36
+ }>) => void) | ((vnode: VNode<RendererNode, RendererElement, {
37
+ [key: string]: any;
38
+ }>, oldVNode: VNode<RendererNode, RendererElement, {
39
+ [key: string]: any;
40
+ }>) => void)[] | undefined;
41
+ onVnodeBeforeUnmount?: ((vnode: VNode<RendererNode, RendererElement, {
42
+ [key: string]: any;
43
+ }>) => void) | ((vnode: VNode<RendererNode, RendererElement, {
44
+ [key: string]: any;
45
+ }>) => void)[] | undefined;
46
+ onVnodeUnmounted?: ((vnode: VNode<RendererNode, RendererElement, {
47
+ [key: string]: any;
48
+ }>) => void) | ((vnode: VNode<RendererNode, RendererElement, {
49
+ [key: string]: any;
50
+ }>) => void)[] | undefined;
51
+ class?: unknown;
52
+ style?: unknown;
21
53
  "onMenu-item-click"?: ((key: string) => any) | undefined;
22
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>;
54
+ readonly collapsed: boolean;
55
+ readonly selectedKeys: string[];
56
+ };
23
57
  $attrs: {
24
58
  [x: string]: unknown;
25
59
  };
@@ -27,10 +61,10 @@ declare const ProMenu: {
27
61
  [x: string]: unknown;
28
62
  };
29
63
  $slots: Readonly<{
30
- [name: string]: Slot | undefined;
64
+ [name: string]: Slot<any> | undefined;
31
65
  }>;
32
- $root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
33
- $parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
66
+ $root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
67
+ $parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
34
68
  $emit: (event: "menu-item-click", key: string) => void;
35
69
  $el: any;
36
70
  $options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
@@ -50,7 +84,7 @@ declare const ProMenu: {
50
84
  "onMenu-item-click"?: ((key: string) => any) | undefined;
51
85
  }, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
52
86
  'menu-item-click': (key: string) => true;
53
- }, string, {}, {}, string> & {
87
+ }, string, {}, {}, string, {}> & {
54
88
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
55
89
  created?: ((() => void) | (() => void)[]) | undefined;
56
90
  beforeMount?: ((() => void) | (() => void)[]) | undefined;
@@ -65,7 +99,7 @@ declare const ProMenu: {
65
99
  unmounted?: ((() => void) | (() => void)[]) | undefined;
66
100
  renderTracked?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
67
101
  renderTriggered?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
68
- errorCaptured?: (((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null, info: string) => boolean | void)[]) | undefined;
102
+ errorCaptured?: (((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void)[]) | undefined;
69
103
  };
70
104
  $forceUpdate: () => void;
71
105
  $nextTick: typeof nextTick;
@@ -106,7 +140,7 @@ declare const ProMenu: {
106
140
  "onMenu-item-click"?: ((key: string) => any) | undefined;
107
141
  }, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
108
142
  'menu-item-click': (key: string) => true;
109
- }, string, {}, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
143
+ }, string, {}, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
110
144
  install: (app: App) => void;
111
145
  };
112
146
  export * from './interface';
@@ -6,7 +6,7 @@ export interface IProMenuItem {
6
6
  /** 中文名称 */
7
7
  title: string;
8
8
  /**
9
- * 图标
9
+ * 菜单图标
10
10
  * arco design icon: 'icon-apps'
11
11
  * url: 绝对路径或相对路径
12
12
  * */
@@ -21,6 +21,6 @@ export interface IProMenuItem {
21
21
  breadcrumbs?: string[];
22
22
  /** 默认缓存,如果设置为 true,页面将不会被缓存 */
23
23
  ignoreCache?: boolean;
24
- /** 子元素 */
24
+ /** 子菜单 */
25
25
  children?: IProMenuItem[];
26
26
  }
@@ -10,5 +10,5 @@ declare const _sfc_main: DefineComponent<{
10
10
  type: __PropType<IProMenuItem>;
11
11
  required: true;
12
12
  };
13
- }>>, {}>;
13
+ }>>, {}, {}>;
14
14
  export default _sfc_main;
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, Fragment, createBlock, createSlots, withCtx, createTextVNode, toDisplayString, renderList, createCommentVNode, unref, resolveDynamicComponent, normalizeClass } from "vue";
1
+ import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, Fragment, createBlock, createSlots, withCtx, createTextVNode, toDisplayString, renderList, createCommentVNode, resolveDynamicComponent, normalizeClass } from "vue";
2
2
  import { useRouter } from "vue-router";
3
3
  const _hoisted_1 = ["src"];
4
4
  const _hoisted_2 = ["src"];
@@ -8,7 +8,7 @@ const __default__ = {
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
9
  ...__default__,
10
10
  props: {
11
- item: null
11
+ item: {}
12
12
  },
13
13
  setup(__props) {
14
14
  const props = __props;
@@ -37,17 +37,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
37
37
  const _component_kb_pro_menu_item = resolveComponent("kb-pro-menu-item");
38
38
  const _component_a_sub_menu = resolveComponent("a-sub-menu");
39
39
  const _component_a_menu_item = resolveComponent("a-menu-item");
40
- return __props.item && !__props.item.hideInMenu ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
41
- ((_a = __props.item) == null ? void 0 : _a.children) && ((_c = (_b = __props.item) == null ? void 0 : _b.children) == null ? void 0 : _c.length) > 0 ? (openBlock(), createBlock(_component_a_sub_menu, {
42
- key: __props.item.name
40
+ return _ctx.item && !_ctx.item.hideInMenu ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
41
+ ((_a = _ctx.item) == null ? void 0 : _a.children) && ((_c = (_b = _ctx.item) == null ? void 0 : _b.children) == null ? void 0 : _c.length) > 0 ? (openBlock(), createBlock(_component_a_sub_menu, {
42
+ key: _ctx.item.name
43
43
  }, createSlots({
44
44
  title: withCtx(() => [
45
- createTextVNode(toDisplayString(__props.item.title), 1)
45
+ createTextVNode(toDisplayString(_ctx.item.title), 1)
46
46
  ]),
47
47
  default: withCtx(() => {
48
48
  var _a2, _b2;
49
49
  return [
50
- !((_a2 = __props.item) == null ? void 0 : _a2.hideChildrenInMenu) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(((_b2 = __props.item) == null ? void 0 : _b2.children) || [], (childItem) => {
50
+ !((_a2 = _ctx.item) == null ? void 0 : _a2.hideChildrenInMenu) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(((_b2 = _ctx.item) == null ? void 0 : _b2.children) || [], (childItem) => {
51
51
  return openBlock(), createBlock(_component_kb_pro_menu_item, {
52
52
  key: childItem.name,
53
53
  item: childItem
@@ -57,37 +57,37 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
57
  }),
58
58
  _: 2
59
59
  }, [
60
- ((_d = __props.item) == null ? void 0 : _d.icon) ? {
60
+ ((_d = _ctx.item) == null ? void 0 : _d.icon) ? {
61
61
  name: "icon",
62
62
  fn: withCtx(() => [
63
- unref(iconType) === "icon" ? (openBlock(), createBlock(resolveDynamicComponent(__props.item.icon), { key: 0 })) : createCommentVNode("", true),
64
- unref(iconType) === "url" ? (openBlock(), createElementBlock("img", {
63
+ iconType.value === "icon" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.item.icon), { key: 0 })) : createCommentVNode("", true),
64
+ iconType.value === "url" ? (openBlock(), createElementBlock("img", {
65
65
  key: 1,
66
66
  class: normalizeClass(`${prefixItemClsName}-img`),
67
- src: __props.item.icon,
67
+ src: _ctx.item.icon,
68
68
  alt: ""
69
69
  }, null, 10, _hoisted_1)) : createCommentVNode("", true)
70
70
  ]),
71
71
  key: "0"
72
72
  } : void 0
73
73
  ]), 1024)) : createCommentVNode("", true),
74
- !((_e = __props.item) == null ? void 0 : _e.children) || ((_g = (_f = __props.item) == null ? void 0 : _f.children) == null ? void 0 : _g.length) === 0 ? (openBlock(), createBlock(_component_a_menu_item, {
75
- key: __props.item.name,
76
- onClick: _cache[0] || (_cache[0] = ($event) => onMenuItemClick(__props.item))
74
+ !((_e = _ctx.item) == null ? void 0 : _e.children) || ((_g = (_f = _ctx.item) == null ? void 0 : _f.children) == null ? void 0 : _g.length) === 0 ? (openBlock(), createBlock(_component_a_menu_item, {
75
+ key: _ctx.item.name,
76
+ onClick: _cache[0] || (_cache[0] = ($event) => onMenuItemClick(_ctx.item))
77
77
  }, createSlots({
78
78
  default: withCtx(() => [
79
- createTextVNode(" " + toDisplayString(__props.item.title), 1)
79
+ createTextVNode(" " + toDisplayString(_ctx.item.title), 1)
80
80
  ]),
81
81
  _: 2
82
82
  }, [
83
- ((_h = __props.item) == null ? void 0 : _h.icon) ? {
83
+ ((_h = _ctx.item) == null ? void 0 : _h.icon) ? {
84
84
  name: "icon",
85
85
  fn: withCtx(() => [
86
- unref(iconType) === "icon" ? (openBlock(), createBlock(resolveDynamicComponent(__props.item.icon), { key: 0 })) : createCommentVNode("", true),
87
- unref(iconType) === "url" ? (openBlock(), createElementBlock("img", {
86
+ iconType.value === "icon" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.item.icon), { key: 0 })) : createCommentVNode("", true),
87
+ iconType.value === "url" ? (openBlock(), createElementBlock("img", {
88
88
  key: 1,
89
89
  class: normalizeClass(`${prefixItemClsName}-img`),
90
- src: __props.item.icon,
90
+ src: _ctx.item.icon,
91
91
  alt: ""
92
92
  }, null, 10, _hoisted_2)) : createCommentVNode("", true)
93
93
  ]),
@@ -30,5 +30,5 @@ declare const _sfc_main: DefineComponent<{
30
30
  };
31
31
  }>> & {
32
32
  "onMenu-item-click"?: ((key: string) => any) | undefined;
33
- }, {}>;
33
+ }, {}, {}>;
34
34
  export default _sfc_main;
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementBlock, Fragment, renderList } from "vue";
2
2
  import _sfc_main$1 from "./pro-menu-item.vue.js";
3
3
  import "./pro-menu-item.vue2.js";
4
+ const prefixClsName = "keyblade-pro-menu";
4
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
6
  __name: "pro-menu",
6
7
  props: {
@@ -22,7 +23,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
23
  },
23
24
  setup(__props, { emit }) {
24
25
  const props = __props;
25
- const prefixClsName = "keyblade-pro-menu";
26
26
  const onMenuItemClick = (key) => {
27
27
  let findItem;
28
28
  const find = (items) => {