@keyblade/pro-components 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/es/components.d.ts +2 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +16 -12
- package/es/pro-breadcrumb/index.js +1 -0
- package/es/pro-breadcrumb/pro-breadcrumb.vue.js +14 -6
- package/es/pro-breadcrumb/pro-breadcrumb.vue2.js +2 -2
- package/es/pro-breadcrumb/pro-breadcrumb.vue3.js +5 -0
- package/es/pro-keep-alive-router-view/index.d.ts +124 -0
- package/es/pro-keep-alive-router-view/index.js +11 -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 +57 -0
- package/es/pro-keep-alive-router-view/pro-keep-alive-router-view.vue2.js +4 -0
- package/es/pro-layout/hooks.d.ts +3 -2
- package/es/pro-layout/hooks.js +38 -8
- package/es/pro-layout/index.d.ts +15 -9
- package/es/pro-layout/index.js +3 -6
- package/es/pro-layout/pro-layout.vue.d.ts +5 -3
- package/es/pro-layout/pro-layout.vue.js +34 -59
- package/es/pro-menu/index.d.ts +1 -13
- package/es/pro-menu/interface.d.ts +5 -9
- package/es/pro-menu/pro-menu-item.vue.js +28 -4
- package/es/pro-menu/pro-menu-item.vue2.js +2 -2
- package/es/pro-menu/pro-menu-item.vue3.js +5 -0
- package/es/pro-menu/pro-menu.vue.d.ts +1 -5
- package/es/pro-menu/pro-menu.vue.js +3 -8
- package/es/{pro-page-wrapper → pro-page-container}/index.d.ts +11 -11
- package/es/pro-page-container/index.js +14 -0
- package/es/{pro-page-wrapper/pro-page-wrapper.vue.d.ts → pro-page-container/pro-page-container.vue.d.ts} +3 -3
- package/es/{pro-page-wrapper/pro-page-wrapper.vue.js → pro-page-container/pro-page-container.vue.js} +6 -8
- package/es/pro-page-container/pro-page-container.vue2.js +4 -0
- package/es/pro-page-container/pro-page-container.vue3.js +5 -0
- package/es/style.css +24 -15
- package/package.json +1 -1
- package/src/index.ts +7 -3
- package/es/pro-page-wrapper/index.js +0 -14
- package/es/pro-page-wrapper/pro-page-wrapper.vue2.js +0 -4
- package/es/pro-page-wrapper/pro-page-wrapper.vue3.js +0 -5
package/es/components.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ declare module 'vue' {
|
|
|
2
2
|
interface GlobalComponents {
|
|
3
3
|
KbProBreadcrumb: typeof import('./index')['ProBreadcrumb'];
|
|
4
4
|
KbProDrawerForm: typeof import('./index')['ProDrawerForm'];
|
|
5
|
+
KbProKeepAliveRouterView: typeof import('./index')['ProKeepAliveRouterView'];
|
|
5
6
|
KbProLayout: typeof import('./index')['ProLayout'];
|
|
6
7
|
KbProMenu: typeof import('./index')['ProMenu'];
|
|
7
8
|
KbProModalForm: typeof import('./index')['ProModalForm'];
|
|
8
|
-
|
|
9
|
+
KbProPageContainer: typeof import('./index')['ProPageContainer'];
|
|
9
10
|
KbProReuseTabs: typeof import('./index')['ProReuseTabs'];
|
|
10
11
|
}
|
|
11
12
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -5,11 +5,12 @@ declare const _default: {
|
|
|
5
5
|
export default _default;
|
|
6
6
|
export { default as ProBreadcrumb } from './pro-breadcrumb';
|
|
7
7
|
export { default as ProDrawerForm } from './pro-drawer-form';
|
|
8
|
+
export { default as ProKeepAliveRouterView } from './pro-keep-alive-router-view';
|
|
8
9
|
export { default as ProLayout } from './pro-layout';
|
|
9
10
|
export { default as ProMenu } from './pro-menu';
|
|
10
11
|
export type { IProMenuItem } from './pro-menu';
|
|
11
12
|
export { default as ProModalForm } from './pro-modal-form';
|
|
12
|
-
export { default as
|
|
13
|
+
export { default as ProPageContainer } from './pro-page-container';
|
|
13
14
|
export { default as ProReuseTabs } from './pro-reuse-tabs';
|
|
14
15
|
export type { IProTab } from './pro-reuse-tabs';
|
|
15
16
|
export type {} from './components';
|
package/es/index.js
CHANGED
|
@@ -2,34 +2,38 @@ import { ProBreadcrumb } from "./pro-breadcrumb/index.js";
|
|
|
2
2
|
import { default as default2 } from "./pro-breadcrumb/index.js";
|
|
3
3
|
import { ProDrawerForm } from "./pro-drawer-form/index.js";
|
|
4
4
|
import { default as default3 } from "./pro-drawer-form/index.js";
|
|
5
|
+
import { ProKeepAliveRouterView } from "./pro-keep-alive-router-view/index.js";
|
|
6
|
+
import { default as default4 } from "./pro-keep-alive-router-view/index.js";
|
|
5
7
|
import { ProLayout } from "./pro-layout/index.js";
|
|
6
|
-
import { default as
|
|
8
|
+
import { default as default5 } from "./pro-layout/index.js";
|
|
7
9
|
import { ProMenu } from "./pro-menu/index.js";
|
|
8
|
-
import { default as
|
|
10
|
+
import { default as default6 } from "./pro-menu/index.js";
|
|
9
11
|
import { ProModalForm } from "./pro-modal-form/index.js";
|
|
10
|
-
import { default as
|
|
11
|
-
import {
|
|
12
|
-
import { default as
|
|
12
|
+
import { default as default7 } from "./pro-modal-form/index.js";
|
|
13
|
+
import { ProPageContainer } from "./pro-page-container/index.js";
|
|
14
|
+
import { default as default8 } from "./pro-page-container/index.js";
|
|
13
15
|
import { ProReuseTabs } from "./pro-reuse-tabs/index.js";
|
|
14
|
-
import { default as
|
|
16
|
+
import { default as default9 } from "./pro-reuse-tabs/index.js";
|
|
15
17
|
const index = {
|
|
16
18
|
install(app) {
|
|
17
19
|
app.use(ProBreadcrumb);
|
|
18
20
|
app.use(ProDrawerForm);
|
|
21
|
+
app.use(ProKeepAliveRouterView);
|
|
19
22
|
app.use(ProLayout);
|
|
20
23
|
app.use(ProMenu);
|
|
21
24
|
app.use(ProModalForm);
|
|
22
|
-
app.use(
|
|
25
|
+
app.use(ProPageContainer);
|
|
23
26
|
app.use(ProReuseTabs);
|
|
24
27
|
}
|
|
25
28
|
};
|
|
26
29
|
export {
|
|
27
30
|
default2 as ProBreadcrumb,
|
|
28
31
|
default3 as ProDrawerForm,
|
|
29
|
-
default4 as
|
|
30
|
-
default5 as
|
|
31
|
-
default6 as
|
|
32
|
-
default7 as
|
|
33
|
-
default8 as
|
|
32
|
+
default4 as ProKeepAliveRouterView,
|
|
33
|
+
default5 as ProLayout,
|
|
34
|
+
default6 as ProMenu,
|
|
35
|
+
default7 as ProModalForm,
|
|
36
|
+
default8 as ProPageContainer,
|
|
37
|
+
default9 as ProReuseTabs,
|
|
34
38
|
index as default
|
|
35
39
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, inject, resolveComponent, unref, openBlock, createBlock, normalizeClass, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
1
|
+
import { defineComponent, inject, computed, resolveComponent, unref, openBlock, createBlock, normalizeClass, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
2
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
3
|
__name: "pro-breadcrumb",
|
|
4
4
|
props: {
|
|
@@ -11,23 +11,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11
11
|
setup(__props) {
|
|
12
12
|
const props = __props;
|
|
13
13
|
const prefixClsName = "keyblade-pro-breadcrumb";
|
|
14
|
-
const
|
|
14
|
+
const proBreadcrumbItems = inject("ProBreadcrumbItems", []);
|
|
15
|
+
const breadcrumbItems = computed(() => {
|
|
16
|
+
if (props.items instanceof Array && props.items.length === 0 || !props.items) {
|
|
17
|
+
return proBreadcrumbItems.value;
|
|
18
|
+
}
|
|
19
|
+
return props.items || [];
|
|
20
|
+
});
|
|
15
21
|
return (_ctx, _cache) => {
|
|
16
22
|
const _component_icon_apps = resolveComponent("icon-apps");
|
|
17
23
|
const _component_a_breadcrumb_item = resolveComponent("a-breadcrumb-item");
|
|
18
24
|
const _component_a_breadcrumb = resolveComponent("a-breadcrumb");
|
|
19
|
-
return
|
|
25
|
+
return unref(breadcrumbItems) ? (openBlock(), createBlock(_component_a_breadcrumb, {
|
|
20
26
|
key: 0,
|
|
21
27
|
class: normalizeClass(prefixClsName)
|
|
22
28
|
}, {
|
|
23
29
|
default: withCtx(() => [
|
|
24
|
-
createVNode(_component_a_breadcrumb_item,
|
|
30
|
+
createVNode(_component_a_breadcrumb_item, {
|
|
31
|
+
class: normalizeClass(`${prefixClsName}-icon-item`)
|
|
32
|
+
}, {
|
|
25
33
|
default: withCtx(() => [
|
|
26
34
|
createVNode(_component_icon_apps)
|
|
27
35
|
]),
|
|
28
36
|
_: 1
|
|
29
|
-
}),
|
|
30
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
37
|
+
}, 8, ["class"]),
|
|
38
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(breadcrumbItems), (item, index) => {
|
|
31
39
|
return openBlock(), createBlock(_component_a_breadcrumb_item, {
|
|
32
40
|
key: `${item}-${index}`
|
|
33
41
|
}, {
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { ComponentInternalInstance, ExtractPropTypes, PropType, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, App } from 'vue';
|
|
2
|
+
declare const ProKeepAliveRouterView: {
|
|
3
|
+
new (...args: any[]): {
|
|
4
|
+
$: ComponentInternalInstance;
|
|
5
|
+
$data: {};
|
|
6
|
+
$props: Partial<{
|
|
7
|
+
keepAliveInclude: string[];
|
|
8
|
+
keepAliveExclude: string[];
|
|
9
|
+
keepAliveMax: number;
|
|
10
|
+
}> & Omit<Readonly<ExtractPropTypes<{
|
|
11
|
+
keepAliveInclude: {
|
|
12
|
+
type: PropType<string[]>;
|
|
13
|
+
required: false;
|
|
14
|
+
default: () => never[];
|
|
15
|
+
};
|
|
16
|
+
keepAliveExclude: {
|
|
17
|
+
type: PropType<string[]>;
|
|
18
|
+
required: false;
|
|
19
|
+
default: () => never[];
|
|
20
|
+
};
|
|
21
|
+
keepAliveMax: {
|
|
22
|
+
type: PropType<number>;
|
|
23
|
+
required: false;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
}>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, "keepAliveInclude" | "keepAliveExclude" | "keepAliveMax">;
|
|
27
|
+
$attrs: {
|
|
28
|
+
[x: string]: unknown;
|
|
29
|
+
};
|
|
30
|
+
$refs: {
|
|
31
|
+
[x: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
$slots: Readonly<{
|
|
34
|
+
[name: string]: Slot | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
$root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
37
|
+
$parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
38
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
39
|
+
$el: any;
|
|
40
|
+
$options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
|
|
41
|
+
keepAliveInclude: {
|
|
42
|
+
type: PropType<string[]>;
|
|
43
|
+
required: false;
|
|
44
|
+
default: () => never[];
|
|
45
|
+
};
|
|
46
|
+
keepAliveExclude: {
|
|
47
|
+
type: PropType<string[]>;
|
|
48
|
+
required: false;
|
|
49
|
+
default: () => never[];
|
|
50
|
+
};
|
|
51
|
+
keepAliveMax: {
|
|
52
|
+
type: PropType<number>;
|
|
53
|
+
required: false;
|
|
54
|
+
default: number;
|
|
55
|
+
};
|
|
56
|
+
}>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
57
|
+
keepAliveInclude: string[];
|
|
58
|
+
keepAliveExclude: string[];
|
|
59
|
+
keepAliveMax: number;
|
|
60
|
+
}, {}, string> & {
|
|
61
|
+
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
62
|
+
created?: ((() => void) | (() => void)[]) | undefined;
|
|
63
|
+
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
64
|
+
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
65
|
+
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
66
|
+
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
67
|
+
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
68
|
+
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
69
|
+
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
70
|
+
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
71
|
+
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
72
|
+
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
73
|
+
renderTracked?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
|
|
74
|
+
renderTriggered?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
|
|
75
|
+
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;
|
|
76
|
+
};
|
|
77
|
+
$forceUpdate: () => void;
|
|
78
|
+
$nextTick: typeof nextTick;
|
|
79
|
+
$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;
|
|
80
|
+
} & Readonly<ExtractPropTypes<{
|
|
81
|
+
keepAliveInclude: {
|
|
82
|
+
type: PropType<string[]>;
|
|
83
|
+
required: false;
|
|
84
|
+
default: () => never[];
|
|
85
|
+
};
|
|
86
|
+
keepAliveExclude: {
|
|
87
|
+
type: PropType<string[]>;
|
|
88
|
+
required: false;
|
|
89
|
+
default: () => never[];
|
|
90
|
+
};
|
|
91
|
+
keepAliveMax: {
|
|
92
|
+
type: PropType<number>;
|
|
93
|
+
required: false;
|
|
94
|
+
default: number;
|
|
95
|
+
};
|
|
96
|
+
}>> & ShallowUnwrapRef<{}> & {} & ComponentCustomProperties & {};
|
|
97
|
+
__isFragment?: undefined;
|
|
98
|
+
__isTeleport?: undefined;
|
|
99
|
+
__isSuspense?: undefined;
|
|
100
|
+
} & ComponentOptionsBase<Readonly<ExtractPropTypes<{
|
|
101
|
+
keepAliveInclude: {
|
|
102
|
+
type: PropType<string[]>;
|
|
103
|
+
required: false;
|
|
104
|
+
default: () => never[];
|
|
105
|
+
};
|
|
106
|
+
keepAliveExclude: {
|
|
107
|
+
type: PropType<string[]>;
|
|
108
|
+
required: false;
|
|
109
|
+
default: () => never[];
|
|
110
|
+
};
|
|
111
|
+
keepAliveMax: {
|
|
112
|
+
type: PropType<number>;
|
|
113
|
+
required: false;
|
|
114
|
+
default: number;
|
|
115
|
+
};
|
|
116
|
+
}>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
117
|
+
keepAliveInclude: string[];
|
|
118
|
+
keepAliveExclude: string[];
|
|
119
|
+
keepAliveMax: number;
|
|
120
|
+
}, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
|
|
121
|
+
install: (app: App) => void;
|
|
122
|
+
};
|
|
123
|
+
export { ProKeepAliveRouterView };
|
|
124
|
+
export default ProKeepAliveRouterView;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _sfc_main from "./pro-keep-alive-router-view.vue.js";
|
|
2
|
+
const ProKeepAliveRouterView = Object.assign(_sfc_main, {
|
|
3
|
+
install: (app) => {
|
|
4
|
+
app.component("KbProKeepAliveRouterView", _sfc_main);
|
|
5
|
+
}
|
|
6
|
+
});
|
|
7
|
+
const ProKeepAliveRouterView$1 = ProKeepAliveRouterView;
|
|
8
|
+
export {
|
|
9
|
+
ProKeepAliveRouterView,
|
|
10
|
+
ProKeepAliveRouterView$1 as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, type PropType } from 'vue';
|
|
2
|
+
declare const _sfc_main: 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, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<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 _sfc_main;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, resolveComponent, openBlock, createBlock, withCtx, KeepAlive, unref, resolveDynamicComponent } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
|
+
__name: "pro-keep-alive-router-view",
|
|
4
|
+
props: {
|
|
5
|
+
/** 包含 */
|
|
6
|
+
keepAliveInclude: {
|
|
7
|
+
type: Array,
|
|
8
|
+
required: false,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
/** 排除(ProLayout里一般不会用) */
|
|
12
|
+
keepAliveExclude: {
|
|
13
|
+
type: Array,
|
|
14
|
+
required: false,
|
|
15
|
+
default: () => []
|
|
16
|
+
},
|
|
17
|
+
/** 最大数(ProLayout里一般不会用) */
|
|
18
|
+
keepAliveMax: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: false,
|
|
21
|
+
default: 9999
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const proKeepAliveInclude = inject("ProKeepAliveInclude", []);
|
|
27
|
+
const include = computed(() => {
|
|
28
|
+
if (props.keepAliveInclude instanceof Array && props.keepAliveInclude.length === 0 || !props.keepAliveInclude) {
|
|
29
|
+
return proKeepAliveInclude.value;
|
|
30
|
+
}
|
|
31
|
+
return props.keepAliveInclude || [];
|
|
32
|
+
});
|
|
33
|
+
const exclude = computed(() => {
|
|
34
|
+
return props.keepAliveExclude || [];
|
|
35
|
+
});
|
|
36
|
+
return (_ctx, _cache) => {
|
|
37
|
+
const _component_router_view = resolveComponent("router-view");
|
|
38
|
+
return openBlock(), createBlock(_component_router_view, null, {
|
|
39
|
+
default: withCtx(({ Component, route }) => [
|
|
40
|
+
(openBlock(), createBlock(KeepAlive, {
|
|
41
|
+
include: unref(include),
|
|
42
|
+
exclude: unref(exclude),
|
|
43
|
+
max: __props.keepAliveMax
|
|
44
|
+
}, [
|
|
45
|
+
(openBlock(), createBlock(resolveDynamicComponent(Component), {
|
|
46
|
+
key: route.fullPath
|
|
47
|
+
}))
|
|
48
|
+
], 1032, ["include", "exclude", "max"]))
|
|
49
|
+
]),
|
|
50
|
+
_: 1
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
_sfc_main as default
|
|
57
|
+
};
|
package/es/pro-layout/hooks.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
2
|
import type { IProMenuItem } from '../pro-menu';
|
|
3
3
|
export declare function useHooks(menuItems: Ref<IProMenuItem[]>, options: {
|
|
4
|
-
|
|
4
|
+
showTabs: boolean;
|
|
5
5
|
}): {
|
|
6
6
|
menuSelectedKeys: Ref<string[]>;
|
|
7
|
-
onMenuItemClick: (key: string) => void;
|
|
8
7
|
activeMenuItem: Ref<IProMenuItem | undefined>;
|
|
9
8
|
menuItemMap: Ref<Record<string, IProMenuItem>>;
|
|
10
9
|
breadcrumbItems: Ref<string[]>;
|
|
@@ -15,6 +14,8 @@ export declare function useHooks(menuItems: Ref<IProMenuItem[]>, options: {
|
|
|
15
14
|
fullPath: string;
|
|
16
15
|
active: boolean;
|
|
17
16
|
}[]>;
|
|
17
|
+
keepAliveInclude: Ref<string[]>;
|
|
18
|
+
onMenuItemClick: (key: string) => void;
|
|
18
19
|
onTabClick: (key: string) => void;
|
|
19
20
|
onTabDelete: (key: string) => void;
|
|
20
21
|
};
|
package/es/pro-layout/hooks.js
CHANGED
|
@@ -12,6 +12,7 @@ function useHooks(menuItems, options) {
|
|
|
12
12
|
const menuItemMap = ref({});
|
|
13
13
|
const breadcrumbItems = ref([]);
|
|
14
14
|
const tabs = ref([]);
|
|
15
|
+
const keepAliveInclude = ref([]);
|
|
15
16
|
const setActiveMenuItemPaths = () => {
|
|
16
17
|
const paths = [];
|
|
17
18
|
const recursion = (_menuItems) => {
|
|
@@ -43,16 +44,13 @@ function useHooks(menuItems, options) {
|
|
|
43
44
|
breadcrumbItems.value = ((_a = activeMenuItem.value) == null ? void 0 : _a.breadcrumbs) ? (_b = activeMenuItem.value) == null ? void 0 : _b.breadcrumbs : activeMenuItemTitles.length !== 0 ? activeMenuItemTitles : [];
|
|
44
45
|
};
|
|
45
46
|
function setTabs() {
|
|
46
|
-
if (!activeMenuItem.value) {
|
|
47
|
+
if (!activeMenuItem.value || activeMenuItem.value.noAffix) {
|
|
47
48
|
tabs.value.forEach((tab) => {
|
|
48
49
|
tab.active = false;
|
|
49
50
|
});
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
|
-
const { name: menuItemName, title: menuItemTitle
|
|
53
|
-
if (noAffix) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
53
|
+
const { name: menuItemName, title: menuItemTitle } = activeMenuItem.value;
|
|
56
54
|
let findIndex = -1;
|
|
57
55
|
tabs.value.forEach((v, i) => {
|
|
58
56
|
v.active = false;
|
|
@@ -108,7 +106,37 @@ function useHooks(menuItems, options) {
|
|
|
108
106
|
tab.active = true;
|
|
109
107
|
router.push(tab.fullPath);
|
|
110
108
|
}
|
|
111
|
-
tabs.value.splice(findTabIndex, 1);
|
|
109
|
+
const deleteTab = tabs.value.splice(findTabIndex, 1);
|
|
110
|
+
removeKeepAliveInclude(deleteTab[0]);
|
|
111
|
+
};
|
|
112
|
+
const addKeepAliveInclude = () => {
|
|
113
|
+
var _a;
|
|
114
|
+
if ((_a = route == null ? void 0 : route.meta) == null ? void 0 : _a.ignoreCache) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const keys = new Set(keepAliveInclude.value);
|
|
118
|
+
activeMenuItemPaths.value.forEach((item) => {
|
|
119
|
+
if (item.name) {
|
|
120
|
+
keys.add(item.name);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
keepAliveInclude.value = Array.from(keys.values());
|
|
124
|
+
};
|
|
125
|
+
const removeKeepAliveInclude = (tab) => {
|
|
126
|
+
const keys = new Set(keepAliveInclude.value);
|
|
127
|
+
tab.parentNames.forEach((name) => {
|
|
128
|
+
keys.delete(name);
|
|
129
|
+
});
|
|
130
|
+
tabs.value.forEach((tab2) => {
|
|
131
|
+
tab2.parentNames.forEach((name) => {
|
|
132
|
+
const menuItem = menuItemMap.value[name];
|
|
133
|
+
if (menuItem == null ? void 0 : menuItem.ignoreCache) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
keys.add(menuItem.name);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
keepAliveInclude.value = Array.from(keys.values());
|
|
112
140
|
};
|
|
113
141
|
watch(menuItems, () => {
|
|
114
142
|
const _menuItemMap = {};
|
|
@@ -130,17 +158,19 @@ function useHooks(menuItems, options) {
|
|
|
130
158
|
menuSelectedKeys.value = (activeMenuItem == null ? void 0 : activeMenuItem.value) ? [activeMenuItem.value.name] : [];
|
|
131
159
|
setActiveMenuItemPaths();
|
|
132
160
|
setBreadcrumbItems();
|
|
133
|
-
if (options.
|
|
161
|
+
if (options.showTabs) {
|
|
134
162
|
setTabs();
|
|
135
163
|
}
|
|
164
|
+
addKeepAliveInclude();
|
|
136
165
|
}, { immediate: true });
|
|
137
166
|
return {
|
|
138
167
|
menuSelectedKeys,
|
|
139
|
-
onMenuItemClick,
|
|
140
168
|
activeMenuItem,
|
|
141
169
|
menuItemMap,
|
|
142
170
|
breadcrumbItems,
|
|
143
171
|
tabs,
|
|
172
|
+
keepAliveInclude,
|
|
173
|
+
onMenuItemClick,
|
|
144
174
|
onTabClick,
|
|
145
175
|
onTabDelete
|
|
146
176
|
};
|
package/es/pro-layout/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const ProLayout: {
|
|
|
10
10
|
headerLogo: string;
|
|
11
11
|
theme: "light" | "dark";
|
|
12
12
|
footerTitle: string;
|
|
13
|
-
|
|
13
|
+
showTabs: boolean;
|
|
14
14
|
siderBreakpoint: "xxl" | "xl" | "lg" | "md" | "sm" | "xs";
|
|
15
15
|
}> & Omit<Readonly<ExtractPropTypes<{
|
|
16
16
|
menuItems: {
|
|
@@ -38,7 +38,7 @@ declare const ProLayout: {
|
|
|
38
38
|
required: false;
|
|
39
39
|
default: string;
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
showTabs: {
|
|
42
42
|
type: PropType<boolean>;
|
|
43
43
|
required: false;
|
|
44
44
|
default: boolean;
|
|
@@ -50,7 +50,8 @@ declare const ProLayout: {
|
|
|
50
50
|
};
|
|
51
51
|
}>> & {
|
|
52
52
|
onCollapse?: ((collapsed: boolean) => any) | undefined;
|
|
53
|
-
|
|
53
|
+
onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
|
|
54
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, "menuItems" | "headerTitle" | "headerLogo" | "theme" | "footerTitle" | "showTabs" | "siderBreakpoint">;
|
|
54
55
|
$attrs: {
|
|
55
56
|
[x: string]: unknown;
|
|
56
57
|
};
|
|
@@ -62,7 +63,7 @@ declare const ProLayout: {
|
|
|
62
63
|
}>;
|
|
63
64
|
$root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
64
65
|
$parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
65
|
-
$emit: (event: "collapse", collapsed: boolean) => void;
|
|
66
|
+
$emit: ((event: "collapse", collapsed: boolean) => void) & ((event: "keepAliveIncludeChange", keepAliveInclude: string[]) => void);
|
|
66
67
|
$el: any;
|
|
67
68
|
$options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
|
|
68
69
|
menuItems: {
|
|
@@ -90,7 +91,7 @@ declare const ProLayout: {
|
|
|
90
91
|
required: false;
|
|
91
92
|
default: string;
|
|
92
93
|
};
|
|
93
|
-
|
|
94
|
+
showTabs: {
|
|
94
95
|
type: PropType<boolean>;
|
|
95
96
|
required: false;
|
|
96
97
|
default: boolean;
|
|
@@ -102,15 +103,17 @@ declare const ProLayout: {
|
|
|
102
103
|
};
|
|
103
104
|
}>> & {
|
|
104
105
|
onCollapse?: ((collapsed: boolean) => any) | undefined;
|
|
106
|
+
onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
|
|
105
107
|
}, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
106
108
|
collapse: (collapsed: boolean) => true;
|
|
109
|
+
keepAliveIncludeChange: (keepAliveInclude: string[]) => true;
|
|
107
110
|
}, string, {
|
|
108
111
|
menuItems: IProMenuItem[];
|
|
109
112
|
headerTitle: string;
|
|
110
113
|
headerLogo: string;
|
|
111
114
|
theme: "light" | "dark";
|
|
112
115
|
footerTitle: string;
|
|
113
|
-
|
|
116
|
+
showTabs: boolean;
|
|
114
117
|
siderBreakpoint: "xxl" | "xl" | "lg" | "md" | "sm" | "xs";
|
|
115
118
|
}, {}, string> & {
|
|
116
119
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -158,7 +161,7 @@ declare const ProLayout: {
|
|
|
158
161
|
required: false;
|
|
159
162
|
default: string;
|
|
160
163
|
};
|
|
161
|
-
|
|
164
|
+
showTabs: {
|
|
162
165
|
type: PropType<boolean>;
|
|
163
166
|
required: false;
|
|
164
167
|
default: boolean;
|
|
@@ -170,6 +173,7 @@ declare const ProLayout: {
|
|
|
170
173
|
};
|
|
171
174
|
}>> & {
|
|
172
175
|
onCollapse?: ((collapsed: boolean) => any) | undefined;
|
|
176
|
+
onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
|
|
173
177
|
} & ShallowUnwrapRef<{}> & {} & ComponentCustomProperties & {};
|
|
174
178
|
__isFragment?: undefined;
|
|
175
179
|
__isTeleport?: undefined;
|
|
@@ -200,7 +204,7 @@ declare const ProLayout: {
|
|
|
200
204
|
required: false;
|
|
201
205
|
default: string;
|
|
202
206
|
};
|
|
203
|
-
|
|
207
|
+
showTabs: {
|
|
204
208
|
type: PropType<boolean>;
|
|
205
209
|
required: false;
|
|
206
210
|
default: boolean;
|
|
@@ -212,15 +216,17 @@ declare const ProLayout: {
|
|
|
212
216
|
};
|
|
213
217
|
}>> & {
|
|
214
218
|
onCollapse?: ((collapsed: boolean) => any) | undefined;
|
|
219
|
+
onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
|
|
215
220
|
}, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
216
221
|
collapse: (collapsed: boolean) => true;
|
|
222
|
+
keepAliveIncludeChange: (keepAliveInclude: string[]) => true;
|
|
217
223
|
}, string, {
|
|
218
224
|
menuItems: IProMenuItem[];
|
|
219
225
|
headerTitle: string;
|
|
220
226
|
headerLogo: string;
|
|
221
227
|
theme: "light" | "dark";
|
|
222
228
|
footerTitle: string;
|
|
223
|
-
|
|
229
|
+
showTabs: boolean;
|
|
224
230
|
siderBreakpoint: "xxl" | "xl" | "lg" | "md" | "sm" | "xs";
|
|
225
231
|
}, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
|
|
226
232
|
install: (app: App) => void;
|
package/es/pro-layout/index.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import _sfc_main from "./pro-layout.vue.js";
|
|
2
2
|
import "./pro-layout.vue2.js";
|
|
3
|
-
import { Layout, Space, Typography,
|
|
3
|
+
import { Layout, Space, Typography, Button, Affix } from "@arco-design/web-vue";
|
|
4
|
+
import { ProKeepAliveRouterView } from "../pro-keep-alive-router-view/index.js";
|
|
4
5
|
import { ProMenu } from "../pro-menu/index.js";
|
|
5
6
|
import { ProReuseTabs } from "../pro-reuse-tabs/index.js";
|
|
6
|
-
import { ProPageWrapper } from "../pro-page-wrapper/index.js";
|
|
7
7
|
const ProLayout = Object.assign(_sfc_main, {
|
|
8
8
|
install: (app) => {
|
|
9
9
|
app.use(Layout);
|
|
10
10
|
app.use(Space);
|
|
11
11
|
app.use(Typography);
|
|
12
|
-
app.use(Tooltip);
|
|
13
12
|
app.use(Button);
|
|
14
|
-
app.use(Dropdown);
|
|
15
|
-
app.use(Avatar);
|
|
16
13
|
app.use(Affix);
|
|
14
|
+
app.use(ProKeepAliveRouterView);
|
|
17
15
|
app.use(ProMenu);
|
|
18
16
|
app.use(ProReuseTabs);
|
|
19
|
-
app.use(ProPageWrapper);
|
|
20
17
|
app.component("KbProLayout", _sfc_main);
|
|
21
18
|
}
|
|
22
19
|
});
|