@abi-software/flatmapvuer 0.5.7 → 0.5.9-beta.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.
@@ -0,0 +1,425 @@
1
+ <template>
2
+ <el-main v-if="entry" class="main" v-loading="loading">
3
+ <div class="block" v-if="entry.title">
4
+ <span class="title">{{capitalise(entry.title)}}</span>
5
+ <div v-if="entry.provenanceTaxonomyLabel && entry.provenanceTaxonomyLabel.length > 0" class="subtitle">
6
+ {{provSpeciesDescription}}
7
+ </div>
8
+ </div>
9
+ <div class="block" v-else>
10
+ <span class="title">{{entry.featureId}}</span>
11
+ </div>
12
+ <div v-show="showDetails" class="hide" @click="showDetails = false">
13
+ Hide path information
14
+ <i class="el-icon-arrow-up"></i>
15
+ </div>
16
+ <div v-show="!showDetails" class="hide" @click="showDetails = true">
17
+ Show path information
18
+ <i class="el-icon-arrow-down"></i>
19
+ </div>
20
+ <transition name="slide-fade">
21
+ <div v-show="showDetails" class="content-container scrollbar">
22
+ {{entry.paths}}
23
+ <div v-if="entry.origins && entry.origins.length > 0" class="block">
24
+ <div>
25
+ <span class="attribute-title">Origin</span>
26
+ <el-popover
27
+ width="250"
28
+ trigger="hover"
29
+ :append-to-body=false
30
+ popper-class="popover-origin-help"
31
+ >
32
+ <i slot="reference" class="el-icon-warning-outline info"/>
33
+ <span style="word-break: keep-all;">
34
+ <i>Origin</i> {{originDescription}}
35
+ </span>
36
+ </el-popover>
37
+ </div>
38
+ <div v-for="(origin, i) in entry.origins" class="attribute-content" :key="origin">
39
+ {{ capitalise(origin) }}
40
+ <div v-if="i != entry.origins.length - 1" class="seperator"></div>
41
+ </div>
42
+ <el-button v-show="entry.originsWithDatasets && entry.originsWithDatasets.length > 0" class="button" @click="openDendrites">
43
+ Explore origin data
44
+ </el-button>
45
+ </div>
46
+ <div v-if="entry.components && entry.components.length > 0" class="block">
47
+ <div class="attribute-title">Components</div>
48
+ <div v-for="(component, i) in entry.components" class="attribute-content" :key="component">
49
+ {{ capitalise(component) }}
50
+ <div v-if="i != entry.components.length - 1" class="seperator"></div>
51
+ </div>
52
+ </div>
53
+ <div v-if="entry.destinations && entry.destinations.length > 0" class="block">
54
+ <div>
55
+ <span class="attribute-title">Destination</span>
56
+ <el-popover
57
+ width="250"
58
+ trigger="hover"
59
+ :append-to-body=false
60
+ popper-class="popover-origin-help"
61
+ >
62
+ <i slot="reference" class="el-icon-warning-outline info"/>
63
+ <span style="word-break: keep-all;">
64
+ <i>Destination</i> is where the axons terminate
65
+ </span>
66
+ </el-popover>
67
+ </div>
68
+ <div v-for="(destination, i) in entry.destinations" class="attribute-content" :key="destination">
69
+ {{ capitalise(destination) }}
70
+ <div v-if="i != entry.destinations.length - 1" class="seperator"></div>
71
+ </div>
72
+ <el-button v-show="entry.destinationsWithDatasets && entry.destinationsWithDatasets.length > 0" class="button" @click="openAxons">
73
+ Explore destination data
74
+ </el-button>
75
+ </div>
76
+
77
+ <el-button v-show="entry.componentsWithDatasets && entry.componentsWithDatasets.length > 0" class="button" @click="openAll">
78
+ Search for data on components
79
+ </el-button>
80
+
81
+ <external-resource-card :resources="resources"></external-resource-card>
82
+
83
+ </div>
84
+ </transition>
85
+ </el-main>
86
+ </template>
87
+
88
+
89
+ <script>
90
+ /* eslint-disable no-alert, no-console */
91
+ import Vue from "vue";
92
+ import {
93
+ Button,
94
+ Container,
95
+ Icon,
96
+ Main
97
+ } from "element-ui";
98
+ import lang from "element-ui/lib/locale/lang/en";
99
+ import locale from "element-ui/lib/locale";
100
+ locale.use(lang);
101
+ Vue.use(Button);
102
+ Vue.use(Container);
103
+ Vue.use(Icon);
104
+ Vue.use(Main);
105
+
106
+ import EventBus from './EventBus'
107
+ import ExternalResourceCard from './ExternalResourceCard.vue';
108
+
109
+ const titleCase = (str) => {
110
+ return str.replace(/\w\S*/g, (t) => { return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase() });
111
+ }
112
+
113
+ const capitalise = function(str){
114
+ if (str)
115
+ return str.charAt(0).toUpperCase() + str.slice(1)
116
+ return ""
117
+ }
118
+
119
+ export default {
120
+ components: { ExternalResourceCard },
121
+ name: "ProvenancePopup",
122
+ props: {
123
+ entry: {
124
+ type: Object,
125
+ default: () => ({
126
+ destinations: [],
127
+ origins: [],
128
+ components: [],
129
+ destinationsWithDatasets: [],
130
+ originsWithDatasets: [],
131
+ componentsWithDatasets: [],
132
+ resource: undefined
133
+ })
134
+ },
135
+ },
136
+ data: function() {
137
+ return {
138
+ controller: undefined,
139
+ activeSpecies: undefined,
140
+ appendToBody: false,
141
+ pubmedSearchUrl: '',
142
+ loading: false,
143
+ showToolip: false,
144
+ showDetails: false,
145
+ originDescriptions: {
146
+ 'motor': 'is the location of the initial cell body of the circuit',
147
+ 'sensory': 'is the location of the initial cell body in the PNS circuit'
148
+ },
149
+ componentsWithDatasets: [],
150
+ uberons: [{id: undefined, name: undefined}]
151
+ };
152
+ },
153
+ computed: {
154
+ resources: function(){
155
+ let resources = []
156
+ if(this.entry && this.entry.hyperlinks){
157
+ resources = this.entry.hyperlinks
158
+ }
159
+ return resources
160
+ },
161
+ originDescription: function(){
162
+ if(this.entry && this.entry.title && this.entry.title.toLowerCase().includes('motor')){
163
+ return this.originDescriptions.motor
164
+ } else {
165
+ return this.originDescriptions.sensory
166
+ }
167
+ },
168
+ provSpeciesDescription: function(){
169
+ let text = "Observed in"
170
+ this.entry.provenanceTaxonomyLabel.forEach(label => {
171
+ text += ` ${label},`
172
+ });
173
+ text = text.slice(0,-1) // remove last comma
174
+ text += " species"
175
+ return text
176
+ }
177
+ },
178
+ methods: {
179
+ titleCase: function(title){
180
+ return titleCase(title)
181
+ },
182
+ capitalise: function(text){
183
+ return capitalise(text)
184
+ },
185
+ onClose: function() {
186
+ this.$emit("onClose")
187
+ },
188
+ openUrl: function(url){
189
+ window.open(url, '_blank')
190
+ },
191
+ openAll: function(){
192
+ EventBus.$emit('onActionClick', {type:'Facets', labels: this.entry.componentsWithDatasets.map(a=>a.name)})
193
+ },
194
+ openAxons: function(){
195
+ EventBus.$emit('onActionClick', {type:'Facets', labels: this.entry.destinationsWithDatasets.map(a=>a.name)})
196
+ },
197
+ openDendrites: function(){
198
+ EventBus.$emit('onActionClick', {type:'Facets', labels: this.entry.originsWithDatasets.map(a=>a.name)})
199
+ },
200
+ pubmedSearchUrlUpdate: function (val){
201
+ this.pubmedSearchUrl = val
202
+ },
203
+ }
204
+ };
205
+ </script>
206
+
207
+ <style scoped lang="scss">
208
+ @import "~element-ui/packages/theme-chalk/src/button";
209
+ @import "~element-ui/packages/theme-chalk/src/container";
210
+ @import "~element-ui/packages/theme-chalk/src/header";
211
+ @import "~element-ui/packages/theme-chalk/src/main";
212
+
213
+ .display {
214
+ width: 44px;
215
+ word-break: normal;
216
+ }
217
+
218
+ .title {
219
+ text-align: left;
220
+ width: 16em;
221
+ line-height: 1.5em !important;
222
+ font-size: 1em;
223
+ font-family: Helvetica;
224
+ font-weight: 500;
225
+ /* font-weight: bold; */
226
+ padding-bottom: 8px;
227
+ }
228
+
229
+ .block {
230
+ margin-bottom: 0.5em;
231
+ }
232
+
233
+ .pub {
234
+ width: 16rem;
235
+ }
236
+
237
+ .icon {
238
+ right: 0px;
239
+ position: absolute;
240
+ top: 10px;
241
+ }
242
+
243
+ .icon:hover {
244
+ cursor: pointer;
245
+ }
246
+
247
+ .popover-origin-help {
248
+ text-transform: none !important; // need to overide the tooltip text transform
249
+ }
250
+
251
+ .info{
252
+ transform: rotate(180deg);
253
+ color: #8300bf;
254
+ margin-left: 8px;
255
+ }
256
+
257
+ .seperator {
258
+ width:90%;
259
+ height:1px;
260
+ background-color:#bfbec2;
261
+ }
262
+
263
+ .hide{
264
+ color: $app-primary-color;
265
+ cursor: pointer;
266
+ margin-right: 6px;
267
+ margin-top: 3px;
268
+ }
269
+
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
+ .main {
282
+ font-size: 14px;
283
+ text-align: left;
284
+ line-height: 1.5em;
285
+ font-family: Asap, sans-serif,Helvetica;
286
+ font-weight: 400;
287
+ /* outline: thin red solid; */
288
+ padding: 1em !important;
289
+ overflow: hidden;
290
+ min-width: 16rem;
291
+ }
292
+
293
+ .title{
294
+ font-size: 18px;
295
+ font-weight: 500;
296
+ font-weight: bold;
297
+ padding-bottom: 8px;
298
+ color: rgb(131, 0, 191);
299
+ }
300
+
301
+ .attribute-title{
302
+ font-size: 16px;
303
+ font-weight: 600;
304
+ /* font-weight: bold; */
305
+ text-transform: uppercase;
306
+ }
307
+
308
+ .attribute-content{
309
+ font-size: 14px;
310
+ font-weight: 500;
311
+ }
312
+
313
+ .popover-container {
314
+ height: 100%;
315
+ width: 100%;
316
+ }
317
+
318
+ .main {
319
+ .el-button.is-round{
320
+ border-radius: 4px;
321
+ padding: 9px 20px 10px 20px;
322
+ display: flex;
323
+ height: 36px;
324
+ }
325
+ }
326
+
327
+ .button {
328
+ margin-left: 0px !important;
329
+ margin-top: 0px !important;
330
+ font-size: 14px !important;
331
+ background-color: $app-primary-color;
332
+ color: #fff;
333
+ &+.button {
334
+ margin-top: 10px !important;
335
+ }
336
+ &:hover {
337
+ color: #fff !important;
338
+ background: #ac76c5 !important;
339
+ border: 1px solid #ac76c5 !important;
340
+ }
341
+ }
342
+
343
+ .tooltip-container{
344
+ &::after, &::before {
345
+ content: '';
346
+ display: block;
347
+ position: absolute;
348
+ width: 0;
349
+ height: 0;
350
+ border-style: solid;
351
+ flex-shrink: 0;
352
+ }
353
+ .tooltip {
354
+ &::after {
355
+ display: none;
356
+ }
357
+ &::before {
358
+ display: none;
359
+ }
360
+ }
361
+ }
362
+
363
+ .maplibregl-popup-anchor-bottom {
364
+ .tooltip-container {
365
+ &::after, &::before {
366
+ top: 100%;
367
+ border-width: 12px;
368
+ }
369
+ &::after {
370
+ margin-top:-1px;
371
+ border-color: rgb(255, 255, 255) transparent transparent transparent ;
372
+ }
373
+ &::before {
374
+ margin: 0 auto;
375
+ border-color: $app-primary-color transparent transparent transparent ;
376
+ }
377
+ }
378
+ }
379
+
380
+ .maplibregl-popup-anchor-top {
381
+ .tooltip-container {
382
+ &::after, &::before {
383
+ top: -24px;
384
+ border-width: 12px;
385
+ }
386
+ &::after {
387
+ margin-top: 1px;
388
+ border-color: transparent transparent rgb(255, 255, 255) transparent ;
389
+ }
390
+ &::before {
391
+ margin: 0 auto;
392
+ border-color: transparent transparent $app-primary-color transparent ;
393
+ }
394
+ }
395
+ }
396
+
397
+ .content-container {
398
+ overflow-y: scroll;
399
+ scrollbar-width: thin !important;
400
+ max-height: 240px;
401
+ }
402
+
403
+ .scrollbar::-webkit-scrollbar-track {
404
+ border-radius: 10px;
405
+ background-color: #f5f5f5;
406
+ }
407
+
408
+ .scrollbar::-webkit-scrollbar {
409
+ width: 12px;
410
+ right: -12px;
411
+ background-color: #f5f5f5;
412
+ }
413
+
414
+ .scrollbar::-webkit-scrollbar-thumb {
415
+ border-radius: 4px;
416
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
417
+ background-color: #979797;
418
+ }
419
+
420
+
421
+ /* Fix for chrome bug where under triangle pops up above one on top of it */
422
+ .selector:not(*:root), .tooltip-container::after{
423
+ top: 99.4%;
424
+ }
425
+ </style>