From 4d98ee065e7a6c4d07845274f2ac13bed80f2de9 Mon Sep 17 00:00:00 2001 From: Janeene Beeforth Date: Mon, 27 Nov 2017 13:06:01 +1100 Subject: [PATCH] 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; } /**