Skip to content

Commit

Permalink
chore: add types & doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Aram Vardanyan committed Apr 27, 2023
1 parent 554b29c commit 906c40d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/src/data-editor/data-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ type ScrollToFn = (
}
) => void;

type EnterCellEditModeFn = (location: Item, initialValue?: string) => void;

/** @category DataEditor */
export interface DataEditorRef {
/**
Expand Down Expand Up @@ -645,6 +647,10 @@ export interface DataEditorRef {
* Scrolls to the desired cell or location in the grid.
*/
scrollTo: ScrollToFn;
/**
* Enters edit mode of the provided cell.
*/
enterCellEditMode: EnterCellEditModeFn;
}

const loadingCell: GridCell = {
Expand Down Expand Up @@ -1523,8 +1529,8 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
[mangledCols, onRowAppended, rowMarkerOffset, rows, scrollTo, setCurrent]
);

const enterCellEditMode = React.useCallback(
([col, row]: Item, initialValue?: string): void => {
const enterCellEditMode: EnterCellEditModeFn = React.useCallback(
([col, row], initialValue): void => {

const cell = getCellContentRef.current([col - rowMarkerOffset, row]);
const bounds = gridRef.current?.getBounds(col, row);
Expand Down

0 comments on commit 906c40d

Please sign in to comment.