FieldOptions interface

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

interface FieldOptions<TValue = any>

No documentation.

Properties

commit

readonly commit?: FieldCommit;

input (the default) writes each input, in order. pause writes the draft delay milliseconds after the last input and at once on commit(), which the framework bindings call when the element loses focus; text that was not written yet is written when the field is disposed.

delay

readonly delay?: number;

The pause of commit: "pause", in milliseconds. Defaults to 700.

checked

readonly checked?: boolean;

Writes with the member's checked write instead of its setter: the write is checked against the value and version the field showed when the draft started, so a change by another writer meanwhile is a conflict instead of being overwritten. Needs checked and baseline in the definition, as generated descriptors have. Checked writes are one at a time, so coalesce is ignored.

coalesce

readonly coalesce?: boolean;

With true (the default) at most one write is in flight, and values typed meanwhile coalesce into the latest one, which is written when the write settles. With false every value is written at once; setters keep them in order with their edit numbers.

keepDraftOnError

readonly keepDraftOnError?: boolean;

With true (the default) a failed, rejected or conflicting write keeps the draft and sets error, so the user can correct it. With false the field shows the View's value again and sets error.

locale

readonly locale?: string | readonly string[] | null;

The locale of the text of number, decimal, bigint, date, time and datetime fields, as Intl takes it, such as "de-DE" or navigator.languages. Numbers show the locale's decimal separator and digits (1,5), and read them and its group separators (1.234,5). Dates and times show the locale's numeric form in the Gregorian calendar with a four-digit year and its hour cycle (23.11.2026, 21:45 in de, 11/23/2026, 9:45 PM in en-US), and read that form and the ISO form (2026-11-23, 21:45). Without it, the window's locale when the application sets one (IRunicWindowLocale, translation-text/1). A change of the window's locale formats the text again, but not while the field has a draft; the draft keeps the locale it was typed in, and the text follows once it is written. null, or no locale at all, is the invariant form (1.5) and the ISO forms that <input type="number">, "date", "time" and "datetime-local" take, which the browser shows in its own language: pass null for a field bound to one of those inputs (bindField does for them), and use a text input (inputmode="decimal" for numbers) for a field that follows the locale. format and parse replace the kind's text form in any locale.

scale

readonly scale?: number;

The most digits a number or decimal text may have after the decimal separator; more is an invalid-text error. A decimal allows at most 28 in any case.

parse

readonly parse?: (text: string, previous: TValue) => TValue;

Reads the text the user typed into a value, replacing the kind's parser. Throw to reject it: a thrown FieldError is the field's error, any other error becomes an invalid-text FieldError with its message. previous is the value the field shows.

format

readonly format?: (value: TValue) => string;

Writes a value as the field's text, replacing the kind's formatter. Pair it with parse, which must read it back.