import * as i0 from "@angular/core"; import { EventEmitter, OnInit } from "@angular/core"; import { IAbstractSortState, IAbstractTableData } from "@hmcts/opal-frontend-common/components/abstract/abstract-sortable-table/interfaces"; import { SortDirectionType, SortableValuesType } from "@hmcts/opal-frontend-common/components/abstract/abstract-sortable-table/types"; import { AbstractTableFilterComponent } from "@hmcts/opal-frontend-common/components/abstract/abstract-table-filter"; export declare abstract class AbstractSortableTableComponent extends AbstractTableFilterComponent implements OnInit { private readonly sortService; /** * Synchronizes the sorted table data with the current filter and sort state. * * This effect observes changes to the filtered table data and the sort state signals. * If no active sort key is found (i.e., no sorting is applied), it sets the sorted table data * to a shallow copy of the filtered data. Otherwise, sorting logic should be applied elsewhere. * * @protected */ protected syncSortedDataEffect: import("@angular/core").EffectRef; displayTableDataSignal: import("@angular/core").WritableSignal[]>; filteredTableDataSignal: import("@angular/core").WritableSignal[]>; sortedTableDataSignal: import("@angular/core").WritableSignal[]>; abstractExistingSortState: IAbstractSortState | null; sortStateSignal: import("@angular/core").WritableSignal; sortedColumnTitleSignal: import("@angular/core").WritableSignal; sortedColumnDirectionSignal: import("@angular/core").WritableSignal; abstractSortState: EventEmitter; /** * Creates an initial sort state for a table based on the provided table data. * * @param tableData - Array of table data objects representing table rows. * @returns Initial sort state object with column names as keys and 'none' as values. */ private createSortState; /** * Initializes the sort state for the sortable table component. * * This method sets the initial sort state based on the existing sort state or creates a new one * if none exists. It then updates the sort state signal with the initial sort state. * * If an existing sort state is found, it iterates over each entry and triggers the sort change * for each key that has a sort type other than 'none'. * * @private * @returns {void} */ private initialiseSortState; /** * Updates the sort state for a given column key and sort type. * Resets the sort state for all other columns to 'none'. * * @param key - The column to sort by. * @param sortType - Sorting order ('ascending' or 'descending'). */ private updateSortState; /** * Retrieves the sorted table data based on the specified key and sort type. * * @param key - The key of the property to sort by. * @param sortType - The type of sorting to apply, either 'ascending' or 'descending'. * @returns An array of sorted table data objects. */ private getSortedTableData; /** * Determines the first column with a sort state other than 'none' and updates the sorted column signals accordingly. * * - If a sorted column is found, updates the `sortedColumnTitleSignal` and `sortedColumnDirectionSignal` with the column key and state. * - If no sorted column is found, sets the `sortedColumnTitleSignal` to an empty string and `sortedColumnDirectionSignal` to 'none'. * * @private * @returns {void} */ private getSortedColumn; /** * Handles the change in sorting for the table. * * @param event - An object containing the key to sort by and the sort type. * @param event.key - The key of the column to sort. * @param event.sortType - The type of sorting to apply ('ascending' or 'descending'). * * This method updates the sort state, sorts the table data based on the provided key and sort type, * updates the table data signal, and emits the updated sort state. */ protected onSortChange(event: { key: string; sortType: 'ascending' | 'descending'; }): void; /** * Lifecycle hook to initialise the sort state. */ ngOnInit(): void; /** * Applies the current filters to the table data and updates the sorted data accordingly. * * This method overrides the parent implementation to additionally handle sorting. * If there is an active sort key, it applies the corresponding sort to the filtered data. * If no sort key is active, it simply updates the sorted data to match the filtered data. * * @override */ onApplyFilters(): void; /** * Clears all filters applied to the table and restores the data to its unfiltered state. * If a sort is currently active, re-applies the sort after clearing filters. * Otherwise, resets the sorted table data to match the filtered data. * * @override */ clearAllFilters(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }