@abi-software/map-side-bar 1.3.12 → 1.3.16
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 +116 -56
- 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 +116 -56
- 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 +2 -2
- package/src/algolia/algolia.js +2 -2
- package/src/components/ContextCard.vue +75 -21
- package/src/components/SearchFilters.vue +7 -7
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -107,7 +107,7 @@ export default {
|
|
|
107
107
|
console.log("action fired: ", val)
|
|
108
108
|
},
|
|
109
109
|
openSearch: function(){
|
|
110
|
-
this.$refs.sideBar.openSearch([], '
|
|
110
|
+
this.$refs.sideBar.openSearch([], 'http://purl.obolibrary.org/obo/UBERON_0001103')
|
|
111
111
|
},
|
|
112
112
|
singleFacets: function(){
|
|
113
113
|
this.$refs.sideBar.addFilter({facet: 'Heart', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name', AND: true})
|
|
@@ -119,7 +119,7 @@ export default {
|
|
|
119
119
|
this.$refs.sideBar.openSearch([{facet: 'Male', term:'Sex', facetPropPath:'attributes.subject.sex.value'}, {facet: 'Heart', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name'}], '')
|
|
120
120
|
},
|
|
121
121
|
keywordSearch: function(){
|
|
122
|
-
this.$refs.sideBar.
|
|
122
|
+
this.$refs.sideBar.addFilter({type: 'Facet', label: undefined, facet: '3d model', facetPropPath: 'item.keywords.keyword', term: 'Keywords', AND: true})
|
|
123
123
|
},
|
|
124
124
|
markerFromFlatmap: function(){
|
|
125
125
|
this.$refs.sideBar.openSearch([{facet: 'http://purl.obolibrary.org/obo/UBERON_0001103', term:'Keywords', facetPropPath:'item.keywords.keyword'}])
|
package/src/algolia/algolia.js
CHANGED
|
@@ -98,8 +98,8 @@ export class AlgoliaClient {
|
|
|
98
98
|
hits.forEach(hit => {
|
|
99
99
|
if (hit.item && hit.item.keywords) {
|
|
100
100
|
hit.item.keywords.forEach(keywordObj => {
|
|
101
|
-
let keyword = keywordObj.keyword
|
|
102
|
-
if (keyword.includes('UBERON') || keyword.includes('
|
|
101
|
+
let keyword = keywordObj.keyword.toUpperCase()
|
|
102
|
+
if (keyword.includes('UBERON') || keyword.includes('ILX')) {
|
|
103
103
|
foundKeyWords.push(this._processUberonURL(keyword))
|
|
104
104
|
}
|
|
105
105
|
})
|
|
@@ -11,28 +11,49 @@
|
|
|
11
11
|
<div class="title">{{contextData.heading}}</div>
|
|
12
12
|
<div v-html="contextData.description"/>
|
|
13
13
|
<br/>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
|
|
15
|
+
<!-- Show sampeles and views seperately if they do not match -->
|
|
16
|
+
<template v-if="!samplesUnderViews">
|
|
17
|
+
<div v-if="contextData.views && contextData.views.length > 0" class="subtitle">Scaffold Views</div>
|
|
18
|
+
<template v-for="(view, i) in contextData.views">
|
|
19
|
+
<div v-bind:key="i+'_1'" @click="openViewFile(view)" class="context-card-view">
|
|
20
|
+
<img class="view-image" :src="getFileFromPath(view.thumbnail)">
|
|
21
|
+
<div class="view-description">{{view.description}}</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div v-bind:key="i" class="padding"/>
|
|
24
|
+
</template>
|
|
25
|
+
<div style="margin-bottom: 16px;"/>
|
|
26
|
+
<div v-if="contextData.samples && contextData.samples.length > 0" class="subtitle">Samples on Scaffold</div>
|
|
27
|
+
<template v-for="(sample, i) in contextData.samples">
|
|
28
|
+
<span v-bind:key="i+'_3'" class="context-card-item cursor-pointer" @click="toggleSampleDetails(i)">
|
|
29
|
+
<div v-bind:key="i+'_6'" style="display: flex">
|
|
30
|
+
<div v-if="sample.color" class="color-box" :style="'background-color:'+ sample.color"></div>
|
|
31
|
+
<img class="key-image" v-else-if="sample.thumbnail" :src="getFileFromPath(sample.thumbnail)">
|
|
32
|
+
{{sample.heading}}
|
|
33
|
+
<i class="el-icon-warning-outline info"></i>
|
|
34
|
+
</div>
|
|
35
|
+
</span>
|
|
36
|
+
<div v-bind:key="i+'_4'" v-if="sampleDetails[i]" v-html="sample.description"/>
|
|
37
|
+
<a v-bind:key="i+'_5'" v-if="sampleDetails[i]" :href="generateFileLink(sample.path)" target="_blank">View Source</a>
|
|
38
|
+
<div v-bind:key="i+'_2'" class="padding"/>
|
|
39
|
+
</template>
|
|
21
40
|
</template>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<template v-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<i class="el-icon-warning-outline info"></i>
|
|
31
|
-
</div>
|
|
41
|
+
|
|
42
|
+
<!-- Show samples under views if the ids match -->
|
|
43
|
+
<template v-else>
|
|
44
|
+
<div v-if="contextData.views && contextData.views.length > 0" class="subtitle">Scaffold Views</div>
|
|
45
|
+
<template v-for="(view, i) in contextData.views">
|
|
46
|
+
<span :key="i+'_1'" @click="viewClicked(view, i)" class="context-card-view">
|
|
47
|
+
<img class="view-image" :src="getFileFromPath(view.thumbnail)"/>
|
|
48
|
+
<div class="view-description">{{view.description}}<i class="el-icon-warning-outline info"></i> </div>
|
|
32
49
|
</span>
|
|
33
|
-
<div v-
|
|
34
|
-
<a v-bind:key="i+'_5'" v-if="sampleDetails[i]" :href="generateFileLink(
|
|
35
|
-
<div
|
|
50
|
+
<div v-if="sampleDetails[i]" v-html="samplesMatching(view.id).description" :key="i+'_2'"/>
|
|
51
|
+
<a v-bind:key="i+'_5'" v-if="sampleDetails[i]" :href="generateFileLink(samplesMatching(view.id).path)" target="_blank">View Source</a>
|
|
52
|
+
<div :key="i" class="padding"/>
|
|
53
|
+
|
|
54
|
+
<!-- Extra padding if sample details is open -->
|
|
55
|
+
<div :key="i+'_6'" v-if="sampleDetails[i]" class="padding"/>
|
|
56
|
+
</template>
|
|
36
57
|
</template>
|
|
37
58
|
</div>
|
|
38
59
|
</el-card>
|
|
@@ -95,7 +116,39 @@ export default {
|
|
|
95
116
|
immediate: true
|
|
96
117
|
}
|
|
97
118
|
},
|
|
119
|
+
computed: {
|
|
120
|
+
samplesUnderViews: function(){
|
|
121
|
+
if (this.contextData){
|
|
122
|
+
if (this.contextData.samplesUnderViews){
|
|
123
|
+
return true
|
|
124
|
+
} else {
|
|
125
|
+
let viewId = this.contextData.views.map(v=>v.id)
|
|
126
|
+
let samplesView = this.contextData.samples.map(s=>s.view)
|
|
127
|
+
|
|
128
|
+
// get matching values
|
|
129
|
+
let matching = viewId.filter(v=>samplesView.includes(v))
|
|
130
|
+
|
|
131
|
+
// check all arrays have the same length (which means all values are in all three)
|
|
132
|
+
if ( viewId.length === matching.length && matching.length === samplesView.length){
|
|
133
|
+
return true
|
|
134
|
+
}
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else return false
|
|
139
|
+
},
|
|
140
|
+
},
|
|
98
141
|
methods: {
|
|
142
|
+
samplesMatching: function(viewId){
|
|
143
|
+
if (this.contextData && this.contextData.samples){
|
|
144
|
+
return this.contextData.samples.filter(s=>s.view == viewId)[0]
|
|
145
|
+
}
|
|
146
|
+
else return []
|
|
147
|
+
},
|
|
148
|
+
viewClicked: function(view, i){
|
|
149
|
+
this.openViewFile(view)
|
|
150
|
+
this.toggleSampleDetails(i)
|
|
151
|
+
},
|
|
99
152
|
getContextFile: function (contextFileUrl) {
|
|
100
153
|
this.loading = true
|
|
101
154
|
fetch(contextFileUrl)
|
|
@@ -183,9 +236,10 @@ export default {
|
|
|
183
236
|
}
|
|
184
237
|
|
|
185
238
|
.view-image {
|
|
186
|
-
width:
|
|
239
|
+
width: 34px;
|
|
187
240
|
height: auto;
|
|
188
241
|
flex: 1;
|
|
242
|
+
margin-right: 4px;
|
|
189
243
|
}
|
|
190
244
|
|
|
191
245
|
.view-descriptions {
|
|
@@ -72,7 +72,7 @@ import speciesMap from "./species-map";
|
|
|
72
72
|
import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
|
|
73
73
|
|
|
74
74
|
import {AlgoliaClient} from "../algolia/algolia.js";
|
|
75
|
-
import {
|
|
75
|
+
import {facetPropPathMapping} from "../algolia/utils.js";
|
|
76
76
|
|
|
77
77
|
locale.use(lang);
|
|
78
78
|
Vue.use(Option);
|
|
@@ -144,13 +144,13 @@ export default {
|
|
|
144
144
|
},
|
|
145
145
|
methods: {
|
|
146
146
|
createCascaderItemValue: function (term, facet) {
|
|
147
|
-
if (facet) return term + "
|
|
147
|
+
if (facet) return term + ">" + facet;
|
|
148
148
|
else return term;
|
|
149
149
|
},
|
|
150
150
|
populateCascader: function () {
|
|
151
151
|
return new Promise((resolve) => {
|
|
152
152
|
// Algolia facet serach
|
|
153
|
-
this.algoliaClient.getAlgoliaFacets(
|
|
153
|
+
this.algoliaClient.getAlgoliaFacets(facetPropPathMapping)
|
|
154
154
|
.then((data) => {
|
|
155
155
|
this.facets = data;
|
|
156
156
|
this.options = data;
|
|
@@ -201,8 +201,8 @@ export default {
|
|
|
201
201
|
// Create results for the filter update
|
|
202
202
|
let filterKeys = event.filter( selection => selection !== undefined).map( fs => ({
|
|
203
203
|
facetPropPath: fs[0],
|
|
204
|
-
facet: fs[1].split("
|
|
205
|
-
term: fs[1].split("
|
|
204
|
+
facet: fs[1].split(">")[1],
|
|
205
|
+
term: fs[1].split(">")[0],
|
|
206
206
|
AND: fs[2] // for setting the boolean
|
|
207
207
|
}))
|
|
208
208
|
|
|
@@ -211,8 +211,8 @@ export default {
|
|
|
211
211
|
let propPath = fs[0].includes('duplicate') ? fs[0].split('duplicate')[0] : fs[0]
|
|
212
212
|
return {
|
|
213
213
|
facetPropPath: propPath,
|
|
214
|
-
facet: fs[1].split("
|
|
215
|
-
term: fs[1].split("
|
|
214
|
+
facet: fs[1].split(">")[1],
|
|
215
|
+
term: fs[1].split(">")[0],
|
|
216
216
|
AND: fs[2] // for setting the boolean
|
|
217
217
|
}
|
|
218
218
|
})
|