@abi-software/map-side-bar 2.14.8-demo.0 → 2.14.8-demo.2

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.0",
3
+ "version": "2.14.8-demo.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -395,9 +395,21 @@ export default {
395
395
  },
396
396
  openCard: function() {
397
397
  this.$emit('open', this.cellType.id);
398
+
399
+ EventBus.emit('trackEvent', {
400
+ 'event_name': `portal_maps_cell_card_open`,
401
+ 'category': this.cellType.id || '',
402
+ 'location': 'map_sidebar_cell_card',
403
+ });
398
404
  },
399
405
  closeCard: function() {
400
406
  this.$emit('close');
407
+
408
+ EventBus.emit('trackEvent', {
409
+ 'event_name': `portal_maps_cell_card_close`,
410
+ 'category': this.cellType.id || '',
411
+ 'location': 'map_sidebar_cell_card',
412
+ });
401
413
  },
402
414
  showSomaLocation: function (name) {
403
415
  this.$emit('soma-location-hovered', name);
@@ -425,7 +437,7 @@ export default {
425
437
  ] : [];
426
438
  this.$emit('connectivity-search', {
427
439
  facets: facets,
428
- query: query,
440
+ query: '',
429
441
  });
430
442
  },
431
443
  onSearchPopoverShow: function (locationId) {
@@ -800,7 +812,6 @@ export default {
800
812
  .source-publication-chip,
801
813
  .source-publication-link {
802
814
  display: inline-block;
803
- border: 1px solid var(--cell-card-source-color);
804
815
  border-radius: 4px;
805
816
  color: white !important;
806
817
  text-decoration: none;
@@ -808,7 +819,8 @@ export default {
808
819
  }
809
820
 
810
821
  .source-publication-chip {
811
- padding: 2px 6px;
822
+ padding: 2px 8px;
823
+ font-size: 13px;
812
824
  }
813
825
 
814
826
  .alert-chip {
@@ -340,11 +340,19 @@ export default {
340
340
  this.$refs.searchHistory.selectValue = 'Search history';
341
341
  }
342
342
  this.applyFilters(this.activeFilters);
343
+ this.emitSomaLocations(this.filterOptions);
344
+
345
+ EventBus.emit('trackEvent', {
346
+ 'event_name': `portal_maps_action_filter`,
347
+ 'category': `reset`,
348
+ 'location': 'map_sidebar_cell_card_explorer',
349
+ });
343
350
  },
344
351
  searchAndFilterUpdate: function() {
345
352
  this.page = 1;
346
353
  this.start = 0;
347
354
  this.applyFilters(this.activeFilters);
355
+ this.emitSomaLocations(this.filterOptions);
348
356
  this.searchHistoryUpdate(this.activeFilters, this.searchInput);
349
357
  },
350
358
  filterUpdate: function(filters) {
@@ -352,18 +360,35 @@ export default {
352
360
  this.page = 1;
353
361
  this.start = 0;
354
362
  this.applyFilters(this.activeFilters);
363
+ this.emitSomaLocations(this.filterOptions);
355
364
  this.searchHistoryUpdate(this.activeFilters, this.searchInput);
356
365
  this.loadingCards = false;
357
366
  },
358
367
  numberPerPageUpdate: function(value) {
359
368
  this.numberPerPage = parseInt(value, 10) || 10;
360
- this.pageChange(1);
369
+
370
+ EventBus.emit('trackEvent', {
371
+ 'event_name': `portal_maps_cell_card_perPage`,
372
+ 'category': value + '',
373
+ 'location': 'map_sidebar_cell_card_explorer',
374
+ });
375
+
376
+ const preventPaginationTracking = this.page === 1;
377
+ this.pageChange(1, preventPaginationTracking);
361
378
  },
362
- pageChange: function(page) {
379
+ pageChange: function(page, preventTracking = false) {
363
380
  this.page = page;
364
381
  this.start = (page - 1) * this.numberPerPage;
365
382
  this.applyFilters(this.activeFilters);
366
383
  this.scrollToTop();
384
+
385
+ if (!preventTracking) {
386
+ EventBus.emit('trackEvent', {
387
+ 'event_name': `portal_maps_cell_card_pagination`,
388
+ 'category': `page_${this.page}`,
389
+ 'location': 'map_sidebar_cell_card_explorer',
390
+ });
391
+ }
367
392
  },
368
393
  scrollToTop: function() {
369
394
  if (this.$refs.content) {
@@ -397,6 +422,8 @@ export default {
397
422
  this.$refs.filtersRef.checkShowAllBoxes();
398
423
  }
399
424
  }
425
+
426
+ this.emitSomaLocations(this.filterOptions);
400
427
  },
401
428
  cascaderReady: function() {
402
429
  this.cascaderIsReady = true;
@@ -405,6 +432,17 @@ export default {
405
432
  normalizeFacetValue: function(value) {
406
433
  return String(value || '').trim().toLowerCase();
407
434
  },
435
+ getSelectedSomaLocationFilters: function() {
436
+ return (this.activeFilters || [])
437
+ .filter((filter) => {
438
+ return (
439
+ this.normalizeFacetValue(filter?.term) === 'soma location' &&
440
+ this.normalizeFacetValue(filter?.facet) !== 'show all'
441
+ );
442
+ })
443
+ .map((filter) => this.normalizeFacetValue(filter?.facet))
444
+ .filter(Boolean);
445
+ },
408
446
  getAvailableSpeciesSet: function() {
409
447
  const availableSpecies = new Set();
410
448
 
@@ -551,6 +589,14 @@ export default {
551
589
  label: 'Source',
552
590
  children: this.buildFacetChildren(cellTypes, 'sourceNomenclatureLabel'),
553
591
  },
592
+ {
593
+ key: 'notes',
594
+ label: 'Notes',
595
+ children: [
596
+ { label: 'with notes' },
597
+ { label: 'without notes' },
598
+ ],
599
+ },
554
600
  ];
555
601
 
556
602
  return options.filter((option) => option.children.length > 0);
@@ -559,6 +605,9 @@ export default {
559
605
  const somaLocationOption = (filterOptions || []).find((option) => option.key === 'somaLocations');
560
606
  const availableDataRaw = localStorage.getItem('available-name-curie-mapping');
561
607
  const availableData = availableDataRaw ? JSON.parse(availableDataRaw) : {};
608
+ const selectedSomaLocationFilters = this.getSelectedSomaLocationFilters();
609
+ const shouldFilterBySelectedSomaLocations = (this.activeFilters || []).length > 0 && selectedSomaLocationFilters.length > 0;
610
+ const selectedSomaLocationSet = new Set(selectedSomaLocationFilters);
562
611
  const scopedCellTypes = this.getCellTypesForActiveSpecies();
563
612
  const somaLocationCounts = scopedCellTypes.reduce((counts, cellType) => {
564
613
  (Array.isArray(cellType?.somaLocations) ? cellType.somaLocations : []).forEach((location) => {
@@ -571,6 +620,13 @@ export default {
571
620
  const somaLocations = (somaLocationOption?.children || [])
572
621
  .map((child) => String(child?.label || '').trim())
573
622
  .filter(Boolean)
623
+ .filter((label) => {
624
+ if (!shouldFilterBySelectedSomaLocations) {
625
+ return true;
626
+ }
627
+
628
+ return selectedSomaLocationSet.has(label.toLowerCase());
629
+ })
574
630
  .map((label) => {
575
631
  const curie = Object.keys(availableData).find(
576
632
  (curie) => String(availableData[curie] || '').toLowerCase() === label.toLowerCase()
@@ -638,6 +694,13 @@ export default {
638
694
  return this.normalizeFacetValue(cellType.sourceNomenclatureLabel) === filterFacet;
639
695
  }
640
696
 
697
+ if (filterTerm === 'notes') {
698
+ const hasNotes = (cellType.alertNotes?.length > 0 || cellType.curatorNotes?.length > 0);
699
+ if (filterFacet === 'with notes') return hasNotes;
700
+ if (filterFacet === 'without notes') return !hasNotes;
701
+ return false;
702
+ }
703
+
641
704
  return false;
642
705
  },
643
706
  applyFilters: function(filters) {
@@ -669,6 +732,12 @@ export default {
669
732
  if (!this.cellTypes.some((cellType) => cellType.id === this.activeCardId)) {
670
733
  this.activeCardId = null;
671
734
  }
735
+
736
+ this.$emit('search-changed', {
737
+ query: this.searchInput,
738
+ filter: filters,
739
+ tabType: "cellType",
740
+ });
672
741
  },
673
742
  showSomaLocation: function (name) {
674
743
  this.$emit('soma-location-hovered', name);
@@ -679,6 +748,13 @@ export default {
679
748
  onConnectivitySearch: function (query) {
680
749
  this.$emit('connectivity-search', query);
681
750
  },
751
+ getSearch: function () {
752
+ return this.searchInput;
753
+ },
754
+ getFilters: function () {
755
+ const hasFilters = this.activeFilters.some((f) => f.facet.toLowerCase() !== 'show all');
756
+ return hasFilters ? this.activeFilters : [];
757
+ },
682
758
  },
683
759
  }
684
760
  </script>
@@ -420,7 +420,7 @@ export default {
420
420
  this.openSearch([], '');
421
421
  this.$emit('search-changed', {
422
422
  value: [],
423
- tabType: 'dataset',
423
+ tabType: 'connectivity',
424
424
  type: 'reset-update',
425
425
  })
426
426
 
@@ -468,7 +468,7 @@ export default {
468
468
  if (notFoundItems.length) {
469
469
  this.$emit('search-changed', {
470
470
  value: notFoundItems,
471
- tabType: 'dataset',
471
+ tabType: 'connectivity',
472
472
  type: 'reset-update',
473
473
  })
474
474
  }
@@ -334,7 +334,8 @@ export default {
334
334
  getParentComponentName: function () {
335
335
  const isConnectivity = this.localStorageKey?.indexOf('connectivity') !== -1;
336
336
  const isDataset = this.localStorageKey?.indexOf('dataset') !== -1;
337
- const location = isConnectivity ? 'connectivity' : isDataset ? 'dataset' : '';
337
+ const isCellCard = this.localStorageKey?.indexOf('cell-card') !== -1;
338
+ const location = isConnectivity ? 'connectivity' : isDataset ? 'dataset' : isCellCard ? 'cell_card' : '';
338
339
  return location;
339
340
  },
340
341
  search: function (item) {
@@ -72,6 +72,7 @@
72
72
  v-show="tab.id === activeTabId"
73
73
  :envVars="envVars"
74
74
  :activeSpecies="activeSpeciesForEntries"
75
+ @search-changed="searchChanged(tab.id, $event)"
75
76
  @dataset-search="openDatasetSearchFromCellCard($event)"
76
77
  @connectivity-search="openConnectivitySearch($event.facets, $event.query)"
77
78
  @soma-location-hovered="showSomaLocation"
@@ -218,7 +219,11 @@ export default {
218
219
  search: '',
219
220
  filters: [],
220
221
  },
221
- connectivity: {
222
+ connectivity: {
223
+ search: '',
224
+ filters: [],
225
+ },
226
+ cellCards: {
222
227
  search: '',
223
228
  filters: [],
224
229
  },
@@ -504,6 +509,13 @@ export default {
504
509
  this.state.connectivity.filters = connectivityExplorerTabRef.getFilters();
505
510
  }
506
511
 
512
+ // Update cell card explorer state if available
513
+ const cellCardExplorerTabRef = this.getTabRef(undefined, 'cellCardExplorer');
514
+ if (cellCardExplorerTabRef) {
515
+ this.state.cellCards.search = cellCardExplorerTabRef.getSearch();
516
+ this.state.cellCards.filters = cellCardExplorerTabRef.getFilters();
517
+ }
518
+
507
519
  // Update connectivity entries if available
508
520
  if (this.connectivityEntry && this.connectivityEntry.length > 0) {
509
521
  this.state.connectivityEntries = this.connectivityEntry.map((entry) => entry.id);
@@ -533,11 +545,15 @@ export default {
533
545
  setState: function (state) {
534
546
  // if state is not provided or formatted incorrectly, do nothing
535
547
  if (!state || !state.dataset || !state.connectivity) return;
536
- this.state = JSON.parse(JSON.stringify(state)); // deep copy to avoid reference issues
537
- const datasetFilters = state.dataset.filters;
538
- const connectivityFilters = state.connectivity.filters;
539
- const datasetSearch = state.dataset.search;
540
- const connectivitySearch = state.connectivity.search;
548
+ // Create a deep copy while preserving the original state structure for future extensibility
549
+ const newState = JSON.parse(JSON.stringify(state));
550
+ this.state = { ...this.state, ...newState };
551
+ const datasetFilters = this.state.dataset.filters;
552
+ const connectivityFilters = this.state.connectivity.filters;
553
+ const datasetSearch = this.state.dataset.search;
554
+ const connectivitySearch = this.state.connectivity.search;
555
+ const cellCardFilters = this.state.cellCards.filters || [];
556
+ const cellCardSearch = this.state.cellCards.search || '';
541
557
 
542
558
  if (datasetFilters.length || datasetSearch) {
543
559
  this.openSearch(datasetFilters, datasetSearch);
@@ -547,6 +563,10 @@ export default {
547
563
  this.openConnectivitySearch(connectivityFilters, connectivitySearch);
548
564
  }
549
565
 
566
+ if (cellCardFilters.length || cellCardSearch) {
567
+ this.openCellCardExplorerSearch(cellCardFilters, cellCardSearch);
568
+ }
569
+
550
570
  if (state.activeTabId) {
551
571
  this.$nextTick(() => {
552
572
  const hasTab = this.tabEntries.find((t) => t.id === state.activeTabId);