sag_components 2.0.0-beta268 → 2.0.0-beta269

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.
package/dist/index.js CHANGED
@@ -37887,7 +37887,6 @@ const FilterPop = props => {
37887
37887
  const unselectedItems = nonAllItems.filter(item => !attributes[item.value]);
37888
37888
  const allSelected = selectedItems.length === nonAllItems.length;
37889
37889
  const noneSelected = selectedItems.length === 0;
37890
- const fewerSelected = selectedItems.length <= unselectedItems.length;
37891
37890
  if (allSelected) {
37892
37891
  return {
37893
37892
  excluded: [],
@@ -37900,18 +37899,21 @@ const FilterPop = props => {
37900
37899
  included: [],
37901
37900
  isSelectAll: false
37902
37901
  };
37903
- } else if (fewerSelected) {
37904
- return {
37905
- excluded: [],
37906
- included: selectedItems.map(item => item.value),
37907
- isSelectAll: false
37908
- };
37909
37902
  } else {
37910
- return {
37911
- excluded: unselectedItems.map(item => item.value),
37912
- included: [],
37913
- isSelectAll: true
37914
- };
37903
+ const fewerSelected = selectedItems.length <= unselectedItems.length;
37904
+ if (fewerSelected) {
37905
+ return {
37906
+ excluded: [],
37907
+ included: selectedItems.map(item => item.value),
37908
+ isSelectAll: false
37909
+ };
37910
+ } else {
37911
+ return {
37912
+ excluded: unselectedItems.map(item => item.value),
37913
+ included: [],
37914
+ isSelectAll: true
37915
+ };
37916
+ }
37915
37917
  }
37916
37918
  };
37917
37919
  const handleCheckboxChange = attribute => {
@@ -37921,9 +37923,22 @@ const FilterPop = props => {
37921
37923
  const updatedAttributes = {
37922
37924
  ...selectedAttributes
37923
37925
  };
37924
- visibleNonAllItems.forEach(item => {
37925
- updatedAttributes[item.value] = !allVisibleSelected;
37926
- });
37926
+ if (searchTerm.trim()) {
37927
+ if (allVisibleSelected) {
37928
+ const nonAllItems = getNonAllItems();
37929
+ nonAllItems.forEach(item => {
37930
+ updatedAttributes[item.value] = false;
37931
+ });
37932
+ } else {
37933
+ visibleNonAllItems.forEach(item => {
37934
+ updatedAttributes[item.value] = true;
37935
+ });
37936
+ }
37937
+ } else {
37938
+ visibleNonAllItems.forEach(item => {
37939
+ updatedAttributes[item.value] = !allVisibleSelected;
37940
+ });
37941
+ }
37927
37942
  updatedAttributes.All = areAllNonAllItemsSelected(updatedAttributes);
37928
37943
  setSelectedAttributes(updatedAttributes);
37929
37944
  const filterData = createFilterData(updatedAttributes);