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