@douyinfe/semi-foundation 2.23.0-beta.0 → 2.23.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.
Files changed (180) hide show
  1. package/anchor/animation.scss +2 -2
  2. package/autoComplete/animation.scss +2 -2
  3. package/breadcrumb/animation.scss +2 -2
  4. package/button/animation.scss +26 -26
  5. package/carousel/animation.scss +2 -2
  6. package/cascader/animation.scss +2 -2
  7. package/cascader/cascader.scss +15 -0
  8. package/cascader/variables.scss +1 -0
  9. package/checkbox/animation.scss +4 -4
  10. package/checkbox/variables.scss +1 -1
  11. package/collapsible/animation.scss +2 -2
  12. package/datePicker/animation.scss +2 -2
  13. package/dropdown/animation.scss +1 -1
  14. package/dropdown/foundation.ts +16 -9
  15. package/dropdown/menuFoundation.ts +1 -12
  16. package/form/form.scss +3 -4
  17. package/form/rtl.scss +0 -1
  18. package/form/variables.scss +38 -35
  19. package/input/animation.scss +6 -6
  20. package/inputNumber/animation.scss +4 -4
  21. package/lib/cjs/anchor/anchor.css +1 -1
  22. package/lib/cjs/anchor/animation.scss +2 -2
  23. package/lib/cjs/autoComplete/animation.scss +2 -2
  24. package/lib/cjs/autoComplete/autoComplete.css +1 -1
  25. package/lib/cjs/breadcrumb/animation.scss +2 -2
  26. package/lib/cjs/breadcrumb/breadcrumb.css +1 -1
  27. package/lib/cjs/button/animation.scss +26 -26
  28. package/lib/cjs/button/button.css +7 -7
  29. package/lib/cjs/carousel/animation.scss +2 -2
  30. package/lib/cjs/carousel/carousel.css +6 -6
  31. package/lib/cjs/cascader/animation.scss +2 -2
  32. package/lib/cjs/cascader/cascader.css +13 -1
  33. package/lib/cjs/cascader/cascader.scss +15 -0
  34. package/lib/cjs/cascader/variables.scss +1 -0
  35. package/lib/cjs/checkbox/animation.scss +4 -4
  36. package/lib/cjs/checkbox/checkbox.css +2 -2
  37. package/lib/cjs/checkbox/variables.scss +1 -1
  38. package/lib/cjs/collapsible/animation.scss +2 -2
  39. package/lib/cjs/collapsible/collapsible.css +1 -1
  40. package/lib/cjs/datePicker/animation.scss +2 -2
  41. package/lib/cjs/dropdown/animation.scss +1 -1
  42. package/lib/cjs/dropdown/dropdown.css +1 -1
  43. package/lib/cjs/dropdown/foundation.d.ts +4 -3
  44. package/lib/cjs/dropdown/foundation.js +21 -8
  45. package/lib/cjs/dropdown/menuFoundation.d.ts +0 -1
  46. package/lib/cjs/dropdown/menuFoundation.js +0 -11
  47. package/lib/cjs/form/form.css +0 -2
  48. package/lib/cjs/form/form.scss +3 -4
  49. package/lib/cjs/form/rtl.scss +0 -1
  50. package/lib/cjs/form/variables.scss +38 -35
  51. package/lib/cjs/input/animation.scss +6 -6
  52. package/lib/cjs/input/input.css +2 -2
  53. package/lib/cjs/input/textarea.css +1 -1
  54. package/lib/cjs/inputNumber/animation.scss +4 -4
  55. package/lib/cjs/inputNumber/inputNumber.css +1 -1
  56. package/lib/cjs/navigation/animation.scss +2 -2
  57. package/lib/cjs/navigation/navigation.css +1 -1
  58. package/lib/cjs/pagination/animation.scss +4 -4
  59. package/lib/cjs/pagination/pagination.css +1 -1
  60. package/lib/cjs/radio/animation.scss +4 -4
  61. package/lib/cjs/radio/radio.css +4 -4
  62. package/lib/cjs/rating/animation.scss +2 -2
  63. package/lib/cjs/rating/rating.css +1 -1
  64. package/lib/cjs/scrollList/animation.scss +1 -1
  65. package/lib/cjs/scrollList/scrollList.css +1 -1
  66. package/lib/cjs/select/animation.scss +6 -6
  67. package/lib/cjs/select/select.css +2 -2
  68. package/lib/cjs/slider/animation.scss +2 -2
  69. package/lib/cjs/slider/slider.css +1 -1
  70. package/lib/cjs/steps/animation.scss +6 -6
  71. package/lib/cjs/steps/steps.css +7 -7
  72. package/lib/cjs/switch/animation.scss +1 -1
  73. package/lib/cjs/switch/switch.css +1 -1
  74. package/lib/cjs/table/animation.scss +1 -1
  75. package/lib/cjs/table/table.css +2 -2
  76. package/lib/cjs/tabs/animation.scss +8 -8
  77. package/lib/cjs/tabs/tabs.css +46 -6
  78. package/lib/cjs/tabs/tabs.scss +43 -2
  79. package/lib/cjs/tabs/variables.scss +20 -0
  80. package/lib/cjs/tagInput/animation.scss +4 -4
  81. package/lib/cjs/tagInput/tagInput.css +1 -1
  82. package/lib/cjs/timePicker/utils/animation.scss +4 -4
  83. package/lib/cjs/tooltip/constants.d.ts +1 -0
  84. package/lib/cjs/tooltip/constants.js +2 -2
  85. package/lib/cjs/tooltip/foundation.d.ts +21 -2
  86. package/lib/cjs/tooltip/foundation.js +360 -77
  87. package/lib/cjs/transfer/animation.scss +2 -2
  88. package/lib/cjs/transfer/transfer.css +1 -1
  89. package/lib/cjs/tree/animation.scss +2 -2
  90. package/lib/cjs/tree/tree.css +1 -1
  91. package/lib/es/anchor/anchor.css +1 -1
  92. package/lib/es/anchor/animation.scss +2 -2
  93. package/lib/es/autoComplete/animation.scss +2 -2
  94. package/lib/es/autoComplete/autoComplete.css +1 -1
  95. package/lib/es/breadcrumb/animation.scss +2 -2
  96. package/lib/es/breadcrumb/breadcrumb.css +1 -1
  97. package/lib/es/button/animation.scss +26 -26
  98. package/lib/es/button/button.css +7 -7
  99. package/lib/es/carousel/animation.scss +2 -2
  100. package/lib/es/carousel/carousel.css +6 -6
  101. package/lib/es/cascader/animation.scss +2 -2
  102. package/lib/es/cascader/cascader.css +13 -1
  103. package/lib/es/cascader/cascader.scss +15 -0
  104. package/lib/es/cascader/variables.scss +1 -0
  105. package/lib/es/checkbox/animation.scss +4 -4
  106. package/lib/es/checkbox/checkbox.css +2 -2
  107. package/lib/es/checkbox/variables.scss +1 -1
  108. package/lib/es/collapsible/animation.scss +2 -2
  109. package/lib/es/collapsible/collapsible.css +1 -1
  110. package/lib/es/datePicker/animation.scss +2 -2
  111. package/lib/es/dropdown/animation.scss +1 -1
  112. package/lib/es/dropdown/dropdown.css +1 -1
  113. package/lib/es/dropdown/foundation.d.ts +4 -3
  114. package/lib/es/dropdown/foundation.js +21 -8
  115. package/lib/es/dropdown/menuFoundation.d.ts +0 -1
  116. package/lib/es/dropdown/menuFoundation.js +1 -12
  117. package/lib/es/form/form.css +0 -2
  118. package/lib/es/form/form.scss +3 -4
  119. package/lib/es/form/rtl.scss +0 -1
  120. package/lib/es/form/variables.scss +38 -35
  121. package/lib/es/input/animation.scss +6 -6
  122. package/lib/es/input/input.css +2 -2
  123. package/lib/es/input/textarea.css +1 -1
  124. package/lib/es/inputNumber/animation.scss +4 -4
  125. package/lib/es/inputNumber/inputNumber.css +1 -1
  126. package/lib/es/navigation/animation.scss +2 -2
  127. package/lib/es/navigation/navigation.css +1 -1
  128. package/lib/es/pagination/animation.scss +4 -4
  129. package/lib/es/pagination/pagination.css +1 -1
  130. package/lib/es/radio/animation.scss +4 -4
  131. package/lib/es/radio/radio.css +4 -4
  132. package/lib/es/rating/animation.scss +2 -2
  133. package/lib/es/rating/rating.css +1 -1
  134. package/lib/es/scrollList/animation.scss +1 -1
  135. package/lib/es/scrollList/scrollList.css +1 -1
  136. package/lib/es/select/animation.scss +6 -6
  137. package/lib/es/select/select.css +2 -2
  138. package/lib/es/slider/animation.scss +2 -2
  139. package/lib/es/slider/slider.css +1 -1
  140. package/lib/es/steps/animation.scss +6 -6
  141. package/lib/es/steps/steps.css +7 -7
  142. package/lib/es/switch/animation.scss +1 -1
  143. package/lib/es/switch/switch.css +1 -1
  144. package/lib/es/table/animation.scss +1 -1
  145. package/lib/es/table/table.css +2 -2
  146. package/lib/es/tabs/animation.scss +8 -8
  147. package/lib/es/tabs/tabs.css +46 -6
  148. package/lib/es/tabs/tabs.scss +43 -2
  149. package/lib/es/tabs/variables.scss +20 -0
  150. package/lib/es/tagInput/animation.scss +4 -4
  151. package/lib/es/tagInput/tagInput.css +1 -1
  152. package/lib/es/timePicker/utils/animation.scss +4 -4
  153. package/lib/es/tooltip/constants.d.ts +1 -0
  154. package/lib/es/tooltip/constants.js +2 -2
  155. package/lib/es/tooltip/foundation.d.ts +21 -2
  156. package/lib/es/tooltip/foundation.js +360 -77
  157. package/lib/es/transfer/animation.scss +2 -2
  158. package/lib/es/transfer/transfer.css +1 -1
  159. package/lib/es/tree/animation.scss +2 -2
  160. package/lib/es/tree/tree.css +1 -1
  161. package/navigation/animation.scss +2 -2
  162. package/package.json +2 -2
  163. package/pagination/animation.scss +4 -4
  164. package/radio/animation.scss +4 -4
  165. package/rating/animation.scss +2 -2
  166. package/scrollList/animation.scss +1 -1
  167. package/select/animation.scss +6 -6
  168. package/slider/animation.scss +2 -2
  169. package/steps/animation.scss +6 -6
  170. package/switch/animation.scss +1 -1
  171. package/table/animation.scss +1 -1
  172. package/tabs/animation.scss +8 -8
  173. package/tabs/tabs.scss +43 -2
  174. package/tabs/variables.scss +20 -0
  175. package/tagInput/animation.scss +4 -4
  176. package/timePicker/utils/animation.scss +4 -4
  177. package/tooltip/constants.ts +1 -0
  178. package/tooltip/foundation.ts +322 -78
  179. package/transfer/animation.scss +2 -2
  180. package/tree/animation.scss +2 -2
@@ -133,11 +133,26 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
133
133
  unBindResizeEvent() {
134
134
  this._adapter.unregisterResizeHandler(this.onResize);
135
135
  }
136
-
136
+
137
137
  removePortal = () => {
138
138
  this._adapter.removePortal();
139
139
  }
140
140
 
141
+ _adjustPos(position = '', isVertical = false, adjustType = 'reverse', concatPos?: any) {
142
+ switch (adjustType) {
143
+ case 'reverse':
144
+ return this._reversePos(position, isVertical);
145
+ case 'expand':
146
+ // only happens when position is top/bottom/left/right
147
+ return this._expandPos(position, concatPos);
148
+ case 'reduce':
149
+ // only happens when position other than top/bottom/left/right
150
+ return this._reducePos(position);
151
+ default:
152
+ return this._reversePos(position, isVertical);
153
+ }
154
+ }
155
+
141
156
  _reversePos(position = '', isVertical = false) {
142
157
  if (isVertical) {
143
158
  if (REGS.TOP.test(position)) {
@@ -153,6 +168,16 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
153
168
  return position;
154
169
  }
155
170
 
171
+ _expandPos(position = '', concatPos: string) {
172
+ return position.concat(concatPos);
173
+ }
174
+
175
+ _reducePos(position = '') {
176
+ // if cur position consists of two directions, remove the last position
177
+ const found = ['Top', 'Bottom', 'Left', 'Right'].find(pos => position.endsWith(pos));
178
+ return found ? position.replace(found, ''): position;
179
+ }
180
+
156
181
  clearDelayTimer() {
157
182
  if (this._timer) {
158
183
  clearTimeout(this._timer);
@@ -269,6 +294,10 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
269
294
  const content = this.getProp('content');
270
295
  const trigger = this.getProp('trigger');
271
296
  const clickTriggerToHide = this.getProp('clickTriggerToHide');
297
+ const { visible } = this.getStates();
298
+ if (visible) {
299
+ return ;
300
+ }
272
301
 
273
302
  this.clearDelayTimer();
274
303
 
@@ -285,9 +314,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
285
314
  this._togglePortalVisible(true);
286
315
  });
287
316
 
288
- const position = this.calcPosition(null, null, null, false);
289
-
290
- this._adapter.insertPortal(content, position);
317
+ this._adapter.insertPortal(content, { left: -9999, top: -9999 }); // offscreen rendering
291
318
 
292
319
  if (trigger === 'custom') {
293
320
  // eslint-disable-next-line
@@ -358,14 +385,15 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
358
385
  return null;
359
386
  }
360
387
 
361
- calcPosStyle(triggerRect: DOMRect, wrapperRect: DOMRect, containerRect: PopupContainerDOMRect, position?: Position, spacing?: number) {
362
- triggerRect = (isEmpty(triggerRect) ? triggerRect : this._adapter.getTriggerBounding()) || { ...defaultRect as any };
363
- containerRect = (isEmpty(containerRect) ? containerRect : this._adapter.getPopupContainerRect()) || {
388
+ calcPosStyle(props: {triggerRect: DOMRect; wrapperRect: DOMRect; containerRect: PopupContainerDOMRect; position?: Position; spacing?: number; isOverFlow?: [boolean, boolean]}) {
389
+ const { spacing, isOverFlow } = props;
390
+ const triggerRect = (isEmpty(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || { ...defaultRect as any };
391
+ const containerRect = (isEmpty(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || {
364
392
  ...defaultRect,
365
393
  };
366
- wrapperRect = (isEmpty(wrapperRect) ? wrapperRect : this._adapter.getWrapperBounding()) || { ...defaultRect as any };
394
+ const wrapperRect = (isEmpty(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || { ...defaultRect as any };
367
395
  // eslint-disable-next-line
368
- position = position != null ? position : this.getProp('position');
396
+ const position = props.position != null ? props.position : this.getProp('position');
369
397
  // eslint-disable-next-line
370
398
  const SPACING = spacing != null ? spacing : this.getProp('spacing');
371
399
  const { arrowPointAtCenter, showArrow, arrowBounding } = this.getProps();
@@ -389,67 +417,104 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
389
417
  const offsetXWithArrow = positionOffsetX + horizontalArrowWidth / 2;
390
418
  const offsetYWithArrow = positionOffsetY + verticalArrowHeight / 2;
391
419
 
420
+ const heightDifference = wrapperRect.height - containerRect.height;
421
+ const widthDifference = wrapperRect.width - containerRect.width;
422
+
423
+ const offsetHeight = heightDifference > 0 ? heightDifference : 0;
424
+ const offsetWidth = widthDifference > 0 ? widthDifference : 0;
425
+ const isHeightOverFlow = isOverFlow && isOverFlow[0];
426
+ const isWidthOverFlow = isOverFlow && isOverFlow[1];
427
+
428
+ const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
429
+ const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
430
+
431
+
392
432
  switch (position) {
393
433
  case 'top':
394
- left = middleX;
395
- top = triggerRect.top - SPACING;
434
+ // left = middleX;
435
+ // top = triggerRect.top - SPACING;
436
+ left = isWidthOverFlow ? (isTriggerNearLeft ? containerRect.left + wrapperRect.width / 2 : containerRect.right - wrapperRect.width / 2 + offsetWidth): middleX;
437
+ top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
396
438
  translateX = -0.5;
397
439
  translateY = -1;
398
440
  break;
399
441
  case 'topLeft':
400
- left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
401
- top = triggerRect.top - SPACING;
442
+ // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
443
+ // top = triggerRect.top - SPACING;
444
+ left = isWidthOverFlow ? containerRect.left : (pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left);
445
+ top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
402
446
  translateY = -1;
403
447
  break;
404
448
  case 'topRight':
405
- left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
406
- top = triggerRect.top - SPACING;
449
+ // left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
450
+ // top = triggerRect.top - SPACING;
451
+ left = isWidthOverFlow ? containerRect.right + offsetWidth : (pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right);
452
+ top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
407
453
  translateY = -1;
408
454
  translateX = -1;
409
455
  break;
410
456
  case 'left':
411
- left = triggerRect.left - SPACING;
412
- top = middleY;
457
+ // left = triggerRect.left - SPACING;
458
+ // top = middleY;
459
+ // left = isWidthOverFlow? containerRect.right - SPACING : triggerRect.left - SPACING;
460
+ left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
461
+ top = isHeightOverFlow ? (isTriggerNearTop ? containerRect.top + wrapperRect.height / 2 : containerRect.bottom - wrapperRect.height / 2 + offsetHeight): middleY;
413
462
  translateX = -1;
414
463
  translateY = -0.5;
415
464
  break;
416
465
  case 'leftTop':
417
- left = triggerRect.left - SPACING;
418
- top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
466
+ // left = triggerRect.left - SPACING;
467
+ // top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
468
+ left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
469
+ top = isHeightOverFlow ? containerRect.top : (pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top);
419
470
  translateX = -1;
420
471
  break;
421
472
  case 'leftBottom':
422
- left = triggerRect.left - SPACING;
423
- top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
473
+ // left = triggerRect.left - SPACING;
474
+ // top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
475
+ left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow: triggerRect.left - SPACING;
476
+ top = isHeightOverFlow ? containerRect.bottom + offsetHeight: (pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom);
424
477
  translateX = -1;
425
478
  translateY = -1;
426
479
  break;
427
480
  case 'bottom':
428
- left = middleX;
429
- top = triggerRect.top + triggerRect.height + SPACING;
481
+ // left = middleX;
482
+ // top = triggerRect.top + triggerRect.height + SPACING;
483
+ left = isWidthOverFlow ? (isTriggerNearLeft ? containerRect.left + wrapperRect.width / 2 : containerRect.right - wrapperRect.width / 2 + offsetWidth): middleX;
484
+ top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING: triggerRect.top + triggerRect.height + SPACING;
430
485
  translateX = -0.5;
431
486
  break;
432
487
  case 'bottomLeft':
433
- left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
434
- top = triggerRect.bottom + SPACING;
488
+ // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
489
+ // top = triggerRect.bottom + SPACING;
490
+ left = isWidthOverFlow ? containerRect.left : (pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left);
491
+ top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
435
492
  break;
436
493
  case 'bottomRight':
437
- left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
438
- top = triggerRect.bottom + SPACING;
494
+ // left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
495
+ // top = triggerRect.bottom + SPACING;
496
+ left = isWidthOverFlow ? containerRect.right + offsetWidth : (pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right);
497
+ top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
439
498
  translateX = -1;
440
499
  break;
441
500
  case 'right':
442
- left = triggerRect.right + SPACING;
443
- top = middleY;
501
+ // left = triggerRect.right + SPACING;
502
+ // top = middleY;
503
+ left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
504
+ top = isHeightOverFlow ? (isTriggerNearTop ? containerRect.top + wrapperRect.height / 2 : containerRect.bottom - wrapperRect.height / 2 + offsetHeight) : middleY;
444
505
  translateY = -0.5;
445
506
  break;
446
507
  case 'rightTop':
447
- left = triggerRect.right + SPACING;
448
- top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
508
+ // left = triggerRect.right + SPACING;
509
+ // top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
510
+ left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
511
+ top = isHeightOverFlow ? containerRect.top : (pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top);
449
512
  break;
450
513
  case 'rightBottom':
451
- left = triggerRect.right + SPACING;
452
- top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
514
+ // left = triggerRect.right + SPACING;
515
+ // top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
516
+ left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
517
+ top = isHeightOverFlow ? containerRect.bottom + offsetHeight : (pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom);
453
518
  translateY = -1;
454
519
  break;
455
520
  case 'leftTopOver':
@@ -574,18 +639,18 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
574
639
 
575
640
  // console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
576
641
 
577
- let style = this.calcPosStyle(triggerRect, wrapperRect, containerRect);
642
+ let style = this.calcPosStyle({ triggerRect, wrapperRect, containerRect });
578
643
 
579
644
  let position = this.getProp('position');
580
645
 
581
646
  if (this.getProp('autoAdjustOverflow')) {
582
647
  // console.log('style: ', style, '\ntriggerRect: ', triggerRect, '\nwrapperRect: ', wrapperRect);
583
- const adjustedPos = this.adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect);
648
+ const { position: adjustedPos, isHeightOverFlow, isWidthOverFlow } = this.adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect);
584
649
 
585
- if (position !== adjustedPos) {
650
+ if (position !== adjustedPos || isHeightOverFlow || isWidthOverFlow) {
586
651
  position = adjustedPos;
587
652
 
588
- style = this.calcPosStyle(triggerRect, wrapperRect, containerRect, position);
653
+ style = this.calcPosStyle({ triggerRect, wrapperRect, containerRect, position, spacing: null, isOverFlow: [ isHeightOverFlow, isWidthOverFlow ] });
589
654
  }
590
655
  }
591
656
 
@@ -598,17 +663,66 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
598
663
  };
599
664
 
600
665
  isLR(position = '') {
601
- return position.indexOf('left') === 0 || position.indexOf('right') === 0;
666
+ return position.includes('left') || position.includes('right');
602
667
  }
603
668
 
604
669
  isTB(position = '') {
605
- return position.indexOf('top') === 0 || position.indexOf('bottom') === 0;
670
+ return position.includes('top') || position.includes('bottom');
671
+ }
672
+
673
+ isReverse(rowSpace: number, reverseSpace: number, size: number) {
674
+ // 原空间不足,反向空间足够
675
+ // Insufficient original space, enough reverse space
676
+ return rowSpace < size && reverseSpace > size;
677
+ }
678
+
679
+ isOverFlow(rowSpace: number, reverseSpace: number, size: number){
680
+ // 原空间且反向空间都不足
681
+ // The original space and the reverse space are not enough
682
+ return rowSpace < size && reverseSpace < size;
683
+ }
684
+
685
+ isHalfOverFlow(posSpace: number, negSpace: number, size: number){
686
+ // 正半空间或者负半空间不足,即表示有遮挡,需要偏移
687
+ // Insufficient positive half space or negative half space means that there is occlusion and needs to be offset
688
+ return posSpace < size || negSpace < size;
689
+ }
690
+
691
+ isHalfAllEnough(posSpace: number, negSpace: number, size: number){
692
+ // 正半空间和负半空间都足够,即表示可以从 topLeft/topRight 变成 top
693
+ // Both positive and negative half-spaces are sufficient, which means you can change from topLeft/topRight to top
694
+ return posSpace >= size || negSpace >= size;
695
+ }
696
+
697
+ getReverse(viewOverFlow: boolean, containerOverFlow: boolean, shouldReverseView: boolean, shouldReverseContainer: boolean) {
698
+ /**
699
+ * 基于视口和容器一起判断,以下几种情况允许从原方向转到反方向,以判断是否应该由top->bottom为例子
700
+ *
701
+ * 1. 视口上下空间不足 且 容器上空间❌下空间✅
702
+ * 2. 视口上空间❌下空间✅ 且 容器上下空间不足
703
+ * 3. 视口上空间❌下空间✅ 且 容器上空间❌下空间✅
704
+ *
705
+ * Based on the judgment of the viewport and the container, the following situations are allowed to turn from the original direction to the opposite direction
706
+ * to judge whether it should be top->bottom as an example
707
+ * 1. There is insufficient space above and below the viewport and the space above the container ❌ the space below ✅
708
+ * 2. The space above the viewport ❌ the space below ✅ and the space above and below the container is insufficient
709
+ * 3. Viewport upper space ❌ lower space✅ and container upper space ❌ lower space✅
710
+ */
711
+ return (viewOverFlow && shouldReverseContainer) || (shouldReverseView && containerOverFlow) || (shouldReverseView && shouldReverseContainer);
606
712
  }
607
713
 
608
714
  // place the dom correctly
609
715
  adjustPosIfNeed(position: Position | string, style: Record<string, any>, triggerRect: DOMRect, wrapperRect: DOMRect, containerRect: PopupContainerDOMRect) {
610
716
  const { innerWidth, innerHeight } = window;
611
- const { spacing } = this.getProps();
717
+ const { spacing, margin } = this.getProps();
718
+
719
+ const marginLeft = typeof margin === 'number' ? margin : margin.marginLeft;
720
+ const marginTop = typeof margin === 'number' ? margin : margin.marginTop;
721
+ const marginRight = typeof margin === 'number' ? margin : margin.marginRight;
722
+ const marginBottom = typeof margin === 'number' ? margin : margin.marginBottom;
723
+
724
+ let isHeightOverFlow = false;
725
+ let isWidthOverFlow = false;
612
726
 
613
727
  if (wrapperRect.width > 0 && wrapperRect.height > 0) {
614
728
  // let clientLeft = left + translateX * wrapperRect.width - containerRect.scrollLeft;
@@ -638,144 +752,274 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
638
752
 
639
753
  // The wrapperR ect.top|bottom equivalent cannot be directly used here for comparison, which is easy to cause jitter
640
754
 
641
- const shouldReverseTop = clientTop < wrapperRect.height + spacing && restClientBottom > wrapperRect.height + spacing;
642
- const shouldReverseLeft = clientLeft < wrapperRect.width + spacing && restClientRight > wrapperRect.width + spacing;
643
- const shouldReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
644
- const shouldReverseRight = restClientRight < wrapperRect.width + spacing && clientLeft > wrapperRect.width + spacing;
755
+ // 基于视口的微调判断
756
+ // Fine-tuning judgment based on viewport
757
+ const shouldViewReverseTop = clientTop - marginTop < wrapperRect.height + spacing && restClientBottom - marginBottom > wrapperRect.height + spacing;
758
+ const shouldViewReverseLeft = clientLeft - marginLeft < wrapperRect.width + spacing && restClientRight - marginRight > wrapperRect.width + spacing;
759
+ const shouldViewReverseBottom = restClientBottom - marginBottom < wrapperRect.height + spacing && clientTop - marginTop > wrapperRect.height + spacing;
760
+ const shouldViewReverseRight = restClientRight - marginRight < wrapperRect.width + spacing && clientLeft - marginLeft > wrapperRect.width + spacing;
761
+ const shouldViewReverseTopOver = restClientTop - marginBottom< wrapperRect.height + spacing && clientBottom - marginTop> wrapperRect.height + spacing;
762
+ const shouldViewReverseBottomOver = clientBottom - marginTop < wrapperRect.height + spacing && restClientTop - marginBottom > wrapperRect.height + spacing;
763
+
764
+ const shouldViewReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
765
+ const shouldViewReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
766
+ const shouldViewReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
767
+ const shouldViewReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
768
+
645
769
  const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
646
770
  const shouldReverseBottomOver = clientBottom < wrapperRect.height + spacing && restClientTop > wrapperRect.height + spacing;
647
771
 
648
- const shouldReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
649
- const shouldReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
650
- const shouldReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
651
- const shouldReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
652
-
653
772
  const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
654
773
  const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
655
774
 
775
+ // 基于容器的微调判断
776
+ // Fine-tuning judgment based on container
777
+ const clientTopInContainer = clientTop - containerRect.top;
778
+ const clientLeftInContainer = clientLeft - containerRect.left;
779
+ const clientBottomInContainer = clientTopInContainer + triggerRect.height;
780
+ const clientRightInContainer = clientLeftInContainer + triggerRect.width;
781
+
782
+ const restClientBottomInContainer = containerRect.bottom - clientBottom;
783
+ const restClientRightInContainer = containerRect.right - clientRight;
784
+ const restClientTopInContainer = restClientBottomInContainer + triggerRect.height;
785
+ const restClientLeftInContainer = restClientRightInContainer + triggerRect.width;
786
+
787
+ // 当原空间不足,反向空间足够时,可以反向。
788
+ // When the original space is insufficient and the reverse space is sufficient, the reverse can be performed.
789
+ const shouldContainerReverseTop = this.isReverse(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
790
+ const shouldContainerReverseLeft = this.isReverse(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
791
+ const shouldContainerReverseBottom = this.isReverse(restClientBottomInContainer - marginBottom, clientTopInContainer - marginTop, wrapperRect.height + spacing);
792
+ const shouldContainerReverseRight = this.isReverse(restClientRightInContainer - marginRight, clientLeftInContainer - marginLeft, wrapperRect.width + spacing);
793
+ const shouldContainerReverseTopOver = this.isReverse(restClientTopInContainer - marginBottom, clientBottomInContainer - marginTop, wrapperRect.height + spacing);
794
+ const shouldContainerReverseBottomOver = this.isReverse(clientBottomInContainer - marginTop, restClientTopInContainer - marginBottom, wrapperRect.height + spacing);
795
+
796
+ const shouldContainerReverseTopSide = this.isReverse(restClientTopInContainer, clientBottomInContainer, wrapperRect.height);
797
+ const shouldContainerReverseBottomSide = this.isReverse(clientBottomInContainer, restClientTopInContainer, wrapperRect.height);
798
+ const shouldContainerReverseLeftSide = this.isReverse(restClientLeftInContainer, clientRightInContainer, wrapperRect.width);
799
+ const shouldContainerReverseRightSide = this.isReverse(clientRightInContainer, restClientLeftInContainer, wrapperRect.width);
800
+
801
+ const halfHeight = triggerRect.height / 2;
802
+ const halfWidth = triggerRect.width / 2;
803
+
804
+ // 视口, 原空间与反向空间是否都不足判断
805
+ // Viewport, whether the original space and the reverse space are insufficient to judge
806
+ const isViewYOverFlow = this.isOverFlow(clientTop - marginTop, restClientBottom - marginBottom, wrapperRect.height + spacing);
807
+ const isViewXOverFlow = this.isOverFlow(clientLeft - marginLeft, restClientRight - marginRight, wrapperRect.width + spacing);
808
+ const isViewYOverFlowSide = this.isOverFlow(clientBottom - marginTop, restClientTop - marginBottom, wrapperRect.height + spacing);
809
+ const isViewXOverFlowSide = this.isOverFlow(clientRight - marginLeft, restClientLeft - marginRight, wrapperRect.width + spacing);
810
+ const isViewYOverFlowSideHalf = this.isHalfOverFlow(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
811
+ const isViewXOverFlowSideHalf = this.isHalfOverFlow(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2);
812
+ const isViewYEnoughSideHalf = this.isHalfAllEnough(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
813
+ const isViewXEnoughSideHalf = this.isHalfAllEnough(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2);
814
+
815
+ // 容器, 原空间与反向空间是否都不足判断
816
+ // container, whether the original space and the reverse space are insufficient to judge
817
+ const isContainerYOverFlow = this.isOverFlow(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
818
+ const isContainerXOverFlow = this.isOverFlow(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
819
+ const isContainerYOverFlowSide = this.isOverFlow(clientBottomInContainer - marginTop, restClientTopInContainer - marginBottom, wrapperRect.height + spacing);
820
+ const isContainerXOverFlowSide = this.isOverFlow(clientRightInContainer - marginLeft, restClientLeftInContainer - marginRight, wrapperRect.width + spacing);
821
+ const isContainerYOverFlowSideHalf = this.isHalfOverFlow(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
822
+ const isContainerXOverFlowSideHalf = this.isHalfOverFlow(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2);
823
+ const isContainerYEnoughSideHalf = this.isHalfAllEnough(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
824
+ const isContainerXEnoughSideHalf = this.isHalfAllEnough(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2);
825
+
826
+ // 综合 viewport + container 判断微调,即视口 + 容器都放置不行时才能考虑位置调整
827
+ // Comprehensive viewport + container judgment fine-tuning, that is, the position adjustment can only be considered when the viewport + container cannot be placed.
828
+ const shouldReverseTop = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseTop, shouldContainerReverseTop);
829
+ const shouldReverseLeft = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseLeft, shouldContainerReverseLeft);
830
+ const shouldReverseBottom = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseBottom, shouldContainerReverseBottom);
831
+ const shouldReverseRight = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseRight, shouldContainerReverseRight);
832
+
833
+ // const shouldReverseTopOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopOver, shouldContainerReverseTopOver);
834
+ // const shouldReverseBottomOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomOver, shouldContainerReverseBottomOver);
835
+
836
+ const shouldReverseTopSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopSide, shouldContainerReverseTopSide);
837
+ const shouldReverseBottomSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomSide, shouldContainerReverseBottomSide);
838
+ const shouldReverseLeftSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseLeftSide, shouldContainerReverseLeftSide);
839
+ const shouldReverseRightSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseRightSide, shouldContainerReverseRightSide);
840
+
841
+ const isYOverFlowSideHalf = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
842
+ const isXOverFlowSideHalf = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
843
+
656
844
  switch (position) {
657
845
  case 'top':
658
846
  if (shouldReverseTop) {
659
- position = this._reversePos(position, true);
847
+ position = this._adjustPos(position, true);
848
+ }
849
+ if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
850
+ position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
660
851
  }
661
852
  break;
662
853
  case 'topLeft':
663
854
  if (shouldReverseTop) {
664
- position = this._reversePos(position, true);
855
+ position = this._adjustPos(position, true);
665
856
  }
666
857
  if (shouldReverseLeftSide && widthIsBigger) {
667
- position = this._reversePos(position);
858
+ position = this._adjustPos(position, true);
859
+ }
860
+ if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
861
+ position = this._adjustPos(position, true, 'reduce');
668
862
  }
669
863
  break;
670
864
  case 'topRight':
671
865
  if (shouldReverseTop) {
672
- position = this._reversePos(position, true);
866
+ position = this._adjustPos(position, true);
673
867
  }
674
868
  if (shouldReverseRightSide && widthIsBigger) {
675
- position = this._reversePos(position);
869
+ position = this._adjustPos(position);
870
+ }
871
+ if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
872
+ position = this._adjustPos(position, true, 'reduce');
676
873
  }
677
874
  break;
678
875
  case 'left':
679
876
  if (shouldReverseLeft) {
680
- position = this._reversePos(position);
877
+ position = this._adjustPos(position);
878
+ }
879
+ if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
880
+ position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
681
881
  }
682
882
  break;
683
883
  case 'leftTop':
684
884
  if (shouldReverseLeft) {
685
- position = this._reversePos(position);
885
+ position = this._adjustPos(position);
686
886
  }
687
887
  if (shouldReverseTopSide && heightIsBigger) {
688
- position = this._reversePos(position, true);
888
+ position = this._adjustPos(position, true);
889
+ }
890
+ if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
891
+ position = this._adjustPos(position, false, 'reduce');
689
892
  }
690
893
  break;
691
894
  case 'leftBottom':
692
895
  if (shouldReverseLeft) {
693
- position = this._reversePos(position);
896
+ position = this._adjustPos(position);
694
897
  }
695
898
  if (shouldReverseBottomSide && heightIsBigger) {
696
- position = this._reversePos(position, true);
899
+ position = this._adjustPos(position, true);
900
+ }
901
+ if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
902
+ position = this._adjustPos(position, false, 'reduce');
697
903
  }
698
904
  break;
699
905
  case 'bottom':
700
906
  if (shouldReverseBottom) {
701
- position = this._reversePos(position, true);
907
+ position = this._adjustPos(position, true);
908
+ }
909
+ if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
910
+ position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
702
911
  }
703
912
  break;
704
913
  case 'bottomLeft':
705
914
  if (shouldReverseBottom) {
706
- position = this._reversePos(position, true);
915
+ position = this._adjustPos(position, true);
707
916
  }
708
917
  if (shouldReverseLeftSide && widthIsBigger) {
709
- position = this._reversePos(position);
918
+ position = this._adjustPos(position);
919
+ }
920
+ if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
921
+ position = this._adjustPos(position, true, 'reduce');
710
922
  }
711
923
  break;
712
924
  case 'bottomRight':
713
925
  if (shouldReverseBottom) {
714
- position = this._reversePos(position, true);
926
+ position = this._adjustPos(position, true);
715
927
  }
716
928
  if (shouldReverseRightSide && widthIsBigger) {
717
- position = this._reversePos(position);
929
+ position = this._adjustPos(position);
930
+ }
931
+ if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
932
+ position = this._adjustPos(position, true, 'reduce');
718
933
  }
719
934
  break;
720
935
  case 'right':
721
936
  if (shouldReverseRight) {
722
- position = this._reversePos(position);
937
+ position = this._adjustPos(position);
938
+ }
939
+ if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
940
+ position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
723
941
  }
724
942
  break;
725
943
  case 'rightTop':
726
944
  if (shouldReverseRight) {
727
- position = this._reversePos(position);
945
+ position = this._adjustPos(position);
728
946
  }
729
947
  if (shouldReverseTopSide && heightIsBigger) {
730
- position = this._reversePos(position, true);
948
+ position = this._adjustPos(position, true);
949
+ }
950
+ if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
951
+ position = this._adjustPos(position, false, 'reduce');
731
952
  }
732
953
  break;
733
954
  case 'rightBottom':
734
955
  if (shouldReverseRight) {
735
- position = this._reversePos(position);
956
+ position = this._adjustPos(position);
736
957
  }
737
958
  if (shouldReverseBottomSide && heightIsBigger) {
738
- position = this._reversePos(position, true);
959
+ position = this._adjustPos(position, true);
960
+ }
961
+ if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
962
+ position = this._adjustPos(position, false, 'reduce');
739
963
  }
740
964
  break;
741
965
  case 'leftTopOver':
742
966
  if (shouldReverseTopOver) {
743
- position = this._reversePos(position, true);
967
+ position = this._adjustPos(position, true);
744
968
  }
745
969
  if (shouldReverseLeftOver) {
746
- position = this._reversePos(position);
970
+ position = this._adjustPos(position);
747
971
  }
748
972
  break;
749
973
  case 'leftBottomOver':
750
974
  if (shouldReverseBottomOver) {
751
- position = this._reversePos(position, true);
975
+ position = this._adjustPos(position, true);
752
976
  }
753
977
  if (shouldReverseLeftOver) {
754
- position = this._reversePos(position);
978
+ position = this._adjustPos(position);
755
979
  }
756
980
  break;
757
981
  case 'rightTopOver':
758
982
  if (shouldReverseTopOver) {
759
- position = this._reversePos(position, true);
983
+ position = this._adjustPos(position, true);
760
984
  }
761
985
  if (shouldReverseRightOver) {
762
- position = this._reversePos(position);
986
+ position = this._adjustPos(position);
763
987
  }
764
988
  break;
765
989
  case 'rightBottomOver':
766
990
  if (shouldReverseBottomOver) {
767
- position = this._reversePos(position, true);
991
+ position = this._adjustPos(position, true);
768
992
  }
769
993
  if (shouldReverseRightOver) {
770
- position = this._reversePos(position);
994
+ position = this._adjustPos(position);
771
995
  }
772
996
  break;
773
997
  default:
774
998
  break;
775
999
  }
1000
+
1001
+ // 判断溢出 Judgment overflow
1002
+ // 上下方向 top and bottom
1003
+ if (this.isTB(position)){
1004
+ isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
1005
+ if (position === 'top' || position === 'bottom') {
1006
+ isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
1007
+ } else {
1008
+ isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide;
1009
+ }
1010
+ }
1011
+ // 左右方向 left and right
1012
+ if (this.isLR(position)){
1013
+ isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
1014
+ if (position === 'left' || position === 'right') {
1015
+ isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
1016
+ } else {
1017
+ isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide;
1018
+ }
1019
+ }
776
1020
  }
777
1021
 
778
- return position;
1022
+ return { position, isHeightOverFlow, isWidthOverFlow };
779
1023
  }
780
1024
 
781
1025
  delayHide = () => {
@@ -1,4 +1,4 @@
1
- $transition_duration_transfer_item-bg: var(--semi-transition_duration-faster);//穿梭框条目-背景色-动画持续时间
1
+ $transition_duration_transfer_item-bg: var(--semi-transition_duration-none);//穿梭框条目-背景色-动画持续时间
2
2
  $transition_function_transfer_item-bg: var(--semi-transition_function-easeIn);//穿梭框条目-背景色-过渡曲线
3
- $transition_delay_transfer_item-bg: var(--semi-transition_delay-fastest);//穿梭框条目-背景色-延迟时间
3
+ $transition_delay_transfer_item-bg: var(--semi-transition_delay-none);//穿梭框条目-背景色-延迟时间
4
4
 
@@ -1,6 +1,6 @@
1
- $transition_duration-tree_option-bg: var(--semi-transition_duration-faster);//树选项-背景色-动画持续时间
1
+ $transition_duration-tree_option-bg: var(--semi-transition_duration-none);//树选项-背景色-动画持续时间
2
2
  $transition_function-tree_option-bg: var(--semi-transition_function-easeIn);//树选项-背景色-过渡曲线
3
- $transition_delay-tree_option-bg: var(--semi-transition_delay-fastest);//树选项-背景色-延迟时间
3
+ $transition_delay-tree_option-bg: var(--semi-transition_delay-none);//树选项-背景色-延迟时间
4
4
 
5
5
  //transform token
6
6