Skip to content

Commit 2b29909

Browse files
committed
feat(AnalyticalTable): enable passing useTableProps and additional tableHooks to react-table
1 parent 00c9ae0 commit 2b29909

File tree

1 file changed

+12
-5
lines changed
  • packages/main/src/components/AnalyticalTable

1 file changed

+12
-5
lines changed

packages/main/src/components/AnalyticalTable/index.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export interface ColumnConfiguration {
2222
vAlign?: VerticalAlign;
2323
canResize?: boolean;
2424
minWidth?: number;
25-
2625
[key: string]: any;
2726
}
2827

@@ -65,6 +64,8 @@ export interface TableProps extends CommonProps {
6564
noDataText?: string;
6665
stickyHeader?: boolean;
6766
onSort?: (e?: Event) => void;
67+
useTableProps?: object;
68+
tableHooks?: Array<() => any>;
6869
}
6970

7071
const useStyles = createUseStyles<JSSTheme, keyof ReturnType<typeof styles>>(styles);
@@ -100,7 +101,9 @@ export const AnalyticalTable: FC<TableProps> = forwardRef((props: TableProps, re
100101
selectable,
101102
onRowSelected,
102103
stickyHeader,
103-
onSort
104+
onSort,
105+
useTableProps,
106+
tableHooks
104107
} = props;
105108

106109
const [selectedRow, setSelectedRow] = useState(null);
@@ -188,13 +191,15 @@ export const AnalyticalTable: FC<TableProps> = forwardRef((props: TableProps, re
188191
columns,
189192
data,
190193
defaultColumn,
191-
state: tableState
194+
state: tableState,
195+
...useTableProps
192196
},
193197
useFilters,
194198
useGroupBy,
195199
useSortBy,
196200
useExpanded,
197-
useTableStyling
201+
useTableStyling,
202+
...tableHooks
198203
);
199204

200205
const minimumRows = useMemo(() => {
@@ -333,5 +338,7 @@ AnalyticalTable.defaultProps = {
333338
pivotBy: [],
334339
NoDataComponent: DefaultNoDataComponent,
335340
noDataText: 'No Data',
336-
stickyHeader: true
341+
stickyHeader: true,
342+
useTableProps: {},
343+
tableHooks: []
337344
};

0 commit comments

Comments
 (0)