mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 23:46:28 +08:00
commit
1f22ebb9d9
@ -175,7 +175,12 @@ const Badge: CompoundedComponent = ({
|
||||
return (
|
||||
<span {...restProps} className={badgeClassName}>
|
||||
{children}
|
||||
<CSSMotion visible={!isHidden} motionName={`${prefixCls}-zoom`} motionAppear={false}>
|
||||
<CSSMotion
|
||||
visible={!isHidden}
|
||||
motionName={`${prefixCls}-zoom`}
|
||||
motionAppear={false}
|
||||
motionDeadline={1000}
|
||||
>
|
||||
{({ className: motionClassName }) => {
|
||||
const scrollNumberPrefixCls = getPrefixCls(
|
||||
'scroll-number',
|
||||
|
@ -242,7 +242,7 @@ Form.List 渲染表单相关操作函数。
|
||||
| isFieldTouched | 检查对应字段是否被用户操作过 | (name: [NamePath](#NamePath)) => boolean | |
|
||||
| isFieldValidating | 检查对应字段是否正在校验 | (name: [NamePath](#NamePath)) => boolean | |
|
||||
| resetFields | 重置一组字段到 `initialValues` | (fields?: [FieldData](#FieldData)\[]) => void | |
|
||||
| scrollToField | 滚动到对应字段位置 | (name: [NamePath](#NamePath), options: \[[ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)]) => void | |
|
||||
| scrollToField | 滚动到对应字段位置 | (name: [NamePath](#NamePath), options: [ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)) => void | |
|
||||
| setFields | 设置一组字段状态 | (fields: [FieldData](#FieldData)\[]) => void | |
|
||||
| setFieldsValue | 设置表单的值(该值将直接传入 form store 中。如果你不希望传入对象被修改,请克隆后传入) | (values) => void | |
|
||||
| submit | 提交表单,与点击 `submit` 按钮效果相同 | () => void | |
|
||||
|
@ -32,6 +32,10 @@
|
||||
margin-right: @radio-wrapper-margin-right;
|
||||
cursor: pointer;
|
||||
|
||||
&-disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&::after {
|
||||
display: inline-block;
|
||||
width: 0;
|
||||
|
@ -305,7 +305,7 @@ const InternalUpload: React.ForwardRefRenderFunction<unknown, UploadProps> = (pr
|
||||
onError,
|
||||
onProgress,
|
||||
onSuccess,
|
||||
...props,
|
||||
...(props as RcUploadProps),
|
||||
prefixCls,
|
||||
beforeUpload: mergedBeforeUpload,
|
||||
onChange: undefined,
|
||||
|
@ -99,11 +99,10 @@ describe('Upload.typescript', () => {
|
||||
status: 'error' as const,
|
||||
},
|
||||
];
|
||||
const upload = (
|
||||
<Upload fileList={fileList} defaultFileList={fileList} />
|
||||
)
|
||||
const upload = <Upload fileList={fileList} defaultFileList={fileList} />;
|
||||
expect(upload).toBeTruthy();
|
||||
});
|
||||
|
||||
it('itemRender', () => {
|
||||
const upload = (
|
||||
<Upload
|
||||
@ -123,4 +122,39 @@ describe('Upload.typescript', () => {
|
||||
);
|
||||
expect(upload).toBeTruthy();
|
||||
});
|
||||
|
||||
it('data', () => {
|
||||
const upload1 = (
|
||||
<Upload
|
||||
data={() => ({
|
||||
url: '',
|
||||
})}
|
||||
>
|
||||
<span>click to upload</span>
|
||||
</Upload>
|
||||
);
|
||||
const upload2 = (
|
||||
<Upload
|
||||
data={() =>
|
||||
Promise.resolve({
|
||||
url: '',
|
||||
})
|
||||
}
|
||||
>
|
||||
<span>click to upload</span>
|
||||
</Upload>
|
||||
);
|
||||
const upload3 = (
|
||||
<Upload
|
||||
data={{
|
||||
url: '',
|
||||
}}
|
||||
>
|
||||
<span>click to upload</span>
|
||||
</Upload>
|
||||
);
|
||||
expect(upload1).toBeTruthy();
|
||||
expect(upload2).toBeTruthy();
|
||||
expect(upload3).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@ -91,7 +91,9 @@ export interface UploadProps<T = any> {
|
||||
fileList?: Array<UploadFile<T>>;
|
||||
action?: string | ((file: RcFile) => string) | ((file: RcFile) => PromiseLike<string>);
|
||||
directory?: boolean;
|
||||
data?: object | ((file: UploadFile<T>) => object);
|
||||
data?:
|
||||
| Record<string, unknown>
|
||||
| ((file: UploadFile<T>) => Record<string, unknown> | Promise<Record<string, unknown>>);
|
||||
method?: 'POST' | 'PUT' | 'PATCH' | 'post' | 'put' | 'patch';
|
||||
headers?: HttpRequestHeader;
|
||||
showUploadList?: boolean | ShowUploadListInterface;
|
||||
|
Loading…
Reference in New Issue
Block a user