@abi-software/map-side-bar 2.5.0-beta.5 → 2.5.0-beta.6
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/dist/map-side-bar.js +4168 -4142
- package/dist/map-side-bar.umd.cjs +36 -36
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/ConnectivityInfo.vue +114 -18
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
|
+
"version": "2.5.0-beta.6",
|
|
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.1-beta.
|
|
42
|
+
"@abi-software/map-utilities": "^1.2.1-beta.2",
|
|
43
43
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
44
44
|
"@element-plus/icons-vue": "^2.3.1",
|
|
45
45
|
"algoliasearch": "^4.10.5",
|
|
@@ -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">
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
:class="{'active': origin === selectedConnectivity}"
|
|
108
108
|
:origin-item-label="origin"
|
|
109
109
|
:key="origin"
|
|
110
|
-
@mouseenter="toggleConnectivityTooltip(origin, true)"
|
|
111
|
-
@mouseleave="toggleConnectivityTooltip(origin, false)"
|
|
110
|
+
@mouseenter="toggleConnectivityTooltip(origin, {show: true})"
|
|
111
|
+
@mouseleave="toggleConnectivityTooltip(origin, {show: false})"
|
|
112
112
|
@click="selectConnectivity(origin)"
|
|
113
113
|
>
|
|
114
114
|
{{ capitalise(origin) }}
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
:class="{'active': component === selectedConnectivity}"
|
|
139
139
|
:component-item-label="component"
|
|
140
140
|
:key="component"
|
|
141
|
-
@mouseenter="toggleConnectivityTooltip(component, true)"
|
|
142
|
-
@mouseleave="toggleConnectivityTooltip(component, false)"
|
|
141
|
+
@mouseenter="toggleConnectivityTooltip(component, {show: true})"
|
|
142
|
+
@mouseleave="toggleConnectivityTooltip(component, {show: false})"
|
|
143
143
|
@click="selectConnectivity(component)"
|
|
144
144
|
>
|
|
145
145
|
{{ capitalise(component) }}
|
|
@@ -171,8 +171,8 @@
|
|
|
171
171
|
:class="{'active': destination === selectedConnectivity}"
|
|
172
172
|
:destination-item-label="destination"
|
|
173
173
|
:key="destination"
|
|
174
|
-
@mouseenter="toggleConnectivityTooltip(destination, true)"
|
|
175
|
-
@mouseleave="toggleConnectivityTooltip(destination, false)"
|
|
174
|
+
@mouseenter="toggleConnectivityTooltip(destination, {show: true})"
|
|
175
|
+
@mouseleave="toggleConnectivityTooltip(destination, {show: false})"
|
|
176
176
|
@click="selectConnectivity(destination)"
|
|
177
177
|
>
|
|
178
178
|
{{ capitalise(destination) }}
|
|
@@ -204,6 +204,15 @@
|
|
|
204
204
|
Search for data on components
|
|
205
205
|
</el-button>
|
|
206
206
|
</div>
|
|
207
|
+
|
|
208
|
+
<div v-if="connectivityError" class="connectivity-error-container">
|
|
209
|
+
<div class="connectivity-error">
|
|
210
|
+
<strong v-if="connectivityError.errorConnectivities">
|
|
211
|
+
{{ connectivityError.errorConnectivities }}
|
|
212
|
+
</strong>
|
|
213
|
+
{{ connectivityError.errorMessage }}
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
207
216
|
</div>
|
|
208
217
|
|
|
209
218
|
<div class="content-container" v-if="activeView === 'graphView'">
|
|
@@ -246,6 +255,8 @@ const capitalise = function (str) {
|
|
|
246
255
|
return ''
|
|
247
256
|
}
|
|
248
257
|
|
|
258
|
+
const ERROR_TIMEOUT = 3000; // 3 seconds
|
|
259
|
+
|
|
249
260
|
export default {
|
|
250
261
|
name: 'ConnectivityInfo',
|
|
251
262
|
components: {
|
|
@@ -300,6 +311,7 @@ export default {
|
|
|
300
311
|
uberons: [{ id: undefined, name: undefined }],
|
|
301
312
|
selectedConnectivity: '',
|
|
302
313
|
selectedConnectivityData: [],
|
|
314
|
+
connectivityError: null,
|
|
303
315
|
}
|
|
304
316
|
},
|
|
305
317
|
watch: {
|
|
@@ -415,7 +427,7 @@ export default {
|
|
|
415
427
|
// save selected state for list view
|
|
416
428
|
const name = data.map(t => t.label).join(', ');
|
|
417
429
|
this.selectedConnectivity = name;
|
|
418
|
-
this.toggleConnectivityTooltip(name, true);
|
|
430
|
+
this.toggleConnectivityTooltip(name, {show: true, type: 'click'});
|
|
419
431
|
|
|
420
432
|
/**
|
|
421
433
|
* This event is triggered by connectivity-graph's `tap-node` event.
|
|
@@ -518,9 +530,9 @@ export default {
|
|
|
518
530
|
},
|
|
519
531
|
toggleConnectivityTooltip: function (name, option) {
|
|
520
532
|
// if there has selected item
|
|
521
|
-
if (!option && this.selectedConnectivity) {
|
|
533
|
+
if (!option.show && this.selectedConnectivity) {
|
|
522
534
|
name = this.selectedConnectivity;
|
|
523
|
-
option = true;
|
|
535
|
+
option.show = true;
|
|
524
536
|
}
|
|
525
537
|
|
|
526
538
|
const allWithDatasets = [
|
|
@@ -530,7 +542,7 @@ export default {
|
|
|
530
542
|
];
|
|
531
543
|
const names = name.split(','); // some features have more than one value
|
|
532
544
|
const data = [];
|
|
533
|
-
if (option) {
|
|
545
|
+
if (option.show) {
|
|
534
546
|
names.forEach((n) => {
|
|
535
547
|
const foundData = allWithDatasets.find((a) =>
|
|
536
548
|
a.name.toLowerCase().trim() === n.toLowerCase().trim()
|
|
@@ -547,26 +559,87 @@ export default {
|
|
|
547
559
|
|
|
548
560
|
// saved state for graph view
|
|
549
561
|
this.selectedConnectivityData = data;
|
|
550
|
-
|
|
562
|
+
// type: to show error only for click event
|
|
563
|
+
this.$emit('connectivity-component-click', {
|
|
564
|
+
data,
|
|
565
|
+
type: option.type
|
|
566
|
+
});
|
|
551
567
|
},
|
|
552
568
|
selectConnectivity: function (name) {
|
|
553
569
|
// clicking on the same item will unselect it
|
|
554
570
|
if (this.selectedConnectivity === name) {
|
|
555
571
|
this.selectedConnectivity = '';
|
|
556
|
-
this.toggleConnectivityTooltip(name, false);
|
|
572
|
+
this.toggleConnectivityTooltip(name, {show: false});
|
|
557
573
|
} else {
|
|
558
574
|
this.selectedConnectivity = name;
|
|
559
|
-
this.toggleConnectivityTooltip(name, true);
|
|
575
|
+
this.toggleConnectivityTooltip(name, {show: true, type: 'click'});
|
|
560
576
|
}
|
|
561
577
|
},
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
578
|
+
getErrorConnectivities: function (errorData) {
|
|
579
|
+
const errorDataToEmit = [...new Set(errorData)];
|
|
580
|
+
let errorConnectivities = '';
|
|
581
|
+
|
|
582
|
+
errorDataToEmit.forEach((connectivity, i) => {
|
|
583
|
+
const { label } = connectivity;
|
|
584
|
+
errorConnectivities += (i === 0) ? capitalise(label) : label;
|
|
585
|
+
|
|
586
|
+
if (errorDataToEmit.length > 1) {
|
|
587
|
+
if ((i + 2) === errorDataToEmit.length) {
|
|
588
|
+
errorConnectivities += ' and ';
|
|
589
|
+
} else if ((i + 1) < errorDataToEmit.length) {
|
|
590
|
+
errorConnectivities += ', ';
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
return errorConnectivities;
|
|
596
|
+
},
|
|
597
|
+
/**
|
|
598
|
+
* Function to show error message.
|
|
599
|
+
* `errorInfo` includes `errorData` array (optional) for error connectivities
|
|
600
|
+
* and `errorMessage` for error message.
|
|
601
|
+
* @arg `errorInfo`
|
|
602
|
+
*/
|
|
603
|
+
getConnectivityError: function (errorInfo) {
|
|
604
|
+
const { errorData, errorMessage } = errorInfo;
|
|
605
|
+
const errorConnectivities = this.getErrorConnectivities(errorData);
|
|
606
|
+
|
|
607
|
+
return {
|
|
608
|
+
errorConnectivities,
|
|
609
|
+
errorMessage,
|
|
610
|
+
};
|
|
611
|
+
},
|
|
612
|
+
isExistingError: function (connectivityError) {
|
|
613
|
+
if (
|
|
614
|
+
this.connectivityError &&
|
|
615
|
+
connectivityError.errorConnectivities !== this.connectivityError.errorConnectivities
|
|
616
|
+
) {
|
|
617
|
+
return true;
|
|
618
|
+
}
|
|
619
|
+
return false;
|
|
620
|
+
},
|
|
621
|
+
pushConnectivityError: function (errorInfo) {
|
|
622
|
+
const connectivityError = this.getConnectivityError(errorInfo);
|
|
565
623
|
const connectivityGraphRef = this.$refs.connectivityGraphRef;
|
|
566
624
|
|
|
625
|
+
// error for graph view
|
|
567
626
|
if (connectivityGraphRef) {
|
|
568
|
-
connectivityGraphRef.showErrorMessage(
|
|
627
|
+
connectivityGraphRef.showErrorMessage(connectivityError);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// error for list view
|
|
631
|
+
if (!this.isExistingError(connectivityError)) {
|
|
632
|
+
this.connectivityError = {...connectivityError};
|
|
633
|
+
|
|
634
|
+
setTimeout(() => {
|
|
635
|
+
this.connectivityError = null;
|
|
636
|
+
}, ERROR_TIMEOUT);
|
|
569
637
|
}
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
mounted: function () {
|
|
641
|
+
EventBus.on('connectivity-graph-error', (errorInfo) => {
|
|
642
|
+
this.pushConnectivityError(errorInfo);
|
|
570
643
|
});
|
|
571
644
|
},
|
|
572
645
|
}
|
|
@@ -932,4 +1005,27 @@ export default {
|
|
|
932
1005
|
background: #f3ecf6;
|
|
933
1006
|
}
|
|
934
1007
|
}
|
|
1008
|
+
|
|
1009
|
+
.content-container-connectivity {
|
|
1010
|
+
position: relative;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
.connectivity-error-container {
|
|
1014
|
+
position: sticky;
|
|
1015
|
+
bottom: 0.5rem;
|
|
1016
|
+
width: 100%;
|
|
1017
|
+
display: flex;
|
|
1018
|
+
flex-direction: row;
|
|
1019
|
+
align-items: center;
|
|
1020
|
+
justify-content: center;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
.connectivity-error {
|
|
1024
|
+
width: fit-content;
|
|
1025
|
+
font-size: 12px;
|
|
1026
|
+
padding: 0.25rem 0.5rem;
|
|
1027
|
+
background-color: var(--el-color-error-light-9);
|
|
1028
|
+
border-radius: var(--el-border-radius-small);
|
|
1029
|
+
border: 1px solid var(--el-color-error);
|
|
1030
|
+
}
|
|
935
1031
|
</style>
|