@douyinfe/semi-ui 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.
- package/dist/css/semi.css +108 -57
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +421 -120
- 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/_base/base.css +1 -0
- package/lib/cjs/cascader/item.d.ts +1 -1
- package/lib/cjs/cascader/item.js +12 -6
- package/lib/cjs/datePicker/yearAndMonth.js +0 -1
- package/lib/cjs/dropdown/dropdownMenu.d.ts +0 -2
- package/lib/cjs/dropdown/dropdownMenu.js +1 -7
- package/lib/cjs/dropdown/index.d.ts +3 -1
- package/lib/cjs/dropdown/index.js +5 -2
- package/lib/cjs/select/index.js +1 -1
- package/lib/cjs/tooltip/index.d.ts +9 -0
- package/lib/cjs/tooltip/index.js +9 -1
- package/lib/es/_base/base.css +1 -0
- package/lib/es/cascader/item.d.ts +1 -1
- package/lib/es/cascader/item.js +12 -6
- package/lib/es/datePicker/yearAndMonth.js +0 -1
- package/lib/es/dropdown/dropdownMenu.d.ts +0 -2
- package/lib/es/dropdown/dropdownMenu.js +1 -7
- package/lib/es/dropdown/index.d.ts +3 -1
- package/lib/es/dropdown/index.js +5 -2
- package/lib/es/select/index.js +1 -1
- package/lib/es/tooltip/index.d.ts +9 -0
- package/lib/es/tooltip/index.js +8 -1
- package/package.json +7 -7
package/dist/umd/semi-ui.js
CHANGED
|
@@ -17967,6 +17967,10 @@ var isUndefined_default = /*#__PURE__*/__webpack_require__.n(isUndefined);
|
|
|
17967
17967
|
var external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_ = __webpack_require__("faye");
|
|
17968
17968
|
var external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default = /*#__PURE__*/__webpack_require__.n(external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_);
|
|
17969
17969
|
|
|
17970
|
+
// EXTERNAL MODULE: /home/runner/work/semi-design/semi-design/node_modules/lodash/isEqual.js
|
|
17971
|
+
var isEqual = __webpack_require__("nnRT");
|
|
17972
|
+
var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual);
|
|
17973
|
+
|
|
17970
17974
|
// EXTERNAL MODULE: /home/runner/work/semi-design/semi-design/node_modules/lodash/isFunction.js
|
|
17971
17975
|
var isFunction = __webpack_require__("2q8g");
|
|
17972
17976
|
var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction);
|
|
@@ -18219,6 +18223,14 @@ class foundation_Tooltip extends foundation {
|
|
|
18219
18223
|
const content = this.getProp('content');
|
|
18220
18224
|
const trigger = this.getProp('trigger');
|
|
18221
18225
|
const clickTriggerToHide = this.getProp('clickTriggerToHide');
|
|
18226
|
+
const {
|
|
18227
|
+
visible
|
|
18228
|
+
} = this.getStates();
|
|
18229
|
+
|
|
18230
|
+
if (visible) {
|
|
18231
|
+
return;
|
|
18232
|
+
}
|
|
18233
|
+
|
|
18222
18234
|
this.clearDelayTimer();
|
|
18223
18235
|
/**
|
|
18224
18236
|
* If you emit an event in setState callback, you need to place the event listener function before setState to execute.
|
|
@@ -18234,9 +18246,11 @@ class foundation_Tooltip extends foundation {
|
|
|
18234
18246
|
this._togglePortalVisible(true);
|
|
18235
18247
|
});
|
|
18236
18248
|
|
|
18237
|
-
|
|
18249
|
+
this._adapter.insertPortal(content, {
|
|
18250
|
+
left: -9999,
|
|
18251
|
+
top: -9999
|
|
18252
|
+
}); // offscreen rendering
|
|
18238
18253
|
|
|
18239
|
-
this._adapter.insertPortal(content, position);
|
|
18240
18254
|
|
|
18241
18255
|
if (trigger === 'custom') {
|
|
18242
18256
|
// eslint-disable-next-line
|
|
@@ -18282,17 +18296,32 @@ class foundation_Tooltip extends foundation {
|
|
|
18282
18296
|
containerRect = (isEmpty_default()(containerRect) ? _this._adapter.getPopupContainerRect() : containerRect) || Object.assign({}, defaultRect);
|
|
18283
18297
|
wrapperRect = (isEmpty_default()(wrapperRect) ? _this._adapter.getWrapperBounding() : wrapperRect) || Object.assign({}, defaultRect); // console.log('containerRect: ', containerRect, 'triggerRect: ', triggerRect, 'wrapperRect: ', wrapperRect);
|
|
18284
18298
|
|
|
18285
|
-
let style = _this.calcPosStyle(
|
|
18299
|
+
let style = _this.calcPosStyle({
|
|
18300
|
+
triggerRect,
|
|
18301
|
+
wrapperRect,
|
|
18302
|
+
containerRect
|
|
18303
|
+
});
|
|
18286
18304
|
|
|
18287
18305
|
let position = _this.getProp('position');
|
|
18288
18306
|
|
|
18289
18307
|
if (_this.getProp('autoAdjustOverflow')) {
|
|
18290
18308
|
// console.log('style: ', style, '\ntriggerRect: ', triggerRect, '\nwrapperRect: ', wrapperRect);
|
|
18291
|
-
const
|
|
18309
|
+
const {
|
|
18310
|
+
position: adjustedPos,
|
|
18311
|
+
isHeightOverFlow,
|
|
18312
|
+
isWidthOverFlow
|
|
18313
|
+
} = _this.adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect);
|
|
18292
18314
|
|
|
18293
|
-
if (position !== adjustedPos) {
|
|
18315
|
+
if (position !== adjustedPos || isHeightOverFlow || isWidthOverFlow) {
|
|
18294
18316
|
position = adjustedPos;
|
|
18295
|
-
style = _this.calcPosStyle(
|
|
18317
|
+
style = _this.calcPosStyle({
|
|
18318
|
+
triggerRect,
|
|
18319
|
+
wrapperRect,
|
|
18320
|
+
containerRect,
|
|
18321
|
+
position,
|
|
18322
|
+
spacing: null,
|
|
18323
|
+
isOverFlow: [isHeightOverFlow, isWidthOverFlow]
|
|
18324
|
+
});
|
|
18296
18325
|
}
|
|
18297
18326
|
}
|
|
18298
18327
|
|
|
@@ -18430,6 +18459,29 @@ class foundation_Tooltip extends foundation {
|
|
|
18430
18459
|
this._adapter.unregisterResizeHandler(this.onResize);
|
|
18431
18460
|
}
|
|
18432
18461
|
|
|
18462
|
+
_adjustPos() {
|
|
18463
|
+
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18464
|
+
let isVertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18465
|
+
let adjustType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'reverse';
|
|
18466
|
+
let concatPos = arguments.length > 3 ? arguments[3] : undefined;
|
|
18467
|
+
|
|
18468
|
+
switch (adjustType) {
|
|
18469
|
+
case 'reverse':
|
|
18470
|
+
return this._reversePos(position, isVertical);
|
|
18471
|
+
|
|
18472
|
+
case 'expand':
|
|
18473
|
+
// only happens when position is top/bottom/left/right
|
|
18474
|
+
return this._expandPos(position, concatPos);
|
|
18475
|
+
|
|
18476
|
+
case 'reduce':
|
|
18477
|
+
// only happens when position other than top/bottom/left/right
|
|
18478
|
+
return this._reducePos(position);
|
|
18479
|
+
|
|
18480
|
+
default:
|
|
18481
|
+
return this._reversePos(position, isVertical);
|
|
18482
|
+
}
|
|
18483
|
+
}
|
|
18484
|
+
|
|
18433
18485
|
_reversePos() {
|
|
18434
18486
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18435
18487
|
let isVertical = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -18449,6 +18501,19 @@ class foundation_Tooltip extends foundation {
|
|
|
18449
18501
|
return position;
|
|
18450
18502
|
}
|
|
18451
18503
|
|
|
18504
|
+
_expandPos() {
|
|
18505
|
+
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18506
|
+
let concatPos = arguments.length > 1 ? arguments[1] : undefined;
|
|
18507
|
+
return position.concat(concatPos);
|
|
18508
|
+
}
|
|
18509
|
+
|
|
18510
|
+
_reducePos() {
|
|
18511
|
+
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18512
|
+
// if cur position consists of two directions, remove the last position
|
|
18513
|
+
const found = ['Top', 'Bottom', 'Left', 'Right'].find(pos => position.endsWith(pos));
|
|
18514
|
+
return found ? position.replace(found, '') : position;
|
|
18515
|
+
}
|
|
18516
|
+
|
|
18452
18517
|
clearDelayTimer() {
|
|
18453
18518
|
if (this._timer) {
|
|
18454
18519
|
clearTimeout(this._timer);
|
|
@@ -18609,12 +18674,16 @@ class foundation_Tooltip extends foundation {
|
|
|
18609
18674
|
return null;
|
|
18610
18675
|
}
|
|
18611
18676
|
|
|
18612
|
-
calcPosStyle(
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18677
|
+
calcPosStyle(props) {
|
|
18678
|
+
const {
|
|
18679
|
+
spacing,
|
|
18680
|
+
isOverFlow
|
|
18681
|
+
} = props;
|
|
18682
|
+
const triggerRect = (isEmpty_default()(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
|
|
18683
|
+
const containerRect = (isEmpty_default()(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
|
|
18684
|
+
const wrapperRect = (isEmpty_default()(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect); // eslint-disable-next-line
|
|
18616
18685
|
|
|
18617
|
-
position = position != null ? position : this.getProp('position'); // eslint-disable-next-line
|
|
18686
|
+
const position = props.position != null ? props.position : this.getProp('position'); // eslint-disable-next-line
|
|
18618
18687
|
|
|
18619
18688
|
const SPACING = spacing != null ? spacing : this.getProp('spacing');
|
|
18620
18689
|
const {
|
|
@@ -18644,79 +18713,112 @@ class foundation_Tooltip extends foundation {
|
|
|
18644
18713
|
const middleY = triggerRect.top + triggerRect.height / 2;
|
|
18645
18714
|
const offsetXWithArrow = positionOffsetX + horizontalArrowWidth / 2;
|
|
18646
18715
|
const offsetYWithArrow = positionOffsetY + verticalArrowHeight / 2;
|
|
18716
|
+
const heightDifference = wrapperRect.height - containerRect.height;
|
|
18717
|
+
const widthDifference = wrapperRect.width - containerRect.width;
|
|
18718
|
+
const offsetHeight = heightDifference > 0 ? heightDifference : 0;
|
|
18719
|
+
const offsetWidth = widthDifference > 0 ? widthDifference : 0;
|
|
18720
|
+
const isHeightOverFlow = isOverFlow && isOverFlow[0];
|
|
18721
|
+
const isWidthOverFlow = isOverFlow && isOverFlow[1];
|
|
18722
|
+
const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
|
|
18723
|
+
const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
|
|
18647
18724
|
|
|
18648
18725
|
switch (position) {
|
|
18649
18726
|
case 'top':
|
|
18650
|
-
left = middleX;
|
|
18651
|
-
top = triggerRect.top - SPACING;
|
|
18727
|
+
// left = middleX;
|
|
18728
|
+
// top = triggerRect.top - SPACING;
|
|
18729
|
+
left = isWidthOverFlow ? isTriggerNearLeft ? containerRect.left + wrapperRect.width / 2 : containerRect.right - wrapperRect.width / 2 + offsetWidth : middleX;
|
|
18730
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
18652
18731
|
translateX = -0.5;
|
|
18653
18732
|
translateY = -1;
|
|
18654
18733
|
break;
|
|
18655
18734
|
|
|
18656
18735
|
case 'topLeft':
|
|
18657
|
-
left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18658
|
-
top = triggerRect.top - SPACING;
|
|
18736
|
+
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18737
|
+
// top = triggerRect.top - SPACING;
|
|
18738
|
+
left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18739
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
18659
18740
|
translateY = -1;
|
|
18660
18741
|
break;
|
|
18661
18742
|
|
|
18662
18743
|
case 'topRight':
|
|
18663
|
-
left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18664
|
-
top = triggerRect.top - SPACING;
|
|
18744
|
+
// left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18745
|
+
// top = triggerRect.top - SPACING;
|
|
18746
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth : pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18747
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
|
|
18665
18748
|
translateY = -1;
|
|
18666
18749
|
translateX = -1;
|
|
18667
18750
|
break;
|
|
18668
18751
|
|
|
18669
18752
|
case 'left':
|
|
18670
|
-
left = triggerRect.left - SPACING;
|
|
18671
|
-
top = middleY;
|
|
18753
|
+
// left = triggerRect.left - SPACING;
|
|
18754
|
+
// top = middleY;
|
|
18755
|
+
// left = isWidthOverFlow? containerRect.right - SPACING : triggerRect.left - SPACING;
|
|
18756
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
|
|
18757
|
+
top = isHeightOverFlow ? isTriggerNearTop ? containerRect.top + wrapperRect.height / 2 : containerRect.bottom - wrapperRect.height / 2 + offsetHeight : middleY;
|
|
18672
18758
|
translateX = -1;
|
|
18673
18759
|
translateY = -0.5;
|
|
18674
18760
|
break;
|
|
18675
18761
|
|
|
18676
18762
|
case 'leftTop':
|
|
18677
|
-
left = triggerRect.left - SPACING;
|
|
18678
|
-
top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18763
|
+
// left = triggerRect.left - SPACING;
|
|
18764
|
+
// top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18765
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
|
|
18766
|
+
top = isHeightOverFlow ? containerRect.top : pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18679
18767
|
translateX = -1;
|
|
18680
18768
|
break;
|
|
18681
18769
|
|
|
18682
18770
|
case 'leftBottom':
|
|
18683
|
-
left = triggerRect.left - SPACING;
|
|
18684
|
-
top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18771
|
+
// left = triggerRect.left - SPACING;
|
|
18772
|
+
// top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18773
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth - SPACING + offsetXWithArrow : triggerRect.left - SPACING;
|
|
18774
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18685
18775
|
translateX = -1;
|
|
18686
18776
|
translateY = -1;
|
|
18687
18777
|
break;
|
|
18688
18778
|
|
|
18689
18779
|
case 'bottom':
|
|
18690
|
-
left = middleX;
|
|
18691
|
-
top = triggerRect.top + triggerRect.height + SPACING;
|
|
18780
|
+
// left = middleX;
|
|
18781
|
+
// top = triggerRect.top + triggerRect.height + SPACING;
|
|
18782
|
+
left = isWidthOverFlow ? isTriggerNearLeft ? containerRect.left + wrapperRect.width / 2 : containerRect.right - wrapperRect.width / 2 + offsetWidth : middleX;
|
|
18783
|
+
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
18692
18784
|
translateX = -0.5;
|
|
18693
18785
|
break;
|
|
18694
18786
|
|
|
18695
18787
|
case 'bottomLeft':
|
|
18696
|
-
left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18697
|
-
top = triggerRect.bottom + SPACING;
|
|
18788
|
+
// left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18789
|
+
// top = triggerRect.bottom + SPACING;
|
|
18790
|
+
left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
|
|
18791
|
+
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
18698
18792
|
break;
|
|
18699
18793
|
|
|
18700
18794
|
case 'bottomRight':
|
|
18701
|
-
left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18702
|
-
top = triggerRect.bottom + SPACING;
|
|
18795
|
+
// left = pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18796
|
+
// top = triggerRect.bottom + SPACING;
|
|
18797
|
+
left = isWidthOverFlow ? containerRect.right + offsetWidth : pointAtCenter ? middleX + offsetXWithArrow : triggerRect.right;
|
|
18798
|
+
top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
|
|
18703
18799
|
translateX = -1;
|
|
18704
18800
|
break;
|
|
18705
18801
|
|
|
18706
18802
|
case 'right':
|
|
18707
|
-
left = triggerRect.right + SPACING;
|
|
18708
|
-
top = middleY;
|
|
18803
|
+
// left = triggerRect.right + SPACING;
|
|
18804
|
+
// top = middleY;
|
|
18805
|
+
left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
|
|
18806
|
+
top = isHeightOverFlow ? isTriggerNearTop ? containerRect.top + wrapperRect.height / 2 : containerRect.bottom - wrapperRect.height / 2 + offsetHeight : middleY;
|
|
18709
18807
|
translateY = -0.5;
|
|
18710
18808
|
break;
|
|
18711
18809
|
|
|
18712
18810
|
case 'rightTop':
|
|
18713
|
-
left = triggerRect.right + SPACING;
|
|
18714
|
-
top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18811
|
+
// left = triggerRect.right + SPACING;
|
|
18812
|
+
// top = pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18813
|
+
left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
|
|
18814
|
+
top = isHeightOverFlow ? containerRect.top : pointAtCenter ? middleY - offsetYWithArrow : triggerRect.top;
|
|
18715
18815
|
break;
|
|
18716
18816
|
|
|
18717
18817
|
case 'rightBottom':
|
|
18718
|
-
left = triggerRect.right + SPACING;
|
|
18719
|
-
top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18818
|
+
// left = triggerRect.right + SPACING;
|
|
18819
|
+
// top = pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18820
|
+
left = isWidthOverFlow ? containerRect.left - SPACING + offsetXWithArrow : triggerRect.right + SPACING;
|
|
18821
|
+
top = isHeightOverFlow ? containerRect.bottom + offsetHeight : pointAtCenter ? middleY + offsetYWithArrow : triggerRect.bottom;
|
|
18720
18822
|
translateY = -1;
|
|
18721
18823
|
break;
|
|
18722
18824
|
|
|
@@ -18823,12 +18925,53 @@ class foundation_Tooltip extends foundation {
|
|
|
18823
18925
|
|
|
18824
18926
|
isLR() {
|
|
18825
18927
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18826
|
-
return position.
|
|
18928
|
+
return position.includes('left') || position.includes('right');
|
|
18827
18929
|
}
|
|
18828
18930
|
|
|
18829
18931
|
isTB() {
|
|
18830
18932
|
let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18831
|
-
return position.
|
|
18933
|
+
return position.includes('top') || position.includes('bottom');
|
|
18934
|
+
}
|
|
18935
|
+
|
|
18936
|
+
isReverse(rowSpace, reverseSpace, size) {
|
|
18937
|
+
// 原空间不足,反向空间足够
|
|
18938
|
+
// Insufficient original space, enough reverse space
|
|
18939
|
+
return rowSpace < size && reverseSpace > size;
|
|
18940
|
+
}
|
|
18941
|
+
|
|
18942
|
+
isOverFlow(rowSpace, reverseSpace, size) {
|
|
18943
|
+
// 原空间且反向空间都不足
|
|
18944
|
+
// The original space and the reverse space are not enough
|
|
18945
|
+
return rowSpace < size && reverseSpace < size;
|
|
18946
|
+
}
|
|
18947
|
+
|
|
18948
|
+
isHalfOverFlow(posSpace, negSpace, size) {
|
|
18949
|
+
// 正半空间或者负半空间不足,即表示有遮挡,需要偏移
|
|
18950
|
+
// Insufficient positive half space or negative half space means that there is occlusion and needs to be offset
|
|
18951
|
+
return posSpace < size || negSpace < size;
|
|
18952
|
+
}
|
|
18953
|
+
|
|
18954
|
+
isHalfAllEnough(posSpace, negSpace, size) {
|
|
18955
|
+
// 正半空间和负半空间都足够,即表示可以从 topLeft/topRight 变成 top
|
|
18956
|
+
// Both positive and negative half-spaces are sufficient, which means you can change from topLeft/topRight to top
|
|
18957
|
+
return posSpace >= size || negSpace >= size;
|
|
18958
|
+
}
|
|
18959
|
+
|
|
18960
|
+
getReverse(viewOverFlow, containerOverFlow, shouldReverseView, shouldReverseContainer) {
|
|
18961
|
+
/**
|
|
18962
|
+
* 基于视口和容器一起判断,以下几种情况允许从原方向转到反方向,以判断是否应该由top->bottom为例子
|
|
18963
|
+
*
|
|
18964
|
+
* 1. 视口上下空间不足 且 容器上空间❌下空间✅
|
|
18965
|
+
* 2. 视口上空间❌下空间✅ 且 容器上下空间不足
|
|
18966
|
+
* 3. 视口上空间❌下空间✅ 且 容器上空间❌下空间✅
|
|
18967
|
+
*
|
|
18968
|
+
* 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
|
|
18969
|
+
* to judge whether it should be top->bottom as an example
|
|
18970
|
+
* 1. There is insufficient space above and below the viewport and the space above the container ❌ the space below ✅
|
|
18971
|
+
* 2. The space above the viewport ❌ the space below ✅ and the space above and below the container is insufficient
|
|
18972
|
+
* 3. Viewport upper space ❌ lower space✅ and container upper space ❌ lower space✅
|
|
18973
|
+
*/
|
|
18974
|
+
return viewOverFlow && shouldReverseContainer || shouldReverseView && containerOverFlow || shouldReverseView && shouldReverseContainer;
|
|
18832
18975
|
} // place the dom correctly
|
|
18833
18976
|
|
|
18834
18977
|
|
|
@@ -18838,8 +18981,15 @@ class foundation_Tooltip extends foundation {
|
|
|
18838
18981
|
innerHeight
|
|
18839
18982
|
} = window;
|
|
18840
18983
|
const {
|
|
18841
|
-
spacing
|
|
18984
|
+
spacing,
|
|
18985
|
+
margin
|
|
18842
18986
|
} = this.getProps();
|
|
18987
|
+
const marginLeft = typeof margin === 'number' ? margin : margin.marginLeft;
|
|
18988
|
+
const marginTop = typeof margin === 'number' ? margin : margin.marginTop;
|
|
18989
|
+
const marginRight = typeof margin === 'number' ? margin : margin.marginRight;
|
|
18990
|
+
const marginBottom = typeof margin === 'number' ? margin : margin.marginBottom;
|
|
18991
|
+
let isHeightOverFlow = false;
|
|
18992
|
+
let isWidthOverFlow = false;
|
|
18843
18993
|
|
|
18844
18994
|
if (wrapperRect.width > 0 && wrapperRect.height > 0) {
|
|
18845
18995
|
// let clientLeft = left + translateX * wrapperRect.width - containerRect.scrollLeft;
|
|
@@ -18862,187 +19012,324 @@ class foundation_Tooltip extends foundation {
|
|
|
18862
19012
|
const restClientBottom = innerHeight - clientBottom;
|
|
18863
19013
|
const widthIsBigger = wrapperRect.width > triggerRect.width;
|
|
18864
19014
|
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
|
|
19015
|
+
// 基于视口的微调判断
|
|
19016
|
+
// Fine-tuning judgment based on viewport
|
|
19017
|
+
|
|
19018
|
+
const shouldViewReverseTop = clientTop - marginTop < wrapperRect.height + spacing && restClientBottom - marginBottom > wrapperRect.height + spacing;
|
|
19019
|
+
const shouldViewReverseLeft = clientLeft - marginLeft < wrapperRect.width + spacing && restClientRight - marginRight > wrapperRect.width + spacing;
|
|
19020
|
+
const shouldViewReverseBottom = restClientBottom - marginBottom < wrapperRect.height + spacing && clientTop - marginTop > wrapperRect.height + spacing;
|
|
19021
|
+
const shouldViewReverseRight = restClientRight - marginRight < wrapperRect.width + spacing && clientLeft - marginLeft > wrapperRect.width + spacing;
|
|
19022
|
+
const shouldViewReverseTopOver = restClientTop - marginBottom < wrapperRect.height + spacing && clientBottom - marginTop > wrapperRect.height + spacing;
|
|
19023
|
+
const shouldViewReverseBottomOver = clientBottom - marginTop < wrapperRect.height + spacing && restClientTop - marginBottom > wrapperRect.height + spacing;
|
|
19024
|
+
const shouldViewReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
|
|
19025
|
+
const shouldViewReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
|
|
19026
|
+
const shouldViewReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
19027
|
+
const shouldViewReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
18870
19028
|
const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
|
|
18871
19029
|
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
19030
|
const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
18877
|
-
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
19031
|
+
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width; // 基于容器的微调判断
|
|
19032
|
+
// Fine-tuning judgment based on container
|
|
19033
|
+
|
|
19034
|
+
const clientTopInContainer = clientTop - containerRect.top;
|
|
19035
|
+
const clientLeftInContainer = clientLeft - containerRect.left;
|
|
19036
|
+
const clientBottomInContainer = clientTopInContainer + triggerRect.height;
|
|
19037
|
+
const clientRightInContainer = clientLeftInContainer + triggerRect.width;
|
|
19038
|
+
const restClientBottomInContainer = containerRect.bottom - clientBottom;
|
|
19039
|
+
const restClientRightInContainer = containerRect.right - clientRight;
|
|
19040
|
+
const restClientTopInContainer = restClientBottomInContainer + triggerRect.height;
|
|
19041
|
+
const restClientLeftInContainer = restClientRightInContainer + triggerRect.width; // 当原空间不足,反向空间足够时,可以反向。
|
|
19042
|
+
// When the original space is insufficient and the reverse space is sufficient, the reverse can be performed.
|
|
19043
|
+
|
|
19044
|
+
const shouldContainerReverseTop = this.isReverse(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19045
|
+
const shouldContainerReverseLeft = this.isReverse(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
|
|
19046
|
+
const shouldContainerReverseBottom = this.isReverse(restClientBottomInContainer - marginBottom, clientTopInContainer - marginTop, wrapperRect.height + spacing);
|
|
19047
|
+
const shouldContainerReverseRight = this.isReverse(restClientRightInContainer - marginRight, clientLeftInContainer - marginLeft, wrapperRect.width + spacing);
|
|
19048
|
+
const shouldContainerReverseTopOver = this.isReverse(restClientTopInContainer - marginBottom, clientBottomInContainer - marginTop, wrapperRect.height + spacing);
|
|
19049
|
+
const shouldContainerReverseBottomOver = this.isReverse(clientBottomInContainer - marginTop, restClientTopInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19050
|
+
const shouldContainerReverseTopSide = this.isReverse(restClientTopInContainer, clientBottomInContainer, wrapperRect.height);
|
|
19051
|
+
const shouldContainerReverseBottomSide = this.isReverse(clientBottomInContainer, restClientTopInContainer, wrapperRect.height);
|
|
19052
|
+
const shouldContainerReverseLeftSide = this.isReverse(restClientLeftInContainer, clientRightInContainer, wrapperRect.width);
|
|
19053
|
+
const shouldContainerReverseRightSide = this.isReverse(clientRightInContainer, restClientLeftInContainer, wrapperRect.width);
|
|
19054
|
+
const halfHeight = triggerRect.height / 2;
|
|
19055
|
+
const halfWidth = triggerRect.width / 2; // 视口, 原空间与反向空间是否都不足判断
|
|
19056
|
+
// Viewport, whether the original space and the reverse space are insufficient to judge
|
|
19057
|
+
|
|
19058
|
+
const isViewYOverFlow = this.isOverFlow(clientTop - marginTop, restClientBottom - marginBottom, wrapperRect.height + spacing);
|
|
19059
|
+
const isViewXOverFlow = this.isOverFlow(clientLeft - marginLeft, restClientRight - marginRight, wrapperRect.width + spacing);
|
|
19060
|
+
const isViewYOverFlowSide = this.isOverFlow(clientBottom - marginTop, restClientTop - marginBottom, wrapperRect.height + spacing);
|
|
19061
|
+
const isViewXOverFlowSide = this.isOverFlow(clientRight - marginLeft, restClientLeft - marginRight, wrapperRect.width + spacing);
|
|
19062
|
+
const isViewYOverFlowSideHalf = this.isHalfOverFlow(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
|
|
19063
|
+
const isViewXOverFlowSideHalf = this.isHalfOverFlow(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2);
|
|
19064
|
+
const isViewYEnoughSideHalf = this.isHalfAllEnough(clientBottom - halfHeight, restClientTop - halfHeight, wrapperRect.height / 2);
|
|
19065
|
+
const isViewXEnoughSideHalf = this.isHalfAllEnough(clientRight - halfWidth, restClientLeft - halfWidth, wrapperRect.width / 2); // 容器, 原空间与反向空间是否都不足判断
|
|
19066
|
+
// container, whether the original space and the reverse space are insufficient to judge
|
|
19067
|
+
|
|
19068
|
+
const isContainerYOverFlow = this.isOverFlow(clientTopInContainer - marginTop, restClientBottomInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19069
|
+
const isContainerXOverFlow = this.isOverFlow(clientLeftInContainer - marginLeft, restClientRightInContainer - marginRight, wrapperRect.width + spacing);
|
|
19070
|
+
const isContainerYOverFlowSide = this.isOverFlow(clientBottomInContainer - marginTop, restClientTopInContainer - marginBottom, wrapperRect.height + spacing);
|
|
19071
|
+
const isContainerXOverFlowSide = this.isOverFlow(clientRightInContainer - marginLeft, restClientLeftInContainer - marginRight, wrapperRect.width + spacing);
|
|
19072
|
+
const isContainerYOverFlowSideHalf = this.isHalfOverFlow(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
|
|
19073
|
+
const isContainerXOverFlowSideHalf = this.isHalfOverFlow(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2);
|
|
19074
|
+
const isContainerYEnoughSideHalf = this.isHalfAllEnough(clientBottomInContainer - halfHeight, restClientTopInContainer - halfHeight, wrapperRect.height / 2);
|
|
19075
|
+
const isContainerXEnoughSideHalf = this.isHalfAllEnough(clientRightInContainer - halfWidth, restClientLeftInContainer - halfWidth, wrapperRect.width / 2); // 综合 viewport + container 判断微调,即视口 + 容器都放置不行时才能考虑位置调整
|
|
19076
|
+
// Comprehensive viewport + container judgment fine-tuning, that is, the position adjustment can only be considered when the viewport + container cannot be placed.
|
|
19077
|
+
|
|
19078
|
+
const shouldReverseTop = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseTop, shouldContainerReverseTop);
|
|
19079
|
+
const shouldReverseLeft = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseLeft, shouldContainerReverseLeft);
|
|
19080
|
+
const shouldReverseBottom = this.getReverse(isViewYOverFlow, isContainerYOverFlow, shouldViewReverseBottom, shouldContainerReverseBottom);
|
|
19081
|
+
const shouldReverseRight = this.getReverse(isViewXOverFlow, isContainerXOverFlow, shouldViewReverseRight, shouldContainerReverseRight); // const shouldReverseTopOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopOver, shouldContainerReverseTopOver);
|
|
19082
|
+
// const shouldReverseBottomOver = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomOver, shouldContainerReverseBottomOver);
|
|
19083
|
+
|
|
19084
|
+
const shouldReverseTopSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseTopSide, shouldContainerReverseTopSide);
|
|
19085
|
+
const shouldReverseBottomSide = this.getReverse(isViewYOverFlowSide, isContainerYOverFlowSide, shouldViewReverseBottomSide, shouldContainerReverseBottomSide);
|
|
19086
|
+
const shouldReverseLeftSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseLeftSide, shouldContainerReverseLeftSide);
|
|
19087
|
+
const shouldReverseRightSide = this.getReverse(isViewXOverFlowSide, isContainerXOverFlowSide, shouldViewReverseRightSide, shouldContainerReverseRightSide);
|
|
19088
|
+
const isYOverFlowSideHalf = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
19089
|
+
const isXOverFlowSideHalf = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
18878
19090
|
|
|
18879
19091
|
switch (position) {
|
|
18880
19092
|
case 'top':
|
|
18881
19093
|
if (shouldReverseTop) {
|
|
18882
|
-
position = this.
|
|
19094
|
+
position = this._adjustPos(position, true);
|
|
19095
|
+
}
|
|
19096
|
+
|
|
19097
|
+
if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
|
|
19098
|
+
position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
|
|
18883
19099
|
}
|
|
18884
19100
|
|
|
18885
19101
|
break;
|
|
18886
19102
|
|
|
18887
19103
|
case 'topLeft':
|
|
18888
19104
|
if (shouldReverseTop) {
|
|
18889
|
-
position = this.
|
|
19105
|
+
position = this._adjustPos(position, true);
|
|
18890
19106
|
}
|
|
18891
19107
|
|
|
18892
19108
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
18893
|
-
position = this.
|
|
19109
|
+
position = this._adjustPos(position, true);
|
|
19110
|
+
}
|
|
19111
|
+
|
|
19112
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19113
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18894
19114
|
}
|
|
18895
19115
|
|
|
18896
19116
|
break;
|
|
18897
19117
|
|
|
18898
19118
|
case 'topRight':
|
|
18899
19119
|
if (shouldReverseTop) {
|
|
18900
|
-
position = this.
|
|
19120
|
+
position = this._adjustPos(position, true);
|
|
18901
19121
|
}
|
|
18902
19122
|
|
|
18903
19123
|
if (shouldReverseRightSide && widthIsBigger) {
|
|
18904
|
-
position = this.
|
|
19124
|
+
position = this._adjustPos(position);
|
|
19125
|
+
}
|
|
19126
|
+
|
|
19127
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19128
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18905
19129
|
}
|
|
18906
19130
|
|
|
18907
19131
|
break;
|
|
18908
19132
|
|
|
18909
19133
|
case 'left':
|
|
18910
19134
|
if (shouldReverseLeft) {
|
|
18911
|
-
position = this.
|
|
19135
|
+
position = this._adjustPos(position);
|
|
19136
|
+
}
|
|
19137
|
+
|
|
19138
|
+
if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
|
|
19139
|
+
position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
|
|
18912
19140
|
}
|
|
18913
19141
|
|
|
18914
19142
|
break;
|
|
18915
19143
|
|
|
18916
19144
|
case 'leftTop':
|
|
18917
19145
|
if (shouldReverseLeft) {
|
|
18918
|
-
position = this.
|
|
19146
|
+
position = this._adjustPos(position);
|
|
18919
19147
|
}
|
|
18920
19148
|
|
|
18921
19149
|
if (shouldReverseTopSide && heightIsBigger) {
|
|
18922
|
-
position = this.
|
|
19150
|
+
position = this._adjustPos(position, true);
|
|
19151
|
+
}
|
|
19152
|
+
|
|
19153
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19154
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18923
19155
|
}
|
|
18924
19156
|
|
|
18925
19157
|
break;
|
|
18926
19158
|
|
|
18927
19159
|
case 'leftBottom':
|
|
18928
19160
|
if (shouldReverseLeft) {
|
|
18929
|
-
position = this.
|
|
19161
|
+
position = this._adjustPos(position);
|
|
18930
19162
|
}
|
|
18931
19163
|
|
|
18932
19164
|
if (shouldReverseBottomSide && heightIsBigger) {
|
|
18933
|
-
position = this.
|
|
19165
|
+
position = this._adjustPos(position, true);
|
|
19166
|
+
}
|
|
19167
|
+
|
|
19168
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19169
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18934
19170
|
}
|
|
18935
19171
|
|
|
18936
19172
|
break;
|
|
18937
19173
|
|
|
18938
19174
|
case 'bottom':
|
|
18939
19175
|
if (shouldReverseBottom) {
|
|
18940
|
-
position = this.
|
|
19176
|
+
position = this._adjustPos(position, true);
|
|
19177
|
+
}
|
|
19178
|
+
|
|
19179
|
+
if (isXOverFlowSideHalf && (shouldReverseLeftSide || shouldReverseRightSide)) {
|
|
19180
|
+
position = this._adjustPos(position, true, 'expand', shouldReverseLeftSide ? 'Right' : 'Left');
|
|
18941
19181
|
}
|
|
18942
19182
|
|
|
18943
19183
|
break;
|
|
18944
19184
|
|
|
18945
19185
|
case 'bottomLeft':
|
|
18946
19186
|
if (shouldReverseBottom) {
|
|
18947
|
-
position = this.
|
|
19187
|
+
position = this._adjustPos(position, true);
|
|
18948
19188
|
}
|
|
18949
19189
|
|
|
18950
19190
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
18951
|
-
position = this.
|
|
19191
|
+
position = this._adjustPos(position);
|
|
19192
|
+
}
|
|
19193
|
+
|
|
19194
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19195
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18952
19196
|
}
|
|
18953
19197
|
|
|
18954
19198
|
break;
|
|
18955
19199
|
|
|
18956
19200
|
case 'bottomRight':
|
|
18957
19201
|
if (shouldReverseBottom) {
|
|
18958
|
-
position = this.
|
|
19202
|
+
position = this._adjustPos(position, true);
|
|
18959
19203
|
}
|
|
18960
19204
|
|
|
18961
19205
|
if (shouldReverseRightSide && widthIsBigger) {
|
|
18962
|
-
position = this.
|
|
19206
|
+
position = this._adjustPos(position);
|
|
19207
|
+
}
|
|
19208
|
+
|
|
19209
|
+
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
19210
|
+
position = this._adjustPos(position, true, 'reduce');
|
|
18963
19211
|
}
|
|
18964
19212
|
|
|
18965
19213
|
break;
|
|
18966
19214
|
|
|
18967
19215
|
case 'right':
|
|
18968
19216
|
if (shouldReverseRight) {
|
|
18969
|
-
position = this.
|
|
19217
|
+
position = this._adjustPos(position);
|
|
19218
|
+
}
|
|
19219
|
+
|
|
19220
|
+
if (isYOverFlowSideHalf && (shouldReverseTopSide || shouldReverseBottomSide)) {
|
|
19221
|
+
position = this._adjustPos(position, false, 'expand', shouldReverseTopSide ? 'Bottom' : 'Top');
|
|
18970
19222
|
}
|
|
18971
19223
|
|
|
18972
19224
|
break;
|
|
18973
19225
|
|
|
18974
19226
|
case 'rightTop':
|
|
18975
19227
|
if (shouldReverseRight) {
|
|
18976
|
-
position = this.
|
|
19228
|
+
position = this._adjustPos(position);
|
|
18977
19229
|
}
|
|
18978
19230
|
|
|
18979
19231
|
if (shouldReverseTopSide && heightIsBigger) {
|
|
18980
|
-
position = this.
|
|
19232
|
+
position = this._adjustPos(position, true);
|
|
19233
|
+
}
|
|
19234
|
+
|
|
19235
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19236
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18981
19237
|
}
|
|
18982
19238
|
|
|
18983
19239
|
break;
|
|
18984
19240
|
|
|
18985
19241
|
case 'rightBottom':
|
|
18986
19242
|
if (shouldReverseRight) {
|
|
18987
|
-
position = this.
|
|
19243
|
+
position = this._adjustPos(position);
|
|
18988
19244
|
}
|
|
18989
19245
|
|
|
18990
19246
|
if (shouldReverseBottomSide && heightIsBigger) {
|
|
18991
|
-
position = this.
|
|
19247
|
+
position = this._adjustPos(position, true);
|
|
19248
|
+
}
|
|
19249
|
+
|
|
19250
|
+
if (isHeightOverFlow && (isViewYEnoughSideHalf || isContainerYEnoughSideHalf)) {
|
|
19251
|
+
position = this._adjustPos(position, false, 'reduce');
|
|
18992
19252
|
}
|
|
18993
19253
|
|
|
18994
19254
|
break;
|
|
18995
19255
|
|
|
18996
19256
|
case 'leftTopOver':
|
|
18997
19257
|
if (shouldReverseTopOver) {
|
|
18998
|
-
position = this.
|
|
19258
|
+
position = this._adjustPos(position, true);
|
|
18999
19259
|
}
|
|
19000
19260
|
|
|
19001
19261
|
if (shouldReverseLeftOver) {
|
|
19002
|
-
position = this.
|
|
19262
|
+
position = this._adjustPos(position);
|
|
19003
19263
|
}
|
|
19004
19264
|
|
|
19005
19265
|
break;
|
|
19006
19266
|
|
|
19007
19267
|
case 'leftBottomOver':
|
|
19008
19268
|
if (shouldReverseBottomOver) {
|
|
19009
|
-
position = this.
|
|
19269
|
+
position = this._adjustPos(position, true);
|
|
19010
19270
|
}
|
|
19011
19271
|
|
|
19012
19272
|
if (shouldReverseLeftOver) {
|
|
19013
|
-
position = this.
|
|
19273
|
+
position = this._adjustPos(position);
|
|
19014
19274
|
}
|
|
19015
19275
|
|
|
19016
19276
|
break;
|
|
19017
19277
|
|
|
19018
19278
|
case 'rightTopOver':
|
|
19019
19279
|
if (shouldReverseTopOver) {
|
|
19020
|
-
position = this.
|
|
19280
|
+
position = this._adjustPos(position, true);
|
|
19021
19281
|
}
|
|
19022
19282
|
|
|
19023
19283
|
if (shouldReverseRightOver) {
|
|
19024
|
-
position = this.
|
|
19284
|
+
position = this._adjustPos(position);
|
|
19025
19285
|
}
|
|
19026
19286
|
|
|
19027
19287
|
break;
|
|
19028
19288
|
|
|
19029
19289
|
case 'rightBottomOver':
|
|
19030
19290
|
if (shouldReverseBottomOver) {
|
|
19031
|
-
position = this.
|
|
19291
|
+
position = this._adjustPos(position, true);
|
|
19032
19292
|
}
|
|
19033
19293
|
|
|
19034
19294
|
if (shouldReverseRightOver) {
|
|
19035
|
-
position = this.
|
|
19295
|
+
position = this._adjustPos(position);
|
|
19036
19296
|
}
|
|
19037
19297
|
|
|
19038
19298
|
break;
|
|
19039
19299
|
|
|
19040
19300
|
default:
|
|
19041
19301
|
break;
|
|
19302
|
+
} // 判断溢出 Judgment overflow
|
|
19303
|
+
// 上下方向 top and bottom
|
|
19304
|
+
|
|
19305
|
+
|
|
19306
|
+
if (this.isTB(position)) {
|
|
19307
|
+
isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
|
|
19308
|
+
|
|
19309
|
+
if (position === 'top' || position === 'bottom') {
|
|
19310
|
+
isWidthOverFlow = isViewXOverFlowSideHalf && isContainerXOverFlowSideHalf;
|
|
19311
|
+
} else {
|
|
19312
|
+
isWidthOverFlow = isViewXOverFlowSide && isContainerXOverFlowSide;
|
|
19313
|
+
}
|
|
19314
|
+
} // 左右方向 left and right
|
|
19315
|
+
|
|
19316
|
+
|
|
19317
|
+
if (this.isLR(position)) {
|
|
19318
|
+
isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
|
|
19319
|
+
|
|
19320
|
+
if (position === 'left' || position === 'right') {
|
|
19321
|
+
isHeightOverFlow = isViewYOverFlowSideHalf && isContainerYOverFlowSideHalf;
|
|
19322
|
+
} else {
|
|
19323
|
+
isHeightOverFlow = isViewYOverFlowSide && isContainerYOverFlowSide;
|
|
19324
|
+
}
|
|
19042
19325
|
}
|
|
19043
19326
|
}
|
|
19044
19327
|
|
|
19045
|
-
return
|
|
19328
|
+
return {
|
|
19329
|
+
position,
|
|
19330
|
+
isHeightOverFlow,
|
|
19331
|
+
isWidthOverFlow
|
|
19332
|
+
};
|
|
19046
19333
|
}
|
|
19047
19334
|
|
|
19048
19335
|
_bindScrollEvent() {
|
|
@@ -19211,8 +19498,8 @@ const numbers = {
|
|
|
19211
19498
|
DEFAULT_Z_INDEX: 1060,
|
|
19212
19499
|
MOUSE_ENTER_DELAY: 50,
|
|
19213
19500
|
MOUSE_LEAVE_DELAY: 50,
|
|
19214
|
-
SPACING: 8
|
|
19215
|
-
|
|
19501
|
+
SPACING: 8,
|
|
19502
|
+
MARGIN: 0
|
|
19216
19503
|
};
|
|
19217
19504
|
|
|
19218
19505
|
// CONCATENATED MODULE: ../semi-foundation/utils/uuid.ts
|
|
@@ -19489,10 +19776,6 @@ const TriangleArrowVertical = props => {
|
|
|
19489
19776
|
width: prop_types_default.a.number,
|
|
19490
19777
|
height: prop_types_default.a.number
|
|
19491
19778
|
}));
|
|
19492
|
-
// EXTERNAL MODULE: /home/runner/work/semi-design/semi-design/node_modules/lodash/isEqual.js
|
|
19493
|
-
var isEqual = __webpack_require__("nnRT");
|
|
19494
|
-
var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual);
|
|
19495
|
-
|
|
19496
19779
|
// CONCATENATED MODULE: ./_cssAnimation/index.tsx
|
|
19497
19780
|
|
|
19498
19781
|
|
|
@@ -19631,6 +19914,7 @@ _cssAnimation_CSSAnimation.defaultProps = {
|
|
|
19631
19914
|
|
|
19632
19915
|
|
|
19633
19916
|
|
|
19917
|
+
|
|
19634
19918
|
var tooltip_rest = undefined && undefined.__rest || function (s, e) {
|
|
19635
19919
|
var t = {};
|
|
19636
19920
|
|
|
@@ -19898,6 +20182,10 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
|
|
|
19898
20182
|
return mergedEvents;
|
|
19899
20183
|
};
|
|
19900
20184
|
|
|
20185
|
+
this.getPopupId = () => {
|
|
20186
|
+
return this.state.id;
|
|
20187
|
+
};
|
|
20188
|
+
|
|
19901
20189
|
this.state = {
|
|
19902
20190
|
visible: false,
|
|
19903
20191
|
|
|
@@ -20210,7 +20498,7 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
|
|
|
20210
20498
|
this.props.visible ? this.foundation.delayShow() : this.foundation.delayHide();
|
|
20211
20499
|
}
|
|
20212
20500
|
|
|
20213
|
-
if (prevProps.rePosKey
|
|
20501
|
+
if (!isEqual_default()(prevProps.rePosKey, this.props.rePosKey)) {
|
|
20214
20502
|
this.rePosition();
|
|
20215
20503
|
}
|
|
20216
20504
|
}
|
|
@@ -20320,6 +20608,7 @@ tooltip_Tooltip.propTypes = {
|
|
|
20320
20608
|
onVisibleChange: prop_types_default.a.func,
|
|
20321
20609
|
onClickOutSide: prop_types_default.a.func,
|
|
20322
20610
|
spacing: prop_types_default.a.number,
|
|
20611
|
+
margin: prop_types_default.a.oneOfType([prop_types_default.a.number, prop_types_default.a.object]),
|
|
20323
20612
|
showArrow: prop_types_default.a.oneOfType([prop_types_default.a.bool, prop_types_default.a.node]),
|
|
20324
20613
|
zIndex: prop_types_default.a.number,
|
|
20325
20614
|
rePosKey: prop_types_default.a.oneOfType([prop_types_default.a.string, prop_types_default.a.number]),
|
|
@@ -20349,6 +20638,7 @@ tooltip_Tooltip.defaultProps = {
|
|
|
20349
20638
|
onVisibleChange: noop_default.a,
|
|
20350
20639
|
onClickOutSide: noop_default.a,
|
|
20351
20640
|
spacing: numbers.SPACING,
|
|
20641
|
+
margin: numbers.MARGIN,
|
|
20352
20642
|
showArrow: true,
|
|
20353
20643
|
wrapWhenSpecial: true,
|
|
20354
20644
|
zIndex: numbers.DEFAULT_Z_INDEX,
|
|
@@ -22859,6 +23149,13 @@ const IconWindowAdaptionStroked_IconComponent = convertIcon(IconWindowAdaptionSt
|
|
|
22859
23149
|
|
|
22860
23150
|
|
|
22861
23151
|
|
|
23152
|
+
|
|
23153
|
+
|
|
23154
|
+
|
|
23155
|
+
|
|
23156
|
+
|
|
23157
|
+
|
|
23158
|
+
|
|
22862
23159
|
|
|
22863
23160
|
|
|
22864
23161
|
|
|
@@ -40525,27 +40822,33 @@ class item_Item extends external_root_React_commonjs2_react_commonjs_react_amd_r
|
|
|
40525
40822
|
return state;
|
|
40526
40823
|
};
|
|
40527
40824
|
|
|
40528
|
-
this.renderIcon = type
|
|
40825
|
+
this.renderIcon = function (type) {
|
|
40826
|
+
let haveMarginLeft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
40827
|
+
|
|
40828
|
+
const finalCls = style => {
|
|
40829
|
+
return style + (haveMarginLeft ? " ".concat(item_prefixcls, "-icon-left") : '');
|
|
40830
|
+
};
|
|
40831
|
+
|
|
40529
40832
|
switch (type) {
|
|
40530
40833
|
case 'child':
|
|
40531
40834
|
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")
|
|
40835
|
+
className: finalCls("".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-expand"))
|
|
40533
40836
|
});
|
|
40534
40837
|
|
|
40535
40838
|
case 'tick':
|
|
40536
40839
|
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")
|
|
40840
|
+
className: finalCls("".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-active"))
|
|
40538
40841
|
});
|
|
40539
40842
|
|
|
40540
40843
|
case 'loading':
|
|
40541
40844
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(spin_0, {
|
|
40542
|
-
wrapperClassName: "".concat(item_prefixcls, "-spin-icon")
|
|
40845
|
+
wrapperClassName: finalCls("".concat(item_prefixcls, "-spin-icon"))
|
|
40543
40846
|
});
|
|
40544
40847
|
|
|
40545
40848
|
case 'empty':
|
|
40546
40849
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
|
|
40547
40850
|
"aria-hidden": true,
|
|
40548
|
-
className: "".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-empty")
|
|
40851
|
+
className: finalCls("".concat(item_prefixcls, "-icon ").concat(item_prefixcls, "-icon-empty"))
|
|
40549
40852
|
});
|
|
40550
40853
|
|
|
40551
40854
|
default:
|
|
@@ -40693,7 +40996,7 @@ class item_Item extends external_root_React_commonjs2_react_commonjs_react_amd_r
|
|
|
40693
40996
|
indeterminate: halfCheckedKeys.has(item.key),
|
|
40694
40997
|
checked: checkedKeys.has(item.key),
|
|
40695
40998
|
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);
|
|
40999
|
+
}), /*#__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
41000
|
})));
|
|
40698
41001
|
|
|
40699
41002
|
if (showChildItem) {
|
|
@@ -56546,7 +56849,6 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
56546
56849
|
disabledDate,
|
|
56547
56850
|
yearAndMonthOpts
|
|
56548
56851
|
} = this.props;
|
|
56549
|
-
console.log('yearAndMonthOpts', yearAndMonthOpts);
|
|
56550
56852
|
|
|
56551
56853
|
let transform = val => val;
|
|
56552
56854
|
|
|
@@ -60122,26 +60424,39 @@ class foundation_DropdownFoundation extends foundation {
|
|
|
60122
60424
|
this._adapter.setPopVisible(visible);
|
|
60123
60425
|
|
|
60124
60426
|
this._adapter.notifyVisibleChange(visible);
|
|
60427
|
+
|
|
60428
|
+
const {
|
|
60429
|
+
trigger
|
|
60430
|
+
} = this.getProps();
|
|
60431
|
+
|
|
60432
|
+
if (visible && trigger === "click") {
|
|
60433
|
+
const popupId = this._adapter.getPopupId();
|
|
60434
|
+
|
|
60435
|
+
this.setFocusToFirstMenuItem(popupId);
|
|
60436
|
+
}
|
|
60125
60437
|
}
|
|
60126
60438
|
|
|
60127
|
-
getMenuItemNodes(
|
|
60128
|
-
const id = target.attributes['data-popupid'].value;
|
|
60439
|
+
getMenuItemNodes(id) {
|
|
60129
60440
|
const menuWrapper = document.getElementById(id); // if has dropdown item, the item must wrapped by li
|
|
60130
60441
|
|
|
60131
60442
|
return menuWrapper ? Array.from(menuWrapper.getElementsByTagName('li')).filter(item => item.ariaDisabled === "false") : null;
|
|
60132
60443
|
}
|
|
60133
60444
|
|
|
60134
|
-
setFocusToFirstMenuItem(
|
|
60135
|
-
const menuItemNodes = this.getMenuItemNodes(
|
|
60445
|
+
setFocusToFirstMenuItem(id) {
|
|
60446
|
+
const menuItemNodes = this.getMenuItemNodes(id);
|
|
60136
60447
|
menuItemNodes && setFocusToFirstItem(menuItemNodes);
|
|
60137
60448
|
}
|
|
60138
60449
|
|
|
60139
|
-
setFocusToLastMenuItem(
|
|
60140
|
-
const menuItemNodes = this.getMenuItemNodes(
|
|
60450
|
+
setFocusToLastMenuItem(id) {
|
|
60451
|
+
const menuItemNodes = this.getMenuItemNodes(id);
|
|
60141
60452
|
menuItemNodes && setFocusToLastItem(menuItemNodes);
|
|
60142
60453
|
}
|
|
60143
60454
|
|
|
60144
60455
|
handleKeyDown(event) {
|
|
60456
|
+
var _a, _b;
|
|
60457
|
+
|
|
60458
|
+
const id = (_b = (_a = event.target) === null || _a === void 0 ? void 0 : _a.attributes['data-popupid']) === null || _b === void 0 ? void 0 : _b.value;
|
|
60459
|
+
|
|
60145
60460
|
switch (event.key) {
|
|
60146
60461
|
case ' ':
|
|
60147
60462
|
case 'Enter':
|
|
@@ -60151,12 +60466,12 @@ class foundation_DropdownFoundation extends foundation {
|
|
|
60151
60466
|
break;
|
|
60152
60467
|
|
|
60153
60468
|
case 'ArrowDown':
|
|
60154
|
-
this.setFocusToFirstMenuItem(
|
|
60469
|
+
this.setFocusToFirstMenuItem(id);
|
|
60155
60470
|
handlePrevent(event);
|
|
60156
60471
|
break;
|
|
60157
60472
|
|
|
60158
60473
|
case 'ArrowUp':
|
|
60159
|
-
this.setFocusToLastMenuItem(
|
|
60474
|
+
this.setFocusToLastMenuItem(id);
|
|
60160
60475
|
handlePrevent(event);
|
|
60161
60476
|
break;
|
|
60162
60477
|
|
|
@@ -60174,17 +60489,6 @@ class menuFoundation_DropdownMenuFoundation extends foundation {
|
|
|
60174
60489
|
super(...arguments);
|
|
60175
60490
|
this.menuItemNodes = null;
|
|
60176
60491
|
this.firstChars = [];
|
|
60177
|
-
} // if trigger is click, auto focus to the first menu item
|
|
60178
|
-
|
|
60179
|
-
|
|
60180
|
-
autoFocus(ulElement) {
|
|
60181
|
-
const trigger = this._adapter.getContext('trigger');
|
|
60182
|
-
|
|
60183
|
-
if (trigger === 'click') {
|
|
60184
|
-
// find all non-disabled li under this menu and set focus to the first menu
|
|
60185
|
-
this.menuItemNodes = [...ulElement.getElementsByTagName('li')].filter(item => item.ariaDisabled !== "true");
|
|
60186
|
-
setFocusToFirstItem(this.menuItemNodes);
|
|
60187
|
-
}
|
|
60188
60492
|
}
|
|
60189
60493
|
|
|
60190
60494
|
handleEscape(menu) {
|
|
@@ -60286,7 +60590,6 @@ const dropdownMenu_prefixCls = dropdown_constants_cssClasses.PREFIX;
|
|
|
60286
60590
|
class dropdownMenu_DropdownMenu extends baseComponent_BaseComponent {
|
|
60287
60591
|
constructor(props) {
|
|
60288
60592
|
super(props);
|
|
60289
|
-
this.menuRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
60290
60593
|
this.foundation = new menuFoundation_DropdownMenuFoundation(this.adapter);
|
|
60291
60594
|
}
|
|
60292
60595
|
|
|
@@ -60294,10 +60597,6 @@ class dropdownMenu_DropdownMenu extends baseComponent_BaseComponent {
|
|
|
60294
60597
|
return Object.assign({}, super.adapter);
|
|
60295
60598
|
}
|
|
60296
60599
|
|
|
60297
|
-
componentDidMount() {
|
|
60298
|
-
this.foundation.autoFocus(this.menuRef.current);
|
|
60299
|
-
}
|
|
60300
|
-
|
|
60301
60600
|
render() {
|
|
60302
60601
|
const _a = this.props,
|
|
60303
60602
|
{
|
|
@@ -60309,8 +60608,7 @@ class dropdownMenu_DropdownMenu extends baseComponent_BaseComponent {
|
|
|
60309
60608
|
|
|
60310
60609
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("ul", Object.assign({
|
|
60311
60610
|
role: "menu",
|
|
60312
|
-
"aria-orientation": "vertical"
|
|
60313
|
-
ref: this.menuRef
|
|
60611
|
+
"aria-orientation": "vertical"
|
|
60314
60612
|
}, rest, {
|
|
60315
60613
|
className: classnames_default()("".concat(dropdownMenu_prefixCls, "-menu"), className),
|
|
60316
60614
|
style: style,
|
|
@@ -60543,6 +60841,7 @@ class dropdown_Dropdown extends baseComponent_BaseComponent {
|
|
|
60543
60841
|
popVisible: props.visible
|
|
60544
60842
|
};
|
|
60545
60843
|
this.foundation = new foundation_DropdownFoundation(this.adapter);
|
|
60844
|
+
this.tooltipRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
60546
60845
|
}
|
|
60547
60846
|
|
|
60548
60847
|
get adapter() {
|
|
@@ -60550,7 +60849,8 @@ class dropdown_Dropdown extends baseComponent_BaseComponent {
|
|
|
60550
60849
|
setPopVisible: popVisible => this.setState({
|
|
60551
60850
|
popVisible
|
|
60552
60851
|
}),
|
|
60553
|
-
notifyVisibleChange: visible => this.props.onVisibleChange(visible)
|
|
60852
|
+
notifyVisibleChange: visible => this.props.onVisibleChange(visible),
|
|
60853
|
+
getPopupId: () => this.tooltipRef.current.getPopupId()
|
|
60554
60854
|
});
|
|
60555
60855
|
}
|
|
60556
60856
|
|
|
@@ -60707,7 +61007,8 @@ class dropdown_Dropdown extends baseComponent_BaseComponent {
|
|
|
60707
61007
|
trigger: trigger,
|
|
60708
61008
|
onVisibleChange: this.handleVisibleChange,
|
|
60709
61009
|
showArrow: false,
|
|
60710
|
-
returnFocusOnClose: true
|
|
61010
|
+
returnFocusOnClose: true,
|
|
61011
|
+
ref: this.tooltipRef
|
|
60711
61012
|
}, attr), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.isValidElement(children) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.cloneElement(children, {
|
|
60712
61013
|
//@ts-ignore
|
|
60713
61014
|
className: classnames_default()(get_default()(children, 'props.className'), {
|
|
@@ -71830,7 +72131,7 @@ class select_Select extends baseComponent_BaseComponent {
|
|
|
71830
72131
|
} // Add isOptionChanged: There may be cases where the value is unchanged, but the optionList is updated. At this time, the label corresponding to the value may change, and the selected item needs to be updated
|
|
71831
72132
|
|
|
71832
72133
|
|
|
71833
|
-
if (
|
|
72134
|
+
if (!isEqual_default()(this.props.value, prevProps.value) || isOptionsChanged) {
|
|
71834
72135
|
if ('value' in this.props) {
|
|
71835
72136
|
this.foundation.handleValueChange(this.props.value);
|
|
71836
72137
|
} else {
|