@abi-software/map-utilities 1.5.0-beta.2 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.5.0-beta.2",
3
+ "version": "1.5.0",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -110,10 +110,8 @@
110
110
  </div>
111
111
  </div>
112
112
 
113
- <div v-if="connectivityError" class="connectivity-graph-error">
114
- <strong v-if="connectivityError.errorConnectivities">
115
- {{ connectivityError.errorConnectivities }}
116
- </strong>
113
+ <div v-show="connectivityError.errorConnectivities" class="connectivity-graph-error">
114
+ <strong>{{ connectivityError.errorConnectivities }}</strong>
117
115
  {{ connectivityError.errorMessage }}
118
116
  </div>
119
117
 
@@ -136,7 +134,6 @@ const ZOOM_IN_LABEL = 'Zoom in';
136
134
  const ZOOM_OUT_LABEL = 'Zoom out';
137
135
  const ZOOM_INCREMENT = 0.25;
138
136
  const APP_PRIMARY_COLOR = '#8300bf';
139
- const ERROR_TIMEOUT = 3000; // 3 seconds
140
137
 
141
138
  export default {
142
139
  name: 'ConnectivityGraph',
@@ -164,6 +161,10 @@ export default {
164
161
  type: Object,
165
162
  default: () => null,
166
163
  },
164
+ connectivityError: {
165
+ type: Object,
166
+ default: () => {},
167
+ }
167
168
  },
168
169
  data: function () {
169
170
  return {
@@ -183,8 +184,6 @@ export default {
183
184
  zoomOutLabel: ZOOM_OUT_LABEL,
184
185
  iconColor: APP_PRIMARY_COLOR,
185
186
  zoomEnabled: false,
186
- connectivityError: null,
187
- timeoutID: undefined,
188
187
  connectivityGraphContainer: null,
189
188
  };
190
189
  },
@@ -505,18 +504,7 @@ export default {
505
504
  this.zoomEnabled = !this.zoomEnabled;
506
505
  this.zoomLockLabel = this.zoomEnabled ? ZOOM_UNLOCK_LABEL : ZOOM_LOCK_LABEL;
507
506
  this.connectivityGraph.enableZoom(!this.zoomEnabled);
508
- },
509
- showErrorMessage: function (connectivityError) {
510
- this.connectivityError = {...connectivityError};
511
-
512
- if (this.timeoutID) {
513
- clearTimeout(this.timeoutID);
514
- }
515
-
516
- this.timeoutID = setTimeout(() => {
517
- this.connectivityError = null;
518
- }, ERROR_TIMEOUT);
519
- },
507
+ }
520
508
  },
521
509
  };
522
510
  </script>
@@ -1,151 +1,195 @@
1
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"
2
+ <div ref="connectivityList" class="connectivity-list">
3
+ <el-popover
4
+ width="250"
5
+ :show-arrow="false"
6
+ trigger="manual"
7
+ :teleported="false"
8
+ placement="left-start"
9
+ :visible="(connectivityError.errorConnectivities ? true: false)"
10
+ popper-class="connectivity-error-container"
11
+ >
12
+ <template #reference>
13
+ <div class="connectivity-alert"
14
+ :style="{ top: alertTop + 'px' }">
15
+ </div>
16
+ </template>
17
+ <template #default>
18
+ <strong>{{ connectivityError.errorConnectivities }}</strong>
19
+ {{ connectivityError.errorMessage }}
20
+ </template>
21
+ </el-popover>
22
+ {{ entry.paths }}
23
+ <div v-if="origins && origins.length > 0" class="block">
24
+ <div class="attribute-title-container">
25
+ <span class="attribute-title">Origin</span>
26
+ <el-popover
27
+ width="250"
28
+ trigger="hover"
29
+ :teleported="false"
30
+ popper-class="popover-origin-help"
31
+ >
32
+ <template #reference>
33
+ <el-icon class="info"><el-icon-warning /></el-icon>
34
+ </template>
35
+ <span style="word-break: keep-all">
36
+ <i>Origin</i> {{ originDescription }}
37
+ </span>
38
+ </el-popover>
39
+ </div>
40
+ <div
41
+ v-for="(origin, i) in origins"
42
+ class="attribute-content"
43
+ :origin-item-label="origin"
44
+ :key="origin"
45
+ @mouseenter="onConnectivityHovered(origin, $event)"
46
+ @mouseleave="onConnectivityHovered()"
12
47
  >
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>
48
+ <el-popover
49
+ width="150"
50
+ trigger="hover"
51
+ :teleported="false"
52
+ popper-class="popover-origin-help"
53
+ >
54
+ <template #reference>
55
+ <el-icon
56
+ class="magnify-glass"
57
+ v-show="shouldShowMagnifyGlass(origin,)"
58
+ @click="onConnectivityClicked(origin)"
59
+ >
60
+ <el-icon-search />
61
+ </el-icon>
62
+ </template>
63
+ <span>Search connectivity</span>
64
+ </el-popover>
65
+ <span>{{ capitalise(origin) }}</span>
66
+ </div>
67
+ <el-button
68
+ v-show="
69
+ originsWithDatasets && originsWithDatasets.length > 0 &&
70
+ shouldShowExploreButton(originsWithDatasets)
71
+ "
72
+ class="button"
73
+ id="open-dendrites-button"
74
+ @click="openDendrites"
75
+ >
76
+ Explore origin data
77
+ </el-button>
20
78
  </div>
21
79
  <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()"
80
+ v-if="components && components.length > 0"
81
+ class="block"
28
82
  >
29
- <span>{{ capitalise(origin) }}</span>
30
- <el-icon
31
- class="connectivity-search-icon"
32
- @click="onConnectivityClicked(origin)"
83
+ <div class="attribute-title-container">
84
+ <span class="attribute-title">Components</span>
85
+ </div>
86
+ <div
87
+ v-for="(component, i) in components"
88
+ class="attribute-content"
89
+ :component-item-label="component"
90
+ :key="component"
91
+ @mouseenter="onConnectivityHovered(component, $event)"
92
+ @mouseleave="onConnectivityHovered()"
33
93
  >
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>
94
+ <el-popover
95
+ width="150"
96
+ trigger="hover"
97
+ :teleported="false"
98
+ popper-class="popover-origin-help"
99
+ >
100
+ <template #reference>
101
+ <el-icon
102
+ class="magnify-glass"
103
+ v-show="shouldShowMagnifyGlass(component)"
104
+ @click="onConnectivityClicked(component)"
105
+ >
106
+ <el-icon-search />
107
+ </el-icon>
108
+ </template>
109
+ <span>Search connectivity</span>
110
+ </el-popover>
111
+ <span>{{ capitalise(component) }}</span>
112
+ </div>
55
113
  </div>
56
114
  <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()"
115
+ v-if="destinations && destinations.length > 0"
116
+ class="block"
63
117
  >
64
- <span>{{ capitalise(component) }}</span>
65
- <el-icon
66
- class="connectivity-search-icon"
67
- @click="onConnectivityClicked(component)"
118
+ <div class="attribute-title-container">
119
+ <span class="attribute-title">Destination</span>
120
+ <el-popover
121
+ width="250"
122
+ trigger="hover"
123
+ :teleported="false"
124
+ popper-class="popover-origin-help"
125
+ >
126
+ <template #reference>
127
+ <el-icon class="info"><el-icon-warning /></el-icon>
128
+ </template>
129
+ <span style="word-break: keep-all">
130
+ <i>Destination</i> is where the axons terminate
131
+ </span>
132
+ </el-popover>
133
+ </div>
134
+ <div
135
+ v-for="(destination, i) in destinations"
136
+ class="attribute-content"
137
+ :destination-item-label="destination"
138
+ :key="destination"
139
+ @mouseenter="onConnectivityHovered(destination, $event)"
140
+ @mouseleave="onConnectivityHovered()"
68
141
  >
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"
142
+ <el-popover
143
+ width="150"
144
+ trigger="hover"
145
+ :teleported="false"
146
+ popper-class="popover-origin-help"
147
+ >
148
+ <template #reference>
149
+ <el-icon
150
+ class="magnify-glass"
151
+ v-show="shouldShowMagnifyGlass(destination)"
152
+ @click="onConnectivityClicked(destination)"
153
+ >
154
+ <el-icon-search />
155
+ </el-icon>
156
+ </template>
157
+ <span>Search connectivity</span>
158
+ </el-popover>
159
+ <span>{{ capitalise(destination) }}</span>
160
+ </div>
161
+ <el-button
162
+ v-show="
163
+ destinationsWithDatasets &&
164
+ destinationsWithDatasets.length > 0 &&
165
+ shouldShowExploreButton(destinationsWithDatasets)
166
+ "
167
+ class="button"
168
+ @click="openAxons"
84
169
  >
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>
170
+ Explore destination data
171
+ </el-button>
92
172
  </div>
93
173
  <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
174
  v-show="
111
- destinationsWithDatasets &&
112
- destinationsWithDatasets.length > 0 &&
113
- shouldShowExploreButton(destinationsWithDatasets)
175
+ componentsWithDatasets &&
176
+ componentsWithDatasets.length > 0 &&
177
+ shouldShowExploreButton(componentsWithDatasets)
114
178
  "
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"
179
+ class="block"
132
180
  >
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 }}
181
+ <el-button
182
+ class="button"
183
+ @click="openAll"
184
+ >
185
+ Search for data on components
186
+ </el-button>
143
187
  </div>
144
- </div>
145
188
  </div>
146
189
  </template>
147
190
 
148
191
  <script>
192
+ import { shallowRef } from 'vue';
149
193
  import {
150
194
  Warning as ElIconWarning,
151
195
  Search as ElIconSearch,
@@ -210,17 +254,17 @@ export default {
210
254
  },
211
255
  connectivityError: {
212
256
  type: Object,
213
- default: () => null,
257
+ default: () => {},
214
258
  }
215
259
  },
216
260
  data: function () {
217
261
  return {
262
+ alertTop: 0,
218
263
  originDescriptions: {
219
264
  motor: 'is the location of the initial cell body of the circuit',
220
265
  sensory: 'is the location of the initial cell body in the PNS circuit',
221
266
  },
222
267
  facetList: [],
223
- sckanVersion: '',
224
268
  }
225
269
  },
226
270
  watch: {
@@ -249,11 +293,24 @@ export default {
249
293
  capitalise: function (text) {
250
294
  return capitalise(text)
251
295
  },
252
- onConnectivityHovered: function (name) {
296
+ onConnectivityHovered: function (name, ele) {
253
297
  this.$emit('connectivity-hovered', name);
298
+ if (ele) {
299
+ this.alertTop = ele.srcElement.offsetParent.offsetTop + ele.srcElement.offsetTop;
300
+ }
254
301
  },
255
302
  onConnectivityClicked: function (name) {
256
- this.$emit('connectivity-clicked', name);
303
+ const connectivity = this.connectivityError.errorConnectivities;
304
+ // Remove the invalid term while searching
305
+ const label = connectivity
306
+ ? name.replace(new RegExp(`\\s*,?\\s*${connectivity}\\s*,?\\s*`, 'gi'), '').trim()
307
+ : name;
308
+ this.$emit('connectivity-clicked', label);
309
+ },
310
+ // shouldShowMagnifyGlass: Checks whether the hovered terms contain valid term or not
311
+ shouldShowMagnifyGlass: function (features) {
312
+ const connectivity = this.connectivityError.errorConnectivities;
313
+ return connectivity?.toLowerCase() !== features.toLowerCase();
257
314
  },
258
315
  // shouldShowExploreButton: Checks if the feature is in the list of available anatomy facets
259
316
  shouldShowExploreButton: function (features) {
@@ -296,7 +353,7 @@ export default {
296
353
  labels: this.originsWithDatasets.map((a) => a.name.toLowerCase()),
297
354
  })
298
355
  },
299
- }
356
+ },
300
357
  }
301
358
  </script>
302
359
 
@@ -368,25 +425,27 @@ export default {
368
425
  }
369
426
 
370
427
  .attribute-content {
371
- display: flex;
372
- justify-content: space-between;
373
428
  font-size: 14px;
374
429
  font-weight: 500;
375
430
  transition: color 0.25s ease;
376
431
  position: relative;
377
432
  cursor: default;
433
+ padding-left: 16px;
378
434
 
379
- .connectivity-search-icon {
435
+ .magnify-glass {
380
436
  display: none;
437
+ position: absolute;
438
+ top: 0;
439
+ left: 0;
381
440
  }
382
441
 
383
442
  &:hover {
384
443
  color: $app-primary-color;
385
444
 
386
- .connectivity-search-icon {
445
+ .magnify-glass {
446
+ display: block;
387
447
  padding-top: 4px;
388
448
  cursor: pointer;
389
- display: block;
390
449
  }
391
450
  }
392
451
 
@@ -407,24 +466,20 @@ export default {
407
466
  }
408
467
  }
409
468
 
410
- .connectivity-error-container {
411
- position: sticky;
412
- bottom: 0.5rem;
413
- width: 100%;
469
+ .connectivity-alert {
470
+ position: absolute;
471
+ width: 1px;
472
+ right:0px;
473
+ }
474
+
475
+ :deep(.connectivity-error-container.el-popover) {
414
476
  min-height: 31px; // placeholder
415
- margin-top: -10px !important;
416
- display: flex;
417
- flex-direction: row;
418
477
  align-items: center;
419
478
  justify-content: center;
420
- }
421
-
422
- .connectivity-error {
423
- width: fit-content;
424
- font-size: 12px;
425
479
  padding: 0.25rem 0.5rem;
426
480
  background-color: var(--el-color-error-light-9);
427
481
  border-radius: var(--el-border-radius-small);
428
482
  border: 1px solid var(--el-color-error);
483
+ pointer-events: none;
429
484
  }
430
485
  </style>
@@ -87,6 +87,7 @@
87
87
  :componentsWithDatasets="componentsWithDatasets"
88
88
  :destinationsWithDatasets="destinationsWithDatasets"
89
89
  :availableAnatomyFacets="availableAnatomyFacets"
90
+ :connectivityError="connectivityError"
90
91
  @connectivity-action-click="onConnectivityActionClick"
91
92
  />
92
93
  <external-resource-card
@@ -134,6 +135,7 @@ export default {
134
135
  },
135
136
  entryIndex: 0,
136
137
  availableAnatomyFacets: [],
138
+ connectivityError: {},
137
139
  };
138
140
  },
139
141
  computed: {
package/vite.config.js CHANGED
@@ -38,10 +38,11 @@ export default defineConfig({
38
38
  fileName: "map-utilities",
39
39
  },
40
40
  rollupOptions: {
41
- external: ["vue"],
41
+ external: ["vue", "@element-plus/icons-vue"],
42
42
  output: {
43
43
  globals: {
44
44
  vue: "Vue",
45
+ "@element-plus/icons-vue": "@element-plus/icons-vue",
45
46
  },
46
47
  },
47
48
  },