@douyinfe/semi-ui 2.30.0-beta.0 → 2.30.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.
@@ -18689,6 +18689,9 @@ class foundation_Tooltip extends foundation {
18689
18689
  spacing,
18690
18690
  isOverFlow
18691
18691
  } = props;
18692
+ const {
18693
+ innerWidth
18694
+ } = window;
18692
18695
  const triggerRect = (isEmpty_default()(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
18693
18696
  const containerRect = (isEmpty_default()(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
18694
18697
  const wrapperRect = (isEmpty_default()(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect); // eslint-disable-next-line
@@ -18731,6 +18734,7 @@ class foundation_Tooltip extends foundation {
18731
18734
  const isWidthOverFlow = isOverFlow && isOverFlow[1];
18732
18735
  const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
18733
18736
  const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
18737
+ const isWrapperWidthOverflow = wrapperRect.width > innerWidth;
18734
18738
 
18735
18739
  switch (position) {
18736
18740
  case 'top':
@@ -18745,7 +18749,7 @@ class foundation_Tooltip extends foundation {
18745
18749
  case 'topLeft':
18746
18750
  // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
18747
18751
  // top = triggerRect.top - SPACING;
18748
- left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
18752
+ left = isWidthOverFlow ? isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
18749
18753
  top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
18750
18754
  translateY = -1;
18751
18755
  break;
@@ -18797,7 +18801,7 @@ class foundation_Tooltip extends foundation {
18797
18801
  case 'bottomLeft':
18798
18802
  // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
18799
18803
  // top = triggerRect.bottom + SPACING;
18800
- left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
18804
+ left = isWidthOverFlow ? isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
18801
18805
  top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
18802
18806
  break;
18803
18807
 
@@ -60178,7 +60182,16 @@ function confirm_confirm(props) {
60178
60182
  };
60179
60183
 
60180
60184
  function render(renderProps) {
60185
+ const {
60186
+ afterClose
60187
+ } = renderProps; //@ts-ignore
60188
+
60181
60189
  external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default.a.render( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(modal_ConfirmModal, Object.assign({}, renderProps, {
60190
+ afterClose: function () {
60191
+ //@ts-ignore
60192
+ afterClose === null || afterClose === void 0 ? void 0 : afterClose(...arguments);
60193
+ destroy();
60194
+ },
60182
60195
  motion: props.motion
60183
60196
  })), div);
60184
60197
  }
@@ -93117,6 +93130,13 @@ const treeSelect_constants_numbers = {};
93117
93130
  class foundation_TreeSelectFoundation extends foundation {
93118
93131
  constructor(adapter) {
93119
93132
  super(Object.assign({}, adapter));
93133
+
93134
+ this._registerClickOutsideHandler = e => {
93135
+ this._adapter.registerClickOutsideHandler(e => {
93136
+ this.handlerTriggerBlur(e);
93137
+ this.close(e);
93138
+ });
93139
+ };
93120
93140
  }
93121
93141
 
93122
93142
  init() {
@@ -93135,6 +93155,10 @@ class foundation_TreeSelectFoundation extends foundation {
93135
93155
  if (isOpen) {
93136
93156
  this.open();
93137
93157
  }
93158
+
93159
+ if (triggerSearchAutoFocus) {
93160
+ this.handleTriggerFocus(null);
93161
+ }
93138
93162
  }
93139
93163
 
93140
93164
  destroy() {
@@ -93402,6 +93426,14 @@ class foundation_TreeSelectFoundation extends foundation {
93402
93426
 
93403
93427
  _notifyFocus(e) {
93404
93428
  this._adapter.notifyFocus(e);
93429
+ }
93430
+
93431
+ handleTriggerFocus(e) {
93432
+ this._adapter.updateIsFocus(true);
93433
+
93434
+ this._notifyFocus(e);
93435
+
93436
+ this._registerClickOutsideHandler(e);
93405
93437
  } // Scenes that may trigger blur
93406
93438
  // 1、clickOutSide
93407
93439
  // 2、click option / press enter, and then select complete(when multiple is false
@@ -93412,6 +93444,14 @@ class foundation_TreeSelectFoundation extends foundation {
93412
93444
  this._adapter.notifyBlur(e);
93413
93445
  }
93414
93446
 
93447
+ handlerTriggerBlur(e) {
93448
+ this._adapter.updateIsFocus(false);
93449
+
93450
+ this._notifyBlur(e);
93451
+
93452
+ this._adapter.unregisterClickOutsideHandler();
93453
+ }
93454
+
93415
93455
  toggleHoverState(bool) {
93416
93456
  this._adapter.toggleHovering(bool);
93417
93457
  }
@@ -93420,19 +93460,11 @@ class foundation_TreeSelectFoundation extends foundation {
93420
93460
  this._adapter.openMenu();
93421
93461
 
93422
93462
  this._setDropdownWidth();
93423
-
93424
- this._adapter.registerClickOutsideHandler(e => {
93425
- this.close(e);
93426
- });
93427
93463
  }
93428
93464
 
93429
93465
  close(e) {
93430
93466
  this._adapter.closeMenu();
93431
93467
 
93432
- this._adapter.unregisterClickOutsideHandler();
93433
-
93434
- this._notifyBlur(e);
93435
-
93436
93468
  if (this.getProp('motionExpand')) {
93437
93469
  this._adapter.updateState({
93438
93470
  motionKeys: new Set([])
@@ -93445,7 +93477,8 @@ class foundation_TreeSelectFoundation extends foundation {
93445
93477
 
93446
93478
  const {
93447
93479
  isOpen,
93448
- inputValue
93480
+ inputValue,
93481
+ isFocus
93449
93482
  } = this.getStates();
93450
93483
  const {
93451
93484
  searchPosition
@@ -93453,16 +93486,20 @@ class foundation_TreeSelectFoundation extends foundation {
93453
93486
 
93454
93487
  if (isDisabled) {
93455
93488
  return;
93456
- } else if (!isOpen) {
93457
- this.open();
93458
-
93459
- this._notifyFocus(e);
93460
- } else if (isOpen) {
93461
- if (searchPosition === 'trigger' && inputValue) {
93462
- return;
93489
+ } else {
93490
+ if (!isFocus) {
93491
+ this.handleTriggerFocus(e);
93463
93492
  }
93464
93493
 
93465
- this.close(e);
93494
+ if (isOpen) {
93495
+ if (searchPosition === 'trigger' && inputValue) {
93496
+ return;
93497
+ }
93498
+
93499
+ this.close(e);
93500
+ } else {
93501
+ this.open();
93502
+ }
93466
93503
  }
93467
93504
  }
93468
93505
  /**
@@ -93708,6 +93745,7 @@ class foundation_TreeSelectFoundation extends foundation {
93708
93745
 
93709
93746
  if (clickToHide && (this._isSelectToClose() || !data.children)) {
93710
93747
  this.close(e);
93748
+ this.handlerTriggerBlur(e);
93711
93749
  }
93712
93750
  }
93713
93751
 
@@ -94402,12 +94440,11 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94402
94440
  triggerRender
94403
94441
  } = this.props;
94404
94442
  const {
94405
- isOpen,
94406
- isInput,
94407
94443
  inputValue,
94408
94444
  selectedKeys,
94409
94445
  checkedKeys,
94410
- keyEntities
94446
+ keyEntities,
94447
+ isFocus
94411
94448
  } = this.state;
94412
94449
  const filterable = Boolean(filterTreeNode);
94413
94450
  const useCustomTrigger = typeof triggerRender === 'function';
@@ -94421,7 +94458,7 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94421
94458
 
94422
94459
  const isValueTriggerSearch = isTriggerPositionSearch && !isEmpty_default()(checkedKeys);
94423
94460
  const classNames = useCustomTrigger ? classnames_default()(className) : classnames_default()(treeSelect_prefixcls, {
94424
- [`${treeSelect_prefixcls}-focus`]: isOpen && !isInput,
94461
+ [`${treeSelect_prefixcls}-focus`]: isFocus,
94425
94462
  [`${treeSelect_prefixcls}-disabled`]: disabled,
94426
94463
  [`${treeSelect_prefixcls}-single`]: !multiple,
94427
94464
  [`${treeSelect_prefixcls}-multiple`]: multiple,
@@ -94561,7 +94598,8 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94561
94598
  showRestTagsPopover,
94562
94599
  restTagsPopoverProps,
94563
94600
  searchPosition,
94564
- filterTreeNode
94601
+ filterTreeNode,
94602
+ preventScroll
94565
94603
  } = this.props;
94566
94604
  const {
94567
94605
  keyEntities,
@@ -94600,7 +94638,8 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94600
94638
  autoFocus: autoFocus,
94601
94639
  renderTagItem: (itemKey, index) => this.renderTagItem(itemKey, index),
94602
94640
  onRemove: itemKey => this.removeTag(itemKey),
94603
- expandRestTagsOnClick: false
94641
+ expandRestTagsOnClick: false,
94642
+ preventScroll: preventScroll
94604
94643
  });
94605
94644
  }; // render Tree
94606
94645
 
@@ -94918,7 +94957,8 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94918
94957
  this.state = {
94919
94958
  inputTriggerFocus: false,
94920
94959
  isOpen: false,
94921
- isInput: false,
94960
+ isFocus: false,
94961
+ // isInput: false,
94922
94962
  rePosKey: treeSelect_key,
94923
94963
  dropdownMinWidth: null,
94924
94964
  inputValue: '',
@@ -95216,7 +95256,12 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
95216
95256
  updateInputFocus: bool => {
95217
95257
  if (bool) {
95218
95258
  if (this.inputRef && this.inputRef.current) {
95219
- this.inputRef.current.focus();
95259
+ const {
95260
+ preventScroll
95261
+ } = this.props;
95262
+ this.inputRef.current.focus({
95263
+ preventScroll
95264
+ });
95220
95265
  }
95221
95266
 
95222
95267
  if (this.tagInputRef && this.tagInputRef.current) {
@@ -95231,8 +95276,12 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
95231
95276
  this.tagInputRef.current.blur();
95232
95277
  }
95233
95278
  }
95234
- } // eslint-disable-line
95235
-
95279
+ },
95280
+ updateIsFocus: bool => {
95281
+ this.setState({
95282
+ isFocus: bool
95283
+ });
95284
+ }
95236
95285
  });
95237
95286
  }
95238
95287
 
@@ -95369,7 +95418,8 @@ treeSelect_TreeSelect.propTypes = {
95369
95418
  checkRelation: prop_types_default.a.string,
95370
95419
  'aria-label': prop_types_default.a.string,
95371
95420
  showRestTagsPopover: prop_types_default.a.bool,
95372
- restTagsPopoverProps: prop_types_default.a.object
95421
+ restTagsPopoverProps: prop_types_default.a.object,
95422
+ preventScroll: prop_types_default.a.bool
95373
95423
  };
95374
95424
  treeSelect_TreeSelect.defaultProps = {
95375
95425
  searchPosition: treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN,