Skip to content

Commit

Permalink
refactor(useInlineEdit): add typescript types (#5529)
Browse files Browse the repository at this point in the history
  • Loading branch information
anamikaanu96 authored Jun 18, 2024
1 parent 1fb233e commit 0bc2c3d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import React from 'react';
import { pkg } from '../../settings';
import cx from 'classnames';
import { InlineEditCell } from './Datagrid/addons/InlineEdit/InlineEditCell';
import { Hooks, TableInstance } from 'react-table';
import { DataGridState } from './types';

const blockClass = `${pkg.prefix}--datagrid`;

const useInlineEdit = (hooks) => {
const useInlineEdit = (hooks: Hooks) => {
const addInlineEdit = (props, { cell, instance }) => {
const columnInlineEditConfig = cell.column.inlineEdit;
const inlineEditType = cell.column?.inlineEdit?.type;
Expand All @@ -24,7 +26,7 @@ const useInlineEdit = (hooks) => {
tabIndex={-1}
value={cell.value}
cell={cell}
isDisabled={isDisabled}
disabledCell={isDisabled}
instance={instance}
type={type}
/>
Expand Down Expand Up @@ -73,8 +75,8 @@ const useInlineEdit = (hooks) => {
];
};
hooks.getCellProps.push(addInlineEdit);
hooks.useInstance.push((instance) => {
Object.assign(instance, {
hooks.useInstance.push((instance: TableInstance) => {
Object.assign(instance as DataGridState, {
withInlineEdit: true,
});
});
Expand Down

0 comments on commit 0bc2c3d

Please sign in to comment.