@douyinfe/semi-ui 2.23.0-beta.0 → 2.23.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/semi.css +12 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +375 -85
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/cascader/item.d.ts +1 -1
- package/lib/cjs/cascader/item.js +12 -6
- package/lib/cjs/tooltip/index.d.ts +8 -0
- package/lib/cjs/tooltip/index.js +2 -0
- package/lib/es/cascader/item.d.ts +1 -1
- package/lib/es/cascader/item.js +12 -6
- package/lib/es/tooltip/index.d.ts +8 -0
- package/lib/es/tooltip/index.js +2 -0
- package/package.json +7 -7
package/dist/umd/semi-ui.js
CHANGED
|
@@ -18234,9 +18234,11 @@ class foundation_Tooltip extends foundation {
|
|
|
18234
18234
|
this._togglePortalVisible(true);
|
|
18235
18235
|
});
|
|
18236
18236
|
|
|
18237
|
-
|
|
18237
|
+
this._adapter.insertPortal(content, {
|
|
18238
|
+
left: -9990,
|
|
18239
|
+
top: -9999
|
|
18240
|
+
}); // offscreen rendering
|
|
18238
18241
|
|
|
18239
|
-
this._adapter.insertPortal(content, position);
|
|
18240
18242
|
|
|
18241
18243
|
if (trigger === 'custom') {
|
|
18242
18244
|
// eslint-disable-next-line
|
|
@@ -18282,17 +18284,32 @@ class foundation_Tooltip extends foundation {
|
|
|
18282
18284
|
containerRect = (isEmpty_default()(containerRect) ? _this._adapter.getPopupContainerRect() : containerRect) || Object.assign({}, defaultRect);
|
|
18283
18285
|
wrapperRect = (isEmpty_default()(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) || Object.assign({}, defaultRect); // console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
|
|
18284
18286
|
|
|
18285
|
-
let style = _this.calcPosStyle(
|
|
18287
|
+
let style = _this.calcPosStyle({
|
|
18288
|
+
triggerRect,
|
|
18289
|
+
wrapperRect,
|
|
18290
|
+
containerRect
|
|
18291
|
+
});
|
|
18286
18292
|
|
|
18287
18293
|
let position = _this.getProp('position');
|
|
18288
18294
|
|
|
18289
18295
|
if (_this.getProp('autoAdjustOverflow')) {
|
|
18290
18296
|
// console.log('style: ', style, '\ntriggerRect: ', triggerRect, '\nwrapperRect: ', wrapperRect);
|
|
18291
|
-
const
|
|
18297
|
+
const {
|
|
18298
|
+
position: adjustedPos,
|
|
18299
|
+
isHeightOverFlow,
|
|
18300
|
+
isWidthOverFlow
|
|
18301
|
+
} = _this.adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect);
|
|
18292
18302
|
|
|
18293
|
-
if (position !== adjustedPos) {
|
|
18303
|
+
if (position !== adjustedPos || isHeightOverFlow || isWidthOverFlow) {
|
|
18294
18304
|
position = adjustedPos;
|
|
18295
|
-
style = _this.calcPosStyle(
|
|
18305
|
+
style = _this.calcPosStyle({
|
|
18306
|
+
triggerRect,
|
|
18307
|
+
wrapperRect,
|
|
18308
|
+
containerRect,
|
|
18309
|
+
position,
|
|
18310
|
+
spacing: null,
|
|
18311
|
+
isOverFlow: [isHeightOverFlow, isWidthOverFlow]
|
|
18312
|
+
});
|
|
18296
18313
|
}
|
|
18297
18314
|
}
|
|
18298
18315
|
|
|
@@ -18430,6 +18447,29 @@ class foundation_Tooltip extends foundation {
|
|
|
18430
18447
|
this._adapter.unregisterResizeHandler(this.onResize);
|
|
18431
18448
|
}
|
|
18432
18449
|
|
|
18450
|
+
_adjustPos() {
|
|
18451
|
+
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18452
|
+
let isVertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18453
|
+
let adjustType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'reverse';
|
|
18454
|
+
let concatPos = arguments.length > 3 ? arguments[3] : undefined;
|
|
18455
|
+
|
|
18456
|
+
switch (adjustType) {
|
|
18457
|
+
case 'reverse':
|
|
18458
|
+
return this._reversePos(position, isVertical);
|
|
18459
|
+
|
|
18460
|
+
case 'expand':
|
|
18461
|
+
// only happens when position is top/bottom/left/right
|
|
18462
|
+
return this._expandPos(position, concatPos);
|
|
18463
|
+
|
|
18464
|
+
case 'reduce':
|
|
18465
|
+
// only happens when position other than top/bottom/left/right
|
|
18466
|
+
return this._reducePos(position);
|
|
18467
|
+
|
|
18468
|
+
default:
|
|
18469
|
+
return this._reversePos(position, isVertical);
|
|
18470
|
+
}
|
|
18471
|
+
}
|
|
18472
|
+
|
|
18433
18473
|
_reversePos() {
|
|
18434
18474
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18435
18475
|
let isVertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -18449,6 +18489,19 @@ class foundation_Tooltip extends foundation {
|
|
|
18449
18489
|
return position;
|
|
18450
18490
|
}
|
|
18451
18491
|
|
|
18492
|
+
_expandPos() {
|
|
18493
|
+
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18494
|
+
let concatPos = arguments.length > 1 ? arguments[1] : undefined;
|
|
18495
|
+
return position.concat(concatPos);
|
|
18496
|
+
}
|
|
18497
|
+
|
|
18498
|
+
_reducePos() {
|
|
18499
|
+
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18500
|
+
// if cur position consists of two directions, remove the last position
|
|
18501
|
+
const found = ['Top', 'Bottom', 'Left', 'Right'].find(pos => position.endsWith(pos));
|
|
18502
|
+
return found ? position.replace(found, '') : position;
|
|
18503
|
+
}
|
|
18504
|
+
|
|
18452
18505
|
clearDelayTimer() {
|
|
18453
18506
|
if (this._timer) {
|
|
18454
18507
|
clearTimeout(this._timer);
|
|
@@ -18609,12 +18662,16 @@ class foundation_Tooltip extends foundation {
|
|
|
18609
18662
|
return null;
|
|
18610
18663
|
}
|
|
18611
18664
|
|
|
18612
|
-
calcPosStyle(
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18665
|
+
calcPosStyle(props) {
|
|
18666
|
+
const {
|
|
18667
|
+
spacing,
|
|
18668
|
+
isOverFlow
|
|
18669
|
+
} = props;
|
|
18670
|
+
const triggerRect = (isEmpty_default()(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
|
|
18671
|
+
const containerRect = (isEmpty_default()(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
|
|
18672
|
+
const wrapperRect = (isEmpty_default()(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect); // eslint-disable-next-line
|
|
18616
18673
|
|
|
18617
|
-
position = position != null ? position : this.getProp('position'); // eslint-disable-next-line
|
|
18674
|
+
const position = props.position != null ? props.position : this.getProp('position'); // eslint-disable-next-line
|
|
18618
18675
|
|
|
18619
18676
|
const SPACING = spacing != null ? spacing : this.getProp('spacing');
|
|
18620
18677
|
const {
|
|
@@ -18644,79 +18701,112 @@ class foundation_Tooltip extends foundation {
|
|
|
18644
18701
|
const middleY = triggerRect.top + triggerRect.height / 2;
|
|
18645
18702
|
const offsetXWithArrow = positionOffsetX + horizontalArrowWidth / 2;
|
|
18646
18703
|
const offsetYWithArrow = positionOffsetY + verticalArrowHeight / 2;
|
|
18704
|
+
const heightDifference = wrapperRect.height - containerRect.height;
|
|
18705
|
+
const widthDifference = wrapperRect.width - containerRect.width;
|
|
18706
|
+
const offsetHeight = heightDifference > 0 ? heightDifference : 0;
|
|
18707
|
+
const offsetWidth = widthDifference > 0 ? widthDifference : 0;
|
|
18708
|
+
const isHeightOverFlow = isOverFlow && isOverFlow[0];
|
|
18709
|
+
const isWidthOverFlow = isOverFlow && isOverFlow[1];
|
|
18710
|
+
const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
|
|
18711
|
+
const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
|
|
18647
18712
|
|
|
18648
18713
|
switch (position) {
|
|
18649
18714
|
case 'top':
|
|
18650
|
-
left = middleX;
|
|
18651
|
-
top = triggerRect.top - SPACING;
|
|
18715
|
+
// left = middleX;
|
|
18716
|
+
// top = triggerRect.top - SPACING;
|
|
18717
|
+
left = isWidthOverFlow ? isTriggerNearLeft ? containerRect.left + wrapperRect.width / 2 : containerRect.right - wrapperRect.width / 2 + offsetWidth : middleX;
|
|
18718
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
18652
18719
|
translateX = -0.5;
|
|
18653
18720
|
translateY = -1;
|
|
18654
18721
|
break;
|
|
18655
18722
|
|
|
18656
18723
|
case 'topLeft':
|
|
18657
|
-
left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18658
|
-
top = triggerRect.top - SPACING;
|
|
18724
|
+
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18725
|
+
// top = triggerRect.top - SPACING;
|
|
18726
|
+
left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18727
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
18659
18728
|
translateY = -1;
|
|
18660
18729
|
break;
|
|
18661
18730
|
|
|
18662
18731
|
case 'topRight':
|
|
18663
|
-
left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18664
|
-
top = triggerRect.top - SPACING;
|
|
18732
|
+
// left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18733
|
+
// top = triggerRect.top - SPACING;
|
|
18734
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth : pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18735
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
18665
18736
|
translateY = -1;
|
|
18666
18737
|
translateX = -1;
|
|
18667
18738
|
break;
|
|
18668
18739
|
|
|
18669
18740
|
case 'left':
|
|
18670
|
-
left = triggerRect.left - SPACING;
|
|
18671
|
-
top = middleY;
|
|
18741
|
+
// left = triggerRect.left - SPACING;
|
|
18742
|
+
// top = middleY;
|
|
18743
|
+
// left = isWidthOverFlow? containerRect.right - SPACING : triggerRect.left - SPACING;
|
|
18744
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
|
|
18745
|
+
top = isHeightOverFlow ? isTriggerNearTop ? containerRect.top + wrapperRect.height / 2 : containerRect.bottom - wrapperRect.height / 2 + offsetHeight : middleY;
|
|
18672
18746
|
translateX = -1;
|
|
18673
18747
|
translateY = -0.5;
|
|
18674
18748
|
break;
|
|
18675
18749
|
|
|
18676
18750
|
case 'leftTop':
|
|
18677
|
-
left = triggerRect.left - SPACING;
|
|
18678
|
-
top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18751
|
+
// left = triggerRect.left - SPACING;
|
|
18752
|
+
// top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18753
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
|
|
18754
|
+
top = isHeightOverFlow ? containerRect.top : pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18679
18755
|
translateX = -1;
|
|
18680
18756
|
break;
|
|
18681
18757
|
|
|
18682
18758
|
case 'leftBottom':
|
|
18683
|
-
left = triggerRect.left - SPACING;
|
|
18684
|
-
top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18759
|
+
// left = triggerRect.left - SPACING;
|
|
18760
|
+
// top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18761
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
|
|
18762
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18685
18763
|
translateX = -1;
|
|
18686
18764
|
translateY = -1;
|
|
18687
18765
|
break;
|
|
18688
18766
|
|
|
18689
18767
|
case 'bottom':
|
|
18690
|
-
left = middleX;
|
|
18691
|
-
top = triggerRect.top + triggerRect.height + SPACING;
|
|
18768
|
+
// left = middleX;
|
|
18769
|
+
// top = triggerRect.top + triggerRect.height + SPACING;
|
|
18770
|
+
left = isWidthOverFlow ? isTriggerNearLeft ? containerRect.left + wrapperRect.width / 2 : containerRect.right - wrapperRect.width / 2 + offsetWidth : middleX;
|
|
18771
|
+
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
18692
18772
|
translateX = -0.5;
|
|
18693
18773
|
break;
|
|
18694
18774
|
|
|
18695
18775
|
case 'bottomLeft':
|
|
18696
|
-
left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18697
|
-
top = triggerRect.bottom + SPACING;
|
|
18776
|
+
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18777
|
+
// top = triggerRect.bottom + SPACING;
|
|
18778
|
+
left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18779
|
+
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
18698
18780
|
break;
|
|
18699
18781
|
|
|
18700
18782
|
case 'bottomRight':
|
|
18701
|
-
left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18702
|
-
top = triggerRect.bottom + SPACING;
|
|
18783
|
+
// left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18784
|
+
// top = triggerRect.bottom + SPACING;
|
|
18785
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth : pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18786
|
+
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
18703
18787
|
translateX = -1;
|
|
18704
18788
|
break;
|
|
18705
18789
|
|
|
18706
18790
|
case 'right':
|
|
18707
|
-
left = triggerRect.right + SPACING;
|
|
18708
|
-
top = middleY;
|
|
18791
|
+
// left = triggerRect.right + SPACING;
|
|
18792
|
+
// top = middleY;
|
|
18793
|
+
left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
|
|
18794
|
+
top = isHeightOverFlow ? isTriggerNearTop ? containerRect.top + wrapperRect.height / 2 : containerRect.bottom - wrapperRect.height / 2 + offsetHeight : middleY;
|
|
18709
18795
|
translateY = -0.5;
|
|
18710
18796
|
break;
|
|
18711
18797
|
|
|
18712
18798
|
case 'rightTop':
|
|
18713
|
-
left = triggerRect.right + SPACING;
|
|
18714
|
-
top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18799
|
+
// left = triggerRect.right + SPACING;
|
|
18800
|
+
// top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18801
|
+
left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
|
|
18802
|
+
top = isHeightOverFlow ? containerRect.top : pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18715
18803
|
break;
|
|
18716
18804
|
|
|
18717
18805
|
case 'rightBottom':
|
|
18718
|
-
left = triggerRect.right + SPACING;
|
|
18719
|
-
top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18806
|
+
// left = triggerRect.right + SPACING;
|
|
18807
|
+
// top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18808
|
+
left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
|
|
18809
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18720
18810
|
translateY = -1;
|
|
18721
18811
|
break;
|
|
18722
18812
|
|
|
@@ -18823,12 +18913,53 @@ class foundation_Tooltip extends foundation {
|
|
|
18823
18913
|
|
|
18824
18914
|
isLR() {
|
|
18825
18915
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18826
|
-
return position.
|
|
18916
|
+
return position.includes('left') || position.includes('right');
|
|
18827
18917
|
}
|
|
18828
18918
|
|
|
18829
18919
|
isTB() {
|
|
18830
18920
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18831
|
-
return position.
|
|
18921
|
+
return position.includes('top') || position.includes('bottom');
|
|
18922
|
+
}
|
|
18923
|
+
|
|
18924
|
+
isReverse(rowSpace, reverseSpace, size) {
|
|
18925
|
+
// 原空间不足,反向空间足够
|
|
18926
|
+
// Insufficient original space, enough reverse space
|
|
18927
|
+
return rowSpace < size && reverseSpace > size;
|
|
18928
|
+
}
|
|
18929
|
+
|
|
18930
|
+
isOverFlow(rowSpace, reverseSpace, size) {
|
|
18931
|
+
// 原空间且反向空间都不足
|
|
18932
|
+
// The original space and the reverse space are not enough
|
|
18933
|
+
return rowSpace < size && reverseSpace < size;
|
|
18934
|
+
}
|
|
18935
|
+
|
|
18936
|
+
isHalfOverFlow(posSpace, negSpace, size) {
|
|
18937
|
+
// 正半空间或者负半空间不足,即表示有遮挡,需要偏移
|
|
18938
|
+
// Insufficient positive half space or negative half space means that there is occlusion and needs to be offset
|
|
18939
|
+
return posSpace < size || negSpace < size;
|
|
18940
|
+
}
|
|
18941
|
+
|
|
18942
|
+
isHalfAllEnough(posSpace, negSpace, size) {
|
|
18943
|
+
// 正半空间和负半空间都足够,即表示可以从 topLeft/topRight 变成 top
|
|
18944
|
+
// Both positive and negative half-spaces are sufficient, which means you can change from topLeft/topRight to top
|
|
18945
|
+
return posSpace >= size || negSpace >= size;
|
|
18946
|
+
}
|
|
18947
|
+
|
|
18948
|
+
getReverse(viewOverFlow, containerOverFlow, shouldReverseView, shouldReverseContainer) {
|
|
18949
|
+
/**
|
|
18950
|
+
* 基于视口和容器一起判断,以下几种情况允许从原方向转到反方向,以判断是否应该由top->bottom为例子
|
|
18951
|
+
*
|
|
18952
|
+
* 1. 视口上下空间不足 且 容器上空间❌下空间✅
|
|
18953
|
+
* 2. 视口上空间❌下空间✅ 且 容器上下空间不足
|
|
18954
|
+
* 3. 视口上空间❌下空间✅ 且 容器上空间❌下空间✅
|
|
18955
|
+
*
|
|
18956
|
+
* 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
|
|
18957
|
+
* to judge whether it should be top->bottom as an example
|
|
18958
|
+
* 1. There is insufficient space above and below the viewport and the space above the container ❌ the space below ✅
|
|
18959
|
+
* 2. The space above the viewport ❌ the space below ✅ and the space above and below the container is insufficient
|
|
18960
|
+
* 3. Viewport upper space ❌ lower space✅ and container upper space ❌ lower space✅
|
|
18961
|
+
*/
|
|
18962
|
+
return viewOverFlow && shouldReverseContainer || shouldReverseView && containerOverFlow || shouldReverseView && shouldReverseContainer;
|
|
18832
18963
|
} // place the dom correctly
|
|
18833
18964
|
|
|
18834
18965
|
|
|
@@ -18838,8 +18969,15 @@ class foundation_Tooltip extends foundation {
|
|
|
18838
18969
|
innerHeight
|
|
18839
18970
|
} = window;
|
|
18840
18971
|
const {
|
|
18841
|
-
spacing
|
|
18972
|
+
spacing,
|
|
18973
|
+
margin
|
|
18842
18974
|
} = this.getProps();
|
|
18975
|
+
const marginLeft = typeof margin === 'number' ? margin : margin.marginLeft;
|
|
18976
|
+
const marginTop = typeof margin === 'number' ? margin : margin.marginTop;
|
|
18977
|
+
const marginRight = typeof margin === 'number' ? margin : margin.marginRight;
|
|
18978
|
+
const marginBottom = typeof margin === 'number' ? margin : margin.marginBottom;
|
|
18979
|
+
let isHeightOverFlow = false;
|
|
18980
|
+
let isWidthOverFlow = false;
|
|
18843
18981
|
|
|
18844
18982
|
if (wrapperRect.width > 0 && wrapperRect.height > 0) {
|
|
18845
18983
|
// let clientLeft = left + translateX * wrapperRect.width - containerRect.scrollLeft;
|
|
@@ -18862,187 +19000,324 @@ class foundation_Tooltip extends foundation {
|
|
|
18862
19000
|
const restClientBottom = innerHeight - clientBottom;
|
|
18863
19001
|
const widthIsBigger = wrapperRect.width > triggerRect.width;
|
|
18864
19002
|
const heightIsBigger = wrapperRect.height > triggerRect.height; // The wrapperR ect.top|bottom equivalent cannot be directly used here for comparison, which is easy to cause jitter
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
const
|
|
18869
|
-
const
|
|
19003
|
+
// 基于视口的微调判断
|
|
19004
|
+
// Fine-tuning judgment based on viewport
|
|
19005
|
+
|
|
19006
|
+
const shouldViewReverseTop = clientTop - marginTop < wrapperRect.height + spacing && restClientBottom - marginBottom > wrapperRect.height + spacing;
|
|
19007
|
+
const shouldViewReverseLeft = clientLeft - marginLeft < wrapperRect.width + spacing && restClientRight - marginRight > wrapperRect.width + spacing;
|
|
19008
|
+
const shouldViewReverseBottom = restClientBottom - marginBottom < wrapperRect.height + spacing && clientTop - marginTop > wrapperRect.height + spacing;
|
|
19009
|
+
const shouldViewReverseRight = restClientRight - marginRight < wrapperRect.width + spacing && clientLeft - marginLeft > wrapperRect.width + spacing;
|
|
19010
|
+
const shouldViewReverseTopOver = restClientTop - marginBottom < wrapperRect.height + spacing && clientBottom - marginTop > wrapperRect.height + spacing;
|
|
19011
|
+
const shouldViewReverseBottomOver = clientBottom - marginTop < wrapperRect.height + spacing && restClientTop - marginBottom > wrapperRect.height + spacing;
|
|
19012
|
+
const shouldViewReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
|
|
19013
|
+
const shouldViewReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
|
|
19014
|
+
const shouldViewReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
19015
|
+
const shouldViewReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
18870
19016
|
const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
|
|
18871
19017
|
const shouldReverseBottomOver = clientBottom < wrapperRect.height + spacing && restClientTop > wrapperRect.height + spacing;
|
|
18872
|
-
const shouldReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
|
|
18873
|
-
const shouldReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
|
|
18874
|
-
const shouldReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
18875
|
-
const shouldReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
18876
19018
|
const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
18877
|
-
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
19019
|
+
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width; // 基于容器的微调判断
|
|
19020
|
+
// Fine-tuning judgment based on container
|
|
19021
|
+
|
|
19022
|
+
const clientTopInContainer = clientTop - containerRect.top;
|
|
19023
|
+
const clientLeftInContainer = clientLeft - containerRect.left;
|
|
19024
|
+
const clientBottomInContainer = clientTopInContainer + triggerRect.height;
|
|
19025
|
+
const clientRightInContainer = clientLeftInContainer + triggerRect.width;
|
|
19026
|
+
const restClientBottomInContainer = containerRect.bottom - clientBottom;
|
|
19027
|
+
const restClientRightInContainer = containerRect.right - clientRight;
|
|
19028
|
+
const restClientTopInContainer = restClientBottomInContainer + triggerRect.height;
|
|
19029
|
+
const restClientLeftInContainer = restClientRightInContainer + triggerRect.width; // 当原空间不足,反向空间足够时,可以反向。
|
|
19030
|
+
// When the original space is insufficient and the reverse space is sufficient, the reverse can be performed.
|
|
19031
|
+
|
|
19032
|
+
const shouldContainerReverseTop = this.isReverse(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19033
|
+
const shouldContainerReverseLeft = this.isReverse(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
|
|
19034
|
+
const shouldContainerReverseBottom = this.isReverse(restClientBottomInContainer - marginBottom, clientTopInContainer - marginTop, wrapperRect.height + spacing);
|
|
19035
|
+
const shouldContainerReverseRight = this.isReverse(restClientRightInContainer - marginRight, clientLeftInContainer - marginLeft, wrapperRect.width + spacing);
|
|
19036
|
+
const shouldContainerReverseTopOver = this.isReverse(restClientTopInContainer - marginBottom, clientBottomInContainer - marginTop, wrapperRect.height + spacing);
|
|
19037
|
+
const shouldContainerReverseBottomOver = this.isReverse(clientBottomInContainer - marginTop, restClientTopInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19038
|
+
const shouldContainerReverseTopSide = this.isReverse(restClientTopInContainer, clientBottomInContainer, wrapperRect.height);
|
|
19039
|
+
const shouldContainerReverseBottomSide = this.isReverse(clientBottomInContainer, restClientTopInContainer, wrapperRect.height);
|
|
19040
|
+
const shouldContainerReverseLeftSide = this.isReverse(restClientLeftInContainer, clientRightInContainer, wrapperRect.width);
|
|
19041
|
+
const shouldContainerReverseRightSide = this.isReverse(clientRightInContainer, restClientLeftInContainer, wrapperRect.width);
|
|
19042
|
+
const halfHeight = triggerRect.height / 2;
|
|
19043
|
+
const halfWidth = triggerRect.width / 2; // 视口, 原空间与反向空间是否都不足判断
|
|
19044
|
+
// Viewport, whether the original space and the reverse space are insufficient to judge
|
|
19045
|
+
|
|
19046
|
+
const isViewYOverFlow = this.isOverFlow(clientTop - marginTop, restClientBottom - marginBottom, wrapperRect.height + spacing);
|
|
19047
|
+
const isViewXOverFlow = this.isOverFlow(clientLeft - marginLeft, restClientRight - marginRight, wrapperRect.width + spacing);
|
|
19048
|
+
const isViewYOverFlowSide = this.isOverFlow(clientBottom - marginTop, restClientTop - marginBottom, wrapperRect.height + spacing);
|
|
19049
|
+
const isViewXOverFlowSide = this.isOverFlow(clientRight - marginLeft, restClientLeft - marginRight, wrapperRect.width + spacing);
|
|
19050
|
+
const isViewYOverFlowSideHalf = this.isHalfOverFlow(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
|
|
19051
|
+
const isViewXOverFlowSideHalf = this.isHalfOverFlow(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2);
|
|
19052
|
+
const isViewYEnoughSideHalf = this.isHalfAllEnough(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
|
|
19053
|
+
const isViewXEnoughSideHalf = this.isHalfAllEnough(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2); // 容器, 原空间与反向空间是否都不足判断
|
|
19054
|
+
// container, whether the original space and the reverse space are insufficient to judge
|
|
19055
|
+
|
|
19056
|
+
const isContainerYOverFlow = this.isOverFlow(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19057
|
+
const isContainerXOverFlow = this.isOverFlow(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
|
|
19058
|
+
const isContainerYOverFlowSide = this.isOverFlow(clientBottomInContainer - marginTop, restClientTopInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19059
|
+
const isContainerXOverFlowSide = this.isOverFlow(clientRightInContainer - marginLeft, restClientLeftInContainer - marginRight, wrapperRect.width + spacing);
|
|
19060
|
+
const isContainerYOverFlowSideHalf = this.isHalfOverFlow(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
|
|
19061
|
+
const isContainerXOverFlowSideHalf = this.isHalfOverFlow(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2);
|
|
19062
|
+
const isContainerYEnoughSideHalf = this.isHalfAllEnough(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
|
|
19063
|
+
const isContainerXEnoughSideHalf = this.isHalfAllEnough(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2); // 综合 viewport + container 判断微调,即视口 + 容器都放置不行时才能考虑位置调整
|
|
19064
|
+
// Comprehensive viewport + container judgment fine-tuning, that is, the position adjustment can only be considered when the viewport + container cannot be placed.
|
|
19065
|
+
|
|
19066
|
+
const shouldReverseTop = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseTop, shouldContainerReverseTop);
|
|
19067
|
+
const shouldReverseLeft = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseLeft, shouldContainerReverseLeft);
|
|
19068
|
+
const shouldReverseBottom = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseBottom, shouldContainerReverseBottom);
|
|
19069
|
+
const shouldReverseRight = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseRight, shouldContainerReverseRight); // const shouldReverseTopOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopOver, shouldContainerReverseTopOver);
|
|
19070
|
+
// const shouldReverseBottomOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomOver, shouldContainerReverseBottomOver);
|
|
19071
|
+
|
|
19072
|
+
const shouldReverseTopSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopSide, shouldContainerReverseTopSide);
|
|
19073
|
+
const shouldReverseBottomSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomSide, shouldContainerReverseBottomSide);
|
|
19074
|
+
const shouldReverseLeftSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseLeftSide, shouldContainerReverseLeftSide);
|
|
19075
|
+
const shouldReverseRightSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseRightSide, shouldContainerReverseRightSide);
|
|
19076
|
+
const isYOverFlowSideHalf = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
19077
|
+
const isXOverFlowSideHalf = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
18878
19078
|
|
|
18879
19079
|
switch (position) {
|
|
18880
19080
|
case 'top':
|
|
18881
19081
|
if (shouldReverseTop) {
|
|
18882
|
-
position = this.
|
|
19082
|
+
position = this._adjustPos(position, true);
|
|
19083
|
+
}
|
|
19084
|
+
|
|
19085
|
+
if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
|
|
19086
|
+
position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
|
|
18883
19087
|
}
|
|
18884
19088
|
|
|
18885
19089
|
break;
|
|
18886
19090
|
|
|
18887
19091
|
case 'topLeft':
|
|
18888
19092
|
if (shouldReverseTop) {
|
|
18889
|
-
position = this.
|
|
19093
|
+
position = this._adjustPos(position, true);
|
|
18890
19094
|
}
|
|
18891
19095
|
|
|
18892
19096
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
18893
|
-
position = this.
|
|
19097
|
+
position = this._adjustPos(position, true);
|
|
19098
|
+
}
|
|
19099
|
+
|
|
19100
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19101
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18894
19102
|
}
|
|
18895
19103
|
|
|
18896
19104
|
break;
|
|
18897
19105
|
|
|
18898
19106
|
case 'topRight':
|
|
18899
19107
|
if (shouldReverseTop) {
|
|
18900
|
-
position = this.
|
|
19108
|
+
position = this._adjustPos(position, true);
|
|
18901
19109
|
}
|
|
18902
19110
|
|
|
18903
19111
|
if (shouldReverseRightSide && widthIsBigger) {
|
|
18904
|
-
position = this.
|
|
19112
|
+
position = this._adjustPos(position);
|
|
19113
|
+
}
|
|
19114
|
+
|
|
19115
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19116
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18905
19117
|
}
|
|
18906
19118
|
|
|
18907
19119
|
break;
|
|
18908
19120
|
|
|
18909
19121
|
case 'left':
|
|
18910
19122
|
if (shouldReverseLeft) {
|
|
18911
|
-
position = this.
|
|
19123
|
+
position = this._adjustPos(position);
|
|
19124
|
+
}
|
|
19125
|
+
|
|
19126
|
+
if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
|
|
19127
|
+
position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
|
|
18912
19128
|
}
|
|
18913
19129
|
|
|
18914
19130
|
break;
|
|
18915
19131
|
|
|
18916
19132
|
case 'leftTop':
|
|
18917
19133
|
if (shouldReverseLeft) {
|
|
18918
|
-
position = this.
|
|
19134
|
+
position = this._adjustPos(position);
|
|
18919
19135
|
}
|
|
18920
19136
|
|
|
18921
19137
|
if (shouldReverseTopSide && heightIsBigger) {
|
|
18922
|
-
position = this.
|
|
19138
|
+
position = this._adjustPos(position, true);
|
|
19139
|
+
}
|
|
19140
|
+
|
|
19141
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19142
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18923
19143
|
}
|
|
18924
19144
|
|
|
18925
19145
|
break;
|
|
18926
19146
|
|
|
18927
19147
|
case 'leftBottom':
|
|
18928
19148
|
if (shouldReverseLeft) {
|
|
18929
|
-
position = this.
|
|
19149
|
+
position = this._adjustPos(position);
|
|
18930
19150
|
}
|
|
18931
19151
|
|
|
18932
19152
|
if (shouldReverseBottomSide && heightIsBigger) {
|
|
18933
|
-
position = this.
|
|
19153
|
+
position = this._adjustPos(position, true);
|
|
19154
|
+
}
|
|
19155
|
+
|
|
19156
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19157
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18934
19158
|
}
|
|
18935
19159
|
|
|
18936
19160
|
break;
|
|
18937
19161
|
|
|
18938
19162
|
case 'bottom':
|
|
18939
19163
|
if (shouldReverseBottom) {
|
|
18940
|
-
position = this.
|
|
19164
|
+
position = this._adjustPos(position, true);
|
|
19165
|
+
}
|
|
19166
|
+
|
|
19167
|
+
if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
|
|
19168
|
+
position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
|
|
18941
19169
|
}
|
|
18942
19170
|
|
|
18943
19171
|
break;
|
|
18944
19172
|
|
|
18945
19173
|
case 'bottomLeft':
|
|
18946
19174
|
if (shouldReverseBottom) {
|
|
18947
|
-
position = this.
|
|
19175
|
+
position = this._adjustPos(position, true);
|
|
18948
19176
|
}
|
|
18949
19177
|
|
|
18950
19178
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
18951
|
-
position = this.
|
|
19179
|
+
position = this._adjustPos(position);
|
|
19180
|
+
}
|
|
19181
|
+
|
|
19182
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19183
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18952
19184
|
}
|
|
18953
19185
|
|
|
18954
19186
|
break;
|
|
18955
19187
|
|
|
18956
19188
|
case 'bottomRight':
|
|
18957
19189
|
if (shouldReverseBottom) {
|
|
18958
|
-
position = this.
|
|
19190
|
+
position = this._adjustPos(position, true);
|
|
18959
19191
|
}
|
|
18960
19192
|
|
|
18961
19193
|
if (shouldReverseRightSide && widthIsBigger) {
|
|
18962
|
-
position = this.
|
|
19194
|
+
position = this._adjustPos(position);
|
|
19195
|
+
}
|
|
19196
|
+
|
|
19197
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19198
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18963
19199
|
}
|
|
18964
19200
|
|
|
18965
19201
|
break;
|
|
18966
19202
|
|
|
18967
19203
|
case 'right':
|
|
18968
19204
|
if (shouldReverseRight) {
|
|
18969
|
-
position = this.
|
|
19205
|
+
position = this._adjustPos(position);
|
|
19206
|
+
}
|
|
19207
|
+
|
|
19208
|
+
if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
|
|
19209
|
+
position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
|
|
18970
19210
|
}
|
|
18971
19211
|
|
|
18972
19212
|
break;
|
|
18973
19213
|
|
|
18974
19214
|
case 'rightTop':
|
|
18975
19215
|
if (shouldReverseRight) {
|
|
18976
|
-
position = this.
|
|
19216
|
+
position = this._adjustPos(position);
|
|
18977
19217
|
}
|
|
18978
19218
|
|
|
18979
19219
|
if (shouldReverseTopSide && heightIsBigger) {
|
|
18980
|
-
position = this.
|
|
19220
|
+
position = this._adjustPos(position, true);
|
|
19221
|
+
}
|
|
19222
|
+
|
|
19223
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19224
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18981
19225
|
}
|
|
18982
19226
|
|
|
18983
19227
|
break;
|
|
18984
19228
|
|
|
18985
19229
|
case 'rightBottom':
|
|
18986
19230
|
if (shouldReverseRight) {
|
|
18987
|
-
position = this.
|
|
19231
|
+
position = this._adjustPos(position);
|
|
18988
19232
|
}
|
|
18989
19233
|
|
|
18990
19234
|
if (shouldReverseBottomSide && heightIsBigger) {
|
|
18991
|
-
position = this.
|
|
19235
|
+
position = this._adjustPos(position, true);
|
|
19236
|
+
}
|
|
19237
|
+
|
|
19238
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19239
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18992
19240
|
}
|
|
18993
19241
|
|
|
18994
19242
|
break;
|
|
18995
19243
|
|
|
18996
19244
|
case 'leftTopOver':
|
|
18997
19245
|
if (shouldReverseTopOver) {
|
|
18998
|
-
position = this.
|
|
19246
|
+
position = this._adjustPos(position, true);
|
|
18999
19247
|
}
|
|
19000
19248
|
|
|
19001
19249
|
if (shouldReverseLeftOver) {
|
|
19002
|
-
position = this.
|
|
19250
|
+
position = this._adjustPos(position);
|
|
19003
19251
|
}
|
|
19004
19252
|
|
|
19005
19253
|
break;
|
|
19006
19254
|
|
|
19007
19255
|
case 'leftBottomOver':
|
|
19008
19256
|
if (shouldReverseBottomOver) {
|
|
19009
|
-
position = this.
|
|
19257
|
+
position = this._adjustPos(position, true);
|
|
19010
19258
|
}
|
|
19011
19259
|
|
|
19012
19260
|
if (shouldReverseLeftOver) {
|
|
19013
|
-
position = this.
|
|
19261
|
+
position = this._adjustPos(position);
|
|
19014
19262
|
}
|
|
19015
19263
|
|
|
19016
19264
|
break;
|
|
19017
19265
|
|
|
19018
19266
|
case 'rightTopOver':
|
|
19019
19267
|
if (shouldReverseTopOver) {
|
|
19020
|
-
position = this.
|
|
19268
|
+
position = this._adjustPos(position, true);
|
|
19021
19269
|
}
|
|
19022
19270
|
|
|
19023
19271
|
if (shouldReverseRightOver) {
|
|
19024
|
-
position = this.
|
|
19272
|
+
position = this._adjustPos(position);
|
|
19025
19273
|
}
|
|
19026
19274
|
|
|
19027
19275
|
break;
|
|
19028
19276
|
|
|
19029
19277
|
case 'rightBottomOver':
|
|
19030
19278
|
if (shouldReverseBottomOver) {
|
|
19031
|
-
position = this.
|
|
19279
|
+
position = this._adjustPos(position, true);
|
|
19032
19280
|
}
|
|
19033
19281
|
|
|
19034
19282
|
if (shouldReverseRightOver) {
|
|
19035
|
-
position = this.
|
|
19283
|
+
position = this._adjustPos(position);
|
|
19036
19284
|
}
|
|
19037
19285
|
|
|
19038
19286
|
break;
|
|
19039
19287
|
|
|
19040
19288
|
default:
|
|
19041
19289
|
break;
|
|
19290
|
+
} // 判断溢出 Judgment overflow
|
|
19291
|
+
// 上下方向 top and bottom
|
|
19292
|
+
|
|
19293
|
+
|
|
19294
|
+
if (this.isTB(position)) {
|
|
19295
|
+
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
|
|
19296
|
+
|
|
19297
|
+
if (position === 'top' || position === 'bottom') {
|
|
19298
|
+
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
19299
|
+
} else {
|
|
19300
|
+
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide;
|
|
19301
|
+
}
|
|
19302
|
+
} // 左右方向 left and right
|
|
19303
|
+
|
|
19304
|
+
|
|
19305
|
+
if (this.isLR(position)) {
|
|
19306
|
+
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
|
|
19307
|
+
|
|
19308
|
+
if (position === 'left' || position === 'right') {
|
|
19309
|
+
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
19310
|
+
} else {
|
|
19311
|
+
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide;
|
|
19312
|
+
}
|
|
19042
19313
|
}
|
|
19043
19314
|
}
|
|
19044
19315
|
|
|
19045
|
-
return
|
|
19316
|
+
return {
|
|
19317
|
+
position,
|
|
19318
|
+
isHeightOverFlow,
|
|
19319
|
+
isWidthOverFlow
|
|
19320
|
+
};
|
|
19046
19321
|
}
|
|
19047
19322
|
|
|
19048
19323
|
_bindScrollEvent() {
|
|
@@ -19211,8 +19486,8 @@ const numbers = {
|
|
|
19211
19486
|
DEFAULT_Z_INDEX: 1060,
|
|
19212
19487
|
MOUSE_ENTER_DELAY: 50,
|
|
19213
19488
|
MOUSE_LEAVE_DELAY: 50,
|
|
19214
|
-
SPACING: 8
|
|
19215
|
-
|
|
19489
|
+
SPACING: 8,
|
|
19490
|
+
MARGIN: 0
|
|
19216
19491
|
};
|
|
19217
19492
|
|
|
19218
19493
|
// CONCATENATED MODULE: ../semi-foundation/utils/uuid.ts
|
|
@@ -20320,6 +20595,7 @@ tooltip_Tooltip.propTypes = {
|
|
|
20320
20595
|
onVisibleChange: prop_types_default.a.func,
|
|
20321
20596
|
onClickOutSide: prop_types_default.a.func,
|
|
20322
20597
|
spacing: prop_types_default.a.number,
|
|
20598
|
+
margin: prop_types_default.a.oneOfType([prop_types_default.a.number, prop_types_default.a.object]),
|
|
20323
20599
|
showArrow: prop_types_default.a.oneOfType([prop_types_default.a.bool, prop_types_default.a.node]),
|
|
20324
20600
|
zIndex: prop_types_default.a.number,
|
|
20325
20601
|
rePosKey: prop_types_default.a.oneOfType([prop_types_default.a.string, prop_types_default.a.number]),
|
|
@@ -20349,6 +20625,7 @@ tooltip_Tooltip.defaultProps = {
|
|
|
20349
20625
|
onVisibleChange: noop_default.a,
|
|
20350
20626
|
onClickOutSide: noop_default.a,
|
|
20351
20627
|
spacing: numbers.SPACING,
|
|
20628
|
+
margin: numbers.MARGIN,
|
|
20352
20629
|
showArrow: true,
|
|
20353
20630
|
wrapWhenSpecial: true,
|
|
20354
20631
|
zIndex: numbers.DEFAULT_Z_INDEX,
|
|
@@ -22859,6 +23136,13 @@ const IconWindowAdaptionStroked_IconComponent = convertIcon(IconWindowAdaptionSt
|
|
|
22859
23136
|
|
|
22860
23137
|
|
|
22861
23138
|
|
|
23139
|
+
|
|
23140
|
+
|
|
23141
|
+
|
|
23142
|
+
|
|
23143
|
+
|
|
23144
|
+
|
|
23145
|
+
|
|
22862
23146
|
|
|
22863
23147
|
|
|
22864
23148
|
|
|
@@ -40525,27 +40809,33 @@ class item_Item extends external_root_React_commonjs2_react_commonjs_react_amd_r
|
|
|
40525
40809
|
return state;
|
|
40526
40810
|
};
|
|
40527
40811
|
|
|
40528
|
-
this.renderIcon = type
|
|
40812
|
+
this.renderIcon = function (type) {
|
|
40813
|
+
let haveMarginLeft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
40814
|
+
|
|
40815
|
+
const finalCls = style => {
|
|
40816
|
+
return style + (haveMarginLeft ? " ".concat(item_prefixcls, "-icon-left") : '');
|
|
40817
|
+
};
|
|
40818
|
+
|
|
40529
40819
|
switch (type) {
|
|
40530
40820
|
case 'child':
|
|
40531
40821
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconChevronRight, {
|
|
40532
|
-
className: "".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-expand")
|
|
40822
|
+
className: finalCls("".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-expand"))
|
|
40533
40823
|
});
|
|
40534
40824
|
|
|
40535
40825
|
case 'tick':
|
|
40536
40826
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconTick, {
|
|
40537
|
-
className: "".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-active")
|
|
40827
|
+
className: finalCls("".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-active"))
|
|
40538
40828
|
});
|
|
40539
40829
|
|
|
40540
40830
|
case 'loading':
|
|
40541
40831
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(spin_0, {
|
|
40542
|
-
wrapperClassName: "".concat(item_prefixcls, "-spin-icon")
|
|
40832
|
+
wrapperClassName: finalCls("".concat(item_prefixcls, "-spin-icon"))
|
|
40543
40833
|
});
|
|
40544
40834
|
|
|
40545
40835
|
case 'empty':
|
|
40546
40836
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
|
|
40547
40837
|
"aria-hidden": true,
|
|
40548
|
-
className: "".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-empty")
|
|
40838
|
+
className: finalCls("".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-empty"))
|
|
40549
40839
|
});
|
|
40550
40840
|
|
|
40551
40841
|
default:
|
|
@@ -40693,7 +40983,7 @@ class item_Item extends external_root_React_commonjs2_react_commonjs_react_amd_r
|
|
|
40693
40983
|
indeterminate: halfCheckedKeys.has(item.key),
|
|
40694
40984
|
checked: checkedKeys.has(item.key),
|
|
40695
40985
|
className: "".concat(item_prefixcls, "-label-checkbox")
|
|
40696
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child') : null);
|
|
40986
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child', true) : null);
|
|
40697
40987
|
})));
|
|
40698
40988
|
|
|
40699
40989
|
if (showChildItem) {
|