diff --git a/src/components/ProductFilterModal.vue b/src/components/ProductFilterModal.vue index f5cada47..c37f077d 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,24 @@ 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){ 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 c79e5fd9..8b99a2f9 100644 --- a/src/views/SelectProduct.vue +++ b/src/views/SelectProduct.vue @@ -19,7 +19,7 @@ - +
- - + @@ -265,7 +267,8 @@ export default defineComponent({ isFilterChanged: false, isServiceScheduling: false, job: {} as any, - jobId: "" as any + jobId: "" as any, + isScrollingEnabled: false } }, methods: { @@ -339,13 +342,24 @@ 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){ 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; @@ -525,6 +539,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) {