@douyinfe/semi-ui 2.12.0-alpha.0 → 2.12.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 (188) hide show
  1. package/avatar/index.tsx +2 -2
  2. package/backtop/index.tsx +7 -11
  3. package/badge/index.tsx +1 -1
  4. package/banner/index.tsx +5 -5
  5. package/breadcrumb/index.tsx +3 -5
  6. package/button/Button.tsx +9 -11
  7. package/card/index.tsx +41 -43
  8. package/carousel/CarouselArrow.tsx +0 -2
  9. package/carousel/index.tsx +0 -1
  10. package/cascader/index.tsx +123 -101
  11. package/cascader/item.tsx +1 -1
  12. package/checkbox/checkbox.tsx +2 -13
  13. package/collapsible/index.tsx +1 -8
  14. package/datePicker/dateInput.tsx +0 -1
  15. package/datePicker/datePicker.tsx +5 -13
  16. package/dist/umd/semi-ui.js +2491 -789
  17. package/dist/umd/semi-ui.js.map +1 -1
  18. package/dist/umd/semi-ui.min.js +1 -1
  19. package/dist/umd/semi-ui.min.js.map +1 -1
  20. package/divider/index.tsx +4 -8
  21. package/dropdown/index.tsx +1 -1
  22. package/empty/index.tsx +5 -13
  23. package/form/hoc/withField.tsx +1 -1
  24. package/form/label.tsx +1 -1
  25. package/grid/col.tsx +1 -1
  26. package/grid/row.tsx +1 -1
  27. package/iconButton/index.tsx +1 -2
  28. package/input/index.tsx +11 -38
  29. package/lib/cjs/avatar/index.js +2 -4
  30. package/lib/cjs/backtop/index.js +1 -2
  31. package/lib/cjs/badge/index.js +1 -2
  32. package/lib/cjs/banner/index.js +4 -9
  33. package/lib/cjs/breadcrumb/index.js +3 -4
  34. package/lib/cjs/button/Button.d.ts +1 -1
  35. package/lib/cjs/button/Button.js +3 -13
  36. package/lib/cjs/card/index.js +5 -10
  37. package/lib/cjs/carousel/CarouselArrow.js +2 -6
  38. package/lib/cjs/carousel/index.js +1 -2
  39. package/lib/cjs/cascader/index.js +6 -9
  40. package/lib/cjs/cascader/item.js +1 -2
  41. package/lib/cjs/checkbox/checkbox.js +4 -8
  42. package/lib/cjs/collapsible/index.js +1 -2
  43. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  44. package/lib/cjs/datePicker/dateInput.js +1 -2
  45. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  46. package/lib/cjs/datePicker/datePicker.js +2 -4
  47. package/lib/cjs/datePicker/monthsGrid.d.ts +2 -2
  48. package/lib/cjs/divider/index.js +1 -2
  49. package/lib/cjs/dropdown/index.js +1 -2
  50. package/lib/cjs/empty/index.js +4 -8
  51. package/lib/cjs/form/baseForm.d.ts +1 -1
  52. package/lib/cjs/form/field.d.ts +1 -1
  53. package/lib/cjs/form/hoc/withField.js +1 -2
  54. package/lib/cjs/form/label.js +1 -2
  55. package/lib/cjs/grid/col.js +1 -2
  56. package/lib/cjs/grid/row.js +1 -2
  57. package/lib/cjs/iconButton/index.js +1 -3
  58. package/lib/cjs/input/index.js +5 -9
  59. package/lib/cjs/list/index.js +3 -6
  60. package/lib/cjs/modal/ConfirmModal.js +1 -2
  61. package/lib/cjs/modal/Modal.js +5 -8
  62. package/lib/cjs/modal/ModalContent.d.ts +2 -0
  63. package/lib/cjs/modal/ModalContent.js +23 -22
  64. package/lib/cjs/notification/notice.js +3 -6
  65. package/lib/cjs/pagination/index.js +2 -4
  66. package/lib/cjs/popconfirm/index.js +3 -6
  67. package/lib/cjs/progress/index.js +1 -1
  68. package/lib/cjs/radio/radio.d.ts +1 -1
  69. package/lib/cjs/radio/radio.js +2 -4
  70. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  71. package/lib/cjs/rating/item.js +1 -2
  72. package/lib/cjs/scrollList/index.js +3 -6
  73. package/lib/cjs/select/index.js +4 -8
  74. package/lib/cjs/select/option.js +1 -2
  75. package/lib/cjs/sideSheet/SideSheetContent.js +3 -6
  76. package/lib/cjs/skeleton/index.js +1 -3
  77. package/lib/cjs/space/index.js +1 -2
  78. package/lib/cjs/spin/index.js +3 -7
  79. package/lib/cjs/switch/index.js +4 -6
  80. package/lib/cjs/table/Table.d.ts +1 -1
  81. package/lib/cjs/table/Table.js +3 -6
  82. package/lib/cjs/tabs/TabBar.js +1 -2
  83. package/lib/cjs/tabs/TabPane.js +2 -5
  84. package/lib/cjs/tagInput/index.js +2 -4
  85. package/lib/cjs/timePicker/Combobox.js +1 -3
  86. package/lib/cjs/toast/toast.js +3 -6
  87. package/lib/cjs/transfer/index.js +1 -2
  88. package/lib/cjs/tree/treeNode.js +1 -2
  89. package/lib/cjs/treeSelect/index.js +3 -6
  90. package/lib/cjs/typography/base.js +1 -2
  91. package/lib/cjs/typography/title.d.ts +1 -1
  92. package/lib/cjs/upload/index.d.ts +1 -1
  93. package/lib/cjs/upload/index.js +6 -13
  94. package/lib/es/avatar/index.js +2 -4
  95. package/lib/es/backtop/index.js +1 -2
  96. package/lib/es/badge/index.js +1 -2
  97. package/lib/es/banner/index.js +4 -9
  98. package/lib/es/breadcrumb/index.js +3 -4
  99. package/lib/es/button/Button.d.ts +1 -1
  100. package/lib/es/button/Button.js +3 -11
  101. package/lib/es/card/index.js +5 -10
  102. package/lib/es/carousel/CarouselArrow.js +2 -6
  103. package/lib/es/carousel/index.js +1 -2
  104. package/lib/es/cascader/index.js +6 -9
  105. package/lib/es/cascader/item.js +1 -2
  106. package/lib/es/checkbox/checkbox.js +4 -8
  107. package/lib/es/collapsible/index.js +1 -2
  108. package/lib/es/datePicker/dateInput.d.ts +1 -1
  109. package/lib/es/datePicker/dateInput.js +1 -2
  110. package/lib/es/datePicker/datePicker.d.ts +1 -1
  111. package/lib/es/datePicker/datePicker.js +2 -4
  112. package/lib/es/datePicker/monthsGrid.d.ts +2 -2
  113. package/lib/es/divider/index.js +1 -2
  114. package/lib/es/dropdown/index.js +1 -2
  115. package/lib/es/empty/index.js +4 -8
  116. package/lib/es/form/baseForm.d.ts +1 -1
  117. package/lib/es/form/field.d.ts +1 -1
  118. package/lib/es/form/hoc/withField.js +1 -2
  119. package/lib/es/form/label.js +1 -2
  120. package/lib/es/grid/col.js +1 -2
  121. package/lib/es/grid/row.js +1 -2
  122. package/lib/es/iconButton/index.js +1 -3
  123. package/lib/es/input/index.js +5 -9
  124. package/lib/es/list/index.js +3 -6
  125. package/lib/es/modal/ConfirmModal.js +1 -2
  126. package/lib/es/modal/Modal.js +5 -8
  127. package/lib/es/modal/ModalContent.d.ts +2 -0
  128. package/lib/es/modal/ModalContent.js +22 -22
  129. package/lib/es/notification/notice.js +3 -6
  130. package/lib/es/pagination/index.js +2 -4
  131. package/lib/es/popconfirm/index.js +3 -6
  132. package/lib/es/progress/index.js +1 -1
  133. package/lib/es/radio/radio.d.ts +1 -1
  134. package/lib/es/radio/radio.js +2 -4
  135. package/lib/es/radio/radioGroup.d.ts +1 -1
  136. package/lib/es/rating/item.js +1 -2
  137. package/lib/es/scrollList/index.js +3 -6
  138. package/lib/es/select/index.js +4 -8
  139. package/lib/es/select/option.js +1 -2
  140. package/lib/es/sideSheet/SideSheetContent.js +3 -6
  141. package/lib/es/skeleton/index.js +1 -3
  142. package/lib/es/space/index.js +1 -2
  143. package/lib/es/spin/index.js +3 -7
  144. package/lib/es/switch/index.js +4 -6
  145. package/lib/es/table/Table.d.ts +1 -1
  146. package/lib/es/table/Table.js +3 -6
  147. package/lib/es/tabs/TabBar.js +1 -2
  148. package/lib/es/tabs/TabPane.js +2 -5
  149. package/lib/es/tagInput/index.js +2 -4
  150. package/lib/es/timePicker/Combobox.js +1 -3
  151. package/lib/es/toast/toast.js +3 -6
  152. package/lib/es/transfer/index.js +1 -2
  153. package/lib/es/tree/treeNode.js +1 -2
  154. package/lib/es/treeSelect/index.js +3 -6
  155. package/lib/es/typography/base.js +1 -2
  156. package/lib/es/typography/title.d.ts +1 -1
  157. package/lib/es/upload/index.d.ts +1 -1
  158. package/lib/es/upload/index.js +6 -13
  159. package/list/index.tsx +4 -16
  160. package/modal/ConfirmModal.tsx +1 -1
  161. package/modal/Modal.tsx +2 -3
  162. package/modal/ModalContent.tsx +34 -40
  163. package/notification/notice.tsx +4 -16
  164. package/package.json +9 -9
  165. package/pagination/index.tsx +2 -16
  166. package/popconfirm/index.tsx +3 -11
  167. package/progress/index.tsx +1 -1
  168. package/radio/radio.tsx +2 -10
  169. package/rating/item.tsx +1 -1
  170. package/scrollList/index.tsx +3 -19
  171. package/select/index.tsx +4 -12
  172. package/select/option.tsx +1 -5
  173. package/sideSheet/SideSheetContent.tsx +3 -3
  174. package/skeleton/index.tsx +1 -1
  175. package/space/index.tsx +1 -1
  176. package/spin/index.tsx +9 -15
  177. package/switch/index.tsx +14 -9
  178. package/table/Table.tsx +3 -5
  179. package/tabs/TabBar.tsx +1 -1
  180. package/tabs/TabPane.tsx +4 -9
  181. package/tagInput/index.tsx +2 -2
  182. package/timePicker/Combobox.tsx +1 -6
  183. package/toast/toast.tsx +3 -3
  184. package/transfer/index.tsx +0 -1
  185. package/tree/treeNode.tsx +1 -1
  186. package/treeSelect/index.tsx +3 -15
  187. package/typography/base.tsx +1 -1
  188. package/upload/index.tsx +38 -107
@@ -273,7 +273,7 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
273
273
  // eslint-disable-next-line max-len
274
274
  [`${prefixCls}-prefix-icon`]: React.isValidElement(prefix) && !(prefix && isString(prefix)),
275
275
  });
276
- return <div className={prefixWrapperCls} x-semi-prop="prefix">{prefix}</div>;
276
+ return <div className={prefixWrapperCls}>{prefix}</div>;
277
277
  }
278
278
 
279
279
  renderSuffix() {
@@ -286,7 +286,7 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
286
286
  // eslint-disable-next-line max-len
287
287
  [`${prefixCls}-suffix-icon`]: React.isValidElement(suffix) && !(suffix && isString(suffix)),
288
288
  });
289
- return <div className={suffixWrapperCls} x-semi-prop="suffix">{suffix}</div>;
289
+ return <div className={suffixWrapperCls}>{suffix}</div>;
290
290
  }
291
291
 
292
292
  renderTags() {
@@ -317,12 +317,7 @@ class Combobox extends BaseComponent<ComboboxProps, ComboboxState> {
317
317
  return (
318
318
  <LocaleConsumer componentName="TimePicker">
319
319
  {(locale: Locale['TimePicker'], localeCode: Locale['code']) => (
320
- <ScrollList
321
- header={panelHeader}
322
- footer={panelFooter}
323
- x-semi-header-alias="panelHeader"
324
- x-semi-footer-alias="panelFooter"
325
- >
320
+ <ScrollList header={panelHeader} footer={panelFooter}>
326
321
  {this.renderAMPMSelect(locale, localeCode)}
327
322
  {this.renderHourSelect(value.getHours(), locale)}
328
323
  {this.renderMinuteSelect(value.getMinutes(), locale)}
package/toast/toast.tsx CHANGED
@@ -120,7 +120,7 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
120
120
  const btnSize = 'small';
121
121
  return (
122
122
  <div
123
- role="alert"
123
+ role='alert'
124
124
  aria-label={`${type ? type : 'default'} type`}
125
125
  className={toastCls}
126
126
  style={style}
@@ -129,7 +129,7 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
129
129
  >
130
130
  <div className={`${prefixCls}-content`}>
131
131
  {this.renderIcon()}
132
- <span className={`${prefixCls}-content-text`} style={textStyle} x-semi-prop="content">
132
+ <span className={`${prefixCls}-content-text`} style={textStyle}>
133
133
  {content}
134
134
  </span>
135
135
  {showClose && (
@@ -137,7 +137,7 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
137
137
  <Button
138
138
  onClick={e => this.close(e)}
139
139
  type="tertiary"
140
- icon={<IconClose x-semi-prop="icon" />}
140
+ icon={<IconClose />}
141
141
  theme={btnTheme}
142
142
  size={btnSize}
143
143
  />
@@ -353,7 +353,6 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
353
353
  checked={checked}
354
354
  role="listitem"
355
355
  onChange={() => this.onSelectOrRemove(item)}
356
- x-semi-children-alias={`dataSource[${index}].label`}
357
356
  >
358
357
  {item.label}
359
358
  </Checkbox>
package/tree/treeNode.tsx CHANGED
@@ -269,7 +269,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
269
269
  });
270
270
  return (
271
271
  <ul className={wrapperCls}>
272
- <li className={`${prefixcls}-label ${prefixcls}-label-empty`} x-semi-prop="emptyContent">
272
+ <li className={`${prefixcls}-label ${prefixcls}-label-empty`}>
273
273
  {emptyContent}
274
274
  </li>
275
275
  </ul>
@@ -646,11 +646,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
646
646
  [`${prefixcls}-suffix-text`]: suffix && isString(suffix),
647
647
  [`${prefixcls}-suffix-icon`]: isSemiIcon(suffix),
648
648
  });
649
- return (
650
- <div className={suffixWrapperCls} x-semi-prop="suffix">
651
- {suffix}
652
- </div>
653
- );
649
+ return <div className={suffixWrapperCls}>{suffix}</div>;
654
650
  };
655
651
 
656
652
  renderPrefix = () => {
@@ -664,11 +660,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
664
660
  [`${prefixcls}-prefix-icon`]: isSemiIcon(labelNode),
665
661
  });
666
662
 
667
- return (
668
- <div className={prefixWrapperCls} id={insetLabelId} x-semi-prop="prefix,insetLabel">
669
- {labelNode}
670
- </div>
671
- );
663
+ return <div className={prefixWrapperCls} id={insetLabelId}>{labelNode}</div>;
672
664
  };
673
665
 
674
666
  renderContent = () => {
@@ -875,11 +867,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
875
867
  if (showClearBtn) {
876
868
  return null;
877
869
  }
878
- return arrowIcon ? (
879
- <div className={cls(`${prefixcls}-arrow`)} x-semi-prop="arrowIcon">
880
- {arrowIcon}
881
- </div>
882
- ) : null;
870
+ return arrowIcon ? <div className={cls(`${prefixcls}-arrow`)}>{arrowIcon}</div> : null;
883
871
  };
884
872
 
885
873
  renderClearBtn = () => {
@@ -526,7 +526,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
526
526
  }
527
527
  const iconSize: Size = size === 'small' ? 'small' : 'default';
528
528
  return (
529
- <span className={`${prefixCls}-icon`} x-semi-prop="icon">
529
+ <span className={`${prefixCls}-icon`}>
530
530
  {isSemiIcon(icon) ? React.cloneElement((icon as React.ReactElement), { size: iconSize }) : icon}
531
531
  </span>
532
532
  );
package/upload/index.tsx CHANGED
@@ -3,54 +3,25 @@ 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, {
7
- CustomFile,
8
- UploadAdapter,
9
- BeforeUploadObjectResult,
10
- AfterUploadResult,
11
- } from '@douyinfe/semi-foundation/upload/foundation';
6
+ import UploadFoundation, { CustomFile, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/upload/foundation';
12
7
  import { strings, cssClasses } from '@douyinfe/semi-foundation/upload/constants';
13
8
  import FileCard from './fileCard';
14
9
  import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
15
10
  import LocaleConsumer from '../locale/localeConsumer';
16
11
  import { IconUpload } from '@douyinfe/semi-icons';
17
- import {
18
- FileItem,
19
- RenderFileItemProps,
20
- UploadListType,
21
- PromptPositionType,
22
- BeforeUploadProps,
23
- AfterUploadProps,
24
- OnChangeProps,
25
- customRequestArgs,
26
- CustomError,
27
- } from './interface';
12
+ import { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError } from './interface';
28
13
  import { Locale } from '../locale/interface';
29
14
  import '@douyinfe/semi-foundation/upload/upload.scss';
30
15
 
31
16
  const prefixCls = cssClasses.PREFIX;
32
17
 
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
- };
18
+ export { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult };
46
19
 
47
20
  export interface UploadProps {
48
21
  accept?: string;
49
22
  action: string;
50
23
  afterUpload?: (object: AfterUploadProps) => AfterUploadResult;
51
- beforeUpload?: (
52
- object: BeforeUploadProps
53
- ) => BeforeUploadObjectResult | Promise<BeforeUploadObjectResult> | boolean;
24
+ beforeUpload?: (object: BeforeUploadProps) => BeforeUploadObjectResult | Promise<BeforeUploadObjectResult> | boolean;
54
25
  beforeClear?: (fileList: Array<FileItem>) => boolean | Promise<boolean>;
55
26
  beforeRemove?: (file: FileItem, fileList: Array<FileItem>) => boolean | Promise<boolean>;
56
27
  capture?: boolean | 'user' | 'environment' | undefined;
@@ -143,7 +114,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
143
114
  fileList: PropTypes.array, // files had been uploaded
144
115
  fileName: PropTypes.string, // same as name, to avoid props conflict in Form.Upload
145
116
  headers: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
146
- hotSpotLocation: PropTypes.oneOf(['start', 'end']),
117
+ hotSpotLocation: PropTypes.oneOf(['start','end']),
147
118
  itemStyle: PropTypes.object,
148
119
  limit: PropTypes.number, // 最大允许上传文件个数
149
120
  listType: PropTypes.oneOf<UploadProps['listType']>(strings.LIST_TYPE),
@@ -247,7 +218,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
247
218
  const { fileList } = props;
248
219
  if ('fileList' in props) {
249
220
  return {
250
- fileList: fileList || [],
221
+ fileList: fileList || []
251
222
  };
252
223
  }
253
224
  return null;
@@ -257,8 +228,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
257
228
  return {
258
229
  ...super.adapter,
259
230
  notifyFileSelect: (files): void => this.props.onFileChange(files),
260
- notifyError: (error, fileInstance, fileList, xhr): void =>
261
- this.props.onError(error, fileInstance, fileList, xhr),
231
+ notifyError: (error, fileInstance, fileList, xhr): void => this.props.onError(error, fileInstance, fileList, xhr),
262
232
  notifySuccess: (responseBody, file, fileList): void => this.props.onSuccess(responseBody, file, fileList),
263
233
  notifyProgress: (percent, file, fileList): void => this.props.onProgress(percent, file, fileList),
264
234
  notifyRemove: (file, fileList, fileItem): void => this.props.onRemove(file, fileList, fileItem),
@@ -271,25 +241,19 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
271
241
  this.setState({ fileList });
272
242
  }
273
243
  },
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 }),
244
+ notifyBeforeUpload: ({ file, fileList }): boolean | BeforeUploadObjectResult | Promise<BeforeUploadObjectResult> => this.props.beforeUpload({ file, fileList }),
245
+ notifyAfterUpload: ({ response, file, fileList }): AfterUploadResult => this.props.afterUpload({ response, file, fileList }),
281
246
  resetInput: (): void => {
282
247
  this.setState(prevState => ({
283
- inputKey: Math.random(),
248
+ inputKey: Math.random()
284
249
  }));
285
250
  },
286
251
  resetReplaceInput: (): void => {
287
252
  this.setState(prevState => ({
288
- replaceInputKey: Math.random(),
253
+ replaceInputKey: Math.random()
289
254
  }));
290
255
  },
291
- updateDragAreaStatus: (dragAreaStatus: string): void =>
292
- this.setState({ dragAreaStatus } as { dragAreaStatus: 'default' | 'legal' | 'illegal' }),
256
+ updateDragAreaStatus: (dragAreaStatus: string): void => this.setState({ dragAreaStatus } as { dragAreaStatus: 'default' | 'legal' | 'illegal' }),
293
257
  notifyChange: ({ currentFile, fileList }): void => this.props.onChange({ currentFile, fileList }),
294
258
  updateLocalUrls: (urls): void => this.setState({ localUrls: urls }),
295
259
  notifyClear: (): void => this.props.onClear(),
@@ -331,6 +295,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
331
295
  this.setState({ replaceIdx: index }, () => {
332
296
  this.replaceInputRef.current.click();
333
297
  });
298
+
334
299
  };
335
300
 
336
301
  onReplaceChange = (e: ChangeEvent<HTMLInputElement>): void => {
@@ -351,11 +316,11 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
351
316
  * insert files at index
352
317
  * @param files Array<CustomFile>
353
318
  * @param index number
354
- * @returns
319
+ * @returns
355
320
  */
356
321
  insert = (files: Array<CustomFile>, index: number): void => {
357
322
  return this.foundation.insertFileToList(files, index);
358
- };
323
+ }
359
324
 
360
325
  /**
361
326
  * ref method
@@ -368,19 +333,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
368
333
 
369
334
  renderFile = (file: FileItem, index: number, locale: Locale['Upload']): ReactNode => {
370
335
  const { name, status, validateMessage, _sizeInvalid, uid } = file;
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;
336
+ const { previewFile, listType, itemStyle, showPicInfo, renderPicInfo, renderPicPreviewIcon, renderFileOperation, renderFileItem, renderThumbnail, disabled, onPreviewClick } = this.props;
384
337
  const onRemove = (): void => this.remove(file);
385
338
  const onRetry = (): void => {
386
339
  this.foundation.retry(file);
@@ -405,10 +358,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
405
358
  renderFileOperation,
406
359
  renderThumbnail,
407
360
  onReplace,
408
- onPreviewClick:
409
- typeof onPreviewClick !== 'undefined'
410
- ? (): void => this.foundation.handlePreviewClick(file)
411
- : undefined,
361
+ onPreviewClick: typeof onPreviewClick !== 'undefined' ? (): void => this.foundation.handlePreviewClick(file) : undefined,
412
362
  };
413
363
 
414
364
  if (status === strings.FILE_STATUS_UPLOAD_FAIL && !validateMessage) {
@@ -454,7 +404,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
454
404
  });
455
405
  const dragAreaCls = cls({
456
406
  [`${dragAreaBaseCls}-legal`]: dragAreaStatus === strings.DRAG_AREA_LEGAL,
457
- [`${dragAreaBaseCls}-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL,
407
+ [`${dragAreaBaseCls}-illegal`]: dragAreaStatus === strings.DRAG_AREA_ILLEGAL
458
408
  });
459
409
  const mainCls = `${prefixCls}-file-list-main`;
460
410
  const addContentProps = {
@@ -463,7 +413,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
463
413
  onClick: this.onClick,
464
414
  };
465
415
  const containerProps = {
466
- className: fileListCls,
416
+ className: fileListCls
467
417
  };
468
418
  const draggableProps = {
469
419
  onDrop: this.onDrop,
@@ -475,7 +425,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
475
425
  Object.assign(addContentProps, draggableProps, { className: cls(uploadAddCls, dragAreaCls) });
476
426
  }
477
427
  const addContent = (
478
- <div {...addContentProps} x-semi-prop="children">
428
+ <div {...addContentProps}>
479
429
  {children}
480
430
  </div>
481
431
  );
@@ -500,7 +450,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
500
450
  )}
501
451
  </LocaleConsumer>
502
452
  );
503
- };
453
+ }
504
454
 
505
455
  renderFileListDefault = () => {
506
456
  const { showUploadList, limit, disabled } = this.props;
@@ -512,7 +462,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
512
462
  const showTitle = limit !== 1 && fileList.length;
513
463
  const showClear = this.props.showClear && !disabled;
514
464
  const containerProps = {
515
- className: fileListCls,
465
+ className: fileListCls
516
466
  };
517
467
 
518
468
  if (!showUploadList || !fileList.length) {
@@ -527,12 +477,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
527
477
  <div className={titleCls}>
528
478
  <span className={`${titleCls}-choosen`}>{locale.selectedFiles}</span>
529
479
  {showClear ? (
530
- <span
531
- role="button"
532
- tabIndex={0}
533
- onClick={this.clear}
534
- className={`${titleCls}-clear`}
535
- >
480
+ <span role="button" tabIndex={0} onClick={this.clear} className={`${titleCls}-clear`}>
536
481
  {locale.clear}
537
482
  </span>
538
483
  ) : null}
@@ -546,7 +491,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
546
491
  )}
547
492
  </LocaleConsumer>
548
493
  );
549
- };
494
+ }
550
495
 
551
496
  onDrop = (e: DragEvent<HTMLDivElement>): void => {
552
497
  this.foundation.handleDrop(e);
@@ -579,7 +524,7 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
579
524
  {children}
580
525
  </div>
581
526
  );
582
- };
527
+ }
583
528
 
584
529
  renderDragArea = (): ReactNode => {
585
530
  const { dragAreaStatus } = this.state;
@@ -609,16 +554,14 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
609
554
  children
610
555
  ) : (
611
556
  <>
612
- <div className={`${dragAreaBaseCls}-icon`} x-semi-prop="dragIcon">
557
+ <div className={`${dragAreaBaseCls}-icon`}>
613
558
  {dragIcon || <IconUpload size="extra-large" />}
614
559
  </div>
615
560
  <div className={`${dragAreaBaseCls}-text`}>
616
- <div className={`${dragAreaBaseCls}-main-text`} x-semi-prop="dragMainText">
561
+ <div className={`${dragAreaBaseCls}-main-text`}>
617
562
  {dragMainText || locale.mainText}
618
563
  </div>
619
- <div className={`${dragAreaBaseCls}-sub-text`} x-semi-prop="dragSubText">
620
- {dragSubText}
621
- </div>
564
+ <div className={`${dragAreaBaseCls}-sub-text`}>{dragSubText}</div>
622
565
  <div className={`${dragAreaBaseCls}-tips`}>
623
566
  {dragAreaStatus === strings.DRAG_AREA_LEGAL && (
624
567
  <span className={`${dragAreaBaseCls}-tips-legal`}>{locale.legalTips}</span>
@@ -655,18 +598,14 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
655
598
  validateStatus,
656
599
  directory,
657
600
  } = this.props;
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
- );
601
+ const uploadCls = cls(prefixCls, {
602
+ [`${prefixCls}-picture`]: listType === strings.FILE_LIST_PIC,
603
+ [`${prefixCls}-disabled`]: disabled,
604
+ [`${prefixCls}-default`]: validateStatus === 'default',
605
+ [`${prefixCls}-error`]: validateStatus === 'error',
606
+ [`${prefixCls}-warning`]: validateStatus === 'warning',
607
+ [`${prefixCls}-success`]: validateStatus === 'success',
608
+ }, className);
670
609
  const inputCls = cls(`${prefixCls}-hidden-input`);
671
610
  const inputReplaceCls = cls(`${prefixCls}-hidden-input-replace`);
672
611
  const promptCls = cls(`${prefixCls}-prompt`);
@@ -701,17 +640,9 @@ class Upload extends BaseComponent<UploadProps, UploadState> {
701
640
  ref={this.replaceInputRef}
702
641
  />
703
642
  {this.renderAddContent()}
704
- {prompt ? (
705
- <div className={promptCls} x-semi-prop="prompt">
706
- {prompt}
707
- </div>
708
- ) : null}
643
+ {prompt ? <div className={promptCls}>{prompt}</div> : null}
709
644
 
710
- {validateMessage ? (
711
- <div className={validateMsgCls} x-semi-prop="validateMessage">
712
- {validateMessage}
713
- </div>
714
- ) : null}
645
+ {validateMessage ? <div className={validateMsgCls}>{validateMessage}</div> : null}
715
646
  {this.renderFileList()}
716
647
  </div>
717
648
  );