@abi-software/map-side-bar 2.8.3-beta.0 → 2.8.3-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.8.3-beta.0",
3
+ "version": "2.8.3-beta.1",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
package/src/App.vue CHANGED
@@ -31,7 +31,7 @@
31
31
  @hover-changed="hoverChanged($event)"
32
32
  @connectivity-hovered="onConnectivityHovered"
33
33
  @actionClick="action"
34
- @connectivity-explorer-clicked="onConnectivityExplorerClicked"
34
+ @connectivity-collapse-change="onConnectivityCollapseChange"
35
35
  />
36
36
  </div>
37
37
  </template>
@@ -344,7 +344,7 @@ export default {
344
344
  const filter = entry ? entry.filter : []
345
345
  this.$refs.sideBar.openConnectivitySearch(filter, query)
346
346
  },
347
- onConnectivityExplorerClicked: function () {
347
+ onConnectivityCollapseChange: function () {
348
348
  this.connectivityEntry = [...exampleConnectivityInput]
349
349
  }
350
350
  },
@@ -2,10 +2,10 @@
2
2
  <div class="connectivity-card-container" ref="container">
3
3
  <div class="connectivity-card" ref="card">
4
4
  <div class="seperator-path"></div>
5
- <div v-loading="loading" class="card" @click="cardClicked(entry)">
6
- <div class="title">{{ capitalise(entry.label) }}</div>
5
+ <div v-loading="loading" class="card-content" @click="cardClicked(entry)">
6
+ <div class="card-title">{{ capitalise(entry.label) }}</div>
7
7
  <template v-for="field in displayFields" :key="field">
8
- <div class="details" v-if="entry[field]">
8
+ <div class="card-details" v-if="entry[field]">
9
9
  <strong>{{ field }}:</strong> {{ entry[field] }}
10
10
  </div>
11
11
  </template>
@@ -31,12 +31,23 @@ export default {
31
31
  type: Object,
32
32
  default: () => {},
33
33
  },
34
+ connectivityEntry: {
35
+ type: Array,
36
+ default: () => [],
37
+ },
34
38
  },
35
39
  computed: {
36
40
  loading: function () {
37
- // Only when click on overlay paths
38
- if ("detailsReady" in this.entry) {
39
- return !this.entry.detailsReady;
41
+ // for clicking on the flatmap neuron
42
+ if ("ready" in this.entry) {
43
+ return !this.entry.ready;
44
+ }
45
+ // for clicking on the explorer card
46
+ const cEntry = this.connectivityEntry.find(
47
+ (entry) => entry.id === this.entry.id
48
+ );
49
+ if (cEntry) {
50
+ return !cEntry.ready;
40
51
  }
41
52
  return false;
42
53
  },
@@ -48,7 +59,7 @@ export default {
48
59
  },
49
60
  cardClicked: function (data) {
50
61
  if (!this.loading) {
51
- this.$emit("connectivity-card-clicked", data);
62
+ this.$emit("open-connectivity", data);
52
63
  }
53
64
  },
54
65
  },
@@ -62,32 +73,21 @@ export default {
62
73
  min-height: 5rem;
63
74
  }
64
75
 
65
- .card {
76
+ .card-content {
66
77
  padding-top: 18px;
67
78
  padding-left: 6px;
68
79
  cursor: pointer;
69
80
  }
70
81
 
71
- .title {
82
+ .card-title {
72
83
  padding-bottom: 0.75rem;
73
84
  font-weight: bold;
74
85
  line-height: 1.5;
75
86
  letter-spacing: 1.05px;
76
87
  }
77
88
 
78
- .details {
89
+ .card-details {
79
90
  line-height: 1.5;
80
91
  letter-spacing: 1.05px;
81
92
  }
82
-
83
- .button {
84
- margin-right: 3.5rem;
85
- font-family: Asap;
86
- font-size: 14px;
87
- font-weight: normal;
88
- background-color: $app-primary-color;
89
- border: $app-primary-color;
90
- color: white;
91
- margin-top: 8px;
92
- }
93
93
  </style>
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <el-card :body-style="bodyStyle" class="content-card">
2
+ <el-card
3
+ :body-style="bodyStyle"
4
+ class="content-card"
5
+ @mouseleave="hoverChanged(undefined)"
6
+ >
3
7
  <template #header>
4
8
  <div class="header">
5
9
  <el-input
@@ -57,21 +61,20 @@
57
61
  :key="result.id"
58
62
  :ref="'stepItem-' + result.id"
59
63
  class="step-item"
60
- :class="{
61
- 'is-active': expanded === result.id && result.loaded,
62
- 'is-loading': expanded === result.id && !result.loaded,
63
- }"
64
64
  @mouseenter="hoverChanged(result)"
65
65
  >
66
66
  <ConnectivityCard
67
- class="dataset-card"
67
+ v-show="expanded !== result.id"
68
+ class="connectivity-card"
68
69
  :entry="result"
69
- @connectivity-card-clicked="onConnectivityExplorerClicked"
70
+ :connectivityEntry="connectivityEntry"
71
+ @open-connectivity="onConnectivityCollapseChange"
70
72
  />
71
73
  <ConnectivityInfo
72
74
  v-if="expanded === result.id"
73
- :connectivityEntry="connectivityEntry"
75
+ class="connectivity-info"
74
76
  :entryId="result.id"
77
+ :connectivityEntry="connectivityEntry"
75
78
  :availableAnatomyFacets="availableAnatomyFacets"
76
79
  :envVars="envVars"
77
80
  :withCloseButton="true"
@@ -80,7 +83,7 @@
80
83
  @connectivity-clicked="onConnectivityClicked"
81
84
  @connectivity-hovered="$emit('connectivity-hovered', $event)"
82
85
  @loaded="onConnectivityInfoLoaded(result)"
83
- @close-connectivity="closeConnectivity(result)"
86
+ @close-connectivity="onConnectivityCollapseChange(result)"
84
87
  />
85
88
  </div>
86
89
  <el-pagination
@@ -106,6 +109,7 @@ import {
106
109
  ElInput as Input,
107
110
  ElPagination as Pagination,
108
111
  } from "element-plus";
112
+ import EventBus from './EventBus.js'
109
113
  import SearchFilters from "./SearchFilters.vue";
110
114
  import SearchHistory from "./SearchHistory.vue";
111
115
  import ConnectivityCard from "./ConnectivityCard.vue";
@@ -212,24 +216,31 @@ export default {
212
216
  },
213
217
  },
214
218
  watch: {
215
- connectivityKnowledge: function (value, oldValue) {
216
- this.expanded = '';
217
- this.initLoading = false;
219
+ connectivityKnowledge: function (newVal, oldVal) {
220
+ this.expanded = ""; // reset expanded state
218
221
  this.loadingCards = false;
219
-
220
- if (JSON.stringify(value) === JSON.stringify(oldValue)) {
221
- return;
222
+ if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
223
+ this.results = newVal;
224
+ this.initLoading = false;
225
+ this.numberOfHits = this.results.length;
226
+ // knowledge is from the neuron click if there is 'ready' property
227
+ if (this.numberOfHits === 1 && !('ready' in this.results[0])) {
228
+ this.onConnectivityCollapseChange(this.results[0]);
229
+ }
222
230
  }
223
-
224
- this.results = value.map((item) => {
225
- return {
226
- ...item,
227
- loaded: false,
228
- };
229
- });
230
- this.numberOfHits = this.results.length;
231
- if (this.numberOfHits === 1) {
232
- this.onConnectivityExplorerClicked(this.results[0]);
231
+ },
232
+ // watch for connectivityEntry changes
233
+ // card should be expanded if there is only one entry and it is ready
234
+ connectivityEntry: function (newVal, oldVal) {
235
+ if (newVal.length === 1 && newVal[0].ready) {
236
+ // if the changed property is connectivity source, do not collapse
237
+ if (
238
+ (newVal[0].connectivitySource !== oldVal[0].connectivitySource) &&
239
+ oldVal[0].ready
240
+ ) {
241
+ return;
242
+ }
243
+ this.collapseChange(newVal[0]);
233
244
  }
234
245
  },
235
246
  paginatedResults: function () {
@@ -242,20 +253,23 @@ export default {
242
253
  this.filters = data.filter;
243
254
  this.searchAndFilterUpdate();
244
255
  },
245
- openConnectivity: function (data) {
246
- this.expanded = data.id;
256
+ collapseChange:function (data) {
257
+ this.expanded = this.expanded === data.id ? "" : data.id;
247
258
  },
248
259
  closeConnectivity: function (data) {
249
260
  this.expanded = '';
261
+ this.$emit('connectivity-item-close');
250
262
  },
251
- onConnectivityExplorerClicked: function (data) {
252
- if (this.expanded !== data.id) {
253
- data.loaded = false; // reset loading
254
- this.openConnectivity(data);
255
- const entry = this.connectivityEntry.filter(entry => entry.featureId[0] === data.id);
256
- if (entry.length === 0) {
257
- this.$emit("connectivity-explorer-clicked", data);
258
- }
263
+ onConnectivityCollapseChange: function (data) {
264
+ // close connectivity event will not trigger emit
265
+ if (this.connectivityEntry.find(entry => entry.featureId[0] === data.id)) {
266
+ this.collapseChange(data);
267
+ } else {
268
+ this.expanded = "";
269
+ // Make sure to emit the change after the next DOM update
270
+ this.$nextTick(() => {
271
+ this.$emit("connectivity-collapse-change", data);
272
+ });
259
273
  }
260
274
  },
261
275
  hoverChanged: function (data) {
@@ -412,7 +426,6 @@ export default {
412
426
  this.searchAndFilterUpdate();
413
427
  },
414
428
  onConnectivityInfoLoaded: function (result) {
415
- result.loaded = true;
416
429
  const stepItemRef = this.$refs['stepItem-' + result.id];
417
430
  const contentRef = this.$refs['content'];
418
431
  this.$nextTick(() => {
@@ -425,6 +438,10 @@ export default {
425
438
  mounted: function () {
426
439
  localStorage.removeItem('connectivity-active-view');
427
440
  this.openSearch(this.filter, this.searchInput);
441
+
442
+ EventBus.on('close-connectivity', () => {
443
+ this.closeConnectivity();
444
+ });
428
445
  },
429
446
  };
430
447
  </script>
@@ -432,7 +449,7 @@ export default {
432
449
  <style lang="scss" scoped>
433
450
  @import '../assets/pagination.scss';
434
451
 
435
- .dataset-card {
452
+ .connectivity-card {
436
453
  position: relative;
437
454
 
438
455
  &::before {
@@ -472,51 +489,15 @@ export default {
472
489
  font-size: 14px;
473
490
  margin-bottom: 18px;
474
491
  text-align: left;
475
- max-height: 200px;
476
492
  transition: all 0.3s ease;
477
493
 
478
- .dataset-card {
479
- opacity: 1;
480
- visibility: visible;
481
- transition: all 0.3s ease;
494
+ .connectivity-card {
495
+ max-height: 200px;
482
496
  }
483
-
484
- &.is-active {
485
- max-height: 9999px;
497
+ .connectivity-info {
486
498
  background-color: #f7faff;
487
499
  border: 2px solid $app-primary-color;
488
500
  border-radius: var(--el-border-radius-base);
489
-
490
- .dataset-card {
491
- pointer-events: none;
492
-
493
- &::before {
494
- display: none;
495
- }
496
-
497
- + .main {
498
- border: 0 none;
499
- }
500
- }
501
-
502
- &:not(.is-loading) {
503
- .dataset-card {
504
- opacity: 0;
505
- visibility: hidden;
506
- height: 0;
507
- }
508
- }
509
- }
510
-
511
- &.is-loading {
512
- opacity: 0.5;
513
- pointer-events: none;
514
-
515
- :deep(.connectivity-card .title) {
516
- color: $app-primary-color;
517
- font-size: 18px;
518
- letter-spacing: normal;
519
- }
520
501
  }
521
502
  }
522
503
 
@@ -1,39 +1,5 @@
1
1
  <template>
2
2
  <div v-if="entry" class="main">
3
- <div v-if="connectivityEntry.length > 1 && !entryId" class="toggle-button">
4
- <el-popover
5
- width="auto"
6
- trigger="hover"
7
- :teleported="false"
8
- >
9
- <template #reference>
10
- <el-button
11
- class="button"
12
- @click="previous"
13
- :disabled="this.entryIndex === 0"
14
- >
15
- Previous
16
- </el-button>
17
- </template>
18
- <span>{{ previousLabel }}</span>
19
- </el-popover>
20
- <el-popover
21
- width="auto"
22
- trigger="hover"
23
- :teleported="false"
24
- >
25
- <template #reference>
26
- <el-button
27
- class="button"
28
- @click="next"
29
- :disabled="this.entryIndex === this.connectivityEntry.length - 1"
30
- >
31
- Next
32
- </el-button>
33
- </template>
34
- <span>{{ nextLabel }}</span>
35
- </el-popover>
36
- </div>
37
3
  <!-- Connectivity Info Title -->
38
4
  <div class="connectivity-info-title">
39
5
  <div class="title-content">
@@ -259,7 +225,6 @@ export default {
259
225
  },
260
226
  data: function () {
261
227
  return {
262
- entryIndex: 0,
263
228
  updatedCopyContent: '',
264
229
  activeView: 'listView',
265
230
  connectivityLoading: false,
@@ -271,24 +236,9 @@ export default {
271
236
  },
272
237
  computed: {
273
238
  entry: function () {
274
- if (this.entryId) {
275
- return this.connectivityEntry.filter((entry) => {
276
- return entry.featureId[0] === this.entryId;
277
- })[this.entryIndex];
278
- }
279
- return this.connectivityEntry[this.entryIndex];
280
- },
281
- previousLabel: function () {
282
- if (this.entryIndex === 0) {
283
- return "This is the first item. Click 'Next' to see more information.";
284
- }
285
- return this.connectivityEntry[this.entryIndex - 1].title;
286
- },
287
- nextLabel: function () {
288
- if (this.entryIndex === this.connectivityEntry.length - 1) {
289
- return "This is the last item. Click 'Previous' to see more information.";
290
- }
291
- return this.connectivityEntry[this.entryIndex + 1].title;
239
+ return this.connectivityEntry.find((entry) => {
240
+ return entry.featureId[0] === this.entryId;
241
+ });
292
242
  },
293
243
  hasProvenanceTaxonomyLabel: function () {
294
244
  return (
@@ -341,7 +291,7 @@ export default {
341
291
  deep: true,
342
292
  immediate: true,
343
293
  handler: function (newVal, oldVal) {
344
- if (newVal !== oldVal) {
294
+ if (newVal && newVal !== oldVal) {
345
295
  this.connectivityLoading = true;
346
296
  this.activeView =
347
297
  localStorage.getItem('connectivity-active-view') ||
@@ -361,16 +311,6 @@ export default {
361
311
  },
362
312
  },
363
313
  methods: {
364
- previous: function () {
365
- if (this.entryIndex !== 0) {
366
- this.entryIndex = this.entryIndex - 1;
367
- }
368
- },
369
- next: function () {
370
- if (this.entryIndex !== this.connectivityEntry.length - 1) {
371
- this.entryIndex = this.entryIndex + 1;
372
- }
373
- },
374
314
  titleCase: function (title) {
375
315
  return titleCase(title)
376
316
  },
@@ -941,6 +881,9 @@ export default {
941
881
  border-color: $app-primary-color !important;
942
882
  border-radius: 50%;
943
883
  }
884
+ &.is-disabled {
885
+ border-color: #dab3ec !important;
886
+ }
944
887
  }
945
888
 
946
889
  .el-button + .el-button {
@@ -54,7 +54,8 @@
54
54
  @show-connectivity="showConnectivity"
55
55
  @show-reference-connectivities="onShowReferenceConnectivities"
56
56
  @connectivity-hovered="onConnectivityHovered"
57
- @connectivity-explorer-clicked="onConnectivityExplorerClicked"
57
+ @connectivity-collapse-change="onConnectivityCollapseChange"
58
+ @connectivity-item-close="onConnectivityItemClose"
58
59
  />
59
60
  </template>
60
61
  <template v-else>
@@ -173,8 +174,16 @@ export default {
173
174
  }
174
175
  },
175
176
  methods: {
176
- onConnectivityExplorerClicked: function (data) {
177
- this.$emit('connectivity-explorer-clicked', data)
177
+ onConnectivityCollapseChange: function (data) {
178
+ this.$emit('connectivity-collapse-change', data)
179
+ },
180
+ /**
181
+ * This event is emitted when
182
+ * the close button of the opened connectivity card
183
+ * in connectivity explorer is clicked.
184
+ */
185
+ onConnectivityItemClose: function () {
186
+ this.$emit('connectivity-item-close');
178
187
  },
179
188
  /**
180
189
  * This event is emitted when the mouse hover are changed.
@@ -323,6 +332,9 @@ export default {
323
332
  storeAvailableAnatomyFacets: function (availableAnatomyFacets) {
324
333
  localStorage.setItem('available-anatomy-facets', JSON.stringify(availableAnatomyFacets))
325
334
  },
335
+ closeConnectivity: function () {
336
+ EventBus.emit('close-connectivity');
337
+ },
326
338
  },
327
339
  computed: {
328
340
  // This should respect the information provided by the property
@@ -40,6 +40,8 @@ declare module 'vue' {
40
40
  ElSelect: typeof import('element-plus/es')['ElSelect']
41
41
  ElTag: typeof import('element-plus/es')['ElTag']
42
42
  ImageGallery: typeof import('./components/ImageGallery.vue')['default']
43
+ RouterLink: typeof import('vue-router')['RouterLink']
44
+ RouterView: typeof import('vue-router')['RouterView']
43
45
  SearchFilters: typeof import('./components/SearchFilters.vue')['default']
44
46
  SearchHistory: typeof import('./components/SearchHistory.vue')['default']
45
47
  SideBar: typeof import('./components/SideBar.vue')['default']