@abi-software/mapintegratedvuer 1.21.1 → 1.21.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.
Files changed (68) hide show
  1. package/README.md +23 -5
  2. package/assets/location-icon.html +33 -1
  3. package/assets/styleguide.css +18 -18
  4. package/cypress.config.js +7 -9
  5. package/dist/{ConnectivityGraph-CZMROk9r.js → ConnectivityGraph-DrSaFEDd.js} +3 -3
  6. package/dist/{ContentMixin-Vn34n5t2.js → ContentMixin-Xg0PjBqG.js} +2 -2
  7. package/dist/{DynamicMarkerMixin-BS6t7w_i.js → DynamicMarkerMixin-D5Ruu_hd.js} +1 -1
  8. package/dist/{Flatmap-BejxA0uz.js → Flatmap-CxN8TbnS.js} +4 -4
  9. package/dist/{Iframe-BWbhTjCR.js → Iframe-CkgbLfJt.js} +4 -4
  10. package/dist/{MultiFlatmap-nlmsH-Ib.js → MultiFlatmap-CkejvAJe.js} +4 -4
  11. package/dist/{Plot-ChbPsDZX.js → Plot-BfwoipSl.js} +2 -2
  12. package/dist/{Scaffold-C6f7c7Ha.js → Scaffold-DCqsTKpg.js} +4 -4
  13. package/dist/{Simulation-DcJScRYo.js → Simulation-BOtU3kTT.js} +2 -2
  14. package/dist/{connectivities-UXTqf7_0.js → connectivities-DyeS8w0c.js} +126 -95
  15. package/dist/index.html +9 -6
  16. package/dist/mapintegratedvuer.js +5489 -5578
  17. package/dist/mapintegratedvuer.umd.cjs +196 -196
  18. package/dist/style.css +1 -1
  19. package/eslint.config.js +39 -15
  20. package/package.json +11 -5
  21. package/public/index.html +9 -6
  22. package/src/App.vue +234 -249
  23. package/src/assets/_variables.scss +12 -10
  24. package/src/assets/header-icon.scss +8 -9
  25. package/src/assets/mapicon-species-style.css +10 -8
  26. package/src/assets/styles.scss +1 -1
  27. package/src/components/ContentBar.vue +98 -106
  28. package/src/components/ContentVuer.vue +36 -39
  29. package/src/components/ContextCard.vue +238 -199
  30. package/src/components/ContextHelp.vue +22 -26
  31. package/src/components/CustomSplitter.vue +32 -43
  32. package/src/components/DatasetHeader.vue +37 -41
  33. package/src/components/DialogToolbarContent.vue +292 -256
  34. package/src/components/FlatmapContextCard.vue +52 -57
  35. package/src/components/MapContent.vue +90 -86
  36. package/src/components/ResizeSensor.vue +8 -13
  37. package/src/components/SearchControls.vue +26 -35
  38. package/src/components/SimulatedData.js +196 -219
  39. package/src/components/SplitDialog.vue +139 -129
  40. package/src/components/SplitFlow.vue +421 -237
  41. package/src/components/index.js +1 -3
  42. package/src/components/scripts/simulation_data.js +393 -397
  43. package/src/components/scripts/utilities.js +108 -78
  44. package/src/components/viewers/CellDLViewer.vue +9 -9
  45. package/src/components/viewers/ConnectivityGraph.vue +9 -12
  46. package/src/components/viewers/Flatmap.vue +23 -25
  47. package/src/components/viewers/Iframe.vue +8 -10
  48. package/src/components/viewers/MultiFlatmap.vue +59 -69
  49. package/src/components/viewers/Plot.vue +6 -7
  50. package/src/components/viewers/Scaffold.vue +73 -63
  51. package/src/components/viewers/Simulation.vue +10 -15
  52. package/src/main.js +16 -21
  53. package/src/mixins/ContentMixin.js +208 -178
  54. package/src/mixins/DynamicMarkerMixin.js +14 -18
  55. package/src/mixins/RetrieveContextCardMixin.js +35 -30
  56. package/src/mixins/S3Bucket.vue +10 -13
  57. package/src/services/knowledgeMapping.js +53 -53
  58. package/src/services/tagging.js +4 -4
  59. package/src/stores/connectivities.js +46 -8
  60. package/src/stores/entries.js +7 -9
  61. package/src/stores/index.js +7 -7
  62. package/src/stores/settings.js +23 -31
  63. package/src/stores/splitFlow.js +364 -298
  64. package/vite.bundle-build.js +24 -26
  65. package/vite.config.js +22 -21
  66. package/vite.static-build.js +4 -4
  67. package/vitest.workspace.js +1 -3
  68. package/vuese-generator.js +47 -55
@@ -1,9 +1,5 @@
1
- import { markRaw } from "vue";
2
- import {
3
- getNerveNames,
4
- getParentsRegion,
5
- } from "../components/SimulatedData.js";
6
- import EventBus from "../components/EventBus";
1
+ import { markRaw } from 'vue';
2
+ import EventBus from '../components/EventBus';
7
3
  import { mapStores } from 'pinia';
8
4
  import { useEntriesStore } from '../stores/entries';
9
5
  import { useSettingsStore } from '../stores/settings';
@@ -11,21 +7,24 @@ import { useSplitFlowStore } from '../stores/splitFlow';
11
7
  import { useConnectivitiesStore } from '../stores/connectivities';
12
8
  import Tagging from '../services/tagging.js';
13
9
 
10
+ import { getFlatmapFilterOptions } from '@abi-software/map-utilities';
11
+ import { FlatmapQueries } from '@abi-software/flatmapvuer/src/services/flatmapQueries.js';
12
+ import {
13
+ getKnowledgeSource,
14
+ loadAndStoreKnowledge,
15
+ } from '@abi-software/flatmapvuer/src/services/flatmapKnowledge.js';
14
16
  import {
15
- getFlatmapFilterOptions,
16
- } from '@abi-software/map-utilities'
17
- import { FlatmapQueries } from "@abi-software/flatmapvuer/src/services/flatmapQueries.js";
18
- import { getKnowledgeSource, loadAndStoreKnowledge } from "@abi-software/flatmapvuer/src/services/flatmapKnowledge.js";
19
- import { getTermNerveMaps, getFilterOptions as getScaffoldFilterOptions } from "@abi-software/scaffoldvuer/src/scripts/MappedNerves.js";
20
- import { defaultSpecies } from "../components/scripts/utilities.js";
17
+ getTermNerveMaps,
18
+ getFilterOptions as getScaffoldFilterOptions,
19
+ } from '@abi-software/scaffoldvuer/src/scripts/MappedNerves.js';
20
+ import { defaultSpecies } from '../components/scripts/utilities.js';
21
21
 
22
22
  function capitalise(text) {
23
- return text[0].toUpperCase() + text.substring(1)
23
+ return text[0].toUpperCase() + text.substring(1);
24
24
  }
25
25
 
26
- /* eslint-disable no-alert, no-console */
27
26
  export default {
28
- emits: [ "flatmap-provenance-ready", "resource-selected", "species-changed"],
27
+ emits: ['flatmap-provenance-ready', 'resource-selected', 'species-changed'],
29
28
  props: {
30
29
  /**
31
30
  * Object containing information for
@@ -77,7 +76,7 @@ export default {
77
76
  return !this.showGlobalSettings;
78
77
  },
79
78
  },
80
- beforeUnmount: function() {
79
+ beforeUnmount: function () {
81
80
  this.alive = false;
82
81
  },
83
82
  mounted: function () {
@@ -126,7 +125,7 @@ export default {
126
125
  },
127
126
  onConnectivityItemClose() {
128
127
  if (this?.alive) {
129
- if (this.multiflatmapRef) {
128
+ if (this.multiflatmapRef && this.flatmapIsReady()) {
130
129
  const currentFlatmap = this.multiflatmapRef.getCurrentFlatmap();
131
130
  if (currentFlatmap) {
132
131
  currentFlatmap.closeTooltip();
@@ -141,7 +140,7 @@ export default {
141
140
  return undefined;
142
141
  },
143
142
  openMap: function (type) {
144
- EventBus.emit("OpenNewMap", type);
143
+ EventBus.emit('OpenNewMap', type);
145
144
  this.trackOpenMap(`open_new_${type}_map`);
146
145
  },
147
146
  onMapmanagerLoaded: function (mapManager) {
@@ -151,23 +150,23 @@ export default {
151
150
  // GA Tagging
152
151
  // Open map tracking
153
152
  Tagging.sendEvent({
154
- 'event': 'interaction_event',
155
- 'event_name': 'portal_maps_open_map',
156
- 'category': category,
157
- 'location': 'open_new_map'
153
+ event: 'interaction_event',
154
+ event_name: 'portal_maps_open_map',
155
+ category: category,
156
+ location: 'open_new_map',
158
157
  });
159
158
  },
160
- updateEntryLabel: function(label) {
159
+ updateEntryLabel: function (label) {
161
160
  if (label) {
162
161
  this.entriesStore.updateLabelForEntry(this.entry, label);
163
162
  }
164
163
  },
165
- updateEntryTitle: function(title) {
164
+ updateEntryTitle: function (title) {
166
165
  if (title) {
167
166
  this.entriesStore.updateTitleForEntry(this.entry, title);
168
167
  }
169
168
  },
170
- updateWithViewUrl: function() {
169
+ updateWithViewUrl: function () {
171
170
  return;
172
171
  },
173
172
  /**
@@ -186,15 +185,14 @@ export default {
186
185
  * Callback when the vuers emit a selected event.
187
186
  */
188
187
  resourceSelected: function (type, resources) {
189
- const resource = resources[0]
188
+ const resource = resources[0];
190
189
  // Skip processing if resources already has actions
191
190
  if (this.resourceHasAction(resource)) {
192
- EventBus.emit("PopoverActionClick", resource);
191
+ EventBus.emit('PopoverActionClick', resource);
193
192
  return;
194
193
  }
195
194
 
196
195
  let returnedAction = undefined;
197
- let action = "none";
198
196
  let fireResourceSelected = false;
199
197
  const result = {
200
198
  paneIndex: this.entry.id,
@@ -204,25 +202,26 @@ export default {
204
202
  eventType: undefined,
205
203
  };
206
204
 
207
- if (type == "MultiFlatmap" || type == "Flatmap") {
208
- result.internalName = resource?.feature?.label ?
209
- resource.feature.label : this.idNamePair[resource.feature.models];
210
- if (resource.eventType == "click") {
211
- result.eventType = "selected";
212
- if (resource.feature.type == "marker") {
205
+ if (type == 'MultiFlatmap' || type == 'Flatmap') {
206
+ result.internalName = resource?.feature?.label
207
+ ? resource.feature.label
208
+ : this.idNamePair[resource.feature.models];
209
+ if (resource.eventType == 'click') {
210
+ result.eventType = 'selected';
211
+ if (resource.feature.type == 'marker') {
213
212
  let label = result.internalName;
214
213
  // `resource.feature.id` is the marker identifier (not featureId or models)
215
214
  if (this.settingsStore.isFeaturedMarkerIdentifier(resource.feature.id)) {
216
215
  // It is a featured dataset search for DOI.
217
216
  returnedAction = {
218
- type: "Search",
217
+ type: 'Search',
219
218
  term: this.settingsStore.featuredMarkerDoi(resource.feature.id),
220
219
  featuredDataset: true,
221
220
  };
222
221
  } else {
223
222
  // Facet search on anatomy if it is not a keyword search
224
223
  returnedAction = {
225
- type: "Facet",
224
+ type: 'Facet',
226
225
  facets: [label],
227
226
  };
228
227
  let labels = new Set();
@@ -244,77 +243,72 @@ export default {
244
243
  /* Add to the filter list as and if there is selected facets */
245
244
  if (this.settingsStore.appliedFacets.length) {
246
245
  if (!this.settingsStore.hasAppliedFacets(labels)) {
247
- const newFacets = [...new Set([
248
- ...this.settingsStore.appliedFacets,
249
- ...labels
250
- ])];
246
+ const newFacets = [...new Set([...this.settingsStore.appliedFacets, ...labels])];
251
247
  this.settingsStore.updateAppliedFacets(newFacets);
252
248
  }
253
249
  } else {
254
250
  if (labels.size > 1) {
255
- returnedAction.type = "Facets";
251
+ returnedAction.type = 'Facets';
256
252
  }
257
253
  this.settingsStore.updateAppliedFacets(returnedAction.facets);
258
254
  }
259
255
  }
260
256
  fireResourceSelected = true;
261
- if (type == "MultiFlatmap") {
257
+ if (type == 'MultiFlatmap') {
262
258
  const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
263
259
  flatmap.clearSearchResults();
264
260
  }
265
261
  }
266
- } else if (resource.eventType == "mouseenter") {
267
- result.eventType = "highlighted";
262
+ } else if (resource.eventType == 'mouseenter') {
263
+ result.eventType = 'highlighted';
268
264
  fireResourceSelected = true;
269
265
  }
270
- } else if (type == "Scaffold") {
266
+ } else if (type == 'Scaffold') {
271
267
  if (resource) {
272
- if (resource.data?.id === undefined || resource.data?.id === "") {
268
+ if (resource.data?.id === undefined || resource.data?.id === '') {
273
269
  resource.data.id = resource.data?.group;
274
270
  }
275
271
  result.internalName = resource.data.id;
276
272
  // Facet search if marker is clicked
277
273
  if (resource.data.lastActionOnMarker === true) {
278
274
  returnedAction = {
279
- type: "Facet",
275
+ type: 'Facet',
280
276
  facets: [capitalise(resource.data.id)],
281
277
  };
282
278
  }
283
279
  }
284
- result.eventType = "selected";
280
+ result.eventType = 'selected';
285
281
  fireResourceSelected = true;
286
- action = "search";
287
282
  }
288
- if (returnedAction) EventBus.emit("PopoverActionClick", returnedAction);
289
- if (fireResourceSelected) this.$emit("resource-selected", result);
283
+ if (returnedAction) EventBus.emit('PopoverActionClick', returnedAction);
284
+ if (fireResourceSelected) this.$emit('resource-selected', result);
290
285
  },
291
286
  resourceHasAction: function (resource) {
292
287
  return (
293
- resource && (
294
- resource.type === "URL" ||
295
- resource.type === "Search" ||
296
- resource.type === "Neuron Search" ||
297
- resource.type == "Facet" ||
298
- resource.type == "Facets"
299
- )
288
+ resource &&
289
+ (resource.type === 'URL' ||
290
+ resource.type === 'Search' ||
291
+ resource.type === 'Neuron Search' ||
292
+ resource.type == 'Facet' ||
293
+ resource.type == 'Facets')
300
294
  );
301
295
  },
302
296
  // Get the species and andaotmy info for the featured datasets
303
297
  getDatasetAnatomyInfo: function (identifier) {
304
298
  fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${identifier}`)
305
- .then(response => response.json())
306
- .then(data => {
299
+ .then((response) => response.json())
300
+ .then((data) => {
307
301
  const resultPayload = data.result[0];
308
302
  let markerCurie;
309
303
  try {
310
304
  markerCurie = resultPayload.anatomy.organ[0].curie;
311
- } catch (error) {
305
+ } catch (_error) {
312
306
  markerCurie = undefined;
313
307
  }
314
308
  let markerDoi;
315
309
  try {
316
310
  markerDoi = resultPayload.item.curie;
317
- } catch (error) {
311
+ } catch (_error) {
318
312
  markerDoi = undefined;
319
313
  }
320
314
  let markerSpecies;
@@ -329,7 +323,7 @@ export default {
329
323
  }
330
324
  index += 1;
331
325
  }
332
- } catch (error) {
326
+ } catch (_error) {
333
327
  markerSpecies = undefined;
334
328
  }
335
329
  // can test the featured marker by uncommenting the line below:
@@ -344,8 +338,8 @@ export default {
344
338
  },
345
339
  // Check if the old featured dataset api has any info
346
340
  oldFeaturedDatasetApiHasInfo: async function () {
347
- let response = await fetch(`${this.apiLocation}get_featured_datasets_identifiers`)
348
- let data = await response.json()
341
+ let response = await fetch(`${this.apiLocation}get_featured_datasets_identifiers`);
342
+ let data = await response.json();
349
343
  if (!data.identifiers || data.identifiers.length == 0) {
350
344
  return false;
351
345
  } else {
@@ -354,12 +348,12 @@ export default {
354
348
  },
355
349
  // Check if the new featured dataset api has any info
356
350
  newFeaturedDatasetApiHasInfo: async function () {
357
- let response = await fetch(`${this.apiLocation}get_featured_dataset`)
358
- let data = await response.json()
351
+ let response = await fetch(`${this.apiLocation}get_featured_dataset`);
352
+ let data = await response.json();
359
353
  if (!data.datasets || data.datasets.length == 0) {
360
354
  return false;
361
355
  } else {
362
- return data.datasets.map(d => d.id);
356
+ return data.datasets.map((d) => d.id);
363
357
  }
364
358
  },
365
359
  flatmapResourceSelected: function (type, resources) {
@@ -369,20 +363,24 @@ export default {
369
363
  const { eventType, feature } = firstResource;
370
364
  const { viewingMode } = this.settingsStore.globalSettings;
371
365
 
372
- if (eventType === 'click' && feature.type === 'feature' && feature.models?.startsWith('ilxtr:')) {
366
+ if (
367
+ eventType === 'click' &&
368
+ feature.type === 'feature' &&
369
+ feature.models?.startsWith('ilxtr:')
370
+ ) {
373
371
  // Use only models data for GA tagging
374
372
  // There is character limit (100 characters) for event parameter value in GA
375
373
  const categories = [];
376
- resources.forEach(resource => {
374
+ resources.forEach((resource) => {
377
375
  const { models } = resource.feature;
378
376
  categories.push(models);
379
377
  });
380
378
 
381
379
  Tagging.sendEvent({
382
- 'event': 'interaction_event',
383
- 'event_name': 'portal_maps_connectivity',
384
- 'category': categories.join(', '),
385
- "location": type + ' ' + viewingMode
380
+ event: 'interaction_event',
381
+ event_name: 'portal_maps_connectivity',
382
+ category: categories.join(', '),
383
+ location: type + ' ' + viewingMode,
386
384
  });
387
385
  }
388
386
  },
@@ -401,8 +399,8 @@ export default {
401
399
  }
402
400
  // Update the store with the new list of featured datasets
403
401
  this.settingsStore.updateFeatured(datasetIds);
404
- datasetIds.forEach(element => {
405
- this.getDatasetAnatomyInfo(element)
402
+ datasetIds.forEach((element) => {
403
+ this.getDatasetAnatomyInfo(element);
406
404
  });
407
405
  },
408
406
  flatmapMarkerUpdate() {
@@ -411,20 +409,20 @@ export default {
411
409
  onResize: function () {
412
410
  return;
413
411
  },
414
- updateViewerSettings: function() {
412
+ updateViewerSettings: function () {
415
413
  return;
416
414
  },
417
415
  startHelp: function () {
418
416
  if (this?.alive) {
419
417
  if (this.isInHelp === false) {
420
418
  this.helpMode = true;
421
- window.addEventListener("mousedown", this.checkEndHelpMouseDown);
419
+ window.addEventListener('mousedown', this.checkEndHelpMouseDown);
422
420
  this.isInHelp = true;
423
421
  }
424
422
  }
425
423
  },
426
424
  endHelp: function () {
427
- window.removeEventListener("mousedown", this.checkEndHelpMouseDown);
425
+ window.removeEventListener('mousedown', this.checkEndHelpMouseDown);
428
426
  this.helpMode = false;
429
427
  setTimeout(() => {
430
428
  this.isInHelp = false;
@@ -485,9 +483,11 @@ export default {
485
483
 
486
484
  // to highlight connected paths
487
485
  if (globalSettings.highlightConnectedPaths) {
488
- const hoverEntry = hoverAnatomies.length ? hoverAnatomies :
489
- hoverConnectivity.length ? hoverConnectivity :
490
- []
486
+ const hoverEntry = hoverAnatomies.length
487
+ ? hoverAnatomies
488
+ : hoverConnectivity.length
489
+ ? hoverConnectivity
490
+ : [];
491
491
  const connectedPaths = await flatmap.retrieveConnectedPaths(hoverEntry);
492
492
  if (connectedPaths) {
493
493
  toHighlight.push(...connectedPaths);
@@ -505,9 +505,10 @@ export default {
505
505
  return toHighlight;
506
506
  },
507
507
  sidebarHoverHighlight: function (payload) {
508
- if (this.visible && (
509
- ((this.flatmapRef || this.multiflatmapRef) && this.flatmapReady) ||
510
- (this.scaffoldRef && this.scaffoldLoaded))
508
+ if (
509
+ this.visible &&
510
+ (((this.flatmapRef || this.multiflatmapRef) && this.flatmapReady) ||
511
+ (this.scaffoldRef && this.scaffoldLoaded))
511
512
  ) {
512
513
  const hoverAnatomies = this.settingsStore.hoverAnatomies;
513
514
  const hoverOrgans = this.settingsStore.hoverOrgans;
@@ -522,49 +523,56 @@ export default {
522
523
 
523
524
  // reset
524
525
  clearTimeout(this.highlightDelay);
525
- if (!hoverAnatomies.length && !hoverOrgans.length && !hoverDOI && !hoverConnectivity.length) {
526
+ if (
527
+ !hoverAnatomies.length &&
528
+ !hoverOrgans.length &&
529
+ !hoverDOI &&
530
+ !hoverConnectivity.length
531
+ ) {
526
532
  if ((this.multiflatmapRef || this.flatmapRef) && flatmap) {
527
533
  if (flatmap.mapImp && !flatmap.mapImp.contextLost) {
528
534
  flatmap.mapImp?.clearSearchResults();
529
535
  if (payload.connectivityProcessed) {
530
536
  // grey out all connectivity if no search results
531
- flatmap.mapImp?.setPaint({ dimmed: true })
537
+ flatmap.mapImp?.setPaint({ dimmed: true });
532
538
  }
533
539
  }
534
540
  } else if (this.scaffoldRef && scaffold) {
535
- scaffold.changeHighlightedByName(hoverOrgans, "", false);
541
+ scaffold.changeHighlightedByName(hoverOrgans, '', false);
536
542
  }
537
543
  }
538
544
 
539
545
  this.highlightDelay = setTimeout(() => {
540
546
  if (hoverAnatomies.length || hoverOrgans.length || hoverDOI || hoverConnectivity.length) {
541
547
  if ((this.multiflatmapRef || this.flatmapRef) && flatmap) {
542
- this.flatmapHighlight(flatmap, hoverAnatomies, hoverDOI, hoverConnectivity).then((paths) => {
543
- try {
544
- flatmap.showConnectivityTooltips({
545
- connectivityInfo: { featureId: paths },
546
- data: []
547
- });
548
- } catch (error) {
549
- console.log(error)
550
- // only for connectivity hover highlight
551
- if (hoverConnectivity.length && flatmap.mapImp) {
552
- const uuid = flatmap.mapImp.uuid;
553
- const found = paths.every((path) =>
554
- this.connectivityKnowledge[uuid].some((connectivity) =>
555
- connectivity.id === path
556
- )
557
- );
558
- if (!found) {
559
- if (flatmap.mapImp && !flatmap.mapImp.contextLost) {
560
- flatmap.mapImp.clearSearchResults();
548
+ this.flatmapHighlight(flatmap, hoverAnatomies, hoverDOI, hoverConnectivity).then(
549
+ (paths) => {
550
+ try {
551
+ flatmap.showConnectivityTooltips({
552
+ connectivityInfo: { featureId: paths },
553
+ data: [],
554
+ });
555
+ } catch (error) {
556
+ console.log(error);
557
+ // only for connectivity hover highlight
558
+ if (hoverConnectivity.length && flatmap.mapImp) {
559
+ const uuid = flatmap.mapImp.uuid;
560
+ const found = paths.every((path) =>
561
+ this.connectivityKnowledge[uuid].some(
562
+ (connectivity) => connectivity.id === path,
563
+ ),
564
+ );
565
+ if (!found) {
566
+ if (flatmap.mapImp && !flatmap.mapImp.contextLost) {
567
+ flatmap.mapImp.clearSearchResults();
568
+ }
561
569
  }
562
570
  }
563
571
  }
564
- }
565
- });
572
+ },
573
+ );
566
574
  } else if (this.scaffoldRef && scaffold) {
567
- scaffold.changeHighlightedByName(hoverOrgans, "", false);
575
+ scaffold.changeHighlightedByName(hoverOrgans, '', false);
568
576
  }
569
577
  }
570
578
  }, 100);
@@ -588,30 +596,30 @@ export default {
588
596
  onConnectivityInfoClose: function () {
589
597
  EventBus.emit('connectivity-info-close');
590
598
  },
591
- onSidebarAnnotationClose: function() {
599
+ onSidebarAnnotationClose: function () {
592
600
  return;
593
601
  },
594
602
  onNeuronConnectionFeatureClick: function (payload) {
595
603
  EventBus.emit('neuron-connection-feature-click', payload);
596
604
  },
597
- showConnectivity: function() {
605
+ showConnectivity: function () {
598
606
  return;
599
607
  },
600
608
  showConnectivityTooltips: function () {
601
609
  return;
602
610
  },
603
- setVisibilityFilter: function() {
611
+ setVisibilityFilter: function () {
604
612
  return;
605
613
  },
606
614
  loadExplorerConfig: async function () {
607
615
  this.flatmapService = await this.mockUpFlatmapService();
608
616
  this.loadConnectivityExplorerConfig(this.flatmapService);
609
617
  },
610
- mockUpFlatmapService: async function() {
618
+ mockUpFlatmapService: async function () {
611
619
  const flatmapResponse = await fetch(this.flatmapAPI);
612
620
  const flatmapJson = await flatmapResponse.json();
613
621
  const latestFlatmap = flatmapJson
614
- .filter(f => f.id === 'human-flatmap_male')
622
+ .filter((f) => f.id === 'human-flatmap_male')
615
623
  .sort((a, b) => b.created.localeCompare(a.created))[0];
616
624
  const flatmapUuid = latestFlatmap.uuid;
617
625
  const flatmapSource = latestFlatmap.sckan['knowledge-source'];
@@ -622,36 +630,37 @@ export default {
622
630
  this.flatmapQueries.initialise(this.flatmapAPI);
623
631
 
624
632
  const mapImp = {
625
- 'mapMetadata': {
626
- 'uuid': flatmapUuid,
627
- 'connectivity': {
633
+ mapMetadata: {
634
+ uuid: flatmapUuid,
635
+ connectivity: {
628
636
  ...latestFlatmap.sckan,
629
637
  },
630
638
  },
631
- 'pathways': pathwaysJson,
632
- 'resource': this.entry.resource,
639
+ pathways: pathwaysJson,
640
+ resource: this.entry.resource,
633
641
  knowledgeSource: flatmapSource,
634
- queryKnowledge : async (keastId) => {
635
- const sql = 'select knowledge from knowledge where (source=? or source is null) and entity=? order by source desc';
642
+ queryKnowledge: async (keastId) => {
643
+ const sql =
644
+ 'select knowledge from knowledge where (source=? or source is null) and entity=? order by source desc';
636
645
  const params = [flatmapSource, keastId];
637
646
  const response = await this.flatmapQueries.queryKnowledge(sql, params);
638
647
  return JSON.parse(response);
639
648
  },
640
- queryLabels : async (entities) => {
641
- const sql = `select source, entity, knowledge from knowledge where (source=? or source is null) and entity in (?${', ?'.repeat(entities.length-1)}) order by entity, source desc`;
649
+ queryLabels: async (entities) => {
650
+ const sql = `select source, entity, knowledge from knowledge where (source=? or source is null) and entity in (?${', ?'.repeat(entities.length - 1)}) order by entity, source desc`;
642
651
  const params = [flatmapSource, ...entities];
643
652
  const response = await this.flatmapQueries.queryKnowledge(sql, params);
644
653
  const entityLabels = [];
645
654
  let last_entity;
646
655
  for (const row of response) {
647
- if (row[1] !== last_entity) {
648
- const knowledge = JSON.parse(row[2]);
649
- entityLabels.push({
650
- entity: row[1],
651
- label: knowledge['label'] || row[1]
652
- })
653
- last_entity = row[1];
654
- }
656
+ if (row[1] !== last_entity) {
657
+ const knowledge = JSON.parse(row[2]);
658
+ entityLabels.push({
659
+ entity: row[1],
660
+ label: knowledge['label'] || row[1],
661
+ });
662
+ last_entity = row[1];
663
+ }
655
664
  }
656
665
  return entityLabels;
657
666
  },
@@ -660,16 +669,21 @@ export default {
660
669
  const scaffoldFilterOptions = getScaffoldFilterOptions();
661
670
  const combinedFilterOptions = async (flatmapImp, providedKnowledge) => {
662
671
  const providedPathways = undefined;
663
- const flatmapFilterOptions = await getFlatmapFilterOptions(this.flatmapAPI, flatmapImp, providedKnowledge, providedPathways);
672
+ const flatmapFilterOptions = await getFlatmapFilterOptions(
673
+ this.flatmapAPI,
674
+ flatmapImp,
675
+ providedKnowledge,
676
+ providedPathways,
677
+ );
664
678
  return [...scaffoldFilterOptions, ...flatmapFilterOptions];
665
679
  };
666
680
 
667
681
  return {
668
- 'mockup': true,
682
+ mockup: true,
669
683
  getFilterOptions: combinedFilterOptions,
670
684
  getTermNerveMaps: getTermNerveMaps,
671
- 'mapImp': mapImp,
672
- }
685
+ mapImp: mapImp,
686
+ };
673
687
  },
674
688
  loadConnectivityExplorerConfig: async function (flatmap) {
675
689
  const flatmapImp = flatmap.mapImp;
@@ -682,22 +696,28 @@ export default {
682
696
  this.flatmapQueries.initialise(this.flatmapAPI);
683
697
  const knowledge = await loadAndStoreKnowledge(flatmapImp, this.flatmapQueries);
684
698
  this.connectivityKnowledge[sckanVersion] = knowledge
685
- .filter(item => item.connectivity?.length)
699
+ .filter((item) => item.connectivity?.length)
686
700
  .sort((a, b) => a.label.localeCompare(b.label));
687
701
  }
688
702
  if (!this.connectivityKnowledge[uuid]) {
689
703
  const pathways = flatmapImp.pathways?.paths || {};
690
- this.connectivityKnowledge[uuid] = this.connectivityKnowledge[sckanVersion]
691
- .filter(item => item.id in pathways);
704
+ this.connectivityKnowledge[uuid] = this.connectivityKnowledge[sckanVersion].filter(
705
+ (item) => item.id in pathways,
706
+ );
692
707
  }
693
708
  if (!this.connectivityFilterOptions[uuid] && !flatmap.mockup) {
694
- this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(flatmapImp , this.connectivityKnowledge[uuid]);
709
+ this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(
710
+ flatmapImp,
711
+ this.connectivityKnowledge[uuid],
712
+ );
695
713
  }
696
714
  if (flatmap.mockup) {
697
715
  const nerveMaps = flatmap.getTermNerveMaps() || {};
698
716
  // deep copy the connectivity knowledge
699
717
  // to avoid modifying the original data
700
- const deepCopyConnectivityKnowledge = JSON.parse(JSON.stringify(this.connectivityKnowledge[uuid]));
718
+ const deepCopyConnectivityKnowledge = JSON.parse(
719
+ JSON.stringify(this.connectivityKnowledge[uuid]),
720
+ );
701
721
  this.connectivityKnowledge[uuid] = deepCopyConnectivityKnowledge
702
722
  .map((item) => {
703
723
  let payload = item;
@@ -711,28 +731,34 @@ export default {
711
731
  }, []);
712
732
  if (nerveLabels?.length) {
713
733
  validNerves.push(...nerveLabels);
714
- payload["nerve-label"] = nerveLabels.sort((a, b) => a.nerve.localeCompare(b.nerve));
734
+ payload['nerve-label'] = nerveLabels.sort((a, b) => a.nerve.localeCompare(b.nerve));
715
735
  }
716
736
  }
717
737
  return payload;
718
738
  })
719
- .filter((item) => item["nerve-label"]);
739
+ .filter((item) => item['nerve-label']);
720
740
 
721
741
  if (!this.connectivityFilterOptions[uuid]) {
722
- this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(flatmapImp , this.connectivityKnowledge[uuid]);
742
+ this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(
743
+ flatmapImp,
744
+ this.connectivityKnowledge[uuid],
745
+ );
723
746
  }
724
747
 
725
- validNerves = validNerves.map(nerve => nerve.nerve.toLowerCase());
726
- const deepCopyFilterOption = JSON.parse(JSON.stringify(this.connectivityFilterOptions[uuid]));
727
- this.connectivityFilterOptions[uuid] = deepCopyFilterOption
728
- .map((option) => {
729
- if (option.key === 'scaffold.connectivity.nerve') {
730
- const newChildren = option.children.filter((child) => validNerves.includes(child.label.toLowerCase()));
731
- return { ...option, children: newChildren };
732
- } else {
733
- return option;
734
- }
735
- })
748
+ validNerves = validNerves.map((nerve) => nerve.nerve.toLowerCase());
749
+ const deepCopyFilterOption = JSON.parse(
750
+ JSON.stringify(this.connectivityFilterOptions[uuid]),
751
+ );
752
+ this.connectivityFilterOptions[uuid] = deepCopyFilterOption.map((option) => {
753
+ if (option.key === 'scaffold.connectivity.nerve') {
754
+ const newChildren = option.children.filter((child) =>
755
+ validNerves.includes(child.label.toLowerCase()),
756
+ );
757
+ return { ...option, children: newChildren };
758
+ } else {
759
+ return option;
760
+ }
761
+ });
736
762
  } else {
737
763
  if (!this.connectivityFilterSources[uuid]) {
738
764
  this.connectivityFilterSources[uuid] = flatmap.getFilterSources();
@@ -744,13 +770,15 @@ export default {
744
770
  EventBus.emit('species-layout-connectivity-update');
745
771
  },
746
772
  knowledgeTooltipQuery: async function (data) {
747
- await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.flatmapService.mapImp, { resource: [data.id] });
773
+ await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.flatmapService.mapImp, {
774
+ resource: [data.id],
775
+ });
748
776
  let tooltip = await this.flatmapQueries.createTooltipData(this.flatmapService.mapImp, {
749
777
  resource: [data.id],
750
778
  label: data.label,
751
779
  provenanceTaxonomy: data.taxons,
752
- feature: []
753
- })
780
+ feature: [],
781
+ });
754
782
  tooltip['knowledgeSource'] = getKnowledgeSource(this.flatmapService.mapImp);
755
783
  tooltip['mapId'] = this.flatmapService.mapImp.mapMetadata.id;
756
784
  tooltip['mapuuid'] = this.flatmapService.mapImp.mapMetadata.uuid;
@@ -760,7 +788,9 @@ export default {
760
788
  },
761
789
  getKnowledgeTooltip: async function (payload) {
762
790
  this.tooltipEntry = [];
763
- payload.data.forEach(d => this.tooltipEntry.push({ title: d.label, featureId: [d.id], ready: false }));
791
+ payload.data.forEach((d) =>
792
+ this.tooltipEntry.push({ title: d.label, featureId: [d.id], ready: false }),
793
+ );
764
794
  EventBus.emit('connectivity-info-open', this.tooltipEntry);
765
795
 
766
796
  let prom1 = [];
@@ -769,7 +799,7 @@ export default {
769
799
  prom1.push(await this.knowledgeTooltipQuery(payload.data[index]));
770
800
  }
771
801
  this.tooltipEntry = await Promise.all(prom1);
772
- const featureIds = this.tooltipEntry.map(tooltip => tooltip.featureId[0]);
802
+ const featureIds = this.tooltipEntry.map((tooltip) => tooltip.featureId[0]);
773
803
  if (featureIds.length > 0) {
774
804
  EventBus.emit('connectivity-info-open', this.tooltipEntry);
775
805
  }
@@ -779,13 +809,17 @@ export default {
779
809
  const flatmapUUID = this?.flatmapService?.mapImp?.mapMetadata.uuid;
780
810
  if (!ongoingSource.includes(flatmapUUID)) {
781
811
  ongoingSource.push(flatmapUUID);
782
- await this.flatmapQueries.queryForConnectivityNew(this.flatmapService.mapImp, entry.featureId[0], connectivitySource);
812
+ await this.flatmapQueries.queryForConnectivityNew(
813
+ this.flatmapService.mapImp,
814
+ entry.featureId[0],
815
+ connectivitySource,
816
+ );
783
817
  this.tooltipEntry = this.tooltipEntry.map((tooltip) => {
784
818
  if (tooltip.featureId[0] === entry.featureId[0]) {
785
819
  return this.flatmapQueries.updateTooltipData(tooltip);
786
820
  }
787
821
  return tooltip;
788
- })
822
+ });
789
823
  EventBus.emit('connectivity-info-open', this.tooltipEntry);
790
824
  }
791
825
  },
@@ -810,8 +844,8 @@ export default {
810
844
  const connectivities = uuid ? this.connectivitiesStore?.globalConnectivities?.[uuid] : null;
811
845
 
812
846
  // Make features unique by it's id.
813
- const uniqueFeatures = features.filter((feature, index, self) =>
814
- index === self.findIndex((f) => f.id === feature.id)
847
+ const uniqueFeatures = features.filter(
848
+ (feature, index, self) => index === self.findIndex((f) => f.id === feature.id),
815
849
  );
816
850
 
817
851
  for (const feature of uniqueFeatures) {
@@ -822,12 +856,10 @@ export default {
822
856
  }
823
857
  // Look up long-label from the connectivity store
824
858
  if (connectivities) {
825
- const match = connectivities.find(c => c.id === featureId);
859
+ const match = connectivities.find((c) => c.id === featureId);
826
860
  const truncate = this.truncateLongLabel?.value ?? this.truncateLongLabel;
827
861
  const lineClamp = 3;
828
- const withIdStyles = [
829
- `margin-bottom: 4px`,
830
- ];
862
+ const withIdStyles = [`margin-bottom: 4px`];
831
863
  const truncateStyles = [
832
864
  `display: -webkit-box`,
833
865
  `-webkit-line-clamp: ${lineClamp}`,
@@ -836,11 +868,11 @@ export default {
836
868
  ];
837
869
  const styles = [
838
870
  ...(this.showIdInTooltip ? withIdStyles : []),
839
- ...(truncate ? truncateStyles : [])
871
+ ...(truncate ? truncateStyles : []),
840
872
  ].join(';');
841
873
 
842
874
  if (match && match['long-label']) {
843
- let labelTag = []
875
+ let labelTag = [];
844
876
  labelTag.push(`<div style="${styles}">${capitalise(match['long-label'])}</div>`);
845
877
  if (this.showIdInTooltip) {
846
878
  labelTag.push(`<span class="id-tag">${featureId}</span>`);
@@ -863,9 +895,9 @@ export default {
863
895
  activeSpecies: defaultSpecies,
864
896
  scaffoldCamera: undefined,
865
897
  mainStyle: {
866
- height: this.entry.datasetTitle ? "calc(100% - 30px)" : "100%",
867
- width: "100%",
868
- bottom: "0px",
898
+ height: this.entry.datasetTitle ? 'calc(100% - 30px)' : '100%',
899
+ width: '100%',
900
+ bottom: '0px',
869
901
  },
870
902
  helpMode: false,
871
903
  helpModeActiveItem: 0,
@@ -892,10 +924,8 @@ export default {
892
924
  created: function () {
893
925
  this.flatmapAPI = undefined;
894
926
  this.apiLocation = undefined;
895
- if (this.settingsStore.flatmapAPI)
896
- this.flatmapAPI = this.settingsStore.flatmapAPI;
897
- if (this.settingsStore.sparcApi)
898
- this.apiLocation = this.settingsStore.sparcApi;
927
+ if (this.settingsStore.flatmapAPI) this.flatmapAPI = this.settingsStore.flatmapAPI;
928
+ if (this.settingsStore.sparcApi) this.apiLocation = this.settingsStore.sparcApi;
899
929
  if (this.settingsStore.mapManager) {
900
930
  this.mapManager = this.settingsStore.mapManager;
901
931
  }
@@ -905,6 +935,6 @@ export default {
905
935
  if (!newVal) {
906
936
  this.helpModeActiveItem = 0;
907
937
  }
908
- }
938
+ },
909
939
  },
910
940
  };