2019-10-03 16:54:05 +00:00
|
|
|
import { Component, Vue, Prop, Provide } from 'vue-property-decorator';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class FacetList extends Vue {
|
|
|
|
|
|
|
|
ITEMS_PER_FILTER = 5;
|
|
|
|
bar = 'bar';
|
2019-10-04 17:00:31 +00:00
|
|
|
// filterItems = [];
|
2019-10-03 16:54:05 +00:00
|
|
|
|
|
|
|
@Prop()
|
|
|
|
data;
|
2019-10-04 17:00:31 +00:00
|
|
|
@Prop()
|
|
|
|
filterName;
|
2019-10-03 16:54:05 +00:00
|
|
|
|
|
|
|
get myLanguageFilters() {
|
2019-10-04 17:00:31 +00:00
|
|
|
// console.log(this.filterName);
|
|
|
|
// console.log(this.data);
|
|
|
|
var facetValues = this.data.map((facet, i) => {
|
2019-10-03 16:54:05 +00:00
|
|
|
if (i % 2 === 0) {
|
|
|
|
// var rObj = {};
|
|
|
|
// rObj['value'] = facet;
|
|
|
|
// rObj['count'] = solrArray[i +1];
|
2019-10-04 17:00:31 +00:00
|
|
|
var rObj = { value: facet, count: this.data[i + 1] };
|
2019-10-03 16:54:05 +00:00
|
|
|
return rObj;
|
|
|
|
}
|
|
|
|
}).filter(function (el) {
|
|
|
|
return el != null && el.count > 0;
|
|
|
|
});
|
|
|
|
// var facetValues = this.data.language.filter(function(facet, i) {
|
|
|
|
// return i % 2 === 0;
|
|
|
|
// }).map(function (facet, i) {
|
|
|
|
// var rObj = { value: facet, count: this.data.language[i + 1] };
|
|
|
|
// return rObj;
|
|
|
|
// }, this);
|
|
|
|
return facetValues;
|
|
|
|
};
|
|
|
|
|
|
|
|
get facets() {
|
|
|
|
return this.data;
|
|
|
|
};
|
2019-10-04 17:00:31 +00:00
|
|
|
get filterItems() {
|
|
|
|
var facetValues = this.data.map((facet, i) => {
|
2019-10-03 16:54:05 +00:00
|
|
|
if (i % 2 === 0) {
|
|
|
|
// var rObj = {};
|
|
|
|
// rObj['value'] = facet;
|
|
|
|
// rObj['count'] = solrArray[i +1];
|
2019-10-04 17:00:31 +00:00
|
|
|
var rObj = { value: facet, count: this.data[i + 1] };
|
2019-10-03 16:54:05 +00:00
|
|
|
return rObj;
|
|
|
|
}
|
2019-10-04 17:00:31 +00:00
|
|
|
}).filter(function (el) {
|
|
|
|
return el != null && el.count > 0;
|
2019-10-03 16:54:05 +00:00
|
|
|
});
|
2019-10-04 17:00:31 +00:00
|
|
|
// var facetValues = this.data.language.filter(function(facet, i) {
|
|
|
|
// return i % 2 === 0;
|
|
|
|
// }).map(function (facet, i) {
|
|
|
|
// var rObj = { value: facet, count: this.data.language[i + 1] };
|
|
|
|
// return rObj;
|
|
|
|
// }, this);
|
2019-10-03 16:54:05 +00:00
|
|
|
return facetValues;
|
2019-10-04 17:00:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
};
|
2019-10-03 16:54:05 +00:00
|
|
|
}
|