@semcore/ellipsis 2.40.0-prerelease.0 → 2.40.0-prerelease.4
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/lib/cjs/Ellipsis.js +142 -75
- package/lib/cjs/Ellipsis.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/ellipsis.shadow.css +8 -8
- package/lib/cjs/useResizeObserver.js +5 -4
- package/lib/cjs/useResizeObserver.js.map +1 -1
- package/lib/es6/Ellipsis.js +136 -71
- package/lib/es6/Ellipsis.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/ellipsis.shadow.css +8 -8
- package/lib/es6/useResizeObserver.js +2 -2
- package/lib/es6/useResizeObserver.js.map +1 -1
- package/lib/esm/Ellipsis.mjs +135 -70
- package/lib/esm/style/ellipsis.shadow.css +8 -8
- package/lib/esm/useResizeObserver.mjs +2 -2
- package/lib/types/index.d.ts +9 -12
- package/package.json +5 -5
- package/lib/cjs/utils.js +0 -53
- package/lib/cjs/utils.js.map +0 -1
- package/lib/es6/utils.js +0 -46
- package/lib/es6/utils.js.map +0 -1
- package/lib/esm/utils.mjs +0 -47
package/lib/es6/Ellipsis.js
CHANGED
|
@@ -3,66 +3,110 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import
|
|
6
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
7
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
8
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import { sstyled as _sstyled } from "@semcore/core";
|
|
10
|
+
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
10
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
11
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
12
|
-
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"]
|
|
13
|
-
|
|
14
|
-
import { createComponent, Component, Root, sstyled } from '@semcore/core';
|
|
15
|
-
import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
|
|
16
|
-
import findComponent, { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';
|
|
17
|
-
import getOriginChildren from '@semcore/core/lib/utils/getOriginChildren';
|
|
18
|
-
import pick from '@semcore/core/lib/utils/pick';
|
|
19
|
-
import reactToText from '@semcore/core/lib/utils/reactToText';
|
|
20
|
-
import { forkRef } from '@semcore/core/lib/utils/ref';
|
|
21
|
-
import useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';
|
|
22
|
-
import Tooltip from '@semcore/tooltip';
|
|
13
|
+
var _excluded = ["styles", "Children", "maxLine", "tooltip", "trim", "containerRect", "containerRef", "includeTooltipProps", "children"],
|
|
14
|
+
_excluded2 = ["styles", "text", "tooltip", "containerRect", "containerRef", "textRef", "tooltipProps", "children", "advanceMode"];
|
|
23
15
|
import React from 'react';
|
|
16
|
+
import createComponent, { Component, Root, sstyled } from '@semcore/core';
|
|
17
|
+
import Tooltip from '@semcore/tooltip';
|
|
18
|
+
import { Box } from '@semcore/flex-box';
|
|
19
|
+
import { useResizeObserver } from './useResizeObserver';
|
|
20
|
+
import useEnhancedEffect from '@semcore/utils/lib/use/useEnhancedEffect';
|
|
21
|
+
import findComponent, { isAdvanceMode } from '@semcore/utils/lib/findComponent';
|
|
24
22
|
/*!__reshadow-styles__:"./style/ellipsis.shadow.css"*/
|
|
25
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
23
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SContainerMiddle_1xdmi_gg_,.___SContainer_1xdmi_gg_,.___SEllipsis_1xdmi_gg_.__middle-mod_1xdmi_gg_,.___SNoTooltipContainer_1xdmi_gg_{display:flex;overflow:hidden}.___SBeginning_1xdmi_gg_,.___SEllipsis_1xdmi_gg_{overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:pre}.___SEllipsis_1xdmi_gg_.__maxLine_1xdmi_gg_{display:-webkit-box;-webkit-line-clamp:var(--maxLine_1xdmi);-webkit-box-orient:vertical;overflow:hidden;white-space:normal;word-wrap:break-word}.___SContainerMiddle_1xdmi_gg_>:has(.___SBeginning_1xdmi_gg_),.___SContainerMiddle_1xdmi_gg_>:has(.___STail_1xdmi_gg_){display:flex;width:100%}.___STail_1xdmi_gg_{white-space:pre}", /*__inner_css_end__*/"1xdmi_gg_"),
|
|
26
24
|
/*__reshadow_css_end__*/
|
|
27
25
|
{
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"__STail": "
|
|
26
|
+
"__SContainer": "___SContainer_1xdmi_gg_",
|
|
27
|
+
"__SNoTooltipContainer": "___SNoTooltipContainer_1xdmi_gg_",
|
|
28
|
+
"__SContainerMiddle": "___SContainerMiddle_1xdmi_gg_",
|
|
29
|
+
"__SBeginning": "___SBeginning_1xdmi_gg_",
|
|
30
|
+
"__SEllipsis": "___SEllipsis_1xdmi_gg_",
|
|
31
|
+
"_middle-mod": "__middle-mod_1xdmi_gg_",
|
|
32
|
+
"_maxLine": "__maxLine_1xdmi_gg_",
|
|
33
|
+
"--maxLine": "--maxLine_1xdmi",
|
|
34
|
+
"__STail": "___STail_1xdmi_gg_"
|
|
37
35
|
});
|
|
38
|
-
import
|
|
39
|
-
import
|
|
36
|
+
import reactToText from '@semcore/utils/lib/reactToText';
|
|
37
|
+
import getOriginChildren from '@semcore/utils/lib/getOriginChildren';
|
|
38
|
+
import pick from '@semcore/utils/lib/pick';
|
|
39
|
+
import { forkRef } from '@semcore/utils/lib/ref';
|
|
40
|
+
import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
|
|
40
41
|
var defaultTooltipProps = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate', 'cursorAnchoring'];
|
|
42
|
+
var createMeasurerElement = function createMeasurerElement(element, text) {
|
|
43
|
+
var styleElement = window.getComputedStyle(element, null);
|
|
44
|
+
var temporaryElement = document.createElement('temporary-block');
|
|
45
|
+
temporaryElement.style.display = styleElement.getPropertyValue('display');
|
|
46
|
+
temporaryElement.style.padding = styleElement.getPropertyValue('padding');
|
|
47
|
+
temporaryElement.style.position = 'absolute';
|
|
48
|
+
temporaryElement.style.right = '0%';
|
|
49
|
+
temporaryElement.style.bottom = '0%';
|
|
50
|
+
temporaryElement.style.visibility = 'hidden';
|
|
51
|
+
temporaryElement.style.fontFamily = styleElement.getPropertyValue('font-family');
|
|
52
|
+
temporaryElement.style.fontSize = styleElement.getPropertyValue('font-size');
|
|
53
|
+
temporaryElement.style.fontWeight = styleElement.getPropertyValue('font-weight');
|
|
54
|
+
temporaryElement.style.lineHeight = styleElement.getPropertyValue('line-height');
|
|
55
|
+
temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');
|
|
56
|
+
temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');
|
|
57
|
+
temporaryElement.style.fontFeatureSettings = styleElement.getPropertyValue('font-feature-settings');
|
|
58
|
+
temporaryElement.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');
|
|
59
|
+
temporaryElement.innerHTML = text !== null && text !== void 0 ? text : element.innerHTML;
|
|
60
|
+
return temporaryElement;
|
|
61
|
+
};
|
|
62
|
+
function isTextOverflowing(element, multiline, text) {
|
|
63
|
+
if (!element) return false;
|
|
64
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
65
|
+
currentHeight = _element$getBoundingC.height,
|
|
66
|
+
currentWidth = _element$getBoundingC.width;
|
|
67
|
+
var measuringElement = createMeasurerElement(element, text);
|
|
68
|
+
var isOverflowing = false;
|
|
69
|
+
document.body.appendChild(measuringElement);
|
|
70
|
+
if (multiline) {
|
|
71
|
+
measuringElement.style.width = "".concat(currentWidth, "px");
|
|
72
|
+
var width = measuringElement.scrollWidth;
|
|
73
|
+
var height = measuringElement.getBoundingClientRect().height;
|
|
74
|
+
if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {
|
|
75
|
+
isOverflowing = true;
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
measuringElement.style.whiteSpace = 'nowrap';
|
|
79
|
+
isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;
|
|
80
|
+
}
|
|
81
|
+
document.body.removeChild(measuringElement);
|
|
82
|
+
return isOverflowing;
|
|
83
|
+
}
|
|
41
84
|
var forcedAdvancedMode = {
|
|
42
85
|
forcedAdvancedMode: true
|
|
43
86
|
};
|
|
44
87
|
var noAdvancedMode = {};
|
|
45
88
|
var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
89
|
+
_inherits(RootEllipsis, _Component);
|
|
90
|
+
var _super = _createSuper(RootEllipsis);
|
|
46
91
|
function RootEllipsis() {
|
|
47
92
|
var _this;
|
|
48
93
|
_classCallCheck(this, RootEllipsis);
|
|
49
94
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
95
|
args[_key] = arguments[_key];
|
|
51
96
|
}
|
|
52
|
-
_this =
|
|
53
|
-
_defineProperty(_this, "state", {
|
|
97
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
98
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
54
99
|
visible: false
|
|
55
100
|
});
|
|
56
|
-
_defineProperty(_this, "textRef", /*#__PURE__*/React.createRef());
|
|
57
|
-
_defineProperty(_this, "handlerVisibleChange", function (visible) {
|
|
101
|
+
_defineProperty(_assertThisInitialized(_this), "textRef", /*#__PURE__*/React.createRef());
|
|
102
|
+
_defineProperty(_assertThisInitialized(_this), "handlerVisibleChange", function (visible) {
|
|
58
103
|
_this.setState({
|
|
59
104
|
visible: visible && _this.showTooltip()
|
|
60
105
|
});
|
|
61
106
|
});
|
|
62
107
|
return _this;
|
|
63
108
|
}
|
|
64
|
-
|
|
65
|
-
return _createClass(RootEllipsis, [{
|
|
109
|
+
_createClass(RootEllipsis, [{
|
|
66
110
|
key: "showTooltip",
|
|
67
111
|
value: function showTooltip() {
|
|
68
112
|
var _this$asProps = this.asProps,
|
|
@@ -95,9 +139,10 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
95
139
|
}, {
|
|
96
140
|
key: "render",
|
|
97
141
|
value: function render() {
|
|
98
|
-
var
|
|
142
|
+
var _ref4, _tooltipProps$visible;
|
|
99
143
|
var SEllipsis = this.Root;
|
|
100
144
|
var SContainer = Tooltip;
|
|
145
|
+
var SNoTooltipContainer = Box;
|
|
101
146
|
var _this$asProps3 = this.asProps,
|
|
102
147
|
styles = _this$asProps3.styles,
|
|
103
148
|
Children = _this$asProps3.Children,
|
|
@@ -107,7 +152,7 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
107
152
|
containerRect = _this$asProps3.containerRect,
|
|
108
153
|
containerRef = _this$asProps3.containerRef,
|
|
109
154
|
includeTooltipProps = _this$asProps3.includeTooltipProps,
|
|
110
|
-
|
|
155
|
+
children = _this$asProps3.children,
|
|
111
156
|
other = _objectWithoutProperties(_this$asProps3, _excluded);
|
|
112
157
|
var visible = this.state.visible;
|
|
113
158
|
var advancedContent = findComponent(Children, [Ellipsis.Content.displayName]);
|
|
@@ -129,16 +174,25 @@ var RootEllipsis = /*#__PURE__*/function (_Component) {
|
|
|
129
174
|
"advanceMode": advanceMode
|
|
130
175
|
}, other)), /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})));
|
|
131
176
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
177
|
+
if (tooltip) {
|
|
178
|
+
var _ref3;
|
|
179
|
+
return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SContainer, _ref3.cn("SContainer", _objectSpread(_objectSpread({
|
|
180
|
+
"interaction": 'hover',
|
|
181
|
+
"title": !advanceMode ? text : undefined
|
|
182
|
+
}, tooltipProps), advanceMode ? forcedAdvancedMode : noAdvancedMode)), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})) : /*#__PURE__*/React.createElement(SEllipsis, _ref3.cn("SEllipsis", _objectSpread({
|
|
183
|
+
"render": Box,
|
|
184
|
+
"ref": this.textRef,
|
|
185
|
+
"maxLine": maxLine
|
|
186
|
+
}, other)), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {}))));
|
|
187
|
+
}
|
|
188
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SNoTooltipContainer, _ref4.cn("SNoTooltipContainer", {}), advanceMode ? /*#__PURE__*/React.createElement(Children, _ref4.cn("Children", {})) : /*#__PURE__*/React.createElement(SEllipsis, _ref4.cn("SEllipsis", _objectSpread({
|
|
136
189
|
"render": Box,
|
|
137
190
|
"ref": this.textRef,
|
|
138
191
|
"maxLine": maxLine
|
|
139
|
-
}, other)), /*#__PURE__*/React.createElement(Children,
|
|
192
|
+
}, other)), /*#__PURE__*/React.createElement(Children, _ref4.cn("Children", {}))));
|
|
140
193
|
}
|
|
141
194
|
}]);
|
|
195
|
+
return RootEllipsis;
|
|
142
196
|
}(Component);
|
|
143
197
|
_defineProperty(RootEllipsis, "displayName", 'Ellipsis');
|
|
144
198
|
_defineProperty(RootEllipsis, "style", style);
|
|
@@ -149,8 +203,8 @@ _defineProperty(RootEllipsis, "defaultProps", {
|
|
|
149
203
|
__excludeProps: ['title']
|
|
150
204
|
});
|
|
151
205
|
var EllipsisMiddleContext = /*#__PURE__*/React.createContext(null);
|
|
152
|
-
function EllipsisMiddle(props) {
|
|
153
|
-
var
|
|
206
|
+
var EllipsisMiddle = function EllipsisMiddle(props) {
|
|
207
|
+
var _ref7;
|
|
154
208
|
var styles = props.styles,
|
|
155
209
|
text = props.text,
|
|
156
210
|
tooltip = props.tooltip,
|
|
@@ -160,33 +214,37 @@ function EllipsisMiddle(props) {
|
|
|
160
214
|
tooltipProps = props.tooltipProps,
|
|
161
215
|
children = props.children,
|
|
162
216
|
advanceMode = props.advanceMode,
|
|
163
|
-
|
|
217
|
+
otherProps = _objectWithoutProperties(props, _excluded2);
|
|
164
218
|
var resizeElement = React.useRef(null);
|
|
165
|
-
var _React$useState = React.useState(
|
|
219
|
+
var _React$useState = React.useState({
|
|
220
|
+
fontSize: '14',
|
|
221
|
+
symbolWidth: 0
|
|
222
|
+
}),
|
|
166
223
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
167
|
-
|
|
168
|
-
|
|
224
|
+
dimension = _React$useState2[0],
|
|
225
|
+
setDimension = _React$useState2[1];
|
|
169
226
|
var blockWidth = useResizeObserver(resizeElement, containerRect).width;
|
|
170
227
|
useEnhancedEffect(function () {
|
|
171
228
|
var node = (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || (resizeElement === null || resizeElement === void 0 ? void 0 : resizeElement.current);
|
|
172
229
|
if (!node) return;
|
|
173
|
-
var styleElement = window.getComputedStyle(node);
|
|
174
230
|
var dateSpan = document.createElement('temporary-block');
|
|
175
|
-
|
|
176
|
-
dateSpan.
|
|
231
|
+
dateSpan.setAttribute('style', "fontSize: ".concat(dimension.fontSize, "px"));
|
|
232
|
+
dateSpan.innerHTML = 'a';
|
|
177
233
|
document.body.appendChild(dateSpan);
|
|
178
234
|
var rect = dateSpan.getBoundingClientRect();
|
|
179
|
-
|
|
235
|
+
setDimension({
|
|
236
|
+
fontSize: window.getComputedStyle(node, null).getPropertyValue('font-size'),
|
|
237
|
+
symbolWidth: rect.width
|
|
238
|
+
});
|
|
180
239
|
document.body.removeChild(dateSpan);
|
|
181
240
|
}, []);
|
|
182
241
|
var STail = 'span';
|
|
183
242
|
var SBeginning = 'span';
|
|
184
|
-
var SContainerMiddle =
|
|
243
|
+
var SContainerMiddle = props.tag || Box;
|
|
185
244
|
var SAdvancedModeContainerMiddle = Tooltip;
|
|
186
245
|
var displayedSymbols = React.useMemo(function () {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}, [blockWidth, symbolWidth]);
|
|
246
|
+
return Math.round(blockWidth / dimension.symbolWidth);
|
|
247
|
+
}, [blockWidth, dimension.symbolWidth]);
|
|
190
248
|
var interaction = text.length > displayedSymbols ? 'hover' : 'none';
|
|
191
249
|
var ref = containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement;
|
|
192
250
|
var contextValue = React.useMemo(function () {
|
|
@@ -197,41 +255,48 @@ function EllipsisMiddle(props) {
|
|
|
197
255
|
};
|
|
198
256
|
}, [text, displayedSymbols]);
|
|
199
257
|
if (advanceMode) {
|
|
200
|
-
var
|
|
201
|
-
return
|
|
202
|
-
"interaction":
|
|
258
|
+
var _ref5;
|
|
259
|
+
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SAdvancedModeContainerMiddle, _ref5.cn("SAdvancedModeContainerMiddle", _objectSpread(_objectSpread({
|
|
260
|
+
"interaction": interaction
|
|
203
261
|
}, tooltipProps), forcedAdvancedMode)), /*#__PURE__*/React.createElement(EllipsisMiddleContext.Provider, {
|
|
204
262
|
value: contextValue
|
|
205
263
|
}, children));
|
|
206
264
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
"
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
265
|
+
if (tooltip) {
|
|
266
|
+
var _ref6;
|
|
267
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SContainerMiddle, _ref6.cn("SContainerMiddle", _objectSpread({
|
|
268
|
+
"interaction": interaction,
|
|
269
|
+
"title": text,
|
|
270
|
+
"ref": forkRef(ref, textRef),
|
|
271
|
+
"tag": Tooltip,
|
|
272
|
+
"__excludeProps": ['title']
|
|
273
|
+
}, tooltipProps)), /*#__PURE__*/React.createElement(SBeginning, _ref6.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/React.createElement(STail, _ref6.cn("STail", {}), contextValue.tail));
|
|
274
|
+
}
|
|
275
|
+
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SContainerMiddle, _ref7.cn("SContainerMiddle", _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
276
|
+
"ref": containerRef !== null && containerRef !== void 0 ? containerRef : resizeElement
|
|
277
|
+
})), /*#__PURE__*/React.createElement(SBeginning, _ref7.cn("SBeginning", {}), contextValue.begining), /*#__PURE__*/React.createElement(STail, _ref7.cn("STail", {}), contextValue.tail));
|
|
278
|
+
};
|
|
279
|
+
var Content = function Content(_ref10) {
|
|
215
280
|
var _ref = arguments[0],
|
|
216
|
-
|
|
217
|
-
var styles =
|
|
218
|
-
Children =
|
|
281
|
+
_ref9;
|
|
282
|
+
var styles = _ref10.styles,
|
|
283
|
+
Children = _ref10.Children;
|
|
219
284
|
var SEllipsis = Tooltip.Trigger;
|
|
220
285
|
var ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);
|
|
221
286
|
var STail = 'span';
|
|
222
287
|
var SBeginning = 'span';
|
|
223
288
|
if (ellipsisMiddleContext) {
|
|
224
|
-
var
|
|
289
|
+
var _ref8;
|
|
225
290
|
var begining = ellipsisMiddleContext.begining,
|
|
226
291
|
tail = ellipsisMiddleContext.tail,
|
|
227
292
|
ref = ellipsisMiddleContext.ref;
|
|
228
|
-
return
|
|
293
|
+
return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref8.cn("SEllipsis", _objectSpread({}, _assignProps({
|
|
229
294
|
"middle-mod": true,
|
|
230
295
|
"ref": ref
|
|
231
|
-
}, _ref))), /*#__PURE__*/React.createElement(SBeginning,
|
|
296
|
+
}, _ref))), /*#__PURE__*/React.createElement(SBeginning, _ref8.cn("SBeginning", {}), begining), /*#__PURE__*/React.createElement(STail, _ref8.cn("STail", {}), tail));
|
|
232
297
|
}
|
|
233
|
-
return
|
|
234
|
-
}
|
|
298
|
+
return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SEllipsis, _ref9.cn("SEllipsis", _objectSpread({}, _assignProps2({}, _ref))), /*#__PURE__*/React.createElement(Children, _ref9.cn("Children", {})));
|
|
299
|
+
};
|
|
235
300
|
var Ellipsis = createComponent(RootEllipsis, {
|
|
236
301
|
Content: Content,
|
|
237
302
|
Popper: Tooltip.Popper
|
package/lib/es6/Ellipsis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ellipsis.js","names":["Box","createComponent","Component","Root","sstyled","callAllEventHandlers","findComponent","isAdvanceMode","getOriginChildren","pick","reactToText","forkRef","useEnhancedEffect","Tooltip","React","style","_sstyled","insert","useResizeObserver","isTextOverflowing","setFontSettings","defaultTooltipProps","forcedAdvancedMode","noAdvancedMode","RootEllipsis","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","visible","createRef","setState","showTooltip","_inherits","_createClass","key","value","_this$asProps","asProps","_this$asProps$maxLine","maxLine","Children","text","textRef","current","getContentProps","ref","getPopperProps","_this$asProps2","includeTooltipProps","tooltipProps","_objectSpread","children","render","_ref3","_tooltipProps$visible","SEllipsis","SContainer","_this$asProps3","styles","tooltip","trim","containerRect","containerRef","_children","other","_objectWithoutProperties","_excluded","state","advancedContent","Ellipsis","Content","displayName","advanceMode","Popper","onVisibleChange","handlerVisibleChange","_ref2","createElement","EllipsisMiddle","cn","undefined","__excludeProps","EllipsisMiddleContext","createContext","props","_ref5","tag","resizeElement","useRef","_React$useState","useState","_React$useState2","_slicedToArray","symbolWidth","setSymbolWidth","blockWidth","width","node","styleElement","window","getComputedStyle","dateSpan","document","textContent","body","appendChild","rect","getBoundingClientRect","removeChild","STail","SBeginning","SContainerMiddle","SAdvancedModeContainerMiddle","displayedSymbols","useMemo","Math","round","interaction","contextValue","begining","substring","tail","_ref4","Provider","_ref8","_ref","arguments[0]","_ref7","Trigger","ellipsisMiddleContext","useContext","_ref6","_assignProps","_assignProps2"],"sources":["../../src/Ellipsis.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@semcore/base-components';\nimport { createComponent, Component, type Intergalactic, Root, sstyled } from '@semcore/core';\nimport { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport findComponent, { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';\nimport getOriginChildren from '@semcore/core/lib/utils/getOriginChildren';\nimport pick from '@semcore/core/lib/utils/pick';\nimport reactToText from '@semcore/core/lib/utils/reactToText';\nimport { forkRef } from '@semcore/core/lib/utils/ref';\nimport useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';\nimport Tooltip, { type TooltipProps } from '@semcore/tooltip';\nimport React, { type RefObject } from 'react';\n\nimport style from './style/ellipsis.shadow.css';\nimport { useResizeObserver } from './useResizeObserver';\nimport { isTextOverflowing, setFontSettings } from './utils';\n\ntype AsProps = {\n maxLine?: number;\n trim?: 'end' | 'middle';\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n includeTooltipProps?: string[];\n __excludeProps?: string[];\n};\n\ntype AsPropsMiddle = {\n text: string;\n textRef: RefObject<HTMLElement>;\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n tooltipProps: TooltipProps;\n children?: React.ReactNode;\n advanceMode?: boolean;\n tag?: React.ElementType;\n};\n\ntype EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLDivElement>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\nconst defaultTooltipProps = [\n 'title',\n 'theme',\n 'strategy',\n 'modifiers',\n 'placement',\n 'interaction',\n 'timeout',\n 'visible',\n 'defaultVisible',\n 'onVisibleChange',\n 'offset',\n 'preventOverflow',\n 'arrow',\n 'flip',\n 'computeStyles',\n 'eventListeners',\n 'onFirstUpdate',\n 'cursorAnchoring',\n];\n\nconst forcedAdvancedMode = { forcedAdvancedMode: true } as any;\nconst noAdvancedMode = {} as any;\n\nclass RootEllipsis extends Component<AsProps> {\n static displayName = 'Ellipsis';\n static style = style;\n static defaultProps: AsProps = {\n trim: 'end',\n tooltip: true,\n includeTooltipProps: defaultTooltipProps,\n __excludeProps: ['title'],\n };\n\n state = {\n visible: false,\n };\n\n textRef = React.createRef<HTMLDivElement>();\n\n showTooltip() {\n const { maxLine = 1, Children } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n return isTextOverflowing(this.textRef.current, maxLine > 1, text);\n }\n\n handlerVisibleChange = (visible: boolean) => {\n this.setState({ visible: visible && this.showTooltip() });\n };\n\n getContentProps() {\n return {\n ref: this.textRef,\n maxLine: this.asProps.maxLine,\n };\n }\n\n getPopperProps() {\n const { Children, includeTooltipProps } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n return { children: text, ...tooltipProps };\n }\n\n render() {\n const SEllipsis = this.Root;\n const SContainer = Tooltip;\n const {\n styles,\n Children,\n maxLine,\n tooltip,\n trim,\n containerRect,\n containerRef,\n includeTooltipProps,\n children: _children,\n ...other\n } = this.asProps;\n const { visible } = this.state;\n const advancedContent = findComponent(Children, [(Ellipsis as any).Content.displayName]);\n const text = reactToText(advancedContent || getOriginChildren(Children));\n const advanceMode = isAdvanceMode(Children, [\n (Ellipsis as any).Content.displayName,\n (Ellipsis as any).Popper.displayName,\n ]);\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n\n tooltipProps.visible = tooltipProps.visible ?? visible;\n tooltipProps.onVisibleChange = tooltipProps.onVisibleChange\n ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange)\n : this.handlerVisibleChange;\n\n if (trim === 'middle') {\n return sstyled(styles)(\n <EllipsisMiddle\n text={text}\n styles={styles}\n tooltip={tooltip}\n containerRect={containerRect}\n containerRef={containerRef}\n textRef={this.textRef}\n tooltipProps={tooltipProps}\n advanceMode={advanceMode}\n {...other}\n >\n <Children />\n </EllipsisMiddle>,\n );\n }\n\n return sstyled(styles)(\n <SContainer\n interaction={tooltip ? 'hover' : 'none'}\n title={!advanceMode ? text : undefined}\n {...tooltipProps}\n {...(advanceMode ? forcedAdvancedMode : noAdvancedMode)}\n >\n {advanceMode\n ? (\n <Children />\n )\n : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SContainer>,\n );\n }\n}\n\nconst EllipsisMiddleContext = React.createContext<null | {\n begining: string;\n tail: string;\n ref: React.RefObject<HTMLElement>;\n}>(null);\n\nfunction EllipsisMiddle(props: AsPropsMiddle) {\n const {\n styles,\n text,\n tooltip,\n containerRect,\n containerRef,\n textRef,\n tooltipProps,\n children,\n advanceMode,\n tag,\n } = props;\n\n const resizeElement = React.useRef<HTMLDivElement>(null);\n const [symbolWidth, setSymbolWidth] = React.useState(0);\n const blockWidth = useResizeObserver(resizeElement, containerRect).width;\n\n useEnhancedEffect(() => {\n const node = containerRef?.current || resizeElement?.current;\n if (!node) return;\n\n const styleElement = window.getComputedStyle(node);\n const dateSpan = document.createElement('temporary-block');\n\n setFontSettings(dateSpan, styleElement);\n dateSpan.textContent = 'a';\n document.body.appendChild(dateSpan);\n const rect = dateSpan.getBoundingClientRect();\n\n setSymbolWidth(rect.width);\n document.body.removeChild(dateSpan);\n }, []);\n\n const STail = 'span';\n const SBeginning = 'span';\n const SContainerMiddle = Tooltip;\n const SAdvancedModeContainerMiddle = Tooltip;\n const displayedSymbols = React.useMemo(\n () => {\n const displayedSymbols = Math.round(blockWidth / symbolWidth);\n\n return displayedSymbols % 2 === 0 ? displayedSymbols : displayedSymbols - 1;\n },\n [blockWidth, symbolWidth],\n );\n\n const interaction = text.length > displayedSymbols ? 'hover' : 'none';\n const ref = containerRef ?? resizeElement;\n const contextValue = React.useMemo(\n () => ({\n begining: text.substring(0, text.length - displayedSymbols / 2 - 1),\n tail: text.substring(text.length - displayedSymbols / 2 - 1),\n ref,\n }),\n [text, displayedSymbols],\n );\n\n if (advanceMode) {\n return sstyled(styles)(\n <SAdvancedModeContainerMiddle\n interaction={tooltip ? interaction : 'none'}\n {...tooltipProps}\n {...forcedAdvancedMode}\n >\n <EllipsisMiddleContext.Provider value={contextValue}>\n {children}\n </EllipsisMiddleContext.Provider>\n </SAdvancedModeContainerMiddle>,\n );\n }\n return sstyled(styles)(\n <SContainerMiddle\n interaction={tooltip ? interaction : 'none'}\n title={text}\n ref={forkRef(ref, textRef)}\n tag={tag}\n {...tooltipProps}\n >\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n );\n}\n\ntype EllipsisContentAsProps = {\n styles: any;\n Children: React.FC;\n};\n\nfunction Content({ styles, Children }: EllipsisContentAsProps) {\n const SEllipsis = Root;\n const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);\n const STail = 'span';\n const SBeginning = 'span';\n\n if (ellipsisMiddleContext) {\n const { begining, tail, ref } = ellipsisMiddleContext;\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger} middle-mod ref={ref}>\n <SBeginning>{begining}</SBeginning>\n <STail>{tail}</STail>\n </SEllipsis>,\n ) as any;\n }\n\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger}>\n <Children />\n </SEllipsis>,\n ) as any;\n}\n\nconst Ellipsis = createComponent(RootEllipsis, {\n Content,\n Popper: Tooltip.Popper,\n}) as any as Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport default Ellipsis;\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,GAAG,QAAuB,0BAA0B;AAC7D,SAASC,eAAe,EAAEC,SAAS,EAAsBC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC7F,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,OAAOC,aAAa,IAAIC,aAAa,QAAQ,uCAAuC;AACpF,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,IAAI,MAAM,8BAA8B;AAC/C,OAAOC,WAAW,MAAM,qCAAqC;AAC7D,SAASC,OAAO,QAAQ,6BAA6B;AACrD,OAAOC,iBAAiB,MAAM,+CAA+C;AAC7E,OAAOC,OAAO,MAA6B,kBAAkB;AAC7D,OAAOC,KAAK,MAA0B,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAG9C,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,iBAAiB,EAAEC,eAAe,QAAQ,SAAS;AA2D5D,IAAMC,mBAAmB,GAAG,CAC1B,OAAO,EACP,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,SAA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ACrE,IAAM2B,KAAK,GAAG,MAAM;EACpB,IAAMC,UAAU,GAAG,MAAM;EAEzB,IAAImB,qBAAqB,EAAE;IAAA,IAAAE,KAAA;IACzB,IAAQZ,QAAQ,GAAgBU,qBAAqB,CAA7CV,QAAQ;MAAEE,IAAI,GAAUQ,qBAAqB,CAAnCR,IAAI;MAAE5E,GAAG,GAAKoF,qBAAqB,CAA7BpF,GAAG;IAC3B,OAAAsF,KAAA,GAAOxI,OAAO,CAAC+D,MAAM,CAAC,eACpBrD,KAAA,CAAAwE,aAAA,CAACtB,SAAS,EAAA4E,KAAA,CAAApD,EAAA,cAAA7B,aAAA,KAAAkF,YAAA;MAAA;MAAA,OAA0CvF;IAAG,GAAAgF,IAAA,kBACrDxH,KAAA,CAAAwE,aAAA,CAACiC,UAAU,EAAAqB,KAAA,CAAApD,EAAA,oBAAEwC,QAAqB,CAAC,eACnClH,KAAA,CAAAwE,aAAA,CAACgC,KAAK,EAAAsB,KAAA,CAAApD,EAAA,eAAE0C,IAAY,CACX,CAAC;EAEhB;EAEA,OAAAM,KAAA,GAAOpI,OAAO,CAAC+D,MAAM,CAAC,eACpBrD,KAAA,CAAAwE,aAAA,CAACtB,SAAS,EAAAwE,KAAA,CAAAhD,EAAA,cAAA7B,aAAA,KAAAmF,aAAA,KAAAR,IAAA,kBACRxH,KAAA,CAAAwE,aAAA,CAACrC,QAAQ,EAAAuF,KAAA,CAAAhD,EAAA,gBAAE,CACF,CAAC;AAEhB;AAEA,IAAMV,QAAQ,GAAG7E,eAAe,CAACuB,YAAY,EAAE;EAC7CuD,OAAO,EAAPA,OAAO;EACPG,MAAM,EAAErE,OAAO,CAACqE;AAClB,CAAC,CAGA;AAED,eAAeJ,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Ellipsis.js","names":["React","createComponent","Component","Root","sstyled","Tooltip","Box","useResizeObserver","useEnhancedEffect","findComponent","isAdvanceMode","style","_sstyled","insert","reactToText","getOriginChildren","pick","forkRef","callAllEventHandlers","defaultTooltipProps","createMeasurerElement","element","text","styleElement","window","getComputedStyle","temporaryElement","document","createElement","display","getPropertyValue","padding","position","right","bottom","visibility","fontFamily","fontSize","fontWeight","lineHeight","whiteSpace","wordWrap","fontFeatureSettings","fontVariantNumeric","innerHTML","isTextOverflowing","multiline","_element$getBoundingC","getBoundingClientRect","currentHeight","height","currentWidth","width","measuringElement","isOverflowing","body","appendChild","concat","scrollWidth","Math","ceil","removeChild","forcedAdvancedMode","noAdvancedMode","RootEllipsis","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","_defineProperty","_assertThisInitialized","visible","createRef","setState","showTooltip","_createClass","key","value","_this$asProps","asProps","_this$asProps$maxLine","maxLine","Children","textRef","current","getContentProps","ref","getPopperProps","_this$asProps2","includeTooltipProps","tooltipProps","_objectSpread","children","render","_ref4","_tooltipProps$visible","SEllipsis","SContainer","SNoTooltipContainer","_this$asProps3","styles","tooltip","trim","containerRect","containerRef","other","_objectWithoutProperties","_excluded","state","advancedContent","Ellipsis","Content","displayName","advanceMode","Popper","onVisibleChange","handlerVisibleChange","_ref2","EllipsisMiddle","cn","_ref3","undefined","__excludeProps","EllipsisMiddleContext","createContext","props","_ref7","otherProps","_excluded2","resizeElement","useRef","_React$useState","useState","symbolWidth","_React$useState2","_slicedToArray","dimension","setDimension","blockWidth","node","dateSpan","setAttribute","rect","STail","SBeginning","SContainerMiddle","tag","SAdvancedModeContainerMiddle","displayedSymbols","useMemo","round","interaction","contextValue","begining","substring","tail","_ref5","Provider","_ref6","_ref10","_ref","arguments[0]","_ref9","Trigger","ellipsisMiddleContext","useContext","_ref8","_assignProps","_assignProps2"],"sources":["../../src/Ellipsis.tsx"],"sourcesContent":["import React, { RefObject } from 'react';\nimport createComponent, { Component, Intergalactic, Root, sstyled } from '@semcore/core';\nimport Tooltip, { TooltipProps } from '@semcore/tooltip';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { useResizeObserver } from './useResizeObserver';\nimport useEnhancedEffect from '@semcore/utils/lib/use/useEnhancedEffect';\nimport findComponent, { isAdvanceMode } from '@semcore/utils/lib/findComponent';\n\nimport style from './style/ellipsis.shadow.css';\nimport reactToText from '@semcore/utils/lib/reactToText';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport pick from '@semcore/utils/lib/pick';\nimport { forkRef } from '@semcore/utils/lib/ref';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\ntype AsProps = {\n maxLine?: number;\n trim?: 'end' | 'middle';\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n includeTooltipProps?: string[];\n __excludeProps?: string[];\n};\n\ntype AsPropsMiddle = {\n text: string;\n textRef: RefObject<HTMLElement>;\n tooltip?: boolean;\n styles?: React.CSSProperties;\n containerRect?: { width: number };\n\n containerRef?: RefObject<HTMLDivElement>;\n tooltipProps: TooltipProps;\n children?: React.ReactNode;\n advanceMode?: boolean;\n tag?: React.ElementType;\n};\n\ntype EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope\n containerRef?: RefObject<HTMLDivElement>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\nconst defaultTooltipProps = [\n 'title',\n 'theme',\n 'strategy',\n 'modifiers',\n 'placement',\n 'interaction',\n 'timeout',\n 'visible',\n 'defaultVisible',\n 'onVisibleChange',\n 'offset',\n 'preventOverflow',\n 'arrow',\n 'flip',\n 'computeStyles',\n 'eventListeners',\n 'onFirstUpdate',\n 'cursorAnchoring',\n];\n\nconst createMeasurerElement = (element: HTMLDivElement, text?: string) => {\n const styleElement = window.getComputedStyle(element, null);\n const temporaryElement = document.createElement('temporary-block');\n temporaryElement.style.display = styleElement.getPropertyValue('display');\n temporaryElement.style.padding = styleElement.getPropertyValue('padding');\n temporaryElement.style.position = 'absolute';\n temporaryElement.style.right = '0%';\n temporaryElement.style.bottom = '0%';\n temporaryElement.style.visibility = 'hidden';\n temporaryElement.style.fontFamily = styleElement.getPropertyValue('font-family');\n temporaryElement.style.fontSize = styleElement.getPropertyValue('font-size');\n temporaryElement.style.fontWeight = styleElement.getPropertyValue('font-weight');\n temporaryElement.style.lineHeight = styleElement.getPropertyValue('line-height');\n temporaryElement.style.whiteSpace = styleElement.getPropertyValue('white-space');\n temporaryElement.style.wordWrap = styleElement.getPropertyValue('word-wrap');\n\n temporaryElement.style.fontFeatureSettings =\n styleElement.getPropertyValue('font-feature-settings');\n temporaryElement.style.fontVariantNumeric = styleElement.getPropertyValue('font-variant-numeric');\n\n temporaryElement.innerHTML = text ?? element.innerHTML;\n return temporaryElement;\n};\n\nfunction isTextOverflowing(element: HTMLDivElement, multiline: boolean, text?: string): boolean {\n if (!element) return false;\n\n const { height: currentHeight, width: currentWidth } = element.getBoundingClientRect();\n const measuringElement = createMeasurerElement(element, text);\n let isOverflowing = false;\n\n document.body.appendChild(measuringElement);\n if (multiline) {\n measuringElement.style.width = `${currentWidth}px`;\n\n const width = measuringElement.scrollWidth;\n const height = measuringElement.getBoundingClientRect().height;\n\n if (Math.ceil(currentHeight) < height || Math.ceil(currentWidth) < width) {\n isOverflowing = true;\n }\n } else {\n measuringElement.style.whiteSpace = 'nowrap';\n isOverflowing = Math.ceil(currentWidth) < measuringElement.getBoundingClientRect().width;\n }\n\n document.body.removeChild(measuringElement);\n\n return isOverflowing;\n}\n\nconst forcedAdvancedMode = { forcedAdvancedMode: true } as any;\nconst noAdvancedMode = {} as any;\n\nclass RootEllipsis extends Component<AsProps> {\n static displayName = 'Ellipsis';\n static style = style;\n static defaultProps: AsProps = {\n trim: 'end',\n tooltip: true,\n includeTooltipProps: defaultTooltipProps,\n __excludeProps: ['title'],\n };\n\n state = {\n visible: false,\n };\n\n textRef = React.createRef<HTMLDivElement>();\n\n showTooltip() {\n const { maxLine = 1, Children } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n return isTextOverflowing(this.textRef.current!, maxLine > 1, text);\n }\n\n handlerVisibleChange = (visible: boolean) => {\n this.setState({ visible: visible && this.showTooltip() });\n };\n\n getContentProps() {\n return {\n ref: this.textRef,\n maxLine: this.asProps.maxLine,\n };\n }\n\n getPopperProps() {\n const { Children, includeTooltipProps } = this.asProps;\n const text = reactToText(getOriginChildren(Children));\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n return { children: text, ...tooltipProps };\n }\n\n render() {\n const SEllipsis = this.Root;\n const SContainer = Tooltip;\n const SNoTooltipContainer = Box;\n const {\n styles,\n Children,\n maxLine,\n tooltip,\n trim,\n containerRect,\n containerRef,\n includeTooltipProps,\n children,\n ...other\n } = this.asProps;\n const { visible } = this.state;\n const advancedContent = findComponent(Children, [(Ellipsis as any).Content.displayName]);\n const text = reactToText(advancedContent || getOriginChildren(Children));\n const advanceMode = isAdvanceMode(Children, [\n (Ellipsis as any).Content.displayName,\n (Ellipsis as any).Popper.displayName,\n ]);\n const tooltipProps = pick(this.asProps, includeTooltipProps as any) as TooltipProps;\n\n tooltipProps.visible = tooltipProps.visible ?? visible;\n tooltipProps.onVisibleChange = tooltipProps.onVisibleChange\n ? callAllEventHandlers(tooltipProps.onVisibleChange, this.handlerVisibleChange)\n : this.handlerVisibleChange;\n\n if (trim === 'middle') {\n return sstyled(styles)(\n <EllipsisMiddle\n text={text}\n styles={styles}\n tooltip={tooltip}\n containerRect={containerRect}\n containerRef={containerRef}\n textRef={this.textRef}\n tooltipProps={tooltipProps}\n advanceMode={advanceMode}\n {...other}\n >\n <Children />\n </EllipsisMiddle>,\n );\n }\n if (tooltip) {\n return sstyled(styles)(\n <SContainer\n interaction='hover'\n title={!advanceMode ? text : undefined}\n {...tooltipProps}\n {...(advanceMode ? forcedAdvancedMode : noAdvancedMode)}\n >\n {advanceMode ? (\n <Children />\n ) : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SContainer>,\n );\n }\n return sstyled(styles)(\n <SNoTooltipContainer>\n {advanceMode ? (\n <Children />\n ) : (\n <SEllipsis render={Box} ref={this.textRef} maxLine={maxLine} {...other}>\n <Children />\n </SEllipsis>\n )}\n </SNoTooltipContainer>,\n );\n }\n}\n\nconst EllipsisMiddleContext = React.createContext<null | {\n begining: string;\n tail: string;\n ref: React.RefObject<HTMLElement>;\n}>(null);\n\nconst EllipsisMiddle: React.FC<AsPropsMiddle> = (props) => {\n const {\n styles,\n text,\n tooltip,\n containerRect,\n containerRef,\n textRef,\n tooltipProps,\n children,\n advanceMode,\n ...otherProps\n } = props;\n const resizeElement = React.useRef<HTMLDivElement>(null);\n const [dimension, setDimension] = React.useState<{ fontSize: string; symbolWidth: number }>({\n fontSize: '14',\n symbolWidth: 0,\n });\n const blockWidth = useResizeObserver(resizeElement, containerRect).width;\n\n useEnhancedEffect(() => {\n const node = containerRef?.current || resizeElement?.current;\n if (!node) return;\n\n const dateSpan = document.createElement('temporary-block');\n dateSpan.setAttribute('style', `fontSize: ${dimension.fontSize}px`);\n dateSpan.innerHTML = 'a';\n document.body.appendChild(dateSpan);\n const rect = dateSpan.getBoundingClientRect();\n\n setDimension({\n fontSize: window.getComputedStyle(node, null).getPropertyValue('font-size'),\n symbolWidth: rect.width,\n });\n document.body.removeChild(dateSpan);\n }, []);\n\n const STail = 'span';\n const SBeginning = 'span';\n const SContainerMiddle = props.tag || Box;\n const SAdvancedModeContainerMiddle = Tooltip;\n const displayedSymbols = React.useMemo(\n () => Math.round(blockWidth / dimension.symbolWidth),\n [blockWidth, dimension.symbolWidth],\n );\n\n const interaction = text.length > displayedSymbols ? 'hover' : 'none';\n const ref = containerRef ?? resizeElement;\n const contextValue = React.useMemo(\n () => ({\n begining: text.substring(0, text.length - displayedSymbols / 2 - 1),\n tail: text.substring(text.length - displayedSymbols / 2 - 1),\n ref,\n }),\n [text, displayedSymbols],\n );\n\n if (advanceMode) {\n return sstyled(styles)(\n <SAdvancedModeContainerMiddle\n interaction={interaction}\n {...tooltipProps}\n {...forcedAdvancedMode}\n >\n <EllipsisMiddleContext.Provider value={contextValue}>\n {children}\n </EllipsisMiddleContext.Provider>\n </SAdvancedModeContainerMiddle>,\n ) as any;\n }\n if (tooltip) {\n return sstyled(styles)(\n <SContainerMiddle\n interaction={interaction}\n title={text as any}\n ref={forkRef(ref, textRef)}\n tag={Tooltip}\n __excludeProps={['title']}\n {...tooltipProps}\n >\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n ) as any;\n }\n return sstyled(styles)(\n <SContainerMiddle {...otherProps} ref={containerRef ?? resizeElement}>\n <SBeginning>{contextValue.begining}</SBeginning>\n <STail>{contextValue.tail}</STail>\n </SContainerMiddle>,\n ) as any;\n};\n\ntype EllipsisContentAsProps = {\n styles: any;\n Children: React.FC;\n};\n\nconst Content: React.FC<EllipsisContentAsProps> = ({ styles, Children }) => {\n const SEllipsis = Root;\n const ellipsisMiddleContext = React.useContext(EllipsisMiddleContext);\n const STail = 'span';\n const SBeginning = 'span';\n\n if (ellipsisMiddleContext) {\n const { begining, tail, ref } = ellipsisMiddleContext;\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger} middle-mod ref={ref}>\n <SBeginning>{begining}</SBeginning>\n <STail>{tail}</STail>\n </SEllipsis>,\n ) as any;\n }\n\n return sstyled(styles)(\n <SEllipsis render={Tooltip.Trigger}>\n <Children />\n </SEllipsis>,\n ) as any;\n};\n\nconst Ellipsis = createComponent(RootEllipsis, {\n Content,\n Popper: Tooltip.Popper,\n}) as any as Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport default Ellipsis;\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAqB,OAAO;AACxC,OAAOC,eAAe,IAAIC,SAAS,EAAiBC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACxF,OAAOC,OAAO,MAAwB,kBAAkB;AACxD,SAASC,GAAG,QAAkB,mBAAmB;AACjD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,aAAa,IAAIC,aAAa,QAAQ,kCAAkC;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAGhF,OAAOC,WAAW,MAAM,gCAAgC;AACxD,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,IAAI,MAAM,yBAAyB;AAC1C,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,oBAAoB,QAAQ,gCAAgC;AA4DrE,IAAMC,mBAAmB,GAAG,CAC1B,OAAO,EACP,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,MAAM,EACN,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,CAClB;AAED,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,OAAuB,EAAEC,IAAa,EAAK;EACxE,IAAMC,YAAY,GAAGC,MAAM,CAACC,gBAAgB,CAACJ,OAAO,EAAE,IAAI,CAAC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BW,qBAAqB,CAA7CX,QAAQ;MAAEE,IAAI,GAAUS,qBAAqB,CAAnCT,IAAI;MAAErE,GAAG,GAAK8E,qBAAqB,CAA7B9E,GAAG;IAC3B,OAAAgF,KAAA,GAAO5K,OAAO,CAAC0G,MAAM,CAAC,eACpB9G,KAAA,CAAA4B,aAAA,CAAC8E,SAAS,EAAAsE,KAAA,CAAA/C,EAAA,cAAA5B,aAAA,KAAA4E,YAAA;MAAA;MAAA,OAA0CjF;IAAG,GAAA0E,IAAA,kBACrD1K,KAAA,CAAA4B,aAAA,CAAC8H,UAAU,EAAAsB,KAAA,CAAA/C,EAAA,oBAAEkC,QAAQ,CAAc,eACnCnK,KAAA,CAAA4B,aAAA,CAAC6H,KAAK,EAAAuB,KAAA,CAAA/C,EAAA,eAAEoC,IAAI,CAAS,CACX;EAEhB;EAEA,OAAAO,KAAA,GAAOxK,OAAO,CAAC0G,MAAM,CAAC,eACpB9G,KAAA,CAAA4B,aAAA,CAAC8E,SAAS,EAAAkE,KAAA,CAAA3C,EAAA,cAAA5B,aAAA,KAAA6E,aAAA,KAAAR,IAAA,kBACR1K,KAAA,CAAA4B,aAAA,CAACgE,QAAQ,EAAAgF,KAAA,CAAA3C,EAAA,iBAAG,CACF;AAEhB,CAAC;AAED,IAAMT,QAAQ,GAAGvH,eAAe,CAAC+D,YAAY,EAAE;EAC7CyD,OAAO,EAAPA,OAAO;EACPG,MAAM,EAAEvH,OAAO,CAACuH;AAClB,CAAC,CAGA;AAED,eAAeJ,QAAQ"}
|
package/lib/es6/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { UnknownProperties, Intergalactic } from '@semcore/core';\nimport { RefObject } from 'react';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport Tooltip, { TooltipProps } from '@semcore/tooltip';\n\n/** @deprecated */\nexport interface IEllipsisProps extends EllipsisProps, UnknownProperties {}\nexport type EllipsisProps = BoxProps &\n Partial<TooltipProps> & {\n /**\n * Rows count in multiline Ellipsis\n * @default 1\n */\n maxLine?: number;\n /**\n * Trimming type\n * @default end\n */\n trim?: 'end' | 'middle';\n /**\n * Show tooltip\n * @default true\n */\n tooltip?: boolean;\n /**\n * Ref to the item that will be observed by ResizeObserver\n */\n containerRef?: RefObject<HTMLElement | null>;\n /**\n * Explicit sizes of container text should be trimmed in\n **/\n containerRect?: { width: number };\n /** List of props that will be passed to tooltip\n * @default ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate']\n */\n includeTooltipProps?: string[];\n };\n\ndeclare const useResizeObserver: (\n ref: RefObject<HTMLElement>,\n hookOverride?: { width: number },\n) => { width: number };\n\ndeclare const Ellipsis: Intergalactic.Component<'div', EllipsisProps> & {\n Content: typeof Box;\n Popper: typeof Tooltip.Popper;\n};\n\nexport { useResizeObserver };\nexport default Ellipsis;\n"],"mappings":""}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","useResizeObserver"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Ellipsis';\nexport { useResizeObserver } from './useResizeObserver';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,iBAAiB,QAAQ,qBAAqB"
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","useResizeObserver"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Ellipsis';\nexport { useResizeObserver } from './useResizeObserver';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,iBAAiB,QAAQ,qBAAqB"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
SContainer,
|
|
2
|
+
SNoTooltipContainer,
|
|
3
|
+
SContainerMiddle {
|
|
4
|
+
display: flex;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
SBeginning,
|
|
2
9
|
SEllipsis {
|
|
3
10
|
overflow: hidden;
|
|
@@ -6,9 +13,7 @@ SEllipsis {
|
|
|
6
13
|
white-space: pre;
|
|
7
14
|
}
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
SNoTooltipContainer,
|
|
11
|
-
SContainerMiddle {
|
|
16
|
+
SEllipsis[middle-mod] {
|
|
12
17
|
display: flex;
|
|
13
18
|
overflow: hidden;
|
|
14
19
|
}
|
|
@@ -22,11 +27,6 @@ SEllipsis[maxLine] {
|
|
|
22
27
|
overflow-wrap: break-word;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
SEllipsis[middle-mod] {
|
|
26
|
-
display: flex;
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
30
|
SContainerMiddle> :has(SBeginning),
|
|
31
31
|
SContainerMiddle> :has(STail) {
|
|
32
32
|
display: flex;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import canUseDOM from '@semcore/core/lib/utils/canUseDOM';
|
|
3
|
-
import useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';
|
|
4
2
|
import React from 'react';
|
|
3
|
+
import useEnhancedEffect from '@semcore/utils/lib/use/useEnhancedEffect';
|
|
4
|
+
import canUseDOM from '@semcore/utils/lib/canUseDOM';
|
|
5
5
|
export var useResizeObserver = function useResizeObserver(ref, hookOverride) {
|
|
6
6
|
var _React$useState = React.useState(0),
|
|
7
7
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.js","names":["
|
|
1
|
+
{"version":3,"file":"useResizeObserver.js","names":["React","useEnhancedEffect","canUseDOM","useResizeObserver","ref","hookOverride","_React$useState","useState","_React$useState2","_slicedToArray","width","setWidth","handleResize","useCallback","entries","contentRect","current","ro","ResizeObserver","observe","disconnect"],"sources":["../../src/useResizeObserver.tsx"],"sourcesContent":["import React, { RefObject } from 'react';\nimport useEnhancedEffect from '@semcore/utils/lib/use/useEnhancedEffect';\nimport canUseDOM from '@semcore/utils/lib/canUseDOM';\n\nexport const useResizeObserver = (\n ref: RefObject<HTMLElement>,\n hookOverride?: { width: number },\n) => {\n const [width, setWidth] = React.useState<number>(0);\n\n const handleResize = React.useCallback((entries: ResizeObserverEntry[]) => {\n setWidth(entries[0].contentRect.width);\n }, []);\n\n useEnhancedEffect(() => {\n if (!ref.current) {\n return;\n }\n\n if (hookOverride) {\n return;\n }\n if (canUseDOM()) {\n const ro = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n handleResize(entries);\n });\n\n ro.observe(ref.current);\n\n return () => {\n ro.disconnect();\n };\n }\n }, [hookOverride]);\n\n if (hookOverride) {\n return hookOverride;\n }\n return { width };\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAqB,OAAO;AACxC,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,SAAS,MAAM,8BAA8B;AAEpD,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAC5BC,GAA2B,EAC3BC,YAAgC,EAC7B;EACH,IAAAC,eAAA,GAA0BN,KAAK,CAACO,QAAQ,CAAS,CAAC,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA;IAA5CI,KAAK,GAAAF,gBAAA;IAAEG,QAAQ,GAAAH,gBAAA;EAEtB,IAAMI,YAAY,GAAGZ,KAAK,CAACa,WAAW,CAAC,UAACC,OAA8B,EAAK;IACzEH,QAAQ,CAACG,OAAO,CAAC,CAAC,CAAC,CAACC,WAAW,CAACL,KAAK,CAAC;EACxC,CAAC,EAAE,EAAE,CAAC;EAENT,iBAAiB,CAAC,YAAM;IACtB,IAAI,CAACG,GAAG,CAACY,OAAO,EAAE;MAChB;IACF;IAEA,IAAIX,YAAY,EAAE;MAChB;IACF;IACA,IAAIH,SAAS,EAAE,EAAE;MACf,IAAMe,EAAE,GAAG,IAAIC,cAAc,CAAC,UAACJ,OAA8B,EAAK;QAChEF,YAAY,CAACE,OAAO,CAAC;MACvB,CAAC,CAAC;MAEFG,EAAE,CAACE,OAAO,CAACf,GAAG,CAACY,OAAO,CAAC;MAEvB,OAAO,YAAM;QACXC,EAAE,CAACG,UAAU,EAAE;MACjB,CAAC;IACH;EACF,CAAC,EAAE,CAACf,YAAY,CAAC,CAAC;EAElB,IAAIA,YAAY,EAAE;IAChB,OAAOA,YAAY;EACrB;EACA,OAAO;IAAEK,KAAK,EAALA;EAAM,CAAC;AAClB,CAAC"}
|