FieldState interface

Module @runic-artifex/views in @runic-artifex/views 0.23.0

interface FieldState<TValue>

What a field shows.

Properties

value

readonly value: TValue;

The draft while one exists, otherwise the member's value in the View's state.

text

readonly text: string;

What a text input shows: the text typed, while it is a draft that does not parse or still means value (so 1. stays while typing 1.5), otherwise value formatted for its kind.

editing

readonly editing: boolean;

A draft exists: from the first input until the last write settled and the View's state caught up, or after a failed write until reset() or the next successful write. Prefer it to disabling the field on the View's busy state, which the field's own write causes.

error

readonly error: unknown;

Why the latest write or text failed, until the next input, retry() or reset(): a BridgeError of the write, or a FieldError . undefined otherwise.

errors

readonly errors: readonly string[];

The member's validation messages in the View's state, or of the last checked write's receipt; [] when valid.

conflict

readonly conflict: FieldBaseline<TValue> | undefined;

The producer's field while a checked write's conflict keeps the draft; undefined otherwise.

validating

readonly validating: boolean;

The member's validation is in progress in the View's state, such as an asynchronous rule that is still checking (validating(state) of the definition, validation-pending/1); show "checking…". false without one.