@abi-software/flatmapvuer 0.5.9 → 0.6.0-vue3-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/babel.config.js +0 -14
- package/dist/favicon.ico +0 -0
- package/dist/flatmapvuer.js +69542 -0
- package/dist/flatmapvuer.umd.cjs +1021 -0
- package/dist/index.html +17 -0
- package/dist/style.css +1 -0
- package/package.json +29 -21
- package/src/App.vue +180 -105
- package/src/assets/styles.scss +2 -3
- package/src/components/AnnotationTool.vue +193 -153
- package/src/components/EventBus.js +3 -3
- package/src/components/ExternalResourceCard.vue +39 -30
- package/src/components/FlatmapVuer.vue +734 -676
- package/src/components/MultiFlatmapVuer.vue +313 -246
- package/src/components/ProvenancePopup.vue +195 -121
- package/src/components/SelectionsGroup.vue +93 -84
- package/src/components/Tooltip.vue +11 -13
- package/src/components/TreeControls.vue +67 -64
- package/src/components/index.js +4 -7
- package/src/components/legends/DynamicLegends.vue +13 -19
- package/src/components/legends/SvgLegends.vue +72 -27
- package/src/components.d.ts +46 -0
- package/src/icons/flatmap-marker.js +1 -1
- package/src/icons/fonts/mapicon-species.eot +0 -0
- package/src/icons/fonts/mapicon-species.svg +0 -0
- package/src/icons/yellowstar.js +2 -2
- package/src/legends/legend.svg +0 -0
- package/src/main.js +2 -6
- package/src/services/flatmapQueries.js +175 -139
- package/vite.config.js +76 -0
- package/vue.config.js +14 -0
- package/CHANGELOG.md +0 -402
- package/dist/demo.html +0 -10
- package/dist/flatmapvuer.common.js +0 -22741
- package/dist/flatmapvuer.common.js.map +0 -1
- package/dist/flatmapvuer.css +0 -1
- package/dist/flatmapvuer.umd.js +0 -22751
- package/dist/flatmapvuer.umd.js.map +0 -1
- package/dist/flatmapvuer.umd.min.js +0 -4
- package/dist/flatmapvuer.umd.min.js.map +0 -1
- package/package-lock.json +0 -18473
|
@@ -1,41 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="multi-container" ref="multiContainer">
|
|
3
|
-
<div style="position:absolute;z-index:10
|
|
4
|
-
<div class="species-display-text">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
v-model="activeSpecies"
|
|
14
|
-
placeholder="Select"
|
|
15
|
-
class="select-box"
|
|
16
|
-
popper-class="flatmap_dropdown"
|
|
17
|
-
@change="setSpecies"
|
|
18
|
-
v-popover:selectPopover
|
|
3
|
+
<div style="position: absolute; z-index: 10">
|
|
4
|
+
<div class="species-display-text">Species</div>
|
|
5
|
+
<el-popover
|
|
6
|
+
content="Select a species"
|
|
7
|
+
placement="right"
|
|
8
|
+
trigger="manual"
|
|
9
|
+
popper-class="flatmap-popper right-popper"
|
|
10
|
+
:visible="helpMode"
|
|
11
|
+
:teleported="false"
|
|
12
|
+
ref="selectPopover"
|
|
19
13
|
>
|
|
20
|
-
<
|
|
21
|
-
<el-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
<template #reference>
|
|
15
|
+
<el-select
|
|
16
|
+
id="flatmap-select"
|
|
17
|
+
:teleported="false"
|
|
18
|
+
v-model="activeSpecies"
|
|
19
|
+
placeholder="Select"
|
|
20
|
+
class="select-box"
|
|
21
|
+
popper-class="flatmap-dropdown"
|
|
22
|
+
@change="setSpecies"
|
|
23
|
+
>
|
|
24
|
+
<el-option
|
|
25
|
+
v-for="(item, key) in speciesList"
|
|
26
|
+
:key="key"
|
|
27
|
+
:label="key"
|
|
28
|
+
:value="key"
|
|
29
|
+
>
|
|
30
|
+
<el-row>
|
|
31
|
+
<el-col :span="8"><i :class="item.iconClass"></i></el-col>
|
|
32
|
+
<el-col :span="12">{{ key }}</el-col>
|
|
33
|
+
</el-row>
|
|
34
|
+
</el-option>
|
|
35
|
+
</el-select>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
</el-popover>
|
|
27
39
|
</div>
|
|
28
40
|
<FlatmapVuer
|
|
29
41
|
v-for="(item, key) in speciesList"
|
|
30
42
|
:key="key"
|
|
31
43
|
:showLayer="showLayer"
|
|
32
|
-
v-show="activeSpecies==key"
|
|
44
|
+
v-show="activeSpecies == key"
|
|
33
45
|
:entry="item.taxo"
|
|
34
46
|
:uuid="item.uuid"
|
|
35
47
|
:biologicalSex="item.biologicalSex"
|
|
36
48
|
:displayWarning="item.displayWarning"
|
|
37
49
|
:displayLatestChanges="item.displayLatestChanges"
|
|
38
|
-
:latestChangesMessage="item.latestChangesMessage"
|
|
39
50
|
:isLegacy="item.isLegacy"
|
|
40
51
|
:ref="key"
|
|
41
52
|
:enableOpenMapUI="enableOpenMapUI"
|
|
@@ -54,207 +65,216 @@
|
|
|
54
65
|
:renderAtMounted="renderAtMounted"
|
|
55
66
|
:displayMinimap="displayMinimap"
|
|
56
67
|
:showStarInLegend="showStarInLegend"
|
|
57
|
-
style="height:100%"
|
|
68
|
+
style="height: 100%"
|
|
58
69
|
:flatmapAPI="flatmapAPI"
|
|
59
70
|
:sparcAPI="sparcAPI"
|
|
60
71
|
/>
|
|
61
72
|
</div>
|
|
62
73
|
</template>
|
|
63
74
|
|
|
64
|
-
|
|
65
75
|
<script>
|
|
66
76
|
/* eslint-disable no-alert, no-console */
|
|
77
|
+
import { reactive } from 'vue'
|
|
67
78
|
import EventBus from './EventBus'
|
|
68
|
-
import
|
|
69
|
-
import
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Vue.use(Option);
|
|
77
|
-
Vue.use(Select);
|
|
78
|
-
Vue.use(Popover)
|
|
79
|
+
import FlatmapVuer from './FlatmapVuer.vue'
|
|
80
|
+
import {
|
|
81
|
+
ElCol as Col,
|
|
82
|
+
ElOption as Option,
|
|
83
|
+
ElSelect as Select,
|
|
84
|
+
ElRow as Row,
|
|
85
|
+
ElPopover as Popover,
|
|
86
|
+
} from 'element-plus'
|
|
79
87
|
|
|
80
88
|
const TAXON_UUID = {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
'NCBITaxon:10114': '01fedbf9-d783-509c-a10c-827941ab13da',
|
|
90
|
+
'NCBITaxon:9823': 'a336ac04-24db-561f-a25f-1c994fe17410',
|
|
91
|
+
'NCBITaxon:9606': '42ed6323-f645-5fbe-bada-9581819cf689',
|
|
92
|
+
'NCBITaxon:10090': '25285fab-48a0-5620-a6a0-f9a0374837d5',
|
|
93
|
+
'NCBITaxon:9685': '73060497-46a6-52bf-b975-cac511c127cb',
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
export default {
|
|
89
|
-
name:
|
|
97
|
+
name: 'MultiFlatmapVuer',
|
|
90
98
|
components: {
|
|
91
|
-
|
|
99
|
+
Col,
|
|
100
|
+
Row,
|
|
101
|
+
Option,
|
|
102
|
+
Select,
|
|
103
|
+
Popover,
|
|
104
|
+
FlatmapVuer,
|
|
92
105
|
},
|
|
93
106
|
beforeMount() {
|
|
94
107
|
//List for resolving the promise in initialise
|
|
95
108
|
//if initialise is called multiple times
|
|
96
|
-
this._resolveList = []
|
|
97
|
-
this._initialised = false
|
|
109
|
+
this._resolveList = []
|
|
110
|
+
this._initialised = false
|
|
98
111
|
},
|
|
99
|
-
mounted: function() {
|
|
100
|
-
this.initialise()
|
|
101
|
-
EventBus
|
|
112
|
+
mounted: function () {
|
|
113
|
+
this.initialise()
|
|
114
|
+
EventBus.on('onActionClick', (action) => {
|
|
102
115
|
this.FlatmapSelected(action)
|
|
103
116
|
})
|
|
104
117
|
},
|
|
105
118
|
methods: {
|
|
106
|
-
initialise: function() {
|
|
107
|
-
return new Promise(resolve => {
|
|
119
|
+
initialise: function () {
|
|
120
|
+
return new Promise((resolve) => {
|
|
108
121
|
if (this.requireInitialisation) {
|
|
109
122
|
//It has not been initialised yet
|
|
110
|
-
this.requireInitialisation = false
|
|
123
|
+
this.requireInitialisation = false
|
|
111
124
|
fetch(this.flatmapAPI)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
.then((response) => response.json())
|
|
126
|
+
.then((data) => {
|
|
127
|
+
//Check each key in the provided availableSpecies against the one
|
|
128
|
+
Object.keys(this.availableSpecies).forEach((key) => {
|
|
129
|
+
// FIrst look through the uuid
|
|
130
|
+
const uuid = this.availableSpecies[key].uuid
|
|
131
|
+
if (uuid && data.map((e) => e.uuid).indexOf(uuid) > 0) {
|
|
132
|
+
this.speciesList[key] = reactive(this.availableSpecies[key])
|
|
133
|
+
} else {
|
|
134
|
+
for (let i = 0; i < data.length; i++) {
|
|
135
|
+
if (this.availableSpecies[key].taxo === data[i].taxon) {
|
|
136
|
+
if (this.availableSpecies[key].biologicalSex) {
|
|
137
|
+
if (
|
|
138
|
+
data[i].biologicalSex &&
|
|
139
|
+
data[i].biologicalSex ===
|
|
140
|
+
this.availableSpecies[key].biologicalSex
|
|
141
|
+
) {
|
|
142
|
+
this.speciesList[key] = reactive(this.availableSpecies[key])
|
|
143
|
+
break
|
|
128
144
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
145
|
+
} else {
|
|
146
|
+
this.speciesList[key] = reactive(this.availableSpecies[key])
|
|
147
|
+
break
|
|
148
|
+
}
|
|
132
149
|
}
|
|
133
150
|
}
|
|
134
151
|
}
|
|
152
|
+
})
|
|
153
|
+
//Use the state species if it does not have any other species information
|
|
154
|
+
let species = this.initial
|
|
155
|
+
if (this.state) {
|
|
156
|
+
const mapState = this.state.state
|
|
157
|
+
if (
|
|
158
|
+
(!mapState || (!mapState.uuid && !mapState.entry)) &&
|
|
159
|
+
this.state.species
|
|
160
|
+
)
|
|
161
|
+
species = this.state.species
|
|
162
|
+
else species = undefined
|
|
135
163
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (species && this.speciesList[species] !== undefined) {
|
|
149
|
-
this.activeSpecies = species;
|
|
150
|
-
} else {
|
|
151
|
-
this.activeSpecies = Object.keys(this.speciesList)[0];
|
|
164
|
+
if (species) {
|
|
165
|
+
//No state resuming, set the current flatmap to {this.initial}
|
|
166
|
+
if (species && this.speciesList[species] !== undefined) {
|
|
167
|
+
this.activeSpecies = species
|
|
168
|
+
} else {
|
|
169
|
+
this.activeSpecies = Object.keys(this.speciesList)[0]
|
|
170
|
+
}
|
|
171
|
+
this.setSpecies(
|
|
172
|
+
this.activeSpecies,
|
|
173
|
+
this.state ? this.state.state : undefined,
|
|
174
|
+
5
|
|
175
|
+
)
|
|
152
176
|
}
|
|
153
|
-
this.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
177
|
+
this._initialised = true
|
|
178
|
+
resolve()
|
|
179
|
+
//Resolve all other promises resolve in the list
|
|
180
|
+
this._resolveList.forEach((other) => {
|
|
181
|
+
other()
|
|
182
|
+
})
|
|
183
|
+
})
|
|
160
184
|
} else if (this._initialised) {
|
|
161
185
|
//resolve as it has been initialised
|
|
162
|
-
resolve()
|
|
186
|
+
resolve()
|
|
163
187
|
} else {
|
|
164
|
-
//resolve when the async initialisation is finished
|
|
165
|
-
this._resolveList.push(resolve)
|
|
188
|
+
//resolve when the async initialisation is finished
|
|
189
|
+
this._resolveList.push(resolve)
|
|
166
190
|
}
|
|
167
191
|
})
|
|
168
192
|
},
|
|
169
|
-
FlatmapSelected: function(resource) {
|
|
170
|
-
this.$emit(
|
|
193
|
+
FlatmapSelected: function (resource) {
|
|
194
|
+
this.$emit('resource-selected', resource)
|
|
171
195
|
},
|
|
172
|
-
FlatmapReady: function(component) {
|
|
173
|
-
this.$emit(
|
|
196
|
+
FlatmapReady: function (component) {
|
|
197
|
+
this.$emit('ready', component)
|
|
174
198
|
},
|
|
175
|
-
getCoordinatesOfLastClick: function() {
|
|
176
|
-
const flatmap = this.$refs[this.activeSpecies]
|
|
199
|
+
getCoordinatesOfLastClick: function () {
|
|
200
|
+
const flatmap = this.$refs[this.activeSpecies]
|
|
177
201
|
if (flatmap && flatmap[0]) {
|
|
178
|
-
return flatmap[0].getCoordinatesOfLastClick()
|
|
202
|
+
return flatmap[0].getCoordinatesOfLastClick()
|
|
179
203
|
}
|
|
180
|
-
return undefined
|
|
204
|
+
return undefined
|
|
181
205
|
},
|
|
182
|
-
getCurrentFlatmap: function() {
|
|
183
|
-
return this.$refs[this.activeSpecies][0]
|
|
206
|
+
getCurrentFlatmap: function () {
|
|
207
|
+
return this.$refs[this.activeSpecies][0]
|
|
184
208
|
},
|
|
185
|
-
panZoomCallback: function(payload) {
|
|
186
|
-
this.$emit(
|
|
209
|
+
panZoomCallback: function (payload) {
|
|
210
|
+
this.$emit('pan-zoom-callback', payload)
|
|
187
211
|
},
|
|
188
|
-
showPopup: function(featureId, node, options) {
|
|
189
|
-
let map = this.getCurrentFlatmap()
|
|
190
|
-
map.showPopup(featureId, node, options)
|
|
212
|
+
showPopup: function (featureId, node, options) {
|
|
213
|
+
let map = this.getCurrentFlatmap()
|
|
214
|
+
map.showPopup(featureId, node, options)
|
|
191
215
|
},
|
|
192
|
-
showMarkerPopup: function(featureId, node, options) {
|
|
193
|
-
let map = this.getCurrentFlatmap()
|
|
194
|
-
map.showMarkerPopup(featureId, node, options)
|
|
216
|
+
showMarkerPopup: function (featureId, node, options) {
|
|
217
|
+
let map = this.getCurrentFlatmap()
|
|
218
|
+
map.showMarkerPopup(featureId, node, options)
|
|
195
219
|
},
|
|
196
|
-
setSpecies: function(species, state, numberOfRetry) {
|
|
220
|
+
setSpecies: function (species, state, numberOfRetry) {
|
|
197
221
|
if (this.$refs && species in this.$refs) {
|
|
198
|
-
this.activeSpecies = species
|
|
199
|
-
this.$refs[this.activeSpecies][0].createFlatmap(state)
|
|
200
|
-
this.$emit('flatmapChanged', this.activeSpecies)
|
|
222
|
+
this.activeSpecies = species
|
|
223
|
+
this.$refs[this.activeSpecies][0].createFlatmap(state)
|
|
224
|
+
this.$emit('flatmapChanged', this.activeSpecies)
|
|
201
225
|
} else if (numberOfRetry) {
|
|
202
|
-
const retry = numberOfRetry - 1
|
|
226
|
+
const retry = numberOfRetry - 1
|
|
203
227
|
if (retry >= 0) {
|
|
204
|
-
|
|
205
|
-
this.setSpecies(species, state, retry)
|
|
206
|
-
})
|
|
228
|
+
this.$nextTick(() => {
|
|
229
|
+
this.setSpecies(species, state, retry)
|
|
230
|
+
})
|
|
207
231
|
}
|
|
208
232
|
}
|
|
209
233
|
},
|
|
210
234
|
/**
|
|
211
|
-
* Function to switch to the latest existing map from
|
|
212
|
-
* a legacy map of the same species.
|
|
213
|
-
*
|
|
235
|
+
* Function to switch to the latest existing map from
|
|
236
|
+
* a legacy map of the same species.
|
|
237
|
+
*
|
|
214
238
|
* @private
|
|
215
239
|
*/
|
|
216
|
-
viewLatestMap: function(state) {
|
|
217
|
-
const keys = Object.keys(this.speciesList)
|
|
240
|
+
viewLatestMap: function (state) {
|
|
241
|
+
const keys = Object.keys(this.speciesList)
|
|
218
242
|
for (let i = 0; i < keys.length; i++) {
|
|
219
|
-
const species = this.speciesList[keys[i]]
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
243
|
+
const species = this.speciesList[keys[i]]
|
|
244
|
+
if (
|
|
245
|
+
!species.isLegacy &&
|
|
246
|
+
species.taxo === state.entry &&
|
|
247
|
+
species.biologicalSex === state.biologicalSex
|
|
248
|
+
) {
|
|
249
|
+
this.setSpecies(keys[i], state, 0)
|
|
250
|
+
return
|
|
225
251
|
}
|
|
226
252
|
}
|
|
227
253
|
},
|
|
228
254
|
/**
|
|
229
255
|
* Create a legacy entry with the provided information
|
|
230
|
-
*
|
|
256
|
+
*
|
|
231
257
|
* @private
|
|
232
258
|
*/
|
|
233
|
-
createLegacyEntry: function(state, taxo, uuid) {
|
|
259
|
+
createLegacyEntry: function (state, taxo, uuid) {
|
|
234
260
|
if (uuid && taxo) {
|
|
235
|
-
let name =
|
|
261
|
+
let name = 'Legacy'
|
|
236
262
|
if (state.species) {
|
|
237
|
-
if (state.species.slice(0, 6) ===
|
|
238
|
-
|
|
239
|
-
else
|
|
240
|
-
name = name + ` ${state.species}`;
|
|
263
|
+
if (state.species.slice(0, 6) === 'Legacy') name = state.species
|
|
264
|
+
else name = name + ` ${state.species}`
|
|
241
265
|
}
|
|
242
|
-
this
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
isLegacy: true,
|
|
248
|
-
displayWarning: true
|
|
249
|
-
}
|
|
250
|
-
);
|
|
266
|
+
this.speciesList[name] = reactive({
|
|
267
|
+
taxo: taxo,
|
|
268
|
+
isLegacy: true,
|
|
269
|
+
displayWarning: true,
|
|
270
|
+
})
|
|
251
271
|
return {
|
|
252
272
|
species: name,
|
|
253
273
|
state: {
|
|
254
274
|
entry: taxo,
|
|
255
275
|
uuid: uuid,
|
|
256
276
|
viewport: state.state.viewport,
|
|
257
|
-
searchTerm: state.state.searchTerm
|
|
277
|
+
searchTerm: state.state.searchTerm,
|
|
258
278
|
},
|
|
259
279
|
}
|
|
260
280
|
}
|
|
@@ -262,106 +282,126 @@ export default {
|
|
|
262
282
|
/**
|
|
263
283
|
* Function used to translate the legacy map state to one that can be used in current
|
|
264
284
|
* flatmap if required. If it is a legacy, an Select entry will be added
|
|
265
|
-
*
|
|
285
|
+
*
|
|
266
286
|
* @private
|
|
267
287
|
*/
|
|
268
|
-
updateState: function(state) {
|
|
288
|
+
updateState: function (state) {
|
|
269
289
|
return new Promise((resolve) => {
|
|
270
290
|
if (state && state.state) {
|
|
271
|
-
const mapState = state.state
|
|
291
|
+
const mapState = state.state
|
|
272
292
|
//uuid is not in the state, this is a legacy map
|
|
273
293
|
if (!mapState.uuid) {
|
|
274
294
|
if (mapState.entry) {
|
|
275
|
-
const uuid =
|
|
276
|
-
|
|
277
|
-
|
|
295
|
+
const uuid =
|
|
296
|
+
mapState.entry in TAXON_UUID
|
|
297
|
+
? TAXON_UUID[mapState.entry]
|
|
298
|
+
: undefined
|
|
299
|
+
const newState = this.createLegacyEntry(
|
|
300
|
+
state,
|
|
301
|
+
mapState.entry,
|
|
302
|
+
uuid
|
|
303
|
+
)
|
|
304
|
+
resolve(newState ? newState : state)
|
|
278
305
|
}
|
|
279
306
|
} else if (mapState.entry) {
|
|
280
307
|
//uuid is in the state but should be checked if it is the latest map
|
|
281
308
|
//for that taxon
|
|
282
309
|
return new Promise(() => {
|
|
283
|
-
const mapManager =
|
|
310
|
+
const mapManager =
|
|
311
|
+
new (require('@abi-software/flatmap-viewer').MapManager)(
|
|
312
|
+
this.flatmapAPI
|
|
313
|
+
)
|
|
284
314
|
//mapManager.findMap_ is an async function so we need to wrap this with a promise
|
|
285
|
-
const identifier = { taxon: mapState.entry }
|
|
315
|
+
const identifier = { taxon: mapState.entry }
|
|
286
316
|
if (mapState.biologicalSex)
|
|
287
|
-
identifier['biologicalSex'] = mapState.biologicalSex
|
|
288
|
-
mapManager
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
317
|
+
identifier['biologicalSex'] = mapState.biologicalSex
|
|
318
|
+
mapManager
|
|
319
|
+
.findMap_(identifier)
|
|
320
|
+
.then((map) => {
|
|
321
|
+
if (map.uuid !== mapState.uuid) {
|
|
322
|
+
return this.createLegacyEntry(
|
|
323
|
+
state,
|
|
324
|
+
mapState.entry,
|
|
325
|
+
mapState.uuid
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
.then((newState) => {
|
|
330
|
+
resolve(newState ? newState : state)
|
|
331
|
+
})
|
|
332
|
+
.catch(() => {
|
|
333
|
+
resolve(state)
|
|
334
|
+
})
|
|
335
|
+
})
|
|
299
336
|
}
|
|
300
337
|
//Create a new state and add the legacy map to the select
|
|
301
338
|
}
|
|
302
|
-
resolve(state)
|
|
303
|
-
})
|
|
339
|
+
resolve(state)
|
|
340
|
+
})
|
|
304
341
|
},
|
|
305
342
|
/**
|
|
306
|
-
* Function used for getting the current states of the scene. This exported states
|
|
343
|
+
* Function used for getting the current states of the scene. This exported states
|
|
307
344
|
* can be imported using the importStates method.
|
|
308
|
-
*
|
|
345
|
+
*
|
|
309
346
|
* @public
|
|
310
347
|
*/
|
|
311
|
-
getState: function() {
|
|
348
|
+
getState: function () {
|
|
312
349
|
let state = {
|
|
313
350
|
species: this.activeSpecies,
|
|
314
351
|
state: undefined,
|
|
315
|
-
}
|
|
316
|
-
let map = this.getCurrentFlatmap()
|
|
317
|
-
state.state = map.getState()
|
|
318
|
-
return state
|
|
352
|
+
}
|
|
353
|
+
let map = this.getCurrentFlatmap()
|
|
354
|
+
state.state = map.getState()
|
|
355
|
+
return state
|
|
319
356
|
},
|
|
320
357
|
/**
|
|
321
|
-
* Function used for importing the states of the scene. This exported states
|
|
358
|
+
* Function used for importing the states of the scene. This exported states
|
|
322
359
|
* can be imported using the read states method.
|
|
323
|
-
*
|
|
360
|
+
*
|
|
324
361
|
* @public
|
|
325
362
|
*/
|
|
326
|
-
setState: function(state) {
|
|
363
|
+
setState: function (state) {
|
|
327
364
|
if (state) {
|
|
328
|
-
|
|
329
|
-
this.updateState(state).then(currentState => {
|
|
365
|
+
//Update state if required
|
|
366
|
+
this.updateState(state).then((currentState) => {
|
|
330
367
|
this.initialise().then(() => {
|
|
331
|
-
if (
|
|
332
|
-
|
|
368
|
+
if (
|
|
369
|
+
currentState.species &&
|
|
370
|
+
currentState.species !== this.activeSpecies
|
|
371
|
+
) {
|
|
372
|
+
this.setSpecies(currentState.species, currentState.state, 5)
|
|
333
373
|
} else if (currentState.state) {
|
|
334
|
-
let map = this.getCurrentFlatmap()
|
|
335
|
-
map.setState(currentState.state)
|
|
374
|
+
let map = this.getCurrentFlatmap()
|
|
375
|
+
map.setState(currentState.state)
|
|
336
376
|
}
|
|
337
|
-
})
|
|
338
|
-
})
|
|
377
|
+
})
|
|
378
|
+
})
|
|
339
379
|
}
|
|
340
380
|
},
|
|
341
|
-
resourceSelected: function(action) {
|
|
342
|
-
this.$emit(
|
|
381
|
+
resourceSelected: function (action) {
|
|
382
|
+
this.$emit('resource-selected', action)
|
|
343
383
|
},
|
|
344
384
|
},
|
|
345
385
|
props: {
|
|
346
386
|
showLayer: {
|
|
347
387
|
type: Boolean,
|
|
348
|
-
default: false
|
|
388
|
+
default: false,
|
|
349
389
|
},
|
|
350
390
|
featureInfo: {
|
|
351
391
|
type: Boolean,
|
|
352
|
-
default: false
|
|
392
|
+
default: false,
|
|
353
393
|
},
|
|
354
394
|
pathControls: {
|
|
355
395
|
type: Boolean,
|
|
356
|
-
default: true
|
|
396
|
+
default: true,
|
|
357
397
|
},
|
|
358
398
|
searchable: {
|
|
359
399
|
type: Boolean,
|
|
360
|
-
default: false
|
|
400
|
+
default: false,
|
|
361
401
|
},
|
|
362
402
|
layerControl: {
|
|
363
403
|
type: Boolean,
|
|
364
|
-
default: false
|
|
404
|
+
default: false,
|
|
365
405
|
},
|
|
366
406
|
/**
|
|
367
407
|
* Initial species for the flatmap.
|
|
@@ -369,27 +409,27 @@ export default {
|
|
|
369
409
|
*/
|
|
370
410
|
initial: {
|
|
371
411
|
type: String,
|
|
372
|
-
default:
|
|
412
|
+
default: '',
|
|
373
413
|
},
|
|
374
414
|
minZoom: {
|
|
375
415
|
type: Number,
|
|
376
|
-
default: 4
|
|
416
|
+
default: 4,
|
|
377
417
|
},
|
|
378
418
|
renderAtMounted: {
|
|
379
419
|
type: Boolean,
|
|
380
|
-
default: false
|
|
420
|
+
default: false,
|
|
381
421
|
},
|
|
382
422
|
helpMode: {
|
|
383
423
|
type: Boolean,
|
|
384
|
-
default: false
|
|
424
|
+
default: false,
|
|
385
425
|
},
|
|
386
426
|
displayMinimap: {
|
|
387
427
|
type: Boolean,
|
|
388
|
-
default: false
|
|
428
|
+
default: false,
|
|
389
429
|
},
|
|
390
430
|
showStarInLegend: {
|
|
391
431
|
type: Boolean,
|
|
392
|
-
default: false
|
|
432
|
+
default: false,
|
|
393
433
|
},
|
|
394
434
|
/**
|
|
395
435
|
* Flag to determine rather open map UI should be
|
|
@@ -400,20 +440,46 @@ export default {
|
|
|
400
440
|
default: false,
|
|
401
441
|
},
|
|
402
442
|
openMapOptions: {
|
|
403
|
-
type: Array
|
|
443
|
+
type: Array,
|
|
404
444
|
},
|
|
405
445
|
availableSpecies: {
|
|
406
446
|
type: Object,
|
|
407
|
-
default: function() {
|
|
447
|
+
default: function () {
|
|
408
448
|
return {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
449
|
+
'Human Female': {
|
|
450
|
+
taxo: 'NCBITaxon:9606',
|
|
451
|
+
biologicalSex: 'PATO:0000383',
|
|
452
|
+
iconClass: 'mapicon-icon_human',
|
|
453
|
+
displayWarning: true,
|
|
454
|
+
},
|
|
455
|
+
'Human Male': {
|
|
456
|
+
taxo: 'NCBITaxon:9606',
|
|
457
|
+
biologicalSex: 'PATO:0000384',
|
|
458
|
+
iconClass: 'mapicon-icon_human',
|
|
459
|
+
displayWarning: true,
|
|
460
|
+
},
|
|
461
|
+
Rat: {
|
|
462
|
+
taxo: 'NCBITaxon:10114',
|
|
463
|
+
iconClass: 'mapicon-icon_rat',
|
|
464
|
+
displayLatestChanges: true,
|
|
465
|
+
},
|
|
466
|
+
Mouse: {
|
|
467
|
+
taxo: 'NCBITaxon:10090',
|
|
468
|
+
iconClass: 'mapicon-icon_mouse',
|
|
469
|
+
displayWarning: true,
|
|
470
|
+
},
|
|
471
|
+
Pig: {
|
|
472
|
+
taxo: 'NCBITaxon:9823',
|
|
473
|
+
iconClass: 'mapicon-icon_pig',
|
|
474
|
+
displayWarning: true,
|
|
475
|
+
},
|
|
476
|
+
Cat: {
|
|
477
|
+
taxo: 'NCBITaxon:9685',
|
|
478
|
+
iconClass: 'mapicon-icon_cat',
|
|
479
|
+
displayWarning: true,
|
|
480
|
+
},
|
|
415
481
|
}
|
|
416
|
-
}
|
|
482
|
+
},
|
|
417
483
|
},
|
|
418
484
|
/**
|
|
419
485
|
* State containing state of the flatmap.
|
|
@@ -427,36 +493,35 @@ export default {
|
|
|
427
493
|
*/
|
|
428
494
|
flatmapAPI: {
|
|
429
495
|
type: String,
|
|
430
|
-
default:
|
|
496
|
+
default: 'https://mapcore-demo.org/current/flatmap/v3/',
|
|
431
497
|
},
|
|
432
498
|
sparcAPI: {
|
|
433
499
|
type: String,
|
|
434
|
-
default:
|
|
435
|
-
}
|
|
500
|
+
default: 'https://api.sparc.science/',
|
|
501
|
+
},
|
|
436
502
|
},
|
|
437
|
-
data: function() {
|
|
503
|
+
data: function () {
|
|
438
504
|
return {
|
|
439
505
|
activeSpecies: undefined,
|
|
440
|
-
appendToBody: false,
|
|
441
506
|
speciesList: {},
|
|
442
|
-
requireInitialisation: true
|
|
443
|
-
}
|
|
507
|
+
requireInitialisation: true,
|
|
508
|
+
}
|
|
444
509
|
},
|
|
445
510
|
watch: {
|
|
446
511
|
state: {
|
|
447
|
-
handler: function(state) {
|
|
448
|
-
this.setState(state)
|
|
512
|
+
handler: function (state) {
|
|
513
|
+
this.setState(state)
|
|
449
514
|
},
|
|
450
515
|
immediate: true,
|
|
451
516
|
deep: true,
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
}
|
|
455
520
|
</script>
|
|
456
521
|
|
|
457
|
-
<style
|
|
458
|
-
@
|
|
459
|
-
@
|
|
522
|
+
<style lang="scss" scoped>
|
|
523
|
+
@use 'element-plus/theme-chalk/src/select';
|
|
524
|
+
@use 'element-plus/theme-chalk/src/option';
|
|
460
525
|
|
|
461
526
|
.multi-container {
|
|
462
527
|
height: 100%;
|
|
@@ -470,8 +535,8 @@ export default {
|
|
|
470
535
|
font-size: 14px;
|
|
471
536
|
font-weight: normal;
|
|
472
537
|
line-height: 20px;
|
|
473
|
-
left:24px;
|
|
474
|
-
top:16px;
|
|
538
|
+
left: 24px;
|
|
539
|
+
top: 16px;
|
|
475
540
|
position: absolute;
|
|
476
541
|
}
|
|
477
542
|
|
|
@@ -481,24 +546,28 @@ export default {
|
|
|
481
546
|
border: 1px solid rgb(144, 147, 153);
|
|
482
547
|
background-color: var(--white);
|
|
483
548
|
font-weight: 500;
|
|
484
|
-
color:rgb(48, 49, 51);
|
|
549
|
+
color: rgb(48, 49, 51);
|
|
485
550
|
left: 16px;
|
|
486
551
|
top: 44px;
|
|
487
552
|
position: absolute;
|
|
488
|
-
|
|
553
|
+
:deep(.el-input__inner) {
|
|
489
554
|
color: rgb(48, 49, 51);
|
|
490
555
|
padding-top: 0.25em;
|
|
491
556
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
557
|
+
:deep() {
|
|
558
|
+
.el-input {
|
|
559
|
+
.el-input__wrapper{
|
|
560
|
+
&is-focus,
|
|
561
|
+
&:focus {
|
|
562
|
+
border: 1px solid $app-primary-color;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
495
565
|
}
|
|
496
566
|
}
|
|
497
|
-
}
|
|
498
|
-
|
|
567
|
+
}
|
|
499
568
|
|
|
500
|
-
|
|
501
|
-
min-width: 160px!important;
|
|
569
|
+
.flatmap-dropdown {
|
|
570
|
+
min-width: 160px !important;
|
|
502
571
|
.el-select-dropdown__item {
|
|
503
572
|
white-space: nowrap;
|
|
504
573
|
text-align: left;
|
|
@@ -509,9 +578,9 @@ export default {
|
|
|
509
578
|
}
|
|
510
579
|
}
|
|
511
580
|
|
|
512
|
-
|
|
581
|
+
.flatmap-popper {
|
|
513
582
|
padding: 6px 4px;
|
|
514
|
-
font-size:12px;
|
|
583
|
+
font-size: 12px;
|
|
515
584
|
color: rgb(48, 49, 51);
|
|
516
585
|
background-color: #f3ecf6;
|
|
517
586
|
border: 1px solid $app-primary-color;
|
|
@@ -527,10 +596,8 @@ export default {
|
|
|
527
596
|
}
|
|
528
597
|
}
|
|
529
598
|
|
|
530
|
-
|
|
531
|
-
background-color: #f0f0f000
|
|
599
|
+
:deep(.flatmap-marker-popup) {
|
|
600
|
+
background-color: #f0f0f000 !important;
|
|
532
601
|
box-shadow: none !important;
|
|
533
602
|
}
|
|
534
|
-
|
|
535
603
|
</style>
|
|
536
|
-
|