FormBinding

Internal interface for form binding operations.

This interface provides the low-level binding operations between form fields and the form state. It handles field registration, validation, and state management. This is an internal API and should not be used directly by application code.

Parameters

T

The type of the form data.

Properties

Link copied to clipboard
abstract val fieldChanges: SharedFlow<FieldName>

A shared flow of field change notifications.

Link copied to clipboard
abstract val policy: FormPolicy

The form policy that defines validation behavior.

Link copied to clipboard
abstract val state: FormData<T>

The current state of the form including data and metadata.

Functions

Link copied to clipboard
abstract operator fun get(name: FieldName): FieldMetaState?

Gets the metadata for a specific field.

Link copied to clipboard
abstract fun handleChange(updater: T.() -> T)

Handles a change to the form data.

Link copied to clipboard
abstract suspend fun notifyFieldChange(name: FieldName)

Notifies the form that a field's validation target has changed.

Link copied to clipboard
abstract fun register(name: FieldName, rule: FieldRule<T>)

Registers a field with its validation rule.

Link copied to clipboard
abstract operator fun set(name: FieldName, fieldMeta: FieldMetaState)

Sets the metadata for a specific field.

Link copied to clipboard
abstract fun unregister(name: FieldName)

Unregisters a field from the form.

Link copied to clipboard
abstract fun validate(value: T, dryRun: Boolean): Boolean

Validates the form data.