@cloudtower/eagle 0.31.9 → 0.31.11
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/cjs/core/Tooltip/EllipsisTooltipContent.js +55 -0
- package/dist/cjs/core/Tooltip/index.js +4 -1
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +1720 -1720
- package/dist/esm/core/Tooltip/EllipsisTooltipContent.js +49 -0
- package/dist/esm/core/Tooltip/index.js +4 -1
- package/dist/esm/stats1.html +1 -1
- package/dist/src/core/Tooltip/EllipsisTooltipContent.d.ts +1 -1
- package/dist/src/core/Tooltip/index.d.ts +7 -2
- package/dist/stories/docs/core/EllipsisTooltipContent.stories.d.ts +1 -1
- package/dist/stories/docs/core/Tooltip.stories.d.ts +3 -1
- package/dist/style.css +1397 -1397
- package/package.json +4 -4
- package/dist/src/core/Tooltip/tooltip.widget.d.ts +0 -5
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cx } from '@linaria/core';
|
|
2
|
+
import { styled } from '@linaria/react';
|
|
3
|
+
import { debounce, isNull } from 'lodash';
|
|
4
|
+
import React__default, { useRef, useState, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
const _exp = /*#__PURE__*/() => props => props.maxHeight ? `${props.maxHeight}px` : "unset";
|
|
7
|
+
const Wrapper = /*#__PURE__*/styled('div')({
|
|
8
|
+
name: "Wrapper",
|
|
9
|
+
class: "E_w1dxz879",
|
|
10
|
+
propsAsIs: false,
|
|
11
|
+
vars: {
|
|
12
|
+
"w1dxz879-0": [_exp()]
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const EllipsisTooltipContent = ({
|
|
16
|
+
tooltip,
|
|
17
|
+
maxHeight,
|
|
18
|
+
contentWrapperClassName,
|
|
19
|
+
ellipsisTips
|
|
20
|
+
}) => {
|
|
21
|
+
const overFlowWrapperRef = useRef(null);
|
|
22
|
+
const [showTips, setShowTips] = useState(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const wrapperEle = overFlowWrapperRef.current;
|
|
25
|
+
let wrapperObserver;
|
|
26
|
+
if (wrapperEle) {
|
|
27
|
+
const handleVisibleTips = debounce(() => {
|
|
28
|
+
setShowTips(wrapperEle.scrollHeight > (maxHeight || Infinity));
|
|
29
|
+
}, 200);
|
|
30
|
+
wrapperObserver = new ResizeObserver(handleVisibleTips);
|
|
31
|
+
wrapperObserver.observe(wrapperEle);
|
|
32
|
+
}
|
|
33
|
+
return () => {
|
|
34
|
+
wrapperObserver == null ? void 0 : wrapperObserver.disconnect();
|
|
35
|
+
};
|
|
36
|
+
}, [maxHeight]);
|
|
37
|
+
return /* @__PURE__ */React__default.createElement(Wrapper, {
|
|
38
|
+
className: cx(contentWrapperClassName, isNull(showTips) && "eagle-ellipsis-content"),
|
|
39
|
+
maxHeight
|
|
40
|
+
}, /* @__PURE__ */React__default.createElement("div", {
|
|
41
|
+
className: "ellipsis-tooltip",
|
|
42
|
+
ref: overFlowWrapperRef
|
|
43
|
+
}, tooltip), !!showTips && /* @__PURE__ */React__default.createElement("span", {
|
|
44
|
+
className: "tips"
|
|
45
|
+
}, ellipsisTips));
|
|
46
|
+
};
|
|
47
|
+
var EllipsisTooltipContent$1 = EllipsisTooltipContent;
|
|
48
|
+
|
|
49
|
+
export { EllipsisTooltipContent$1 as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Tooltip as Tooltip$2 } from 'antd';
|
|
2
2
|
import cs from 'classnames';
|
|
3
3
|
import React__default, { useRef, useMemo, useCallback, useEffect } from 'react';
|
|
4
|
+
import EllipsisTooltipContent from './EllipsisTooltipContent.js';
|
|
4
5
|
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
7
|
var __defProps = Object.defineProperties;
|
|
@@ -32,7 +33,7 @@ var __objRest = (source, exclude) => {
|
|
|
32
33
|
};
|
|
33
34
|
let componentId = 0;
|
|
34
35
|
const TooltipDefaultClass = "E_t1m2x205";
|
|
35
|
-
const
|
|
36
|
+
const InternalTooltip = props => {
|
|
36
37
|
const _a = props,
|
|
37
38
|
{
|
|
38
39
|
followMouse,
|
|
@@ -80,6 +81,8 @@ const Tooltip = props => {
|
|
|
80
81
|
}, overlayStyle) : overlayStyle
|
|
81
82
|
}));
|
|
82
83
|
};
|
|
84
|
+
const Tooltip = InternalTooltip;
|
|
85
|
+
Tooltip.EllipsisContent = EllipsisTooltipContent;
|
|
83
86
|
var Tooltip$1 = Tooltip;
|
|
84
87
|
|
|
85
88
|
export { Tooltip$1 as default };
|