@keyblade/pro-components 1.10.2 → 1.11.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.
- package/es/components.d.ts +11 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +26 -0
- package/es/pro-keep-alive-router-view/index.d.ts +152 -0
- package/es/pro-keep-alive-router-view/index.js +10 -0
- package/es/pro-keep-alive-router-view/pro-keep-alive-router-view.vue.d.ts +45 -0
- package/es/pro-keep-alive-router-view/pro-keep-alive-router-view.vue.js +56 -0
- package/es/pro-keep-alive-router-view/pro-keep-alive-router-view.vue2.js +4 -0
- package/es/pro-layout/hooks.d.ts +25 -0
- package/es/pro-layout/hooks.js +106 -0
- package/es/pro-layout/index.d.ts +393 -0
- package/es/pro-layout/index.js +16 -0
- package/es/pro-layout/pro-layout.vue.d.ts +227 -0
- package/es/pro-layout/pro-layout.vue.js +303 -0
- package/es/pro-layout/pro-layout.vue2.js +1 -0
- package/es/pro-layout/pro-layout.vue3.js +5 -0
- package/es/pro-menu/index.d.ts +167 -0
- package/es/pro-menu/index.js +12 -0
- package/es/pro-menu/interface.d.ts +39 -0
- package/es/pro-menu/pro-menu.vue.d.ts +46 -0
- package/es/pro-menu/pro-menu.vue.js +127 -0
- package/es/pro-menu/pro-menu.vue2.js +1 -0
- package/es/pro-menu/pro-menu.vue3.js +5 -0
- package/es/pro-page-container/index.d.ts +228 -0
- package/es/pro-page-container/index.js +12 -0
- package/es/pro-page-container/pro-page-container.vue.d.ts +88 -0
- package/es/pro-page-container/pro-page-container.vue.js +54 -0
- package/es/pro-page-container/pro-page-container.vue2.js +1 -0
- package/es/pro-page-container/pro-page-container.vue3.js +5 -0
- package/es/pro-page-header/index.d.ts +242 -0
- package/es/pro-page-header/index.js +13 -0
- package/es/pro-page-header/pro-page-header.vue.d.ts +106 -0
- package/es/pro-page-header/pro-page-header.vue.js +144 -0
- package/es/pro-page-header/pro-page-header.vue2.js +1 -0
- package/es/pro-page-header/pro-page-header.vue3.js +5 -0
- package/es/pro-reuse-tabs/index.d.ts +188 -0
- package/es/pro-reuse-tabs/index.js +12 -0
- package/es/pro-reuse-tabs/interface.d.ts +15 -0
- package/es/pro-reuse-tabs/pro-reuse-tabs.vue.d.ts +59 -0
- package/es/pro-reuse-tabs/pro-reuse-tabs.vue.js +70 -0
- package/es/pro-reuse-tabs/pro-reuse-tabs.vue2.js +1 -0
- package/es/pro-reuse-tabs/pro-reuse-tabs.vue3.js +5 -0
- package/es/style.css +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module 'vue' {
|
|
2
|
+
interface GlobalComponents {
|
|
3
|
+
KbProPageHeader: typeof import('./index')['ProPageHeader'];
|
|
4
|
+
KbProKeepAliveRouterView: typeof import('./index')['ProKeepAliveRouterView'];
|
|
5
|
+
KbProLayout: typeof import('./index')['ProLayout'];
|
|
6
|
+
KbProMenu: typeof import('./index')['ProMenu'];
|
|
7
|
+
KbProPageContainer: typeof import('./index')['ProPageContainer'];
|
|
8
|
+
KbProReuseTabs: typeof import('./index')['ProReuseTabs'];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {};
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
install(app: App): void;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
export { default as ProPageHeader } from './pro-page-header';
|
|
7
|
+
export { default as ProKeepAliveRouterView } from './pro-keep-alive-router-view';
|
|
8
|
+
export { default as ProLayout } from './pro-layout';
|
|
9
|
+
export { default as ProMenu } from './pro-menu';
|
|
10
|
+
export type { IProMenuItem } from './pro-menu';
|
|
11
|
+
export { default as ProPageContainer } from './pro-page-container';
|
|
12
|
+
export { default as ProReuseTabs } from './pro-reuse-tabs';
|
|
13
|
+
export type { IProTab } from './pro-reuse-tabs';
|
|
14
|
+
export type {} from './components';
|
package/es/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProPageHeader as o } from "./pro-page-header/index.js";
|
|
2
|
+
import { default as g } from "./pro-page-header/index.js";
|
|
3
|
+
import { ProKeepAliveRouterView as r } from "./pro-keep-alive-router-view/index.js";
|
|
4
|
+
import { default as b } from "./pro-keep-alive-router-view/index.js";
|
|
5
|
+
import { ProLayout as t } from "./pro-layout/index.js";
|
|
6
|
+
import { default as w } from "./pro-layout/index.js";
|
|
7
|
+
import { ProMenu as a } from "./pro-menu/index.js";
|
|
8
|
+
import { default as A } from "./pro-menu/index.js";
|
|
9
|
+
import { ProPageContainer as u } from "./pro-page-container/index.js";
|
|
10
|
+
import { default as H } from "./pro-page-container/index.js";
|
|
11
|
+
import { ProReuseTabs as f } from "./pro-reuse-tabs/index.js";
|
|
12
|
+
import { default as L } from "./pro-reuse-tabs/index.js";
|
|
13
|
+
const n = {
|
|
14
|
+
install(e) {
|
|
15
|
+
e.use(o), e.use(r), e.use(t), e.use(a), e.use(u), e.use(f);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
b as ProKeepAliveRouterView,
|
|
20
|
+
w as ProLayout,
|
|
21
|
+
A as ProMenu,
|
|
22
|
+
H as ProPageContainer,
|
|
23
|
+
g as ProPageHeader,
|
|
24
|
+
L as ProReuseTabs,
|
|
25
|
+
n as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
declare const ProKeepAliveRouterView: {
|
|
3
|
+
new (...args: any[]): {
|
|
4
|
+
$: import("vue").ComponentInternalInstance;
|
|
5
|
+
$data: {};
|
|
6
|
+
$props: {
|
|
7
|
+
keepAliveInclude?: string[] | undefined;
|
|
8
|
+
keepAliveExclude?: string[] | undefined;
|
|
9
|
+
keepAliveMax?: number | undefined;
|
|
10
|
+
key?: string | number | symbol | undefined;
|
|
11
|
+
ref?: import("vue").VNodeRef | undefined;
|
|
12
|
+
ref_for?: boolean | undefined;
|
|
13
|
+
ref_key?: string | undefined;
|
|
14
|
+
onVnodeBeforeMount?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}>) => void)[] | undefined;
|
|
19
|
+
onVnodeMounted?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>) => void)[] | undefined;
|
|
24
|
+
onVnodeBeforeUpdate?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}>) => void)[] | undefined;
|
|
33
|
+
onVnodeUpdated?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}>) => void)[] | undefined;
|
|
42
|
+
onVnodeBeforeUnmount?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}>) => void)[] | undefined;
|
|
47
|
+
onVnodeUnmounted?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}>) => void)[] | undefined;
|
|
52
|
+
class?: unknown;
|
|
53
|
+
style?: unknown;
|
|
54
|
+
};
|
|
55
|
+
$attrs: {
|
|
56
|
+
[x: string]: unknown;
|
|
57
|
+
};
|
|
58
|
+
$refs: {
|
|
59
|
+
[x: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
$slots: Readonly<{
|
|
62
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
63
|
+
}>;
|
|
64
|
+
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
65
|
+
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
66
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
67
|
+
$el: any;
|
|
68
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
69
|
+
keepAliveInclude: {
|
|
70
|
+
type: import("vue").PropType<string[]>;
|
|
71
|
+
required: false;
|
|
72
|
+
default: () => never[];
|
|
73
|
+
};
|
|
74
|
+
keepAliveExclude: {
|
|
75
|
+
type: import("vue").PropType<string[]>;
|
|
76
|
+
required: false;
|
|
77
|
+
default: () => never[];
|
|
78
|
+
};
|
|
79
|
+
keepAliveMax: {
|
|
80
|
+
type: import("vue").PropType<number>;
|
|
81
|
+
required: false;
|
|
82
|
+
default: number;
|
|
83
|
+
};
|
|
84
|
+
}>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
85
|
+
keepAliveInclude: string[];
|
|
86
|
+
keepAliveExclude: string[];
|
|
87
|
+
keepAliveMax: number;
|
|
88
|
+
}, {}, string, {}> & {
|
|
89
|
+
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
90
|
+
created?: ((() => void) | (() => void)[]) | undefined;
|
|
91
|
+
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
92
|
+
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
93
|
+
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
94
|
+
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
95
|
+
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
96
|
+
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
97
|
+
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
98
|
+
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
99
|
+
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
100
|
+
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
101
|
+
renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
102
|
+
renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
103
|
+
errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void)[]) | undefined;
|
|
104
|
+
};
|
|
105
|
+
$forceUpdate: () => void;
|
|
106
|
+
$nextTick: typeof import("vue").nextTick;
|
|
107
|
+
$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?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
108
|
+
} & Readonly<import("vue").ExtractPropTypes<{
|
|
109
|
+
keepAliveInclude: {
|
|
110
|
+
type: import("vue").PropType<string[]>;
|
|
111
|
+
required: false;
|
|
112
|
+
default: () => never[];
|
|
113
|
+
};
|
|
114
|
+
keepAliveExclude: {
|
|
115
|
+
type: import("vue").PropType<string[]>;
|
|
116
|
+
required: false;
|
|
117
|
+
default: () => never[];
|
|
118
|
+
};
|
|
119
|
+
keepAliveMax: {
|
|
120
|
+
type: import("vue").PropType<number>;
|
|
121
|
+
required: false;
|
|
122
|
+
default: number;
|
|
123
|
+
};
|
|
124
|
+
}>> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {};
|
|
125
|
+
__isFragment?: undefined;
|
|
126
|
+
__isTeleport?: undefined;
|
|
127
|
+
__isSuspense?: undefined;
|
|
128
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
129
|
+
keepAliveInclude: {
|
|
130
|
+
type: import("vue").PropType<string[]>;
|
|
131
|
+
required: false;
|
|
132
|
+
default: () => never[];
|
|
133
|
+
};
|
|
134
|
+
keepAliveExclude: {
|
|
135
|
+
type: import("vue").PropType<string[]>;
|
|
136
|
+
required: false;
|
|
137
|
+
default: () => never[];
|
|
138
|
+
};
|
|
139
|
+
keepAliveMax: {
|
|
140
|
+
type: import("vue").PropType<number>;
|
|
141
|
+
required: false;
|
|
142
|
+
default: number;
|
|
143
|
+
};
|
|
144
|
+
}>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
145
|
+
keepAliveInclude: string[];
|
|
146
|
+
keepAliveExclude: string[];
|
|
147
|
+
keepAliveMax: number;
|
|
148
|
+
}, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
149
|
+
install: (app: App) => void;
|
|
150
|
+
};
|
|
151
|
+
export { ProKeepAliveRouterView };
|
|
152
|
+
export default ProKeepAliveRouterView;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
/** 包含 */
|
|
4
|
+
keepAliveInclude: {
|
|
5
|
+
type: PropType<string[]>;
|
|
6
|
+
required: false;
|
|
7
|
+
default: () => never[];
|
|
8
|
+
};
|
|
9
|
+
/** 排除(ProLayout里一般不会用) */
|
|
10
|
+
keepAliveExclude: {
|
|
11
|
+
type: PropType<string[]>;
|
|
12
|
+
required: false;
|
|
13
|
+
default: () => never[];
|
|
14
|
+
};
|
|
15
|
+
/** 最大数(ProLayout里一般不会用) */
|
|
16
|
+
keepAliveMax: {
|
|
17
|
+
type: PropType<number>;
|
|
18
|
+
required: false;
|
|
19
|
+
default: number;
|
|
20
|
+
};
|
|
21
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
/** 包含 */
|
|
23
|
+
keepAliveInclude: {
|
|
24
|
+
type: PropType<string[]>;
|
|
25
|
+
required: false;
|
|
26
|
+
default: () => never[];
|
|
27
|
+
};
|
|
28
|
+
/** 排除(ProLayout里一般不会用) */
|
|
29
|
+
keepAliveExclude: {
|
|
30
|
+
type: PropType<string[]>;
|
|
31
|
+
required: false;
|
|
32
|
+
default: () => never[];
|
|
33
|
+
};
|
|
34
|
+
/** 最大数(ProLayout里一般不会用) */
|
|
35
|
+
keepAliveMax: {
|
|
36
|
+
type: PropType<number>;
|
|
37
|
+
required: false;
|
|
38
|
+
default: number;
|
|
39
|
+
};
|
|
40
|
+
}>>, {
|
|
41
|
+
keepAliveInclude: string[];
|
|
42
|
+
keepAliveExclude: string[];
|
|
43
|
+
keepAliveMax: number;
|
|
44
|
+
}, {}>;
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent as o, inject as s, computed as r, resolveComponent as A, openBlock as i, createBlock as t, withCtx as k, KeepAlive as x, resolveDynamicComponent as y } from "vue";
|
|
2
|
+
const _ = /* @__PURE__ */ o({
|
|
3
|
+
__name: "pro-keep-alive-router-view",
|
|
4
|
+
props: {
|
|
5
|
+
/** 包含 */
|
|
6
|
+
keepAliveInclude: {
|
|
7
|
+
type: Array,
|
|
8
|
+
required: !1,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
/** 排除(ProLayout里一般不会用) */
|
|
12
|
+
keepAliveExclude: {
|
|
13
|
+
type: Array,
|
|
14
|
+
required: !1,
|
|
15
|
+
default: () => []
|
|
16
|
+
},
|
|
17
|
+
/** 最大数(ProLayout里一般不会用) */
|
|
18
|
+
keepAliveMax: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: !1,
|
|
21
|
+
default: 9999
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(d) {
|
|
25
|
+
const l = d, u = (e) => {
|
|
26
|
+
var p, n, c, a;
|
|
27
|
+
if ((p = e == null ? void 0 : e.meta) != null && p.componentKey) {
|
|
28
|
+
if (((c = e == null ? void 0 : e.meta) == null ? void 0 : c.componentKey) === "path")
|
|
29
|
+
return e.path;
|
|
30
|
+
if (((a = e == null ? void 0 : e.meta) == null ? void 0 : a.componentKey) === "fullPath")
|
|
31
|
+
return e.fullPath;
|
|
32
|
+
} else
|
|
33
|
+
return (n = e == null ? void 0 : e.meta) != null && n.ignoreCache ? e.path : e.fullPath;
|
|
34
|
+
}, v = s("ProKeepAliveInclude", []), m = r(() => l.keepAliveInclude instanceof Array && l.keepAliveInclude.length === 0 || !l.keepAliveInclude ? v.value : l.keepAliveInclude || []), f = r(() => l.keepAliveExclude || []);
|
|
35
|
+
return (e, p) => {
|
|
36
|
+
const n = A("router-view");
|
|
37
|
+
return i(), t(n, null, {
|
|
38
|
+
default: k(({ Component: c, route: a }) => [
|
|
39
|
+
(i(), t(x, {
|
|
40
|
+
include: m.value,
|
|
41
|
+
exclude: f.value,
|
|
42
|
+
max: d.keepAliveMax
|
|
43
|
+
}, [
|
|
44
|
+
(i(), t(y(c), {
|
|
45
|
+
key: u(a)
|
|
46
|
+
}))
|
|
47
|
+
], 1032, ["include", "exclude", "max"]))
|
|
48
|
+
]),
|
|
49
|
+
_: 1
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export {
|
|
55
|
+
_ as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { IProMenuItem } from '../pro-menu';
|
|
3
|
+
export declare function useHooks(menuItems: Ref<IProMenuItem[]>, options: {
|
|
4
|
+
hideTabs: boolean;
|
|
5
|
+
disableKeepAlive: boolean;
|
|
6
|
+
}): {
|
|
7
|
+
menuSelectedKeys: Ref<string[]>;
|
|
8
|
+
activeMenuItem: Ref<IProMenuItem | undefined>;
|
|
9
|
+
menuItemMap: Ref<Record<string, IProMenuItem>>;
|
|
10
|
+
breadcrumbItems: Ref<{
|
|
11
|
+
path?: string | undefined;
|
|
12
|
+
label: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
tabs: Ref<{
|
|
15
|
+
name: string;
|
|
16
|
+
parentNames: string[];
|
|
17
|
+
title: string;
|
|
18
|
+
fullPath: string;
|
|
19
|
+
active: boolean;
|
|
20
|
+
}[]>;
|
|
21
|
+
keepAliveInclude: Ref<string[]>;
|
|
22
|
+
onMenuItemClick: (key: string) => void;
|
|
23
|
+
onTabClick: (key: string) => void;
|
|
24
|
+
onTabDelete: (key: string) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ref as i, watch as T } from "vue";
|
|
2
|
+
import { useRoute as S, useRouter as x } from "vue-router";
|
|
3
|
+
function J(h, o) {
|
|
4
|
+
const r = S(), b = x(), m = i([]), P = (t) => {
|
|
5
|
+
m.value = [t];
|
|
6
|
+
}, u = i(), v = i([]), d = i({}), p = i([]), c = i([]), f = i([]), N = () => {
|
|
7
|
+
const t = [], l = (a) => {
|
|
8
|
+
var n;
|
|
9
|
+
for (const e in a) {
|
|
10
|
+
const s = a[e];
|
|
11
|
+
if (s.name === ((n = u == null ? void 0 : u.value) == null ? void 0 : n.name) || s.children && s.children.length > 0 && l(s.children))
|
|
12
|
+
return delete s.children, t.unshift(s), !0;
|
|
13
|
+
}
|
|
14
|
+
return !1;
|
|
15
|
+
};
|
|
16
|
+
l(JSON.parse(JSON.stringify(h.value))), v.value = t;
|
|
17
|
+
}, k = () => {
|
|
18
|
+
var l, a, n;
|
|
19
|
+
const t = (l = v.value) == null ? void 0 : l.map((e) => ({ path: e == null ? void 0 : e.path, label: e == null ? void 0 : e.title }));
|
|
20
|
+
p.value = (a = u.value) != null && a.breadcrumbs ? (n = u.value) == null ? void 0 : n.breadcrumbs : t.length !== 0 ? t : [];
|
|
21
|
+
};
|
|
22
|
+
function y() {
|
|
23
|
+
if (!u.value || u.value.noAffix) {
|
|
24
|
+
c.value.forEach((e) => {
|
|
25
|
+
e.active = !1;
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const { name: t, title: l } = u.value;
|
|
30
|
+
let a = -1;
|
|
31
|
+
c.value.forEach((e, s) => {
|
|
32
|
+
e.active = !1, e.name === t && (a = s);
|
|
33
|
+
});
|
|
34
|
+
const n = {
|
|
35
|
+
name: t,
|
|
36
|
+
parentNames: v.value.map((e) => e.name),
|
|
37
|
+
title: l ?? t,
|
|
38
|
+
fullPath: r.fullPath,
|
|
39
|
+
active: !0
|
|
40
|
+
};
|
|
41
|
+
if (~a) {
|
|
42
|
+
const e = c.value[a];
|
|
43
|
+
e.fullPath === r.fullPath ? (e.active = !0, e.fullPath = r.fullPath) : (c.value.splice(a, 1), setTimeout(() => {
|
|
44
|
+
c.value.push(n);
|
|
45
|
+
}));
|
|
46
|
+
} else
|
|
47
|
+
c.value.push(n);
|
|
48
|
+
}
|
|
49
|
+
const A = (t) => {
|
|
50
|
+
const l = c.value.findIndex((n) => n.name === t), a = c.value[l];
|
|
51
|
+
b.push(a.fullPath);
|
|
52
|
+
}, E = (t) => {
|
|
53
|
+
let l = -1, a = -1;
|
|
54
|
+
if (c.value.forEach((e, s) => {
|
|
55
|
+
e.name === t && (a = s), e.active && (l = s);
|
|
56
|
+
}), l === a) {
|
|
57
|
+
let e;
|
|
58
|
+
a === 0 ? e = c.value[a + 1] : e = c.value[a - 1], e.active = !0, b.push(e.fullPath);
|
|
59
|
+
}
|
|
60
|
+
const n = c.value.splice(a, 1);
|
|
61
|
+
I(n[0]);
|
|
62
|
+
}, g = () => {
|
|
63
|
+
var l;
|
|
64
|
+
if (o != null && o.disableKeepAlive || (l = r == null ? void 0 : r.meta) != null && l.ignoreCache)
|
|
65
|
+
return;
|
|
66
|
+
const t = new Set(f.value);
|
|
67
|
+
v.value.forEach((a) => {
|
|
68
|
+
a.name && t.add(a.name);
|
|
69
|
+
}), f.value = Array.from(t.values());
|
|
70
|
+
}, I = (t) => {
|
|
71
|
+
const l = new Set(f.value);
|
|
72
|
+
t.parentNames.forEach((a) => {
|
|
73
|
+
l.delete(a);
|
|
74
|
+
}), c.value.forEach((a) => {
|
|
75
|
+
a.parentNames.forEach((n) => {
|
|
76
|
+
const e = d.value[n];
|
|
77
|
+
e != null && e.ignoreCache || l.add(e.name);
|
|
78
|
+
});
|
|
79
|
+
}), f.value = Array.from(l.values());
|
|
80
|
+
};
|
|
81
|
+
return T(h, () => {
|
|
82
|
+
const t = {}, l = (a) => {
|
|
83
|
+
a.forEach((n) => {
|
|
84
|
+
n.children && n.children.length > 0 && l(n.children), delete n.children, t[n.name] = n;
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
l(JSON.parse(JSON.stringify(h.value))), d.value = t;
|
|
88
|
+
}, { immediate: !0 }), T(() => r == null ? void 0 : r.name, () => {
|
|
89
|
+
var l;
|
|
90
|
+
const t = r == null ? void 0 : r.name;
|
|
91
|
+
u.value = d.value[t], m.value = u != null && u.value ? [u.value.name, ...((l = u.value) == null ? void 0 : l.activatedKeys) || []] : [], N(), k(), o.hideTabs || y(), g();
|
|
92
|
+
}, { immediate: !0 }), {
|
|
93
|
+
menuSelectedKeys: m,
|
|
94
|
+
activeMenuItem: u,
|
|
95
|
+
menuItemMap: d,
|
|
96
|
+
breadcrumbItems: p,
|
|
97
|
+
tabs: c,
|
|
98
|
+
keepAliveInclude: f,
|
|
99
|
+
onMenuItemClick: P,
|
|
100
|
+
onTabClick: A,
|
|
101
|
+
onTabDelete: E
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
J as useHooks
|
|
106
|
+
};
|