@douyinfe/semi-ui 2.13.0 → 2.14.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autoComplete/_story/CustomTrigger/index.jsx +1 -1
- package/avatar/_story/avatar.stories.js +62 -5
- package/avatar/avatarGroup.tsx +16 -4
- package/avatar/index.tsx +88 -17
- package/backtop/index.tsx +11 -7
- package/badge/index.tsx +1 -1
- package/banner/index.tsx +5 -5
- package/breadcrumb/index.tsx +5 -3
- package/button/Button.tsx +10 -8
- package/calendar/_story/calendar.stories.js +125 -1
- package/card/index.tsx +43 -41
- package/carousel/CarouselArrow.tsx +2 -0
- package/carousel/index.tsx +1 -0
- package/cascader/_story/cascader.stories.js +21 -0
- package/cascader/index.tsx +99 -120
- package/cascader/item.tsx +1 -1
- package/checkbox/checkbox.tsx +13 -2
- package/collapsible/index.tsx +8 -1
- package/datePicker/dateInput.tsx +1 -0
- package/datePicker/datePicker.tsx +13 -5
- package/dist/css/semi.css +51 -35
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +933 -530
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/divider/index.tsx +8 -4
- package/dropdown/index.tsx +1 -1
- package/empty/index.tsx +13 -5
- package/form/hoc/withField.tsx +1 -1
- package/form/label.tsx +1 -1
- package/grid/col.tsx +1 -1
- package/grid/row.tsx +1 -1
- package/iconButton/index.tsx +2 -1
- package/input/_story/input.stories.js +32 -3
- package/input/index.tsx +45 -23
- package/input/inputGroup.tsx +3 -1
- package/input/textarea.tsx +2 -14
- package/lib/cjs/_base/base.css +14 -14
- package/lib/cjs/avatar/avatarGroup.d.ts +1 -1
- package/lib/cjs/avatar/avatarGroup.js +36 -9
- package/lib/cjs/avatar/index.d.ts +5 -0
- package/lib/cjs/avatar/index.js +121 -41
- package/lib/cjs/backtop/index.js +2 -1
- package/lib/cjs/badge/index.js +2 -1
- package/lib/cjs/banner/index.js +9 -4
- package/lib/cjs/breadcrumb/index.js +4 -3
- package/lib/cjs/button/Button.js +13 -3
- package/lib/cjs/card/index.js +10 -5
- package/lib/cjs/carousel/CarouselArrow.js +6 -2
- package/lib/cjs/carousel/index.js +2 -1
- package/lib/cjs/cascader/index.js +11 -6
- package/lib/cjs/cascader/item.js +2 -1
- package/lib/cjs/checkbox/checkbox.js +6 -2
- package/lib/cjs/collapsible/index.js +2 -1
- package/lib/cjs/datePicker/dateInput.js +2 -1
- package/lib/cjs/datePicker/datePicker.js +4 -2
- package/lib/cjs/divider/index.js +2 -1
- package/lib/cjs/dropdown/index.js +2 -1
- package/lib/cjs/empty/index.js +8 -4
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/form/hoc/withField.js +2 -1
- package/lib/cjs/form/label.js +2 -1
- package/lib/cjs/grid/col.js +2 -1
- package/lib/cjs/grid/row.js +2 -1
- package/lib/cjs/iconButton/index.js +3 -1
- package/lib/cjs/input/index.d.ts +0 -1
- package/lib/cjs/input/index.js +41 -36
- package/lib/cjs/input/inputGroup.js +2 -3
- package/lib/cjs/input/textarea.js +8 -15
- package/lib/cjs/list/index.js +6 -3
- package/lib/cjs/modal/ConfirmModal.js +2 -1
- package/lib/cjs/modal/Modal.js +6 -2
- package/lib/cjs/modal/ModalContent.js +13 -6
- package/lib/cjs/notification/notice.js +6 -3
- package/lib/cjs/pagination/index.js +4 -2
- package/lib/cjs/popconfirm/index.js +6 -3
- package/lib/cjs/radio/radio.d.ts +4 -0
- package/lib/cjs/radio/radio.js +32 -9
- package/lib/cjs/radio/radioInner.d.ts +6 -0
- package/lib/cjs/radio/radioInner.js +13 -4
- package/lib/cjs/rating/item.js +2 -1
- package/lib/cjs/scrollList/index.js +6 -3
- package/lib/cjs/select/index.js +10 -4
- package/lib/cjs/select/option.js +2 -1
- package/lib/cjs/sideSheet/SideSheetContent.js +6 -3
- package/lib/cjs/skeleton/index.js +3 -1
- package/lib/cjs/space/index.js +2 -1
- package/lib/cjs/spin/index.js +7 -3
- package/lib/cjs/switch/index.js +6 -4
- package/lib/cjs/table/Table.js +6 -3
- package/lib/cjs/tabs/TabBar.js +2 -1
- package/lib/cjs/tabs/TabPane.js +5 -2
- package/lib/cjs/tagInput/index.js +25 -15
- package/lib/cjs/timePicker/Combobox.js +3 -1
- package/lib/cjs/timePicker/TimePicker.js +2 -0
- package/lib/cjs/toast/toast.js +6 -3
- package/lib/cjs/tooltip/index.js +6 -1
- package/lib/cjs/transfer/index.js +2 -1
- package/lib/cjs/tree/treeNode.js +2 -1
- package/lib/cjs/treeSelect/index.js +10 -3
- package/lib/cjs/typography/base.js +2 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/index.d.ts +1 -1
- package/lib/cjs/upload/index.js +13 -6
- package/lib/es/_base/base.css +14 -14
- package/lib/es/avatar/avatarGroup.d.ts +1 -1
- package/lib/es/avatar/avatarGroup.js +37 -9
- package/lib/es/avatar/index.d.ts +5 -0
- package/lib/es/avatar/index.js +119 -38
- package/lib/es/backtop/index.js +2 -1
- package/lib/es/badge/index.js +2 -1
- package/lib/es/banner/index.js +9 -4
- package/lib/es/breadcrumb/index.js +4 -3
- package/lib/es/button/Button.js +11 -3
- package/lib/es/card/index.js +10 -5
- package/lib/es/carousel/CarouselArrow.js +6 -2
- package/lib/es/carousel/index.js +2 -1
- package/lib/es/cascader/index.js +11 -6
- package/lib/es/cascader/item.js +2 -1
- package/lib/es/checkbox/checkbox.js +6 -2
- package/lib/es/collapsible/index.js +2 -1
- package/lib/es/datePicker/dateInput.js +2 -1
- package/lib/es/datePicker/datePicker.js +4 -2
- package/lib/es/divider/index.js +2 -1
- package/lib/es/dropdown/index.js +2 -1
- package/lib/es/empty/index.js +8 -4
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +2 -1
- package/lib/es/form/label.js +2 -1
- package/lib/es/grid/col.js +2 -1
- package/lib/es/grid/row.js +2 -1
- package/lib/es/iconButton/index.js +3 -1
- package/lib/es/input/index.d.ts +0 -1
- package/lib/es/input/index.js +41 -36
- package/lib/es/input/inputGroup.js +2 -3
- package/lib/es/input/textarea.js +8 -15
- package/lib/es/list/index.js +6 -3
- package/lib/es/modal/ConfirmModal.js +2 -1
- package/lib/es/modal/Modal.js +6 -2
- package/lib/es/modal/ModalContent.js +13 -6
- package/lib/es/notification/notice.js +6 -3
- package/lib/es/pagination/index.js +4 -2
- package/lib/es/popconfirm/index.js +6 -3
- package/lib/es/radio/radio.d.ts +4 -0
- package/lib/es/radio/radio.js +32 -9
- package/lib/es/radio/radioInner.d.ts +6 -0
- package/lib/es/radio/radioInner.js +13 -4
- package/lib/es/rating/item.js +2 -1
- package/lib/es/scrollList/index.js +6 -3
- package/lib/es/select/index.js +10 -4
- package/lib/es/select/option.js +2 -1
- package/lib/es/sideSheet/SideSheetContent.js +6 -3
- package/lib/es/skeleton/index.js +3 -1
- package/lib/es/space/index.js +2 -1
- package/lib/es/spin/index.js +7 -3
- package/lib/es/switch/index.js +6 -4
- package/lib/es/table/Table.js +6 -3
- package/lib/es/tabs/TabBar.js +2 -1
- package/lib/es/tabs/TabPane.js +5 -2
- package/lib/es/tagInput/index.js +25 -15
- package/lib/es/timePicker/Combobox.js +3 -1
- package/lib/es/timePicker/TimePicker.js +2 -0
- package/lib/es/toast/toast.js +6 -3
- package/lib/es/tooltip/index.js +6 -1
- package/lib/es/transfer/index.js +2 -1
- package/lib/es/tree/treeNode.js +2 -1
- package/lib/es/treeSelect/index.js +10 -3
- package/lib/es/typography/base.js +2 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/index.d.ts +1 -1
- package/lib/es/upload/index.js +13 -6
- package/list/index.tsx +16 -4
- package/modal/ConfirmModal.tsx +1 -1
- package/modal/Modal.tsx +2 -0
- package/modal/ModalContent.tsx +27 -14
- package/notification/notice.tsx +16 -4
- package/package.json +8 -8
- package/pagination/index.tsx +16 -2
- package/popconfirm/index.tsx +11 -3
- package/radio/_story/radio.stories.js +9 -6
- package/radio/radio.tsx +37 -7
- package/radio/radioInner.tsx +11 -2
- package/rating/item.tsx +1 -1
- package/scrollList/index.tsx +19 -3
- package/select/index.tsx +13 -4
- package/select/option.tsx +5 -1
- package/sideSheet/SideSheetContent.tsx +3 -3
- package/skeleton/index.tsx +1 -1
- package/space/index.tsx +1 -1
- package/spin/index.tsx +15 -9
- package/switch/index.tsx +9 -14
- package/table/Table.tsx +5 -3
- package/tabs/TabBar.tsx +1 -1
- package/tabs/TabPane.tsx +9 -4
- package/tagInput/index.tsx +23 -4
- package/timePicker/Combobox.tsx +6 -1
- package/timePicker/TimePicker.tsx +1 -0
- package/toast/toast.tsx +3 -3
- package/tooltip/index.tsx +4 -1
- package/transfer/index.tsx +1 -0
- package/tree/treeNode.tsx +1 -1
- package/treeSelect/_story/treeSelect.stories.js +161 -2
- package/treeSelect/index.tsx +17 -3
- package/typography/base.tsx +1 -1
- package/upload/index.tsx +107 -38
- package/yarn-error.log +26235 -0
package/upload/index.tsx
CHANGED
|
@@ -3,25 +3,54 @@ import React, { ReactNode, CSSProperties, RefObject, ChangeEvent, DragEvent } fr
|
|
|
3
3
|
import cls from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { noop, pick } from 'lodash';
|
|
6
|
-
import UploadFoundation, {
|
|
6
|
+
import UploadFoundation, {
|
|
7
|
+
CustomFile,
|
|
8
|
+
UploadAdapter,
|
|
9
|
+
BeforeUploadObjectResult,
|
|
10
|
+
AfterUploadResult,
|
|
11
|
+
} from '@douyinfe/semi-foundation/upload/foundation';
|
|
7
12
|
import { strings, cssClasses } from '@douyinfe/semi-foundation/upload/constants';
|
|
8
13
|
import FileCard from './fileCard';
|
|
9
14
|
import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
10
15
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
11
16
|
import { IconUpload } from '@douyinfe/semi-icons';
|
|
12
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
FileItem,
|
|
19
|
+
RenderFileItemProps,
|
|
20
|
+
UploadListType,
|
|
21
|
+
PromptPositionType,
|
|
22
|
+
BeforeUploadProps,
|
|
23
|
+
AfterUploadProps,
|
|
24
|
+
OnChangeProps,
|
|
25
|
+
customRequestArgs,
|
|
26
|
+
CustomError,
|
|
27
|
+
} from './interface';
|
|
13
28
|
import { Locale } from '../locale/interface';
|
|
14
29
|
import '@douyinfe/semi-foundation/upload/upload.scss';
|
|
15
30
|
|
|
16
31
|
const prefixCls = cssClasses.PREFIX;
|
|
17
32
|
|
|
18
|
-
export {
|
|
33
|
+
export {
|
|
34
|
+
FileItem,
|
|
35
|
+
RenderFileItemProps,
|
|
36
|
+
UploadListType,
|
|
37
|
+
PromptPositionType,
|
|
38
|
+
BeforeUploadProps,
|
|
39
|
+
AfterUploadProps,
|
|
40
|
+
OnChangeProps,
|
|
41
|
+
customRequestArgs,
|
|
42
|
+
CustomError,
|
|
43
|
+
BeforeUploadObjectResult,
|
|
44
|
+
AfterUploadResult,
|
|
45
|
+
};
|
|
19
46
|
|
|
20
47
|
export interface UploadProps {
|
|
21
48
|
accept?: string;
|
|
22
49
|
action: string;
|
|
23
50
|
afterUpload?: (object: AfterUploadProps) => AfterUploadResult;
|
|
24
|
-
beforeUpload?: (
|
|
51
|
+
beforeUpload?: (
|
|
52
|
+
object: BeforeUploadProps
|
|
53
|
+
) => BeforeUploadObjectResult | Promise<BeforeUploadObjectResult> | boolean;
|
|
25
54
|
beforeClear?: (fileList: Array<FileItem>) => boolean | Promise<boolean>;
|
|
26
55
|
beforeRemove?: (file: FileItem, fileList: Array<FileItem>) => boolean | Promise<boolean>;
|
|
27
56
|
capture?: boolean | 'user' | 'environment' | undefined;
|
|
@@ -114,7 +143,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
114
143
|
fileList: PropTypes.array, // files had been uploaded
|
|
115
144
|
fileName: PropTypes.string, // same as name, to avoid props conflict in Form.Upload
|
|
116
145
|
headers: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
|
117
|
-
hotSpotLocation: PropTypes.oneOf(['start','end']),
|
|
146
|
+
hotSpotLocation: PropTypes.oneOf(['start', 'end']),
|
|
118
147
|
itemStyle: PropTypes.object,
|
|
119
148
|
limit: PropTypes.number, // 最大允许上传文件个数
|
|
120
149
|
listType: PropTypes.oneOf<UploadProps['listType']>(strings.LIST_TYPE),
|
|
@@ -218,7 +247,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
218
247
|
const { fileList } = props;
|
|
219
248
|
if ('fileList' in props) {
|
|
220
249
|
return {
|
|
221
|
-
fileList: fileList || []
|
|
250
|
+
fileList: fileList || [],
|
|
222
251
|
};
|
|
223
252
|
}
|
|
224
253
|
return null;
|
|
@@ -228,7 +257,8 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
228
257
|
return {
|
|
229
258
|
...super.adapter,
|
|
230
259
|
notifyFileSelect: (files): void => this.props.onFileChange(files),
|
|
231
|
-
notifyError: (error, fileInstance, fileList, xhr): void =>
|
|
260
|
+
notifyError: (error, fileInstance, fileList, xhr): void =>
|
|
261
|
+
this.props.onError(error, fileInstance, fileList, xhr),
|
|
232
262
|
notifySuccess: (responseBody, file, fileList): void => this.props.onSuccess(responseBody, file, fileList),
|
|
233
263
|
notifyProgress: (percent, file, fileList): void => this.props.onProgress(percent, file, fileList),
|
|
234
264
|
notifyRemove: (file, fileList, fileItem): void => this.props.onRemove(file, fileList, fileItem),
|
|
@@ -241,19 +271,25 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
241
271
|
this.setState({ fileList });
|
|
242
272
|
}
|
|
243
273
|
},
|
|
244
|
-
notifyBeforeUpload: ({
|
|
245
|
-
|
|
274
|
+
notifyBeforeUpload: ({
|
|
275
|
+
file,
|
|
276
|
+
fileList,
|
|
277
|
+
}): boolean | BeforeUploadObjectResult | Promise<BeforeUploadObjectResult> =>
|
|
278
|
+
this.props.beforeUpload({ file, fileList }),
|
|
279
|
+
notifyAfterUpload: ({ response, file, fileList }): AfterUploadResult =>
|
|
280
|
+
this.props.afterUpload({ response, file, fileList }),
|
|
246
281
|
resetInput: (): void => {
|
|
247
282
|
this.setState(prevState => ({
|
|
248
|
-
inputKey: Math.random()
|
|
283
|
+
inputKey: Math.random(),
|
|
249
284
|
}));
|
|
250
285
|
},
|
|
251
286
|
resetReplaceInput: (): void => {
|
|
252
287
|
this.setState(prevState => ({
|
|
253
|
-
replaceInputKey: Math.random()
|
|
288
|
+
replaceInputKey: Math.random(),
|
|
254
289
|
}));
|
|
255
290
|
},
|
|
256
|
-
updateDragAreaStatus: (dragAreaStatus: string): void =>
|
|
291
|
+
updateDragAreaStatus: (dragAreaStatus: string): void =>
|
|
292
|
+
this.setState({ dragAreaStatus } as { dragAreaStatus: 'default' | 'legal' | 'illegal' }),
|
|
257
293
|
notifyChange: ({ currentFile, fileList }): void => this.props.onChange({ currentFile, fileList }),
|
|
258
294
|
updateLocalUrls: (urls): void => this.setState({ localUrls: urls }),
|
|
259
295
|
notifyClear: (): void => this.props.onClear(),
|
|
@@ -295,7 +331,6 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
295
331
|
this.setState({ replaceIdx: index }, () => {
|
|
296
332
|
this.replaceInputRef.current.click();
|
|
297
333
|
});
|
|
298
|
-
|
|
299
334
|
};
|
|
300
335
|
|
|
301
336
|
onReplaceChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
|
@@ -316,11 +351,11 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
316
351
|
* insert files at index
|
|
317
352
|
* @param files Array<CustomFile>
|
|
318
353
|
* @param index number
|
|
319
|
-
* @returns
|
|
354
|
+
* @returns
|
|
320
355
|
*/
|
|
321
356
|
insert = (files: Array<CustomFile>, index: number): void => {
|
|
322
357
|
return this.foundation.insertFileToList(files, index);
|
|
323
|
-
}
|
|
358
|
+
};
|
|
324
359
|
|
|
325
360
|
/**
|
|
326
361
|
* ref method
|
|
@@ -333,7 +368,19 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
333
368
|
|
|
334
369
|
renderFile = (file: FileItem, index: number, locale: Locale['Upload']): ReactNode => {
|
|
335
370
|
const { name, status, validateMessage, _sizeInvalid, uid } = file;
|
|
336
|
-
const {
|
|
371
|
+
const {
|
|
372
|
+
previewFile,
|
|
373
|
+
listType,
|
|
374
|
+
itemStyle,
|
|
375
|
+
showPicInfo,
|
|
376
|
+
renderPicInfo,
|
|
377
|
+
renderPicPreviewIcon,
|
|
378
|
+
renderFileOperation,
|
|
379
|
+
renderFileItem,
|
|
380
|
+
renderThumbnail,
|
|
381
|
+
disabled,
|
|
382
|
+
onPreviewClick,
|
|
383
|
+
} = this.props;
|
|
337
384
|
const onRemove = (): void => this.remove(file);
|
|
338
385
|
const onRetry = (): void => {
|
|
339
386
|
this.foundation.retry(file);
|
|
@@ -358,7 +405,10 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
358
405
|
renderFileOperation,
|
|
359
406
|
renderThumbnail,
|
|
360
407
|
onReplace,
|
|
361
|
-
onPreviewClick:
|
|
408
|
+
onPreviewClick:
|
|
409
|
+
typeof onPreviewClick !== 'undefined'
|
|
410
|
+
? (): void => this.foundation.handlePreviewClick(file)
|
|
411
|
+
: undefined,
|
|
362
412
|
};
|
|
363
413
|
|
|
364
414
|
if (status === strings.FILE_STATUS_UPLOAD_FAIL && !validateMessage) {
|
|
@@ -404,7 +454,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
404
454
|
});
|
|
405
455
|
const dragAreaCls = cls({
|
|
406
456
|
[`${dragAreaBaseCls}-legal`]: dragAreaStatus === strings.DRAG_AREA_LEGAL,
|
|
407
|
-
[`${dragAreaBaseCls}-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL
|
|
457
|
+
[`${dragAreaBaseCls}-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL,
|
|
408
458
|
});
|
|
409
459
|
const mainCls = `${prefixCls}-file-list-main`;
|
|
410
460
|
const addContentProps = {
|
|
@@ -413,7 +463,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
413
463
|
onClick: this.onClick,
|
|
414
464
|
};
|
|
415
465
|
const containerProps = {
|
|
416
|
-
className: fileListCls
|
|
466
|
+
className: fileListCls,
|
|
417
467
|
};
|
|
418
468
|
const draggableProps = {
|
|
419
469
|
onDrop: this.onDrop,
|
|
@@ -425,7 +475,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
425
475
|
Object.assign(addContentProps, draggableProps, { className: cls(uploadAddCls, dragAreaCls) });
|
|
426
476
|
}
|
|
427
477
|
const addContent = (
|
|
428
|
-
<div {...addContentProps}>
|
|
478
|
+
<div {...addContentProps} x-semi-prop="children">
|
|
429
479
|
{children}
|
|
430
480
|
</div>
|
|
431
481
|
);
|
|
@@ -450,7 +500,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
450
500
|
)}
|
|
451
501
|
</LocaleConsumer>
|
|
452
502
|
);
|
|
453
|
-
}
|
|
503
|
+
};
|
|
454
504
|
|
|
455
505
|
renderFileListDefault = () => {
|
|
456
506
|
const { showUploadList, limit, disabled } = this.props;
|
|
@@ -462,7 +512,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
462
512
|
const showTitle = limit !== 1 && fileList.length;
|
|
463
513
|
const showClear = this.props.showClear && !disabled;
|
|
464
514
|
const containerProps = {
|
|
465
|
-
className: fileListCls
|
|
515
|
+
className: fileListCls,
|
|
466
516
|
};
|
|
467
517
|
|
|
468
518
|
if (!showUploadList || !fileList.length) {
|
|
@@ -477,7 +527,12 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
477
527
|
<div className={titleCls}>
|
|
478
528
|
<span className={`${titleCls}-choosen`}>{locale.selectedFiles}</span>
|
|
479
529
|
{showClear ? (
|
|
480
|
-
<span
|
|
530
|
+
<span
|
|
531
|
+
role="button"
|
|
532
|
+
tabIndex={0}
|
|
533
|
+
onClick={this.clear}
|
|
534
|
+
className={`${titleCls}-clear`}
|
|
535
|
+
>
|
|
481
536
|
{locale.clear}
|
|
482
537
|
</span>
|
|
483
538
|
) : null}
|
|
@@ -491,7 +546,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
491
546
|
)}
|
|
492
547
|
</LocaleConsumer>
|
|
493
548
|
);
|
|
494
|
-
}
|
|
549
|
+
};
|
|
495
550
|
|
|
496
551
|
onDrop = (e: DragEvent<HTMLDivElement>): void => {
|
|
497
552
|
this.foundation.handleDrop(e);
|
|
@@ -524,7 +579,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
524
579
|
{children}
|
|
525
580
|
</div>
|
|
526
581
|
);
|
|
527
|
-
}
|
|
582
|
+
};
|
|
528
583
|
|
|
529
584
|
renderDragArea = (): ReactNode => {
|
|
530
585
|
const { dragAreaStatus } = this.state;
|
|
@@ -554,14 +609,16 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
554
609
|
children
|
|
555
610
|
) : (
|
|
556
611
|
<>
|
|
557
|
-
<div className={`${dragAreaBaseCls}-icon`}>
|
|
612
|
+
<div className={`${dragAreaBaseCls}-icon`} x-semi-prop="dragIcon">
|
|
558
613
|
{dragIcon || <IconUpload size="extra-large" />}
|
|
559
614
|
</div>
|
|
560
615
|
<div className={`${dragAreaBaseCls}-text`}>
|
|
561
|
-
<div className={`${dragAreaBaseCls}-main-text`}>
|
|
616
|
+
<div className={`${dragAreaBaseCls}-main-text`} x-semi-prop="dragMainText">
|
|
562
617
|
{dragMainText || locale.mainText}
|
|
563
618
|
</div>
|
|
564
|
-
<div className={`${dragAreaBaseCls}-sub-text`}
|
|
619
|
+
<div className={`${dragAreaBaseCls}-sub-text`} x-semi-prop="dragSubText">
|
|
620
|
+
{dragSubText}
|
|
621
|
+
</div>
|
|
565
622
|
<div className={`${dragAreaBaseCls}-tips`}>
|
|
566
623
|
{dragAreaStatus === strings.DRAG_AREA_LEGAL && (
|
|
567
624
|
<span className={`${dragAreaBaseCls}-tips-legal`}>{locale.legalTips}</span>
|
|
@@ -598,14 +655,18 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
598
655
|
validateStatus,
|
|
599
656
|
directory,
|
|
600
657
|
} = this.props;
|
|
601
|
-
const uploadCls = cls(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
658
|
+
const uploadCls = cls(
|
|
659
|
+
prefixCls,
|
|
660
|
+
{
|
|
661
|
+
[`${prefixCls}-picture`]: listType === strings.FILE_LIST_PIC,
|
|
662
|
+
[`${prefixCls}-disabled`]: disabled,
|
|
663
|
+
[`${prefixCls}-default`]: validateStatus === 'default',
|
|
664
|
+
[`${prefixCls}-error`]: validateStatus === 'error',
|
|
665
|
+
[`${prefixCls}-warning`]: validateStatus === 'warning',
|
|
666
|
+
[`${prefixCls}-success`]: validateStatus === 'success',
|
|
667
|
+
},
|
|
668
|
+
className
|
|
669
|
+
);
|
|
609
670
|
const inputCls = cls(`${prefixCls}-hidden-input`);
|
|
610
671
|
const inputReplaceCls = cls(`${prefixCls}-hidden-input-replace`);
|
|
611
672
|
const promptCls = cls(`${prefixCls}-prompt`);
|
|
@@ -640,9 +701,17 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
640
701
|
ref={this.replaceInputRef}
|
|
641
702
|
/>
|
|
642
703
|
{this.renderAddContent()}
|
|
643
|
-
{prompt ?
|
|
704
|
+
{prompt ? (
|
|
705
|
+
<div className={promptCls} x-semi-prop="prompt">
|
|
706
|
+
{prompt}
|
|
707
|
+
</div>
|
|
708
|
+
) : null}
|
|
644
709
|
|
|
645
|
-
{validateMessage ?
|
|
710
|
+
{validateMessage ? (
|
|
711
|
+
<div className={validateMsgCls} x-semi-prop="validateMessage">
|
|
712
|
+
{validateMessage}
|
|
713
|
+
</div>
|
|
714
|
+
) : null}
|
|
646
715
|
{this.renderFileList()}
|
|
647
716
|
</div>
|
|
648
717
|
);
|