@abi-software/flatmapvuer 0.6.1-annotator.0 → 0.6.1-auth.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.
@@ -27,10 +27,10 @@
27
27
  :label="key"
28
28
  :value="key"
29
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>
30
+ <span class="select-box-icon">
31
+ <i :class="item.iconClass"></i>
32
+ </span>
33
+ {{ key }}
34
34
  </el-option>
35
35
  </el-select>
36
36
  </template>
@@ -40,7 +40,6 @@
40
40
  <FlatmapVuer
41
41
  v-for="(item, key) in speciesList"
42
42
  :key="key"
43
- :showLayer="showLayer"
44
43
  v-show="activeSpecies == key"
45
44
  :entry="item.taxo"
46
45
  :uuid="item.uuid"
@@ -53,15 +52,17 @@
53
52
  :openMapOptions="openMapOptions"
54
53
  :disableUI="disableUI"
55
54
  @view-latest-map="viewLatestMap"
56
- @resource-selected="FlatmapSelected"
55
+ @resource-selected="resourceSelected"
57
56
  @ready="FlatmapReady"
58
57
  @pan-zoom-callback="panZoomCallback"
59
- @open-map="$emit('open-map', $event)"
60
- :featureInfo="featureInfo"
58
+ @open-map="
59
+ /**
60
+ * This event is emitted when the user chooses a different map option
61
+ * from ``openMapOptions`` props.
62
+ * @arg $event
63
+ */
64
+ $emit('open-map', $event)"
61
65
  :minZoom="minZoom"
62
- :pathControls="pathControls"
63
- :searchable="searchable"
64
- :layerControl="layerControl"
65
66
  :helpMode="helpMode"
66
67
  :renderAtMounted="renderAtMounted"
67
68
  :displayMinimap="displayMinimap"
@@ -69,6 +70,7 @@
69
70
  style="height: 100%"
70
71
  :flatmapAPI="flatmapAPI"
71
72
  :sparcAPI="sparcAPI"
73
+ :userApiKey="userApiKey"
72
74
  />
73
75
  </div>
74
76
  </template>
@@ -78,7 +80,7 @@
78
80
  import { reactive } from 'vue'
79
81
  import EventBus from './EventBus'
80
82
  import FlatmapVuer from './FlatmapVuer.vue'
81
- import * as flatmap from 'customised-viewer'
83
+ import * as flatmap from '@abi-software/flatmap-viewer'
82
84
  import {
83
85
  ElCol as Col,
84
86
  ElOption as Option,
@@ -95,6 +97,9 @@ const TAXON_UUID = {
95
97
  'NCBITaxon:9685': '73060497-46a6-52bf-b975-cac511c127cb',
96
98
  }
97
99
 
100
+ /**
101
+ * A vue component to show a flatmap from the list of multiple flatmap data.
102
+ */
98
103
  export default {
99
104
  name: 'MultiFlatmapVuer',
100
105
  components: {
@@ -114,10 +119,15 @@ export default {
114
119
  mounted: function () {
115
120
  this.initialise()
116
121
  EventBus.on('onActionClick', (action) => {
117
- this.FlatmapSelected(action)
122
+ this.resourceSelected(action)
118
123
  })
119
124
  },
120
125
  methods: {
126
+ /**
127
+ * @vuese
128
+ * Function to initialise the component when mounted.
129
+ * It returns a promise.
130
+ */
121
131
  initialise: function () {
122
132
  return new Promise((resolve) => {
123
133
  if (this.requireInitialisation) {
@@ -192,37 +202,89 @@ export default {
192
202
  }
193
203
  })
194
204
  },
195
- FlatmapSelected: function (resource) {
196
- this.$emit('resource-selected', resource)
205
+ /**
206
+ * @vuese
207
+ * Function to emit ``resource-selected`` event with provided ``resource``.
208
+ * @arg action
209
+ */
210
+ resourceSelected: function (action) {
211
+ /**
212
+ * This event is emitted by ``resourceSelected`` method.
213
+ */
214
+ this.$emit('resource-selected', action)
197
215
  },
216
+ /**
217
+ * @vuese
218
+ * Function to emit ``ready`` event after the flatmap is loaded.
219
+ * @arg component
220
+ */
198
221
  FlatmapReady: function (component) {
222
+ /**
223
+ * This event is emitted by ``FlatmapReady`` method after the flatmap is loaded.
224
+ * @arg component
225
+ */
199
226
  this.$emit('ready', component)
200
227
  },
201
- getCoordinatesOfLastClick: function () {
202
- const flatmap = this.$refs[this.activeSpecies]
203
- if (flatmap && flatmap[0]) {
204
- return flatmap[0].getCoordinatesOfLastClick()
205
- }
206
- return undefined
207
- },
228
+ /**
229
+ * @vuese
230
+ * Function to get the current active map.
231
+ */
208
232
  getCurrentFlatmap: function () {
209
233
  return this.$refs[this.activeSpecies][0]
210
234
  },
235
+ /**
236
+ * @vuese
237
+ * Function to emit ``pan-zoom-callback`` event
238
+ * from the event emitted in ``callback`` function from ``MapManager.loadMap()``.
239
+ * @arg payload
240
+ */
211
241
  panZoomCallback: function (payload) {
242
+ /**
243
+ * The event emitted by ``panZoomCallback`` method.
244
+ * @arg payload
245
+ */
212
246
  this.$emit('pan-zoom-callback', payload)
213
247
  },
248
+ /**
249
+ * @vuese
250
+ * Function to show popup on map.
251
+ * @arg featureId,
252
+ * @arg node,
253
+ * @arg options
254
+ */
214
255
  showPopup: function (featureId, node, options) {
215
256
  let map = this.getCurrentFlatmap()
216
257
  map.showPopup(featureId, node, options)
217
258
  },
259
+ /**
260
+ * @vuese
261
+ * Function to show marker popup.
262
+ * @arg featureId,
263
+ * @arg node,
264
+ * @arg options
265
+ */
218
266
  showMarkerPopup: function (featureId, node, options) {
219
267
  let map = this.getCurrentFlatmap()
220
268
  map.showMarkerPopup(featureId, node, options)
221
269
  },
270
+ /**
271
+ * @vuese
272
+ * Function to set species.
273
+ * This function is called on the first load and
274
+ * when user changes the species.
275
+ * @arg species,
276
+ * @arg state,
277
+ * @arg numberOfRetry
278
+ */
222
279
  setSpecies: function (species, state, numberOfRetry) {
223
280
  if (this.$refs && species in this.$refs) {
224
281
  this.activeSpecies = species
225
282
  this.$refs[this.activeSpecies][0].createFlatmap(state)
283
+ /**
284
+ * This event is emitted by ``setSpecies`` method.
285
+ * Emitted on first load and when user changes species.
286
+ * @arg activeSpecies
287
+ */
226
288
  this.$emit('flatmapChanged', this.activeSpecies)
227
289
  } else if (numberOfRetry) {
228
290
  const retry = numberOfRetry - 1
@@ -234,8 +296,10 @@ export default {
234
296
  }
235
297
  },
236
298
  /**
299
+ * @vuese
237
300
  * Function to switch to the latest existing map from
238
301
  * a legacy map of the same species.
302
+ * @arg state
239
303
  *
240
304
  * @private
241
305
  */
@@ -254,7 +318,11 @@ export default {
254
318
  }
255
319
  },
256
320
  /**
321
+ * @vuese
257
322
  * Create a legacy entry with the provided information
323
+ * @arg state,
324
+ * @arg taxo,
325
+ * @arg uuid
258
326
  *
259
327
  * @private
260
328
  */
@@ -282,8 +350,10 @@ export default {
282
350
  }
283
351
  },
284
352
  /**
353
+ * @vuese
285
354
  * Function used to translate the legacy map state to one that can be used in current
286
355
  * flatmap if required. If it is a legacy, an Select entry will be added
356
+ * @arg state
287
357
  *
288
358
  * @private
289
359
  */
@@ -339,6 +409,7 @@ export default {
339
409
  })
340
410
  },
341
411
  /**
412
+ * @vuese
342
413
  * Function used for getting the current states of the scene. This exported states
343
414
  * can be imported using the importStates method.
344
415
  *
@@ -354,8 +425,10 @@ export default {
354
425
  return state
355
426
  },
356
427
  /**
428
+ * @vuese
357
429
  * Function used for importing the states of the scene. This exported states
358
430
  * can be imported using the read states method.
431
+ * @arg state
359
432
  *
360
433
  * @public
361
434
  */
@@ -377,31 +450,8 @@ export default {
377
450
  })
378
451
  }
379
452
  },
380
- resourceSelected: function (action) {
381
- this.$emit('resource-selected', action)
382
- },
383
453
  },
384
454
  props: {
385
- showLayer: {
386
- type: Boolean,
387
- default: false,
388
- },
389
- featureInfo: {
390
- type: Boolean,
391
- default: false,
392
- },
393
- pathControls: {
394
- type: Boolean,
395
- default: true,
396
- },
397
- searchable: {
398
- type: Boolean,
399
- default: false,
400
- },
401
- layerControl: {
402
- type: Boolean,
403
- default: false,
404
- },
405
455
  /**
406
456
  * Initial species for the flatmap.
407
457
  * This value will be ignored if a valid state object is provided.
@@ -410,22 +460,37 @@ export default {
410
460
  type: String,
411
461
  default: '',
412
462
  },
463
+ /**
464
+ * The minimum zoom level of the map.
465
+ */
413
466
  minZoom: {
414
467
  type: Number,
415
468
  default: 4,
416
469
  },
470
+ /**
471
+ * The option to create map on component mounted.
472
+ */
417
473
  renderAtMounted: {
418
474
  type: Boolean,
419
475
  default: false,
420
476
  },
477
+ /**
478
+ * The option to show tooltips for help mode.
479
+ */
421
480
  helpMode: {
422
481
  type: Boolean,
423
482
  default: false,
424
483
  },
484
+ /**
485
+ * The option to display minimap at the top-right corner of the map.
486
+ */
425
487
  displayMinimap: {
426
488
  type: Boolean,
427
489
  default: false,
428
490
  },
491
+ /**
492
+ * The option to show star in legend area.
493
+ */
429
494
  showStarInLegend: {
430
495
  type: Boolean,
431
496
  default: false,
@@ -438,11 +503,55 @@ export default {
438
503
  type: Boolean,
439
504
  default: false,
440
505
  },
506
+ /**
507
+ * The data to show different map options.
508
+ * Available at the bottom-left corner ("Open new map" tooltip).
509
+ */
441
510
  openMapOptions: {
442
511
  type: Array,
443
512
  },
513
+ /**
514
+ * The available species data for different maps.
515
+ * This data is used for multi flatmaps.
516
+ */
444
517
  availableSpecies: {
445
518
  type: Object,
519
+ /**
520
+ * ```{
521
+ 'Human Female': {
522
+ taxo: 'NCBITaxon:9606',
523
+ biologicalSex: 'PATO:0000383',
524
+ iconClass: 'mapicon-icon_human',
525
+ displayWarning: true,
526
+ },
527
+ 'Human Male': {
528
+ taxo: 'NCBITaxon:9606',
529
+ biologicalSex: 'PATO:0000384',
530
+ iconClass: 'mapicon-icon_human',
531
+ displayWarning: true,
532
+ },
533
+ Rat: {
534
+ taxo: 'NCBITaxon:10114',
535
+ iconClass: 'mapicon-icon_rat',
536
+ displayLatestChanges: true,
537
+ },
538
+ Mouse: {
539
+ taxo: 'NCBITaxon:10090',
540
+ iconClass: 'mapicon-icon_mouse',
541
+ displayWarning: true,
542
+ },
543
+ Pig: {
544
+ taxo: 'NCBITaxon:9823',
545
+ iconClass: 'mapicon-icon_pig',
546
+ displayWarning: true,
547
+ },
548
+ Cat: {
549
+ taxo: 'NCBITaxon:9685',
550
+ iconClass: 'mapicon-icon_cat',
551
+ displayWarning: true,
552
+ },
553
+ }```
554
+ */
446
555
  default: function () {
447
556
  return {
448
557
  'Human Female': {
@@ -494,9 +603,16 @@ export default {
494
603
  type: String,
495
604
  default: 'https://mapcore-demo.org/current/flatmap/v3/',
496
605
  },
606
+ /**
607
+ * Specify the endpoint of the SPARC API.
608
+ */
497
609
  sparcAPI: {
498
610
  type: String,
499
611
  default: 'https://api.sparc.science/',
612
+ },
613
+ userApiKey: {
614
+ type: String,
615
+ default: undefined,
500
616
  },
501
617
  /**
502
618
  * Flag to disable UIs on Map
@@ -567,6 +683,13 @@ export default {
567
683
  }
568
684
  }
569
685
  }
686
+
687
+ .select-box-icon {
688
+ display: inline-block;
689
+ width: 24px;
690
+ margin-right: 5px;
691
+ text-align: center;
692
+ }
570
693
  }
571
694
 
572
695
  .flatmap-dropdown {
@@ -15,11 +15,11 @@
15
15
  <div class="block" v-else>
16
16
  <span class="title">{{ entry.featureId }}</span>
17
17
  </div>
18
- <div v-show="showDetails" class="hide" @click="showDetails = false">
18
+ <div v-show="showDetails" class="hide" id="hide-path-info" @click="showDetails = false">
19
19
  Hide path information
20
20
  <el-icon><el-icon-arrow-up /></el-icon>
21
21
  </div>
22
- <div v-show="!showDetails" class="hide" @click="showDetails = true">
22
+ <div v-show="!showDetails" class="hide" id="show-path-info" @click="showDetails = true">
23
23
  Show path information
24
24
  <el-icon><el-icon-arrow-down /></el-icon>
25
25
  </div>
@@ -37,15 +37,17 @@
37
37
  >
38
38
  <template #reference>
39
39
  <el-icon class="info"><el-icon-warning /></el-icon>
40
- <span style="word-break: keep-all">
41
- <i>Origin</i> {{ originDescription }}
42
- </span>
43
40
  </template>
41
+ <span style="word-break: keep-all">
42
+ <i>Origin</i> {{ originDescription }}
43
+ </span>
44
+
44
45
  </el-popover>
45
46
  </div>
46
47
  <div
47
48
  v-for="(origin, i) in entry.origins"
48
49
  class="attribute-content"
50
+ :origin-item-label="origin"
49
51
  :key="origin"
50
52
  >
51
53
  {{ capitalise(origin) }}
@@ -56,6 +58,7 @@
56
58
  entry.originsWithDatasets && entry.originsWithDatasets.length > 0
57
59
  "
58
60
  class="button"
61
+ id="open-dendrites-button"
59
62
  @click="openDendrites"
60
63
  >
61
64
  Explore origin data
@@ -69,6 +72,7 @@
69
72
  <div
70
73
  v-for="(component, i) in entry.components"
71
74
  class="attribute-content"
75
+ :component-item-label="component"
72
76
  :key="component"
73
77
  >
74
78
  {{ capitalise(component) }}
@@ -92,15 +96,16 @@
92
96
  >
93
97
  <template #reference>
94
98
  <el-icon class="info"><el-icon-warning /></el-icon>
95
- <span style="word-break: keep-all">
96
- <i>Destination</i> is where the axons terminate
97
- </span>
98
99
  </template>
100
+ <span style="word-break: keep-all">
101
+ <i>Destination</i> is where the axons terminate
102
+ </span>
99
103
  </el-popover>
100
104
  </div>
101
105
  <div
102
106
  v-for="(destination, i) in entry.destinations"
103
107
  class="attribute-content"
108
+ :destination-item-label="destination"
104
109
  :key="destination"
105
110
  >
106
111
  {{ capitalise(destination) }}
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="dialog-container">
3
+ <el-row>
4
+ <span class="dialog-title" v-if="drawing">Finalise drawing</span>
5
+ <span class="dialog-title" v-else>Visualise relevance</span>
6
+ <el-row v-if="drawing">
7
+ <el-col :span="13">
8
+ <el-button type="primary" plain @click="$emit('confirm', true)">
9
+ Confirm
10
+ </el-button>
11
+ </el-col>
12
+ <el-col :span="11">
13
+ <el-button type="primary" plain @click="$emit('cancel', true)">
14
+ Cancel
15
+ </el-button>
16
+ </el-col>
17
+ </el-row>
18
+ <el-row v-else>
19
+ <el-button type="primary" plain @click="$emit('display', false)">
20
+ Close
21
+ </el-button>
22
+ </el-row>
23
+ </el-row>
24
+ <el-row v-if="relevance">
25
+ <el-row>
26
+ <el-col :span="23">
27
+ <b><span>Related Features</span></b>
28
+ </el-col>
29
+ <el-col :span="1">
30
+ <el-icon><el-icon-circle-close @click="$emit('popup', true)" /></el-icon>
31
+ </el-col>
32
+ </el-row>
33
+ <el-card shadow="hover" v-for="(value, key) in entry" :key="key" @click="$emit('tooltip', value)">
34
+ <span>{{ key }}</span>
35
+ </el-card>
36
+ </el-row>
37
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ /* eslint-disable no-alert, no-console */
42
+ import { CircleClose as ElIconCircleClose } from '@element-plus/icons-vue'
43
+ import {
44
+ ElRow as Row,
45
+ ElCol as Col,
46
+ ElCard as Card
47
+ } from 'element-plus'
48
+
49
+ export default {
50
+ name: 'RelevanceDialog',
51
+ components: {
52
+ Row,
53
+ Col,
54
+ Card
55
+ },
56
+ props: {
57
+ entry: {
58
+ type: Object,
59
+ },
60
+ drawing: {
61
+ type: Boolean,
62
+ default: false,
63
+ },
64
+ relevance: {
65
+ type: Boolean,
66
+ default: false,
67
+ }
68
+ },
69
+ }
70
+ </script>
71
+
72
+ <style lang="scss" scoped>
73
+ .dialog-container {
74
+ width: 200px;
75
+ height: fit-content;
76
+ text-align: justify;
77
+ border-radius: 4px;
78
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
79
+ pointer-events: auto;
80
+ background: #fff;
81
+ border: 1px solid $app-primary-color;
82
+ display: flex;
83
+ flex-direction: column;
84
+ padding: 1em 5px 1em 5px;
85
+ }
86
+
87
+ .dialog-title {
88
+ font-size: 18px;
89
+ font-weight: bold;
90
+ color: rgb(131, 0, 191);
91
+ }
92
+
93
+ .el-icon {
94
+ cursor: pointer;
95
+ }
96
+
97
+ :deep(.el-card) {
98
+ --el-card-padding: 8px;
99
+ border: 0;
100
+ cursor: pointer;
101
+ }
102
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="tooltip-container">
2
+ <div class="tooltip-container" id="tooltip-container">
3
3
  <template v-if="annotationDisplay">
4
4
  <annotation-tool :annotationEntry="annotationEntry" @annotation="$emit('annotation', $event)" />
5
5
  </template>
@@ -30,7 +30,7 @@ export default {
30
30
  },
31
31
  annotationEntry: {
32
32
  type: Object,
33
- },
33
+ }
34
34
  },
35
35
  }
36
36
  </script>
@@ -14,7 +14,6 @@ declare module 'vue' {
14
14
  ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
15
15
  ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
16
16
  ElCol: typeof import('element-plus/es')['ElCol']
17
- ElDialog: typeof import('element-plus/es')['ElDialog']
18
17
  ElIcon: typeof import('element-plus/es')['ElIcon']
19
18
  ElIconArrowDown: typeof import('@element-plus/icons-vue')['ArrowDown']
20
19
  ElIconArrowLeft: typeof import('@element-plus/icons-vue')['ArrowLeft']
@@ -39,6 +38,7 @@ declare module 'vue' {
39
38
  FlatmapVuer: typeof import('./components/FlatmapVuer.vue')['default']
40
39
  MultiFlatmapVuer: typeof import('./components/MultiFlatmapVuer.vue')['default']
41
40
  ProvenancePopup: typeof import('./components/ProvenancePopup.vue')['default']
41
+ RelevanceDialog: typeof import('./components/RelevanceDialog.vue')['default']
42
42
  SelectionsGroup: typeof import('./components/SelectionsGroup.vue')['default']
43
43
  SvgLegends: typeof import('./components/legends/SvgLegends.vue')['default']
44
44
  Tooltip: typeof import('./components/Tooltip.vue')['default']
@@ -1,4 +1,4 @@
1
- export default '<svg width="195px" height="24px" viewBox="0 0 160 24" fill="yellow">' +
1
+ export default '<svg width="195px" height="24px" viewBox="0 0 200 24" fill="yellow">' +
2
2
  '<path d="M22.0748 3.25583C22.4141 2.42845 23.5859 2.42845 23.9252 3.25583L25.6493 7.45955C25.793 7.80979 26.1221 8.04889 26.4995 8.07727L31.0303 8.41798C31.922 8.48504 32.2841 9.59942 31.6021 10.1778L28.1369 13.1166C27.8482 13.3614 27.7225 13.7483 27.8122 14.1161L28.8882 18.5304C29.1 19.3992 28.152 20.0879 27.3912 19.618L23.5255 17.2305C23.2034 17.0316 22.7966 17.0316 22.4745 17.2305L18.60881 19.618C17.84796 20.0879 16.9 19.3992 17.1118 18.5304L18.18785 14.1161C18.2775 13.7483 18.1518 13.3614 17.86309 13.1166L14.3979 10.1778C13.71588 9.59942 14.07796 8.48504 14.96971 8.41798L19.50046 8.07727C19.87794 8.04889 20.20704 7.80979 20.35068 7.45955L22.0748 3.25583Z" stroke="#000000" stroke-width="2"/>' +
3
3
  // Adjusting the x attribute and adding padding for the text element
4
4
  '<text x="42" y="50%" dominant-baseline="middle" text-anchor="start" font-family="Asap, sans-serif" font-size="12" fill="#000000">Featured dataset marker</text>' +
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable no-alert, no-console */
2
2
  // remove duplicates by stringifying the objects
3
3
  const removeDuplicates = function (arrayOfAnything) {
4
+ if (!arrayOfAnything) return []
4
5
  return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
5
6
  JSON.parse(e)
6
7
  )
@@ -35,6 +36,7 @@ const findTaxonomyLabel = async function (flatmapAPI, taxonomy) {
35
36
  }
36
37
 
37
38
  const inArray = function (ar1, ar2) {
39
+ if (!ar1 || !ar2) return false
38
40
  let as1 = JSON.stringify(ar1)
39
41
  let as2 = JSON.stringify(ar2)
40
42
  return as1.indexOf(as2) !== -1
package/vite.config.js CHANGED
@@ -11,7 +11,7 @@ export default defineConfig(({ command, mode }) => {
11
11
  css: {
12
12
  preprocessorOptions: {
13
13
  scss: {
14
- additionalData: `@use '${pathSrc}/assets/styles' as *;`
14
+ additionalData: `@use './src/assets/styles' as *;`
15
15
  },
16
16
  },
17
17
  },
@@ -55,6 +55,9 @@ export default defineConfig(({ command, mode }) => {
55
55
  },
56
56
  },
57
57
  },
58
+ optimizeDeps: {
59
+ entries: ['./cypress/*']
60
+ }
58
61
  };
59
62
 
60
63
  if (command === 'serve') {