@abi-software/map-utilities 1.5.0-beta.1 → 1.5.0-beta.3

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.1",
3
+ "version": "1.5.0-beta.3",
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>
@@ -26,7 +26,14 @@
26
26
  @mouseenter="onConnectivityHovered(origin)"
27
27
  @mouseleave="onConnectivityHovered()"
28
28
  >
29
- {{ capitalise(origin) }}
29
+ <el-icon
30
+ class="magnify-glass"
31
+ v-show="shouldShowMagnifyGlass(origin)"
32
+ @click="onConnectivityClicked(origin)"
33
+ >
34
+ <el-icon-search />
35
+ </el-icon>
36
+ <span>{{ capitalise(origin) }}</span>
30
37
  </div>
31
38
  <el-button
32
39
  v-show="
@@ -55,7 +62,14 @@
55
62
  @mouseenter="onConnectivityHovered(component)"
56
63
  @mouseleave="onConnectivityHovered()"
57
64
  >
58
- {{ capitalise(component) }}
65
+ <el-icon
66
+ class="magnify-glass"
67
+ v-show="shouldShowMagnifyGlass(component)"
68
+ @click="onConnectivityClicked(component)"
69
+ >
70
+ <el-icon-search />
71
+ </el-icon>
72
+ <span>{{ capitalise(component) }}</span>
59
73
  </div>
60
74
  </div>
61
75
  <div
@@ -86,7 +100,14 @@
86
100
  @mouseenter="onConnectivityHovered(destination)"
87
101
  @mouseleave="onConnectivityHovered()"
88
102
  >
89
- {{ capitalise(destination) }}
103
+ <el-icon
104
+ class="magnify-glass"
105
+ v-show="shouldShowMagnifyGlass(destination)"
106
+ @click="onConnectivityClicked(destination)"
107
+ >
108
+ <el-icon-search />
109
+ </el-icon>
110
+ <span>{{ capitalise(destination) }}</span>
90
111
  </div>
91
112
  <el-button
92
113
  v-show="
@@ -117,10 +138,8 @@
117
138
  </div>
118
139
 
119
140
  <div class="connectivity-error-container">
120
- <div class="connectivity-error" v-if="connectivityError">
121
- <strong v-if="connectivityError.errorConnectivities">
122
- {{ connectivityError.errorConnectivities }}
123
- </strong>
141
+ <div class="connectivity-error" v-show="connectivityError.errorConnectivities">
142
+ <strong>{{ connectivityError.errorConnectivities }}</strong>
124
143
  {{ connectivityError.errorMessage }}
125
144
  </div>
126
145
  </div>
@@ -130,6 +149,7 @@
130
149
  <script>
131
150
  import {
132
151
  Warning as ElIconWarning,
152
+ Search as ElIconSearch,
133
153
  } from '@element-plus/icons-vue'
134
154
  import {
135
155
  ElButton as Button,
@@ -145,6 +165,7 @@ export default {
145
165
  Container,
146
166
  Icon,
147
167
  ElIconWarning,
168
+ ElIconSearch
148
169
  },
149
170
  props: {
150
171
  entry: {
@@ -190,7 +211,7 @@ export default {
190
211
  },
191
212
  connectivityError: {
192
213
  type: Object,
193
- default: () => null,
214
+ default: () => {},
194
215
  }
195
216
  },
196
217
  data: function () {
@@ -200,7 +221,6 @@ export default {
200
221
  sensory: 'is the location of the initial cell body in the PNS circuit',
201
222
  },
202
223
  facetList: [],
203
- sckanVersion: '',
204
224
  }
205
225
  },
206
226
  watch: {
@@ -232,8 +252,18 @@ export default {
232
252
  onConnectivityHovered: function (name) {
233
253
  this.$emit('connectivity-hovered', name);
234
254
  },
235
- onConnectivityClicked: function (id, type, label) {
236
- this.$emit('connectivity-clicked', { id, type, label });
255
+ onConnectivityClicked: function (name) {
256
+ const connectivity = this.connectivityError.errorConnectivities;
257
+ // Remove the invalid term while searching
258
+ const label = connectivity
259
+ ? name.replace(new RegExp(`\\s*,?\\s*${connectivity}\\s*,?\\s*`, 'gi'), '').trim()
260
+ : name;
261
+ this.$emit('connectivity-clicked', label);
262
+ },
263
+ // shouldShowMagnifyGlass: Checks whether the hovered terms contain valid term or not
264
+ shouldShowMagnifyGlass: function (features) {
265
+ const connectivity = this.connectivityError.errorConnectivities;
266
+ return connectivity?.toLowerCase() !== features.toLowerCase();
237
267
  },
238
268
  // shouldShowExploreButton: Checks if the feature is in the list of available anatomy facets
239
269
  shouldShowExploreButton: function (features) {
@@ -353,9 +383,23 @@ export default {
353
383
  transition: color 0.25s ease;
354
384
  position: relative;
355
385
  cursor: default;
386
+ padding-left: 16px;
387
+
388
+ .magnify-glass {
389
+ display: none;
390
+ position: absolute;
391
+ top: 0;
392
+ left: 0;
393
+ }
356
394
 
357
395
  &:hover {
358
396
  color: $app-primary-color;
397
+
398
+ .magnify-glass {
399
+ display: block;
400
+ padding-top: 4px;
401
+ cursor: pointer;
402
+ }
359
403
  }
360
404
 
361
405
  + .attribute-content {
@@ -30,6 +30,7 @@ declare module 'vue' {
30
30
  ElIconEdit: typeof import('@element-plus/icons-vue')['Edit']
31
31
  ElIconFinished: typeof import('@element-plus/icons-vue')['Finished']
32
32
  ElIconLock: typeof import('@element-plus/icons-vue')['Lock']
33
+ ElIconSearch: typeof import('@element-plus/icons-vue')['Search']
33
34
  ElIconUnlock: typeof import('@element-plus/icons-vue')['Unlock']
34
35
  ElIconWarning: typeof import('@element-plus/icons-vue')['Warning']
35
36
  ElIconZoomIn: typeof import('@element-plus/icons-vue')['ZoomIn']
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
  },