import type { Injector } from '@angular/core';
import { AfterViewInit, ChangeDetectorRef, DoCheck, EmbeddedViewRef, EventEmitter, IterableChanges, IterableDiffers, NgZone, OnChanges, OnDestroy, SimpleChanges, TemplateRef, TrackByFunction, ViewContainerRef } from '@angular/core';
import { BaseDataSource, BaseDataSourceViewer, DataSourceLoader } from '@rxap/data-source';
import { IdOrInstanceOrToken } from '@rxap/definition';
import { Observable, Subscription } from 'rxjs';
import * as i0 from "@angular/core";
export declare class DataSourceCollectionTemplateContext<Data> {
    $implicit: Data;
    connection$: Observable<Data[]>;
    index: number;
    count: number;
    constructor($implicit: Data, connection$: Observable<Data[]>, index: number, count: number);
    get first(): boolean;
    get last(): boolean;
    get even(): boolean;
    get odd(): boolean;
}
export interface DataSourceCollectionErrorTemplateContext {
    $implicit: unknown | null;
    refresh: () => void;
}
export declare class DataSourceCollectionDirective<Data = any> implements OnChanges, OnDestroy, AfterViewInit, DoCheck {
    private readonly dataSourceLoader;
    private readonly template;
    private readonly viewContainerRef;
    private readonly injector;
    private readonly differs;
    private readonly cdr;
    private readonly zone;
    dataSourceOrIdOrToken: IdOrInstanceOrToken<BaseDataSource<Data[]>>;
    viewer: BaseDataSourceViewer;
    dataSource: BaseDataSource<Data[]> | null;
    emptyTemplate?: TemplateRef<void>;
    errorTemplate?: TemplateRef<DataSourceCollectionErrorTemplateContext>;
    loaded: EventEmitter<any>;
    error: EventEmitter<any>;
    connection$: Observable<Data[]> | null;
    protected readonly subscription: Subscription;
    protected embeddedErrorViewRef?: EmbeddedViewRef<DataSourceCollectionErrorTemplateContext>;
    private _differ;
    private _trackByFn;
    private _dirty;
    /**
     * Idecates that the data source returned a empty collection
     *
     * true - is empty
     * false - is NOT empty
     * null - unknown
     *
     * @private
     */
    private _empty;
    /**
     * Holds the empty template view ref.
     *
     * Is used to determine if a empty template is added to the
     * view. And used to destruct the empty template if the data source
     * changes from empty to not empty.
     *
     * @private
     */
    private _emptyTemplateViewRef;
    private _dataSourceLoadingSubscription;
    constructor(dataSourceLoader: DataSourceLoader, template: TemplateRef<DataSourceCollectionTemplateContext<Data>>, viewContainerRef: ViewContainerRef, injector: Injector, differs: IterableDiffers, cdr: ChangeDetectorRef, zone: NgZone);
    /**
     * A function that defines how to track changes for items in the iterable.
     *
     * When items are added, moved, or removed in the iterable,
     * the directive must re-render the appropriate DOM nodes.
     * To minimize churn in the DOM, only nodes that have changed
     * are re-rendered.
     *
     * By default, the change detector assumes that
     * the object instance identifies the node in the iterable.
     * When this function is supplied, the directive uses
     * the result of calling this function to identify the item node,
     * rather than the identity of the object itself.
     *
     * The function receives two inputs,
     * the iteration index and the node object ID.
     */
    set rxapDataSourceCollectionTrackBy(fn: TrackByFunction<Data>);
    get ngForTrackBy(): TrackByFunction<Data>;
    /**
     * Holds the data that should be displayed
     * @private
     */
    private _data;
    protected set data(data: Data[]);
    /**
     * Asserts the correct type of the context for the template that `NgForOf` will render.
     *
     * The presence of this method is a signal to the Ivy template type-check compiler that the
     * `NgForOf` structural directive renders its template with a specific context type.
     */
    static ngTemplateContextGuard<T>(dir: DataSourceCollectionDirective<T>, ctx: any): ctx is DataSourceCollectionTemplateContext<T>;
    ngOnChanges(changes: SimpleChanges): void;
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    /**
     * Applies the changes when needed.
     */
    ngDoCheck(): void;
    embedErrorTemplate(error: unknown | null): void;
    protected connect(): void;
    protected applyChanges(changes: IterableChanges<Data>): void;
    protected loadDataSource(): BaseDataSource<Data[]> | null;
    private perViewChange;
    static ɵfac: i0.ɵɵFactoryDeclaration<DataSourceCollectionDirective<any>, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<DataSourceCollectionDirective<any>, "[rxapDataSourceCollection]", never, { "dataSourceOrIdOrToken": { "alias": "rxapDataSourceCollectionFrom"; "required": true; }; "viewer": { "alias": "rxapDataSourceCollectionViewer"; "required": false; }; "emptyTemplate": { "alias": "rxapDataSourceCollectionEmpty"; "required": false; }; "errorTemplate": { "alias": "rxapDataSourceCollectionErrorTemplate"; "required": false; }; "rxapDataSourceCollectionTrackBy": { "alias": "rxapDataSourceCollectionTrackBy"; "required": false; }; }, { "loaded": "loaded"; "error": "error"; }, never, never, true, never>;
}
