@abi-software/map-side-bar 2.5.0-beta.3 → 2.5.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.5.0-beta.3",
3
+ "version": "2.5.1",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@abi-software/gallery": "^1.1.2",
42
- "@abi-software/map-utilities": "^1.2.0-beta.8",
42
+ "@abi-software/map-utilities": "^1.2.0",
43
43
  "@abi-software/svg-sprite": "^1.0.1",
44
44
  "@element-plus/icons-vue": "^2.3.1",
45
45
  "algoliasearch": "^4.10.5",
package/src/App.vue CHANGED
@@ -29,6 +29,7 @@
29
29
  @tabClicked="tabClicked"
30
30
  @search-changed="searchChanged($event)"
31
31
  @hover-changed="hoverChanged($event)"
32
+ @connectivity-component-click="onConnectivityComponentClick"
32
33
  @actionClick="action"
33
34
  />
34
35
  </div>
@@ -123,10 +124,18 @@ export default {
123
124
  BL_SERVER_URL: import.meta.env.VITE_APP_BL_SERVER_URL,
124
125
  NL_LINK_PREFIX: import.meta.env.VITE_APP_NL_LINK_PREFIX,
125
126
  ROOT_URL: import.meta.env.VITE_APP_ROOT_URL,
127
+ FLATMAPAPI_LOCATION: import.meta.env.VITE_FLATMAPAPI_LOCATION,
126
128
  },
127
129
  connectivityInput: exampleConnectivityInput,
128
130
  activeId: 1,
129
- createData: null,
131
+ createData: {
132
+ toBeConfirmed: false,
133
+ points: [],
134
+ shape: "",
135
+ x: 0,
136
+ y: 0,
137
+ },
138
+ createDataSet: false,
130
139
  }
131
140
  },
132
141
  methods: {
@@ -237,7 +246,7 @@ export default {
237
246
  console.log('Algolia facets:', facets)
238
247
  },
239
248
  toggleCreateData : function() {
240
- if (!this.createData) {
249
+ if (!this.createDataSet) {
241
250
  this.createData = {
242
251
  drawingBox: false,
243
252
  toBeConfirmed: true,
@@ -249,9 +258,20 @@ export default {
249
258
  faceIndex: -1,
250
259
  toBeDeleted: false,
251
260
  }
261
+ this.createDataSet = true
252
262
  } else {
253
- this.createData = null
263
+ this.createData = {
264
+ toBeConfirmed: false,
265
+ points: [],
266
+ shape: "",
267
+ x: 0,
268
+ y: 0,
269
+ }
270
+ this.createDataSet = false
254
271
  }
272
+ },
273
+ onConnectivityComponentClick: function(data) {
274
+ console.log("onConnectivityComponentClick" , data)
255
275
  }
256
276
  },
257
277
  mounted: function () {
@@ -35,7 +35,9 @@
35
35
  <div class="block" v-else>
36
36
  <div class="title">{{ entry.featureId }}</div>
37
37
  </div>
38
- <external-resource-card :resources="resources"></external-resource-card>
38
+ <div class="block" v-if="resources.length">
39
+ <external-resource-card :resources="resources"></external-resource-card>
40
+ </div>
39
41
  </div>
40
42
  <div class="title-buttons">
41
43
  <el-popover
@@ -58,7 +60,28 @@
58
60
  <CopyToClipboard :content="updatedCopyContent" />
59
61
  </div>
60
62
  </div>
61
- <div class="content-container scrollbar">
63
+
64
+ <div class="content-container population-display">
65
+ <div class="block attribute-title-container">
66
+ <span class="attribute-title">Population Display</span>
67
+ </div>
68
+ <div class="block buttons-row">
69
+ <el-button
70
+ :class="activeView === 'listView' ? 'button' : 'el-button-secondary'"
71
+ @click="switchConnectivityView('listView')"
72
+ >
73
+ List view
74
+ </el-button>
75
+ <el-button
76
+ :class="activeView === 'graphView' ? 'button' : 'el-button-secondary'"
77
+ @click="switchConnectivityView('graphView')"
78
+ >
79
+ Graph view
80
+ </el-button>
81
+ </div>
82
+ </div>
83
+
84
+ <div class="content-container" v-if="activeView === 'listView'">
62
85
  {{ entry.paths }}
63
86
  <div v-if="entry.origins && entry.origins.length > 0" class="block">
64
87
  <div class="attribute-title-container">
@@ -83,9 +106,15 @@
83
106
  class="attribute-content"
84
107
  :origin-item-label="origin"
85
108
  :key="origin"
109
+ @mouseenter="toggleConnectivityTooltip(origin, true)"
110
+ @mouseleave="toggleConnectivityTooltip(origin, false)"
86
111
  >
87
112
  {{ capitalise(origin) }}
88
- <div v-if="i != entry.origins.length - 1" class="seperator"></div>
113
+ <!-- <el-checkbox
114
+ :label="capitalise(origin)"
115
+ size="small"
116
+ @change="toggleConnectivityHighlight"
117
+ /> -->
89
118
  </div>
90
119
  <el-button
91
120
  v-show="
@@ -111,12 +140,15 @@
111
140
  class="attribute-content"
112
141
  :component-item-label="component"
113
142
  :key="component"
143
+ @mouseenter="toggleConnectivityTooltip(component, true)"
144
+ @mouseleave="toggleConnectivityTooltip(component, false)"
114
145
  >
115
146
  {{ capitalise(component) }}
116
- <div
117
- v-if="i != entry.components.length - 1"
118
- class="seperator"
119
- ></div>
147
+ <!-- <el-checkbox
148
+ :label="capitalise(component)"
149
+ size="small"
150
+ @change="toggleConnectivityHighlight"
151
+ /> -->
120
152
  </div>
121
153
  </div>
122
154
  <div
@@ -144,12 +176,15 @@
144
176
  class="attribute-content"
145
177
  :destination-item-label="destination"
146
178
  :key="destination"
179
+ @mouseenter="toggleConnectivityTooltip(destination, true)"
180
+ @mouseleave="toggleConnectivityTooltip(destination, false)"
147
181
  >
148
182
  {{ capitalise(destination) }}
149
- <div
150
- v-if="i != entry.destinations.length - 1"
151
- class="seperator"
152
- ></div>
183
+ <!-- <el-checkbox
184
+ :label="capitalise(destination)"
185
+ size="small"
186
+ @change="toggleConnectivityHighlight"
187
+ /> -->
153
188
  </div>
154
189
  <el-button
155
190
  v-show="
@@ -163,18 +198,30 @@
163
198
  Explore destination data
164
199
  </el-button>
165
200
  </div>
166
-
167
- <el-button
201
+ <div
168
202
  v-show="
169
203
  entry.componentsWithDatasets &&
170
204
  entry.componentsWithDatasets.length > 0 &&
171
205
  shouldShowExploreButton(entry.componentsWithDatasets)
172
206
  "
173
- class="button"
174
- @click="openAll"
207
+ class="block"
175
208
  >
176
- Search for data on components
177
- </el-button>
209
+ <el-button
210
+ class="button"
211
+ @click="openAll"
212
+ >
213
+ Search for data on components
214
+ </el-button>
215
+ </div>
216
+ </div>
217
+
218
+ <div class="content-container" v-if="activeView === 'graphView'">
219
+ <connectivity-graph
220
+ :entry="entry.featureId[0]"
221
+ :mapServer="envVars.FLATMAPAPI_LOCATION"
222
+ @tap-node="onTapNode"
223
+ ref="connectivityGraphRef"
224
+ />
178
225
  </div>
179
226
  </div>
180
227
  </template>
@@ -193,7 +240,7 @@ import {
193
240
  } from 'element-plus'
194
241
  import ExternalResourceCard from './ExternalResourceCard.vue'
195
242
  import EventBus from './EventBus.js'
196
- import { CopyToClipboard } from '@abi-software/map-utilities';
243
+ import { CopyToClipboard, ConnectivityGraph } from '@abi-software/map-utilities';
197
244
  import '@abi-software/map-utilities/dist/style.css';
198
245
 
199
246
  const titleCase = (str) => {
@@ -218,6 +265,7 @@ export default {
218
265
  ElIconWarning,
219
266
  ExternalResourceCard,
220
267
  CopyToClipboard,
268
+ ConnectivityGraph,
221
269
  },
222
270
  props: {
223
271
  entry: {
@@ -233,6 +281,10 @@ export default {
233
281
  featuresAlert: undefined,
234
282
  }),
235
283
  },
284
+ envVars: {
285
+ type: Object,
286
+ default: () => {},
287
+ },
236
288
  availableAnatomyFacets: {
237
289
  type: Array,
238
290
  default: () => [],
@@ -244,6 +296,7 @@ export default {
244
296
  activeSpecies: undefined,
245
297
  pubmedSearchUrl: '',
246
298
  loading: false,
299
+ activeView: 'listView',
247
300
  facetList: [],
248
301
  showToolip: false,
249
302
  showDetails: false,
@@ -352,6 +405,24 @@ export default {
352
405
  // connected to flatmapvuer > moveMap(featureIds) function
353
406
  this.$emit('show-connectivity', featureIds);
354
407
  },
408
+ switchConnectivityView: function (val) {
409
+ this.activeView = val;
410
+
411
+ if (val === 'graphView') {
412
+ const connectivityGraphRef = this.$refs.connectivityGraphRef;
413
+ if (connectivityGraphRef && connectivityGraphRef.$el) {
414
+ connectivityGraphRef.$el.scrollIntoView({
415
+ behavior: 'smooth',
416
+ });
417
+ }
418
+ }
419
+ },
420
+ onTapNode: function (data) {
421
+ /**
422
+ * This event is triggered by connectivity-graph's `tap-node` event.
423
+ */
424
+ this.$emit('connectivity-component-click', data);
425
+ },
355
426
  getUpdateCopyContent: function () {
356
427
  if (!this.entry) {
357
428
  return '';
@@ -446,6 +517,34 @@ export default {
446
517
 
447
518
  return contentArray.join('\n\n<br>');
448
519
  },
520
+ toggleConnectivityTooltip: function (name, option) {
521
+ const allWithDatasets = [
522
+ ...this.entry.componentsWithDatasets,
523
+ ...this.entry.destinationsWithDatasets,
524
+ ...this.entry.originsWithDatasets,
525
+ ];
526
+ const names = name.split(','); // some features have more than one value
527
+ const data = [];
528
+ if (option) {
529
+ names.forEach((n) => {
530
+ data.push(allWithDatasets.find((a) => a.name.trim() === n.trim()));
531
+ });
532
+ }
533
+ this.$emit('connectivity-component-click', data);
534
+ },
535
+ // TODO: to keep the connection on the flatmap when the checkbox is ticked.
536
+ // toggleConnectivityHighlight: function (value) {
537
+ // // value = true/false
538
+ // },
539
+ },
540
+ mounted: function () {
541
+ EventBus.on('connectivity-graph-error', (errorMessage) => {
542
+ const connectivityGraphRef = this.$refs.connectivityGraphRef;
543
+
544
+ if (connectivityGraphRef) {
545
+ connectivityGraphRef.showErrorMessage(errorMessage);
546
+ }
547
+ });
449
548
  },
450
549
  }
451
550
  </script>
@@ -458,7 +557,7 @@ export default {
458
557
  }
459
558
 
460
559
  .connectivity-info-title {
461
- padding: 1rem;
560
+ padding: 0;
462
561
  display: flex;
463
562
  flex-direction: row;
464
563
  justify-content: space-between;
@@ -476,16 +575,8 @@ export default {
476
575
  color: $app-primary-color;
477
576
  }
478
577
 
479
- .block {
480
- margin-bottom: 0.5em;
481
-
482
- .main > &:first-of-type {
483
- margin-right: 1em;
484
- }
485
- }
486
-
487
- .pub {
488
- width: 16rem;
578
+ .block + .block {
579
+ margin-top: 0.5em;
489
580
  }
490
581
 
491
582
  .button-circle {
@@ -547,12 +638,6 @@ export default {
547
638
  }
548
639
  }
549
640
 
550
- .seperator {
551
- width: 90%;
552
- height: 1px;
553
- background-color: #bfbec2;
554
- }
555
-
556
641
  .hide {
557
642
  color: $app-primary-color;
558
643
  cursor: pointer;
@@ -585,6 +670,10 @@ export default {
585
670
  height: 100%;
586
671
  border-left: 1px solid var(--el-border-color);
587
672
  border-top: 1px solid var(--el-border-color);
673
+ display: flex;
674
+ flex-direction: column;
675
+ gap: 1.75rem;
676
+ padding: 1rem;
588
677
  }
589
678
 
590
679
  .attribute-title-container {
@@ -601,10 +690,46 @@ export default {
601
690
  .attribute-content {
602
691
  font-size: 14px;
603
692
  font-weight: 500;
693
+ transition: color 0.25s ease;
694
+ cursor: default;
695
+
696
+ &:hover {
697
+ color: $app-primary-color;
698
+ }
699
+
700
+ + .attribute-content {
701
+ position: relative;
702
+
703
+ &::before {
704
+ content: "";
705
+ width: 90%;
706
+ height: 1px;
707
+ background-color: var(--el-border-color);
708
+ position: absolute;
709
+ top: 0;
710
+ left: 0;
711
+ }
712
+ }
604
713
 
605
714
  &:last-of-type {
606
715
  margin-bottom: 0.5em;
607
716
  }
717
+
718
+ // TODO: if we have checkboxes
719
+ // :deep(.el-checkbox),
720
+ // :deep(.el-checkbox.el-checkbox--small .el-checkbox__label) {
721
+ // font-size: inherit;
722
+ // font-weight: inherit;
723
+ // color: inherit;
724
+ // }
725
+
726
+ // :deep(.el-checkbox) {
727
+ // gap: 8px;
728
+ // }
729
+
730
+ // :deep(.el-checkbox.el-checkbox--small .el-checkbox__label) {
731
+ // padding: 0;
732
+ // }
608
733
  }
609
734
 
610
735
  .popover-container {
@@ -627,16 +752,59 @@ export default {
627
752
  font-size: 14px !important;
628
753
  background-color: $app-primary-color;
629
754
  color: #fff;
755
+
756
+ &:hover {
757
+ color: #fff !important;
758
+ background-color: #ac76c5 !important;
759
+ border: 1px solid #ac76c5 !important;
760
+ }
761
+
630
762
  & + .button {
631
763
  margin-top: 10px !important;
632
764
  }
765
+ }
766
+
767
+ .el-button-secondary {
768
+ border-color: transparent !important;
769
+ background-color: transparent !important;
770
+ color: inherit !important;
771
+
633
772
  &:hover {
634
- color: #fff !important;
635
- background: #ac76c5 !important;
636
- border: 1px solid #ac76c5 !important;
773
+ color: $app-primary-color !important;
774
+ border-color: $app-primary-color !important;
775
+ background-color: #f9f2fc !important;
637
776
  }
638
777
  }
639
778
 
779
+ .buttons-row {
780
+ text-align: right;
781
+
782
+ .button {
783
+ cursor: default;
784
+ border-color: transparent;
785
+
786
+ &:hover {
787
+ background-color: $app-primary-color !important;
788
+ border-color: transparent !important;
789
+ }
790
+ }
791
+
792
+ .el-button + .el-button {
793
+ margin-top: 0 !important;
794
+ margin-left: 10px !important;
795
+ }
796
+ }
797
+
798
+ .population-display {
799
+ display: flex;
800
+ flex: 1 1 auto !important;
801
+ flex-direction: row !important;
802
+ align-items: center;
803
+ justify-content: space-between;
804
+ border-bottom: 1px solid $app-primary-color;
805
+ padding-bottom: 0.5rem !important;
806
+ }
807
+
640
808
  .tooltip-container {
641
809
  &::after,
642
810
  &::before {
@@ -696,39 +864,18 @@ export default {
696
864
 
697
865
  .content-container {
698
866
  flex: 1 1 100%;
699
- padding: 1rem;
867
+ padding: 0;
700
868
  box-sizing: border-box;
869
+ display: flex;
870
+ flex-direction: column;
871
+ gap: 1rem;
701
872
 
702
- .block {
703
- padding-top: 0.5em;
704
-
705
- + .block {
706
- margin-top: 1rem;
707
- }
708
- }
709
-
710
- .connectivity-info-title ~ & {
711
- padding-top: 0;
873
+ > div,
874
+ > .block + .block {
875
+ margin: 0;
712
876
  }
713
877
  }
714
878
 
715
- .scrollbar::-webkit-scrollbar-track {
716
- border-radius: 10px;
717
- background-color: #f5f5f5;
718
- }
719
-
720
- .scrollbar::-webkit-scrollbar {
721
- width: 12px;
722
- right: -12px;
723
- background-color: #f5f5f5;
724
- }
725
-
726
- .scrollbar::-webkit-scrollbar-thumb {
727
- border-radius: 4px;
728
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
729
- background-color: #979797;
730
- }
731
-
732
879
  /* Fix for chrome bug where under triangle pops up above one on top of it */
733
880
  .selector:not(*:root),
734
881
  .tooltip-container::after {
@@ -30,13 +30,15 @@
30
30
  />
31
31
  <template v-for="tab in tabs" key="tab.id">
32
32
  <!-- Connectivity Info -->
33
- <template v-if="tab.type === 'connectivity'">
33
+ <template v-if="tab.type === 'connectivity' && connectivityInfo">
34
34
  <connectivity-info
35
35
  :entry="connectivityInfo"
36
36
  :availableAnatomyFacets="availableAnatomyFacets"
37
- v-show="tab.id === activeTabId"
37
+ v-if="tab.id === activeTabId"
38
+ :envVars="envVars"
38
39
  :ref="'connectivityTab_' + tab.id"
39
40
  @show-connectivity="showConnectivity"
41
+ @connectivity-component-click="onConnectivityComponentClick"
40
42
  />
41
43
  </template>
42
44
  <template v-else-if="tab.type === 'annotation'">
@@ -156,7 +158,13 @@ export default {
156
158
  },
157
159
  createData: {
158
160
  type: Object,
159
- default: null,
161
+ default: {
162
+ toBeConfirmed: false,
163
+ points: [],
164
+ shape: "",
165
+ x: 0,
166
+ y: 0,
167
+ },
160
168
  }
161
169
  },
162
170
  data: function () {
@@ -180,6 +188,13 @@ export default {
180
188
  showConnectivity: function (featureIds) {
181
189
  this.$emit('show-connectivity', featureIds);
182
190
  },
191
+ /**
192
+ * This function is triggered after a connectivity component is clicked.
193
+ * @arg data
194
+ */
195
+ onConnectivityComponentClick: function (data) {
196
+ this.$emit('connectivity-component-click', data);
197
+ },
183
198
  /**
184
199
  * This event is emitted when the search filters are changed.
185
200
  * @arg `obj` {data, id}
@@ -291,6 +306,13 @@ export default {
291
306
  tabClose: function (id) {
292
307
  this.$emit('tab-close', id);
293
308
  },
309
+ /**
310
+ * To receive error message for connectivity graph
311
+ * @param {String} errorMessage
312
+ */
313
+ updateConnectivityGraphError: function (errorMessage) {
314
+ EventBus.emit('connectivity-graph-error', errorMessage);
315
+ },
294
316
  },
295
317
  computed: {
296
318
  activeTabs: function() {
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  </div>
18
18
  <el-button
19
- v-if="title.id !== 1"
19
+ v-if="title.id > 1"
20
20
  @click="tabClose(title.id)"
21
21
  class="button-tab-close"
22
22
  aria-label="Close"