@gx-design-vue/pro-layout 0.1.0-alpha.4 → 0.1.0-alpha.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.
package/dist/ProLayout.js CHANGED
@@ -399,12 +399,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
399
399
  headerRightExtra: {
400
400
  type: [
401
401
  Function,
402
- Object,
403
402
  String,
404
403
  Number,
405
- Boolean,
406
404
  null,
407
- Array
405
+ Object,
406
+ Boolean
408
407
  ],
409
408
  required: false,
410
409
  default: void 0
@@ -420,12 +419,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
420
419
  siderExtra: {
421
420
  type: [
422
421
  Function,
423
- Object,
424
422
  String,
425
423
  Number,
426
- Boolean,
427
424
  null,
428
- Array
425
+ Object,
426
+ Boolean
429
427
  ],
430
428
  required: false,
431
429
  default: void 0
@@ -457,12 +455,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
457
455
  footer: {
458
456
  type: [
459
457
  Function,
460
- Object,
461
458
  String,
462
459
  Number,
463
- Boolean,
464
460
  null,
465
- Array
461
+ Object,
462
+ Boolean
466
463
  ],
467
464
  required: false,
468
465
  default: void 0
@@ -470,12 +467,11 @@ const GProLayout = /* @__PURE__ */ defineComponent((props, { emit, expose, slots
470
467
  copyright: {
471
468
  type: [
472
469
  Function,
473
- Object,
474
470
  String,
475
471
  Number,
476
- Boolean,
477
472
  null,
478
- Array
473
+ Object,
474
+ Boolean
479
475
  ],
480
476
  required: false,
481
477
  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
@@ -43,7 +43,7 @@ const Breadcrumb = /* @__PURE__ */ defineComponent((props, { slots }) => {
43
43
  const breadcrumbRoutes = computed(() => props.routes ?? menuState?.breadcrumbRoutes.value ?? []);
44
44
  const homeIconConfig = computed(() => {
45
45
  if (props.homeIcon !== void 0) return props.homeIcon;
46
- return breadcrumbConfig ? breadcrumbConfig.value.showHome : void 0;
46
+ return breadcrumbConfig ? breadcrumbConfig.value?.showHome : void 0;
47
47
  });
48
48
  const lookup = computed(() => menuState?.lookup.value);
49
49
  const selectedKeys = computed(() => menuState?.selectedKeys.value ?? []);
@@ -5,7 +5,7 @@ import { MenuFoldOutlined, MenuUnfoldOutlined } from "@antdv-next/icons";
5
5
  //#region src/components/CollapseButton/index.tsx
6
6
  const LayoutCollapseButton = /* @__PURE__ */ defineComponent((props, { emit, slots }) => {
7
7
  const { prefixCls, collapseConfig } = useLayoutBase();
8
- const placement = computed(() => collapseConfig.value?.placement);
8
+ const placement = computed(() => props.placement ?? collapseConfig?.value?.placement ?? "sider");
9
9
  const collapseButtonClassNames = computed(() => classNames(`${prefixCls.value}-collapse-button`, `${prefixCls.value}-collapse-button-${placement.value}`, props.collapsed && `${prefixCls.value}-collapse-button-${placement.value}-collapsed`));
10
10
  function handleClick(event) {
11
11
  emit("click", event);
@@ -24,13 +24,19 @@ 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
+ }, [collapseConfig?.value ? slots.icon?.({ collapsed: props.collapsed }) : props.collapsed ? createVNode(MenuUnfoldOutlined, null, null) : createVNode(MenuFoldOutlined, null, null)]);
28
28
  };
29
29
  }, {
30
- props: { collapsed: {
31
- type: Boolean,
32
- required: true
33
- } },
30
+ props: {
31
+ collapsed: {
32
+ type: Boolean,
33
+ required: true
34
+ },
35
+ placement: {
36
+ type: String,
37
+ required: false
38
+ }
39
+ },
34
40
  emits: ["click"],
35
41
  name: "LayoutCollapseButton",
36
42
  inheritAttrs: false
@@ -7,6 +7,8 @@ interface LayoutCollapseButtonEmitsProps {
7
7
  }
8
8
  interface LayoutCollapseButtonProps extends LayoutCollapseButtonEmitsProps {
9
9
  collapsed: boolean;
10
+ /** 折叠按钮位置:优先于 context 的 collapseConfig.placement */
11
+ placement?: 'sider' | 'header' | 'floating';
10
12
  }
11
13
  interface LayoutCollapseButtonSlots {
12
14
  icon?: (props: {
@@ -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
@@ -15,10 +15,10 @@ const LayoutLogo = /* @__PURE__ */ defineComponent((_props, { emit, slots }) =>
15
15
  const { layout, isMobile, prefixCls, collapsed, logoConfig, proClasses, proStyles, collapseConfig } = useLayoutBase();
16
16
  const collapsedWidth = computed(() => collapseConfig?.value?.width);
17
17
  const title = computed(() => {
18
- if (!logoConfig.value) return "";
19
- return logoConfig.value.title;
18
+ if (!logoConfig?.value) return "";
19
+ return logoConfig?.value.title;
20
20
  });
21
- const logoSource = computed(() => !logoConfig.value ? false : logoConfig.value.logo);
21
+ const logoSource = computed(() => !logoConfig?.value ? false : logoConfig?.value.logo);
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, {
@@ -241,12 +241,11 @@ const ProPageContainer = /* @__PURE__ */ defineComponent((props, { slots, emit }
241
241
  header: {
242
242
  type: [
243
243
  Function,
244
- Object,
245
244
  String,
246
245
  Number,
247
- Boolean,
248
246
  null,
249
- Array
247
+ Object,
248
+ Boolean
250
249
  ],
251
250
  required: false,
252
251
  default: void 0
@@ -254,12 +253,11 @@ const ProPageContainer = /* @__PURE__ */ defineComponent((props, { slots, emit }
254
253
  headerContent: {
255
254
  type: [
256
255
  Function,
257
- Object,
258
256
  String,
259
257
  Number,
260
- Boolean,
261
258
  null,
262
- Array
259
+ Object,
260
+ Boolean
263
261
  ],
264
262
  required: false,
265
263
  default: void 0
@@ -267,12 +265,11 @@ const ProPageContainer = /* @__PURE__ */ defineComponent((props, { slots, emit }
267
265
  extra: {
268
266
  type: [
269
267
  Function,
270
- Object,
271
268
  String,
272
269
  Number,
273
- Boolean,
274
270
  null,
275
- Array
271
+ Object,
272
+ Boolean
276
273
  ],
277
274
  required: false,
278
275
  default: void 0
@@ -284,12 +281,11 @@ const ProPageContainer = /* @__PURE__ */ defineComponent((props, { slots, emit }
284
281
  footer: {
285
282
  type: [
286
283
  Function,
287
- Object,
288
284
  String,
289
285
  Number,
290
- Boolean,
291
286
  null,
292
- Array
287
+ Object,
288
+ Boolean
293
289
  ],
294
290
  required: false,
295
291
  default: void 0
@@ -99,7 +99,6 @@ const genSiderMenuStyle = (token) => {
99
99
  const siderMenuPaddingWithArrow = token.calc(siderMenuArrowSize).add(token.padding).add(token.marginXS).equal();
100
100
  const siderMenuTitleGap = token.iconMarginInlineEnd ?? token.marginSM;
101
101
  const activeBarWidth = token.activeBarWidth ?? 0;
102
- token.activeBarBorderWidth ?? token.lineWidth;
103
102
  const itemWidth = token.itemWidth || `calc(100% - ${unit$1(token.calc(siderMenuItemMarginInline).mul(2).equal())})`;
104
103
  return {
105
104
  [`${componentCls}`]: {
@@ -7,23 +7,23 @@ import { computed } from "vue";
7
7
  */
8
8
  function useLayoutBase(props) {
9
9
  const layoutContext = useInjectLayoutContext();
10
- const sider = layoutContext.sider;
11
- const header = layoutContext.header;
12
- const zIndex = layoutContext.zIndex;
13
- const prefixCls = layoutContext.prefixCls;
14
- const hashId = layoutContext.hashId;
15
- const cssVarCls = layoutContext.cssVarCls;
16
- const rootCls = layoutContext.rootCls;
17
- const watermark = layoutContext.watermark;
18
- const menuState = layoutContext.menuState;
19
- const breadcrumbRender = layoutContext.breadcrumbRender;
20
- const breadcrumbConfig = layoutContext.breadcrumbConfig;
21
- const pageContainerConfig = layoutContext.pageContainerConfig;
22
- const collapseConfig = layoutContext.collapseConfig;
23
- const contentFullscreen = layoutContext.contentFullscreen;
24
- const renderRouterView = layoutContext.renderRouterView;
25
- const navigate = layoutContext.navigate;
26
- const setHasFooterToolbar = layoutContext.setHasFooterToolbar;
10
+ const sider = layoutContext?.sider;
11
+ const header = layoutContext?.header;
12
+ const zIndex = layoutContext?.zIndex;
13
+ const prefixCls = layoutContext?.prefixCls;
14
+ const hashId = layoutContext?.hashId;
15
+ const cssVarCls = layoutContext?.cssVarCls;
16
+ const rootCls = layoutContext?.rootCls;
17
+ const watermark = layoutContext?.watermark;
18
+ const menuState = layoutContext?.menuState;
19
+ const breadcrumbRender = layoutContext?.breadcrumbRender;
20
+ const breadcrumbConfig = layoutContext?.breadcrumbConfig;
21
+ const pageContainerConfig = layoutContext?.pageContainerConfig;
22
+ const collapseConfig = layoutContext?.collapseConfig;
23
+ const contentFullscreen = layoutContext?.contentFullscreen;
24
+ const renderRouterView = layoutContext?.renderRouterView;
25
+ const navigate = layoutContext?.navigate;
26
+ const setHasFooterToolbar = layoutContext?.setHasFooterToolbar;
27
27
  const layout = computed(() => layoutContext?.layout.value);
28
28
  const collapsed = computed(() => props?.collapsed ?? layoutContext?.collapsed.value ?? false);
29
29
  const isMobile = computed(() => layoutContext?.isMobile.value ?? false);