mirror of
https://github.com/docmost/docmost.git
synced 2026-07-14 23:46:45 +10:00
feat(base): add focused-cell atom and cell coordinate types
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user