@douyinfe/semi-ui 2.10.2-alpha.0 → 2.10.3

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 (38) hide show
  1. package/cascader/index.tsx +4 -2
  2. package/dist/umd/semi-ui.js +4827 -3239
  3. package/dist/umd/semi-ui.js.map +1 -1
  4. package/dist/umd/semi-ui.min.js +1 -1
  5. package/dist/umd/semi-ui.min.js.map +1 -1
  6. package/lib/cjs/cascader/index.js +4 -2
  7. package/lib/cjs/form/baseForm.d.ts +1 -1
  8. package/lib/cjs/form/field.d.ts +1 -1
  9. package/lib/cjs/modal/confirm.d.ts +5 -5
  10. package/lib/cjs/select/index.js +27 -24
  11. package/lib/cjs/table/Body/BaseRow.d.ts +1 -0
  12. package/lib/cjs/table/Body/BaseRow.js +22 -0
  13. package/lib/cjs/table/HeadTable.d.ts +2 -1
  14. package/lib/cjs/table/HeadTable.js +2 -1
  15. package/lib/cjs/table/Table.d.ts +1 -1
  16. package/lib/cjs/table/Table.js +2 -0
  17. package/lib/cjs/typography/title.d.ts +1 -1
  18. package/lib/es/cascader/index.js +4 -2
  19. package/lib/es/form/baseForm.d.ts +1 -1
  20. package/lib/es/form/field.d.ts +1 -1
  21. package/lib/es/modal/confirm.d.ts +5 -5
  22. package/lib/es/select/index.js +23 -21
  23. package/lib/es/table/Body/BaseRow.d.ts +1 -0
  24. package/lib/es/table/Body/BaseRow.js +22 -0
  25. package/lib/es/table/HeadTable.d.ts +2 -1
  26. package/lib/es/table/HeadTable.js +2 -1
  27. package/lib/es/table/Table.d.ts +1 -1
  28. package/lib/es/table/Table.js +2 -0
  29. package/lib/es/typography/title.d.ts +1 -1
  30. package/package.json +9 -9
  31. package/scrollList/_story/ScrollList/index.js +1 -1
  32. package/select/index.tsx +3 -1
  33. package/table/Body/BaseRow.tsx +15 -0
  34. package/table/HeadTable.tsx +3 -1
  35. package/table/Table.tsx +2 -0
  36. package/table/_story/v2/FixedOnHeaderRow/index.jsx +134 -0
  37. package/table/_story/v2/index.js +2 -1
  38. package/upload/_story/upload.stories.js +1 -0
@@ -800,13 +800,15 @@ class Cascader extends _baseComponent.default {
800
800
  if ((0, _isArray.default)(realValue)) {
801
801
  normallizedValue = (0, _isArray.default)(realValue[0]) ? realValue : [realValue];
802
802
  } else {
803
- normallizedValue = [[realValue]];
803
+ if (realValue !== undefined) {
804
+ normallizedValue = [[realValue]];
805
+ }
804
806
  } // formatValuePath is used to save value of valuePath
805
807
 
806
808
 
807
809
  const formatValuePath = [];
808
810
  (0, _forEach.default)(normallizedValue).call(normallizedValue, valueItem => {
809
- const formatItem = onChangeWithObject ? (0, _map.default)(valueItem).call(valueItem, i => i.value) : valueItem;
811
+ const formatItem = onChangeWithObject ? (0, _map.default)(valueItem).call(valueItem, i => i === null || i === void 0 ? void 0 : i.value) : valueItem;
810
812
  formatValuePath.push(formatItem);
811
813
  }); // formatKeys is used to save key of value
812
814
 
@@ -125,7 +125,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
125
125
  onBlur?: (e: React.FocusEvent<Element, Element>) => void;
126
126
  onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
127
127
  children?: React.ReactNode;
128
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
128
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
129
129
  static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
130
130
  static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
131
131
  static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
@@ -73,7 +73,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
73
73
  onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
74
74
  onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
75
75
  children?: import("react").ReactNode;
76
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
76
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
77
77
  declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
78
78
  declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
79
79
  declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
@@ -15,7 +15,7 @@ export declare function withInfo(props: ModalReactProps): {
15
15
  bodyStyle?: React.CSSProperties;
16
16
  maskStyle?: React.CSSProperties;
17
17
  style?: React.CSSProperties;
18
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
18
+ icon: React.ReactNode | JSX.Element;
19
19
  closeIcon?: React.ReactNode;
20
20
  title?: React.ReactNode;
21
21
  content?: React.ReactNode;
@@ -57,7 +57,7 @@ export declare function withSuccess(props: ModalReactProps): {
57
57
  bodyStyle?: React.CSSProperties;
58
58
  maskStyle?: React.CSSProperties;
59
59
  style?: React.CSSProperties;
60
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
60
+ icon: React.ReactNode | JSX.Element;
61
61
  closeIcon?: React.ReactNode;
62
62
  title?: React.ReactNode;
63
63
  content?: React.ReactNode;
@@ -99,7 +99,7 @@ export declare function withWarning(props: ModalReactProps): {
99
99
  bodyStyle?: React.CSSProperties;
100
100
  maskStyle?: React.CSSProperties;
101
101
  style?: React.CSSProperties;
102
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
102
+ icon: React.ReactNode | JSX.Element;
103
103
  closeIcon?: React.ReactNode;
104
104
  title?: React.ReactNode;
105
105
  content?: React.ReactNode;
@@ -141,7 +141,7 @@ export declare function withError(props: ModalReactProps): {
141
141
  bodyStyle?: React.CSSProperties;
142
142
  maskStyle?: React.CSSProperties;
143
143
  style?: React.CSSProperties;
144
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
144
+ icon: React.ReactNode | JSX.Element;
145
145
  closeIcon?: React.ReactNode;
146
146
  title?: React.ReactNode;
147
147
  content?: React.ReactNode;
@@ -183,7 +183,7 @@ export declare function withConfirm(props: ModalReactProps): {
183
183
  bodyStyle?: React.CSSProperties;
184
184
  maskStyle?: React.CSSProperties;
185
185
  style?: React.CSSProperties;
186
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
186
+ icon: React.ReactNode | JSX.Element;
187
187
  closeIcon?: React.ReactNode;
188
188
  title?: React.ReactNode;
189
189
  content?: React.ReactNode;
@@ -16,8 +16,6 @@ exports.default = void 0;
16
16
 
17
17
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
18
18
 
19
- var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
20
-
21
19
  var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
22
20
 
23
21
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
@@ -34,6 +32,8 @@ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
34
32
 
35
33
  var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
36
34
 
35
+ var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
36
+
37
37
  var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
38
38
 
39
39
  var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/values"));
@@ -56,7 +56,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
56
56
 
57
57
  var _propTypes = _interopRequireDefault(require("prop-types"));
58
58
 
59
- var _context16 = _interopRequireDefault(require("../configProvider/context"));
59
+ var _context15 = _interopRequireDefault(require("../configProvider/context"));
60
60
 
61
61
  var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/select/foundation"));
62
62
 
@@ -96,6 +96,8 @@ var _utils2 = require("../_utils");
96
96
 
97
97
  var _warning = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/warning"));
98
98
 
99
+ var _uuid = require("@douyinfe/semi-foundation/lib/cjs/utils/uuid");
100
+
99
101
  require("@douyinfe/semi-foundation/lib/cjs/select/select.css");
100
102
 
101
103
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -110,7 +112,7 @@ const key = 0; // Notes: Use the label of the option as the identifier, that is,
110
112
 
111
113
  class Select extends _baseComponent.default {
112
114
  constructor(props) {
113
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8;
115
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7;
114
116
 
115
117
  super(props);
116
118
 
@@ -132,19 +134,19 @@ class Select extends _baseComponent.default {
132
134
  };
133
135
  /* Generate random string */
134
136
 
135
- this.selectOptionListID = (0, _slice.default)(_context = Math.random().toString(36)).call(_context, 2);
137
+ this.selectOptionListID = '';
136
138
  this.virtualizeListRef = /*#__PURE__*/_react.default.createRef();
137
139
  this.inputRef = /*#__PURE__*/_react.default.createRef();
138
140
  this.triggerRef = /*#__PURE__*/_react.default.createRef();
139
141
  this.optionsRef = /*#__PURE__*/_react.default.createRef();
140
142
  this.clickOutsideHandler = null;
141
- this.onSelect = (0, _bind.default)(_context2 = this.onSelect).call(_context2, this);
142
- this.onClear = (0, _bind.default)(_context3 = this.onClear).call(_context3, this);
143
- this.onMouseEnter = (0, _bind.default)(_context4 = this.onMouseEnter).call(_context4, this);
144
- this.onMouseLeave = (0, _bind.default)(_context5 = this.onMouseLeave).call(_context5, this);
145
- this.renderOption = (0, _bind.default)(_context6 = this.renderOption).call(_context6, this);
146
- this.onKeyPress = (0, _bind.default)(_context7 = this.onKeyPress).call(_context7, this);
147
- this.onClearBtnEnterPress = (0, _bind.default)(_context8 = this.onClearBtnEnterPress).call(_context8, this);
143
+ this.onSelect = (0, _bind.default)(_context = this.onSelect).call(_context, this);
144
+ this.onClear = (0, _bind.default)(_context2 = this.onClear).call(_context2, this);
145
+ this.onMouseEnter = (0, _bind.default)(_context3 = this.onMouseEnter).call(_context3, this);
146
+ this.onMouseLeave = (0, _bind.default)(_context4 = this.onMouseLeave).call(_context4, this);
147
+ this.renderOption = (0, _bind.default)(_context5 = this.renderOption).call(_context5, this);
148
+ this.onKeyPress = (0, _bind.default)(_context6 = this.onKeyPress).call(_context6, this);
149
+ this.onClearBtnEnterPress = (0, _bind.default)(_context7 = this.onClearBtnEnterPress).call(_context7, this);
148
150
  this.foundation = new _foundation.default(this.adapter);
149
151
  (0, _warning.default)('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
150
152
  (0, _warning.default)('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
@@ -348,18 +350,18 @@ class Select extends _baseComponent.default {
348
350
  } catch (error) {}
349
351
  },
350
352
  updateScrollTop: index => {
351
- var _context10, _context11;
353
+ var _context9, _context10;
352
354
 
353
355
  // eslint-disable-next-line max-len
354
356
  let optionClassName = ".".concat(prefixcls, "-option-selected");
355
357
 
356
358
  if (index !== undefined) {
357
- var _context9;
359
+ var _context8;
358
360
 
359
- optionClassName = (0, _concat.default)(_context9 = ".".concat(prefixcls, "-option:nth-child(")).call(_context9, index, ")");
361
+ optionClassName = (0, _concat.default)(_context8 = ".".concat(prefixcls, "-option:nth-child(")).call(_context8, index, ")");
360
362
  }
361
363
 
362
- let destNode = document.querySelector((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "#".concat(prefixcls, "-")).call(_context11, this.selectOptionListID, " ")).call(_context10, optionClassName));
364
+ let destNode = document.querySelector((0, _concat.default)(_context9 = (0, _concat.default)(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " ")).call(_context9, optionClassName));
363
365
 
364
366
  if ((0, _isArray.default)(destNode)) {
365
367
  // eslint-disable-next-line prefer-destructuring
@@ -380,6 +382,7 @@ class Select extends _baseComponent.default {
380
382
 
381
383
  componentDidMount() {
382
384
  this.foundation.init();
385
+ this.selectOptionListID = (0, _uuid.getUuidShort)();
383
386
  }
384
387
 
385
388
  componentWillUnmount() {
@@ -387,10 +390,10 @@ class Select extends _baseComponent.default {
387
390
  }
388
391
 
389
392
  componentDidUpdate(prevProps, prevState) {
390
- var _context12, _context13;
393
+ var _context11, _context12;
391
394
 
392
- const prevChildrenKeys = (0, _map2.default)(_context12 = _react.default.Children.toArray(prevProps.children)).call(_context12, child => child.key);
393
- const nowChildrenKeys = (0, _map2.default)(_context13 = _react.default.Children.toArray(this.props.children)).call(_context13, child => child.key);
395
+ const prevChildrenKeys = (0, _map2.default)(_context11 = _react.default.Children.toArray(prevProps.children)).call(_context11, child => child.key);
396
+ const nowChildrenKeys = (0, _map2.default)(_context12 = _react.default.Children.toArray(this.props.children)).call(_context12, child => child.key);
394
397
  let isOptionsChanged = false;
395
398
 
396
399
  if (!(0, _isEqual2.default)(prevChildrenKeys, nowChildrenKeys) || !(0, _isEqual2.default)(prevProps.optionList, this.props.optionList)) {
@@ -631,7 +634,7 @@ class Select extends _baseComponent.default {
631
634
  }
632
635
 
633
636
  renderOptions(children) {
634
- var _context14;
637
+ var _context13;
635
638
 
636
639
  const {
637
640
  dropdownMinWidth,
@@ -667,7 +670,7 @@ class Select extends _baseComponent.default {
667
670
  });
668
671
  const isEmpty = !options.length || !(0, _some.default)(options).call(options, item => item._show);
669
672
  return /*#__PURE__*/_react.default.createElement("div", {
670
- id: (0, _concat.default)(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
673
+ id: (0, _concat.default)(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
671
674
  className: dropdownClassName,
672
675
  style: style
673
676
  }, outerTopSlot, /*#__PURE__*/_react.default.createElement("div", {
@@ -898,7 +901,7 @@ class Select extends _baseComponent.default {
898
901
  }
899
902
 
900
903
  renderSelection() {
901
- var _context15;
904
+ var _context14;
902
905
 
903
906
  const {
904
907
  disabled,
@@ -982,7 +985,7 @@ class Select extends _baseComponent.default {
982
985
  role: "combobox",
983
986
  "aria-disabled": disabled,
984
987
  "aria-expanded": isOpen,
985
- "aria-controls": (0, _concat.default)(_context15 = "".concat(prefixcls, "-")).call(_context15, this.selectOptionListID),
988
+ "aria-controls": (0, _concat.default)(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
986
989
  "aria-haspopup": "listbox",
987
990
  "aria-label": "select value",
988
991
  "aria-invalid": this.props['aria-invalid'],
@@ -1049,7 +1052,7 @@ class Select extends _baseComponent.default {
1049
1052
 
1050
1053
  }
1051
1054
 
1052
- Select.contextType = _context16.default;
1055
+ Select.contextType = _context15.default;
1053
1056
  Select.Option = _option.default;
1054
1057
  Select.OptGroup = _optionGroup.default;
1055
1058
  Select.propTypes = {
@@ -113,6 +113,7 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
113
113
  get adapter(): TableRowAdapter<BaseRowProps>;
114
114
  ref: React.MutableRefObject<any>;
115
115
  constructor(props: BaseRowProps);
116
+ componentDidMount(): void;
116
117
  shouldComponentUpdate(nextProps: BaseRowProps): boolean;
117
118
  _cacheNode: (node: any) => void;
118
119
  renderExpandIcon: (record: Record<string, any>) => React.ReactNode;
@@ -141,6 +141,28 @@ class TableRow extends _baseComponent.default {
141
141
  });
142
142
  }
143
143
 
144
+ componentDidMount() {
145
+ // fix #745
146
+ // didmount/willUnmount may be called twice when React.StrictMode is true in React 18, we need to ensure that this.cache.customRowProps is correct
147
+ const {
148
+ onRow,
149
+ index,
150
+ record
151
+ } = this.props;
152
+ const customRowProps = this.adapter.getCache('customRowProps');
153
+
154
+ if (typeof customRowProps === 'undefined') {
155
+ const _a = onRow(record, index) || {},
156
+ {
157
+ className: customClassName,
158
+ style: customStyle
159
+ } = _a,
160
+ rowProps = __rest(_a, ["className", "style"]);
161
+
162
+ this.adapter.setCache('customRowProps', (0, _assign.default)({}, rowProps));
163
+ }
164
+ }
165
+
144
166
  shouldComponentUpdate(nextProps) {
145
167
  /**
146
168
  * Shallow comparison of incoming props to simulate PureComponent
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
2
+ import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
3
3
  export interface HeadTableProps {
4
4
  [x: string]: any;
5
5
  anyColumnFixed?: boolean;
@@ -15,6 +15,7 @@ export interface HeadTableProps {
15
15
  selectedRowKeysSet: Set<any>;
16
16
  showHeader?: boolean;
17
17
  onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
18
+ onHeaderRow?: OnHeaderRow<any>;
18
19
  }
19
20
  declare const _default: React.ForwardRefExoticComponent<Pick<HeadTableProps, keyof HeadTableProps> & React.RefAttributes<HTMLDivElement>>;
20
21
  export default _default;
@@ -116,7 +116,8 @@ HeadTable.propTypes = {
116
116
  }),
117
117
  selectedRowKeysSet: _propTypes.default.instanceOf(_set.default).isRequired,
118
118
  showHeader: _propTypes.default.bool,
119
- onDidUpdate: _propTypes.default.func
119
+ onDidUpdate: _propTypes.default.func,
120
+ onHeaderRow: _propTypes.default.func
120
121
  };
121
122
  HeadTable.defaultProps = {
122
123
  handleBodyScroll: _noop2.default
@@ -294,7 +294,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
294
294
  defaultCurrentPage?: number;
295
295
  onPageChange?: (currentPage: number) => void;
296
296
  onPageSizeChange?: (newPageSize: number) => void;
297
- onChange: (currentPage: number, pageSize: number) => void;
297
+ onChange: ((currentPage: number, pageSize: number) => void) | ((currentPage: number, currentPageSize: number) => void);
298
298
  prevText?: React.ReactNode;
299
299
  nextText?: React.ReactNode;
300
300
  showSizeChanger?: boolean;
@@ -718,6 +718,7 @@ class Table extends _baseComponent.default {
718
718
  components,
719
719
  headerRef,
720
720
  bodyRef,
721
+ onHeaderRow,
721
722
  rowSelection,
722
723
  dataSource,
723
724
  bodyHasScrollBar,
@@ -736,6 +737,7 @@ class Table extends _baseComponent.default {
736
737
  scroll: scroll,
737
738
  showHeader: showHeader,
738
739
  selectedRowKeysSet: selectedRowKeysSet,
740
+ onHeaderRow: onHeaderRow,
739
741
  dataSource: dataSource,
740
742
  bodyHasScrollBar: bodyHasScrollBar
741
743
  }) : null;
@@ -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 | 5 | 6>;
40
+ heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
@@ -741,14 +741,16 @@ class Cascader extends BaseComponent {
741
741
  if (_Array$isArray(realValue)) {
742
742
  normallizedValue = _Array$isArray(realValue[0]) ? realValue : [realValue];
743
743
  } else {
744
- normallizedValue = [[realValue]];
744
+ if (realValue !== undefined) {
745
+ normallizedValue = [[realValue]];
746
+ }
745
747
  } // formatValuePath is used to save value of valuePath
746
748
 
747
749
 
748
750
  const formatValuePath = [];
749
751
 
750
752
  _forEachInstanceProperty(normallizedValue).call(normallizedValue, valueItem => {
751
- const formatItem = onChangeWithObject ? _mapInstanceProperty(valueItem).call(valueItem, i => i.value) : valueItem;
753
+ const formatItem = onChangeWithObject ? _mapInstanceProperty(valueItem).call(valueItem, i => i === null || i === void 0 ? void 0 : i.value) : valueItem;
752
754
  formatValuePath.push(formatItem);
753
755
  }); // formatKeys is used to save key of value
754
756
 
@@ -125,7 +125,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
125
125
  onBlur?: (e: React.FocusEvent<Element, Element>) => void;
126
126
  onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
127
127
  children?: React.ReactNode;
128
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
128
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
129
129
  static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
130
130
  static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
131
131
  static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
@@ -73,7 +73,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
73
73
  onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
74
74
  onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
75
75
  children?: import("react").ReactNode;
76
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
76
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
77
77
  declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
78
78
  declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
79
79
  declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
@@ -15,7 +15,7 @@ export declare function withInfo(props: ModalReactProps): {
15
15
  bodyStyle?: React.CSSProperties;
16
16
  maskStyle?: React.CSSProperties;
17
17
  style?: React.CSSProperties;
18
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
18
+ icon: React.ReactNode | JSX.Element;
19
19
  closeIcon?: React.ReactNode;
20
20
  title?: React.ReactNode;
21
21
  content?: React.ReactNode;
@@ -57,7 +57,7 @@ export declare function withSuccess(props: ModalReactProps): {
57
57
  bodyStyle?: React.CSSProperties;
58
58
  maskStyle?: React.CSSProperties;
59
59
  style?: React.CSSProperties;
60
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
60
+ icon: React.ReactNode | JSX.Element;
61
61
  closeIcon?: React.ReactNode;
62
62
  title?: React.ReactNode;
63
63
  content?: React.ReactNode;
@@ -99,7 +99,7 @@ export declare function withWarning(props: ModalReactProps): {
99
99
  bodyStyle?: React.CSSProperties;
100
100
  maskStyle?: React.CSSProperties;
101
101
  style?: React.CSSProperties;
102
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
102
+ icon: React.ReactNode | JSX.Element;
103
103
  closeIcon?: React.ReactNode;
104
104
  title?: React.ReactNode;
105
105
  content?: React.ReactNode;
@@ -141,7 +141,7 @@ export declare function withError(props: ModalReactProps): {
141
141
  bodyStyle?: React.CSSProperties;
142
142
  maskStyle?: React.CSSProperties;
143
143
  style?: React.CSSProperties;
144
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
144
+ icon: React.ReactNode | JSX.Element;
145
145
  closeIcon?: React.ReactNode;
146
146
  title?: React.ReactNode;
147
147
  content?: React.ReactNode;
@@ -183,7 +183,7 @@ export declare function withConfirm(props: ModalReactProps): {
183
183
  bodyStyle?: React.CSSProperties;
184
184
  maskStyle?: React.CSSProperties;
185
185
  style?: React.CSSProperties;
186
- icon: string | number | boolean | React.ReactFragment | JSX.Element;
186
+ icon: React.ReactNode | JSX.Element;
187
187
  closeIcon?: React.ReactNode;
188
188
  title?: React.ReactNode;
189
189
  content?: React.ReactNode;
@@ -4,7 +4,6 @@ import _noop from "lodash/noop";
4
4
  import _isString from "lodash/isString";
5
5
  import _isEqual from "lodash/isEqual";
6
6
  import _Map from "@babel/runtime-corejs3/core-js-stable/map";
7
- import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
8
7
  import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
9
8
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
10
9
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
@@ -13,6 +12,7 @@ import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array
13
12
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
14
13
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
15
14
  import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
15
+ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
16
16
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
17
17
  import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
18
18
 
@@ -43,13 +43,14 @@ import Trigger from '../trigger';
43
43
  import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
44
44
  import { isSemiIcon } from '../_utils';
45
45
  import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
46
+ import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
46
47
  import '@douyinfe/semi-foundation/lib/es/select/select.css';
47
48
  const prefixcls = cssClasses.PREFIX;
48
49
  const key = 0; // Notes: Use the label of the option as the identifier, that is, the option in Select, the value is allowed to be the same, but the label must be unique
49
50
 
50
51
  class Select extends BaseComponent {
51
52
  constructor(props) {
52
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8;
53
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7;
53
54
 
54
55
  super(props);
55
56
 
@@ -71,19 +72,19 @@ class Select extends BaseComponent {
71
72
  };
72
73
  /* Generate random string */
73
74
 
74
- this.selectOptionListID = _sliceInstanceProperty(_context = Math.random().toString(36)).call(_context, 2);
75
+ this.selectOptionListID = '';
75
76
  this.virtualizeListRef = /*#__PURE__*/React.createRef();
76
77
  this.inputRef = /*#__PURE__*/React.createRef();
77
78
  this.triggerRef = /*#__PURE__*/React.createRef();
78
79
  this.optionsRef = /*#__PURE__*/React.createRef();
79
80
  this.clickOutsideHandler = null;
80
- this.onSelect = _bindInstanceProperty(_context2 = this.onSelect).call(_context2, this);
81
- this.onClear = _bindInstanceProperty(_context3 = this.onClear).call(_context3, this);
82
- this.onMouseEnter = _bindInstanceProperty(_context4 = this.onMouseEnter).call(_context4, this);
83
- this.onMouseLeave = _bindInstanceProperty(_context5 = this.onMouseLeave).call(_context5, this);
84
- this.renderOption = _bindInstanceProperty(_context6 = this.renderOption).call(_context6, this);
85
- this.onKeyPress = _bindInstanceProperty(_context7 = this.onKeyPress).call(_context7, this);
86
- this.onClearBtnEnterPress = _bindInstanceProperty(_context8 = this.onClearBtnEnterPress).call(_context8, this);
81
+ this.onSelect = _bindInstanceProperty(_context = this.onSelect).call(_context, this);
82
+ this.onClear = _bindInstanceProperty(_context2 = this.onClear).call(_context2, this);
83
+ this.onMouseEnter = _bindInstanceProperty(_context3 = this.onMouseEnter).call(_context3, this);
84
+ this.onMouseLeave = _bindInstanceProperty(_context4 = this.onMouseLeave).call(_context4, this);
85
+ this.renderOption = _bindInstanceProperty(_context5 = this.renderOption).call(_context5, this);
86
+ this.onKeyPress = _bindInstanceProperty(_context6 = this.onKeyPress).call(_context6, this);
87
+ this.onClearBtnEnterPress = _bindInstanceProperty(_context7 = this.onClearBtnEnterPress).call(_context7, this);
87
88
  this.foundation = new SelectFoundation(this.adapter);
88
89
  warning('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
89
90
  warning('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
@@ -286,18 +287,18 @@ class Select extends BaseComponent {
286
287
  } catch (error) {}
287
288
  },
288
289
  updateScrollTop: index => {
289
- var _context10, _context11;
290
+ var _context9, _context10;
290
291
 
291
292
  // eslint-disable-next-line max-len
292
293
  let optionClassName = ".".concat(prefixcls, "-option-selected");
293
294
 
294
295
  if (index !== undefined) {
295
- var _context9;
296
+ var _context8;
296
297
 
297
- optionClassName = _concatInstanceProperty(_context9 = ".".concat(prefixcls, "-option:nth-child(")).call(_context9, index, ")");
298
+ optionClassName = _concatInstanceProperty(_context8 = ".".concat(prefixcls, "-option:nth-child(")).call(_context8, index, ")");
298
299
  }
299
300
 
300
- let destNode = document.querySelector(_concatInstanceProperty(_context10 = _concatInstanceProperty(_context11 = "#".concat(prefixcls, "-")).call(_context11, this.selectOptionListID, " ")).call(_context10, optionClassName));
301
+ let destNode = document.querySelector(_concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " ")).call(_context9, optionClassName));
301
302
 
302
303
  if (_Array$isArray(destNode)) {
303
304
  // eslint-disable-next-line prefer-destructuring
@@ -318,6 +319,7 @@ class Select extends BaseComponent {
318
319
 
319
320
  componentDidMount() {
320
321
  this.foundation.init();
322
+ this.selectOptionListID = getUuidShort();
321
323
  }
322
324
 
323
325
  componentWillUnmount() {
@@ -325,11 +327,11 @@ class Select extends BaseComponent {
325
327
  }
326
328
 
327
329
  componentDidUpdate(prevProps, prevState) {
328
- var _context12, _context13;
330
+ var _context11, _context12;
329
331
 
330
- const prevChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(prevProps.children)).call(_context12, child => child.key);
332
+ const prevChildrenKeys = _mapInstanceProperty(_context11 = React.Children.toArray(prevProps.children)).call(_context11, child => child.key);
331
333
 
332
- const nowChildrenKeys = _mapInstanceProperty(_context13 = React.Children.toArray(this.props.children)).call(_context13, child => child.key);
334
+ const nowChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(this.props.children)).call(_context12, child => child.key);
333
335
 
334
336
  let isOptionsChanged = false;
335
337
 
@@ -575,7 +577,7 @@ class Select extends BaseComponent {
575
577
  }
576
578
 
577
579
  renderOptions(children) {
578
- var _context14;
580
+ var _context13;
579
581
 
580
582
  const {
581
583
  dropdownMinWidth,
@@ -613,7 +615,7 @@ class Select extends BaseComponent {
613
615
  });
614
616
  const isEmpty = !options.length || !_someInstanceProperty(options).call(options, item => item._show);
615
617
  return /*#__PURE__*/React.createElement("div", {
616
- id: _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
618
+ id: _concatInstanceProperty(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
617
619
  className: dropdownClassName,
618
620
  style: style
619
621
  }, outerTopSlot, /*#__PURE__*/React.createElement("div", {
@@ -847,7 +849,7 @@ class Select extends BaseComponent {
847
849
  }
848
850
 
849
851
  renderSelection() {
850
- var _context15;
852
+ var _context14;
851
853
 
852
854
  const {
853
855
  disabled,
@@ -931,7 +933,7 @@ class Select extends BaseComponent {
931
933
  role: "combobox",
932
934
  "aria-disabled": disabled,
933
935
  "aria-expanded": isOpen,
934
- "aria-controls": _concatInstanceProperty(_context15 = "".concat(prefixcls, "-")).call(_context15, this.selectOptionListID),
936
+ "aria-controls": _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
935
937
  "aria-haspopup": "listbox",
936
938
  "aria-label": "select value",
937
939
  "aria-invalid": this.props['aria-invalid'],
@@ -113,6 +113,7 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
113
113
  get adapter(): TableRowAdapter<BaseRowProps>;
114
114
  ref: React.MutableRefObject<any>;
115
115
  constructor(props: BaseRowProps);
116
+ componentDidMount(): void;
116
117
  shouldComponentUpdate(nextProps: BaseRowProps): boolean;
117
118
  _cacheNode: (node: any) => void;
118
119
  renderExpandIcon: (record: Record<string, any>) => React.ReactNode;
@@ -103,6 +103,28 @@ export default class TableRow extends BaseComponent {
103
103
  });
104
104
  }
105
105
 
106
+ componentDidMount() {
107
+ // fix #745
108
+ // didmount/willUnmount may be called twice when React.StrictMode is true in React 18, we need to ensure that this.cache.customRowProps is correct
109
+ const {
110
+ onRow,
111
+ index,
112
+ record
113
+ } = this.props;
114
+ const customRowProps = this.adapter.getCache('customRowProps');
115
+
116
+ if (typeof customRowProps === 'undefined') {
117
+ const _a = onRow(record, index) || {},
118
+ {
119
+ className: customClassName,
120
+ style: customStyle
121
+ } = _a,
122
+ rowProps = __rest(_a, ["className", "style"]);
123
+
124
+ this.adapter.setCache('customRowProps', _Object$assign({}, rowProps));
125
+ }
126
+ }
127
+
106
128
  shouldComponentUpdate(nextProps) {
107
129
  /**
108
130
  * Shallow comparison of incoming props to simulate PureComponent
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps } from './interface';
2
+ import { Fixed, TableComponents, Scroll, BodyScrollEvent, ColumnProps, OnHeaderRow } from './interface';
3
3
  export interface HeadTableProps {
4
4
  [x: string]: any;
5
5
  anyColumnFixed?: boolean;
@@ -15,6 +15,7 @@ export interface HeadTableProps {
15
15
  selectedRowKeysSet: Set<any>;
16
16
  showHeader?: boolean;
17
17
  onDidUpdate?: (ref: React.MutableRefObject<any>) => void;
18
+ onHeaderRow?: OnHeaderRow<any>;
18
19
  }
19
20
  declare const _default: React.ForwardRefExoticComponent<Pick<HeadTableProps, keyof HeadTableProps> & React.RefAttributes<HTMLDivElement>>;
20
21
  export default _default;