diff --git a/src/components/ProductFilterModal.vue b/src/components/ProductFilterModal.vue index 0ccf08d5..6f110f34 100644 --- a/src/components/ProductFilterModal.vue +++ b/src/components/ProductFilterModal.vue @@ -13,7 +13,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -88,7 +88,8 @@ export default defineComponent({ facetOptions: [] as any, isFilterChanged: false, isScrollable: true, - selectedValues: [] as Array + selectedValues: [] as Array, + isScrollingEnabled: false } }, computed: { @@ -100,6 +101,9 @@ export default defineComponent({ mounted() { this.selectedValues = JSON.parse(JSON.stringify(this.appliedFilters[this.type][this.searchfield])).list; }, + async ionViewWillEnter() { + this.isScrollingEnabled = false; + }, methods: { closeModal() { modalController.dismiss({ dismissed: true, isFilterChanged: this.isFilterChanged }); @@ -134,13 +138,28 @@ export default defineComponent({ this.isScrollable = false; } }, + enableScrolling() { + const parentElement = (this as any).$refs.contentRef.$el + const scrollEl = parentElement.shadowRoot.querySelector("main[part='scroll']") + let scrollHeight = scrollEl.scrollHeight, infiniteHeight = (this as any).$refs.infiniteScrollRef.$el.offsetHeight, scrollTop = scrollEl.scrollTop, threshold = 100, height = scrollEl.offsetHeight + const distanceFromInfinite = scrollHeight - infiniteHeight - scrollTop - threshold - height + if(distanceFromInfinite < 0) { + this.isScrollingEnabled = false; + } else { + this.isScrollingEnabled = true; + } + }, async loadMoreTags(event: any){ + // Added this check here as if added on infinite-scroll component the Loading content does not gets displayed + if(!(this.isScrollingEnabled && this.isScrollable)) { + await event.target.complete(); + } this.getTags( undefined, Math.ceil(this.facetOptions.length / process.env.VUE_APP_VIEW_SIZE).toString() - ).then(() => { - event.target.complete(); - }) + ).then(async () => { + await event.target.complete(); + }); }, updateSelectedValues(value: string) { this.selectedValues.includes(value) ? this.selectedValues.splice(this.selectedValues.indexOf(value), 1) : this.selectedValues.push(value); diff --git a/src/views/SelectProduct.vue b/src/views/SelectProduct.vue index 9089a218..7c6578d6 100644 --- a/src/views/SelectProduct.vue +++ b/src/views/SelectProduct.vue @@ -19,7 +19,7 @@ - +
- + + @@ -258,7 +267,8 @@ export default defineComponent({ isFilterChanged: false, isServiceScheduling: false, job: {} as any, - jobId: "" as any + jobId: "" as any, + isScrollingEnabled: false } }, methods: { @@ -332,13 +342,28 @@ export default defineComponent({ const viewIndex = vIndex ? vIndex : 0; this.store.dispatch("product/updateQuery", { viewSize, viewIndex, queryString: this.queryString }) }, + enableScrolling() { + const parentElement = (this as any).$refs.contentRef.$el + const scrollEl = parentElement.shadowRoot.querySelector("main[part='scroll']") + let scrollHeight = scrollEl.scrollHeight, infiniteHeight = (this as any).$refs.infiniteScrollRef.$el.offsetHeight, scrollTop = scrollEl.scrollTop, threshold = 100, height = scrollEl.offsetHeight + const distanceFromInfinite = scrollHeight - infiniteHeight - scrollTop - threshold - height + if(distanceFromInfinite < 0) { + this.isScrollingEnabled = false; + } else { + this.isScrollingEnabled = true; + } + }, async loadMoreProducts(event: any){ + // Added this check here as if added on infinite-scroll component the Loading content does not gets displayed + if(!(this.isScrollingEnabled && this.isScrollable)) { + await event.target.complete(); + } this.getProducts( undefined, Math.ceil(this.products.list.length / process.env.VUE_APP_VIEW_SIZE).toString() - ).then(() => { - event.target.complete(); - }) + ).then(async () => { + await event.target.complete(); + }); }, async updateThreshold() { this.isServiceScheduling = true; @@ -518,6 +543,7 @@ export default defineComponent({ emitter.off("productStoreChanged", this.getProducts); }, async ionViewWillEnter(){ + this.isScrollingEnabled = false; this.jobId = this.$route.query.id this.isFilterChanged = false; if (this.jobId) {