@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.
@@ -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, _parentElement$tagNam;
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 = (parentElement === null || parentElement === void 0 ? void 0 : (_parentElement$tagNam = parentElement.tagName) === null || _parentElement$tagNam === void 0 ? void 0 : _parentElement$tagNam.toLowerCase()) === 'td';
68
+ var isTable = _findTableParent(ref.current);
62
69
  var overlayStyle = mode === 'auto' ? {
63
70
  maxWidth: _localSizeWidth
64
71
  } : {};
@@ -9,9 +9,8 @@ export interface ProTooltipType {
9
9
  /**
10
10
  * 提示框宽度
11
11
  * @description 设置提示框的宽度,支持各种CSS宽度单位
12
- * @default 'auto'
13
12
  */
14
- width?: string;
13
+ width?: string | number;
15
14
  /**
16
15
  * 显示的行数
17
16
  * @description 当内容超过设定行数时将截断显示
@@ -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, _parentElement$tagNam;
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 = (parentElement === null || parentElement === void 0 ? void 0 : (_parentElement$tagNam = parentElement.tagName) === null || _parentElement$tagNam === void 0 ? void 0 : _parentElement$tagNam.toLowerCase()) === 'td';
74
+ var isTable = _findTableParent(ref.current);
68
75
  var overlayStyle = mode === 'auto' ? {
69
76
  maxWidth: _localSizeWidth
70
77
  } : {};
@@ -9,9 +9,8 @@ export interface ProTooltipType {
9
9
  /**
10
10
  * 提示框宽度
11
11
  * @description 设置提示框的宽度,支持各种CSS宽度单位
12
- * @default 'auto'
13
12
  */
14
- width?: string;
13
+ width?: string | number;
15
14
  /**
16
15
  * 显示的行数
17
16
  * @description 当内容超过设定行数时将截断显示
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.2-beta.1",
3
+ "version": "3.13.2-beta.2",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",