@abi-software/map-utilities 0.0.0-beta.7 → 1.0.0-beta.1

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.
@@ -1,11 +1,11 @@
1
1
  <template>
2
- <div v-if="tooltipEntry" class="main" v-loading="loading">
3
- <div class="block" v-if="tooltipEntry.title">
4
- <div class="title">{{ capitalise(tooltipEntry.title) }}</div>
2
+ <div v-if="provenanceEntry" class="main" v-loading="loading">
3
+ <div class="block" v-if="provenanceEntry.title">
4
+ <div class="title">{{ capitalise(provenanceEntry.title) }}</div>
5
5
  <div
6
6
  v-if="
7
- tooltipEntry.provenanceTaxonomyLabel &&
8
- tooltipEntry.provenanceTaxonomyLabel.length > 0
7
+ provenanceEntry.provenanceTaxonomyLabel &&
8
+ provenanceEntry.provenanceTaxonomyLabel.length > 0
9
9
  "
10
10
  class="subtitle"
11
11
  >
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  </div>
15
15
  <div class="block" v-else>
16
- <div class="title">{{ tooltipEntry.featureId }}</div>
16
+ <div class="title">{{ provenanceEntry.featureId }}</div>
17
17
  </div>
18
18
  <div v-if="featuresAlert" class="attribute-title-container">
19
19
  <span class="attribute-title">Alert</span>
@@ -31,24 +31,6 @@
31
31
  </span>
32
32
  </el-popover>
33
33
  </div>
34
- <div class="block">
35
- <el-button
36
- class="button"
37
- @click="showImages = !showImages"
38
- >
39
- <span v-if="showImages">Hide images</span>
40
- <span v-else>View images at this location (Gallery)</span>
41
- </el-button>
42
- <div v-if="showImages" class="image-gallery-container">
43
- <Gallery :items="galleryItems" />
44
- </div>
45
- <el-button
46
- class="button"
47
- @click="viewImage(imageIframeURL[this.tooltipEntry.featureId[0]])"
48
- >
49
- <span>View images at this location (iFrame)</span>
50
- </el-button>
51
- </div>
52
34
  <div
53
35
  v-show="showDetails"
54
36
  class="hide"
@@ -69,8 +51,8 @@
69
51
  </div>
70
52
  <transition name="slide-fade">
71
53
  <div v-show="showDetails" class="content-container scrollbar">
72
- {{ tooltipEntry.paths }}
73
- <div v-if="tooltipEntry.origins && tooltipEntry.origins.length > 0" class="block">
54
+ {{ provenanceEntry.paths }}
55
+ <div v-if="provenanceEntry.origins && provenanceEntry.origins.length > 0" class="block">
74
56
  <div class="attribute-title-container">
75
57
  <span class="attribute-title">Origin</span>
76
58
  <el-popover
@@ -88,17 +70,17 @@
88
70
  </el-popover>
89
71
  </div>
90
72
  <div
91
- v-for="(origin, i) in tooltipEntry.origins"
73
+ v-for="(origin, i) in provenanceEntry.origins"
92
74
  class="attribute-content"
93
75
  :origin-item-label="origin"
94
76
  :key="origin"
95
77
  >
96
78
  {{ capitalise(origin) }}
97
- <div v-if="i != tooltipEntry.origins.length - 1" class="separator"></div>
79
+ <div v-if="i != provenanceEntry.origins.length - 1" class="separator"></div>
98
80
  </div>
99
81
  <el-button
100
82
  v-show="
101
- tooltipEntry.originsWithDatasets && tooltipEntry.originsWithDatasets.length > 0
83
+ provenanceEntry.originsWithDatasets && provenanceEntry.originsWithDatasets.length > 0
102
84
  "
103
85
  class="button"
104
86
  id="open-dendrites-button"
@@ -108,27 +90,27 @@
108
90
  </el-button>
109
91
  </div>
110
92
  <div
111
- v-if="tooltipEntry.components && tooltipEntry.components.length > 0"
93
+ v-if="provenanceEntry.components && provenanceEntry.components.length > 0"
112
94
  class="block"
113
95
  >
114
96
  <div class="attribute-title-container">
115
97
  <div class="attribute-title">Components</div>
116
98
  </div>
117
99
  <div
118
- v-for="(component, i) in tooltipEntry.components"
100
+ v-for="(component, i) in provenanceEntry.components"
119
101
  class="attribute-content"
120
102
  :component-item-label="component"
121
103
  :key="component"
122
104
  >
123
105
  {{ capitalise(component) }}
124
106
  <div
125
- v-if="i != tooltipEntry.components.length - 1"
107
+ v-if="i != provenanceEntry.components.length - 1"
126
108
  class="separator"
127
109
  ></div>
128
110
  </div>
129
111
  </div>
130
112
  <div
131
- v-if="tooltipEntry.destinations && tooltipEntry.destinations.length > 0"
113
+ v-if="provenanceEntry.destinations && provenanceEntry.destinations.length > 0"
132
114
  class="block"
133
115
  >
134
116
  <div class="attribute-title-container">
@@ -148,21 +130,21 @@
148
130
  </el-popover>
149
131
  </div>
150
132
  <div
151
- v-for="(destination, i) in tooltipEntry.destinations"
133
+ v-for="(destination, i) in provenanceEntry.destinations"
152
134
  class="attribute-content"
153
135
  :destination-item-label="destination"
154
136
  :key="destination"
155
137
  >
156
138
  {{ capitalise(destination) }}
157
139
  <div
158
- v-if="i != tooltipEntry.destinations.length - 1"
140
+ v-if="i != provenanceEntry.destinations.length - 1"
159
141
  class="separator"
160
142
  ></div>
161
143
  </div>
162
144
  <el-button
163
145
  v-show="
164
- tooltipEntry.destinationsWithDatasets &&
165
- tooltipEntry.destinationsWithDatasets.length > 0
146
+ provenanceEntry.destinationsWithDatasets &&
147
+ provenanceEntry.destinationsWithDatasets.length > 0
166
148
  "
167
149
  class="button"
168
150
  @click="openAxons"
@@ -173,8 +155,8 @@
173
155
 
174
156
  <el-button
175
157
  v-show="
176
- tooltipEntry.componentsWithDatasets &&
177
- tooltipEntry.componentsWithDatasets.length > 0
158
+ provenanceEntry.componentsWithDatasets &&
159
+ provenanceEntry.componentsWithDatasets.length > 0
178
160
  "
179
161
  class="button"
180
162
  @click="openAll"
@@ -189,20 +171,6 @@
189
171
  </template>
190
172
 
191
173
  <script>
192
- import Gallery from "@abi-software/gallery";
193
- import "@abi-software/gallery/dist/style.css";
194
- import {
195
- ArrowUp as ElIconArrowUp,
196
- ArrowDown as ElIconArrowDown,
197
- Warning as ElIconWarning,
198
- } from '@element-plus/icons-vue'
199
- /* eslint-disable no-alert, no-console */
200
- import {
201
- ElButton as Button,
202
- ElContainer as Container,
203
- ElIcon as Icon,
204
- } from 'element-plus'
205
-
206
174
  import EventBus from "../EventBus.js";
207
175
 
208
176
  const titleCase = (str) => {
@@ -216,43 +184,10 @@ const capitalise = function (str) {
216
184
  return "";
217
185
  };
218
186
 
219
- // TODO: temp data for testing
220
- const galleryItems = [
221
- {
222
- title: 'Title 1',
223
- type: 'data1',
224
- userData: 'https://sparc.science/',
225
- },
226
- {
227
- title: 'Title 2',
228
- type: 'data2',
229
- link: 'https://sparc.science/',
230
- },
231
- {
232
- title: 'Title 3',
233
- type: 'data3',
234
- link: 'https://sparc.science/',
235
- },
236
- ]
237
- const imageIframeURL = {
238
- 'UBERON:0000948': 'https://sparc.biolucida.net/image?c=MjIzNzItY29sLTI1NA%3D%3D',
239
- 'UBERON:0016508': 'https://sparc.biolucida.net/image?c=MjIzNzQtY29sLTI1NA%3D%3D',
240
- 'ILX:0793082': 'https://sparc.biolucida.net/image?c=MjIzNzUtY29sLTI1NA%3D%3D'
241
- }
242
-
243
187
  export default {
244
188
  name: "ProvenancePopup",
245
- components: {
246
- Button,
247
- Container,
248
- Icon,
249
- ElIconArrowUp,
250
- ElIconArrowDown,
251
- ElIconWarning,
252
- Gallery,
253
- },
254
189
  props: {
255
- tooltipEntry: {
190
+ provenanceEntry: {
256
191
  type: Object,
257
192
  default: () => ({
258
193
  destinations: [],
@@ -265,7 +200,7 @@ export default {
265
200
  }),
266
201
  },
267
202
  },
268
- inject: ["getFeaturesAlert"],
203
+ // inject: ["getFeaturesAlert"],
269
204
  data: function () {
270
205
  return {
271
206
  controller: undefined,
@@ -274,9 +209,6 @@ export default {
274
209
  loading: false,
275
210
  showToolip: false,
276
211
  showDetails: false,
277
- showImages: false,
278
- galleryItems: galleryItems,
279
- imageIframeURL: imageIframeURL,
280
212
  originDescriptions: {
281
213
  motor: "is the location of the initial cell body of the circuit",
282
214
  sensory: "is the location of the initial cell body in the PNS circuit",
@@ -287,20 +219,21 @@ export default {
287
219
  },
288
220
  computed: {
289
221
  featuresAlert() {
290
- return this.getFeaturesAlert();
222
+ // return this.getFeaturesAlert();
223
+ return ""
291
224
  },
292
225
  resources: function () {
293
226
  let resources = [];
294
- if (this.tooltipEntry && this.tooltipEntry.hyperlinks) {
295
- resources = this.tooltipEntry.hyperlinks;
227
+ if (this.provenanceEntry && this.provenanceEntry.hyperlinks) {
228
+ resources = this.provenanceEntry.hyperlinks;
296
229
  }
297
230
  return resources;
298
231
  },
299
232
  originDescription: function () {
300
233
  if (
301
- this.tooltipEntry &&
302
- this.tooltipEntry.title &&
303
- this.tooltipEntry.title.toLowerCase().includes("motor")
234
+ this.provenanceEntry &&
235
+ this.provenanceEntry.title &&
236
+ this.provenanceEntry.title.toLowerCase().includes("motor")
304
237
  ) {
305
238
  return this.originDescriptions.motor;
306
239
  } else {
@@ -309,7 +242,7 @@ export default {
309
242
  },
310
243
  provSpeciesDescription: function () {
311
244
  let text = "Studied in";
312
- this.tooltipEntry.provenanceTaxonomyLabel.forEach((label) => {
245
+ this.provenanceEntry.provenanceTaxonomyLabel.forEach((label) => {
313
246
  text += ` ${label},`;
314
247
  });
315
248
  text = text.slice(0, -1); // remove last comma
@@ -330,27 +263,24 @@ export default {
330
263
  openAll: function () {
331
264
  EventBus.emit("onActionClick", {
332
265
  type: "Facets",
333
- labels: this.tooltipEntry.componentsWithDatasets.map((a) => a.name),
266
+ labels: this.provenanceEntry.componentsWithDatasets.map((a) => a.name),
334
267
  });
335
268
  },
336
269
  openAxons: function () {
337
270
  EventBus.emit("onActionClick", {
338
271
  type: "Facets",
339
- labels: this.tooltipEntry.destinationsWithDatasets.map((a) => a.name),
272
+ labels: this.provenanceEntry.destinationsWithDatasets.map((a) => a.name),
340
273
  });
341
274
  },
342
275
  openDendrites: function () {
343
276
  EventBus.emit("onActionClick", {
344
277
  type: "Facets",
345
- labels: this.tooltipEntry.originsWithDatasets.map((a) => a.name),
278
+ labels: this.provenanceEntry.originsWithDatasets.map((a) => a.name),
346
279
  });
347
280
  },
348
281
  pubmedSearchUrlUpdate: function (val) {
349
282
  this.pubmedSearchUrl = val;
350
283
  },
351
- viewImage: function (url) {
352
- this.$emit('view-image', url);
353
- },
354
284
  },
355
285
  };
356
286
  </script>
@@ -581,18 +511,6 @@ export default {
581
511
  background-color: #979797;
582
512
  }
583
513
 
584
- .image-gallery-container {
585
- :deep(.gallery) {
586
- .gallery-strip {
587
- padding: 1rem 0;
588
- }
589
-
590
- > div {
591
- min-height: max-content !important;
592
- }
593
- }
594
- }
595
-
596
514
  /* Fix for chrome bug where under triangle pops up above one on top of it */
597
515
  .selector:not(*:root),
598
516
  .tooltip-container::after {
@@ -1,62 +1,49 @@
1
1
  <template>
2
2
  <div class="tooltip-container" id="tooltip-container">
3
- <template v-if="tooltipType === 'annotation' && annotationDisplay">
3
+ <template v-if="tooltipType === 'annotation'">
4
4
  <annotation-popup
5
5
  :annotationEntry="annotationEntry"
6
6
  @annotation="$emit('annotation', $event)"
7
7
  />
8
8
  </template>
9
9
  <template v-if="tooltipType === 'provenance'">
10
- <provenance-popup
11
- :tooltipEntry="tooltipEntry"
12
- @view-image="viewImage"
13
- />
10
+ <provenance-popup :provenanceEntry="provenanceEntry" />
14
11
  </template>
15
- <template v-if="tooltipType === 'image-gallery'">
16
- <image-gallery-popup
17
- :galleryItems="galleryItems"
18
- @viewImage="viewImage"
19
- />
12
+ <template v-if="tooltipType === 'image'">
13
+ <image-gallery-popup :imageEntry="imageEntry" />
20
14
  </template>
21
15
  </div>
22
16
  </template>
23
17
 
24
18
  <script>
25
- import EventBus from '../EventBus.js';
19
+ import EventBus from "../EventBus.js";
26
20
 
27
21
  export default {
28
22
  name: "Tooltip",
29
23
  props: {
30
- tooltipEntry: {
31
- type: Object,
32
- },
33
24
  tooltipType: {
34
25
  type: String,
35
- default: 'provenance',
26
+ default: "",
36
27
  },
37
- annotationDisplay: {
38
- type: Boolean,
39
- default: false,
28
+ provenanceEntry: {
29
+ type: Object,
30
+ default: {},
40
31
  },
41
32
  annotationEntry: {
42
33
  type: Object,
34
+ default: {},
43
35
  },
44
- galleryItems: {
36
+ imageEntry: {
45
37
  type: Array,
46
- default: () => [],
38
+ default: [],
47
39
  },
48
40
  },
49
- mounted: function() {
41
+ mounted: function () {
50
42
  // Emit events from child components
51
43
  EventBus.on("onActionClick", (data) => {
52
44
  this.$emit("onActionClick", data);
53
45
  });
54
46
  },
55
- methods: {
56
- viewImage: function (url) {
57
- this.$emit('view-image', url)
58
- }
59
- }
60
47
  };
61
48
  </script>
62
49
 
@@ -2,6 +2,5 @@ import DrawToolbar from "./DrawToolbar/DrawToolbar.vue";
2
2
  import HelpModeDialog from "./HelpModeDialog/HelpModeDialog.vue";
3
3
  import Tooltip from "./Tooltip/Tooltip.vue";
4
4
  import TreeControls from "./TreeControls/TreeControls.vue";
5
- import IframeImageDialog from "./ImageDialog/IframeImageDialog.vue";
6
5
 
7
- export { DrawToolbar, HelpModeDialog, Tooltip, TreeControls, IframeImageDialog };
6
+ export { DrawToolbar, HelpModeDialog, Tooltip, TreeControls };
@@ -33,7 +33,6 @@ declare module 'vue' {
33
33
  ElTree: typeof import('element-plus/es')['ElTree']
34
34
  ExternalResourceCard: typeof import('./components/Tooltip/ExternalResourceCard.vue')['default']
35
35
  HelpModeDialog: typeof import('./components/HelpModeDialog/HelpModeDialog.vue')['default']
36
- IframeImageDialog: typeof import('./components/ImageDialog/IframeImageDialog.vue')['default']
37
36
  ImageGalleryPopup: typeof import('./components/Tooltip/ImageGalleryPopup.vue')['default']
38
37
  ProvenancePopup: typeof import('./components/Tooltip/ProvenancePopup.vue')['default']
39
38
  Tooltip: typeof import('./components/Tooltip/Tooltip.vue')['default']
@@ -1,70 +0,0 @@
1
- <template>
2
- <div class="image-dialog" v-if="imageIframeOpen">
3
- <div class="map-iframe-container">
4
- <iframe
5
- class="my-iframe"
6
- :src="imageIframeURL">
7
- </iframe>
8
- </div>
9
- <button
10
- class="image-dialog-close"
11
- @click="closeImageIframe"
12
- >
13
- Close
14
- </button>
15
- </div>
16
- </template>
17
-
18
- <script>
19
- export default {
20
- name: 'IframeImageDialog',
21
- props: {
22
- imageIframeOpen: false,
23
- imageIframeURL: ''
24
- },
25
- methods: {
26
- closeImageIframe: function () {
27
- this.$emit('closeImageIframe')
28
- },
29
- }
30
- }
31
- </script>
32
-
33
- <style lang="scss" scoped>
34
- .image-dialog {
35
- position: fixed;
36
- top: 0;
37
- left: 0;
38
- width: 100%;
39
- height: 100%;
40
- background-color: rgba(#000, 0.9);
41
- z-index: 1000;
42
- display: flex;
43
- align-items: center;
44
- justify-content: center;
45
-
46
- .image-dialog-close {
47
- position: absolute;
48
- top: 1rem;
49
- right: 1rem;
50
- padding: 4px;
51
- border: 2px solid;
52
- border-radius: 4px;
53
- }
54
-
55
- .map-iframe-container {
56
- height: 80%;
57
- width: 80%;
58
- background: #fff;
59
- border: 1px solid black;
60
- overflow: hidden;
61
- }
62
-
63
- .my-iframe {
64
- height:100%;
65
- width:100%;
66
- position:relative;
67
- border-width:0px;
68
- }
69
- }
70
- </style>
@@ -1,42 +0,0 @@
1
- export default {
2
- // Note that the setting store is included in MapContent.vue
3
- methods: {
4
- findImagesForSpeciesFromGalleryItems: function (galleryItems, speciesToFind) {
5
- let imageList = []
6
- galleryItems.forEach((image) => {
7
- if (image.species && image.species.length > 0) {
8
- image.species.forEach((species) => {
9
- if (species.species && species.species.curie === speciesToFind) {
10
- imageList.push(image)
11
- }
12
- })
13
- }
14
- })
15
- return imageList
16
- },
17
- findAllSpeciesFromGalleryItems: function (galleryItems) {
18
- let speciesList = [];
19
- let speciesSet = new Set();
20
-
21
- galleryItems.forEach((image) => {
22
- if (image.species && image.species.length > 0) {
23
- image.species.forEach((species) => {
24
- if (species.species) {
25
- let ispc = species.species;
26
- if (!speciesSet.has(ispc.curie)) {
27
- speciesSet.add(ispc.curie);
28
- speciesList.push({ 'taxon': ispc.curie, 'name': ispc.name, 'count': 1});
29
- } else {
30
- speciesList.forEach((sp) => {
31
- if (sp.taxon === ispc.curie) sp.count++;
32
- });
33
- }
34
- }
35
- });
36
- }
37
- });
38
-
39
- return speciesList;
40
- },
41
- }
42
- }