@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.
@@ -1,7 +1,7 @@
1
1
  /* shadow */
2
2
  /* sizing */
3
3
  /* spacing */
4
- body {
4
+ body, :host {
5
5
  --semi-transition_duration-slowest:0ms;
6
6
  --semi-transition_duration-slower:0ms;
7
7
  --semi-transition_duration-slow:0ms;
@@ -38,8 +38,7 @@ body {
38
38
  --semi-transform_rotate-anticlockwise360deg:rotate(-360deg);
39
39
  }
40
40
 
41
- body,
42
- body .semi-always-light {
41
+ body, body .semi-always-light, :host, :host .semi-always-light {
43
42
  --semi-amber-0: 254,251,235;
44
43
  --semi-amber-1: 252,245,206;
45
44
  --semi-amber-2: 249,232,158;
@@ -204,8 +203,7 @@ body .semi-always-light {
204
203
  --semi-yellow-9: 83,72,0;
205
204
  }
206
205
 
207
- body[theme-mode=dark],
208
- body .semi-always-dark {
206
+ body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
209
207
  --semi-red-0: 108,9,11;
210
208
  --semi-red-1: 144,17,16;
211
209
  --semi-red-2: 180,32,25;
@@ -370,7 +368,7 @@ body .semi-always-dark {
370
368
  --semi-black: 0, 0, 0;
371
369
  }
372
370
 
373
- body, body[theme-mode=dark] .semi-always-light {
371
+ body, body[theme-mode=dark] .semi-always-light, :host, :host .semi-always-light {
374
372
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
375
373
  -webkit-font-smoothing: antialiased;
376
374
  --semi-color-white: rgba(var(--semi-white), 1);
@@ -480,7 +478,7 @@ body, body[theme-mode=dark] .semi-always-light {
480
478
  --semi-color-data-19: rgba(188, 198, 255, 1);
481
479
  }
482
480
 
483
- body[theme-mode=dark], body .semi-always-dark {
481
+ body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
484
482
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
485
483
  -webkit-font-smoothing: antialiased;
486
484
  --semi-color-white: rgba(228, 231, 245, 1);
@@ -154,7 +154,8 @@ class AutoComplete extends _baseComponent.default {
154
154
  const triggerDom = this.triggerRef && this.triggerRef.current;
155
155
  const optionsDom = _reactDom.default.findDOMNode(optionInstance);
156
156
  const target = e.target;
157
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
157
+ const path = e.composedPath && e.composedPath() || [target];
158
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
158
159
  cb(e);
159
160
  }
160
161
  };
@@ -26,6 +26,7 @@ export default class BackTop extends BaseComponent<BackTopProps, BackTopState> {
26
26
  style: PropTypes.Requireable<object>;
27
27
  className: PropTypes.Requireable<string>;
28
28
  };
29
+ handler: (e: React.MouseEvent<HTMLDivElement>) => void;
29
30
  constructor(props: BackTopProps);
30
31
  componentDidMount(): void;
31
32
  componentWillUnmount(): void;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
7
8
  var _react = _interopRequireDefault(require("react"));
8
9
  var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
9
10
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -34,7 +35,9 @@ class BackTop extends _baseComponent.default {
34
35
  this.foundation = new _foundation.default(this.adapter);
35
36
  }
36
37
  componentDidMount() {
38
+ var _a;
37
39
  this.foundation.init();
40
+ this.handler = (0, _throttle2.default)(this.handleClick, (_a = this.props.duration) !== null && _a !== void 0 ? _a : BackTop.defaultProps.duration);
38
41
  }
39
42
  componentWillUnmount() {
40
43
  this.foundation.destroy();
@@ -92,7 +95,7 @@ class BackTop extends _baseComponent.default {
92
95
  _react.default.createElement("div", Object.assign({}, others, {
93
96
  className: preCls,
94
97
  style: style,
95
- onClick: e => this.handleClick(e),
98
+ onClick: e => this.handler(e),
96
99
  "x-semi-prop": "children"
97
100
  }), backtopBtn) : null;
98
101
  return content;
@@ -287,7 +287,9 @@ class monthCalendar extends _baseComponent.default {
287
287
  const clickOutsideHandler = e => {
288
288
  const cardInstance = this.cardRef && this.cardRef.get(key);
289
289
  const cardDom = _reactDom.default.findDOMNode(cardInstance);
290
- if (cardDom && !cardDom.contains(e.target)) {
290
+ const target = e.target;
291
+ const path = e.composedPath && e.composedPath() || [target];
292
+ if (cardDom && !cardDom.contains(target) && !path.includes(cardDom)) {
291
293
  cb();
292
294
  }
293
295
  };
@@ -570,7 +570,8 @@ class Cascader extends _baseComponent.default {
570
570
  const triggerDom = this.triggerRef && this.triggerRef.current;
571
571
  const optionsDom = _reactDom.default.findDOMNode(optionInstance);
572
572
  const target = e.target;
573
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
573
+ const path = e.composedPath && e.composedPath() || [target];
574
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
574
575
  cb(e);
575
576
  }
576
577
  };
@@ -274,15 +274,11 @@ class DatePicker extends _baseComponent.default {
274
274
  this.clickOutSideHandler = e => {
275
275
  const triggerEl = this.triggerElRef && this.triggerElRef.current;
276
276
  const panelEl = this.panelRef && this.panelRef.current;
277
- const isInTrigger = triggerEl && triggerEl.contains(e.target);
278
- const isInPanel = panelEl && panelEl.contains(e.target);
279
- const clickOutSide = !isInTrigger && !isInPanel && this._mounted;
280
- if (this.adapter.needConfirm()) {
281
- clickOutSide && this.props.onClickOutSide();
282
- return;
283
- } else {
284
- if (clickOutSide) {
285
- this.props.onClickOutSide();
277
+ const target = e.target;
278
+ const path = e.composedPath && e.composedPath() || [target];
279
+ if (!(triggerEl && triggerEl.contains(target)) && !(panelEl && panelEl.contains(target)) && !(path.includes(triggerEl) || path.includes(panelEl))) {
280
+ this.props.onClickOutSide();
281
+ if (!this.adapter.needConfirm()) {
286
282
  this.foundation.closePanel(e);
287
283
  }
288
284
  }
@@ -196,9 +196,9 @@ class Select extends _baseComponent.default {
196
196
  const optionInstance = this.optionsRef && this.optionsRef.current;
197
197
  const triggerDom = this.triggerRef && this.triggerRef.current;
198
198
  const optionsDom = _reactDom.default.findDOMNode(optionInstance);
199
- // let isInPanel = optionsDom && optionsDom.contains(e.target);
200
- // let isInTrigger = triggerDom && triggerDom.contains(e.target);
201
- if (optionsDom && !optionsDom.contains(e.target) && triggerDom && !triggerDom.contains(e.target)) {
199
+ const target = e.target;
200
+ const path = e.composedPath && e.composedPath() || [target];
201
+ if (!(optionsDom && optionsDom.contains(target)) && !(triggerDom && triggerDom.contains(target)) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
202
202
  cb(e);
203
203
  }
204
204
  };
@@ -270,7 +270,8 @@ class TagInput extends _baseComponent.default {
270
270
  const clickOutsideHandler = e => {
271
271
  const tagInputDom = this.tagInputRef && this.tagInputRef.current;
272
272
  const target = e.target;
273
- if (tagInputDom && !tagInputDom.contains(target)) {
273
+ const path = e.composedPath && e.composedPath() || [target];
274
+ if (tagInputDom && !tagInputDom.contains(target) && !path.includes(tagInputDom)) {
274
275
  cb(e);
275
276
  }
276
277
  };
@@ -193,6 +193,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
193
193
  foundation: TimePickerFoundation;
194
194
  timePickerRef: React.MutableRefObject<HTMLDivElement>;
195
195
  savePanelRef: React.RefObject<HTMLDivElement>;
196
+ useCustomTrigger: boolean;
196
197
  clickOutSideHandler: (e: MouseEvent) => void;
197
198
  constructor(props: TimePickerProps);
198
199
  get adapter(): TimePickerAdapter<TimePickerProps, TimePickerState>;
@@ -92,6 +92,7 @@ class TimePicker extends _baseComponent.default {
92
92
  this.foundation = new _foundation.default(this.adapter);
93
93
  this.timePickerRef = /*#__PURE__*/_react.default.createRef();
94
94
  this.savePanelRef = /*#__PURE__*/_react.default.createRef();
95
+ this.useCustomTrigger = typeof this.props.triggerRender === 'function';
95
96
  }
96
97
  get adapter() {
97
98
  var _this2 = this;
@@ -107,11 +108,11 @@ class TimePicker extends _baseComponent.default {
107
108
  }
108
109
  this.clickOutSideHandler = e => {
109
110
  const panel = this.savePanelRef && this.savePanelRef.current;
110
- const isInPanel = e.target && panel && panel.contains(e.target);
111
- const isInTimepicker = this.timePickerRef && this.timePickerRef.current && this.timePickerRef.current.contains(e.target);
112
- if (!isInTimepicker && !isInPanel) {
113
- const clickedOutside = true;
114
- this.foundation.handlePanelClose(clickedOutside, e);
111
+ const trigger = this.timePickerRef && this.timePickerRef.current;
112
+ const target = e.target;
113
+ const path = e.composedPath && e.composedPath() || [target];
114
+ if (!(panel && panel.contains(target)) && !(trigger && trigger.contains(target)) && !(path.includes(trigger) || path.includes(panel))) {
115
+ this.foundation.handlePanelClose(true, e);
115
116
  }
116
117
  };
117
118
  document.addEventListener('mousedown', this.clickOutSideHandler);
@@ -275,7 +276,6 @@ class TimePicker extends _baseComponent.default {
275
276
  rest = __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"]);
276
277
  const format = this.foundation.getDefaultFormatIfNeed();
277
278
  const position = this.foundation.getPosition();
278
- const useCustomTrigger = typeof triggerRender === 'function';
279
279
  const {
280
280
  open,
281
281
  inputValue,
@@ -309,7 +309,7 @@ class TimePicker extends _baseComponent.default {
309
309
  onBlur: this.handleBlur
310
310
  });
311
311
  const outerProps = {};
312
- if (useCustomTrigger) {
312
+ if (this.useCustomTrigger) {
313
313
  outerProps.onClick = this.openPanel;
314
314
  }
315
315
  return /*#__PURE__*/_react.default.createElement("div", Object.assign({
@@ -332,7 +332,7 @@ class TimePicker extends _baseComponent.default {
332
332
  margin: dropdownMargin,
333
333
  autoAdjustOverflow: autoAdjustOverflow,
334
334
  stopPropagation: stopPropagation
335
- }, useCustomTrigger ? /*#__PURE__*/_react.default.createElement(_trigger.default, {
335
+ }, this.useCustomTrigger ? /*#__PURE__*/_react.default.createElement(_trigger.default, {
336
336
  triggerRender: triggerRender,
337
337
  disabled: disabled,
338
338
  value: value,
@@ -432,7 +432,10 @@ class Tooltip extends _baseComponent.default {
432
432
  let popupEl = this.containerEl && this.containerEl.current;
433
433
  el = _reactDom.default.findDOMNode(el);
434
434
  popupEl = _reactDom.default.findDOMNode(popupEl);
435
- if (el && !el.contains(e.target) && popupEl && !popupEl.contains(e.target) || this.props.clickTriggerToHide && el && el.contains(e.target)) {
435
+ const target = e.target;
436
+ const path = e.composedPath && e.composedPath() || [target];
437
+ const isClickTriggerToHide = this.props.clickTriggerToHide ? el && el.contains(target) || path.includes(el) : false;
438
+ if (el && !el.contains(target) && popupEl && !popupEl.contains(target) && !(path.includes(popupEl) || path.includes(el)) || isClickTriggerToHide) {
436
439
  this.props.onClickOutSide(e);
437
440
  cb();
438
441
  }
@@ -1114,7 +1114,8 @@ class TreeSelect extends _baseComponent.default {
1114
1114
  const triggerDom = this.triggerRef && this.triggerRef.current;
1115
1115
  const optionsDom = _reactDom.default.findDOMNode(optionInstance);
1116
1116
  const target = e.target;
1117
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
1117
+ const path = e.composedPath && e.composedPath() || [target];
1118
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
1118
1119
  cb(e);
1119
1120
  }
1120
1121
  };
@@ -1,7 +1,7 @@
1
1
  /* shadow */
2
2
  /* sizing */
3
3
  /* spacing */
4
- body {
4
+ body, :host {
5
5
  --semi-transition_duration-slowest:0ms;
6
6
  --semi-transition_duration-slower:0ms;
7
7
  --semi-transition_duration-slow:0ms;
@@ -38,8 +38,7 @@ body {
38
38
  --semi-transform_rotate-anticlockwise360deg:rotate(-360deg);
39
39
  }
40
40
 
41
- body,
42
- body .semi-always-light {
41
+ body, body .semi-always-light, :host, :host .semi-always-light {
43
42
  --semi-amber-0: 254,251,235;
44
43
  --semi-amber-1: 252,245,206;
45
44
  --semi-amber-2: 249,232,158;
@@ -204,8 +203,7 @@ body .semi-always-light {
204
203
  --semi-yellow-9: 83,72,0;
205
204
  }
206
205
 
207
- body[theme-mode=dark],
208
- body .semi-always-dark {
206
+ body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
209
207
  --semi-red-0: 108,9,11;
210
208
  --semi-red-1: 144,17,16;
211
209
  --semi-red-2: 180,32,25;
@@ -370,7 +368,7 @@ body .semi-always-dark {
370
368
  --semi-black: 0, 0, 0;
371
369
  }
372
370
 
373
- body, body[theme-mode=dark] .semi-always-light {
371
+ body, body[theme-mode=dark] .semi-always-light, :host, :host .semi-always-light {
374
372
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
375
373
  -webkit-font-smoothing: antialiased;
376
374
  --semi-color-white: rgba(var(--semi-white), 1);
@@ -480,7 +478,7 @@ body, body[theme-mode=dark] .semi-always-light {
480
478
  --semi-color-data-19: rgba(188, 198, 255, 1);
481
479
  }
482
480
 
483
- body[theme-mode=dark], body .semi-always-dark {
481
+ body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
484
482
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
485
483
  -webkit-font-smoothing: antialiased;
486
484
  --semi-color-white: rgba(228, 231, 245, 1);
@@ -147,7 +147,8 @@ class AutoComplete extends BaseComponent {
147
147
  const triggerDom = this.triggerRef && this.triggerRef.current;
148
148
  const optionsDom = ReactDOM.findDOMNode(optionInstance);
149
149
  const target = e.target;
150
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
150
+ const path = e.composedPath && e.composedPath() || [target];
151
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
151
152
  cb(e);
152
153
  }
153
154
  };
@@ -26,6 +26,7 @@ export default class BackTop extends BaseComponent<BackTopProps, BackTopState> {
26
26
  style: PropTypes.Requireable<object>;
27
27
  className: PropTypes.Requireable<string>;
28
28
  };
29
+ handler: (e: React.MouseEvent<HTMLDivElement>) => void;
29
30
  constructor(props: BackTopProps);
30
31
  componentDidMount(): void;
31
32
  componentWillUnmount(): void;
@@ -1,3 +1,4 @@
1
+ import _throttle from "lodash/throttle";
1
2
  var __rest = this && this.__rest || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -27,7 +28,9 @@ export default class BackTop extends BaseComponent {
27
28
  this.foundation = new BackTopFoundation(this.adapter);
28
29
  }
29
30
  componentDidMount() {
31
+ var _a;
30
32
  this.foundation.init();
33
+ this.handler = _throttle(this.handleClick, (_a = this.props.duration) !== null && _a !== void 0 ? _a : BackTop.defaultProps.duration);
31
34
  }
32
35
  componentWillUnmount() {
33
36
  this.foundation.destroy();
@@ -85,7 +88,7 @@ export default class BackTop extends BaseComponent {
85
88
  React.createElement("div", Object.assign({}, others, {
86
89
  className: preCls,
87
90
  style: style,
88
- onClick: e => this.handleClick(e),
91
+ onClick: e => this.handler(e),
89
92
  "x-semi-prop": "children"
90
93
  }), backtopBtn) : null;
91
94
  return content;
@@ -279,7 +279,9 @@ export default class monthCalendar extends BaseComponent {
279
279
  const clickOutsideHandler = e => {
280
280
  const cardInstance = this.cardRef && this.cardRef.get(key);
281
281
  const cardDom = ReactDOM.findDOMNode(cardInstance);
282
- if (cardDom && !cardDom.contains(e.target)) {
282
+ const target = e.target;
283
+ const path = e.composedPath && e.composedPath() || [target];
284
+ if (cardDom && !cardDom.contains(target) && !path.includes(cardDom)) {
283
285
  cb();
284
286
  }
285
287
  };
@@ -561,7 +561,8 @@ class Cascader extends BaseComponent {
561
561
  const triggerDom = this.triggerRef && this.triggerRef.current;
562
562
  const optionsDom = ReactDOM.findDOMNode(optionInstance);
563
563
  const target = e.target;
564
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
564
+ const path = e.composedPath && e.composedPath() || [target];
565
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
565
566
  cb(e);
566
567
  }
567
568
  };
@@ -266,15 +266,11 @@ export default class DatePicker extends BaseComponent {
266
266
  this.clickOutSideHandler = e => {
267
267
  const triggerEl = this.triggerElRef && this.triggerElRef.current;
268
268
  const panelEl = this.panelRef && this.panelRef.current;
269
- const isInTrigger = triggerEl && triggerEl.contains(e.target);
270
- const isInPanel = panelEl && panelEl.contains(e.target);
271
- const clickOutSide = !isInTrigger && !isInPanel && this._mounted;
272
- if (this.adapter.needConfirm()) {
273
- clickOutSide && this.props.onClickOutSide();
274
- return;
275
- } else {
276
- if (clickOutSide) {
277
- this.props.onClickOutSide();
269
+ const target = e.target;
270
+ const path = e.composedPath && e.composedPath() || [target];
271
+ if (!(triggerEl && triggerEl.contains(target)) && !(panelEl && panelEl.contains(target)) && !(path.includes(triggerEl) || path.includes(panelEl))) {
272
+ this.props.onClickOutSide();
273
+ if (!this.adapter.needConfirm()) {
278
274
  this.foundation.closePanel(e);
279
275
  }
280
276
  }
@@ -187,9 +187,9 @@ class Select extends BaseComponent {
187
187
  const optionInstance = this.optionsRef && this.optionsRef.current;
188
188
  const triggerDom = this.triggerRef && this.triggerRef.current;
189
189
  const optionsDom = ReactDOM.findDOMNode(optionInstance);
190
- // let isInPanel = optionsDom && optionsDom.contains(e.target);
191
- // let isInTrigger = triggerDom && triggerDom.contains(e.target);
192
- if (optionsDom && !optionsDom.contains(e.target) && triggerDom && !triggerDom.contains(e.target)) {
190
+ const target = e.target;
191
+ const path = e.composedPath && e.composedPath() || [target];
192
+ if (!(optionsDom && optionsDom.contains(target)) && !(triggerDom && triggerDom.contains(target)) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
193
193
  cb(e);
194
194
  }
195
195
  };
@@ -263,7 +263,8 @@ class TagInput extends BaseComponent {
263
263
  const clickOutsideHandler = e => {
264
264
  const tagInputDom = this.tagInputRef && this.tagInputRef.current;
265
265
  const target = e.target;
266
- if (tagInputDom && !tagInputDom.contains(target)) {
266
+ const path = e.composedPath && e.composedPath() || [target];
267
+ if (tagInputDom && !tagInputDom.contains(target) && !path.includes(tagInputDom)) {
267
268
  cb(e);
268
269
  }
269
270
  };
@@ -193,6 +193,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
193
193
  foundation: TimePickerFoundation;
194
194
  timePickerRef: React.MutableRefObject<HTMLDivElement>;
195
195
  savePanelRef: React.RefObject<HTMLDivElement>;
196
+ useCustomTrigger: boolean;
196
197
  clickOutSideHandler: (e: MouseEvent) => void;
197
198
  constructor(props: TimePickerProps);
198
199
  get adapter(): TimePickerAdapter<TimePickerProps, TimePickerState>;
@@ -85,6 +85,7 @@ export default class TimePicker extends BaseComponent {
85
85
  this.foundation = new TimePickerFoundation(this.adapter);
86
86
  this.timePickerRef = /*#__PURE__*/React.createRef();
87
87
  this.savePanelRef = /*#__PURE__*/React.createRef();
88
+ this.useCustomTrigger = typeof this.props.triggerRender === 'function';
88
89
  }
89
90
  get adapter() {
90
91
  var _this2 = this;
@@ -100,11 +101,11 @@ export default class TimePicker extends BaseComponent {
100
101
  }
101
102
  this.clickOutSideHandler = e => {
102
103
  const panel = this.savePanelRef && this.savePanelRef.current;
103
- const isInPanel = e.target && panel && panel.contains(e.target);
104
- const isInTimepicker = this.timePickerRef && this.timePickerRef.current && this.timePickerRef.current.contains(e.target);
105
- if (!isInTimepicker && !isInPanel) {
106
- const clickedOutside = true;
107
- this.foundation.handlePanelClose(clickedOutside, e);
104
+ const trigger = this.timePickerRef && this.timePickerRef.current;
105
+ const target = e.target;
106
+ const path = e.composedPath && e.composedPath() || [target];
107
+ if (!(panel && panel.contains(target)) && !(trigger && trigger.contains(target)) && !(path.includes(trigger) || path.includes(panel))) {
108
+ this.foundation.handlePanelClose(true, e);
108
109
  }
109
110
  };
110
111
  document.addEventListener('mousedown', this.clickOutSideHandler);
@@ -268,7 +269,6 @@ export default class TimePicker extends BaseComponent {
268
269
  rest = __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"]);
269
270
  const format = this.foundation.getDefaultFormatIfNeed();
270
271
  const position = this.foundation.getPosition();
271
- const useCustomTrigger = typeof triggerRender === 'function';
272
272
  const {
273
273
  open,
274
274
  inputValue,
@@ -302,7 +302,7 @@ export default class TimePicker extends BaseComponent {
302
302
  onBlur: this.handleBlur
303
303
  });
304
304
  const outerProps = {};
305
- if (useCustomTrigger) {
305
+ if (this.useCustomTrigger) {
306
306
  outerProps.onClick = this.openPanel;
307
307
  }
308
308
  return /*#__PURE__*/React.createElement("div", Object.assign({
@@ -325,7 +325,7 @@ export default class TimePicker extends BaseComponent {
325
325
  margin: dropdownMargin,
326
326
  autoAdjustOverflow: autoAdjustOverflow,
327
327
  stopPropagation: stopPropagation
328
- }, useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
328
+ }, this.useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
329
329
  triggerRender: triggerRender,
330
330
  disabled: disabled,
331
331
  value: value,
@@ -423,7 +423,10 @@ export default class Tooltip extends BaseComponent {
423
423
  let popupEl = this.containerEl && this.containerEl.current;
424
424
  el = ReactDOM.findDOMNode(el);
425
425
  popupEl = ReactDOM.findDOMNode(popupEl);
426
- if (el && !el.contains(e.target) && popupEl && !popupEl.contains(e.target) || this.props.clickTriggerToHide && el && el.contains(e.target)) {
426
+ const target = e.target;
427
+ const path = e.composedPath && e.composedPath() || [target];
428
+ const isClickTriggerToHide = this.props.clickTriggerToHide ? el && el.contains(target) || path.includes(el) : false;
429
+ if (el && !el.contains(target) && popupEl && !popupEl.contains(target) && !(path.includes(popupEl) || path.includes(el)) || isClickTriggerToHide) {
427
430
  this.props.onClickOutSide(e);
428
431
  cb();
429
432
  }
@@ -1105,7 +1105,8 @@ class TreeSelect extends BaseComponent {
1105
1105
  const triggerDom = this.triggerRef && this.triggerRef.current;
1106
1106
  const optionsDom = ReactDOM.findDOMNode(optionInstance);
1107
1107
  const target = e.target;
1108
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
1108
+ const path = e.composedPath && e.composedPath() || [target];
1109
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
1109
1110
  cb(e);
1110
1111
  }
1111
1112
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.55.5",
3
+ "version": "2.56.0-beta.0",
4
4
  "description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,12 +20,12 @@
20
20
  "@dnd-kit/core": "^6.0.8",
21
21
  "@dnd-kit/sortable": "^7.0.2",
22
22
  "@dnd-kit/utilities": "^3.2.1",
23
- "@douyinfe/semi-animation": "2.55.5",
24
- "@douyinfe/semi-animation-react": "2.55.5",
25
- "@douyinfe/semi-foundation": "2.55.5",
26
- "@douyinfe/semi-icons": "2.55.5",
27
- "@douyinfe/semi-illustrations": "2.55.5",
28
- "@douyinfe/semi-theme-default": "2.55.5",
23
+ "@douyinfe/semi-animation": "2.56.0-beta.0",
24
+ "@douyinfe/semi-animation-react": "2.56.0-beta.0",
25
+ "@douyinfe/semi-foundation": "2.56.0-beta.0",
26
+ "@douyinfe/semi-icons": "2.56.0-beta.0",
27
+ "@douyinfe/semi-illustrations": "2.56.0-beta.0",
28
+ "@douyinfe/semi-theme-default": "2.56.0-beta.0",
29
29
  "async-validator": "^3.5.0",
30
30
  "classnames": "^2.2.6",
31
31
  "copy-text-to-clipboard": "^2.1.1",
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "author": "",
77
77
  "license": "MIT",
78
- "gitHead": "4b283dae2b36fe704607cd2a8c367a36950a759d",
78
+ "gitHead": "ae4502e3075a19370e9f4ed32fbfb1292acd06c2",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",