From 91b820ac70a9106431bfc270d6e99744b87866ca Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Fri, 28 Feb 2020 17:31:36 -0300 Subject: [PATCH] Adds infinite scroll to taxnomy filter taginput #335. Removes unecessary mixin from checkbox and taginput filters. --- .../filter-types/taxonomy/Checkbox.vue | 13 ++++- .../filter-types/taxonomy/Taginput.vue | 57 +++++++++++++++---- src/views/admin/js/filter-types-mixin.js | 2 +- 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/src/views/admin/components/filter-types/taxonomy/Checkbox.vue b/src/views/admin/components/filter-types/taxonomy/Checkbox.vue index c8119b3e6..b59485b21 100644 --- a/src/views/admin/components/filter-types/taxonomy/Checkbox.vue +++ b/src/views/admin/components/filter-types/taxonomy/Checkbox.vue @@ -50,19 +50,25 @@ import { tainacan as axios, CancelToken, isCancel } from '../../../js/axios'; import { mapGetters } from 'vuex'; import CheckboxRadioModal from '../../../components/modals/checkbox-radio-modal.vue'; - import { filterTypeMixin, dynamicFilterTypeMixin } from '../../../js/filter-types-mixin'; + import { filterTypeMixin } from '../../../js/filter-types-mixin'; export default { - mixins: [ filterTypeMixin, dynamicFilterTypeMixin ], + mixins: [ filterTypeMixin ], data(){ return { isLoadingOptions: true, + getOptionsValuesCancel: undefined, options: [], selected: [], taxonomy: '', taxonomyId: '' } }, + computed: { + facetsFromItemSearch() { + return this.getFacets(); + } + }, watch: { selected(newVal, oldVal) { const isEqual = (newVal.length == oldVal.length) && newVal.every((element, index) => { @@ -76,6 +82,9 @@ if (this.isUsingElasticSearch) this.loadOptions(); }, + isLoadingItems() { + this.isLoadingOptions = this.isLoadingItems; + }, 'query.metaquery'() { this.loadOptions(); }, diff --git a/src/views/admin/components/filter-types/taxonomy/Taginput.vue b/src/views/admin/components/filter-types/taxonomy/Taginput.vue index afbbec28c..01080413b 100644 --- a/src/views/admin/components/filter-types/taxonomy/Taginput.vue +++ b/src/views/admin/components/filter-types/taxonomy/Taginput.vue @@ -16,7 +16,9 @@ :class="{'has-selected': selected != undefined && selected != []}" @typing="search" @input="onSelect" - :placeholder="$i18n.get('info_type_to_add_terms')"> + :placeholder="$i18n.get('info_type_to_add_terms')" + check-infinite-scroll + @infinite-scroll="searchMore">