@abi-software/map-side-bar 1.3.17 → 1.3.18
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.common.js +133 -64
- package/dist/map-side-bar.common.js.map +1 -1
- package/dist/map-side-bar.css +1 -1
- package/dist/map-side-bar.umd.js +133 -64
- package/dist/map-side-bar.umd.js.map +1 -1
- package/dist/map-side-bar.umd.min.js +1 -1
- package/dist/map-side-bar.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/App.vue +8 -3
- package/src/components/SearchFilters.vue +42 -10
- package/src/components/SidebarContent.vue +19 -5
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
<link rel="stylesheet"
|
|
4
4
|
href="https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap">
|
|
5
5
|
Click arrow to open sidebar
|
|
6
|
-
<el-button @click="openSearch">search
|
|
6
|
+
<el-button @click="openSearch">search Uberon from refs</el-button>
|
|
7
7
|
<el-button @click="singleFacets">Add heart to Filter</el-button>
|
|
8
|
-
|
|
8
|
+
<el-button @click="addStomach">Add stomach to Filter</el-button>
|
|
9
|
+
<el-button @click="AddInvalidTerm">Add invalid term to Filter</el-button>
|
|
9
10
|
<el-button @click="multiFacets">multiple facets</el-button>
|
|
10
11
|
<el-button @click="neuronSearch">open neuron search</el-button>
|
|
11
12
|
<el-button @click="keywordSearch">keyword search</el-button>
|
|
@@ -115,8 +116,12 @@ export default {
|
|
|
115
116
|
addStomach: function(){
|
|
116
117
|
this.$refs.sideBar.addFilter({facet: 'Stomach', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name', AND: true})
|
|
117
118
|
},
|
|
119
|
+
addInvalidTerm: function(){
|
|
120
|
+
this.$refs.sideBar.addFilter({facet: 'Invalid', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name', AND: true})
|
|
121
|
+
},
|
|
118
122
|
multiFacets: function(){
|
|
119
|
-
this.$refs.sideBar.openSearch([{facet: 'Male', term:'Sex', facetPropPath:'attributes.subject.sex.value'}, {facet: 'Heart', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name'}
|
|
123
|
+
this.$refs.sideBar.openSearch([{facet: 'Male', term:'Sex', facetPropPath:'attributes.subject.sex.value'}, {facet: 'Heart', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name'},
|
|
124
|
+
{facet: 'Not correct', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name'}], '')
|
|
120
125
|
},
|
|
121
126
|
keywordSearch: function(){
|
|
122
127
|
this.$refs.sideBar.addFilter({type: 'Facet', label: undefined, facet: '3d model', facetPropPath: 'item.keywords.keyword', term: 'Keywords', AND: true})
|
|
@@ -178,7 +178,7 @@ export default {
|
|
|
178
178
|
this.createCascaderItemValue(facet.label, facetItem.label);
|
|
179
179
|
});
|
|
180
180
|
});
|
|
181
|
-
this.createDataTypeFacet()
|
|
181
|
+
this.createDataTypeFacet();
|
|
182
182
|
})
|
|
183
183
|
.finally(() => {
|
|
184
184
|
resolve();
|
|
@@ -225,7 +225,7 @@ export default {
|
|
|
225
225
|
this.makeCascadeLabelsClickable();
|
|
226
226
|
}
|
|
227
227
|
},
|
|
228
|
-
// showAllEventModifier: Modifies a cascade event to
|
|
228
|
+
// showAllEventModifier: Modifies a cascade event to unclick all selections in category if "show all" is clicked. Also unchecks "Show all" if any secection is clicked
|
|
229
229
|
// *NOTE* Does NOT remove 'Show all' selections from showing in 'cascadeSelected'
|
|
230
230
|
showAllEventModifier: function (event) {
|
|
231
231
|
// check if show all is in the cascader checked option list
|
|
@@ -363,13 +363,13 @@ export default {
|
|
|
363
363
|
addFilter: function (filter) {
|
|
364
364
|
//Do not set the value unless it is ready
|
|
365
365
|
if (this.cascaderIsReady && filter) {
|
|
366
|
-
this.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
366
|
+
if (this.validateFilter(filter)) {
|
|
367
|
+
this.cascadeSelected.filter(f=>f.term != filter.term)
|
|
368
|
+
this.cascadeSelected.push([filter.facetPropPath, this.createCascaderItemValue(filter.term, filter.facet), filter.AND])
|
|
369
|
+
this.cascadeSelectedWithBoolean.push([filter.facetPropPath, this.createCascaderItemValue(filter.term, filter.facet), filter.AND])
|
|
370
|
+
// The 'AND' her is to set the boolean value when we search on the filters. It can be undefined without breaking anything
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
373
|
}
|
|
374
374
|
},
|
|
375
375
|
initiateSearch: function() {
|
|
@@ -406,13 +406,45 @@ export default {
|
|
|
406
406
|
});
|
|
407
407
|
});
|
|
408
408
|
},
|
|
409
|
+
/**
|
|
410
|
+
* Validate ther filter term to make sure the term is correct
|
|
411
|
+
*/
|
|
412
|
+
validateFilter: function(filter) {
|
|
413
|
+
if (filter && filter.facet && filter.term) {
|
|
414
|
+
const item = this.createCascaderItemValue(filter.term, filter.facet);
|
|
415
|
+
const facet = this.options.find(element => element.value === filter.facetPropPath);
|
|
416
|
+
if (facet) {
|
|
417
|
+
const filter = facet.children.find(element => element.value === item);
|
|
418
|
+
if (filter)
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return false;
|
|
423
|
+
},
|
|
424
|
+
/**
|
|
425
|
+
* Return a list of valid filers given a list of filters,
|
|
426
|
+
*/
|
|
427
|
+
getValidatedFilters: function (filters) {
|
|
428
|
+
if (filters) {
|
|
429
|
+
if (this.cascaderIsReady) {
|
|
430
|
+
const result = [];
|
|
431
|
+
filters.forEach(filter => {
|
|
432
|
+
if (this.validateFilter(filter)) {
|
|
433
|
+
result.push(filter);
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
return result;
|
|
437
|
+
} else return filters;
|
|
438
|
+
}
|
|
439
|
+
return [];
|
|
440
|
+
},
|
|
409
441
|
},
|
|
410
442
|
mounted: function () {
|
|
411
443
|
this.algoliaClient = new AlgoliaClient(this.envVars.ALGOLIA_ID, this.envVars.ALGOLIA_KEY, this.envVars.PENNSIEVE_API_LOCATION);
|
|
412
444
|
this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX);
|
|
413
445
|
this.populateCascader().then(() => {
|
|
414
446
|
this.cascaderIsReady = true;
|
|
415
|
-
this.checkShowAllBoxes()
|
|
447
|
+
this.checkShowAllBoxes();
|
|
416
448
|
this.setCascader(this.entry.filterFacets);
|
|
417
449
|
this.makeCascadeLabelsClickable();
|
|
418
450
|
});
|
|
@@ -153,20 +153,34 @@ export default {
|
|
|
153
153
|
contextCardUpdate: function(val){
|
|
154
154
|
this.contextCardEntry = val
|
|
155
155
|
},
|
|
156
|
+
resetSearch: function() {
|
|
157
|
+
this.numberOfHits = 0
|
|
158
|
+
this.discoverIds = []
|
|
159
|
+
this._dois = []
|
|
160
|
+
this.results = []
|
|
161
|
+
this.loadingCards = false
|
|
162
|
+
},
|
|
156
163
|
openSearch: function(filter, search='') {
|
|
157
164
|
this.searchInput = search;
|
|
158
165
|
this.resetPageNavigation();
|
|
159
|
-
this.
|
|
160
|
-
|
|
161
|
-
|
|
166
|
+
this.filter = this.$refs.filtersRef.getValidatedFilters(filter);
|
|
167
|
+
//Facets provided but cannot find at least one valid
|
|
168
|
+
//facet. Tell the users the search is invalid and reset
|
|
169
|
+
//facets check boxes.
|
|
170
|
+
if ((filter && filter.length > 0) &&
|
|
171
|
+
(this.filter && this.filter.length === 0)) {
|
|
172
|
+
this.$refs.filtersRef.checkShowAllBoxes();
|
|
173
|
+
this.resetSearch();
|
|
174
|
+
} else if (this.filter) {
|
|
175
|
+
this.searchAlgolia(this.filter, search);
|
|
162
176
|
this.$refs.filtersRef.setCascader(this.filter);
|
|
163
177
|
}
|
|
164
178
|
},
|
|
165
179
|
addFilter: function(filter) {
|
|
166
180
|
this.resetPageNavigation();
|
|
167
181
|
if (filter) {
|
|
168
|
-
this.$refs.filtersRef.addFilter(filter)
|
|
169
|
-
|
|
182
|
+
if (this.$refs.filtersRef.addFilter(filter))
|
|
183
|
+
this.$refs.filtersRef.initiateSearch();
|
|
170
184
|
}
|
|
171
185
|
},
|
|
172
186
|
clearSearchClicked: function() {
|