Skip to content

Commit 548fc22

Browse files
committed
tweak EditCell
1 parent 07e3af6 commit 548fc22

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

src/EditCell.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@ import { useEffectEvent, useLayoutEffect, useRef } from 'react';
22
import { css } from 'ecij';
33

44
import { createCellEvent, getCellClassname, getCellStyle, onEditorNavigation } from './utils';
5-
import type {
6-
CellKeyboardEvent,
7-
RenderCellProps,
8-
EditCellKeyDownArgs,
9-
Maybe,
10-
Omit,
11-
RenderEditCellContentProps
12-
} from './types';
5+
import type { CellKeyboardEvent, RenderCellProps, EditCellKeyDownArgs, Maybe } from './types';
136

147
declare global {
158
const scheduler: Scheduler | undefined;
@@ -50,13 +43,12 @@ const cellEditing = css`
5043
}
5144
`;
5245

53-
type SharedRenderCellProps<R, SR> = Pick<RenderCellProps<R, SR>, 'colSpan'>;
46+
type SharedRenderCellProps<R, SR> = Pick<
47+
RenderCellProps<R, SR>,
48+
'column' | 'colSpan' | 'row' | 'rowIdx'
49+
>;
5450

55-
interface EditCellProps<R, SR>
56-
extends
57-
Omit<RenderEditCellContentProps<R, SR>, 'onRowChange' | 'onClose'>,
58-
SharedRenderCellProps<R, SR> {
59-
rowIdx: number;
51+
interface EditCellProps<R, SR> extends SharedRenderCellProps<R, SR> {
6052
onRowChange: (row: R, commitChanges: boolean, shouldFocusCell: boolean) => void;
6153
closeEditor: (shouldFocusCell: boolean) => void;
6254
navigate: (event: React.KeyboardEvent<HTMLDivElement>) => void;
@@ -70,8 +62,8 @@ export default function EditCell<R, SR>({
7062
rowIdx,
7163
onRowChange,
7264
closeEditor,
73-
onKeyDown,
74-
navigate
65+
navigate,
66+
onKeyDown
7567
}: EditCellProps<R, SR>) {
7668
const captureEventRef = useRef<MouseEvent | undefined>(undefined);
7769
const abortControllerRef = useRef<AbortController>(undefined);

0 commit comments

Comments
 (0)