mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
[react-table] add typings for selectTableHOC and treeTableHOC
This commit is contained in:
Vendored
+4
-1
@@ -1,6 +1,9 @@
|
||||
// Type definitions for react-table 6.7
|
||||
// Project: https://github.com/react-tools/react-table
|
||||
// Definitions by: Roy Xue <https://github.com/royxue>, Pavel Sakalo <https://github.com/psakalo>, Krzysztof Porębski <https://github.com/Havret>
|
||||
// Definitions by: Roy Xue <https://github.com/royxue>
|
||||
// Pavel Sakalo <https://github.com/psakalo>
|
||||
// Krzysztof Porębski <https://github.com/Havret>
|
||||
// Grzegorz Rozdzialik <https://github.com/Gelio>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
import * as React from 'react';
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { ComponentType } from 'react';
|
||||
|
||||
type HOC<OwnProps, AdditionalProps> = <Props extends OwnProps>(
|
||||
Component: ComponentType<Props>
|
||||
) => ComponentType<Props & AdditionalProps>;
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
import { ComponentType } from 'react';
|
||||
|
||||
import { TableProps } from '../../index';
|
||||
import { HOC } from './hoc-type';
|
||||
|
||||
export type SelectType = 'checkbox' | 'radio';
|
||||
|
||||
export interface SelectInputComponentProps {
|
||||
selectType: SelectType;
|
||||
onClick: (key: string, shiftKeyPressed: boolean, row: any) => any;
|
||||
checked: boolean;
|
||||
id: string;
|
||||
row: any;
|
||||
}
|
||||
|
||||
export interface SelectAllInputComponent {
|
||||
selectType: SelectType;
|
||||
checked: boolean;
|
||||
onClick: () => any;
|
||||
}
|
||||
|
||||
export interface SelectTableAdditionalProps {
|
||||
/**
|
||||
* Default: _id
|
||||
*/
|
||||
keyField?: string;
|
||||
|
||||
isSelected?: (key: string) => boolean;
|
||||
|
||||
selectAll?: boolean;
|
||||
|
||||
toggleAll?: SelectAllInputComponent['onClick'];
|
||||
|
||||
toggleSelection?: SelectInputComponentProps['onClick'];
|
||||
|
||||
/**
|
||||
* Default: checkbox
|
||||
*/
|
||||
selectType?: SelectType;
|
||||
|
||||
SelectInputComponent?: ComponentType<SelectInputComponentProps>;
|
||||
SelectAllInputComponent?: ComponentType<SelectAllInputComponent>;
|
||||
}
|
||||
|
||||
declare const selectTableHOC: HOC<
|
||||
Partial<TableProps>,
|
||||
SelectTableAdditionalProps
|
||||
>;
|
||||
|
||||
export default selectTableHOC;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import { ComponentType } from 'react';
|
||||
|
||||
import { TableProps } from '../../index';
|
||||
import { HOC } from './hoc-type';
|
||||
|
||||
interface TreeTableAdditionalProps {}
|
||||
|
||||
declare const treeTableHOC: HOC<Partial<TableProps>, TreeTableAdditionalProps>;
|
||||
|
||||
export default treeTableHOC;
|
||||
Reference in New Issue
Block a user