right-angled
Version:
Lightweight and easy to use angular data grids. Integrates with your markup and styles rather than generating its own.
187 lines • 7.47 kB
TypeScript
import { EventEmitter, InjectionToken } from '@angular/core';
import { Observable } from 'rxjs';
import { RTFiltersService } from '../../filters/filters.service';
import { RTStateService } from './state.service';
import { RTSortingsService } from './sortings.service';
import { OperationStatus } from '../../core/operation-status';
import { ListResponse } from '../../core/list-response';
import { AsyncSubscriber } from './async-subscriber';
import { Pager } from '../../core/pager';
import { FilterConfig } from '../../core/filter-config';
import * as i0 from "@angular/core";
export declare const RTFilterTarget: InjectionToken<any>;
export declare class OperationStatusStream {
status$: Observable<OperationStatus>;
}
export declare class RTList {
private asyncSubscriber;
private sortingsService;
private filtersService;
/**
* Global settings of list..
*
* These settings are static and their values are copied to the properties of the same name for each instance of {@link RTList} type.
*
* So, changing of this settings will affect all instances of {@link RTList} type that will be created after such changes.
* If you want to change settings of concrete object you can use it the same name properties.
*/
static settings: {
/**
* @see {@link RTList.keepRecordsOnLoad}
*/
keepRecordsOnLoad: boolean;
};
loadStarted: EventEmitter<void>;
loadSucceed: EventEmitter<ListResponse<any> | any[]>;
loadFailed: EventEmitter<any>;
private filterTargets;
constructor(asyncSubscriber: AsyncSubscriber, stateServices: RTStateService, // | RTStateService[],
filterTargets: any, sortingsService: RTSortingsService, filtersService: RTFiltersService);
/**
* Specifies that list must destroy previously loaded records immediately or keep them until data request is completed.
*/
keepRecordsOnLoad: boolean;
/**
* Can be used with `Observable` data sourceto specify that list must keep previously loaded records or destroy them when new value published
*/
appendStreamedData: boolean | null;
/**
* Method for getting data. This parameter is required and its configuration is necessary.
*
* This method get one parameter with the settings of the request implementing {@link ListRequest} contract for the simple lists and {@link PagedListRequest} one for the paged lists.
* The return value of this method should be any subscribable object which can be handled by {@link AsyncSubscriber}.
* For the simple lists the response should contain array with the records. As for the paged ones, it should implement {@link ListResponse} contract.
*/
fetchMethod: (requestParams: any) => any;
/**
* Array of elements transferred in the {@link ListResponse.items} property.
*/
get items(): any[];
/**
* Array of registered {@link RTStateService} instances.
*/
stateServices: RTStateService[];
/**
* Async implementation of @see RTList.status
*/
status$: Observable<OperationStatus>;
/**
* Async implementation of @see RTList.destroyed
*/
destroyed$: Observable<boolean>;
/**
* Async implementation of @see RTList.inited
*/
inited$: Observable<boolean>;
/**
* Async implementation of @see RTList.items
*/
items$: Observable<any[]>;
/**
* Async implementation of @see RTList.busy
*/
busy$: Observable<boolean>;
/**
* Async implementation of @see RTList.ready
*/
ready$: Observable<boolean>;
private pagerInternal;
/**
* Configured {@link Pager} service.
*/
get pager(): Pager;
set pager(value: Pager);
/**
* True if the service was already destroyed via {@link destroy} call.
*/
get destroyed(): boolean;
/**
* True if the service was already initialized via {@link init} call.
*/
get inited(): boolean;
/**
* Current execution status of the list.
*/
get status(): OperationStatus;
/**
* returns `true`, if there is a data request executed at the moment (i.e. {@link state} is equal to {@link ProgressState.Progress})
*/
get busy(): boolean;
/**
* returns `true`, if there is no data request executed at the moment (i.e. {@link state} is NOT equal to {@link ProgressState.Progress})
*/
get ready(): boolean;
/**
* Performs initialization logic of the service. This method must be called before first use of the service.
*/
init(): void;
/**
* Performs destroy logic of the list itself and all of the inner services.
*/
destroy(): void;
/**
* Registers passed object(s) as state service to manage the list state.
*/
registerStateService(...services: RTStateService[]): void;
/**
* Removes passed object(s) from state services collection of the list.
*/
removeStateService(...services: RTStateService[]): void;
/**
* Registers passed object(s) as filter targets in underlying {@link FiltersService} to include their configured properties as parameters to the data request.
* @see {@link FiltersService.registerFilterTarget}
*/
registerFilterTarget(...targets: object[]): void;
/**
* @see {@link FiltersService.removeFilterTarget}
*/
removeFilterTarget(...targets: object[]): void;
/**
* @see {@link FiltersService.getRequestState}
*/
getRequestState(filterFn?: (config: FilterConfig, proposedValue: any, targetObject: object) => boolean): any;
/**
* Resets the list parameters (sortings, paging, filters) to their default values.
*/
resetSettings(): void;
/**
* Cancels the request executed at the moment.
*/
cancelRequests(): void;
/**
* Clears {@link items} array. Calls {@link destroyAll} method for {@link items} array to perform optional destroy logic of the elements.
* {@see destroyAll}
*/
clearData(): void;
/**
* Performs data loading by calling specified {@link fetchMethod} delegate.
* @return result of {@link fetchMethod} execution.
*/
loadData(): Observable<any> | Promise<any> | EventEmitter<any>;
/**
* Resets paging parameters and performs data loading by calling {@link loadData} if list not in {@link OperationStatus.Progress} state.
* @return result of {@link fetchMethod} if it was called. `null` otherwise.
*/
reloadData(): Observable<any> | Promise<any> | EventEmitter<any>;
/**
* Callback which is executed if {@link fetchMethod} execution finished successfully.
*/
loadSuccessCallback(response: ListResponse<any> | any[]): ListResponse<any> | any[];
/**
* Callback which is executed if {@link fetchMethod} execution finished with error.
*/
loadFailCallback(): void;
private loadDataSuccessCallback;
private reloadDataSuccessCallback;
private loadDataFailCallback;
private tryInterceptStatusResponse;
private reloadDataFailCallback;
private tryCleanItemsOnLoad;
private tryCleanItemsOnReload;
private beginRequest;
private responseHasStatus;
static ɵfac: i0.ɵɵFactoryDeclaration<RTList, [null, { optional: true; }, { optional: true; skipSelf: true; }, null, null]>;
static ɵprov: i0.ɵɵInjectableDeclaration<RTList>;
}
export declare const LIST_PROVIDERS: any[];
//# sourceMappingURL=list.d.ts.map