@abi-software/map-side-bar 2.14.8-demo.3 → 2.14.8-demo.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.14.8-demo.3",
3
+ "version": "2.14.8-demo.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -609,8 +609,8 @@ export default {
609
609
  const selectedSomaLocationFilters = this.getSelectedSomaLocationFilters();
610
610
  const shouldFilterBySelectedSomaLocations = (this.activeFilters || []).length > 0 && selectedSomaLocationFilters.length > 0;
611
611
  const selectedSomaLocationSet = new Set(selectedSomaLocationFilters);
612
- const scopedCellTypes = this.getCellTypesForActiveSpecies();
613
- const somaLocationCounts = scopedCellTypes.reduce((counts, cellType) => {
612
+ const filteredCellTypes = this.getFilteredCellTypes(this.activeFilters, this.searchInput);
613
+ const somaLocationCounts = filteredCellTypes.reduce((counts, cellType) => {
614
614
  (Array.isArray(cellType?.somaLocations) ? cellType.somaLocations : []).forEach((location) => {
615
615
  const normalizedLocation = String(location || '').trim().toLowerCase();
616
616
  if (!normalizedLocation) return;
@@ -704,8 +704,8 @@ export default {
704
704
 
705
705
  return false;
706
706
  },
707
- applyFilters: function(filters) {
708
- const searchTerms = this.normalizeSearchTerms(this.searchInput);
707
+ getFilteredCellTypes: function(filters = this.activeFilters, searchInput = this.searchInput) {
708
+ const searchTerms = this.normalizeSearchTerms(searchInput);
709
709
  const activeFilters = (filters || []).filter((filter) => {
710
710
  return filter?.term && filter?.facet && this.normalizeFacetValue(filter.facet) !== 'show all';
711
711
  });
@@ -721,11 +721,16 @@ export default {
721
721
 
722
722
  const filterGroups = Object.values(filtersByTerm);
723
723
 
724
- const filtered = this.allCellTypes.filter((cellType) => {
725
- return filterGroups.every((termGroup) => {
726
- return termGroup.some((filter) => this.matchFieldFilter(cellType, filter));
727
- });
728
- }).filter((cellType) => this.matchSearchQuery(cellType, searchTerms));
724
+ return this.allCellTypes
725
+ .filter((cellType) => {
726
+ return filterGroups.every((termGroup) => {
727
+ return termGroup.some((filter) => this.matchFieldFilter(cellType, filter));
728
+ });
729
+ })
730
+ .filter((cellType) => this.matchSearchQuery(cellType, searchTerms));
731
+ },
732
+ applyFilters: function(filters) {
733
+ const filtered = this.getFilteredCellTypes(filters, this.searchInput);
729
734
 
730
735
  this.totalFilteredCount = filtered.length;
731
736
  this.cellTypes = filtered.slice(this.start, this.start + this.numberPerPage);