mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
fix: upload circle ref (#34379)
Co-authored-by: kanweiwei <kanweiwei@nutstore.net>
This commit is contained in:
parent
c1831fbf82
commit
6a08a46ecc
@ -2,7 +2,6 @@ import * as React from 'react';
|
||||
import RcUpload, { UploadProps as RcUploadProps } from 'rc-upload';
|
||||
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
||||
import classNames from 'classnames';
|
||||
import Dragger from './Dragger';
|
||||
import UploadList from './UploadList';
|
||||
import {
|
||||
RcFile,
|
||||
@ -20,7 +19,7 @@ import defaultLocale from '../locale/default';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
|
||||
export const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
|
||||
|
||||
export { UploadProps };
|
||||
|
||||
@ -424,24 +423,7 @@ const InternalUpload: React.ForwardRefRenderFunction<unknown, UploadProps> = (pr
|
||||
);
|
||||
};
|
||||
|
||||
const ForwardUpload = React.forwardRef<unknown, UploadProps>(InternalUpload) as <T>(
|
||||
props: React.PropsWithChildren<UploadProps<T>> & React.RefAttributes<any>,
|
||||
) => React.ReactElement;
|
||||
|
||||
type InternalUploadType = typeof ForwardUpload;
|
||||
|
||||
interface UploadInterface extends InternalUploadType {
|
||||
defaultProps?: Partial<UploadProps>;
|
||||
displayName?: string;
|
||||
Dragger: typeof Dragger;
|
||||
LIST_IGNORE: string;
|
||||
}
|
||||
|
||||
const Upload = ForwardUpload as UploadInterface;
|
||||
|
||||
Upload.Dragger = Dragger;
|
||||
|
||||
Upload.LIST_IGNORE = LIST_IGNORE;
|
||||
const Upload = React.forwardRef<unknown, UploadProps>(InternalUpload);
|
||||
|
||||
Upload.displayName = 'Upload';
|
||||
|
||||
|
@ -1,8 +1,20 @@
|
||||
import Upload from './Upload';
|
||||
import Dragger from './Dragger';
|
||||
import InternalUpload, { LIST_IGNORE, UploadProps } from './Upload';
|
||||
|
||||
export { UploadProps, UploadListProps, UploadChangeParam, RcFile } from './interface';
|
||||
export { DraggerProps } from './Dragger';
|
||||
|
||||
type InternalUploadType = typeof InternalUpload;
|
||||
interface UploadInterface<T = any> extends InternalUploadType {
|
||||
<U extends T>(
|
||||
props: React.PropsWithChildren<UploadProps<U>> & React.RefAttributes<any>,
|
||||
): React.ReactElement;
|
||||
Dragger: typeof Dragger;
|
||||
LIST_IGNORE: string;
|
||||
}
|
||||
|
||||
const Upload = InternalUpload as UploadInterface;
|
||||
Upload.Dragger = Dragger;
|
||||
Upload.LIST_IGNORE = LIST_IGNORE;
|
||||
|
||||
export default Upload;
|
||||
|
Loading…
Reference in New Issue
Block a user