UNPKG

1.53 kBTypeScriptView Raw
1import { ComponentChild } from 'preact';
2import Row from './row';
3import { SortConfig } from './view/plugin/sort/sort';
4import { JSXInternal } from 'preact/src/jsx';
5import { Plugin } from './plugin';
6export type OneDArray<T> = T[];
7export type TwoDArray<T> = T[][];
8export type TCell = number | string | boolean | ComponentChild | HTMLElement;
9export type TDataArrayRow = OneDArray<TCell>;
10export type TDataArray = OneDArray<TDataArrayRow>;
11export type TDataObjectRow = {
12 [key: string]: TCell;
13};
14export type TDataObject = OneDArray<TDataObjectRow>;
15export type TData = TDataArray | TDataObject;
16export interface TColumn {
17 id?: string;
18 data?: ((row: TDataArrayRow | TDataObjectRow) => TCell) | TCell;
19 name?: string | ComponentChild;
20 plugin?: Plugin<any>;
21 width?: string;
22 minWidth?: string;
23 sort?: SortConfig;
24 columns?: OneDArray<TColumn>;
25 resizable?: boolean;
26 hidden?: boolean;
27 formatter?: (cell: TCell, row: Row, column: TColumn) => ComponentChild;
28 attributes?: ((cell: TCell | null, row: Row | null, column: TColumn) => JSXInternal.HTMLAttributes<HTMLTableCellElement>) | JSXInternal.HTMLAttributes<HTMLTableCellElement>;
29}
30export type Comparator<T> = (a: T, b: T) => number;
31export interface TColumnSort {
32 index: number;
33 direction?: 1 | -1;
34}
35export declare enum Status {
36 Init = 0,
37 Loading = 1,
38 Loaded = 2,
39 Rendered = 3,
40 Error = 4
41}
42export type CSSDeclaration = {
43 [key: string]: string | number;
44};