@abi-software/map-side-bar 2.17.1-demo.1 → 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 (41) 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 +5906 -7001
  5. package/dist/map-side-bar.umd.cjs +62 -65
  6. package/dist/style.css +1 -1
  7. package/eslint.config.js +44 -9
  8. package/package.json +12 -5
  9. package/reporter-config.json +1 -1
  10. package/src/App.vue +80 -86
  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 +22 -19
  20. package/src/components/ConnectivityExplorer.vue +107 -128
  21. package/src/components/ConnectivityInfo.vue +169 -128
  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 +381 -408
  27. package/src/components/SearchHistory.vue +75 -91
  28. package/src/components/SideBar.vue +86 -193
  29. package/src/components/Tabs.vue +16 -30
  30. package/src/components/index.js +3 -5
  31. package/src/components/species-map.js +7 -7
  32. package/src/components.d.ts +0 -3
  33. package/src/exampleConnectivityInput.js +310 -318
  34. package/src/main.js +6 -6
  35. package/src/mixins/S3Bucket.vue +10 -13
  36. package/vite.config.js +62 -61
  37. package/vuese-generator.js +47 -55
  38. package/src/components/CellCard.vue +0 -994
  39. package/src/components/CellCardExplorer.vue +0 -882
  40. package/src/components/icons/IconOpenExternal.vue +0 -28
  41. package/src/utils/common.js +0 -71
@@ -3,7 +3,7 @@
3
3
  <MapSvgSpriteColor />
4
4
  <template #header>
5
5
  <div class="header">
6
- <div class="search-input-container" :class="{'is-focus': inputFocus}">
6
+ <div class="search-input-container" :class="{ 'is-focus': inputFocus }">
7
7
  <el-input
8
8
  class="search-input"
9
9
  placeholder="Search"
@@ -15,11 +15,7 @@
15
15
  clearable
16
16
  @clear="clearSearchClicked"
17
17
  ></el-input>
18
- <el-popover
19
- width="350"
20
- trigger="hover"
21
- popper-class="filter-help-popover"
22
- >
18
+ <el-popover width="350" trigger="hover" popper-class="filter-help-popover">
23
19
  <template #reference>
24
20
  <MapSvgIcon icon="help" class="help" />
25
21
  </template>
@@ -27,54 +23,60 @@
27
23
  <strong>Search rules:</strong>
28
24
  <ul>
29
25
  <li>
30
- <strong>Partial Matching:</strong> You don't need to type the full word or ID.
31
- The search will find items that contain your search term.
26
+ <strong>Partial Matching:</strong>
27
+ You don't need to type the full word or ID. The search will find items that
28
+ contain your search term.
32
29
  </li>
33
30
  <li>
34
- <strong>Multiple Terms:</strong> Separate terms with a comma (<code>,</code>).
35
- This will find pathways that match any of the terms (an "OR" search).
31
+ <strong>Multiple Terms:</strong>
32
+ Separate terms with a comma (
33
+ <code>,</code>
34
+ ). This will find pathways that match any of the terms (an "OR" search).
36
35
  </li>
37
36
  </ul>
38
- <br/>
37
+ <br />
39
38
  <strong>Examples:</strong>
40
39
  <ul>
41
40
  <li>
42
41
  <strong>To find by partial ID:</strong>
43
- Searching for <code>kidney/132</code> will match the full <strong>Pathway ID</strong> <code>ilxtr:sparc-nlp/kidney/132</code>
42
+ Searching for
43
+ <code>kidney/132</code>
44
+ will match the full
45
+ <strong>Pathway ID</strong>
46
+ <code>ilxtr:sparc-nlp/kidney/132</code>
44
47
  </li>
45
48
  <li>
46
49
  <strong>To find by keyword:</strong>
47
- Searching for (<code>vagus nerve</code>) will match <strong>pathways</strong> that have <code>vagus nerve</code> in their title OR are linked to a related component (like UBERON:0001759).
50
+ Searching for (
51
+ <code>vagus nerve</code>
52
+ ) will match
53
+ <strong>pathways</strong>
54
+ that have
55
+ <code>vagus nerve</code>
56
+ in their title OR are linked to a related component (like UBERON:0001759).
48
57
  </li>
49
58
  <li>
50
59
  <strong>To find by multiple terms:</strong>
51
- Searching for <code>kidney</code>, <code>vagus nerve</code> will find pathways that are related to either <code>kidney</code> OR <code>vagus nerve</code>.</li>
60
+ Searching for
61
+ <code>kidney</code>
62
+ ,
63
+ <code>vagus nerve</code>
64
+ will find pathways that are related to either
65
+ <code>kidney</code>
66
+ OR
67
+ <code>vagus nerve</code>
68
+ .
69
+ </li>
52
70
  </ul>
53
71
  </div>
54
72
  </el-popover>
55
73
  </div>
56
- <el-button
57
- type="primary"
58
- class="button"
59
- @click="searchEvent"
60
- size="large"
61
- >
74
+ <el-button type="primary" class="button" @click="searchEvent" size="large">
62
75
  Search
63
76
  </el-button>
64
- <el-button
65
- link
66
- class="el-button-link"
67
- @click="onResetClick"
68
- size="large"
69
- >
70
- Reset
71
- </el-button>
77
+ <el-button link class="el-button-link" @click="onResetClick" size="large">Reset</el-button>
72
78
  <div v-if="showVisibilityFilter" class="visibility-filter">
73
- <el-checkbox
74
- v-model="filterVisibility"
75
- >
76
- Focused
77
- </el-checkbox>
79
+ <el-checkbox v-model="filterVisibility">Focused</el-checkbox>
78
80
  <el-popover
79
81
  title="How does focused checkbox work?"
80
82
  width="250"
@@ -125,7 +127,7 @@
125
127
  <div
126
128
  v-for="result in paginatedResults"
127
129
  :key="result.id"
128
- :ref="'stepItem-' + result.id"
130
+ :ref="'stepItem-' + result.id"
129
131
  class="step-item"
130
132
  @mouseenter="onHoverChanged($event, result)"
131
133
  >
@@ -170,27 +172,18 @@
170
172
  </template>
171
173
 
172
174
  <script>
173
- /* eslint-disable no-alert, no-console */
174
- import {
175
- ElButton as Button,
176
- ElCard as Card,
177
- ElCheckbox as Checkbox,
178
- ElIcon as Icon,
179
- ElInput as Input,
180
- ElPagination as Pagination,
181
- ElMessage as Message,
182
- } from "element-plus";
183
175
  import 'element-plus/es/components/message/style/css';
184
- import EventBus from './EventBus.js'
185
- import SearchFilters from "./SearchFilters.vue";
186
- import SearchHistory from "./SearchHistory.vue";
187
- import ConnectivityCard from "./ConnectivityCard.vue";
188
- import ConnectivityInfo from "./ConnectivityInfo.vue";
189
- import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
176
+ import { ElMessage } from 'element-plus';
177
+ import EventBus from './EventBus.js';
178
+ import SearchFilters from './SearchFilters.vue';
179
+ import SearchHistory from './SearchHistory.vue';
180
+ import ConnectivityCard from './ConnectivityCard.vue';
181
+ import ConnectivityInfo from './ConnectivityInfo.vue';
182
+ import { MapSvgIcon, MapSvgSpriteColor } from '@abi-software/svg-sprite';
190
183
 
191
184
  var initial_state = {
192
- searchInput: "",
193
- lastSearch: "",
185
+ searchInput: '',
186
+ lastSearch: '',
194
187
  results: [],
195
188
  numberOfHits: 0,
196
189
  filter: [],
@@ -206,20 +199,14 @@ export default {
206
199
  SearchHistory,
207
200
  ConnectivityCard,
208
201
  ConnectivityInfo,
209
- Button,
210
- Card,
211
- Checkbox,
212
- Icon,
213
- Input,
214
- Pagination,
215
202
  MapSvgIcon,
216
- MapSvgSpriteColor
203
+ MapSvgSpriteColor,
217
204
  },
218
- name: "ConnectivityExplorer",
205
+ name: 'ConnectivityExplorer',
219
206
  props: {
220
207
  connectivityKnowledge: {
221
208
  type: Array,
222
- default: [],
209
+ default: () => [],
223
210
  },
224
211
  entry: {
225
212
  type: Object,
@@ -231,15 +218,15 @@ export default {
231
218
  },
232
219
  connectivityEntry: {
233
220
  type: Array,
234
- default: [],
221
+ default: () => [],
235
222
  },
236
223
  availableAnatomyFacets: {
237
- type: Object,
238
- default: [],
224
+ type: Array,
225
+ default: () => [],
239
226
  },
240
227
  connectivityFilterOptions: {
241
228
  type: Array,
242
- default: [],
229
+ default: () => [],
243
230
  },
244
231
  showVisibilityFilter: {
245
232
  type: Boolean,
@@ -254,15 +241,15 @@ export default {
254
241
  return {
255
242
  ...this.entry,
256
243
  bodyStyle: {
257
- flex: "1 1 auto",
258
- "flex-flow": "column",
259
- display: "flex",
244
+ flex: '1 1 auto',
245
+ 'flex-flow': 'column',
246
+ display: 'flex',
260
247
  },
261
248
  cascaderIsReady: false,
262
249
  freezeTimeout: undefined,
263
250
  freezed: false,
264
251
  initLoading: true,
265
- expanded: "",
252
+ expanded: '',
266
253
  filterVisibility: true,
267
254
  expandedData: null,
268
255
  inputFocus: false,
@@ -278,8 +265,8 @@ export default {
278
265
  showFilters: true,
279
266
  helper: {
280
267
  within: "'CNS' OR 'Local circuit neuron'",
281
- between: "'Somatic lower motor' AND 'Human'"
282
- }
268
+ between: "'Somatic lower motor' AND 'Human'",
269
+ },
283
270
  };
284
271
  },
285
272
  paginatedResults: function () {
@@ -288,7 +275,7 @@ export default {
288
275
  },
289
276
  watch: {
290
277
  connectivityKnowledge: function (newVal, oldVal) {
291
- this.expanded = ""; // reset expanded state
278
+ this.expanded = ''; // reset expanded state
292
279
  this.expandedData = null;
293
280
  this.loadingCards = false;
294
281
  if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
@@ -296,7 +283,7 @@ export default {
296
283
  this.initLoading = false;
297
284
  this.numberOfHits = this.results.length;
298
285
  // knowledge is from the neuron click if there is 'ready' property
299
- if (this.numberOfHits > 0 && ('ready' in this.results[0])) {
286
+ if (this.numberOfHits > 0 && 'ready' in this.results[0]) {
300
287
  this.$refs.filtersRef.checkShowAllBoxes();
301
288
  this.searchInput = '';
302
289
  this.filter = [];
@@ -309,19 +296,18 @@ export default {
309
296
  connectivityEntry: function (newVal, oldVal) {
310
297
  if (
311
298
  JSON.stringify(newVal) !== JSON.stringify(oldVal) &&
312
- newVal.length === 1 && newVal[0].ready
299
+ newVal.length === 1 &&
300
+ newVal[0].ready
313
301
  ) {
314
- const hasValidFacet = this.filter.some(f => f.facet !== "Show all");
302
+ const hasValidFacet = this.filter.some((f) => f.facet !== 'Show all');
315
303
  if (
316
304
  // card should not be expanded if only one entry and from neuron click
317
- (this.numberOfHits === 1 && !this.searchInput && !hasValidFacet)||
305
+ (this.numberOfHits === 1 && !this.searchInput && !hasValidFacet) ||
318
306
  // if the changed property is connectivity source,
319
307
  // or two different maps in split view, do not collapse
320
- (
321
- newVal[0].connectivitySource !== oldVal[0].connectivitySource ||
322
- newVal[0].mapId !== oldVal[0].mapId
323
- ) &&
324
- oldVal[0].ready
308
+ ((newVal[0].connectivitySource !== oldVal[0].connectivitySource ||
309
+ newVal[0].mapId !== oldVal[0].mapId) &&
310
+ oldVal[0].ready)
325
311
  ) {
326
312
  return;
327
313
  }
@@ -344,7 +330,7 @@ export default {
344
330
  }
345
331
  this.freezeTimeout = setTimeout(() => {
346
332
  this.freezed = false;
347
- }, 3000)
333
+ }, 3000);
348
334
  },
349
335
  onShowConnectivity: function (data) {
350
336
  this.freezeHoverChange();
@@ -359,8 +345,8 @@ export default {
359
345
  this.searchAndFilterUpdate();
360
346
  this.updateInputFocus();
361
347
  },
362
- collapseChange:function (data) {
363
- this.expanded = this.expanded === data.id ? "" : data.id;
348
+ collapseChange: function (data) {
349
+ this.expanded = this.expanded === data.id ? '' : data.id;
364
350
  this.expandedData = this.expanded ? data : null;
365
351
  },
366
352
  closeConnectivity: function () {
@@ -370,15 +356,15 @@ export default {
370
356
  },
371
357
  onConnectivityCollapseChange: function (data) {
372
358
  // close connectivity event will not trigger emit
373
- if (this.connectivityEntry.find(entry => entry.featureId[0] === data.id)) {
359
+ if (this.connectivityEntry.find((entry) => entry.featureId[0] === data.id)) {
374
360
  this.collapseChange(data);
375
361
  this.closeConnectivity();
376
362
  } else {
377
- this.expanded = "";
363
+ this.expanded = '';
378
364
  this.expandedData = null;
379
365
  // Make sure to emit the change after the next DOM update
380
366
  this.$nextTick(() => {
381
- this.$emit("connectivity-collapse-change", data);
367
+ this.$emit('connectivity-collapse-change', data);
382
368
  });
383
369
  }
384
370
  },
@@ -388,21 +374,21 @@ export default {
388
374
  // mouseleave event won't trigger if the connectivity explorer tab is not in view
389
375
  // e.g., switching to annotation tab on item click
390
376
  if (data || (target && target.checkVisibility())) {
391
- this.hoverChanged(data)
377
+ this.hoverChanged(data);
392
378
  }
393
379
  },
394
380
  hoverChanged: function (data) {
395
381
  // disable hover changes when show connectivity is clicked
396
382
  if (!this.freezed) {
397
- let payload = { tabType: "connectivity" };
383
+ let payload = { tabType: 'connectivity' };
398
384
 
399
385
  if (data) {
400
- payload = {...payload, ...data};
386
+ payload = { ...payload, ...data };
401
387
  } else if (this.expandedData) {
402
- payload = {...payload, ...this.expandedData};
388
+ payload = { ...payload, ...this.expandedData };
403
389
  }
404
390
 
405
- this.$emit("hover-changed", payload);
391
+ this.$emit('hover-changed', payload);
406
392
  }
407
393
  },
408
394
  resetSearch: function () {
@@ -410,8 +396,8 @@ export default {
410
396
  this.results = [];
411
397
  this.loadingCards = false;
412
398
  },
413
- resetSearchIfNoActiveSearch: function() {
414
- const hasValidFacet = this.filter.some(f => f.facet !== "Show all");
399
+ resetSearchIfNoActiveSearch: function () {
400
+ const hasValidFacet = this.filter.some((f) => f.facet !== 'Show all');
415
401
  if (!this.searchInput && !hasValidFacet) {
416
402
  this.openSearch([], '');
417
403
  }
@@ -422,15 +408,15 @@ export default {
422
408
  value: [],
423
409
  tabType: 'connectivity',
424
410
  type: 'reset-update',
425
- })
411
+ });
426
412
 
427
413
  EventBus.emit('trackEvent', {
428
- 'event_name': `portal_maps_action_filter`,
429
- 'category': `reset`,
430
- 'location': 'map_sidebar_connectivity',
414
+ event_name: `portal_maps_action_filter`,
415
+ category: `reset`,
416
+ location: 'map_sidebar_connectivity',
431
417
  });
432
418
  },
433
- openSearch: function (filter, search = "") {
419
+ openSearch: function (filter, search = '') {
434
420
  this.searchInput = search;
435
421
  this.updateInputFocus();
436
422
  this.resetPageNavigation();
@@ -438,7 +424,7 @@ export default {
438
424
  if (this.cascaderIsReady) {
439
425
  const validatedFilters = this.$refs.filtersRef.getHierarchicalValidatedFilters(filter);
440
426
  const notFoundItems = validatedFilters.notFound
441
- ? validatedFilters.notFound.filter(item => item.facet.toLowerCase() !== 'show all')
427
+ ? validatedFilters.notFound.filter((item) => item.facet.toLowerCase() !== 'show all')
442
428
  : [];
443
429
  this.filter = validatedFilters.result;
444
430
 
@@ -446,7 +432,7 @@ export default {
446
432
  notFoundItems.forEach((notFoundItem) => {
447
433
  const itemLabel = notFoundItem.tagLabel || notFoundItem.facet;
448
434
  const itemLabelLowerCase = itemLabel.charAt(0).toLowerCase() + itemLabel.slice(1);
449
- let message = '';
435
+ let message;
450
436
  if (notFoundItem.term.toLowerCase() === 'origin') {
451
437
  message = `There are no neuron populations beginning at <strong>${itemLabelLowerCase}</strong>.`;
452
438
  } else if (notFoundItem.term.toLowerCase() === 'via') {
@@ -454,11 +440,11 @@ export default {
454
440
  } else if (notFoundItem.term.toLowerCase() === 'destination') {
455
441
  message = `There are no neuron populations terminating at <strong>${itemLabelLowerCase}</strong>.`;
456
442
  } else {
457
- message = `There are no neuron populations beginning, terminating, or running through <strong>${itemLabelLowerCase}</strong>.`
443
+ message = `There are no neuron populations beginning, terminating, or running through <strong>${itemLabelLowerCase}</strong>.`;
458
444
  }
459
- Message({
445
+ ElMessage({
460
446
  dangerouslyUseHTMLString: true,
461
- message: message,
447
+ message,
462
448
  appendTo: this.$el,
463
449
  showClose: true,
464
450
  offset: 113,
@@ -470,18 +456,13 @@ export default {
470
456
  value: notFoundItems,
471
457
  tabType: 'connectivity',
472
458
  type: 'reset-update',
473
- })
459
+ });
474
460
  }
475
461
 
476
462
  //Facets provided but cannot find at least one valid
477
463
  //facet. Tell the users the search is invalid and reset
478
464
  //facets check boxes.
479
- if (
480
- filter &&
481
- filter.length > 0 &&
482
- this.filter &&
483
- this.filter.length === 0
484
- ) {
465
+ if (filter && filter.length > 0 && this.filter && this.filter.length === 0) {
485
466
  this.$refs.filtersRef.checkShowAllBoxes();
486
467
  this.resetSearch();
487
468
  } else if (this.filter) {
@@ -503,8 +484,7 @@ export default {
503
484
  if (this.cascaderIsReady) {
504
485
  this.resetPageNavigation();
505
486
  if (filter) {
506
- if (this.$refs.filtersRef.addFilter(filter))
507
- this.$refs.filtersRef.initiateSearch();
487
+ if (this.$refs.filtersRef.addFilter(filter)) this.$refs.filtersRef.initiateSearch();
508
488
  }
509
489
  } else {
510
490
  if (Array.isArray(this.filter)) {
@@ -519,7 +499,7 @@ export default {
519
499
  this.openSearch(this.filter, this.searchInput);
520
500
  },
521
501
  clearSearchClicked: function () {
522
- this.searchInput = "";
502
+ this.searchInput = '';
523
503
  this.searchAndFilterUpdate();
524
504
  this.updateInputFocus();
525
505
  },
@@ -563,17 +543,17 @@ export default {
563
543
  this.$refs.searchHistory.addSearchToHistory(this.filter, search);
564
544
  }
565
545
  },
566
- searchKnowledge: function (filters, query = "") {
567
- this.expanded = "";
546
+ searchKnowledge: function (filters, query = '') {
547
+ this.expanded = '';
568
548
  this.expandedData = null;
569
549
  this.loadingCards = true;
570
550
  this.scrollToTop();
571
- this.$emit("search-changed", {
551
+ this.$emit('search-changed', {
572
552
  // value: this.searchInput,
573
553
  // type: "query-update",
574
554
  query: query,
575
555
  filter: filters,
576
- tabType: "connectivity",
556
+ tabType: 'connectivity',
577
557
  });
578
558
  this.lastSearch = query;
579
559
  },
@@ -584,9 +564,9 @@ export default {
584
564
  this.numberPerPage = val;
585
565
 
586
566
  EventBus.emit('trackEvent', {
587
- 'event_name': `portal_maps_connectivity_perPage`,
588
- 'category': val + '',
589
- 'location': 'map_sidebar_connectivity',
567
+ event_name: `portal_maps_connectivity_perPage`,
568
+ category: val + '',
569
+ location: 'map_sidebar_connectivity',
590
570
  });
591
571
 
592
572
  const preventPaginationTracking = this.page === 1;
@@ -595,22 +575,22 @@ export default {
595
575
  pageChange: function (page, preventPaginationTracking = false) {
596
576
  this.start = (page - 1) * this.numberPerPage;
597
577
  this.page = page;
598
- this.expanded = "";
578
+ this.expanded = '';
599
579
  this.expandedData = null;
600
580
  this.scrollToTop();
601
581
  // this.searchKnowledge(this.filter, this.searchInput);
602
582
 
603
583
  if (!preventPaginationTracking) {
604
584
  EventBus.emit('trackEvent', {
605
- 'event_name': `portal_maps_connectivity_pagination`,
606
- 'category': `page_${this.page}`,
607
- 'location': 'map_sidebar_connectivity',
585
+ event_name: `portal_maps_connectivity_pagination`,
586
+ category: `page_${this.page}`,
587
+ location: 'map_sidebar_connectivity',
608
588
  });
609
589
  }
610
590
  },
611
591
  scrollToTop: function () {
612
592
  if (this.$refs.content) {
613
- this.$refs.content.scroll({ top: 0, behavior: "smooth" });
593
+ this.$refs.content.scroll({ top: 0, behavior: 'smooth' });
614
594
  }
615
595
  },
616
596
  resetPageNavigation: function () {
@@ -660,7 +640,7 @@ export default {
660
640
  position: relative;
661
641
 
662
642
  &::before {
663
- content: "";
643
+ content: '';
664
644
  display: block;
665
645
  width: calc(100% - 15px);
666
646
  height: 100%;
@@ -826,5 +806,4 @@ export default {
826
806
  color: #f9f2fc !important;
827
807
  }
828
808
  }
829
-
830
809
  </style>