UNPKG

@rxap/data-source

Version:

Provides a set of classes and decorators for creating and managing data sources in Angular applications, including base classes, static data sources, observable data sources, and method data sources. It also includes a component for displaying data source

55 lines (54 loc) 3.48 kB
import { SelectionModel } from '@angular/cdk/collections'; import { InjectionToken, OnDestroy } from '@angular/core'; import { BaseDataSourceViewer } from '@rxap/data-source'; import { PaginatorLike } from '@rxap/data-source/pagination'; import { AbstractTableDataSource, FilterLike, SortLike, TableDataSourceMetadata, TableEvent } from '@rxap/data-source/table'; import { ExpandNodeFunction, Node } from '@rxap/data-structure-tree'; import { Method } from '@rxap/pattern'; import '@rxap/rxjs'; import { WithChildren, WithIdentifier } from '@rxap/utilities'; import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { RowDataWithNode } from './row-data-with-node'; import * as i0 from "@angular/core"; export declare const RXAP_TREE_TABLE_DATA_SOURCE_ROOT_METHOD: InjectionToken<unknown>; export declare const RXAP_TREE_TABLE_DATA_SOURCE_CHILDREN_METHOD: InjectionToken<unknown>; export type TreeTableEvent = Omit<TableEvent, 'start' | 'end'>; export interface FilterQuery { column: string; filter: string; } export declare class TreeTableDataSource<RowData extends WithIdentifier & WithChildren, Parameters = any> extends AbstractTableDataSource<RowDataWithNode<RowData>, Parameters> implements OnDestroy { readonly rootMethod: Method<RowData | RowData[], TreeTableEvent>; readonly childrenMethod: Method<RowData[], { node: Node<RowData>; event: TreeTableEvent; }>; tree$: BehaviorSubject<Node<RowData, any>[]>; expanded: SelectionModel<string>; _data$: Subject<RowDataWithNode<RowData>[]>; private _expandedLocalStorageSubscription; private _subscription?; constructor(rootMethod: Method<RowData | RowData[], TreeTableEvent>, childrenMethod: Method<RowData[], { node: Node<RowData>; event: TreeTableEvent; }>, paginator?: PaginatorLike | null, sort?: SortLike | null, filter?: FilterLike | null, parameters?: Observable<Parameters> | null, metadata?: TableDataSourceMetadata | null); init(): void; getTreeRoot(event?: TreeTableEvent): Promise<void>; getChildren(node: Node<RowData>, event: TreeTableEvent): Promise<RowData[]>; getRoot(event: TreeTableEvent): Promise<RowData | RowData[]>; collapseNode(node: Node<RowData>): Promise<void>; _toNode(row: RowData, depth?: number, onExpand?: ExpandNodeFunction<RowData>, onCollapse?: ExpandNodeFunction<RowData>): Promise<Node<RowData>>; expandNode(node: Node<RowData>): Promise<void>; toNode(row: RowData, depth?: number, onExpand?: ExpandNodeFunction<RowData>, onCollapse?: ExpandNodeFunction<RowData>): Node<RowData> | Promise<Node<RowData>>; ngOnDestroy(): void; flatTree(tree: Node<RowData>): Array<Node<RowData>>; retry(): Promise<void>; refresh(): any; isMatchingFilter(item: RowDataWithNode<RowData>, filterList: Array<FilterQuery>): boolean; hasMatchingNodesByFilter(nodeList: ReadonlyArray<Node<any>>, filterList: Array<FilterQuery>): boolean; applyFilterBy(data: ReadonlyArray<RowDataWithNode<RowData>>, filter: Record<string, any> | string): RowDataWithNode<RowData>[]; protected _connect(viewer: BaseDataSourceViewer): Observable<Array<RowDataWithNode<RowData>>>; private initExpanded; static ɵfac: i0.ɵɵFactoryDeclaration<TreeTableDataSource<any, any>, [null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<TreeTableDataSource<any, any>>; }