intelicoreact 1.4.37 → 1.4.39
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.
|
@@ -737,7 +737,9 @@ const TagsDropdown = _ref => {
|
|
|
737
737
|
setIsOpen(true);
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
}, attributesOfNativeInput
|
|
740
|
+
}, attributesOfNativeInput, withCreateLogic ? {
|
|
741
|
+
symbolsLimit: 50
|
|
742
|
+
} : {})))), headerContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
741
743
|
className: (0, _classnames.default)("".concat(RC, "__header-row"))
|
|
742
744
|
}, headerContent)) : null, withSearchInputInList && /*#__PURE__*/_react.default.createElement("div", {
|
|
743
745
|
className: (0, _classnames.default)("".concat(RC, "__input-list-wrapper"))
|
|
@@ -121,7 +121,11 @@ const Tag = _ref => {
|
|
|
121
121
|
className: "tag__label"
|
|
122
122
|
}, label || name), removeItem && !isNoDismiss && /*#__PURE__*/_react.default.createElement("button", {
|
|
123
123
|
"data-testid": testIdRemove,
|
|
124
|
-
onClick:
|
|
124
|
+
onClick: e => {
|
|
125
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
126
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
127
|
+
removeItem(value);
|
|
128
|
+
},
|
|
125
129
|
className: "tag__button"
|
|
126
130
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
|
|
127
131
|
className: "color--text"
|
|
@@ -26,6 +26,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
28
|
const TagList = _ref => {
|
|
29
|
+
var _wrapperRef$current$g, _wrapperRef$current, _wrapperRef$current$g2;
|
|
30
|
+
|
|
29
31
|
let {
|
|
30
32
|
disabled,
|
|
31
33
|
className,
|
|
@@ -42,19 +44,17 @@ const TagList = _ref => {
|
|
|
42
44
|
onToggleRenderAll
|
|
43
45
|
} = _ref;
|
|
44
46
|
const wrapperRef = (0, _react.useRef)(null);
|
|
45
|
-
const [wrapperWidth, setWrapperWidth] = (0, _react.useState)(-1);
|
|
46
47
|
const [tagList, setTagList] = (0, _react.useState)([]);
|
|
47
48
|
const [staticTagsCount, setStaticTagsCount] = (0, _react.useState)(-1);
|
|
48
49
|
const [renderItemsCount, setRenderItemsCount] = (0, _react.useState)(-1);
|
|
49
50
|
const [renderAll, setRenderAll] = (0, _react.useState)(!withToggle);
|
|
51
|
+
const wrapperWidth = (_wrapperRef$current$g = wrapperRef === null || wrapperRef === void 0 ? void 0 : (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : (_wrapperRef$current$g2 = _wrapperRef$current.getBoundingClientRect()) === null || _wrapperRef$current$g2 === void 0 ? void 0 : _wrapperRef$current$g2.width) !== null && _wrapperRef$current$g !== void 0 ? _wrapperRef$current$g : -1;
|
|
50
52
|
|
|
51
53
|
const setRenderAllInterceptor = v => {
|
|
52
54
|
setRenderAll(v);
|
|
53
55
|
onToggleRenderAll === null || onToggleRenderAll === void 0 ? void 0 : onToggleRenderAll(v);
|
|
54
56
|
};
|
|
55
57
|
|
|
56
|
-
const [lastCheckTime, setLastCheckTime] = (0, _react.useState)(-1);
|
|
57
|
-
|
|
58
58
|
const isTagsRefSet = () => {
|
|
59
59
|
if (!tagList.length) return false;
|
|
60
60
|
return tagList.map(_ref2 => {
|
|
@@ -76,10 +76,13 @@ const TagList = _ref => {
|
|
|
76
76
|
} = _ref3;
|
|
77
77
|
return itemRef;
|
|
78
78
|
}).reduce((result, itemRef) => {
|
|
79
|
-
|
|
80
|
-
const itemWidth = parseInt(
|
|
79
|
+
const itemStyle = window.getComputedStyle(itemRef === null || itemRef === void 0 ? void 0 : itemRef.current);
|
|
80
|
+
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) => {
|
|
81
|
+
if (!isNaN(item)) result += item;
|
|
82
|
+
return result;
|
|
83
|
+
}, 0);
|
|
81
84
|
|
|
82
|
-
if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width < wrapperWidth) {
|
|
85
|
+
if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width < wrapperWidth - 30) {
|
|
83
86
|
result = {
|
|
84
87
|
count: result.count + 1,
|
|
85
88
|
width: result.width + itemWidth,
|
|
@@ -125,7 +128,7 @@ const TagList = _ref => {
|
|
|
125
128
|
return (value !== null && value !== void 0 ? value : id) === v;
|
|
126
129
|
});
|
|
127
130
|
if (!item) return null;
|
|
128
|
-
const isHidden = renderItemsCount !== -1 ? i >= renderItemsCount : false;
|
|
131
|
+
const isHidden = renderItemsCount !== -1 && staticTagsCount !== -1 ? i >= renderItemsCount : false;
|
|
129
132
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
130
133
|
className: "tag-list_wrapper_item ".concat(isHidden ? "tag-list_wrapper_item--hidden" : ""),
|
|
131
134
|
key: "tag-list-item-".concat((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.value),
|
|
@@ -157,16 +160,8 @@ const TagList = _ref => {
|
|
|
157
160
|
className: "tag-list_wrapper_hide-more",
|
|
158
161
|
onClick: e => cancelDefault(e, () => setRenderAllInterceptor(false))
|
|
159
162
|
});
|
|
160
|
-
}; // Set TagList
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
(0, _react.useLayoutEffect)(() => {
|
|
164
|
-
const wrapperNewWidth = parseInt(window.getComputedStyle(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current).getPropertyValue("width"), 10) - 48;
|
|
163
|
+
}; // Set TagList Items
|
|
165
164
|
|
|
166
|
-
if (wrapperRef.current && wrapperNewWidth !== wrapperWidth) {
|
|
167
|
-
setWrapperWidth(wrapperNewWidth);
|
|
168
|
-
}
|
|
169
|
-
}, [document]); // Set TagList Items
|
|
170
165
|
|
|
171
166
|
(0, _react.useEffect)(() => {
|
|
172
167
|
setStaticTagsCount(-1);
|
|
@@ -178,15 +173,10 @@ const TagList = _ref => {
|
|
|
178
173
|
}, [items]); // Count Row Tags
|
|
179
174
|
|
|
180
175
|
(0, _react.useLayoutEffect)(() => {
|
|
181
|
-
if (withToggle) {
|
|
182
|
-
if (!isTagsRefSet() && lastCheckTime === -1) {
|
|
183
|
-
setLastCheckTime(Date.now());
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
176
|
+
if (withToggle && wrapperWidth !== -1) {
|
|
187
177
|
setStaticTagsCount(getStaticTagsCount());
|
|
188
178
|
}
|
|
189
|
-
}, [tagList, wrapperWidth,
|
|
179
|
+
}, [tagList, wrapperWidth, withToggle]); //
|
|
190
180
|
|
|
191
181
|
(0, _react.useLayoutEffect)(() => {
|
|
192
182
|
setRenderItemsCount(staticTagsCount);
|
|
@@ -203,6 +193,10 @@ const TagList = _ref => {
|
|
|
203
193
|
className: (0, _classnames.default)("tag-list_wrapper", "".concat(renderItemsCount !== (tagList === null || tagList === void 0 ? void 0 : tagList.length) || !withToggle || staticTagsCount === -1 || staticTagsCount === (tagList === null || tagList === void 0 ? void 0 : tagList.length) ? "tag-list_wrapper--only-static-items" : "tag-list_wrapper--all-items"), className, {
|
|
204
194
|
"tag-list_wrapper--disabled": disabled
|
|
205
195
|
}),
|
|
196
|
+
style: {
|
|
197
|
+
visibility: staticTagsCount === -1 ? "hidden" : "visible",
|
|
198
|
+
zIndex: staticTagsCount === -1 ? "-1" : "auto"
|
|
199
|
+
},
|
|
206
200
|
ref: wrapperRef
|
|
207
201
|
}, renderTags(), renderMoreTags(), renderHideTags(), typeof onEditClick === "function" && /*#__PURE__*/_react.default.createElement("div", {
|
|
208
202
|
className: "tag-list__edit-trigger"
|