@abi-software/flatmapvuer 0.5.3 → 0.5.4-fccb-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/CHANGELOG.md +3 -1
- package/dist/flatmapvuer.common.js +5602 -829
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +5602 -829
- package/dist/flatmapvuer.umd.js.map +1 -1
- package/dist/flatmapvuer.umd.min.js +2 -2
- package/dist/flatmapvuer.umd.min.js.map +1 -1
- package/package-lock.json +9 -9
- package/package.json +2 -2
- package/src/App.vue +2 -0
- package/src/components/FlatmapVuer.vue +109 -21
- package/src/components/SelectionsGroup.vue +2 -1
- package/src/components/Tooltip.vue +12 -3
- package/src/components/TreeControls.vue +232 -0
- package/src/services/flatmapQueries.js +40 -2
package/package-lock.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4-fccb-0",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@abi-software/flatmap-viewer": {
|
|
8
|
-
"version": "2.
|
|
9
|
-
"resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.
|
|
10
|
-
"integrity": "sha512-
|
|
8
|
+
"version": "2.4.1-b.4",
|
|
9
|
+
"resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.4.1-b.4.tgz",
|
|
10
|
+
"integrity": "sha512-v22Knqr0lSgp87/tnVTE813kKpfjwPyCfxuax8BwjSFV6r2qnWHgVYkB9P8vIA7Cxp6H6TwtPXcQ2TjTYhxQgQ==",
|
|
11
11
|
"requires": {
|
|
12
12
|
"@babel/runtime": "^7.10.4",
|
|
13
13
|
"@fortawesome/fontawesome-free": "^6.4.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"bezier-js": "^6.1.0",
|
|
19
19
|
"html-es6cape": "^2.0.2",
|
|
20
20
|
"jspanel4": "^4.16.1",
|
|
21
|
-
"maplibre-gl": ">=
|
|
21
|
+
"maplibre-gl": ">=3.0.0",
|
|
22
22
|
"minisearch": "^2.2.1",
|
|
23
23
|
"polylabel": "^1.1.0"
|
|
24
24
|
}
|
|
@@ -8270,9 +8270,9 @@
|
|
|
8270
8270
|
}
|
|
8271
8271
|
},
|
|
8272
8272
|
"maplibre-gl": {
|
|
8273
|
-
"version": "3.0
|
|
8274
|
-
"resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.0.
|
|
8275
|
-
"integrity": "sha512-
|
|
8273
|
+
"version": "3.1.0",
|
|
8274
|
+
"resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.1.0.tgz",
|
|
8275
|
+
"integrity": "sha512-KFarVUUszCEucPwnGsFJtPMQBg/F6lg+SPDmTztKUD/n0YShETjIOdNmm5jpxacEX3+dq50MzlqDr6VH+RtDDA==",
|
|
8276
8276
|
"requires": {
|
|
8277
8277
|
"@mapbox/geojson-rewind": "^0.5.2",
|
|
8278
8278
|
"@mapbox/jsonlint-lines-primitives": "^2.0.2",
|
|
@@ -11887,7 +11887,7 @@
|
|
|
11887
11887
|
"simple-html-tokenizer": {
|
|
11888
11888
|
"version": "0.1.1",
|
|
11889
11889
|
"resolved": "https://registry.npmjs.org/simple-html-tokenizer/-/simple-html-tokenizer-0.1.1.tgz",
|
|
11890
|
-
"integrity": "
|
|
11890
|
+
"integrity": "sha512-Mc/gH3RvlKvB/gkp9XwgDKEWrSYyefIJPGG8Jk1suZms/rISdUuVEMx5O1WBnTWaScvxXDvGJrZQWblUmQHjkQ=="
|
|
11891
11891
|
},
|
|
11892
11892
|
"simple-swizzle": {
|
|
11893
11893
|
"version": "0.2.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4-fccb-0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/flatmapvuer.common.js",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"version": "npm run build-bundle;npm run changelog; git add CHANGELOG.md"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abi-software/flatmap-viewer": "^2.
|
|
30
|
+
"@abi-software/flatmap-viewer": "^2.4.1-b.4",
|
|
31
31
|
"@abi-software/svg-sprite": "^0.1.14",
|
|
32
32
|
"core-js": "^3.3.2",
|
|
33
33
|
"css-element-queries": "^1.2.2",
|
package/src/App.vue
CHANGED
|
@@ -71,6 +71,7 @@ export default {
|
|
|
71
71
|
console.log(component);
|
|
72
72
|
let taxon = component.mapImp.describes;
|
|
73
73
|
let id = component.mapImp.addMarker("UBERON:0000948");
|
|
74
|
+
window.flatmapImp = component.mapImp;
|
|
74
75
|
component.enablePanZoomEvents(true);
|
|
75
76
|
//component.showPathwaysDrawer(false);
|
|
76
77
|
console.log(taxon, id);
|
|
@@ -135,6 +136,7 @@ export default {
|
|
|
135
136
|
//flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
|
|
136
137
|
//flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
|
|
137
138
|
flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v4/"
|
|
139
|
+
//flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
|
|
138
140
|
//flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
|
|
139
141
|
// flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
|
|
140
142
|
}
|
|
@@ -178,17 +178,15 @@
|
|
|
178
178
|
v-html="flatmapMarker"
|
|
179
179
|
v-popover:markerPopover
|
|
180
180
|
></div>
|
|
181
|
-
<
|
|
181
|
+
<tree-controls
|
|
182
182
|
v-if="isFC && systems && systems.length > 0"
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
colourStyle="background"
|
|
183
|
+
:active="currentActive"
|
|
184
|
+
:hover="currentHover"
|
|
185
|
+
:tree-data="systems"
|
|
186
|
+
ref="treeControls"
|
|
188
187
|
@changed="systemSelected"
|
|
189
188
|
@checkAll="checkAllSystems"
|
|
190
|
-
|
|
191
|
-
key="systemsSelection"
|
|
189
|
+
@change-active="ftuSelected"
|
|
192
190
|
/>
|
|
193
191
|
<!--
|
|
194
192
|
<selections-group
|
|
@@ -224,6 +222,17 @@
|
|
|
224
222
|
key="layersSelection"
|
|
225
223
|
/>
|
|
226
224
|
-->
|
|
225
|
+
<selections-group
|
|
226
|
+
v-if="!isFC && taxonConnectivity && taxonConnectivity.length > 0"
|
|
227
|
+
title="Observed in"
|
|
228
|
+
labelKey="label"
|
|
229
|
+
identifierKey="taxon"
|
|
230
|
+
:selections="taxonConnectivity"
|
|
231
|
+
@changed="taxonsSelected"
|
|
232
|
+
@checkAll="checkAllTaxons"
|
|
233
|
+
ref="taxonSelection"
|
|
234
|
+
key="taxonSelection"
|
|
235
|
+
/>
|
|
227
236
|
<selections-group
|
|
228
237
|
v-if="pathways && pathways.length > 0"
|
|
229
238
|
title="Pathways"
|
|
@@ -302,7 +311,6 @@
|
|
|
302
311
|
ref="tooltip"
|
|
303
312
|
class="tooltip"
|
|
304
313
|
:entry="tooltipEntry"
|
|
305
|
-
@resource-selected="resourceSelected"
|
|
306
314
|
/>
|
|
307
315
|
</div>
|
|
308
316
|
</div>
|
|
@@ -312,7 +320,8 @@
|
|
|
312
320
|
/* eslint-disable no-alert, no-console */
|
|
313
321
|
import Vue from "vue";
|
|
314
322
|
import Tooltip from "./Tooltip";
|
|
315
|
-
import SelectionsGroup from "./SelectionsGroup
|
|
323
|
+
import SelectionsGroup from "./SelectionsGroup";
|
|
324
|
+
import TreeControls from "./TreeControls";
|
|
316
325
|
import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
|
|
317
326
|
import SvgLegends from "./legends/SvgLegends";
|
|
318
327
|
import {
|
|
@@ -325,7 +334,7 @@ import {
|
|
|
325
334
|
import lang from "element-ui/lib/locale/lang/en";
|
|
326
335
|
import locale from "element-ui/lib/locale";
|
|
327
336
|
import flatmapMarker from "../icons/flatmap-marker";
|
|
328
|
-
import {FlatmapQueries} from "../services/flatmapQueries.js";
|
|
337
|
+
import {FlatmapQueries, findTaxonomyLabel} from "../services/flatmapQueries.js";
|
|
329
338
|
|
|
330
339
|
locale.use(lang);
|
|
331
340
|
Vue.use(Col);
|
|
@@ -335,6 +344,65 @@ Vue.use(RadioGroup);
|
|
|
335
344
|
Vue.use(Row);
|
|
336
345
|
const ResizeSensor = require("css-element-queries/src/ResizeSensor");
|
|
337
346
|
|
|
347
|
+
const processTaxon = (flatmapAPI, taxonIdentifiers) => {
|
|
348
|
+
let processed = [];
|
|
349
|
+
taxonIdentifiers.forEach(taxon => {
|
|
350
|
+
findTaxonomyLabel(flatmapAPI, taxon).then(value => {
|
|
351
|
+
const item = { taxon, label: value};
|
|
352
|
+
processed.push(item);
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
return processed;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const processFTUs = (parent, key) => {
|
|
360
|
+
const ftus = [];
|
|
361
|
+
let items = parent.organs ? parent.organs : parent.ftus;
|
|
362
|
+
const children = items ? items.filter(
|
|
363
|
+
(obj, index) =>
|
|
364
|
+
items.findIndex((item) => item.label === obj.label) === index
|
|
365
|
+
) : undefined
|
|
366
|
+
if (children) {
|
|
367
|
+
children.forEach(child => {
|
|
368
|
+
const data = {
|
|
369
|
+
label: child.label,
|
|
370
|
+
models: child.models,
|
|
371
|
+
key: `${key}.${child.label}`,
|
|
372
|
+
};
|
|
373
|
+
const grandChildren = processFTUs(child, data.key);
|
|
374
|
+
if (grandChildren.length > 0) {
|
|
375
|
+
data.children = grandChildren;
|
|
376
|
+
}
|
|
377
|
+
ftus.push(data);
|
|
378
|
+
})
|
|
379
|
+
}
|
|
380
|
+
return ftus;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const processSystems = systems => {
|
|
384
|
+
const allSystems = [];
|
|
385
|
+
if (systems && systems.length > 0) {
|
|
386
|
+
const data = { label: "All", key: "All", children: [] };
|
|
387
|
+
systems.forEach(system => {
|
|
388
|
+
const child = {
|
|
389
|
+
colour: system.colour,
|
|
390
|
+
enabled: system.enabled,
|
|
391
|
+
label: system.id,
|
|
392
|
+
key: system.id,
|
|
393
|
+
};
|
|
394
|
+
const children = processFTUs(system, child.key);
|
|
395
|
+
if (children.length > 0)
|
|
396
|
+
child.children = children;
|
|
397
|
+
data.children.push(child);
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
allSystems.push(data);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return allSystems;
|
|
404
|
+
}
|
|
405
|
+
|
|
338
406
|
const createUnfilledTooltipData = function (){
|
|
339
407
|
return {
|
|
340
408
|
destinations: [],
|
|
@@ -353,6 +421,7 @@ export default {
|
|
|
353
421
|
MapSvgIcon,
|
|
354
422
|
MapSvgSpriteColor,
|
|
355
423
|
Tooltip,
|
|
424
|
+
TreeControls,
|
|
356
425
|
SelectionsGroup,
|
|
357
426
|
SvgLegends
|
|
358
427
|
},
|
|
@@ -467,11 +536,14 @@ export default {
|
|
|
467
536
|
this.mapImp.enableSystem(payload.key, payload.value);
|
|
468
537
|
}
|
|
469
538
|
},
|
|
470
|
-
checkAllSystems: function(
|
|
539
|
+
checkAllSystems: function(flag) {
|
|
471
540
|
if (this.mapImp) {
|
|
472
|
-
|
|
541
|
+
this.systems[0].children.forEach(key => this.mapImp.enableSystem(key.label, flag));
|
|
473
542
|
}
|
|
474
543
|
},
|
|
544
|
+
ftuSelected: function(models) {
|
|
545
|
+
this.searchAndShowResult(models, true);
|
|
546
|
+
},
|
|
475
547
|
layersSelected: function(payload) {
|
|
476
548
|
if (this.mapImp) {
|
|
477
549
|
this.mapImp.enableLayer(payload.key, payload.value);
|
|
@@ -482,6 +554,16 @@ export default {
|
|
|
482
554
|
payload.keys.forEach(key => this.mapImp.enableLayer(key, payload.value));
|
|
483
555
|
}
|
|
484
556
|
},
|
|
557
|
+
taxonsSelected: function(payload) {
|
|
558
|
+
if (this.mapImp) {
|
|
559
|
+
this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value);
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
checkAllTaxons: function(payload) {
|
|
563
|
+
if (this.mapImp) {
|
|
564
|
+
payload.keys.forEach(key => this.mapImp.enableConnectivityByTaxonIds(key, payload.value));
|
|
565
|
+
}
|
|
566
|
+
},
|
|
485
567
|
pathwaysSelected: function(payload) {
|
|
486
568
|
if (this.mapImp) {
|
|
487
569
|
this.mapImp.enablePath(payload.key, payload.value);
|
|
@@ -510,12 +592,17 @@ export default {
|
|
|
510
592
|
label: label,
|
|
511
593
|
feature: data,
|
|
512
594
|
userData: args,
|
|
513
|
-
eventType: eventType
|
|
595
|
+
eventType: eventType,
|
|
596
|
+
provenanceTaxonomy: data.taxons ? JSON.parse(data.taxons) : undefined
|
|
514
597
|
};
|
|
598
|
+
if (eventType === "click") {
|
|
599
|
+
this.currentActive = data.models ? data.models : "";
|
|
600
|
+
} else if (eventType === "mouseenter") {
|
|
601
|
+
this.currentHover = data.models ? data.models : "";
|
|
602
|
+
}
|
|
515
603
|
if (data && data.type !== "marker" && eventType === "click"){
|
|
516
604
|
this.checkAndCreatePopups(payload);
|
|
517
605
|
}
|
|
518
|
-
this.$emit("resource-selected", payload);
|
|
519
606
|
} else {
|
|
520
607
|
this.$emit("pan-zoom-callback", data);
|
|
521
608
|
}
|
|
@@ -544,11 +631,8 @@ export default {
|
|
|
544
631
|
"block";
|
|
545
632
|
};
|
|
546
633
|
},
|
|
547
|
-
|
|
548
|
-
this
|
|
549
|
-
},
|
|
550
|
-
createTooltipFromNeuronCuration: function(data) {
|
|
551
|
-
this.tooltipEntry = this.flatmapQueries.createTooltipData(data);
|
|
634
|
+
createTooltipFromNeuronCuration: async function(data) {
|
|
635
|
+
this.tooltipEntry = await this.flatmapQueries.createTooltipData(data);
|
|
552
636
|
this.displayTooltip();
|
|
553
637
|
},
|
|
554
638
|
// Keeping this as an API
|
|
@@ -809,7 +893,8 @@ export default {
|
|
|
809
893
|
this.mapImp.enableCentrelines(false);
|
|
810
894
|
//Disable layers for now
|
|
811
895
|
//this.layers = this.mapImp.getLayers();
|
|
812
|
-
this.systems = this.mapImp.getSystems();
|
|
896
|
+
this.systems = processSystems(this.mapImp.getSystems());
|
|
897
|
+
this.taxonConnectivity = processTaxon(this.flatmapAPI, this.mapImp.taxonIdentifiers);
|
|
813
898
|
this.addResizeButtonToMinimap();
|
|
814
899
|
this.loading = false;
|
|
815
900
|
this.computePathControlsMaximumHeight();
|
|
@@ -966,6 +1051,7 @@ export default {
|
|
|
966
1051
|
}
|
|
967
1052
|
],
|
|
968
1053
|
systems: [],
|
|
1054
|
+
taxonConnectivity: [],
|
|
969
1055
|
pathwaysMaxHeight: 1000,
|
|
970
1056
|
hoverVisibilities: [
|
|
971
1057
|
{ value: false },
|
|
@@ -991,6 +1077,8 @@ export default {
|
|
|
991
1077
|
outlinesRadio: true,
|
|
992
1078
|
minimapResizeShow: false,
|
|
993
1079
|
minimapSmall: false,
|
|
1080
|
+
currentActive: "",
|
|
1081
|
+
currentHover: "",
|
|
994
1082
|
};
|
|
995
1083
|
},
|
|
996
1084
|
watch: {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<div class="path-visual" :style="getLineStyles(item)"></div>
|
|
34
34
|
</el-col>
|
|
35
35
|
<el-col :span="20">
|
|
36
|
-
<div
|
|
36
|
+
<div :style="getBackgroundStyles(item)">
|
|
37
37
|
{{item[labelKey]}}
|
|
38
38
|
</div>
|
|
39
39
|
</el-col>
|
|
@@ -188,6 +188,7 @@ export default {
|
|
|
188
188
|
font-weight: normal;
|
|
189
189
|
line-height: 20px;
|
|
190
190
|
margin-left: 8px;
|
|
191
|
+
white-space: nowrap;
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
.all-checkbox {
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
<el-main v-if="entry" class="main" v-loading="loading">
|
|
4
4
|
<div class="block" v-if="entry.title">
|
|
5
5
|
<span class="title">{{capitalise(entry.title)}}</span>
|
|
6
|
+
<div v-if="entry.provenanceTaxonomyLabel && entry.provenanceTaxonomyLabel.length > 0" class="subtitle">
|
|
7
|
+
{{provSpeciesDescription}}
|
|
8
|
+
</div>
|
|
6
9
|
</div>
|
|
7
10
|
<div class="block" v-else>
|
|
8
11
|
<span class="title">{{entry.featureId}}</span>
|
|
@@ -163,12 +166,18 @@ export default {
|
|
|
163
166
|
} else {
|
|
164
167
|
return this.originDescriptions.sensory
|
|
165
168
|
}
|
|
169
|
+
},
|
|
170
|
+
provSpeciesDescription: function(){
|
|
171
|
+
let text = "Observed in"
|
|
172
|
+
this.entry.provenanceTaxonomyLabel.forEach(label => {
|
|
173
|
+
text += ` ${label},`
|
|
174
|
+
});
|
|
175
|
+
text = text.slice(0,-1) // remove last comma
|
|
176
|
+
text += " species"
|
|
177
|
+
return text
|
|
166
178
|
}
|
|
167
179
|
},
|
|
168
180
|
methods: {
|
|
169
|
-
resourceSelected: function(action) {
|
|
170
|
-
this.$emit("resource-selected", action);
|
|
171
|
-
},
|
|
172
181
|
titleCase: function(title){
|
|
173
182
|
return titleCase(title)
|
|
174
183
|
},
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container">
|
|
3
|
+
<el-row>
|
|
4
|
+
<el-col :span="12">
|
|
5
|
+
<div class="title-text">
|
|
6
|
+
Systems
|
|
7
|
+
</div>
|
|
8
|
+
</el-col>
|
|
9
|
+
</el-row>
|
|
10
|
+
<div class="tree-container">
|
|
11
|
+
<el-tree
|
|
12
|
+
ref="tree"
|
|
13
|
+
node-key="key"
|
|
14
|
+
show-checkbox
|
|
15
|
+
:check-strictly="false"
|
|
16
|
+
:data="treeData"
|
|
17
|
+
:render-after-expand="false"
|
|
18
|
+
:default-expanded-keys="defaultExpandedKeys"
|
|
19
|
+
@check="checkChanged"
|
|
20
|
+
>
|
|
21
|
+
<span
|
|
22
|
+
slot-scope="{ node, data }"
|
|
23
|
+
class="region-tree-node"
|
|
24
|
+
:class="{
|
|
25
|
+
activeItem: nodeIsActive(data),
|
|
26
|
+
hoverItem: nodeIsHover(data),
|
|
27
|
+
}"
|
|
28
|
+
@click="changeActiveByNode(data)"
|
|
29
|
+
@mouseover="changeHoverByNode(data)"
|
|
30
|
+
>
|
|
31
|
+
<div :style="getBackgroundStyles(data)">
|
|
32
|
+
{{ node.label }}
|
|
33
|
+
</div>
|
|
34
|
+
</span>
|
|
35
|
+
</el-tree>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
/* eslint-disable no-alert, no-console */
|
|
42
|
+
import Vue from "vue";
|
|
43
|
+
import { Checkbox, CheckboxGroup, ColorPicker, Row, Tree } from "element-ui";
|
|
44
|
+
import lang from "element-ui/lib/locale/lang/en";
|
|
45
|
+
import locale from "element-ui/lib/locale";
|
|
46
|
+
locale.use(lang);
|
|
47
|
+
Vue.use(Checkbox);
|
|
48
|
+
Vue.use(CheckboxGroup);
|
|
49
|
+
Vue.use(ColorPicker);
|
|
50
|
+
Vue.use(Row);
|
|
51
|
+
Vue.use(Tree);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A vue component for toggling visibility of various regions.
|
|
55
|
+
*/
|
|
56
|
+
export default {
|
|
57
|
+
name: "TreeControls",
|
|
58
|
+
props: {
|
|
59
|
+
treeData: {
|
|
60
|
+
type: Array,
|
|
61
|
+
default: function () {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
active: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: ""
|
|
68
|
+
},
|
|
69
|
+
hover: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ""
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
data: function () {
|
|
75
|
+
return {
|
|
76
|
+
defaultExpandedKeys: ["All"],
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
destroyed: function () {
|
|
80
|
+
this.sortedPrimitiveGroups = undefined;
|
|
81
|
+
},
|
|
82
|
+
methods: {
|
|
83
|
+
nodeIsActive: function(data) {
|
|
84
|
+
return this.active === data.models;
|
|
85
|
+
},
|
|
86
|
+
nodeIsHover: function(data) {
|
|
87
|
+
return this.hover === data.models;
|
|
88
|
+
},
|
|
89
|
+
changeActiveByNode: function(data) {
|
|
90
|
+
if (data.models) {
|
|
91
|
+
this.$emit("change-active", data.models);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
changeHoverByNode: function() {
|
|
95
|
+
//if (data.models) {
|
|
96
|
+
// this.$emit("change-active", data.models);
|
|
97
|
+
//}
|
|
98
|
+
},
|
|
99
|
+
checkChanged: function (node, data) {
|
|
100
|
+
const isChecked = data.checkedKeys.includes(node.key);
|
|
101
|
+
if (node.key === "All") {
|
|
102
|
+
this.$emit("checkAll", isChecked);
|
|
103
|
+
} else {
|
|
104
|
+
this.$emit("changed", {key: node.key, value: isChecked});
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
getBackgroundStyles: function(node) {
|
|
108
|
+
if ('colour' in node) {
|
|
109
|
+
return { background: node.colour };
|
|
110
|
+
}
|
|
111
|
+
return {};
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
118
|
+
<style scoped lang="scss">
|
|
119
|
+
@import "~element-ui/packages/theme-chalk/src/checkbox";
|
|
120
|
+
@import "~element-ui/packages/theme-chalk/src/row";
|
|
121
|
+
@import "~element-ui/packages/theme-chalk/src/tree";
|
|
122
|
+
|
|
123
|
+
.checkbox-container {
|
|
124
|
+
display: flex;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.tree-controls {
|
|
129
|
+
position: absolute;
|
|
130
|
+
bottom: 0px;
|
|
131
|
+
transition: all 1s ease;
|
|
132
|
+
|
|
133
|
+
&:focus {
|
|
134
|
+
outline: none;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.container {
|
|
139
|
+
text-align: left;
|
|
140
|
+
overflow: none;
|
|
141
|
+
border: 1px solid rgb(220, 223, 230);
|
|
142
|
+
padding-top: 7px;
|
|
143
|
+
padding-bottom: 16px;
|
|
144
|
+
background: #ffffff;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.title-text {
|
|
148
|
+
width: 59px;
|
|
149
|
+
height: 20px;
|
|
150
|
+
color: rgb(48, 49, 51);
|
|
151
|
+
font-size: 14px;
|
|
152
|
+
font-weight: normal;
|
|
153
|
+
line-height: 20px;
|
|
154
|
+
margin-left: 8px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.all-checkbox {
|
|
158
|
+
float: right;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.tree-container {
|
|
162
|
+
width: 260px;
|
|
163
|
+
border: 1px solid rgb(144, 147, 153);
|
|
164
|
+
border-radius: 4px;
|
|
165
|
+
background: #ffffff;
|
|
166
|
+
margin-top: 6px;
|
|
167
|
+
scrollbar-width: thin;
|
|
168
|
+
|
|
169
|
+
::v-deep .el-tree {
|
|
170
|
+
max-height: 240px;
|
|
171
|
+
min-height: 130px;
|
|
172
|
+
overflow: auto;
|
|
173
|
+
&::-webkit-scrollbar {
|
|
174
|
+
width: 4px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&::-webkit-scrollbar-thumb {
|
|
178
|
+
border-radius: 10px;
|
|
179
|
+
box-shadow: inset 0 0 6px #c0c4cc;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
::v-deep .el-tree-node__content {
|
|
184
|
+
height: 22px;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
::v-deep .el-checkbox__input {
|
|
189
|
+
&.is-indeterminate,
|
|
190
|
+
&.is-checked {
|
|
191
|
+
.el-checkbox__inner {
|
|
192
|
+
background-color: $app-primary-color;
|
|
193
|
+
border-color: $app-primary-color;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
::v-deep .el-tree-node__children .el-tree-node__children .el-tree-node__content > label.el-checkbox {
|
|
199
|
+
display: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
::v-deep .el-checkbox__label {
|
|
203
|
+
padding-left: 5px;
|
|
204
|
+
color: $app-primary-color !important;
|
|
205
|
+
font-size: 12px;
|
|
206
|
+
font-weight: 500;
|
|
207
|
+
letter-spacing: 0px;
|
|
208
|
+
line-height: 14px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.activeItem {
|
|
212
|
+
background-color: #bbb !important;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.region-tree-node {
|
|
216
|
+
flex: 1;
|
|
217
|
+
color: $app-primary-color !important;
|
|
218
|
+
display: flex;
|
|
219
|
+
font-size: 12px;
|
|
220
|
+
line-height: 14px;
|
|
221
|
+
padding-left: 0px;
|
|
222
|
+
background-color: #fff;
|
|
223
|
+
width: 100%;
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.hoverItem {
|
|
228
|
+
background-color: #eee !important;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
</style>
|
|
232
|
+
|
|
@@ -4,6 +4,34 @@ const removeDuplicates = function(arrayOfAnything){
|
|
|
4
4
|
return [...new Set(arrayOfAnything.map(e => JSON.stringify(e)))].map(e => JSON.parse(e))
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
const cachedLabels = {};
|
|
8
|
+
|
|
9
|
+
const findTaxonomyLabel = async function(flatmapAPI, taxonomy){
|
|
10
|
+
if (cachedLabels && cachedLabels.hasOwnProperty(taxonomy)) {
|
|
11
|
+
return cachedLabels[taxonomy];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return new Promise(resolve=>{
|
|
15
|
+
fetch(`${flatmapAPI}knowledge/label/${taxonomy}`, {
|
|
16
|
+
method: 'GET',
|
|
17
|
+
})
|
|
18
|
+
.then(response => response.json())
|
|
19
|
+
.then(data => {
|
|
20
|
+
let label = data.label;
|
|
21
|
+
if (label === "Mammalia") {
|
|
22
|
+
label = "Mammalia not otherwise specified";
|
|
23
|
+
}
|
|
24
|
+
cachedLabels[taxonomy] = label;
|
|
25
|
+
resolve(label);
|
|
26
|
+
})
|
|
27
|
+
.catch((error) => {
|
|
28
|
+
console.error('Error:', error);
|
|
29
|
+
cachedLabels[taxonomy] = taxonomy;
|
|
30
|
+
resolve(taxonomy);
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
7
35
|
const inArray = function(ar1, ar2){
|
|
8
36
|
let as1 = JSON.stringify(ar1)
|
|
9
37
|
let as2 = JSON.stringify(ar2)
|
|
@@ -24,13 +52,21 @@ let FlatmapQueries = function(){
|
|
|
24
52
|
this.lookUp = []
|
|
25
53
|
}
|
|
26
54
|
|
|
27
|
-
this.createTooltipData = function (eventData) {
|
|
55
|
+
this.createTooltipData = async function (eventData) {
|
|
28
56
|
let hyperlinks = []
|
|
29
57
|
if (eventData.feature.hyperlinks && eventData.feature.hyperlinks.length > 0) {
|
|
30
58
|
hyperlinks = eventData.feature.hyperlinks
|
|
31
59
|
} else {
|
|
32
60
|
hyperlinks = this.urls.map(url=>({url: url, id: "pubmed"}))
|
|
33
61
|
}
|
|
62
|
+
let taxonomyLabel = undefined;
|
|
63
|
+
if (eventData.provenanceTaxonomy) {
|
|
64
|
+
taxonomyLabel = [];
|
|
65
|
+
for (let i = 0; eventData.provenanceTaxonomy.length > i; i++) {
|
|
66
|
+
taxonomyLabel.push(await findTaxonomyLabel(this.flatmapAPI, eventData.provenanceTaxonomy[i]))
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
34
70
|
let tooltipData = {
|
|
35
71
|
destinations: this.destinations,
|
|
36
72
|
origins: this.origins,
|
|
@@ -41,6 +77,8 @@ let FlatmapQueries = function(){
|
|
|
41
77
|
title: eventData.label,
|
|
42
78
|
featureId: eventData.resource,
|
|
43
79
|
hyperlinks: hyperlinks,
|
|
80
|
+
provenanceTaxonomy: eventData.provenanceTaxonomy,
|
|
81
|
+
provenanceTaxonomyLabel: taxonomyLabel
|
|
44
82
|
}
|
|
45
83
|
return tooltipData
|
|
46
84
|
}
|
|
@@ -371,4 +409,4 @@ let FlatmapQueries = function(){
|
|
|
371
409
|
}
|
|
372
410
|
}
|
|
373
411
|
|
|
374
|
-
export {FlatmapQueries}
|
|
412
|
+
export {FlatmapQueries, findTaxonomyLabel}
|