@abi-software/map-utilities 1.5.0-beta.0 → 1.5.0-beta.2

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,430 @@
1
+ <template>
2
+ <div class="connectivity-list">
3
+ {{ entry.paths }}
4
+ <div v-if="origins && origins.length > 0" class="block">
5
+ <div class="attribute-title-container">
6
+ <span class="attribute-title">Origin</span>
7
+ <el-popover
8
+ width="250"
9
+ trigger="hover"
10
+ :teleported="false"
11
+ popper-class="popover-origin-help"
12
+ >
13
+ <template #reference>
14
+ <el-icon class="info"><el-icon-warning /></el-icon>
15
+ </template>
16
+ <span style="word-break: keep-all">
17
+ <i>Origin</i> {{ originDescription }}
18
+ </span>
19
+ </el-popover>
20
+ </div>
21
+ <div
22
+ v-for="(origin, i) in origins"
23
+ class="attribute-content"
24
+ :origin-item-label="origin"
25
+ :key="origin"
26
+ @mouseenter="onConnectivityHovered(origin)"
27
+ @mouseleave="onConnectivityHovered()"
28
+ >
29
+ <span>{{ capitalise(origin) }}</span>
30
+ <el-icon
31
+ class="connectivity-search-icon"
32
+ @click="onConnectivityClicked(origin)"
33
+ >
34
+ <el-icon-search />
35
+ </el-icon>
36
+ </div>
37
+ <el-button
38
+ v-show="
39
+ originsWithDatasets && originsWithDatasets.length > 0 &&
40
+ shouldShowExploreButton(originsWithDatasets)
41
+ "
42
+ class="button"
43
+ id="open-dendrites-button"
44
+ @click="openDendrites"
45
+ >
46
+ Explore origin data
47
+ </el-button>
48
+ </div>
49
+ <div
50
+ v-if="components && components.length > 0"
51
+ class="block"
52
+ >
53
+ <div class="attribute-title-container">
54
+ <span class="attribute-title">Components</span>
55
+ </div>
56
+ <div
57
+ v-for="(component, i) in components"
58
+ class="attribute-content"
59
+ :component-item-label="component"
60
+ :key="component"
61
+ @mouseenter="onConnectivityHovered(component)"
62
+ @mouseleave="onConnectivityHovered()"
63
+ >
64
+ <span>{{ capitalise(component) }}</span>
65
+ <el-icon
66
+ class="connectivity-search-icon"
67
+ @click="onConnectivityClicked(component)"
68
+ >
69
+ <el-icon-search />
70
+ </el-icon>
71
+ </div>
72
+ </div>
73
+ <div
74
+ v-if="destinations && destinations.length > 0"
75
+ class="block"
76
+ >
77
+ <div class="attribute-title-container">
78
+ <span class="attribute-title">Destination</span>
79
+ <el-popover
80
+ width="250"
81
+ trigger="hover"
82
+ :teleported="false"
83
+ popper-class="popover-origin-help"
84
+ >
85
+ <template #reference>
86
+ <el-icon class="info"><el-icon-warning /></el-icon>
87
+ </template>
88
+ <span style="word-break: keep-all">
89
+ <i>Destination</i> is where the axons terminate
90
+ </span>
91
+ </el-popover>
92
+ </div>
93
+ <div
94
+ v-for="(destination, i) in destinations"
95
+ class="attribute-content"
96
+ :destination-item-label="destination"
97
+ :key="destination"
98
+ @mouseenter="onConnectivityHovered(destination)"
99
+ @mouseleave="onConnectivityHovered()"
100
+ >
101
+ <span>{{ capitalise(destination) }}</span>
102
+ <el-icon
103
+ class="connectivity-search-icon"
104
+ @click="onConnectivityClicked(destination)"
105
+ >
106
+ <el-icon-search />
107
+ </el-icon>
108
+ </div>
109
+ <el-button
110
+ v-show="
111
+ destinationsWithDatasets &&
112
+ destinationsWithDatasets.length > 0 &&
113
+ shouldShowExploreButton(destinationsWithDatasets)
114
+ "
115
+ class="button"
116
+ @click="openAxons"
117
+ >
118
+ Explore destination data
119
+ </el-button>
120
+ </div>
121
+ <div
122
+ v-show="
123
+ componentsWithDatasets &&
124
+ componentsWithDatasets.length > 0 &&
125
+ shouldShowExploreButton(componentsWithDatasets)
126
+ "
127
+ class="block"
128
+ >
129
+ <el-button
130
+ class="button"
131
+ @click="openAll"
132
+ >
133
+ Search for data on components
134
+ </el-button>
135
+ </div>
136
+
137
+ <div class="connectivity-error-container">
138
+ <div class="connectivity-error" v-if="connectivityError">
139
+ <strong v-if="connectivityError.errorConnectivities">
140
+ {{ connectivityError.errorConnectivities }}
141
+ </strong>
142
+ {{ connectivityError.errorMessage }}
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </template>
147
+
148
+ <script>
149
+ import {
150
+ Warning as ElIconWarning,
151
+ Search as ElIconSearch,
152
+ } from '@element-plus/icons-vue'
153
+ import {
154
+ ElButton as Button,
155
+ ElContainer as Container,
156
+ ElIcon as Icon,
157
+ } from 'element-plus'
158
+ import { capitalise } from '../utilities'
159
+
160
+ export default {
161
+ name: 'ConnectivityList',
162
+ components: {
163
+ Button,
164
+ Container,
165
+ Icon,
166
+ ElIconWarning,
167
+ ElIconSearch
168
+ },
169
+ props: {
170
+ entry: {
171
+ type: Object,
172
+ default: () => ({
173
+ destinations: [],
174
+ origins: [],
175
+ components: [],
176
+ destinationsWithDatasets: [],
177
+ originsWithDatasets: [],
178
+ componentsWithDatasets: [],
179
+ resource: undefined,
180
+ featuresAlert: undefined,
181
+ }),
182
+ },
183
+ origins: {
184
+ type: Array,
185
+ default: () => []
186
+ },
187
+ components: {
188
+ type: Array,
189
+ default: () => []
190
+ },
191
+ destinations: {
192
+ type: Array,
193
+ default: () => []
194
+ },
195
+ originsWithDatasets: {
196
+ type: Array,
197
+ default: () => []
198
+ },
199
+ componentsWithDatasets: {
200
+ type: Array,
201
+ default: () => []
202
+ },
203
+ destinationsWithDatasets: {
204
+ type: Array,
205
+ default: () => []
206
+ },
207
+ availableAnatomyFacets: {
208
+ type: Array,
209
+ default: () => [],
210
+ },
211
+ connectivityError: {
212
+ type: Object,
213
+ default: () => null,
214
+ }
215
+ },
216
+ data: function () {
217
+ return {
218
+ originDescriptions: {
219
+ motor: 'is the location of the initial cell body of the circuit',
220
+ sensory: 'is the location of the initial cell body in the PNS circuit',
221
+ },
222
+ facetList: [],
223
+ sckanVersion: '',
224
+ }
225
+ },
226
+ watch: {
227
+ availableAnatomyFacets: {
228
+ handler: function (val) {
229
+ this.convertFacetsToList(val)
230
+ },
231
+ immediate: true,
232
+ deep: true,
233
+ },
234
+ },
235
+ computed: {
236
+ originDescription: function () {
237
+ if (
238
+ this.entry &&
239
+ this.entry.title &&
240
+ this.entry.title.toLowerCase().includes('motor')
241
+ ) {
242
+ return this.originDescriptions.motor
243
+ } else {
244
+ return this.originDescriptions.sensory
245
+ }
246
+ },
247
+ },
248
+ methods: {
249
+ capitalise: function (text) {
250
+ return capitalise(text)
251
+ },
252
+ onConnectivityHovered: function (name) {
253
+ this.$emit('connectivity-hovered', name);
254
+ },
255
+ onConnectivityClicked: function (name) {
256
+ this.$emit('connectivity-clicked', name);
257
+ },
258
+ // shouldShowExploreButton: Checks if the feature is in the list of available anatomy facets
259
+ shouldShowExploreButton: function (features) {
260
+ // facetList will not be available when there has no Sidebar's data
261
+ if (!this.facetList.length) {
262
+ return true
263
+ }
264
+ for (let i = 0; i < features.length; i++) {
265
+ if (this.facetList.includes(features[i].name.toLowerCase())) {
266
+ return true
267
+ }
268
+ }
269
+ return false
270
+ },
271
+ // convertFacetsToList: Converts the available anatomy facets to a list for easy searching
272
+ convertFacetsToList: function (facets) {
273
+ facets.forEach((facet) => {
274
+ if(facet.children) {
275
+ this.convertFacetsToList(facet.children)
276
+ } else {
277
+ this.facetList.push(facet.label.toLowerCase())
278
+ }
279
+ })
280
+ },
281
+ openAll: function () {
282
+ this.$emit('connectivity-action-click', {
283
+ type: 'Facets',
284
+ labels: this.componentsWithDatasets.map((a) => a.name.toLowerCase()),
285
+ })
286
+ },
287
+ openAxons: function () {
288
+ this.$emit('connectivity-action-click', {
289
+ type: 'Facets',
290
+ labels: this.destinationsWithDatasets.map((a) => a.name.toLowerCase()),
291
+ })
292
+ },
293
+ openDendrites: function () {
294
+ this.$emit('connectivity-action-click', {
295
+ type: 'Facets',
296
+ labels: this.originsWithDatasets.map((a) => a.name.toLowerCase()),
297
+ })
298
+ },
299
+ }
300
+ }
301
+ </script>
302
+
303
+ <style lang="scss" scoped>
304
+ .connectivity-list {
305
+ display: flex;
306
+ flex-direction: column;
307
+ gap: 1rem;
308
+ position: relative;
309
+ }
310
+
311
+ .button {
312
+ margin-left: 0px !important;
313
+ margin-top: 0px !important;
314
+ font-size: 14px !important;
315
+ background-color: $app-primary-color;
316
+ color: #fff;
317
+
318
+ &:hover {
319
+ color: #fff !important;
320
+ background-color: #ac76c5 !important;
321
+ border: 1px solid #ac76c5 !important;
322
+ }
323
+
324
+ & + .button {
325
+ margin-top: 10px !important;
326
+ }
327
+ }
328
+
329
+ .icon {
330
+ right: 0px;
331
+ position: absolute;
332
+ top: 10px;
333
+ }
334
+
335
+ .icon:hover {
336
+ cursor: pointer;
337
+ }
338
+
339
+ :deep(.popover-origin-help.el-popover) {
340
+ text-transform: none !important; // need to overide the tooltip text transform
341
+ border: 1px solid $app-primary-color;
342
+ font-weight: 400;
343
+ font-family: Asap, sans-serif, Helvetica;
344
+
345
+ .el-popper__arrow {
346
+ &:before {
347
+ border-color: $app-primary-color;
348
+ background-color: #ffffff;
349
+ }
350
+ }
351
+ }
352
+
353
+ .info {
354
+ color: #8300bf;
355
+ transform: rotate(180deg);
356
+ margin-left: 8px;
357
+ }
358
+
359
+ .attribute-title-container {
360
+ margin-bottom: 0.5em;
361
+ }
362
+
363
+ .attribute-title {
364
+ font-size: 16px;
365
+ font-weight: 600;
366
+ /* font-weight: bold; */
367
+ text-transform: uppercase;
368
+ }
369
+
370
+ .attribute-content {
371
+ display: flex;
372
+ justify-content: space-between;
373
+ font-size: 14px;
374
+ font-weight: 500;
375
+ transition: color 0.25s ease;
376
+ position: relative;
377
+ cursor: default;
378
+
379
+ .connectivity-search-icon {
380
+ display: none;
381
+ }
382
+
383
+ &:hover {
384
+ color: $app-primary-color;
385
+
386
+ .connectivity-search-icon {
387
+ padding-top: 4px;
388
+ cursor: pointer;
389
+ display: block;
390
+ }
391
+ }
392
+
393
+ + .attribute-content {
394
+ &::before {
395
+ content: "";
396
+ width: 90%;
397
+ height: 1px;
398
+ background-color: var(--el-border-color);
399
+ position: absolute;
400
+ top: 0;
401
+ left: 0;
402
+ }
403
+ }
404
+
405
+ &:last-of-type {
406
+ margin-bottom: 0.5em;
407
+ }
408
+ }
409
+
410
+ .connectivity-error-container {
411
+ position: sticky;
412
+ bottom: 0.5rem;
413
+ width: 100%;
414
+ min-height: 31px; // placeholder
415
+ margin-top: -10px !important;
416
+ display: flex;
417
+ flex-direction: row;
418
+ align-items: center;
419
+ justify-content: center;
420
+ }
421
+
422
+ .connectivity-error {
423
+ width: fit-content;
424
+ font-size: 12px;
425
+ padding: 0.25rem 0.5rem;
426
+ background-color: var(--el-color-error-light-9);
427
+ border-radius: var(--el-border-radius-small);
428
+ border: 1px solid var(--el-color-error);
429
+ }
430
+ </style>
@@ -573,8 +573,8 @@ export default {
573
573
  border-color: var(--el-color-primary-light-5);
574
574
  border-radius: 1rem;
575
575
  position: absolute;
576
- right: calc(50vw - 100px);
577
- bottom: 16px;
576
+ right: 40%;
577
+ bottom: 1rem;
578
578
  z-index: 10;
579
579
  }
580
580