@keyblade/pro-components 0.0.4 → 0.0.6

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.
@@ -1,4 +1,4 @@
1
- import type { ComponentInternalInstance, ExtractPropTypes, PropType, 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, Ref, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, App } from 'vue';
2
2
  declare const ProBreadcrumb: {
3
3
  new (...args: any[]): {
4
4
  $: ComponentInternalInstance;
@@ -34,7 +34,7 @@ declare const ProBreadcrumb: {
34
34
  }>>, {
35
35
  prefixClsName: string;
36
36
  props: any;
37
- injectValue: never[];
37
+ injectValue: Ref<string[]>;
38
38
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
39
39
  items: string[];
40
40
  }, {}, string> & {
@@ -66,7 +66,7 @@ declare const ProBreadcrumb: {
66
66
  }>> & ShallowUnwrapRef<{
67
67
  prefixClsName: string;
68
68
  props: any;
69
- injectValue: never[];
69
+ injectValue: Ref<string[]>;
70
70
  }> & {} & ComponentCustomProperties & {};
71
71
  __isFragment?: undefined;
72
72
  __isTeleport?: undefined;
@@ -80,7 +80,7 @@ declare const ProBreadcrumb: {
80
80
  }>>, {
81
81
  prefixClsName: string;
82
82
  props: any;
83
- injectValue: never[];
83
+ injectValue: Ref<string[]>;
84
84
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
85
85
  items: string[];
86
86
  }, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
@@ -1,4 +1,4 @@
1
- import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, type PropType } from 'vue';
1
+ import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, type PropType, type Ref } from 'vue';
2
2
  declare const _sfc_main: DefineComponent<{
3
3
  items: {
4
4
  type: PropType<string[]>;
@@ -8,7 +8,7 @@ declare const _sfc_main: DefineComponent<{
8
8
  }, {
9
9
  prefixClsName: string;
10
10
  props: any;
11
- injectValue: never[];
11
+ injectValue: Ref<string[]>;
12
12
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
13
13
  items: {
14
14
  type: PropType<string[]>;
@@ -4,13 +4,13 @@ export declare function useHooks(menuItems: Ref<IProMenuItem[]>, options: {
4
4
  tabsMode: boolean;
5
5
  }): {
6
6
  menuSelectedKeys: Ref<string[]>;
7
- menuOpenKeys: Ref<string[]>;
8
7
  onMenuItemClick: (key: string) => void;
9
- onSubMenuClick: (key: string, openKeys: string[]) => void;
10
8
  activeMenuItem: Ref<IProMenuItem | undefined>;
9
+ menuItemMap: Ref<Record<string, IProMenuItem>>;
11
10
  breadcrumbItems: Ref<string[]>;
12
11
  tabs: Ref<{
13
12
  name: string;
13
+ parentNames: string[];
14
14
  title: string;
15
15
  fullPath: string;
16
16
  active: boolean;
@@ -4,44 +4,42 @@ function useHooks(menuItems, options) {
4
4
  const route = useRoute();
5
5
  const router = useRouter();
6
6
  const menuSelectedKeys = ref([]);
7
- const menuOpenKeys = ref([]);
8
7
  const onMenuItemClick = (key) => {
9
8
  menuSelectedKeys.value = [key];
10
9
  };
11
- const onSubMenuClick = (key, openKeys) => {
12
- menuOpenKeys.value = openKeys;
13
- };
14
10
  const activeMenuItem = ref();
11
+ const activeMenuItemPaths = ref([]);
15
12
  const menuItemMap = ref({});
16
13
  const breadcrumbItems = ref([]);
17
14
  const tabs = ref([]);
18
- const setBreadcrumbItems = () => {
19
- var _a, _b;
20
- const menuItemPaths = [];
21
- const recursion = (_menuItem) => {
22
- var _a2;
23
- let find = false;
24
- for (const i in _menuItem) {
25
- if (_menuItem[i].name === ((_a2 = activeMenuItem == null ? void 0 : activeMenuItem.value) == null ? void 0 : _a2.name)) {
26
- find = true;
27
- menuItemPaths.push(_menuItem[i]);
15
+ const setActiveMenuItemPaths = () => {
16
+ const paths = [];
17
+ const recursion = (_menuItems) => {
18
+ var _a;
19
+ for (const i in _menuItems) {
20
+ const menuItem = _menuItems[i];
21
+ if (menuItem.name === ((_a = activeMenuItem == null ? void 0 : activeMenuItem.value) == null ? void 0 : _a.name)) {
22
+ delete menuItem.children;
23
+ paths.unshift(menuItem);
24
+ return true;
28
25
  }
29
- const children = _menuItem[i].children;
30
- if (children) {
31
- const node = recursion(children);
32
- if (node) {
33
- menuItemPaths.push(_menuItem[i]);
26
+ if (menuItem.children && menuItem.children.length > 0) {
27
+ const ok = recursion(menuItem.children);
28
+ if (ok) {
29
+ delete menuItem.children;
30
+ paths.unshift(menuItem);
31
+ return true;
34
32
  }
35
33
  }
36
34
  }
37
- return find;
35
+ return false;
38
36
  };
39
- recursion(menuItems.value);
40
- const activeMenuItemPaths = menuItemPaths.reverse();
41
- const parentMenuPaths = activeMenuItemPaths.filter((_, i) => i !== activeMenuItemPaths.length - 1);
42
- const keySet = /* @__PURE__ */ new Set([...parentMenuPaths.map((v) => v.name), ...menuOpenKeys.value]);
43
- menuOpenKeys.value = [...keySet];
44
- const activeMenuItemTitles = activeMenuItemPaths.map((v) => v.title);
37
+ recursion(JSON.parse(JSON.stringify(menuItems.value)));
38
+ activeMenuItemPaths.value = paths;
39
+ };
40
+ const setBreadcrumbItems = () => {
41
+ var _a, _b;
42
+ const activeMenuItemTitles = activeMenuItemPaths.value.map((v) => v.title);
45
43
  breadcrumbItems.value = ((_a = activeMenuItem.value) == null ? void 0 : _a.breadcrumbs) ? (_b = activeMenuItem.value) == null ? void 0 : _b.breadcrumbs : activeMenuItemTitles.length !== 0 ? activeMenuItemTitles : [];
46
44
  };
47
45
  function setTabs() {
@@ -64,6 +62,7 @@ function useHooks(menuItems, options) {
64
62
  });
65
63
  const newTab = {
66
64
  name: menuItemName,
65
+ parentNames: activeMenuItemPaths.value.map((v) => v.name),
67
66
  title: menuItemTitle ?? menuItemName,
68
67
  fullPath: route.fullPath,
69
68
  active: true
@@ -129,6 +128,7 @@ function useHooks(menuItems, options) {
129
128
  const routeName = route == null ? void 0 : route.name;
130
129
  activeMenuItem.value = menuItemMap.value[routeName];
131
130
  menuSelectedKeys.value = (activeMenuItem == null ? void 0 : activeMenuItem.value) ? [activeMenuItem.value.name] : [];
131
+ setActiveMenuItemPaths();
132
132
  setBreadcrumbItems();
133
133
  if (options.tabsMode) {
134
134
  setTabs();
@@ -136,10 +136,9 @@ function useHooks(menuItems, options) {
136
136
  }, { immediate: true });
137
137
  return {
138
138
  menuSelectedKeys,
139
- menuOpenKeys,
140
139
  onMenuItemClick,
141
- onSubMenuClick,
142
140
  activeMenuItem,
141
+ menuItemMap,
143
142
  breadcrumbItems,
144
143
  tabs,
145
144
  onTabClick,
@@ -11,6 +11,7 @@ declare const ProLayout: {
11
11
  theme: "light" | "dark";
12
12
  footerTitle: string;
13
13
  tabsMode: boolean;
14
+ siderBreakpoint: "xxl" | "xl" | "lg" | "md" | "sm" | "xs";
14
15
  }> & Omit<Readonly<ExtractPropTypes<{
15
16
  menuItems: {
16
17
  type: PropType<IProMenuItem[]>;
@@ -42,9 +43,14 @@ declare const ProLayout: {
42
43
  required: false;
43
44
  default: boolean;
44
45
  };
46
+ siderBreakpoint: {
47
+ type: PropType<"xxl" | "xl" | "lg" | "md" | "sm" | "xs">;
48
+ required: false;
49
+ default: string;
50
+ };
45
51
  }>> & {
46
52
  onCollapse?: ((collapsed: boolean) => any) | undefined;
47
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "menuItems" | "headerTitle" | "headerLogo" | "theme" | "footerTitle" | "tabsMode">;
53
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "menuItems" | "headerTitle" | "headerLogo" | "theme" | "footerTitle" | "tabsMode" | "siderBreakpoint">;
48
54
  $attrs: {
49
55
  [x: string]: unknown;
50
56
  };
@@ -89,6 +95,11 @@ declare const ProLayout: {
89
95
  required: false;
90
96
  default: boolean;
91
97
  };
98
+ siderBreakpoint: {
99
+ type: PropType<"xxl" | "xl" | "lg" | "md" | "sm" | "xs">;
100
+ required: false;
101
+ default: string;
102
+ };
92
103
  }>> & {
93
104
  onCollapse?: ((collapsed: boolean) => any) | undefined;
94
105
  }, {
@@ -100,13 +111,13 @@ declare const ProLayout: {
100
111
  [name: string]: Slot | undefined;
101
112
  }>;
102
113
  menuSelectedKeys: Ref<string[]>;
103
- menuOpenKeys: Ref<string[]>;
104
114
  onMenuItemClick: (key: string) => void;
105
- onSubMenuClick: (key: string, openKeys: string[]) => void;
106
115
  activeMenuItem: Ref<IProMenuItem | undefined>;
116
+ menuItemMap: Ref<Record<string, IProMenuItem>>;
107
117
  breadcrumbItems: Ref<string[]>;
108
118
  tabs: Ref<{
109
119
  name: string;
120
+ parentNames: string[];
110
121
  title: string;
111
122
  fullPath: string;
112
123
  active: boolean;
@@ -114,6 +125,8 @@ declare const ProLayout: {
114
125
  onTabClick: (key: string) => void;
115
126
  onTabDelete: (key: string) => void;
116
127
  keepAliveKeys: ComputedRef<string[]>;
128
+ headerHeight: number;
129
+ headerHeightWidthPx: string;
117
130
  siderWidth: number;
118
131
  siderCollapsedWidth: number;
119
132
  siderWidthPx: string;
@@ -129,6 +142,7 @@ declare const ProLayout: {
129
142
  theme: "light" | "dark";
130
143
  footerTitle: string;
131
144
  tabsMode: boolean;
145
+ siderBreakpoint: "xxl" | "xl" | "lg" | "md" | "sm" | "xs";
132
146
  }, {}, string> & {
133
147
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
134
148
  created?: ((() => void) | (() => void)[]) | undefined;
@@ -180,6 +194,11 @@ declare const ProLayout: {
180
194
  required: false;
181
195
  default: boolean;
182
196
  };
197
+ siderBreakpoint: {
198
+ type: PropType<"xxl" | "xl" | "lg" | "md" | "sm" | "xs">;
199
+ required: false;
200
+ default: string;
201
+ };
183
202
  }>> & {
184
203
  onCollapse?: ((collapsed: boolean) => any) | undefined;
185
204
  } & ShallowUnwrapRef<{
@@ -191,13 +210,13 @@ declare const ProLayout: {
191
210
  [name: string]: Slot | undefined;
192
211
  }>;
193
212
  menuSelectedKeys: Ref<string[]>;
194
- menuOpenKeys: Ref<string[]>;
195
213
  onMenuItemClick: (key: string) => void;
196
- onSubMenuClick: (key: string, openKeys: string[]) => void;
197
214
  activeMenuItem: Ref<IProMenuItem | undefined>;
215
+ menuItemMap: Ref<Record<string, IProMenuItem>>;
198
216
  breadcrumbItems: Ref<string[]>;
199
217
  tabs: Ref<{
200
218
  name: string;
219
+ parentNames: string[];
201
220
  title: string;
202
221
  fullPath: string;
203
222
  active: boolean;
@@ -205,6 +224,8 @@ declare const ProLayout: {
205
224
  onTabClick: (key: string) => void;
206
225
  onTabDelete: (key: string) => void;
207
226
  keepAliveKeys: ComputedRef<string[]>;
227
+ headerHeight: number;
228
+ headerHeightWidthPx: string;
208
229
  siderWidth: number;
209
230
  siderCollapsedWidth: number;
210
231
  siderWidthPx: string;
@@ -246,6 +267,11 @@ declare const ProLayout: {
246
267
  required: false;
247
268
  default: boolean;
248
269
  };
270
+ siderBreakpoint: {
271
+ type: PropType<"xxl" | "xl" | "lg" | "md" | "sm" | "xs">;
272
+ required: false;
273
+ default: string;
274
+ };
249
275
  }>> & {
250
276
  onCollapse?: ((collapsed: boolean) => any) | undefined;
251
277
  }, {
@@ -257,13 +283,13 @@ declare const ProLayout: {
257
283
  [name: string]: Slot | undefined;
258
284
  }>;
259
285
  menuSelectedKeys: Ref<string[]>;
260
- menuOpenKeys: Ref<string[]>;
261
286
  onMenuItemClick: (key: string) => void;
262
- onSubMenuClick: (key: string, openKeys: string[]) => void;
263
287
  activeMenuItem: Ref<IProMenuItem | undefined>;
288
+ menuItemMap: Ref<Record<string, IProMenuItem>>;
264
289
  breadcrumbItems: Ref<string[]>;
265
290
  tabs: Ref<{
266
291
  name: string;
292
+ parentNames: string[];
267
293
  title: string;
268
294
  fullPath: string;
269
295
  active: boolean;
@@ -271,6 +297,8 @@ declare const ProLayout: {
271
297
  onTabClick: (key: string) => void;
272
298
  onTabDelete: (key: string) => void;
273
299
  keepAliveKeys: ComputedRef<string[]>;
300
+ headerHeight: number;
301
+ headerHeightWidthPx: string;
274
302
  siderWidth: number;
275
303
  siderCollapsedWidth: number;
276
304
  siderWidthPx: string;
@@ -286,6 +314,7 @@ declare const ProLayout: {
286
314
  theme: "light" | "dark";
287
315
  footerTitle: string;
288
316
  tabsMode: boolean;
317
+ siderBreakpoint: "xxl" | "xl" | "lg" | "md" | "sm" | "xs";
289
318
  }, {}, string> & VNodeProps & AllowedComponentProps & ComponentCustomProps & {
290
319
  install: (app: App) => void;
291
320
  };
@@ -31,6 +31,11 @@ declare const _sfc_main: DefineComponent<{
31
31
  required: false;
32
32
  default: boolean;
33
33
  };
34
+ siderBreakpoint: {
35
+ type: PropType<"xxl" | "xl" | "lg" | "md" | "sm" | "xs">;
36
+ required: false;
37
+ default: string;
38
+ };
34
39
  }, {
35
40
  prefixClsName: string;
36
41
  props: any;
@@ -40,13 +45,13 @@ declare const _sfc_main: DefineComponent<{
40
45
  [name: string]: Slot | undefined;
41
46
  }>;
42
47
  menuSelectedKeys: Ref<string[]>;
43
- menuOpenKeys: Ref<string[]>;
44
48
  onMenuItemClick: (key: string) => void;
45
- onSubMenuClick: (key: string, openKeys: string[]) => void;
46
49
  activeMenuItem: Ref<IProMenuItem | undefined>;
50
+ menuItemMap: Ref<Record<string, IProMenuItem>>;
47
51
  breadcrumbItems: Ref<string[]>;
48
52
  tabs: Ref<{
49
53
  name: string;
54
+ parentNames: string[];
50
55
  title: string;
51
56
  fullPath: string;
52
57
  active: boolean;
@@ -54,6 +59,8 @@ declare const _sfc_main: DefineComponent<{
54
59
  onTabClick: (key: string) => void;
55
60
  onTabDelete: (key: string) => void;
56
61
  keepAliveKeys: ComputedRef<string[]>;
62
+ headerHeight: number;
63
+ headerHeightWidthPx: string;
57
64
  siderWidth: number;
58
65
  siderCollapsedWidth: number;
59
66
  siderWidthPx: string;
@@ -93,6 +100,11 @@ declare const _sfc_main: DefineComponent<{
93
100
  required: false;
94
101
  default: boolean;
95
102
  };
103
+ siderBreakpoint: {
104
+ type: PropType<"xxl" | "xl" | "lg" | "md" | "sm" | "xs">;
105
+ required: false;
106
+ default: string;
107
+ };
96
108
  }>> & {
97
109
  onCollapse?: ((collapsed: boolean) => any) | undefined;
98
110
  }, {
@@ -102,5 +114,6 @@ declare const _sfc_main: DefineComponent<{
102
114
  theme: "light" | "dark";
103
115
  footerTitle: string;
104
116
  tabsMode: boolean;
117
+ siderBreakpoint: "xxl" | "xl" | "lg" | "md" | "sm" | "xs";
105
118
  }>;
106
119
  export default _sfc_main;
@@ -1,4 +1,4 @@
1
- import { defineComponent, useCssVars, toRefs, useSlots, provide, computed, ref, watch, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createVNode, createElementVNode, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode, resolveDynamicComponent, KeepAlive } from "vue";
1
+ import { defineComponent, useCssVars, toRefs, useSlots, computed, provide, ref, watch, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createVNode, createElementVNode, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode, resolveDynamicComponent, KeepAlive } from "vue";
2
2
  import { useHooks } from "./hooks.js";
3
3
  const _hoisted_1 = ["src"];
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -33,6 +33,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33
33
  type: Boolean,
34
34
  required: false,
35
35
  default: true
36
+ },
37
+ siderBreakpoint: {
38
+ type: String,
39
+ required: false,
40
+ default: "xl"
36
41
  }
37
42
  },
38
43
  emits: {
@@ -41,18 +46,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41
46
  setup(__props, { emit }) {
42
47
  const props = __props;
43
48
  useCssVars((_ctx) => ({
44
- "499b6380": siderWidthPx,
45
- "5e353345": siderCollapsedWidthPx
49
+ "aa0adaee": headerHeightWidthPx,
50
+ "f32a33f8": siderWidthPx,
51
+ "5b964541": siderCollapsedWidthPx
46
52
  }));
47
53
  const prefixClsName = "keyblade-pro-layout";
48
54
  const { menuItems } = toRefs(props);
49
55
  const slots = useSlots();
50
56
  const {
51
57
  menuSelectedKeys,
52
- menuOpenKeys,
53
58
  onMenuItemClick,
54
- onSubMenuClick,
55
59
  activeMenuItem,
60
+ menuItemMap,
56
61
  breadcrumbItems,
57
62
  tabs,
58
63
  onTabClick,
@@ -60,18 +65,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
60
65
  } = useHooks(menuItems, {
61
66
  tabsMode: props.tabsMode
62
67
  });
63
- provide("ProBreadcrumbItems", breadcrumbItems);
64
68
  const keepAliveKeys = computed(() => {
65
- const keys = [];
69
+ const keys = /* @__PURE__ */ new Set();
66
70
  tabs.value.forEach((tab) => {
67
- var _a, _b;
68
- if (tab.name === ((_a = activeMenuItem == null ? void 0 : activeMenuItem.value) == null ? void 0 : _a.name) && ((_b = activeMenuItem.value) == null ? void 0 : _b.ignoreCache)) {
69
- return;
70
- }
71
- keys.push(tab.name);
71
+ tab.parentNames.forEach((name) => {
72
+ const menuItem = menuItemMap.value[name];
73
+ if (menuItem.ignoreCache) {
74
+ return;
75
+ }
76
+ keys.add(menuItem.name);
77
+ });
72
78
  });
73
- return keys;
79
+ return Array.from(keys.values());
74
80
  });
81
+ provide("ProBreadcrumbItems", breadcrumbItems);
82
+ provide("ProKeepAliveKeys", keepAliveKeys);
83
+ const headerHeight = 60;
84
+ const headerHeightWidthPx = `${headerHeight}px`;
75
85
  const siderWidth = 220;
76
86
  const siderCollapsedWidth = 48;
77
87
  const siderWidthPx = `${siderWidth}px`;
@@ -98,6 +108,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
98
108
  const _component_kb_pro_menu = resolveComponent("kb-pro-menu");
99
109
  const _component_a_layout_sider = resolveComponent("a-layout-sider");
100
110
  const _component_kb_pro_reuse_tabs = resolveComponent("kb-pro-reuse-tabs");
111
+ const _component_a_affix = resolveComponent("a-affix");
101
112
  const _component_router_view = resolveComponent("router-view");
102
113
  const _component_kb_pro_page_wrapper = resolveComponent("kb-pro-page-wrapper");
103
114
  const _component_a_layout_content = resolveComponent("a-layout-content");
@@ -149,7 +160,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
149
160
  class: normalizeClass(`${prefixClsName}-sider`),
150
161
  collapsible: true,
151
162
  width: siderWidth,
152
- breakpoint: "md",
163
+ breakpoint: __props.siderBreakpoint,
153
164
  collapsed: siderCollapsed.value,
154
165
  "hide-trigger": true,
155
166
  onCollapse: onSiderCollapse
@@ -163,30 +174,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
163
174
  style: { "flex": "1" },
164
175
  collapsed: siderCollapsed.value,
165
176
  "selected-keys": unref(menuSelectedKeys),
166
- "open-keys": unref(menuOpenKeys),
167
177
  items: unref(menuItems),
168
178
  onCollapse: onSiderCollapse,
169
- onMenuItemClick: unref(onMenuItemClick),
170
- onSubMenuClick: unref(onSubMenuClick)
171
- }, null, 8, ["collapsed", "selected-keys", "open-keys", "items", "onMenuItemClick", "onSubMenuClick"])
179
+ onMenuItemClick: unref(onMenuItemClick)
180
+ }, null, 8, ["collapsed", "selected-keys", "items", "onMenuItemClick"])
172
181
  ], 2)
173
182
  ]),
174
183
  _: 3
175
- }, 8, ["class", "collapsed"]),
184
+ }, 8, ["class", "breakpoint", "collapsed"]),
176
185
  createVNode(_component_a_layout, {
177
186
  class: normalizeClass(`${prefixClsName}-body` + (siderCollapsed.value ? ` ${prefixClsName}-body-collapsed` : ""))
178
187
  }, {
179
188
  default: withCtx(() => [
189
+ createVNode(_component_a_affix, {
190
+ class: normalizeClass(`${prefixClsName}-body-affix`),
191
+ offsetTop: headerHeight
192
+ }, {
193
+ default: withCtx(() => [
194
+ __props.tabsMode && unref(tabs).length > 0 ? (openBlock(), createBlock(_component_kb_pro_reuse_tabs, {
195
+ key: 0,
196
+ tabs: unref(tabs),
197
+ onTabClick: unref(onTabClick),
198
+ onTabDelete: unref(onTabDelete)
199
+ }, null, 8, ["tabs", "onTabClick", "onTabDelete"])) : createCommentVNode("", true)
200
+ ]),
201
+ _: 1
202
+ }, 8, ["class"]),
180
203
  createVNode(_component_a_layout_content, null, {
181
204
  default: withCtx(() => {
182
205
  var _a;
183
206
  return [
184
- __props.tabsMode && unref(tabs).length > 0 ? (openBlock(), createBlock(_component_kb_pro_reuse_tabs, {
185
- key: 0,
186
- tabs: unref(tabs),
187
- onTabClick: unref(onTabClick),
188
- onTabDelete: unref(onTabDelete)
189
- }, null, 8, ["tabs", "onTabClick", "onTabDelete"])) : createCommentVNode("", true),
190
207
  createVNode(_component_kb_pro_page_wrapper, {
191
208
  "hide-page-wrapper": (_a = unref(activeMenuItem)) == null ? void 0 : _a.hidePageWrapper
192
209
  }, {
@@ -14,10 +14,6 @@ declare const ProMenu: {
14
14
  type: PropType<string[]>;
15
15
  required: true;
16
16
  };
17
- openKeys: {
18
- type: PropType<string[]>;
19
- required: true;
20
- };
21
17
  items: {
22
18
  type: PropType<IProMenuItem[]>;
23
19
  required: true;
@@ -49,10 +45,6 @@ declare const ProMenu: {
49
45
  type: PropType<string[]>;
50
46
  required: true;
51
47
  };
52
- openKeys: {
53
- type: PropType<string[]>;
54
- required: true;
55
- };
56
48
  items: {
57
49
  type: PropType<IProMenuItem[]>;
58
50
  required: true;
@@ -63,7 +55,9 @@ declare const ProMenu: {
63
55
  "onSub-menu-click"?: ((key: string, openKeys: string[]) => any) | undefined;
64
56
  }, {
65
57
  prefixClsName: string;
58
+ props: any;
66
59
  emit: ((event: "collapse", collapsed: boolean) => void) & ((event: "menu-item-click", key: string) => void) & ((event: "sub-menu-click", key: string, openKeys: string[]) => void);
60
+ onMenuItemClick: (key: string) => void;
67
61
  ProMenuItem: DefineComponent<{
68
62
  item: {
69
63
  type: null;
@@ -111,10 +105,6 @@ declare const ProMenu: {
111
105
  type: PropType<string[]>;
112
106
  required: true;
113
107
  };
114
- openKeys: {
115
- type: PropType<string[]>;
116
- required: true;
117
- };
118
108
  items: {
119
109
  type: PropType<IProMenuItem[]>;
120
110
  required: true;
@@ -125,7 +115,9 @@ declare const ProMenu: {
125
115
  "onSub-menu-click"?: ((key: string, openKeys: string[]) => any) | undefined;
126
116
  } & ShallowUnwrapRef<{
127
117
  prefixClsName: string;
118
+ props: any;
128
119
  emit: ((event: "collapse", collapsed: boolean) => void) & ((event: "menu-item-click", key: string) => void) & ((event: "sub-menu-click", key: string, openKeys: string[]) => void);
120
+ onMenuItemClick: (key: string) => void;
129
121
  ProMenuItem: DefineComponent<{
130
122
  item: {
131
123
  type: null;
@@ -153,10 +145,6 @@ declare const ProMenu: {
153
145
  type: PropType<string[]>;
154
146
  required: true;
155
147
  };
156
- openKeys: {
157
- type: PropType<string[]>;
158
- required: true;
159
- };
160
148
  items: {
161
149
  type: PropType<IProMenuItem[]>;
162
150
  required: true;
@@ -167,7 +155,9 @@ declare const ProMenu: {
167
155
  "onSub-menu-click"?: ((key: string, openKeys: string[]) => any) | undefined;
168
156
  }, {
169
157
  prefixClsName: string;
158
+ props: any;
170
159
  emit: ((event: "collapse", collapsed: boolean) => void) & ((event: "menu-item-click", key: string) => void) & ((event: "sub-menu-click", key: string, openKeys: string[]) => void);
160
+ onMenuItemClick: (key: string) => void;
171
161
  ProMenuItem: DefineComponent<{
172
162
  item: {
173
163
  type: null;
@@ -14,6 +14,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
14
  if (!(item == null ? void 0 : item.path)) {
15
15
  return;
16
16
  }
17
+ if (item.path.startsWith("http") || item.path.startsWith("https")) {
18
+ window.open(item.path);
19
+ return;
20
+ }
17
21
  router.push({ path: item.path });
18
22
  };
19
23
  return (_ctx, _cache) => {
@@ -10,17 +10,15 @@ declare const _sfc_main: DefineComponent<{
10
10
  type: PropType<string[]>;
11
11
  required: true;
12
12
  };
13
- openKeys: {
14
- type: PropType<string[]>;
15
- required: true;
16
- };
17
13
  items: {
18
14
  type: PropType<IProMenuItem[]>;
19
15
  required: true;
20
16
  };
21
17
  }, {
22
18
  prefixClsName: string;
19
+ props: any;
23
20
  emit: ((event: "collapse", collapsed: boolean) => void) & ((event: "menu-item-click", key: string) => void) & ((event: "sub-menu-click", key: string, openKeys: string[]) => void);
21
+ onMenuItemClick: (key: string) => void;
24
22
  ProMenuItem: DefineComponent<{
25
23
  item: {
26
24
  type: null;
@@ -48,10 +46,6 @@ declare const _sfc_main: DefineComponent<{
48
46
  type: PropType<string[]>;
49
47
  required: true;
50
48
  };
51
- openKeys: {
52
- type: PropType<string[]>;
53
- required: true;
54
- };
55
49
  items: {
56
50
  type: PropType<IProMenuItem[]>;
57
51
  required: true;
@@ -11,10 +11,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11
11
  type: Array,
12
12
  required: true
13
13
  },
14
- openKeys: {
15
- type: Array,
16
- required: true
17
- },
18
14
  items: {
19
15
  type: Array,
20
16
  required: true
@@ -26,19 +22,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26
22
  "sub-menu-click": (key, openKeys) => true
27
23
  },
28
24
  setup(__props, { emit }) {
25
+ const props = __props;
29
26
  const prefixClsName = "keyblade-pro-menu";
27
+ const onMenuItemClick = (key) => {
28
+ let findItem;
29
+ const find = (items) => {
30
+ var _a;
31
+ for (let i = 0; i < items.length; i++) {
32
+ const item = items[i];
33
+ if (item.name === key) {
34
+ findItem = item;
35
+ return;
36
+ }
37
+ if ((item == null ? void 0 : item.children) && ((_a = item.children) == null ? void 0 : _a.length) > 0) {
38
+ find(item.children);
39
+ }
40
+ }
41
+ };
42
+ find(props.items);
43
+ if (findItem && (findItem.path.startsWith("http") || findItem.path.startsWith("https"))) {
44
+ return;
45
+ }
46
+ emit("menu-item-click", key);
47
+ };
30
48
  return (_ctx, _cache) => {
31
49
  const _component_a_menu = resolveComponent("a-menu");
32
50
  return openBlock(), createBlock(_component_a_menu, {
33
51
  class: normalizeClass(prefixClsName),
34
52
  collapsed: __props.collapsed,
35
- "open-keys": __props.openKeys,
36
53
  "selected-keys": __props.selectedKeys,
37
54
  "show-collapse-button": "",
55
+ "auto-open-selected": "",
38
56
  breakpoint: "md",
39
57
  onCollapse: _cache[0] || (_cache[0] = ($event) => emit("collapse", $event)),
40
- onMenuItemClick: _cache[1] || (_cache[1] = ($event) => emit("menu-item-click", $event)),
41
- onSubMenuClick: _cache[2] || (_cache[2] = (_key, _openKeys) => emit("sub-menu-click", _key, _openKeys))
58
+ onMenuItemClick,
59
+ onSubMenuClick: _cache[1] || (_cache[1] = (_key, _openKeys) => emit("sub-menu-click", _key, _openKeys))
42
60
  }, {
43
61
  default: withCtx(() => [
44
62
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
@@ -49,7 +67,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
67
  }), 128))
50
68
  ]),
51
69
  _: 1
52
- }, 8, ["collapsed", "open-keys", "selected-keys"]);
70
+ }, 8, ["collapsed", "selected-keys"]);
53
71
  };
54
72
  }
55
73
  });
@@ -4,6 +4,8 @@
4
4
  export interface IProTab {
5
5
  /** 菜单名称 */
6
6
  name: string;
7
+ /** 所有父级且包含自己的所有名称(主要用作路由缓存) */
8
+ parentNames: string[];
7
9
  /** 菜单标题 */
8
10
  title: string;
9
11
  /** 完整路径 */
package/es/style.css CHANGED
@@ -18,7 +18,7 @@
18
18
  top: 0;
19
19
  left: 0;
20
20
  width: 100%;
21
- height: 60px;
21
+ height: var(--aa0adaee);
22
22
  z-index: 100;
23
23
  display: flex;
24
24
  align-items: center;
@@ -40,7 +40,7 @@
40
40
  font-size: 18px;
41
41
  }
42
42
  .keyblade-pro-layout-sider {
43
- padding-top: 60px;
43
+ padding-top: var(--aa0adaee);
44
44
  position: fixed;
45
45
  top: 0;
46
46
  left: 0;
@@ -55,8 +55,8 @@
55
55
  overflow: auto;
56
56
  }
57
57
  .keyblade-pro-layout-body {
58
- padding-top: 60px;
59
- padding-left: var(--499b6380);
58
+ padding-top: var(--aa0adaee);
59
+ padding-left: var(--f32a33f8);
60
60
  min-height: 100vh;
61
61
  overflow-y: hidden;
62
62
  background-color: var(--color-fill-2);
@@ -76,5 +76,5 @@
76
76
  text-align: center;
77
77
  }
78
78
  .keyblade-pro-layout-body-collapsed {
79
- padding-left: var(--5e353345);
79
+ padding-left: var(--5b964541);
80
80
  }
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.4",
5
+ "version": "0.0.6",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",