import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, Renderer2, SimpleChanges } from "@angular/core"; import { UntypedFormControl } from "@angular/forms"; import { MatLegacyDialog as MatDialog } from "@angular/material/legacy-dialog"; import { MatLegacyTable as MatTable, MatLegacyTableDataSource as MatTableDataSource } from "@angular/material/legacy-table"; import { SelectionModel } from "@angular/cdk/collections"; import { BooleanInput } from "@angular/cdk/coercion"; import { StarkLoggingService } from "@nationalbankbelgium/stark-core"; import { StarkTableColumnComponent } from "./column.component"; import { StarkAction, StarkActionBarConfig } from "@nationalbankbelgium/stark-ui/src/modules/action-bar"; import { StarkColumnSortChangedOutput, StarkTableColumnFilter, StarkTableColumnProperties, StarkTableColumnSortingDirection, StarkTableFilter, StarkTableRowActions } from "../entities"; import { AbstractStarkUiComponent } from "@nationalbankbelgium/stark-ui/src/internal-common"; import { StarkPaginateEvent, StarkPaginationComponent, StarkPaginationConfig } from "@nationalbankbelgium/stark-ui/src/modules/pagination"; import { StarkMinimapComponentMode, StarkMinimapItemProperties } from "@nationalbankbelgium/stark-ui/src/modules/minimap"; import { StarkTableExpandDetailDirective } from "../directives/table-expand-detail.directive"; import { StarkTableRowContentDirective } from "../directives/table-row-content.directive"; import * as i0 from "@angular/core"; /** * Component to display array data in a table layout. */ export declare class StarkTableComponent extends AbstractStarkUiComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy { logger: StarkLoggingService; dialogService: MatDialog; private cdRef; /** * Array of {@link StarkTableColumnProperties} objects which define the columns of the data table. */ set columnProperties(input: StarkTableColumnProperties[]); get columnProperties(): StarkTableColumnProperties[]; /** * Return the array of {@link StarkMinimapItemProperties} to be displayed display in the table minimap component */ get _minimapItemProperties(): StarkMinimapItemProperties[]; /** * Return the items to be shown as "visible" in the table minimap component */ get _visibleMinimapItems(): string[]; /** * Array of {@link StarkAction} objects. */ customTableActions?: StarkAction[]; /** * Mode in which the custom actions will be displayed in the table */ customTableActionsType: "regular" | "alt"; /** * Data that will be display inside your table. */ data: T[]; static ngAcceptInputType_data: object[] | undefined | null; /** * Object which contains filtering information for the table. */ get filter(): StarkTableFilter; set filter(value: StarkTableFilter); static ngAcceptInputType_filter: StarkTableFilter | undefined; /** * Allows to fix the header to the top of the scrolling viewport containing the table. * Setting the attribute to `true` or empty will enable this feature. * * The class `fixed-header` will be added under `.stark-table` which defines the following CSS properties: * - `overflow-y: auto;` * - `height: 400px;` * * If you need to change the height, please redefine the value for `.stark-table .fixed-header { height: 400px; }` */ set fixedHeader(value: boolean); static ngAcceptInputType_fixedHeader: BooleanInput; /** * HTML id of the table */ htmlId?: string; /** * Determine if you can select the rows in the table * @deprecated - use {@link selection} instead */ rowsSelectable?: boolean; /** * Allows multiple row selection. Setting the attribute to "true" or empty will enable this feature. * @deprecated - use {@link selection} instead */ multiSelect?: string; /** * Allows sorting by multiple columns. Setting the attribute to "true" or empty will enable this feature. */ set multiSort(value: boolean); static ngAcceptInputType_multiSort: BooleanInput; /** * Columns to be sorted by default */ orderProperties?: string[]; /** * Whether to display the pagination component */ paginate: boolean; /** * Shows or hides the {@link StarkMinimapComponent} in the header. When set to 'compact' it shows the compacted minimap */ minimap: boolean | StarkMinimapComponentMode; /** * {@link StarkPaginationConfig} object for the embedded {@link StarkPaginationComponent} * * **IMPORTANT:** the pagination component is displayed in "compact" mode */ paginationConfig: StarkPaginationConfig; /** * Determine if the item counter is enabled. Shows how many items are in the data object array. * * Default: `false` */ get showRowsCounter(): boolean; set showRowsCounter(value: boolean); static ngAcceptInputType_showRowsCounter: BooleanInput; /** * {@link StarkActionBarConfig} object for the {@link StarkActionBarComponent} to be displayed in all the rows */ tableRowActions: StarkTableRowActions; /** * Active row that should be collapsed */ expandedRows: T[]; /** * An {@link StarkActionBarConfig} object defining the different actions to be shown in each row of the table * @deprecated - use {@link tableRowActions} instead */ set tableRowsActionBarConfig(config: StarkActionBarConfig); /** * Function to generate classNames for rows */ rowClassNameFn?: (row: T, index: number) => string; /** * Function to see if a row is collapsed */ expandedRowFn: (expandedRow: T, row: T) => boolean; /** * Angular CDK selection model used for the "master" selection of the table */ get selection(): SelectionModel; set selection(selection: SelectionModel); /** * @ignore */ private _selection; /** * Determine if the row index must be present or not. * * Default: `false` */ get showRowIndex(): boolean; set showRowIndex(value: boolean); static ngAcceptInputType_showRowIndex: BooleanInput; /** * Output event emitter that will emit the latest filter value whenever it changes. */ readonly filterChanged: EventEmitter; /** * Callback function to be called when the pagination changes. Two parameters * will be passed to the callback function: * -- page (number) * -- itemsPerPage (number) * * When you declare it in html tags you have to declare it like 'on-paginate="yourFunction(page,itemsPerPage)"' * If no callback function is passed, the data will be paginated automatically by the component. * * When set onPaginate, these attributes are required : totalItems */ readonly paginationChanged: EventEmitter; /** * Output event emitter that will emit the array of selected rows. * @deprecated - use {@link selection} instead */ readonly selectChanged: EventEmitter; /** * Output event emitter that will emit the data of a row when it is clicked. * If there are no observers it will not emit, but instead select the row. */ readonly rowClicked: EventEmitter; /** * Reference to the MatTable embedded in this component */ table: MatTable; /** * Reference to the MatPaginator embedded in this component */ starkPaginator: StarkPaginationComponent; /** * Columns added automatically by this component according to the `columnProperties` input */ viewColumns: QueryList; /** * Columns added by the user via transclusion inside an
element with class "stark-table-columns" */ contentColumns: QueryList; expandedDetailTemplate: StarkTableExpandDetailDirective; customRowTemplate: StarkTableRowContentDirective; /** * Array of StarkTableColumnComponents defined in this table */ columns: StarkTableColumnComponent[]; /** * Array of StarkAction for alt mode */ customTableAltActions?: StarkAction[]; /** * {@link StarkActionBarConfig} object for the {@link StarkActionBarComponent} in regular mode */ customTableRegularActions: StarkActionBarConfig; /** * MatTableDataSource associated to the MatTable embedded in this component */ dataSource: MatTableDataSource; /** * Array of columns (column id's) to be displayed in the table. */ displayedColumns: string[]; /** * @ignore */ _globalFilterFormCtrl: UntypedFormControl; /** * Whether the fixed header is enabled. */ isFixedHeaderEnabled: boolean; /** * Whether the footer is enabled. * * Default: if there is no footer defined here and in any other column, then it won't be displayed. * Otherwise, if at least one of the other columns defines a footer, * then the footer of this column will be displayed as empty */ isFooterEnabled: boolean; /** * Whether the current sorting is done on multiple columns */ isMultiSorting: boolean; /** * Whether the sorting by multiple columns is enabled. */ isMultiSortEnabled: boolean; /** * @ignore */ private _selectionSub; /** * @ignore */ private _managedSelection; /** * Class constructor * @param logger - The `StarkLoggingService` instance of the application. * @param dialogService - Angular Material service to open Material Design modal dialogs. * @param cdRef - Reference to the change detector attached to this component * @param renderer - Angular `Renderer2` wrapper for DOM manipulations. * @param elementRef - Reference to the DOM element where this component is attached to. */ constructor(logger: StarkLoggingService, dialogService: MatDialog, cdRef: ChangeDetectorRef, renderer: Renderer2, elementRef: ElementRef); /** * Component lifecycle hook */ ngOnInit(): void; /** * Component lifecycle hook */ ngAfterViewInit(): void; /** * Component lifecycle hook * @param changes - Contains the changed properties */ ngOnChanges(changes: SimpleChanges): void; /** * Component lifecycle hook */ ngOnDestroy(): void; /** * Remove the columns that were previously defined */ private removeOldColumnsFromTable; /** * Add the new columns defined * @param columns - The columns to be added */ private addColumnsToTable; /** * Trigger the filtering of the MatTableDataSource used by the MatTable */ applyFilter(): void; /** * Selects all rows if they are not all selected; otherwise clear selection. */ masterToggle(): void; /** * Create and initialize the MatTableDataSource used by the MatTable */ private initializeDataSource; /** * Update columns of the Mat-Table component based on columnProperties. */ updateTableColumns(): void; /** * Return the filter criteria that the item does not meet * @param item - The item to filter * @param filterCriteria - The criteria that should be met by the item */ getUnmetFilterCriteria(item: object | string, filterCriteria: RegExp[]): RegExp[]; /** * Normalize the given filter value into a more complex filter criteria supporting wildcards * @param filterValue - The original filter value * @returns An array containing more complex regex based on the original filter value supporting wildcards */ getNormalizedFilterCriteria(filterValue: string): RegExp[]; /** * Return whether the number of selected elements matches the total number of rows. */ isAllSelected(): boolean; /** * Called when the Clear button in the filter pop-up is clicked */ onClearFilter(): void; /** * Called whenever the value of the filter input of a column changes * @param columnName - The column whose filter input has changed * @param filterValue - The new value set to the filter input */ onColumnFilterChange(columnName: string, filterValue?: string): void; /** * Called whenever the sorting of any of the columns changes * @param column - The column whose sorting has changed */ onReorderChange(column: StarkColumnSortChangedOutput): void; /** * Open the multi-sort dialog to configure the multi-column sorting of the data */ openMultiSortDialog(): void; /** * Clear the sorting direction of every column in the table except for the given column (if any) * @param exceptColumn - Column whose sorting direction should not be cleared */ resetSorting(exceptColumn: StarkColumnSortChangedOutput): void; /** * @ignore */ private _resetSelection; /** * Sort the data according to the direction and priority (if any) defined for each column. * In case there is a compareFn defined for any of the columns then such method is called to perform the custom sorting. */ sortData(): void; /** * Get the filter value of the specified column. * @param columnName - Name of the column whose filter value should be retrieved. * @returns The filter value of the specified column or undefined in case it has no filter value defined. */ getColumnFilterValue(columnName: string): string | undefined; /** * Get the position of the filter box of the specified column. * @param columnName - Name of the column whose filter box position should be retrieved. * @returns The position of the filter box of the specified column. */ getColumnFilterPosition(columnName: string): StarkTableColumnFilter["filterPosition"]; /** * Get the sorting direction of the specified column. * @param columnName - Name of the column whose sorting direction should be retrieved. * @returns The sorting direction of the specified column. */ getColumnSortingDirection(columnName: string): StarkTableColumnSortingDirection; /** * Get the sorting priority of the specified column. * @param columnName - Name of the column whose sorting priority should be retrieved. * @returns The sorting priority of the specified column. */ getColumnSortingPriority(columnName: string): number | undefined; /** * Reset the filter value (global or per column) as long as the resetFilterOnDataChange (global or per column) option is enabled * @returns Whether the filter has been reset */ resetFilterValueOnDataChange(): boolean; /** * Check if a given row is inside the expandedRow. * @param row - The data object to check. * @returns boolean */ isRowInExpandedRows(row: T): boolean; /** * Gets the class for a specific row if a rowClassNameFn function has been given as an Input. * Also checks if the row is selected. * @param row - The data object passed to the row. * @param index - The index of the row. * @returns The classNames generated by the rowClassNameFn function */ getRowClasses(row: T, index: number): string; /** * Handles if a row is clicked. If there are listeners on the rowClick event of the table these should handle the event. * If there are no listeners we fall back to the default behaviour, which is (de)selecting the row (if rowsSelectable is enabled) * @param row - The data object passed to the row */ onRowClick(row: T): void; /** * Get the row index, based on its position in dataSource.data * @param row - Row to get index */ getRowIndex(row: any): number | undefined; /** * Toggles the visibility of a column * @param item - The item containing the name of the column */ toggleColumnVisibility(item: StarkMinimapItemProperties): void; /** * @ignore * Type guard */ private isArrayFilled; /** * @ignore */ trackColumnFn(_index: number, item: StarkTableColumnProperties): string; /** * @ignore * Type guard */ private isColumnPropertiesWithOnClickCallback; /** * @ignore * Type guard */ isGlobalFilterPresent(filter: StarkTableFilter): filter is StarkTableFilter & Required>; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "stark-table", never, { "columnProperties": { "alias": "columnProperties"; "required": false; }; "customTableActions": { "alias": "customTableActions"; "required": false; }; "customTableActionsType": { "alias": "customTableActionsType"; "required": false; }; "data": { "alias": "data"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "fixedHeader": { "alias": "fixedHeader"; "required": false; }; "htmlId": { "alias": "htmlId"; "required": false; }; "rowsSelectable": { "alias": "rowsSelectable"; "required": false; }; "multiSelect": { "alias": "multiSelect"; "required": false; }; "multiSort": { "alias": "multiSort"; "required": false; }; "orderProperties": { "alias": "orderProperties"; "required": false; }; "paginate": { "alias": "paginate"; "required": false; }; "minimap": { "alias": "minimap"; "required": false; }; "paginationConfig": { "alias": "paginationConfig"; "required": false; }; "showRowsCounter": { "alias": "showRowsCounter"; "required": false; }; "tableRowActions": { "alias": "tableRowActions"; "required": false; }; "expandedRows": { "alias": "expandedRows"; "required": false; }; "tableRowsActionBarConfig": { "alias": "tableRowsActionBarConfig"; "required": false; }; "rowClassNameFn": { "alias": "rowClassNameFn"; "required": false; }; "expandedRowFn": { "alias": "expandedRowFn"; "required": false; }; "selection": { "alias": "selection"; "required": false; }; "showRowIndex": { "alias": "showRowIndex"; "required": false; }; }, { "filterChanged": "filterChanged"; "paginationChanged": "paginationChanged"; "selectChanged": "selectChanged"; "rowClicked": "rowClicked"; }, ["expandedDetailTemplate", "customRowTemplate", "contentColumns"], ["header", ".stark-table-columns"], false, never>; }