@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
@@ -15,6 +15,7 @@ import { cssClasses, numbers } from '@douyinfe/semi-foundation/lib/es/pagination
15
15
  import '@douyinfe/semi-foundation/lib/es/pagination/pagination.css';
16
16
  import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/lib/es/popover/constants';
17
17
  import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons';
18
+ import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
18
19
  import ConfigContext from '../configProvider/context';
19
20
  import LocaleConsumer from '../locale/localeConsumer';
20
21
  import Select from '../select/index';
@@ -45,6 +46,7 @@ export default class Pagination extends BaseComponent {
45
46
  this.foundation = new PaginationFoundation(this.adapter);
46
47
  this.renderDefaultPage = _bindInstanceProperty(_context = this.renderDefaultPage).call(_context, this);
47
48
  this.renderSmallPage = _bindInstanceProperty(_context2 = this.renderSmallPage).call(_context2, this);
49
+ warning(Boolean(props.showSizeChanger && props.hideOnSinglePage), '[Semi Pagination] You should not use showSizeChanger and hideOnSinglePage in ths same time. At this time, hideOnSinglePage no longer takes effect, otherwise there may be a problem that the switch entry disappears');
48
50
  }
49
51
 
50
52
  get adapter() {
@@ -338,7 +340,8 @@ export default class Pagination extends BaseComponent {
338
340
  className,
339
341
  style,
340
342
  hideOnSinglePage,
341
- hoverShowPageSelect
343
+ hoverShowPageSelect,
344
+ showSizeChanger
342
345
  } = this.props;
343
346
  const paginationCls = classNames("".concat(prefixCls, "-small"), prefixCls, className);
344
347
  const {
@@ -348,7 +351,7 @@ export default class Pagination extends BaseComponent {
348
351
  } = this.state;
349
352
  const totalPageNum = Math.ceil(total / pageSize);
350
353
 
351
- if (totalPageNum < 2 && hideOnSinglePage) {
354
+ if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
352
355
  return null;
353
356
  }
354
357
 
@@ -377,13 +380,14 @@ export default class Pagination extends BaseComponent {
377
380
  showTotal,
378
381
  className,
379
382
  style,
380
- hideOnSinglePage
383
+ hideOnSinglePage,
384
+ showSizeChanger
381
385
  } = this.props;
382
386
  const paginationCls = classNames(className, "".concat(prefixCls));
383
387
  const showTotalCls = "".concat(prefixCls, "-total");
384
388
  const totalPageNum = Math.ceil(total / pageSize);
385
389
 
386
- if (totalPageNum < 2 && hideOnSinglePage) {
390
+ if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
387
391
  return null;
388
392
  }
389
393
 
@@ -65,7 +65,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
65
65
  prefixCls?: string;
66
66
  name?: string;
67
67
  onChange?: (e: RadioChangeEvent) => void;
68
- buttonSize?: "small" | "large" | "middle";
68
+ buttonSize?: "small" | "middle" | "large";
69
69
  isCardRadio?: boolean;
70
70
  isPureCardRadio?: boolean;
71
71
  };
@@ -127,6 +127,7 @@ class Radio extends BaseComponent {
127
127
  ["".concat(prefix, "-cardRadioGroup")]: isCardRadioGroup,
128
128
  ["".concat(prefix, "-cardRadioGroup_disabled")]: isDisabled && isCardRadioGroup,
129
129
  ["".concat(prefix, "-cardRadioGroup_checked")]: isCardRadioGroup && realChecked && !isDisabled,
130
+ ["".concat(prefix, "-cardRadioGroup_checked_disabled")]: isCardRadioGroup && realChecked && isDisabled,
130
131
  ["".concat(prefix, "-cardRadioGroup_hover")]: isCardRadioGroup && !realChecked && isHover && !isDisabled,
131
132
  [className]: Boolean(className)
132
133
  });
@@ -40,7 +40,7 @@ declare class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState>
40
40
  disabled: PropTypes.Requireable<boolean>;
41
41
  name: PropTypes.Requireable<string>;
42
42
  options: PropTypes.Requireable<any[]>;
43
- buttonSize: PropTypes.Requireable<"small" | "large" | "middle">;
43
+ buttonSize: PropTypes.Requireable<"small" | "middle" | "large">;
44
44
  type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
45
45
  value: PropTypes.Requireable<any>;
46
46
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
@@ -71,7 +71,7 @@ export default class Item extends PureComponent {
71
71
  height: size,
72
72
  fontSize: size
73
73
  } : {};
74
- const iconSize = size === 'small' ? 'default' : 'extra-large';
74
+ const iconSize = isCustomSize ? 'inherit' : size === 'small' ? 'default' : 'extra-large';
75
75
  const content = character ? character : /*#__PURE__*/React.createElement(IconStar, {
76
76
  size: iconSize
77
77
  });
@@ -86,7 +86,8 @@ export default class Item extends PureComponent {
86
86
  "aria-checked": value > index ? 'true' : 'false',
87
87
  "aria-posinset": index + 1,
88
88
  "aria-setsize": count,
89
- tabIndex: 0
89
+ tabIndex: 0,
90
+ className: "".concat(prefixCls, "-wrapper")
90
91
  }, /*#__PURE__*/React.createElement("div", {
91
92
  className: "".concat(prefixCls, "-first"),
92
93
  style: {
@@ -2,13 +2,20 @@ import React, { MouseEvent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import SelectFoundation, { SelectAdapter } from '@douyinfe/semi-foundation/lib/es/select/foundation';
4
4
  import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
5
+ import { InputProps } from '../input/index';
5
6
  import Option, { OptionProps } from './option';
6
7
  import OptionGroup from './optionGroup';
8
+ import { Subtract } from 'utility-types';
7
9
  import '@douyinfe/semi-foundation/lib/es/select/select.css';
8
10
  import { Position, TooltipProps } from '../tooltip';
9
11
  export { OptionProps } from './option';
10
12
  export { OptionGroupProps } from './optionGroup';
11
13
  export { VirtualRowProps } from './virtualRow';
14
+ declare type ExcludeInputType = {
15
+ value?: InputProps['value'];
16
+ onFocus?: InputProps['onFocus'];
17
+ onChange?: InputProps['onChange'];
18
+ };
12
19
  export interface optionRenderProps {
13
20
  key?: any;
14
21
  label?: string | React.ReactNode | number;
@@ -48,6 +55,7 @@ export declare type RenderMultipleSelectedItemFn = (optionNode: Record<string, a
48
55
  };
49
56
  export declare type RenderSelectedItemFn = RenderSingleSelectedItemFn | RenderMultipleSelectedItemFn;
50
57
  export declare type SelectProps = {
58
+ id?: string;
51
59
  autoFocus?: boolean;
52
60
  arrowIcon?: React.ReactNode;
53
61
  defaultValue?: string | number | any[] | Record<string, any>;
@@ -84,6 +92,7 @@ export declare type SelectProps = {
84
92
  suffix?: React.ReactNode;
85
93
  prefix?: React.ReactNode;
86
94
  insetLabel?: React.ReactNode;
95
+ inputProps?: Subtract<InputProps, ExcludeInputType>;
87
96
  showClear?: boolean;
88
97
  showArrow?: boolean;
89
98
  renderSelectedItem?: RenderSelectedItemFn;
@@ -150,6 +159,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
150
159
  dropdownStyle: PropTypes.Requireable<object>;
151
160
  outerTopSlot: PropTypes.Requireable<PropTypes.ReactNodeLike>;
152
161
  innerTopSlot: PropTypes.Requireable<PropTypes.ReactNodeLike>;
162
+ inputProps: PropTypes.Requireable<object>;
153
163
  outerBottomSlot: PropTypes.Requireable<PropTypes.ReactNodeLike>;
154
164
  innerBottomSlot: PropTypes.Requireable<PropTypes.ReactNodeLike>;
155
165
  optionList: PropTypes.Requireable<any[]>;
@@ -342,39 +342,44 @@ class Select extends BaseComponent {
342
342
  const {
343
343
  size,
344
344
  multiple,
345
- disabled
345
+ disabled,
346
+ inputProps
346
347
  } = this.props;
348
+
349
+ const inputPropsCls = _get(inputProps, 'className');
350
+
347
351
  const inputcls = cls("".concat(prefixcls, "-input"), {
348
352
  ["".concat(prefixcls, "-input-single")]: !multiple,
349
353
  ["".concat(prefixcls, "-input-multiple")]: multiple
350
- });
354
+ }, inputPropsCls);
351
355
  const {
352
356
  inputValue
353
357
  } = this.state;
354
- const inputProps = {
358
+
359
+ const selectInputProps = _Object$assign({
355
360
  value: inputValue,
356
361
  disabled,
357
362
  className: inputcls,
358
363
  onChange: this.handleInputChange
359
- };
364
+ }, inputProps);
365
+
360
366
  let style = {}; // Multiple choice mode
361
367
 
362
368
  if (multiple) {
363
369
  style = {
364
370
  width: inputValue ? "".concat(inputValue.length * 16, "px") : '2px'
365
371
  };
366
- inputProps.style = style;
372
+ selectInputProps.style = style;
367
373
  }
368
374
 
369
375
  return /*#__PURE__*/React.createElement(Input, _Object$assign({
370
376
  ref: this.inputRef,
371
- size: size
372
- }, inputProps, {
377
+ size: size,
373
378
  onFocus: e => {
374
379
  // prevent event bubbling which will fire trigger onFocus event
375
380
  e.stopPropagation(); // e.nativeEvent.stopImmediatePropagation();
376
381
  }
377
- }));
382
+ }, selectInputProps));
378
383
  }
379
384
 
380
385
  close() {
@@ -704,7 +709,9 @@ class Select extends BaseComponent {
704
709
  key: value
705
710
  }), content);
706
711
  } else {
707
- return content;
712
+ return /*#__PURE__*/React.createElement(Fragment, {
713
+ key: value
714
+ }, content);
708
715
  }
709
716
  });
710
717
 
@@ -818,6 +825,7 @@ class Select extends BaseComponent {
818
825
  multiple,
819
826
  filter,
820
827
  style,
828
+ id,
821
829
  size,
822
830
  className,
823
831
  validateStatus,
@@ -891,6 +899,7 @@ class Select extends BaseComponent {
891
899
  ref: ref => this.triggerRef.current = ref,
892
900
  onClick: e => this.foundation.handleClick(e),
893
901
  style: style,
902
+ id: id,
894
903
  tabIndex: tabIndex,
895
904
  onMouseEnter: this.onMouseEnter,
896
905
  onMouseLeave: this.onMouseLeave,
@@ -976,6 +985,7 @@ Select.propTypes = {
976
985
  dropdownStyle: PropTypes.object,
977
986
  outerTopSlot: PropTypes.node,
978
987
  innerTopSlot: PropTypes.node,
988
+ inputProps: PropTypes.object,
979
989
  outerBottomSlot: PropTypes.node,
980
990
  innerBottomSlot: PropTypes.node,
981
991
  optionList: PropTypes.array,
@@ -176,7 +176,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
176
176
  _invokeColumnFn: (key: string, funcName: string, ...args: any[]) => void;
177
177
  _cacheHeaderRef: (node: HTMLDivElement) => void;
178
178
  getCurrentPageData: () => any;
179
- getColumns: (columns: ColumnProps<RecordType>[], children: ReactNode) => ColumnProps<any>[];
179
+ getColumns: (columns: ColumnProps<RecordType>[], children: ReactNode) => ColumnProps<RecordType>[];
180
180
  getCellWidths: (...args: any[]) => number[];
181
181
  setHeadWidths: (...args: any[]) => void;
182
182
  getHeadWidths: (...args: any[]) => number[];
@@ -85,11 +85,11 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
85
85
  panelFooter: PropTypes.Requireable<PropTypes.ReactNodeLike>;
86
86
  prefixCls: PropTypes.Requireable<string>;
87
87
  clearText: PropTypes.Requireable<string>;
88
- value: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
88
+ value: PropTypes.Requireable<string | number | string[] | number[] | Date | Date[]>;
89
89
  inputReadOnly: PropTypes.Requireable<boolean>;
90
90
  disabled: PropTypes.Requireable<boolean>;
91
91
  showClear: PropTypes.Requireable<boolean>;
92
- defaultValue: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
92
+ defaultValue: PropTypes.Requireable<string | number | string[] | number[] | Date | Date[]>;
93
93
  open: PropTypes.Requireable<boolean>;
94
94
  defaultOpen: PropTypes.Requireable<boolean>;
95
95
  onOpenChange: PropTypes.Requireable<(...args: any[]) => any>;
@@ -6,5 +6,5 @@ import PropTypes from 'prop-types';
6
6
  * - \[12:00:12, 12:21:12]
7
7
  * - \[[12:00:12, 12:21:12], [12:11:12, 12:32:12]]
8
8
  */
9
- declare const TimeShape: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
9
+ declare const TimeShape: PropTypes.Requireable<string | number | string[] | number[] | Date | Date[]>;
10
10
  export { TimeShape };
@@ -13,11 +13,11 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
13
13
  panelFooter: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
14
14
  prefixCls: import("prop-types").Requireable<string>;
15
15
  clearText: import("prop-types").Requireable<string>;
16
- value: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
16
+ value: import("prop-types").Requireable<string | number | string[] | number[] | Date | Date[]>;
17
17
  inputReadOnly: import("prop-types").Requireable<boolean>;
18
18
  disabled: import("prop-types").Requireable<boolean>;
19
19
  showClear: import("prop-types").Requireable<boolean>;
20
- defaultValue: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
20
+ defaultValue: import("prop-types").Requireable<string | number | string[] | number[] | Date | Date[]>;
21
21
  open: import("prop-types").Requireable<boolean>;
22
22
  defaultOpen: import("prop-types").Requireable<boolean>;
23
23
  onOpenChange: import("prop-types").Requireable<(...args: any[]) => any>;
@@ -3,28 +3,31 @@ import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
4
4
  export interface TimelineItemProps {
5
5
  color?: string;
6
- time?: string;
6
+ time?: React.ReactNode;
7
7
  type?: 'default' | 'ongoing' | 'success' | 'warning' | 'error';
8
8
  dot?: React.ReactNode;
9
9
  extra?: React.ReactNode;
10
10
  position?: 'left' | 'right';
11
11
  className?: string;
12
12
  style?: React.CSSProperties;
13
+ onClick?: React.MouseEventHandler<HTMLLIElement>;
13
14
  }
14
15
  export default class Item extends PureComponent<TimelineItemProps> {
15
16
  static propTypes: {
16
17
  color: PropTypes.Requireable<string>;
17
- time: PropTypes.Requireable<string>;
18
+ time: PropTypes.Requireable<PropTypes.ReactNodeLike>;
18
19
  type: PropTypes.Requireable<string>;
19
20
  dot: PropTypes.Requireable<PropTypes.ReactNodeLike>;
20
21
  extra: PropTypes.Requireable<PropTypes.ReactNodeLike>;
21
22
  position: PropTypes.Requireable<string>;
22
23
  className: PropTypes.Requireable<string>;
23
24
  style: PropTypes.Requireable<object>;
25
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
24
26
  };
25
27
  static defaultProps: {
26
28
  type: string;
27
29
  time: string;
30
+ onClick: (...args: any[]) => void;
28
31
  };
29
32
  render(): JSX.Element;
30
33
  }
@@ -1,3 +1,4 @@
1
+ import _noop from "lodash/noop";
1
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
2
3
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
3
4
  import React, { PureComponent } from 'react';
@@ -18,7 +19,8 @@ export default class Item extends PureComponent {
18
19
  type,
19
20
  style,
20
21
  time,
21
- extra
22
+ extra,
23
+ onClick
22
24
  } = this.props;
23
25
  const itemCls = cls(prefixCls, className);
24
26
  const dotCls = cls({
@@ -33,16 +35,17 @@ export default class Item extends PureComponent {
33
35
  } : null;
34
36
  return /*#__PURE__*/React.createElement("li", {
35
37
  className: itemCls,
36
- style: style
38
+ style: style,
39
+ onClick: onClick
37
40
  }, /*#__PURE__*/React.createElement("div", {
38
41
  className: "".concat(prefixCls, "-tail")
39
42
  }), /*#__PURE__*/React.createElement("div", _Object$assign({
40
43
  className: dotCls
41
44
  }, dotStyle), dot), /*#__PURE__*/React.createElement("div", {
42
45
  className: "".concat(prefixCls, "-content")
43
- }, children, extra ? /*#__PURE__*/React.createElement("div", {
46
+ }, children, extra && /*#__PURE__*/React.createElement("div", {
44
47
  className: "".concat(prefixCls, "-content-extra")
45
- }, extra) : null, /*#__PURE__*/React.createElement("div", {
48
+ }, extra), time && /*#__PURE__*/React.createElement("div", {
46
49
  className: "".concat(prefixCls, "-content-time")
47
50
  }, time)));
48
51
  }
@@ -50,15 +53,17 @@ export default class Item extends PureComponent {
50
53
  }
51
54
  Item.propTypes = {
52
55
  color: PropTypes.string,
53
- time: PropTypes.string,
56
+ time: PropTypes.node,
54
57
  type: PropTypes.oneOf(strings.ITEM_TYPE),
55
58
  dot: PropTypes.node,
56
59
  extra: PropTypes.node,
57
60
  position: PropTypes.oneOf(strings.ITEM_POS),
58
61
  className: PropTypes.string,
59
- style: PropTypes.object
62
+ style: PropTypes.object,
63
+ onClick: PropTypes.func
60
64
  };
61
65
  Item.defaultProps = {
62
66
  type: 'default',
63
- time: ''
67
+ time: '',
68
+ onClick: _noop
64
69
  };
@@ -64,8 +64,6 @@ export default class TreeNode extends PureComponent {
64
64
  const {
65
65
  onNodeRightClick
66
66
  } = this.context;
67
- e.stopPropagation();
68
- e.nativeEvent.stopImmediatePropagation();
69
67
  onNodeRightClick(e, this.props);
70
68
  };
71
69
 
@@ -716,6 +716,7 @@ class TreeSelect extends BaseComponent {
716
716
  itemSize: virtualize.itemSize,
717
717
  height: height,
718
718
  width: width,
719
+ // @ts-ignore avoid strict check of itemKey
719
720
  itemKey: this.itemKey,
720
721
  itemData: flattenNodes,
721
722
  className: "".concat(prefixTree, "-virtual-list"),
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
39
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 6 | 5>;
40
+ heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
@@ -26,6 +26,7 @@ declare class FileCard extends PureComponent<FileCardProps> {
26
26
  style: PropTypes.Requireable<object>;
27
27
  url: PropTypes.Requireable<string>;
28
28
  validateMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
29
+ index: PropTypes.Requireable<number>;
29
30
  };
30
31
  static defaultProps: {
31
32
  listType: "list";
@@ -39,6 +40,7 @@ declare class FileCard extends PureComponent<FileCardProps> {
39
40
  renderValidateMessage(): ReactNode;
40
41
  renderPicValidateMsg(): ReactNode;
41
42
  renderPic(locale: Locale['Upload']): ReactNode;
43
+ renderFile(locale: Locale["Upload"]): JSX.Element;
42
44
  onRemove(e: MouseEvent): void;
43
45
  onReplace(e: MouseEvent): void;
44
46
  onRetry(e: MouseEvent): void;
@@ -4,13 +4,13 @@ import cls from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/upload/constants';
6
6
  import { getFileSize } from '@douyinfe/semi-foundation/lib/es/upload/utils';
7
+ import { IconAlertCircle, IconClose, IconFile, IconRefresh } from '@douyinfe/semi-icons';
7
8
  import LocaleConsumer from '../locale/localeConsumer';
8
9
  import IconButton from '../iconButton/index';
9
10
  import Progress from '../progress/index';
10
11
  import Tooltip from '../tooltip/index';
11
12
  import Spin from '../spin/index';
12
13
  import { isElement } from '../_base/reactUtils';
13
- import { IconAlertCircle, IconClose, IconFile, IconRefresh } from '@douyinfe/semi-icons';
14
14
  const prefixCls = cssClasses.PREFIX;
15
15
 
16
16
  const ErrorSvg = function () {
@@ -158,16 +158,23 @@ class FileCard extends PureComponent {
158
158
  status,
159
159
  disabled,
160
160
  style,
161
- onPreviewClick
161
+ onPreviewClick,
162
+ showPicInfo,
163
+ renderPicInfo,
164
+ renderThumbnail,
165
+ name,
166
+ index
162
167
  } = this.props;
168
+ const showProgress = status === strings.FILE_STATUS_UPLOADING && percent !== 100;
169
+ const showRetry = status === strings.FILE_STATUS_UPLOAD_FAIL && this.props.showRetry;
170
+ const showReplace = status === strings.FILE_STATUS_SUCCESS && this.props.showReplace;
163
171
  const filePicCardCls = cls({
164
172
  ["".concat(prefixCls, "-picture-file-card")]: true,
165
173
  ["".concat(prefixCls, "-picture-file-card-disabled")]: disabled,
166
- ["".concat(prefixCls, "-picture-file-card-show-pointer")]: typeof onPreviewClick !== 'undefined'
174
+ ["".concat(prefixCls, "-picture-file-card-show-pointer")]: typeof onPreviewClick !== 'undefined',
175
+ ["".concat(prefixCls, "-picture-file-card-error")]: status === strings.FILE_STATUS_UPLOAD_FAIL,
176
+ ["".concat(prefixCls, "-picture-file-card-uploading")]: showProgress
167
177
  });
168
- const showProgress = status === strings.FILE_STATUS_UPLOADING && percent !== 100;
169
- const showRetry = status === strings.FILE_STATUS_UPLOAD_FAIL && this.props.showRetry;
170
- const showReplace = status === strings.FILE_STATUS_SUCCESS && this.props.showReplace;
171
178
  const closeCls = "".concat(prefixCls, "-picture-file-card-close");
172
179
  const retry = /*#__PURE__*/React.createElement("div", {
173
180
  className: "".concat(prefixCls, "-picture-file-card-retry"),
@@ -187,47 +194,38 @@ class FileCard extends PureComponent {
187
194
  }, /*#__PURE__*/React.createElement(ReplaceSvg, {
188
195
  className: "".concat(prefixCls, "-picture-file-card-icon-replace")
189
196
  })));
197
+ const picInfo = typeof renderPicInfo === 'function' ? renderPicInfo(this.props) : /*#__PURE__*/React.createElement("div", {
198
+ className: "".concat(prefixCls, "-picture-file-card-pic-info")
199
+ }, index + 1);
200
+ const thumbnail = typeof renderThumbnail === 'function' ? renderThumbnail(this.props) : /*#__PURE__*/React.createElement("img", {
201
+ src: url,
202
+ alt: "picture of ".concat(name)
203
+ });
190
204
  return /*#__PURE__*/React.createElement("div", {
191
205
  className: filePicCardCls,
192
206
  style: style,
193
207
  onClick: onPreviewClick
194
- }, /*#__PURE__*/React.createElement("img", {
195
- src: url
196
- }), showProgress ? /*#__PURE__*/React.createElement(Progress, {
208
+ }, thumbnail, showProgress ? /*#__PURE__*/React.createElement(Progress, {
197
209
  percent: percent,
198
210
  type: "circle",
199
211
  size: "small",
200
212
  orbitStroke: '#FFF'
201
- }) : null, showRetry ? retry : null, showReplace && replace, disabled ? null : /*#__PURE__*/React.createElement("div", {
202
- className: closeCls,
203
- onClick: e => this.onRemove(e)
213
+ }) : null, showRetry ? retry : null, showReplace && replace, showPicInfo && picInfo, !disabled && /*#__PURE__*/React.createElement("div", {
214
+ className: closeCls
204
215
  }, /*#__PURE__*/React.createElement(IconClose, {
205
- size: "extra-small"
216
+ size: "extra-small",
217
+ onClick: e => this.onRemove(e)
206
218
  })), this.renderPicValidateMsg());
207
219
  }
208
220
 
209
- onRemove(e) {
210
- e.stopPropagation();
211
- this.props.onRemove(this.props, e);
212
- }
213
-
214
- onReplace(e) {
215
- e.stopPropagation();
216
- this.props.onReplace(this.props, e);
217
- }
218
-
219
- onRetry(e) {
220
- e.stopPropagation();
221
- this.props.onRetry(this.props, e);
222
- }
223
-
224
- render() {
221
+ renderFile(locale) {
225
222
  const {
226
223
  name,
227
224
  size,
228
225
  percent,
229
226
  url,
230
- listType,
227
+ showRetry: propsShowRetry,
228
+ showReplace: propsShowReplace,
231
229
  preview,
232
230
  previewFile,
233
231
  status,
@@ -248,15 +246,8 @@ class FileCard extends PureComponent {
248
246
  const replaceCls = "".concat(prefixCls, "-file-card-replace");
249
247
  const showProgress = !(percent === 100 || typeof percent === 'undefined') && status === strings.FILE_STATUS_UPLOADING; // only show retry when upload fail & showRetry is true, no need to show during validate fail
250
248
 
251
- const showRetry = status === strings.FILE_STATUS_UPLOAD_FAIL && this.props.showRetry;
252
- const showReplace = status === strings.FILE_STATUS_SUCCESS && this.props.showReplace;
253
-
254
- if (listType === strings.FILE_LIST_PIC) {
255
- return /*#__PURE__*/React.createElement(LocaleConsumer, {
256
- componentName: "Upload"
257
- }, locale => this.renderPic(locale));
258
- }
259
-
249
+ const showRetry = status === strings.FILE_STATUS_UPLOAD_FAIL && propsShowRetry;
250
+ const showReplace = status === strings.FILE_STATUS_SUCCESS && propsShowReplace;
260
251
  const fileSize = this.transSize(size);
261
252
  let previewContent = preview ? /*#__PURE__*/React.createElement("img", {
262
253
  src: url
@@ -268,9 +259,7 @@ class FileCard extends PureComponent {
268
259
  previewContent = previewFile(this.props);
269
260
  }
270
261
 
271
- return /*#__PURE__*/React.createElement(LocaleConsumer, {
272
- componentName: "Upload"
273
- }, locale => /*#__PURE__*/React.createElement("div", {
262
+ return /*#__PURE__*/React.createElement("div", {
274
263
  className: fileCardCls,
275
264
  style: style,
276
265
  onClick: onPreviewClick
@@ -315,7 +304,42 @@ class FileCard extends PureComponent {
315
304
  theme: "borderless",
316
305
  size: "small",
317
306
  className: closeCls
318
- })));
307
+ }));
308
+ }
309
+
310
+ onRemove(e) {
311
+ e.stopPropagation();
312
+ this.props.onRemove(this.props, e);
313
+ }
314
+
315
+ onReplace(e) {
316
+ e.stopPropagation();
317
+ this.props.onReplace(this.props, e);
318
+ }
319
+
320
+ onRetry(e) {
321
+ e.stopPropagation();
322
+ this.props.onRetry(this.props, e);
323
+ }
324
+
325
+ render() {
326
+ const {
327
+ listType
328
+ } = this.props;
329
+
330
+ if (listType === strings.FILE_LIST_PIC) {
331
+ return /*#__PURE__*/React.createElement(LocaleConsumer, {
332
+ componentName: "Upload"
333
+ }, locale => this.renderPic(locale));
334
+ }
335
+
336
+ if (listType === strings.FILE_LIST_DEFAULT) {
337
+ return /*#__PURE__*/React.createElement(LocaleConsumer, {
338
+ componentName: "Upload"
339
+ }, locale => this.renderFile(locale));
340
+ }
341
+
342
+ return null;
319
343
  }
320
344
 
321
345
  }
@@ -338,7 +362,8 @@ FileCard.propTypes = {
338
362
  status: PropTypes.string,
339
363
  style: PropTypes.object,
340
364
  url: PropTypes.string,
341
- validateMessage: PropTypes.node
365
+ validateMessage: PropTypes.node,
366
+ index: PropTypes.number
342
367
  };
343
368
  FileCard.defaultProps = {
344
369
  listType: strings.FILE_LIST_DEFAULT,