feat(base): add focused-cell atom and cell coordinate types

This commit is contained in:
Philipinho
2026-06-15 02:02:38 +01:00
parent 6187150224
commit 3bfe0c0b7d
2 changed files with 19 additions and 3 deletions
+13 -1
View File
@@ -1,6 +1,6 @@
import { atom } from "jotai";
import { atomFamily } from "jotai/utils";
import { EditingCell } from "@/ee/base/types/base.types";
import { EditingCell, FocusedCell } from "@/ee/base/types/base.types";
// Atoms are scoped per-base via `pageId` so that two BaseTable instances on
// the same page don't share UI state.
@@ -41,3 +41,15 @@ export const selectedRowIdsAtomFamily = atomFamily((_pageId: string) =>
export const lastToggledRowIndexAtomFamily = atomFamily((_pageId: string) =>
atom<number | null>(null),
);
export const focusedCellAtomFamily = atomFamily((_pageId: string) =>
atom<FocusedCell>(null),
);
export type PendingTypeInsert = {
rowId: string;
propertyId: string;
char: string;
} | null;
export const pendingTypeInsertAtom = atom<PendingTypeInsert>(null);
+6 -2
View File
@@ -251,10 +251,14 @@ export type IBase = {
baseSchemaVersion: number;
};
export type EditingCell = {
export type CellCoord = {
rowId: string;
propertyId: string;
} | null;
};
export type EditingCell = CellCoord | null;
export type FocusedCell = CellCoord | null;
export type CreateBaseInput = {
name: string;