@abi-software/map-side-bar 1.1.17-beta.1 → 1.1.18-fixes-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/LICENSE +201 -201
- package/README.md +53 -53
- package/babel.config.js +14 -14
- package/dist/map-side-bar.common.js +233 -221
- 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 +233 -221
- 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-lock.json +13548 -13548
- package/package.json +64 -64
- package/public/index.html +17 -17
- package/src/App.vue +130 -130
- package/src/algolia/algolia.js +99 -99
- package/src/algolia/utils.js +51 -51
- package/src/components/Cascader.vue +49 -49
- package/src/components/ContextCard.vue +237 -236
- package/src/components/DatasetCard.vue +394 -393
- package/src/components/EventBus.js +3 -3
- package/src/components/SearchFilters.vue +557 -557
- package/src/components/SideBar.vue +239 -239
- package/src/components/SidebarContent.vue +443 -443
- package/src/components/Tabs.vue +78 -78
- package/src/components/hardcoded-context-info.js +80 -76
- package/src/components/index.js +8 -8
- package/src/components/scaffold-meta-map.js +29 -29
- package/src/components/species-map.js +8 -8
- package/src/main.js +8 -8
- package/static.json +6 -6
- package/vue.config.js +11 -11
- package/scaffold_context_info.json +0 -28
package/src/algolia/utils.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
/* eslint-disable no-alert, no-console */
|
|
2
|
-
|
|
3
|
-
// Mapping between display categories and their Algolia index property path
|
|
4
|
-
// Used for populating the Dataset Search Results facet menu dynamically
|
|
5
|
-
export const facetPropPathMapping = {
|
|
6
|
-
'anatomy.organ.name' : 'Anatomical Structure',
|
|
7
|
-
'organisms.primary.species.name' : 'Species',
|
|
8
|
-
'item.modalities.keyword' : 'Experimental Approach',
|
|
9
|
-
'attributes.subject.sex.value' : 'Sex',
|
|
10
|
-
'attributes.subject.ageCategory.value' : 'Age Categories',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/* Returns filter for searching algolia. All facets of the same category are joined with OR,
|
|
14
|
-
* and each of those results is then joined with an AND.
|
|
15
|
-
* i.e. (color:blue OR color:red) AND (shape:circle OR shape:red) */
|
|
16
|
-
export function getFilters(selectedFacetArray=undefined) {
|
|
17
|
-
|
|
18
|
-
// return all datasets if no filter
|
|
19
|
-
if (selectedFacetArray === undefined) {
|
|
20
|
-
return 'NOT item.published.status:embargo'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Switch the 'term' attribute to 'label' if 'label' does not exist
|
|
24
|
-
selectedFacetArray.forEach(f=>f.label=f.facet)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
let facets = removeShowAllFacets(selectedFacetArray)
|
|
28
|
-
|
|
29
|
-
let filters = "NOT item.published.status:embargo";
|
|
30
|
-
filters = `(${filters}) AND `;
|
|
31
|
-
|
|
32
|
-
const facetPropPaths = Object.keys(facetPropPathMapping);
|
|
33
|
-
facetPropPaths.map((facetPropPath) => {
|
|
34
|
-
const facetsToOr = facets.filter(
|
|
35
|
-
(facet) => facet.facetPropPath == facetPropPath
|
|
36
|
-
);
|
|
37
|
-
var filter = "";
|
|
38
|
-
facetsToOr.map((facet) => {
|
|
39
|
-
filter += `"${facetPropPath}":"${facet.label}" OR `;
|
|
40
|
-
});
|
|
41
|
-
if (filter == "") {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
filter = `(${filter.substring(0, filter.lastIndexOf(" OR "))})`;
|
|
45
|
-
filters += `${filter} AND `;
|
|
46
|
-
});
|
|
47
|
-
return filters.substring(0, filters.lastIndexOf(" AND "));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function removeShowAllFacets(facetArray){
|
|
51
|
-
return facetArray.filter( f => f.label !== 'Show all')
|
|
1
|
+
/* eslint-disable no-alert, no-console */
|
|
2
|
+
|
|
3
|
+
// Mapping between display categories and their Algolia index property path
|
|
4
|
+
// Used for populating the Dataset Search Results facet menu dynamically
|
|
5
|
+
export const facetPropPathMapping = {
|
|
6
|
+
'anatomy.organ.name' : 'Anatomical Structure',
|
|
7
|
+
'organisms.primary.species.name' : 'Species',
|
|
8
|
+
'item.modalities.keyword' : 'Experimental Approach',
|
|
9
|
+
'attributes.subject.sex.value' : 'Sex',
|
|
10
|
+
'attributes.subject.ageCategory.value' : 'Age Categories',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Returns filter for searching algolia. All facets of the same category are joined with OR,
|
|
14
|
+
* and each of those results is then joined with an AND.
|
|
15
|
+
* i.e. (color:blue OR color:red) AND (shape:circle OR shape:red) */
|
|
16
|
+
export function getFilters(selectedFacetArray=undefined) {
|
|
17
|
+
|
|
18
|
+
// return all datasets if no filter
|
|
19
|
+
if (selectedFacetArray === undefined) {
|
|
20
|
+
return 'NOT item.published.status:embargo'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Switch the 'term' attribute to 'label' if 'label' does not exist
|
|
24
|
+
selectedFacetArray.forEach(f=>f.label=f.facet)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
let facets = removeShowAllFacets(selectedFacetArray)
|
|
28
|
+
|
|
29
|
+
let filters = "NOT item.published.status:embargo";
|
|
30
|
+
filters = `(${filters}) AND `;
|
|
31
|
+
|
|
32
|
+
const facetPropPaths = Object.keys(facetPropPathMapping);
|
|
33
|
+
facetPropPaths.map((facetPropPath) => {
|
|
34
|
+
const facetsToOr = facets.filter(
|
|
35
|
+
(facet) => facet.facetPropPath == facetPropPath
|
|
36
|
+
);
|
|
37
|
+
var filter = "";
|
|
38
|
+
facetsToOr.map((facet) => {
|
|
39
|
+
filter += `"${facetPropPath}":"${facet.label}" OR `;
|
|
40
|
+
});
|
|
41
|
+
if (filter == "") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
filter = `(${filter.substring(0, filter.lastIndexOf(" OR "))})`;
|
|
45
|
+
filters += `${filter} AND `;
|
|
46
|
+
});
|
|
47
|
+
return filters.substring(0, filters.lastIndexOf(" AND "));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function removeShowAllFacets(facetArray){
|
|
51
|
+
return facetArray.filter( f => f.label !== 'Show all')
|
|
52
52
|
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/* eslint-disable no-alert, no-console */
|
|
3
|
-
import { Cascader } from "element-ui";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'CustomCascader',
|
|
7
|
-
extends: Cascader,
|
|
8
|
-
methods:{
|
|
9
|
-
//Modify this internal function to disable Show all tags
|
|
10
|
-
computePresentTags() {
|
|
11
|
-
const { isDisabled, leafOnly, showAllLevels, separator, collapseTags } = this;
|
|
12
|
-
const checkedNodes = this.getCheckedNodes(leafOnly);
|
|
13
|
-
const tags = [];
|
|
14
|
-
const genTag = node => ({
|
|
15
|
-
node,
|
|
16
|
-
key: node.uid,
|
|
17
|
-
text: node.getText(showAllLevels, separator),
|
|
18
|
-
hitState: false,
|
|
19
|
-
closable: !isDisabled && !node.isDisabled
|
|
20
|
-
});
|
|
21
|
-
let customNodes = checkedNodes.filter(node =>
|
|
22
|
-
{
|
|
23
|
-
return !(node.getText(showAllLevels, separator).includes("Show all"));
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
if (customNodes.length) {
|
|
27
|
-
const [first, ...rest] = customNodes;
|
|
28
|
-
const restCount = rest.length;
|
|
29
|
-
tags.push(genTag(first));
|
|
30
|
-
if (restCount) {
|
|
31
|
-
if (collapseTags) {
|
|
32
|
-
tags.push({
|
|
33
|
-
key: -1,
|
|
34
|
-
text: `+ ${restCount}`,
|
|
35
|
-
closable: false
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
rest.forEach(node => tags.push(genTag(node)));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
this.checkedNodes = checkedNodes;
|
|
43
|
-
this.presentTags = tags;
|
|
44
|
-
this.$emit("tags-changed", this.presentTags);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
</script>
|
|
1
|
+
<script>
|
|
2
|
+
/* eslint-disable no-alert, no-console */
|
|
3
|
+
import { Cascader } from "element-ui";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'CustomCascader',
|
|
7
|
+
extends: Cascader,
|
|
8
|
+
methods:{
|
|
9
|
+
//Modify this internal function to disable Show all tags
|
|
10
|
+
computePresentTags() {
|
|
11
|
+
const { isDisabled, leafOnly, showAllLevels, separator, collapseTags } = this;
|
|
12
|
+
const checkedNodes = this.getCheckedNodes(leafOnly);
|
|
13
|
+
const tags = [];
|
|
14
|
+
const genTag = node => ({
|
|
15
|
+
node,
|
|
16
|
+
key: node.uid,
|
|
17
|
+
text: node.getText(showAllLevels, separator),
|
|
18
|
+
hitState: false,
|
|
19
|
+
closable: !isDisabled && !node.isDisabled
|
|
20
|
+
});
|
|
21
|
+
let customNodes = checkedNodes.filter(node =>
|
|
22
|
+
{
|
|
23
|
+
return !(node.getText(showAllLevels, separator).includes("Show all"));
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
if (customNodes.length) {
|
|
27
|
+
const [first, ...rest] = customNodes;
|
|
28
|
+
const restCount = rest.length;
|
|
29
|
+
tags.push(genTag(first));
|
|
30
|
+
if (restCount) {
|
|
31
|
+
if (collapseTags) {
|
|
32
|
+
tags.push({
|
|
33
|
+
key: -1,
|
|
34
|
+
text: `+ ${restCount}`,
|
|
35
|
+
closable: false
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
rest.forEach(node => tags.push(genTag(node)));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
this.checkedNodes = checkedNodes;
|
|
43
|
+
this.presentTags = tags;
|
|
44
|
+
this.$emit("tags-changed", this.presentTags);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
</script>
|