mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
feat: upload support rootClassName (#44060)
* feat: upload support rootClassName * feat: optimize code * feat: optimize code
This commit is contained in:
parent
5e9ef6803b
commit
9436ece6e3
@ -62,6 +62,7 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
|
||||
action = '',
|
||||
accept = '',
|
||||
supportServerRender = true,
|
||||
rootClassName,
|
||||
} = props;
|
||||
|
||||
// ===================== Disabled =====================
|
||||
@ -405,11 +406,18 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
|
||||
);
|
||||
};
|
||||
|
||||
const wrapperCls = classNames(`${prefixCls}-wrapper`, className, hashId, ctxUpload?.className, {
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
[`${prefixCls}-picture-card-wrapper`]: listType === 'picture-card',
|
||||
[`${prefixCls}-picture-circle-wrapper`]: listType === 'picture-circle',
|
||||
});
|
||||
const wrapperCls = classNames(
|
||||
`${prefixCls}-wrapper`,
|
||||
className,
|
||||
rootClassName,
|
||||
hashId,
|
||||
ctxUpload?.className,
|
||||
{
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
[`${prefixCls}-picture-card-wrapper`]: listType === 'picture-card',
|
||||
[`${prefixCls}-picture-circle-wrapper`]: listType === 'picture-circle',
|
||||
},
|
||||
);
|
||||
|
||||
const mergedStyle: React.CSSProperties = { ...ctxUpload?.style, ...style };
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
import demoTest from '../../../tests/shared/demoTest';
|
||||
|
||||
demoTest('upload', { skip: ['crop-image.tsx'], testRootProps: false });
|
||||
demoTest('upload', { skip: ['crop-image.tsx'] });
|
||||
|
@ -109,6 +109,7 @@ export interface UploadProps<T = any> extends Pick<RcUploadProps, 'capture'> {
|
||||
onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
|
||||
listType?: UploadListType;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
onPreview?: (file: UploadFile<T>) => void;
|
||||
onDownload?: (file: UploadFile<T>) => void;
|
||||
onRemove?: (file: UploadFile<T>) => void | boolean | Promise<void | boolean>;
|
||||
|
Loading…
Reference in New Issue
Block a user