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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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: {
@@ -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, {
@@ -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}`]: {
@@ -38,13 +38,13 @@ declare function useLayoutBase(props?: {
38
38
  selectedKeys: _$vue.ComputedRef<string[]>;
39
39
  openKeys: _$vue.ComputedRef<string[]>;
40
40
  proClasses: _$vue.ComputedRef<{
41
- header?: string;
42
- sider?: string;
43
- content?: string;
44
41
  siderHeader?: string;
45
42
  siderFooter?: string;
46
43
  breadcrumb?: string;
47
44
  footer?: string;
45
+ header?: string;
46
+ content?: string;
47
+ sider?: string;
48
48
  root?: string;
49
49
  siderChildren?: string;
50
50
  logo?: string;
@@ -53,13 +53,13 @@ declare function useLayoutBase(props?: {
53
53
  tabs?: string;
54
54
  }>;
55
55
  proStyles: _$vue.ComputedRef<{
56
- header?: _$vue.CSSProperties;
57
- sider?: _$vue.CSSProperties;
58
- content?: _$vue.CSSProperties;
59
56
  siderHeader?: _$vue.CSSProperties;
60
57
  siderFooter?: _$vue.CSSProperties;
61
58
  breadcrumb?: _$vue.CSSProperties;
62
59
  footer?: _$vue.CSSProperties;
60
+ header?: _$vue.CSSProperties;
61
+ content?: _$vue.CSSProperties;
62
+ sider?: _$vue.CSSProperties;
63
63
  root?: _$vue.CSSProperties;
64
64
  siderChildren?: _$vue.CSSProperties;
65
65
  logo?: _$vue.CSSProperties;
@@ -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);