UNPKG

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