@abi-software/map-side-bar 2.7.3-beta.0 → 2.7.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/dist/map-side-bar.js +6754 -6309
- package/dist/map-side-bar.umd.cjs +61 -61
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +96 -32
- package/src/assets/pagination.scss +21 -0
- package/src/components/AnnotationTool.vue +1 -1
- package/src/components/ConnectivityCard.vue +93 -0
- package/src/components/ConnectivityExplorer.vue +615 -0
- package/src/components/ConnectivityInfo.vue +388 -383
- package/src/components/SearchFilters.vue +161 -129
- package/src/components/SearchHistory.vue +11 -13
- package/src/components/SideBar.vue +109 -116
- package/src/components/SidebarContent.vue +24 -18
- package/src/components/Tabs.vue +56 -95
- package/src/components.d.ts +5 -0
- package/src/exampleConnectivityInput.js +320 -290
|
@@ -1,89 +1,91 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="filters">
|
|
3
3
|
<MapSvgSpriteColor />
|
|
4
|
-
<div
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
v-if="presentTags.length > 1"
|
|
15
|
-
placement="bottom-start"
|
|
16
|
-
:width="200"
|
|
17
|
-
trigger="hover"
|
|
18
|
-
popper-class="cascade-tags-popover"
|
|
19
|
-
>
|
|
20
|
-
<template #default>
|
|
21
|
-
<div class="el-tags-container">
|
|
22
|
-
<el-tag
|
|
23
|
-
v-for="(tag, i) in presentTags.slice(1)"
|
|
24
|
-
:key="i"
|
|
25
|
-
class="ml-2"
|
|
26
|
-
type="info"
|
|
27
|
-
closable
|
|
28
|
-
@close="cascadeTagClose(tag)"
|
|
29
|
-
>
|
|
30
|
-
{{ tag }}
|
|
31
|
-
</el-tag>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
<template #reference>
|
|
35
|
-
<div class="el-tags-container">
|
|
36
|
-
<el-tag
|
|
37
|
-
v-if="presentTags.length > 1"
|
|
38
|
-
class="ml-2"
|
|
39
|
-
type="info"
|
|
40
|
-
>
|
|
41
|
-
+{{ presentTags.length - 1 }}
|
|
42
|
-
</el-tag>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
</el-popover>
|
|
46
|
-
</div>
|
|
47
|
-
<transition name="el-zoom-in-top">
|
|
48
|
-
<span v-show="showFilters" v-loading="!cascaderIsReady" class="search-filters transition-box">
|
|
49
|
-
<el-cascader
|
|
50
|
-
class="cascader"
|
|
51
|
-
ref="cascader"
|
|
52
|
-
v-model="cascadeSelected"
|
|
53
|
-
size="large"
|
|
54
|
-
placeholder=" "
|
|
55
|
-
:collapse-tags="true"
|
|
56
|
-
collapse-tags-tooltip
|
|
57
|
-
:options="options"
|
|
58
|
-
:props="props"
|
|
59
|
-
@change="cascadeEvent($event)"
|
|
60
|
-
@expand-change="cascadeExpandChange"
|
|
61
|
-
:show-all-levels="true"
|
|
62
|
-
popper-class="sidebar-cascader-popper"
|
|
63
|
-
/>
|
|
64
|
-
<div v-if="showFiltersText" class="filter-default-value">Filters</div>
|
|
4
|
+
<div v-show="showFilters">
|
|
5
|
+
<div class="cascader-tag" v-if="presentTags.length > 0">
|
|
6
|
+
<el-tag
|
|
7
|
+
class="ml-2"
|
|
8
|
+
type="info"
|
|
9
|
+
closable
|
|
10
|
+
@close="cascadeTagClose(presentTags[0])"
|
|
11
|
+
>
|
|
12
|
+
{{ presentTags[0] }}
|
|
13
|
+
</el-tag>
|
|
65
14
|
<el-popover
|
|
66
|
-
|
|
67
|
-
|
|
15
|
+
v-if="presentTags.length > 1"
|
|
16
|
+
placement="bottom-start"
|
|
17
|
+
:width="200"
|
|
68
18
|
trigger="hover"
|
|
69
|
-
popper-class="
|
|
19
|
+
popper-class="cascade-tags-popover"
|
|
70
20
|
>
|
|
21
|
+
<template #default>
|
|
22
|
+
<div class="el-tags-container">
|
|
23
|
+
<el-tag
|
|
24
|
+
v-for="(tag, i) in presentTags.slice(1)"
|
|
25
|
+
:key="i"
|
|
26
|
+
class="ml-2"
|
|
27
|
+
type="info"
|
|
28
|
+
closable
|
|
29
|
+
@close="cascadeTagClose(tag)"
|
|
30
|
+
>
|
|
31
|
+
{{ tag }}
|
|
32
|
+
</el-tag>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
71
35
|
<template #reference>
|
|
72
|
-
<
|
|
36
|
+
<div class="el-tags-container">
|
|
37
|
+
<el-tag
|
|
38
|
+
v-if="presentTags.length > 1"
|
|
39
|
+
class="ml-2"
|
|
40
|
+
type="info"
|
|
41
|
+
>
|
|
42
|
+
+{{ presentTags.length - 1 }}
|
|
43
|
+
</el-tag>
|
|
44
|
+
</div>
|
|
73
45
|
</template>
|
|
74
|
-
<div>
|
|
75
|
-
<strong>Within categories:</strong> OR
|
|
76
|
-
<br />
|
|
77
|
-
example: 'heart' OR 'colon'
|
|
78
|
-
<br />
|
|
79
|
-
<br />
|
|
80
|
-
<strong>Between categories:</strong> AND
|
|
81
|
-
<br />
|
|
82
|
-
example: 'rat' AND 'lung'
|
|
83
|
-
</div>
|
|
84
46
|
</el-popover>
|
|
85
|
-
</
|
|
86
|
-
|
|
47
|
+
</div>
|
|
48
|
+
<transition name="el-zoom-in-top">
|
|
49
|
+
<span v-loading="!cascaderIsReady" class="search-filters transition-box">
|
|
50
|
+
<el-cascader
|
|
51
|
+
class="cascader"
|
|
52
|
+
ref="cascader"
|
|
53
|
+
v-model="cascadeSelected"
|
|
54
|
+
size="large"
|
|
55
|
+
placeholder=" "
|
|
56
|
+
:collapse-tags="true"
|
|
57
|
+
collapse-tags-tooltip
|
|
58
|
+
:options="options"
|
|
59
|
+
:props="props"
|
|
60
|
+
@change="cascadeEvent($event)"
|
|
61
|
+
@expand-change="cascadeExpandChange"
|
|
62
|
+
:show-all-levels="true"
|
|
63
|
+
popper-class="sidebar-cascader-popper"
|
|
64
|
+
/>
|
|
65
|
+
<div v-if="showFiltersText" class="filter-default-value">Filters</div>
|
|
66
|
+
<el-popover
|
|
67
|
+
title="How do filters work?"
|
|
68
|
+
width="250"
|
|
69
|
+
trigger="hover"
|
|
70
|
+
popper-class="filter-help-popover"
|
|
71
|
+
>
|
|
72
|
+
<template #reference>
|
|
73
|
+
<MapSvgIcon icon="help" class="help" />
|
|
74
|
+
</template>
|
|
75
|
+
<div>
|
|
76
|
+
<strong>Within categories:</strong> OR
|
|
77
|
+
<br />
|
|
78
|
+
example: 'heart' OR 'colon'
|
|
79
|
+
<br />
|
|
80
|
+
<br />
|
|
81
|
+
<strong>Between categories:</strong> AND
|
|
82
|
+
<br />
|
|
83
|
+
example: 'rat' AND 'lung'
|
|
84
|
+
</div>
|
|
85
|
+
</el-popover>
|
|
86
|
+
</span>
|
|
87
|
+
</transition>
|
|
88
|
+
</div>
|
|
87
89
|
<div class="dataset-shown">
|
|
88
90
|
<span class="dataset-results-feedback">{{ numberOfResultsText }}</span>
|
|
89
91
|
<el-select
|
|
@@ -164,7 +166,6 @@ export default {
|
|
|
164
166
|
organ: false,
|
|
165
167
|
datasets: false,
|
|
166
168
|
},
|
|
167
|
-
showFilters: true,
|
|
168
169
|
showFiltersText: true,
|
|
169
170
|
cascadeSelected: [],
|
|
170
171
|
cascadeSelectedWithBoolean: [],
|
|
@@ -197,6 +198,9 @@ export default {
|
|
|
197
198
|
numberOfResultsText: function () {
|
|
198
199
|
return `${this.entry.numberOfHits} results | Showing`
|
|
199
200
|
},
|
|
201
|
+
showFilters: function () {
|
|
202
|
+
return this.entry.showFilters
|
|
203
|
+
}
|
|
200
204
|
},
|
|
201
205
|
methods: {
|
|
202
206
|
createCascaderItemValue: function (
|
|
@@ -213,7 +217,60 @@ export default {
|
|
|
213
217
|
)
|
|
214
218
|
return value
|
|
215
219
|
},
|
|
220
|
+
processOptions: function () {
|
|
221
|
+
// create top level of options in cascader
|
|
222
|
+
this.options.forEach((facet, i) => {
|
|
223
|
+
this.options[i].total = this.countTotalFacet(facet)
|
|
224
|
+
|
|
225
|
+
this.options[i].label = convertReadableLabel(facet.label)
|
|
226
|
+
this.options[i].value = this.createCascaderItemValue(
|
|
227
|
+
facet.key,
|
|
228
|
+
undefined
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
// put "Show all" as first option
|
|
232
|
+
this.options[i].children.unshift({
|
|
233
|
+
value: this.createCascaderItemValue('Show all'),
|
|
234
|
+
label: 'Show all',
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
// populate second level of options
|
|
238
|
+
this.options[i].children.forEach((facetItem, j) => {
|
|
239
|
+
// Format labels except funding program
|
|
240
|
+
if (this.options[i].children[j].facetPropPath !== 'pennsieve.organization.name') {
|
|
241
|
+
this.options[i].children[j].label = convertReadableLabel(
|
|
242
|
+
facetItem.label
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
this.options[i].children[j].value =
|
|
246
|
+
this.createCascaderItemValue(facet.label, facetItem.label)
|
|
247
|
+
if (
|
|
248
|
+
this.options[i].children[j].children &&
|
|
249
|
+
this.options[i].children[j].children.length > 0
|
|
250
|
+
) {
|
|
251
|
+
this.options[i].children[j].children.forEach((term, k) => {
|
|
252
|
+
this.options[i].children[j].children[k].label =
|
|
253
|
+
convertReadableLabel(term.label)
|
|
254
|
+
this.options[i].children[j].children[k].value =
|
|
255
|
+
this.createCascaderItemValue(
|
|
256
|
+
facet.label,
|
|
257
|
+
facetItem.label,
|
|
258
|
+
term.label
|
|
259
|
+
)
|
|
260
|
+
})
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
},
|
|
216
265
|
populateCascader: function () {
|
|
266
|
+
if (this.entry.options) {
|
|
267
|
+
return new Promise((resolve) => {
|
|
268
|
+
this.facets = this.entry.options
|
|
269
|
+
this.options = this.entry.options
|
|
270
|
+
this.processOptions()
|
|
271
|
+
resolve();
|
|
272
|
+
});
|
|
273
|
+
}
|
|
217
274
|
return new Promise((resolve) => {
|
|
218
275
|
// Algolia facet serach
|
|
219
276
|
this.algoliaClient
|
|
@@ -222,50 +279,7 @@ export default {
|
|
|
222
279
|
this.facets = data
|
|
223
280
|
EventBus.emit('available-facets', data)
|
|
224
281
|
this.options = data
|
|
225
|
-
|
|
226
|
-
// create top level of options in cascader
|
|
227
|
-
this.options.forEach((facet, i) => {
|
|
228
|
-
this.options[i].total = this.countTotalFacet(facet)
|
|
229
|
-
|
|
230
|
-
this.options[i].label = convertReadableLabel(facet.label)
|
|
231
|
-
this.options[i].value = this.createCascaderItemValue(
|
|
232
|
-
facet.key,
|
|
233
|
-
undefined
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
// put "Show all" as first option
|
|
237
|
-
this.options[i].children.unshift({
|
|
238
|
-
value: this.createCascaderItemValue('Show all'),
|
|
239
|
-
label: 'Show all',
|
|
240
|
-
})
|
|
241
|
-
|
|
242
|
-
// populate second level of options
|
|
243
|
-
this.options[i].children.forEach((facetItem, j) => {
|
|
244
|
-
// Format labels except funding program
|
|
245
|
-
if (this.options[i].children[j].facetPropPath !== 'pennsieve.organization.name') {
|
|
246
|
-
this.options[i].children[j].label = convertReadableLabel(
|
|
247
|
-
facetItem.label
|
|
248
|
-
)
|
|
249
|
-
}
|
|
250
|
-
this.options[i].children[j].value =
|
|
251
|
-
this.createCascaderItemValue(facet.label, facetItem.label)
|
|
252
|
-
if (
|
|
253
|
-
this.options[i].children[j].children &&
|
|
254
|
-
this.options[i].children[j].children.length > 0
|
|
255
|
-
) {
|
|
256
|
-
this.options[i].children[j].children.forEach((term, k) => {
|
|
257
|
-
this.options[i].children[j].children[k].label =
|
|
258
|
-
convertReadableLabel(term.label)
|
|
259
|
-
this.options[i].children[j].children[k].value =
|
|
260
|
-
this.createCascaderItemValue(
|
|
261
|
-
facet.label,
|
|
262
|
-
facetItem.label,
|
|
263
|
-
term.label
|
|
264
|
-
)
|
|
265
|
-
})
|
|
266
|
-
}
|
|
267
|
-
})
|
|
268
|
-
})
|
|
282
|
+
this.processOptions()
|
|
269
283
|
})
|
|
270
284
|
.finally(() => {
|
|
271
285
|
resolve()
|
|
@@ -735,13 +749,18 @@ export default {
|
|
|
735
749
|
removeTopLevelCascaderCheckboxes: function () {
|
|
736
750
|
// Next tick allows the cascader menu to change
|
|
737
751
|
this.$nextTick(() => {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
752
|
+
const cascadePanels = document.querySelectorAll('.sidebar-cascader-popper .el-cascader-menu__list');
|
|
753
|
+
|
|
754
|
+
cascadePanels.forEach(panel => {
|
|
755
|
+
const panelText = panel.textContent;
|
|
756
|
+
const expandArrow = panel.querySelector('.el-icon.arrow-right');
|
|
757
|
+
|
|
758
|
+
if (!panelText.includes('Show all') && expandArrow) {
|
|
759
|
+
panel.querySelectorAll('.el-checkbox__input').forEach(checkbox => {
|
|
760
|
+
checkbox.style.display = 'none';
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
});
|
|
745
764
|
})
|
|
746
765
|
},
|
|
747
766
|
/*
|
|
@@ -788,11 +807,24 @@ export default {
|
|
|
788
807
|
if (filters) {
|
|
789
808
|
if (this.cascaderIsReady) {
|
|
790
809
|
const result = []
|
|
810
|
+
const terms = []
|
|
791
811
|
filters.forEach((filter) => {
|
|
792
812
|
const validatedFilter =
|
|
793
813
|
this.validateAndConvertFilterToHierarchical(filter)
|
|
794
814
|
if (validatedFilter) {
|
|
795
815
|
result.push(validatedFilter)
|
|
816
|
+
terms.push(validatedFilter.term)
|
|
817
|
+
}
|
|
818
|
+
})
|
|
819
|
+
// make sure unused filter terms' show all checkbox is always checked
|
|
820
|
+
this.options.forEach((option)=>{
|
|
821
|
+
if (!terms.includes(option.label)) {
|
|
822
|
+
result.push({
|
|
823
|
+
facet: "Show all",
|
|
824
|
+
facetPropPath: option.key,
|
|
825
|
+
label: "Show all",
|
|
826
|
+
term: option.label
|
|
827
|
+
})
|
|
796
828
|
}
|
|
797
829
|
})
|
|
798
830
|
return result
|
|
@@ -170,6 +170,12 @@ export default {
|
|
|
170
170
|
Tag,
|
|
171
171
|
Select
|
|
172
172
|
},
|
|
173
|
+
props: {
|
|
174
|
+
localStorageKey: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: '',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
173
179
|
data() {
|
|
174
180
|
return {
|
|
175
181
|
searchHistory: [],
|
|
@@ -186,16 +192,14 @@ export default {
|
|
|
186
192
|
},
|
|
187
193
|
methods: {
|
|
188
194
|
getSearchHistory() {
|
|
189
|
-
if (localStorage.getItem(
|
|
190
|
-
this.searchHistory = JSON.parse(
|
|
191
|
-
localStorage.getItem('sparc.science-sidebar-search-history')
|
|
192
|
-
)
|
|
195
|
+
if (localStorage.getItem(this.localStorageKey)) {
|
|
196
|
+
this.searchHistory = JSON.parse(localStorage.getItem(this.localStorageKey))
|
|
193
197
|
} else {
|
|
194
198
|
this.searchHistory = []
|
|
195
199
|
}
|
|
196
200
|
},
|
|
197
201
|
clearSearchHistory() {
|
|
198
|
-
localStorage.removeItem(
|
|
202
|
+
localStorage.removeItem(this.localStorageKey)
|
|
199
203
|
this.searchHistory = []
|
|
200
204
|
},
|
|
201
205
|
sortFilters(a, b) {
|
|
@@ -263,10 +267,7 @@ export default {
|
|
|
263
267
|
this.trimSearchHistory();
|
|
264
268
|
|
|
265
269
|
// Save new data
|
|
266
|
-
localStorage.setItem(
|
|
267
|
-
'sparc.science-sidebar-search-history',
|
|
268
|
-
JSON.stringify(this.searchHistory)
|
|
269
|
-
);
|
|
270
|
+
localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory));
|
|
270
271
|
}
|
|
271
272
|
},
|
|
272
273
|
/**
|
|
@@ -356,10 +357,7 @@ export default {
|
|
|
356
357
|
this.trimSearchHistory();
|
|
357
358
|
|
|
358
359
|
// Save updated data
|
|
359
|
-
localStorage.setItem(
|
|
360
|
-
'sparc.science-sidebar-search-history',
|
|
361
|
-
JSON.stringify(this.searchHistory)
|
|
362
|
-
)
|
|
360
|
+
localStorage.setItem(this.localStorageKey, JSON.stringify(this.searchHistory))
|
|
363
361
|
},
|
|
364
362
|
search: function (item) {
|
|
365
363
|
this.$emit('search', item)
|