import * as rxjs from 'rxjs'; import { Observable, BehaviorSubject } from 'rxjs'; import { FormControl } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; import * as i0 from '@angular/core'; import { TemplateRef, OnInit, OnDestroy, ChangeDetectorRef, InjectionToken, EnvironmentProviders } from '@angular/core'; declare abstract class CollectionProvider { protected cachedRequestParams: Record | null; abstract transform(request: CollectionRequest, context: CollectionContext): Observable>; protected validateParams(request: Record, _context: CollectionContext): Record; protected formatArrayToCollectionData(items: T[]): CollectionData; protected deepCompare(value1: unknown, value2: unknown): boolean; } declare const enum CollectionState { Initial = "initial", Error = "error", Empty = "empty", Data = "data" } declare class Collection { private readonly _provider; readonly _initialValues: Partial; readonly queryControl: FormControl; readonly queryFieldsControl: FormControl; readonly pageNumberControl: FormControl; readonly pageSizeControl: FormControl; readonly sortControl: FormControl; readonly data$: Observable<{ response?: CollectionData; request?: CollectionRequest; error?: Error; state: CollectionState; loading: boolean; initial: boolean; }>; readonly raw$: BehaviorSubject>; readonly loading$: BehaviorSubject; private _formatter; private _refresh$; constructor(_provider: CollectionProvider, _initialValues?: Partial); refresh(): void; setFormatter(callback: (items: T[]) => T[] | Observable): this; private getData; private formatResponse; private getState; private cacheCollectionData; private get request(); private getQueryObservable; } interface CollectionRequest { pageNumber: number; pageSize: number; query: string | null; queryFields: string[]; sort: CollectionRequestSort | CollectionRequestSort[]; } interface CollectionRequestSort { name: T; direction: 'asc' | 'desc'; } interface CollectionData { pageNumber: number; pageSize: number; totalPages: number; totalEntries: number; data: T[]; raw?: any; } interface CollectionApiResponse { page_number: number; page_size: number; total_pages: number; total_entries: number; data: T[]; [key: string]: unknown; } type CollectionApiParams = string | number | boolean | ReadonlyArray; interface CollectionContext { collection: Collection; } type ArrayCollectionStringKeys = { [K in keyof T]: T[K] extends string ? K : never; }[keyof T]; interface ArrayCollectionOptions { sortables?: Partial, 'string' | 'number'>>; } declare class ApiCollectionProvider extends CollectionProvider { protected readonly endpoint: string | Observable; protected readonly httpClient: HttpClient; protected extraParams: Record>; protected extraObjectParams: Observable>[]; constructor(endpoint: string | Observable, httpClient: HttpClient); append(name: string, value: CollectionApiParams | Observable): this; appendObject(value: Record | Observable>): void; transform(request: CollectionRequest, context: CollectionContext): Observable>; protected validateParams(request: Record, context: CollectionContext): Record; protected getExtraParams(params: Record>): Observable<{}>; protected getExtraObjectParams(params$: Observable>[]): Observable<{}>; protected formatToCollectionData(response: CollectionApiResponse | T[]): CollectionData; protected getBackendFormat(request: CollectionRequest): {}; } declare class LocalCollectionProvider extends CollectionProvider { private _options?; private _items$; constructor(items: T[], _options?: ArrayCollectionOptions); update(value: T[]): void; transform(request: CollectionRequest): rxjs.Observable<{ totalPages: number; totalEntries: number; pageSize: number; pageNumber: number; data: T[]; }>; } declare class BbCollectionsDataContext { items: T[]; loading: boolean; constructor(items: T[], loading: boolean); } declare class BbCollectionsData { template: TemplateRef>; constructor(template: TemplateRef>); static ngTemplateContextGuard(dir: BbCollectionsData, ctx: unknown): ctx is BbCollectionsDataContext; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[bbCollectionsData]", never, {}, {}, never, never, true, never>; } declare class BbCollectionsDataRowContext { item: T; $implicit: T; constructor(item: T); } declare class BbCollectionsDataRow { template: TemplateRef>; constructor(template: TemplateRef>); static ngTemplateContextGuard(dir: BbCollectionsDataRow, ctx: unknown): ctx is BbCollectionsDataRowContext; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[bbCollectionsDataRow]", never, {}, {}, never, never, true, never>; } declare class BbCollectionsEmptyContext { query: string; loading: boolean; constructor(query: string, loading: boolean); } declare class BbCollectionsEmpty { template: TemplateRef>; constructor(template: TemplateRef>); static ngTemplateContextGuard(dir: BbCollectionsEmpty, ctx: unknown): ctx is BbCollectionsEmptyContext; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[bbCollectionsEmpty]", never, {}, {}, never, never, true, never>; } declare class BbCollectionsErrorContext { error: Error; loading: boolean; constructor(error: Error, loading: boolean); } declare class BbCollectionsError { template: TemplateRef>; constructor(template: TemplateRef>); static ngTemplateContextGuard(dir: BbCollectionsError, ctx: unknown): ctx is BbCollectionsErrorContext; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[bbCollectionsError]", never, {}, {}, never, never, true, never>; } declare class BbCollectionsInitialContext { } declare class BbCollectionsInitial { template: TemplateRef>; constructor(template: TemplateRef>); static ngTemplateContextGuard(dir: BbCollectionsInitial, ctx: unknown): ctx is BbCollectionsInitialContext; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[bbCollectionsInitial]", never, {}, {}, never, never, true, never>; } declare class BbCollectionsItemContext { item: T; $implicit: T; constructor(item: T); } declare class BbCollectionsItem { template: TemplateRef>; constructor(template: TemplateRef>); static ngTemplateContextGuard(dir: BbCollectionsItem, ctx: unknown): ctx is BbCollectionsItemContext; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "ng-template[bbCollectionsItem]", never, {}, {}, never, never, true, never>; } declare class BbCollectionsViewer { dataTemplate?: TemplateRef>; emptyTemplate?: TemplateRef>; errorTemplate?: TemplateRef>; initialTemplate?: TemplateRef>; collection: Collection | null; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "[bb-collections-viewer]", never, { "collection": { "alias": "collection"; "required": false; }; }, {}, ["dataTemplate", "emptyTemplate", "errorTemplate", "initialTemplate"], never, true, never>; } declare class BbCollectionsPager implements OnInit, OnDestroy { private readonly _config?; readonly arrowPreviousIconName: string; readonly arrowNextIconName: string; set maxAmountOfButtons(value: number); get maxAmountOfButtons(): number; set collection(collection: Collection | null); get collection(): Collection | null; data$: Observable<{ start?: number; end?: number; totalEntries?: number; totalPages?: number; pageNumber?: number; pages?: { page: number; active: boolean; }[]; }>; private _collection; private _subscription; private _cache$; private _maxAmountOfButtons$; ngOnInit(): void; ngOnDestroy(): void; setPage(pageNumber: number, totalPages: number): void; private setData; private observeCollectionChanges; private calculatePages; private filterActivePages; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_maxAmountOfButtons: unknown; } declare class BbCollectionsTable { readonly collection$: BehaviorSubject>; dataTemplate?: TemplateRef>; dataRowTemplate?: TemplateRef>; queryPlaceholder: string | null; emptyContent: string | TemplateRef | null; noResultsContent: string | TemplateRef | null; errorContent: string | TemplateRef | null; trackByProperty: string | null; includeVerticalLines: boolean; hideActions: boolean; hidePager: boolean; set collection(collection: Collection); get collection(): Collection; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "bb-collections-table", never, { "queryPlaceholder": { "alias": "queryPlaceholder"; "required": false; }; "emptyContent": { "alias": "emptyContent"; "required": false; }; "noResultsContent": { "alias": "noResultsContent"; "required": false; }; "errorContent": { "alias": "errorContent"; "required": false; }; "trackByProperty": { "alias": "trackByProperty"; "required": false; }; "includeVerticalLines": { "alias": "includeVerticalLines"; "required": false; }; "hideActions": { "alias": "hideActions"; "required": false; }; "hidePager": { "alias": "hidePager"; "required": false; }; "collection": { "alias": "collection"; "required": true; }; }, {}, ["dataTemplate", "dataRowTemplate"], ["[data-collections-action]", "[data-collections-row]", "[data-collections-header]", "thead", "tfoot"], true, never>; static ngAcceptInputType_includeVerticalLines: unknown; static ngAcceptInputType_hideActions: unknown; static ngAcceptInputType_hidePager: unknown; } declare class BbCollectionsTableSorting implements OnInit, OnDestroy { private _name; private _changeDetectorRef; private _parent?; readonly orderedOptions: [null, 'asc', 'desc']; direction: 'asc' | 'desc' | null; private _subscription; constructor(_name: string, _changeDetectorRef: ChangeDetectorRef, _parent?: BbCollectionsTable); ngOnInit(): void; ngOnDestroy(): void; onClick(): void; private getNextOption; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BbCollectionsTableLabel { titleLabel: string | TemplateRef | null; descriptionLabel: string | TemplateRef | null; imageUrl: string | null; alt: string | null; type: 'image' | 'avatar' | 'content'; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BbCollectionsGrid { readonly collection$: BehaviorSubject>; itemTemplate?: TemplateRef>; queryPlaceholder: string | null; emptyContent: string | TemplateRef | null; noResultsContent: string | TemplateRef | null; errorContent: string | TemplateRef | null; trackByProperty: string | null; hideActions: boolean; hidePager: boolean; set collection(collection: Collection); get collection(): Collection; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "bb-collections-grid", never, { "queryPlaceholder": { "alias": "queryPlaceholder"; "required": false; }; "emptyContent": { "alias": "emptyContent"; "required": false; }; "noResultsContent": { "alias": "noResultsContent"; "required": false; }; "errorContent": { "alias": "errorContent"; "required": false; }; "trackByProperty": { "alias": "trackByProperty"; "required": false; }; "hideActions": { "alias": "hideActions"; "required": false; }; "hidePager": { "alias": "hidePager"; "required": false; }; "collection": { "alias": "collection"; "required": true; }; }, {}, ["itemTemplate"], ["[data-collections-action]", "[data-collections-row]"], true, never>; static ngAcceptInputType_hideActions: unknown; static ngAcceptInputType_hidePager: unknown; } declare class BbCollectionsActions { private readonly _config?; readonly searchIconName: string; readonly closeIconName: string; collection: Collection | null; queryPlaceholder: string | null; standalone: boolean; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "bb-collections-actions", never, { "collection": { "alias": "collection"; "required": true; }; "queryPlaceholder": { "alias": "queryPlaceholder"; "required": false; }; "standalone": { "alias": "standalone"; "required": false; }; }, {}, never, ["[data-collections-action]", "*"], true, never>; static ngAcceptInputType_standalone: unknown; } declare class ArrayCollection { protected value: T[]; constructor(value: T[]); search(query: string, fields: ArrayCollectionStringKeys[]): this; sortBy(sort: CollectionRequestSort | CollectionRequestSort[], sortables: Partial, 'string' | 'number'>>): this; toPage(pageNumber: number, pageSize: number): { totalPages: number; totalEntries: number; pageSize: number; pageNumber: number; data: T[]; }; toArray(): T[]; protected normalizeValueAsString(value: unknown): string; } declare class CollectionsModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const COLLECTIONS_CONFIG: InjectionToken; interface CollectionsConfig { icons?: { actionsSearch?: string; actionsClose?: string; pagerArrowPrevious?: string; pagerArrowNext?: string; }; } declare function provideCollectionsConfig(config: CollectionsConfig): EnvironmentProviders; export { ApiCollectionProvider, ArrayCollection, BbCollectionsActions, BbCollectionsData, BbCollectionsDataContext, BbCollectionsDataRow, BbCollectionsDataRowContext, BbCollectionsEmpty, BbCollectionsEmptyContext, BbCollectionsError, BbCollectionsErrorContext, BbCollectionsGrid, BbCollectionsInitial, BbCollectionsInitialContext, BbCollectionsItem, BbCollectionsItemContext, BbCollectionsPager, BbCollectionsTable, BbCollectionsTableLabel, BbCollectionsTableSorting, BbCollectionsViewer, COLLECTIONS_CONFIG, Collection, CollectionProvider, CollectionState, CollectionsModule, LocalCollectionProvider, provideCollectionsConfig }; export type { ArrayCollectionOptions, ArrayCollectionStringKeys, CollectionApiParams, CollectionApiResponse, CollectionContext, CollectionData, CollectionRequest, CollectionRequestSort, CollectionsConfig };