ListFieldComponent

class ListFieldComponent<T>(ctx: Ctx<ListFieldComponent.Props<T>>) : Component<ListFieldComponent.Props<T>>

Constructors

Link copied to clipboard
fun <T> ListFieldComponent(ctx: Ctx<ListFieldComponent.Props<T>>)

Types

Link copied to clipboard
data class AddCtx<T>(val add: (T) -> Unit)
Link copied to clipboard
data class ItemCtx<T>(    val idx: Int,     val item: T,     val all: List<T>,     val modify: (T) -> Unit,     val swapWith: (idx: Int) -> Unit,     val remove: () -> Unit,     val copy: (T) -> Unit,     keySuffix: String)
Link copied to clipboard
data class Props<T>(    val items: List<T>,     val onChange: (List<T>) -> Unit,     val renderItem: FlowContent.(ListFieldComponent.ItemCtx<T>) -> Unit,     val renderAdd: FlowContent.(ListFieldComponent.AddCtx<T>) -> Unit)
Link copied to clipboard
class PropsBuilder<T>(val items: List<T>, val onChange: (List<T>) -> Unit)

Functions

Link copied to clipboard
fun <C : Component<*>> createRef(): ComponentRef.Tracker<C>
Link copied to clipboard
operator fun <T> Stream<T>.invoke(handler: (T) -> Unit): () -> Unit

Subscribes to a Stream.

Link copied to clipboard
open override fun VDom.render()

Every component needs to implement this method

Link copied to clipboard
open fun shouldRedraw(nextProps: ListFieldComponent.Props<T>): Boolean

Returns 'true' when the component should redraw.

Link copied to clipboard
fun <T> stream(    initial: T,     config: Stream<T>.() -> Stream<T>? = null,     handler: (T) -> Unit = {}): ComponentStreamProperty<T>

Creates a property that is backed by a StreamSource

Link copied to clipboard
fun <T> subscribingTo(stream: Stream<T>, onNext: (T) -> Unit? = null): ReadOnlyProperty<Any?, T>

Creates a property that is subscribed to a stream.

Link copied to clipboard
fun triggerRedraw()

Triggers a redraw

Link copied to clipboard
fun <T> value(initial: T, onChange: (T) -> Unit? = null): ComponentStateProperty<T>

Creates a read write property for the components state.

Properties

Link copied to clipboard
val attributes: MutableTypedAttributes

The attributes of the component

Link copied to clipboard
val autoDomKey: String

An automatically generated unique dom key for the component instance.

Link copied to clipboard
val ctx: Ctx<ListFieldComponent.Props<T>>
Link copied to clipboard
val dom: HTMLElement?

The Dom node to which the component is rendered

Link copied to clipboard
val lifecycle: Component.LifeCycle<ListFieldComponent.Props<T>>

The life-cycle LifeCycle that the component exposes

Link copied to clipboard
val parent: Component<*>?

Accessor for the parent component

Link copied to clipboard
val props: ListFieldComponent.Props<T>

Public getter for the Props