import { GristRecord } from './types.js'; /** * One row's edits on the grid: the row (its id, or the row object itself while it is new), how it changed, and the * edited fields with their values. */ export interface RowEdits { id?: string; /** The row object as the grid holds it - a new row has no id yet, so it is known by this. */ row?: GristRecord; flag: '+' | 'M' | '-'; values: Record; } /** The edits on the given rows now - what a save sends, or what is left after one. */ export declare function editsOf(records: readonly GristRecord[]): RowEdits[]; /** * What was edited after `sent` was taken: the rows not sent at all, and on the sent rows the fields whose value is not * the one sent. A new row that was sent and saved has an id now (`savedIds`, by the row object) - its later edits are * edits of that saved row. A new row that was sent but whose id is unknown cannot be found again; it is left out of the * result and returned in `lost`, so the screen can say so. */ export declare function editsSince(now: readonly RowEdits[], sent: readonly RowEdits[], savedIds?: ReadonlyMap): { edits: RowEdits[]; lost: RowEdits[]; }; /** * Lay edits on rows just read: a row of the same id takes the values and is marked edited (or deleted); a new row is * added at the end. Returns the edits whose row is not among the rows read - another page, or deleted meanwhile. * The rows are changed in place; the grid recomputes what is dirty afterwards (`checkDirties`). */ export declare function layEdits(records: GristRecord[], edits: readonly RowEdits[]): RowEdits[]; /** * Mark what a save sent as saved on the rows still shown, when the list cannot be read again after it: a sent value * becomes the row's value as read, a new row takes the id the save gave it. What was edited after the save was sent * stays an edit; a new row whose id is unknown stays new. The grid recomputes what is dirty afterwards * (`checkDirties`). Without this, a new row saved but still marked new would be saved again. */ export declare function settleSent(sent: readonly RowEdits[], savedIds?: ReadonlyMap): void; /** * Join entries held aside (`held`) with the edits on the grid now (`current`) before laying them on a list read again. * A held field the row is not edited in now joins that row's edit; a held field edited now to the same value is the * same entry. A held field edited now to another value is not laid over the newer input: the current value stays and * the held one stays held (`kept`), to be shown again. Held new rows are rows of their own. */ export declare function mergeHeld(current: readonly RowEdits[], held: readonly RowEdits[]): { edits: RowEdits[]; kept: RowEdits[]; };