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

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.1",
3
+ "version": "2.14.8-demo.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -152,8 +152,16 @@
152
152
  </div>
153
153
  <div v-if="cellType.relatedCells?.length" class="card-section">
154
154
  <div class="card-section-title">Related Species Variants</div>
155
- <ul v-for="relatedCell in cellType.relatedCells" :key="relatedCell">
156
- <li>{{ relatedCell.label }}</li>
155
+ <ul class="related-cell-list">
156
+ <li v-for="relatedCell in cellType.relatedCells" :key="relatedCell">
157
+ <button
158
+ class="related-cell-item"
159
+ @click.stop="$emit('related-cell-click', relatedCell)"
160
+ title="Click to view this cell type"
161
+ >
162
+ {{ relatedCell.label }}
163
+ </button>
164
+ </li>
157
165
  </ul>
158
166
  </div>
159
167
  <div v-if="cellType.sourceNomenclature" class="card-section source-publication-section">
@@ -236,7 +244,7 @@ export default {
236
244
  default: false,
237
245
  },
238
246
  },
239
- emits: ['open', 'close', 'soma-location-hovered', 'dataset-search', 'connectivity-search'],
247
+ emits: ['open', 'close', 'soma-location-hovered', 'dataset-search', 'connectivity-search', 'related-cell-click'],
240
248
  data() {
241
249
  return {
242
250
  cardElement: null,
@@ -395,9 +403,21 @@ export default {
395
403
  },
396
404
  openCard: function() {
397
405
  this.$emit('open', this.cellType.id);
406
+
407
+ EventBus.emit('trackEvent', {
408
+ 'event_name': `portal_maps_cell_card_open`,
409
+ 'category': this.cellType.id || '',
410
+ 'location': 'map_sidebar_cell_card',
411
+ });
398
412
  },
399
413
  closeCard: function() {
400
414
  this.$emit('close');
415
+
416
+ EventBus.emit('trackEvent', {
417
+ 'event_name': `portal_maps_cell_card_close`,
418
+ 'category': this.cellType.id || '',
419
+ 'location': 'map_sidebar_cell_card',
420
+ });
401
421
  },
402
422
  showSomaLocation: function (name) {
403
423
  this.$emit('soma-location-hovered', name);
@@ -729,6 +749,11 @@ export default {
729
749
  margin: 0;
730
750
  padding-left: 1rem;
731
751
 
752
+ &.related-cell-list {
753
+ list-style-type: none;
754
+ padding-left: 0;
755
+ }
756
+
732
757
  li {
733
758
  color: #606266;
734
759
  }
@@ -800,7 +825,6 @@ export default {
800
825
  .source-publication-chip,
801
826
  .source-publication-link {
802
827
  display: inline-block;
803
- border: 1px solid var(--cell-card-source-color);
804
828
  border-radius: 4px;
805
829
  color: white !important;
806
830
  text-decoration: none;
@@ -808,7 +832,8 @@ export default {
808
832
  }
809
833
 
810
834
  .source-publication-chip {
811
- padding: 2px 6px;
835
+ padding: 2px 8px;
836
+ font-size: 13px;
812
837
  }
813
838
 
814
839
  .alert-chip {
@@ -943,4 +968,27 @@ export default {
943
968
  }
944
969
  }
945
970
  }
971
+
972
+ .related-cell-list {
973
+ li + li {
974
+ margin-top: 0.5rem;
975
+ }
976
+ }
977
+
978
+ .related-cell-item {
979
+ cursor: pointer;
980
+ color: $app-primary-color;
981
+ background: none;
982
+ border: 1px solid $app-primary-color;
983
+ border-radius: 4px;
984
+ padding: 2px 4px;
985
+ font-family: inherit;
986
+ font-size: inherit;
987
+ line-height: inherit;
988
+ transition: background-color 0.2s ease, border-color 0.2s ease, text-decoration-color 0.2s ease;
989
+
990
+ &:hover {
991
+ background-color: rgba($app-primary-color, 0.08);
992
+ }
993
+ }
946
994
  </style>
@@ -92,6 +92,7 @@
92
92
  @dataset-search="onDatasetSearch"
93
93
  @connectivity-search="onConnectivitySearch"
94
94
  @soma-location-hovered="showSomaLocation"
95
+ @related-cell-click="onRelatedCellClick"
95
96
  />
96
97
  <el-pagination
97
98
  class="pagination"
@@ -341,6 +342,12 @@ export default {
341
342
  }
342
343
  this.applyFilters(this.activeFilters);
343
344
  this.emitSomaLocations(this.filterOptions);
345
+
346
+ EventBus.emit('trackEvent', {
347
+ 'event_name': `portal_maps_action_filter`,
348
+ 'category': `reset`,
349
+ 'location': 'map_sidebar_cell_card_explorer',
350
+ });
344
351
  },
345
352
  searchAndFilterUpdate: function() {
346
353
  this.page = 1;
@@ -354,18 +361,35 @@ export default {
354
361
  this.page = 1;
355
362
  this.start = 0;
356
363
  this.applyFilters(this.activeFilters);
364
+ this.emitSomaLocations(this.filterOptions);
357
365
  this.searchHistoryUpdate(this.activeFilters, this.searchInput);
358
366
  this.loadingCards = false;
359
367
  },
360
368
  numberPerPageUpdate: function(value) {
361
369
  this.numberPerPage = parseInt(value, 10) || 10;
362
- this.pageChange(1);
370
+
371
+ EventBus.emit('trackEvent', {
372
+ 'event_name': `portal_maps_cell_card_perPage`,
373
+ 'category': value + '',
374
+ 'location': 'map_sidebar_cell_card_explorer',
375
+ });
376
+
377
+ const preventPaginationTracking = this.page === 1;
378
+ this.pageChange(1, preventPaginationTracking);
363
379
  },
364
- pageChange: function(page) {
380
+ pageChange: function(page, preventTracking = false) {
365
381
  this.page = page;
366
382
  this.start = (page - 1) * this.numberPerPage;
367
383
  this.applyFilters(this.activeFilters);
368
384
  this.scrollToTop();
385
+
386
+ if (!preventTracking) {
387
+ EventBus.emit('trackEvent', {
388
+ 'event_name': `portal_maps_cell_card_pagination`,
389
+ 'category': `page_${this.page}`,
390
+ 'location': 'map_sidebar_cell_card_explorer',
391
+ });
392
+ }
369
393
  },
370
394
  scrollToTop: function() {
371
395
  if (this.$refs.content) {
@@ -399,6 +423,8 @@ export default {
399
423
  this.$refs.filtersRef.checkShowAllBoxes();
400
424
  }
401
425
  }
426
+
427
+ this.emitSomaLocations(this.filterOptions);
402
428
  },
403
429
  cascaderReady: function() {
404
430
  this.cascaderIsReady = true;
@@ -410,7 +436,10 @@ export default {
410
436
  getSelectedSomaLocationFilters: function() {
411
437
  return (this.activeFilters || [])
412
438
  .filter((filter) => {
413
- return this.normalizeFacetValue(filter?.term) === 'soma location';
439
+ return (
440
+ this.normalizeFacetValue(filter?.term) === 'soma location' &&
441
+ this.normalizeFacetValue(filter?.facet) !== 'show all'
442
+ );
414
443
  })
415
444
  .map((filter) => this.normalizeFacetValue(filter?.facet))
416
445
  .filter(Boolean);
@@ -561,6 +590,14 @@ export default {
561
590
  label: 'Source',
562
591
  children: this.buildFacetChildren(cellTypes, 'sourceNomenclatureLabel'),
563
592
  },
593
+ {
594
+ key: 'notes',
595
+ label: 'Notes',
596
+ children: [
597
+ { label: 'with notes' },
598
+ { label: 'without notes' },
599
+ ],
600
+ },
564
601
  ];
565
602
 
566
603
  return options.filter((option) => option.children.length > 0);
@@ -658,6 +695,13 @@ export default {
658
695
  return this.normalizeFacetValue(cellType.sourceNomenclatureLabel) === filterFacet;
659
696
  }
660
697
 
698
+ if (filterTerm === 'notes') {
699
+ const hasNotes = (cellType.alertNotes?.length > 0 || cellType.curatorNotes?.length > 0);
700
+ if (filterFacet === 'with notes') return hasNotes;
701
+ if (filterFacet === 'without notes') return !hasNotes;
702
+ return false;
703
+ }
704
+
661
705
  return false;
662
706
  },
663
707
  applyFilters: function(filters) {
@@ -689,6 +733,58 @@ export default {
689
733
  if (!this.cellTypes.some((cellType) => cellType.id === this.activeCardId)) {
690
734
  this.activeCardId = null;
691
735
  }
736
+
737
+ this.$emit('search-changed', {
738
+ query: this.searchInput,
739
+ filter: filters,
740
+ tabType: "cellType",
741
+ });
742
+ },
743
+ onRelatedCellClick: function(relatedCell) {
744
+ const species = relatedCell.species;
745
+ const label = relatedCell.label;
746
+
747
+ // Normalize species (e.g., "human male" -> "human")
748
+ const normalizedSpecies = this.normalizeActiveSpeciesFilterTerm(species);
749
+
750
+ // Check if this species filter already exists
751
+ const speciesFilterExists = this.activeFilters.some(function(filter) {
752
+ return this.normalizeFacetValue(filter.term) === 'species'
753
+ && this.normalizeFacetValue(filter.facet) === this.normalizeFacetValue(normalizedSpecies);
754
+ }, this);
755
+
756
+ // Add species filter if not already present
757
+ if (!speciesFilterExists && normalizedSpecies) {
758
+ this.activeFilters.push({
759
+ facetPropPath: 'species',
760
+ facet: capitalise(normalizedSpecies),
761
+ term: 'Species',
762
+ tagLabel: capitalise(normalizedSpecies),
763
+ });
764
+ }
765
+
766
+ // Clear search input to avoid text search interfering
767
+ this.searchInput = '';
768
+ this.page = 1;
769
+ this.start = 0;
770
+
771
+ // Apply filters and sync cascader UI
772
+ this.applyFilters(this.activeFilters);
773
+ this.syncCascaderFromActiveFilters();
774
+ this.emitSomaLocations(this.filterOptions);
775
+
776
+ // Find the matching cell type by preferredLabel and open its card
777
+ const matchingCellType = this.allCellTypes.find(function(ct) {
778
+ return (ct.preferredLabel || '').toLowerCase() === (label || '').toLowerCase();
779
+ });
780
+
781
+ if (matchingCellType) {
782
+ this.activeCardId = matchingCellType.id;
783
+ }
784
+
785
+ this.$nextTick(function() {
786
+ this.scrollToTop();
787
+ });
692
788
  },
693
789
  showSomaLocation: function (name) {
694
790
  this.$emit('soma-location-hovered', name);
@@ -699,6 +795,13 @@ export default {
699
795
  onConnectivitySearch: function (query) {
700
796
  this.$emit('connectivity-search', query);
701
797
  },
798
+ getSearch: function () {
799
+ return this.searchInput;
800
+ },
801
+ getFilters: function () {
802
+ const hasFilters = this.activeFilters.some((f) => f.facet.toLowerCase() !== 'show all');
803
+ return hasFilters ? this.activeFilters : [];
804
+ },
702
805
  },
703
806
  }
704
807
  </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);