/******************************************************************* * NGX-DYNAMIC-MATERIAL-TABLE * * @description Create fancy and complex tables dynamically * * @file table-instance.component.ts * * @author Gökhan Sari - * * @copyright Arpage AG, Zurich Switzerland, 2018 * *******************************************************************/ import { MatTableDataSource, MatSort, MatTable } from '@angular/material'; import { QueryList, Injector, OnInit, OnDestroy, AfterViewInit } from '@angular/core'; import { AbstractWebLibraryComponent } from '../../abstract-web-library.component'; import { DynamicTableInterface } from '../interfaces/dynamic-table.interface'; import { Subject } from 'rxjs'; import { DynamicTableEventDataInterface } from '../interfaces/dynamic-table-event-data.interface'; import { DynamicTableColumnDefinitionConstants } from '../shared/dynamic-table-column-definition.constants'; import { DynamicTableActionsContainerDirective } from '../directives/dynamic-table-actions-container.directive'; import { DynamicTableIconContainerDirective } from '../directives/dynamic-table-icon-container.directive'; import { DynamicTableContentSummaryContainerDirective } from '../directives/dynamic-table-content-summary-container.directive'; import { PalTableAdditionalInfoContainerDirective } from '../directives/dynamic-table-additional-info-container.directive'; import { DynamicTableDescriptionContainerDirective } from '../directives/dynamic-table-description-container.directive'; import { DynamicTableActionMessageService } from '../services/dynamic-table-action-message.service'; import { DynamicTableDataProvider } from '../shared/dynamic-table-data-provider'; import { DynamicTableGroupExpressionInterface } from '../interfaces/dynamic-table-group-expression.interface'; import { SafeStyle } from '@angular/platform-browser'; import { DynamicTableTitleContainerDirective } from '../directives/dynamic-table-title-container.directive'; import { DynamicTableColumnInterace } from '../interfaces/dynamic-table-column.interface'; import { DynamicTableMouseEventMessageService } from '../services/dynamic-table-mouse-event-message.service'; /** * TableInstanceComponent * @description Contains the logic of a dynamic table instance. * * @param selector * @param templateUrl * @param styleUrls */ export declare class TableInstanceComponent extends AbstractWebLibraryComponent implements OnInit, AfterViewInit, OnDestroy, DynamicTableInterface { static readonly FILTER_MIN_VALUE: number; filterHint: string; displayedColumns: string[]; columns: Array; isLoadingResults: boolean; noDataFound: boolean; showFilter: boolean; resultsLength: number; dataSource: MatTableDataSource; COLUMN_DEFINITIONS: DynamicTableColumnDefinitionConstants; currentSelectedRowIndex: number; palTableDataProvider: DynamicTableDataProvider; private palTableActionsContainerDirectives; private palTableIconContainerDirectives; private palTableContentSummaryContainerDirectives; private palTableAdditionalInfoContainerDirectives; private palTableDescriptionContainerDirectives; private palTableTitleContainerDirectives; private subscription; private palTableDynamicCellBuilder; private actionMessage; private mouseEventMessage; palTableIconContainerQueryList: QueryList; palTableActionsContainerQueryList: QueryList; palTableContentSummaryContainerQueryList: QueryList; palTableAdditionalInfoContainerQueryList: QueryList; palTableDescriptionContainerQueryList: QueryList; palTableTitleContainerQueryList: QueryList; sort: MatSort; table: MatTable; iconCell: any; groupIndex: number; groupName: string; itemRowColor: string; hideColumns: boolean; groupExpressions: DynamicTableGroupExpressionInterface[]; columnOptions: DynamicTableColumnInterace[]; actionsSubject: Subject>; mouseEventsSubject: Subject>; /** * @inheritdoc */ constructor(injector: Injector); /** * @inheritdoc */ ngOnInit(): void; /** * @inheritdoc */ ngAfterViewInit(): void; /** * @inheritdoc */ ngOnDestroy(): void; /** * @description Adds standard columns to the table. * * @returns void */ addStandardColumns(): void; /** * @description Loads the data provided by the table data provider. * * @returns void */ private loadData; /** * @description Converts the provided item row color as trusted style. * * @returns SafeStyle */ getItemRowColor(): SafeStyle; /** * @description Retrieves the defined cell color by the given columnId. * * @param columnId * @returns SafeStyle */ getColumnColor(columnId: string): SafeStyle; /** * @description Checks if the table has groups. * * @returns boolean */ private hasGroups; /** * @description Swaps the given item after an ID comparison on the same index. * * @param item */ private replaceItem; /** * @description Removes the given item from the array list. * * @param item * @returns void */ private removeItem; /** * @description Handles events triggered from the data provider. * * @param data * @returns void */ handleDataProviderEvents(data: DynamicTableEventDataInterface): void; /** * @description Checks if the given column is defined and should be displayed. * * @param column */ isColumnDefined(column: string): boolean; /** * @description Retrieves the style url. * * @returns string */ getColumnsStyleUrl(): string; /** * @description Retrieves the indicator cell color provided by the table data provider. * * @param item * @param rowIndex * @returns string */ getIndicatorColor(item: object, rowIndex: number): string; /** * @description Retrieves the indicator cell sign provided by the table data provider. * * @param item * @param rowIndex * @returns string */ getIndicatorSign(item: object, rowIndex: number): string; /** * @description Retrieves the html content summary cell provided by the table data provider. * The html content summary can be defined as html string which will be compiled and rendered dynamically in this cell. * * @param item * @param rowIndex * @returns string */ getHTMLContentSummary(item: object, rowIndex: number): string; /** * @description Retrieves the additional info cell provided by the table data provider. * The additional info can be defined as html string which will be compiled and rendered dynamically in this cell. * * @param item * @param rowIndex * @returns string */ getAdditionalInfo(item: object, rowIndex: number): string; /** * @description Retrieves the html icon cell provided by the table data provider. * The icon can be defined as html string which will be compiled and rendered dynamically in this cell. * * @param item * @param rowIndex * @returns string */ getHTMLIcon(item: object, rowIndex: number): string; /** * @description Retrieves the title cell provided by the table data provider. * The title can be defined as html string which will be compiled and rendered dynamically in this cell. * * @param item * @param rowIndex * @returns string */ getTitle(item: object, rowIndex: number): string; /** * @description Retrieves the other text based cell provided by the table data provider. * * @param item * @param rowIndex * @returns string */ getOtherTextBased(item: object, rowIndex: number): string; /** * @description Retrieves the description cell provided by the table data provider. * The description content can be defined as html string which will be compiled and rendered dynamically in this cell. * * @param item * @param rowIndex * @returns string */ getDescription(item: object, rowIndex: number): string; /** * @description Retrieves the actions cell provided by the table data provider. * Actions can be defined as html string which will be compiled and rendered dynamically in this cell. * * @param item * @param rowIndex * @returns string */ getHTMLAction(item: object, rowIndex: number): string; /** * @description Retrives the column name by the given columnId. * * @param columnId * @returns string */ getColumnName(columnId: string): string; /** * @description Applies the given filter value to the data source. * * @param filterValue * @returns void */ applyFilter(filterValue: string): void; /** * @description Selects the clicked item. * * @param index * @returns void */ selectItem(index: number): void; /** * @description Retrieves the current selected item. * * @returns object */ getCurrentSelectedItem(): object; /** * @description Retrieves the previous selected item. * * @returns object */ getPreviousItem(): object; /** * @description Retrieves the item to be selected next. * * @returns object */ getNextItem(): object; /** * @description Triggered when the filter input is entered. * * @returns void */ onFilterEnter(): void; /** * @description Triggered when the filter input is leaved. * * @returns void */ onFilterLeave(): void; }