diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index 0a5a1483c2..0687891657 100644 --- a/types/react-bootstrap-table/index.d.ts +++ b/types/react-bootstrap-table/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-bootstrap-table 4.0 +// Type definitions for react-bootstrap-table 4.1 // Project: https://github.com/AllenFang/react-bootstrap-table // Definitions by: Frank Laub , // Aleksander Lode , @@ -351,15 +351,15 @@ export interface BootstrapTableProps extends Props { /** * Enable row selection on table. SelectRow accept an object. */ - selectRow?: SelectRow; + selectRow?: SelectRow; /** * Enable cell editing on table. cellEdit accept an object which have the following properties */ - cellEdit?: CellEdit; + cellEdit?: CellEdit; /** * For some options setting on this component, you can set the options attribute and give an object which contain following properties */ - options?: Options; + options?: Options; /** * Used to specify the total number of rows (matching current filter/sort/size per page) in a remote data source. * Documented in examples, but missing from the main docs. Essential for remote data pagination calculations. @@ -428,7 +428,7 @@ export interface FooterData { formatter?(tableData: any[]): string | number | ReactElement; } -export interface SelectRow { +export interface SelectRow { /** * Specify whether the selection column uses single(radio) or multiple(checkbox) selection modes. Required. */ @@ -516,7 +516,7 @@ export interface SelectRow { * react-bootstrap-table supports cell editing. When you enable this feature, react-bootstrap-table will make * the target cell editable by either clicking or dbclicking (depending on the properties you set). */ -export interface CellEdit { +export interface CellEdit { /** * Spectify which condition will trigger cell editing.(click or dbclick). Required. */ @@ -560,7 +560,7 @@ export interface CellEdit { /** * Main Options for the Bootstrap Table. */ -export interface Options { +export interface Options { /** * Provide the name of the column that should be sorted by. * If multi-column sort is active, this is an array of columns. @@ -1193,9 +1193,14 @@ export interface TableHeaderColumnProps extends Props { */ tdAttr?: CustomAttrs; /** - * Allow you to add your custom style object on TD element. + * Allow you to add your custom style object on TD element. Accepts either a CSS Properties object, or + * a function that takes 4 arguments and returns a CSS Properties object. These arguments are: + * `cell`: The current cell value + * `row`: The current row data + * `rowIndex`: Index number for the current row data in the input data array. + * `columnIndex`: Index number for the current column that the cell is in. */ - tdStyle?: CSSProperties; + tdStyle?: CSSProperties | ((cell: any, row: any, rowIndex: number, columnIndex: number) => CSSProperties); /** * Allow you to add your custom style object on TH element. */ @@ -1372,7 +1377,7 @@ export interface TableHeaderColumnProps extends Props { */ customInsertEditor?: { getElement( - column: InsertModalColumnDescription, + column: InsertModalColumnDescription, attr: EditableAttrs, editorClass: string, ignoreEditable: boolean, @@ -1910,7 +1915,7 @@ export interface CustomSelectProps { * react-bootstrap-table source code to check what properties actually get passed to the * onSearchChange callback function. */ -export interface ColumnDescription { +export interface ColumnDescription { /** * Name of the column. * Comes from TableHeader.dataField property. @@ -2388,7 +2393,7 @@ export interface SearchFieldInterface { /** * Modal Column data passed to Options.insertModal and Options.insertModalBody. */ -export interface InsertModalColumnDescription { +export interface InsertModalColumnDescription { /** * Flag to indicate that this is the key field for the column. It is only present if there is more than * one column in the table. @@ -2530,7 +2535,7 @@ export interface InsertModalFooterProps { /** * Interface that must be implemented by a custom insert modal body component. */ -export interface ModalBodyInterface { +export interface ModalBodyInterface { /** * The required getFieldValue method that must be implemented on a customized insert modal body that returns the * new row data when the save button is clicked in the modal window. diff --git a/types/react-bootstrap-table/react-bootstrap-table-tests.tsx b/types/react-bootstrap-table/react-bootstrap-table-tests.tsx index f54a72f73b..edf2111b78 100644 --- a/types/react-bootstrap-table/react-bootstrap-table-tests.tsx +++ b/types/react-bootstrap-table/react-bootstrap-table-tests.tsx @@ -224,7 +224,7 @@ const thStyleExample = */ class ColumnHeaderSpanComplex extends React.Component { render() { - const options: Options<{}> = { exportCSVSeparator: '##' }; + const options: Options = { exportCSVSeparator: '##' }; return ( ID @@ -566,7 +566,7 @@ class CustomPagination extends React.Component { ) render() { - const options: Options<{}> = { + const options: Options = { paginationPanel: this.renderPagination }; @@ -973,7 +973,7 @@ class CustomButtonGroup extends React.Component { } render() { - const selectRow: SelectRow<{}> = { + const selectRow: SelectRow = { mode: 'checkbox', showOnlySelected: true };