@douyinfe/semi-ui 2.1.4-alpha.0 → 2.2.0-beta.0

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.
Files changed (162) hide show
  1. package/_base/_story/a11y.jsx +1302 -0
  2. package/_base/_story/a11y.scss +49 -0
  3. package/_base/_story/index.scss +1 -0
  4. package/_base/_story/index.stories.js +3 -1
  5. package/_utils/index.ts +2 -1
  6. package/button/Button.tsx +1 -0
  7. package/button/__test__/button.test.js +15 -0
  8. package/button/_story/button.stories.js +13 -0
  9. package/button/buttonGroup.tsx +6 -4
  10. package/cascader/__test__/cascader.test.js +221 -0
  11. package/cascader/_story/cascader.stories.js +138 -0
  12. package/cascader/index.tsx +37 -21
  13. package/cascader/item.tsx +7 -2
  14. package/checkbox/__test__/checkboxGroup.test.js +37 -5
  15. package/checkbox/_story/checkbox.stories.js +78 -6
  16. package/checkbox/checkbox.tsx +3 -0
  17. package/checkbox/checkboxGroup.tsx +3 -2
  18. package/datePicker/__test__/datePicker.test.js +67 -2
  19. package/datePicker/_story/datePicker.stories.js +3 -1
  20. package/datePicker/_story/v2/YearButton.jsx +17 -0
  21. package/datePicker/_story/v2/index.js +1 -0
  22. package/datePicker/monthsGrid.tsx +12 -1
  23. package/datePicker/navigation.tsx +55 -29
  24. package/descriptions/__test__/descriptions.test.js +27 -1
  25. package/descriptions/_story/descriptions.stories.js +52 -2
  26. package/descriptions/item.tsx +1 -1
  27. package/dist/css/semi.css +105 -32
  28. package/dist/css/semi.min.css +1 -1
  29. package/dist/umd/semi-ui.js +801 -227
  30. package/dist/umd/semi-ui.js.map +1 -1
  31. package/dist/umd/semi-ui.min.js +1 -1
  32. package/dist/umd/semi-ui.min.js.map +1 -1
  33. package/form/_story/form.stories.js +0 -67
  34. package/form/_story/form.stories.tsx +2 -2
  35. package/form/hoc/withField.tsx +2 -2
  36. package/lib/cjs/_base/base.css +2 -2
  37. package/lib/cjs/_utils/index.d.ts +1 -0
  38. package/lib/cjs/_utils/index.js +3 -2
  39. package/lib/cjs/button/Button.d.ts +1 -0
  40. package/lib/cjs/button/buttonGroup.js +11 -3
  41. package/lib/cjs/cascader/index.d.ts +7 -0
  42. package/lib/cjs/cascader/index.js +35 -22
  43. package/lib/cjs/cascader/item.d.ts +2 -0
  44. package/lib/cjs/cascader/item.js +9 -2
  45. package/lib/cjs/checkbox/checkbox.js +4 -1
  46. package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -0
  47. package/lib/cjs/checkbox/checkboxGroup.js +3 -1
  48. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  49. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  50. package/lib/cjs/datePicker/monthsGrid.d.ts +2 -1
  51. package/lib/cjs/datePicker/monthsGrid.js +6 -0
  52. package/lib/cjs/datePicker/navigation.js +47 -7
  53. package/lib/cjs/descriptions/item.js +1 -1
  54. package/lib/cjs/form/baseForm.d.ts +6 -0
  55. package/lib/cjs/form/field.d.ts +6 -0
  56. package/lib/cjs/form/hoc/withField.js +3 -1
  57. package/lib/cjs/locale/source/es.d.ts +7 -0
  58. package/lib/cjs/locale/source/es.js +168 -0
  59. package/lib/cjs/modal/Modal.d.ts +8 -8
  60. package/lib/cjs/modal/Modal.js +4 -4
  61. package/lib/cjs/modal/confirm.d.ts +10 -10
  62. package/lib/cjs/navigation/index.d.ts +2 -2
  63. package/lib/cjs/pagination/index.js +9 -4
  64. package/lib/cjs/radio/radio.d.ts +1 -1
  65. package/lib/cjs/radio/radio.js +1 -0
  66. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  67. package/lib/cjs/rating/item.js +3 -2
  68. package/lib/cjs/select/index.d.ts +10 -0
  69. package/lib/cjs/select/index.js +15 -9
  70. package/lib/cjs/table/Table.d.ts +1 -1
  71. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  72. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  73. package/lib/cjs/timePicker/index.d.ts +2 -2
  74. package/lib/cjs/timeline/item.d.ts +5 -2
  75. package/lib/cjs/timeline/item.js +13 -7
  76. package/lib/cjs/tree/treeNode.js +0 -2
  77. package/lib/cjs/treeSelect/index.js +1 -0
  78. package/lib/cjs/typography/title.d.ts +1 -1
  79. package/lib/cjs/upload/fileCard.d.ts +2 -0
  80. package/lib/cjs/upload/fileCard.js +70 -45
  81. package/lib/cjs/upload/index.d.ts +34 -4
  82. package/lib/cjs/upload/index.js +141 -25
  83. package/lib/cjs/upload/interface.d.ts +3 -0
  84. package/lib/es/_base/base.css +2 -2
  85. package/lib/es/_utils/index.d.ts +1 -0
  86. package/lib/es/_utils/index.js +3 -2
  87. package/lib/es/button/Button.d.ts +1 -0
  88. package/lib/es/button/buttonGroup.js +3 -3
  89. package/lib/es/cascader/index.d.ts +7 -0
  90. package/lib/es/cascader/index.js +34 -25
  91. package/lib/es/cascader/item.d.ts +2 -0
  92. package/lib/es/cascader/item.js +9 -2
  93. package/lib/es/checkbox/checkbox.js +4 -1
  94. package/lib/es/checkbox/checkboxGroup.d.ts +1 -0
  95. package/lib/es/checkbox/checkboxGroup.js +3 -1
  96. package/lib/es/datePicker/dateInput.d.ts +1 -1
  97. package/lib/es/datePicker/datePicker.d.ts +1 -1
  98. package/lib/es/datePicker/monthsGrid.d.ts +2 -1
  99. package/lib/es/datePicker/monthsGrid.js +6 -0
  100. package/lib/es/datePicker/navigation.js +48 -8
  101. package/lib/es/descriptions/item.js +1 -1
  102. package/lib/es/form/baseForm.d.ts +6 -0
  103. package/lib/es/form/field.d.ts +6 -0
  104. package/lib/es/form/hoc/withField.js +3 -1
  105. package/lib/es/locale/source/es.d.ts +7 -0
  106. package/lib/es/locale/source/es.js +157 -0
  107. package/lib/es/modal/Modal.d.ts +8 -8
  108. package/lib/es/modal/Modal.js +4 -4
  109. package/lib/es/modal/confirm.d.ts +10 -10
  110. package/lib/es/navigation/index.d.ts +2 -2
  111. package/lib/es/pagination/index.js +8 -4
  112. package/lib/es/radio/radio.d.ts +1 -1
  113. package/lib/es/radio/radio.js +1 -0
  114. package/lib/es/radio/radioGroup.d.ts +1 -1
  115. package/lib/es/rating/item.js +3 -2
  116. package/lib/es/select/index.d.ts +10 -0
  117. package/lib/es/select/index.js +19 -9
  118. package/lib/es/table/Table.d.ts +1 -1
  119. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  120. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  121. package/lib/es/timePicker/index.d.ts +2 -2
  122. package/lib/es/timeline/item.d.ts +5 -2
  123. package/lib/es/timeline/item.js +12 -7
  124. package/lib/es/tree/treeNode.js +0 -2
  125. package/lib/es/treeSelect/index.js +1 -0
  126. package/lib/es/typography/title.d.ts +1 -1
  127. package/lib/es/upload/fileCard.d.ts +2 -0
  128. package/lib/es/upload/fileCard.js +69 -44
  129. package/lib/es/upload/index.d.ts +34 -4
  130. package/lib/es/upload/index.js +141 -24
  131. package/lib/es/upload/interface.d.ts +3 -0
  132. package/locale/source/es.ts +160 -0
  133. package/modal/Modal.tsx +6 -6
  134. package/navigation/__test__/navigation.test.js +4 -4
  135. package/navigation/_story/AutoOpen/index.js +1 -1
  136. package/navigation/_story/WithChildren/index.js +1 -1
  137. package/navigation/_story/navigation.stories.js +1 -1
  138. package/navigation/_story/navigation.stories.tsx +4 -4
  139. package/navigation/index.tsx +2 -2
  140. package/package.json +16 -8
  141. package/pagination/_story/pagination.stories.js +11 -0
  142. package/pagination/index.tsx +9 -4
  143. package/popover/Arrow.tsx +1 -1
  144. package/radio/__test__/radioGroup.test.jsx +41 -6
  145. package/radio/_story/radio.stories.js +22 -11
  146. package/radio/radio.tsx +1 -0
  147. package/rating/item.tsx +2 -1
  148. package/select/_story/select.stories.js +39 -14
  149. package/select/index.tsx +21 -7
  150. package/table/_story/DynamicFilters/index.js +13 -16
  151. package/timeline/__test__/timeline.test.js +17 -1
  152. package/timeline/_story/timeline.stories.js +70 -6
  153. package/timeline/item.tsx +11 -6
  154. package/tooltip/_story/tooltip.stories.js +1 -1
  155. package/tree/_story/tree.stories.js +2 -2
  156. package/tree/treeNode.tsx +0 -2
  157. package/treeSelect/index.tsx +3 -2
  158. package/tsconfig.json +2 -1
  159. package/upload/__test__/upload.test.js +50 -1
  160. package/upload/fileCard.tsx +110 -95
  161. package/upload/index.tsx +155 -54
  162. 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, { BaseFileItem, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/upload/foundation';
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,
@@ -193,7 +200,14 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
193
200
  this.replaceInputRef = React.createRef<HTMLInputElement>();
194
201
  }
195
202
 
196
- static getDerivedStateFromProps(props: UploadProps): Partial<UploadState> | null {
203
+ /**
204
+ * Notes:
205
+ * The input parameter and return value here do not declare the type, otherwise tsc may report an error in form/fields.tsx when wrap after withField
206
+ * `The types of the parameters "props" and "nextProps" are incompatible.
207
+ The attribute "action" is missing in the type "Readonly<any>", but it is required in the type "UploadProps".`
208
+ * which seems to be a bug, remove props type declare here
209
+ */
210
+ static getDerivedStateFromProps(props) {
197
211
  const { fileList } = props;
198
212
  if ('fileList' in props) {
199
213
  return {
@@ -290,14 +304,29 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
290
304
  this.foundation.handleRemove(fileItem);
291
305
  };
292
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
+ */
293
322
  upload = (): void => {
294
323
  const { fileList } = this.state;
295
324
  this.foundation.startUpload(fileList);
296
325
  };
297
326
 
298
327
  renderFile = (file: FileItem, index: number, locale: Locale['Upload']): ReactNode => {
299
- const { name, status, validateMessage, _sizeInvalid } = file;
300
- 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;
301
330
  const onRemove = (): void => this.remove(file);
302
331
  const onRetry = (): void => {
303
332
  this.foundation.retry(file);
@@ -311,10 +340,14 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
311
340
  listType,
312
341
  onRemove,
313
342
  onRetry,
314
- key: `${name}${index}`,
343
+ index,
344
+ key: uid || `${name}${index}`,
315
345
  showRetry: typeof file.showRetry !== 'undefined' ? file.showRetry : showRetry,
316
346
  style: itemStyle,
317
347
  disabled,
348
+ showPicInfo,
349
+ renderPicInfo,
350
+ renderThumbnail,
318
351
  showReplace: typeof file.showReplace !== 'undefined' ? file.showReplace : showReplace,
319
352
  onReplace,
320
353
  onPreviewClick: typeof onPreviewClick !== 'undefined' ? (): void => this.foundation.handlePreviewClick(file) : undefined,
@@ -336,17 +369,54 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
336
369
  };
337
370
 
338
371
  renderFileList = (): ReactNode => {
339
- const { showUploadList, listType, limit, disabled, children } = this.props;
340
- const { fileList: stateFileList } = this.state;
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;
341
387
  const fileList = this.props.fileList || stateFileList;
342
- const isPicType = listType === strings.FILE_LIST_PIC;
343
- const showAddTriggerInList = isPicType && (limit ? limit > fileList.length : true);
344
- const uploadAddCls = cls(`${prefixCls }-add`, {
345
- [`${prefixCls }-picture-add`]: isPicType,
346
- [`${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,
347
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
+ }
348
418
  const addContent = (
349
- <div className={uploadAddCls} onClick={this.onClick}>
419
+ <div {...addContentProps}>
350
420
  {children}
351
421
  </div>
352
422
  );
@@ -358,23 +428,46 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
358
428
  return null;
359
429
  }
360
430
 
361
- const fileListCls = cls(`${prefixCls }-file-list`, {
362
- [`${prefixCls }-picture-file-list`]: isPicType,
363
- });
364
- const titleCls = `${prefixCls }-file-list-title`;
365
- const mainCls = `${prefixCls }-file-list-main`;
366
- const showTitle = limit !== 1 && fileList.length && listType !== strings.FILE_LIST_PIC;
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;
367
453
  const showClear = this.props.showClear && !disabled;
454
+ const containerProps = {
455
+ className: fileListCls
456
+ };
457
+
458
+ if (!showUploadList || !fileList.length) {
459
+ return null;
460
+ }
368
461
 
369
462
  return (
370
463
  <LocaleConsumer componentName="Upload">
371
- {(locale: Locale['Upload']): ReactNode => (
372
- <div className={fileListCls}>
464
+ {(locale: Locale['Upload']) => (
465
+ <div {...containerProps}>
373
466
  {showTitle ? (
374
467
  <div className={titleCls}>
375
- <span className={`${titleCls }-choosen`}>{locale.selectedFiles}</span>
468
+ <span className={`${titleCls}-choosen`}>{locale.selectedFiles}</span>
376
469
  {showClear ? (
377
- <span onClick={this.clear} className={`${titleCls }-clear`}>
470
+ <span onClick={this.clear} className={`${titleCls}-clear`}>
378
471
  {locale.clear}
379
472
  </span>
380
473
  ) : null}
@@ -383,13 +476,12 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
383
476
 
384
477
  <div className={mainCls}>
385
478
  {fileList.map((file, index) => this.renderFile(file, index, locale))}
386
- {showAddTriggerInList ? addContent : null}
387
479
  </div>
388
480
  </div>
389
481
  )}
390
482
  </LocaleConsumer>
391
483
  );
392
- };
484
+ }
393
485
 
394
486
  onDrop = (e: DragEvent<HTMLDivElement>): void => {
395
487
  this.foundation.handleDrop(e);
@@ -408,14 +500,30 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
408
500
  this.foundation.handleDragEnter(e);
409
501
  };
410
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
+
411
519
  renderDragArea = (): ReactNode => {
412
520
  const { dragAreaStatus } = this.state;
413
521
  const { children, dragIcon, dragMainText, dragSubText } = this.props;
414
- const dragAreaBaseCls = `${prefixCls }-drag-area`;
522
+ const dragAreaBaseCls = `${prefixCls}-drag-area`;
415
523
  const dragAreaCls = cls(dragAreaBaseCls, {
416
- [`${dragAreaBaseCls }-legal`]: dragAreaStatus === strings.DRAG_AREA_LEGAL,
417
- [`${dragAreaBaseCls }-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL,
418
- [`${dragAreaBaseCls }-custom`]: children,
524
+ [`${dragAreaBaseCls}-legal`]: dragAreaStatus === strings.DRAG_AREA_LEGAL,
525
+ [`${dragAreaBaseCls}-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL,
526
+ [`${dragAreaBaseCls}-custom`]: children,
419
527
  });
420
528
 
421
529
  return (
@@ -433,20 +541,20 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
433
541
  children
434
542
  ) : (
435
543
  <>
436
- <div className={`${dragAreaBaseCls }-icon`}>
544
+ <div className={`${dragAreaBaseCls}-icon`}>
437
545
  {dragIcon || <IconUpload size="extra-large" />}
438
546
  </div>
439
- <div className={`${dragAreaBaseCls }-text`}>
440
- <div className={`${dragAreaBaseCls }-main-text`}>
547
+ <div className={`${dragAreaBaseCls}-text`}>
548
+ <div className={`${dragAreaBaseCls}-main-text`}>
441
549
  {dragMainText || locale.mainText}
442
550
  </div>
443
- <div className={`${dragAreaBaseCls }-sub-text`}>{dragSubText}</div>
444
- <div className={`${dragAreaBaseCls }-tips`}>
551
+ <div className={`${dragAreaBaseCls}-sub-text`}>{dragSubText}</div>
552
+ <div className={`${dragAreaBaseCls}-tips`}>
445
553
  {dragAreaStatus === strings.DRAG_AREA_LEGAL && (
446
- <span className={`${dragAreaBaseCls }-tips-legal`}>{locale.legalTips}</span>
554
+ <span className={`${dragAreaBaseCls}-tips-legal`}>{locale.legalTips}</span>
447
555
  )}
448
556
  {dragAreaStatus === strings.DRAG_AREA_ILLEGAL && (
449
- <span className={`${dragAreaBaseCls }-tips-illegal`}>
557
+ <span className={`${dragAreaBaseCls}-tips-illegal`}>
450
558
  {locale.illegalTips}
451
559
  </span>
452
560
  )}
@@ -478,27 +586,20 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
478
586
  directory,
479
587
  } = this.props;
480
588
  const uploadCls = cls(prefixCls, {
481
- [`${prefixCls }-picture`]: listType === strings.FILE_LIST_PIC,
482
- [`${prefixCls }-disabled`]: disabled,
483
- [`${prefixCls }-default`]: validateStatus === 'default',
484
- [`${prefixCls }-error`]: validateStatus === 'error',
485
- [`${prefixCls }-warning`]: validateStatus === 'warning',
486
- [`${prefixCls }-success`]: validateStatus === 'success',
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',
487
595
  }, className);
488
- const uploadAddCls = cls(`${prefixCls }-add`);
489
- const inputCls = cls(`${prefixCls }-hidden-input`);
490
- const inputReplaceCls = cls(`${prefixCls }-hidden-input-replace`);
491
- const promptCls = cls(`${prefixCls }-prompt`);
492
- 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`);
493
600
 
494
601
  const dirProps = directory ? { directory: 'directory', webkitdirectory: 'webkitdirectory' } : {};
495
602
 
496
- const addContent =
497
- listType !== strings.FILE_LIST_PIC ? (
498
- <div className={uploadAddCls} onClick={this.onClick}>
499
- {children}
500
- </div>
501
- ) : null;
502
603
  return (
503
604
  <div className={uploadCls} style={style} x-prompt-pos={promptPosition}>
504
605
  <input
@@ -525,7 +626,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
525
626
  className={inputReplaceCls}
526
627
  ref={this.replaceInputRef}
527
628
  />
528
- {draggable ? this.renderDragArea() : addContent}
629
+ {this.renderAddContent()}
529
630
  {prompt ? <div className={promptCls}>{prompt}</div> : null}
530
631
 
531
632
  {validateMessage ? <div className={validateMsgCls}>{validateMessage}</div> : null}
@@ -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;