@asup/simple-table
Version:
REACT table, because I wanted one that took an array of objects as an input.
77 lines (75 loc) • 3.06 kB
TypeScript
import React, { Key } from "react";
export interface ISimpleTableRow {
[key: string]: unknown;
}
export interface ISimpleTableSort {
name: string;
asc: boolean;
}
interface ISimpleTableHeaderRenderProps {
columnNumber: number;
field: ISimpleTableField;
}
export interface ISimpleTableCellRenderProps extends ISimpleTableHeaderRenderProps {
cellField: string;
rowData: ISimpleTableRow;
rowNumber: number;
}
export interface ISimpleTableField {
name: string;
label?: string;
hidden?: boolean;
width?: string;
sortFn?: (a: ISimpleTableRow, b: ISimpleTableRow, sortBy: ISimpleTableSort) => number;
searchFn?: (a: ISimpleTableRow, searchText: string) => boolean;
filterOutFn?: (a: ISimpleTableRow) => boolean;
headerRenderFn?: (a: ISimpleTableHeaderRenderProps) => React.ReactElement;
renderFn?: (a: ISimpleTableCellRenderProps) => React.ReactElement;
canColumnFilter?: boolean;
}
export const convertDateToLocaleString: (s: string | Date) => string;
export const columnFilterValue: (dataItem: unknown, showBlank?: boolean) => string;
interface SimpleTableProps extends React.ComponentPropsWithoutRef<"table"> {
id: string;
headerLabel?: string;
fields: ISimpleTableField[];
keyField: string;
data: ISimpleTableRow[];
selectable?: boolean;
currentSelection?: Key[];
setCurrentSelection?: (ret: Key[]) => void;
showHeader?: boolean;
showSearch?: boolean;
showFilter?: boolean;
showPager?: boolean;
initialFilterSelected?: boolean;
filterLabel?: string;
searchLabel?: string;
onWidthChange?: (ret: {
name: string;
width: string;
}[]) => void;
onPagerChange?: (ret: {
firstRow: number;
pageRows: number;
}) => void;
tableClassName?: string;
inputGroupClassName?: string;
filterLabelClassName?: string;
filterCheckClassName?: string;
searchLabelClassName?: string;
searchInputClassName?: string;
mainBackgroundColor?: string;
headerBackgroundColor?: string;
selectedBackgroundColor?: string;
selectInactiveColor?: string;
selectActiveColor?: string;
}
export const SimpleTable: {
({ id, headerLabel, fields, keyField, data, selectable, currentSelection, setCurrentSelection, showHeader, showSearch, showFilter, showPager, initialFilterSelected, filterLabel, searchLabel, onWidthChange, onPagerChange, tableClassName, inputGroupClassName, filterLabelClassName, filterCheckClassName, searchLabelClassName, searchInputClassName, mainBackgroundColor, headerBackgroundColor, selectedBackgroundColor, selectInactiveColor, selectActiveColor, ...rest }: SimpleTableProps): React.ReactElement;
displayName: string;
};
export const SimpleTableNullDate: ({ rowData, cellField, }: ISimpleTableCellRenderProps) => React.ReactElement;
export const convertLocaleDateToUTCString: (s: string) => string;
export const simpleTableSortFn: (a: ISimpleTableRow, b: ISimpleTableRow, sortBy: ISimpleTableSort) => number;
//# sourceMappingURL=simple-table.d.ts.map