mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +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 = '',
|
action = '',
|
||||||
accept = '',
|
accept = '',
|
||||||
supportServerRender = true,
|
supportServerRender = true,
|
||||||
|
rootClassName,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
// ===================== Disabled =====================
|
// ===================== Disabled =====================
|
||||||
@ -405,11 +406,18 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapperCls = classNames(`${prefixCls}-wrapper`, className, hashId, ctxUpload?.className, {
|
const wrapperCls = classNames(
|
||||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
`${prefixCls}-wrapper`,
|
||||||
[`${prefixCls}-picture-card-wrapper`]: listType === 'picture-card',
|
className,
|
||||||
[`${prefixCls}-picture-circle-wrapper`]: listType === 'picture-circle',
|
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 };
|
const mergedStyle: React.CSSProperties = { ...ctxUpload?.style, ...style };
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import demoTest from '../../../tests/shared/demoTest';
|
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;
|
onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
|
||||||
listType?: UploadListType;
|
listType?: UploadListType;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
rootClassName?: string;
|
||||||
onPreview?: (file: UploadFile<T>) => void;
|
onPreview?: (file: UploadFile<T>) => void;
|
||||||
onDownload?: (file: UploadFile<T>) => void;
|
onDownload?: (file: UploadFile<T>) => void;
|
||||||
onRemove?: (file: UploadFile<T>) => void | boolean | Promise<void | boolean>;
|
onRemove?: (file: UploadFile<T>) => void | boolean | Promise<void | boolean>;
|
||||||
|
Loading…
Reference in New Issue
Block a user