Skip to content

Commit

Permalink
refactor(useDatagrid): implement typescript types (carbon-design-syst…
Browse files Browse the repository at this point in the history
  • Loading branch information
makafsal authored Jun 11, 2024
1 parent 73ee632 commit 70a353c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const DatagridSimpleBody = (datagridState: DataGridState) => {
return (
<TableBody
{...getTableBodyProps({ role: undefined })}
aria-live={null}
aria-live={undefined}
className={cx(
`${blockClass}__simple-body`,
getTableBodyProps().className
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ const DatagridVirtualBody = (datagridState: DataGridState) => {
>
<DatagridHead {...datagridState} />
</div>
<TableBody {...getTableBodyProps({ role: undefined })} aria-live={null}>
<TableBody
{...getTableBodyProps({ role: undefined })}
aria-live={undefined}
>
<VariableSizeList
height={virtualHeight || tableHeight}
itemCount={visibleRows.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useGlobalFilter,
useFilters,
usePagination,
TableInstance,
} from 'react-table';
import uniqueId from 'lodash/uniqueId';
import useSkeletonRows from './useSkeletonRows';
Expand All @@ -27,7 +28,7 @@ import useFlexResize from './useFlexResize';
import useFloatingScroll from './useFloatingScroll';
import { stateReducer } from './Datagrid/addons/stateReducer';

const useDatagrid = (params, ...plugins) => {
const useDatagrid = (params, ...plugins): TableInstance => {
const defaultPlugins = [
useFlexLayout,
useHeaderRow,
Expand All @@ -45,7 +46,7 @@ const useDatagrid = (params, ...plugins) => {
// Disable resizing
if (params.disableResizing) {
const resizeIndex = defaultPlugins.findIndex(
(p) => p.pluginName === 'useResizeColumns'
(p) => p?.['pluginName'] === 'useResizeColumns'
);
defaultPlugins.splice(resizeIndex, 1);
}
Expand All @@ -69,6 +70,7 @@ const useDatagrid = (params, ...plugins) => {
...defaultEndPlugins,
...clientEndPlugins
);

return tableState;
};

Expand Down

0 comments on commit 70a353c

Please sign in to comment.