@keyblade/pro-components 1.7.3 → 1.7.5

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.
@@ -2,11 +2,15 @@ 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
  hideTabs: boolean;
5
+ disableKeepAlive: boolean;
5
6
  }): {
6
7
  menuSelectedKeys: Ref<string[]>;
7
8
  activeMenuItem: Ref<IProMenuItem | undefined>;
8
9
  menuItemMap: Ref<Record<string, IProMenuItem>>;
9
- breadcrumbItems: Ref<string[]>;
10
+ breadcrumbItems: Ref<{
11
+ path?: string | undefined;
12
+ label: string;
13
+ }[]>;
10
14
  tabs: Ref<{
11
15
  name: string;
12
16
  parentNames: string[];
@@ -1,106 +1,106 @@
1
- import { ref as r, watch as b } from "vue";
1
+ import { ref as i, watch as T } from "vue";
2
2
  import { useRoute as S, useRouter as x } from "vue-router";
3
- function K(d, T) {
4
- const i = S(), m = x(), h = r([]), P = (a) => {
5
- h.value = [a];
6
- }, u = r(), f = r([]), v = r({}), p = r([]), s = r([]), o = r([]), N = () => {
7
- const a = [], t = (e) => {
8
- var l;
9
- for (const n in e) {
10
- const c = e[n];
11
- if (c.name === ((l = u == null ? void 0 : u.value) == null ? void 0 : l.name) || c.children && c.children.length > 0 && t(c.children))
12
- return delete c.children, a.unshift(c), !0;
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
13
  }
14
14
  return !1;
15
15
  };
16
- t(JSON.parse(JSON.stringify(d.value))), f.value = a;
16
+ l(JSON.parse(JSON.stringify(h.value))), v.value = t;
17
17
  }, k = () => {
18
- var t, e;
19
- const a = f.value.map((l) => l.title);
20
- p.value = (t = u.value) != null && t.breadcrumbs ? (e = u.value) == null ? void 0 : e.breadcrumbs : a.length !== 0 ? a : [];
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
21
  };
22
22
  function y() {
23
23
  if (!u.value || u.value.noAffix) {
24
- s.value.forEach((n) => {
25
- n.active = !1;
24
+ c.value.forEach((e) => {
25
+ e.active = !1;
26
26
  });
27
27
  return;
28
28
  }
29
- const { name: a, title: t } = u.value;
30
- let e = -1;
31
- s.value.forEach((n, c) => {
32
- n.active = !1, n.name === a && (e = c);
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
33
  });
34
- const l = {
35
- name: a,
36
- parentNames: f.value.map((n) => n.name),
37
- title: t ?? a,
38
- fullPath: i.fullPath,
34
+ const n = {
35
+ name: t,
36
+ parentNames: v.value.map((e) => e.name),
37
+ title: l ?? t,
38
+ fullPath: r.fullPath,
39
39
  active: !0
40
40
  };
41
- if (~e) {
42
- const n = s.value[e];
43
- n.fullPath === i.fullPath ? (n.active = !0, n.fullPath = i.fullPath) : (s.value.splice(e, 1), setTimeout(() => {
44
- s.value.push(l);
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
45
  }));
46
46
  } else
47
- s.value.push(l);
47
+ c.value.push(n);
48
48
  }
49
- const E = (a) => {
50
- const t = s.value.findIndex((l) => l.name === a), e = s.value[t];
51
- m.push(e.fullPath);
52
- }, g = (a) => {
53
- let t = -1, e = -1;
54
- if (s.value.forEach((n, c) => {
55
- n.name === a && (e = c), n.active && (t = c);
56
- }), t === e) {
57
- let n;
58
- e === 0 ? n = s.value[e + 1] : n = s.value[e - 1], n.active = !0, m.push(n.fullPath);
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
59
  }
60
- const l = s.value.splice(e, 1);
61
- I(l[0]);
62
- }, A = () => {
63
- var t;
64
- if ((t = i == null ? void 0 : i.meta) != null && t.ignoreCache)
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
65
  return;
66
- const a = new Set(o.value);
67
- f.value.forEach((e) => {
68
- e.name && a.add(e.name);
69
- }), o.value = Array.from(a.values());
70
- }, I = (a) => {
71
- const t = new Set(o.value);
72
- a.parentNames.forEach((e) => {
73
- t.delete(e);
74
- }), s.value.forEach((e) => {
75
- e.parentNames.forEach((l) => {
76
- const n = v.value[l];
77
- n != null && n.ignoreCache || t.add(n.name);
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
78
  });
79
- }), o.value = Array.from(t.values());
79
+ }), f.value = Array.from(l.values());
80
80
  };
81
- return b(d, () => {
82
- const a = {}, t = (e) => {
83
- e.forEach((l) => {
84
- l.children && l.children.length > 0 && t(l.children), delete l.children, a[l.name] = l;
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
85
  });
86
86
  };
87
- t(JSON.parse(JSON.stringify(d.value))), v.value = a;
88
- }, { immediate: !0 }), b(() => i == null ? void 0 : i.name, () => {
89
- var t;
90
- const a = i == null ? void 0 : i.name;
91
- u.value = v.value[a], h.value = u != null && u.value ? [u.value.name, ...((t = u.value) == null ? void 0 : t.activatedKeys) || []] : [], N(), k(), T.hideTabs || y(), A();
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
92
  }, { immediate: !0 }), {
93
- menuSelectedKeys: h,
93
+ menuSelectedKeys: m,
94
94
  activeMenuItem: u,
95
- menuItemMap: v,
95
+ menuItemMap: d,
96
96
  breadcrumbItems: p,
97
- tabs: s,
98
- keepAliveInclude: o,
97
+ tabs: c,
98
+ keepAliveInclude: f,
99
99
  onMenuItemClick: P,
100
- onTabClick: E,
101
- onTabDelete: g
100
+ onTabClick: A,
101
+ onTabDelete: E
102
102
  };
103
103
  }
104
104
  export {
105
- K as useHooks
105
+ J as useHooks
106
106
  };
@@ -5,6 +5,9 @@ declare const ProLayout: {
5
5
  $data: {};
6
6
  $props: {
7
7
  title?: string | undefined;
8
+ tabsSize?: "small" | "mini" | "medium" | "large" | undefined;
9
+ tabsType?: "line" | "text" | "card" | "card-gutter" | "rounded" | "capsule" | undefined;
10
+ tabsHeaderPadding?: boolean | undefined;
8
11
  layout?: "mix" | "side" | undefined;
9
12
  headerHeight?: number | undefined;
10
13
  logo?: string | undefined;
@@ -15,6 +18,7 @@ declare const ProLayout: {
15
18
  footerTitle?: string | undefined;
16
19
  hideFooter?: boolean | undefined;
17
20
  hideTabs?: boolean | undefined;
21
+ disableKeepAlive?: boolean | undefined;
18
22
  key?: string | number | symbol | undefined;
19
23
  ref?: import("vue").VNodeRef | undefined;
20
24
  ref_for?: boolean | undefined;
@@ -131,6 +135,26 @@ declare const ProLayout: {
131
135
  required: false;
132
136
  default: boolean;
133
137
  };
138
+ tabsSize: {
139
+ type: import("vue").PropType<"small" | "mini" | "medium" | "large">;
140
+ required: false;
141
+ default: string;
142
+ };
143
+ tabsType: {
144
+ type: import("vue").PropType<"line" | "text" | "card" | "card-gutter" | "rounded" | "capsule">;
145
+ required: false;
146
+ default: string;
147
+ };
148
+ tabsHeaderPadding: {
149
+ type: import("vue").PropType<boolean>;
150
+ required: false;
151
+ default: boolean;
152
+ };
153
+ disableKeepAlive: {
154
+ type: import("vue").PropType<boolean>;
155
+ required: false;
156
+ default: boolean;
157
+ };
134
158
  }>> & {
135
159
  onCollapse?: ((collapsed: boolean) => any) | undefined;
136
160
  onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
@@ -139,6 +163,9 @@ declare const ProLayout: {
139
163
  keepAliveIncludeChange: (keepAliveInclude: string[]) => true;
140
164
  }, string, {
141
165
  title: string;
166
+ tabsSize: "small" | "mini" | "medium" | "large";
167
+ tabsType: "line" | "text" | "card" | "card-gutter" | "rounded" | "capsule";
168
+ tabsHeaderPadding: boolean;
142
169
  layout: "mix" | "side";
143
170
  headerHeight: number;
144
171
  logo: string;
@@ -149,6 +176,7 @@ declare const ProLayout: {
149
176
  footerTitle: string;
150
177
  hideFooter: boolean;
151
178
  hideTabs: boolean;
179
+ disableKeepAlive: boolean;
152
180
  }, {}, string, {}> & {
153
181
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
154
182
  created?: ((() => void) | (() => void)[]) | undefined;
@@ -225,6 +253,26 @@ declare const ProLayout: {
225
253
  required: false;
226
254
  default: boolean;
227
255
  };
256
+ tabsSize: {
257
+ type: import("vue").PropType<"small" | "mini" | "medium" | "large">;
258
+ required: false;
259
+ default: string;
260
+ };
261
+ tabsType: {
262
+ type: import("vue").PropType<"line" | "text" | "card" | "card-gutter" | "rounded" | "capsule">;
263
+ required: false;
264
+ default: string;
265
+ };
266
+ tabsHeaderPadding: {
267
+ type: import("vue").PropType<boolean>;
268
+ required: false;
269
+ default: boolean;
270
+ };
271
+ disableKeepAlive: {
272
+ type: import("vue").PropType<boolean>;
273
+ required: false;
274
+ default: boolean;
275
+ };
228
276
  }>> & {
229
277
  onCollapse?: ((collapsed: boolean) => any) | undefined;
230
278
  onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
@@ -288,6 +336,26 @@ declare const ProLayout: {
288
336
  required: false;
289
337
  default: boolean;
290
338
  };
339
+ tabsSize: {
340
+ type: import("vue").PropType<"small" | "mini" | "medium" | "large">;
341
+ required: false;
342
+ default: string;
343
+ };
344
+ tabsType: {
345
+ type: import("vue").PropType<"line" | "text" | "card" | "card-gutter" | "rounded" | "capsule">;
346
+ required: false;
347
+ default: string;
348
+ };
349
+ tabsHeaderPadding: {
350
+ type: import("vue").PropType<boolean>;
351
+ required: false;
352
+ default: boolean;
353
+ };
354
+ disableKeepAlive: {
355
+ type: import("vue").PropType<boolean>;
356
+ required: false;
357
+ default: boolean;
358
+ };
291
359
  }>> & {
292
360
  onCollapse?: ((collapsed: boolean) => any) | undefined;
293
361
  onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
@@ -296,6 +364,9 @@ declare const ProLayout: {
296
364
  keepAliveIncludeChange: (keepAliveInclude: string[]) => true;
297
365
  }, string, {
298
366
  title: string;
367
+ tabsSize: "small" | "mini" | "medium" | "large";
368
+ tabsType: "line" | "text" | "card" | "card-gutter" | "rounded" | "capsule";
369
+ tabsHeaderPadding: boolean;
299
370
  layout: "mix" | "side";
300
371
  headerHeight: number;
301
372
  logo: string;
@@ -306,6 +377,7 @@ declare const ProLayout: {
306
377
  footerTitle: string;
307
378
  hideFooter: boolean;
308
379
  hideTabs: boolean;
380
+ disableKeepAlive: boolean;
309
381
  }, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
310
382
  $slots: {
311
383
  "header-left"?(_: {}): any;
@@ -71,6 +71,30 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
71
71
  required: false;
72
72
  default: boolean;
73
73
  };
74
+ /** tabs尺寸 */
75
+ tabsSize: {
76
+ type: PropType<"small" | "mini" | "medium" | "large">;
77
+ required: false;
78
+ default: string;
79
+ };
80
+ /** tabs类型 */
81
+ tabsType: {
82
+ type: PropType<"line" | "text" | "card" | "card-gutter" | "rounded" | "capsule">;
83
+ required: false;
84
+ default: string;
85
+ };
86
+ /** tabs头部间距 */
87
+ tabsHeaderPadding: {
88
+ type: PropType<boolean>;
89
+ required: false;
90
+ default: boolean;
91
+ };
92
+ /** 禁用全局路由缓存 */
93
+ disableKeepAlive: {
94
+ type: PropType<boolean>;
95
+ required: false;
96
+ default: boolean;
97
+ };
74
98
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
75
99
  /** 收缩事件 */
76
100
  collapse: (collapsed: boolean) => true;
@@ -147,11 +171,38 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
147
171
  required: false;
148
172
  default: boolean;
149
173
  };
174
+ /** tabs尺寸 */
175
+ tabsSize: {
176
+ type: PropType<"small" | "mini" | "medium" | "large">;
177
+ required: false;
178
+ default: string;
179
+ };
180
+ /** tabs类型 */
181
+ tabsType: {
182
+ type: PropType<"line" | "text" | "card" | "card-gutter" | "rounded" | "capsule">;
183
+ required: false;
184
+ default: string;
185
+ };
186
+ /** tabs头部间距 */
187
+ tabsHeaderPadding: {
188
+ type: PropType<boolean>;
189
+ required: false;
190
+ default: boolean;
191
+ };
192
+ /** 禁用全局路由缓存 */
193
+ disableKeepAlive: {
194
+ type: PropType<boolean>;
195
+ required: false;
196
+ default: boolean;
197
+ };
150
198
  }>> & {
151
199
  onCollapse?: ((collapsed: boolean) => any) | undefined;
152
200
  onKeepAliveIncludeChange?: ((keepAliveInclude: string[]) => any) | undefined;
153
201
  }, {
154
202
  title: string;
203
+ tabsSize: "small" | "mini" | "medium" | "large";
204
+ tabsType: "line" | "text" | "card" | "card-gutter" | "rounded" | "capsule";
205
+ tabsHeaderPadding: boolean;
155
206
  layout: "mix" | "side";
156
207
  headerHeight: number;
157
208
  logo: string;
@@ -162,6 +213,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
162
213
  footerTitle: string;
163
214
  hideFooter: boolean;
164
215
  hideTabs: boolean;
216
+ disableKeepAlive: boolean;
165
217
  }, {}>, {
166
218
  "header-left"?(_: {}): any;
167
219
  "header-center"?(_: {}): any;