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