@uniquedj95/vtable
Version:
An advanced datatable for Ionic vue framework
76 lines • 3.29 kB
TypeScript
import { PaginationInterface, SortQueryInterface, TableColumnInterface } from "./types";
/**
* Retrieves an array of rows either from a getter function or the provided default rows.
*
* @param getter - An optional function to retrieve rows asynchronously.
* @param defaultRows - An array of default rows (empty by default).
* @param indexed - If true, adds an 'index' property to each row.
* @returns An array of rows.
*/
export declare function getRows(defaultRows: Array<any>, indexed?: boolean, getter?: Function): Promise<Array<any>>;
/**
* A function that sort table rows based on specified sort queries
*
* @param rows An array of data
* @param query an array of sort queries
* @returns sorted array
*/
export declare function sortRows(rows: any[], query: SortQueryInterface[]): any[];
/**
* Builds pagination information summary
*
* @param paginator The current pagination filter
* @param totalRows Total filtered rows
* @returns string
*/
export declare function buildPaginationInfo(paginator: PaginationInterface, totalRows: number): string;
/**
* Calculates the range of visible page numbers for pagination.
*
* @param paginator - The pagination settings.
* @param totalRows - The total number of rows.
* @param pages - An array of current visible page numbers.
* @returns The updated pagination settings.
*/
export declare function calculatePageRange(paginator: PaginationInterface, totalRows: number, pages: Array<number>): PaginationInterface;
/**
* Paginates an array of rows based on the provided pagination settings.
*
* @param rows - The array of rows to be paginated.
* @param paginator - The pagination settings.
* @returns The paginated array of rows.
*/
export declare function getActiveRows(rows: Array<any>, paginator: PaginationInterface): Array<any>;
/**
* Initializes sort queries based on column configurations.
*
* @param columns - An array of table columns.
* @returns An array of initial sort queries.
*/
export declare function initializeSortQueries(columns: Array<TableColumnInterface>): Array<SortQueryInterface>;
/**
* Updates the array of sort queries based on a specific column.
*
* @param sortQueries - The current array of sort queries.
* @param column - The column for which to update the sort query.
* @returns The updated array of sort queries.
*/
export declare function updateSortQueries(sortQueries: Array<SortQueryInterface>, column: TableColumnInterface): Array<SortQueryInterface>;
/**
* Filters an array of rows based on a query string.
*
* @param rows - The array of rows to be filtered.
* @param query - The query string for filtering.
* @returns The filtered array of rows.
*/
export declare function filterRows(rows: Array<any>, query: string): Array<any>;
/**
* Determines if a table column is drillable based on the provided column configuration, value, and row.
*
* @param column - The table column configuration object.
* @param value - The value in the table cell.
* @param row - The entire row data.
* @returns A boolean indicating whether the column is drillable.
*/
export declare function isDrillable(column: TableColumnInterface, value: any, row: any): boolean;
//# sourceMappingURL=utils.d.ts.map