mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[mui-datatables] Add types for string literal unions (#35972)
* Resolve merge conflicts * Update test to specify proper selectableRows value `selectableRows` takes a string literal union of `'none' | 'single' | 'multiple'` defined in type `SelectableRows`
This commit is contained in:
parent
271c20d6f4
commit
e92e72f419
20
types/mui-datatables/index.d.ts
vendored
20
types/mui-datatables/index.d.ts
vendored
@ -8,6 +8,12 @@
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export type Display = 'true' | 'false' | 'excluded';
|
||||
export type SortDirection = 'asc' | 'desc';
|
||||
export type FilterType = 'dropdown' | 'checkbox' | 'multiselect' | 'textField';
|
||||
export type Responsive = 'stacked' | 'scroll';
|
||||
export type SelectableRows = 'multiple' | 'single' | 'none';
|
||||
|
||||
interface MUIDataTableData {
|
||||
index: number;
|
||||
data: Array<object | number[] | string[]>;
|
||||
@ -97,15 +103,15 @@ export interface MUIDataTableTextLabels {
|
||||
}
|
||||
|
||||
export interface MUIDataTableColumnOptions {
|
||||
display?: 'true' | 'false' | 'excluded';
|
||||
display?: Display;
|
||||
empty?: boolean;
|
||||
filter?: boolean;
|
||||
filterList?: string[];
|
||||
filterOptions?: string[];
|
||||
filterType?: 'dropdown' | 'checkbox' | 'multiselect' | 'textField';
|
||||
filterType?: FilterType;
|
||||
sort?: boolean;
|
||||
searchable?: boolean;
|
||||
sortDirection?: 'asc' | 'desc';
|
||||
sortDirection?: SortDirection;
|
||||
print?: boolean;
|
||||
download?: boolean;
|
||||
viewColumns?: boolean;
|
||||
@ -135,7 +141,7 @@ export interface MUIDataTableOptions {
|
||||
elevation?: number;
|
||||
expandableRows?: boolean;
|
||||
filter?: boolean;
|
||||
filterType?: 'dropdown' | 'checkbox' | 'multiselect' | 'textField';
|
||||
filterType?: FilterType;
|
||||
fixedHeader?: boolean;
|
||||
isRowSelectable?: (dataIndex: number) => boolean;
|
||||
onCellClick?: (colData: any, cellMeta: { colIndex: number, rowIndex: number, dataIndex: number, event: React.MouseEvent }) => void;
|
||||
@ -155,13 +161,13 @@ export interface MUIDataTableOptions {
|
||||
print?: boolean;
|
||||
renderExpandableRow?: (rowData: string[], rowMeta: { dataIndex: number; rowIndex: number }) => React.ReactNode;
|
||||
resizableColumns?: boolean;
|
||||
responsive?: 'stacked' | 'scroll';
|
||||
responsive?: Responsive;
|
||||
rowHover?: boolean;
|
||||
rowsPerPage?: number;
|
||||
rowsPerPageOptions?: number[];
|
||||
rowsSelected?: any[];
|
||||
search?: boolean;
|
||||
selectableRows?: boolean;
|
||||
selectableRows?: SelectableRows;
|
||||
serverSide?: boolean;
|
||||
setRowProps?: (row: any[], rowIndex: number) => object;
|
||||
sort?: boolean;
|
||||
@ -263,7 +269,7 @@ export interface MUIDataTableHead {
|
||||
export interface MUIDataTableHeadCell {
|
||||
classes?: object;
|
||||
options: object;
|
||||
sortDirection?: 'asc' | 'desc';
|
||||
sortDirection?: SortDirection;
|
||||
toggleSort: (...args: any) => any;
|
||||
sort: boolean;
|
||||
hint: string;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import MUIDataTable, { MUIDataTableOptions, MUIDataTableTextLabels } from 'mui-datatables';
|
||||
import MUIDataTable, { MUIDataTableOptions, MUIDataTableTextLabels, SelectableRows } from 'mui-datatables';
|
||||
import * as React from 'react';
|
||||
|
||||
interface Props extends MUIDataTableOptions {
|
||||
@ -17,7 +17,7 @@ const MuiCustomTable: React.FC<Props> = (props) => {
|
||||
const TableOptions: MUIDataTableOptions = {
|
||||
filterType: 'checkbox',
|
||||
responsive: 'scroll',
|
||||
selectableRows: false,
|
||||
selectableRows: 'none',
|
||||
elevation: 0,
|
||||
rowsPerPageOptions: [5, 10, 20, 25, 50, 100],
|
||||
downloadOptions: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user