kvision / pl.treksoft.kvision.core / Widget

Widget

(js) open class Widget : StyledComponent, Component

Base widget class. The parent of all component classes.

A simple widget is rendered as HTML DIV element.

Types

(js)

RefreshDelegate

inner class RefreshDelegate<T>
(js)

RefreshDelegateProvider

inner class RefreshDelegateProvider<T>

Constructors

(js)

<init>

Creates basic Widget with given CSS class names.

Widget(classes: Set<String> = setOf())

Properties

(js)

afterDestroyHook

A function called after the widget is removed from the DOM.

var afterDestroyHook: (() -> Unit)?
(js)

afterDisposeHook

A function called after the widget is disposed.

var afterDisposeHook: (() -> Unit)?
(js)

afterInsertHook

A function called after the widget is inserted to the DOM.

var afterInsertHook: ((VNode) -> Unit)?
(js)

draggable

Determines if the current widget is draggable.

var draggable: Boolean?
(js)

eventTarget

var eventTarget: Widget?
(js)

id

An ID attribute of generated HTML element.

var id: String?
(js)

lastLanguage

var lastLanguage: String?
(js)

parent

Parent of the current component.

open var parent: Container?
(js)

popoverOptions

var popoverOptions: PopoverOptions?
(js)

role

A role attribute of generated HTML element.

var role: String?
(js)

surroundingSpan

var surroundingSpan: Boolean
(js)

tabindex

A tabindex attribute of generated HTML element.

var tabindex: Int?
(js)

title

A title attribute of generated HTML element.

var title: String?
(js)

tooltipOptions

var tooltipOptions: TooltipOptions?
(js)

visible

Visibility state of the current component.

open var visible: Boolean
(js)

vnode

var vnode: VNode?

Functions

(js)

addCssClass

Adds given value to the set of CSS classes generated in html code of current component.

open fun addCssClass(css: String): Widget
(js)

addCssStyle

Adds given style object to the set of CSS classes generated in html code of current component.

open fun addCssStyle(css: Style): Widget
(js)

addSurroundingCssClass

Adds given value to the set of CSS classes generated in html code of parent component.

open fun addSurroundingCssClass(css: String): Widget
(js)

addSurroundingCssStyle

Adds given style object to the set of CSS classes generated in html code of parent component.

open fun addSurroundingCssStyle(css: Style): Widget
(js)

afterCreate

Method called after creating Snabbdom vnode.

open fun afterCreate(node: VNode): Unit
(js)

afterDestroy

Method called after destroying Snabbdom vnode.

open fun afterDestroy(): Unit
(js)

afterInsert

Method called after inserting Snabbdom vnode into the DOM.

open fun afterInsert(node: VNode): Unit
(js)

animate

Animate the widget changing CSS properties.

open fun animate(duration: Int = 400, easing: Easing = Easing.SWING, complete: (() -> Unit)? = null, styles: StyledComponent.() -> Unit): Unit
(js)

clearDragDropData

Clears D&D data for the current widget. It also makes it not draggable.

open fun clearDragDropData(): Unit
(js)

disablePopover

Disables popover for the current widget.

open fun disablePopover(): Widget
(js)

disableTooltip

Disables tooltip for the current widget.

open fun disableTooltip(): Widget
(js)

dispatchEvent

open fun dispatchEvent(type: String, eventInitDict: CustomEventInit): Boolean?
(js)

enablePopover

Enables popover for the current widget.

open fun enablePopover(options: PopoverOptions = PopoverOptions()): Widget
(js)

enableTooltip

Enables tooltip for the current widget.

open fun enableTooltip(options: TooltipOptions = TooltipOptions()): Widget
(js)

fadeIn

Shows current widget with fade in effect.

open fun fadeIn(duration: Int = 400, easing: Easing = Easing.SWING, complete: (() -> Unit)? = null): Widget
(js)

fadeOut

Hides current widget with fade out effect.

open fun fadeOut(duration: Int = 400, easing: Easing = Easing.SWING, complete: (() -> Unit)? = null): Widget
(js)

getAttribute

Returns the value of an additional attribute.

open fun getAttribute(name: String): String?
(js)

getElement

Returns DOM element bound to the current component.

open fun getElement(): Node?
(js)

getElementJQuery

Returns JQuery element bound to the current component.

open fun getElementJQuery(): JQuery?
(js)

getElementJQueryD

Returns JQuery element bound to the current component as a dynamic type.

open fun getElementJQueryD(): dynamic
(js)

getSnAttrs

Returns list of element attributes in the form of a List.

open fun getSnAttrs(): List<StringPair>
(js)

getSnClass

Returns list of CSS class names for current widget in the form of a List.

open fun getSnClass(): List<StringBoolPair>
(js)

getSnHooks

Returns list of hooks in the form of a Snabbdom Hooks object.

open fun getSnHooks(): Hooks?
(js)

getSnOn

Returns list of event handlers in the form of a Snabbdom On object.

open fun getSnOn(): On?
(js)

hide

Makes current widget invisible.

open fun hide(): Widget
(js)

hideAnim

Hides current widget with animation effect.

open fun hideAnim(duration: Int = 400, easing: Easing = Easing.SWING, complete: (() -> Unit)? = null): Widget
(js)

hidePopover

Hides popover for the current widget.

open fun hidePopover(): Widget
(js)

hideTooltip

Hides tooltip for the current widget.

open fun hideTooltip(): Widget
(js)

refreshOnUpdate

fun <T> refreshOnUpdate(refreshFunction: (T) -> Unit = { this.refresh() }): RefreshDelegateProvider<T>
fun <T> refreshOnUpdate(initialValue: T, refreshFunction: (T) -> Unit = { this.refresh() }): RefreshDelegateProvider<T>
(js)

removeAttribute

Removes the value of additional attribute.

open fun removeAttribute(name: String): Widget
(js)

removeCssClass

Removes given value from the set of CSS classes generated in html code of current component.

open fun removeCssClass(css: String): Widget
(js)

removeCssStyle

Removes given style object from the set of CSS classes generated in html code of current component.

open fun removeCssStyle(css: Style): Widget
(js)

removeEventListener

Removes event listener from current widget.

open fun removeEventListener(id: Int): Widget
(js)

removeEventListeners

Removes all event listeners from current widget.

open fun removeEventListeners(): Widget
(js)

removeSurroundingCssClass

Removes given value from the set of CSS classes generated in html code of parent component.

open fun removeSurroundingCssClass(css: String): Widget
(js)

removeSurroundingCssStyle

Removes given style object from the set of CSS classes generated in html code of parent component.

open fun removeSurroundingCssStyle(css: Style): Widget
(js)

render

Renders current component as a Snabbdom vnode.

open fun render(): VNode
open fun render(elementName: String): VNode
open fun render(elementName: String, children: Array<dynamic>): VNode
(js)

setAttribute

Sets the value of additional attribute.

open fun setAttribute(name: String, value: String): Widget
(js)

setDragDropData

Sets D&D data for the current widget. It also makes it draggable.

open fun setDragDropData(format: String, data: String): Unit
(js)

setDropTarget

Sets the current widget as a D&D drop target.

open fun setDropTarget(format: String, callback: (DragEvent) -> Unit): Unit
open fun setDropTarget(formats: Set<String>? = null, callback: (DragEvent) -> Unit): Unit
(js)

setDropTargetData

Sets the current widget as a D&D drop target with helper callback accepting String data.

open fun setDropTargetData(format: String, callback: (String?) -> Unit): Unit
(js)

setEventListener

Sets an event listener for current widget, keeping the actual type of component.

open fun <T : Widget> setEventListener(block: SnOn<T>.() -> Unit): Int
(js)

show

Makes current widget visible.

open fun show(): Widget
(js)

showAnim

Shows current widget with animation effect.

open fun showAnim(duration: Int = 400, easing: Easing = Easing.SWING, complete: (() -> Unit)? = null): Widget
(js)

showPopover

Shows popover for the current widget.

open fun showPopover(): Widget
(js)

showTooltip

Shows tooltip for the current widget.

open fun showTooltip(): Widget
(js)

singleRender

fun <T> singleRender(block: () -> T): T
(js)

slideDown

Shows current widget with slide down effect.

open fun slideDown(duration: Int = 400, easing: Easing = Easing.SWING, complete: (() -> Unit)? = null): Widget
(js)

slideUp

Hides current widget with slide up effect.

open fun slideUp(duration: Int = 400, easing: Easing = Easing.SWING, complete: (() -> Unit)? = null): Widget
(js)

toggleVisible

Toggles visibility of current widget.

open fun toggleVisible(): Widget
(js)

translate

Translates given text with I18n trans function and sets lastLanguage marker.

fun translate(text: String): Stringfun translate(text: String?): String?

Extension Properties

(js)

changeFlow

Extension property returning Flow for a change event.

val <T : Widget> T.changeFlow: Flow<T>
(js)

clickFlow

Extension property returning Flow for a click event.

val <T : Widget> T.clickFlow: Flow<T>
(js)

inputFlow

Extension property returning Flow for an input event.

val <T : Widget> T.inputFlow: Flow<T>

Extension Functions

(js)

addBsBgColor

fun Component.addBsBgColor(bsBgColor: BsBgColor): Unit
(js)

addBsBorder

fun Component.addBsBorder(vararg bsBorder: BsBorder): Unit
(js)

addBsClearfix

fun Component.addBsClearfix(): Unit
(js)

addBsColor

fun Component.addBsColor(bsColor: BsColor): Unit
(js)

addBsRounded

fun Component.addBsRounded(vararg bsRounded: BsRounded): Unit
(js)

bind

An extension function which binds the widget to the observable state.

fun <S, W : Widget> W.bind(observableState: ObservableState<S>, removeChildren: Boolean = true, factory: W.(S) -> Unit): W
(js)

contextMenu

DSL builder extension function.

fun Widget.contextMenu(fixedPosition: Boolean = false, classes: Set<String>? = null, className: String? = null, init: (ContextMenu.() -> Unit)? = null): ContextMenu
(js)

enableGestureDetector

Enable gesture detector for a given Widget.

fun Widget.enableGestureDetector(): Unit
(js)

eventFlow

Extension property returning Flow<Pair<Widget, Event>> for a given event

fun <T : Widget> T.eventFlow(event: String): Flow<Pair<T, Event>>
(js)

onClick

An extension function for defining on click event handlers.

fun <T : Widget> T.onClick(handler: T.(MouseEvent) -> Unit): Int
(js)

onEvent

An extension function for defining event handlers.

fun <T : Widget> T.onEvent(block: SnOn<T>.() -> Unit): Int
(js)

removeBsBgColor

fun Component.removeBsBgColor(bsBgColor: BsBgColor): Unit
(js)

removeBsBorder

fun Component.removeBsBorder(vararg bsBorder: BsBorder): Unit
(js)

removeBsClearfix

fun Component.removeBsClearfix(): Unit
(js)

removeBsColor

fun Component.removeBsColor(bsColor: BsColor): Unit
(js)

removeBsRounded

fun Component.removeBsRounded(vararg bsRounded: BsRounded): Unit
(js)

setContextMenu

Sets context menu for the current widget.

fun Widget.setContextMenu(contextMenu: ContextMenu): Widget
(js)

style

DSL builder extension function.

fun Widget.style(className: String? = null, init: (Style.() -> Unit)? = null): Style

Inheritors

(js)

AbstractTextInput

Base class for basic text components.

abstract class AbstractTextInput : Widget, FormInput, ObservableState<String?>
(js)

Canvas

Canvas component.

open class Canvas : Widget
(js)

Chart

Chart component.

open class Chart : Widget
(js)

CheckInput

The basic input component rendered as HTML input type="checkbox" or input type="radio".

abstract class CheckInput : Widget, FormInput, ObservableState<Boolean>
(js)

CloseIcon

Helper class for close icon component.

open class CloseIcon : Widget
(js)

DataContainer

A container class with support for mutable/observable data model.

class DataContainer<M, C : Component, CONT : Container> : Widget, Container, DataUpdatable
(js)

Icon

An icon component.

open class Icon : Widget
(js)

Iframe

Iframe component.

open class Iframe : Widget
(js)

Image

Image component.

open class Image : Widget
(js)

Maps

Maps component.

open class Maps : Widget
(js)

MaximizeIcon

Helper class for maximize icon component.

open class MaximizeIcon : Widget
(js)

MinimizeIcon

Helper class for minimize icon component.

open class MinimizeIcon : Widget
(js)

OnsDateTimeInput

OnsenUI date/time input component.

open class OnsDateTimeInput : Widget, FormInput, ObservableState<Date?>
(js)

OnsLazyRepeat

An Onsen UI lazy repeat helper component.

open class OnsLazyRepeat : Widget
(js)

OnsNumberInput

OnsenUI number input component.

open class OnsNumberInput : Widget, FormInput, ObservableState<Number?>
(js)

ProgressBar

A progress bar component.

open class ProgressBar : Widget
(js)

ProgressCircular

A circular progress indicator component.

open class ProgressCircular : Widget
(js)

RangeInput

Range input component.

open class RangeInput : Widget, FormInput, ObservableState<Number?>
(js)

React

React component for KVision with support for state holder.

class React<S> : Widget, ObservableState<S>
(js)

Ripple

A ripple effect component.

open class Ripple : Widget
(js)

SelectOption

The helper component for adding options to Select or SelectOptGroup.

open class SelectOption : Widget
(js)

SimplePanel

Basic container class, rendered as a DIV element with all children directly within.

open class SimplePanel : Widget, Container
(js)

SpinnerInput

The basic component for spinner control.

open class SpinnerInput : Widget, FormInput, ObservableState<Number?>
(js)

StateBinding

A class which binds the given container to the observable state.

class StateBinding<S : Any, CONT : Container, CONTENT> : Widget
(js)

Tabulator

Tabulator component.

open class Tabulator<T : Any> : Widget
(js)

TextNode

Simple component for rendering text DOM node.

open class TextNode : Widget
(js)

UploadInput

The file upload component.

open class UploadInput : Widget, FormInput