forked from DefinitelyTyped/DefinitelyTyped
/
index.d.ts
2689 lines (2603 loc) · 87.7 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for react-bootstrap-table 4.3
// Project: https://github.com/AllenFang/react-bootstrap-table
// Definitions by: Frank Laub <https://github.com/flaub>,
// Aleksander Lode <https://github.com/alelode>,
// Josué Us <https://github.com/UJosue10>
// Janeene Beeforth <https://github.com/dawnmist>
// Oscar Andersson <https://github.com/Ogglas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
// documentation taken from http://allenfang.github.io/react-bootstrap-table/docs.html
import { Component, CSSProperties, Props, ReactElement, SyntheticEvent } from 'react';
/**
* Table scroll position.
*/
export type ScrollPosition = 'Top' | 'Bottom';
/**
* Row selection mode. Single selection = 'radio', multiple selection = 'checkbox'.
*/
export type SelectRowMode = 'none' | 'radio' | 'checkbox';
/**
* Sort Order values. 'asc' = ascending, 'desc' = descending.
*/
export type SortOrder = 'asc' | 'desc';
/**
* Type of selection for cell editing.
*/
export type CellEditClickMode = 'none' | 'click' | 'dbclick';
/**
* Tell react-bootstrap-table how to trigger expanding by clicking on 'row' or 'column' level.
* If the value is 'column', by default all the columns are expandable. If you want to specify some columns as
* unexpandable, check expandable.
* Default is 'row'.
*/
export type ExpandBy = 'row' | 'column';
/**
* Used to specify whether a dropdown button should use 'dropup' mode or 'dropdown' mode.
* Default is usually 'dropdown'.
*/
export type DropDirection = 'dropdown' | 'dropup';
/**
* List of valid filter types.
* Note: ArrayFilter can only be used as part of the FilterData passed to the BootstrapTable.handleFilterData
* function. It is NOT valid for use when specifying a filter to the TableHeaderColumn filter properties.
*/
export type FilterType =
| 'TextFilter'
| 'RegexFilter'
| 'SelectFilter'
| 'NumberFilter'
| 'DateFilter'
| 'CustomFilter'
| 'ArrayFilter';
/**
* Filter conditions that can be used with TextFilter/SelectFilter/RegexFilter filters.
*/
export type FilterCondition = 'eq' | 'like';
/**
* Filter comparators used for NumberFilter/DateFilter filters
*/
export type FilterComparator = '=' | '<' | '<=' | '>' | '>=' | '!=';
/**
* Element type to use for editing a particular column's cells.
*/
export type EditCellType = 'textarea' | 'select' | 'checkbox' | 'datetime';
/**
* Position to show the Pagination Panel. Options are above the table ('top'), below the table ('bottom'), or both
* above and below the table ('both').
*/
export type PaginationPostion = 'top' | 'bottom' | 'both';
/**
* Result type for validation when editing.
*/
export type EditValidatorType = 'success' | 'error';
/**
* Used to specify the text alignment for a column.
*/
export type DataAlignType = 'left' | 'center' | 'right' | 'start' | 'end';
/**
* Boostrap version number.
*/
export type BootstrapVersion = '3' | '4';
/**
* CSV Field types supported.
*/
export type CSVFieldType = 'string' | 'number';
/**
* Custom attributes for a column/cell/etc.
* Example: { 'data-attr': 'test' }
*/
export interface CustomAttrs {
[attrKey: string]: string | number | boolean;
}
/**
* Size per page list definition
*/
export type SizePerPageList = number[] | Array<{ text: string, value: number }>;
/**
* Interface spec for sepcifying functionality to handle remotely
*
* Consult [documentation](https://allenfang.github.io/react-bootstrap-table/docs.html#remote)
* for more info
*/
export interface RemoteObjSpec {
/**
* If set, cell edits will be handled remotely
*/
cellEdit?: boolean;
/**
* If set insertions will be handled remotely
*/
insertRow?: boolean;
/**
* If set deletion will be handled remotely
*/
dropRow?: boolean;
/**
* If set filters will be handled remotely
*/
filter?: boolean;
/**
* If set search will be handled remotely
*/
search?: boolean;
/**
* If set, exporting CSV will be handled remotely
*/
exportCSV?: boolean;
/**
* If set sorting will be handled remotely
*/
sort?: boolean;
/**
* If set pagination will be handled remotely
*/
pagination?: boolean;
}
export interface BootstrapTableProps extends Props<BootstrapTable> {
/**
* Bootstrap version to use, values include '3' or '4'. Defaults to '3'.
*/
version?: BootstrapVersion;
/**
* Use data to specify the data that you want to display on table.
*/
data: object[];
/**
* Normally, react-bootstrap-table handles all the data sorting/filtering/pagination/etc itself internally.
* If this is true, you need to handle all of those manually outside the table. By default it is false.
* This is used mostly with an external/central data store, for example Redux or a database that returns
* already filtered/sorted/paged data.
*
* If a function given, which means you can choose which functionality should be handled with remote or not.Currently,
* we have following functionality you can control: sort, pagination, cellEdit, insertRow, dropRow, filter, search,
* exportCSV.
*/
remote?: boolean | ((remobeObj: RemoteObjSpec) => RemoteObjSpec);
/**
* Use keyField to tell table which column is unique. This is same as isKey in <TableHeaderColumn>
* Tips: react-bootstrap-table support data manipulation(CRUD) so that we need to fetch correct row by a unique column.
* You need choose one of configuration to set the key field: isKey or keyField in <BootstrapTable>.
*/
keyField?: string;
/**
* Use height to set the height of table, default is 100%. The string needs to have a unit, e.g. 'px', '%'.
*/
height?: string;
/**
* Set the maximum height of table. You need give a string with an unit(px) value like height.
*/
maxHeight?: string;
/**
* Enable striped by setting striped to true. Same as Bootstrap table class .table-striped, default is false.
*/
striped?: boolean;
/**
* Enable hover by setting hover to true. Same as Bootstrap table class .table-hover, default is false.
*/
hover?: boolean;
/**
* Enable condensed by setting condensed to true. Same as Bootstrap table class .table-condensed, default is false.
*/
condensed?: boolean;
/**
* Become a borderless table by setting bordered to false, default is true.
*/
bordered?: boolean;
/**
* Enable pagination by setting pagination to true, default is false.
*/
pagination?: boolean;
/**
* Assign the class name of row(tr). This attribute accept a string or function and function is a better way to do more customization.
* If a string given, means the value will be presented as the row class.
* If a function given, will pass rowData and rowIndex as params and should return string for presenting class. for examples:
* @example
* function trClassFormat(rowData,rowIndex) {
* return rowIndex % 2 == 0 ? "tr-odd" : "tr-even"; // return a class name.
* }
*/
trClassName?: string | ((rowData: any, rowIndex: number) => string);
/**
* Enable row insertion by setting insertRow to true, default is false.
* If you enable row insertion, there's a button on the upper left side of table.
*/
insertRow?: boolean;
/**
* Enable row deletion by setting deleteRow to true, default is false.
* If you enable row deletion, there's a button on the upper left side of table.
*/
deleteRow?: boolean;
/**
* Enable column filter by setting columnFilter to true, default is false.
* If enabled, there're input text field per column under the table, user can input your filter condition by each column.
*/
columnFilter?: boolean;
/**
* Enable search by setting search to true, default is false.
* If enabled, there is a on the upper left side of the table. The default place holder is Search
*/
search?: boolean;
/**
* Set searchPlaceholder to change the placeholder in search field, default is Search.
*/
searchPlaceholder?: string;
/**
* Strict search. Set this flag to apply search terms so that only rows that contain ALL terms are included in the
* search results.
*/
strictSearch?: boolean;
/**
* Enable multi search by multiColumnSearch, default is false.
* If you want to use multi search, you must enable search at first.
* Tips: Use space to delimited search text. EX: 3 4, which means match all 3 or 4 datas in table.
*/
multiColumnSearch?: boolean;
/**
* Enable export csv function, default is false.
* If you enable, there's a button on the upper left side of table.
*/
exportCSV?: boolean;
/**
* Set CSV filename (e.g. items.csv). Default is spreadsheet.csv
*/
csvFileName?: string | (() => string);
/**
* If true, it will hide the pagination if there is only one page, default is false.
*/
ignoreSinglePage?: boolean;
/**
* Specify a fix position for the vertical bar if it exist. Available is a number or Top and Bottom
*/
scrollTop?: number | ScrollPosition;
/**
* Add css styles to the react-bs-table-container class.
* For example: containerStyle={ { background: '#00ff00' } }
*/
containerStyle?: CSSProperties;
/**
* Add css styles to the react-bs-table class.
*/
tableStyle?: CSSProperties;
/**
* Add css styles to the react-bs-container-header class.
*/
headerStyle?: CSSProperties;
/**
* Add css styles to the react-bs-container-body class.
*/
bodyStyle?: CSSProperties;
/**
* Add your own class names on the react-bs-table-container class
*/
containerClass?: string;
/**
* Add your own class names on the react-bs-table class
*/
tableContainerClass?: string;
/**
* Add your own class names on the react-bs-container-header class
*/
headerContainerClass?: string;
/**
* Add your own class names on the react-bs-container-body class
*/
bodyContainerClass?: string;
/**
* react-bootstrap-table separate two table element as header and body.
* The tableHeaderClass is for the table element in the header
*/
tableHeaderClass?: string;
/**
* react-bootstrap-table separate two table element as header and body.
* The tableBodyClass is for the table element in the body
*/
tableBodyClass?: string;
/**
* Tell react-bootstrap-table which rows are able to expand. This prop accepts
* a callback function and is suppose to be return an Array of row keys.
* expandableRow is always used with expandComponent, both of props are enable
* the expand row functionality on table.
*/
expandableRow?(row: any): boolean;
/**
* Tell react-bootstrap-table what's content should be rendered in the expanding
* content. This props accept a callback function and is suppose to be return JSX
* or String.
* expandComponent is always used with expandableRow, both of props are enable
* the expand row functionality on table.
*/
expandComponent?(row: any): string | ReactElement<any>;
/**
* Assign some alternative options for expand row feature, expandColumnOptions
* only have four available property currently.
*/
expandColumnOptions?: ExpandColumnOptions;
/**
* Enable the multi sort on table and the number value is means max number of sorting column.
*/
multiColumnSort?: number;
/**
* This prop will enable/disable the keyboard navigation cell by cell on table. This is new
* feature from 3.0.0. Default is false. You can have a basic and simple keyboard navigation
* feature on table by enabling keyBoardNav on BootstrapTable. For the usage of keyboard
* navigation is you can click any cell to focus in or use ⬅ ⬆ ⬇ ➡ to natigate the cell.
*
* But if you want more advance features for keyboard navigation or to integrate with cell
* editing, expand row or selection row, you may get interested to see how they work well
* together: In the advance cases, you need to configure keyBoardNav as an object.
*/
keyBoardNav?: boolean | KeyboardNavigation;
/**
* Enable row selection on table. SelectRow accept an object.
*/
selectRow?: SelectRow;
/**
* Enable cell editing on table. cellEdit accept an object which have the following properties
*/
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;
/**
* 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.
*/
fetchInfo?: FetchInfo;
/**
* Automatically collapses open rows when doing a sort/filter/search action if those options have been specified.
* Is an object with three possible fields: sort, filter, search. Each field is a flag to specify whether that
* action type should cause expanded rows to close. All three fields default to false.
*/
autoCollapse?: {
sort?: boolean;
filter?: boolean;
search?: boolean;
};
/**
* Set a style to be used for the table rows. Example: https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/style/tr-style-table.js
*/
trStyle?: CSSProperties | ((rowData: any, rowIndex: number) => CSSProperties);
/**
* Disable the automatic tabIndex for navigating between cells. This can be useful if you have a page with multiple
* tables on the page, to stop the tab moving to another table. Default is false.
*/
withoutTabIndex?: boolean;
/**
* Disable writing the header row when exporting to a CSV file.
*/
excludeCSVHeader?: boolean;
/**
* Add a footer to the table.
*/
footer?: boolean;
/**
* Data for the table footer. Format is an array of footer rows, each containing an array of column footer data.
*/
footerData?: FooterData[][];
/**
* Table footer custom class
*/
tableFooterClass?: string;
/**
* Render react-s-alert notifications
*/
renderAlert?: boolean;
}
/**
* Footer Data for a column.
*/
export interface FooterData {
/**
* Title to display for the column footer
*/
label: string;
/**
* Index for the column that this footer belongs to
*/
columnIndex: number;
/**
* Text alignment for the data in this footer.
*/
align?: DataAlignType;
/**
* Formatting function for the data in this footer. Used to be able to do things like sum the contents of this
* column in the table so that the footer can be used for totals, etc.
*
* The output value from the formatter function will be used instead of the label if the formatter function is
* defined.
*/
formatter?(tableData: any[]): string | number | ReactElement<any>;
}
export interface SelectRow<TRow extends object = any> {
/**
* Specify whether the selection column uses single(radio) or multiple(checkbox) selection modes. Required.
*/
mode: SelectRowMode;
/**
* If true, clicking the row will trigger selection on that row, default is false.
*/
clickToSelect?: boolean;
/**
* If true, clicking the row will trigger selection on that row and also trigger cell editing if you enabled cell edit. Default is false.
*/
clickToSelectAndEditCell?: boolean;
/**
* If true, clicking the row will trigger expanding the row. Default is false.
*/
clickToExpand?: boolean;
/**
* You can assign the background color of row which be selected.
* If your requirement is much complex, you can assign a function to bgColor that
* returns a css color string.
*/
bgColor?: string | ((row: TRow, isSelect: boolean) => string);
/**
* You can change the width of the selection column by columnWidth (include units).
*/
columnWidth?: string;
/**
* You can assign the class name of selected rows. This can either be a string, or a function that takes two
* arguments: row and isSelect.
* `row`: The current row data.
* `isSelect`: Flag indicating whether this particular row is selected.
*/
className?: string | ((row: TRow, isSelect: boolean) => string);
/**
* Give an array data to perform which rows you want to be selected when table loading.
* The content of array should be the rowkeys for the rows that you want to be selected.
*/
selected?: Array<number | string>;
/**
* Provide a list of unselectable row keys.
*/
unselectable?: Array<number | string>;
/**
* If true, the radio/checkbox column will be hidden.
* You can enable this attribute if you enable clickToSelect and you don't want to show the selection column.
*/
hideSelectColumn?: boolean;
/**
* Default is false, if enabled, there will be a button on top of table for toggling selected rows only.
*/
showOnlySelected?: boolean;
/**
* Accept a custom callback function, if a row be selected or unselected, this function will be called.
* This callback function takes four arguments: row, isSelected, event, and rowIndex:
* `row`: is the row data which you wanted to select or unselect.
* `isSelected`: it's a boolean value means "whether or not that row will be selected?".
* `event`: The event target object.
* `rowIndex`: the index number for the row.
* If the return value of this (function) is false, the select or deselect action will not be applied.
*/
onSelect?(row: TRow, isSelected: boolean, event: any, rowIndex: number): boolean | void;
/**
* Accept a custom callback function, if click select all checkbox, this function will be called. This callback
* function taking two arguments: isSelected, rows.
* isSelectedis a boolean value which means "whether or not that row will be selected?".
* rows is the rows which be selected or unselected.
*
* Tips:
* If the return value of this function is false, the select all or deselect all action will not be applied.
* If return value of this function is an array of rowkeys, this array will be applied as selection row when
* select all triggers. It's useful when you have a validation to filter some rows on selecting all.
*/
onSelectAll?(isSelected: boolean, rows: TRow[]): boolean | Array<number | string>;
/**
* Function that returns a component to customize the display of the selection checkbox or radio button with.
*/
customComponent?(props: CustomSelectProps): string | ReactElement<any>;
/**
* Only unselect visible rows.
*/
onlyUnselectVisible?: boolean;
}
/**
* 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<TRow extends object = any> {
/**
* Spectify which condition will trigger cell editing.(click or dbclick). Required.
*/
mode: CellEditClickMode;
/**
* Enabling blurToSave will trigger a saving event on the cell when the input field becomes deselected. Default is false.
* In the default condition, you need to press ENTER to save the cell.
*/
blurToSave?: boolean;
/**
* Enabling blurToEscape will result in a cell edit being cancelled when the user clicks outside the table during
* editing.
* Default is false.
*/
blurToEscape?: boolean;
/**
* nonEditableRows tell react-bootstrap-table which rows should not be edited on all of the columns. Briefly, its a row level limitation
* Please assign a callback function, and this function is supposed to be return an array of row keys.
*/
nonEditableRows?(): Array<number | string>;
/**
* Accept a custom callback function, before cell saving, this function will be called.
* This callback function takes four arguments: row, cellName, cellValue and done.
* `row`: the row data to be saved.
* `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?<K extends keyof TRow>(
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?<K extends keyof TRow>(
row: TRow,
cellName: K,
cellValue: TRow[K],
props: { rowIndex: number; colIndex: number }
): void;
}
/**
* Main Options for the Bootstrap Table.
*/
export interface Options<TRow extends object = any> {
/**
* 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<keyof TRow>;
/**
* 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[];
/**
* Specify the default sort column.
* Note: when using cleanSort(), this default sort column will be restored.
*/
defaultSortName?: keyof TRow;
/**
* Assign a default sort order.
* Note: when using cleanSort(), this default sort order will be restored.
*/
defaultSortOrder?: SortOrder;
/**
* Set to false to disable sort indicators on header columns, default is true.
*/
sortIndicator?: boolean;
/**
* Assign a callback function which will be called after triggering sorting.
* This function takes two argument: `sortName` and `sortOrder`.
* `sortName`: The sort column name, or array of column names if multi-column sort is active.
* `sortOrder`: The sort ordering, or array of ordering if multi-column sort is active.
*/
onSortChange?:
| ((sortName: keyof TRow, sortOrder: SortOrder) => void)
| ((sortName: ReadonlyArray<keyof TRow>, sortOrder: ReadonlyArray<SortOrder>) => void);
/**
* Change the text displayed on the table if data is empty.
*/
noDataText?: string | ReactElement<any>;
/**
* If true, this hides the noDataText on the table when the tableis empty. Default is false.
*/
withoutNoDataText?: boolean;
/**
* A delay for trigger search after a keyup (millisecond)
*/
searchDelayTime?: number;
/**
* Only work on enable search. If true, there will be a button beside the search input field
* that will empty the field when clicked.
*/
clearSearch?: boolean;
/**
* Set the default search condition.
*/
defaultSearch?: string;
/**
* Assign a callback function which will be called when search text changes. This function takes
* three argument:
* `searchText`: the text from the search field.
* `colInfos`: Array of column settings (e.g. filterFormatted, etc).
* `multiColumnSearch`: True if multiple column search is enabled.
* In most cases, you only need to use searchText. This function usually used for remote searching.
*/
onSearchChange?(searchText: string, colInfos: ReadonlyArray<ColumnDescription<TRow>>, multiColumnSearch: boolean): void;
/**
* Assign a callback function which will be called after triggering searching.
* This function takes two argument: search and result.
* `search`: The search text from the user.
* `result`: The results after searching (array of rows that matched the search).
*/
afterSearch?(search: string, result: ReadonlyArray<TRow>): void;
/**
* Default is false, if true means you want to ignore any editable columns when creating the insert form.
*/
ignoreEditable?: boolean;
/**
* Assign a callback function that will be called after table updates.
*/
afterTableComplete?(): void;
/**
* Assign a callback function which will be called after row delete.
* This function takes two arguments:
* `rowKeys`: which means the row keys for the deleted rows
* `rows`: the array of row data that was deleted.
*/
afterDeleteRow?(rowKeys: ReadonlyArray<number | string>, rows: ReadonlyArray<TRow>): void;
/**
* Assign a callback function which will be called after inserting a row.
* This function takes one argument: row, which means the whole row data you added.
*/
afterInsertRow?(row: TRow): void;
/**
* Assign a callback function which will be called after triggering column filtering.
* This function takes two arguments: filterConds and result.
* `filterConds`: It's an array object which contain all column filter conditions.
* `result`: The results after filtering.
*
* This function only work when you enable columnFilter on <BootstrapTable> or define
* a filter on <TableHeaderColumn>.
*/
afterColumnFilter?(filterConds: ReadonlyArray<FilterData>, result: ReadonlyArray<TRow>): void;
/**
* Assign a callback function which will be called when a row is added. This function
* takes three arguments:
* `row`: which represents the new row data
* `colInfos`: Array of Column Descriptions for the table.
* `errorCallback`: Function to call to provide an async error message if the Add fails.
* The function should either return a string immediately, or return false and then return a string through the
* error callback function later.
*/
onAddRow?(row: TRow, colInfo: ReadonlyArray<ColumnDescription<TRow>>, errorCallback: (message: string) => void): string | boolean;
/**
* Assign a callback function which will be called when a filter condition changes.
* This function takes one argument: filterObj which is an object which take dataField
* as object key and the value is the filter condition.
*/
onFilterChange?(filterObject: FilterData): void;
/**
* Assign a callback function which will be called when the export csv button is clicked.
* In this function, you need to return an array of rows to be exported.
*/
onExportToCSV?(): TRow[];
/**
* Assign a callback function which will be called when a row been deleted.
* This function takes two arguments:
* `rowKeys`: keys for the rows to be deleted.
* `rows`: row data for the rows to be deleted.
*/
onDeleteRow?(rowKeys: ReadonlyArray<number | string>, rows: ReadonlyArray<TRow>): void;
/**
* Assign a callback function which will be called after a row click.
* 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, event: React.MouseEvent<any>): void;
/**
* Assign a callback function which will be called after a row double click.
* This function takes two arguments:
* `row`: which is the row data that was double clicked on.
* `event`: the double click event.
*/
onRowDoubleClick?(row: TRow, event: React.MouseEvent<any>): void;
/**
* Assign a callback function which will be called when mouse enters the table.
*/
onMouseEnter?(): void;
/**
* Assign a callback function which will be called when mouse leaves the table.
*/
onMouseLeave?(): void;
/**
* Assign a callback function which will be called when the mouse enters a row in table.
* This function takes two arguments:
* `row`: the row data the mouse entered
* `e`: the mouse event data
*/
onRowMouseOver?(row: TRow, e: React.MouseEvent<any>): void;
/**
* Assign a callback function which will be called when mouse leaves a row in table.
* This function takes two arguments:
* `row`: the row data the mouse entered
* `e`: the mouse event data
*/
onRowMouseOut?(row: TRow, e: React.MouseEvent<any>): void;
/**
* Assign a callback function which will be called when deleting a row.
* It gives you a chance to customize your confirmation for row deletion.
* This function takes two argument: next and rowKeys:
* `next`: If you confirm the delete, call next() to continue the process.
* `rowKeys` Is the row keys to be deleted, you can call the `next` function to apply this deletion.
*/
handleConfirmDeleteRow?(next: () => void, rowKeys: ReadonlyArray<number | string>): void;
/**
* Customize the text of previouse page button.
* If using the default pagination panel, this should be a string to use for the button label.
* If creating a custom pagination panel, this is passed to the panel and can be of any type desired.
*/
prePage?: any;
/**
* Customize the text of next page button.
* If using the default pagination panel, this should be a string to use for the button label.
* If creating a custom pagination panel, this is passed to the panel and can be of any type desired.
*/
nextPage?: any;
/**
* Customize the text of first page button.
* If using the default pagination panel, this should be a string to use for the button label.
* If creating a custom pagination panel, this is passed to the panel and can be of any type desired.
*/
firstPage?: any;
/**
* Customize the text of last page button.
* If using the default pagination panel, this should be a string to use for the button label.
* If creating a custom pagination panel, this is passed to the panel and can be of any type desired.
*/
lastPage?: any;
/**
* Accept a number, which means the page you want to show as default.
*/
page?: number;
/**
* You can change the dropdown list for size per page if you enable pagination.
* Default is [10, 25, 30, 50].
*/
sizePerPageList?: SizePerPageList;
/**
* Current chosen size per page.
*/
sizePerPage?: number;
/**
* Number of page buttons to show on the pagination bar, default is 5.
* i.e. previous 2 pages + current page + next two pages = 5.
*/
paginationSize?: number;
/**
* Hide the dropdown list for size per page, default is false.
*/
hideSizePerPage?: boolean;
/**
* Display a short text showing the total number of rows and current lines displayed,
* default is false. If you want to customize this short text, you can give a function
* and this function take three arguments:
* `start`: Current start index
* `to`: Current end index
* `total`: The total data volume.
*/
paginationShowsTotal?: boolean | ((start: number, to: number, total: number) => string | ReactElement<any>);
/**
* Allows you to modify where to start counting the pages, e.g. to set the first page number to 0.
* Default is 1.
*/
pageStartIndex?: number;
/**
* Assign a callback function which will be called after page changed.
* This function takes two argument: page and sizePerPage.
* `page`: New page number
* `sizePerPage`: The number of rows to display in one page.
*/
onPageChange?(page: number, sizePerPage: number): void;
/**
* Assign a callback function which will be called after the size per page (number of rows per page)
* has been changed.
* This function takes one argument: sizePerPage.
* `sizePerPage`: The new number of rows to display in one page.
*/
onSizePerPageList?(sizePerPage: number): void;
/**
* Default is false. If true, the pagination list will be hidden when there is only one page.
*/
hidePageListOnlyOnePage?: boolean;
/**
* Background color on expanded rows (css color value).
*/
expandRowBgColor?: string;
/**
* Expand all rows
*/
expandAll?: boolean;
/**
* Tell react-bootstrap-table how to trigger expanding by clicking on 'row' or 'column' level.
* If the value is 'column', by default all the columns are expandable. If you want to specify some columns as
* unexpandable, check expandable.
* Default is 'row'.
*/
expandBy?: ExpandBy;
/**
* Customize the text on the insert button.
*/
insertText?: string;
/**
* Customize the text on the delete button.
*/
deleteText?: string;
/**
* Customize the text on the save button in the insert modal.
*/
saveText?: string;
/**
* Customize the text on the close button in the insert modal.
*/
closeText?: string;
/**
* Customize the text on the export csv button
*/
exportCSVText?: string;
/**
* You can do something before the toastr pop or even disable the toastr!!
* Returning false or void will not trigger the toastr.
* If you want the toastr popup, you should return true always.
* Inputs match the EditValidatorObject.notification field types.
*/
beforeShowError?(type: EditValidatorType, msg: string, title: string): boolean | void;
/**
* Default is true. If false, during printing the toolbar is hidden.
*/
printToolBar?: boolean;
/**
* ToolBar is the area on the top of table, it contain the search panel, buttons for data manipulation.
* After v3.0.0, you can custom all the components in the ToolBar also itself too.
* Give a toolBar in options props and toolBar only accept a function and a JSX returned value is necessary.
*/
toolBar?(props: ToolBarProps): ReactElement<any>;
/**
* Button group which contain the insert, drop, show only select and export CSV buttons, these button all
* grouped as btn-group class in bootstrap. This is a chance that you can custom this button group.
* Give a btnGroup in options props and btnGroup only accept a function and a JSX returned value is necessary.
* This lets you customize just the left-hand-side of the toolbar if desired.
*/
btnGroup?(props: ButtonGroupProps): ReactElement<any>;
/**
* It's available to customize the insert button by configuring insertBtn in options props, insertBtn only
* accept a function and a JSX returned value is necessary. This function will take one argument: onClick.
*
* The default `InsertButton` component is also exported as a component, so that you can use it as the base
* for your custom component.
*/
insertBtn?(onClick: (e: React.MouseEvent<any>) => void): ReactElement<any>;
/**
* It's available to customize delete button by configuring deleteBtn in options props, deleteBtn onl<y
* accept a function and a JSX returned value is necessary. This function will take one argument: onClick.
*
* The default `DeleteButton` component is also exported as a component, so that you can use it as the base
* for your custom component.
*/
deleteBtn?(onClick: (e: React.MouseEvent<any>) => void): ReactElement<any>;
/**
* It's available to customize the export csv button by configuring exportCSVBtn in options props, exportCSVBtn only
* accept a function and a JSX returned value is necessary. This function will take one argument: onClick.
*
* The default `ExportCSVButton` component is also exported as a component, so that you can use it as the base
* for your custom component.
*/
exportCSVBtn?(onClick: (e: React.MouseEvent<any>) => void): ReactElement<any>;
/**
* It's available to custom select only toggle button by configuring showSelectedOnlyBtn in options props.
* showSelectedOnlyBtn only accept a function and a JSX returned value is necessary.
* This function will take two argument: onClick and showSelected.
*
* The default `ShowSelectedOnlyButton` component is also exported as a component, so that you can use it as
* the base for your custom component.
*/
showSelectedOnlyBtn?(onClick: (e: React.MouseEvent<any>) => void, showSelected: boolean): ReactElement<any>;
/**
* You can custom the whole search panel(right side) by searchPanel in options props. searchPanel only accept
* a function and a JSX returned value is necessary. This function will take one argument: props, that contains:
* `searchField`: the default search field component
* `clearBtn`: the default clear button component
* `defaultValue`: the default text for the search field
* `placeholder`: the default placeholder text for the search field
* `clearBtnClick`: the callback function to use when the clear search button is clicked
* `search`: the callback function for triggering the search, which takes the search text as an input.
*/
searchPanel?(props: SearchPanelProps): ReactElement<any>;
/**
* You can custom the search input field only by searchField in options props. searchField only accept a
* function and a JSX returned value is necessary.
*
* The default `SearchField` component is also exported as a component, so that you can use it as the base for
* your custom component.
*/
searchField?(props: SearchFieldProps): ReactElement<Component<any> & SearchFieldInterface>;
/**
* You can custom the clear button for search field by giving clearSearchBtn in options props.
* clearSearchBtn only accept a function and a JSX returned value is necessary.
*
* The default `ClearSearchButton` component is also exported as a component, so that you can use it as the
* base for your own custom component.
*/
clearSearchBtn?(onClick: (e: React.MouseEvent<any>) => void): ReactElement<any>;
/**
* You can customize everything in the insert modal via options.insertModal and we give you the event
* callback, props and some informations: onModalClose, onSave, columns, validateState, ignoreEditable
* @see https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/custom/insert-modal/custom-insert-modal.js
*/
insertModal?(
onModalClose: () => void,
onSave: (row: TRow) => void,
columns: ReadonlyArray<InsertModalColumnDescription<TRow>>,
validateState: { [dataField: string]: string },
ignoreEditable: boolean
): ReactElement<any>;
/**
* You can customize the body of the insert modal via options.insertModalBody and we give you the following
* arguments: columns, validateState {[fieldname]: errorMsg}, ignoreEditable
*
* Note: There is no exported Insert Modal Body component - if you are customising this, you need to create your
* own body component. That component needs to implement a `getFieldValue` method that returns the new row data. It
* will be called by react-bootstrap-table when the save button is clicked in the insert modal window.
*/
insertModalBody?(
columns: ReadonlyArray<InsertModalColumnDescription<TRow>>,
validateState: { [dataField: string]: string },
ignoreEditable: boolean
): React.ReactElement<React.Component<any> & ModalBodyInterface<TRow>>;
/**
* It's available to custom the header of insert modal by configuring options.insertModalHeader. It only accepts
* a function and a JSX returned value is necessary. This function will take two arguments: closeModal and save.
* `closeModal`: callback function to trigger closing the modal window.
* `save`: callback function to trigger saving the new row data.
*
* The default `InsertModalHeader` component is also exported as a component, so that you can use it as the base
* for your own custom component.
*/
insertModalHeader?(closeModal: () => void, save: () => void): ReactElement<any>;
/**
* It's available to custom the footer of insert modal by configuring options.insertModalFooter. It only accepts
* a function and a JSX returned value is necessary. This function will take two arguments: closeModal and save.
* `closeModal`: callback function to trigger closing the modal window.
* `save`: callback function to trigger saving the new row data.
*
* The default `InsertModalFooter` component is also exported as a component, so that you can use it as the base
* for your own custom component.