@douyinfe/semi-ui 2.30.0-beta.0 → 2.30.1

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
  }
@@ -61001,11 +61014,12 @@ class dropdownItem_DropdownItem extends baseComponent_BaseComponent {
61001
61014
  const {
61002
61015
  showTick: contextShowTick
61003
61016
  } = this.context;
61017
+ const realShowTick = contextShowTick !== null && contextShowTick !== void 0 ? contextShowTick : showTick;
61004
61018
  const itemclass = classnames_default()(className, {
61005
61019
  [`${dropdownItem_prefixCls}-item`]: true,
61006
61020
  [`${dropdownItem_prefixCls}-item-disabled`]: disabled,
61007
61021
  [`${dropdownItem_prefixCls}-item-hover`]: hover,
61008
- [`${dropdownItem_prefixCls}-item-withTick`]: contextShowTick !== null && contextShowTick !== void 0 ? contextShowTick : showTick,
61022
+ [`${dropdownItem_prefixCls}-item-withTick`]: realShowTick,
61009
61023
  [`${dropdownItem_prefixCls}-item-${type}`]: type,
61010
61024
  [`${dropdownItem_prefixCls}-item-active`]: active
61011
61025
  });
@@ -61020,11 +61034,11 @@ class dropdownItem_DropdownItem extends baseComponent_BaseComponent {
61020
61034
  let tick = null;
61021
61035
 
61022
61036
  switch (true) {
61023
- case showTick && active:
61037
+ case realShowTick && active:
61024
61038
  tick = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconTick, null);
61025
61039
  break;
61026
61040
 
61027
- case showTick && !active:
61041
+ case realShowTick && !active:
61028
61042
  tick = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconTick, {
61029
61043
  style: {
61030
61044
  color: 'transparent'
@@ -93117,6 +93131,13 @@ const treeSelect_constants_numbers = {};
93117
93131
  class foundation_TreeSelectFoundation extends foundation {
93118
93132
  constructor(adapter) {
93119
93133
  super(Object.assign({}, adapter));
93134
+
93135
+ this._registerClickOutsideHandler = e => {
93136
+ this._adapter.registerClickOutsideHandler(e => {
93137
+ this.handlerTriggerBlur(e);
93138
+ this.close(e);
93139
+ });
93140
+ };
93120
93141
  }
93121
93142
 
93122
93143
  init() {
@@ -93135,6 +93156,10 @@ class foundation_TreeSelectFoundation extends foundation {
93135
93156
  if (isOpen) {
93136
93157
  this.open();
93137
93158
  }
93159
+
93160
+ if (triggerSearchAutoFocus) {
93161
+ this.handleTriggerFocus(null);
93162
+ }
93138
93163
  }
93139
93164
 
93140
93165
  destroy() {
@@ -93402,6 +93427,14 @@ class foundation_TreeSelectFoundation extends foundation {
93402
93427
 
93403
93428
  _notifyFocus(e) {
93404
93429
  this._adapter.notifyFocus(e);
93430
+ }
93431
+
93432
+ handleTriggerFocus(e) {
93433
+ this._adapter.updateIsFocus(true);
93434
+
93435
+ this._notifyFocus(e);
93436
+
93437
+ this._registerClickOutsideHandler(e);
93405
93438
  } // Scenes that may trigger blur
93406
93439
  // 1、clickOutSide
93407
93440
  // 2、click option / press enter, and then select complete(when multiple is false
@@ -93412,6 +93445,14 @@ class foundation_TreeSelectFoundation extends foundation {
93412
93445
  this._adapter.notifyBlur(e);
93413
93446
  }
93414
93447
 
93448
+ handlerTriggerBlur(e) {
93449
+ this._adapter.updateIsFocus(false);
93450
+
93451
+ this._notifyBlur(e);
93452
+
93453
+ this._adapter.unregisterClickOutsideHandler();
93454
+ }
93455
+
93415
93456
  toggleHoverState(bool) {
93416
93457
  this._adapter.toggleHovering(bool);
93417
93458
  }
@@ -93420,19 +93461,11 @@ class foundation_TreeSelectFoundation extends foundation {
93420
93461
  this._adapter.openMenu();
93421
93462
 
93422
93463
  this._setDropdownWidth();
93423
-
93424
- this._adapter.registerClickOutsideHandler(e => {
93425
- this.close(e);
93426
- });
93427
93464
  }
93428
93465
 
93429
93466
  close(e) {
93430
93467
  this._adapter.closeMenu();
93431
93468
 
93432
- this._adapter.unregisterClickOutsideHandler();
93433
-
93434
- this._notifyBlur(e);
93435
-
93436
93469
  if (this.getProp('motionExpand')) {
93437
93470
  this._adapter.updateState({
93438
93471
  motionKeys: new Set([])
@@ -93445,7 +93478,8 @@ class foundation_TreeSelectFoundation extends foundation {
93445
93478
 
93446
93479
  const {
93447
93480
  isOpen,
93448
- inputValue
93481
+ inputValue,
93482
+ isFocus
93449
93483
  } = this.getStates();
93450
93484
  const {
93451
93485
  searchPosition
@@ -93453,16 +93487,20 @@ class foundation_TreeSelectFoundation extends foundation {
93453
93487
 
93454
93488
  if (isDisabled) {
93455
93489
  return;
93456
- } else if (!isOpen) {
93457
- this.open();
93458
-
93459
- this._notifyFocus(e);
93460
- } else if (isOpen) {
93461
- if (searchPosition === 'trigger' && inputValue) {
93462
- return;
93490
+ } else {
93491
+ if (!isFocus) {
93492
+ this.handleTriggerFocus(e);
93463
93493
  }
93464
93494
 
93465
- this.close(e);
93495
+ if (isOpen) {
93496
+ if (searchPosition === 'trigger' && inputValue) {
93497
+ return;
93498
+ }
93499
+
93500
+ this.close(e);
93501
+ } else {
93502
+ this.open();
93503
+ }
93466
93504
  }
93467
93505
  }
93468
93506
  /**
@@ -93708,6 +93746,7 @@ class foundation_TreeSelectFoundation extends foundation {
93708
93746
 
93709
93747
  if (clickToHide && (this._isSelectToClose() || !data.children)) {
93710
93748
  this.close(e);
93749
+ this.handlerTriggerBlur(e);
93711
93750
  }
93712
93751
  }
93713
93752
 
@@ -94402,12 +94441,11 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94402
94441
  triggerRender
94403
94442
  } = this.props;
94404
94443
  const {
94405
- isOpen,
94406
- isInput,
94407
94444
  inputValue,
94408
94445
  selectedKeys,
94409
94446
  checkedKeys,
94410
- keyEntities
94447
+ keyEntities,
94448
+ isFocus
94411
94449
  } = this.state;
94412
94450
  const filterable = Boolean(filterTreeNode);
94413
94451
  const useCustomTrigger = typeof triggerRender === 'function';
@@ -94421,7 +94459,7 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94421
94459
 
94422
94460
  const isValueTriggerSearch = isTriggerPositionSearch && !isEmpty_default()(checkedKeys);
94423
94461
  const classNames = useCustomTrigger ? classnames_default()(className) : classnames_default()(treeSelect_prefixcls, {
94424
- [`${treeSelect_prefixcls}-focus`]: isOpen && !isInput,
94462
+ [`${treeSelect_prefixcls}-focus`]: isFocus,
94425
94463
  [`${treeSelect_prefixcls}-disabled`]: disabled,
94426
94464
  [`${treeSelect_prefixcls}-single`]: !multiple,
94427
94465
  [`${treeSelect_prefixcls}-multiple`]: multiple,
@@ -94561,7 +94599,8 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94561
94599
  showRestTagsPopover,
94562
94600
  restTagsPopoverProps,
94563
94601
  searchPosition,
94564
- filterTreeNode
94602
+ filterTreeNode,
94603
+ preventScroll
94565
94604
  } = this.props;
94566
94605
  const {
94567
94606
  keyEntities,
@@ -94600,7 +94639,8 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94600
94639
  autoFocus: autoFocus,
94601
94640
  renderTagItem: (itemKey, index) => this.renderTagItem(itemKey, index),
94602
94641
  onRemove: itemKey => this.removeTag(itemKey),
94603
- expandRestTagsOnClick: false
94642
+ expandRestTagsOnClick: false,
94643
+ preventScroll: preventScroll
94604
94644
  });
94605
94645
  }; // render Tree
94606
94646
 
@@ -94918,7 +94958,8 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94918
94958
  this.state = {
94919
94959
  inputTriggerFocus: false,
94920
94960
  isOpen: false,
94921
- isInput: false,
94961
+ isFocus: false,
94962
+ // isInput: false,
94922
94963
  rePosKey: treeSelect_key,
94923
94964
  dropdownMinWidth: null,
94924
94965
  inputValue: '',
@@ -95216,7 +95257,12 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
95216
95257
  updateInputFocus: bool => {
95217
95258
  if (bool) {
95218
95259
  if (this.inputRef && this.inputRef.current) {
95219
- this.inputRef.current.focus();
95260
+ const {
95261
+ preventScroll
95262
+ } = this.props;
95263
+ this.inputRef.current.focus({
95264
+ preventScroll
95265
+ });
95220
95266
  }
95221
95267
 
95222
95268
  if (this.tagInputRef && this.tagInputRef.current) {
@@ -95231,8 +95277,12 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
95231
95277
  this.tagInputRef.current.blur();
95232
95278
  }
95233
95279
  }
95234
- } // eslint-disable-line
95235
-
95280
+ },
95281
+ updateIsFocus: bool => {
95282
+ this.setState({
95283
+ isFocus: bool
95284
+ });
95285
+ }
95236
95286
  });
95237
95287
  }
95238
95288
 
@@ -95369,7 +95419,8 @@ treeSelect_TreeSelect.propTypes = {
95369
95419
  checkRelation: prop_types_default.a.string,
95370
95420
  'aria-label': prop_types_default.a.string,
95371
95421
  showRestTagsPopover: prop_types_default.a.bool,
95372
- restTagsPopoverProps: prop_types_default.a.object
95422
+ restTagsPopoverProps: prop_types_default.a.object,
95423
+ preventScroll: prop_types_default.a.bool
95373
95424
  };
95374
95425
  treeSelect_TreeSelect.defaultProps = {
95375
95426
  searchPosition: treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN,