@douyinfe/semi-ui 2.1.6-alpha.0 → 2.2.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/_base/_story/a11y.jsx +1302 -0
- package/_base/_story/a11y.scss +49 -0
- package/_base/_story/index.stories.js +3 -1
- package/_utils/index.ts +9 -4
- package/cascader/__test__/cascader.test.js +221 -0
- package/cascader/_story/cascader.stories.js +138 -0
- package/cascader/index.tsx +37 -21
- package/cascader/item.tsx +4 -2
- package/datePicker/__test__/datePicker.test.js +100 -2
- package/datePicker/_story/datePicker.stories.js +90 -1
- package/datePicker/_story/v2/YearButton.jsx +17 -0
- package/datePicker/_story/v2/index.js +1 -0
- package/datePicker/datePicker.tsx +3 -0
- package/datePicker/monthsGrid.tsx +12 -1
- package/datePicker/navigation.tsx +55 -29
- package/descriptions/__test__/descriptions.test.js +27 -1
- package/descriptions/_story/descriptions.stories.js +52 -2
- package/descriptions/item.tsx +1 -1
- package/dist/css/semi.css +72 -28
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +1086 -468
- 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/empty/index.tsx +2 -2
- package/gulpfile.js +2 -1
- package/lib/cjs/_utils/index.d.ts +1 -0
- package/lib/cjs/_utils/index.js +12 -5
- package/lib/cjs/cascader/index.d.ts +7 -0
- package/lib/cjs/cascader/index.js +35 -22
- package/lib/cjs/cascader/item.d.ts +2 -0
- package/lib/cjs/cascader/item.js +4 -2
- package/lib/cjs/datePicker/datePicker.js +4 -0
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.js +6 -0
- package/lib/cjs/datePicker/navigation.js +47 -7
- package/lib/cjs/descriptions/item.js +1 -1
- package/lib/cjs/empty/index.d.ts +2 -2
- package/lib/cjs/empty/index.js +19 -18
- package/lib/cjs/form/baseForm.d.ts +6 -1
- package/lib/cjs/form/field.d.ts +6 -1
- package/lib/cjs/locale/source/es.d.ts +7 -0
- package/lib/cjs/locale/source/es.js +168 -0
- package/lib/cjs/rating/item.js +1 -1
- package/lib/cjs/select/index.d.ts +9 -0
- package/lib/cjs/select/index.js +10 -8
- package/lib/cjs/tabs/index.js +3 -7
- package/lib/cjs/timeline/item.d.ts +3 -0
- package/lib/cjs/timeline/item.js +10 -4
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/fileCard.d.ts +2 -0
- package/lib/cjs/upload/fileCard.js +70 -45
- package/lib/cjs/upload/index.d.ts +23 -2
- package/lib/cjs/upload/index.js +133 -25
- package/lib/cjs/upload/interface.d.ts +3 -0
- package/lib/es/_utils/index.d.ts +1 -0
- package/lib/es/_utils/index.js +12 -5
- package/lib/es/cascader/index.d.ts +7 -0
- package/lib/es/cascader/index.js +34 -25
- package/lib/es/cascader/item.d.ts +2 -0
- package/lib/es/cascader/item.js +4 -2
- package/lib/es/datePicker/datePicker.js +4 -0
- package/lib/es/datePicker/monthsGrid.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.js +6 -0
- package/lib/es/datePicker/navigation.js +48 -8
- package/lib/es/descriptions/item.js +1 -1
- package/lib/es/empty/index.d.ts +2 -2
- package/lib/es/empty/index.js +19 -18
- package/lib/es/form/baseForm.d.ts +6 -1
- package/lib/es/form/field.d.ts +6 -1
- package/lib/es/locale/source/es.d.ts +7 -0
- package/lib/es/locale/source/es.js +157 -0
- package/lib/es/rating/item.js +1 -1
- package/lib/es/select/index.d.ts +9 -0
- package/lib/es/select/index.js +14 -8
- package/lib/es/tabs/index.js +1 -5
- package/lib/es/timeline/item.d.ts +3 -0
- package/lib/es/timeline/item.js +9 -4
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/fileCard.d.ts +2 -0
- package/lib/es/upload/fileCard.js +69 -44
- package/lib/es/upload/index.d.ts +23 -2
- package/lib/es/upload/index.js +133 -24
- package/lib/es/upload/interface.d.ts +3 -0
- package/locale/source/es.ts +160 -0
- package/package.json +9 -9
- package/popover/Arrow.tsx +1 -1
- package/rating/item.tsx +1 -1
- package/select/_story/select.stories.js +25 -0
- package/select/index.tsx +17 -6
- package/tabs/index.tsx +1 -1
- package/timeline/_story/timeline.stories.js +50 -0
- package/timeline/item.tsx +7 -2
- package/upload/__test__/upload.test.js +50 -1
- package/upload/fileCard.tsx +110 -95
- package/upload/index.tsx +147 -53
- package/upload/interface.ts +3 -0
package/upload/index.tsx
CHANGED
|
@@ -3,7 +3,7 @@ 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 } from 'lodash';
|
|
6
|
-
import UploadFoundation, {
|
|
6
|
+
import UploadFoundation, { CustomFile, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/upload/foundation';
|
|
7
7
|
import { strings, cssClasses } from '@douyinfe/semi-foundation/upload/constants';
|
|
8
8
|
import FileCard from './fileCard';
|
|
9
9
|
import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
@@ -64,7 +64,10 @@ export interface UploadProps {
|
|
|
64
64
|
prompt?: ReactNode;
|
|
65
65
|
promptPosition?: PromptPositionType;
|
|
66
66
|
renderFileItem?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
67
|
+
renderPicInfo?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
68
|
+
renderThumbnail?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
67
69
|
showClear?: boolean;
|
|
70
|
+
showPicInfo?: boolean; // Show pic info in picture wall
|
|
68
71
|
showReplace?: boolean; // Display replacement function
|
|
69
72
|
showRetry?: boolean;
|
|
70
73
|
showUploadList?: boolean;
|
|
@@ -133,7 +136,10 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
133
136
|
prompt: PropTypes.node,
|
|
134
137
|
promptPosition: PropTypes.oneOf<UploadProps['promptPosition']>(strings.PROMPT_POSITION),
|
|
135
138
|
renderFileItem: PropTypes.func,
|
|
139
|
+
renderPicInfo: PropTypes.func,
|
|
140
|
+
renderThumbnail: PropTypes.func,
|
|
136
141
|
showClear: PropTypes.bool,
|
|
142
|
+
showPicInfo: PropTypes.bool,
|
|
137
143
|
showReplace: PropTypes.bool,
|
|
138
144
|
showRetry: PropTypes.bool,
|
|
139
145
|
showUploadList: PropTypes.bool, // whether to show fileList
|
|
@@ -168,6 +174,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
168
174
|
onSuccess: noop,
|
|
169
175
|
promptPosition: 'right' as const,
|
|
170
176
|
showClear: true,
|
|
177
|
+
showPicInfo: false,
|
|
171
178
|
showReplace: false,
|
|
172
179
|
showRetry: true,
|
|
173
180
|
showUploadList: true,
|
|
@@ -297,14 +304,29 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
297
304
|
this.foundation.handleRemove(fileItem);
|
|
298
305
|
};
|
|
299
306
|
|
|
307
|
+
/**
|
|
308
|
+
* ref method
|
|
309
|
+
* insert files at index
|
|
310
|
+
* @param files Array<CustomFile>
|
|
311
|
+
* @param index number
|
|
312
|
+
* @returns
|
|
313
|
+
*/
|
|
314
|
+
insert = (files: Array<CustomFile>, index: number): void => {
|
|
315
|
+
return this.foundation.insertFileToList(files, index);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* ref method
|
|
320
|
+
* manual upload by user
|
|
321
|
+
*/
|
|
300
322
|
upload = (): void => {
|
|
301
323
|
const { fileList } = this.state;
|
|
302
324
|
this.foundation.startUpload(fileList);
|
|
303
325
|
};
|
|
304
326
|
|
|
305
327
|
renderFile = (file: FileItem, index: number, locale: Locale['Upload']): ReactNode => {
|
|
306
|
-
const { name, status, validateMessage, _sizeInvalid } = file;
|
|
307
|
-
const { previewFile, listType, itemStyle, showRetry, renderFileItem, disabled, onPreviewClick, showReplace } = this.props;
|
|
328
|
+
const { name, status, validateMessage, _sizeInvalid, uid } = file;
|
|
329
|
+
const { previewFile, listType, itemStyle, showRetry, showPicInfo, renderPicInfo, renderFileItem, renderThumbnail, disabled, onPreviewClick, showReplace } = this.props;
|
|
308
330
|
const onRemove = (): void => this.remove(file);
|
|
309
331
|
const onRetry = (): void => {
|
|
310
332
|
this.foundation.retry(file);
|
|
@@ -318,10 +340,14 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
318
340
|
listType,
|
|
319
341
|
onRemove,
|
|
320
342
|
onRetry,
|
|
321
|
-
|
|
343
|
+
index,
|
|
344
|
+
key: uid || `${name}${index}`,
|
|
322
345
|
showRetry: typeof file.showRetry !== 'undefined' ? file.showRetry : showRetry,
|
|
323
346
|
style: itemStyle,
|
|
324
347
|
disabled,
|
|
348
|
+
showPicInfo,
|
|
349
|
+
renderPicInfo,
|
|
350
|
+
renderThumbnail,
|
|
325
351
|
showReplace: typeof file.showReplace !== 'undefined' ? file.showReplace : showReplace,
|
|
326
352
|
onReplace,
|
|
327
353
|
onPreviewClick: typeof onPreviewClick !== 'undefined' ? (): void => this.foundation.handlePreviewClick(file) : undefined,
|
|
@@ -343,17 +369,54 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
343
369
|
};
|
|
344
370
|
|
|
345
371
|
renderFileList = (): ReactNode => {
|
|
346
|
-
const {
|
|
347
|
-
|
|
372
|
+
const { listType } = this.props;
|
|
373
|
+
if (listType === strings.FILE_LIST_PIC) {
|
|
374
|
+
return this.renderFileListPic();
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (listType === strings.FILE_LIST_DEFAULT) {
|
|
378
|
+
return this.renderFileListDefault();
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
return null;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
renderFileListPic = () => {
|
|
385
|
+
const { showUploadList, limit, disabled, children, draggable } = this.props;
|
|
386
|
+
const { fileList: stateFileList, dragAreaStatus } = this.state;
|
|
348
387
|
const fileList = this.props.fileList || stateFileList;
|
|
349
|
-
const
|
|
350
|
-
const
|
|
351
|
-
const uploadAddCls = cls(`${prefixCls
|
|
352
|
-
[`${prefixCls
|
|
353
|
-
[`${prefixCls}-picture-add-disabled`]: disabled
|
|
388
|
+
const showAddTriggerInList = limit ? limit > fileList.length : true;
|
|
389
|
+
const dragAreaBaseCls = `${prefixCls}-drag-area`;
|
|
390
|
+
const uploadAddCls = cls(`${prefixCls}-add`, {
|
|
391
|
+
[`${prefixCls}-picture-add`]: true,
|
|
392
|
+
[`${prefixCls}-picture-add-disabled`]: disabled,
|
|
354
393
|
});
|
|
394
|
+
const fileListCls = cls(`${prefixCls}-file-list`, {
|
|
395
|
+
[`${prefixCls}-picture-file-list`]: true,
|
|
396
|
+
});
|
|
397
|
+
const dragAreaCls = cls({
|
|
398
|
+
[`${dragAreaBaseCls}-legal`]: dragAreaStatus === strings.DRAG_AREA_LEGAL,
|
|
399
|
+
[`${dragAreaBaseCls}-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL
|
|
400
|
+
});
|
|
401
|
+
const mainCls = `${prefixCls}-file-list-main`;
|
|
402
|
+
const addContentProps = {
|
|
403
|
+
className: uploadAddCls,
|
|
404
|
+
onClick: this.onClick,
|
|
405
|
+
};
|
|
406
|
+
const containerProps = {
|
|
407
|
+
className: fileListCls
|
|
408
|
+
};
|
|
409
|
+
const draggableProps = {
|
|
410
|
+
onDrop: this.onDrop,
|
|
411
|
+
onDragOver: this.onDragOver,
|
|
412
|
+
onDragLeave: this.onDragLeave,
|
|
413
|
+
onDragEnter: this.onDragEnter,
|
|
414
|
+
};
|
|
415
|
+
if (draggable) {
|
|
416
|
+
Object.assign(addContentProps, draggableProps, { className: cls(uploadAddCls, dragAreaCls) });
|
|
417
|
+
}
|
|
355
418
|
const addContent = (
|
|
356
|
-
<div
|
|
419
|
+
<div {...addContentProps}>
|
|
357
420
|
{children}
|
|
358
421
|
</div>
|
|
359
422
|
);
|
|
@@ -365,23 +428,46 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
365
428
|
return null;
|
|
366
429
|
}
|
|
367
430
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
431
|
+
return (
|
|
432
|
+
<LocaleConsumer componentName="Upload">
|
|
433
|
+
{(locale: Locale['Upload']) => (
|
|
434
|
+
<div {...containerProps}>
|
|
435
|
+
<div className={mainCls}>
|
|
436
|
+
{fileList.map((file, index) => this.renderFile(file, index, locale))}
|
|
437
|
+
{showAddTriggerInList ? addContent : null}
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
)}
|
|
441
|
+
</LocaleConsumer>
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
renderFileListDefault = () => {
|
|
446
|
+
const { showUploadList, limit, disabled } = this.props;
|
|
447
|
+
const { fileList: stateFileList } = this.state;
|
|
448
|
+
const fileList = this.props.fileList || stateFileList;
|
|
449
|
+
const fileListCls = cls(`${prefixCls}-file-list`);
|
|
450
|
+
const titleCls = `${prefixCls}-file-list-title`;
|
|
451
|
+
const mainCls = `${prefixCls}-file-list-main`;
|
|
452
|
+
const showTitle = limit !== 1 && fileList.length;
|
|
374
453
|
const showClear = this.props.showClear && !disabled;
|
|
454
|
+
const containerProps = {
|
|
455
|
+
className: fileListCls
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
if (!showUploadList || !fileList.length) {
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
375
461
|
|
|
376
462
|
return (
|
|
377
463
|
<LocaleConsumer componentName="Upload">
|
|
378
|
-
{(locale: Locale['Upload'])
|
|
379
|
-
<div
|
|
464
|
+
{(locale: Locale['Upload']) => (
|
|
465
|
+
<div {...containerProps}>
|
|
380
466
|
{showTitle ? (
|
|
381
467
|
<div className={titleCls}>
|
|
382
|
-
<span className={`${titleCls
|
|
468
|
+
<span className={`${titleCls}-choosen`}>{locale.selectedFiles}</span>
|
|
383
469
|
{showClear ? (
|
|
384
|
-
<span onClick={this.clear} className={`${titleCls
|
|
470
|
+
<span onClick={this.clear} className={`${titleCls}-clear`}>
|
|
385
471
|
{locale.clear}
|
|
386
472
|
</span>
|
|
387
473
|
) : null}
|
|
@@ -390,13 +476,12 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
390
476
|
|
|
391
477
|
<div className={mainCls}>
|
|
392
478
|
{fileList.map((file, index) => this.renderFile(file, index, locale))}
|
|
393
|
-
{showAddTriggerInList ? addContent : null}
|
|
394
479
|
</div>
|
|
395
480
|
</div>
|
|
396
481
|
)}
|
|
397
482
|
</LocaleConsumer>
|
|
398
483
|
);
|
|
399
|
-
}
|
|
484
|
+
}
|
|
400
485
|
|
|
401
486
|
onDrop = (e: DragEvent<HTMLDivElement>): void => {
|
|
402
487
|
this.foundation.handleDrop(e);
|
|
@@ -415,14 +500,30 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
415
500
|
this.foundation.handleDragEnter(e);
|
|
416
501
|
};
|
|
417
502
|
|
|
503
|
+
renderAddContent = () => {
|
|
504
|
+
const { draggable, children, listType } = this.props;
|
|
505
|
+
const uploadAddCls = cls(`${prefixCls}-add`);
|
|
506
|
+
if (listType === strings.FILE_LIST_PIC) {
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
if (draggable) {
|
|
510
|
+
return this.renderDragArea();
|
|
511
|
+
}
|
|
512
|
+
return (
|
|
513
|
+
<div className={uploadAddCls} onClick={this.onClick}>
|
|
514
|
+
{children}
|
|
515
|
+
</div>
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
|
|
418
519
|
renderDragArea = (): ReactNode => {
|
|
419
520
|
const { dragAreaStatus } = this.state;
|
|
420
521
|
const { children, dragIcon, dragMainText, dragSubText } = this.props;
|
|
421
|
-
const dragAreaBaseCls = `${prefixCls
|
|
522
|
+
const dragAreaBaseCls = `${prefixCls}-drag-area`;
|
|
422
523
|
const dragAreaCls = cls(dragAreaBaseCls, {
|
|
423
|
-
[`${dragAreaBaseCls
|
|
424
|
-
[`${dragAreaBaseCls
|
|
425
|
-
[`${dragAreaBaseCls
|
|
524
|
+
[`${dragAreaBaseCls}-legal`]: dragAreaStatus === strings.DRAG_AREA_LEGAL,
|
|
525
|
+
[`${dragAreaBaseCls}-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL,
|
|
526
|
+
[`${dragAreaBaseCls}-custom`]: children,
|
|
426
527
|
});
|
|
427
528
|
|
|
428
529
|
return (
|
|
@@ -440,20 +541,20 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
440
541
|
children
|
|
441
542
|
) : (
|
|
442
543
|
<>
|
|
443
|
-
<div className={`${dragAreaBaseCls
|
|
544
|
+
<div className={`${dragAreaBaseCls}-icon`}>
|
|
444
545
|
{dragIcon || <IconUpload size="extra-large" />}
|
|
445
546
|
</div>
|
|
446
|
-
<div className={`${dragAreaBaseCls
|
|
447
|
-
<div className={`${dragAreaBaseCls
|
|
547
|
+
<div className={`${dragAreaBaseCls}-text`}>
|
|
548
|
+
<div className={`${dragAreaBaseCls}-main-text`}>
|
|
448
549
|
{dragMainText || locale.mainText}
|
|
449
550
|
</div>
|
|
450
|
-
<div className={`${dragAreaBaseCls
|
|
451
|
-
<div className={`${dragAreaBaseCls
|
|
551
|
+
<div className={`${dragAreaBaseCls}-sub-text`}>{dragSubText}</div>
|
|
552
|
+
<div className={`${dragAreaBaseCls}-tips`}>
|
|
452
553
|
{dragAreaStatus === strings.DRAG_AREA_LEGAL && (
|
|
453
|
-
<span className={`${dragAreaBaseCls
|
|
554
|
+
<span className={`${dragAreaBaseCls}-tips-legal`}>{locale.legalTips}</span>
|
|
454
555
|
)}
|
|
455
556
|
{dragAreaStatus === strings.DRAG_AREA_ILLEGAL && (
|
|
456
|
-
<span className={`${dragAreaBaseCls
|
|
557
|
+
<span className={`${dragAreaBaseCls}-tips-illegal`}>
|
|
457
558
|
{locale.illegalTips}
|
|
458
559
|
</span>
|
|
459
560
|
)}
|
|
@@ -485,27 +586,20 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
485
586
|
directory,
|
|
486
587
|
} = this.props;
|
|
487
588
|
const uploadCls = cls(prefixCls, {
|
|
488
|
-
[`${prefixCls
|
|
489
|
-
[`${prefixCls
|
|
490
|
-
[`${prefixCls
|
|
491
|
-
[`${prefixCls
|
|
492
|
-
[`${prefixCls
|
|
493
|
-
[`${prefixCls
|
|
589
|
+
[`${prefixCls}-picture`]: listType === strings.FILE_LIST_PIC,
|
|
590
|
+
[`${prefixCls}-disabled`]: disabled,
|
|
591
|
+
[`${prefixCls}-default`]: validateStatus === 'default',
|
|
592
|
+
[`${prefixCls}-error`]: validateStatus === 'error',
|
|
593
|
+
[`${prefixCls}-warning`]: validateStatus === 'warning',
|
|
594
|
+
[`${prefixCls}-success`]: validateStatus === 'success',
|
|
494
595
|
}, className);
|
|
495
|
-
const
|
|
496
|
-
const
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
const validateMsgCls = cls(`${prefixCls }-validate-message`);
|
|
596
|
+
const inputCls = cls(`${prefixCls}-hidden-input`);
|
|
597
|
+
const inputReplaceCls = cls(`${prefixCls}-hidden-input-replace`);
|
|
598
|
+
const promptCls = cls(`${prefixCls}-prompt`);
|
|
599
|
+
const validateMsgCls = cls(`${prefixCls}-validate-message`);
|
|
500
600
|
|
|
501
601
|
const dirProps = directory ? { directory: 'directory', webkitdirectory: 'webkitdirectory' } : {};
|
|
502
602
|
|
|
503
|
-
const addContent =
|
|
504
|
-
listType !== strings.FILE_LIST_PIC ? (
|
|
505
|
-
<div className={uploadAddCls} onClick={this.onClick}>
|
|
506
|
-
{children}
|
|
507
|
-
</div>
|
|
508
|
-
) : null;
|
|
509
603
|
return (
|
|
510
604
|
<div className={uploadCls} style={style} x-prompt-pos={promptPosition}>
|
|
511
605
|
<input
|
|
@@ -532,7 +626,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
532
626
|
className={inputReplaceCls}
|
|
533
627
|
ref={this.replaceInputRef}
|
|
534
628
|
/>
|
|
535
|
-
{
|
|
629
|
+
{this.renderAddContent()}
|
|
536
630
|
{prompt ? <div className={promptCls}>{prompt}</div> : null}
|
|
537
631
|
|
|
538
632
|
{validateMessage ? <div className={validateMsgCls}>{validateMessage}</div> : null}
|
package/upload/interface.ts
CHANGED
|
@@ -45,12 +45,15 @@ export interface FileItem extends BaseFileItem {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface RenderFileItemProps extends FileItem {
|
|
48
|
+
index?: number;
|
|
48
49
|
previewFile?: (fileItem: RenderFileItemProps) => ReactNode;
|
|
49
50
|
listType: UploadListType;
|
|
50
51
|
onRemove: (props: RenderFileItemProps, e: MouseEvent) => void;
|
|
51
52
|
onRetry: (props: RenderFileItemProps, e: MouseEvent) => void;
|
|
52
53
|
onReplace: (props: RenderFileItemProps, e: MouseEvent) => void;
|
|
53
54
|
key: string;
|
|
55
|
+
showPicInfo?: boolean;
|
|
56
|
+
renderPicInfo?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
54
57
|
showRetry: boolean;
|
|
55
58
|
showReplace: boolean;
|
|
56
59
|
style?: CSSProperties;
|