summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Widget.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/WidgetWrapper.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Button.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Image.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Label.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Link.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/List.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Tag.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt14
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt9
38 files changed, 190 insertions, 119 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
index 532a6bb7..f50b1679 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
@@ -519,12 +519,14 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent() {
companion object {
/**
- * DSL builder extension function
+ * 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) {
- this.add(Widget(classes).apply { init?.invoke(this) })
+ 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 81765846..2616e77c 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/WidgetWrapper.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/WidgetWrapper.kt
@@ -56,7 +56,7 @@ open class WidgetWrapper(internal var wrapped: Component?, classes: Set<String>
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -64,8 +64,10 @@ open class WidgetWrapper(internal var wrapped: Component?, classes: Set<String>
wrapped: Component?,
classes: Set<String> = setOf(),
init: (WidgetWrapper.() -> Unit)? = null
- ) {
- this.add(WidgetWrapper(wrapped, classes).apply { init?.invoke(this) })
+ ): WidgetWrapper {
+ val widgetWrapper = WidgetWrapper(wrapped, classes).apply { init?.invoke(this) }
+ this.add(widgetWrapper)
+ return widgetWrapper
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
index fa545dc8..c008c47b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
@@ -126,7 +126,7 @@ class DataContainer<M : DataComponent, C : Component>(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -135,8 +135,10 @@ class DataContainer<M : DataComponent, C : Component>(
binding: (Int) -> C,
child: Container = VPanel(),
init: (DataContainer<M, C>.() -> Unit)? = null
- ) {
- this.add(DataContainer(model, binding, child, init))
+ ): DataContainer<M, C> {
+ val dataContainer = DataContainer(model, binding, child, init)
+ this.add(dataContainer)
+ return dataContainer
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
index 1af71dc8..0f653d30 100644
--- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
@@ -239,7 +239,7 @@ open class DropDown(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -247,8 +247,10 @@ open class DropDown(
text: String, elements: List<StringPair>? = null, icon: String? = null,
style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT, disabled: Boolean = false,
classes: Set<String> = setOf(), init: (DropDown.() -> Unit)? = null
- ) {
- this.add(DropDown(text, elements, icon, style, disabled, classes).apply { init?.invoke(this) })
+ ): DropDown {
+ val dropDown = DropDown(text, elements, icon, style, disabled, classes).apply { init?.invoke(this) }
+ this.add(dropDown)
+ return dropDown
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
index 70c44fd7..75cb9c03 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/FormPanel.kt
@@ -218,7 +218,7 @@ open class FormPanel<K>(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
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 4c373a2d..7a8b5905 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt
@@ -203,15 +203,17 @@ open class CheckBox(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.checkBox(
value: Boolean = false, label: String? = null,
rich: Boolean = false, init: (CheckBox.() -> Unit)? = null
- ) {
- this.add(CheckBox(value, label, rich).apply { init?.invoke(this) })
+ ): CheckBox {
+ val checkBox = CheckBox(value, label, rich).apply { init?.invoke(this) }
+ this.add(checkBox)
+ return checkBox
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt
index 8d083b42..46e5395c 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt
@@ -183,15 +183,17 @@ open class CheckInput(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.checkInput(
type: CHECKINPUTTYPE = CHECKINPUTTYPE.CHECKBOX, value: Boolean = false,
classes: Set<String> = setOf(), init: (CheckInput.() -> Unit)? = null
- ) {
- this.add(CheckInput(type, value, classes).apply { init?.invoke(this) })
+ ): CheckInput {
+ val checkInput = CheckInput(type, value, classes).apply { init?.invoke(this) }
+ this.add(checkInput)
+ return checkInput
}
}
}
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 13f4c4cd..ef5d6eb9 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
@@ -223,15 +223,17 @@ open class Radio(
internal var counter = 0
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(Radio(value, extraValue, name, label, rich).apply { init?.invoke(this) })
+ ): 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 80736d59..c7eb5a22 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
@@ -167,15 +167,17 @@ open class RadioGroup(
internal var counter = 0
/**
- * DSL builder extension function
+ * 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, inline: Boolean = false,
label: String? = null, rich: Boolean = false, init: (RadioGroup.() -> Unit)? = null
- ) {
- this.add(RadioGroup(options, value, inline, label, rich).apply { init?.invoke(this) })
+ ): RadioGroup {
+ val radioGroup = RadioGroup(options, value, inline, label, rich).apply { init?.invoke(this) }
+ this.add(radioGroup)
+ return radioGroup
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
index dc55dd04..2e9b5562 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
@@ -274,7 +274,7 @@ open class Select(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -282,8 +282,10 @@ open class Select(
options: List<StringPair>? = null, value: String? = null,
multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
rich: Boolean = false, init: (Select.() -> Unit)? = null
- ) {
- this.add(Select(options, value, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) })
+ ): Select {
+ val select = Select(options, value, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) }
+ this.add(select)
+ return select
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
index be986f02..f90401ce 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
@@ -388,7 +388,7 @@ open class SelectInput(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -396,8 +396,10 @@ open class SelectInput(
options: List<StringPair>? = null, value: String? = null,
multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
classes: Set<String> = setOf(), init: (SelectInput.() -> Unit)? = null
- ) {
- this.add(SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) })
+ ): SelectInput {
+ val selectInput = SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) }
+ this.add(selectInput)
+ return selectInput
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
index 2a5d2cbe..3cd50473 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
@@ -240,7 +240,7 @@ open class Spinner(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -249,12 +249,14 @@ open class Spinner(
decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
forceType: FORCETYPE = FORCETYPE.NONE, label: String? = null,
rich: Boolean = false, init: (Spinner.() -> Unit)? = null
- ) {
- this.add(Spinner(value, min, max, step, decimals, buttonsType, forceType, label, rich).apply {
+ ): Spinner {
+ val spinner = Spinner(value, min, max, step, decimals, buttonsType, forceType, label, rich).apply {
init?.invoke(
this
)
- })
+ }
+ this.add(spinner)
+ return spinner
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
index 6dcb2b4a..a3f72b75 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
@@ -342,7 +342,7 @@ open class SpinnerInput(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -351,12 +351,14 @@ open class SpinnerInput(
decimals: Int = 0, buttonsType: BUTTONSTYPE = BUTTONSTYPE.VERTICAL,
forceType: FORCETYPE = FORCETYPE.NONE, classes: Set<String> = setOf(),
init: (SpinnerInput.() -> Unit)? = null
- ) {
- this.add(SpinnerInput(value, min, max, step, decimals, buttonsType, forceType, classes).apply {
+ ): SpinnerInput {
+ val spinnerInput = SpinnerInput(value, min, max, step, decimals, buttonsType, forceType, classes).apply {
init?.invoke(
this
)
- })
+ }
+ this.add(spinnerInput)
+ return spinnerInput
}
}
}
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 39c9a306..e2f9ab93 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/Password.kt
@@ -37,14 +37,16 @@ open class Password(value: String? = null, label: String? = null, rich: Boolean
) {
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.password(
value: String? = null, label: String? = null, rich: Boolean = false, init: (Password.() -> Unit)? = null
- ) {
- this.add(Password(value, label, rich).apply { init?.invoke(this) })
+ ): Password {
+ val password = Password(value, label, rich).apply { init?.invoke(this) }
+ this.add(password)
+ return password
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
index 9d5c8c49..953fec90 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt
@@ -56,14 +56,16 @@ open class RichText(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.richText(
value: String? = null, label: String? = null, rich: Boolean = false, init: (RichText.() -> Unit)? = null
- ) {
- this.add(RichText(value, label, rich).apply { init?.invoke(this) })
+ ): RichText {
+ val richText = RichText(value, label, rich).apply { init?.invoke(this) }
+ this.add(richText)
+ return richText
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
index f802cc2a..9e6e61b0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
@@ -112,14 +112,16 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf())
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.richTextInput(
value: String? = null, classes: Set<String> = setOf(), init: (RichTextInput.() -> Unit)? = null
- ) {
- this.add(RichTextInput(value, classes).apply { init?.invoke(this) })
+ ): RichTextInput {
+ val richTextInput = RichTextInput(value, classes).apply { init?.invoke(this) }
+ this.add(richTextInput)
+ return richTextInput
}
}
}
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 2878dc66..ac9d0d9b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/Text.kt
@@ -65,15 +65,17 @@ open class Text(
companion object {
/**
- * DSL builder extension function
+ * 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,
label: String? = null, rich: Boolean = false, init: (Text.() -> Unit)? = null
- ) {
- this.add(Text(type, value, label, rich).apply { init?.invoke(this) })
+ ): Text {
+ val text = Text(type, value, 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 e9575264..58f63028 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextArea.kt
@@ -74,15 +74,17 @@ open class TextArea(
companion object {
/**
- * DSL builder extension function
+ * 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,
label: String? = null, rich: Boolean = false, init: (TextArea.() -> Unit)? = null
- ) {
- this.add(TextArea(cols, rows, value, label, rich).apply { init?.invoke(this) })
+ ): TextArea {
+ val textArea = TextArea(cols, rows, value, 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 64e0f17d..8ee150e1 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextAreaInput.kt
@@ -84,15 +84,17 @@ open class TextAreaInput(cols: Int? = null, rows: Int? = null, value: String? =
companion object {
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(TextAreaInput(cols, rows, value, classes).apply { init?.invoke(this) })
+ ): 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 cc443aa5..a2bfcd0b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/text/TextInput.kt
@@ -88,15 +88,17 @@ open class TextInput(type: TEXTINPUTTYPE = TEXTINPUTTYPE.TEXT, value: String? =
companion object {
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(TextInput(type, value, classes).apply { init?.invoke(this) })
+ ): 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/form/time/DateTime.kt b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
index 34ea98ce..29cb664d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
@@ -236,15 +236,17 @@ open class DateTime(
internal var counter = 0
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.dateTime(
value: Date? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
rich: Boolean = false, init: (DateTime.() -> Unit)? = null
- ) {
- this.add(DateTime(value, format, label, rich).apply { init?.invoke(this) })
+ ): DateTime {
+ val dateTime = DateTime(value, format, label, rich).apply { init?.invoke(this) }
+ this.add(dateTime)
+ return dateTime
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
index 0556f2ef..c198ec77 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
@@ -312,15 +312,17 @@ open class DateTimeInput(
}
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.dateTimeInput(
value: Date? = null, format: String = "YYYY-MM-DD HH:mm", classes: Set<String> = setOf(),
init: (DateTimeInput.() -> Unit)? = null
- ) {
- this.add(DateTimeInput(value, format, classes).apply { init?.invoke(this) })
+ ): DateTimeInput {
+ val dateTimeInput = DateTimeInput(value, format, classes).apply { init?.invoke(this) }
+ this.add(dateTimeInput)
+ return dateTimeInput
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
index b4c6ed7c..79155395 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Button.kt
@@ -162,15 +162,17 @@ open class Button(
companion object {
/**
- * DSL builder extension function
+ * 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.DEFAULT,
disabled: Boolean = false, classes: Set<String> = setOf(), init: (Button.() -> Unit)? = null
- ) {
- this.add(Button(text, icon, style, disabled, classes).apply { init?.invoke(this) })
+ ): Button {
+ val button = Button(text, icon, style, disabled, classes).apply { init?.invoke(this) }
+ this.add(button)
+ return button
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
index c2af9bac..bd469afe 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
@@ -122,15 +122,17 @@ open class Image(
companion object {
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(Image(src, alt, responsive, shape, centered, classes).apply { init?.invoke(this) })
+ ): 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/Label.kt b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt
index cd120cba..e56362ef 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Label.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt
@@ -33,14 +33,16 @@ import pl.treksoft.kvision.core.Container
open class Label(text: String, rich: Boolean = false) : Tag(TAG.SPAN, text, rich) {
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.label(
text: String, rich: Boolean = false, init: (Label.() -> Unit)? = null
- ) {
- this.add(Label(text, rich).apply { init?.invoke(this) })
+ ): Label {
+ val label = Label(text, rich).apply { init?.invoke(this) }
+ this.add(label)
+ return label
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt
index 7572d444..e075d685 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt
@@ -85,15 +85,17 @@ open class Link(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.link(
label: String, url: String, icon: String? = null, image: ResString? = null,
classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null
- ) {
- this.add(Link(label, url, icon, image, classes).apply { init?.invoke(this) })
+ ): 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 29f5d18e..2dadd546 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/List.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/List.kt
@@ -146,15 +146,17 @@ open class ListTag(
companion object {
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(ListTag(type, elements, rich, classes, init))
+ ): ListTag {
+ val listTag = ListTag(type, elements, rich, classes, init)
+ this.add(listTag)
+ return listTag
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
index ebcc0020..62a647bc 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
@@ -155,15 +155,17 @@ open class Tag(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
fun Container.tag(
type: TAG, text: String? = null, rich: Boolean = false, align: ALIGN? = null,
classes: Set<String> = setOf(), init: (Tag.() -> Unit)? = null
- ) {
- this.add(Tag(type, text, rich, align, classes, init))
+ ): Tag {
+ val tag = Tag(type, text, rich, align, classes, 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 15e66766..4573b6a4 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
@@ -189,12 +189,14 @@ open class DockPanel(classes: Set<String> = setOf(), init: (DockPanel.() -> Unit
companion object {
/**
- * DSL builder extension function
+ * 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) {
- this.add(DockPanel(classes, init))
+ 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 9cff2a7e..4a4f4086 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
@@ -278,7 +278,7 @@ internal class FlexWrapper(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -286,8 +286,10 @@ internal class FlexWrapper(
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
- ) {
- this.add(FlexPanel(direction, wrap, justify, alignItems, alignContent, spacing, classes, init))
+ ): 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 48e4a784..178c1e7f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
@@ -306,7 +306,7 @@ open class GridPanel(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -316,13 +316,13 @@ open class GridPanel(
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
- ) {
- this.add(
- GridPanel(
- autoColumns, autoRows, autoFlow, templateColumns, templateRows, templateAreas,
- columnGap, rowGap, justifyItems, alignItems, justifyContent, alignContent, classes, init
- )
+ ): GridPanel {
+ val gridPanel = GridPanel(
+ autoColumns, autoRows, autoFlow, templateColumns, templateRows, templateAreas,
+ columnGap, rowGap, justifyItems, alignItems, justifyContent, alignContent, classes, init
)
+ this.add(gridPanel)
+ return gridPanel
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
index 20cc72f8..d0176481 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
@@ -50,7 +50,7 @@ open class HPanel(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -61,8 +61,10 @@ open class HPanel(
spacing: Int? = null,
classes: Set<String> = setOf(),
init: (HPanel.() -> Unit)? = null
- ) {
- this.add(HPanel(wrap, justify, alignItems, spacing, classes, init))
+ ): 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/ResponsiveGridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
index 9ac66d20..dbada3dc 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
@@ -180,7 +180,7 @@ open class ResponsiveGridPanel(
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
@@ -188,8 +188,10 @@ open class ResponsiveGridPanel(
gridsize: GRIDSIZE = GRIDSIZE.MD,
rows: Int = 0, cols: Int = 0, align: ALIGN? = null,
classes: Set<String> = setOf(), init: (ResponsiveGridPanel.() -> Unit)? = null
- ) {
- this.add(ResponsiveGridPanel(gridsize, rows, cols, align, classes, init))
+ ): ResponsiveGridPanel {
+ val responsiveGridPanel = ResponsiveGridPanel(gridsize, rows, cols, align, classes, init)
+ this.add(responsiveGridPanel)
+ return responsiveGridPanel
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
index f642b353..916cbba3 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
@@ -103,12 +103,14 @@ open class SimplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() ->
companion object {
/**
- * DSL builder extension function
+ * 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) {
- this.add(SimplePanel(classes, init))
+ 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 c9ee7197..d5e4cb03 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
@@ -101,15 +101,17 @@ open class SplitPanel(
companion object {
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(SplitPanel(direction, classes, init))
+ ): SplitPanel {
+ val splitPanel = SplitPanel(direction, classes, init)
+ this.add(splitPanel)
+ return splitPanel
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
index c5234f88..235c76ec 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
@@ -104,14 +104,16 @@ open class StackPanel(
companion object {
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(StackPanel(activateLast, classes, init))
+ ): StackPanel {
+ val stackPanel = StackPanel(activateLast, classes, init)
+ this.add(stackPanel)
+ return stackPanel
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
index 3e882710..4572036d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
@@ -139,12 +139,14 @@ open class TabPanel(classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)?
companion object {
/**
- * DSL builder extension function
+ * DSL builder extension function.
*
* It takes the same parameters as the constructor of the built component.
*/
- fun Container.tabPanel(classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)? = null) {
- this.add(TabPanel(classes, init))
+ fun Container.tabPanel(classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)? = null): TabPanel {
+ val tabPanel = TabPanel(classes, init)
+ this.add(tabPanel)
+ return tabPanel
}
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
index a0eccb50..c2cb602b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
@@ -49,16 +49,17 @@ open class VPanel(
companion object {
/**
- * DSL builder extension function
+ * 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
- ) {
- this.add(VPanel(justify, alignItems, spacing, classes, init))
+ ): VPanel {
+ val vpanel = VPanel(justify, alignItems, spacing, classes, init)
+ this.add(vpanel)
+ return vpanel
}
}
}
-