intelicoreact 1.3.50 → 1.3.51
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.
|
@@ -106,7 +106,12 @@ const TagsDropdown = _ref => {
|
|
|
106
106
|
const [localOptionsStore, setLocalOptionsStore] = (0, _react.useState)({});
|
|
107
107
|
const singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce((acc, item) => {
|
|
108
108
|
const checkUniqAndPush = (acc, item) => {
|
|
109
|
-
const isExist = acc === null || acc === void 0 ? void 0 : acc.findIndex(
|
|
109
|
+
const isExist = acc === null || acc === void 0 ? void 0 : acc.findIndex(_ref2 => {
|
|
110
|
+
let {
|
|
111
|
+
value
|
|
112
|
+
} = _ref2;
|
|
113
|
+
return value === (item === null || item === void 0 ? void 0 : item.value);
|
|
114
|
+
});
|
|
110
115
|
|
|
111
116
|
if (isExist !== -1) {
|
|
112
117
|
acc[isExist] = item;
|
|
@@ -143,12 +148,12 @@ const TagsDropdown = _ref => {
|
|
|
143
148
|
}
|
|
144
149
|
}, [options]);
|
|
145
150
|
|
|
146
|
-
const handleClickOutside =
|
|
151
|
+
const handleClickOutside = _ref3 => {
|
|
147
152
|
var _getListContainer;
|
|
148
153
|
|
|
149
154
|
let {
|
|
150
155
|
target
|
|
151
|
-
} =
|
|
156
|
+
} = _ref3;
|
|
152
157
|
|
|
153
158
|
if ( // eslint-disable-next-line no-use-before-define
|
|
154
159
|
!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target))
|
|
@@ -263,25 +268,25 @@ const TagsDropdown = _ref => {
|
|
|
263
268
|
const selectAllItems = () => {
|
|
264
269
|
var _prepareOptions;
|
|
265
270
|
|
|
266
|
-
const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(
|
|
271
|
+
const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(_ref4 => {
|
|
267
272
|
let {
|
|
268
273
|
isFreezed,
|
|
269
274
|
value
|
|
270
|
-
} =
|
|
275
|
+
} = _ref4;
|
|
271
276
|
return !isFreezed && !(chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.includes(value)) && value !== "open_modal";
|
|
272
277
|
});
|
|
273
|
-
setLocalOptionsStore(options => preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.reduce((result,
|
|
278
|
+
setLocalOptionsStore(options => preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.reduce((result, _ref5) => {
|
|
274
279
|
let {
|
|
275
280
|
value,
|
|
276
281
|
label
|
|
277
|
-
} =
|
|
282
|
+
} = _ref5;
|
|
278
283
|
result[value] = label;
|
|
279
284
|
return result;
|
|
280
285
|
}, options));
|
|
281
|
-
onChange([...chosenOptions, ...((preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.map(
|
|
286
|
+
onChange([...chosenOptions, ...((preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.map(_ref6 => {
|
|
282
287
|
let {
|
|
283
288
|
value
|
|
284
|
-
} =
|
|
289
|
+
} = _ref6;
|
|
285
290
|
return value;
|
|
286
291
|
})) || [])], "chosenOptions");
|
|
287
292
|
if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
|
|
@@ -292,10 +297,10 @@ const TagsDropdown = _ref => {
|
|
|
292
297
|
onChange(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.filter(item => {
|
|
293
298
|
var _prepareOptions2, _prepareOptions2$find;
|
|
294
299
|
|
|
295
|
-
return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 ? void 0 : (_prepareOptions2$find = _prepareOptions2.find(
|
|
300
|
+
return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 ? void 0 : (_prepareOptions2$find = _prepareOptions2.find(_ref7 => {
|
|
296
301
|
let {
|
|
297
302
|
value
|
|
298
|
-
} =
|
|
303
|
+
} = _ref7;
|
|
299
304
|
return value === item;
|
|
300
305
|
})) === null || _prepareOptions2$find === void 0 ? void 0 : _prepareOptions2$find.isFreezed;
|
|
301
306
|
}), "chosenOptions");
|
|
@@ -303,9 +308,9 @@ const TagsDropdown = _ref => {
|
|
|
303
308
|
};
|
|
304
309
|
|
|
305
310
|
const getParentNode = () => {
|
|
306
|
-
var
|
|
311
|
+
var _ref8, _document$querySelect;
|
|
307
312
|
|
|
308
|
-
return (
|
|
313
|
+
return (_ref8 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref8 !== void 0 ? _ref8 : document.querySelector("div#storybook-root");
|
|
309
314
|
};
|
|
310
315
|
|
|
311
316
|
const initListContainer = () => {
|
|
@@ -494,17 +499,17 @@ const TagsDropdown = _ref => {
|
|
|
494
499
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
495
500
|
className: "".concat(RC, "-group__name")
|
|
496
501
|
}, option.groupName), (_option$list2 = option.list) === null || _option$list2 === void 0 ? void 0 : _option$list2.map(item => getMarkupForElement(item))) : getMarkupForElement(option);
|
|
497
|
-
}), ((_filteredOptions$filt = filteredOptions.filter(
|
|
502
|
+
}), ((_filteredOptions$filt = filteredOptions.filter(_ref9 => {
|
|
498
503
|
let {
|
|
499
504
|
value
|
|
500
|
-
} =
|
|
505
|
+
} = _ref9;
|
|
501
506
|
return value !== "open_modal";
|
|
502
507
|
})) === null || _filteredOptions$filt === void 0 ? void 0 : _filteredOptions$filt.length) === 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
503
508
|
className: "".concat(RC, "__no-options")
|
|
504
|
-
}, noOptionsText) : null), (footerContent || isMobile) && ((_filteredOptions$filt2 = filteredOptions.filter(
|
|
509
|
+
}, noOptionsText) : null), (footerContent || isMobile) && ((_filteredOptions$filt2 = filteredOptions.filter(_ref10 => {
|
|
505
510
|
let {
|
|
506
511
|
value
|
|
507
|
-
} =
|
|
512
|
+
} = _ref10;
|
|
508
513
|
return value !== "open_modal";
|
|
509
514
|
})) === null || _filteredOptions$filt2 === void 0 ? void 0 : _filteredOptions$filt2.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
510
515
|
className: (0, _classnames.default)("".concat(RC, "__footer"), {
|
|
@@ -640,10 +645,10 @@ const TagsDropdown = _ref => {
|
|
|
640
645
|
className: (0, _classnames.default)("".concat(RC, "__trigger"), {
|
|
641
646
|
"tags-dropdown__error": error
|
|
642
647
|
}),
|
|
643
|
-
onClick:
|
|
648
|
+
onClick: _ref11 => {
|
|
644
649
|
let {
|
|
645
650
|
target
|
|
646
|
-
} =
|
|
651
|
+
} = _ref11;
|
|
647
652
|
if ((target === null || target === void 0 ? void 0 : target.tagName) === "INPUT") setIsOpen(true);else if (isTargetInParent(target)) {
|
|
648
653
|
setIsOpen(isOpen => !isOpen);
|
|
649
654
|
}
|