@abi-software/flatmapvuer 0.5.5-beta.0 → 0.5.5

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-lock.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.5.5-beta.0",
3
+ "version": "0.5.5",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
7
7
  "@abi-software/flatmap-viewer": {
8
- "version": "2.3.4",
9
- "resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.3.4.tgz",
10
- "integrity": "sha512-p6xHf6sArnv5Cr0P9KwyPwI+rgTyL20KJVilbVAHiRCZ+zMCaNGpXctuwBHmOSpf7YfPku8U+OLHgMkAxTqdOA==",
8
+ "version": "2.4.1-b.5",
9
+ "resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.4.1-b.5.tgz",
10
+ "integrity": "sha512-ScVaE0s7FB0dInpQ2FLC0eJ9tY1GGGu4aAY2oogQveC6+yfCmBPl5d6BXRuqtxfrlNSQyHRM14BRmE0B0OcjHg==",
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": ">=2.4.0",
21
+ "maplibre-gl": ">=3.0.0",
22
22
  "minisearch": "^2.2.1",
23
23
  "polylabel": "^1.1.0"
24
24
  }
@@ -1357,14 +1357,12 @@
1357
1357
  "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q=="
1358
1358
  },
1359
1359
  "@maplibre/maplibre-gl-style-spec": {
1360
- "version": "19.2.1",
1361
- "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.2.1.tgz",
1362
- "integrity": "sha512-ZVT5QlkVhlxlPav+ca0NO3Moc7EzbHDO2FXW4ic3Q0Vm+TDUw9I8A2EBws7xUUQZf7HQB3kQ+3Jsh5mFLRD4GQ==",
1360
+ "version": "19.3.0",
1361
+ "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.3.0.tgz",
1362
+ "integrity": "sha512-ZbhX9CTV+Z7vHwkRIasDOwTSzr76e8Q6a55RMsAibjyX6+P0ZNL1qAKNzOjjBDP3+aEfNMl7hHo5knuY6pTAUQ==",
1363
1363
  "requires": {
1364
1364
  "@mapbox/jsonlint-lines-primitives": "~2.0.2",
1365
- "@mapbox/point-geometry": "^0.1.0",
1366
1365
  "@mapbox/unitbezier": "^0.0.1",
1367
- "@types/mapbox__point-geometry": "^0.1.2",
1368
1366
  "json-stringify-pretty-compact": "^3.0.0",
1369
1367
  "minimist": "^1.2.8",
1370
1368
  "rw": "^1.3.3",
@@ -3128,9 +3126,9 @@
3128
3126
  }
3129
3127
  },
3130
3128
  "bezier-js": {
3131
- "version": "6.1.3",
3132
- "resolved": "https://registry.npmjs.org/bezier-js/-/bezier-js-6.1.3.tgz",
3133
- "integrity": "sha512-VPFvkyO98oCJ1Tsi+bFBrKEWLdefAj4DJVaWp3xTEsdCbunC7Pt/nTeIgu/UdskBNcmHv8TOfsgdMZb1GsICmg=="
3129
+ "version": "6.1.4",
3130
+ "resolved": "https://registry.npmjs.org/bezier-js/-/bezier-js-6.1.4.tgz",
3131
+ "integrity": "sha512-PA0FW9ZpcHbojUCMu28z9Vg/fNkwTj5YhusSAjHHDfHDGLxJ6YUKrAN2vk1fP2MMOxVw4Oko16FMlRGVBGqLKg=="
3134
3132
  },
3135
3133
  "bfj": {
3136
3134
  "version": "6.1.2",
@@ -8270,9 +8268,9 @@
8270
8268
  }
8271
8269
  },
8272
8270
  "maplibre-gl": {
8273
- "version": "3.0.1",
8274
- "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.0.1.tgz",
8275
- "integrity": "sha512-OdFpejEkvaDwwVT9qAn6oA2h7093VlemaenF2/ssfD3TadNPz5oIVPzywn3cgso5i1D7IMKvEpba0A8A5qvXow==",
8271
+ "version": "3.2.0",
8272
+ "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.2.0.tgz",
8273
+ "integrity": "sha512-TOo/cV9r8Xy3ngbJtY6JUC7rpjpObrsdO5pt14l5OIw4gY1v5XnxWP16VDSe0zRoncFfDCEBDmRwhfEFwtlbvw==",
8276
8274
  "requires": {
8277
8275
  "@mapbox/geojson-rewind": "^0.5.2",
8278
8276
  "@mapbox/jsonlint-lines-primitives": "^2.0.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.5.5-beta.0",
3
+ "version": "0.5.5",
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.3.3-b.4",
30
+ "@abi-software/flatmap-viewer": "^2.4.1-b.5",
31
31
  "@abi-software/svg-sprite": "^0.3.0",
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);
@@ -138,6 +139,7 @@ export default {
138
139
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
139
140
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
140
141
  flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v4/"
142
+ //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
141
143
  //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
142
144
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
143
145
  }
@@ -178,17 +178,15 @@
178
178
  v-html="flatmapMarker"
179
179
  v-popover:markerPopover
180
180
  ></div>
181
- <selections-group
181
+ <tree-controls
182
182
  v-if="isFC && systems && systems.length > 0"
183
- title="Systems"
184
- labelKey="name"
185
- identifierKey="id"
186
- :selections="systems"
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
- ref="systemsSelection"
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"
@@ -253,31 +262,13 @@
253
262
  trigger="click"
254
263
  popper-class="open-map-popper non-selectable"
255
264
  >
256
- <el-row>
257
- <el-button
258
- type="primary"
259
- plain
260
- @click="$emit('open-map', 'AC')"
261
- >
262
- Open AC Map
263
- </el-button>
264
- </el-row>
265
- <el-row>
266
- <el-button
267
- type="primary"
268
- plain
269
- @click="$emit('open-map', 'FC')"
270
- >
271
- Open FC Map
272
- </el-button>
273
- </el-row>
274
- <el-row>
265
+ <el-row v-for="item in openMapOptions" :key="item.key">
275
266
  <el-button
276
267
  type="primary"
277
268
  plain
278
- @click="$emit('open-map', '3D')"
269
+ @click="$emit('open-map', item.key)"
279
270
  >
280
- Open 3D Map
271
+ {{item.display}}
281
272
  </el-button>
282
273
  </el-row>
283
274
  </el-popover>
@@ -329,7 +320,7 @@
329
320
  popper-class="flatmap-popper right-popper"
330
321
  >
331
322
  <map-svg-icon
332
- v-if="enableOpenMapUI"
323
+ v-if="enableOpenMapUI && openMapOptions.length > 0"
333
324
  slot="reference"
334
325
  v-popover:open-map-popover
335
326
  icon="openMap"
@@ -363,7 +354,6 @@
363
354
  ref="tooltip"
364
355
  class="tooltip"
365
356
  :entry="tooltipEntry"
366
- @resource-selected="resourceSelected"
367
357
  />
368
358
  </div>
369
359
  </div>
@@ -373,7 +363,8 @@
373
363
  /* eslint-disable no-alert, no-console */
374
364
  import Vue from "vue";
375
365
  import Tooltip from "./Tooltip";
376
- import SelectionsGroup from "./SelectionsGroup.vue";
366
+ import SelectionsGroup from "./SelectionsGroup";
367
+ import TreeControls from "./TreeControls";
377
368
  import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
378
369
  import SvgLegends from "./legends/SvgLegends";
379
370
  import {
@@ -387,7 +378,7 @@ import {
387
378
  import lang from "element-ui/lib/locale/lang/en";
388
379
  import locale from "element-ui/lib/locale";
389
380
  import flatmapMarker from "../icons/flatmap-marker";
390
- import {FlatmapQueries} from "../services/flatmapQueries.js";
381
+ import {FlatmapQueries, findTaxonomyLabel} from "../services/flatmapQueries.js";
391
382
 
392
383
  locale.use(lang);
393
384
  Vue.use(Button);
@@ -398,6 +389,65 @@ Vue.use(RadioGroup);
398
389
  Vue.use(Row);
399
390
  const ResizeSensor = require("css-element-queries/src/ResizeSensor");
400
391
 
392
+ const processTaxon = (flatmapAPI, taxonIdentifiers) => {
393
+ let processed = [];
394
+ taxonIdentifiers.forEach(taxon => {
395
+ findTaxonomyLabel(flatmapAPI, taxon).then(value => {
396
+ const item = { taxon, label: value};
397
+ processed.push(item);
398
+ });
399
+ });
400
+
401
+ return processed;
402
+ }
403
+
404
+ const processFTUs = (parent, key) => {
405
+ const ftus = [];
406
+ let items = parent.organs ? parent.organs : parent.ftus;
407
+ const children = items ? items.filter(
408
+ (obj, index) =>
409
+ items.findIndex((item) => item.label === obj.label) === index
410
+ ) : undefined
411
+ if (children) {
412
+ children.forEach(child => {
413
+ const data = {
414
+ label: child.label,
415
+ models: child.models,
416
+ key: `${key}.${child.label}`,
417
+ };
418
+ const grandChildren = processFTUs(child, data.key);
419
+ if (grandChildren.length > 0) {
420
+ data.children = grandChildren;
421
+ }
422
+ ftus.push(data);
423
+ })
424
+ }
425
+ return ftus;
426
+ }
427
+
428
+ const processSystems = systems => {
429
+ const allSystems = [];
430
+ if (systems && systems.length > 0) {
431
+ const data = { label: "All", key: "All", children: [] };
432
+ systems.forEach(system => {
433
+ const child = {
434
+ colour: system.colour,
435
+ enabled: system.enabled,
436
+ label: system.id,
437
+ key: system.id,
438
+ };
439
+ const children = processFTUs(system, child.key);
440
+ if (children.length > 0)
441
+ child.children = children;
442
+ data.children.push(child);
443
+ });
444
+
445
+ allSystems.push(data);
446
+ }
447
+
448
+ return allSystems;
449
+ }
450
+
401
451
  const createUnfilledTooltipData = function (){
402
452
  return {
403
453
  destinations: [],
@@ -416,6 +466,7 @@ export default {
416
466
  MapSvgIcon,
417
467
  MapSvgSpriteColor,
418
468
  Tooltip,
469
+ TreeControls,
419
470
  SelectionsGroup,
420
471
  SvgLegends
421
472
  },
@@ -530,11 +581,14 @@ export default {
530
581
  this.mapImp.enableSystem(payload.key, payload.value);
531
582
  }
532
583
  },
533
- checkAllSystems: function(payload) {
584
+ checkAllSystems: function(flag) {
534
585
  if (this.mapImp) {
535
- payload.keys.forEach(key => this.mapImp.enableSystem(key, payload.value));
586
+ this.systems[0].children.forEach(key => this.mapImp.enableSystem(key.label, flag));
536
587
  }
537
588
  },
589
+ ftuSelected: function(models) {
590
+ this.searchAndShowResult(models, true);
591
+ },
538
592
  layersSelected: function(payload) {
539
593
  if (this.mapImp) {
540
594
  this.mapImp.enableLayer(payload.key, payload.value);
@@ -545,6 +599,16 @@ export default {
545
599
  payload.keys.forEach(key => this.mapImp.enableLayer(key, payload.value));
546
600
  }
547
601
  },
602
+ taxonsSelected: function(payload) {
603
+ if (this.mapImp) {
604
+ this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value);
605
+ }
606
+ },
607
+ checkAllTaxons: function(payload) {
608
+ if (this.mapImp) {
609
+ payload.keys.forEach(key => this.mapImp.enableConnectivityByTaxonIds(key, payload.value));
610
+ }
611
+ },
548
612
  pathwaysSelected: function(payload) {
549
613
  if (this.mapImp) {
550
614
  this.mapImp.enablePath(payload.key, payload.value);
@@ -573,12 +637,17 @@ export default {
573
637
  label: label,
574
638
  feature: data,
575
639
  userData: args,
576
- eventType: eventType
640
+ eventType: eventType,
641
+ provenanceTaxonomy: data.taxons ? JSON.parse(data.taxons) : undefined
577
642
  };
643
+ if (eventType === "click") {
644
+ this.currentActive = data.models ? data.models : "";
645
+ } else if (eventType === "mouseenter") {
646
+ this.currentHover = data.models ? data.models : "";
647
+ }
578
648
  if (data && data.type !== "marker" && eventType === "click"){
579
649
  this.checkAndCreatePopups(payload);
580
650
  }
581
- this.$emit("resource-selected", payload);
582
651
  } else {
583
652
  this.$emit("pan-zoom-callback", data);
584
653
  }
@@ -607,11 +676,8 @@ export default {
607
676
  "block";
608
677
  };
609
678
  },
610
- resourceSelected: function(action) {
611
- this.$emit("resource-selected", action);
612
- },
613
- createTooltipFromNeuronCuration: function(data) {
614
- this.tooltipEntry = this.flatmapQueries.createTooltipData(data);
679
+ createTooltipFromNeuronCuration: async function(data) {
680
+ this.tooltipEntry = await this.flatmapQueries.createTooltipData(data);
615
681
  this.displayTooltip();
616
682
  },
617
683
  // Keeping this as an API
@@ -872,7 +938,8 @@ export default {
872
938
  this.mapImp.enableCentrelines(false);
873
939
  //Disable layers for now
874
940
  //this.layers = this.mapImp.getLayers();
875
- this.systems = this.mapImp.getSystems();
941
+ this.systems = processSystems(this.mapImp.getSystems());
942
+ this.taxonConnectivity = processTaxon(this.flatmapAPI, this.mapImp.taxonIdentifiers);
876
943
  this.addResizeButtonToMinimap();
877
944
  this.loading = false;
878
945
  this.computePathControlsMaximumHeight();
@@ -982,6 +1049,25 @@ export default {
982
1049
  type: Boolean,
983
1050
  default: false,
984
1051
  },
1052
+ openMapOptions: {
1053
+ type: Array,
1054
+ default: function () {
1055
+ return [
1056
+ {
1057
+ display: "Open AC Map",
1058
+ key: "AC"
1059
+ },
1060
+ {
1061
+ display: "Open FC Map",
1062
+ key: "FC"
1063
+ },
1064
+ {
1065
+ display: "Open 3D Human Map",
1066
+ key: "3D"
1067
+ },
1068
+ ]
1069
+ },
1070
+ },
985
1071
  isLegacy: {
986
1072
  type: Boolean,
987
1073
  default: false
@@ -992,7 +1078,7 @@ export default {
992
1078
  },
993
1079
  latestChangesMessage: {
994
1080
  type: String,
995
- default: "Search now provide suggested terms. Add new legends. New tilesets. New female map. Improve upstream downstream information.",
1081
+ default: "'Observed In' controls and information are now included in AC maps. System control with FTU information has been added to the FC map.",
996
1082
  },
997
1083
  /**
998
1084
  * State containing state of the flatmap.
@@ -1037,6 +1123,7 @@ export default {
1037
1123
  }
1038
1124
  ],
1039
1125
  systems: [],
1126
+ taxonConnectivity: [],
1040
1127
  pathwaysMaxHeight: 1000,
1041
1128
  hoverVisibilities: [
1042
1129
  { value: false },
@@ -1063,6 +1150,8 @@ export default {
1063
1150
  outlinesRadio: true,
1064
1151
  minimapResizeShow: false,
1065
1152
  minimapSmall: false,
1153
+ currentActive: "",
1154
+ currentHover: "",
1066
1155
  };
1067
1156
  },
1068
1157
  watch: {
@@ -1386,8 +1475,8 @@ export default {
1386
1475
  background-color: #ffffff;
1387
1476
  border: 1px solid $app-primary-color;
1388
1477
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
1389
- width: 128px;
1390
- min-width: 128px;
1478
+ width: 178px;
1479
+ min-width: 178px;
1391
1480
 
1392
1481
  .el-row ~ .el-row {
1393
1482
  margin-top: 8px;
@@ -38,6 +38,7 @@
38
38
  :isLegacy="item.isLegacy"
39
39
  :ref="key"
40
40
  :enableOpenMapUI="enableOpenMapUI"
41
+ :openMapOptions="openMapOptions"
41
42
  @view-latest-map="viewLatestMap"
42
43
  @resource-selected="FlatmapSelected"
43
44
  @ready="FlatmapReady"
@@ -387,6 +388,9 @@ export default {
387
388
  type: Boolean,
388
389
  default: false,
389
390
  },
391
+ openMapOptions: {
392
+ type: Array
393
+ },
390
394
  availableSpecies: {
391
395
  type: Object,
392
396
  default: function() {
@@ -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 class="label-text" :style="getBackgroundStyles(item)">
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
  },