@douyinfe/semi-ui 2.24.0-beta.1 → 2.24.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.
@@ -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,
@@ -56597,8 +56625,48 @@ Combobox_Combobox.defaultProps = {
56597
56625
  format: timePicker_constants_strings.DEFAULT_FORMAT
56598
56626
  };
56599
56627
  /* harmony default export */ var timePicker_Combobox = (Combobox_Combobox);
56628
+ // CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/setYear/index.js
56629
+
56630
+
56631
+
56632
+ /**
56633
+ * @name setYear
56634
+ * @category Year Helpers
56635
+ * @summary Set the year to the given date.
56636
+ *
56637
+ * @description
56638
+ * Set the year to the given date.
56639
+ *
56640
+ * ### v2.0.0 breaking changes:
56641
+ *
56642
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
56643
+ *
56644
+ * @param {Date|Number} date - the date to be changed
56645
+ * @param {Number} year - the year of the new date
56646
+ * @returns {Date} the new date with the year set
56647
+ * @throws {TypeError} 2 arguments required
56648
+ *
56649
+ * @example
56650
+ * // Set year 2013 to 1 September 2014:
56651
+ * const result = setYear(new Date(2014, 8, 1), 2013)
56652
+ * //=> Sun Sep 01 2013 00:00:00
56653
+ */
56654
+
56655
+ function setYear(dirtyDate, dirtyYear) {
56656
+ requiredArgs(2, arguments);
56657
+ var date = toDate(dirtyDate);
56658
+ var year = toInteger(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
56659
+
56660
+ if (isNaN(date.getTime())) {
56661
+ return new Date(NaN);
56662
+ }
56663
+
56664
+ date.setFullYear(year);
56665
+ return date;
56666
+ }
56600
56667
  // CONCATENATED MODULE: ../semi-foundation/datePicker/yearAndMonthFoundation.ts
56601
56668
 
56669
+
56602
56670
  class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
56603
56671
  constructor(adapter) {
56604
56672
  super(Object.assign({}, adapter));
@@ -56613,7 +56681,7 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
56613
56681
  selectYear(item) {
56614
56682
  const year = item.value;
56615
56683
 
56616
- this._adapter.setCurrentYear(year);
56684
+ this._adapter.setCurrentYear(year, () => this.autoSelectMonth(item));
56617
56685
 
56618
56686
  this._adapter.notifySelectYear(year);
56619
56687
  }
@@ -56627,6 +56695,59 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
56627
56695
 
56628
56696
  this._adapter.notifySelectMonth(month);
56629
56697
  }
56698
+ /**
56699
+ * After selecting a year, if the currentMonth is disabled, automatically select a non-disabled month
56700
+ */
56701
+
56702
+
56703
+ autoSelectMonth(item) {
56704
+ const {
56705
+ disabledDate,
56706
+ locale
56707
+ } = this._adapter.getProps();
56708
+
56709
+ const {
56710
+ months,
56711
+ currentMonth
56712
+ } = this._adapter.getStates();
56713
+
56714
+ const currentDate = setYear(Date.now(), item.year);
56715
+ const isCurrentMonthDisabled = disabledDate(setMonth(currentDate, currentMonth - 1));
56716
+
56717
+ if (isCurrentMonthDisabled) {
56718
+ const currentIndex = months.findIndex(_ref => {
56719
+ let {
56720
+ month
56721
+ } = _ref;
56722
+ return month === currentMonth;
56723
+ });
56724
+ let validMonth; // First look in the back, if you can't find it in the back, then look in the front
56725
+
56726
+ validMonth = months.slice(currentIndex).find(_ref2 => {
56727
+ let {
56728
+ month
56729
+ } = _ref2;
56730
+ return !disabledDate(setMonth(currentDate, month - 1));
56731
+ });
56732
+
56733
+ if (!validMonth) {
56734
+ validMonth = months.slice(0, currentIndex).find(_ref3 => {
56735
+ let {
56736
+ month
56737
+ } = _ref3;
56738
+ return !disabledDate(setMonth(currentDate, month - 1));
56739
+ });
56740
+ }
56741
+
56742
+ if (validMonth) {
56743
+ this.selectMonth({
56744
+ month: validMonth.month,
56745
+ value: locale.fullMonths[validMonth.month],
56746
+ disabled: false
56747
+ });
56748
+ }
56749
+ }
56750
+ }
56630
56751
 
56631
56752
  backToMain() {
56632
56753
  this._adapter.notifyBackToMain();
@@ -56643,45 +56764,6 @@ const getYears = () => {
56643
56764
  };
56644
56765
 
56645
56766
  /* harmony default export */ var _utils_getYears = (getYears);
56646
- // CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/setYear/index.js
56647
-
56648
-
56649
-
56650
- /**
56651
- * @name setYear
56652
- * @category Year Helpers
56653
- * @summary Set the year to the given date.
56654
- *
56655
- * @description
56656
- * Set the year to the given date.
56657
- *
56658
- * ### v2.0.0 breaking changes:
56659
- *
56660
- * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
56661
- *
56662
- * @param {Date|Number} date - the date to be changed
56663
- * @param {Number} year - the year of the new date
56664
- * @returns {Date} the new date with the year set
56665
- * @throws {TypeError} 2 arguments required
56666
- *
56667
- * @example
56668
- * // Set year 2013 to 1 September 2014:
56669
- * const result = setYear(new Date(2014, 8, 1), 2013)
56670
- * //=> Sun Sep 01 2013 00:00:00
56671
- */
56672
-
56673
- function setYear(dirtyDate, dirtyYear) {
56674
- requiredArgs(2, arguments);
56675
- var date = toDate(dirtyDate);
56676
- var year = toInteger(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
56677
-
56678
- if (isNaN(date.getTime())) {
56679
- return new Date(NaN);
56680
- }
56681
-
56682
- date.setFullYear(year);
56683
- return date;
56684
- }
56685
56767
  // CONCATENATED MODULE: ./datePicker/yearAndMonth.tsx
56686
56768
 
56687
56769
 
@@ -56758,9 +56840,9 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
56758
56840
  return Object.assign(Object.assign({}, super.adapter), {
56759
56841
  // updateYears: years => this.setState({ years }),
56760
56842
  // updateMonths: months => this.setState({ months }),
56761
- setCurrentYear: currentYear => this.setState({
56843
+ setCurrentYear: (currentYear, cb) => this.setState({
56762
56844
  currentYear
56763
- }),
56845
+ }, cb),
56764
56846
  setCurrentMonth: currentMonth => this.setState({
56765
56847
  currentMonth
56766
56848
  }),
@@ -56795,7 +56877,8 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
56795
56877
  const {
56796
56878
  years,
56797
56879
  currentYear,
56798
- currentMonth
56880
+ currentMonth,
56881
+ months
56799
56882
  } = this.state;
56800
56883
  const {
56801
56884
  disabledDate,
@@ -56809,10 +56892,19 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
56809
56892
  value,
56810
56893
  year
56811
56894
  } = _ref;
56895
+ const isAllMonthDisabled = months.every(_ref2 => {
56896
+ let {
56897
+ month
56898
+ } = _ref2;
56899
+ return disabledDate(set_set(currentDate, {
56900
+ year,
56901
+ month: month - 1
56902
+ }));
56903
+ });
56812
56904
  return {
56813
56905
  year,
56814
56906
  value,
56815
- disabled: disabledDate(setYear(currentDate, year))
56907
+ disabled: isAllMonthDisabled
56816
56908
  };
56817
56909
  });
56818
56910
 
@@ -56859,11 +56951,11 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
56859
56951
  } // i18n
56860
56952
 
56861
56953
 
56862
- const list = months.map(_ref2 => {
56954
+ const list = months.map(_ref3 => {
56863
56955
  let {
56864
56956
  value,
56865
56957
  month
56866
- } = _ref2;
56958
+ } = _ref3;
56867
56959
  return {
56868
56960
  month,
56869
56961
  disabled: disabledDate(setMonth(currentDate, month - 1)),
@@ -63263,7 +63355,9 @@ class foundation_InputNumberFoundation extends foundation {
63263
63355
  _preventDefault(event) {
63264
63356
  const keepFocus = this._adapter.getProp('keepFocus');
63265
63357
 
63266
- if (keepFocus) {
63358
+ const innerButtons = this._adapter.getProp('innerButtons');
63359
+
63360
+ if (keepFocus || innerButtons) {
63267
63361
  event.preventDefault();
63268
63362
  }
63269
63363
  }
@@ -86934,7 +87028,6 @@ class TabBar_TabBar extends external_root_React_commonjs2_react_commonjs_react_a
86934
87028
  this.renderTabComponents = list => list.map(panel => this.renderTabItem(panel));
86935
87029
 
86936
87030
  this.handleArrowClick = (items, pos) => {
86937
- const inline = pos === 'start' ? 'end' : 'start';
86938
87031
  const lastItem = pos === 'start' ? items.pop() : items.shift();
86939
87032
 
86940
87033
  if (!lastItem) {
@@ -86948,7 +87041,7 @@ class TabBar_TabBar extends external_root_React_commonjs2_react_commonjs_react_a
86948
87041
  tabItem.scrollIntoView({
86949
87042
  behavior: 'smooth',
86950
87043
  block: 'nearest',
86951
- inline
87044
+ inline: 'nearest'
86952
87045
  });
86953
87046
  };
86954
87047
 
@@ -93666,7 +93759,9 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93666
93759
  maxTagCount,
93667
93760
  checkRelation,
93668
93761
  showRestTagsPopover,
93669
- restTagsPopoverProps
93762
+ restTagsPopoverProps,
93763
+ searchPosition,
93764
+ filterTreeNode
93670
93765
  } = this.props;
93671
93766
  const {
93672
93767
  keyEntities,
@@ -93680,8 +93775,16 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93680
93775
  keyList = normalizeKeyList(checkedKeys, keyEntities, leafOnly);
93681
93776
  } else if (checkRelation === 'unRelated') {
93682
93777
  keyList = [...realCheckedKeys];
93683
- }
93778
+ } // auto focus search input divide into two parts
93779
+ // 1. filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER
93780
+ // Implemented by passing autofocus to the underlying input's autofocus
93781
+ // 2. filterTreeNode && searchPosition === strings.SEARCH_POSITION_DROPDOWN
93782
+ // Due to the off-screen rendering in the tooltip implementation mechanism, if it is implemented through the
93783
+ // autofocus of the input, when the option panel is opened, the page will scroll to top, so it is necessary
93784
+ // to call the focus method through ref in the onVisibleChange callback of the Popover to achieve focus
93684
93785
 
93786
+
93787
+ const autoFocus = filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_TRIGGER ? searchAutoFocus : undefined;
93685
93788
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(tagInput_0, {
93686
93789
  maxTagCount: maxTagCount,
93687
93790
  disabled: disabled,
@@ -93694,7 +93797,7 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93694
93797
  showRestTagsPopover: showRestTagsPopover,
93695
93798
  restTagsPopoverProps: restTagsPopoverProps,
93696
93799
  // eslint-disable-next-line jsx-a11y/no-autofocus
93697
- autoFocus: searchAutoFocus,
93800
+ autoFocus: autoFocus,
93698
93801
  renderTagItem: (itemKey, index) => this.renderTagItem(itemKey, index),
93699
93802
  onRemove: itemKey => this.removeTag(itemKey),
93700
93803
  expandRestTagsOnClick: false
@@ -93730,6 +93833,7 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93730
93833
  prefix: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconSearch, null)
93731
93834
  };
93732
93835
  const inputTriggerProps = {
93836
+ autofocus: searchAutoFocus,
93733
93837
  onFocus: e => this.foundation.handleInputTriggerFocus(),
93734
93838
  onBlur: e => this.foundation.handleInputTriggerBlur(),
93735
93839
  disabled
@@ -93761,7 +93865,6 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93761
93865
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(input_0, Object.assign({
93762
93866
  "aria-label": 'Filter TreeSelect item',
93763
93867
  ref: this.inputRef,
93764
- autofocus: searchAutoFocus,
93765
93868
  placeholder: placeholder
93766
93869
  }, baseInputProps, realInputProps));
93767
93870
  }));
@@ -93835,12 +93938,18 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
93835
93938
 
93836
93939
  this.handlePopoverClose = isVisible => {
93837
93940
  const {
93838
- filterTreeNode
93941
+ filterTreeNode,
93942
+ searchAutoFocus,
93943
+ searchPosition
93839
93944
  } = this.props;
93840
93945
 
93841
93946
  if (isVisible === false && Boolean(filterTreeNode)) {
93842
93947
  this.foundation.clearInput();
93843
93948
  }
93949
+
93950
+ if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
93951
+ this.foundation.focusInput(true);
93952
+ }
93844
93953
  };
93845
93954
 
93846
93955
  this.renderTreeNode = (treeNode, ind, style) => {
@@ -94304,7 +94413,25 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
94304
94413
  isHovering: bool
94305
94414
  });
94306
94415
  },
94307
- updateInputFocus: bool => {} // eslint-disable-line
94416
+ updateInputFocus: bool => {
94417
+ if (bool) {
94418
+ if (this.inputRef && this.inputRef.current) {
94419
+ this.inputRef.current.focus();
94420
+ }
94421
+
94422
+ if (this.tagInputRef && this.tagInputRef.current) {
94423
+ this.tagInputRef.current.focus();
94424
+ }
94425
+ } else {
94426
+ if (this.inputRef && this.inputRef.current) {
94427
+ this.inputRef.current.blur();
94428
+ }
94429
+
94430
+ if (this.tagInputRef && this.tagInputRef.current) {
94431
+ this.tagInputRef.current.blur();
94432
+ }
94433
+ }
94434
+ } // eslint-disable-line
94308
94435
 
94309
94436
  });
94310
94437
  }
@@ -103108,7 +103235,7 @@ class preview_Preview extends baseComponent_BaseComponent {
103108
103235
  const finalSrcList = [...srcArr, ...srcListInChildren];
103109
103236
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(PreviewContext.Provider, {
103110
103237
  value: {
103111
- isGroup: finalSrcList.length > 1,
103238
+ isGroup: true,
103112
103239
  previewSrc: finalSrcList,
103113
103240
  titles: titles,
103114
103241
  currentIndex,