chore(): sync feature-6.1 with main

This commit is contained in:
Liam DeBeasi
2022-04-04 15:27:16 -04:00
940 changed files with 79771 additions and 96056 deletions

View File

@ -1,14 +1,14 @@
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h, readTask, writeTask } from '@stencil/core';
import type { ComponentInterface, EventEmitter } from '@stencil/core';
import { Component, Element, Event, Host, Method, Prop, State, Watch, h, readTask, writeTask } from '@stencil/core';
import { findClosestIonContent, getScrollElement, printIonContentErrorMsg } from '@utils/content';
import { getIonMode } from '../../global/ionic-global';
@Component({
tag: 'ion-infinite-scroll',
styleUrl: 'infinite-scroll.scss'
styleUrl: 'infinite-scroll.scss',
})
export class InfiniteScroll implements ComponentInterface {
private thrPx = 0;
private thrPc = 0;
private scrollEl?: HTMLElement;
@ -34,8 +34,7 @@ export class InfiniteScroll implements ComponentInterface {
const val = this.threshold;
if (val.lastIndexOf('%') > -1) {
this.thrPx = 0;
this.thrPc = (parseFloat(val) / 100);
this.thrPc = parseFloat(val) / 100;
} else {
this.thrPx = parseFloat(val);
this.thrPc = 0;
@ -114,11 +113,12 @@ export class InfiniteScroll implements ComponentInterface {
const scrollTop = scrollEl.scrollTop;
const scrollHeight = scrollEl.scrollHeight;
const height = scrollEl.offsetHeight;
const threshold = this.thrPc !== 0 ? (height * this.thrPc) : this.thrPx;
const threshold = this.thrPc !== 0 ? height * this.thrPc : this.thrPx;
const distanceFromInfinite = (this.position === 'bottom')
? scrollHeight - infiniteHeight - scrollTop - threshold - height
: scrollTop - infiniteHeight - threshold;
const distanceFromInfinite =
this.position === 'bottom'
? scrollHeight - infiniteHeight - scrollTop - threshold - height
: scrollTop - infiniteHeight - threshold;
if (distanceFromInfinite < 0) {
if (!this.didFire) {
@ -132,7 +132,7 @@ export class InfiniteScroll implements ComponentInterface {
}
return 4;
}
};
/**
* Call `complete()` within the `ionInfinite` output event handler when
@ -198,12 +198,7 @@ export class InfiniteScroll implements ComponentInterface {
}
private canStart(): boolean {
return (
!this.disabled &&
!this.isBusy &&
!!this.scrollEl &&
!this.isLoading
);
return !this.disabled && !this.isBusy && !!this.scrollEl && !this.isLoading;
}
private enableScrollEvents(shouldListen: boolean) {
@ -224,7 +219,7 @@ export class InfiniteScroll implements ComponentInterface {
class={{
[mode]: true,
'infinite-scroll-loading': this.isLoading,
'infinite-scroll-enabled': !disabled
'infinite-scroll-enabled': !disabled,
}}
/>
);