@app-studio/web 0.3.50 → 0.3.52
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/web.esm.js
CHANGED
|
@@ -2665,30 +2665,37 @@ var TruncateText = function TruncateText(_ref2) {
|
|
|
2665
2665
|
_ref2$maxLines = _ref2.maxLines,
|
|
2666
2666
|
maxLines = _ref2$maxLines === void 0 ? 1 : _ref2$maxLines;
|
|
2667
2667
|
var containerRef = useRef(null);
|
|
2668
|
-
var _useState = useState(text),
|
|
2669
|
-
|
|
2670
|
-
|
|
2668
|
+
var _useState = useState(text.length),
|
|
2669
|
+
truncatedLength = _useState[0],
|
|
2670
|
+
setTruncatedLength = _useState[1];
|
|
2671
2671
|
useEffect(function () {
|
|
2672
|
-
var textContent = content;
|
|
2673
2672
|
var textNode = containerRef.current;
|
|
2674
|
-
if (textNode)
|
|
2675
|
-
|
|
2673
|
+
if (!textNode) return;
|
|
2674
|
+
var updateTruncatedText = function updateTruncatedText() {
|
|
2676
2675
|
var comLineHeight = getComputedStyle(textNode).lineHeight;
|
|
2677
2676
|
var lineHeight = comLineHeight !== 'normal' ? parseFloat(comLineHeight) : 20;
|
|
2678
|
-
var maxHeight =
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2677
|
+
var maxHeight = lineHeight * maxLines;
|
|
2678
|
+
var start = 0;
|
|
2679
|
+
var end = text.length;
|
|
2680
|
+
var middle;
|
|
2681
|
+
while (start <= end) {
|
|
2682
|
+
middle = Math.floor((start + end) / 2);
|
|
2683
|
+
textNode.innerText = text.substring(0, middle) + '...';
|
|
2684
|
+
var currentHeight = textNode.offsetHeight;
|
|
2685
|
+
if (currentHeight > maxHeight) {
|
|
2686
|
+
end = middle - 1;
|
|
2687
|
+
} else {
|
|
2688
|
+
start = middle + 1;
|
|
2684
2689
|
}
|
|
2685
2690
|
}
|
|
2686
|
-
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2691
|
+
setTruncatedLength(end);
|
|
2692
|
+
};
|
|
2693
|
+
updateTruncatedText();
|
|
2694
|
+
}, [text, maxLines]);
|
|
2695
|
+
var displayText = text.length > truncatedLength ? text.substring(0, truncatedLength) + '...' : text;
|
|
2689
2696
|
return React.createElement("div", {
|
|
2690
2697
|
ref: containerRef
|
|
2691
|
-
},
|
|
2698
|
+
}, displayText);
|
|
2692
2699
|
};
|
|
2693
2700
|
var TextView = function TextView(_ref3) {
|
|
2694
2701
|
var children = _ref3.children,
|
|
@@ -4417,9 +4424,9 @@ var useModalStore = /*#__PURE__*/create(function (set) {
|
|
|
4417
4424
|
hide: function hide() {
|
|
4418
4425
|
set(function (state) {
|
|
4419
4426
|
return _extends({}, state, {
|
|
4420
|
-
modalProps: {
|
|
4427
|
+
modalProps: _extends({}, state.modalProps, {
|
|
4421
4428
|
isVisible: false
|
|
4422
|
-
}
|
|
4429
|
+
})
|
|
4423
4430
|
});
|
|
4424
4431
|
});
|
|
4425
4432
|
}
|