diff options
Diffstat (limited to 'src')
56 files changed, 798 insertions, 888 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Style.kt b/src/main/kotlin/pl/treksoft/kvision/core/Style.kt index ff91c429..7c650e6c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Style.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Style.kt @@ -96,26 +96,25 @@ open class Style(className: String? = null, parentStyle: Style? = null, init: (S companion object { internal var counter = 0 internal var styles = mutableListOf<Style>() - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Widget.style(className: String? = null, init: (Style.() -> Unit)? = null): Style { - val style = Style(className, null, init) - this.addCssClass(style) - return style - } - - /** - * DSL builder extension function for cascading styles. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Style.style(className: String? = null, init: (Style.() -> Unit)? = null): Style { - return Style(className, this, init) - } } +} +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Widget.style(className: String? = null, init: (Style.() -> Unit)? = null): Style { + val style = Style(className, null, init) + this.addCssClass(style) + return style +} + +/** + * DSL builder extension function for cascading styles. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Style.style(className: String? = null, init: (Style.() -> Unit)? = null): Style { + return Style(className, this, init) } diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt index 24543b1f..9b3e9226 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt @@ -810,16 +810,16 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component companion object { private var counter: Long = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.widget(classes: Set<String> = setOf(), init: (Widget.() -> Unit)? = null): Widget { - val widget = Widget(classes).apply { init?.invoke(this) } - this.add(widget) - return widget - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.widget(classes: Set<String> = setOf(), init: (Widget.() -> Unit)? = null): Widget { + val widget = Widget(classes).apply { init?.invoke(this) } + this.add(widget) + return widget +} diff --git a/src/main/kotlin/pl/treksoft/kvision/core/WidgetWrapper.kt b/src/main/kotlin/pl/treksoft/kvision/core/WidgetWrapper.kt index 739cb99e..1d5ada90 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/WidgetWrapper.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/WidgetWrapper.kt @@ -23,7 +23,6 @@ package pl.treksoft.kvision.core import com.github.snabbdom.VNode import pl.treksoft.kvision.panel.SimplePanel -import kotlin.Unit /** * This class allows to wrap a component into separately styled DIV element. @@ -55,21 +54,19 @@ open class WidgetWrapper(internal var wrapped: Component?, classes: Set<String> wrapped?.clearParent() wrapped = null } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.widgetWrapper( - wrapped: Component?, - classes: Set<String> = setOf(), - init: (WidgetWrapper.() -> Unit)? = null - ): WidgetWrapper { - val widgetWrapper = WidgetWrapper(wrapped, classes).apply { init?.invoke(this) } - this.add(widgetWrapper) - return widgetWrapper - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.widgetWrapper( + wrapped: Component?, + classes: Set<String> = setOf(), + init: (WidgetWrapper.() -> Unit)? = null +): WidgetWrapper { + val widgetWrapper = WidgetWrapper(wrapped, classes).apply { init?.invoke(this) } + this.add(widgetWrapper) + return widgetWrapper } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt index 4684b1be..8413eb3c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt @@ -46,20 +46,18 @@ open class FieldLabel( override fun getSnAttrs(): List<StringPair> { return super.getSnAttrs() + ("for" to forId) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.fieldLabel( - forId: String, content: String? = null, rich: Boolean = false, - classes: Set<String> = setOf("control-label"), init: (FieldLabel.() -> Unit)? = null - ): FieldLabel { - val fieldLabel = FieldLabel(forId, content, rich, classes).apply { init?.invoke(this) } - this.add(fieldLabel) - return fieldLabel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.fieldLabel( + forId: String, content: String? = null, rich: Boolean = false, + classes: Set<String> = setOf("control-label"), init: (FieldLabel.() -> Unit)? = null +): FieldLabel { + val fieldLabel = FieldLabel(forId, content, rich, classes).apply { init?.invoke(this) } + this.add(fieldLabel) + return fieldLabel } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt index e8fa0a42..894ea4bc 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt @@ -28,6 +28,7 @@ import kotlinx.serialization.serializer import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.StringBoolPair import pl.treksoft.kvision.core.StringPair +import pl.treksoft.kvision.form.FormPanel.Companion.create import pl.treksoft.kvision.html.Div import pl.treksoft.kvision.panel.SimplePanel import pl.treksoft.kvision.types.KFile @@ -390,21 +391,6 @@ open class FormPanel<K : Any>( } companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - inline fun <reified K : Any> Container.formPanel( - method: FormMethod? = null, action: String? = null, enctype: FormEnctype? = null, - type: FormType? = null, condensed: Boolean = false, classes: Set<String> = setOf(), - noinline init: (FormPanel<K>.() -> Unit)? = null - ): FormPanel<K> { - val formPanel = create<K>(method, action, enctype, type, condensed, classes) - init?.invoke(formPanel) - this.add(formPanel) - return formPanel - } @UseExperimental(ImplicitReflectionSerializer::class) inline fun <reified K : Any> create( @@ -419,3 +405,19 @@ open class FormPanel<K : Any>( } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +inline fun <reified K : Any> Container.formPanel( + method: FormMethod? = null, action: String? = null, enctype: FormEnctype? = null, + type: FormType? = null, condensed: Boolean = false, classes: Set<String> = setOf(), + noinline init: (FormPanel<K>.() -> Unit)? = null +): FormPanel<K> { + val formPanel = create<K>(method, action, enctype, type, condensed, classes) + init?.invoke(formPanel) + this.add(formPanel) + return formPanel +} diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt index cb962850..ac25b30d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt @@ -191,19 +191,19 @@ open class CheckBox( companion object { internal var counter = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.checkBox( - value: Boolean = false, name: String? = null, label: String? = null, - rich: Boolean = false, init: (CheckBox.() -> Unit)? = null - ): CheckBox { - val checkBox = CheckBox(value, name, label, rich).apply { init?.invoke(this) } - this.add(checkBox) - return checkBox - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.checkBox( + value: Boolean = false, name: String? = null, label: String? = null, + rich: Boolean = false, init: (CheckBox.() -> Unit)? = null +): CheckBox { + val checkBox = CheckBox(value, name, label, rich).apply { init?.invoke(this) } + this.add(checkBox) + return checkBox +} diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBoxInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBoxInput.kt index ea58268d..ea8bf7db 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBoxInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBoxInput.kt @@ -33,21 +33,18 @@ import pl.treksoft.kvision.core.Container open class CheckBoxInput( value: Boolean = false, classes: Set<String> = setOf() -) : CheckInput(CheckInputType.CHECKBOX, value, classes) { +) : CheckInput(CheckInputType.CHECKBOX, value, classes) - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.checkBoxInput( - value: Boolean = false, - classes: Set<String> = setOf(), init: (CheckInput.() -> Unit)? = null - ): CheckBoxInput { - val checkBoxInput = CheckBoxInput(value, classes).apply { init?.invoke(this) } - this.add(checkBoxInput) - return checkBoxInput - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.checkBoxInput( + value: Boolean = false, + classes: Set<String> = setOf(), init: (CheckInput.() -> Unit)? = null +): CheckBoxInput { + val checkBoxInput = CheckBoxInput(value, classes).apply { init?.invoke(this) } + this.add(checkBoxInput) + return checkBoxInput } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt index e9551196..bb73da60 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt @@ -206,19 +206,19 @@ open class Radio( companion object { internal var counter = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.radio( - value: Boolean = false, extraValue: String? = null, name: String? = null, label: String? = null, - rich: Boolean = false, init: (Radio.() -> Unit)? = null - ): Radio { - val radio = Radio(value, extraValue, name, label, rich).apply { init?.invoke(this) } - this.add(radio) - return radio - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.radio( + value: Boolean = false, extraValue: String? = null, name: String? = null, label: String? = null, + rich: Boolean = false, init: (Radio.() -> Unit)? = null +): Radio { + val radio = Radio(value, extraValue, name, label, rich).apply { init?.invoke(this) } + this.add(radio) + return radio +} diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt index 14b426a3..bee57db4 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt @@ -227,19 +227,19 @@ open class RadioGroup( companion object { internal var counter = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.radioGroup( - options: List<StringPair>? = null, value: String? = null, name: String? = null, inline: Boolean = false, - label: String? = null, rich: Boolean = false, init: (RadioGroup.() -> Unit)? = null - ): RadioGroup { - val radioGroup = RadioGroup(options, value, name, inline, label, rich).apply { init?.invoke(this) } - this.add(radioGroup) - return radioGroup - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.radioGroup( + options: List<StringPair>? = null, value: String? = null, name: String? = null, inline: Boolean = false, + label: String? = null, rich: Boolean = false, init: (RadioGroup.() -> Unit)? = null +): RadioGroup { + val radioGroup = RadioGroup(options, value, name, inline, label, rich).apply { init?.invoke(this) } + this.add(radioGroup) + return radioGroup +} diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt index d4301709..5a47c3ce 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt @@ -174,19 +174,19 @@ open class RadioGroupInput( companion object { internal var counter = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.radioGroupInput( - options: List<StringPair>? = null, value: String? = null, name: String? = null, inline: Boolean = false, - init: (RadioGroupInput.() -> Unit)? = null - ): RadioGroupInput { - val radioGroupInput = RadioGroupInput(options, value, name, inline).apply { init?.invoke(this) } - this.add(radioGroupInput) - return radioGroupInput - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.radioGroupInput( + options: List<StringPair>? = null, value: String? = null, name: String? = null, inline: Boolean = false, + init: (RadioGroupInput.() -> Unit)? = null +): RadioGroupInput { + val radioGroupInput = RadioGroupInput(options, value, name, inline).apply { init?.invoke(this) } + this.add(radioGroupInput) + return radioGroupInput +} diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioInput.kt index 9c6a1670..72bb4cd0 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioInput.kt @@ -33,21 +33,18 @@ import pl.treksoft.kvision.core.Container open class RadioInput( value: Boolean = false, classes: Set<String> = setOf() -) : CheckInput(CheckInputType.RADIO, value, classes) { +) : CheckInput(CheckInputType.RADIO, value, classes) - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.radioInput( - value: Boolean = false, - classes: Set<String> = setOf(), init: (CheckInput.() -> Unit)? = null - ): RadioInput { - val checkBoxInput = RadioInput(value, classes).apply { init?.invoke(this) } - this.add(checkBoxInput) - return checkBoxInput - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.radioInput( + value: Boolean = false, + classes: Set<String> = setOf(), init: (CheckInput.() -> Unit)? = null +): RadioInput { + val checkBoxInput = RadioInput(value, classes).apply { init?.invoke(this) } + this.add(checkBoxInput) + return checkBoxInput } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt index bef14bfa..1bcef061 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt @@ -186,24 +186,24 @@ open class SimpleSelect( companion object { internal var counter = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.simpleSelect( - options: List<StringPair>? = null, - value: String? = null, - emptyOption: Boolean = false, - name: String? = null, - label: String? = null, - rich: Boolean = false, - init: (SimpleSelect.() -> Unit)? = null - ): SimpleSelect { - val simpleSelect = SimpleSelect(options, value, emptyOption, name, label, rich).apply { init?.invoke(this) } - this.add(simpleSelect) - return simpleSelect - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.simpleSelect( + options: List<StringPair>? = null, + value: String? = null, + emptyOption: Boolean = false, + name: String? = null, + label: String? = null, + rich: Boolean = false, + init: (SimpleSelect.() -> Unit)? = null +): SimpleSelect { + val simpleSelect = SimpleSelect(options, value, emptyOption, name, label, rich).apply { init?.invoke(this) } + this.add(simpleSelect) + return simpleSelect +} diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt index 31d32052..bc99f514 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt @@ -199,21 +199,18 @@ open class SimpleSelectInput( override fun blur() { getElementJQuery()?.blur() } +} - companion object { - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.simpleSelectInput( - options: List<StringPair>? = null, value: String? = null, emptyOption: Boolean = false, - classes: Set<String> = setOf(), init: (SimpleSelectInput.() -> Unit)? = null - ): SimpleSelectInput { - val simpleSelectInput = SimpleSelectInput(options, value, emptyOption, classes).apply { init?.invoke(this) } - this.add(simpleSelectInput) - return simpleSelectInput - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.simpleSelectInput( + options: List<StringPair>? = null, value: String? = null, emptyOption: Boolean = false, + classes: Set<String> = setOf(), init: (SimpleSelectInput.() -> Unit)? = null +): SimpleSelectInput { + val simpleSelectInput = SimpleSelectInput(options, value, emptyOption, classes).apply { init?.invoke(this) } + this.add(simpleSelectInput) + return simpleSelectInput } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt index 1d36516e..eb86f152 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt @@ -35,23 +35,21 @@ import pl.treksoft.kvision.core.Container open class Password(value: String? = null, name: String? = null, label: String? = null, rich: Boolean = false) : Text( TextInputType.PASSWORD, value, name, label, rich -) { - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.password( - value: String? = null, - name: String? = null, - label: String? = null, - rich: Boolean = false, - init: (Password.() -> Unit)? = null - ): Password { - val password = Password(value, name, label, rich).apply { init?.invoke(this) } - this.add(password) - return password - } - } +) + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.password( + value: String? = null, + name: String? = null, + label: String? = null, + rich: Boolean = false, + init: (Password.() -> Unit)? = null +): Password { + val password = Password(value, name, label, rich).apply { init?.invoke(this) } + this.add(password) + return password } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt index f493b06e..32fc1881 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt @@ -66,20 +66,18 @@ open class Text( this.addInternal(input) this.addInternal(invalidFeedback) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.text( - type: TextInputType = TextInputType.TEXT, value: String? = null, name: String? = null, - label: String? = null, rich: Boolean = false, init: (Text.() -> Unit)? = null - ): Text { - val text = Text(type, value, name, label, rich).apply { init?.invoke(this) } - this.add(text) - return text - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.text( + type: TextInputType = TextInputType.TEXT, value: String? = null, name: String? = null, + label: String? = null, rich: Boolean = false, init: (Text.() -> Unit)? = null +): Text { + val text = Text(type, value, name, label, rich).apply { init?.invoke(this) } + this.add(text) + return text } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt index ccf17892..47b6870c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt @@ -75,20 +75,18 @@ open class TextArea( this.addInternal(input) this.addInternal(invalidFeedback) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.textArea( - cols: Int? = null, rows: Int? = null, value: String? = null, name: String? = null, - label: String? = null, rich: Boolean = false, init: (TextArea.() -> Unit)? = null - ): TextArea { - val textArea = TextArea(cols, rows, value, name, label, rich).apply { init?.invoke(this) } - this.add(textArea) - return textArea - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.textArea( + cols: Int? = null, rows: Int? = null, value: String? = null, name: String? = null, + label: String? = null, rich: Boolean = false, init: (TextArea.() -> Unit)? = null +): TextArea { + val textArea = TextArea(cols, rows, value, name, label, rich).apply { init?.invoke(this) } + this.add(textArea) + return textArea } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt index 9fc89544..acad7853 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt @@ -69,20 +69,18 @@ open class TextAreaInput(cols: Int? = null, rows: Int? = null, value: String? = } return sn } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.textAreaInput( - cols: Int? = null, rows: Int? = null, value: String? = null, classes: Set<String> = setOf(), - init: (TextAreaInput.() -> Unit)? = null - ): TextAreaInput { - val textAreaInput = TextAreaInput(cols, rows, value, classes).apply { init?.invoke(this) } - this.add(textAreaInput) - return textAreaInput - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.textAreaInput( + cols: Int? = null, rows: Int? = null, value: String? = null, classes: Set<String> = setOf(), + init: (TextAreaInput.() -> Unit)? = null +): TextAreaInput { + val textAreaInput = TextAreaInput(cols, rows, value, classes).apply { init?.invoke(this) } + this.add(textAreaInput) + return textAreaInput } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt index bc6e178d..d057dcbd 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt @@ -77,20 +77,18 @@ open class TextInput(type: TextInputType = TextInputType.TEXT, value: String? = } return sn } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.textInput( - type: TextInputType = TextInputType.TEXT, value: String? = null, classes: Set<String> = setOf(), - init: (TextInput.() -> Unit)? = null - ): TextInput { - val textInput = TextInput(type, value, classes).apply { init?.invoke(this) } - this.add(textInput) - return textInput - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.textInput( + type: TextInputType = TextInputType.TEXT, value: String? = null, classes: Set<String> = setOf(), + init: (TextInput.() -> Unit)? = null +): TextInput { + val textInput = TextInput(type, value, classes).apply { init?.invoke(this) } + this.add(textInput) + return textInput } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt index aaa0f735..ec1d95f5 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt @@ -155,25 +155,23 @@ open class Button( } return this } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.button( - text: String, - icon: String? = null, - style: ButtonStyle = ButtonStyle.PRIMARY, - type: ButtonType = ButtonType.BUTTON, - disabled: Boolean = false, - classes: Set<String> = setOf(), - init: (Button.() -> Unit)? = null - ): Button { - val button = Button(text, icon, style, type, disabled, classes).apply { init?.invoke(this) } - this.add(button) - return button - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.button( + text: String, + icon: String? = null, + style: ButtonStyle = ButtonStyle.PRIMARY, + type: ButtonType = ButtonType.BUTTON, + disabled: Boolean = false, + classes: Set<String> = setOf(), + init: (Button.() -> Unit)? = null +): Button { + val button = Button(text, icon, style, type, disabled, classes).apply { init?.invoke(this) } + this.add(button) + return button } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt b/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt index feb9a970..840d5dc7 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt @@ -75,20 +75,20 @@ open class Canvas( companion object { internal var counter = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.canvas( - canvasWidth: Int? = null, canvasHeight: Int? = null, classes: Set<String> = setOf(), - init: (Canvas.() -> Unit)? = null - ): Canvas { - val canvas = - Canvas(canvasWidth, canvasHeight, classes).apply { init?.invoke(this) } - this.add(canvas) - return canvas - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.canvas( + canvasWidth: Int? = null, canvasHeight: Int? = null, classes: Set<String> = setOf(), + init: (Canvas.() -> Unit)? = null +): Canvas { + val canvas = + Canvas(canvasWidth, canvasHeight, classes).apply { init?.invoke(this) } + this.add(canvas) + return canvas +} diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Div.kt b/src/main/kotlin/pl/treksoft/kvision/html/Div.kt index 42d6b496..2ffabe49 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Div.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Div.kt @@ -46,23 +46,21 @@ open class Div( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.div( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (Div.() -> Unit)? = null - ): Div { - val div = Div(content, rich, align, classes).apply { init?.invoke(this) } - this.add(div) - return div - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.div( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (Div.() -> Unit)? = null +): Div { + val div = Div(content, rich, align, classes).apply { init?.invoke(this) } + this.add(div) + return div } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Footer.kt b/src/main/kotlin/pl/treksoft/kvision/html/Footer.kt index 8b44dfc0..c71e346f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Footer.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Footer.kt @@ -46,23 +46,21 @@ open class Footer( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.footer( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (Footer.() -> Unit)? = null - ): Footer { - val footer = Footer(content, rich, align, classes).apply { init?.invoke(this) } - this.add(footer) - return footer - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.footer( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (Footer.() -> Unit)? = null +): Footer { + val footer = Footer(content, rich, align, classes).apply { init?.invoke(this) } + this.add(footer) + return footer } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H1.kt b/src/main/kotlin/pl/treksoft/kvision/html/H1.kt index 894baf72..6a3ac9cc 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/H1.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/H1.kt @@ -46,23 +46,21 @@ open class H1( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.h1( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (H1.() -> Unit)? = null - ): H1 { - val h1 = H1(content, rich, align, classes).apply { init?.invoke(this) } - this.add(h1) - return h1 - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.h1( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (H1.() -> Unit)? = null +): H1 { + val h1 = H1(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h1) + return h1 } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H2.kt b/src/main/kotlin/pl/treksoft/kvision/html/H2.kt index 54e12b4a..7bdd3473 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/H2.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/H2.kt @@ -46,23 +46,21 @@ open class H2( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.h2( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (H2.() -> Unit)? = null - ): H2 { - val h2 = H2(content, rich, align, classes).apply { init?.invoke(this) } - this.add(h2) - return h2 - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.h2( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (H2.() -> Unit)? = null +): H2 { + val h2 = H2(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h2) + return h2 } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H3.kt b/src/main/kotlin/pl/treksoft/kvision/html/H3.kt index af71cdc5..1a2efdbb 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/H3.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/H3.kt @@ -46,23 +46,21 @@ open class H3( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.h3( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (H3.() -> Unit)? = null - ): H3 { - val h3 = H3(content, rich, align, classes).apply { init?.invoke(this) } - this.add(h3) - return h3 - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.h3( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (H3.() -> Unit)? = null +): H3 { + val h3 = H3(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h3) + return h3 } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H4.kt b/src/main/kotlin/pl/treksoft/kvision/html/H4.kt index 9c1b92ab..ae00b8a7 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/H4.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/H4.kt @@ -46,23 +46,21 @@ open class H4( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.h4( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (H4.() -> Unit)? = null - ): H4 { - val h4 = H4(content, rich, align, classes).apply { init?.invoke(this) } - this.add(h4) - return h4 - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.h4( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (H4.() -> Unit)? = null +): H4 { + val h4 = H4(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h4) + return h4 } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H5.kt b/src/main/kotlin/pl/treksoft/kvision/html/H5.kt index ac993c4d..c40a0658 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/H5.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/H5.kt @@ -46,23 +46,21 @@ open class H5( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.h5( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (H5.() -> Unit)? = null - ): H5 { - val h5 = H5(content, rich, align, classes).apply { init?.invoke(this) } - this.add(h5) - return h5 - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.h5( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (H5.() -> Unit)? = null +): H5 { + val h5 = H5(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h5) + return h5 } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H6.kt b/src/main/kotlin/pl/treksoft/kvision/html/H6.kt index eaef18ff..048ab5df 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/H6.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/H6.kt @@ -46,23 +46,21 @@ open class H6( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.h6( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (H6.() -> Unit)? = null - ): H6 { - val h6 = H6(content, rich, align, classes).apply { init?.invoke(this) } - this.add(h6) - return h6 - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.h6( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (H6.() -> Unit)? = null +): H6 { + val h6 = H6(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h6) + return h6 } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Header.kt b/src/main/kotlin/pl/treksoft/kvision/html/Header.kt index 94a9c079..e62e884e 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Header.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Header.kt @@ -46,23 +46,21 @@ open class Header( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.header( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (Header.() -> Unit)? = null - ): Header { - val header = Header(content, rich, align, classes).apply { init?.invoke(this) } - this.add(header) - return header - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.header( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (Header.() -> Unit)? = null +): Header { + val header = Header(content, rich, align, classes).apply { init?.invoke(this) } + this.add(header) + return header } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Icon.kt b/src/main/kotlin/pl/treksoft/kvision/html/Icon.kt index a9fb03db..a54df1d6 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Icon.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Icon.kt @@ -42,19 +42,17 @@ open class Icon(icon: String) : Tag(TAG.SPAN) { icon.split(" ").forEach { cl.add(it to true) } return cl } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.icon( - icon: String, init: (Icon.() -> Unit)? = null - ): Icon { - val i = Icon(icon).apply { init?.invoke(this) } - this.add(i) - return i - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.icon( + icon: String, init: (Icon.() -> Unit)? = null +): Icon { + val i = Icon(icon).apply { init?.invoke(this) } + this.add(i) + return i } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Iframe.kt b/src/main/kotlin/pl/treksoft/kvision/html/Iframe.kt index a3a067ba..dad33ed4 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Iframe.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Iframe.kt @@ -132,22 +132,20 @@ open class Iframe( open fun getIframeWindow(): Window { return getElementJQueryD()[0].contentWindow } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.iframe( - src: String? = null, srcdoc: String? = null, name: String? = null, iframeWidth: Int? = null, - iframeHeight: Int? = null, sandbox: Set<Sandbox>? = null, classes: Set<String> = setOf(), - init: (Iframe.() -> Unit)? = null - ): Iframe { - val iframe = - Iframe(src, srcdoc, name, iframeWidth, iframeHeight, sandbox, classes).apply { init?.invoke(this) } - this.add(iframe) - return iframe - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.iframe( + src: String? = null, srcdoc: String? = null, name: String? = null, iframeWidth: Int? = null, + iframeHeight: Int? = null, sandbox: Set<Sandbox>? = null, classes: Set<String> = setOf(), + init: (Iframe.() -> Unit)? = null +): Iframe { + val iframe = + Iframe(src, srcdoc, name, iframeWidth, iframeHeight, sandbox, classes).apply { init?.invoke(this) } + this.add(iframe) + return iframe } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt index 81873088..6496b042 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt @@ -99,20 +99,18 @@ open class Image( } return cl } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.image( - src: ResString, alt: String? = null, responsive: Boolean = false, shape: ImageShape? = null, - centered: Boolean = false, classes: Set<String> = setOf(), init: (Image.() -> Unit)? = null - ): Image { - val image = Image(src, alt, responsive, shape, centered, classes).apply { init?.invoke(this) } - this.add(image) - return image - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.image( + src: ResString, alt: String? = null, responsive: Boolean = false, shape: ImageShape? = null, + centered: Boolean = false, classes: Set<String> = setOf(), init: (Image.() -> Unit)? = null +): Image { + val image = Image(src, alt, responsive, shape, centered, classes).apply { init?.invoke(this) } + this.add(image) + return image } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt index 63104248..2c2f1723 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt @@ -83,20 +83,18 @@ open class Link( } return this } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.link( - label: String, url: String? = null, icon: String? = null, image: ResString? = null, - classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null - ): Link { - val link = Link(label, url, icon, image, classes).apply { init?.invoke(this) } - this.add(link) - return link - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.link( + label: String, url: String? = null, icon: String? = null, image: ResString? = null, + classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null +): Link { + val link = Link(label, url, icon, image, classes).apply { init?.invoke(this) } + this.add(link) + return link } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/List.kt b/src/main/kotlin/pl/treksoft/kvision/html/List.kt index cf3f8be6..1d26007c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/List.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/List.kt @@ -133,20 +133,18 @@ open class ListTag( } return cl } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.listTag( - type: ListType, elements: List<String>? = null, rich: Boolean = false, - classes: Set<String> = setOf(), init: (ListTag.() -> Unit)? = null - ): ListTag { - val listTag = ListTag(type, elements, rich, classes, init) - this.add(listTag) - return listTag - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.listTag( + type: ListType, elements: List<String>? = null, rich: Boolean = false, + classes: Set<String> = setOf(), init: (ListTag.() -> Unit)? = null +): ListTag { + val listTag = ListTag(type, elements, rich, classes, init) + this.add(listTag) + return listTag } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/P.kt b/src/main/kotlin/pl/treksoft/kvision/html/P.kt index feadc54a..d5bb2c4d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/P.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/P.kt @@ -46,23 +46,21 @@ open class P( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.p( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (P.() -> Unit)? = null - ): P { - val p = P(content, rich, align, classes).apply { init?.invoke(this) } - this.add(p) - return p - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.p( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (P.() -> Unit)? = null +): P { + val p = P(content, rich, align, classes).apply { init?.invoke(this) } + this.add(p) + return p } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Section.kt b/src/main/kotlin/pl/treksoft/kvision/html/Section.kt index 94413943..43dd8fcf 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Section.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Section.kt @@ -46,23 +46,21 @@ open class Section( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.section( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (Section.() -> Unit)? = null - ): Section { - val section = Section(content, rich, align, classes).apply { init?.invoke(this) } - this.add(section) - return section - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.section( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (Section.() -> Unit)? = null +): Section { + val section = Section(content, rich, align, classes).apply { init?.invoke(this) } + this.add(section) + return section } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Span.kt b/src/main/kotlin/pl/treksoft/kvision/html/Span.kt index bc5e93cd..862d0b2f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Span.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Span.kt @@ -46,23 +46,21 @@ open class Span( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.span( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (Span.() -> Unit)? = null - ): Span { - val span = Span(content, rich, align, classes).apply { init?.invoke(this) } - this.add(span) - return span - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.span( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (Span.() -> Unit)? = null +): Span { + val span = Span(content, rich, align, classes).apply { init?.invoke(this) } + this.add(span) + return span } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt index a5e855ae..aefd3730 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt @@ -192,21 +192,19 @@ open class Tag( else content += translate(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.tag( - type: TAG, content: String? = null, rich: Boolean = false, align: Align? = null, - classes: Set<String> = setOf(), attributes: Map<String, String> = mapOf(), - init: (Tag.() -> Unit)? = null - ): Tag { - val tag = Tag(type, content, rich, align, classes, attributes, init) - this.add(tag) - return tag - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.tag( + type: TAG, content: String? = null, rich: Boolean = false, align: Align? = null, + classes: Set<String> = setOf(), attributes: Map<String, String> = mapOf(), + init: (Tag.() -> Unit)? = null +): Tag { + val tag = Tag(type, content, rich, align, classes, attributes, init) + this.add(tag) + return tag } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt index b871abfa..59c61637 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt @@ -197,17 +197,15 @@ open class DockPanel(classes: Set<String> = setOf(), init: (DockPanel.() -> Unit removeAt(Side.DOWN) return this } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.dockPanel(classes: Set<String> = setOf(), init: (DockPanel.() -> Unit)? = null): DockPanel { - val dockPanel = DockPanel(classes, init) - this.add(dockPanel) - return dockPanel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.dockPanel(classes: Set<String> = setOf(), init: (DockPanel.() -> Unit)? = null): DockPanel { + val dockPanel = DockPanel(classes, init) + this.add(dockPanel) + return dockPanel } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt index 010f7cba..436ade22 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt @@ -218,23 +218,21 @@ open class FlexPanel( } return snstyle } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.flexPanel( - direction: FlexDir? = null, wrap: FlexWrap? = null, justify: FlexJustify? = null, - alignItems: FlexAlignItems? = null, alignContent: FlexAlignContent? = null, - spacing: Int? = null, classes: Set<String> = setOf(), init: (FlexPanel.() -> Unit)? = null - ): FlexPanel { - val flexPanel = FlexPanel(direction, wrap, justify, alignItems, alignContent, spacing, classes, init) - this.add(flexPanel) - return flexPanel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.flexPanel( + direction: FlexDir? = null, wrap: FlexWrap? = null, justify: FlexJustify? = null, + alignItems: FlexAlignItems? = null, alignContent: FlexAlignContent? = null, + spacing: Int? = null, classes: Set<String> = setOf(), init: (FlexPanel.() -> Unit)? = null +): FlexPanel { + val flexPanel = FlexPanel(direction, wrap, justify, alignItems, alignContent, spacing, classes, init) + this.add(flexPanel) + return flexPanel } /** diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt index 1f5efbb4..1598753b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt @@ -255,28 +255,26 @@ open class GridPanel( } return snstyle } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.gridPanel( - autoColumns: String? = null, autoRows: String? = null, autoFlow: GridFlow? = null, - templateColumns: String? = null, templateRows: String? = null, templateAreas: List<String>? = null, - columnGap: Int? = null, rowGap: Int? = null, justifyItems: GridJustify? = null, - alignItems: GridAlign? = null, justifyContent: GridJustifyContent? = null, - alignContent: GridAlignContent? = null, classes: Set<String> = setOf(), init: (GridPanel.() -> Unit)? = null - ): GridPanel { - val gridPanel = GridPanel( - autoColumns, autoRows, autoFlow, templateColumns, templateRows, templateAreas, - columnGap, rowGap, justifyItems, alignItems, justifyContent, alignContent, classes, init - ) - this.add(gridPanel) - return gridPanel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.gridPanel( + autoColumns: String? = null, autoRows: String? = null, autoFlow: GridFlow? = null, + templateColumns: String? = null, templateRows: String? = null, templateAreas: List<String>? = null, + columnGap: Int? = null, rowGap: Int? = null, justifyItems: GridJustify? = null, + alignItems: GridAlign? = null, justifyContent: GridJustifyContent? = null, + alignContent: GridAlignContent? = null, classes: Set<String> = setOf(), init: (GridPanel.() -> Unit)? = null +): GridPanel { + val gridPanel = GridPanel( + autoColumns, autoRows, autoFlow, templateColumns, templateRows, templateAreas, + columnGap, rowGap, justifyItems, alignItems, justifyContent, alignContent, classes, init + ) + this.add(gridPanel) + return gridPanel } class GridWrapper( diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt index 0700e88a..ccc77b0f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt @@ -47,24 +47,22 @@ open class HPanel( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.hPanel( - wrap: FlexWrap? = null, - justify: FlexJustify? = null, - alignItems: FlexAlignItems? = null, - spacing: Int? = null, - classes: Set<String> = setOf(), - init: (HPanel.() -> Unit)? = null - ): HPanel { - val hpanel = HPanel(wrap, justify, alignItems, spacing, classes, init) - this.add(hpanel) - return hpanel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.hPanel( + wrap: FlexWrap? = null, + justify: FlexJustify? = null, + alignItems: FlexAlignItems? = null, + spacing: Int? = null, + classes: Set<String> = setOf(), + init: (HPanel.() -> Unit)? = null +): HPanel { + val hpanel = HPanel(wrap, justify, alignItems, spacing, classes, init) + this.add(hpanel) + return hpanel } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt index 7d06428a..111d4738 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt @@ -211,30 +211,29 @@ class Root : SimplePanel { fun removeModal(modal: Widget) { modals.remove(modal) } + } +} - /** - * Create new Root container based on ID - * @param id ID attribute of element in the main HTML file - * @param fixed if false, the container is rendered with Bootstrap "container-fluid" class, - * otherwise it's rendered with "container" class (default is false) - * @param init an initializer extension function - * @return the created Root container - */ - fun Application.root(id: String, fixed: Boolean = false, init: Root.() -> Unit): Root { - return Root(id, fixed, init) - } - - /** - * Create new Root container based on HTML element - * @param element HTML element in the DOM tree - * @param fixed if false, the container is rendered with Bootstrap "container-fluid" class, - * otherwise it's rendered with "container" class (default is false) - * @param init an initializer extension function - * @return the created Root container - */ - fun Application.root(element: HTMLElement, fixed: Boolean = false, init: Root.() -> Unit): Root { - return Root(element, fixed, init) - } +/** + * Create new Root container based on ID + * @param id ID attribute of element in the main HTML file + * @param fixed if false, the container is rendered with Bootstrap "container-fluid" class, + * otherwise it's rendered with "container" class (default is false) + * @param init an initializer extension function + * @return the created Root container + */ +fun Application.root(id: String, fixed: Boolean = false, init: Root.() -> Unit): Root { + return Root(id, fixed, init) +} - } +/** + * Create new Root container based on HTML element + * @param element HTML element in the DOM tree + * @param fixed if false, the container is rendered with Bootstrap "container-fluid" class, + * otherwise it's rendered with "container" class (default is false) + * @param init an initializer extension function + * @return the created Root container + */ +fun Application.root(element: HTMLElement, fixed: Boolean = false, init: Root.() -> Unit): Root { + return Root(element, fixed, init) } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt index 91eeda80..915fa6a7 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt @@ -101,17 +101,15 @@ open class SimplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() -> children.forEach { it.dispose() } removeAll() } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.simplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() -> Unit)? = null): SimplePanel { - val simplePanel = SimplePanel(classes, init) - this.add(simplePanel) - return simplePanel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.simplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() -> Unit)? = null): SimplePanel { + val simplePanel = SimplePanel(classes, init) + this.add(simplePanel) + return simplePanel } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt index 8b46ae0b..c7f4b3ac 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt @@ -98,22 +98,20 @@ open class SplitPanel( arrayOf() } } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.splitPanel( - direction: Direction = Direction.VERTICAL, - classes: Set<String> = setOf(), init: (SplitPanel.() -> Unit)? = null - ): SplitPanel { - val splitPanel = SplitPanel(direction, classes, init) - this.add(splitPanel) - return splitPanel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.splitPanel( + direction: Direction = Direction.VERTICAL, + classes: Set<String> = setOf(), init: (SplitPanel.() -> Unit)? = null +): SplitPanel { + val splitPanel = SplitPanel(direction, classes, init) + this.add(splitPanel) + return splitPanel } internal class Splitter(private val splitPanel: SplitPanel, direction: Direction) : Tag( diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt index 37dd449b..26bfcb8c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt @@ -118,18 +118,18 @@ open class StackPanel( companion object { internal var counter = 0 - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.stackPanel( - activateLast: Boolean = true, classes: Set<String> = setOf(), init: (StackPanel.() -> Unit)? = null - ): StackPanel { - val stackPanel = StackPanel(activateLast, classes, init) - this.add(stackPanel) - return stackPanel - } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.stackPanel( + activateLast: Boolean = true, classes: Set<String> = setOf(), init: (StackPanel.() -> Unit)? = null +): StackPanel { + val stackPanel = StackPanel(activateLast, classes, init) + this.add(stackPanel) + return stackPanel +} diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt index eb9c138e..e5d275d4 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt @@ -46,20 +46,18 @@ open class VPanel( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.vPanel( - justify: FlexJustify? = null, alignItems: FlexAlignItems? = null, spacing: Int? = null, - classes: Set<String> = setOf(), init: (VPanel.() -> Unit)? = null - ): VPanel { - val vpanel = VPanel(justify, alignItems, spacing, classes, init) - this.add(vpanel) - return vpanel - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.vPanel( + justify: FlexJustify? = null, alignItems: FlexAlignItems? = null, spacing: Int? = null, + classes: Set<String> = setOf(), init: (VPanel.() -> Unit)? = null +): VPanel { + val vpanel = VPanel(justify, alignItems, spacing, classes, init) + this.add(vpanel) + return vpanel } diff --git a/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt b/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt index adb7d3be..20cb2d8e 100644 --- a/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt +++ b/src/main/kotlin/pl/treksoft/kvision/state/StateBinding.kt @@ -49,7 +49,7 @@ class StateBinding<S : Any, CONT : Container, CONTENT>( } } - private fun setUpdateState(updateState: (S, CONTENT) -> Unit) { + internal fun setUpdateState(updateState: (S, CONTENT) -> Unit) { this.updateState = updateState } @@ -57,32 +57,30 @@ class StateBinding<S : Any, CONT : Container, CONTENT>( unsubscribe() super.dispose() } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun <S : Any, CONT : Container> CONT.stateBinding( - observableState: ObservableState<S>, - factory: (CONT.(S) -> Unit) - ): StateBinding<S, CONT, Unit> { - return StateBinding(observableState, this, factory) - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun <S : Any, CONT : Container> CONT.stateBinding( + observableState: ObservableState<S>, + factory: (CONT.(S) -> Unit) +): StateBinding<S, CONT, Unit> { + return StateBinding(observableState, this, factory) +} - /** - * DSL builder extension function for updateable redux content. - * - * It takes the same parameters as the constructor of the built component. - */ - fun <S : Any, CONT : Container, CONTENT> CONT.stateUpdate( - observableState: ObservableState<S>, - factory: (CONT.(S) -> CONTENT) - ): Updateable<S, CONTENT> { - return Updateable(StateBinding(observableState, this, factory)::setUpdateState) - } - } +/** + * DSL builder extension function for updateable redux content. + * + * It takes the same parameters as the constructor of the built component. + */ +fun <S : Any, CONT : Container, CONTENT> CONT.stateUpdate( + observableState: ObservableState<S>, + factory: (CONT.(S) -> CONTENT) +): Updateable<S, CONTENT> { + return Updateable(StateBinding(observableState, this, factory)::setUpdateState) } /** diff --git a/src/main/kotlin/pl/treksoft/kvision/table/Cell.kt b/src/main/kotlin/pl/treksoft/kvision/table/Cell.kt index 44646897..4cf72f77 100644 --- a/src/main/kotlin/pl/treksoft/kvision/table/Cell.kt +++ b/src/main/kotlin/pl/treksoft/kvision/table/Cell.kt @@ -47,39 +47,36 @@ open class Cell( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Row.cell( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), init: (Cell.() -> Unit)? = null - ): Cell { - val cell = Cell(content, rich, align, classes, init) - this.add(cell) - return cell - } - - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Row.thcell( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), init: (HeaderCell.() -> Unit)? = null - ): HeaderCell { - val headerCell = HeaderCell(content, rich, align, Scope.ROW, classes, init) - this.add(headerCell) - return headerCell - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Row.cell( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), init: (Cell.() -> Unit)? = null +): Cell { + val cell = Cell(content, rich, align, classes, init) + this.add(cell) + return cell +} +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Row.thcell( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), init: (HeaderCell.() -> Unit)? = null +): HeaderCell { + val headerCell = HeaderCell(content, rich, align, Scope.ROW, classes, init) + this.add(headerCell) + return headerCell } diff --git a/src/main/kotlin/pl/treksoft/kvision/table/HeaderCell.kt b/src/main/kotlin/pl/treksoft/kvision/table/HeaderCell.kt index 14527f0f..f7f45784 100644 --- a/src/main/kotlin/pl/treksoft/kvision/table/HeaderCell.kt +++ b/src/main/kotlin/pl/treksoft/kvision/table/HeaderCell.kt @@ -57,24 +57,21 @@ open class HeaderCell( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Row.headerCell( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - scope: Scope? = null, - classes: Set<String> = setOf(), init: (HeaderCell.() -> Unit)? = null - ): HeaderCell { - val cell = HeaderCell(content, rich, align, scope, classes, init) - this.add(cell) - return cell - } - } - +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Row.headerCell( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + scope: Scope? = null, + classes: Set<String> = setOf(), init: (HeaderCell.() -> Unit)? = null +): HeaderCell { + val cell = HeaderCell(content, rich, align, scope, classes, init) + this.add(cell) + return cell } diff --git a/src/main/kotlin/pl/treksoft/kvision/table/Row.kt b/src/main/kotlin/pl/treksoft/kvision/table/Row.kt index 34ce3471..0681953f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/table/Row.kt +++ b/src/main/kotlin/pl/treksoft/kvision/table/Row.kt @@ -34,25 +34,21 @@ import pl.treksoft.kvision.html.Tag open class Row(classes: Set<String> = setOf(), init: (Row.() -> Unit)? = null) : Tag( TAG.TR, classes = classes ) { - init { @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Table.row( - classes: Set<String> = setOf(), init: (Row.() -> Unit)? = null - ): Row { - val row = Row(classes, init) - this.add(row) - return row - } - } - +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Table.row( + classes: Set<String> = setOf(), init: (Row.() -> Unit)? = null +): Row { + val row = Row(classes, init) + this.add(row) + return row } diff --git a/src/main/kotlin/pl/treksoft/kvision/table/Table.kt b/src/main/kotlin/pl/treksoft/kvision/table/Table.kt index 6d7c9b6e..114e3dfa 100644 --- a/src/main/kotlin/pl/treksoft/kvision/table/Table.kt +++ b/src/main/kotlin/pl/treksoft/kvision/table/Table.kt @@ -200,22 +200,20 @@ open class Table( override fun getChildren(): List<Component> { return tbody.getChildren() } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.table( - headerNames: List<String>? = null, - types: Set<TableType> = setOf(), caption: String? = null, responsiveType: ResponsiveType? = null, - theadType: TheadType? = null, classes: Set<String> = setOf(), init: (Table.() -> Unit)? = null - ): Table { - val table = - Table(headerNames, types, caption, responsiveType, theadType, classes, init) - this.add(table) - return table - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.table( + headerNames: List<String>? = null, + types: Set<TableType> = setOf(), caption: String? = null, responsiveType: ResponsiveType? = null, + theadType: TheadType? = null, classes: Set<String> = setOf(), init: (Table.() -> Unit)? = null +): Table { + val table = + Table(headerNames, types, caption, responsiveType, theadType, classes, init) + this.add(table) + return table } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt index 4fbe3d59..cf7c21b2 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/core/StyleSpec.kt @@ -24,8 +24,8 @@ package test.pl.treksoft.kvision.core import pl.treksoft.kvision.core.Col import pl.treksoft.kvision.core.Color import pl.treksoft.kvision.core.Overflow -import pl.treksoft.kvision.core.Style.Companion.style -import pl.treksoft.kvision.core.Widget.Companion.widget +import pl.treksoft.kvision.core.style +import pl.treksoft.kvision.core.widget import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.utils.px import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/state/StateBindingSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/state/StateBindingSpec.kt index f5416748..c0de7c6f 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/state/StateBindingSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/state/StateBindingSpec.kt @@ -21,12 +21,12 @@ */ package test.pl.treksoft.kvision.state -import pl.treksoft.kvision.html.Div.Companion.div +import pl.treksoft.kvision.html.div import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.state.StateBinding.Companion.stateBinding -import pl.treksoft.kvision.state.StateBinding.Companion.stateUpdate import pl.treksoft.kvision.state.observableListOf +import pl.treksoft.kvision.state.stateBinding +import pl.treksoft.kvision.state.stateUpdate import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test diff --git a/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt index d9a6fdfa..8f80f465 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/table/RowSpec.kt @@ -22,8 +22,8 @@ package test.pl.treksoft.kvision.table import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.table.Cell.Companion.cell import pl.treksoft.kvision.table.Row +import pl.treksoft.kvision.table.cell import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test diff --git a/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt index 69dc05d3..e81e539d 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/table/TableSpec.kt @@ -22,11 +22,11 @@ package test.pl.treksoft.kvision.table import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.table.Cell.Companion.cell import pl.treksoft.kvision.table.ResponsiveType -import pl.treksoft.kvision.table.Row.Companion.row import pl.treksoft.kvision.table.Table import pl.treksoft.kvision.table.TableType +import pl.treksoft.kvision.table.cell +import pl.treksoft.kvision.table.row import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test |