Skip to content

Commit

Permalink
feat: add innserStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Oct 18, 2023
1 parent 6e24053 commit 6ef64a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/AjaxUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ class AjaxUploader extends Component<UploadProps> {
className,
disabled,
id,
style,
style: rootStyle,
innerStyle,
multiple,
accept,
capture,
Expand Down Expand Up @@ -298,7 +299,7 @@ class AjaxUploader extends Component<UploadProps> {
tabIndex: '0',
};
return (
<Tag {...events} className={cls} role="button" style={style}>
<Tag {...events} className={cls} role="button" style={rootStyle}>
<input
{...pickAttrs(otherProps, { aria: true, data: true })}
id={id}
Expand All @@ -307,7 +308,7 @@ class AjaxUploader extends Component<UploadProps> {
ref={this.saveFileInput}
onClick={e => e.stopPropagation()} // https://github.com/ant-design/ant-design/issues/19948
key={this.state.uid}
style={{ display: 'none' }}
style={{ display: 'none', ...(innerStyle ?? {}) }}
accept={accept}
{...dirProps}
multiple={multiple}
Expand Down
5 changes: 5 additions & 0 deletions src/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export interface UploadProps
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement>) => void;
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement>) => void;
onClick?: (e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>) => void;
/**
* Inline styles that actually act on the input tag,
* whereas the previous `style` only acted on its parent container.
*/
innerStyle?: React.CSSProperties;
}

export interface UploadProgressEvent extends Partial<ProgressEvent> {
Expand Down

0 comments on commit 6ef64a9

Please sign in to comment.