sag_components 1.0.374 → 1.0.376
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.
|
@@ -73,11 +73,10 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
73
73
|
setCurrentInputValue = _useState2[1];
|
|
74
74
|
var _useState3 = (0, _react.useState)(filterOptionsMultiSelect ? filterOptionsMultiSelect : undefined),
|
|
75
75
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
filterMultiSelectState = _useState4[0],
|
|
77
|
+
setFilterMultiSelectState = _useState4[1];
|
|
78
78
|
(0, _react.useEffect)(function () {
|
|
79
|
-
|
|
80
|
-
console.log("currentFilterMultiSelectState", currentFilterMultiSelectState);
|
|
79
|
+
setFilterMultiSelectState(filterOptionsMultiSelect);
|
|
81
80
|
}, [filterOptionsMultiSelect]);
|
|
82
81
|
(0, _react.useEffect)(function () {
|
|
83
82
|
var delayDebounceFn = setTimeout(function () {
|
|
@@ -213,8 +212,7 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
213
212
|
});
|
|
214
213
|
};
|
|
215
214
|
var onChangeHandler = function onChangeHandler(event, newValue) {
|
|
216
|
-
|
|
217
|
-
console.log("currentFilterMultiSelectState", currentFilterMultiSelectState);
|
|
215
|
+
setFilterMultiSelectState(newValue);
|
|
218
216
|
onChange({
|
|
219
217
|
syntheticBaseEvent: event,
|
|
220
218
|
newValue: newValue
|
|
@@ -321,7 +319,7 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
321
319
|
limitTags: limitTagsOnMultiSelect,
|
|
322
320
|
id: "checkboxes-tags",
|
|
323
321
|
options: options,
|
|
324
|
-
value:
|
|
322
|
+
value: filterMultiSelectState !== null && filterMultiSelectState !== void 0 ? filterMultiSelectState : undefined,
|
|
325
323
|
disabled: disabled,
|
|
326
324
|
disableCloseOnSelect: true,
|
|
327
325
|
disableClearable: disableClearable,
|
|
@@ -336,12 +334,8 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
336
334
|
var selected = _ref2.selected;
|
|
337
335
|
return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
338
336
|
icon: icon,
|
|
339
|
-
checkedIcon: checkedIcon
|
|
340
|
-
//
|
|
341
|
-
// variantName.findIndex((item) => item.id === variant.id) >= 0
|
|
342
|
-
// }
|
|
343
|
-
,
|
|
344
|
-
checked: selected
|
|
337
|
+
checkedIcon: checkedIcon,
|
|
338
|
+
checked: isOptionChecked(option) //{selected}
|
|
345
339
|
}), option.label);
|
|
346
340
|
},
|
|
347
341
|
renderInput: function renderInput(params) {
|
|
@@ -378,6 +372,16 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
378
372
|
}
|
|
379
373
|
}));
|
|
380
374
|
};
|
|
375
|
+
var isOptionChecked = function isOptionChecked(option) {
|
|
376
|
+
var _Object$values;
|
|
377
|
+
if (filterMultiSelectState && (_Object$values = Object.values(filterMultiSelectState)) !== null && _Object$values !== void 0 && _Object$values.map(function (itemFilter) {
|
|
378
|
+
return itemFilter.label;
|
|
379
|
+
}).includes(option.label)) {
|
|
380
|
+
return true;
|
|
381
|
+
} else {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
381
385
|
|
|
382
386
|
// --------------------------------- MAIN -------------------------------------
|
|
383
387
|
return /*#__PURE__*/_react.default.createElement(_Dropdown.DropdownContainer, {
|