feat(base): insert row below via Shift+Enter on the primary cell

This commit is contained in:
Philipinho
2026-06-16 13:22:54 +01:00
parent c43ac7fc8c
commit 2e80fc457c
5 changed files with 75 additions and 31 deletions
@@ -67,7 +67,7 @@ type GridContainerProps = {
table: Table<IBaseRow>;
properties: IBaseProperty[];
onCellUpdate: (rowId: string, propertyId: string, value: unknown) => void;
onAddRow?: () => void;
onAddRow?: (afterRowId?: string, focusPropertyId?: string) => void;
pageId: string;
onColumnReorder?: (columnId: string, finishIndex: number) => void;
onResizeEnd?: () => void;
@@ -378,6 +378,13 @@ export function GridContainer({
[table, setFocusedCell],
);
const handleAddRowBelow = useCallback(
(afterRowId: string, focusPropertyId: string) => {
onAddRow?.(afterRowId, focusPropertyId);
},
[onAddRow],
);
useGridKeyboardNav({
table,
properties,
@@ -395,6 +402,7 @@ export function GridContainer({
deleteSelected,
toggleRowSelection,
expandRow,
addRow: handleAddRowBelow,
});
const activeCell = editingCell ?? focusedCell;