@douyinfe/semi-ui 2.38.3-alpha.2-patch-modal → 2.38.3-alpha.2-patch-select-max

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.
Files changed (69) hide show
  1. package/dist/umd/semi-ui.js +25 -19
  2. package/dist/umd/semi-ui.js.map +1 -1
  3. package/dist/umd/semi-ui.min.js +1 -1
  4. package/dist/umd/semi-ui.min.js.map +1 -1
  5. package/lib/cjs/anchor/index.d.ts +1 -1
  6. package/lib/cjs/autoComplete/index.d.ts +1 -1
  7. package/lib/cjs/button/Button.d.ts +1 -1
  8. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  9. package/lib/cjs/button/index.d.ts +1 -1
  10. package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
  11. package/lib/cjs/carousel/index.d.ts +1 -1
  12. package/lib/cjs/cascader/index.d.ts +1 -1
  13. package/lib/cjs/cascader/item.d.ts +1 -1
  14. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  15. package/lib/cjs/datePicker/datePicker.d.ts +2 -2
  16. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  17. package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
  18. package/lib/cjs/form/baseForm.d.ts +1 -1
  19. package/lib/cjs/form/field.d.ts +1 -1
  20. package/lib/cjs/input/index.d.ts +1 -1
  21. package/lib/cjs/input/inputGroup.d.ts +1 -1
  22. package/lib/cjs/modal/Modal.js +6 -9
  23. package/lib/cjs/modal/ModalContent.js +4 -5
  24. package/lib/cjs/modal/confirm.d.ts +20 -20
  25. package/lib/cjs/popover/index.d.ts +1 -1
  26. package/lib/cjs/rating/index.d.ts +1 -1
  27. package/lib/cjs/rating/item.d.ts +1 -1
  28. package/lib/cjs/switch/index.d.ts +1 -1
  29. package/lib/cjs/table/Table.d.ts +2 -2
  30. package/lib/cjs/table/index.d.ts +1 -1
  31. package/lib/cjs/tagInput/index.d.ts +1 -1
  32. package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
  33. package/lib/cjs/timePicker/index.d.ts +1 -1
  34. package/lib/cjs/tooltip/index.d.ts +1 -1
  35. package/lib/cjs/treeSelect/index.js +4 -0
  36. package/lib/cjs/typography/title.d.ts +1 -1
  37. package/lib/es/anchor/index.d.ts +1 -1
  38. package/lib/es/autoComplete/index.d.ts +1 -1
  39. package/lib/es/button/Button.d.ts +1 -1
  40. package/lib/es/button/buttonGroup.d.ts +1 -1
  41. package/lib/es/button/index.d.ts +1 -1
  42. package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
  43. package/lib/es/carousel/index.d.ts +1 -1
  44. package/lib/es/cascader/index.d.ts +1 -1
  45. package/lib/es/cascader/item.d.ts +1 -1
  46. package/lib/es/datePicker/dateInput.d.ts +1 -1
  47. package/lib/es/datePicker/datePicker.d.ts +2 -2
  48. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  49. package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
  50. package/lib/es/form/baseForm.d.ts +1 -1
  51. package/lib/es/form/field.d.ts +1 -1
  52. package/lib/es/input/index.d.ts +1 -1
  53. package/lib/es/input/inputGroup.d.ts +1 -1
  54. package/lib/es/modal/Modal.js +6 -9
  55. package/lib/es/modal/ModalContent.js +4 -5
  56. package/lib/es/modal/confirm.d.ts +20 -20
  57. package/lib/es/popover/index.d.ts +1 -1
  58. package/lib/es/rating/index.d.ts +1 -1
  59. package/lib/es/rating/item.d.ts +1 -1
  60. package/lib/es/switch/index.d.ts +1 -1
  61. package/lib/es/table/Table.d.ts +2 -2
  62. package/lib/es/table/index.d.ts +1 -1
  63. package/lib/es/tagInput/index.d.ts +1 -1
  64. package/lib/es/timePicker/TimePicker.d.ts +1 -1
  65. package/lib/es/timePicker/index.d.ts +1 -1
  66. package/lib/es/tooltip/index.d.ts +1 -1
  67. package/lib/es/treeSelect/index.js +4 -0
  68. package/lib/es/typography/title.d.ts +1 -1
  69. package/package.json +8 -8
@@ -57149,21 +57149,20 @@ class ModalContent extends BaseComponent {
57149
57149
  this.foundation.destroy();
57150
57150
  }
57151
57151
  render() {
57152
- var _a;
57153
- const _b = this.props,
57152
+ const _a = this.props,
57154
57153
  {
57155
57154
  maskClosable,
57156
57155
  className,
57157
57156
  getPopupContainer,
57158
57157
  maskFixed,
57159
57158
  getContainerContext
57160
- } = _b,
57161
- rest = ModalContent_rest(_b, ["maskClosable", "className", "getPopupContainer", "maskFixed", "getContainerContext"]);
57159
+ } = _a,
57160
+ rest = ModalContent_rest(_a, ["maskClosable", "className", "getPopupContainer", "maskFixed", "getContainerContext"]);
57162
57161
  const {
57163
57162
  direction
57164
57163
  } = this.context;
57165
57164
  const classList = classnames_default()(className, {
57166
- [`${modal_constants_cssClasses.DIALOG}-popup`]: getPopupContainer && getPopupContainer() !== ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body) && !maskFixed,
57165
+ [`${modal_constants_cssClasses.DIALOG}-popup`]: getPopupContainer && !maskFixed,
57167
57166
  [`${modal_constants_cssClasses.DIALOG}-fixed`]: maskFixed,
57168
57167
  [`${modal_constants_cssClasses.DIALOG}-rtl`]: direction === 'rtl'
57169
57168
  });
@@ -57564,8 +57563,7 @@ class Modal extends BaseComponent {
57564
57563
  // return <ModalContent {...restProps} footer={renderFooter} onClose={this.handleCancel}/>;
57565
57564
  // };
57566
57565
  this.renderDialog = () => {
57567
- var _a;
57568
- let _b = this.props,
57566
+ let _a = this.props,
57569
57567
  {
57570
57568
  footer,
57571
57569
  className,
@@ -57576,15 +57574,15 @@ class Modal extends BaseComponent {
57576
57574
  zIndex,
57577
57575
  getPopupContainer,
57578
57576
  visible
57579
- } = _b,
57580
- restProps = Modal_rest(_b, ["footer", "className", "motion", "maskStyle", "keepDOM", "style", "zIndex", "getPopupContainer", "visible"]);
57577
+ } = _a,
57578
+ restProps = Modal_rest(_a, ["footer", "className", "motion", "maskStyle", "keepDOM", "style", "zIndex", "getPopupContainer", "visible"]);
57581
57579
  let style = styleFromProps;
57582
57580
  const maskStyle = maskStyleFromProps;
57583
57581
  const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
57584
57582
  let wrapperStyle = {
57585
57583
  zIndex
57586
57584
  };
57587
- if (getPopupContainer && getPopupContainer() !== ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) {
57585
+ if (getPopupContainer) {
57588
57586
  wrapperStyle = {
57589
57587
  zIndex,
57590
57588
  position: 'static'
@@ -57655,22 +57653,20 @@ class Modal extends BaseComponent {
57655
57653
  return Object.assign(Object.assign({}, super.adapter), {
57656
57654
  getProps: () => this.props,
57657
57655
  disabledBodyScroll: () => {
57658
- var _a;
57659
57656
  const {
57660
57657
  getPopupContainer
57661
57658
  } = this.props;
57662
57659
  this.bodyOverflow = document.body.style.overflow || '';
57663
- if ((!getPopupContainer || getPopupContainer() === ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) && this.bodyOverflow !== 'hidden') {
57660
+ if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
57664
57661
  document.body.style.overflow = 'hidden';
57665
57662
  document.body.style.width = `calc(${this.originBodyWidth || '100%'} - ${this.scrollBarWidth}px)`;
57666
57663
  }
57667
57664
  },
57668
57665
  enabledBodyScroll: () => {
57669
- var _a;
57670
57666
  const {
57671
57667
  getPopupContainer
57672
57668
  } = this.props;
57673
- if ((!getPopupContainer || getPopupContainer() === ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
57669
+ if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
57674
57670
  document.body.style.overflow = this.bodyOverflow;
57675
57671
  document.body.style.width = this.originBodyWidth;
57676
57672
  }
@@ -66820,7 +66816,7 @@ class SelectFoundation extends foundation {
66820
66816
  label
66821
66817
  }, rest));
66822
66818
  selections.delete(label);
66823
- } else if (maxLimit && selections.size === maxLimit) {
66819
+ } else if (maxLimit && selections.size >= maxLimit) {
66824
66820
  this._adapter.notifyMaxLimit(Object.assign({
66825
66821
  value,
66826
66822
  label
@@ -86654,7 +86650,7 @@ const treeSelect_constants_numbers = {};
86654
86650
  class TreeSelectFoundation extends foundation {
86655
86651
  constructor(adapter) {
86656
86652
  super(Object.assign({}, adapter));
86657
- this._registerClickOutsideHandler = e => {
86653
+ this._registerClickOutsideHandler = () => {
86658
86654
  this._adapter.registerClickOutsideHandler(e => {
86659
86655
  this.handlerTriggerBlur(e);
86660
86656
  this.close(e);
@@ -86670,11 +86666,13 @@ class TreeSelectFoundation extends foundation {
86670
86666
  const triggerSearch = searchPosition === treeSelect_constants_strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
86671
86667
  const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
86672
86668
  this._setDropdownWidth();
86673
- const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
86669
+ const able = !this._isDisabled();
86670
+ const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
86674
86671
  if (isOpen) {
86675
86672
  this.open();
86673
+ this._registerClickOutsideHandler();
86676
86674
  }
86677
- if (triggerSearchAutoFocus) {
86675
+ if (triggerSearchAutoFocus && able) {
86678
86676
  this.handleTriggerFocus(null);
86679
86677
  }
86680
86678
  }
@@ -86905,7 +86903,7 @@ class TreeSelectFoundation extends foundation {
86905
86903
  handleTriggerFocus(e) {
86906
86904
  this._adapter.updateIsFocus(true);
86907
86905
  this._notifyFocus(e);
86908
- this._registerClickOutsideHandler(e);
86906
+ this._registerClickOutsideHandler();
86909
86907
  }
86910
86908
  // Scenes that may trigger blur
86911
86909
  // 1、clickOutSide
@@ -86915,6 +86913,10 @@ class TreeSelectFoundation extends foundation {
86915
86913
  this._adapter.notifyBlur(e);
86916
86914
  }
86917
86915
  handlerTriggerBlur(e) {
86916
+ const isFocus = this.getState('isFocus');
86917
+ if (!isFocus) {
86918
+ return;
86919
+ }
86918
86920
  this._adapter.updateIsFocus(false);
86919
86921
  this._notifyBlur(e);
86920
86922
  this._adapter.unregisterClickOutsideHandler();
@@ -88416,6 +88418,7 @@ class TreeSelect extends BaseComponent {
88416
88418
  };
88417
88419
  const treeSelectAdapter = {
88418
88420
  registerClickOutsideHandler: cb => {
88421
+ this.adapter.unregisterClickOutsideHandler();
88419
88422
  const clickOutsideHandler = e => {
88420
88423
  const optionInstance = this.optionsRef && this.optionsRef.current;
88421
88424
  const triggerDom = this.triggerRef && this.triggerRef.current;
@@ -88430,6 +88433,9 @@ class TreeSelect extends BaseComponent {
88430
88433
  document.addEventListener('mousedown', clickOutsideHandler, false);
88431
88434
  },
88432
88435
  unregisterClickOutsideHandler: () => {
88436
+ if (!this.clickOutsideHandler) {
88437
+ return;
88438
+ }
88433
88439
  document.removeEventListener('mousedown', this.clickOutsideHandler, false);
88434
88440
  this.clickOutsideHandler = null;
88435
88441
  },