@abi-software/map-utilities 1.4.3-beta.1 → 1.4.3-isan.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/dist/map-utilities.js +17535 -34359
- package/dist/map-utilities.umd.cjs +67 -246
- package/dist/style.css +1 -1
- package/package.json +1 -6
- package/src/App.vue +100 -41
- package/src/components/ConnectivityList/ConnectivityList.vue +0 -14
- package/src/components/Tooltip/ExternalResourceCard.vue +39 -69
- package/src/components/Tooltip/ProvenancePopup.vue +109 -149
- package/src/components/Tooltip/Tooltip.vue +1 -1
- package/src/components/utilities.js +0 -40
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="
|
|
3
|
-
<div
|
|
4
|
-
<
|
|
2
|
+
<div v-if="entry" class="main" v-loading="loading">
|
|
3
|
+
<div v-if="tooltipEntry.length > 1" class="toggle-button">
|
|
4
|
+
<el-popover width="auto" trigger="hover" :teleported="false">
|
|
5
|
+
<template #reference>
|
|
6
|
+
<el-button
|
|
7
|
+
class="button"
|
|
8
|
+
@click="previous"
|
|
9
|
+
:disabled="this.entryIndex === 0"
|
|
10
|
+
>
|
|
11
|
+
Previous
|
|
12
|
+
</el-button>
|
|
13
|
+
</template>
|
|
14
|
+
<span>{{ previousLabel }}</span>
|
|
15
|
+
</el-popover>
|
|
16
|
+
<el-popover width="auto" trigger="hover" :teleported="false">
|
|
17
|
+
<template #reference>
|
|
18
|
+
<el-button
|
|
19
|
+
class="button"
|
|
20
|
+
@click="next"
|
|
21
|
+
:disabled="this.entryIndex === this.tooltipEntry.length - 1"
|
|
22
|
+
>
|
|
23
|
+
Next
|
|
24
|
+
</el-button>
|
|
25
|
+
</template>
|
|
26
|
+
<span>{{ nextLabel }}</span>
|
|
27
|
+
</el-popover>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="block" v-if="entry.title">
|
|
30
|
+
<div class="title">{{ capitalise(entry.title) }}</div>
|
|
5
31
|
<div
|
|
6
32
|
v-if="
|
|
7
|
-
|
|
8
|
-
|
|
33
|
+
entry.provenanceTaxonomyLabel &&
|
|
34
|
+
entry.provenanceTaxonomyLabel.length > 0
|
|
9
35
|
"
|
|
10
36
|
class="subtitle"
|
|
11
37
|
>
|
|
@@ -13,9 +39,9 @@
|
|
|
13
39
|
</div>
|
|
14
40
|
</div>
|
|
15
41
|
<div class="block" v-else>
|
|
16
|
-
<div class="title">{{
|
|
42
|
+
<div class="title">{{ entry.featureId }}</div>
|
|
17
43
|
</div>
|
|
18
|
-
<div v-if="featuresAlert" class="attribute-title-container">
|
|
44
|
+
<div v-if="entry.featuresAlert" class="attribute-title-container">
|
|
19
45
|
<span class="attribute-title">Alert</span>
|
|
20
46
|
<el-popover
|
|
21
47
|
width="250"
|
|
@@ -27,7 +53,7 @@
|
|
|
27
53
|
<el-icon class="info"><el-icon-warning /></el-icon>
|
|
28
54
|
</template>
|
|
29
55
|
<span style="word-break: keep-all">
|
|
30
|
-
{{ featuresAlert }}
|
|
56
|
+
{{ entry.featuresAlert }}
|
|
31
57
|
</span>
|
|
32
58
|
</el-popover>
|
|
33
59
|
</div>
|
|
@@ -52,8 +78,8 @@
|
|
|
52
78
|
<transition name="slide-fade">
|
|
53
79
|
<div v-show="showDetails" class="content-container scrollbar">
|
|
54
80
|
<connectivity-list
|
|
55
|
-
:key="
|
|
56
|
-
:entry="
|
|
81
|
+
:key="entry.featureId[0]"
|
|
82
|
+
:entry="entry"
|
|
57
83
|
:origins="origins"
|
|
58
84
|
:components="components"
|
|
59
85
|
:destinations="destinations"
|
|
@@ -62,9 +88,11 @@
|
|
|
62
88
|
:destinationsWithDatasets="destinationsWithDatasets"
|
|
63
89
|
:availableAnatomyFacets="availableAnatomyFacets"
|
|
64
90
|
@connectivity-action-click="onConnectivityActionClick"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
91
|
+
/>
|
|
92
|
+
<external-resource-card
|
|
93
|
+
v-if="resources.length"
|
|
94
|
+
:resources="resources"
|
|
95
|
+
/>
|
|
68
96
|
</div>
|
|
69
97
|
</transition>
|
|
70
98
|
</div>
|
|
@@ -75,11 +103,11 @@ import {
|
|
|
75
103
|
ArrowUp as ElIconArrowUp,
|
|
76
104
|
ArrowDown as ElIconArrowDown,
|
|
77
105
|
Warning as ElIconWarning,
|
|
78
|
-
} from
|
|
106
|
+
} from "@element-plus/icons-vue";
|
|
79
107
|
import EventBus from "../EventBus.js";
|
|
80
|
-
import ConnectivityList from
|
|
81
|
-
import ExternalResourceCard from
|
|
82
|
-
import { capitalise, titleCase } from
|
|
108
|
+
import ConnectivityList from "../ConnectivityList/ConnectivityList.vue";
|
|
109
|
+
import ExternalResourceCard from "./ExternalResourceCard.vue";
|
|
110
|
+
import { capitalise, titleCase } from "../utilities.js";
|
|
83
111
|
|
|
84
112
|
export default {
|
|
85
113
|
name: "ProvenancePopup",
|
|
@@ -92,19 +120,10 @@ export default {
|
|
|
92
120
|
},
|
|
93
121
|
props: {
|
|
94
122
|
tooltipEntry: {
|
|
95
|
-
type:
|
|
96
|
-
default:
|
|
97
|
-
destinations: [],
|
|
98
|
-
origins: [],
|
|
99
|
-
components: [],
|
|
100
|
-
destinationsWithDatasets: [],
|
|
101
|
-
originsWithDatasets: [],
|
|
102
|
-
componentsWithDatasets: [],
|
|
103
|
-
resource: undefined,
|
|
104
|
-
}),
|
|
123
|
+
type: Array,
|
|
124
|
+
default: [],
|
|
105
125
|
},
|
|
106
126
|
},
|
|
107
|
-
inject: ["getFeaturesAlert"],
|
|
108
127
|
data: function () {
|
|
109
128
|
return {
|
|
110
129
|
loading: false,
|
|
@@ -113,61 +132,71 @@ export default {
|
|
|
113
132
|
motor: "is the location of the initial cell body of the circuit",
|
|
114
133
|
sensory: "is the location of the initial cell body in the PNS circuit",
|
|
115
134
|
},
|
|
116
|
-
|
|
117
|
-
components: [],
|
|
118
|
-
destinations: [],
|
|
119
|
-
originsWithDatasets: [],
|
|
120
|
-
componentsWithDatasets: [],
|
|
121
|
-
destinationsWithDatasets: [],
|
|
135
|
+
entryIndex: 0,
|
|
122
136
|
availableAnatomyFacets: [],
|
|
123
137
|
};
|
|
124
138
|
},
|
|
125
|
-
watch: {
|
|
126
|
-
tooltipEntry: {
|
|
127
|
-
handler: function (val) {
|
|
128
|
-
this.updateConnectionsData(val);
|
|
129
|
-
},
|
|
130
|
-
immediate: true,
|
|
131
|
-
deep: true,
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
139
|
computed: {
|
|
135
|
-
|
|
136
|
-
return this.
|
|
140
|
+
entry: function () {
|
|
141
|
+
return this.tooltipEntry[this.entryIndex];
|
|
137
142
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
resources = this.tooltipEntry.hyperlinks;
|
|
143
|
+
previousLabel: function () {
|
|
144
|
+
if (this.entryIndex === 0) {
|
|
145
|
+
return "This is the first item. Click 'Next' to see more information.";
|
|
142
146
|
}
|
|
143
|
-
return
|
|
147
|
+
return this.tooltipEntry[this.entryIndex - 1]?.title;
|
|
144
148
|
},
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
this.tooltipEntry.title &&
|
|
149
|
-
this.tooltipEntry.title.toLowerCase().includes("motor")
|
|
150
|
-
) {
|
|
151
|
-
return this.originDescriptions.motor;
|
|
152
|
-
} else {
|
|
153
|
-
return this.originDescriptions.sensory;
|
|
149
|
+
nextLabel: function () {
|
|
150
|
+
if (this.entryIndex === this.tooltipEntry.length - 1) {
|
|
151
|
+
return "This is the last item. Click 'Previous' to see more information.";
|
|
154
152
|
}
|
|
153
|
+
return this.tooltipEntry[this.entryIndex + 1]?.title;
|
|
155
154
|
},
|
|
156
155
|
provSpeciesDescription: function () {
|
|
157
156
|
let text = "Studied in";
|
|
158
|
-
this.
|
|
157
|
+
this.entry.provenanceTaxonomyLabel.forEach((label) => {
|
|
159
158
|
text += ` ${label},`;
|
|
160
159
|
});
|
|
161
160
|
text = text.slice(0, -1); // remove last comma
|
|
162
161
|
text += " species";
|
|
163
162
|
return text;
|
|
164
163
|
},
|
|
164
|
+
origins: function () {
|
|
165
|
+
return this.entry.origins;
|
|
166
|
+
},
|
|
167
|
+
components: function () {
|
|
168
|
+
return this.entry.components;
|
|
169
|
+
},
|
|
170
|
+
destinations: function () {
|
|
171
|
+
return this.entry.destinations;
|
|
172
|
+
},
|
|
173
|
+
originsWithDatasets: function () {
|
|
174
|
+
return this.entry.originsWithDatasets;
|
|
175
|
+
},
|
|
176
|
+
componentsWithDatasets: function () {
|
|
177
|
+
return this.entry.componentsWithDatasets;
|
|
178
|
+
},
|
|
179
|
+
destinationsWithDatasets: function () {
|
|
180
|
+
return this.entry.destinationsWithDatasets;
|
|
181
|
+
},
|
|
182
|
+
resources: function () {
|
|
183
|
+
return this.entry.hyperlinks;
|
|
184
|
+
},
|
|
165
185
|
},
|
|
166
186
|
mounted: function () {
|
|
167
187
|
this.loadAvailableAnatomyFacets();
|
|
168
|
-
this.updateConnectionsData(this.tooltipEntry);
|
|
169
188
|
},
|
|
170
189
|
methods: {
|
|
190
|
+
previous: function () {
|
|
191
|
+
if (this.entryIndex !== 0) {
|
|
192
|
+
this.entryIndex = this.entryIndex - 1;
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
next: function () {
|
|
196
|
+
if (this.entryIndex !== this.tooltipEntry.length - 1) {
|
|
197
|
+
this.entryIndex = this.entryIndex + 1;
|
|
198
|
+
}
|
|
199
|
+
},
|
|
171
200
|
titleCase: function (title) {
|
|
172
201
|
return titleCase(title);
|
|
173
202
|
},
|
|
@@ -175,33 +204,32 @@ export default {
|
|
|
175
204
|
return capitalise(text);
|
|
176
205
|
},
|
|
177
206
|
onConnectivityActionClick: function (data) {
|
|
178
|
-
EventBus.emit(
|
|
207
|
+
EventBus.emit("onActionClick", data);
|
|
179
208
|
},
|
|
180
209
|
// Load available anatomy facets from the local storage if available.
|
|
181
210
|
// The data is from Algolia in Sidebar.
|
|
182
211
|
loadAvailableAnatomyFacets: function () {
|
|
183
|
-
const availableAnatomyFacets = localStorage.getItem(
|
|
184
|
-
|
|
212
|
+
const availableAnatomyFacets = localStorage.getItem(
|
|
213
|
+
"available-anatomy-facets"
|
|
214
|
+
);
|
|
185
215
|
if (availableAnatomyFacets) {
|
|
186
216
|
this.availableAnatomyFacets = JSON.parse(availableAnatomyFacets);
|
|
187
217
|
}
|
|
188
218
|
},
|
|
189
|
-
updateConnectionsData: function (source) {
|
|
190
|
-
this.origins = source.origins;
|
|
191
|
-
this.components = source.components;
|
|
192
|
-
this.destinations = source.destinations;
|
|
193
|
-
this.originsWithDatasets = source.originsWithDatasets;
|
|
194
|
-
this.componentsWithDatasets = source.componentsWithDatasets;
|
|
195
|
-
this.destinationsWithDatasets = source.destinationsWithDatasets;
|
|
196
|
-
},
|
|
197
219
|
},
|
|
198
220
|
};
|
|
199
221
|
</script>
|
|
200
222
|
|
|
201
223
|
<style lang="scss" scoped>
|
|
202
|
-
.
|
|
203
|
-
|
|
204
|
-
|
|
224
|
+
.toggle-button {
|
|
225
|
+
display: flex;
|
|
226
|
+
justify-content: space-between;
|
|
227
|
+
|
|
228
|
+
.is-disabled {
|
|
229
|
+
color: #fff !important;
|
|
230
|
+
background-color: #ac76c5 !important;
|
|
231
|
+
border: 1px solid #ac76c5 !important;
|
|
232
|
+
}
|
|
205
233
|
}
|
|
206
234
|
|
|
207
235
|
.title {
|
|
@@ -223,43 +251,12 @@ export default {
|
|
|
223
251
|
}
|
|
224
252
|
}
|
|
225
253
|
|
|
226
|
-
.pub {
|
|
227
|
-
width: 16rem;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.icon {
|
|
231
|
-
right: 0px;
|
|
232
|
-
position: absolute;
|
|
233
|
-
top: 10px;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.icon:hover {
|
|
237
|
-
cursor: pointer;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
:deep(.popover-origin-help.el-popover) {
|
|
241
|
-
text-transform: none !important; // need to overide the tooltip text transform
|
|
242
|
-
border: 1px solid $app-primary-color;
|
|
243
|
-
.el-popper__arrow {
|
|
244
|
-
&:before {
|
|
245
|
-
border-color: $app-primary-color;
|
|
246
|
-
background-color: #ffffff;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
254
|
.info {
|
|
252
255
|
transform: rotate(180deg);
|
|
253
256
|
color: #8300bf;
|
|
254
257
|
margin-left: 8px;
|
|
255
258
|
}
|
|
256
259
|
|
|
257
|
-
.separator {
|
|
258
|
-
width: 90%;
|
|
259
|
-
height: 1px;
|
|
260
|
-
background-color: #bfbec2;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
260
|
.hide {
|
|
264
261
|
color: $app-primary-color;
|
|
265
262
|
cursor: pointer;
|
|
@@ -267,17 +264,6 @@ export default {
|
|
|
267
264
|
margin-top: 3px;
|
|
268
265
|
}
|
|
269
266
|
|
|
270
|
-
.slide-fade-enter-active {
|
|
271
|
-
transition: opacity 0.5s, transform 0.5s;
|
|
272
|
-
}
|
|
273
|
-
.slide-fade-leave-active {
|
|
274
|
-
transition: opacity 0.2s, transform 0.2s;
|
|
275
|
-
}
|
|
276
|
-
.slide-fade-enter, .slide-fade-leave-to /* .slide-fade-leave-active in <2.1.8 */ {
|
|
277
|
-
opacity: 0;
|
|
278
|
-
transform: translateY(-8px);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
267
|
.main {
|
|
282
268
|
font-size: 14px;
|
|
283
269
|
text-align: left;
|
|
@@ -310,11 +296,6 @@ export default {
|
|
|
310
296
|
}
|
|
311
297
|
}
|
|
312
298
|
|
|
313
|
-
.popover-container {
|
|
314
|
-
height: 100%;
|
|
315
|
-
width: 100%;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
299
|
.main {
|
|
319
300
|
.el-button.is-round {
|
|
320
301
|
border-radius: 4px;
|
|
@@ -330,9 +311,11 @@ export default {
|
|
|
330
311
|
font-size: 14px !important;
|
|
331
312
|
background-color: $app-primary-color;
|
|
332
313
|
color: #fff;
|
|
314
|
+
|
|
333
315
|
& + .button {
|
|
334
316
|
margin-top: 10px !important;
|
|
335
317
|
}
|
|
318
|
+
|
|
336
319
|
&:hover {
|
|
337
320
|
color: #fff !important;
|
|
338
321
|
background: #ac76c5 !important;
|
|
@@ -340,27 +323,6 @@ export default {
|
|
|
340
323
|
}
|
|
341
324
|
}
|
|
342
325
|
|
|
343
|
-
.tooltip-container {
|
|
344
|
-
&::after,
|
|
345
|
-
&::before {
|
|
346
|
-
content: "";
|
|
347
|
-
display: block;
|
|
348
|
-
position: absolute;
|
|
349
|
-
width: 0;
|
|
350
|
-
height: 0;
|
|
351
|
-
border-style: solid;
|
|
352
|
-
flex-shrink: 0;
|
|
353
|
-
}
|
|
354
|
-
.tooltip {
|
|
355
|
-
&::after {
|
|
356
|
-
display: none;
|
|
357
|
-
}
|
|
358
|
-
&::before {
|
|
359
|
-
display: none;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
326
|
.maplibregl-popup-anchor-bottom {
|
|
365
327
|
.tooltip-container {
|
|
366
328
|
&::after,
|
|
@@ -368,10 +330,12 @@ export default {
|
|
|
368
330
|
top: 100%;
|
|
369
331
|
border-width: 12px;
|
|
370
332
|
}
|
|
333
|
+
|
|
371
334
|
&::after {
|
|
372
335
|
margin-top: -1px;
|
|
373
336
|
border-color: rgb(255, 255, 255) transparent transparent transparent;
|
|
374
337
|
}
|
|
338
|
+
|
|
375
339
|
&::before {
|
|
376
340
|
margin: 0 auto;
|
|
377
341
|
border-color: $app-primary-color transparent transparent transparent;
|
|
@@ -386,10 +350,12 @@ export default {
|
|
|
386
350
|
top: -24px;
|
|
387
351
|
border-width: 12px;
|
|
388
352
|
}
|
|
353
|
+
|
|
389
354
|
&::after {
|
|
390
355
|
margin-top: 1px;
|
|
391
356
|
border-color: transparent transparent rgb(255, 255, 255) transparent;
|
|
392
357
|
}
|
|
358
|
+
|
|
393
359
|
&::before {
|
|
394
360
|
margin: 0 auto;
|
|
395
361
|
border-color: transparent transparent $app-primary-color transparent;
|
|
@@ -427,10 +393,4 @@ export default {
|
|
|
427
393
|
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
|
|
428
394
|
background-color: #979797;
|
|
429
395
|
}
|
|
430
|
-
|
|
431
|
-
/* Fix for chrome bug where under triangle pops up above one on top of it */
|
|
432
|
-
.selector:not(*:root),
|
|
433
|
-
.tooltip-container::after {
|
|
434
|
-
top: 99.4%;
|
|
435
|
-
}
|
|
436
396
|
</style>
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { Cite, plugins } from '@citation-js/core';
|
|
2
|
-
import '@citation-js/plugin-doi';
|
|
3
|
-
import '@citation-js/plugin-csl';
|
|
4
|
-
import '@citation-js/plugin-bibtex';
|
|
5
|
-
import '@citation-js/plugin-pubmed';
|
|
6
|
-
|
|
7
1
|
const capitalise = term => {
|
|
8
2
|
if (term)
|
|
9
3
|
return term.charAt(0).toUpperCase() + term.slice(1);
|
|
@@ -60,43 +54,9 @@ const delay = (ms) => {
|
|
|
60
54
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
61
55
|
};
|
|
62
56
|
|
|
63
|
-
/**
|
|
64
|
-
* @param {id} id - DOI or PMID
|
|
65
|
-
* @param {options:type} type - type of the ID, e.g., 'pmid'
|
|
66
|
-
* @param {options:format} format - 'apa' (default), 'chicago', 'ieee', 'bibtex', etc.
|
|
67
|
-
* @returns {citation} formatted citation text
|
|
68
|
-
*/
|
|
69
|
-
const getCitationById = async (id, { type, format }) => {
|
|
70
|
-
// because 'chicago' and 'ieee' are not in citation.js default styles
|
|
71
|
-
if ((format !== 'bibtex') && (format !== 'apa')) {
|
|
72
|
-
const xml = `https://raw.githubusercontent.com/citation-style-language/styles/refs/heads/master/${format}.csl`;
|
|
73
|
-
const response = await fetch(xml);
|
|
74
|
-
const template = await response.text();
|
|
75
|
-
let config = plugins.config.get('@csl');
|
|
76
|
-
config.templates.add(format, template);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const option = {};
|
|
80
|
-
|
|
81
|
-
if (type === 'pmid') {
|
|
82
|
-
option['forceType'] = '@pubmed/id';
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const cite = await Cite.async(id, option);
|
|
86
|
-
const citation = (format === 'bibtex') ?
|
|
87
|
-
cite.format(format) :
|
|
88
|
-
cite.format('bibliography', {
|
|
89
|
-
format: 'html',
|
|
90
|
-
template: format || 'apa', // default as 'apa' style
|
|
91
|
-
lang: 'en-US'
|
|
92
|
-
})
|
|
93
|
-
return citation;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
57
|
export {
|
|
97
58
|
capitalise,
|
|
98
59
|
titleCase,
|
|
99
60
|
xmlToJSON,
|
|
100
61
|
delay,
|
|
101
|
-
getCitationById,
|
|
102
62
|
};
|