@douyinfe/semi-ui 2.55.5 → 2.56.0-beta.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.
@@ -20518,7 +20518,10 @@ class Tooltip extends BaseComponent {
20518
20518
  let popupEl = this.containerEl && this.containerEl.current;
20519
20519
  el = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(el);
20520
20520
  popupEl = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(popupEl);
20521
- if (el && !el.contains(e.target) && popupEl && !popupEl.contains(e.target) || this.props.clickTriggerToHide && el && el.contains(e.target)) {
20521
+ const target = e.target;
20522
+ const path = e.composedPath && e.composedPath() || [target];
20523
+ const isClickTriggerToHide = this.props.clickTriggerToHide ? el && el.contains(target) || path.includes(el) : false;
20524
+ if (el && !el.contains(target) && popupEl && !popupEl.contains(target) && !(path.includes(popupEl) || path.includes(el)) || isClickTriggerToHide) {
20522
20525
  this.props.onClickOutSide(e);
20523
20526
  cb();
20524
20527
  }
@@ -26241,7 +26244,8 @@ class AutoComplete extends BaseComponent {
26241
26244
  const triggerDom = this.triggerRef && this.triggerRef.current;
26242
26245
  const optionsDom = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(optionInstance);
26243
26246
  const target = e.target;
26244
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
26247
+ const path = e.composedPath && e.composedPath() || [target];
26248
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
26245
26249
  cb(e);
26246
26250
  }
26247
26251
  };
@@ -28082,6 +28086,7 @@ function IconChevronUp_SvgComponent(props) {
28082
28086
  const IconChevronUp_IconComponent = convertIcon(IconChevronUp_SvgComponent, 'chevron_up');
28083
28087
  /* harmony default export */ const IconChevronUp = (IconChevronUp_IconComponent);
28084
28088
  ;// CONCATENATED MODULE: ./backtop/index.tsx
28089
+
28085
28090
  var backtop_rest = undefined && undefined.__rest || function (s, e) {
28086
28091
  var t = {};
28087
28092
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -28111,7 +28116,9 @@ class BackTop extends BaseComponent {
28111
28116
  this.foundation = new BackTopFoundation(this.adapter);
28112
28117
  }
28113
28118
  componentDidMount() {
28119
+ var _a;
28114
28120
  this.foundation.init();
28121
+ this.handler = throttle_default()(this.handleClick, (_a = this.props.duration) !== null && _a !== void 0 ? _a : BackTop.defaultProps.duration);
28115
28122
  }
28116
28123
  componentWillUnmount() {
28117
28124
  this.foundation.destroy();
@@ -28169,7 +28176,7 @@ class BackTop extends BaseComponent {
28169
28176
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({}, others, {
28170
28177
  className: preCls,
28171
28178
  style: style,
28172
- onClick: e => this.handleClick(e),
28179
+ onClick: e => this.handler(e),
28173
28180
  "x-semi-prop": "children"
28174
28181
  }), backtopBtn) : null;
28175
28182
  return content;
@@ -34012,7 +34019,9 @@ class monthCalendar extends BaseComponent {
34012
34019
  const clickOutsideHandler = e => {
34013
34020
  const cardInstance = this.cardRef && this.cardRef.get(key);
34014
34021
  const cardDom = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(cardInstance);
34015
- if (cardDom && !cardDom.contains(e.target)) {
34022
+ const target = e.target;
34023
+ const path = e.composedPath && e.composedPath() || [target];
34024
+ if (cardDom && !cardDom.contains(target) && !path.includes(cardDom)) {
34016
34025
  cb();
34017
34026
  }
34018
34027
  };
@@ -46700,7 +46709,8 @@ class TagInput extends BaseComponent {
46700
46709
  const clickOutsideHandler = e => {
46701
46710
  const tagInputDom = this.tagInputRef && this.tagInputRef.current;
46702
46711
  const target = e.target;
46703
- if (tagInputDom && !tagInputDom.contains(target)) {
46712
+ const path = e.composedPath && e.composedPath() || [target];
46713
+ if (tagInputDom && !tagInputDom.contains(target) && !path.includes(tagInputDom)) {
46704
46714
  cb(e);
46705
46715
  }
46706
46716
  };
@@ -47575,7 +47585,8 @@ class Cascader extends BaseComponent {
47575
47585
  const triggerDom = this.triggerRef && this.triggerRef.current;
47576
47586
  const optionsDom = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(optionInstance);
47577
47587
  const target = e.target;
47578
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
47588
+ const path = e.composedPath && e.composedPath() || [target];
47589
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
47579
47590
  cb(e);
47580
47591
  }
47581
47592
  };
@@ -60110,15 +60121,11 @@ class DatePicker extends BaseComponent {
60110
60121
  this.clickOutSideHandler = e => {
60111
60122
  const triggerEl = this.triggerElRef && this.triggerElRef.current;
60112
60123
  const panelEl = this.panelRef && this.panelRef.current;
60113
- const isInTrigger = triggerEl && triggerEl.contains(e.target);
60114
- const isInPanel = panelEl && panelEl.contains(e.target);
60115
- const clickOutSide = !isInTrigger && !isInPanel && this._mounted;
60116
- if (this.adapter.needConfirm()) {
60117
- clickOutSide && this.props.onClickOutSide();
60118
- return;
60119
- } else {
60120
- if (clickOutSide) {
60121
- this.props.onClickOutSide();
60124
+ const target = e.target;
60125
+ const path = e.composedPath && e.composedPath() || [target];
60126
+ if (!(triggerEl && triggerEl.contains(target)) && !(panelEl && panelEl.contains(target)) && !(path.includes(triggerEl) || path.includes(panelEl))) {
60127
+ this.props.onClickOutSide();
60128
+ if (!this.adapter.needConfirm()) {
60122
60129
  this.foundation.closePanel(e);
60123
60130
  }
60124
60131
  }
@@ -70923,9 +70930,9 @@ class Select extends BaseComponent {
70923
70930
  const optionInstance = this.optionsRef && this.optionsRef.current;
70924
70931
  const triggerDom = this.triggerRef && this.triggerRef.current;
70925
70932
  const optionsDom = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(optionInstance);
70926
- // let isInPanel = optionsDom && optionsDom.contains(e.target);
70927
- // let isInTrigger = triggerDom && triggerDom.contains(e.target);
70928
- if (optionsDom && !optionsDom.contains(e.target) && triggerDom && !triggerDom.contains(e.target)) {
70933
+ const target = e.target;
70934
+ const path = e.composedPath && e.composedPath() || [target];
70935
+ if (!(optionsDom && optionsDom.contains(target)) && !(triggerDom && triggerDom.contains(target)) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
70929
70936
  cb(e);
70930
70937
  }
70931
70938
  };
@@ -86589,6 +86596,7 @@ class TimePicker extends BaseComponent {
86589
86596
  this.foundation = new timePicker_foundation(this.adapter);
86590
86597
  this.timePickerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
86591
86598
  this.savePanelRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
86599
+ this.useCustomTrigger = typeof this.props.triggerRender === 'function';
86592
86600
  }
86593
86601
  get adapter() {
86594
86602
  var _this2 = this;
@@ -86604,11 +86612,11 @@ class TimePicker extends BaseComponent {
86604
86612
  }
86605
86613
  this.clickOutSideHandler = e => {
86606
86614
  const panel = this.savePanelRef && this.savePanelRef.current;
86607
- const isInPanel = e.target && panel && panel.contains(e.target);
86608
- const isInTimepicker = this.timePickerRef && this.timePickerRef.current && this.timePickerRef.current.contains(e.target);
86609
- if (!isInTimepicker && !isInPanel) {
86610
- const clickedOutside = true;
86611
- this.foundation.handlePanelClose(clickedOutside, e);
86615
+ const trigger = this.timePickerRef && this.timePickerRef.current;
86616
+ const target = e.target;
86617
+ const path = e.composedPath && e.composedPath() || [target];
86618
+ if (!(panel && panel.contains(target)) && !(trigger && trigger.contains(target)) && !(path.includes(trigger) || path.includes(panel))) {
86619
+ this.foundation.handlePanelClose(true, e);
86612
86620
  }
86613
86621
  };
86614
86622
  document.addEventListener('mousedown', this.clickOutSideHandler);
@@ -86772,7 +86780,6 @@ class TimePicker extends BaseComponent {
86772
86780
  rest = TimePicker_rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "dropdownMargin", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "onChangeWithDateFirst", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow", "stopPropagation"]);
86773
86781
  const format = this.foundation.getDefaultFormatIfNeed();
86774
86782
  const position = this.foundation.getPosition();
86775
- const useCustomTrigger = typeof triggerRender === 'function';
86776
86783
  const {
86777
86784
  open,
86778
86785
  inputValue,
@@ -86806,7 +86813,7 @@ class TimePicker extends BaseComponent {
86806
86813
  onBlur: this.handleBlur
86807
86814
  });
86808
86815
  const outerProps = {};
86809
- if (useCustomTrigger) {
86816
+ if (this.useCustomTrigger) {
86810
86817
  outerProps.onClick = this.openPanel;
86811
86818
  }
86812
86819
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
@@ -86829,7 +86836,7 @@ class TimePicker extends BaseComponent {
86829
86836
  margin: dropdownMargin,
86830
86837
  autoAdjustOverflow: autoAdjustOverflow,
86831
86838
  stopPropagation: stopPropagation
86832
- }, useCustomTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger, {
86839
+ }, this.useCustomTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger, {
86833
86840
  triggerRender: triggerRender,
86834
86841
  disabled: disabled,
86835
86842
  value: value,
@@ -91806,7 +91813,8 @@ class TreeSelect extends BaseComponent {
91806
91813
  const triggerDom = this.triggerRef && this.triggerRef.current;
91807
91814
  const optionsDom = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(optionInstance);
91808
91815
  const target = e.target;
91809
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
91816
+ const path = e.composedPath && e.composedPath() || [target];
91817
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
91810
91818
  cb(e);
91811
91819
  }
91812
91820
  };