@abi-software/map-side-bar 2.5.0 → 2.5.2

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",
3
+ "version": "2.5.2",
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",
42
+ "@abi-software/map-utilities": "^1.2.1",
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
@@ -128,7 +128,14 @@ export default {
128
128
  },
129
129
  connectivityInput: exampleConnectivityInput,
130
130
  activeId: 1,
131
- createData: null,
131
+ createData: {
132
+ toBeConfirmed: false,
133
+ points: [],
134
+ shape: "",
135
+ x: 0,
136
+ y: 0,
137
+ },
138
+ createDataSet: false,
132
139
  }
133
140
  },
134
141
  methods: {
@@ -239,7 +246,7 @@ export default {
239
246
  console.log('Algolia facets:', facets)
240
247
  },
241
248
  toggleCreateData : function() {
242
- if (!this.createData) {
249
+ if (!this.createDataSet) {
243
250
  this.createData = {
244
251
  drawingBox: false,
245
252
  toBeConfirmed: true,
@@ -251,8 +258,16 @@ export default {
251
258
  faceIndex: -1,
252
259
  toBeDeleted: false,
253
260
  }
261
+ this.createDataSet = true
254
262
  } else {
255
- this.createData = null
263
+ this.createData = {
264
+ toBeConfirmed: false,
265
+ points: [],
266
+ shape: "",
267
+ x: 0,
268
+ y: 0,
269
+ }
270
+ this.createDataSet = false
256
271
  }
257
272
  },
258
273
  onConnectivityComponentClick: function(data) {
@@ -81,7 +81,7 @@
81
81
  </div>
82
82
  </div>
83
83
 
84
- <div class="content-container" v-if="activeView === 'listView'">
84
+ <div class="content-container content-container-connectivity" v-if="activeView === 'listView'">
85
85
  {{ entry.paths }}
86
86
  <div v-if="entry.origins && entry.origins.length > 0" class="block">
87
87
  <div class="attribute-title-container">
@@ -106,15 +106,10 @@
106
106
  class="attribute-content"
107
107
  :origin-item-label="origin"
108
108
  :key="origin"
109
- @mouseenter="toggleConnectivityTooltip(origin, true)"
110
- @mouseleave="toggleConnectivityTooltip(origin, false)"
109
+ @mouseenter="toggleConnectivityTooltip(origin, {show: true})"
110
+ @mouseleave="toggleConnectivityTooltip(origin, {show: false})"
111
111
  >
112
112
  {{ capitalise(origin) }}
113
- <!-- <el-checkbox
114
- :label="capitalise(origin)"
115
- size="small"
116
- @change="toggleConnectivityHighlight"
117
- /> -->
118
113
  </div>
119
114
  <el-button
120
115
  v-show="
@@ -140,15 +135,10 @@
140
135
  class="attribute-content"
141
136
  :component-item-label="component"
142
137
  :key="component"
143
- @mouseenter="toggleConnectivityTooltip(component, true)"
144
- @mouseleave="toggleConnectivityTooltip(component, false)"
138
+ @mouseenter="toggleConnectivityTooltip(component, {show: true})"
139
+ @mouseleave="toggleConnectivityTooltip(component, {show: false})"
145
140
  >
146
141
  {{ capitalise(component) }}
147
- <!-- <el-checkbox
148
- :label="capitalise(component)"
149
- size="small"
150
- @change="toggleConnectivityHighlight"
151
- /> -->
152
142
  </div>
153
143
  </div>
154
144
  <div
@@ -176,15 +166,10 @@
176
166
  class="attribute-content"
177
167
  :destination-item-label="destination"
178
168
  :key="destination"
179
- @mouseenter="toggleConnectivityTooltip(destination, true)"
180
- @mouseleave="toggleConnectivityTooltip(destination, false)"
169
+ @mouseenter="toggleConnectivityTooltip(destination, {show: true})"
170
+ @mouseleave="toggleConnectivityTooltip(destination, {show: false})"
181
171
  >
182
172
  {{ capitalise(destination) }}
183
- <!-- <el-checkbox
184
- :label="capitalise(destination)"
185
- size="small"
186
- @change="toggleConnectivityHighlight"
187
- /> -->
188
173
  </div>
189
174
  <el-button
190
175
  v-show="
@@ -213,6 +198,15 @@
213
198
  Search for data on components
214
199
  </el-button>
215
200
  </div>
201
+
202
+ <div v-if="connectivityError" class="connectivity-error-container">
203
+ <div class="connectivity-error">
204
+ <strong v-if="connectivityError.errorConnectivities">
205
+ {{ connectivityError.errorConnectivities }}
206
+ </strong>
207
+ {{ connectivityError.errorMessage }}
208
+ </div>
209
+ </div>
216
210
  </div>
217
211
 
218
212
  <div class="content-container" v-if="activeView === 'graphView'">
@@ -254,6 +248,8 @@ const capitalise = function (str) {
254
248
  return ''
255
249
  }
256
250
 
251
+ const ERROR_TIMEOUT = 3000; // 3 seconds
252
+
257
253
  export default {
258
254
  name: 'ConnectivityInfo',
259
255
  components: {
@@ -306,6 +302,8 @@ export default {
306
302
  },
307
303
  componentsWithDatasets: [],
308
304
  uberons: [{ id: undefined, name: undefined }],
305
+ connectivityError: null,
306
+ timeoutID: undefined,
309
307
  }
310
308
  },
311
309
  watch: {
@@ -418,10 +416,9 @@ export default {
418
416
  }
419
417
  },
420
418
  onTapNode: function (data) {
421
- /**
422
- * This event is triggered by connectivity-graph's `tap-node` event.
423
- */
424
- this.$emit('connectivity-component-click', data);
419
+ // save selected state for list view
420
+ const name = data.map(t => t.label).join(', ');
421
+ this.toggleConnectivityTooltip(name, {show: true});
425
422
  },
426
423
  getUpdateCopyContent: function () {
427
424
  if (!this.entry) {
@@ -525,25 +522,82 @@ export default {
525
522
  ];
526
523
  const names = name.split(','); // some features have more than one value
527
524
  const data = [];
528
- if (option) {
525
+ if (option.show) {
529
526
  names.forEach((n) => {
530
- data.push(allWithDatasets.find((a) => a.name.trim() === n.trim()));
527
+ const foundData = allWithDatasets.find((a) =>
528
+ a.name.toLowerCase().trim() === n.toLowerCase().trim()
529
+ );
530
+
531
+ if (foundData) {
532
+ data.push({
533
+ id: foundData.id,
534
+ label: foundData.name
535
+ });
536
+ }
531
537
  });
532
538
  }
539
+
540
+ // type: to show error only for click event
533
541
  this.$emit('connectivity-component-click', data);
534
542
  },
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) => {
543
+ getErrorConnectivities: function (errorData) {
544
+ const errorDataToEmit = [...new Set(errorData)];
545
+ let errorConnectivities = '';
546
+
547
+ errorDataToEmit.forEach((connectivity, i) => {
548
+ const { label } = connectivity;
549
+ errorConnectivities += (i === 0) ? capitalise(label) : label;
550
+
551
+ if (errorDataToEmit.length > 1) {
552
+ if ((i + 2) === errorDataToEmit.length) {
553
+ errorConnectivities += ' and ';
554
+ } else if ((i + 1) < errorDataToEmit.length) {
555
+ errorConnectivities += ', ';
556
+ }
557
+ }
558
+ });
559
+
560
+ return errorConnectivities;
561
+ },
562
+ /**
563
+ * Function to show error message.
564
+ * `errorInfo` includes `errorData` array (optional) for error connectivities
565
+ * and `errorMessage` for error message.
566
+ * @arg `errorInfo`
567
+ */
568
+ getConnectivityError: function (errorInfo) {
569
+ const { errorData, errorMessage } = errorInfo;
570
+ const errorConnectivities = this.getErrorConnectivities(errorData);
571
+
572
+ return {
573
+ errorConnectivities,
574
+ errorMessage,
575
+ };
576
+ },
577
+ pushConnectivityError: function (errorInfo) {
578
+ const connectivityError = this.getConnectivityError(errorInfo);
542
579
  const connectivityGraphRef = this.$refs.connectivityGraphRef;
543
580
 
581
+ // error for graph view
544
582
  if (connectivityGraphRef) {
545
- connectivityGraphRef.showErrorMessage(errorMessage);
583
+ connectivityGraphRef.showErrorMessage(connectivityError);
584
+ }
585
+
586
+ // error for list view
587
+ this.connectivityError = {...connectivityError};
588
+
589
+ if (this.timeoutID) {
590
+ clearTimeout(this.timeoutID);
546
591
  }
592
+
593
+ this.timeoutID = setTimeout(() => {
594
+ this.connectivityError = null;
595
+ }, ERROR_TIMEOUT);
596
+ },
597
+ },
598
+ mounted: function () {
599
+ EventBus.on('connectivity-graph-error', (errorInfo) => {
600
+ this.pushConnectivityError(errorInfo);
547
601
  });
548
602
  },
549
603
  }
@@ -691,6 +745,7 @@ export default {
691
745
  font-size: 14px;
692
746
  font-weight: 500;
693
747
  transition: color 0.25s ease;
748
+ position: relative;
694
749
  cursor: default;
695
750
 
696
751
  &:hover {
@@ -698,8 +753,6 @@ export default {
698
753
  }
699
754
 
700
755
  + .attribute-content {
701
- position: relative;
702
-
703
756
  &::before {
704
757
  content: "";
705
758
  width: 90%;
@@ -714,22 +767,6 @@ export default {
714
767
  &:last-of-type {
715
768
  margin-bottom: 0.5em;
716
769
  }
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
- // }
733
770
  }
734
771
 
735
772
  .popover-container {
@@ -765,8 +802,15 @@ export default {
765
802
  }
766
803
 
767
804
  .el-button-secondary {
768
- border-color: transparent;
769
- background-color: transparent;
805
+ border-color: transparent !important;
806
+ background-color: transparent !important;
807
+ color: inherit !important;
808
+
809
+ &:hover {
810
+ color: $app-primary-color !important;
811
+ border-color: $app-primary-color !important;
812
+ background-color: #f9f2fc !important;
813
+ }
770
814
  }
771
815
 
772
816
  .buttons-row {
@@ -906,4 +950,27 @@ export default {
906
950
  background: #f3ecf6;
907
951
  }
908
952
  }
953
+
954
+ .content-container-connectivity {
955
+ position: relative;
956
+ }
957
+
958
+ .connectivity-error-container {
959
+ position: sticky;
960
+ bottom: 0.5rem;
961
+ width: 100%;
962
+ display: flex;
963
+ flex-direction: row;
964
+ align-items: center;
965
+ justify-content: center;
966
+ }
967
+
968
+ .connectivity-error {
969
+ width: fit-content;
970
+ font-size: 12px;
971
+ padding: 0.25rem 0.5rem;
972
+ background-color: var(--el-color-error-light-9);
973
+ border-radius: var(--el-border-radius-small);
974
+ border: 1px solid var(--el-color-error);
975
+ }
909
976
  </style>
@@ -158,7 +158,13 @@ export default {
158
158
  },
159
159
  createData: {
160
160
  type: Object,
161
- default: null,
161
+ default: {
162
+ toBeConfirmed: false,
163
+ points: [],
164
+ shape: "",
165
+ x: 0,
166
+ y: 0,
167
+ },
162
168
  }
163
169
  },
164
170
  data: function () {
@@ -300,6 +306,13 @@ export default {
300
306
  tabClose: function (id) {
301
307
  this.$emit('tab-close', id);
302
308
  },
309
+ /**
310
+ * To receive error message for connectivity graph
311
+ * @param {String} errorMessage
312
+ */
313
+ updateConnectivityGraphError: function (errorInfo) {
314
+ EventBus.emit('connectivity-graph-error', errorInfo);
315
+ },
303
316
  },
304
317
  computed: {
305
318
  activeTabs: function() {
@@ -314,13 +327,6 @@ export default {
314
327
  }
315
328
  return tabs;
316
329
  },
317
- /**
318
- * To receive error message for connectivity graph
319
- * @param {String} errorMessage
320
- */
321
- updateConnectivityGraphError: function (errorMessage) {
322
- EventBus.emit('connectivity-graph-error', errorMessage);
323
- },
324
330
  },
325
331
  created: function () {
326
332
  this.drawerOpen = this.openAtStart