@abi-software/mapintegratedvuer 1.16.3 → 1.17.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/mapintegratedvuer",
3
- "version": "1.16.3",
3
+ "version": "1.17.0",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -52,12 +52,12 @@
52
52
  "*.js"
53
53
  ],
54
54
  "dependencies": {
55
- "@abi-software/flatmapvuer": "1.12.2",
56
- "@abi-software/map-side-bar": "2.13.0",
57
- "@abi-software/map-utilities": "1.7.7",
55
+ "@abi-software/flatmapvuer": "1.13.0",
56
+ "@abi-software/map-side-bar": "2.14.0",
57
+ "@abi-software/map-utilities": "1.8.0",
58
58
  "@abi-software/plotvuer": "1.0.7",
59
- "@abi-software/scaffoldvuer": "1.13.1-beta.2",
60
- "@abi-software/simulationvuer": "3.0.9",
59
+ "@abi-software/scaffoldvuer": "1.14.0",
60
+ "@abi-software/simulationvuer": "3.0.15",
61
61
  "@abi-software/sparc-annotation": "0.3.2",
62
62
  "@abi-software/svg-sprite": "1.0.4",
63
63
  "@element-plus/icons-vue": "^2.3.1",
package/src/App.vue CHANGED
@@ -24,6 +24,7 @@
24
24
  <el-button @click="setWholebody()" size="small">Set to Wholebody</el-button>
25
25
  <el-button @click="setFlatmap()" size="small">Set Flatmap</el-button>
26
26
  <el-button @click="setSearch()" size="small">Set Search</el-button>
27
+ <el-button @click="toggleLongLabel()" size="small">Toggle Long Label</el-button>
27
28
  </div>
28
29
  </div>
29
30
  <template #reference>
@@ -40,6 +41,7 @@
40
41
  :startingMap="startingMap"
41
42
  :options="options"
42
43
  :state="state"
44
+ :showLongLabel="showLongLabel"
43
45
  :shareLink="shareLink"
44
46
  :useHelpModeDialog="true"
45
47
  :connectivityInfoSidebar="true"
@@ -158,6 +160,7 @@ export default {
158
160
  startingMap: "AC",
159
161
  ElIconSetting: shallowRef(ElIconSetting),
160
162
  routerIsReady: false,
163
+ showLongLabel: true,
161
164
  }
162
165
  },
163
166
  computed: {
@@ -309,6 +312,9 @@ export default {
309
312
  setSearch: function() {
310
313
  this.$refs.map.openSearch([], "10.26275/1uno-tynt");
311
314
  },
315
+ toggleLongLabel: function() {
316
+ this.showLongLabel = !this.showLongLabel;
317
+ },
312
318
  mapIsLoaded: function(map) {
313
319
  console.log("map is loaded", map)
314
320
  // map.changeViewingMode('Annotation')
@@ -49,6 +49,7 @@ import { useSplitFlowStore } from '../stores/splitFlow';
49
49
  const Flatmap = defineAsyncComponent(() => import("./viewers/Flatmap.vue"));
50
50
  const Iframe = defineAsyncComponent(() => import("./viewers/Iframe.vue"));
51
51
  const MultiFlatmap = defineAsyncComponent(() => import("./viewers/MultiFlatmap.vue"));
52
+ const ConnectivityGraph = defineAsyncComponent(() => import("./viewers/ConnectivityGraph.vue"));
52
53
  const Plot = defineAsyncComponent(() => import("./viewers/Plot.vue"));
53
54
  const Scaffold = defineAsyncComponent(() => import("./viewers/Scaffold.vue"));
54
55
  const Simulation = defineAsyncComponent(() => import("./viewers/Simulation.vue"));
@@ -70,6 +71,7 @@ export default {
70
71
  //DatasetHeader,
71
72
  Button,
72
73
  ContentBar,
74
+ ConnectivityGraph,
73
75
  Flatmap,
74
76
  Iframe,
75
77
  MultiFlatmap,
@@ -157,7 +159,9 @@ export default {
157
159
  this.$refs.viewer?.setVisibilityFilter(payload);
158
160
  },
159
161
  onLoadConnectivityDetail: function(payload) {
160
- this.$refs.viewer?.getKnowledgeTooltip(payload);
162
+ if (this.$refs.viewer?.entry.type !== 'ConnectivityGraph') {
163
+ this.$refs.viewer?.getKnowledgeTooltip(payload);
164
+ }
161
165
  },
162
166
  toggleMinimap: function(option, prevState) {
163
167
  this.$refs.viewer?.toggleMinimap(option, prevState);
@@ -11,6 +11,7 @@
11
11
  v-if="isReady"
12
12
  @onFullscreen="onFullscreen"
13
13
  :state="stateToSet"
14
+ :showLongLabel="showLongLabel"
14
15
  ref="flow"
15
16
  @vue:mounted="flowMounted"
16
17
  />
@@ -59,6 +60,10 @@ export default {
59
60
  type: Object,
60
61
  default: undefined
61
62
  },
63
+ showLongLabel: {
64
+ type: Boolean,
65
+ default: true,
66
+ },
62
67
  /**
63
68
  * The options include APIs and Keys.
64
69
  */
@@ -203,12 +203,11 @@ export default {
203
203
 
204
204
  // mix connectivites of available maps
205
205
  if (uuids.length) {
206
- this.connectivitiesStore.updateActiveConnectivityKeys(uuids);
207
-
208
- // emit connectivity-knowledge event will be at connectivityQueryFilter
209
-
210
- const uniqueFilters = this.connectivitiesStore.getUniqueFilterOptionsByKeys;
211
- EventBus.emit("connectivity-filter-options", uniqueFilters);
206
+ // emit connectivity-knowledge event only if active connectivity keys are updated
207
+ if (this.connectivitiesStore.updateActiveConnectivityKeys(uuids)) {
208
+ const uniqueFilters = this.connectivitiesStore.getUniqueFilterOptionsByKeys;
209
+ EventBus.emit("connectivity-filter-options", uniqueFilters);
210
+ }
212
211
  } else {
213
212
  const connectivityData = this.connectivitiesStore.globalConnectivities[sckanVersion] || [];
214
213
  EventBus.emit("connectivity-knowledge", {
@@ -30,6 +30,7 @@
30
30
  :connectivityKnowledge="connectivityKnowledge"
31
31
  :filterOptions="filterOptions"
32
32
  :showVisibilityFilter="showVisibilityFilter"
33
+ :showLongLabel="showLongLabel"
33
34
  @tabClicked="onSidebarTabClicked"
34
35
  @tabClosed="onSidebarTabClosed"
35
36
  @actionClick="actionClick"
@@ -48,6 +49,7 @@
48
49
  @connectivity-hovered="onConnectivityHovered"
49
50
  @connectivity-collapse-change="onConnectivityCollapseChange"
50
51
  @connectivity-source-change="onConnectivitySourceChange"
52
+ @show-connectivity-graph="onShowConnectivityGraph"
51
53
  @filter-visibility="onFilterVisibility"
52
54
  @connectivity-item-close="onConnectivityItemClose"
53
55
  @trackEvent="trackEvent"
@@ -146,7 +148,11 @@ export default {
146
148
  state: {
147
149
  type: Object,
148
150
  default: undefined,
149
- }
151
+ },
152
+ showLongLabel: {
153
+ type: Boolean,
154
+ default: true,
155
+ },
150
156
  },
151
157
  data: function () {
152
158
  return {
@@ -480,9 +486,25 @@ export default {
480
486
  if (entry.ready) {
481
487
  result['nerve-label'] = entry['nerve-label'] || ck['nerve-label'];
482
488
  }
489
+ if (ck && ck['long-label']) {
490
+ result['long-label'] = ck['long-label'];
491
+ }
483
492
  return result;
484
493
  });
485
494
 
495
+ // Fetch long-label from global connectivities if not exist in the payload,
496
+ // this is for the case when user click on the flatmap paths/features directly without going through sidebar list,
497
+ // which will only have id and label in the payload
498
+ if (!this.connectivityEntry[0]['long-label'] && this.connectivityEntry[0].mapuuid) {
499
+ const connectivityData = this.connectivitiesStore.globalConnectivities[this.connectivityEntry[0].mapuuid] || [];
500
+ if (connectivityData.length) {
501
+ const ck = connectivityData.find(ck => ck.id === this.connectivityEntry[0].id);
502
+ if (ck && ck['long-label']) {
503
+ this.connectivityEntry[0]['long-label'] = ck['long-label'];
504
+ }
505
+ }
506
+ }
507
+
486
508
  if (this.connectivityExplorerClicked.length) {
487
509
  // only remove clicked if not placeholder entry
488
510
  if (this.connectivityEntry.every(entry => entry.ready)) {
@@ -571,6 +593,38 @@ export default {
571
593
  this.connectivityExplorerClicked.push(true);
572
594
  EventBus.emit('connectivity-source-change', data);
573
595
  },
596
+ onShowConnectivityGraph: function (data) {
597
+ const previousPrimaryId = this.splitFlowStore.customLayout?.['pane-1']?.id;
598
+ const connectivityGraphId = this.createNewEntry({
599
+ resource: data.entry,
600
+ type: 'ConnectivityGraph',
601
+ label: data.title || data.label || data.entry ||'Connectivity Graph',
602
+ graphPayload: { ...data },
603
+ mapServer: this.settingsStore.flatmapAPI,
604
+ sckanVersion: data.sckanVersion,
605
+ });
606
+
607
+ this.splitFlowStore.updateActiveView({
608
+ view: '2vertpanel',
609
+ entries: this.entries,
610
+ }, false);
611
+
612
+ if (previousPrimaryId && previousPrimaryId !== connectivityGraphId) {
613
+ this.splitFlowStore.assignOrSwapPaneWithIds({
614
+ source: connectivityGraphId,
615
+ target: previousPrimaryId,
616
+ }, false);
617
+ }
618
+
619
+ const secondPaneId = this.splitFlowStore.customLayout?.['pane-2']?.id;
620
+ if (secondPaneId && secondPaneId !== connectivityGraphId) {
621
+ this.splitFlowStore.assignOrSwapPaneWithIds({
622
+ source: connectivityGraphId,
623
+ target: secondPaneId,
624
+ }, false);
625
+ }
626
+ this.splitFlowStore.updateSplitPanels();
627
+ },
574
628
  hoverChanged: function (data) {
575
629
  let hoverAnatomies = [], hoverOrgans = [], hoverDOI = '', hoverConnectivity = [];
576
630
  if (data.tabType === 'dataset') {
@@ -50,6 +50,15 @@ const getNewMapEntry = async (type, sparcApi) => {
50
50
  version: data.datasetInfo.version,
51
51
  isBodyScaffold: true,
52
52
  };
53
+ } else if (type === "CG") {
54
+ entry = {
55
+ resource: "ConnectivityGraph",
56
+ type: "ConnectivityGraph",
57
+ mode: "main",
58
+ state: undefined,
59
+ label: "Connectivity Graph",
60
+ discoverId: undefined
61
+ }
53
62
  }
54
63
 
55
64
  return entry;
@@ -190,7 +199,13 @@ const transformStringToObj = (str) => {
190
199
  return obj;
191
200
  };
192
201
 
202
+ const listsAreEqual = (a, b) => {
203
+ if (a.length !== b.length) return false;
204
+ return JSON.stringify([...a].sort()) === JSON.stringify([...b].sort());
205
+ };
206
+
193
207
  export {
208
+ listsAreEqual,
194
209
  availableSpecies,
195
210
  capitalise,
196
211
  findSpeciesKey,
@@ -0,0 +1,146 @@
1
+ <template>
2
+ <div class="viewer-container">
3
+ <MapUtilitiesConnectivityGraph
4
+ :entry="graphEntry"
5
+ :mapServer="mapServer"
6
+ :sckanVersion="sckanVersion"
7
+ :connectivityFromMap="connectivityFromMap"
8
+ :connectivityError="connectivityError"
9
+ :origins="origins"
10
+ :components="components"
11
+ :destinations="destinations"
12
+ :originsWithDatasets="originsWithDatasets"
13
+ :componentsWithDatasets="componentsWithDatasets"
14
+ :destinationsWithDatasets="destinationsWithDatasets"
15
+ :hasSingleConnectivityList="hasSingleConnectivityList"
16
+ :originsCombinations="originsCombinations"
17
+ :componentsCombinations="componentsCombinations"
18
+ :destinationsCombinations="destinationsCombinations"
19
+ @tap-node="onTapNode"
20
+ />
21
+ </div>
22
+ </template>
23
+
24
+ <script>
25
+ /* eslint-disable no-alert, no-console */
26
+ import {
27
+ ConnectivityGraph as MapUtilitiesConnectivityGraph,
28
+ } from '@abi-software/map-utilities';
29
+ import ContentMixin from "../../mixins/ContentMixin";
30
+ import EventBus from '../EventBus';
31
+
32
+ export default {
33
+ name: "ConnectivityGraph",
34
+ mixins: [ ContentMixin ],
35
+ components: {
36
+ MapUtilitiesConnectivityGraph,
37
+ },
38
+ computed: {
39
+ graphEntry() {
40
+ return this.entry.resource;
41
+ },
42
+ connectivityError() {
43
+ return {};
44
+ },
45
+ connectivityFromMap() {
46
+ return this.entry.graphPayload?.connectivityFromMap || null;
47
+ },
48
+ origins() {
49
+ return this.entry.graphPayload?.origins || [];
50
+ },
51
+ components() {
52
+ return this.entry.graphPayload?.components || [];
53
+ },
54
+ destinations() {
55
+ return this.entry.graphPayload?.destinations || [];
56
+ },
57
+ originsWithDatasets() {
58
+ return this.entry.graphPayload?.originsWithDatasets || [];
59
+ },
60
+ componentsWithDatasets() {
61
+ return this.entry.graphPayload?.componentsWithDatasets || [];
62
+ },
63
+ destinationsWithDatasets() {
64
+ return this.entry.graphPayload?.destinationsWithDatasets || [];
65
+ },
66
+ hasSingleConnectivityList() {
67
+ return this.entry.graphPayload?.hasSingleConnectivityList || false;
68
+ },
69
+ originsCombinations() {
70
+ return this.entry.graphPayload?.originsCombinations || [];
71
+ },
72
+ componentsCombinations() {
73
+ return this.entry.graphPayload?.componentsCombinations || [];
74
+ },
75
+ destinationsCombinations() {
76
+ return this.entry.graphPayload?.destinationsCombinations || [];
77
+ },
78
+ mapServer() {
79
+ return this.entry.mapServer || null;
80
+ },
81
+ sckanVersion() {
82
+ return this.entry.sckanVersion || null;
83
+ },
84
+ },
85
+ methods: {
86
+ onTapNode: function (data) {
87
+ const name = data.map(t => t.label).join(', ');
88
+ this.onConnectivityHovered(name);
89
+
90
+ // Hover outside of node area
91
+ if (!name) {
92
+ EventBus.emit('show-connectivity', {
93
+ featureIds: [this.entry.resource]
94
+ });
95
+ }
96
+
97
+ },
98
+ onConnectivityHovered: function (label) {
99
+ const payload = {
100
+ connectivityInfo: this.graphEntry,
101
+ label: label,
102
+ data: label ? this.getConnectivityDatasets(label) : [],
103
+ };
104
+ EventBus.emit('connectivity-hovered', payload);
105
+ },
106
+ getConnectivityDatasets: function (label) {
107
+ const allWithDatasets = this.entry.graphPayload?.allWithDatasets || [];
108
+ const names = label.split(',');
109
+ let data = [];
110
+ names.forEach((n) => {
111
+ const foundData = allWithDatasets.find((a) =>
112
+ a.name.toLowerCase().trim() === n.toLowerCase().trim()
113
+ );
114
+ if (foundData) {
115
+ data.push({
116
+ id: foundData.id,
117
+ label: foundData.name
118
+ });
119
+ }
120
+ });
121
+ return data
122
+ },
123
+ },
124
+ };
125
+ </script>
126
+
127
+ <style scoped lang="scss">
128
+ .viewer-container {
129
+ width: 100%;
130
+ height: 100%;
131
+ box-sizing: border-box;
132
+
133
+ .connectivity-graph {
134
+ width: 100%;
135
+ height: 100%;
136
+ box-shadow: none;
137
+ border: none;
138
+ border-radius: 0;
139
+
140
+ :deep(.graph-canvas) {
141
+ width: 100%;
142
+ height: 100%;
143
+ }
144
+ }
145
+ }
146
+ </style>
@@ -88,6 +88,10 @@ const getOpenMapOptions = (species) => {
88
88
  display: "Open 3D Human Map",
89
89
  key: "3D"
90
90
  },
91
+ {
92
+ display: "Open Connectivity Graph",
93
+ key: "CG"
94
+ },
91
95
  ]
92
96
  return options;
93
97
  }
@@ -228,9 +232,6 @@ export default {
228
232
  this.speciesHasChanged = true;
229
233
  }
230
234
  }
231
-
232
-
233
-
234
235
  // GA Tagging
235
236
  // Event tracking for maps' species change
236
237
  Tagging.sendEvent({
@@ -270,6 +271,9 @@ export default {
270
271
  };
271
272
  EventBus.emit("PopoverActionClick", returnedAction);
272
273
  },
274
+ flatmapIsReady() {
275
+ return this.flatmapReady;
276
+ },
273
277
  restoreFeaturedMarkers: function (flatmap) {
274
278
 
275
279
  this.settingsStore.resetFeaturedMarkerIdentifier();
@@ -464,4 +468,4 @@ export default {
464
468
 
465
469
  </style>
466
470
 
467
- <style src="../../assets/mapicon-species-style.css"></style>
471
+ <style src="../../assets/mapicon-species-style.css"></style>
@@ -7,6 +7,7 @@ export {}
7
7
 
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
+ ConnectivityGraph: typeof import('./components/viewers/ConnectivityGraph.vue')['default']
10
11
  ContentBar: typeof import('./components/ContentBar.vue')['default']
11
12
  ContentVuer: typeof import('./components/ContentVuer.vue')['default']
12
13
  ContextCard: typeof import('./components/ContextCard.vue')['default']
@@ -81,7 +81,7 @@ export default {
81
81
  },
82
82
  methods: {
83
83
  toggleMinimap: function (option, prevState) {
84
- if (this.multiflatmapRef) {
84
+ if (this.multiflatmapRef && this.flatmapIsReady()) {
85
85
  const currentFlatmap = this.multiflatmapRef.getCurrentFlatmap();
86
86
  const mapImp = currentFlatmap?.mapImp;
87
87
  if (mapImp) {
@@ -1,4 +1,5 @@
1
1
  import { defineStore } from 'pinia';
2
+ import { listsAreEqual } from "../components/scripts/utilities";
2
3
 
3
4
  export const useConnectivitiesStore = defineStore('connectivities', {
4
5
  state: () => {
@@ -70,7 +71,11 @@ export const useConnectivitiesStore = defineStore('connectivities', {
70
71
  },
71
72
  actions: {
72
73
  updateActiveConnectivityKeys(activeConnectivityKeys) {
73
- this.activeConnectivityKeys = activeConnectivityKeys;
74
+ if (!listsAreEqual(this.activeConnectivityKeys, activeConnectivityKeys)) {
75
+ this.activeConnectivityKeys = activeConnectivityKeys;
76
+ return true;
77
+ }
78
+ return false;
74
79
  },
75
80
  updateGlobalConnectivities(globalConnectivities) {
76
81
  this.globalConnectivities = globalConnectivities;
@@ -89,7 +89,7 @@ const autoAssignEntryIdsToPane = (entries, layout) => {
89
89
  if (value.content) {
90
90
  if ((1 > value.id) || assignedIds.includes(value.id)) {
91
91
  //id has got an assigned pane or pane contains an invalid id,
92
- //cache it and find one later
92
+ //cache it and find one later
93
93
  invalidIdKeys.push(key);
94
94
  } else {
95
95
  assignedIds.push(value.id);
@@ -221,7 +221,7 @@ export const useSplitFlowStore = defineStore('splitFlow', {
221
221
  },
222
222
  },
223
223
  actions: {
224
- assignOrSwapPaneWithIds(payload) {
224
+ assignOrSwapPaneWithIds(payload, emitSpeciesChanged = true) {
225
225
  let sourceKey = findKeyWithId(this.customLayout, payload.source);
226
226
  let targetKey = findKeyWithId(this.customLayout, payload.target);
227
227
  if (targetKey) {
@@ -230,7 +230,9 @@ export const useSplitFlowStore = defineStore('splitFlow', {
230
230
  if (sourceKey) {
231
231
  this.customLayout[sourceKey].id = payload.target;
232
232
  }
233
- this.updateSplitPanels();
233
+ if (emitSpeciesChanged) {
234
+ this.updateSplitPanels();
235
+ }
234
236
  },
235
237
  getAvailableTerms(apiLocation) {
236
238
  let terms = getAvailableTermsForSpecies();
@@ -255,7 +257,7 @@ export const useSplitFlowStore = defineStore('splitFlow', {
255
257
  });
256
258
  }
257
259
  },
258
- updateActiveView(payload) {
260
+ updateActiveView(payload, emitSpeciesChanged = true) {
259
261
  this.activeView = payload.view;
260
262
  const customLayout = newLayoutWithOrigInfo(
261
263
  this.customLayout, this.activeView);
@@ -263,7 +265,9 @@ export const useSplitFlowStore = defineStore('splitFlow', {
263
265
  for (const [key, value] of Object.entries(customLayout)) {
264
266
  this.customLayout[key] = value;
265
267
  }
266
- this.updateSplitPanels();
268
+ if (emitSpeciesChanged) {
269
+ this.updateSplitPanels();
270
+ }
267
271
  },
268
272
  setSplitter(payload) {
269
273
  if (this.splitters[payload.name])