intelicoreact 1.4.39 → 1.4.41
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,25 +55,16 @@ const TagList = _ref => {
|
|
|
55
55
|
onToggleRenderAll === null || onToggleRenderAll === void 0 ? void 0 : onToggleRenderAll(v);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
const isTagsRefSet = () => {
|
|
59
|
-
if (!tagList.length) return false;
|
|
60
|
-
return tagList.map(_ref2 => {
|
|
61
|
-
let {
|
|
62
|
-
itemRef
|
|
63
|
-
} = _ref2;
|
|
64
|
-
return itemRef;
|
|
65
|
-
}).reduce((result, itemRef) => {
|
|
66
|
-
if (!(itemRef !== null && itemRef !== void 0 && itemRef.current)) return false;
|
|
67
|
-
return result;
|
|
68
|
-
}, true);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
58
|
const getStaticTagsCount = () => {
|
|
59
|
+
var _window$getComputedSt;
|
|
60
|
+
|
|
72
61
|
if (typeof shownItemsCount === "number") return shownItemsCount;
|
|
73
|
-
|
|
62
|
+
let computedWidth = wrapperWidth || parseInt((_window$getComputedSt = window.getComputedStyle(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.width);
|
|
63
|
+
if (isNaN(computedWidth)) return -1;
|
|
64
|
+
const result = tagList.map(_ref2 => {
|
|
74
65
|
let {
|
|
75
66
|
itemRef
|
|
76
|
-
} =
|
|
67
|
+
} = _ref2;
|
|
77
68
|
return itemRef;
|
|
78
69
|
}).reduce((result, itemRef) => {
|
|
79
70
|
const itemStyle = window.getComputedStyle(itemRef === null || itemRef === void 0 ? void 0 : itemRef.current);
|
|
@@ -82,7 +73,7 @@ const TagList = _ref => {
|
|
|
82
73
|
return result;
|
|
83
74
|
}, 0);
|
|
84
75
|
|
|
85
|
-
if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width < wrapperWidth -
|
|
76
|
+
if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width < wrapperWidth - 32) {
|
|
86
77
|
result = {
|
|
87
78
|
count: result.count + 1,
|
|
88
79
|
width: result.width + itemWidth,
|
|
@@ -110,21 +101,21 @@ const TagList = _ref => {
|
|
|
110
101
|
};
|
|
111
102
|
|
|
112
103
|
const renderTags = () => {
|
|
113
|
-
const tagsRenderOrder = renderOrder !== null && renderOrder !== void 0 ? renderOrder : tagList.map(
|
|
104
|
+
const tagsRenderOrder = renderOrder !== null && renderOrder !== void 0 ? renderOrder : tagList.map(_ref3 => {
|
|
114
105
|
let {
|
|
115
106
|
value,
|
|
116
107
|
id
|
|
117
|
-
} =
|
|
108
|
+
} = _ref3;
|
|
118
109
|
return value !== null && value !== void 0 ? value : id;
|
|
119
110
|
});
|
|
120
111
|
return tagsRenderOrder.map((v, i) => {
|
|
121
112
|
var _item$id, _item$id2;
|
|
122
113
|
|
|
123
|
-
const item = tagList.find(
|
|
114
|
+
const item = tagList.find(_ref4 => {
|
|
124
115
|
let {
|
|
125
116
|
value,
|
|
126
117
|
id
|
|
127
|
-
} =
|
|
118
|
+
} = _ref4;
|
|
128
119
|
return (value !== null && value !== void 0 ? value : id) === v;
|
|
129
120
|
});
|
|
130
121
|
if (!item) return null;
|
|
@@ -173,10 +164,20 @@ const TagList = _ref => {
|
|
|
173
164
|
}, [items]); // Count Row Tags
|
|
174
165
|
|
|
175
166
|
(0, _react.useLayoutEffect)(() => {
|
|
176
|
-
if (withToggle && wrapperWidth !== -1) {
|
|
177
|
-
|
|
167
|
+
if (withToggle && wrapperWidth !== -1 && staticTagsCount === -1) {
|
|
168
|
+
let computedWidth = wrapperWidth;
|
|
169
|
+
|
|
170
|
+
if (computedWidth === 0) {
|
|
171
|
+
var _window$getComputedSt2;
|
|
172
|
+
|
|
173
|
+
computedWidth = parseInt((_window$getComputedSt2 = window.getComputedStyle(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) === null || _window$getComputedSt2 === void 0 ? void 0 : _window$getComputedSt2.width);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (!isNaN(computedWidth)) {
|
|
177
|
+
setStaticTagsCount(getStaticTagsCount());
|
|
178
|
+
}
|
|
178
179
|
}
|
|
179
|
-
}, [tagList, wrapperWidth,
|
|
180
|
+
}, [tagList, wrapperWidth, wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current]); //
|
|
180
181
|
|
|
181
182
|
(0, _react.useLayoutEffect)(() => {
|
|
182
183
|
setRenderItemsCount(staticTagsCount);
|