intelicoreact 1.4.72 → 1.4.74
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.
|
@@ -55,26 +55,22 @@ const TagList = _ref => {
|
|
|
55
55
|
onToggleRenderAll === null || onToggleRenderAll === void 0 ? void 0 : onToggleRenderAll(v);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
const getStaticTagsCount =
|
|
59
|
-
var
|
|
58
|
+
const getStaticTagsCount = computedWidth => {
|
|
59
|
+
var _result$items;
|
|
60
60
|
|
|
61
61
|
if (typeof shownItemsCount === "number") return shownItemsCount;
|
|
62
|
-
const computedWidth = wrapperWidth || parseInt(wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current ? (_window$getComputedSt = window.getComputedStyle(wrapperRef.current)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.width : 0);
|
|
63
62
|
const delta = typeof onEditClick === "function" ? 60 : 32;
|
|
64
|
-
|
|
65
|
-
const result = tagList.map(_ref2 => {
|
|
63
|
+
const result = tagList.reduce((result, _ref2, index) => {
|
|
66
64
|
let {
|
|
67
65
|
itemRef
|
|
68
66
|
} = _ref2;
|
|
69
|
-
return itemRef;
|
|
70
|
-
}).reduce((result, itemRef) => {
|
|
71
67
|
const itemStyle = (itemRef === null || itemRef === void 0 ? void 0 : itemRef.current) && window.getComputedStyle(itemRef.current);
|
|
72
68
|
const itemWidth = [parseInt(itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.width, 10), parseInt(itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.marginLeft, 10), parseInt(itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.marginRight, 10)].reduce((result, item) => {
|
|
73
69
|
if (!isNaN(item)) result += item;
|
|
74
70
|
return result;
|
|
75
71
|
}, 0);
|
|
76
72
|
|
|
77
|
-
if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width <
|
|
73
|
+
if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width < computedWidth - delta || index === 0) {
|
|
78
74
|
result = {
|
|
79
75
|
count: result.count + 1,
|
|
80
76
|
width: result.width + itemWidth,
|
|
@@ -91,6 +87,11 @@ const TagList = _ref => {
|
|
|
91
87
|
width: 0,
|
|
92
88
|
items: []
|
|
93
89
|
});
|
|
90
|
+
|
|
91
|
+
if ((result === null || result === void 0 ? void 0 : (_result$items = result.items) === null || _result$items === void 0 ? void 0 : _result$items.length) === 1) {
|
|
92
|
+
result.items[0].r.style.maxWidth = "".concat(computedWidth - delta - 8, "px");
|
|
93
|
+
}
|
|
94
|
+
|
|
94
95
|
return result === null || result === void 0 ? void 0 : result.count;
|
|
95
96
|
};
|
|
96
97
|
|
|
@@ -169,13 +170,13 @@ const TagList = _ref => {
|
|
|
169
170
|
let computedWidth = wrapperWidth;
|
|
170
171
|
|
|
171
172
|
if (computedWidth === 0) {
|
|
172
|
-
var _window$
|
|
173
|
+
var _window$getComputedSt;
|
|
173
174
|
|
|
174
|
-
computedWidth = parseInt(wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current ? (_window$
|
|
175
|
+
computedWidth = parseInt(wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current ? (_window$getComputedSt = window.getComputedStyle(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.width : 0);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
if (!isNaN(computedWidth)) {
|
|
178
|
-
setStaticTagsCount(getStaticTagsCount());
|
|
179
|
+
setStaticTagsCount(getStaticTagsCount(computedWidth));
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
}, [tagList, wrapperWidth, wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current]); //
|
|
@@ -23,6 +23,18 @@
|
|
|
23
23
|
|
|
24
24
|
&_item {
|
|
25
25
|
display: inline-block;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
|
|
29
|
+
.tag {
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
|
|
33
|
+
&__label {
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
26
38
|
|
|
27
39
|
&--hidden {
|
|
28
40
|
display: none;
|