From 4d98ee065e7a6c4d07845274f2ac13bed80f2de9 Mon Sep 17 00:00:00 2001 From: Janeene Beeforth Date: Mon, 27 Nov 2017 13:06:01 +1100 Subject: [PATCH 1/2] Update react-bootstrap-table interface to 4.1.5. * Updated: beforeSaveCell and afterSaveCell now receive an extra parameter representing an object containing the current row & column index values. * New option: KeyboardNavigation now has an option for selecting/unselecting a row by pressing the 'Enter' key. * Bugfix: afterColumnFilter passes NumberFilterValue's number field as a string. --- types/react-bootstrap-table/index.d.ts | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index a07c49a764..92e0aadc1f 100644 --- a/types/react-bootstrap-table/index.d.ts +++ b/types/react-bootstrap-table/index.d.ts @@ -544,17 +544,33 @@ export interface CellEdit { * `cellName`: the column dataField cell name that has been modified. * `cellValue`: the new cell value. * `done`: a callback function to use if this is an async operation, to indicate if the save data is valid. + * `props`: an object containing the current cell's rowIndex and colIndex values. * If your validation is async, for example: you want to pop a confirm dialog for user to confim in this case, * react-bootstrap-table pass a callback function to you. You are supposed to call this callback function with a * bool value to perfom if it is valid or not in addition, you should return 1 from the main function to tell * react-bootstrap-table that this is a async operation. */ - beforeSaveCell?(row: TRow, cellName: K, cellValue: TRow[K], done: (isValid: boolean) => void): boolean | 1; + beforeSaveCell?( + row: TRow, + cellName: K, + cellValue: TRow[K], + done: (isValid: boolean) => void, + props: { rowIndex: number; colIndex: number } + ): boolean | 1; /** * Accept a custom callback function, after cell saving, this function will be called. * This callback function takes three arguments: row, cellName and cellValue + * `row`: the row data that was saved. + * `cellName`: the column dataField cell name that has been modified. + * `cellValue`: the new cell value. + * `props`: an object containing the current cell's rowIndex and colIndex values. */ - afterSaveCell?(row: TRow, cellName: K, cellValue: TRow[K]): void; + afterSaveCell?( + row: TRow, + cellName: K, + cellValue: TRow[K], + props: { rowIndex: number; colIndex: number } + ): void; } /** @@ -1713,7 +1729,7 @@ export type Filter = TextFilter | SelectFilter | RegexFilter | NumberFilter | Da * The "value" type for a number filter */ export interface NumberFilterValue { - number: number; + number: number | string; comparator: FilterComparator; } @@ -1834,6 +1850,10 @@ export interface KeyboardNavigation { * When set to true, pressing ENTER will expand or collapse the current row. */ enterToExpand?: boolean; + /** + * When set to true, pressing ENTER will select or unselect the current row. + */ + enterToSelect?: boolean; } /** From 5ecf6be1032afa63e6e8fa13b0328294d70a15ce Mon Sep 17 00:00:00 2001 From: Janeene Beeforth Date: Thu, 7 Dec 2017 21:15:29 +1100 Subject: [PATCH 2/2] Add documented updates for 4.2.0 --- types/react-bootstrap-table/index.d.ts | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index 92e0aadc1f..9bc4fa1948 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.1 +// Type definitions for react-bootstrap-table 4.2 // Project: https://github.com/AllenFang/react-bootstrap-table // Definitions by: Frank Laub , // Aleksander Lode , @@ -400,6 +400,10 @@ export interface BootstrapTableProps extends Props { * Table footer custom class */ tableFooterClass?: string; + /** + * Render react-s-alert notifications + */ + renderAlert?: boolean; } /** @@ -550,7 +554,7 @@ export interface CellEdit { * bool value to perfom if it is valid or not in addition, you should return 1 from the main function to tell * react-bootstrap-table that this is a async operation. */ - beforeSaveCell?( + beforeSaveCell?( row: TRow, cellName: K, cellValue: TRow[K], @@ -580,11 +584,13 @@ 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. + * If there should be no active sort, both sortName and sortOrder should be undefined. */ sortName?: keyof TRow | Array; /** * Specify whether the sort should be ascending or descending. * If multi-column sort is active, this is an array of sortOrder items. + * If there should be no active sort, both sortName and sortOrder should be undefined. */ sortOrder?: SortOrder | SortOrder[]; /** @@ -707,17 +713,20 @@ export interface Options { onDeleteRow?(rowKeys: ReadonlyArray, rows: ReadonlyArray): void; /** * Assign a callback function which will be called after a row click. - * This function takes three arguments: + * This function takes four arguments: * `row`: which is the row data that was clicked on. * `columnIndex`: index of the column that was clicked on. * `rowIndex`: index of the row that was clicked on. + * `event`: the click event. */ - onRowClick?(row: TRow, columnIndex: number, rowIndex: number): void; + onRowClick?(row: TRow, columnIndex: number, rowIndex: number, event: React.MouseEvent): void; /** * Assign a callback function which will be called after a row double click. - * This function takes one argument: row which is the row data that was double clicked on. + * This function takes two arguments: + * `row`: which is the row data that was double clicked on. + * `event`: the double click event. */ - onRowDoubleClick?(row: TRow): void; + onRowDoubleClick?(row: TRow, event: React.MouseEvent): void; /** * Assign a callback function which will be called when mouse enters the table. */ @@ -1045,12 +1054,12 @@ export interface Options { */ exportCSVSeparator?: string; /** - * Set a function to be called when expanding or collapsing a row. This function takes two arguments: rowKey - * and isExpand. + * Set a function to be called when expanding or collapsing a row. This function takes three arguments: * `rowKey`: dataField key for the row that is expanding or collapsing. * `isExpand`: True if the row is expanding, false if it is collapsing. + * `event`: The click event. */ - onExpand?(rowKey: number | string, isExpand: boolean): void; + onExpand?(rowKey: number | string, isExpand: boolean, event: React.MouseEvent): void; /** * Specify that only one row should be able to be expanded at the same time. */