@sumaris-net/ngx-components 21.0.0-rc28 → 21.0.0-rc29
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.
|
@@ -28734,11 +28734,34 @@ class AppImageGallerySlideshowComponent {
|
|
|
28734
28734
|
}
|
|
28735
28735
|
return deleted;
|
|
28736
28736
|
}
|
|
28737
|
-
slideTo(
|
|
28737
|
+
async slideTo(index) {
|
|
28738
28738
|
const swiper = this.getSwiper();
|
|
28739
28739
|
if (!swiper)
|
|
28740
28740
|
return;
|
|
28741
|
-
|
|
28741
|
+
if (index >= this.rows.length) {
|
|
28742
|
+
// Try fetching a further page first, before falling back to
|
|
28743
|
+
if (this.canFetchMore && this.fetchMore.observed) {
|
|
28744
|
+
const rowCountBeforeFetch = this.rows.length;
|
|
28745
|
+
let fetched = false;
|
|
28746
|
+
try {
|
|
28747
|
+
fetched = await emitPromiseEvent(this.fetchMore, 'fetchMore');
|
|
28748
|
+
}
|
|
28749
|
+
catch (err) {
|
|
28750
|
+
if (err !== 'CANCELLED')
|
|
28751
|
+
throw err;
|
|
28752
|
+
}
|
|
28753
|
+
if (fetched && this.rows.length > rowCountBeforeFetch) {
|
|
28754
|
+
// The new <swiper-slide> elements come from the `rows` input re-rendering, which may not have
|
|
28755
|
+
// reached the DOM yet at this point: wait for Swiper to actually see the extra slide(s).
|
|
28756
|
+
await this._waitForSlideCount(swiper, rowCountBeforeFetch + 1);
|
|
28757
|
+
return this.slideTo(index); // Loop (allow to fetch a new page)
|
|
28758
|
+
}
|
|
28759
|
+
}
|
|
28760
|
+
console.error(`[image-gallery] Cannot slide to index ${index} (max=${this.rows.length - 1})`);
|
|
28761
|
+
return;
|
|
28762
|
+
}
|
|
28763
|
+
this._pendingSlideDirection = index > this._activeIndex ? 'next' : 'prev';
|
|
28764
|
+
await swiper.slideTo(index);
|
|
28742
28765
|
}
|
|
28743
28766
|
async slidePrev(swiperElement) {
|
|
28744
28767
|
const swiper = this.getSwiper(swiperElement);
|