BridgeField interface

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

interface BridgeField<TClient, TState, TValue>

A generated descriptor of one settable View member, such as EditorFields.title: how a field reads it from the View's state, writes it, and finds its validation messages. The framework bindings' useField / injectField and createFieldController take it.

Properties

name

readonly name: string;

The member's wire name.

kind

readonly kind: BridgeFieldKind;

No documentation.

nullable

readonly nullable?: boolean;

The member accepts null.

integer

readonly integer?: boolean;

A number member of an integer CLR type.

offset

readonly offset?: boolean;

A datetime member whose values carry an offset (DateTimeOffset): a local text gets the page's offset.

constraints

readonly constraints?: BridgeFieldConstraints;

The member's DataAnnotations, when it has any the page can mirror.

choices

readonly choices?: readonly TValue[];

A choice member's values, in declaration order.

checkedOnly

readonly checkedOnly?: boolean;

The field has no setter, only its checked write: a field path below a member (field-paths/1), such as InvoiceFields.address.street. A field controller then always writes it checked, as with checked: true.

Methods

read

read(state: TState): TValue;

Reads the member from the View's state.

write

write(client: TClient, value: TValue): Promise<unknown>;

Writes the member with its generated setter (an edit, last writer wins).

checked

checked?(client: TClient, value: TValue, options: FieldWriteOptions<TValue>): Promise<FieldWriteReceipt<TValue>>;

Writes the member with its generated checked write, which reports a receipt.

baseline

baseline?(client: TClient): FieldBaseline<TValue>;

The value and version of the checked field in the producer's state, which a checked write is based on.

errors

errors?(state: TState): readonly string[];

The member's validation messages in a state, present when the View has validation: its own messages, then those of the values below it, such as the members of an object it holds.

validating

validating?(state: TState): boolean;

Whether the member's validation is in progress in a state, present when the View has validation: an asynchronous rule of the member, or of a value below it, is still checking (validation-pending/1).