bs-datatable
Version:
A data table based on Bootstrap 5
122 lines (121 loc) • 4.78 kB
TypeScript
import { BSDataTableBase } from "./BSDataTableBase";
import '../services/string.extensions';
import { BSValidationService } from "../services";
import { BSDataTableCell } from "./BSDataTableCell";
import { BSDataTableColDefinition, BSEventHandler, BSSortingRequestEvent, BSConfigUpdatedEvent, BSColsReorderedEvent, BSFetchRecordEvent, BSDataTablePagingMetaData, BSDataTableOptions, BSEvent, BSFetchRecordErrorEvent, BSColumnSettings, IBSDataTableHttpClient } from "../commonTypes/common-types";
import { BSDataTablePagination } from "./BSDataTablePagination";
import { BSDataTableInfiniteScroll } from "./BSDataTableInfiniteScroll";
import { BSDataTableActions } from "./BSDataTableActions";
import { BSDataTableRow } from "./BSDataTableRow";
import { BSDataTableHeader } from "./BSDataTableHeader";
import { BSDataTableBody } from "./BSDataTableBody";
export declare class BSDataTable extends BSDataTableBase {
options: BSDataTableOptions;
head: BSDataTableHeader;
body: BSDataTableBody;
paginator: BSDataTablePagination;
httpClient: IBSDataTableHttpClient;
infiniteScroller: BSDataTableInfiniteScroll;
gridActions: BSDataTableActions;
discoverable: boolean;
containerElement: HTMLElement;
validationService: BSValidationService;
constructor(options: BSDataTableOptions);
notifyListeners(eventType: string, payload: BSEvent): void;
setDiscoverable(): void;
get dataSourceName(): string;
get isReadOnly(): boolean;
get dirtyRecords(): any[];
get allRecords(): any[];
/**
* @param {number} page
*/
paginatorCallback(page: number): void;
appendHeader(): void;
appendBody(): void;
getGridSettings(gridId: any): {
[x: string]: BSColumnSettings;
};
Render(): this;
addInfiniteScroll(): void;
appendActions(): void;
/**
* @param {BSDataTableCell} th
*/
addSorting(th: BSDataTableCell): void;
clearGrid(): void;
/**
* Apply visibility and size settings from store cookie.
* This helps the user not to re-arrange cols based on their needs all the time they open the screen
* @param {BSDataTableCell} col
* @param {any} settings
*/
applyColSettings(col: BSDataTableCell, settings: BSColumnSettings): void;
/**
* Apply column re-ordering based on the stored cookie
* This helps the user to not re-order the columns everytime they open the screen.
* @param {*} settings
* @returns {BSDataTableColDefinition[]}
*/
applyColOrdering(settings: {
[x: string]: BSColumnSettings;
}): BSDataTableColDefinition[];
/**
* @param {object[]} data
* @param {BSDataTablePagingMetaData} [metaData]
* @returns
*/
bindDataSource(data: object[], metaData: BSDataTablePagingMetaData): void;
/**
* @param {BSDataTablePagingMetaData} [paginationModel]
*/
bindPaginator(paginationModel?: BSDataTablePagingMetaData): void;
/**
* @param {object} rowData
* @param {boolean} isExistingRecord
*/
addNewRow(rowData: object, isExistingRecord: boolean): BSDataTableRow;
toDateDisplayFormat(date: Date): string;
toTimeDisplayFormat(date: Date): string;
/**
*
* @param {BSDataTableRow} row
* @param {*} e
* @returns
*/
onInputKeyDown(e: KeyboardEvent): void;
addEmptyRow(): BSDataTableRow;
createEmptyRowData(): {};
onHeaderNext(eventArgs: BSEvent, fetchGrid: boolean): void;
/**
* @param {number} pageIndex
*/
fetchGridPage(pageIndex: number): void;
onSaveRecord(eventArgs: BSEvent): void;
onSaveError(eventArgs: BSEvent): void;
getRowByIndex(index: number): BSDataTableRow;
/**
* @param {BSDataTableCell} th
* @param {boolean} ascX
*/
sortTable(th: BSDataTableCell, ascX: boolean): void;
onSortingRequest(eventArgs: BSSortingRequestEvent): void;
resetSorting(): void;
onColsReordered(eventArgs: BSColsReorderedEvent): void;
/**
* Add handler to the events raised by the data table
* @param eventName
* @param callback
* @param verifyDSName
*/
addHandler(eventName: string, callback: BSEventHandler, verifyDSName?: boolean): void;
removeHandler(eventName: string): void;
onFetchData(eventArgs: BSFetchRecordEvent): void;
onFetchDataError(eventArgs: BSFetchRecordErrorEvent): void;
RegisterCallbacks(verifyDSName?: boolean): this;
configurableGrid(): void;
resizableGrid(): void;
enableColumnReordering(): void;
onGridConfigurationChanged(eventArgs: BSConfigUpdatedEvent): void;
onGridDataBound(eventArgs: BSEvent): void;
}