@abi-software/map-side-bar 2.10.0-beta.7 → 2.10.0
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 +848 -806
- package/dist/map-side-bar.umd.cjs +27 -27
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/algolia/algolia.js +57 -6
- package/src/components/ConnectivityExplorer.vue +13 -3
- package/src/components/DatasetExplorer.vue +15 -5
- package/src/components/SearchFilters.vue +21 -8
- package/src/components/SideBar.vue +15 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/map-side-bar",
|
|
3
|
-
"version": "2.10.0
|
|
3
|
+
"version": "2.10.0",
|
|
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.
|
|
42
|
+
"@abi-software/map-utilities": "^1.7.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/algolia/algolia.js
CHANGED
|
@@ -59,7 +59,7 @@ export class AlgoliaClient {
|
|
|
59
59
|
: responseFacets[facetPropPath]
|
|
60
60
|
const allSubfacets = parentFacet && responseFacets[parentFacet.facetSubpropPath] ? Object.keys(responseFacets[parentFacet.facetSubpropPath]) : []
|
|
61
61
|
const allSubsubfacets = (parentFacet && parentFacet.facetSubsubpropPath &&
|
|
62
|
-
responseFacets[parentFacet.facetSubsubpropPath]) ?
|
|
62
|
+
responseFacets[parentFacet.facetSubsubpropPath]) ?
|
|
63
63
|
Object.keys(responseFacets[parentFacet.facetSubsubpropPath]) : []
|
|
64
64
|
const subFacetsMap = getFacetsChildrenMap(allSubfacets, 2);
|
|
65
65
|
const subSubFacetsMap = getFacetsChildrenMap(allSubsubfacets, 3);
|
|
@@ -107,7 +107,7 @@ export class AlgoliaClient {
|
|
|
107
107
|
facetPropPath: facetPropPath
|
|
108
108
|
}
|
|
109
109
|
if (childrenSubfacets.length > 0) {
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
newChild.children = childrenSubfacets
|
|
112
112
|
}
|
|
113
113
|
children.push(newChild)
|
|
@@ -258,22 +258,73 @@ export class AlgoliaClient {
|
|
|
258
258
|
// Saving the line below incase we want to starty using keywords again
|
|
259
259
|
// let anatomyAsUberons = this._processAnatomy(response.hits)
|
|
260
260
|
resolve({
|
|
261
|
-
forFlatmap: this.processResultsForFlatmap(response.hits),
|
|
261
|
+
forFlatmap: this.processResultsForFlatmap(response.facets ,response.hits),
|
|
262
262
|
forScaffold: this.processResultsForScaffold(response.hits)
|
|
263
263
|
})
|
|
264
264
|
})
|
|
265
265
|
})
|
|
266
266
|
}
|
|
267
|
-
processResultsForFlatmap(hits) {
|
|
267
|
+
processResultsForFlatmap(facets, hits) {
|
|
268
|
+
const filteredOrganNames = this.filterAvailableAnatomies(facets);
|
|
269
|
+
|
|
268
270
|
let curieForDatasets = hits.map(h=>{
|
|
269
271
|
const data = {
|
|
270
272
|
id: h.objectID,
|
|
271
|
-
terms: h.anatomy
|
|
273
|
+
terms: h.anatomy
|
|
274
|
+
? h.anatomy.organ.map(o => {
|
|
275
|
+
if (filteredOrganNames.includes(o.name.toLowerCase())) {
|
|
276
|
+
return o.curie
|
|
277
|
+
}
|
|
278
|
+
}).filter(Boolean)
|
|
279
|
+
: []
|
|
272
280
|
}
|
|
273
281
|
return data
|
|
274
282
|
})
|
|
275
283
|
|
|
276
|
-
return curieForDatasets
|
|
284
|
+
return curieForDatasets
|
|
285
|
+
}
|
|
286
|
+
filterAvailableAnatomies(facets) {
|
|
287
|
+
const anatomyOrganName = facets['anatomy.organ.name']
|
|
288
|
+
const anatomyOrganCategoryName = facets['anatomy.organ.category.name']
|
|
289
|
+
const anatomyOrganSubcategoryName = facets['anatomy.organ.subcategory.name']
|
|
290
|
+
const anatomyOrganSubsubcategoryName = facets['anatomy.organ.subsubcategory.name']
|
|
291
|
+
const anatomyOrganNames = anatomyOrganName ? Object.keys(anatomyOrganName) : []
|
|
292
|
+
const anatomyOrganCategoryNames = anatomyOrganCategoryName ? Object.keys(anatomyOrganCategoryName) : []
|
|
293
|
+
const anatomyOrganSubcategoryNames = anatomyOrganSubcategoryName ? Object.keys(anatomyOrganSubcategoryName) : []
|
|
294
|
+
const anatomyOrganSubsubcategoryNames = anatomyOrganSubsubcategoryName ? Object.keys(anatomyOrganSubsubcategoryName) : []
|
|
295
|
+
|
|
296
|
+
const filteredOrganNames = [];
|
|
297
|
+
anatomyOrganCategoryNames.forEach((_categoryName) => {
|
|
298
|
+
const categoryName = _categoryName.toLowerCase();
|
|
299
|
+
anatomyOrganNames.forEach((_organName) => {
|
|
300
|
+
const organName = _organName.toLowerCase();
|
|
301
|
+
const fullName = `${categoryName}.${organName}`
|
|
302
|
+
const foundNamesInSubsub = []
|
|
303
|
+
|
|
304
|
+
const found = anatomyOrganSubcategoryNames.some((_subcategoryName) => {
|
|
305
|
+
const subcategoryName = _subcategoryName.toLowerCase();
|
|
306
|
+
if (subcategoryName === fullName) {
|
|
307
|
+
const foundNameInSubsub = anatomyOrganSubsubcategoryNames.find((name) => name.toLocaleLowerCase().includes(subcategoryName))
|
|
308
|
+
if (foundNameInSubsub) {
|
|
309
|
+
const subsubOrganName = foundNameInSubsub.replace(`${subcategoryName}.`, '');
|
|
310
|
+
if (anatomyOrganNames.map((name) => name.toLowerCase()).includes(subsubOrganName)) {
|
|
311
|
+
foundNamesInSubsub.push(subsubOrganName)
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return true
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
if (foundNamesInSubsub.length) {
|
|
319
|
+
filteredOrganNames.push(...foundNamesInSubsub.map(name => name.toLowerCase()))
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (found) {
|
|
323
|
+
filteredOrganNames.push(organName);
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
})
|
|
327
|
+
return filteredOrganNames;
|
|
277
328
|
}
|
|
278
329
|
processResultsForScaffold(hits) {
|
|
279
330
|
let numberOfDatasetsForAnatomy = {}
|
|
@@ -366,7 +366,11 @@ export default {
|
|
|
366
366
|
},
|
|
367
367
|
onResetClick: function () {
|
|
368
368
|
this.openSearch([], '');
|
|
369
|
-
this.$emit('
|
|
369
|
+
this.$emit('search-changed', {
|
|
370
|
+
value: [],
|
|
371
|
+
tabType: 'dataset',
|
|
372
|
+
type: 'reset-update',
|
|
373
|
+
})
|
|
370
374
|
},
|
|
371
375
|
openSearch: function (filter, search = "") {
|
|
372
376
|
this.searchInput = search;
|
|
@@ -374,7 +378,9 @@ export default {
|
|
|
374
378
|
//Proceed normally if cascader is ready
|
|
375
379
|
if (this.cascaderIsReady) {
|
|
376
380
|
const validatedFilters = this.$refs.filtersRef.getHierarchicalValidatedFilters(filter);
|
|
377
|
-
const notFoundItems = validatedFilters.notFound
|
|
381
|
+
const notFoundItems = validatedFilters.notFound
|
|
382
|
+
? validatedFilters.notFound.filter(item => item.facet.toLowerCase() !== 'show all')
|
|
383
|
+
: [];
|
|
378
384
|
this.filter = validatedFilters.result;
|
|
379
385
|
|
|
380
386
|
// Show not found filter items warning message
|
|
@@ -401,7 +407,11 @@ export default {
|
|
|
401
407
|
});
|
|
402
408
|
|
|
403
409
|
if (notFoundItems.length) {
|
|
404
|
-
this.$emit('
|
|
410
|
+
this.$emit('search-changed', {
|
|
411
|
+
value: notFoundItems,
|
|
412
|
+
tabType: 'dataset',
|
|
413
|
+
type: 'reset-update',
|
|
414
|
+
})
|
|
405
415
|
}
|
|
406
416
|
|
|
407
417
|
//Facets provided but cannot find at least one valid
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<el-button
|
|
22
22
|
link
|
|
23
23
|
class="el-button-link"
|
|
24
|
-
@click="
|
|
24
|
+
@click="onResetClick"
|
|
25
25
|
size="large"
|
|
26
26
|
>
|
|
27
27
|
Reset
|
|
@@ -195,7 +195,9 @@ export default {
|
|
|
195
195
|
//Proceed normally if cascader is ready
|
|
196
196
|
if (this.cascaderIsReady) {
|
|
197
197
|
const validatedFilters = this.$refs.filtersRef.getHierarchicalValidatedFilters(filter);
|
|
198
|
-
const notFoundItems = validatedFilters.notFound
|
|
198
|
+
const notFoundItems = validatedFilters.notFound
|
|
199
|
+
? validatedFilters.notFound.filter(item => item.facet.toLowerCase() !== 'show all')
|
|
200
|
+
: [];
|
|
199
201
|
this.filter = validatedFilters.result;
|
|
200
202
|
|
|
201
203
|
// Show not found filter items warning message
|
|
@@ -238,14 +240,14 @@ export default {
|
|
|
238
240
|
if (this.cascaderIsReady) {
|
|
239
241
|
this.resetPageNavigation()
|
|
240
242
|
if (filter) {
|
|
241
|
-
if (this.$refs.filtersRef.
|
|
243
|
+
if (this.$refs.filtersRef.addFilters(filter))
|
|
242
244
|
this.$refs.filtersRef.initiateSearch()
|
|
243
245
|
}
|
|
244
246
|
} else {
|
|
245
247
|
if (Array.isArray(this.filter)) {
|
|
246
|
-
this.filter.push(filter)
|
|
248
|
+
this.filter.push(...filter)
|
|
247
249
|
} else {
|
|
248
|
-
this.filter = [filter]
|
|
250
|
+
this.filter = [...filter]
|
|
249
251
|
}
|
|
250
252
|
}
|
|
251
253
|
},
|
|
@@ -257,6 +259,14 @@ export default {
|
|
|
257
259
|
this.searchInput = '';
|
|
258
260
|
this.searchAndFilterUpdate();
|
|
259
261
|
},
|
|
262
|
+
onResetClick: function () {
|
|
263
|
+
this.openSearch([], '')
|
|
264
|
+
this.$emit('search-changed', {
|
|
265
|
+
value: this.searchInput,
|
|
266
|
+
tabType: 'dataset',
|
|
267
|
+
type: 'reset-update',
|
|
268
|
+
})
|
|
269
|
+
},
|
|
260
270
|
searchEvent: function (event = false) {
|
|
261
271
|
if (event.keyCode === 13 || event instanceof MouseEvent) {
|
|
262
272
|
this.searchInput = this.searchInput.trim();
|
|
@@ -290,7 +290,7 @@ export default {
|
|
|
290
290
|
createChildrenCascaderValue: function(children, facet, facets) {
|
|
291
291
|
if (children?.length) {
|
|
292
292
|
children.forEach((facetItem, i) => {
|
|
293
|
-
//copy the facets into
|
|
293
|
+
//copy the facets into
|
|
294
294
|
if (children[i].facetPropPath !== 'pennsieve.organization.name') {
|
|
295
295
|
children[i].label = convertReadableLabel(
|
|
296
296
|
facetItem.label
|
|
@@ -488,12 +488,12 @@ export default {
|
|
|
488
488
|
// term and facets will be the keys
|
|
489
489
|
// values will be either empty object or another object with next level's facet as key
|
|
490
490
|
if (term && this.correctnessCheck.term.has(term)) {
|
|
491
|
-
if (!(term in this.cascaderTags)) {
|
|
491
|
+
if (!(term in this.cascaderTags)) {
|
|
492
492
|
this.cascaderTags[term] = {}
|
|
493
493
|
this.cascaderTagsClone[term] = {}
|
|
494
494
|
}
|
|
495
495
|
if (facetLabel && this.correctnessCheck.facet.has(facetLabel)) {
|
|
496
|
-
if (!(facetLabel in this.cascaderTags[term])) {
|
|
496
|
+
if (!(facetLabel in this.cascaderTags[term])) {
|
|
497
497
|
this.cascaderTags[term][facetLabel] = {}
|
|
498
498
|
if (termId) {
|
|
499
499
|
this.cascaderTagsClone[term][termId + ':' + facetLabel] = {}
|
|
@@ -502,12 +502,12 @@ export default {
|
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
if (facet2 && this.correctnessCheck.facet2.has(facet2)) {
|
|
505
|
-
if (!(facet2 in this.cascaderTags[term][facetLabel])) {
|
|
505
|
+
if (!(facet2 in this.cascaderTags[term][facetLabel])) {
|
|
506
506
|
this.cascaderTags[term][facetLabel][facet2] = {}
|
|
507
507
|
this.cascaderTagsClone[term][facetLabel][facet2] = {}
|
|
508
508
|
}
|
|
509
509
|
if (facet3 && this.correctnessCheck.facet3.has(facet3)) {
|
|
510
|
-
if (!(facet3 in this.cascaderTags[term][facetLabel][facet2])) {
|
|
510
|
+
if (!(facet3 in this.cascaderTags[term][facetLabel][facet2])) {
|
|
511
511
|
this.cascaderTags[term][facetLabel][facet2][facet3] = {}
|
|
512
512
|
this.cascaderTagsClone[term][facetLabel][facet2][facet3] = {}
|
|
513
513
|
}
|
|
@@ -677,11 +677,12 @@ export default {
|
|
|
677
677
|
hString = cascadeEventItem[layers - 1]
|
|
678
678
|
} else {
|
|
679
679
|
hString = cascadeEventItem[layers - 2]
|
|
680
|
-
bString = cascadeEventItem[layers - 1]
|
|
681
680
|
}
|
|
682
681
|
} else {
|
|
683
682
|
hString = cascadeEventItem[1]
|
|
684
|
-
|
|
683
|
+
}
|
|
684
|
+
if (layers >= 3 && typeof cascadeEventItem[layers - 1] === "boolean") {
|
|
685
|
+
bString = cascadeEventItem[layers - 1]
|
|
685
686
|
}
|
|
686
687
|
return { hString, bString }
|
|
687
688
|
},
|
|
@@ -922,6 +923,15 @@ export default {
|
|
|
922
923
|
}
|
|
923
924
|
}
|
|
924
925
|
},
|
|
926
|
+
addFilters: function (filters) {
|
|
927
|
+
let filterHasChanged = false
|
|
928
|
+
if (this.cascaderIsReady) {
|
|
929
|
+
filters.forEach(filter => {
|
|
930
|
+
filterHasChanged = filterHasChanged || this.addFilter(filter)
|
|
931
|
+
})
|
|
932
|
+
}
|
|
933
|
+
return filterHasChanged
|
|
934
|
+
},
|
|
925
935
|
initiateSearch: function () {
|
|
926
936
|
this.cascadeEvent(this.cascadeSelectedWithBoolean)
|
|
927
937
|
},
|
|
@@ -991,8 +1001,11 @@ export default {
|
|
|
991
1001
|
facet,
|
|
992
1002
|
facetPropPath: filter.facetPropPath,
|
|
993
1003
|
...(facet2 && { facet2 }),
|
|
994
|
-
...(facet3 && { facet3 })
|
|
1004
|
+
...(facet3 && { facet3 }),
|
|
995
1005
|
};
|
|
1006
|
+
if ('AND' in filter) {
|
|
1007
|
+
fObject.AND = filter.AND
|
|
1008
|
+
}
|
|
996
1009
|
// all the child fact will be checked if parent is matched
|
|
997
1010
|
if (previousMatched || labelMatched) {
|
|
998
1011
|
if (isConnectivity) {
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
:showVisibilityFilter="showVisibilityFilter"
|
|
56
56
|
@search-changed="searchChanged(tab.id, $event)"
|
|
57
57
|
@hover-changed="hoverChanged(tab.id, $event)"
|
|
58
|
-
@connectivity-explorer-reset="onConnectivityExplorerReset"
|
|
59
58
|
@show-connectivity="showConnectivity"
|
|
60
59
|
@show-reference-connectivities="onShowReferenceConnectivities"
|
|
61
60
|
@connectivity-hovered="onConnectivityHovered"
|
|
@@ -230,12 +229,6 @@ export default {
|
|
|
230
229
|
this.activeAnnotationData = data;
|
|
231
230
|
}
|
|
232
231
|
},
|
|
233
|
-
/**
|
|
234
|
-
* This event is emitted after clicking reset button in connectivity explorer
|
|
235
|
-
*/
|
|
236
|
-
onConnectivityExplorerReset: function (payload) {
|
|
237
|
-
this.$emit('connectivity-explorer-reset', payload);
|
|
238
|
-
},
|
|
239
232
|
/**
|
|
240
233
|
* This event is emitted when the show connectivity button is clicked.
|
|
241
234
|
* @arg featureIds
|
|
@@ -320,14 +313,21 @@ export default {
|
|
|
320
313
|
* @public
|
|
321
314
|
*/
|
|
322
315
|
addFilter: function (filter) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
316
|
+
if (filter) {
|
|
317
|
+
this.drawerOpen = true
|
|
318
|
+
let filterToAdd = filter;
|
|
319
|
+
if (Array.isArray(filter)) {
|
|
320
|
+
filterToAdd.forEach(item => item.AND = true);
|
|
321
|
+
} else {
|
|
322
|
+
filter.AND = true // When we add a filter external, it is currently only with an AND boolean
|
|
323
|
+
filterToAdd = [filter]
|
|
324
|
+
}
|
|
325
|
+
// Because refs are in v-for, nextTick is needed here
|
|
326
|
+
this.$nextTick(() => {
|
|
327
|
+
const datasetExplorerTabRef = this.getTabRef(undefined, 'datasetExplorer', true);
|
|
328
|
+
datasetExplorerTabRef.addFilter(filterToAdd)
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
331
|
},
|
|
332
332
|
openNeuronSearch: function (neuron) {
|
|
333
333
|
this.drawerOpen = true
|