tlojs
Version:
The Last One - The last npm package you'll need to install
48 lines (47 loc) • 1.26 kB
TypeScript
import { Type } from "../types/type";
import { TableExport } from "./export";
import { TableLoader } from "./loader";
import { TableQueryReference } from "./query";
import { TableRow } from "./row";
export interface TableOptions<T> {
data: T[];
}
export declare class Table<T> {
options: TableOptions<T>;
rows: TableRow<T>[];
constructor(options: TableOptions<T>);
/**
* Load data from a raw format into a table
* @param loader
* @param data
* @returns
*/
static load<T, K>(loader: Type<TableLoader<T, K>>, data: K): Table<T>;
/**
* Select a range in an excel-like manner and return a query of the table
* @param range
* @returns
*/
select(range: TableQueryReference): import("./query-results").TableQueryResults;
/**
* Empty the data from the table
*/
clear(): void;
/**
* Get a list of the headers
* @returns string[]
*/
getHeaders(): string[];
/**
* Sort the table by a column index
* @param columnIndex
* @param descending
*/
sort(columnIndex: number, descending?: boolean): void;
/**
* Export the table
* @param exporter
* @returns
*/
export<K>(exporter: Type<TableExport<T, K>>): K;
}