@douyinfe/semi-ui 2.10.1 → 2.10.2

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.
@@ -171,6 +171,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
171
171
  const { isCardType, isPureCardType } = this.context.checkboxGroup;
172
172
  props.isCardType = isCardType;
173
173
  props.isPureCardType = isPureCardType;
174
+ props['name'] = this.context.checkboxGroup.name;
174
175
  }
175
176
 
176
177
  const prefix = prefixCls || css.PREFIX;
@@ -192,8 +193,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
192
193
  [`${prefix}-cardType_extra_noChildren`]: props.isCardType && !children,
193
194
  });
194
195
 
195
- const name = inGroup && this.context.checkboxGroup.name;
196
-
197
196
  const renderContent = () => (
198
197
  <>
199
198
  {children ? <span id={this.addonId} className={`${prefix}-addon`}>{children}</span> : null}
@@ -220,7 +219,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
220
219
  {...props}
221
220
  addonId={children && this.addonId}
222
221
  extraId={extra && this.extraId}
223
- name={name}
224
222
  isPureCardType={props.isPureCardType}
225
223
  ref={ref => {
226
224
  this.checkboxEntity = ref;
@@ -81,26 +81,31 @@ class CheckboxInner extends PureComponent<CheckboxInnerProps> {
81
81
  <IconCheckboxIndeterminate />
82
82
  ) : null;
83
83
 
84
+ const inputProps: React.InputHTMLAttributes<HTMLInputElement> = {
85
+ type: "checkbox",
86
+ 'aria-label': this.props['aria-label'],
87
+ 'aria-disabled': disabled,
88
+ 'aria-checked': checked,
89
+ 'aria-labelledby': addonId,
90
+ 'aria-describedby':extraId || this.props['aria-describedby'],
91
+ 'aria-invalid': this.props['aria-invalid'],
92
+ 'aria-errormessage': this.props['aria-errormessage'],
93
+ 'aria-required': this.props['aria-required'],
94
+ className: css.INPUT,
95
+ onChange: noop,
96
+ checked: checked,
97
+ disabled: disabled,
98
+ };
99
+
100
+ name && (inputProps['name'] = name);
101
+
84
102
  return (
85
103
  <span className={wrapper}>
86
104
  <input
87
- type="checkbox"
88
- aria-label={this.props['aria-label']}
89
- aria-disabled={disabled}
90
- aria-checked={checked}
91
- aria-labelledby={addonId}
92
- aria-describedby={extraId || this.props['aria-describedby']}
93
- aria-invalid={this.props['aria-invalid']}
94
- aria-errormessage={this.props['aria-errormessage']}
95
- aria-required={this.props['aria-required']}
105
+ {...inputProps}
96
106
  ref={ref => {
97
107
  this.inputEntity = ref;
98
108
  }}
99
- className={css.INPUT}
100
- onChange={noop}
101
- checked={checked}
102
- disabled={disabled}
103
- name={name}
104
109
  />
105
110
  <span className={inner}>{icon}</span>
106
111
  </span>
@@ -28557,6 +28557,12 @@ class src_Animation_Animation extends external_root_React_commonjs2_react_common
28557
28557
  forwardInstance
28558
28558
  } = this.props;
28559
28559
 
28560
+ if (this.animation === null) {
28561
+ // didmount/willUnmount may be called twice when React.StrictMode is true in React 18, we need to ensure that this.animation is correct
28562
+ this.initAnimation();
28563
+ this.bindEvents();
28564
+ }
28565
+
28560
28566
  if (typeof forwardInstance === 'function') {
28561
28567
  forwardInstance(this.animation);
28562
28568
  }
@@ -48332,6 +48338,7 @@ const Context = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_
48332
48338
  // CONCATENATED MODULE: ./checkbox/checkboxInner.tsx
48333
48339
 
48334
48340
 
48341
+
48335
48342
  /* eslint-disable no-nested-ternary */
48336
48343
 
48337
48344
 
@@ -48370,27 +48377,29 @@ class checkboxInner_CheckboxInner extends external_root_React_commonjs2_react_co
48370
48377
  ["".concat(prefix, "-inner-display")]: true
48371
48378
  });
48372
48379
  const icon = checked ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconCheckboxTick, null) : indeterminate ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconCheckboxIndeterminate, null) : null;
48373
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
48374
- className: wrapper
48375
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("input", {
48380
+ const inputProps = {
48376
48381
  type: "checkbox",
48377
- "aria-label": this.props['aria-label'],
48378
- "aria-disabled": disabled,
48379
- "aria-checked": checked,
48380
- "aria-labelledby": addonId,
48381
- "aria-describedby": extraId || this.props['aria-describedby'],
48382
- "aria-invalid": this.props['aria-invalid'],
48383
- "aria-errormessage": this.props['aria-errormessage'],
48384
- "aria-required": this.props['aria-required'],
48385
- ref: ref => {
48386
- this.inputEntity = ref;
48387
- },
48382
+ 'aria-label': this.props['aria-label'],
48383
+ 'aria-disabled': disabled,
48384
+ 'aria-checked': checked,
48385
+ 'aria-labelledby': addonId,
48386
+ 'aria-describedby': extraId || this.props['aria-describedby'],
48387
+ 'aria-invalid': this.props['aria-invalid'],
48388
+ 'aria-errormessage': this.props['aria-errormessage'],
48389
+ 'aria-required': this.props['aria-required'],
48388
48390
  className: checkboxClasses.INPUT,
48389
48391
  onChange: noop_default.a,
48390
48392
  checked: checked,
48391
- disabled: disabled,
48392
- name: name
48393
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
48393
+ disabled: disabled
48394
+ };
48395
+ name && (inputProps['name'] = name);
48396
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
48397
+ className: wrapper
48398
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("input", assign_default()({}, inputProps, {
48399
+ ref: ref => {
48400
+ this.inputEntity = ref;
48401
+ }
48402
+ })), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
48394
48403
  className: inner
48395
48404
  }, icon));
48396
48405
  }
@@ -48550,6 +48559,7 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
48550
48559
  } = this.context.checkboxGroup;
48551
48560
  props.isCardType = isCardType;
48552
48561
  props.isPureCardType = isPureCardType;
48562
+ props['name'] = this.context.checkboxGroup.name;
48553
48563
  }
48554
48564
 
48555
48565
  const prefix = prefixCls || checkboxClasses.PREFIX;
@@ -48568,7 +48578,6 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
48568
48578
  const extraCls = classnames_default()("".concat(prefix, "-extra"), {
48569
48579
  ["".concat(prefix, "-cardType_extra_noChildren")]: props.isCardType && !children
48570
48580
  });
48571
- const name = inGroup && this.context.checkboxGroup.name;
48572
48581
 
48573
48582
  const renderContent = () => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, children ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
48574
48583
  id: this.addonId,
@@ -48596,7 +48605,6 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
48596
48605
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(checkboxInner, assign_default()({}, this.props, props, {
48597
48606
  addonId: children && this.addonId,
48598
48607
  extraId: extra && this.extraId,
48599
- name: name,
48600
48608
  isPureCardType: props.isPureCardType,
48601
48609
  ref: ref => {
48602
48610
  this.checkboxEntity = ref;
@@ -77433,6 +77441,7 @@ var select_select = __webpack_require__("1d3+");
77433
77441
 
77434
77442
 
77435
77443
 
77444
+
77436
77445
 
77437
77446
 
77438
77447
  const select_prefixcls = select_constants_cssClasses.PREFIX;
@@ -77440,7 +77449,7 @@ const select_key = 0; // Notes: Use the label of the option as the identifier, t
77440
77449
 
77441
77450
  class select_Select extends baseComponent_BaseComponent {
77442
77451
  constructor(props) {
77443
- var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8;
77452
+ var _context, _context2, _context3, _context4, _context5, _context6, _context7;
77444
77453
 
77445
77454
  super(props);
77446
77455
 
@@ -77462,19 +77471,19 @@ class select_Select extends baseComponent_BaseComponent {
77462
77471
  };
77463
77472
  /* Generate random string */
77464
77473
 
77465
- this.selectOptionListID = slice_default()(_context = Math.random().toString(36)).call(_context, 2);
77474
+ this.selectOptionListID = '';
77466
77475
  this.virtualizeListRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
77467
77476
  this.inputRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
77468
77477
  this.triggerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
77469
77478
  this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
77470
77479
  this.clickOutsideHandler = null;
77471
- this.onSelect = bind_default()(_context2 = this.onSelect).call(_context2, this);
77472
- this.onClear = bind_default()(_context3 = this.onClear).call(_context3, this);
77473
- this.onMouseEnter = bind_default()(_context4 = this.onMouseEnter).call(_context4, this);
77474
- this.onMouseLeave = bind_default()(_context5 = this.onMouseLeave).call(_context5, this);
77475
- this.renderOption = bind_default()(_context6 = this.renderOption).call(_context6, this);
77476
- this.onKeyPress = bind_default()(_context7 = this.onKeyPress).call(_context7, this);
77477
- this.onClearBtnEnterPress = bind_default()(_context8 = this.onClearBtnEnterPress).call(_context8, this);
77480
+ this.onSelect = bind_default()(_context = this.onSelect).call(_context, this);
77481
+ this.onClear = bind_default()(_context2 = this.onClear).call(_context2, this);
77482
+ this.onMouseEnter = bind_default()(_context3 = this.onMouseEnter).call(_context3, this);
77483
+ this.onMouseLeave = bind_default()(_context4 = this.onMouseLeave).call(_context4, this);
77484
+ this.renderOption = bind_default()(_context5 = this.renderOption).call(_context5, this);
77485
+ this.onKeyPress = bind_default()(_context6 = this.onKeyPress).call(_context6, this);
77486
+ this.onClearBtnEnterPress = bind_default()(_context7 = this.onClearBtnEnterPress).call(_context7, this);
77478
77487
  this.foundation = new foundation_SelectFoundation(this.adapter);
77479
77488
  Object(warning["a" /* default */])('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
77480
77489
  Object(warning["a" /* default */])('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
@@ -77677,18 +77686,18 @@ class select_Select extends baseComponent_BaseComponent {
77677
77686
  } catch (error) {}
77678
77687
  },
77679
77688
  updateScrollTop: index => {
77680
- var _context10, _context11;
77689
+ var _context9, _context10;
77681
77690
 
77682
77691
  // eslint-disable-next-line max-len
77683
77692
  let optionClassName = ".".concat(select_prefixcls, "-option-selected");
77684
77693
 
77685
77694
  if (index !== undefined) {
77686
- var _context9;
77695
+ var _context8;
77687
77696
 
77688
- optionClassName = concat_default()(_context9 = ".".concat(select_prefixcls, "-option:nth-child(")).call(_context9, index, ")");
77697
+ optionClassName = concat_default()(_context8 = ".".concat(select_prefixcls, "-option:nth-child(")).call(_context8, index, ")");
77689
77698
  }
77690
77699
 
77691
- let destNode = document.querySelector(concat_default()(_context10 = concat_default()(_context11 = "#".concat(select_prefixcls, "-")).call(_context11, this.selectOptionListID, " ")).call(_context10, optionClassName));
77700
+ let destNode = document.querySelector(concat_default()(_context9 = concat_default()(_context10 = "#".concat(select_prefixcls, "-")).call(_context10, this.selectOptionListID, " ")).call(_context9, optionClassName));
77692
77701
 
77693
77702
  if (is_array_default()(destNode)) {
77694
77703
  // eslint-disable-next-line prefer-destructuring
@@ -77709,6 +77718,7 @@ class select_Select extends baseComponent_BaseComponent {
77709
77718
 
77710
77719
  componentDidMount() {
77711
77720
  this.foundation.init();
77721
+ this.selectOptionListID = getUuidShort();
77712
77722
  }
77713
77723
 
77714
77724
  componentWillUnmount() {
@@ -77716,11 +77726,11 @@ class select_Select extends baseComponent_BaseComponent {
77716
77726
  }
77717
77727
 
77718
77728
  componentDidUpdate(prevProps, prevState) {
77719
- var _context12, _context13;
77729
+ var _context11, _context12;
77720
77730
 
77721
- const prevChildrenKeys = map_default()(_context12 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(prevProps.children)).call(_context12, child => child.key);
77731
+ const prevChildrenKeys = map_default()(_context11 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(prevProps.children)).call(_context11, child => child.key);
77722
77732
 
77723
- const nowChildrenKeys = map_default()(_context13 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(this.props.children)).call(_context13, child => child.key);
77733
+ const nowChildrenKeys = map_default()(_context12 = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(this.props.children)).call(_context12, child => child.key);
77724
77734
 
77725
77735
  let isOptionsChanged = false;
77726
77736
 
@@ -77966,7 +77976,7 @@ class select_Select extends baseComponent_BaseComponent {
77966
77976
  }
77967
77977
 
77968
77978
  renderOptions(children) {
77969
- var _context14;
77979
+ var _context13;
77970
77980
 
77971
77981
  const {
77972
77982
  dropdownMinWidth,
@@ -78004,7 +78014,7 @@ class select_Select extends baseComponent_BaseComponent {
78004
78014
  });
78005
78015
  const isEmpty = !options.length || !some_default()(options).call(options, item => item._show);
78006
78016
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
78007
- id: concat_default()(_context14 = "".concat(select_prefixcls, "-")).call(_context14, this.selectOptionListID),
78017
+ id: concat_default()(_context13 = "".concat(select_prefixcls, "-")).call(_context13, this.selectOptionListID),
78008
78018
  className: dropdownClassName,
78009
78019
  style: style
78010
78020
  }, outerTopSlot, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
@@ -78238,7 +78248,7 @@ class select_Select extends baseComponent_BaseComponent {
78238
78248
  }
78239
78249
 
78240
78250
  renderSelection() {
78241
- var _context15;
78251
+ var _context14;
78242
78252
 
78243
78253
  const {
78244
78254
  disabled,
@@ -78322,7 +78332,7 @@ class select_Select extends baseComponent_BaseComponent {
78322
78332
  role: "combobox",
78323
78333
  "aria-disabled": disabled,
78324
78334
  "aria-expanded": isOpen,
78325
- "aria-controls": concat_default()(_context15 = "".concat(select_prefixcls, "-")).call(_context15, this.selectOptionListID),
78335
+ "aria-controls": concat_default()(_context14 = "".concat(select_prefixcls, "-")).call(_context14, this.selectOptionListID),
78326
78336
  "aria-haspopup": "listbox",
78327
78337
  "aria-label": "select value",
78328
78338
  "aria-invalid": this.props['aria-invalid'],
@@ -87401,7 +87411,8 @@ HeadTable_HeadTable.propTypes = {
87401
87411
  }),
87402
87412
  selectedRowKeysSet: prop_types_default.a.instanceOf(set_default.a).isRequired,
87403
87413
  showHeader: prop_types_default.a.bool,
87404
- onDidUpdate: prop_types_default.a.func
87414
+ onDidUpdate: prop_types_default.a.func,
87415
+ onHeaderRow: prop_types_default.a.func
87405
87416
  };
87406
87417
  HeadTable_HeadTable.defaultProps = {
87407
87418
  handleBodyScroll: noop_default.a
@@ -88226,6 +88237,28 @@ class BaseRow_TableRow extends baseComponent_BaseComponent {
88226
88237
  });
88227
88238
  }
88228
88239
 
88240
+ componentDidMount() {
88241
+ // fix #745
88242
+ // didmount/willUnmount may be called twice when React.StrictMode is true in React 18, we need to ensure that this.cache.customRowProps is correct
88243
+ const {
88244
+ onRow,
88245
+ index,
88246
+ record
88247
+ } = this.props;
88248
+ const customRowProps = this.adapter.getCache('customRowProps');
88249
+
88250
+ if (typeof customRowProps === 'undefined') {
88251
+ const _a = onRow(record, index) || {},
88252
+ {
88253
+ className: customClassName,
88254
+ style: customStyle
88255
+ } = _a,
88256
+ rowProps = BaseRow_rest(_a, ["className", "style"]);
88257
+
88258
+ this.adapter.setCache('customRowProps', assign_default()({}, rowProps));
88259
+ }
88260
+ }
88261
+
88229
88262
  shouldComponentUpdate(nextProps) {
88230
88263
  /**
88231
88264
  * Shallow comparison of incoming props to simulate PureComponent
@@ -90379,6 +90412,7 @@ class Table_Table extends baseComponent_BaseComponent {
90379
90412
  components,
90380
90413
  headerRef,
90381
90414
  bodyRef,
90415
+ onHeaderRow,
90382
90416
  rowSelection,
90383
90417
  dataSource,
90384
90418
  bodyHasScrollBar,
@@ -90399,6 +90433,7 @@ class Table_Table extends baseComponent_BaseComponent {
90399
90433
  scroll: scroll,
90400
90434
  showHeader: showHeader,
90401
90435
  selectedRowKeysSet: selectedRowKeysSet,
90436
+ onHeaderRow: onHeaderRow,
90402
90437
  dataSource: dataSource,
90403
90438
  bodyHasScrollBar: bodyHasScrollBar
90404
90439
  }) : null;
@@ -100957,6 +100992,7 @@ class foundation_UploadFoundation extends foundation {
100957
100992
  if (!disabled) {
100958
100993
  if (directory) {
100959
100994
  this.handleDirectoryDrop(e);
100995
+ return;
100960
100996
  }
100961
100997
 
100962
100998
  const files = from_default()(e.dataTransfer.files);
@@ -107293,7 +107329,6 @@ class baseForm_Form extends baseComponent_BaseComponent {
107293
107329
 
107294
107330
  componentWillUnmount() {
107295
107331
  this.foundation.destroy();
107296
- this.foundation = null;
107297
107332
  this.formApi = null;
107298
107333
  }
107299
107334