# @salmonui/data-grid/engine/edit API reference

> 62 exported symbols of @salmonui/data-grid/engine/edit: 5 functions, 18 interfaces, 26 types and 13 constants.

Canonical: https://salmonui.dev/docs/reference/data-grid/engine-edit

```ts
import { … } from '@salmonui/data-grid/engine/edit';
```

## Functions

### createEditApi

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/createEditApi

```ts
function createEditApi<Row>(engine: DataGridEngine<Row>): EditApi<Row>;
```

Edit methods over an engine with the `edit` module (spread into the DataGrid API).

### createEditModule

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/createEditModule

```ts
function createEditModule<Row>(): EditModule<Row>;
```

Creates the `edit` module. Options are read from `options.edit`
(`EditOptions`).

### createInitialEditState

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/createInitialEditState

```ts
function createInitialEditState<Row>(options: DataGridOptions<Row>): EditState;
```

The state `createEditModule().initialState(options)` returns: no drafts, no
active editor, version 0. Pure; a renderer that loads the module lazily
renders this at-rest state until the module is loaded.

### showsNewRow

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/showsNewRow

```ts
function showsNewRow(o: ResolvedEditOptions): boolean;
```

`showNewRow` takes effect: enabled, adding allowed, row mode.

### toEditInput

Kind: function

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/toEditInput

```ts
function toEditInput(value: unknown): Json;
```

Converts a value to a command input: Dates become ISO strings, other non-JSON values are stringified.

## Interfaces

### AddedTreePlacement

Kind: interface

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/AddedTreePlacement

```ts
interface AddedTreePlacement {
    readonly position: 'above' | 'below' | 'child';
    readonly anchorId: RowId;
    readonly parentId: RowId | null;
}
```

Where a tree-mode added row goes (`getAddedTreePlacement`).

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `position` | `readonly position: 'above' \| 'below' \| 'child';` |  |  |
| `anchorId` | `readonly anchorId: RowId;` |  | The row the position is relative to. |
| `parentId` | `readonly parentId: RowId \| null;` |  | The parent the added row joins (null: a root). |

## Types

### NewRowPosition

Kind: type

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/NewRowPosition

```ts
type NewRowPosition = 'top' | 'bottom' | 'above' | 'below' | 'child';
```

`newRowPosition` values; `above`, `below` and `child` are tree mode positions relative to a row.

## Constants

### BLANK_ROW_ID_PREFIX

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/BLANK_ROW_ID_PREFIX

```ts
const BLANK_ROW_ID_PREFIX = "__new:blank-";
```

Ids of the always-visible add row (`showNewRow`): this prefix plus a sequence starting at 1.

### DEFAULT_EDIT_MESSAGES

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/DEFAULT_EDIT_MESSAGES

```ts
const DEFAULT_EDIT_MESSAGES: EditMessages;
```

### EDIT_COMMANDS

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_COMMANDS

```ts
const EDIT_COMMANDS: readonly EditCommand['type'][];
```

Command types of the `edit` module (a renderer that registers the module lazily declares them up front).

### EDIT_DELETED

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_DELETED

```ts
const EDIT_DELETED = 16;
```

### EDIT_DIRTY

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_DIRTY

```ts
const EDIT_DIRTY = 2;
```

### EDIT_EDITABLE

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_EDITABLE

```ts
const EDIT_EDITABLE = 128;
```

### EDIT_EDITING

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_EDITING

```ts
const EDIT_EDITING = 1;
```

Cell flag bits (`edit.cellFlags`).

### EDIT_INVALID

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_INVALID

```ts
const EDIT_INVALID = 4;
```

### EDIT_LOCKED

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_LOCKED

```ts
const EDIT_LOCKED = 256;
```

The always-visible add row while another row edits: its editors are shown disabled.

### EDIT_NEW

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_NEW

```ts
const EDIT_NEW = 8;
```

### EDIT_PENDING

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_PENDING

```ts
const EDIT_PENDING = 32;
```

### EDIT_ROW_EDITING

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/EDIT_ROW_EDITING

```ts
const EDIT_ROW_EDITING = 64;
```

The cell's row is in row / dialog edit.

### NEW_ROW_ID_PREFIX

Kind: const

Page: https://salmonui.dev/docs/reference/data-grid/engine-edit/NEW_ROW_ID_PREFIX

```ts
const NEW_ROW_ID_PREFIX = "__new:";
```

## Re-exported entry points

- [@salmonui/data-grid/engine](https://salmonui.dev/docs/reference/data-grid/engine.md): 42 symbols: 17 interfaces and 25 types
  `EditAddRecordCommand`, `EditApi`, `EditBatchChanges`, `EditCancelBatchCommand`, `EditCancelCommand`, `EditCellContext`, `EditChange`, `EditCommand`, `EditCommitAndMoveCommand`, `EditCommitCommand`, `EditDataChanges`, `EditDeleteRecordsCommand`, `EditDisplay`, `EditDraft`, `EditMessageTable`, `EditMessages`, `EditMethods`, `EditMode`, `EditModule`, `EditOptions`, `EditPreview`, `EditPreviewCell`, `EditRedoCommand`, `EditRestoreRecordsCommand`, `EditSaveBatchCommand`, `EditSetOptionsCommand`, `EditSetValueCommand`, `EditSetValuesCommand`, `EditSettleCommand`, `EditSnapshot`, `EditStartCommand`, `EditState`, `EditStatus`, `EditTarget`, `EditUndoCommand`, `EditUpdateCellCommand`, `EditUpdateRowCommand`, `EditValidateBatchCommand`, `EditWriteOutcome`, `ResolvedEditOptions`, `RowValidationContext`, `RowValidator`
