@keyblade/pro-components 1.4.6 → 1.5.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.
Files changed (36) hide show
  1. package/es/components.d.ts +1 -1
  2. package/es/index.d.ts +1 -1
  3. package/es/index.js +19 -19
  4. package/es/pro-keep-alive-router-view/index.d.ts +1 -1
  5. package/es/pro-layout/hooks.d.ts +1 -1
  6. package/es/pro-layout/hooks.js +1 -1
  7. package/es/pro-layout/index.d.ts +31 -13
  8. package/es/pro-layout/pro-layout.vue.d.ts +36 -15
  9. package/es/pro-layout/pro-layout.vue.js +127 -115
  10. package/es/pro-menu/index.d.ts +24 -4
  11. package/es/pro-menu/index.js +7 -6
  12. package/es/pro-menu/pro-menu.vue.d.ts +13 -1
  13. package/es/pro-menu/pro-menu.vue.js +99 -34
  14. package/es/pro-menu/pro-menu.vue2.js +2 -2
  15. package/es/pro-menu/pro-menu.vue3.js +5 -0
  16. package/es/pro-page-container/index.d.ts +82 -109
  17. package/es/pro-page-container/index.js +7 -7
  18. package/es/pro-page-container/pro-page-container.vue.d.ts +49 -79
  19. package/es/pro-page-container/pro-page-container.vue.js +32 -51
  20. package/es/{pro-breadcrumb → pro-page-header}/index.d.ts +55 -55
  21. package/es/pro-page-header/index.js +13 -0
  22. package/es/{pro-breadcrumb/pro-breadcrumb.vue.d.ts → pro-page-header/pro-page-header.vue.d.ts} +41 -41
  23. package/es/pro-page-header/pro-page-header.vue.js +125 -0
  24. package/es/pro-page-header/pro-page-header.vue3.js +5 -0
  25. package/es/pro-reuse-tabs/index.d.ts +1 -1
  26. package/es/style.css +1 -1
  27. package/package.json +3 -2
  28. package/src/index.ts +3 -3
  29. package/es/pro-breadcrumb/index.js +0 -13
  30. package/es/pro-breadcrumb/pro-breadcrumb.vue.js +0 -102
  31. package/es/pro-breadcrumb/pro-breadcrumb.vue3.js +0 -5
  32. package/es/pro-menu/pro-menu-item.vue.d.ts +0 -14
  33. package/es/pro-menu/pro-menu-item.vue.js +0 -88
  34. package/es/pro-menu/pro-menu-item.vue2.js +0 -4
  35. package/es/pro-menu/pro-menu-item.vue3.js +0 -5
  36. /package/es/{pro-breadcrumb/pro-breadcrumb.vue2.js → pro-page-header/pro-page-header.vue2.js} +0 -0
@@ -1,9 +1,13 @@
1
- import { defineComponent as U, useCssVars as X, toRefs as Y, useSlots as Z, provide as q, ref as ee, watch as B, resolveComponent as o, openBlock as s, createBlock as c, normalizeClass as t, withCtx as a, createVNode as i, createElementVNode as f, unref as d, renderSlot as m, createElementBlock as k, Fragment as S, createTextVNode as b, toDisplayString as g, createCommentVNode as p } from "vue";
1
+ import { defineComponent as U, useCssVars as X, toRefs as Y, useSlots as Z, provide as S, ref as ee, watch as w, resolveComponent as o, openBlock as a, createBlock as i, normalizeClass as l, withCtx as s, createVNode as c, createElementVNode as p, unref as n, renderSlot as m, createElementBlock as h, Fragment as b, createTextVNode as g, toDisplayString as v, createCommentVNode as u } from "vue";
2
2
  import { useHooks as te } from "./hooks.js";
3
3
  const le = ["src"], oe = ["src"], e = "keyblade-pro-layout", ae = 48, re = /* @__PURE__ */ U({
4
4
  __name: "pro-layout",
5
5
  props: {
6
- /** 布局类型 */
6
+ /**
7
+ * 布局模式
8
+ * side:侧边菜单布局
9
+ * mix:混合菜单布局
10
+ * */
7
11
  layout: {
8
12
  type: String,
9
13
  required: !1,
@@ -15,17 +19,17 @@ const le = ["src"], oe = ["src"], e = "keyblade-pro-layout", ae = 48, re = /* @_
15
19
  required: !1,
16
20
  default: 60
17
21
  },
18
- /** 右上角标题 */
19
- title: {
22
+ /** logo */
23
+ logo: {
20
24
  type: String,
21
25
  required: !1,
22
- default: "KeyBlade Pro"
26
+ default: "http://p3-armor.byteimg.com/tos-cn-i-49unhts6dw/dfdba5317c0c20ce20e64fac803d52bc.svg~tplv-49unhts6dw-image.image"
23
27
  },
24
- /** 右上角logo */
25
- logo: {
28
+ /** 标题 */
29
+ title: {
26
30
  type: String,
27
31
  required: !1,
28
- default: "http://p3-armor.byteimg.com/tos-cn-i-49unhts6dw/dfdba5317c0c20ce20e64fac803d52bc.svg~tplv-49unhts6dw-image.image"
32
+ default: "KeyBlade Pro"
29
33
  },
30
34
  /** 侧边栏宽度 */
31
35
  siderWidth: {
@@ -57,190 +61,198 @@ const le = ["src"], oe = ["src"], e = "keyblade-pro-layout", ae = 48, re = /* @_
57
61
  required: !1,
58
62
  default: "KeyBlade Pro"
59
63
  },
60
- /** 是否显示多页签 */
61
- showTabs: {
64
+ /** 是否隐藏页脚 */
65
+ hideFooter: {
62
66
  type: Boolean,
63
67
  required: !1,
64
- default: !0
68
+ default: !1
69
+ },
70
+ /** 是否隐藏多页签 */
71
+ hideTabs: {
72
+ type: Boolean,
73
+ required: !1,
74
+ default: !1
65
75
  }
66
76
  },
67
77
  emits: {
68
78
  /** 收缩事件 */
69
- collapse: (l) => !0,
79
+ collapse: (t) => !0,
70
80
  /** keepAlive改变事件 */
71
- keepAliveIncludeChange: (l) => !0
81
+ keepAliveIncludeChange: (t) => !0
72
82
  },
73
- setup(l, { emit: v }) {
74
- const u = l;
83
+ setup(t, { emit: $ }) {
84
+ const f = t;
75
85
  X((r) => ({
76
- "79d837bc": V,
77
- 51986431: D,
78
- "2cc12c98": K
86
+ db27ef1a: V,
87
+ "2f10394c": D,
88
+ "2c81e8ab": K
79
89
  }));
80
- const { menuItems: $ } = Y(u), y = Z(), {
90
+ const { menuItems: C } = Y(f), y = Z(), {
81
91
  menuSelectedKeys: N,
82
92
  breadcrumbItems: P,
83
- tabs: C,
84
- keepAliveInclude: h,
93
+ tabs: T,
94
+ keepAliveInclude: _,
85
95
  onMenuItemClick: W,
86
96
  onTabClick: A,
87
97
  onTabDelete: H
88
- } = te($, {
89
- showTabs: u.showTabs
98
+ } = te(C, {
99
+ hideTabs: f.hideTabs
90
100
  });
91
- q("ProBreadcrumbItems", P), q("ProKeepAliveInclude", h);
92
- const V = `${u.headerHeight}px`, D = `${u.siderWidth}px`, K = `${ae}px`, n = ee(u.siderCollapsed), T = (r) => {
93
- n.value = r, v("collapse", r);
101
+ S("ProBreadcrumbItems", P), S("ProKeepAliveInclude", _);
102
+ const V = `${f.headerHeight}px`, D = `${f.siderWidth}px`, K = `${ae}px`, d = ee(f.siderCollapsed), x = (r) => {
103
+ d.value = r, $("collapse", r);
94
104
  };
95
- return B(() => u.siderCollapsed, () => {
96
- n.value = u.siderCollapsed;
97
- }, { immediate: !0 }), B(h, () => {
98
- v("keepAliveIncludeChange", h.value);
99
- }, { immediate: !0 }), (r, w) => {
100
- const x = o("a-typography-title"), I = o("a-space"), M = o("a-layout-header"), z = o("kb-pro-menu"), E = o("icon-menu-unfold"), F = o("icon-menu-fold"), R = o("a-button"), j = o("a-layout-sider"), G = o("kb-pro-reuse-tabs"), J = o("a-affix"), L = o("kb-pro-keep-alive-router-view"), O = o("a-layout-content"), Q = o("a-layout-footer"), _ = o("a-layout");
101
- return s(), c(_, {
102
- class: t(`${e} ${e}-${l.layout}`)
105
+ return w(() => f.siderCollapsed, () => {
106
+ d.value = f.siderCollapsed;
107
+ }, { immediate: !0 }), w(_, () => {
108
+ $("keepAliveIncludeChange", _.value);
109
+ }, { immediate: !0 }), (r, I) => {
110
+ const q = o("a-typography-title"), B = o("a-space"), F = o("a-layout-header"), M = o("kb-pro-menu"), z = o("icon-menu-unfold"), E = o("icon-menu-fold"), R = o("a-button"), j = o("a-layout-sider"), G = o("kb-pro-reuse-tabs"), J = o("a-affix"), L = o("kb-pro-keep-alive-router-view"), O = o("a-layout-content"), Q = o("a-layout-footer"), k = o("a-layout");
111
+ return a(), i(k, {
112
+ class: l(`${e} ${e}-${t.layout}`)
103
113
  }, {
104
- default: a(() => [
105
- i(M, {
106
- class: t(`${e}-header` + (n.value ? ` ${e}-header-collapsed` : ""))
114
+ default: s(() => [
115
+ c(F, {
116
+ class: l(`${e}-header` + (d.value ? ` ${e}-header-collapsed` : ""))
107
117
  }, {
108
- default: a(() => [
109
- f("div", {
110
- class: t(`${e}-header-left`)
118
+ default: s(() => [
119
+ p("div", {
120
+ class: l(`${e}-header-left`)
111
121
  }, [
112
- d(y)["header-left"] ? m(r.$slots, "header-left", { key: 0 }) : (s(), k(S, { key: 1 }, [
113
- l.layout !== "side" ? (s(), c(I, { key: 0 }, {
114
- default: a(() => [
115
- f("img", {
116
- class: t(`${e}-header-left-logo`),
122
+ n(y)["header-left"] ? m(r.$slots, "header-left", { key: 0 }) : (a(), h(b, { key: 1 }, [
123
+ t.layout !== "side" ? (a(), i(B, { key: 0 }, {
124
+ default: s(() => [
125
+ p("img", {
126
+ class: l(`${e}-header-left-logo`),
117
127
  alt: "logo",
118
- src: l.logo
128
+ src: t.logo
119
129
  }, null, 10, le),
120
- n.value ? p("", !0) : (s(), c(x, {
130
+ d.value ? u("", !0) : (a(), i(q, {
121
131
  key: 0,
122
- class: t(`${e}-header-left-title`),
132
+ class: l(`${e}-header-left-title`),
123
133
  heading: 5
124
134
  }, {
125
- default: a(() => [
126
- b(g(l.title), 1)
135
+ default: s(() => [
136
+ g(v(t.title), 1)
127
137
  ]),
128
138
  _: 1
129
139
  }, 8, ["class"]))
130
140
  ]),
131
141
  _: 1
132
- })) : p("", !0)
142
+ })) : u("", !0)
133
143
  ], 64))
134
144
  ], 2),
135
- f("div", {
136
- class: t(`${e}-header-center`)
145
+ p("div", {
146
+ class: l(`${e}-header-center`)
137
147
  }, [
138
- d(y)["header-center"] ? m(r.$slots, "header-center", { key: 0 }) : p("", !0)
148
+ n(y)["header-center"] ? m(r.$slots, "header-center", { key: 0 }) : u("", !0)
139
149
  ], 2),
140
- f("div", {
141
- class: t(`${e}-header-right`)
150
+ p("div", {
151
+ class: l(`${e}-header-right`)
142
152
  }, [
143
153
  m(r.$slots, "header-right")
144
154
  ], 2)
145
155
  ]),
146
156
  _: 3
147
157
  }, 8, ["class"]),
148
- i(_, null, {
149
- default: a(() => [
150
- i(j, {
151
- class: t(`${e}-sider` + (n.value ? ` ${e}-sider-collapsed` : "")),
152
- width: l.siderWidth,
158
+ c(k, null, {
159
+ default: s(() => [
160
+ c(j, {
161
+ class: l(`${e}-sider` + (d.value ? ` ${e}-sider-collapsed` : "")),
162
+ width: t.siderWidth,
153
163
  collapsible: !0,
154
- breakpoint: l.siderBreakpoint,
155
- collapsed: n.value,
164
+ breakpoint: t.siderBreakpoint,
165
+ collapsed: d.value,
156
166
  "hide-trigger": !0,
157
- onCollapse: T
167
+ onCollapse: x
158
168
  }, {
159
- default: a(() => [
160
- f("div", {
161
- class: t(`${e}-sider-content`)
169
+ default: s(() => [
170
+ p("div", {
171
+ class: l(`${e}-sider-content`)
162
172
  }, [
163
- d(y)["sider-top"] ? m(r.$slots, "sider-top", { key: 0 }) : (s(), k(S, { key: 1 }, [
164
- l.layout === "side" ? (s(), k("div", {
173
+ n(y)["sider-top"] ? m(r.$slots, "sider-top", { key: 0 }) : (a(), h(b, { key: 1 }, [
174
+ t.layout === "side" ? (a(), h("div", {
165
175
  key: 0,
166
- class: t(`${e}-sider-content-top`)
176
+ class: l(`${e}-sider-content-top`)
167
177
  }, [
168
- i(I, null, {
169
- default: a(() => [
170
- f("img", {
171
- class: t(`${e}-sider-content-top-logo`),
178
+ c(B, null, {
179
+ default: s(() => [
180
+ p("img", {
181
+ class: l(`${e}-sider-content-top-logo`),
172
182
  alt: "logo",
173
- src: l.logo
183
+ src: t.logo
174
184
  }, null, 10, oe),
175
- n.value ? p("", !0) : (s(), c(x, {
185
+ d.value ? u("", !0) : (a(), i(q, {
176
186
  key: 0,
177
- class: t(`${e}-sider-content-top-title`),
187
+ class: l(`${e}-sider-content-top-title`),
178
188
  heading: 5
179
189
  }, {
180
- default: a(() => [
181
- b(g(l.title), 1)
190
+ default: s(() => [
191
+ g(v(t.title), 1)
182
192
  ]),
183
193
  _: 1
184
194
  }, 8, ["class"]))
185
195
  ]),
186
196
  _: 1
187
197
  })
188
- ], 2)) : p("", !0)
198
+ ], 2)) : u("", !0)
189
199
  ], 64)),
190
- i(z, {
191
- collapsed: n.value,
192
- "selected-keys": d(N),
193
- items: d($),
194
- onMenuItemClick: d(W)
200
+ c(M, {
201
+ collapsed: d.value,
202
+ "selected-keys": n(N),
203
+ items: n(C),
204
+ onMenuItemClick: n(W)
195
205
  }, null, 8, ["collapsed", "selected-keys", "items", "onMenuItemClick"])
196
206
  ], 2),
197
- i(R, {
207
+ c(R, {
198
208
  size: "mini",
199
- class: t(`${e}-sider-collapsed-icon`),
200
- onClick: w[0] || (w[0] = (se) => T(!n.value))
209
+ class: l(`${e}-sider-collapsed-icon`),
210
+ onClick: I[0] || (I[0] = (se) => x(!d.value))
201
211
  }, {
202
- icon: a(() => [
203
- n.value ? (s(), c(E, { key: 0 })) : (s(), c(F, { key: 1 }))
212
+ icon: s(() => [
213
+ d.value ? (a(), i(z, { key: 0 })) : (a(), i(E, { key: 1 }))
204
214
  ]),
205
215
  _: 1
206
216
  }, 8, ["class"])
207
217
  ]),
208
218
  _: 3
209
219
  }, 8, ["class", "width", "breakpoint", "collapsed"]),
210
- i(_, {
211
- class: t(`${e}-body` + (n.value ? ` ${e}-body-collapsed` : ""))
220
+ c(k, {
221
+ class: l(`${e}-body` + (d.value ? ` ${e}-body-collapsed` : ""))
212
222
  }, {
213
- default: a(() => [
214
- l.showTabs ? (s(), c(J, {
223
+ default: s(() => [
224
+ t.hideTabs ? u("", !0) : (a(), i(J, {
215
225
  key: 0,
216
- class: t(`${e}-body-affix`),
217
- offsetTop: l.headerHeight
226
+ class: l(`${e}-body-affix`),
227
+ offsetTop: t.headerHeight
218
228
  }, {
219
- default: a(() => [
220
- d(C).length > 0 ? (s(), c(G, {
229
+ default: s(() => [
230
+ n(T).length > 0 ? (a(), i(G, {
221
231
  key: 0,
222
- tabs: d(C),
223
- onTabClick: d(A),
224
- onTabDelete: d(H)
225
- }, null, 8, ["tabs", "onTabClick", "onTabDelete"])) : p("", !0)
232
+ tabs: n(T),
233
+ onTabClick: n(A),
234
+ onTabDelete: n(H)
235
+ }, null, 8, ["tabs", "onTabClick", "onTabDelete"])) : u("", !0)
226
236
  ]),
227
237
  _: 1
228
- }, 8, ["class", "offsetTop"])) : p("", !0),
229
- i(O, null, {
230
- default: a(() => [
231
- i(L)
238
+ }, 8, ["class", "offsetTop"])),
239
+ c(O, null, {
240
+ default: s(() => [
241
+ c(L)
232
242
  ]),
233
243
  _: 1
234
244
  }),
235
- d(y).footer !== void 0 ? m(r.$slots, "footer", { key: 1 }) : (s(), c(Q, {
236
- key: 2,
237
- class: t(`${e}-body-footer`)
238
- }, {
239
- default: a(() => [
240
- b(g(l.footerTitle), 1)
241
- ]),
242
- _: 1
243
- }, 8, ["class"]))
245
+ t.hideFooter ? u("", !0) : (a(), h(b, { key: 1 }, [
246
+ n(y).footer !== void 0 ? m(r.$slots, "footer", { key: 0 }) : (a(), i(Q, {
247
+ key: 1,
248
+ class: l(`${e}-body-footer`)
249
+ }, {
250
+ default: s(() => [
251
+ g(v(t.footerTitle), 1)
252
+ ]),
253
+ _: 1
254
+ }, 8, ["class"]))
255
+ ], 64))
244
256
  ]),
245
257
  _: 3
246
258
  }, 8, ["class"])
@@ -5,8 +5,7 @@ declare const ProMenu: {
5
5
  $: ComponentInternalInstance;
6
6
  $data: {};
7
7
  $props: {
8
- readonly items: IProMenuItem[];
9
- style?: unknown;
8
+ mode?: "horizontal" | "vertical" | undefined;
10
9
  key?: string | number | symbol | undefined;
11
10
  ref?: VNodeRef | undefined;
12
11
  ref_for?: boolean | undefined;
@@ -50,8 +49,10 @@ declare const ProMenu: {
50
49
  [key: string]: any;
51
50
  }>) => void)[] | undefined;
52
51
  class?: unknown;
52
+ style?: unknown;
53
53
  readonly collapsed: boolean;
54
54
  readonly selectedKeys: string[];
55
+ readonly items: IProMenuItem[];
55
56
  "onMenu-item-click"?: ((key: string) => any) | undefined;
56
57
  };
57
58
  $attrs: {
@@ -68,6 +69,11 @@ declare const ProMenu: {
68
69
  $emit: (event: "menu-item-click", key: string) => void;
69
70
  $el: any;
70
71
  $options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
72
+ mode: {
73
+ type: PropType<"horizontal" | "vertical">;
74
+ required: false;
75
+ default: string;
76
+ };
71
77
  collapsed: {
72
78
  type: PropType<boolean>;
73
79
  required: true;
@@ -84,7 +90,9 @@ declare const ProMenu: {
84
90
  "onMenu-item-click"?: ((key: string) => any) | undefined;
85
91
  }, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
86
92
  'menu-item-click': (key: string) => true;
87
- }, string, {}, {}, string, {}> & {
93
+ }, string, {
94
+ mode: "horizontal" | "vertical";
95
+ }, {}, string, {}> & {
88
96
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
89
97
  created?: ((() => void) | (() => void)[]) | undefined;
90
98
  beforeMount?: ((() => void) | (() => void)[]) | undefined;
@@ -105,6 +113,11 @@ declare const ProMenu: {
105
113
  $nextTick: typeof nextTick;
106
114
  $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;
107
115
  } & Readonly<ExtractPropTypes<{
116
+ mode: {
117
+ type: PropType<"horizontal" | "vertical">;
118
+ required: false;
119
+ default: string;
120
+ };
108
121
  collapsed: {
109
122
  type: PropType<boolean>;
110
123
  required: true;
@@ -124,6 +137,11 @@ declare const ProMenu: {
124
137
  __isTeleport?: undefined;
125
138
  __isSuspense?: undefined;
126
139
  } & ComponentOptionsBase<Readonly<ExtractPropTypes<{
140
+ mode: {
141
+ type: PropType<"horizontal" | "vertical">;
142
+ required: false;
143
+ default: string;
144
+ };
127
145
  collapsed: {
128
146
  type: PropType<boolean>;
129
147
  required: true;
@@ -140,7 +158,9 @@ declare const ProMenu: {
140
158
  "onMenu-item-click"?: ((key: string) => any) | undefined;
141
159
  }, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
142
160
  'menu-item-click': (key: string) => true;
143
- }, string, {}, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
161
+ }, string, {
162
+ mode: "horizontal" | "vertical";
163
+ }, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
144
164
  install: (app: App) => void;
145
165
  };
146
166
  export * from './interface';
@@ -1,11 +1,12 @@
1
1
  import n from "./pro-menu.vue.js";
2
- import { Menu as e } from "@arco-design/web-vue";
3
- const t = Object.assign(n, {
2
+ import "./pro-menu.vue2.js";
3
+ import { Menu as t } from "@arco-design/web-vue";
4
+ const e = Object.assign(n, {
4
5
  install: (o) => {
5
- o.use(e), o.component("KbProMenu", n);
6
+ o.use(t), o.component("KbProMenu", n);
6
7
  }
7
- }), m = t;
8
+ }), i = e;
8
9
  export {
9
- t as ProMenu,
10
- m as default
10
+ e as ProMenu,
11
+ i as default
11
12
  };
@@ -1,6 +1,11 @@
1
1
  import { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { IProMenuItem } from './interface';
3
3
  declare const _default: DefineComponent<{
4
+ mode: {
5
+ type: PropType<"horizontal" | "vertical">;
6
+ required: false;
7
+ default: string;
8
+ };
4
9
  collapsed: {
5
10
  type: PropType<boolean>;
6
11
  required: true;
@@ -16,6 +21,11 @@ declare const _default: DefineComponent<{
16
21
  }, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
17
22
  'menu-item-click': (key: string) => true;
18
23
  }, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
24
+ mode: {
25
+ type: PropType<"horizontal" | "vertical">;
26
+ required: false;
27
+ default: string;
28
+ };
19
29
  collapsed: {
20
30
  type: PropType<boolean>;
21
31
  required: true;
@@ -30,5 +40,7 @@ declare const _default: DefineComponent<{
30
40
  };
31
41
  }>> & {
32
42
  "onMenu-item-click"?: ((key: string) => any) | undefined;
33
- }, {}, {}>;
43
+ }, {
44
+ mode: "horizontal" | "vertical";
45
+ }, {}>;
34
46
  export default _default;
@@ -1,9 +1,14 @@
1
- import { defineComponent as p, resolveComponent as f, openBlock as o, createBlock as i, normalizeClass as h, withCtx as y, createElementBlock as k, Fragment as C, renderList as _ } from "vue";
2
- import x from "./pro-menu-item.vue.js";
3
- import "./pro-menu-item.vue2.js";
4
- const B = "keyblade-pro-menu", I = /* @__PURE__ */ p({
1
+ import { defineComponent as R, computed as S, resolveComponent as y, openBlock as r, createBlock as l, normalizeClass as h, withCtx as c, createVNode as V, unref as k, createSlots as g, createTextVNode as i, toDisplayString as x, createElementBlock as u, Fragment as f, renderList as b, createCommentVNode as o, resolveDynamicComponent as N } from "vue";
2
+ import { createReusableTemplate as W } from "@vueuse/core";
3
+ import { useRouter as $ } from "vue-router";
4
+ const A = ["src"], K = ["src"], z = "keyblade-pro-menu", T = "keyblade-pro-menu-item", j = /* @__PURE__ */ R({
5
5
  __name: "pro-menu",
6
6
  props: {
7
+ mode: {
8
+ type: String,
9
+ required: !1,
10
+ default: "vertical"
11
+ },
7
12
  collapsed: {
8
13
  type: Boolean,
9
14
  required: !0
@@ -18,44 +23,104 @@ const B = "keyblade-pro-menu", I = /* @__PURE__ */ p({
18
23
  }
19
24
  },
20
25
  emits: {
21
- "menu-item-click": (t) => !0
26
+ "menu-item-click": (a) => !0
22
27
  },
23
- setup(t, { emit: m }) {
24
- const u = t, d = (s) => {
25
- let n;
26
- const l = (r) => {
27
- var a;
28
- for (let c = 0; c < r.length; c++) {
29
- const e = r[c];
30
- if (e.name === s) {
31
- n = e;
32
- return;
33
- }
34
- e != null && e.children && ((a = e.children) == null ? void 0 : a.length) > 0 && l(e.children);
28
+ setup(a, { emit: q }) {
29
+ const d = $(), [B, _] = W(), s = S(() => (n) => {
30
+ const t = n == null ? void 0 : n.icon;
31
+ return t != null && t.startsWith("icon") ? "icon" : "url";
32
+ }), w = (n) => {
33
+ if (n != null && n.path) {
34
+ if (n.path.startsWith("http") || n.path.startsWith("https")) {
35
+ window.open(n.path);
36
+ return;
35
37
  }
36
- };
37
- l(u.items), !(n && (n.path.startsWith("http") || n.path.startsWith("https"))) && m("menu-item-click", s);
38
+ d == null || d.push({ path: n.path }), q("menu-item-click", n.name);
39
+ }
38
40
  };
39
- return (s, n) => {
40
- const l = f("a-menu");
41
- return o(), i(l, {
42
- class: h(B),
43
- collapsed: t.collapsed,
44
- "selected-keys": t.selectedKeys,
45
- "auto-open-selected": "",
46
- onMenuItemClick: d
41
+ return (n, t) => {
42
+ const D = y("a-sub-menu"), I = y("a-menu-item"), M = y("a-menu");
43
+ return r(), l(M, {
44
+ mode: a.mode,
45
+ class: h(z),
46
+ collapsed: a.collapsed,
47
+ "selected-keys": a.selectedKeys,
48
+ "auto-open-selected": ""
47
49
  }, {
48
- default: y(() => [
49
- (o(!0), k(C, null, _(t.items, (r) => (o(), i(x, {
50
- key: r.name,
51
- item: r
52
- }, null, 8, ["item"]))), 128))
50
+ default: c(() => [
51
+ V(k(B), null, {
52
+ default: c(({ item: e }) => {
53
+ var C, v;
54
+ return [
55
+ e != null && e.children && ((C = e == null ? void 0 : e.children) == null ? void 0 : C.length) > 0 ? (r(), l(D, {
56
+ key: e.name
57
+ }, g({
58
+ title: c(() => [
59
+ i(x(e.title), 1)
60
+ ]),
61
+ default: c(() => [
62
+ e != null && e.hideChildrenInMenu ? o("", !0) : (r(!0), u(f, { key: 0 }, b((e == null ? void 0 : e.children) || [], (p) => (r(), l(k(_), {
63
+ key: p.name,
64
+ item: p
65
+ }, null, 8, ["item"]))), 128))
66
+ ]),
67
+ _: 2
68
+ }, [
69
+ e != null && e.icon ? {
70
+ name: "icon",
71
+ fn: c(() => [
72
+ s.value(e) === "icon" ? (r(), l(N(e.icon), { key: 0 })) : o("", !0),
73
+ s.value(e) === "url" ? (r(), u("img", {
74
+ key: 1,
75
+ class: h(`${T}-img`),
76
+ src: e.icon,
77
+ alt: ""
78
+ }, null, 10, A)) : o("", !0)
79
+ ]),
80
+ key: "0"
81
+ } : void 0
82
+ ]), 1024)) : o("", !0),
83
+ !(e != null && e.children) || ((v = e == null ? void 0 : e.children) == null ? void 0 : v.length) === 0 ? (r(), l(I, {
84
+ key: e.name,
85
+ onClick: (p) => w(e)
86
+ }, g({
87
+ default: c(() => [
88
+ i(" " + x(e.title), 1)
89
+ ]),
90
+ _: 2
91
+ }, [
92
+ e != null && e.icon ? {
93
+ name: "icon",
94
+ fn: c(() => [
95
+ s.value(e) === "icon" ? (r(), l(N(e.icon), { key: 0 })) : o("", !0),
96
+ s.value(e) === "url" ? (r(), u("img", {
97
+ key: 1,
98
+ class: h(`${T}-img`),
99
+ src: e.icon,
100
+ alt: ""
101
+ }, null, 10, K)) : o("", !0)
102
+ ]),
103
+ key: "0"
104
+ } : void 0
105
+ ]), 1032, ["onClick"])) : o("", !0)
106
+ ];
107
+ }),
108
+ _: 1
109
+ }),
110
+ (r(!0), u(f, null, b(a.items, (e) => (r(), u(f, {
111
+ key: e.name
112
+ }, [
113
+ e && !e.hideInMenu ? (r(), l(k(_), {
114
+ key: 0,
115
+ item: e
116
+ }, null, 8, ["item"])) : o("", !0)
117
+ ], 64))), 128))
53
118
  ]),
54
119
  _: 1
55
- }, 8, ["collapsed", "selected-keys"]);
120
+ }, 8, ["mode", "collapsed", "selected-keys"]);
56
121
  };
57
122
  }
58
123
  });
59
124
  export {
60
- I as default
125
+ j as default
61
126
  };
@@ -1,4 +1,4 @@
1
- import f from "./pro-menu.vue.js";
1
+ const e = "";
2
2
  export {
3
- f as default
3
+ e as default
4
4
  };
@@ -0,0 +1,5 @@
1
+ import o from "./pro-menu.vue.js";
2
+ import "./pro-menu.vue2.js";
3
+ export {
4
+ o as default
5
+ };