shineout 3.3.6-beta.2 → 3.3.6-beta.3
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/cjs/index.js +1 -1
- package/dist/shineout.js +243 -136
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -476,5 +476,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
476
476
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
477
477
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
478
478
|
var _default = exports.default = {
|
|
479
|
-
version: '3.3.6-beta.
|
|
479
|
+
version: '3.3.6-beta.3'
|
|
480
480
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -11968,7 +11968,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
11968
11968
|
};
|
|
11969
11969
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
11970
11970
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
11971
|
-
/* harmony default export */ var version = ('3.3.6-beta.
|
|
11971
|
+
/* harmony default export */ var version = ('3.3.6-beta.3');
|
|
11972
11972
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
11973
11973
|
|
|
11974
11974
|
|
|
@@ -26045,7 +26045,8 @@ var tooltipStyle = objectSpread2_default()(objectSpread2_default()({}, tooltip_a
|
|
|
26045
26045
|
backgroundColor: src.tooltipDangerBackgroundColor,
|
|
26046
26046
|
color: src.tooltipDangerColor
|
|
26047
26047
|
},
|
|
26048
|
-
'&::before': {
|
|
26048
|
+
// '&::before': {
|
|
26049
|
+
'& $arrow': {
|
|
26049
26050
|
'z-index': 1,
|
|
26050
26051
|
position: 'absolute',
|
|
26051
26052
|
content: '" "',
|
|
@@ -26060,19 +26061,13 @@ var tooltipStyle = objectSpread2_default()(objectSpread2_default()({}, tooltip_a
|
|
|
26060
26061
|
},
|
|
26061
26062
|
'&[data-soui-position^="bottom"]': {
|
|
26062
26063
|
marginTop: arrowGap - 2,
|
|
26063
|
-
'
|
|
26064
|
-
top: '0',
|
|
26065
|
-
left: '0',
|
|
26066
|
-
right: '0',
|
|
26067
|
-
margin: 'auto'
|
|
26068
|
-
},
|
|
26069
|
-
'&[dir=ltr]::before': {
|
|
26064
|
+
'&[dir=ltr] $arrow': {
|
|
26070
26065
|
transform: 'translate(0, -50%) rotate(-45deg)'
|
|
26071
26066
|
},
|
|
26072
|
-
'&[dir=rtl]
|
|
26067
|
+
'&[dir=rtl] $arrow': {
|
|
26073
26068
|
transform: 'translate(0, -50%) rotate(45deg)'
|
|
26074
26069
|
},
|
|
26075
|
-
'
|
|
26070
|
+
'& $arrow::after': {
|
|
26076
26071
|
top: arrowGap * -1,
|
|
26077
26072
|
left: '0',
|
|
26078
26073
|
right: '0',
|
|
@@ -26084,105 +26079,105 @@ var tooltipStyle = objectSpread2_default()(objectSpread2_default()({}, tooltip_a
|
|
|
26084
26079
|
},
|
|
26085
26080
|
'&[data-soui-position^="top"]': {
|
|
26086
26081
|
marginTop: (arrowGap - 2) * -1,
|
|
26087
|
-
'
|
|
26088
|
-
bottom: '0',
|
|
26089
|
-
transform: 'translate(0, 50%) rotate(135deg)',
|
|
26090
|
-
left: '0',
|
|
26091
|
-
right: '0',
|
|
26092
|
-
margin: 'auto'
|
|
26093
|
-
},
|
|
26094
|
-
'&[dir=ltr]::before': {
|
|
26082
|
+
'&[dir=ltr] $arrow': {
|
|
26095
26083
|
transform: 'translate(0, 50%) rotate(135deg)'
|
|
26096
26084
|
},
|
|
26097
|
-
'&[dir=rtl]
|
|
26085
|
+
'&[dir=rtl] $arrow': {
|
|
26098
26086
|
transform: 'translate(0, 50%) rotate(-135deg)'
|
|
26099
|
-
},
|
|
26100
|
-
'&::after': {
|
|
26101
|
-
bottom: arrowGap * -1,
|
|
26102
|
-
left: '0',
|
|
26103
|
-
right: '0',
|
|
26104
|
-
content: '" "',
|
|
26105
|
-
display: 'block',
|
|
26106
|
-
height: arrowGap,
|
|
26107
|
-
position: 'absolute'
|
|
26108
26087
|
}
|
|
26088
|
+
// '&::before': {
|
|
26089
|
+
// bottom: '0',
|
|
26090
|
+
// transform: 'translate(0, 50%) rotate(135deg)',
|
|
26091
|
+
// left: '0',
|
|
26092
|
+
// right: '0',
|
|
26093
|
+
// margin: 'auto',
|
|
26094
|
+
// },
|
|
26095
|
+
// '&[dir=ltr]::before': {
|
|
26096
|
+
// transform: 'translate(0, 50%) rotate(135deg)',
|
|
26097
|
+
// },
|
|
26098
|
+
// '&[dir=rtl]::before': {
|
|
26099
|
+
// transform: 'translate(0, 50%) rotate(-135deg)',
|
|
26100
|
+
// },
|
|
26101
|
+
// '&::after': {
|
|
26102
|
+
// bottom: arrowGap * -1,
|
|
26103
|
+
// left: '0',
|
|
26104
|
+
// right: '0',
|
|
26105
|
+
// content: '" "',
|
|
26106
|
+
// display: 'block',
|
|
26107
|
+
// height: arrowGap,
|
|
26108
|
+
// position: 'absolute',
|
|
26109
|
+
// },
|
|
26109
26110
|
},
|
|
26110
26111
|
'&[data-soui-position^="left"]': {
|
|
26111
26112
|
marginLeft: (arrowGap - 2) * -1,
|
|
26112
|
-
'&[dir=ltr]': {
|
|
26113
|
-
marginLeft: (arrowGap - 2) * -1
|
|
26114
|
-
},
|
|
26115
|
-
'&[dir=rtl]': {
|
|
26116
|
-
marginRight: (arrowGap - 2) * -1
|
|
26117
|
-
},
|
|
26118
|
-
'&::before': {
|
|
26119
|
-
right: 0,
|
|
26120
|
-
top: '0',
|
|
26121
|
-
bottom: '0',
|
|
26122
|
-
margin: 'auto'
|
|
26123
|
-
},
|
|
26124
|
-
'&[dir=ltr]::before': {
|
|
26113
|
+
'&[dir=ltr] $arrow': {
|
|
26125
26114
|
transform: 'translate(50%, 0) rotate(45deg)'
|
|
26126
26115
|
},
|
|
26127
|
-
'&[dir=rtl]
|
|
26116
|
+
'&[dir=rtl] $arrow': {
|
|
26128
26117
|
transform: 'translate(50%, 0) rotate(135deg)'
|
|
26129
|
-
},
|
|
26130
|
-
'&::after': {
|
|
26131
|
-
left: arrowGap * -1,
|
|
26132
|
-
top: '0',
|
|
26133
|
-
bottom: '0',
|
|
26134
|
-
content: '" "',
|
|
26135
|
-
display: 'block',
|
|
26136
|
-
width: arrowGap,
|
|
26137
|
-
position: 'absolute'
|
|
26138
26118
|
}
|
|
26119
|
+
|
|
26120
|
+
// '&[dir=ltr]': { marginLeft: (arrowGap - 2) * -1 },
|
|
26121
|
+
// '&[dir=rtl]': { marginRight: (arrowGap - 2) * -1 },
|
|
26122
|
+
// '&::before': {
|
|
26123
|
+
// right: 0,
|
|
26124
|
+
// top: '0',
|
|
26125
|
+
// bottom: '0',
|
|
26126
|
+
// margin: 'auto',
|
|
26127
|
+
// },
|
|
26128
|
+
// '&[dir=ltr]::before': {
|
|
26129
|
+
// transform: 'translate(50%, 0) rotate(45deg)',
|
|
26130
|
+
// },
|
|
26131
|
+
// '&[dir=rtl]::before': {
|
|
26132
|
+
// transform: 'translate(50%, 0) rotate(135deg)',
|
|
26133
|
+
// },
|
|
26134
|
+
// '&::after': {
|
|
26135
|
+
// left: arrowGap * -1,
|
|
26136
|
+
// top: '0',
|
|
26137
|
+
// bottom: '0',
|
|
26138
|
+
// content: '" "',
|
|
26139
|
+
// display: 'block',
|
|
26140
|
+
// width: arrowGap,
|
|
26141
|
+
// position: 'absolute',
|
|
26142
|
+
// },
|
|
26139
26143
|
},
|
|
26140
26144
|
'&[data-soui-position^="right"]': {
|
|
26141
26145
|
marginLeft: arrowGap - 2,
|
|
26142
|
-
'&[dir=ltr]': {
|
|
26143
|
-
marginLeft: arrowGap - 2
|
|
26144
|
-
},
|
|
26145
|
-
'&[dir=rtl]': {
|
|
26146
|
-
marginRight: arrowGap - 2
|
|
26147
|
-
},
|
|
26148
|
-
'&::before': {
|
|
26149
|
-
left: '0',
|
|
26150
|
-
top: '0',
|
|
26151
|
-
bottom: '0',
|
|
26152
|
-
margin: 'auto'
|
|
26153
|
-
},
|
|
26154
|
-
'&[dir=ltr]::before': {
|
|
26146
|
+
'&[dir=ltr] $arrow': {
|
|
26155
26147
|
transform: 'translate(-50%, 0) rotate(-135deg)'
|
|
26156
26148
|
},
|
|
26157
|
-
'&[dir=rtl]
|
|
26149
|
+
'&[dir=rtl] $arrow': {
|
|
26158
26150
|
transform: 'translate(-50%, 0) rotate(-45deg)'
|
|
26159
|
-
},
|
|
26160
|
-
'&::after': {
|
|
26161
|
-
left: arrowGap * -1,
|
|
26162
|
-
top: '0',
|
|
26163
|
-
bottom: '0',
|
|
26164
|
-
content: '" "',
|
|
26165
|
-
display: 'block',
|
|
26166
|
-
width: arrowGap,
|
|
26167
|
-
position: 'absolute'
|
|
26168
26151
|
}
|
|
26169
|
-
|
|
26170
|
-
|
|
26171
|
-
|
|
26172
|
-
|
|
26173
|
-
|
|
26174
|
-
|
|
26175
|
-
|
|
26176
|
-
|
|
26177
|
-
|
|
26178
|
-
|
|
26179
|
-
|
|
26180
|
-
|
|
26181
|
-
|
|
26182
|
-
|
|
26183
|
-
|
|
26184
|
-
|
|
26152
|
+
|
|
26153
|
+
// '&[dir=ltr]': { marginLeft: arrowGap - 2 },
|
|
26154
|
+
// '&[dir=rtl]': { marginRight: arrowGap - 2 },
|
|
26155
|
+
// '&::before': {
|
|
26156
|
+
// left: '0',
|
|
26157
|
+
// top: '0',
|
|
26158
|
+
// bottom: '0',
|
|
26159
|
+
// margin: 'auto',
|
|
26160
|
+
// },
|
|
26161
|
+
// '&[dir=ltr]::before': {
|
|
26162
|
+
// transform: 'translate(-50%, 0) rotate(-135deg)',
|
|
26163
|
+
// },
|
|
26164
|
+
// '&[dir=rtl]::before': {
|
|
26165
|
+
// transform: 'translate(-50%, 0) rotate(-45deg)',
|
|
26166
|
+
// },
|
|
26167
|
+
// '&::after': {
|
|
26168
|
+
// left: arrowGap * -1,
|
|
26169
|
+
// top: '0',
|
|
26170
|
+
// bottom: '0',
|
|
26171
|
+
// content: '" "',
|
|
26172
|
+
// display: 'block',
|
|
26173
|
+
// width: arrowGap,
|
|
26174
|
+
// position: 'absolute',
|
|
26175
|
+
// },
|
|
26185
26176
|
}
|
|
26177
|
+
// '&&[data-soui-position$="-left"]::before': { left: arrowMargin, right: 'auto' },
|
|
26178
|
+
// '&&[data-soui-position$="-right"]::before': { right: arrowMargin, left: 'auto' },
|
|
26179
|
+
// '&&[data-soui-position$="-top"]::before': { top: arrowMargin, bottom: 'auto' },
|
|
26180
|
+
// '&&[data-soui-position$="-bottom"]::before': { bottom: arrowMargin, top: 'auto' },
|
|
26186
26181
|
},
|
|
26187
26182
|
wrapperOpen: {
|
|
26188
26183
|
display: 'block',
|
|
@@ -26202,6 +26197,12 @@ var tooltipStyle = objectSpread2_default()(objectSpread2_default()({}, tooltip_a
|
|
|
26202
26197
|
target: {
|
|
26203
26198
|
display: 'inline-block'
|
|
26204
26199
|
},
|
|
26200
|
+
arrow: {
|
|
26201
|
+
// before
|
|
26202
|
+
'&::before': {
|
|
26203
|
+
content: "''"
|
|
26204
|
+
}
|
|
26205
|
+
},
|
|
26205
26206
|
content: {
|
|
26206
26207
|
padding: "".concat(src.tooltipPaddingY, " ").concat(src.tooltipPaddingX),
|
|
26207
26208
|
fontSize: src.tooltipFontSize
|
|
@@ -28308,6 +28309,10 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28308
28309
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
28309
28310
|
style = _useState2[0],
|
|
28310
28311
|
setStyle = _useState2[1];
|
|
28312
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
|
|
28313
|
+
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
28314
|
+
arrayStyle = _useState4[0],
|
|
28315
|
+
setArrayStyle = _useState4[1];
|
|
28311
28316
|
var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({
|
|
28312
28317
|
element: null,
|
|
28313
28318
|
containerRect: {
|
|
@@ -28381,10 +28386,12 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28381
28386
|
};
|
|
28382
28387
|
};
|
|
28383
28388
|
var getAbsolutePositionStyle = function getAbsolutePositionStyle(rect, position) {
|
|
28389
|
+
var _popupElRef$current;
|
|
28384
28390
|
var style = {
|
|
28385
28391
|
position: 'absolute',
|
|
28386
28392
|
zIndex: zIndex
|
|
28387
28393
|
};
|
|
28394
|
+
var arrayStyle = {};
|
|
28388
28395
|
if (fixedWidth) {
|
|
28389
28396
|
var widthKey = fixedWidth === 'min' ? 'minWidth' : 'width';
|
|
28390
28397
|
style[widthKey] = rect.width;
|
|
@@ -28394,6 +28401,7 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28394
28401
|
var containerRect = rootContainer.getBoundingClientRect();
|
|
28395
28402
|
var bodyRect = (document.documentElement || document.body).getBoundingClientRect();
|
|
28396
28403
|
var containerScrollBarWidth = rootContainer.offsetWidth - rootContainer.clientWidth;
|
|
28404
|
+
var targetRect = (_popupElRef$current = popupElRef.current) === null || _popupElRef$current === void 0 ? void 0 : _popupElRef$current.getBoundingClientRect();
|
|
28397
28405
|
var containerScroll = {
|
|
28398
28406
|
left: rootContainer.scrollLeft,
|
|
28399
28407
|
top: rootContainer.scrollTop
|
|
@@ -28410,14 +28418,25 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28410
28418
|
if (h === 'left') {
|
|
28411
28419
|
style.left = rect.left - containerRect.left + containerScroll.left;
|
|
28412
28420
|
style.transform = '';
|
|
28421
|
+
arrayStyle.left = "8px";
|
|
28413
28422
|
if (adjust) {
|
|
28414
28423
|
overRight = rect.left + context.popUpWidth - bodyRect.right + containerScrollBarWidth;
|
|
28424
|
+
if (style.left < 0 && targetRect) {
|
|
28425
|
+
style.left = 'auto';
|
|
28426
|
+
}
|
|
28415
28427
|
}
|
|
28416
28428
|
} else if (h === 'right') {
|
|
28417
28429
|
style.right = containerRect.right - rect.right + containerScrollBarWidth - containerScroll.left;
|
|
28418
28430
|
style.left = 'auto';
|
|
28419
28431
|
style.transform = '';
|
|
28420
|
-
|
|
28432
|
+
arrayStyle.right = "8px";
|
|
28433
|
+
if (adjust) {
|
|
28434
|
+
overLeft = bodyRect.left - (rect.right - context.popUpWidth);
|
|
28435
|
+
if (style.right < 0 && targetRect) {
|
|
28436
|
+
style.left = bodyRect.width - targetRect.width;
|
|
28437
|
+
style.right = 'auto';
|
|
28438
|
+
}
|
|
28439
|
+
}
|
|
28421
28440
|
} else {
|
|
28422
28441
|
// 居中对齐
|
|
28423
28442
|
style.left = rect.left + rect.width / 2 - containerRect.left + containerScroll.left;
|
|
@@ -28426,6 +28445,9 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28426
28445
|
overRight = rect.left + rect.width / 2 + context.popUpWidth / 2 - bodyRect.width + containerScrollBarWidth;
|
|
28427
28446
|
overLeft = bodyRect.left - (rect.left + rect.width / 2 - context.popUpWidth / 2);
|
|
28428
28447
|
}
|
|
28448
|
+
if (targetRect) {
|
|
28449
|
+
arrayStyle.left = "".concat(targetRect.width / 2 - 5.9, "px");
|
|
28450
|
+
}
|
|
28429
28451
|
}
|
|
28430
28452
|
if (adjust) {
|
|
28431
28453
|
// 调节左右溢出
|
|
@@ -28434,16 +28456,26 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28434
28456
|
style.left -= overRight;
|
|
28435
28457
|
// 扣除触发器距离页面右侧的距离,以保证从右侧弹出的窗口最右边对齐触发器最右边
|
|
28436
28458
|
style.left -= toRightDistance;
|
|
28459
|
+
if (targetRect) {
|
|
28460
|
+
arrayStyle.left = "".concat((targetRect === null || targetRect === void 0 ? void 0 : targetRect.width) - context.parentRect.width / 2 - 5.9, "px");
|
|
28461
|
+
}
|
|
28437
28462
|
}
|
|
28438
28463
|
if (overLeft > 0) {
|
|
28439
28464
|
style.left += overLeft;
|
|
28465
|
+
arrayStyle.left = "".concat(rect.width / 2 - 5.9, "px");
|
|
28440
28466
|
}
|
|
28441
28467
|
}
|
|
28442
28468
|
if (v === 'bottom') {
|
|
28443
28469
|
style.top = rect.bottom - containerRect.top + containerScroll.top + popupGap;
|
|
28470
|
+
if (targetRect) {
|
|
28471
|
+
arrayStyle.top = "".concat(0, "px");
|
|
28472
|
+
}
|
|
28444
28473
|
} else {
|
|
28445
28474
|
style.top = rect.top - containerRect.top + containerScroll.top - popupGap;
|
|
28446
28475
|
style.transform += 'translateY(-100%)';
|
|
28476
|
+
if (targetRect) {
|
|
28477
|
+
arrayStyle.top = "".concat(targetRect.height - 5.9 - 4, "px");
|
|
28478
|
+
}
|
|
28447
28479
|
}
|
|
28448
28480
|
} else if (horizontalPosition.includes(targetPosition)) {
|
|
28449
28481
|
var _targetPosition$split3 = targetPosition.split('-'),
|
|
@@ -28453,46 +28485,61 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28453
28485
|
if (_v === 'top') {
|
|
28454
28486
|
style.top = rect.top - containerRect.top + containerScroll.top;
|
|
28455
28487
|
style.transform = '';
|
|
28488
|
+
arrayStyle.top = "8px";
|
|
28456
28489
|
} else if (_v === 'bottom') {
|
|
28457
28490
|
style.top = rect.bottom - containerRect.top + containerScroll.top;
|
|
28491
|
+
arrayStyle.bottom = "8px";
|
|
28458
28492
|
style.transform = 'translateY(-100%)';
|
|
28459
28493
|
} else {
|
|
28460
28494
|
// 居中对齐
|
|
28461
28495
|
style.top = rect.top - containerRect.top + containerScroll.top + rect.height / 2;
|
|
28496
|
+
if (targetRect) {
|
|
28497
|
+
arrayStyle.top = "".concat(targetRect.height / 2 - 5.9 / 2, "px");
|
|
28498
|
+
}
|
|
28462
28499
|
style.transform = 'translateY(-50%)';
|
|
28463
28500
|
}
|
|
28464
28501
|
if (_h === 'right') {
|
|
28465
28502
|
style.left = rect.right - containerRect.left + containerScroll.left + popupGap;
|
|
28466
28503
|
} else {
|
|
28467
28504
|
style.left = rect.left - containerRect.left + containerScroll.left - popupGap;
|
|
28505
|
+
arrayStyle.right = "0px";
|
|
28468
28506
|
style.transform += ' translateX(-100%)';
|
|
28469
28507
|
}
|
|
28470
28508
|
} else if (position === 'cover') {
|
|
28471
28509
|
style.top = rect.top - containerRect.top + containerScroll.top;
|
|
28472
28510
|
style.left = rect.left - containerRect.left + containerScroll.left;
|
|
28473
28511
|
}
|
|
28474
|
-
return
|
|
28512
|
+
return {
|
|
28513
|
+
style: style,
|
|
28514
|
+
arrayStyle: arrayStyle
|
|
28515
|
+
};
|
|
28475
28516
|
};
|
|
28476
28517
|
var getAbsoluteStyle = function getAbsoluteStyle(position) {
|
|
28477
|
-
if (!parentElRef.current) return
|
|
28518
|
+
if (!parentElRef.current) return {
|
|
28519
|
+
style: hideStyle
|
|
28520
|
+
};
|
|
28478
28521
|
var rect = context.parentRect;
|
|
28479
|
-
console.log('======================');
|
|
28480
|
-
console.log('rect: >>', rect);
|
|
28481
|
-
console.log('======================');
|
|
28482
28522
|
if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current) {
|
|
28483
28523
|
var _scrollElRef$current;
|
|
28484
28524
|
var visibleRect = ((_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.getBoundingClientRect()) || {};
|
|
28485
28525
|
if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
|
|
28486
|
-
return
|
|
28526
|
+
return {
|
|
28527
|
+
style: hideStyle
|
|
28528
|
+
};
|
|
28487
28529
|
}
|
|
28488
28530
|
}
|
|
28489
|
-
var
|
|
28531
|
+
var _getAbsolutePositionS = getAbsolutePositionStyle(rect, position),
|
|
28532
|
+
style = _getAbsolutePositionS.style,
|
|
28533
|
+
arrayStyle = _getAbsolutePositionS.arrayStyle;
|
|
28490
28534
|
|
|
28491
28535
|
// TODO: 如果是版本大于chrome128,需要根据currentCSSZoom处理chrome的bug
|
|
28492
28536
|
if (!isChromeLowerThan(128)) {
|
|
28493
28537
|
// @ts-ignore currentCSSZoom
|
|
28494
28538
|
var currentCSSZoom = document.body.currentCSSZoom;
|
|
28495
|
-
if (currentCSSZoom === 1 || !currentCSSZoom) return
|
|
28539
|
+
if (currentCSSZoom === 1 || !currentCSSZoom) return {
|
|
28540
|
+
style: style,
|
|
28541
|
+
arrayStyle: arrayStyle
|
|
28542
|
+
};
|
|
28496
28543
|
if (style.left && typeof style.left === 'number') {
|
|
28497
28544
|
style.left = style.left * (1 / currentCSSZoom);
|
|
28498
28545
|
}
|
|
@@ -28506,14 +28553,20 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28506
28553
|
style.bottom = style.bottom * (1 / currentCSSZoom);
|
|
28507
28554
|
}
|
|
28508
28555
|
}
|
|
28509
|
-
return
|
|
28556
|
+
return {
|
|
28557
|
+
style: style,
|
|
28558
|
+
arrayStyle: arrayStyle
|
|
28559
|
+
};
|
|
28510
28560
|
};
|
|
28511
28561
|
var getStyle = function getStyle() {
|
|
28512
28562
|
var newStyle = {};
|
|
28563
|
+
var newArrayStyle = {};
|
|
28513
28564
|
var _ref2 = config || {},
|
|
28514
28565
|
position = _ref2.position,
|
|
28515
28566
|
absolute = _ref2.absolute;
|
|
28516
|
-
if (!position || !show || !parentElRef.current) return
|
|
28567
|
+
if (!position || !show || !parentElRef.current) return {
|
|
28568
|
+
newStyle: style
|
|
28569
|
+
};
|
|
28517
28570
|
context.parentRect = parentElRef.current.getBoundingClientRect();
|
|
28518
28571
|
if (adjust) {
|
|
28519
28572
|
var popupInfo = getPopUpInfo(context.parentRect);
|
|
@@ -28528,22 +28581,35 @@ var usePositionStyle = function usePositionStyle(config) {
|
|
|
28528
28581
|
fixedWidth: fixedWidth
|
|
28529
28582
|
});
|
|
28530
28583
|
} else {
|
|
28531
|
-
|
|
28584
|
+
var _ref3 = getAbsoluteStyle(realPosition),
|
|
28585
|
+
nextStyle = _ref3.style,
|
|
28586
|
+
nextArrayStyle = _ref3.arrayStyle;
|
|
28587
|
+
newStyle = nextStyle;
|
|
28588
|
+
newArrayStyle = nextArrayStyle;
|
|
28532
28589
|
}
|
|
28533
28590
|
// for animation
|
|
28534
28591
|
if (realPosition.indexOf('top') === 0) {
|
|
28535
28592
|
newStyle.transformOrigin = 'center bottom';
|
|
28536
28593
|
}
|
|
28537
|
-
return
|
|
28594
|
+
return {
|
|
28595
|
+
newStyle: newStyle,
|
|
28596
|
+
newArrayStyle: newArrayStyle
|
|
28597
|
+
};
|
|
28538
28598
|
};
|
|
28539
28599
|
var updateStyle = use_persist_fn(function () {
|
|
28540
|
-
var
|
|
28600
|
+
var _getStyle = getStyle(),
|
|
28601
|
+
newStyle = _getStyle.newStyle,
|
|
28602
|
+
newArrayStyle = _getStyle.newArrayStyle;
|
|
28541
28603
|
if (newStyle && !shallow_equal(style, newStyle)) {
|
|
28542
28604
|
setStyle(newStyle);
|
|
28605
|
+
setArrayStyle(newArrayStyle || {});
|
|
28543
28606
|
}
|
|
28544
28607
|
});
|
|
28545
28608
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth]);
|
|
28546
|
-
return
|
|
28609
|
+
return {
|
|
28610
|
+
style: style,
|
|
28611
|
+
arrayStyle: arrayStyle
|
|
28612
|
+
};
|
|
28547
28613
|
};
|
|
28548
28614
|
/* harmony default export */ var use_position_style = ((/* unused pure expression or super */ null && (usePositionStyle)));
|
|
28549
28615
|
// EXTERNAL MODULE: external {"root":"ReactDOM","commonjs2":"react-dom","commonjs":"react-dom","amd":"react-dom"}
|
|
@@ -29188,6 +29254,7 @@ var AbsoluteList = function AbsoluteList(props) {
|
|
|
29188
29254
|
_props$zIndex = props.zIndex,
|
|
29189
29255
|
zIndex = _props$zIndex === void 0 ? 1051 : _props$zIndex,
|
|
29190
29256
|
focus = props.focus,
|
|
29257
|
+
arrowRef = props.arrowRef,
|
|
29191
29258
|
popupElRef = props.popupElRef,
|
|
29192
29259
|
updateKey = props.updateKey,
|
|
29193
29260
|
popupGap = props.popupGap,
|
|
@@ -29206,23 +29273,33 @@ var AbsoluteList = function AbsoluteList(props) {
|
|
|
29206
29273
|
rendered: false
|
|
29207
29274
|
}),
|
|
29208
29275
|
context = _useRef.current;
|
|
29209
|
-
var
|
|
29210
|
-
|
|
29211
|
-
|
|
29212
|
-
|
|
29213
|
-
|
|
29214
|
-
|
|
29215
|
-
|
|
29216
|
-
|
|
29217
|
-
|
|
29218
|
-
|
|
29219
|
-
|
|
29220
|
-
|
|
29221
|
-
|
|
29222
|
-
|
|
29276
|
+
var _usePositionStyle = usePositionStyle({
|
|
29277
|
+
getContainer: getRoot,
|
|
29278
|
+
position: position,
|
|
29279
|
+
absolute: !!absolute,
|
|
29280
|
+
parentElRef: parentElRef,
|
|
29281
|
+
show: focus,
|
|
29282
|
+
fixedWidth: fixedWidth,
|
|
29283
|
+
zIndex: zIndex,
|
|
29284
|
+
scrollElRef: scrollElRef,
|
|
29285
|
+
popupElRef: popupElRef,
|
|
29286
|
+
updateKey: updateKey,
|
|
29287
|
+
popupGap: popupGap,
|
|
29288
|
+
adjust: adjust
|
|
29289
|
+
}),
|
|
29290
|
+
style = _usePositionStyle.style,
|
|
29291
|
+
arrayStyle = _usePositionStyle.arrayStyle;
|
|
29223
29292
|
var childStyle = children.props.style;
|
|
29224
29293
|
var newStyle = objectSpread2_default()(objectSpread2_default()({}, style), childStyle);
|
|
29225
29294
|
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(children) === false) return null;
|
|
29295
|
+
if (arrowRef && arrayStyle && Object.keys(arrayStyle).length > 0) {
|
|
29296
|
+
Object.keys(arrayStyle).forEach(function (key) {
|
|
29297
|
+
if (arrowRef.current) {
|
|
29298
|
+
// @ts-ignore
|
|
29299
|
+
arrowRef.current.style[key] = arrayStyle[key];
|
|
29300
|
+
}
|
|
29301
|
+
});
|
|
29302
|
+
}
|
|
29226
29303
|
var styledChild = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(children, {
|
|
29227
29304
|
style: newStyle
|
|
29228
29305
|
});
|
|
@@ -29336,6 +29413,7 @@ var getMenuPosition = function getMenuPosition(target) {
|
|
|
29336
29413
|
};
|
|
29337
29414
|
var getPopoverPosition = function getPopoverPosition(target) {
|
|
29338
29415
|
var priorityDirection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'vertical';
|
|
29416
|
+
var popup = arguments.length > 2 ? arguments[2] : undefined;
|
|
29339
29417
|
var position = 'bottom-left';
|
|
29340
29418
|
if (!target) return position;
|
|
29341
29419
|
var rect = target.getBoundingClientRect();
|
|
@@ -29357,11 +29435,24 @@ var getPopoverPosition = function getPopoverPosition(target) {
|
|
|
29357
29435
|
position += '-top';
|
|
29358
29436
|
}
|
|
29359
29437
|
} else {
|
|
29438
|
+
var popupRect = popup === null || popup === void 0 ? void 0 : popup.getBoundingClientRect();
|
|
29360
29439
|
if (verticalPoint > windowHeight / 2) position = 'top';else position = 'bottom';
|
|
29361
|
-
|
|
29362
|
-
|
|
29363
|
-
|
|
29364
|
-
|
|
29440
|
+
|
|
29441
|
+
// 如果渲染了弹出内容,则根据弹出内容宽度计算是否自动调整位置
|
|
29442
|
+
if (popupRect) {
|
|
29443
|
+
if ((popupRect === null || popupRect === void 0 ? void 0 : popupRect.width) / 2 > rect.left) {
|
|
29444
|
+
position += '-left';
|
|
29445
|
+
}
|
|
29446
|
+
if ((popupRect === null || popupRect === void 0 ? void 0 : popupRect.width) / 2 > windowWidth - rect.right) {
|
|
29447
|
+
position += '-right';
|
|
29448
|
+
}
|
|
29449
|
+
} else {
|
|
29450
|
+
// 兜底计算
|
|
29451
|
+
if (horizontalPoint > windowWidth * 0.6) {
|
|
29452
|
+
position += '-right';
|
|
29453
|
+
} else if (horizontalPoint < windowWidth * 0.4) {
|
|
29454
|
+
position += '-left';
|
|
29455
|
+
}
|
|
29365
29456
|
}
|
|
29366
29457
|
}
|
|
29367
29458
|
return position;
|
|
@@ -29369,7 +29460,8 @@ var getPopoverPosition = function getPopoverPosition(target) {
|
|
|
29369
29460
|
var getPosition = function getPosition(target) {
|
|
29370
29461
|
var priorityDirection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'vertical';
|
|
29371
29462
|
var mode = arguments.length > 2 ? arguments[2] : undefined;
|
|
29372
|
-
|
|
29463
|
+
var popup = arguments.length > 3 ? arguments[3] : undefined;
|
|
29464
|
+
if (mode === 'popover') return getPopoverPosition(target, priorityDirection, popup);
|
|
29373
29465
|
if (mode === 'menu') return getMenuPosition(target, priorityDirection);
|
|
29374
29466
|
return 'bottom-left';
|
|
29375
29467
|
};
|
|
@@ -29411,6 +29503,7 @@ var usePopup = function usePopup(props) {
|
|
|
29411
29503
|
removeChild = _useContext.removeChild;
|
|
29412
29504
|
var targetRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
29413
29505
|
var popupRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
29506
|
+
var arrowRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
29414
29507
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
29415
29508
|
bindChild(popupRef);
|
|
29416
29509
|
return function () {
|
|
@@ -29442,11 +29535,12 @@ var usePopup = function usePopup(props) {
|
|
|
29442
29535
|
setPositionState = _useState4[1];
|
|
29443
29536
|
var position = isPositionControl ? props.position : positionState;
|
|
29444
29537
|
var updatePosition = use_persist_fn(function () {
|
|
29445
|
-
if (isPositionControl) return;
|
|
29446
|
-
if (props.position === 'auto' || !props.position) {
|
|
29447
|
-
|
|
29538
|
+
// if (isPositionControl) return;
|
|
29539
|
+
// if (props.position === 'auto' || !props.position) {
|
|
29540
|
+
setTimeout(function () {
|
|
29541
|
+
var newPosition = getPosition(targetRef.current, props.priorityDirection, autoMode, popupRef.current || undefined);
|
|
29448
29542
|
if (newPosition !== position) setPositionState(newPosition);
|
|
29449
|
-
}
|
|
29543
|
+
}, 10);
|
|
29450
29544
|
});
|
|
29451
29545
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
29452
29546
|
if (props.open) {
|
|
@@ -29575,6 +29669,7 @@ var usePopup = function usePopup(props) {
|
|
|
29575
29669
|
position: position,
|
|
29576
29670
|
targetRef: targetRef,
|
|
29577
29671
|
popupRef: popupRef,
|
|
29672
|
+
arrowRef: arrowRef,
|
|
29578
29673
|
getTargetProps: getTargetProps,
|
|
29579
29674
|
openPop: openPop,
|
|
29580
29675
|
closePop: closePop,
|
|
@@ -58615,7 +58710,8 @@ var Tooltip = function Tooltip(props) {
|
|
|
58615
58710
|
_props$type = props.type,
|
|
58616
58711
|
type = _props$type === void 0 ? 'default' : _props$type,
|
|
58617
58712
|
_props$position = props.position,
|
|
58618
|
-
popsitionProps = _props$position === void 0 ? '
|
|
58713
|
+
popsitionProps = _props$position === void 0 ? 'auto' : _props$position;
|
|
58714
|
+
var arrowStyleRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({});
|
|
58619
58715
|
var tooltipClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$tooltip = jssStyle.tooltip) === null || _jssStyle$tooltip === void 0 ? void 0 : _jssStyle$tooltip.call(jssStyle);
|
|
58620
58716
|
var config = useConfig();
|
|
58621
58717
|
var childrenProps = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(children) ? children === null || children === void 0 ? void 0 : children.props : {};
|
|
@@ -58632,7 +58728,8 @@ var Tooltip = function Tooltip(props) {
|
|
|
58632
58728
|
position = _usePopup.position,
|
|
58633
58729
|
getTargetProps = _usePopup.getTargetProps,
|
|
58634
58730
|
targetRef = _usePopup.targetRef,
|
|
58635
|
-
popupRef = _usePopup.popupRef
|
|
58731
|
+
popupRef = _usePopup.popupRef,
|
|
58732
|
+
arrowRef = _usePopup.arrowRef;
|
|
58636
58733
|
if (! /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(children)) {
|
|
58637
58734
|
console.error(new Error('Tooltip children expect a single ReactElement.'));
|
|
58638
58735
|
return null;
|
|
@@ -58663,12 +58760,16 @@ var Tooltip = function Tooltip(props) {
|
|
|
58663
58760
|
focus: open,
|
|
58664
58761
|
parentElRef: targetRef,
|
|
58665
58762
|
popupElRef: popupRef,
|
|
58763
|
+
arrowRef: arrowRef,
|
|
58666
58764
|
absolute: true,
|
|
58765
|
+
adjust: popsitionProps === 'auto',
|
|
58667
58766
|
position: position,
|
|
58668
58767
|
fixedWidth: false,
|
|
58669
|
-
popupGap: 0
|
|
58768
|
+
popupGap: 0
|
|
58769
|
+
// arrowStyleRef={arrowStyleRef}
|
|
58770
|
+
,
|
|
58670
58771
|
zIndex: zIndex,
|
|
58671
|
-
children: /*#__PURE__*/(0,jsx_runtime.
|
|
58772
|
+
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({
|
|
58672
58773
|
className: classnames_default()(className, tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.wrapper, open && (tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.wrapperOpen))
|
|
58673
58774
|
}, getDataAttribute({
|
|
58674
58775
|
type: type,
|
|
@@ -58677,11 +58778,17 @@ var Tooltip = function Tooltip(props) {
|
|
|
58677
58778
|
ref: popupRef,
|
|
58678
58779
|
onMouseLeave: events.onMouseLeave,
|
|
58679
58780
|
dir: config.direction,
|
|
58680
|
-
children: /*#__PURE__*/(0,jsx_runtime.jsx)("
|
|
58781
|
+
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", objectSpread2_default()({
|
|
58782
|
+
ref: arrowRef,
|
|
58783
|
+
style: arrowStyleRef.current,
|
|
58784
|
+
className: tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.arrow
|
|
58785
|
+
}, getDataAttribute({
|
|
58786
|
+
role: 'arrow'
|
|
58787
|
+
}))), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
58681
58788
|
style: style,
|
|
58682
58789
|
className: classnames_default()(tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.content),
|
|
58683
58790
|
children: tip
|
|
58684
|
-
})
|
|
58791
|
+
})]
|
|
58685
58792
|
}))
|
|
58686
58793
|
})]
|
|
58687
58794
|
});
|
|
@@ -63773,7 +63880,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
63773
63880
|
|
|
63774
63881
|
|
|
63775
63882
|
/* harmony default export */ var src_0 = ({
|
|
63776
|
-
version: '3.3.6-beta.
|
|
63883
|
+
version: '3.3.6-beta.3'
|
|
63777
63884
|
});
|
|
63778
63885
|
}();
|
|
63779
63886
|
/******/ return __webpack_exports__;
|