Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: #2523 DataTable/TreeTable: stricter generically typed API #3825

Merged
merged 1 commit into from
Dec 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions components/lib/datatable/datatable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ interface DataTablePFSEvent extends DataTablePageParams, DataTableSortParams, Da
[key: string]: any;
}

interface DataTableDataSelectableParams {
data: any;
interface DataTableDataSelectableParams<TValue extends DataTableValueArray> {
data: DataTableRowDataArray<TValue>;
index: number;
}

Expand All @@ -144,7 +144,7 @@ interface DataTableSelectAllChangeParams {

interface DataTableRowEventParams {
originalEvent: React.SyntheticEvent;
data: any;
data: DataTableValue;
}

interface DataTableRowMouseEventParams extends Omit<DataTableRowEventParams, 'originalEvent'> {
Expand All @@ -154,11 +154,11 @@ interface DataTableRowMouseEventParams extends Omit<DataTableRowEventParams, 'or

interface DataTableRowClickEventParams extends DataTableRowMouseEventParams {}

interface DataTableCellClickEventParams {
interface DataTableCellClickEventParams<TValue extends DataTableValueArray> {
originalEvent: React.MouseEvent<HTMLElement>;
value: any;
field: string;
rowData: DataTableValue;
rowData: DataTableRowData<TValue>;
rowIndex: number;
cellIndex: number;
selected: boolean;
Expand Down Expand Up @@ -186,10 +186,10 @@ interface DataTableSelectParams {

interface DataTableUnselectParams extends DataTableSelectParams {}

interface DataTableExportFunctionParams {
data: DataTableValueArray;
interface DataTableExportFunctionParams<TValue extends DataTableValueArray> {
data: DataTableRowDataArray<TValue>;
field: string;
rowData: DataTableValue;
rowData: DataTableRowData<TValue>;
column: Column;
}

Expand All @@ -200,9 +200,9 @@ interface DataTableColReorderParams {
columns: React.ReactElement;
}

interface DataTableRowReorderParams {
interface DataTableRowReorderParams<TValue extends DataTableValueArray> {
originalEvent: React.DragEvent<HTMLElement>;
value: any;
value: DataTableRowDataArray<TValue>;
dragIndex: number;
dropIndex: number;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ export interface DataTableProps<TValue extends DataTableValueArray> extends Omit
first?: number;
footer?: DataTableFooterTemplateType<TValue>;
footerColumnGroup?: React.ReactNode;
frozenValue?: DataTableRowData<TValue>[];
frozenValue?: DataTableRowDataArray<TValue>;
frozenWidth?: string;
globalFilter?: DataTableGlobalFilterType;
globalFilterFields?: string[];
Expand Down Expand Up @@ -352,11 +352,11 @@ export interface DataTableProps<TValue extends DataTableValueArray> extends Omit
cellClassName?(value: any, options: DataTableCellClassNameOptions<TValue>): object | string;
customRestoreState?(): object;
customSaveState?(state: object): void;
exportFunction?(e: DataTableExportFunctionParams): any;
isDataSelectable?(e: DataTableDataSelectableParams): boolean | undefined | null;
exportFunction?(e: DataTableExportFunctionParams<TValue>): any;
isDataSelectable?(e: DataTableDataSelectableParams<TValue>): boolean | undefined | null;
onAllRowsSelect?(e: DataTableSelectParams): void;
onAllRowsUnselect?(e: DataTableUnselectParams): void;
onCellClick?(e: DataTableCellClickEventParams): void;
onCellClick?(e: DataTableCellClickEventParams<TValue>): void;
onCellSelect?(e: DataTableSelectParams): void;
onCellUnselect?(e: DataTableUnselectParams): void;
onColReorder?(e: DataTableColReorderParams): void;
Expand All @@ -378,7 +378,7 @@ export interface DataTableProps<TValue extends DataTableValueArray> extends Omit
onRowExpand?(e: DataTableRowEventParams): void;
onRowMouseEnter?(e: DataTableRowMouseEventParams): void;
onRowMouseLeave?(e: DataTableRowMouseEventParams): void;
onRowReorder?(e: DataTableRowReorderParams): void;
onRowReorder?(e: DataTableRowReorderParams<TValue>): void;
onRowSelect?(e: DataTableSelectParams): void;
onRowToggle?(e: DataTableRowToggleParams): void;
onRowUnselect?(e: DataTableUnselectParams): void;
Expand All @@ -387,7 +387,7 @@ export interface DataTableProps<TValue extends DataTableValueArray> extends Omit
onSort?(e: DataTablePFSEvent): void;
onStateRestore?(state: object): void;
onStateSave?(state: object): void;
onValueChange?(value: any[]): void;
onValueChange?(value: DataTableRowDataArray<TValue>): void;
rowClassName?(data: DataTableRowData<TValue>, options: DataTableRowClassNameOptions<TValue>): object | string;
rowEditValidator?(data: DataTableRowData<TValue>, options: DataTableRowEditValidatorOptions<TValue>): boolean;
rowExpansionTemplate?(data: DataTableRowData<TValue>, options: DataTableRowExpansionTemplate): React.ReactNode;
Expand Down