@gx-design-vue/pro-layout 0.1.0-alpha.5 → 0.1.0-alpha.7

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 (47) hide show
  1. package/dist/ProLayout.js +58 -50
  2. package/dist/components/AppPage/index.d.ts +10 -41
  3. package/dist/components/AppPage/index.js +33 -22
  4. package/dist/components/Breadcrumb/index.js +6 -22
  5. package/dist/components/CollapseButton/index.js +3 -3
  6. package/dist/components/CollapseButton/interface.d.ts +0 -1
  7. package/dist/components/Footer/index.js +4 -6
  8. package/dist/components/FooterToolbar/index.js +2 -3
  9. package/dist/components/Header/index.js +9 -5
  10. package/dist/components/Header/interface.d.ts +6 -0
  11. package/dist/components/Logo/index.d.ts +1 -1
  12. package/dist/components/Logo/index.js +4 -6
  13. package/dist/components/Logo/interface.d.ts +1 -2
  14. package/dist/components/{Sider → Menu}/SiderMenu.d.ts +4 -2
  15. package/dist/components/{Sider → Menu}/SiderMenu.js +18 -26
  16. package/dist/components/Menu/iconRender.d.ts +10 -0
  17. package/dist/components/Menu/iconRender.js +23 -0
  18. package/dist/components/Menu/index.js +3 -17
  19. package/dist/components/{Sider/style.d.ts → Menu/style/siderMenu.d.ts} +1 -1
  20. package/dist/components/{Sider/style.js → Menu/style/siderMenu.js} +6 -6
  21. package/dist/components/PageContainer/PageHeader.d.ts +0 -3
  22. package/dist/components/PageContainer/PageHeader.js +5 -13
  23. package/dist/components/PageContainer/index.js +12 -19
  24. package/dist/components/PageTransition/index.d.ts +2 -2
  25. package/dist/components/PageTransition/index.js +1 -1
  26. package/dist/components/Sider/index.js +58 -16
  27. package/dist/components/Sider/interface.d.ts +6 -3
  28. package/dist/components/Tabs/contextMenu.js +12 -10
  29. package/dist/components/Tabs/index.js +21 -17
  30. package/dist/context/index.d.ts +4 -2
  31. package/dist/defaultConfig.d.ts +1 -1
  32. package/dist/defaultConfig.js +4 -4
  33. package/dist/hooks/useLayoutBase.d.ts +10 -9
  34. package/dist/hooks/useLayoutBase.js +5 -1
  35. package/dist/hooks/useTabs.d.ts +2 -6
  36. package/dist/hooks/useTabs.js +4 -6
  37. package/dist/index.d.ts +2 -2
  38. package/dist/interface.d.ts +18 -21
  39. package/dist/interface.js +0 -2
  40. package/dist/pro-layout.esm.js +1339 -1834
  41. package/dist/pro-layout.js +15 -1
  42. package/dist/style/logo.js +1 -2
  43. package/dist/style/sider.js +29 -14
  44. package/dist/theme/augment.d.ts +6 -6
  45. package/dist/theme/interface/components.d.ts +6 -6
  46. package/dist/utils/themeComponents.d.ts +1 -1
  47. package/package.json +8 -10
package/dist/ProLayout.js CHANGED
@@ -13,7 +13,7 @@ import { normalizeSectionConfig } from "./utils/config.js";
13
13
  import { computed, createVNode, defineComponent, mergeDefaults, ref } from "vue";
14
14
  import { ThemeContext, useThemeContext } from "@gx-design-vue/context";
15
15
  import { GProConfigProvider, useProToken } from "@gx-design-vue/pro-provider";
16
- import { classNames, getSlot, getSlotsProps } from "@gx-design-vue/pro-utils";
16
+ import { classNames, getSlotsProps } from "@gx-design-vue/pro-utils";
17
17
  import { useDark, useMediaQuery, useVModel } from "@vueuse/core";
18
18
  import { ConfigProvider, Layout } from "antdv-next";
19
19
  import { useBaseConfig } from "antdv-next/config-provider/context";
@@ -112,18 +112,39 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
112
112
  }
113
113
  if (target.path && router.currentRoute.value.fullPath !== target.path) router.push(target.path);
114
114
  }
115
+ const logoConfig = computed(() => normalizeSectionConfig(props.logo, DEFAULT_LAYOUT_CONFIG.logo));
116
+ const collapseConfig = computed(() => normalizeSectionConfig(props.collapse, DEFAULT_LAYOUT_CONFIG.collapse));
117
+ const footerConfig = computed(() => normalizeSectionConfig(props.footerConfig, DEFAULT_LAYOUT_CONFIG.footerConfig));
118
+ const breadcrumbConfig = computed(() => normalizeSectionConfig(props.breadcrumb, DEFAULT_LAYOUT_CONFIG.breadcrumb));
119
+ const pageContainerConfig = computed(() => ({
120
+ ...DEFAULT_LAYOUT_CONFIG.pageContainerConfig,
121
+ ...props.pageContainer || {}
122
+ }));
115
123
  const tabsConf = computed(() => normalizeSectionConfig(props.tabsConfig, DEFAULT_LAYOUT_CONFIG.tabsConfig));
116
124
  const tabsStateConfig = computed(() => tabsConf.value ?? {});
125
+ const tabsModel = useVModel(props, "tabs", emit, {
126
+ passive: true,
127
+ defaultValue: []
128
+ });
129
+ const collapsedWidth = computed(() => collapseConfig.value?.width ?? DEFAULT_LAYOUT_CONFIG.collapse.width);
130
+ /** Sider 实际渲染宽度:0 表示不可见,否则 = 折叠/展开的真实宽度 */
131
+ const siderWidth = computed(() => {
132
+ const width = props.sider?.width ?? DEFAULT_LAYOUT_CONFIG.sider.width;
133
+ if (!width) return 0;
134
+ if (contentFullscreen.value) return 0;
135
+ if (![
136
+ "side",
137
+ "mix",
138
+ "wide"
139
+ ].includes(layout.value ?? "")) return 0;
140
+ if (props.sider?.hideWhenEmpty && menuState.siderMenus.value.length === 0) return 0;
141
+ return collapsed.value ? collapsedWidth.value : width;
142
+ });
117
143
  const tabsState = useTabsState({
118
- tabs: useVModel(props, "tabs", emit, {
119
- passive: true,
120
- defaultValue: []
121
- }),
144
+ tabs: tabsModel,
122
145
  config: tabsStateConfig,
123
146
  flatMenus: menuState.flatMenus,
124
- collapsed,
125
- siderWidth: props.sider?.width ?? DEFAULT_LAYOUT_CONFIG.sider.width,
126
- collapseWidth: props.collapseConfig ? props.collapseConfig.width ?? DEFAULT_LAYOUT_CONFIG.collapseConfig.width : DEFAULT_LAYOUT_CONFIG.collapseConfig.width,
147
+ siderWidth,
127
148
  isMobile: computed(() => isMobile.value),
128
149
  contentFullscreen,
129
150
  onTabsChange: (val) => {
@@ -163,14 +184,6 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
163
184
  function handleLogoClick() {
164
185
  emit("logoClick");
165
186
  }
166
- const logoConfig = computed(() => normalizeSectionConfig(props.logoConfig, DEFAULT_LAYOUT_CONFIG.logoConfig));
167
- const collapseConfig = computed(() => normalizeSectionConfig(props.collapseConfig, DEFAULT_LAYOUT_CONFIG.collapseConfig));
168
- const footerConfig = computed(() => normalizeSectionConfig(props.footerConfig, DEFAULT_LAYOUT_CONFIG.footerConfig));
169
- const breadcrumbConfig = computed(() => normalizeSectionConfig(props.breadcrumbConfig, DEFAULT_LAYOUT_CONFIG.breadcrumbConfig));
170
- const pageContainerConfig = computed(() => ({
171
- ...DEFAULT_LAYOUT_CONFIG.pageContainerConfig,
172
- ...props.pageContainerConfig || {}
173
- }));
174
187
  const showHeader = computed(() => !contentFullscreen.value && layout.value !== "simple" && props.header?.height !== 0);
175
188
  const showSider = computed(() => !contentFullscreen.value && [
176
189
  "side",
@@ -194,6 +207,8 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
194
207
  })),
195
208
  menuState,
196
209
  logoConfig,
210
+ siderWidth,
211
+ collapsedWidth,
197
212
  breadcrumbConfig,
198
213
  pageContainerConfig,
199
214
  watermark: computed(() => props.watermark),
@@ -227,17 +242,7 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
227
242
  keys: LAYOUT_SLOT_KEYS,
228
243
  render: false
229
244
  });
230
- const normalized = Object.fromEntries(Object.entries(merged).map(([key, value]) => [key, typeof value === "function" ? value : () => value]));
231
- if (slots.logo) normalized.logo = slots.logo;
232
- if (props.collapseConfig) {
233
- const collapseIconSlot = getSlot({
234
- slots,
235
- props: { collapseIcon: props.collapseConfig.icon },
236
- key: "collapseIcon"
237
- });
238
- if (collapseIconSlot) normalized.collapseIcon = collapseIconSlot;
239
- }
240
- return normalized;
245
+ return Object.fromEntries(Object.entries(merged).map(([key, value]) => [key, typeof value === "function" ? value : () => value]));
241
246
  }
242
247
  return () => {
243
248
  if (props.pure) return slots.default?.();
@@ -253,12 +258,17 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
253
258
  "showSider": showSider.value,
254
259
  "proClasses": props.proClasses,
255
260
  "proStyles": props.proStyles
256
- }, { default: () => [showSider.value && createVNode(LayoutSider$1, {
261
+ }, { default: () => [showSider.value && siderWidth.value && createVNode(LayoutSider$1, {
257
262
  "onSelect": handleSelect,
258
263
  "onOpenChange": handleOpenChange,
259
264
  "onLogoClick": handleLogoClick,
260
265
  "onUpdate:collapsed": handleCollapsedUpdate
261
- }, layoutSlots), createVNode("div", {
266
+ }, {
267
+ ...layoutSlots,
268
+ logo: slots.logo,
269
+ collapse: slots.collapse,
270
+ collapseIcon: slots.collapseIcon
271
+ }), createVNode("div", {
262
272
  "style": { position: "relative" },
263
273
  "class": `${prefixCls.value}-container`,
264
274
  "data-testid": "pro-layout-container"
@@ -267,7 +277,13 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
267
277
  "onLogoClick": handleLogoClick,
268
278
  "onUpdate:collapsed": handleCollapsedUpdate,
269
279
  "onSelect": handleSelect
270
- }, layoutSlots),
280
+ }, {
281
+ ...layoutSlots,
282
+ logo: slots.logo,
283
+ collapse: slots.collapse,
284
+ breadcrumb: slots.breadcrumb,
285
+ collapseIcon: slots.collapseIcon
286
+ }),
271
287
  tabsConf.value && createVNode(LayoutTabs, {
272
288
  "config": tabsConf.value,
273
289
  "onReloadPage": () => emit("reloadPage"),
@@ -364,7 +380,7 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
364
380
  type: Object,
365
381
  required: false
366
382
  },
367
- breadcrumbConfig: {
383
+ breadcrumb: {
368
384
  type: [Object, Boolean],
369
385
  required: false,
370
386
  default: void 0
@@ -374,17 +390,17 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
374
390
  required: false,
375
391
  default: void 0
376
392
  },
377
- logoConfig: {
393
+ logo: {
378
394
  type: [Object, Boolean],
379
395
  required: false,
380
396
  default: void 0
381
397
  },
382
- collapseConfig: {
398
+ collapse: {
383
399
  type: [Object, Boolean],
384
400
  required: false,
385
401
  default: void 0
386
402
  },
387
- pageContainerConfig: {
403
+ pageContainer: {
388
404
  type: Object,
389
405
  required: false
390
406
  },
@@ -399,12 +415,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
399
415
  headerRightExtra: {
400
416
  type: [
401
417
  Function,
402
- Object,
403
418
  String,
404
419
  Number,
405
- Boolean,
406
420
  null,
407
- Array
421
+ Object,
422
+ Boolean
408
423
  ],
409
424
  required: false,
410
425
  default: void 0
@@ -420,12 +435,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
420
435
  siderExtra: {
421
436
  type: [
422
437
  Function,
423
- Object,
424
438
  String,
425
439
  Number,
426
- Boolean,
427
440
  null,
428
- Array
441
+ Object,
442
+ Boolean
429
443
  ],
430
444
  required: false,
431
445
  default: void 0
@@ -446,10 +460,6 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
446
460
  type: Function,
447
461
  required: false
448
462
  },
449
- breadcrumb: {
450
- type: Function,
451
- required: false
452
- },
453
463
  tabBarItem: {
454
464
  type: Function,
455
465
  required: false
@@ -457,12 +467,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
457
467
  footer: {
458
468
  type: [
459
469
  Function,
460
- Object,
461
470
  String,
462
471
  Number,
463
- Boolean,
464
472
  null,
465
- Array
473
+ Object,
474
+ Boolean
466
475
  ],
467
476
  required: false,
468
477
  default: void 0
@@ -470,12 +479,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
470
479
  copyright: {
471
480
  type: [
472
481
  Function,
473
- Object,
474
482
  String,
475
483
  Number,
476
- Boolean,
477
484
  null,
478
- Array
485
+ Object,
486
+ Boolean
479
487
  ],
480
488
  required: false,
481
489
  default: void 0
@@ -1,7 +1,7 @@
1
1
  import { AppPageSpinning } from "../../interface.js";
2
2
  import * as _$vue from "vue";
3
3
  import { CSSProperties, PropType, SlotsType } from "vue";
4
- import * as _$_gx_design_vue_pro_utils0 from "@gx-design-vue/pro-utils";
4
+ import { CustomRender } from "@gx-design-vue/pro-utils";
5
5
  import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
6
6
 
7
7
  //#region src/components/AppPage/index.d.ts
@@ -12,65 +12,34 @@ import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
12
12
  * ③ 经 GProApp context 向后代下发 emptyText / indicator(供 pro-table 等空态/加载态复用)。
13
13
  */
14
14
  declare const ProAppPage: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
15
+ class: PropType<string>;
16
+ style: PropType<CSSProperties>;
17
+ prefixCls: PropType<string>;
15
18
  spinning: {
16
19
  type: PropType<AppPageSpinning>;
17
20
  default: () => {};
18
21
  };
19
- class: {
20
- type: StringConstructor;
21
- default: any;
22
- };
23
- prefixCls: {
24
- type: StringConstructor;
25
- default: any;
26
- };
27
- style: {
28
- type: PropType<CSSProperties>;
29
- default: any;
30
- };
31
- emptyText: {
32
- type: PropType<_$_gx_design_vue_pro_utils0.WithFalse<_$_gx_design_vue_pro_utils0.CustomRender>>;
33
- default: any;
34
- };
35
22
  indicator: {
36
- type: PropType<_$_gx_design_vue_pro_utils0.WithFalse<_$_gx_design_vue_pro_utils0.CustomRender>>;
23
+ type: PropType<CustomRender>;
37
24
  default: any;
38
25
  };
39
26
  }>, () => _$vue_jsx_runtime0.JSX.Element, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
27
+ class: PropType<string>;
28
+ style: PropType<CSSProperties>;
29
+ prefixCls: PropType<string>;
40
30
  spinning: {
41
31
  type: PropType<AppPageSpinning>;
42
32
  default: () => {};
43
33
  };
44
- class: {
45
- type: StringConstructor;
46
- default: any;
47
- };
48
- prefixCls: {
49
- type: StringConstructor;
50
- default: any;
51
- };
52
- style: {
53
- type: PropType<CSSProperties>;
54
- default: any;
55
- };
56
- emptyText: {
57
- type: PropType<_$_gx_design_vue_pro_utils0.WithFalse<_$_gx_design_vue_pro_utils0.CustomRender>>;
58
- default: any;
59
- };
60
34
  indicator: {
61
- type: PropType<_$_gx_design_vue_pro_utils0.WithFalse<_$_gx_design_vue_pro_utils0.CustomRender>>;
35
+ type: PropType<CustomRender>;
62
36
  default: any;
63
37
  };
64
38
  }>> & Readonly<{}>, {
65
- emptyText: _$_gx_design_vue_pro_utils0.CustomRender;
66
- indicator: _$_gx_design_vue_pro_utils0.CustomRender;
67
- prefixCls: string;
39
+ indicator: CustomRender;
68
40
  spinning: AppPageSpinning;
69
- class: string;
70
- style: CSSProperties;
71
41
  }, SlotsType<{
72
42
  default: () => any;
73
- emptyText: () => any;
74
43
  indicator: () => any;
75
44
  }>, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
76
45
  //#endregion
@@ -1,13 +1,11 @@
1
- import { APP_PAGE_SLOT_KEYS } from "../../interface.js";
2
1
  import { provideAppPageContext } from "./context.js";
3
2
  import style_default from "./style.js";
4
3
  import { computed, createVNode, defineComponent } from "vue";
5
- import { classNames } from "@gx-design-vue/pro-utils";
4
+ import { useProConfigContext } from "@gx-design-vue/pro-provider";
5
+ import { classNames, getSlotVNode } from "@gx-design-vue/pro-utils";
6
6
  import { useBaseConfig } from "antdv-next/config-provider/context";
7
7
  import useCSSVarCls from "antdv-next/config-provider/hooks/useCSSVarCls";
8
8
  import { GIcon } from "@gx-design-vue/icon";
9
- import { GProApp, proAppProps } from "@gx-design-vue/pro-app";
10
- import { useSlotsProps } from "@gx-design-vue/pro-hooks";
11
9
  import { GScrollbar } from "@gx-design-vue/scrollbar";
12
10
  //#region src/components/AppPage/index.tsx
13
11
  const SCROLLBAR_BAR_STYLE = {
@@ -29,10 +27,22 @@ const ProAppPage = /* @__PURE__ */ defineComponent({
29
27
  name: "GProAppPage",
30
28
  inheritAttrs: false,
31
29
  props: {
32
- ...proAppProps,
30
+ class: String,
31
+ style: Object,
32
+ prefixCls: String,
33
33
  spinning: {
34
34
  type: Object,
35
35
  default: () => ({})
36
+ },
37
+ indicator: {
38
+ type: [
39
+ Object,
40
+ Function,
41
+ Boolean,
42
+ Array,
43
+ String
44
+ ],
45
+ default: void 0
36
46
  }
37
47
  },
38
48
  slots: Object,
@@ -40,37 +50,38 @@ const ProAppPage = /* @__PURE__ */ defineComponent({
40
50
  const { prefixCls } = useBaseConfig("pro-app-page", props);
41
51
  const rootCls = useCSSVarCls(prefixCls);
42
52
  const [hashId, cssVarCls] = style_default(prefixCls, rootCls);
43
- const slotRenders = useSlotsProps({
44
- slots,
45
- props,
46
- keys: APP_PAGE_SLOT_KEYS,
47
- render: true
48
- });
53
+ const configContext = useProConfigContext();
49
54
  const loading = computed(() => props.spinning?.loading ?? false);
50
55
  provideAppPageContext({ spinning: computed(() => props.spinning?.loading) });
51
- const resolvedIndicator = computed(() => slotRenders.value.indicator ?? createVNode(GIcon, {
52
- "type": "Spinning",
53
- "spin": true,
54
- "class": `${prefixCls.value}-spin-dot ${hashId.value}`
55
- }, null));
56
+ const resolvedIndicator = computed(() => {
57
+ const indicator = getSlotVNode({
58
+ slots,
59
+ key: "indicator",
60
+ props
61
+ });
62
+ if (indicator) return indicator;
63
+ return typeof configContext?.indicator?.value === "function" ? configContext?.indicator?.value?.() : configContext?.indicator?.value || createVNode(GIcon, {
64
+ "type": "Spinning",
65
+ "spin": true,
66
+ "class": `${prefixCls.value}-spin-dot ${hashId.value}`
67
+ }, null);
68
+ });
56
69
  const rootClassNames = computed(() => classNames(prefixCls.value, hashId.value, cssVarCls.value, rootCls.value, loading.value && `${prefixCls.value}-loading`, props.class));
57
70
  const maskStyle = computed(() => ({
58
71
  zIndex: props.spinning?.blur ? 999 : void 0,
59
72
  backgroundColor: props.spinning?.blur ? void 0 : "unset",
60
73
  ...props.spinning?.style || {}
61
74
  }));
62
- return () => createVNode(GProApp, {
75
+ return () => createVNode("div", {
63
76
  "class": rootClassNames.value,
64
- "style": props.style,
65
- "emptyText": slotRenders.value.emptyText,
66
- "indicator": resolvedIndicator.value
67
- }, { default: () => [createVNode(GScrollbar, {
77
+ "style": props.style
78
+ }, [createVNode(GScrollbar, {
68
79
  "barStyle": SCROLLBAR_BAR_STYLE,
69
80
  "viewStyle": SCROLLBAR_VIEW_STYLE
70
81
  }, { default: () => [slots.default?.()] }), loading.value && createVNode("div", {
71
82
  "class": classNames(`${prefixCls.value}-blur`, hashId.value),
72
83
  "style": maskStyle.value
73
- }, [createVNode("div", { "class": `${prefixCls.value}-spin` }, [resolvedIndicator.value])])] });
84
+ }, [createVNode("div", { "class": `${prefixCls.value}-spin` }, [resolvedIndicator.value])])]);
74
85
  }
75
86
  });
76
87
  //#endregion
@@ -1,31 +1,15 @@
1
1
  import { useLayoutBase } from "../../hooks/useLayoutBase.js";
2
- import { Fragment, computed, createTextVNode, createVNode, defineComponent, isVNode } from "vue";
3
- import { classNames, isImg, isString, isUrl } from "@gx-design-vue/pro-utils";
2
+ import { renderMenuIcon } from "../Menu/iconRender.js";
3
+ import { Fragment, computed, createTextVNode, createVNode, defineComponent } from "vue";
4
+ import { classNames } from "@gx-design-vue/pro-utils";
4
5
  import { Dropdown } from "antdv-next";
5
- import { DownOutlined } from "@antdv-next/icons";
6
6
  import { GIcon } from "@gx-design-vue/icon";
7
7
  //#region src/components/Breadcrumb/index.tsx
8
8
  /** 首页占位路由名 */
9
9
  const BREADCRUMB_HOME_KEY = "__breadcrumb_home__";
10
- /**
11
- * 渲染面包屑图标:兼容 VNode / 组件 / 图片地址 / 图标名。
12
- * 复用 LayoutMenu 的 renderMenuIcon 模式。
13
- */
14
- function renderBreadcrumbIcon(icon) {
15
- if (!icon) return null;
16
- if (isVNode(icon)) return icon;
17
- if (isString(icon)) {
18
- if (isUrl(icon) || isImg(icon)) return createVNode("img", {
19
- "src": icon,
20
- "alt": "icon"
21
- }, null);
22
- return createVNode(GIcon, { "type": icon }, null);
23
- }
24
- return null;
25
- }
26
10
  /** 渲染默认面包屑项内容(图标 + 标题) */
27
11
  function renderBreadcrumbItemContent(prefixCls, route) {
28
- const iconNode = renderBreadcrumbIcon(route.meta?.icon);
12
+ const iconNode = renderMenuIcon(route.meta?.icon);
29
13
  return createVNode(Fragment, null, [iconNode && createVNode("span", { "class": `${prefixCls}-item-icon` }, [iconNode]), createVNode("span", null, [route.meta?.title])]);
30
14
  }
31
15
  /**
@@ -94,11 +78,11 @@ const Breadcrumb = /* @__PURE__ */ defineComponent((props, { slots }) => {
94
78
  items: dropdownChildren.map((child) => ({
95
79
  key: child.name,
96
80
  label: child.meta?.title ?? child.name,
97
- icon: renderBreadcrumbIcon(child.meta?.icon)
81
+ icon: renderMenuIcon(child.meta?.icon)
98
82
  })),
99
83
  selectedKeys: dropdownSelectedKeys,
100
84
  onClick: ({ key }) => handleDropdownMenuClick(String(key))
101
- } }, { default: () => [createVNode("span", { "class": `${breadcrumbCls}-overlay-link` }, [itemContent, createVNode(DownOutlined, null, null)])] }) : createVNode("span", {
85
+ } }, { default: () => [createVNode("span", { "class": `${breadcrumbCls}-overlay-link` }, [itemContent, createVNode(GIcon, { "type": "DownOutlined" }, null)])] }) : createVNode("span", {
102
86
  "class": classNames(`${breadcrumbCls}-link`, isLast && `${breadcrumbCls}-link-last`),
103
87
  "onClick": () => handleItemClick(route, isLast)
104
88
  }, [itemContent])]), !isLast && createVNode("li", { "class": `${breadcrumbCls}-separator` }, [createTextVNode("/")])]);
@@ -1,7 +1,8 @@
1
1
  import { useLayoutBase } from "../../hooks/useLayoutBase.js";
2
+ import { ArrowSvgIcon } from "./Arrow.js";
2
3
  import { computed, createVNode, defineComponent } from "vue";
3
4
  import { classNames } from "@gx-design-vue/pro-utils";
4
- import { MenuFoldOutlined, MenuUnfoldOutlined } from "@antdv-next/icons";
5
+ import { GIcon } from "@gx-design-vue/icon";
5
6
  //#region src/components/CollapseButton/index.tsx
6
7
  const LayoutCollapseButton = /* @__PURE__ */ defineComponent((props, { emit, slots }) => {
7
8
  const { prefixCls, collapseConfig } = useLayoutBase();
@@ -11,7 +12,6 @@ const LayoutCollapseButton = /* @__PURE__ */ defineComponent((props, { emit, slo
11
12
  emit("click", event);
12
13
  }
13
14
  return () => {
14
- if (slots.default) return slots.default();
15
15
  return createVNode("div", {
16
16
  "class": collapseButtonClassNames.value,
17
17
  "role": "button",
@@ -24,7 +24,7 @@ const LayoutCollapseButton = /* @__PURE__ */ defineComponent((props, { emit, slo
24
24
  handleClick(event);
25
25
  }
26
26
  }
27
- }, [collapseConfig?.value ? slots.icon?.({ collapsed: props.collapsed }) : props.collapsed ? createVNode(MenuUnfoldOutlined, null, null) : createVNode(MenuFoldOutlined, null, null)]);
27
+ }, [slots.icon?.({ collapsed: props.collapsed }) || placement.value === "sider" ? createVNode(ArrowSvgIcon, null, null) : createVNode(GIcon, { "type": props.collapsed ? "MenuUnfoldOutlined" : "MenuFoldOutlined" }, null)]);
28
28
  };
29
29
  }, {
30
30
  props: {
@@ -14,7 +14,6 @@ interface LayoutCollapseButtonSlots {
14
14
  icon?: (props: {
15
15
  collapsed: boolean;
16
16
  }) => any;
17
- default?: () => any;
18
17
  }
19
18
  //#endregion
20
19
  export { LayoutCollapseButtonEmits, LayoutCollapseButtonEmitsProps, LayoutCollapseButtonProps, LayoutCollapseButtonSlots };
@@ -41,12 +41,11 @@ const LayoutFooter = /* @__PURE__ */ defineComponent((props, { slots }) => {
41
41
  footer: {
42
42
  type: [
43
43
  Function,
44
- Object,
45
44
  String,
46
45
  Number,
47
- Boolean,
48
46
  null,
49
- Array
47
+ Object,
48
+ Boolean
50
49
  ],
51
50
  required: false,
52
51
  default: void 0
@@ -54,12 +53,11 @@ const LayoutFooter = /* @__PURE__ */ defineComponent((props, { slots }) => {
54
53
  copyrightRender: {
55
54
  type: [
56
55
  Function,
57
- Object,
58
56
  String,
59
57
  Number,
60
- Boolean,
61
58
  null,
62
- Array
59
+ Object,
60
+ Boolean
63
61
  ],
64
62
  required: false,
65
63
  default: void 0
@@ -66,12 +66,11 @@ const GFooterToolbar = /* @__PURE__ */ defineComponent((props, { slots }) => {
66
66
  extra: {
67
67
  type: [
68
68
  Function,
69
- Object,
70
69
  String,
71
70
  Number,
72
- Boolean,
73
71
  null,
74
- Array
72
+ Object,
73
+ Boolean
75
74
  ],
76
75
  required: false,
77
76
  default: void 0
@@ -63,7 +63,8 @@ const Header = /* @__PURE__ */ defineComponent((props, { emit, slots }) => {
63
63
  items,
64
64
  routes
65
65
  };
66
- const customBreadcrumb = breadcrumbRender.value?.(slotProps) ?? slots.breadcrumb?.(slotProps);
66
+ const breadcrumb = slots.breadcrumb || breadcrumbConfig.value?.render;
67
+ const customBreadcrumb = breadcrumbRender.value?.(slotProps) ?? breadcrumb?.(slotProps);
67
68
  if (customBreadcrumb) return createVNode("div", {
68
69
  "class": classNames(`${prefixCls.value}-header-breadcrumb`, proClasses.value.breadcrumb),
69
70
  "style": proStyles.value.breadcrumb
@@ -76,6 +77,9 @@ const Header = /* @__PURE__ */ defineComponent((props, { emit, slots }) => {
76
77
  }
77
78
  return () => {
78
79
  const showHeaderMenu = ["top", "mix"].includes(layout.value ?? "");
80
+ const logoRender = slots.logo || logoConfig.value?.render;
81
+ const collapseRender = slots.collapse || collapseConfig.value?.render;
82
+ const collapseIconRender = slots.collapseIcon || collapseConfig.value?.icon;
79
83
  return createVNode(Fragment, null, [header.value?.fixed && createVNode(LayoutHeader, { "style": {
80
84
  background: "transparent",
81
85
  lineHeight: unit(header.value?.height),
@@ -88,14 +92,14 @@ const Header = /* @__PURE__ */ defineComponent((props, { emit, slots }) => {
88
92
  }
89
93
  }, { default: () => [createVNode("div", { "class": `${prefixCls.value}-header-main` }, [
90
94
  createVNode("div", { "class": `${prefixCls.value}-header-main-left` }, [
91
- showLogo.value && (slots.logo?.({
95
+ showLogo.value && logoConfig.value && (typeof logoRender === "function" ? logoRender?.({
92
96
  collapsed: collapsed.value,
93
97
  title: logoTitle.value
94
- }) ?? (logoConfig.value ? createVNode(LayoutLogo, { "onClick": handleLogoClick }, null) : null)),
95
- collapseConfig.value && collapseConfig.value.placement === "header" && (slots.collapseButton?.({ collapsed: collapsed.value }) ?? createVNode(LayoutCollapseButton, {
98
+ }) : createVNode(LayoutLogo, { "onClick": handleLogoClick }, slots)),
99
+ collapseConfig.value && collapseConfig.value.placement === "header" && (collapseRender?.({ collapsed: collapsed.value }) ?? createVNode(LayoutCollapseButton, {
96
100
  "collapsed": collapsed.value,
97
101
  "onClick": handleToggleCollapsed
98
- }, { icon: collapseConfig.value.icon })),
102
+ }, { icon: collapseIconRender })),
99
103
  renderBreadcrumb()
100
104
  ]),
101
105
  slots.headerContent?.({
@@ -20,6 +20,12 @@ interface LayoutHeaderSlots {
20
20
  collapsed: boolean;
21
21
  title?: string;
22
22
  }) => any;
23
+ collapse?: (props: {
24
+ collapsed: boolean;
25
+ }) => any;
26
+ collapseIcon?: (props: {
27
+ collapsed: boolean;
28
+ }) => any;
23
29
  breadcrumb?: (props: LayoutBreadcrumbSlotProps) => any;
24
30
  headerContent?: (props: LayoutHeaderSlotProps) => any;
25
31
  headerRight?: (props: LayoutHeaderSlotProps) => any;
@@ -4,7 +4,7 @@ import { SlotsType } from "vue";
4
4
  import { CustomRender } from "@gx-design-vue/pro-utils";
5
5
 
6
6
  //#region src/components/Logo/index.d.ts
7
- declare function defaultRenderLogo(logo?: CustomRender | false): CustomRender;
7
+ declare function defaultRenderLogo(logo?: CustomRender | false): any;
8
8
  declare const LayoutLogo: _$vue.DefineSetupFnComponent<LayoutLogoEmitsProps, LayoutLogoEmits, SlotsType<LayoutLogoSlots>, LayoutLogoEmitsProps, _$vue.PublicProps>;
9
9
  //#endregion
10
10
  export { LayoutLogo as default, defaultRenderLogo };
@@ -18,7 +18,7 @@ const LayoutLogo = /* @__PURE__ */ defineComponent((_props, { emit, slots }) =>
18
18
  if (!logoConfig?.value) return "";
19
19
  return logoConfig?.value.title;
20
20
  });
21
- const logoSource = computed(() => !logoConfig?.value ? false : logoConfig?.value.logo);
21
+ const logoSource = computed(() => logoConfig?.value.image);
22
22
  const hideTitle = computed(() => collapsed.value && ["side", "simple"].includes(layout.value ?? ""));
23
23
  const showLogo = computed(() => !collapsed.value || !!collapsedWidth.value);
24
24
  const logoClassNames = computed(() => classNames(`${prefixCls.value}-logo`, proClasses.value.logo, {
@@ -29,15 +29,13 @@ const LayoutLogo = /* @__PURE__ */ defineComponent((_props, { emit, slots }) =>
29
29
  emit("click");
30
30
  }
31
31
  return () => {
32
- if (slots.default) return slots.default();
33
- const logo = slots.logo ? slots.logo() : defaultRenderLogo(logoSource.value);
34
- const hasLogo = logo !== null && logo !== void 0 && logo !== false;
32
+ const image = slots.image ? slots.image() : defaultRenderLogo(logoSource.value);
35
33
  const titleDom = title.value && !hideTitle.value ? createVNode("h1", null, [title.value]) : null;
36
34
  return createVNode("div", {
37
35
  "class": logoClassNames.value,
38
36
  "style": proStyles.value.logo,
39
37
  "onClick": handleClick
40
- }, [createVNode("a", null, [showLogo.value && hasLogo && createVNode("span", {
38
+ }, [createVNode("a", null, [showLogo.value && image && createVNode("span", {
41
39
  "class": proClasses.value.logoImage,
42
40
  "style": {
43
41
  display: "inline-flex",
@@ -45,7 +43,7 @@ const LayoutLogo = /* @__PURE__ */ defineComponent((_props, { emit, slots }) =>
45
43
  fontSize: 22,
46
44
  ...proStyles.value.logoImage
47
45
  }
48
- }, [logo]), titleDom])]);
46
+ }, [image]), titleDom])]);
49
47
  };
50
48
  }, {
51
49
  props: { onClick: {
@@ -7,8 +7,7 @@ interface LayoutLogoEmitsProps {
7
7
  }
8
8
  type LayoutLogoProps = LayoutLogoEmitsProps;
9
9
  interface LayoutLogoSlots {
10
- logo?: () => any;
11
- default?: () => any;
10
+ image?: () => any;
12
11
  }
13
12
  //#endregion
14
13
  export { LayoutLogoEmits, LayoutLogoEmitsProps, LayoutLogoProps, LayoutLogoSlots };