@abi-software/map-side-bar 2.18.0 → 2.19.0

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.
Files changed (36) hide show
  1. package/.postcssrc.json +5 -5
  2. package/README.md +8 -9
  3. package/cypress.config.js +6 -7
  4. package/dist/map-side-bar.js +5878 -5991
  5. package/dist/map-side-bar.umd.cjs +58 -58
  6. package/dist/style.css +1 -1
  7. package/eslint.config.js +44 -9
  8. package/package.json +10 -3
  9. package/reporter-config.json +1 -1
  10. package/src/App.vue +79 -78
  11. package/src/algolia/algolia.js +173 -167
  12. package/src/algolia/utils.js +34 -38
  13. package/src/assets/_variables.scss +12 -10
  14. package/src/assets/connectivity-explorer.scss +1 -1
  15. package/src/assets/fonts.scss +0 -1
  16. package/src/assets/searchPopover.scss +1 -2
  17. package/src/components/AnnotationTool.vue +9 -32
  18. package/src/components/BadgesGroup.vue +29 -32
  19. package/src/components/ConnectivityCard.vue +21 -18
  20. package/src/components/ConnectivityExplorer.vue +109 -130
  21. package/src/components/ConnectivityInfo.vue +143 -145
  22. package/src/components/ContributorItem.vue +15 -11
  23. package/src/components/DatasetCard.vue +166 -201
  24. package/src/components/DatasetExplorer.vue +160 -201
  25. package/src/components/ImageGallery.vue +35 -36
  26. package/src/components/SearchFilters.vue +377 -403
  27. package/src/components/SearchHistory.vue +61 -89
  28. package/src/components/SideBar.vue +83 -89
  29. package/src/components/Tabs.vue +10 -15
  30. package/src/components/index.js +3 -5
  31. package/src/components/species-map.js +7 -7
  32. package/src/exampleConnectivityInput.js +310 -318
  33. package/src/main.js +6 -6
  34. package/src/mixins/S3Bucket.vue +10 -13
  35. package/vite.config.js +62 -61
  36. package/vuese-generator.js +47 -55
@@ -29,7 +29,7 @@
29
29
  @tabClosed="tabClosed"
30
30
  @trackEvent="trackEvent"
31
31
  />
32
- <template v-for="tab in tabs" key="tab.id">
32
+ <template v-for="tab in tabs" :key="tab.id">
33
33
  <template v-if="tab.type === 'annotation'">
34
34
  <AnnotationTool
35
35
  :ref="'annotationTab_' + tab.id"
@@ -87,15 +87,13 @@
87
87
  import {
88
88
  ArrowLeft as ElIconArrowLeft,
89
89
  ArrowRight as ElIconArrowRight,
90
- } from '@element-plus/icons-vue'
91
- /* eslint-disable no-alert, no-console */
92
- import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
93
- import DatasetExplorer from './DatasetExplorer.vue'
94
- import EventBus from './EventBus.js'
95
- import Tabs from './Tabs.vue'
96
- import AnnotationTool from './AnnotationTool.vue'
97
- import ConnectivityExplorer from './ConnectivityExplorer.vue'
98
- import { removeShowAllFacets } from '../algolia/utils.js'
90
+ } from '@element-plus/icons-vue';
91
+ import DatasetExplorer from './DatasetExplorer.vue';
92
+ import EventBus from './EventBus.js';
93
+ import Tabs from './Tabs.vue';
94
+ import AnnotationTool from './AnnotationTool.vue';
95
+ import ConnectivityExplorer from './ConnectivityExplorer.vue';
96
+ import { removeShowAllFacets } from '../algolia/utils.js';
99
97
 
100
98
  /**
101
99
  * Aims to provide a sidebar for searching capability for SPARC portal.
@@ -106,8 +104,6 @@ export default {
106
104
  Tabs,
107
105
  ElIconArrowLeft,
108
106
  ElIconArrowRight,
109
- Drawer,
110
- Icon,
111
107
  AnnotationTool,
112
108
  ConnectivityExplorer,
113
109
  },
@@ -115,7 +111,7 @@ export default {
115
111
  props: {
116
112
  tabs: {
117
113
  type: Array,
118
- default: [
114
+ default: () => [
119
115
  { title: 'Dataset Explorer', id: 1, type: 'datasetExplorer', closable: false },
120
116
  { title: 'Connectivity Explorer', id: 2, type: 'connectivityExplorer', closable: false },
121
117
  { title: 'Annotation', id: 3, type: 'annotation', closable: true },
@@ -149,32 +145,32 @@ export default {
149
145
  */
150
146
  connectivityEntry: {
151
147
  type: Array,
152
- default: [],
148
+ default: () => [],
153
149
  },
154
150
  /**
155
151
  * The annotation data to show in sidebar.
156
152
  */
157
153
  annotationEntry: {
158
154
  type: Array,
159
- default: [],
155
+ default: () => [],
160
156
  },
161
157
  createData: {
162
158
  type: Object,
163
- default: {
159
+ default: () => ({
164
160
  toBeConfirmed: false,
165
161
  points: [],
166
- shape: "",
162
+ shape: '',
167
163
  x: 0,
168
164
  y: 0,
169
- },
165
+ }),
170
166
  },
171
167
  connectivityKnowledge: {
172
168
  type: Array,
173
- default: [],
169
+ default: () => [],
174
170
  },
175
171
  filterOptions: {
176
172
  type: Array,
177
- default: [],
173
+ default: () => [],
178
174
  },
179
175
  showVisibilityFilter: {
180
176
  type: Boolean,
@@ -190,14 +186,14 @@ export default {
190
186
  drawerOpen: false,
191
187
  availableAnatomyFacets: [],
192
188
  activeTabId: 1,
193
- activeAnnotationData: { tabType: "annotation" },
194
- activeConnectivityData: { tabType: "connectivity" },
189
+ activeAnnotationData: { tabType: 'annotation' },
190
+ activeConnectivityData: { tabType: 'connectivity' },
195
191
  state: {
196
192
  dataset: {
197
193
  search: '',
198
194
  filters: [],
199
195
  },
200
- connectivity: {
196
+ connectivity: {
201
197
  search: '',
202
198
  filters: [],
203
199
  },
@@ -205,11 +201,11 @@ export default {
205
201
  annotationEntries: [],
206
202
  activeTabId: this.activeTabId,
207
203
  },
208
- }
204
+ };
209
205
  },
210
206
  methods: {
211
207
  onConnectivityCollapseChange: function (data) {
212
- this.$emit('connectivity-collapse-change', data)
208
+ this.$emit('connectivity-collapse-change', data);
213
209
  },
214
210
  /**
215
211
  * This event is emitted when
@@ -224,7 +220,7 @@ export default {
224
220
  * @arg data
225
221
  */
226
222
  hoverChanged: function (id, data) {
227
- this.$emit('hover-changed', {...data, tabId: id })
223
+ this.$emit('hover-changed', { ...data, tabId: id });
228
224
 
229
225
  const activeTabType = this.getActiveTabTypeById(id);
230
226
  // save the last highlighted data for connectivity and annotation tabs
@@ -261,21 +257,21 @@ export default {
261
257
  * @arg `obj` {data, id}
262
258
  */
263
259
  searchChanged: function (id, data) {
264
- this.$emit('search-changed', { ...data, tabId: id })
260
+ this.$emit('search-changed', { ...data, tabId: id });
265
261
  },
266
262
  /**
267
263
  * The function to close sidebar.
268
264
  * @public
269
265
  */
270
266
  close: function () {
271
- this.drawerOpen = false
267
+ this.drawerOpen = false;
272
268
  },
273
269
  /**
274
270
  * The function to toggle (open and close) sidebar.
275
271
  * @public
276
272
  */
277
273
  toggleDrawer: function () {
278
- this.drawerOpen = !this.drawerOpen
274
+ this.drawerOpen = !this.drawerOpen;
279
275
  },
280
276
  openConnectivitySearch: function (facets, query) {
281
277
  this.drawerOpen = true;
@@ -283,29 +279,30 @@ export default {
283
279
  this.$nextTick(() => {
284
280
  const connectivityExplorerTabRef = this.getTabRef(undefined, 'connectivityExplorer', true);
285
281
  connectivityExplorerTabRef.openSearch(facets, query);
286
- })
282
+ });
287
283
  },
288
284
  resetConnectivitySearch: function () {
289
285
  this.$nextTick(() => {
290
286
  const connectivityExplorerTabRef = this.getTabRef(undefined, 'connectivityExplorer', false);
291
287
  connectivityExplorerTabRef.resetSearchIfNoActiveSearch();
292
- })
288
+ });
293
289
  },
294
290
  openSearch: function (facets, query) {
295
- this.drawerOpen = true
291
+ this.drawerOpen = true;
296
292
  // Because refs are in v-for, nextTick is needed here
297
293
  this.$nextTick(() => {
298
294
  const datasetExplorerTabRef = this.getTabRef(undefined, 'datasetExplorer', true);
299
295
  datasetExplorerTabRef.openSearch(facets, query);
300
- })
296
+ });
301
297
  },
302
298
  /**
303
299
  * Get the ref id of the tab by id and type.
304
300
  */
305
301
  getTabRef: function (id, type, switchTab = false) {
306
302
  const matchedTab = this.tabEntries.filter((tabEntry) => {
307
- return (id === undefined || tabEntry.id === id) &&
308
- (type === undefined || tabEntry.type === type);
303
+ return (
304
+ (id === undefined || tabEntry.id === id) && (type === undefined || tabEntry.type === type)
305
+ );
309
306
  });
310
307
  const tabInfo = matchedTab.length ? matchedTab : this.tabEntries;
311
308
  const tabRef = tabInfo[0].type + 'Tab_' + tabInfo[0].id;
@@ -323,40 +320,38 @@ export default {
323
320
  */
324
321
  addFilter: function (filter) {
325
322
  if (filter) {
326
- this.drawerOpen = true
323
+ this.drawerOpen = true;
327
324
  let filterToAdd = filter;
328
325
  if (Array.isArray(filter)) {
329
- filterToAdd.forEach(item => item.AND = true);
326
+ filterToAdd.forEach((item) => (item.AND = true));
330
327
  } else {
331
- filter.AND = true // When we add a filter external, it is currently only with an AND boolean
332
- filterToAdd = [filter]
328
+ filter.AND = true; // When we add a filter external, it is currently only with an AND boolean
329
+ filterToAdd = [filter];
333
330
  }
334
331
  // Because refs are in v-for, nextTick is needed here
335
332
  this.$nextTick(() => {
336
333
  const datasetExplorerTabRef = this.getTabRef(undefined, 'datasetExplorer', true);
337
- datasetExplorerTabRef.addFilter(filterToAdd)
338
- })
334
+ datasetExplorerTabRef.addFilter(filterToAdd);
335
+ });
339
336
  }
340
337
  },
341
338
  openNeuronSearch: function (neuron) {
342
- this.drawerOpen = true
339
+ this.drawerOpen = true;
343
340
  // Because refs are in v-for, nextTick is needed here
344
341
  this.$nextTick(() => {
345
342
  const datasetExplorerTabRef = this.getTabRef(undefined, 'datasetExplorer', true);
346
- datasetExplorerTabRef.openSearch(
347
- '',
348
- undefined,
349
- 'scicrunch-query-string/',
350
- { field: '*organ.curie', curie: neuron }
351
- )
352
- })
343
+ datasetExplorerTabRef.openSearch('', undefined, 'scicrunch-query-string/', {
344
+ field: '*organ.curie',
345
+ curie: neuron,
346
+ });
347
+ });
353
348
  },
354
349
  getAlgoliaFacets: async function () {
355
350
  const datasetExplorerTabRef = this.getTabRef(undefined, 'datasetExplorer');
356
- return await datasetExplorerTabRef.getAlgoliaFacets()
351
+ return await datasetExplorerTabRef.getAlgoliaFacets();
357
352
  },
358
353
  setDrawerOpen: function (value = true) {
359
- this.drawerOpen = value
354
+ this.drawerOpen = value;
360
355
  },
361
356
  setActiveTab: function (tab) {
362
357
  const matchedTab = this.tabs.filter((tabEntry) => {
@@ -382,10 +377,10 @@ export default {
382
377
  if (connectivityExplorerTabRef && !connectivityExplorerTabRef.expanded) {
383
378
  data = { tabType: 'connectivity' };
384
379
  } else {
385
- data = {...this.activeConnectivityData};
380
+ data = { ...this.activeConnectivityData };
386
381
  }
387
382
  } else if (tab.type === 'annotation') {
388
- data = {...this.activeAnnotationData};
383
+ data = { ...this.activeAnnotationData };
389
384
  } else {
390
385
  // switching to dataset explorer tab will not highlight
391
386
  // the highlight is from the last tab
@@ -393,7 +388,7 @@ export default {
393
388
  }
394
389
 
395
390
  if (data) {
396
- this.$emit('hover-changed', {...data, tabId: tab.id })
391
+ this.$emit('hover-changed', { ...data, tabId: tab.id });
397
392
  }
398
393
  },
399
394
  tabClicked: function (tab) {
@@ -415,7 +410,7 @@ export default {
415
410
  * Store available anatomy facets data for connectivity list component
416
411
  */
417
412
  storeAvailableAnatomyFacets: function (availableAnatomyFacets) {
418
- localStorage.setItem('available-anatomy-facets', JSON.stringify(availableAnatomyFacets))
413
+ localStorage.setItem('available-anatomy-facets', JSON.stringify(availableAnatomyFacets));
419
414
  },
420
415
  closeConnectivity: function () {
421
416
  EventBus.emit('close-connectivity');
@@ -496,29 +491,26 @@ export default {
496
491
  */
497
492
  trackEvent: function (data) {
498
493
  const taggingData = {
499
- 'event': 'interaction_event',
500
- 'location': 'map_sidebar',
494
+ event: 'interaction_event',
495
+ location: 'map_sidebar',
501
496
  ...data,
502
497
  };
503
498
  this.$emit('trackEvent', taggingData);
504
- }
499
+ },
505
500
  },
506
501
  computed: {
507
502
  // This should respect the information provided by the property
508
503
  tabEntries: function () {
509
- return this.tabs.filter((tab) =>
510
- tab.type === "datasetExplorer" ||
511
- tab.type === "connectivityExplorer" ||
512
- (
513
- tab.type === "annotation" &&
514
- this.annotationEntry &&
515
- this.annotationEntry.length > 0
516
- )
504
+ return this.tabs.filter(
505
+ (tab) =>
506
+ tab.type === 'datasetExplorer' ||
507
+ tab.type === 'connectivityExplorer' ||
508
+ (tab.type === 'annotation' && this.annotationEntry && this.annotationEntry.length > 0),
517
509
  );
518
510
  },
519
511
  },
520
512
  created: function () {
521
- this.drawerOpen = this.openAtStart
513
+ this.drawerOpen = this.openAtStart;
522
514
  },
523
515
  mounted: function () {
524
516
  EventBus.on('PopoverActionClick', (payLoad) => {
@@ -526,22 +518,22 @@ export default {
526
518
  * This event is emitted when the image is clicked on or the button below the image is clicked on.
527
519
  * @arg payLoad
528
520
  */
529
- this.$emit('actionClick', payLoad)
530
- })
521
+ this.$emit('actionClick', payLoad);
522
+ });
531
523
  EventBus.on('number-of-datasets-for-anatomies', (payLoad) => {
532
524
  /**
533
525
  * This emits a object with keys as anatomy and values as number of datasets for that anatomy.
534
526
  * @arg payload
535
527
  */
536
- this.$emit('number-of-datasets-for-anatomies', payLoad)
537
- })
528
+ this.$emit('number-of-datasets-for-anatomies', payLoad);
529
+ });
538
530
  EventBus.on('anatomy-in-datasets', (payLoad) => {
539
- /**
531
+ /**
540
532
  * This emits a lis of datasets, with the anatomy for each one. Used by flatmap for markers
541
533
  * @arg payload
542
534
  */
543
- this.$emit('anatomy-in-datasets', payLoad)
544
- })
535
+ this.$emit('anatomy-in-datasets', payLoad);
536
+ });
545
537
 
546
538
  EventBus.on('contextUpdate', (payLoad) => {
547
539
  /**
@@ -549,8 +541,8 @@ export default {
549
541
  * Example, context card update on first load.
550
542
  * @arg payload
551
543
  */
552
- this.$emit('contextUpdate', payLoad)
553
- })
544
+ this.$emit('contextUpdate', payLoad);
545
+ });
554
546
  EventBus.on('datalink-clicked', (payLoad) => {
555
547
  /**
556
548
  * This event is emitted
@@ -559,31 +551,33 @@ export default {
559
551
  * @arg payload
560
552
  */
561
553
  this.$emit('datalink-clicked', payLoad);
562
- })
554
+ });
563
555
  EventBus.on('onConnectivityActionClick', (payLoad) => {
564
556
  // switch to search tab with tab id: 1
565
- this.tabClicked({id: 1, type: 'datasetExplorer'});
557
+ this.tabClicked({ id: 1, type: 'datasetExplorer' });
566
558
  this.$emit('actionClick', payLoad);
567
- })
559
+ });
568
560
  EventBus.on('connectivity-source-change', (payLoad) => {
569
561
  this.$emit('connectivity-source-change', payLoad);
570
- })
562
+ });
571
563
  EventBus.on('show-connectivity-graph', (payLoad) => {
572
564
  this.$emit('show-connectivity-graph', payLoad);
573
- })
565
+ });
574
566
 
575
567
  // Get available anatomy facets for the connectivity info
576
568
  EventBus.on('available-facets', (payLoad) => {
577
- this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children
578
- this.storeAvailableAnatomyFacets(this.availableAnatomyFacets);
579
- })
569
+ this.availableAnatomyFacets = payLoad.find(
570
+ (facet) => facet.label === 'Anatomical Structure',
571
+ ).children;
572
+ this.storeAvailableAnatomyFacets(this.availableAnatomyFacets);
573
+ });
580
574
 
581
575
  // Event tracking
582
576
  EventBus.on('trackEvent', (data) => {
583
577
  this.trackEvent(data);
584
578
  });
585
579
  },
586
- }
580
+ };
587
581
  </script>
588
582
 
589
583
  <style lang="scss" scoped>
@@ -598,7 +592,7 @@ export default {
598
592
  position: relative;
599
593
  height: 100%;
600
594
  pointer-events: none;
601
- width:600px;
595
+ width: 600px;
602
596
  float: right;
603
597
  }
604
598
 
@@ -685,12 +679,12 @@ export default {
685
679
 
686
680
  <style lang="scss">
687
681
  .side-bar {
688
- --el-color-primary: #8300BF;
689
- --el-color-primary-light-7: #DAB3EC;
682
+ --el-color-primary: #8300bf;
683
+ --el-color-primary-light-7: #dab3ec;
690
684
  --el-color-primary-light-8: #e6ccf2;
691
685
  --el-color-primary-light-9: #f3e6f9;
692
686
  --el-color-primary-light-3: #f3e6f9;
693
- --el-color-primary-dark-2: #7600AC;
687
+ --el-color-primary-dark-2: #7600ac;
694
688
  }
695
689
  .el-button--primary {
696
690
  --el-button-hover-text-color: var(--el-color-primary);
@@ -7,12 +7,8 @@
7
7
  :class="{ 'active-tab': tab.id == activeId }"
8
8
  @click="tabClicked(tab)"
9
9
  >
10
- <span class="tab-title">{{ tab.title }} </span>
11
- <el-icon
12
- v-if="tab.closable"
13
- @click.stop="tabClosed(tab)"
14
- class="tab-close-icon"
15
- >
10
+ <span class="tab-title">{{ tab.title }}</span>
11
+ <el-icon v-if="tab.closable" @click.stop="tabClosed(tab)" class="tab-close-icon">
16
12
  <el-icon-close />
17
13
  </el-icon>
18
14
  </div>
@@ -20,11 +16,10 @@
20
16
  </template>
21
17
 
22
18
  <script>
23
- /* eslint-disable no-alert, no-console */
24
- import { Close as ElIconClose } from "@element-plus/icons-vue";
19
+ import { Close as ElIconClose } from '@element-plus/icons-vue';
25
20
 
26
21
  export default {
27
- name: "Tabs",
22
+ name: 'Tabs',
28
23
  components: {
29
24
  ElIconClose,
30
25
  },
@@ -58,18 +53,18 @@ export default {
58
53
  },
59
54
  methods: {
60
55
  tabClicked: function (tab) {
61
- this.$emit("tabClicked", { id: tab.id, type: tab.type });
56
+ this.$emit('tabClicked', { id: tab.id, type: tab.type });
62
57
 
63
58
  // To track only direct tab click events
64
59
  this.$emit('trackEvent', {
65
- 'event': 'interaction_event',
66
- 'event_name': 'portal_maps_sidebar_open_tab',
67
- 'category': tab.type,
68
- 'location': 'map_sidebar_tabs',
60
+ event: 'interaction_event',
61
+ event_name: 'portal_maps_sidebar_open_tab',
62
+ category: tab.type,
63
+ location: 'map_sidebar_tabs',
69
64
  });
70
65
  },
71
66
  tabClosed: function (tab) {
72
- this.$emit("tabClosed", { id: tab.id, type: tab.type });
67
+ this.$emit('tabClosed', { id: tab.id, type: tab.type });
73
68
  },
74
69
  },
75
70
  };
@@ -1,6 +1,4 @@
1
- import SideBar from "./SideBar.vue"
2
- import "../assets/fonts.scss";
1
+ import SideBar from './SideBar.vue';
2
+ import '../assets/fonts.scss';
3
3
 
4
- export {
5
- SideBar
6
- };
4
+ export { SideBar };
@@ -1,8 +1,8 @@
1
1
  export default {
2
- 'homo sapiens': 'Human',
3
- 'rattus norvegicus': 'Rat',
4
- 'mus musculus': 'Mouse',
5
- 'sus scrofa domesticus': 'Pig',
6
- 'sus scrofa': 'Boar',
7
- 'felis catus': 'Cat'
8
- }
2
+ 'homo sapiens': 'Human',
3
+ 'rattus norvegicus': 'Rat',
4
+ 'mus musculus': 'Mouse',
5
+ 'sus scrofa domesticus': 'Pig',
6
+ 'sus scrofa': 'Boar',
7
+ 'felis catus': 'Cat',
8
+ };