Package-level declarations

Types

Link copied to clipboard
open class ValidatingStore<D, T, M>(initialData: D, validation: Validation<D, T, M>, metadataDefault: T, validateAfterUpdate: Boolean = true, val id: String = Id.next()) : RootStore<D>

A ValidatingStore is a Store which also contains a Validation for its model and by default applies it to every update.

Link copied to clipboard
value class Validation<D, T, M>(validate: (Inspector<D>, T) -> List<M>)

Encapsulates the logic for validating a given data-model with metadata.

Link copied to clipboard

Minimal interface for a validation message that exposes the model path for matching relevant sub-model-data and probably relevant UI element representation for showing the message and getting information about the valid state after validation process.

Functions

Link copied to clipboard
fun <M : ValidationMessage> Store<*>.messages(): Flow<List<M>>?

Finds all corresponding ValidationMessages to this Store.

Link copied to clipboard
fun <D, M> storeOf(initialData: D, validation: Validation<D, Unit, M>, id: String = Id.next()): ValidatingStore<D, Unit, M>

Convenience function to create a simple ValidatingStore without any metadata and handlers.

fun <D, T, M> storeOf(initialData: D, validation: Validation<D, T, M>, metadataDefault: T, id: String = Id.next()): ValidatingStore<D, T, M>

Convenience function to create a simple ValidatingStore without any handlers, etc.

Link copied to clipboard
fun <D, M> validation(validate: MutableList<M>.(Inspector<D>) -> Unit): Validation<D, Unit, M>

Convenience function for creating a Validation instance only accepting model-data by working on a MutableList receiver and using an Inspector for getting the right Inspector.path from sub-models next to the Inspector.data.

fun <D, T, M> validation(validate: MutableList<M>.(Inspector<D>, T) -> Unit): Validation<D, T, M>

Convenience function for creating a Validation instance accepting model- and metadata by working on a MutableList receiver and using an Inspector for getting the right Inspector.path from sub-models next to the Inspector.data.

Properties

Link copied to clipboard

Returns true when the list contains no ValidationMessage which is marked with ValidationMessage.isError.

val <M : ValidationMessage> Flow<List<M>>.valid: Flow<Boolean>

Checks if a Flow of a List of ValidationMessages is valid.