Skip to content

Commit b70b15b

Browse files
committed
fix: 3.0.0-beta.6 type
fix: typo
1 parent fa5a604 commit b70b15b

File tree

5 files changed

+653
-632
lines changed

5 files changed

+653
-632
lines changed

src/FooterToolbar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const footerToolbarProps = {
1919
type: Object as PropType<FooterToolbarProps['extra']>,
2020
},
2121
renderContent: {
22-
type: Function as PropType<FooterToolbarProps['renderContent']>,
22+
type: [Function, Object] as PropType<FooterToolbarProps['renderContent']>,
2323
},
2424
getContainer: {
25-
type: Function as PropType<FooterToolbarProps['getContainer']>,
25+
type: [Function, Object] as PropType<FooterToolbarProps['getContainer']>,
2626
},
2727
prefixCls: { type: String as PropType<string> },
2828
};

src/PageContainer/index.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { FunctionalComponent, VNodeChild, computed, unref } from 'vue';
1+
import { computed, FunctionalComponent, unref, VNode, VNodeChild } from 'vue';
22
/* replace antd ts define */
33
import { TabPaneProps } from './interfaces/TabPane';
44
import { TabBarExtraContent, TabsProps } from './interfaces/Tabs';
55
import { PageHeaderProps } from './interfaces/PageHeader';
66
import { AffixProps } from './interfaces/Affix';
77
/* replace antd ts define end */
8-
import { useRouteContext, RouteContextProps } from '../RouteContext';
8+
import { RouteContextProps, useRouteContext } from '../RouteContext';
99
import { getCustomRender } from '../utils';
1010
import { withInstall } from 'ant-design-vue/es/_util/type';
1111
import 'ant-design-vue/es/affix/style';
@@ -19,11 +19,11 @@ import Spin from 'ant-design-vue/es/spin';
1919
import GridContent from '../GridContent';
2020
import FooterToolbar from '../FooterToolbar';
2121
import './index.less';
22-
import { WithFalse } from '../typings';
22+
import { CustomRender, WithFalse } from '../typings';
2323

2424
export interface Tab {
2525
key: string;
26-
tab: string | VNodeChild | JSX.Element;
26+
tab: string | VNode | JSX.Element;
2727
}
2828

2929
export interface PageHeaderTabConfig {
@@ -59,14 +59,15 @@ export interface PageHeaderTabConfig {
5959
}
6060

6161
export interface PageContainerProps extends PageHeaderTabConfig, Omit<PageHeaderProps, 'title'> {
62-
title?: VNodeChild | JSX.Element | false;
63-
content?: VNodeChild | JSX.Element;
64-
extraContent?: VNodeChild | JSX.Element;
6562
prefixCls?: string;
66-
footer?: WithFalse<VNodeChild | VNodeChild[] | JSX.Element>;
63+
64+
title?: WithFalse<VNodeChild | JSX.Element | string>;
65+
content?: CustomRender;
66+
extraContent?: CustomRender;
67+
footer?: VNodeChild | JSX.Element;
6768
ghost?: boolean;
68-
header?: PageHeaderProps | VNodeChild;
69-
pageHeaderRender?: (props: PageContainerProps) => VNodeChild | JSX.Element;
69+
header?: PageHeaderProps | CustomRender;
70+
pageHeaderRender?: (props: PageContainerProps | Record<string, any>) => VNode | JSX.Element;
7071
affixProps?: AffixProps;
7172
loading?: boolean;
7273
}
@@ -110,10 +111,10 @@ const renderFooter = (
110111
};
111112

112113
const renderPageHeader = (
113-
content: VNodeChild | JSX.Element,
114-
extraContent: VNodeChild | JSX.Element,
114+
content: CustomRender,
115+
extraContent: CustomRender,
115116
prefixedClassName: string,
116-
): VNodeChild | JSX.Element => {
117+
): VNode | JSX.Element | null => {
117118
if (!content && !extraContent) {
118119
return null;
119120
}
@@ -140,7 +141,7 @@ const renderPageHeader = (
140141
const defaultPageHeaderRender = (
141142
props: PageContainerProps,
142143
value: RouteContextProps & { prefixedClassName: string },
143-
): VNodeChild | JSX.Element => {
144+
): VNode | JSX.Element => {
144145
const {
145146
title,
146147
tabList,

src/PageContainer/interfaces/PageHeader.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { VNodeChild, CSSProperties } from 'vue';
1+
import { VNode, VNodeChild, CSSProperties } from 'vue';
22

33
export type ShapeType = 'circle' | 'square';
44

55
export type Size = 'large' | 'small' | 'default';
66

77
export interface AvatarProps {
8-
icon?: VNodeChild | JSX.Element;
8+
icon?: VNode | JSX.Element;
99
shape?: ShapeType;
1010
size?: Size;
1111
src?: string;
@@ -29,3 +29,4 @@ export interface PageHeaderProps {
2929
onBack?: (e: MouseEvent) => void;
3030
ghost?: boolean;
3131
}
32+
``;

src/typings.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ export type WithFalse<T> = T | false;
6767
export type CustomRender =
6868
| Slot
6969
| VNode
70-
| ((...props: any) => Slot)
71-
| ((...props: any) => VNode)
70+
| ((...props: any[]) => Slot)
71+
| ((...props: any[]) => VNode)
7272
| ((...args: any[]) => VNode)
7373
| VNode[]
7474
| JSX.Element
75-
| null;
75+
| string
76+
| null
77+
| undefined;
7678

7779
export type FormatMessage = (message?: string) => string;

0 commit comments

Comments
 (0)