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