@abi-software/flatmapvuer 1.6.1 → 1.6.2-beta.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/dist/flatmapvuer.js +13869 -13799
- package/dist/flatmapvuer.umd.cjs +93 -93
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/components/FlatmapVuer.vue +120 -109
- package/src/components/MultiFlatmapVuer.vue +34 -2
- package/src/store/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2-beta.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"./src/*": "./src/*"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@abi-software/flatmap-viewer": "^3.2.
|
|
47
|
-
"@abi-software/map-utilities": "^1.2.
|
|
46
|
+
"@abi-software/flatmap-viewer": "^3.2.8",
|
|
47
|
+
"@abi-software/map-utilities": "^1.2.2-beta.0",
|
|
48
48
|
"@abi-software/sparc-annotation": "0.3.2",
|
|
49
49
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
50
50
|
"@element-plus/icons-vue": "^2.3.1",
|
|
@@ -152,7 +152,6 @@ Please use `const` to assign meaningful names to them...
|
|
|
152
152
|
class: '.maplibregl-canvas',
|
|
153
153
|
}"
|
|
154
154
|
:toolbarOptions="toolbarOptions"
|
|
155
|
-
:drawnType="drawnType"
|
|
156
155
|
:activeDrawTool="activeDrawTool"
|
|
157
156
|
:activeDrawMode="activeDrawMode"
|
|
158
157
|
:newlyDrawnEntry="drawnCreatedEvent"
|
|
@@ -260,7 +259,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
260
259
|
<div
|
|
261
260
|
class="pathway-location"
|
|
262
261
|
:class="{ open: drawerOpen, close: !drawerOpen }"
|
|
263
|
-
v-show="!disableUI"
|
|
262
|
+
v-show="!disableUI && requiresDrawer"
|
|
264
263
|
>
|
|
265
264
|
<div
|
|
266
265
|
class="pathway-container"
|
|
@@ -270,27 +269,27 @@ Please use `const` to assign meaningful names to them...
|
|
|
270
269
|
>
|
|
271
270
|
<svg-legends v-if="!isFC" class="svg-legends-container" />
|
|
272
271
|
<template v-if="showStarInLegend">
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
272
|
+
<el-popover
|
|
273
|
+
content="Location of the featured dataset"
|
|
274
|
+
placement="right"
|
|
275
|
+
:teleported="true"
|
|
276
|
+
trigger="manual"
|
|
277
|
+
width="max-content"
|
|
278
|
+
:offset="-10"
|
|
279
|
+
popper-class="flatmap-popper flatmap-teleport-popper"
|
|
280
|
+
:visible="hoverVisibilities[9].value"
|
|
281
|
+
ref="featuredMarkerPopover"
|
|
282
|
+
>
|
|
283
|
+
<template #reference>
|
|
284
|
+
<div
|
|
285
|
+
v-popover:featuredMarkerPopover
|
|
286
|
+
class="yellow-star-legend"
|
|
287
|
+
v-html="yellowstar"
|
|
288
|
+
@mouseover="showTooltip(9)"
|
|
289
|
+
@mouseout="hideTooltip(9)"
|
|
290
|
+
></div>
|
|
291
|
+
</template>
|
|
292
|
+
</el-popover>
|
|
294
293
|
</template>
|
|
295
294
|
<!-- The line below places the yellowstar svg on the left, and the text "Featured markers on the right" with css so they are both centered in the div -->
|
|
296
295
|
<el-popover
|
|
@@ -454,44 +453,22 @@ Please use `const` to assign meaningful names to them...
|
|
|
454
453
|
</template>
|
|
455
454
|
</div>
|
|
456
455
|
<el-row class="viewing-mode-description">
|
|
457
|
-
{{
|
|
456
|
+
{{ modeDescription }}
|
|
458
457
|
</el-row>
|
|
459
458
|
</el-row>
|
|
460
459
|
<template v-if="viewingMode === 'Annotation' && userInformation">
|
|
461
|
-
<el-row class="backgroundText">
|
|
462
|
-
<el-row class="backgroundControl">
|
|
463
|
-
<el-select
|
|
464
|
-
:teleported="false"
|
|
465
|
-
v-model="drawnType"
|
|
466
|
-
placeholder="Select"
|
|
467
|
-
class="select-box"
|
|
468
|
-
popper-class="flatmap_dropdown"
|
|
469
|
-
@change="setDrawnType"
|
|
470
|
-
>
|
|
471
|
-
<el-option
|
|
472
|
-
v-for="item in drawnTypes"
|
|
473
|
-
:key="item"
|
|
474
|
-
:label="item"
|
|
475
|
-
:value="item"
|
|
476
|
-
>
|
|
477
|
-
<el-row>
|
|
478
|
-
<el-col :span="12">{{ item }}</el-col>
|
|
479
|
-
</el-row>
|
|
480
|
-
</el-option>
|
|
481
|
-
</el-select>
|
|
482
|
-
</el-row>
|
|
483
|
-
<el-row class="backgroundText">Annotated By*</el-row>
|
|
460
|
+
<el-row class="backgroundText">Annotations From</el-row>
|
|
484
461
|
<el-row class="backgroundControl">
|
|
485
462
|
<el-select
|
|
486
463
|
:teleported="false"
|
|
487
|
-
v-model="
|
|
464
|
+
v-model="annotationFrom"
|
|
488
465
|
placeholder="Select"
|
|
489
466
|
class="select-box"
|
|
490
467
|
popper-class="flatmap_dropdown"
|
|
491
|
-
@change="
|
|
468
|
+
@change="setAnnotationFrom"
|
|
492
469
|
>
|
|
493
470
|
<el-option
|
|
494
|
-
v-for="item in
|
|
471
|
+
v-for="item in annotatedSource"
|
|
495
472
|
:key="item"
|
|
496
473
|
:label="item"
|
|
497
474
|
:value="item"
|
|
@@ -885,8 +862,7 @@ export default {
|
|
|
885
862
|
}
|
|
886
863
|
this.doubleClickedFeature = false
|
|
887
864
|
}
|
|
888
|
-
}
|
|
889
|
-
if (this.activeDrawMode === 'Delete') {
|
|
865
|
+
} else if (this.activeDrawMode === 'Delete') {
|
|
890
866
|
this.changeAnnotationDrawMode({
|
|
891
867
|
mode: 'simple_select',
|
|
892
868
|
options: { featureIds: [data.feature.feature.id] }
|
|
@@ -1015,12 +991,6 @@ export default {
|
|
|
1015
991
|
let drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
|
|
1016
992
|
// The annotator has `resource` and `features` fields
|
|
1017
993
|
if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
|
|
1018
|
-
// Use to switch the displayed feature type
|
|
1019
|
-
if (this.drawnType !== 'All tools') {
|
|
1020
|
-
drawnFeatures = drawnFeatures.filter((feature) => {
|
|
1021
|
-
return feature.geometry.type === this.drawnType
|
|
1022
|
-
})
|
|
1023
|
-
}
|
|
1024
994
|
return drawnFeatures
|
|
1025
995
|
},
|
|
1026
996
|
/**
|
|
@@ -1030,21 +1000,19 @@ export default {
|
|
|
1030
1000
|
addAnnotationFeature: async function () {
|
|
1031
1001
|
if (this.mapImp) {
|
|
1032
1002
|
if (!this.featureAnnotationSubmitted) this.clearAnnotationFeature()
|
|
1033
|
-
if (this.
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
this.mapImp.addAnnotationFeature(feature)
|
|
1047
|
-
}
|
|
1003
|
+
if (!this.featureAnnotationSubmitted) this.loading = true
|
|
1004
|
+
const userId = this.annotationFrom === 'Anyone' ?
|
|
1005
|
+
undefined : this.userInformation.orcid ?
|
|
1006
|
+
this.userInformation.orcid : '0000-0000-0000-0000'
|
|
1007
|
+
const participated = this.annotationFrom === 'Anyone' ?
|
|
1008
|
+
undefined : this.annotationFrom === 'Me' ?
|
|
1009
|
+
true : false
|
|
1010
|
+
const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
|
|
1011
|
+
this.existDrawnFeatures = drawnFeatures
|
|
1012
|
+
this.loading = false
|
|
1013
|
+
if (!this.featureAnnotationSubmitted) {
|
|
1014
|
+
for (const feature of drawnFeatures) {
|
|
1015
|
+
this.mapImp.addAnnotationFeature(feature)
|
|
1048
1016
|
}
|
|
1049
1017
|
}
|
|
1050
1018
|
}
|
|
@@ -1062,26 +1030,13 @@ export default {
|
|
|
1062
1030
|
this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
|
|
1063
1031
|
}
|
|
1064
1032
|
},
|
|
1065
|
-
/**
|
|
1066
|
-
* @public
|
|
1067
|
-
* Function to switch the type of annotation.
|
|
1068
|
-
* @arg {Boolean} `flag`
|
|
1069
|
-
*/
|
|
1070
|
-
setDrawnType: function (flag) {
|
|
1071
|
-
this.drawnType = flag
|
|
1072
|
-
if (this.mapImp) {
|
|
1073
|
-
this.manualAbortedOnClose()
|
|
1074
|
-
this.addAnnotationFeature()
|
|
1075
|
-
this.initialiseDrawing()
|
|
1076
|
-
}
|
|
1077
|
-
},
|
|
1078
1033
|
/**
|
|
1079
1034
|
* @public
|
|
1080
1035
|
* Function to switch the type of person who annotated.
|
|
1081
1036
|
* @arg {Boolean} `flag`
|
|
1082
1037
|
*/
|
|
1083
|
-
|
|
1084
|
-
this.
|
|
1038
|
+
setAnnotationFrom: function (flag) {
|
|
1039
|
+
this.annotationFrom = flag
|
|
1085
1040
|
if (this.mapImp) {
|
|
1086
1041
|
this.manualAbortedOnClose()
|
|
1087
1042
|
this.addAnnotationFeature()
|
|
@@ -1589,7 +1544,7 @@ export default {
|
|
|
1589
1544
|
this.annotationEntry = {}
|
|
1590
1545
|
} else if (data.type === 'modeChanged') {
|
|
1591
1546
|
if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
|
|
1592
|
-
if (this.annotationSidebar && data.feature.mode === 'simple_select') {
|
|
1547
|
+
if (this.annotationSidebar && data.feature.mode === 'simple_select' && this.activeDrawMode === 'Deleted') {
|
|
1593
1548
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1594
1549
|
}
|
|
1595
1550
|
} else if (data.type === 'selectionChanged') {
|
|
@@ -1624,6 +1579,7 @@ export default {
|
|
|
1624
1579
|
if (data.type === 'created') this.drawnCreatedEvent = payload
|
|
1625
1580
|
else this.checkAndCreatePopups(payload)
|
|
1626
1581
|
}
|
|
1582
|
+
if (data.type === 'updated') this.previousEditEvent = data
|
|
1627
1583
|
if (data.type === 'deleted') this.previousDeletedEvent = data
|
|
1628
1584
|
else this.previousDeletedEvent = {}
|
|
1629
1585
|
},
|
|
@@ -1711,6 +1667,14 @@ export default {
|
|
|
1711
1667
|
!this.activeDrawTool
|
|
1712
1668
|
) {
|
|
1713
1669
|
this.checkAndCreatePopups(payload)
|
|
1670
|
+
if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
|
|
1671
|
+
this.annotationEntry = {
|
|
1672
|
+
...this.previousEditEvent,
|
|
1673
|
+
resourceId: this.serverURL
|
|
1674
|
+
}
|
|
1675
|
+
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1676
|
+
}
|
|
1677
|
+
this.previousEditEvent = {}
|
|
1714
1678
|
}
|
|
1715
1679
|
this.$emit('resource-selected', payload)
|
|
1716
1680
|
} else {
|
|
@@ -1870,12 +1834,8 @@ export default {
|
|
|
1870
1834
|
if (data.feature.featureId && data.feature.models) {
|
|
1871
1835
|
this.displayTooltip(data.feature.models)
|
|
1872
1836
|
} else if (data.feature.feature) {
|
|
1873
|
-
// in drawing or edit/delete mode is on or
|
|
1874
|
-
if (
|
|
1875
|
-
this.activeDrawTool ||
|
|
1876
|
-
this.activeDrawMode ||
|
|
1877
|
-
Object.keys(this.connectionEntry).length > 0
|
|
1878
|
-
) {
|
|
1837
|
+
// in drawing or edit/delete mode is on or valid drawn
|
|
1838
|
+
if (this.activeDrawTool || this.activeDrawMode || this.isValidDrawnCreated) {
|
|
1879
1839
|
this.featureAnnotationSubmitted = false
|
|
1880
1840
|
this.annotationEntry.featureId = data.feature.feature.id
|
|
1881
1841
|
if (this.activeDrawTool) {
|
|
@@ -2042,7 +2002,11 @@ export default {
|
|
|
2042
2002
|
isPathwayContainer(parentElement) ||
|
|
2043
2003
|
isPathwayContainer(nextElementSibling)
|
|
2044
2004
|
) {
|
|
2045
|
-
this.
|
|
2005
|
+
if (this.requiresDrawer) {
|
|
2006
|
+
this.drawerOpen = true;
|
|
2007
|
+
} else {
|
|
2008
|
+
this.helpModeActiveIndex += 1;
|
|
2009
|
+
}
|
|
2046
2010
|
}
|
|
2047
2011
|
} else {
|
|
2048
2012
|
// skip the unavailable tooltips
|
|
@@ -2174,8 +2138,7 @@ export default {
|
|
|
2174
2138
|
!this.disableUI && (
|
|
2175
2139
|
(
|
|
2176
2140
|
this.viewingMode === 'Annotation' &&
|
|
2177
|
-
!this.annotationSidebar
|
|
2178
|
-
this.userInformation
|
|
2141
|
+
!this.annotationSidebar
|
|
2179
2142
|
) ||
|
|
2180
2143
|
(
|
|
2181
2144
|
this.viewingMode === 'Exploration' &&
|
|
@@ -2189,7 +2152,6 @@ export default {
|
|
|
2189
2152
|
this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
|
|
2190
2153
|
this.popUpCssHacks();
|
|
2191
2154
|
});
|
|
2192
|
-
|
|
2193
2155
|
}
|
|
2194
2156
|
},
|
|
2195
2157
|
hasTooltipEntry: function () {
|
|
@@ -2483,7 +2445,7 @@ export default {
|
|
|
2483
2445
|
}
|
|
2484
2446
|
}
|
|
2485
2447
|
|
|
2486
|
-
let promise1 = this.
|
|
2448
|
+
let promise1 = this.mapManagerRef.loadMap(
|
|
2487
2449
|
identifier,
|
|
2488
2450
|
this.$refs.display,
|
|
2489
2451
|
this.eventCallback(),
|
|
@@ -2568,7 +2530,6 @@ export default {
|
|
|
2568
2530
|
this.addResizeButtonToMinimap()
|
|
2569
2531
|
this.loading = false
|
|
2570
2532
|
this.computePathControlsMaximumHeight()
|
|
2571
|
-
this.drawerOpen = true;
|
|
2572
2533
|
this.mapResize()
|
|
2573
2534
|
this.handleMapClick();
|
|
2574
2535
|
this.setInitMapState();
|
|
@@ -2831,6 +2792,14 @@ export default {
|
|
|
2831
2792
|
type: Object,
|
|
2832
2793
|
default: undefined,
|
|
2833
2794
|
},
|
|
2795
|
+
/**
|
|
2796
|
+
* Flatmap's Map Manager to use as single Map Manager
|
|
2797
|
+
* if the FlatmapVuer is loaded from MultiFlatmapVuer.
|
|
2798
|
+
*/
|
|
2799
|
+
mapManager: {
|
|
2800
|
+
type: Object,
|
|
2801
|
+
default: undefined,
|
|
2802
|
+
},
|
|
2834
2803
|
/**
|
|
2835
2804
|
* Specify the endpoint of the flatmap server.
|
|
2836
2805
|
*/
|
|
@@ -2878,7 +2847,7 @@ export default {
|
|
|
2878
2847
|
data: function () {
|
|
2879
2848
|
return {
|
|
2880
2849
|
sensor: null,
|
|
2881
|
-
|
|
2850
|
+
mapManagerRef: undefined,
|
|
2882
2851
|
flatmapQueries: undefined,
|
|
2883
2852
|
annotationEntry: {},
|
|
2884
2853
|
//tooltip display has to be set to false until it is rendered
|
|
@@ -2942,12 +2911,10 @@ export default {
|
|
|
2942
2911
|
viewingModes: {
|
|
2943
2912
|
'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
|
|
2944
2913
|
'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
|
|
2945
|
-
'Annotation': 'View
|
|
2914
|
+
'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
|
|
2946
2915
|
},
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
annotatedType: 'Anyone',
|
|
2950
|
-
annotatedTypes: ['Anyone', 'Me', 'Others'],
|
|
2916
|
+
annotationFrom: 'Anyone',
|
|
2917
|
+
annotatedSource: ['Anyone', 'Me', 'Others'],
|
|
2951
2918
|
openMapRef: undefined,
|
|
2952
2919
|
backgroundIconRef: undefined,
|
|
2953
2920
|
toolbarOptions: [
|
|
@@ -2964,6 +2931,7 @@ export default {
|
|
|
2964
2931
|
activeDrawTool: undefined,
|
|
2965
2932
|
featureAnnotationSubmitted: false,
|
|
2966
2933
|
drawnCreatedEvent: {},
|
|
2934
|
+
previousEditEvent: {},
|
|
2967
2935
|
previousDeletedEvent: {},
|
|
2968
2936
|
connectionEntry: {},
|
|
2969
2937
|
existDrawnFeatures: [], // Store all exist drawn features
|
|
@@ -2998,6 +2966,37 @@ export default {
|
|
|
2998
2966
|
isValidDrawnCreated: function () {
|
|
2999
2967
|
return Object.keys(this.drawnCreatedEvent).length > 0
|
|
3000
2968
|
},
|
|
2969
|
+
requiresDrawer: function() {
|
|
2970
|
+
if (this.loading) {
|
|
2971
|
+
this.drawerOpen = false
|
|
2972
|
+
return false
|
|
2973
|
+
}
|
|
2974
|
+
if (!this.isFC) {
|
|
2975
|
+
this.drawerOpen = true
|
|
2976
|
+
return true
|
|
2977
|
+
} else {
|
|
2978
|
+
if ((this.systems?.length > 0) ||
|
|
2979
|
+
(this.containsAlert && this.alertOptions) ||
|
|
2980
|
+
(this.pathways?.length > 0) ||
|
|
2981
|
+
(this.taxonConnectivity?.length > 0)
|
|
2982
|
+
) {
|
|
2983
|
+
this.drawerOpen = true
|
|
2984
|
+
return true
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
this.drawerOpen = false
|
|
2988
|
+
return true
|
|
2989
|
+
},
|
|
2990
|
+
modeDescription: function () {
|
|
2991
|
+
let description = this.viewingModes[this.viewingMode]
|
|
2992
|
+
if (this.viewingMode === 'Annotation') {
|
|
2993
|
+
if (this.userInformation) {
|
|
2994
|
+
return description[1]
|
|
2995
|
+
}
|
|
2996
|
+
return description[0]
|
|
2997
|
+
}
|
|
2998
|
+
return description
|
|
2999
|
+
},
|
|
3001
3000
|
},
|
|
3002
3001
|
watch: {
|
|
3003
3002
|
entry: function () {
|
|
@@ -3019,7 +3018,7 @@ export default {
|
|
|
3019
3018
|
state: {
|
|
3020
3019
|
handler: function (state, oldVal) {
|
|
3021
3020
|
if (state !== oldVal) {
|
|
3022
|
-
if (this.
|
|
3021
|
+
if (this.mapManagerRef) {
|
|
3023
3022
|
this.setState(state)
|
|
3024
3023
|
} else {
|
|
3025
3024
|
//this component has not been mounted yet
|
|
@@ -3088,11 +3087,22 @@ export default {
|
|
|
3088
3087
|
}
|
|
3089
3088
|
}
|
|
3090
3089
|
},
|
|
3090
|
+
created: function () {
|
|
3091
|
+
if (this.mapManager) {
|
|
3092
|
+
this.mapManagerRef = this.mapManager;
|
|
3093
|
+
} else {
|
|
3094
|
+
this.mapManagerRef = markRaw(new flatmap.MapManager(this.flatmapAPI));
|
|
3095
|
+
/**
|
|
3096
|
+
* The event emitted after a new mapManager is loaded.
|
|
3097
|
+
* This mapManager can be used to create new flatmaps.
|
|
3098
|
+
*/
|
|
3099
|
+
this.$emit('mapmanager-loaded', this.mapManagerRef);
|
|
3100
|
+
}
|
|
3101
|
+
},
|
|
3091
3102
|
mounted: function () {
|
|
3092
3103
|
this.openMapRef = shallowRef(this.$refs.openMapRef)
|
|
3093
3104
|
this.backgroundIconRef = shallowRef(this.$refs.backgroundIconRef)
|
|
3094
3105
|
this.tooltipWait.length = this.hoverVisibilities.length
|
|
3095
|
-
this.mapManager = markRaw(new flatmap.MapManager(this.flatmapAPI))
|
|
3096
3106
|
this.flatmapQueries = markRaw(new FlatmapQueries())
|
|
3097
3107
|
this.flatmapQueries.initialise(this.flatmapAPI)
|
|
3098
3108
|
if (this.state) {
|
|
@@ -3189,6 +3199,7 @@ export default {
|
|
|
3189
3199
|
|
|
3190
3200
|
.svg-legends-container {
|
|
3191
3201
|
width: 70%;
|
|
3202
|
+
min-width:183px;
|
|
3192
3203
|
height: auto;
|
|
3193
3204
|
position: relative;
|
|
3194
3205
|
max-height: 140px;
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
:displayMinimap="displayMinimap"
|
|
84
84
|
:showStarInLegend="showStarInLegend"
|
|
85
85
|
style="height: 100%"
|
|
86
|
+
:mapManager="mapManagerRef"
|
|
86
87
|
:flatmapAPI="flatmapAPI"
|
|
87
88
|
:sparcAPI="sparcAPI"
|
|
88
89
|
/>
|
|
@@ -124,6 +125,9 @@ export default {
|
|
|
124
125
|
Popover,
|
|
125
126
|
FlatmapVuer,
|
|
126
127
|
},
|
|
128
|
+
created: function () {
|
|
129
|
+
this.loadMapManager();
|
|
130
|
+
},
|
|
127
131
|
mounted: function () {
|
|
128
132
|
this.initialise()
|
|
129
133
|
EventBus.on('onActionClick', (action) => {
|
|
@@ -219,6 +223,23 @@ export default {
|
|
|
219
223
|
}
|
|
220
224
|
})
|
|
221
225
|
},
|
|
226
|
+
/**
|
|
227
|
+
* Function to load `mapManager` to create flatmap.
|
|
228
|
+
*/
|
|
229
|
+
loadMapManager: function () {
|
|
230
|
+
if (!this.mapManagerRef) {
|
|
231
|
+
if (this.mapManager) {
|
|
232
|
+
this.mapManagerRef = this.mapManager;
|
|
233
|
+
} else {
|
|
234
|
+
this.mapManagerRef = markRaw(new flatmap.MapManager(this.flatmapAPI));
|
|
235
|
+
/**
|
|
236
|
+
* The event emitted after a new mapManager is loaded.
|
|
237
|
+
* This mapManager can be used to create new flatmaps.
|
|
238
|
+
*/
|
|
239
|
+
this.$emit('mapmanager-loaded', this.mapManagerRef);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
222
243
|
/**
|
|
223
244
|
* @public
|
|
224
245
|
* Function to emit ``resource-selected`` event with provided ``resource``.
|
|
@@ -410,12 +431,11 @@ export default {
|
|
|
410
431
|
//uuid is in the state but should be checked if it is the latest map
|
|
411
432
|
//for that taxon
|
|
412
433
|
return new Promise(() => {
|
|
413
|
-
const mapManager = new flatmap.MapManager(this.flatmapAPI)
|
|
414
434
|
//mapManager.findMap_ is an async function so we need to wrap this with a promise
|
|
415
435
|
const identifier = { taxon: mapState.entry }
|
|
416
436
|
if (mapState.biologicalSex)
|
|
417
437
|
identifier['biologicalSex'] = mapState.biologicalSex
|
|
418
|
-
|
|
438
|
+
this.mapManagerRef
|
|
419
439
|
.findMap_(identifier)
|
|
420
440
|
.then((map) => {
|
|
421
441
|
if (map.uuid !== mapState.uuid) {
|
|
@@ -461,6 +481,9 @@ export default {
|
|
|
461
481
|
*/
|
|
462
482
|
setState: function (state) {
|
|
463
483
|
if (state) {
|
|
484
|
+
// Update undefined mapManagerRef for setState happens before created event
|
|
485
|
+
this.loadMapManager();
|
|
486
|
+
|
|
464
487
|
//Update state if required
|
|
465
488
|
this.updateState(state).then((currentState) => {
|
|
466
489
|
this.initialise().then(() => {
|
|
@@ -696,6 +719,14 @@ export default {
|
|
|
696
719
|
type: Object,
|
|
697
720
|
default: undefined,
|
|
698
721
|
},
|
|
722
|
+
/**
|
|
723
|
+
* Flatmap's Map Manager to use as single Map Manager
|
|
724
|
+
* when the value is provided.
|
|
725
|
+
*/
|
|
726
|
+
mapManager: {
|
|
727
|
+
type: Object,
|
|
728
|
+
default: undefined,
|
|
729
|
+
},
|
|
699
730
|
/**
|
|
700
731
|
* Specify the endpoint of the flatmap server.
|
|
701
732
|
*/
|
|
@@ -739,6 +770,7 @@ export default {
|
|
|
739
770
|
requireInitialisation: true,
|
|
740
771
|
resolveList: markRaw([]),
|
|
741
772
|
initialised: false,
|
|
773
|
+
mapManagerRef: undefined,
|
|
742
774
|
}
|
|
743
775
|
},
|
|
744
776
|
watch: {
|
package/src/store/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { defineStore } from 'pinia'
|
|
|
8
8
|
export const useMainStore = defineStore('main', {
|
|
9
9
|
state: () => ({
|
|
10
10
|
userProfile: {
|
|
11
|
-
token: ''
|
|
11
|
+
token: 'eyJraWQiOiJ1UUMzRDl1RGpTTlhoNzZJRW1ldExcL05uOGRMazFyaU1LWSt5T2ZTUytHaz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjNDhmZDkyOS0wYjIwLTQxNjEtOTEyZi03NTBmMGZiY2VkNWQiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJzY29wZSI6Im9wZW5pZCIsImF1dGhfdGltZSI6MTczMzEwMDk1OSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfRlZMaEo3Q1FBIiwiZXhwIjoxNzMzMTA0NTU5LCJpYXQiOjE3MzMxMDA5NTksInZlcnNpb24iOjIsImp0aSI6IjQyYWE3OTk2LTI0M2QtNDdhYy05MzRjLTEyYmRkOTQxYjg1YSIsImNsaWVudF9pZCI6IjcwM2xtNWQ4b2RjY3UyMXBhZ2NmamtlYWVhIiwidXNlcm5hbWUiOiJjNDhmZDkyOS0wYjIwLTQxNjEtOTEyZi03NTBmMGZiY2VkNWQifQ.BmymFWRhSHRcYaLOxEuhIndcWeVoGJ_vlbFAJMOz2CxzU_23oYVeTTiJCfGw5zCa5OfHHGZfd95hQktuhBUTv0D5UMCfIKM89Zu3-3sVfRYyEHjcn70QyerXhnbrsKdAUfovsc74v9Ko9udtreZFlURfC9vHoiMHExxpnzXv39icZsZlvUc2qmrFGS1iScF8FWy5uwgHtqKwUi7dVvb1Kb84HHBmmaqujVW2R5eXliWZqZM-EEdV_AjZks0G6EBuRza7CXdPCQKztxX-UGqiUKyMLvACrThlYsFFNjy0s9FEI0_maAl5G13ieR874zTgcdijAq4gDvAXWWrvih3a-A'
|
|
12
12
|
},
|
|
13
13
|
}),
|
|
14
14
|
getters: {
|