import type { ReactiveController } from 'lit'; import type { ColumnConfiguration, EditMode, EditTrigger, GridHost, Keys } from '../internal/types.js'; /** * The default editing configuration used when the grid has none set. */ export declare const DEFAULT_EDITING_CONFIG: Readonly<{ enabled: false; mode: EditMode; trigger: EditTrigger; }>; interface ActiveCell { rowIndex: number; columnKey: Keys; /** * Live reference to the underlying record (preserved through the pipeline so * the source array can be mutated on commit). */ data: T; } /** * Reactive controller backing inline cell + row editing. * * @remarks * Holds the currently active cell / row, pending values for row-mode edits, * and is responsible for emitting the cancellable `cellValueChanging` event * and follow-up `cellValueChanged` event. The actual data mutation writes * through to {@link ApexGrid.data} so changes survive pipeline runs and * propagate to consumers that own the source array. */ export declare class EditingController implements ReactiveController { protected host: GridHost; /** The cell currently in edit mode, or `null`. */ activeCell: ActiveCell | null; /** The row currently in edit mode (row mode only), or `null`. */ activeRow: { rowIndex: number; data: T; } | null; /** * Pending values keyed by column for the currently editing row. Populated in * row mode as the user edits individual cells; flushed on * {@link commitRow}. */ pending: Map, unknown>; constructor(host: GridHost); hostConnected(): void; /** * Whether editing is enabled at the grid level. */ get enabled(): boolean; /** * The resolved edit mode (`'cell'` if unset). */ get mode(): EditMode; /** * The resolved edit trigger (`'doubleClick'` if unset). */ get trigger(): EditTrigger; /** * Whether the given column can be edited. */ isEditable(column: ColumnConfiguration): boolean; /** * Whether the cell `(rowIndex, columnKey)` is currently in edit mode. */ isCellEditing(rowIndex: number, columnKey: Keys): boolean; /** * Whether the given row is currently in edit mode (row mode). */ isRowEditing(rowIndex: number): boolean; /** * Begins editing the cell at `(rowIndex, columnKey)`. Auto-commits any cell * already in edit mode (in cell mode); in row mode it switches the active * cell within the same row and rejects cross-row moves. * * @returns `true` if edit started, `false` if rejected (column not editable * or row-mode constraint violated). */ editCell(rowIndex: number, columnKey: Keys): Promise; /** * Begins editing the given row in row mode. Emits `rowEditStarted` on * success. No-op in cell mode. */ editRow(rowIndex: number): Promise; /** * Commits a candidate value for the currently editing cell. In cell mode the * value is written through to {@link ApexGrid.data}; in row mode it is staged * in {@link pending} until {@link commitRow} is called. * * @param value - The candidate value. * @returns `true` if accepted (or staged), `false` if rejected by * `cellValueChanging.preventDefault()`. */ commitCell(value?: unknown): Promise; /** * Writes `value` directly to the cell at `(rowIndex, columnKey)` without * entering edit mode. Used by interactive display widgets (e.g. the boolean * checkbox) that handle their own input. Goes through the same * `cellValueChanging` / `cellValueChanged` event path as a normal commit. * * @returns `true` if the value was applied, `false` if rejected by * `cellValueChanging.preventDefault()` or the column is not editable. */ commitImmediate(rowIndex: number, columnKey: Keys, value: unknown): Promise; /** * Discards the current cell edit without writing. In row mode the row edit * stays open. */ cancelCell(): void; /** * Commits all pending edits for the currently editing row. Emits * `cellValueChanging` for every changed cell and `rowEditEnded` at the end. * * @returns `true` if the row was applied, `false` if any cell change was * cancelled (the row remains in edit mode in that case). */ commitRow(): Promise; /** * Discards every pending edit for the active row and exits row edit mode. * Emits `rowEditEnded` with `committed: false`. */ cancelRow(): void; /** * Returns the current pending or committed value for `(rowIndex, columnKey)`. * Cells in row mode read this so unstaged-but-pending values are reflected * during the edit. */ getValue(rowIndex: number, columnKey: Keys): unknown; } export {};