Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/AjaxUploader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */
import clsx from 'classnames';
import pickAttrs from 'rc-util/lib/pickAttrs';
import warning from 'rc-util/lib/warning';
import React, { Component } from 'react';
import attrAccept from './attr-accept';
import type {
Expand Down Expand Up @@ -321,21 +322,26 @@ class AjaxUploader extends Component<UploadProps> {
capture,
children,
directory,
folder,
openFileDialogOnClick,
onMouseEnter,
onMouseLeave,
hasControlInside,
...otherProps
} = this.props;

warning(
Comment thread
linxianxi marked this conversation as resolved.
Outdated
!('directory' in this.props),
'directory will be deprecated, please use folder. folder will not filter files other than accept, just like the native method.',
);
const cls = clsx({
[prefixCls]: true,
[`${prefixCls}-disabled`]: disabled,
[className]: className,
});
// because input don't have directory/webkitdirectory type declaration
const dirProps: any = directory
? { directory: 'directory', webkitdirectory: 'webkitdirectory' }
: {};
const dirProps: any =
Comment thread
linxianxi marked this conversation as resolved.
directory || folder ? { directory: 'directory', webkitdirectory: 'webkitdirectory' } : {};
const events = disabled
? {}
: {
Expand Down
2 changes: 2 additions & 0 deletions src/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export interface UploadProps
component?: React.ComponentType<any> | string;
action?: Action;
method?: UploadRequestMethod;
/** @deprecated Please use `folder` instead */
directory?: boolean;
folder?: boolean;
data?: Record<string, unknown> | ((file: RcFile | string | Blob) => Record<string, unknown>);
headers?: UploadRequestHeader;
accept?: string;
Expand Down
Loading