Skip to content

Commit 1a7c41b

Browse files
committed
feat: update prop type
1 parent 7bf1e0d commit 1a7c41b

File tree

99 files changed

+632
-641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+632
-641
lines changed

components/_util/Portal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default defineComponent({
1515
inheritAttrs: false,
1616
props: {
1717
getContainer: PropTypes.func.isRequired,
18-
didUpdate: PropTypes.func,
18+
didUpdate: Function,
1919
},
2020
setup(props, { slots }) {
2121
let isSSR = true;

components/_util/PortalWrapper.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ export default defineComponent({
5252
name: 'PortalWrapper',
5353
inheritAttrs: false,
5454
props: {
55-
wrapperClassName: PropTypes.string,
56-
forceRender: PropTypes.looseBool,
55+
wrapperClassName: String,
56+
forceRender: { type: Boolean, default: undefined },
5757
getContainer: PropTypes.any,
58-
visible: PropTypes.looseBool,
58+
visible: { type: Boolean, default: undefined },
5959
},
6060

6161
setup(props, { slots }) {

components/_util/transButton.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const TransButton = defineComponent({
1919
name: 'TransButton',
2020
inheritAttrs: false,
2121
props: {
22-
noStyle: PropTypes.looseBool,
23-
onClick: PropTypes.func,
24-
disabled: PropTypes.looseBool,
25-
autofocus: PropTypes.looseBool,
22+
noStyle: { type: Boolean, default: undefined },
23+
onClick: Function,
24+
disabled: { type: Boolean, default: undefined },
25+
autofocus: { type: Boolean, default: undefined },
2626
},
2727
setup(props, { slots, emit, attrs, expose }) {
2828
const domRef = ref();

components/alert/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const alertProps = () => ({
4444
*/
4545
type: PropTypes.oneOf(AlertTypes),
4646
/** Whether Alert can be closed */
47-
closable: PropTypes.looseBool,
47+
closable: { type: Boolean, default: undefined },
4848
/** Close text to show */
4949
closeText: PropTypes.any,
5050
/** Content of Alert */
@@ -54,9 +54,9 @@ export const alertProps = () => ({
5454
/** Trigger when animation ending of Alert */
5555
afterClose: PropTypes.func.def(noop),
5656
/** Whether to show icon */
57-
showIcon: PropTypes.looseBool,
58-
prefixCls: PropTypes.string,
59-
banner: PropTypes.looseBool,
57+
showIcon: { type: Boolean, default: undefined },
58+
prefixCls: String,
59+
banner: { type: Boolean, default: undefined },
6060
icon: PropTypes.any,
6161
closeIcon: PropTypes.any,
6262
onClose: Function as PropType<NodeMouseEventHandler>,

components/anchor/AnchorLink.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import useConfigInject from '../_util/hooks/useConfigInject';
77
import { useInjectAnchor } from './context';
88

99
export const anchorLinkProps = {
10-
prefixCls: PropTypes.string,
10+
prefixCls: String,
1111
href: PropTypes.string.def('#'),
1212
title: PropTypes.any,
13-
target: PropTypes.string,
13+
target: String,
1414
};
1515

1616
export type AnchorLinkProps = Partial<ExtractPropTypes<typeof anchorLinkProps>>;

components/auto-complete/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const autoCompleteProps = {
1717
...omit(selectProps(), ['loading', 'mode', 'optionLabelProp', 'labelInValue']),
1818
dataSource: PropTypes.array,
1919
dropdownMenuStyle: PropTypes.style,
20-
// optionLabelProp: PropTypes.string,
20+
// optionLabelProp: String,
2121
dropdownMatchSelectWidth: { type: [Number, Boolean], default: true },
2222
};
2323

@@ -32,12 +32,12 @@ const AutoComplete = defineComponent({
3232
inheritAttrs: false,
3333
props: {
3434
...autoCompleteProps,
35-
prefixCls: PropTypes.string,
36-
showSearch: PropTypes.looseBool,
37-
transitionName: PropTypes.string,
35+
prefixCls: String,
36+
showSearch: { type: Boolean, default: undefined },
37+
transitionName: String,
3838
choiceTransitionName: PropTypes.string.def('zoom'),
39-
autofocus: PropTypes.looseBool,
40-
backfill: PropTypes.looseBool,
39+
autofocus: { type: Boolean, default: undefined },
40+
backfill: { type: Boolean, default: undefined },
4141
// optionLabelProp: PropTypes.string.def('children'),
4242
filterOption: PropTypes.oneOfType([PropTypes.looseBool, PropTypes.func]).def(false),
4343
defaultActiveFirstOption: PropTypes.looseBool.def(true),

components/avatar/Avatar.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ import eagerComputed from '../_util/eagerComputed';
1515
export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
1616

1717
export const avatarProps = () => ({
18-
prefixCls: PropTypes.string,
18+
prefixCls: String,
1919
shape: PropTypes.oneOf(tuple('circle', 'square')).def('circle'),
2020
size: {
2121
type: [Number, String, Object] as PropType<AvatarSize>,
2222
default: (): AvatarSize => 'default',
2323
},
24-
src: PropTypes.string,
24+
src: String,
2525
/** Srcset of image avatar */
26-
srcset: PropTypes.string,
26+
srcset: String,
2727
icon: PropTypes.any,
28-
alt: PropTypes.string,
29-
gap: PropTypes.number,
28+
alt: String,
29+
gap: Number,
3030
draggable: PropTypes.bool,
3131
crossOrigin: String as PropType<'' | 'anonymous' | 'use-credentials'>,
3232
loadError: {

components/avatar/Group.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import useConfigInject from '../_util/hooks/useConfigInject';
1111
import useProvideSize from '../_util/hooks/useSize';
1212

1313
export const groupProps = () => ({
14-
prefixCls: PropTypes.string,
15-
maxCount: PropTypes.number,
14+
prefixCls: String,
15+
maxCount: Number,
1616
maxStyle: {
1717
type: Object as PropType<CSSProperties>,
1818
default: () => ({} as CSSProperties),

components/back-top/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const backTopProps = {
2424
visibilityHeight: PropTypes.number.def(400),
2525
duration: PropTypes.number.def(450),
2626
target: Function as PropType<() => HTMLElement | Window | Document>,
27-
prefixCls: PropTypes.string,
28-
onClick: PropTypes.func,
29-
// visible: PropTypes.looseBool, // Only for test. Don't use it.
27+
prefixCls: String,
28+
onClick: Function,
29+
// visible: { type: Boolean, default: undefined }, // Only for test. Don't use it.
3030
};
3131

3232
export type BackTopProps = Partial<ExtractPropTypes<typeof backTopProps>>;

components/badge/Badge.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ import isNumeric from '../_util/isNumeric';
1515
export const badgeProps = {
1616
/** Number to show in badge */
1717
count: PropTypes.any,
18-
showZero: PropTypes.looseBool,
18+
showZero: { type: Boolean, default: undefined },
1919
/** Max count to show */
2020
overflowCount: PropTypes.number.def(99),
2121
/** whether to show red dot without number */
22-
dot: PropTypes.looseBool,
23-
prefixCls: PropTypes.string,
24-
scrollNumberPrefixCls: PropTypes.string,
22+
dot: { type: Boolean, default: undefined },
23+
prefixCls: String,
24+
scrollNumberPrefixCls: String,
2525
status: PropTypes.oneOf(tuple('success', 'processing', 'default', 'error', 'warning')),
2626
2727
size: PropTypes.oneOf(tuple('default', 'small')).def('default'),
28-
color: PropTypes.string,
28+
color: String,
2929
text: PropTypes.any,
3030
offset: PropTypes.arrayOf(PropTypes.oneOfType([String, Number])),
3131
numberStyle: PropTypes.style,
32-
title: PropTypes.string,
32+
title: String,
3333
};
3434

3535
export type BadgeProps = Partial<ExtractPropTypes<typeof badgeProps>>;

components/badge/Ribbon.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import PropTypes from '../_util/vue-types';
88
import useConfigInject from '../_util/hooks/useConfigInject';
99

1010
export const ribbonProps = {
11-
prefix: PropTypes.string,
11+
prefix: String,
1212
color: { type: String as PropType<LiteralUnion<PresetColorType, string>> },
1313
text: PropTypes.any,
1414
placement: PropTypes.oneOf(tuple('start', 'end')).def('end'),

components/badge/ScrollNumber.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import SingleNumber from './SingleNumber';
88
import { filterEmpty } from '../_util/props-util';
99

1010
export const scrollNumberProps = {
11-
prefixCls: PropTypes.string,
11+
prefixCls: String,
1212
count: PropTypes.any,
13-
component: PropTypes.string,
13+
component: String,
1414
title: PropTypes.oneOfType([PropTypes.number, PropTypes.string, null]),
1515
show: Boolean,
1616
};

components/breadcrumb/Breadcrumb.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface Route {
1515
}
1616

1717
export const breadcrumbProps = {
18-
prefixCls: PropTypes.string,
18+
prefixCls: String,
1919
routes: { type: Array as PropType<Route[]> },
2020
params: PropTypes.any,
2121
separator: PropTypes.any,

components/breadcrumb/BreadcrumbItem.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import DownOutlined from '@ant-design/icons-vue/DownOutlined';
77
import useConfigInject from '../_util/hooks/useConfigInject';
88

99
export const breadcrumbItemProps = {
10-
prefixCls: PropTypes.string,
11-
href: PropTypes.string,
10+
prefixCls: String,
11+
href: String,
1212
separator: PropTypes.any,
1313
overlay: PropTypes.any,
1414
};

components/breadcrumb/BreadcrumbSeparator.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { flattenChildren } from '../_util/props-util';
55
import useConfigInject from '../_util/hooks/useConfigInject';
66

77
export const breadcrumbSeparatorProps = {
8-
prefixCls: PropTypes.string,
8+
prefixCls: String,
99
};
1010
export type BreadcrumbSeparatorProps = Partial<ExtractPropTypes<typeof breadcrumbSeparatorProps>>;
1111

components/button/button-group.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { SizeType } from '../config-provider';
88
import UnreachableException from '../_util/unreachableException';
99

1010
const buttonGroupProps = {
11-
prefixCls: PropTypes.string,
11+
prefixCls: String,
1212
size: {
1313
type: String as PropType<SizeType>,
1414
},

components/button/buttonTypes.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function convertLegacyProps(type?: LegacyButtonType): ButtonProps {
2121
}
2222

2323
export const buttonProps = () => ({
24-
prefixCls: PropTypes.string,
24+
prefixCls: String,
2525
type: PropTypes.oneOf(ButtonTypes),
2626
htmlType: PropTypes.oneOf(ButtonHTMLTypes).def('button'),
2727
shape: PropTypes.oneOf(ButtonShapes),
@@ -32,14 +32,14 @@ export const buttonProps = () => ({
3232
type: [Boolean, Object] as PropType<boolean | { delay?: number }>,
3333
default: (): boolean | { delay?: number } => false,
3434
},
35-
disabled: PropTypes.looseBool,
36-
ghost: PropTypes.looseBool,
37-
block: PropTypes.looseBool,
38-
danger: PropTypes.looseBool,
35+
disabled: { type: Boolean, default: undefined },
36+
ghost: { type: Boolean, default: undefined },
37+
block: { type: Boolean, default: undefined },
38+
danger: { type: Boolean, default: undefined },
3939
icon: PropTypes.any,
40-
href: PropTypes.string,
41-
target: PropTypes.string,
42-
title: PropTypes.string,
40+
href: String,
41+
target: String,
42+
title: String,
4343
onClick: {
4444
type: Function as PropType<(event: MouseEvent) => void>,
4545
},

components/card/Card.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type CardSize = 'default' | 'small';
2424
const { TabPane } = Tabs;
2525

2626
export const cardProps = () => ({
27-
prefixCls: PropTypes.string,
27+
prefixCls: String,
2828
title: PropTypes.any,
2929
extra: PropTypes.any,
3030
bordered: PropTypes.looseBool.def(true),
@@ -39,8 +39,8 @@ export const cardProps = () => ({
3939
type: Array as PropType<CardTabListType[]>,
4040
},
4141
tabBarExtraContent: PropTypes.any,
42-
activeTabKey: PropTypes.string,
43-
defaultActiveTabKey: PropTypes.string,
42+
activeTabKey: String,
43+
defaultActiveTabKey: String,
4444
cover: PropTypes.any,
4545
onTabChange: {
4646
type: Function as PropType<(key: string) => void>,

components/card/Meta.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import useConfigInject from '../_util/hooks/useConfigInject';
66
export default defineComponent({
77
name: 'ACardMeta',
88
props: {
9-
prefixCls: PropTypes.string,
9+
prefixCls: String,
1010
title: PropTypes.any,
1111
description: PropTypes.any,
1212
avatar: PropTypes.any,

components/checkbox/interface.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export const abstractCheckboxProps = () => {
5151
indeterminate: { type: Boolean, default: undefined },
5252
type: { type: String, default: 'checkbox' },
5353
autofocus: { type: Boolean, default: undefined },
54-
onChange: PropTypes.func,
55-
'onUpdate:checked': PropTypes.func,
56-
onClick: PropTypes.func,
54+
onChange: Function,
55+
'onUpdate:checked': Function,
56+
onClick: Function,
5757
skipGroup: { type: Boolean, default: false },
5858
};
5959
};

components/collapse/commonProps.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ export type CollapsibleType = 'header' | 'disabled';
66

77
export type ActiveKeyType = Array<string | number> | string | number;
88
const collapseProps = () => ({
9-
prefixCls: PropTypes.string,
9+
prefixCls: String,
1010
activeKey: { type: [Array, Number, String] as PropType<ActiveKeyType> },
1111
defaultActiveKey: { type: [Array, Number, String] as PropType<ActiveKeyType> },
12-
accordion: PropTypes.looseBool,
13-
destroyInactivePanel: PropTypes.looseBool,
14-
bordered: PropTypes.looseBool,
15-
expandIcon: PropTypes.func,
12+
accordion: { type: Boolean, default: undefined },
13+
destroyInactivePanel: { type: Boolean, default: undefined },
14+
bordered: { type: Boolean, default: undefined },
15+
expandIcon: Function,
1616
openAnimation: PropTypes.object,
1717
expandIconPosition: PropTypes.oneOf(tuple('left', 'right')),
1818
collapsible: { type: String as PropType<CollapsibleType> },
19-
ghost: PropTypes.looseBool,
19+
ghost: { type: Boolean, default: undefined },
2020
});
2121

2222
const collapsePanelProps = () => ({
2323
openAnimation: PropTypes.object,
24-
prefixCls: PropTypes.string,
24+
prefixCls: String,
2525
header: PropTypes.any,
26-
headerClass: PropTypes.string,
27-
showArrow: PropTypes.looseBool,
28-
isActive: PropTypes.looseBool,
29-
destroyInactivePanel: PropTypes.looseBool,
26+
headerClass: String,
27+
showArrow: { type: Boolean, default: undefined },
28+
isActive: { type: Boolean, default: undefined },
29+
destroyInactivePanel: { type: Boolean, default: undefined },
3030
/** @deprecated Use `collapsible="disabled"` instead */
31-
disabled: PropTypes.looseBool,
32-
accordion: PropTypes.looseBool,
33-
forceRender: PropTypes.looseBool,
34-
expandIcon: PropTypes.func,
31+
disabled: { type: Boolean, default: undefined },
32+
accordion: { type: Boolean, default: undefined },
33+
forceRender: { type: Boolean, default: undefined },
34+
expandIcon: Function,
3535
extra: PropTypes.any,
3636
panelKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3737
collapsible: { type: String as PropType<CollapsibleType> },

components/color-picker/ColorPicker.jsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ export default {
2121
event: 'change.value', //为了支持v-model直接返回颜色字符串 所以用了自定义的事件,与pickr自带change事件进行区分
2222
},
2323
props: {
24-
prefixCls: PropTypes.string,
25-
defaultValue: PropTypes.string, //默认值
24+
prefixCls: String,
25+
defaultValue: String, //默认值
2626
config: PropTypes.object, //pickr配置
27-
value: PropTypes.string, //颜色值
27+
value: String, //颜色值
2828
locale: PropTypes.object, //双语包
29-
colorRounded: PropTypes.number, //颜色数值保留几位小数
29+
colorRounded: Number, //颜色数值保留几位小数
3030
size: PropTypes.oneOf(['default', 'small', 'large']).def('default'), //尺寸
31-
getPopupContainer: PropTypes.func, //指定渲染容器
31+
getPopupContainer: Function, //指定渲染容器
3232
disabled: PropTypes.looseBool.def(false), //是否禁用
33-
format: PropTypes.string, //颜色格式设置
33+
format: String, //颜色格式设置
3434
alpha: PropTypes.looseBool.def(false), //是否开启透明通道
3535
hue: PropTypes.looseBool.def(true), //是否开启色彩预选
3636
},

components/comment/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const commentProps = {
1414
/** The main content of the comment */
1515
content: PropTypes.any,
1616
/** Comment prefix defaults to '.ant-comment' */
17-
prefixCls: PropTypes.string,
17+
prefixCls: String,
1818
/** A datetime element containing the time to be displayed */
1919
datetime: PropTypes.any,
2020
};

0 commit comments

Comments
 (0)