mirror of
https://github.com/docmost/docmost.git
synced 2026-08-31 02:46:27 +08: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 { atom } from "jotai";
|
||||||
import { atomFamily } from "jotai/utils";
|
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
|
// Atoms are scoped per-base via `pageId` so that two BaseTable instances on
|
||||||
// the same page don't share UI state.
|
// the same page don't share UI state.
|
||||||
@@ -41,3 +41,15 @@ export const selectedRowIdsAtomFamily = atomFamily((_pageId: string) =>
|
|||||||
export const lastToggledRowIndexAtomFamily = atomFamily((_pageId: string) =>
|
export const lastToggledRowIndexAtomFamily = atomFamily((_pageId: string) =>
|
||||||
atom<number | null>(null),
|
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;
|
baseSchemaVersion: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EditingCell = {
|
export type CellCoord = {
|
||||||
rowId: string;
|
rowId: string;
|
||||||
propertyId: string;
|
propertyId: string;
|
||||||
} | null;
|
};
|
||||||
|
|
||||||
|
export type EditingCell = CellCoord | null;
|
||||||
|
|
||||||
|
export type FocusedCell = CellCoord | null;
|
||||||
|
|
||||||
export type CreateBaseInput = {
|
export type CreateBaseInput = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user