UNPKG

@anglr/grid

Version:
184 lines 8.06 kB
import { ElementRef, ViewContainerRef, OnDestroy, Injector, Provider, TemplateRef } from '@angular/core'; import { Action4, Func1, Func2, NoopAction, RecursivePartial } from '@jscrpt/common'; import { Subscription } from 'rxjs'; import { MatrixContentRenderer, MatrixContentRendererDefautTemplates, MatrixContentRendererOptions } from './matrixContentRenderer.interface'; import { CurrentViewContainer, DataLoader, DataResponse, Grid, GridCellContext, GridContext, GridDataRowContext, GridPlugin, GridPluginInstances, GridRowContext, MatrixGridColumn, MatrixGridMetadata, MetadataSelector, Paging, RowSelector } from '../../../interfaces'; import type { FooterRowContainerTemplateDirective } from '../../../directives/footerRowContainerTemplate/footerRowContainerTemplate.directive'; import type { HeaderRowContainerTemplateDirective } from '../../../directives/headerRowContainerTemplate/headerRowContainerTemplate.directive'; import type { ContentRowContainerTemplateDirective } from '../../../directives/contentRowContainerTemplate/contentRowContainerTemplate.directive'; import * as i0 from "@angular/core"; /** * Component used for rendering content using new 'matrix' metadata gatherer */ export declare class MatrixContentRendererComponent implements MatrixContentRenderer, GridPlugin<MatrixContentRendererOptions>, OnDestroy { /** * Instance of current view container */ protected currentViewContainer: CurrentViewContainer; /** * Options for matrix content renderer */ protected ɵoptions: MatrixContentRendererOptions; /** * Instance of grid itself */ protected grid: Grid; /** * Instance of injector used for DI */ protected injector: Injector; /** * Gets plugins instances safely */ protected get gridPluginsSafe(): GridPluginInstances; /** * Currently used grid columns */ protected gridColumns: MatrixGridColumn<unknown>[] | undefined | null; /** * Metadata selector currently used */ protected metadataSelector: MetadataSelector<MatrixGridMetadata<MatrixGridColumn>> | undefined | null; /** * Data loader currently used */ protected dataLoader: DataLoader<DataResponse> | undefined | null; /** * Paging currently used */ protected paging: Paging | undefined | null; /** * Row selector currently used */ protected rowSelector: RowSelector | undefined | null; /** * Subscription for metadata changes */ protected metadataChangeSubscription: Subscription | undefined | null; /** * Subscription for data changes */ protected dataChangeSubscription: Subscription | undefined | null; /** * Instance with default templates */ protected defaults: MatrixContentRendererDefautTemplates | undefined | null; /** * Gets instance with default templates safely */ protected get defaultsSafe(): MatrixContentRendererDefautTemplates; /** * @inheritdoc */ gridPlugins: GridPluginInstances | undefined | null; /** * @inheritdoc */ readonly pluginElement: ElementRef<HTMLElement>; /** * @inheritdoc */ get options(): MatrixContentRendererOptions; set options(value: RecursivePartial<MatrixContentRendererOptions>); /** * Container used for rendering defaults component */ protected defaultsContainer: ViewContainerRef; /** * Default container used for rendering content */ protected container: ViewContainerRef; constructor(defaultOptions: MatrixContentRendererOptions, options?: RecursivePartial<MatrixContentRendererOptions>); /** * Called when component is destroyed */ ngOnDestroy(): void; /** * @inheritdoc */ initialize(force: boolean): void; /** * @inheritdoc */ initOptions(): void; /** * @inheritdoc */ invalidateVisuals(): void; /** * Renders grid container */ protected renderGridContainer(): void; /** * Renders header rows containers */ protected renderHeaderRowsContainers(): void; /** * Renders content rows containers */ protected renderContentRowsContainers(): void; /** * Renders footer rows containers */ protected renderFooterRowsContainers(): void; /** * Gets grid context */ protected getGridContext(): GridContext; /** * Gets grid row context * @param index - Current index to be used for creation of grid row context * @param rowColumns - Array of row columns rendered in current row */ protected getGridRowContext(index: number, rowColumns: MatrixGridColumn[]): GridRowContext; /** * Gets grid data row context * @param index - Current index to be used for creation of grid row context * @param datum - Datum for current row * @param rowColumns - Array of row columns rendered in current row */ protected getGridDataRowContext(index: number, datum: unknown, rowColumns: MatrixGridColumn[]): GridDataRowContext; /** * Creates new injector with content renderer inner structure * @param injector - Injector used as parent injector * @param additionalProviders - Array of additional providers */ protected createInjector(injector: Injector, additionalProviders?: Provider[]): Injector; /** * Clears current view container */ protected clearCurrentViewContainer(): void; /** * Renders one of containers, head, content or foot * @param template - Template to be rendered * @param rowsContainerRenderFn - Function to be called if container is renderable */ protected renderContainer(template: TemplateRef<GridContext<unknown, MatrixGridColumn<unknown>>>, rowsContainerRenderFn: NoopAction): void; /** * Renders row container * @param rowTemplates - Array of row templates directives * @param cellTemplateGetter - Function for obtaining template for cell for column definition * @param cellRenderer - Function that renders * @param contextGetter - Function used for obtaining grid context */ protected renderRowContainer(rowTemplates: Array<FooterRowContainerTemplateDirective | HeaderRowContainerTemplateDirective | ContentRowContainerTemplateDirective>, cellTemplateGetter: Func1<TemplateRef<GridCellContext<unknown, MatrixGridColumn>> | null | undefined, MatrixGridColumn>, cellRenderer: Action4<ViewContainerRef, TemplateRef<GridCellContext<unknown, MatrixGridColumn>>, GridRowContext<unknown, MatrixGridColumn>, MatrixGridColumn>, contextGetter: Func2<GridRowContext | GridDataRowContext, number, MatrixGridColumn[]>): void; /** * Renders header cell * @param viewContainer - View container used for rendering cell * @param template - Template used for rendering cell * @param context - Context passed to rendered cell * @param column - Instance of column metadata */ protected renderHeaderCell(viewContainer: ViewContainerRef, template: TemplateRef<GridCellContext<unknown, MatrixGridColumn>>, context: GridRowContext<unknown, MatrixGridColumn>, column: MatrixGridColumn): void; /** * Renders content or footer cell * @param viewContainer - View container used for rendering cell * @param template - Template used for rendering cell * @param context - Context passed to rendered cell * @param column - Instance of column metadata */ protected renderContentOrFooterCell(viewContainer: ViewContainerRef, template: TemplateRef<GridCellContext<unknown, MatrixGridColumn>>, context: GridRowContext<unknown, MatrixGridColumn>, column: MatrixGridColumn): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatrixContentRendererComponent, [null, { optional: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration<MatrixContentRendererComponent, "div.matrix-content-renderer", never, {}, {}, never, never, true, never>; } //# sourceMappingURL=matrixContentRenderer.component.d.ts.map