Skip to content

Commit

Permalink
fix: 3.0.0-beta.6 type
Browse files Browse the repository at this point in the history
fix: typo
  • Loading branch information
sendya committed Apr 26, 2021
1 parent fa5a604 commit b70b15b
Show file tree
Hide file tree
Showing 5 changed files with 653 additions and 632 deletions.
4 changes: 2 additions & 2 deletions src/FooterToolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const footerToolbarProps = {
type: Object as PropType<FooterToolbarProps['extra']>,
},
renderContent: {
type: Function as PropType<FooterToolbarProps['renderContent']>,
type: [Function, Object] as PropType<FooterToolbarProps['renderContent']>,
},
getContainer: {
type: Function as PropType<FooterToolbarProps['getContainer']>,
type: [Function, Object] as PropType<FooterToolbarProps['getContainer']>,
},
prefixCls: { type: String as PropType<string> },
};
Expand Down
29 changes: 15 additions & 14 deletions src/PageContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { FunctionalComponent, VNodeChild, computed, unref } from 'vue';
import { computed, FunctionalComponent, unref, VNode, VNodeChild } from 'vue';
/* replace antd ts define */
import { TabPaneProps } from './interfaces/TabPane';
import { TabBarExtraContent, TabsProps } from './interfaces/Tabs';
import { PageHeaderProps } from './interfaces/PageHeader';
import { AffixProps } from './interfaces/Affix';
/* replace antd ts define end */
import { useRouteContext, RouteContextProps } from '../RouteContext';
import { RouteContextProps, useRouteContext } from '../RouteContext';
import { getCustomRender } from '../utils';
import { withInstall } from 'ant-design-vue/es/_util/type';
import 'ant-design-vue/es/affix/style';
Expand All @@ -19,11 +19,11 @@ import Spin from 'ant-design-vue/es/spin';
import GridContent from '../GridContent';
import FooterToolbar from '../FooterToolbar';
import './index.less';
import { WithFalse } from '../typings';
import { CustomRender, WithFalse } from '../typings';

export interface Tab {
key: string;
tab: string | VNodeChild | JSX.Element;
tab: string | VNode | JSX.Element;
}

export interface PageHeaderTabConfig {
Expand Down Expand Up @@ -59,14 +59,15 @@ export interface PageHeaderTabConfig {
}

export interface PageContainerProps extends PageHeaderTabConfig, Omit<PageHeaderProps, 'title'> {
title?: VNodeChild | JSX.Element | false;
content?: VNodeChild | JSX.Element;
extraContent?: VNodeChild | JSX.Element;
prefixCls?: string;
footer?: WithFalse<VNodeChild | VNodeChild[] | JSX.Element>;

title?: WithFalse<VNodeChild | JSX.Element | string>;
content?: CustomRender;
extraContent?: CustomRender;
footer?: VNodeChild | JSX.Element;
ghost?: boolean;
header?: PageHeaderProps | VNodeChild;
pageHeaderRender?: (props: PageContainerProps) => VNodeChild | JSX.Element;
header?: PageHeaderProps | CustomRender;
pageHeaderRender?: (props: PageContainerProps | Record<string, any>) => VNode | JSX.Element;
affixProps?: AffixProps;
loading?: boolean;
}
Expand Down Expand Up @@ -110,10 +111,10 @@ const renderFooter = (
};

const renderPageHeader = (
content: VNodeChild | JSX.Element,
extraContent: VNodeChild | JSX.Element,
content: CustomRender,
extraContent: CustomRender,
prefixedClassName: string,
): VNodeChild | JSX.Element => {
): VNode | JSX.Element | null => {
if (!content && !extraContent) {
return null;
}
Expand All @@ -140,7 +141,7 @@ const renderPageHeader = (
const defaultPageHeaderRender = (
props: PageContainerProps,
value: RouteContextProps & { prefixedClassName: string },
): VNodeChild | JSX.Element => {
): VNode | JSX.Element => {
const {
title,
tabList,
Expand Down
5 changes: 3 additions & 2 deletions src/PageContainer/interfaces/PageHeader.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { VNodeChild, CSSProperties } from 'vue';
import { VNode, VNodeChild, CSSProperties } from 'vue';

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

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

export interface AvatarProps {
icon?: VNodeChild | JSX.Element;
icon?: VNode | JSX.Element;
shape?: ShapeType;
size?: Size;
src?: string;
Expand All @@ -29,3 +29,4 @@ export interface PageHeaderProps {
onBack?: (e: MouseEvent) => void;
ghost?: boolean;
}
``;
8 changes: 5 additions & 3 deletions src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ export type WithFalse<T> = T | false;
export type CustomRender =
| Slot
| VNode
| ((...props: any) => Slot)
| ((...props: any) => VNode)
| ((...props: any[]) => Slot)
| ((...props: any[]) => VNode)
| ((...args: any[]) => VNode)
| VNode[]
| JSX.Element
| null;
| string
| null
| undefined;

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

0 comments on commit b70b15b

Please sign in to comment.