@douyinfe/semi-ui 2.24.0-beta.1 → 2.24.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.
@@ -19312,23 +19312,26 @@ class foundation_Tooltip extends foundation {
19312
19312
 
19313
19313
 
19314
19314
  if (this.isTB(position)) {
19315
- isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
19315
+ isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow; // Related PR: https://github.com/DouyinFE/semi-design/pull/1297
19316
+ // If clientRight or restClientRight less than 0, means that the left and right parts of the trigger are blocked
19317
+ // Then the display of the wrapper will also be affected, make width overflow to offset the wrapper
19316
19318
 
19317
19319
  if (position === 'top' || position === 'bottom') {
19318
- isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
19320
+ isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf || clientRight < 0 || restClientRight < 0;
19319
19321
  } else {
19320
- isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide;
19322
+ isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide || clientRight < 0 || restClientRight < 0;
19321
19323
  }
19322
19324
  } // 左右方向 left and right
19323
19325
 
19324
19326
 
19325
19327
  if (this.isLR(position)) {
19326
- isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
19328
+ isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow; // If clientTop or restClientTop less than 0, means that the top and bottom parts of the trigger are blocked
19329
+ // Then the display of the wrapper will also be affected, make height overflow to offset the wrapper
19327
19330
 
19328
19331
  if (position === 'left' || position === 'right') {
19329
- isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
19332
+ isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf || clientTop < 0 || restClientTop < 0;
19330
19333
  } else {
19331
- isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide;
19334
+ isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide || clientTop < 0 || restClientTop < 0;
19332
19335
  }
19333
19336
  }
19334
19337
  }
@@ -26863,6 +26866,8 @@ class foundation_InputFoundation extends foundation {
26863
26866
 
26864
26867
 
26865
26868
  if (this._adapter.isEventTarget(e)) {
26869
+ this._adapter.focusInput();
26870
+
26866
26871
  this._adapter.toggleFocusing(true);
26867
26872
  }
26868
26873
  }
@@ -26878,6 +26883,8 @@ class foundation_InputFoundation extends foundation {
26878
26883
  handleClickEye(e) {
26879
26884
  const eyeClosed = this._adapter.getState('eyeClosed');
26880
26885
 
26886
+ this._adapter.focusInput();
26887
+
26881
26888
  this._adapter.toggleFocusing(true);
26882
26889
 
26883
26890
  this._adapter.setEyeClosed(!eyeClosed);
@@ -26970,6 +26977,8 @@ class foundation_InputFoundation extends foundation {
26970
26977
  } = this._adapter.getStates();
26971
26978
 
26972
26979
  if (!disabled && !isFocus) {
26980
+ this._adapter.focusInput();
26981
+
26973
26982
  this._adapter.toggleFocusing(true);
26974
26983
  }
26975
26984
  }
@@ -27008,6 +27017,7 @@ var input_input = __webpack_require__("RHNq");
27008
27017
 
27009
27018
 
27010
27019
 
27020
+
27011
27021
  var input_rest = undefined && undefined.__rest || function (s, e) {
27012
27022
  var t = {};
27013
27023
 
@@ -27112,21 +27122,17 @@ class input_Input extends baseComponent_BaseComponent {
27112
27122
  eyeClosed: value
27113
27123
  }),
27114
27124
  toggleFocusing: isFocus => {
27125
+ this.setState({
27126
+ isFocus
27127
+ });
27128
+ },
27129
+ focusInput: () => {
27115
27130
  const {
27116
27131
  preventScroll
27117
27132
  } = this.props;
27118
27133
  const input = this.inputRef && this.inputRef.current;
27119
-
27120
- if (isFocus) {
27121
- input && input.focus({
27122
- preventScroll
27123
- });
27124
- } else {
27125
- input && input.blur();
27126
- }
27127
-
27128
- this.setState({
27129
- isFocus
27134
+ input && input.focus({
27135
+ preventScroll
27130
27136
  });
27131
27137
  },
27132
27138
  toggleHovering: isHovering => this.setState({
@@ -27330,6 +27336,28 @@ class input_Input extends baseComponent_BaseComponent {
27330
27336
  );
27331
27337
  }
27332
27338
 
27339
+ getInputRef() {
27340
+ const {
27341
+ forwardRef
27342
+ } = this.props;
27343
+
27344
+ if (!isUndefined_default()(forwardRef)) {
27345
+ if (typeof forwardRef === 'function') {
27346
+ return node => {
27347
+ forwardRef(node);
27348
+ this.inputRef = {
27349
+ current: node
27350
+ };
27351
+ };
27352
+ } else if (Object.prototype.toString.call(forwardRef) === '[object Object]') {
27353
+ this.inputRef = forwardRef;
27354
+ return forwardRef;
27355
+ }
27356
+ }
27357
+
27358
+ return this.inputRef;
27359
+ }
27360
+
27333
27361
  render() {
27334
27362
  const _a = this.props,
27335
27363
  {
@@ -27369,7 +27397,7 @@ class input_Input extends baseComponent_BaseComponent {
27369
27397
  } = this.state;
27370
27398
  const suffixAllowClear = this.showClearBtn();
27371
27399
  const suffixIsIcon = Object(_utils["e" /* isSemiIcon */])(suffix);
27372
- const ref = forwardRef || this.inputRef;
27400
+ const ref = this.getInputRef();
27373
27401
  const wrapperPrefix = "".concat(input_prefixCls, "-wrapper");
27374
27402
  const wrapperCls = classnames_default()(wrapperPrefix, className, {
27375
27403
  ["".concat(input_prefixCls, "-wrapper__with-prefix")]: prefix || insetLabel,
@@ -63263,7 +63291,9 @@ class foundation_InputNumberFoundation extends foundation {
63263
63291
  _preventDefault(event) {
63264
63292
  const keepFocus = this._adapter.getProp('keepFocus');
63265
63293
 
63266
- if (keepFocus) {
63294
+ const innerButtons = this._adapter.getProp('innerButtons');
63295
+
63296
+ if (keepFocus || innerButtons) {
63267
63297
  event.preventDefault();
63268
63298
  }
63269
63299
  }
@@ -86934,7 +86964,6 @@ class TabBar_TabBar extends external_root_React_commonjs2_react_commonjs_react_a
86934
86964
  this.renderTabComponents = list => list.map(panel => this.renderTabItem(panel));
86935
86965
 
86936
86966
  this.handleArrowClick = (items, pos) => {
86937
- const inline = pos === 'start' ? 'end' : 'start';
86938
86967
  const lastItem = pos === 'start' ? items.pop() : items.shift();
86939
86968
 
86940
86969
  if (!lastItem) {
@@ -86948,7 +86977,7 @@ class TabBar_TabBar extends external_root_React_commonjs2_react_commonjs_react_a
86948
86977
  tabItem.scrollIntoView({
86949
86978
  behavior: 'smooth',
86950
86979
  block: 'nearest',
86951
- inline
86980
+ inline: 'nearest'
86952
86981
  });
86953
86982
  };
86954
86983
 
@@ -93666,7 +93695,9 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93666
93695
  maxTagCount,
93667
93696
  checkRelation,
93668
93697
  showRestTagsPopover,
93669
- restTagsPopoverProps
93698
+ restTagsPopoverProps,
93699
+ searchPosition,
93700
+ filterTreeNode
93670
93701
  } = this.props;
93671
93702
  const {
93672
93703
  keyEntities,
@@ -93680,8 +93711,16 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93680
93711
  keyList = normalizeKeyList(checkedKeys, keyEntities, leafOnly);
93681
93712
  } else if (checkRelation === 'unRelated') {
93682
93713
  keyList = [...realCheckedKeys];
93683
- }
93714
+ } // auto focus search input divide into two parts
93715
+ // 1. filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER
93716
+ // Implemented by passing autofocus to the underlying input's autofocus
93717
+ // 2. filterTreeNode && searchPosition === strings.SEARCH_POSITION_DROPDOWN
93718
+ // Due to the off-screen rendering in the tooltip implementation mechanism, if it is implemented through the
93719
+ // autofocus of the input, when the option panel is opened, the page will scroll to top, so it is necessary
93720
+ // to call the focus method through ref in the onVisibleChange callback of the Popover to achieve focus
93721
+
93684
93722
 
93723
+ const autoFocus = filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_TRIGGER ? searchAutoFocus : undefined;
93685
93724
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(tagInput_0, {
93686
93725
  maxTagCount: maxTagCount,
93687
93726
  disabled: disabled,
@@ -93694,7 +93733,7 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93694
93733
  showRestTagsPopover: showRestTagsPopover,
93695
93734
  restTagsPopoverProps: restTagsPopoverProps,
93696
93735
  // eslint-disable-next-line jsx-a11y/no-autofocus
93697
- autoFocus: searchAutoFocus,
93736
+ autoFocus: autoFocus,
93698
93737
  renderTagItem: (itemKey, index) => this.renderTagItem(itemKey, index),
93699
93738
  onRemove: itemKey => this.removeTag(itemKey),
93700
93739
  expandRestTagsOnClick: false
@@ -93730,6 +93769,7 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93730
93769
  prefix: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconSearch, null)
93731
93770
  };
93732
93771
  const inputTriggerProps = {
93772
+ autofocus: searchAutoFocus,
93733
93773
  onFocus: e => this.foundation.handleInputTriggerFocus(),
93734
93774
  onBlur: e => this.foundation.handleInputTriggerBlur(),
93735
93775
  disabled
@@ -93761,7 +93801,6 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93761
93801
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(input_0, Object.assign({
93762
93802
  "aria-label": 'Filter TreeSelect item',
93763
93803
  ref: this.inputRef,
93764
- autofocus: searchAutoFocus,
93765
93804
  placeholder: placeholder
93766
93805
  }, baseInputProps, realInputProps));
93767
93806
  }));
@@ -93835,12 +93874,18 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93835
93874
 
93836
93875
  this.handlePopoverClose = isVisible => {
93837
93876
  const {
93838
- filterTreeNode
93877
+ filterTreeNode,
93878
+ searchAutoFocus,
93879
+ searchPosition
93839
93880
  } = this.props;
93840
93881
 
93841
93882
  if (isVisible === false && Boolean(filterTreeNode)) {
93842
93883
  this.foundation.clearInput();
93843
93884
  }
93885
+
93886
+ if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
93887
+ this.foundation.focusInput(true);
93888
+ }
93844
93889
  };
93845
93890
 
93846
93891
  this.renderTreeNode = (treeNode, ind, style) => {
@@ -94304,7 +94349,25 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94304
94349
  isHovering: bool
94305
94350
  });
94306
94351
  },
94307
- updateInputFocus: bool => {} // eslint-disable-line
94352
+ updateInputFocus: bool => {
94353
+ if (bool) {
94354
+ if (this.inputRef && this.inputRef.current) {
94355
+ this.inputRef.current.focus();
94356
+ }
94357
+
94358
+ if (this.tagInputRef && this.tagInputRef.current) {
94359
+ this.tagInputRef.current.focus();
94360
+ }
94361
+ } else {
94362
+ if (this.inputRef && this.inputRef.current) {
94363
+ this.inputRef.current.blur();
94364
+ }
94365
+
94366
+ if (this.tagInputRef && this.tagInputRef.current) {
94367
+ this.tagInputRef.current.blur();
94368
+ }
94369
+ }
94370
+ } // eslint-disable-line
94308
94371
 
94309
94372
  });
94310
94373
  }
@@ -103108,7 +103171,7 @@ class preview_Preview extends baseComponent_BaseComponent {
103108
103171
  const finalSrcList = [...srcArr, ...srcListInChildren];
103109
103172
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(PreviewContext.Provider, {
103110
103173
  value: {
103111
- isGroup: finalSrcList.length > 1,
103174
+ isGroup: true,
103112
103175
  previewSrc: finalSrcList,
103113
103176
  titles: titles,
103114
103177
  currentIndex,