import { NodeApi } from "../interfaces/node-api"; import { IdObj } from "./utils"; // Returns the newly created row data, whose id is read via idAccessor. `IdObj` // is kept for back-compat with handlers that return a bare `{ id }` (#347). export type CreateHandler = (args: { parentId: string | null; parentNode: NodeApi | null; index: number; type: "internal" | "leaf"; }) => (T | IdObj | null) | Promise; export type MoveHandler = (args: { dragIds: string[]; dragNodes: NodeApi[]; parentId: string | null; parentNode: NodeApi | null; index: number; }) => void | Promise; export type RenameHandler = (args: { id: string; name: string; node: NodeApi; }) => void | Promise; export type DeleteHandler = (args: { ids: string[]; nodes: NodeApi[]; }) => void | Promise; export type EditResult = { cancelled: true } | { cancelled: false; value: string };