import * as i0 from '@angular/core';
import { inject, ElementRef, EventEmitter, Directive, Output, HostListener, NgModule } from '@angular/core';

/**
 * @description Diretiva de scroll infinito que detecta quando o usuário chega
 * ao final do elemento e emite o evento `scrolled`. Deve ser aplicada a um
 * elemento com overflow e scroll habilitado.
 *
 * @example
 * ```html
 * <div sInfiniteScroll (scrolled)="carregarMais()" style="overflow-y: auto; height: 400px">
 *   <!-- itens -->
 * </div>
 * ```
 *
 * @category Data
 */
class InfiniteScrollDirective {
    el = inject(ElementRef);
    /** @description Emitido quando o usuário atinge o final do elemento com scroll. */
    scrolled = new EventEmitter();
    scroll() {
        if (this.el.nativeElement.scrollTop >
            this.el.nativeElement.scrollHeight - this.el.nativeElement.offsetHeight - 2) {
            this.scrolled.emit();
        }
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InfiniteScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
    static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: InfiniteScrollDirective, isStandalone: true, selector: "[sInfiniteScroll]", outputs: { scrolled: "scrolled" }, host: { listeners: { "scroll": "scroll()" } }, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InfiniteScrollDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[sInfiniteScroll]',
                    standalone: true,
                }]
        }], propDecorators: { scrolled: [{
                type: Output
            }], scroll: [{
                type: HostListener,
                args: ['scroll']
            }] } });

class InfiniteScrollModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InfiniteScrollModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: InfiniteScrollModule, imports: [InfiniteScrollDirective], exports: [InfiniteScrollDirective] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InfiniteScrollModule });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InfiniteScrollModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [InfiniteScrollDirective],
                    exports: [InfiniteScrollDirective],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { InfiniteScrollDirective, InfiniteScrollModule };
//# sourceMappingURL=seniorsistemas-angular-components-infinite-scroll.mjs.map
