@douyinfe/semi-ui 2.51.1 → 2.51.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.
@@ -53970,26 +53970,15 @@ class DatePickerFoundation extends foundation {
53970
53970
  * 受控时如果输入不完整,由于没有触发 notifyChange
53971
53971
  * 需要组件内更新一下输入框的值,否则会出现选了一个日期但是输入框没有回显日期的问题 #1357
53972
53972
  */
53973
- if (!this._adapter.needConfirm() || fromPreset) {
53974
- if (isRangeTypeAndInputIncomplete) {
53975
- // do not change value when selected value is incomplete
53976
- this._adapter.updateInputValue(inputValue);
53977
- this._adapter.updateInsetInputValue(insetInputValue);
53978
- return;
53979
- } else {
53980
- if (!controlled || fromPreset) {
53981
- this._updateValueAndInput(dates, true, inputValue);
53982
- this._adapter.updateInsetInputValue(insetInputValue);
53983
- }
53984
- }
53985
- }
53986
- if (!controlled && this._adapter.needConfirm()) {
53987
- // select date only change inputValue when needConfirm is true
53973
+ if (isRangeTypeAndInputIncomplete) {
53974
+ // do not change value when selected value is incomplete
53988
53975
  this._adapter.updateInputValue(inputValue);
53989
53976
  this._adapter.updateInsetInputValue(insetInputValue);
53990
- // if inputValue is not complete, don't notifyChange
53991
- if (isRangeTypeAndInputIncomplete) {
53992
- return;
53977
+ return;
53978
+ } else {
53979
+ if (!controlled || fromPreset) {
53980
+ this._updateValueAndInput(dates, true, inputValue);
53981
+ this._adapter.updateInsetInputValue(insetInputValue);
53993
53982
  }
53994
53983
  }
53995
53984
  if (!isEqual_default()(value, stateValue)) {
@@ -64227,7 +64216,7 @@ class TextAreaFoundation extends foundation {
64227
64216
  }
64228
64217
  constructor(adapter) {
64229
64218
  super(Object.assign(Object.assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
64230
- this.resizeTextarea = cb => {
64219
+ this.resizeTextarea = () => {
64231
64220
  var _a;
64232
64221
  const {
64233
64222
  height
@@ -64239,7 +64228,6 @@ class TextAreaFoundation extends foundation {
64239
64228
  const node = this._adapter.getRef();
64240
64229
  const nodeSizingData = util_getSizingData(node);
64241
64230
  if (!nodeSizingData) {
64242
- cb && cb();
64243
64231
  return;
64244
64232
  }
64245
64233
  const [minRows, maxRows] = autosize !== null && typeof autosize === 'object' ? [(_a = autosize === null || autosize === void 0 ? void 0 : autosize.minRows) !== null && _a !== void 0 ? _a : rows, autosize === null || autosize === void 0 ? void 0 : autosize.maxRows] : [rows];
@@ -64249,7 +64237,6 @@ class TextAreaFoundation extends foundation {
64249
64237
  node.style.height = `${newHeight}px`;
64250
64238
  return;
64251
64239
  }
64252
- cb && cb();
64253
64240
  };
64254
64241
  }
64255
64242
  init() {
@@ -64458,6 +64445,7 @@ var input_textarea = __webpack_require__("d+AG");
64458
64445
 
64459
64446
 
64460
64447
 
64448
+
64461
64449
  var textarea_rest = undefined && undefined.__rest || function (s, e) {
64462
64450
  var t = {};
64463
64451
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -64474,6 +64462,7 @@ var textarea_rest = undefined && undefined.__rest || function (s, e) {
64474
64462
 
64475
64463
 
64476
64464
 
64465
+
64477
64466
  const textarea_prefixCls = input_constants_cssClasses.PREFIX;
64478
64467
  class TextArea extends BaseComponent {
64479
64468
  constructor(props) {
@@ -64502,7 +64491,7 @@ class TextArea extends BaseComponent {
64502
64491
  this.focusing = false;
64503
64492
  this.foundation = new TextAreaFoundation(this.adapter);
64504
64493
  this.libRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
64505
- this._resizeLock = false;
64494
+ this.throttledResizeTextarea = throttle_default()(this.foundation.resizeTextarea, 10);
64506
64495
  }
64507
64496
  get adapter() {
64508
64497
  return Object.assign(Object.assign({}, super.adapter), {
@@ -64553,29 +64542,12 @@ class TextArea extends BaseComponent {
64553
64542
  }
64554
64543
  return willUpdateStates;
64555
64544
  }
64556
- componentDidMount() {
64557
- this.foundation.init();
64558
- this._resizeListener = null;
64559
- if (this.props.autosize) {
64560
- // Working around Firefox bug which runs resize listeners even when other JS is running at the same moment
64561
- // causing competing rerenders (due to setState in the listener) in React.
64562
- // More can be found here - facebook/react#6324
64563
- // // Reference to https://github.com/andreypopp/react-textarea-autosize/
64564
- this._resizeListener = () => {
64565
- if (this._resizeLock) {
64566
- return;
64567
- }
64568
- this._resizeLock = true;
64569
- this.foundation.resizeTextarea(() => {
64570
- this._resizeLock = false;
64571
- });
64572
- };
64573
- window.addEventListener('resize', this._resizeListener);
64574
- }
64575
- }
64576
64545
  componentWillUnmount() {
64577
- this.foundation.destroy();
64578
- this._resizeListener && window.removeEventListener('resize', this._resizeListener);
64546
+ var _a, _b;
64547
+ if (this.throttledResizeTextarea) {
64548
+ (_b = (_a = this.throttledResizeTextarea) === null || _a === void 0 ? void 0 : _a.cancel) === null || _b === void 0 ? void 0 : _b.call(_a);
64549
+ this.throttledResizeTextarea = null;
64550
+ }
64579
64551
  }
64580
64552
  componentDidUpdate(prevProps, prevState) {
64581
64553
  if ((this.props.value !== prevProps.value || this.props.placeholder !== prevProps.placeholder) && this.props.autosize) {
@@ -64695,8 +64667,12 @@ class TextArea extends BaseComponent {
64695
64667
  style: style,
64696
64668
  onMouseEnter: e => this.foundation.handleMouseEnter(e),
64697
64669
  onMouseLeave: e => this.foundation.handleMouseLeave(e)
64670
+ }, autosize ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ReactResizeObserver, {
64671
+ onResize: this.throttledResizeTextarea
64698
64672
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("textarea", Object.assign({}, itemProps, {
64699
64673
  ref: this.setRef
64674
+ }))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("textarea", Object.assign({}, itemProps, {
64675
+ ref: this.setRef
64700
64676
  })), this.renderClearBtn(), this.renderCounter());
64701
64677
  }
64702
64678
  }
@@ -81372,6 +81348,50 @@ var BaseRow_rest = undefined && undefined.__rest || function (s, e) {
81372
81348
 
81373
81349
 
81374
81350
 
81351
+ /**
81352
+ * avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
81353
+ */
81354
+ const baseRowPropTypes = {
81355
+ anyColumnFixed: (prop_types_default()).bool,
81356
+ cellWidths: (prop_types_default()).array.isRequired,
81357
+ className: (prop_types_default()).string,
81358
+ columns: (prop_types_default()).array.isRequired,
81359
+ components: (prop_types_default()).object.isRequired,
81360
+ disabled: (prop_types_default()).bool,
81361
+ expandIcon: prop_types_default().oneOfType([(prop_types_default()).bool, (prop_types_default()).func, (prop_types_default()).node]),
81362
+ expandableRow: (prop_types_default()).bool,
81363
+ expanded: (prop_types_default()).bool,
81364
+ displayNone: (prop_types_default()).bool,
81365
+ expandedRow: (prop_types_default()).bool,
81366
+ fixed: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).bool]),
81367
+ height: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]),
81368
+ hideExpandedColumn: (prop_types_default()).bool,
81369
+ hovered: (prop_types_default()).bool.isRequired,
81370
+ indent: (prop_types_default()).number,
81371
+ indentSize: (prop_types_default()).number,
81372
+ index: (prop_types_default()).number,
81373
+ isSection: (prop_types_default()).bool,
81374
+ level: (prop_types_default()).number,
81375
+ onDidUpdate: (prop_types_default()).func,
81376
+ onHover: (prop_types_default()).func,
81377
+ onRow: (prop_types_default()).func,
81378
+ onRowClick: (prop_types_default()).func,
81379
+ onRowContextMenu: (prop_types_default()).func,
81380
+ onRowDoubleClick: (prop_types_default()).func,
81381
+ onRowMouseEnter: (prop_types_default()).func,
81382
+ onRowMouseLeave: (prop_types_default()).func,
81383
+ prefixCls: (prop_types_default()).string,
81384
+ record: (prop_types_default()).object,
81385
+ renderExpandIcon: (prop_types_default()).func,
81386
+ replaceClassName: (prop_types_default()).string,
81387
+ rowExpandable: (prop_types_default()).func,
81388
+ rowKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]).isRequired,
81389
+ selected: (prop_types_default()).bool,
81390
+ store: (prop_types_default()).object,
81391
+ style: (prop_types_default()).object,
81392
+ virtualized: prop_types_default().oneOfType([(prop_types_default()).object, (prop_types_default()).bool]),
81393
+ visible: (prop_types_default()).bool.isRequired
81394
+ };
81375
81395
  class TableRow extends BaseComponent {
81376
81396
  get adapter() {
81377
81397
  var _this = this;
@@ -81612,47 +81632,7 @@ class TableRow extends BaseComponent {
81612
81632
  }), this.renderCells());
81613
81633
  }
81614
81634
  }
81615
- TableRow.propTypes = {
81616
- anyColumnFixed: (prop_types_default()).bool,
81617
- cellWidths: (prop_types_default()).array.isRequired,
81618
- className: (prop_types_default()).string,
81619
- columns: (prop_types_default()).array.isRequired,
81620
- components: (prop_types_default()).object.isRequired,
81621
- disabled: (prop_types_default()).bool,
81622
- expandIcon: prop_types_default().oneOfType([(prop_types_default()).bool, (prop_types_default()).func, (prop_types_default()).node]),
81623
- expandableRow: (prop_types_default()).bool,
81624
- expanded: (prop_types_default()).bool,
81625
- displayNone: (prop_types_default()).bool,
81626
- expandedRow: (prop_types_default()).bool,
81627
- fixed: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).bool]),
81628
- height: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]),
81629
- hideExpandedColumn: (prop_types_default()).bool,
81630
- hovered: (prop_types_default()).bool.isRequired,
81631
- indent: (prop_types_default()).number,
81632
- indentSize: (prop_types_default()).number,
81633
- index: (prop_types_default()).number,
81634
- isSection: (prop_types_default()).bool,
81635
- level: (prop_types_default()).number,
81636
- onDidUpdate: (prop_types_default()).func,
81637
- onHover: (prop_types_default()).func,
81638
- onRow: (prop_types_default()).func,
81639
- onRowClick: (prop_types_default()).func,
81640
- onRowContextMenu: (prop_types_default()).func,
81641
- onRowDoubleClick: (prop_types_default()).func,
81642
- onRowMouseEnter: (prop_types_default()).func,
81643
- onRowMouseLeave: (prop_types_default()).func,
81644
- prefixCls: (prop_types_default()).string,
81645
- record: (prop_types_default()).object,
81646
- renderExpandIcon: (prop_types_default()).func,
81647
- replaceClassName: (prop_types_default()).string,
81648
- rowExpandable: (prop_types_default()).func,
81649
- rowKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]).isRequired,
81650
- selected: (prop_types_default()).bool,
81651
- store: (prop_types_default()).object,
81652
- style: (prop_types_default()).object,
81653
- virtualized: prop_types_default().oneOfType([(prop_types_default()).object, (prop_types_default()).bool]),
81654
- visible: (prop_types_default()).bool.isRequired
81655
- };
81635
+ TableRow.propTypes = baseRowPropTypes;
81656
81636
  TableRow.defaultProps = {
81657
81637
  columns: [],
81658
81638
  rowExpandable: (stubTrue_default()),
@@ -81825,6 +81805,30 @@ var SectionRow_rest = undefined && undefined.__rest || function (s, e) {
81825
81805
 
81826
81806
 
81827
81807
 
81808
+ /**
81809
+ * avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
81810
+ */
81811
+ const sectionRowPropTypes = {
81812
+ record: (prop_types_default()).object,
81813
+ index: (prop_types_default()).number,
81814
+ columns: (prop_types_default()).array,
81815
+ group: (prop_types_default()).object.isRequired,
81816
+ groupKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]).isRequired,
81817
+ data: (prop_types_default()).array,
81818
+ renderGroupSection: (prop_types_default()).func,
81819
+ onGroupedRow: (prop_types_default()).func,
81820
+ clickGroupedRowToExpand: (prop_types_default()).bool,
81821
+ components: (prop_types_default()).object,
81822
+ expanded: (prop_types_default()).bool,
81823
+ prefixCls: (prop_types_default()).string,
81824
+ onExpand: (prop_types_default()).func,
81825
+ virtualized: prop_types_default().oneOfType([(prop_types_default()).bool, (prop_types_default()).object]),
81826
+ style: (prop_types_default()).object,
81827
+ renderExpandIcon: (prop_types_default()).func,
81828
+ className: (prop_types_default()).string,
81829
+ store: (prop_types_default()).object,
81830
+ rowKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number, (prop_types_default()).func])
81831
+ };
81828
81832
  /**
81829
81833
  * Grouping component title row
81830
81834
  */
@@ -81955,27 +81959,7 @@ class SectionRow extends external_root_React_commonjs2_react_commonjs_react_amd_
81955
81959
  }
81956
81960
  }
81957
81961
  SectionRow.contextType = table_context;
81958
- SectionRow.propTypes = {
81959
- record: (prop_types_default()).object,
81960
- index: (prop_types_default()).number,
81961
- columns: (prop_types_default()).array,
81962
- group: (prop_types_default()).object.isRequired,
81963
- groupKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]).isRequired,
81964
- data: (prop_types_default()).array,
81965
- renderGroupSection: (prop_types_default()).func,
81966
- onGroupedRow: (prop_types_default()).func,
81967
- clickGroupedRowToExpand: (prop_types_default()).bool,
81968
- components: (prop_types_default()).object,
81969
- expanded: (prop_types_default()).bool,
81970
- prefixCls: (prop_types_default()).string,
81971
- onExpand: (prop_types_default()).func,
81972
- virtualized: prop_types_default().oneOfType([(prop_types_default()).bool, (prop_types_default()).object]),
81973
- style: (prop_types_default()).object,
81974
- renderExpandIcon: (prop_types_default()).func,
81975
- className: (prop_types_default()).string,
81976
- store: (prop_types_default()).object,
81977
- rowKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number, (prop_types_default()).func])
81978
- };
81962
+ SectionRow.propTypes = sectionRowPropTypes;
81979
81963
  SectionRow.defaultProps = {
81980
81964
  prefixCls: table_constants_cssClasses.PREFIX,
81981
81965
  components: {
@@ -82260,7 +82244,7 @@ class Body extends BaseComponent {
82260
82244
  groupKey,
82261
82245
  index
82262
82246
  } = props;
82263
- const sectionRowPickKeys = Object.keys(Body_SectionRow.propTypes);
82247
+ const sectionRowPickKeys = Object.keys(sectionRowPropTypes);
82264
82248
  const sectionRowProps = pick_default()(props, sectionRowPickKeys);
82265
82249
  const {
82266
82250
  handleRowExpanded
@@ -82584,7 +82568,7 @@ class Body extends BaseComponent {
82584
82568
  disabledRowKeysSet,
82585
82569
  expandRowByClick
82586
82570
  } = props;
82587
- const baseRowPickKeys = Object.keys(TableRow.propTypes);
82571
+ const baseRowPickKeys = Object.keys(baseRowPropTypes);
82588
82572
  const baseRowProps = pick_default()(props, baseRowPickKeys);
82589
82573
  let key = getRecordKey(record, rowKey);
82590
82574
  if (key == null) {
@@ -100325,7 +100309,7 @@ class PreviewInnerFoundation extends foundation {
100325
100309
  couldClose = false;
100326
100310
  }
100327
100311
  if (couldClose && maskClosable) {
100328
- this.handlePreviewClose();
100312
+ this._adapter.notifyVisibleChange(false);
100329
100313
  }
100330
100314
  };
100331
100315
  this.handleMouseDown = e => {
@@ -100384,9 +100368,10 @@ class PreviewInnerFoundation extends foundation {
100384
100368
  downloadImage(downloadSrc, downloadName);
100385
100369
  this._adapter.notifyDownload(downloadSrc, currentIndex);
100386
100370
  };
100387
- this.handlePreviewClose = () => {
100371
+ this.handlePreviewClose = e => {
100388
100372
  this._adapter.notifyVisibleChange(false);
100389
100373
  this._adapter.notifyClose();
100374
+ handlePrevent(e);
100390
100375
  };
100391
100376
  this.handleAdjustRatio = type => {
100392
100377
  this.setState({
@@ -100672,8 +100657,8 @@ class PreviewInner extends BaseComponent {
100672
100657
  this.handleDownload = () => {
100673
100658
  this.foundation.handleDownload();
100674
100659
  };
100675
- this.handlePreviewClose = () => {
100676
- this.foundation.handlePreviewClose();
100660
+ this.handlePreviewClose = e => {
100661
+ this.foundation.handlePreviewClose(e);
100677
100662
  };
100678
100663
  this.handleAdjustRatio = type => {
100679
100664
  this.foundation.handleAdjustRatio(type);