@zat-design/sisyphus-react 3.13.2-beta.1 → 3.13.2-beta.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/es/ProTooltip/index.js
CHANGED
@@ -10,8 +10,15 @@ import { useSize, useSetState, useDebounce } from 'ahooks';
|
|
10
10
|
import { useEffect, useRef } from 'react';
|
11
11
|
import classnames from 'classnames';
|
12
12
|
import { isEllipsisActive } from '../utils';
|
13
|
+
var _findTableParent = function findTableParent(element) {
|
14
|
+
var _element$tagName;
|
15
|
+
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
16
|
+
if (!element || depth >= 3) return false;
|
17
|
+
if (((_element$tagName = element.tagName) === null || _element$tagName === void 0 ? void 0 : _element$tagName.toLowerCase()) === 'td') return true;
|
18
|
+
return _findTableParent(element.parentElement, depth + 1);
|
19
|
+
};
|
13
20
|
var ProTooltip = function ProTooltip(props) {
|
14
|
-
var _useSize
|
21
|
+
var _useSize;
|
15
22
|
var ref = useRef();
|
16
23
|
var childRef = useRef();
|
17
24
|
var contentWrapRef = useRef();
|
@@ -58,7 +65,7 @@ var ProTooltip = function ProTooltip(props) {
|
|
58
65
|
});
|
59
66
|
var _ref = (_useSize = useSize(localElement)) !== null && _useSize !== void 0 ? _useSize : {},
|
60
67
|
_localSizeWidth = _ref.width;
|
61
|
-
var isTable = (
|
68
|
+
var isTable = _findTableParent(ref.current);
|
62
69
|
var overlayStyle = mode === 'auto' ? {
|
63
70
|
maxWidth: _localSizeWidth
|
64
71
|
} : {};
|
package/lib/ProTooltip/index.js
CHANGED
@@ -16,8 +16,15 @@ var _react = require("react");
|
|
16
16
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
17
17
|
var _utils = require("../utils");
|
18
18
|
var _excluded = ["text", "mode", "width", "line", "className", "style", "lineHeight", "scrollFollowParent"];
|
19
|
+
var _findTableParent = function findTableParent(element) {
|
20
|
+
var _element$tagName;
|
21
|
+
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
22
|
+
if (!element || depth >= 3) return false;
|
23
|
+
if (((_element$tagName = element.tagName) === null || _element$tagName === void 0 ? void 0 : _element$tagName.toLowerCase()) === 'td') return true;
|
24
|
+
return _findTableParent(element.parentElement, depth + 1);
|
25
|
+
};
|
19
26
|
var ProTooltip = function ProTooltip(props) {
|
20
|
-
var _useSize
|
27
|
+
var _useSize;
|
21
28
|
var ref = (0, _react.useRef)();
|
22
29
|
var childRef = (0, _react.useRef)();
|
23
30
|
var contentWrapRef = (0, _react.useRef)();
|
@@ -64,7 +71,7 @@ var ProTooltip = function ProTooltip(props) {
|
|
64
71
|
});
|
65
72
|
var _ref = (_useSize = (0, _ahooks.useSize)(localElement)) !== null && _useSize !== void 0 ? _useSize : {},
|
66
73
|
_localSizeWidth = _ref.width;
|
67
|
-
var isTable = (
|
74
|
+
var isTable = _findTableParent(ref.current);
|
68
75
|
var overlayStyle = mode === 'auto' ? {
|
69
76
|
maxWidth: _localSizeWidth
|
70
77
|
} : {};
|