@keyblade/pro-components 0.0.1-alpha.2 → 0.0.1-alpha.3

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.
@@ -0,0 +1,10 @@
1
+ const _export_sfc = (sfc, props) => {
2
+ const target = sfc.__vccOpts || sfc;
3
+ for (const [key, val] of props) {
4
+ target[key] = val;
5
+ }
6
+ return target;
7
+ };
8
+ export {
9
+ _export_sfc as default
10
+ };
@@ -1,6 +1,8 @@
1
1
  declare module 'vue' {
2
2
  interface GlobalComponents {
3
3
  KbProBreadcrumb: typeof import('./index')['ProBreadcrumb'];
4
+ KbProMenu: typeof import('./index')['ProMenu'];
5
+ KbProReuseTabs: typeof import('./index')['ProReuseTabs'];
4
6
  }
5
7
  }
6
8
  export {};
package/es/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import { App } from 'vue';
2
- import { default as ProBreadcrumb } from './pro-breadcrumb';
3
2
  declare const _default: {
4
3
  install(app: App): void;
5
4
  };
6
5
  export default _default;
7
- export { ProBreadcrumb };
6
+ export { default as ProBreadcrumb } from './pro-breadcrumb';
7
+ export { default as ProMenu } from './pro-menu';
8
+ export type { IProMenuItem } from './pro-menu';
9
+ export { default as ProReuseTabs } from './pro-reuse-tabs';
10
+ export type { IProTab } from './pro-reuse-tabs';
8
11
  export type {} from './components';
package/es/index.js CHANGED
@@ -1,11 +1,19 @@
1
1
  import { ProBreadcrumb } from "./pro-breadcrumb/index.js";
2
2
  import { ProBreadcrumb as ProBreadcrumb2 } from "./pro-breadcrumb/index.js";
3
+ import { ProMenu } from "./pro-menu/index.js";
4
+ import { ProMenu as ProMenu2 } from "./pro-menu/index.js";
5
+ import { ProReuseTabs } from "./pro-reuse-tabs/index.js";
6
+ import { ProReuseTabs as ProReuseTabs2 } from "./pro-reuse-tabs/index.js";
3
7
  const index = {
4
8
  install(app) {
5
9
  app.use(ProBreadcrumb);
10
+ app.use(ProMenu);
11
+ app.use(ProReuseTabs);
6
12
  }
7
13
  };
8
14
  export {
9
15
  ProBreadcrumb2 as ProBreadcrumb,
16
+ ProMenu2 as ProMenu,
17
+ ProReuseTabs2 as ProReuseTabs,
10
18
  index as default
11
19
  };
@@ -1,13 +1,13 @@
1
- import type { ComponentInternalInstance, ExtractPropTypes, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, App } from 'vue';
1
+ import type { ComponentInternalInstance, ExtractPropTypes, PropType, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, App } from 'vue';
2
2
  declare const ProBreadcrumb: {
3
3
  new (...args: any[]): {
4
4
  $: ComponentInternalInstance;
5
5
  $data: {};
6
6
  $props: Partial<{
7
- items: unknown[];
7
+ items: string[];
8
8
  }> & Omit<Readonly<ExtractPropTypes<{
9
9
  items: {
10
- type: ArrayConstructor;
10
+ type: PropType<string[]>;
11
11
  required: false;
12
12
  default: () => never[];
13
13
  };
@@ -27,7 +27,7 @@ declare const ProBreadcrumb: {
27
27
  $el: any;
28
28
  $options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
29
29
  items: {
30
- type: ArrayConstructor;
30
+ type: PropType<string[]>;
31
31
  required: false;
32
32
  default: () => never[];
33
33
  };
@@ -36,7 +36,7 @@ declare const ProBreadcrumb: {
36
36
  props: any;
37
37
  injectValue: never[];
38
38
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
39
- items: unknown[];
39
+ items: string[];
40
40
  }, {}, string> & {
41
41
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
42
42
  created?: ((() => void) | (() => void)[]) | undefined;
@@ -59,7 +59,7 @@ declare const ProBreadcrumb: {
59
59
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: WatchOptions<boolean> | undefined): WatchStopHandle;
60
60
  } & Readonly<ExtractPropTypes<{
61
61
  items: {
62
- type: ArrayConstructor;
62
+ type: PropType<string[]>;
63
63
  required: false;
64
64
  default: () => never[];
65
65
  };
@@ -73,7 +73,7 @@ declare const ProBreadcrumb: {
73
73
  __isSuspense?: undefined;
74
74
  } & ComponentOptionsBase<Readonly<ExtractPropTypes<{
75
75
  items: {
76
- type: ArrayConstructor;
76
+ type: PropType<string[]>;
77
77
  required: false;
78
78
  default: () => never[];
79
79
  };
@@ -82,7 +82,7 @@ declare const ProBreadcrumb: {
82
82
  props: any;
83
83
  injectValue: never[];
84
84
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
85
- items: unknown[];
85
+ items: string[];
86
86
  }, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
87
87
  install: (app: App) => void;
88
88
  };
@@ -1,7 +1,7 @@
1
- import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue';
1
+ import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, type PropType } from 'vue';
2
2
  declare const _sfc_main: DefineComponent<{
3
3
  items: {
4
- type: ArrayConstructor;
4
+ type: PropType<string[]>;
5
5
  required: false;
6
6
  default: () => never[];
7
7
  };
@@ -11,11 +11,11 @@ declare const _sfc_main: DefineComponent<{
11
11
  injectValue: never[];
12
12
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
13
13
  items: {
14
- type: ArrayConstructor;
14
+ type: PropType<string[]>;
15
15
  required: false;
16
16
  default: () => never[];
17
17
  };
18
18
  }>>, {
19
- items: unknown[];
19
+ items: string[];
20
20
  }>;
21
21
  export default _sfc_main;
@@ -2,7 +2,11 @@ import { defineComponent, inject, resolveComponent, unref, openBlock, createBloc
2
2
  const _sfc_main = /* @__PURE__ */ defineComponent({
3
3
  __name: "pro-breadcrumb",
4
4
  props: {
5
- items: { default: () => [] }
5
+ items: {
6
+ type: Array,
7
+ required: false,
8
+ default: () => []
9
+ }
6
10
  },
7
11
  setup(__props) {
8
12
  const props = __props;
@@ -0,0 +1,198 @@
1
+ import type { Router } from 'vue-router';
2
+ import type { IProMenuItem } from './interface';
3
+ import type { ComponentInternalInstance, ExtractPropTypes, PropType, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, DefineComponent, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, App } from 'vue';
4
+ declare const ProMenu: {
5
+ new (...args: any[]): {
6
+ $: ComponentInternalInstance;
7
+ $data: {};
8
+ $props: Partial<{}> & Omit<Readonly<ExtractPropTypes<{
9
+ collapsed: {
10
+ type: PropType<boolean>;
11
+ required: true;
12
+ };
13
+ selectedKeys: {
14
+ type: PropType<string[]>;
15
+ required: true;
16
+ };
17
+ openKeys: {
18
+ type: PropType<string[]>;
19
+ required: true;
20
+ };
21
+ items: {
22
+ type: PropType<IProMenuItem[]>;
23
+ required: true;
24
+ };
25
+ }>> & {
26
+ onCollapse?: ((...args: any[]) => any) | undefined;
27
+ "onMenu-item-click"?: ((...args: any[]) => any) | undefined;
28
+ "onSub-menu-click"?: ((...args: any[]) => any) | undefined;
29
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>;
30
+ $attrs: {
31
+ [x: string]: unknown;
32
+ };
33
+ $refs: {
34
+ [x: string]: unknown;
35
+ };
36
+ $slots: Readonly<{
37
+ [name: string]: Slot | undefined;
38
+ }>;
39
+ $root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
40
+ $parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
41
+ $emit: (event: "collapse" | "menu-item-click" | "sub-menu-click", ...args: any[]) => void;
42
+ $el: any;
43
+ $options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
44
+ collapsed: {
45
+ type: PropType<boolean>;
46
+ required: true;
47
+ };
48
+ selectedKeys: {
49
+ type: PropType<string[]>;
50
+ required: true;
51
+ };
52
+ openKeys: {
53
+ type: PropType<string[]>;
54
+ required: true;
55
+ };
56
+ items: {
57
+ type: PropType<IProMenuItem[]>;
58
+ required: true;
59
+ };
60
+ }>> & {
61
+ onCollapse?: ((...args: any[]) => any) | undefined;
62
+ "onMenu-item-click"?: ((...args: any[]) => any) | undefined;
63
+ "onSub-menu-click"?: ((...args: any[]) => any) | undefined;
64
+ }, {
65
+ prefixClsName: string;
66
+ emit: {
67
+ (event: "collapse", collapsed: boolean): void;
68
+ (event: "menu-item-click", key: string): void;
69
+ (event: "sub-menu-click", key: string, openKeys: string[]): void;
70
+ };
71
+ ProMenuItem: DefineComponent<{
72
+ item: {
73
+ type: null;
74
+ required: true;
75
+ };
76
+ }, {
77
+ router: Router;
78
+ onMenuItemClick: (item: IProMenuItem) => void;
79
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
80
+ item: {
81
+ type: null;
82
+ required: true;
83
+ };
84
+ }>>, {}>;
85
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("collapse" | "menu-item-click" | "sub-menu-click")[], string, {}, {}, string> & {
86
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
87
+ created?: ((() => void) | (() => void)[]) | undefined;
88
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
89
+ mounted?: ((() => void) | (() => void)[]) | undefined;
90
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
91
+ updated?: ((() => void) | (() => void)[]) | undefined;
92
+ activated?: ((() => void) | (() => void)[]) | undefined;
93
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
94
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
95
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
96
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
97
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
98
+ renderTracked?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
99
+ renderTriggered?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
100
+ 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;
101
+ };
102
+ $forceUpdate: () => void;
103
+ $nextTick: typeof nextTick;
104
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: WatchOptions<boolean> | undefined): WatchStopHandle;
105
+ } & Readonly<ExtractPropTypes<{
106
+ collapsed: {
107
+ type: PropType<boolean>;
108
+ required: true;
109
+ };
110
+ selectedKeys: {
111
+ type: PropType<string[]>;
112
+ required: true;
113
+ };
114
+ openKeys: {
115
+ type: PropType<string[]>;
116
+ required: true;
117
+ };
118
+ items: {
119
+ type: PropType<IProMenuItem[]>;
120
+ required: true;
121
+ };
122
+ }>> & {
123
+ onCollapse?: ((...args: any[]) => any) | undefined;
124
+ "onMenu-item-click"?: ((...args: any[]) => any) | undefined;
125
+ "onSub-menu-click"?: ((...args: any[]) => any) | undefined;
126
+ } & ShallowUnwrapRef<{
127
+ prefixClsName: string;
128
+ emit: {
129
+ (event: "collapse", collapsed: boolean): void;
130
+ (event: "menu-item-click", key: string): void;
131
+ (event: "sub-menu-click", key: string, openKeys: string[]): void;
132
+ };
133
+ ProMenuItem: DefineComponent<{
134
+ item: {
135
+ type: null;
136
+ required: true;
137
+ };
138
+ }, {
139
+ router: Router;
140
+ onMenuItemClick: (item: IProMenuItem) => void;
141
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
142
+ item: {
143
+ type: null;
144
+ required: true;
145
+ };
146
+ }>>, {}>;
147
+ }> & {} & ComponentCustomProperties & {};
148
+ __isFragment?: undefined;
149
+ __isTeleport?: undefined;
150
+ __isSuspense?: undefined;
151
+ } & ComponentOptionsBase<Readonly<ExtractPropTypes<{
152
+ collapsed: {
153
+ type: PropType<boolean>;
154
+ required: true;
155
+ };
156
+ selectedKeys: {
157
+ type: PropType<string[]>;
158
+ required: true;
159
+ };
160
+ openKeys: {
161
+ type: PropType<string[]>;
162
+ required: true;
163
+ };
164
+ items: {
165
+ type: PropType<IProMenuItem[]>;
166
+ required: true;
167
+ };
168
+ }>> & {
169
+ onCollapse?: ((...args: any[]) => any) | undefined;
170
+ "onMenu-item-click"?: ((...args: any[]) => any) | undefined;
171
+ "onSub-menu-click"?: ((...args: any[]) => any) | undefined;
172
+ }, {
173
+ prefixClsName: string;
174
+ emit: {
175
+ (event: "collapse", collapsed: boolean): void;
176
+ (event: "menu-item-click", key: string): void;
177
+ (event: "sub-menu-click", key: string, openKeys: string[]): void;
178
+ };
179
+ ProMenuItem: DefineComponent<{
180
+ item: {
181
+ type: null;
182
+ required: true;
183
+ };
184
+ }, {
185
+ router: Router;
186
+ onMenuItemClick: (item: IProMenuItem) => void;
187
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
188
+ item: {
189
+ type: null;
190
+ required: true;
191
+ };
192
+ }>>, {}>;
193
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("collapse" | "menu-item-click" | "sub-menu-click")[], "collapse" | "menu-item-click" | "sub-menu-click", {}, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
194
+ install: (app: App) => void;
195
+ };
196
+ export * from './interface';
197
+ export { ProMenu };
198
+ export default ProMenu;
@@ -0,0 +1,12 @@
1
+ import _sfc_main from "./pro-menu.vue.js";
2
+ import { Menu } from "@arco-design/web-vue";
3
+ const ProMenu = Object.assign(_sfc_main, {
4
+ install: (app) => {
5
+ app.use(Menu);
6
+ app.component("KbProMenu", _sfc_main);
7
+ }
8
+ });
9
+ export {
10
+ ProMenu,
11
+ ProMenu as default
12
+ };
@@ -0,0 +1,30 @@
1
+ import type { RenderFunction, VNode } from 'vue';
2
+ export interface IProMenuItem {
3
+ /** 英文名称(唯一标识,不能重复) */
4
+ name: string;
5
+ /** 路径 */
6
+ path: string;
7
+ /** 中文名称 */
8
+ title: string;
9
+ /**
10
+ * 图标
11
+ * string: 'icon-apps'
12
+ * VNode:v(IconApps)
13
+ * RenderFunction:() => v(IconApps)
14
+ * */
15
+ icon?: string | VNode | RenderFunction;
16
+ /** 如果设置为 true,右侧菜单不显示 */
17
+ hideInMenu?: boolean;
18
+ /** 如果设置为 true,右侧菜单不显示下面子菜单 */
19
+ hideChildrenInMenu?: boolean;
20
+ /** 如果设置为 true,则不会出现在多页签中,并且不会页面缓存 */
21
+ noAffix?: boolean;
22
+ /** 面包屑 */
23
+ breadcrumbs?: string[];
24
+ /** 是否隐藏pageWrapper */
25
+ hidePageWrapper?: boolean;
26
+ /** 如果设置为 true,页面将不会被缓存 */
27
+ ignoreCache?: boolean;
28
+ /** 子元素 */
29
+ children?: IProMenuItem[];
30
+ }
@@ -0,0 +1,18 @@
1
+ import type { Router } from 'vue-router';
2
+ import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue';
3
+ import type { IProMenuItem } from './interface';
4
+ declare const _sfc_main: DefineComponent<{
5
+ item: {
6
+ type: null;
7
+ required: true;
8
+ };
9
+ }, {
10
+ router: Router;
11
+ onMenuItemClick: (item: IProMenuItem) => void;
12
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
13
+ item: {
14
+ type: null;
15
+ required: true;
16
+ };
17
+ }>>, {}>;
18
+ export default _sfc_main;
@@ -0,0 +1,75 @@
1
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, createBlock, createSlots, withCtx, createTextVNode, toDisplayString, renderList, createCommentVNode, resolveDynamicComponent } from "vue";
2
+ import { useRouter } from "vue-router";
3
+ const __default__ = {
4
+ name: "KbProMenuItem"
5
+ };
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ ...__default__,
8
+ props: {
9
+ item: null
10
+ },
11
+ setup(__props) {
12
+ const router = useRouter();
13
+ const onMenuItemClick = (item) => {
14
+ if (!(item == null ? void 0 : item.path)) {
15
+ return;
16
+ }
17
+ router.push({ path: item.path });
18
+ };
19
+ return (_ctx, _cache) => {
20
+ var _a, _b, _c, _d, _e, _f, _g, _h;
21
+ const _component_kb_pro_menu_item = resolveComponent("kb-pro-menu-item");
22
+ const _component_a_sub_menu = resolveComponent("a-sub-menu");
23
+ const _component_a_menu_item = resolveComponent("a-menu-item");
24
+ return __props.item && !__props.item.hideInMenu ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
25
+ ((_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, {
26
+ key: __props.item.name
27
+ }, createSlots({
28
+ title: withCtx(() => [
29
+ createTextVNode(toDisplayString(__props.item.title), 1)
30
+ ]),
31
+ default: withCtx(() => {
32
+ var _a2, _b2;
33
+ return [
34
+ !((_a2 = __props.item) == null ? void 0 : _a2.hideChildrenInMenu) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList((_b2 = __props.item) == null ? void 0 : _b2.children, (childItem) => {
35
+ return openBlock(), createBlock(_component_kb_pro_menu_item, {
36
+ key: childItem.name,
37
+ item: childItem
38
+ }, null, 8, ["item"]);
39
+ }), 128)) : createCommentVNode("", true)
40
+ ];
41
+ }),
42
+ _: 2
43
+ }, [
44
+ ((_d = __props.item) == null ? void 0 : _d.icon) ? {
45
+ name: "icon",
46
+ fn: withCtx(() => [
47
+ (openBlock(), createBlock(resolveDynamicComponent(__props.item.icon)))
48
+ ]),
49
+ key: "0"
50
+ } : void 0
51
+ ]), 1024)) : createCommentVNode("", true),
52
+ !((_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, {
53
+ key: __props.item.name,
54
+ onClick: _cache[0] || (_cache[0] = ($event) => onMenuItemClick(__props.item))
55
+ }, createSlots({
56
+ default: withCtx(() => [
57
+ createTextVNode(" " + toDisplayString(__props.item.title), 1)
58
+ ]),
59
+ _: 2
60
+ }, [
61
+ ((_h = __props.item) == null ? void 0 : _h.icon) ? {
62
+ name: "icon",
63
+ fn: withCtx(() => [
64
+ (openBlock(), createBlock(resolveDynamicComponent(__props.item.icon)))
65
+ ]),
66
+ key: "0"
67
+ } : void 0
68
+ ]), 1024)) : createCommentVNode("", true)
69
+ ], 64)) : createCommentVNode("", true);
70
+ };
71
+ }
72
+ });
73
+ export {
74
+ _sfc_main as default
75
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./pro-menu-item.vue.js";
2
+ import { default as default2 } from "./pro-menu-item.vue.js";
3
+ export {
4
+ default2 as default
5
+ };
@@ -0,0 +1,64 @@
1
+ import type { Router } from 'vue-router';
2
+ import type { IProMenuItem } from './interface';
3
+ import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, type PropType } from 'vue';
4
+ declare const _sfc_main: DefineComponent<{
5
+ collapsed: {
6
+ type: PropType<boolean>;
7
+ required: true;
8
+ };
9
+ selectedKeys: {
10
+ type: PropType<string[]>;
11
+ required: true;
12
+ };
13
+ openKeys: {
14
+ type: PropType<string[]>;
15
+ required: true;
16
+ };
17
+ items: {
18
+ type: PropType<IProMenuItem[]>;
19
+ required: true;
20
+ };
21
+ }, {
22
+ prefixClsName: string;
23
+ emit: {
24
+ (event: 'collapse', collapsed: boolean): void;
25
+ (event: 'menu-item-click', key: string): void;
26
+ (event: 'sub-menu-click', key: string, openKeys: string[]): void;
27
+ };
28
+ ProMenuItem: DefineComponent<{
29
+ item: {
30
+ type: null;
31
+ required: true;
32
+ };
33
+ }, {
34
+ router: Router;
35
+ onMenuItemClick: (item: IProMenuItem) => void;
36
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
37
+ item: {
38
+ type: null;
39
+ required: true;
40
+ };
41
+ }>>, {}>;
42
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("collapse" | "menu-item-click" | "sub-menu-click")[], "collapse" | "menu-item-click" | "sub-menu-click", VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
43
+ collapsed: {
44
+ type: PropType<boolean>;
45
+ required: true;
46
+ };
47
+ selectedKeys: {
48
+ type: PropType<string[]>;
49
+ required: true;
50
+ };
51
+ openKeys: {
52
+ type: PropType<string[]>;
53
+ required: true;
54
+ };
55
+ items: {
56
+ type: PropType<IProMenuItem[]>;
57
+ required: true;
58
+ };
59
+ }>> & {
60
+ onCollapse?: ((...args: any[]) => any) | undefined;
61
+ "onMenu-item-click"?: ((...args: any[]) => any) | undefined;
62
+ "onSub-menu-click"?: ((...args: any[]) => any) | undefined;
63
+ }, {}>;
64
+ export default _sfc_main;
@@ -0,0 +1,55 @@
1
+ import { defineComponent, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementBlock, Fragment, renderList } from "vue";
2
+ import _sfc_main$1 from "./pro-menu-item.vue.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "pro-menu",
5
+ props: {
6
+ collapsed: {
7
+ type: Boolean,
8
+ required: true
9
+ },
10
+ selectedKeys: {
11
+ type: Array,
12
+ required: true
13
+ },
14
+ openKeys: {
15
+ type: Array,
16
+ required: true
17
+ },
18
+ items: {
19
+ type: Array,
20
+ required: true
21
+ }
22
+ },
23
+ emits: ["collapse", "menu-item-click", "sub-menu-click"],
24
+ setup(__props, { emit }) {
25
+ const prefixClsName = "keyblade-pro-menu";
26
+ return (_ctx, _cache) => {
27
+ const _component_a_menu = resolveComponent("a-menu");
28
+ return openBlock(), createBlock(_component_a_menu, {
29
+ class: normalizeClass(prefixClsName),
30
+ style: { width: "100%", height: "100%" },
31
+ collapsed: __props.collapsed,
32
+ "open-keys": __props.openKeys,
33
+ "selected-keys": __props.selectedKeys,
34
+ "show-collapse-button": "",
35
+ breakpoint: "md",
36
+ onCollapse: _cache[0] || (_cache[0] = ($event) => emit("collapse", $event)),
37
+ onMenuItemClick: _cache[1] || (_cache[1] = ($event) => emit("menu-item-click", $event)),
38
+ onSubMenuClick: _cache[2] || (_cache[2] = (_key, _openKeys) => emit("sub-menu-click", _key, _openKeys))
39
+ }, {
40
+ default: withCtx(() => [
41
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
42
+ return openBlock(), createBlock(_sfc_main$1, {
43
+ key: item.name,
44
+ item
45
+ }, null, 8, ["item"]);
46
+ }), 128))
47
+ ]),
48
+ _: 1
49
+ }, 8, ["collapsed", "open-keys", "selected-keys"]);
50
+ };
51
+ }
52
+ });
53
+ export {
54
+ _sfc_main as default
55
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./pro-menu.vue.js";
2
+ import { default as default2 } from "./pro-menu.vue.js";
3
+ export {
4
+ default2 as default
5
+ };
@@ -0,0 +1,122 @@
1
+ import type { IProTab } from './interface';
2
+ import type { ComponentInternalInstance, ExtractPropTypes, PropType, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComputedRef, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, App } from 'vue';
3
+ declare const ProReuseTabs: {
4
+ new (...args: any[]): {
5
+ $: ComponentInternalInstance;
6
+ $data: {};
7
+ $props: Partial<{
8
+ tabs: IProTab[];
9
+ }> & Omit<Readonly<ExtractPropTypes<{
10
+ tabs: {
11
+ type: PropType<IProTab[]>;
12
+ required: true;
13
+ default: () => never[];
14
+ };
15
+ }>> & {
16
+ "onTab-click"?: ((...args: any[]) => any) | undefined;
17
+ "onTab-delete"?: ((...args: any[]) => any) | undefined;
18
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "tabs">;
19
+ $attrs: {
20
+ [x: string]: unknown;
21
+ };
22
+ $refs: {
23
+ [x: string]: unknown;
24
+ };
25
+ $slots: Readonly<{
26
+ [name: string]: Slot | undefined;
27
+ }>;
28
+ $root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
29
+ $parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
30
+ $emit: (event: "tab-click" | "tab-delete", ...args: any[]) => void;
31
+ $el: any;
32
+ $options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
33
+ tabs: {
34
+ type: PropType<IProTab[]>;
35
+ required: true;
36
+ default: () => never[];
37
+ };
38
+ }>> & {
39
+ "onTab-click"?: ((...args: any[]) => any) | undefined;
40
+ "onTab-delete"?: ((...args: any[]) => any) | undefined;
41
+ }, {
42
+ prefixClsName: string;
43
+ props: any;
44
+ emit: {
45
+ (event: "tab-click", key: string): void;
46
+ (event: "tab-delete", key: string): void;
47
+ };
48
+ activeKey: ComputedRef<string | undefined>;
49
+ onTabClick: (key: string | number) => void;
50
+ onTabDelete: (key: string | number) => void;
51
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("tab-click" | "tab-delete")[], string, {
52
+ tabs: IProTab[];
53
+ }, {}, string> & {
54
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
55
+ created?: ((() => void) | (() => void)[]) | undefined;
56
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
57
+ mounted?: ((() => void) | (() => void)[]) | undefined;
58
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
59
+ updated?: ((() => void) | (() => void)[]) | undefined;
60
+ activated?: ((() => void) | (() => void)[]) | undefined;
61
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
62
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
63
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
64
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
65
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
66
+ renderTracked?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
67
+ 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;
69
+ };
70
+ $forceUpdate: () => void;
71
+ $nextTick: typeof nextTick;
72
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: WatchOptions<boolean> | undefined): WatchStopHandle;
73
+ } & Readonly<ExtractPropTypes<{
74
+ tabs: {
75
+ type: PropType<IProTab[]>;
76
+ required: true;
77
+ default: () => never[];
78
+ };
79
+ }>> & {
80
+ "onTab-click"?: ((...args: any[]) => any) | undefined;
81
+ "onTab-delete"?: ((...args: any[]) => any) | undefined;
82
+ } & ShallowUnwrapRef<{
83
+ prefixClsName: string;
84
+ props: any;
85
+ emit: {
86
+ (event: "tab-click", key: string): void;
87
+ (event: "tab-delete", key: string): void;
88
+ };
89
+ activeKey: ComputedRef<string | undefined>;
90
+ onTabClick: (key: string | number) => void;
91
+ onTabDelete: (key: string | number) => void;
92
+ }> & {} & ComponentCustomProperties & {};
93
+ __isFragment?: undefined;
94
+ __isTeleport?: undefined;
95
+ __isSuspense?: undefined;
96
+ } & ComponentOptionsBase<Readonly<ExtractPropTypes<{
97
+ tabs: {
98
+ type: PropType<IProTab[]>;
99
+ required: true;
100
+ default: () => never[];
101
+ };
102
+ }>> & {
103
+ "onTab-click"?: ((...args: any[]) => any) | undefined;
104
+ "onTab-delete"?: ((...args: any[]) => any) | undefined;
105
+ }, {
106
+ prefixClsName: string;
107
+ props: any;
108
+ emit: {
109
+ (event: "tab-click", key: string): void;
110
+ (event: "tab-delete", key: string): void;
111
+ };
112
+ activeKey: ComputedRef<string | undefined>;
113
+ onTabClick: (key: string | number) => void;
114
+ onTabDelete: (key: string | number) => void;
115
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("tab-click" | "tab-delete")[], "tab-click" | "tab-delete", {
116
+ tabs: IProTab[];
117
+ }, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
118
+ install: (app: App) => void;
119
+ };
120
+ export * from './interface';
121
+ export { ProReuseTabs };
122
+ export default ProReuseTabs;
@@ -0,0 +1,12 @@
1
+ import _ProReuseTabs from "./pro-reuse-tabs.vue.js";
2
+ import { Tabs } from "@arco-design/web-vue";
3
+ const ProReuseTabs = Object.assign(_ProReuseTabs, {
4
+ install: (app) => {
5
+ app.use(Tabs);
6
+ app.component("KbProReuseTabs", _ProReuseTabs);
7
+ }
8
+ });
9
+ export {
10
+ ProReuseTabs,
11
+ ProReuseTabs as default
12
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * tab
3
+ */
4
+ export interface IProTab {
5
+ /** 菜单名称 */
6
+ name: string;
7
+ /** 菜单标题 */
8
+ title: string;
9
+ /** 完整路径 */
10
+ fullPath: string;
11
+ /** 是否激活 */
12
+ active: boolean;
13
+ }
@@ -0,0 +1,31 @@
1
+ import type { DefineComponent, ComputedRef, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, type PropType } from 'vue';
2
+ import { IProTab } from './interface';
3
+ declare const _sfc_main: DefineComponent<{
4
+ tabs: {
5
+ type: PropType<IProTab[]>;
6
+ required: true;
7
+ default: () => never[];
8
+ };
9
+ }, {
10
+ prefixClsName: string;
11
+ props: any;
12
+ emit: {
13
+ (event: 'tab-click', key: string): void;
14
+ (event: 'tab-delete', key: string): void;
15
+ };
16
+ activeKey: ComputedRef<string | undefined>;
17
+ onTabClick: (key: string | number) => void;
18
+ onTabDelete: (key: string | number) => void;
19
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("tab-click" | "tab-delete")[], "tab-click" | "tab-delete", VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
20
+ tabs: {
21
+ type: PropType<IProTab[]>;
22
+ required: true;
23
+ default: () => never[];
24
+ };
25
+ }>> & {
26
+ "onTab-click"?: ((...args: any[]) => any) | undefined;
27
+ "onTab-delete"?: ((...args: any[]) => any) | undefined;
28
+ }, {
29
+ tabs: IProTab[];
30
+ }>;
31
+ export default _sfc_main;
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./pro-reuse-tabs.vue2.js";
2
+ import "./pro-reuse-tabs.vue3.js";
3
+ import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
4
+ const _ProReuseTabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-65af5f68"]]);
5
+ export {
6
+ _ProReuseTabs as default
7
+ };
@@ -0,0 +1,57 @@
1
+ import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, unref, withCtx, Fragment, renderList, createBlock } from "vue";
2
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3
+ __name: "pro-reuse-tabs",
4
+ props: {
5
+ tabs: {
6
+ type: Array,
7
+ required: true,
8
+ default: () => []
9
+ }
10
+ },
11
+ emits: ["tab-click", "tab-delete"],
12
+ setup(__props, { emit }) {
13
+ const props = __props;
14
+ const prefixClsName = "keyblade-pro-reuse-tabs";
15
+ const activeKey = computed(() => {
16
+ var _a;
17
+ return ((_a = props.tabs.find((v) => v.active)) == null ? void 0 : _a.name) ?? void 0;
18
+ });
19
+ const onTabClick = (key) => {
20
+ emit("tab-click", String(key));
21
+ };
22
+ const onTabDelete = (key) => {
23
+ emit("tab-delete", String(key));
24
+ };
25
+ return (_ctx, _cache) => {
26
+ const _component_a_tab_pane = resolveComponent("a-tab-pane");
27
+ const _component_a_tabs = resolveComponent("a-tabs");
28
+ return openBlock(), createElementBlock("div", {
29
+ class: normalizeClass(prefixClsName)
30
+ }, [
31
+ createVNode(_component_a_tabs, {
32
+ "active-key": unref(activeKey),
33
+ size: "mini",
34
+ type: "rounded",
35
+ editable: __props.tabs.length > 1,
36
+ "hide-content": "",
37
+ "destroy-on-hide": "",
38
+ onTabClick,
39
+ onDelete: onTabDelete
40
+ }, {
41
+ default: withCtx(() => [
42
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.tabs, (tab) => {
43
+ return openBlock(), createBlock(_component_a_tab_pane, {
44
+ key: tab.name,
45
+ title: tab.title
46
+ }, null, 8, ["title"]);
47
+ }), 128))
48
+ ]),
49
+ _: 1
50
+ }, 8, ["active-key", "editable"])
51
+ ]);
52
+ };
53
+ }
54
+ });
55
+ export {
56
+ _sfc_main as default
57
+ };
@@ -0,0 +1,4 @@
1
+ const proReuseTabs_vue_vue_type_style_index_0_scoped_65af5f68_lang = "";
2
+ export {
3
+ proReuseTabs_vue_vue_type_style_index_0_scoped_65af5f68_lang as default
4
+ };
package/es/style.css ADDED
@@ -0,0 +1,5 @@
1
+ .keyblade-pro-reuse-tabs[data-v-65af5f68] {
2
+ position: relative;
3
+ background-color: var(--color-bg-2);
4
+ padding: 4px 20px;
5
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@keyblade/pro-components",
3
3
  "description": "KeyBlade Pro Components",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "0.0.1-alpha.2",
5
+ "version": "0.0.1-alpha.3",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",
@@ -19,7 +19,8 @@
19
19
  "*.css"
20
20
  ],
21
21
  "dependencies": {
22
- "@arco-design/web-vue": "^2.40.0"
22
+ "@arco-design/web-vue": "^2.40.0",
23
+ "vue-router": "^4.1.6"
23
24
  },
24
25
  "peerDependencies": {
25
26
  "vue": "^3.2.45"
package/src/index.ts CHANGED
@@ -1,14 +1,24 @@
1
1
  import { App } from 'vue'
2
- import { default as ProBreadcrumb } from './pro-breadcrumb'
2
+ import { ProBreadcrumb } from './pro-breadcrumb'
3
+ import { ProMenu } from './pro-menu'
4
+ import { ProReuseTabs } from './pro-reuse-tabs'
3
5
 
4
6
  export default {
5
7
  install(app: App): void {
6
8
  app.use(ProBreadcrumb)
9
+ app.use(ProMenu)
10
+ app.use(ProReuseTabs)
7
11
  }
8
12
  }
9
13
 
10
14
  // 按组件导出
11
- export { ProBreadcrumb }
15
+ export { default as ProBreadcrumb } from './pro-breadcrumb'
16
+
17
+ export { default as ProMenu } from './pro-menu'
18
+ export type { IProMenuItem } from './pro-menu'
19
+
20
+ export { default as ProReuseTabs } from './pro-reuse-tabs'
21
+ export type { IProTab } from './pro-reuse-tabs'
12
22
 
13
23
  // components.d.ts
14
24
  export type {} from './components'