aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-17 21:58:34 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-17 21:58:34 +0200
commit736b80835f67c9c34657074ebcfbe0752bef1c18 (patch)
tree82d1e18a9ec07692dfe5dd31f470b842a9950a89 /kvision-modules
parent53b325d52208bfd44ba6a524ce3dda5379aed699 (diff)
downloadkvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.gz
kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.bz2
kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.zip
Move DSL builder functions out of the companion objects (#93)
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt28
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt32
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt54
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt41
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt30
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt31
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt58
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt111
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt56
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt41
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt40
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt97
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/ContextMenu.kt55
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt181
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Header.kt44
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt43
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Nav.kt92
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/NavForm.kt26
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt49
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt30
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt37
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/progress/ProgressBar.kt54
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt57
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt28
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt72
-rw-r--r--kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/dropdown/ContextMenuSpec.kt4
-rw-r--r--kvision-modules/kvision-bootstrap/src/test/kotlin/test/pl/treksoft/kvision/navbar/NavbarSpec.kt4
-rw-r--r--kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt33
-rw-r--r--kvision-modules/kvision-datacontainer/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt76
-rw-r--r--kvision-modules/kvision-redux-kotlin/src/test/kotlin/test/pl/treksoft/kvision/redux/StateBindingSpec.kt6
-rw-r--r--kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/StateBindingSpec.kt6
-rw-r--r--kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichText.kt34
-rw-r--r--kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt26
-rw-r--r--kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt39
-rw-r--r--kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt135
35 files changed, 851 insertions, 899 deletions
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
index b7cf18ec..3170e462 100644
--- a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
+++ b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
@@ -267,19 +267,19 @@ open class DateTime(
companion object {
internal var counter = 0
-
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.dateTime(
- value: Date? = null, name: String? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
- rich: Boolean = false, init: (DateTime.() -> Unit)? = null
- ): DateTime {
- val dateTime = DateTime(value, name, format, label, rich).apply { init?.invoke(this) }
- this.add(dateTime)
- return dateTime
- }
}
}
+
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.dateTime(
+ value: Date? = null, name: String? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
+ rich: Boolean = false, init: (DateTime.() -> Unit)? = null
+): DateTime {
+ val dateTime = DateTime(value, name, format, label, rich).apply { init?.invoke(this) }
+ this.add(dateTime)
+ return dateTime
+}
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
index 626346b1..178fbeaa 100644
--- a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
+++ b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
@@ -28,8 +28,8 @@ import pl.treksoft.kvision.form.FormInput
import pl.treksoft.kvision.form.text.TextInput
import pl.treksoft.kvision.html.Div
import pl.treksoft.kvision.html.Icon
-import pl.treksoft.kvision.html.Icon.Companion.icon
-import pl.treksoft.kvision.html.Span.Companion.span
+import pl.treksoft.kvision.html.icon
+import pl.treksoft.kvision.html.span
import pl.treksoft.kvision.i18n.I18n
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.types.toDateF
@@ -358,20 +358,18 @@ open class DateTimeInput(
override fun blur() {
input.blur()
}
+}
- companion object {
- /**
- * 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
- ): DateTimeInput {
- val dateTimeInput = DateTimeInput(value, format, classes).apply { init?.invoke(this) }
- this.add(dateTimeInput)
- return dateTimeInput
- }
- }
+/**
+ * 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
+): DateTimeInput {
+ val dateTimeInput = DateTimeInput(value, format, classes).apply { init?.invoke(this) }
+ this.add(dateTimeInput)
+ return dateTimeInput
}
diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
index de823280..930bea32 100644
--- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
+++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
@@ -245,32 +245,32 @@ open class SelectRemote<T : Any>(
companion object {
internal var counter = 0
-
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun <T : Any> Container.selectRemote(
- value: String? = null,
- serviceManager: KVServiceManager<T>,
- function: T.(String?, String?) -> List<RemoteOption>, name: String? = null,
- multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
- rich: Boolean = false, init: (SelectRemote<T>.() -> Unit)? = null
- ): SelectRemote<T> {
- val selectRemote =
- SelectRemote(
- value,
- serviceManager,
- function,
- name,
- multiple,
- ajaxOptions,
- label,
- rich
- ).apply { init?.invoke(this) }
- this.add(selectRemote)
- return selectRemote
- }
}
}
+
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun <T : Any> Container.selectRemote(
+ value: String? = null,
+ serviceManager: KVServiceManager<T>,
+ function: T.(String?, String?) -> List<RemoteOption>, name: String? = null,
+ multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
+ rich: Boolean = false, init: (SelectRemote<T>.() -> Unit)? = null
+): SelectRemote<T> {
+ val selectRemote =
+ SelectRemote(
+ value,
+ serviceManager,
+ function,
+ name,
+ multiple,
+ ajaxOptions,
+ label,
+ rich
+ ).apply { init?.invoke(this) }
+ this.add(selectRemote)
+ return selectRemote
+}
diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
index 4c891d30..5a795c9c 100644
--- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
+++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
@@ -113,28 +113,25 @@ open class SelectRemoteInput<T : Any>(
}
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun <T : Any> Container.selectRemoteInput(
- value: String? = null,
- serviceManager: KVServiceManager<T>,
- function: T.(String?, String?) -> List<RemoteOption>,
- multiple: Boolean = false,
- ajaxOptions: AjaxOptions? = null,
- classes: Set<String> = setOf(), init: (SelectRemoteInput<T>.() -> Unit)? = null
- ): SelectRemoteInput<T> {
- val selectRemoteInput =
- SelectRemoteInput(value, serviceManager, function, multiple, ajaxOptions, classes).apply {
- init?.invoke(this)
- }
- this.add(selectRemoteInput)
- return selectRemoteInput
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun <T : Any> Container.selectRemoteInput(
+ value: String? = null,
+ serviceManager: KVServiceManager<T>,
+ function: T.(String?, String?) -> List<RemoteOption>,
+ multiple: Boolean = false,
+ ajaxOptions: AjaxOptions? = null,
+ classes: Set<String> = setOf(), init: (SelectRemoteInput<T>.() -> Unit)? = null
+): SelectRemoteInput<T> {
+ val selectRemoteInput =
+ SelectRemoteInput(value, serviceManager, function, multiple, ajaxOptions, classes).apply {
+ init?.invoke(this)
}
- }
-
+ this.add(selectRemoteInput)
+ return selectRemoteInput
}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
index 4b2505d2..ea98e369 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
@@ -266,20 +266,20 @@ open class Select(
companion object {
internal var counter = 0
-
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.select(
- options: List<StringPair>? = null, value: String? = null, name: String? = null,
- multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
- rich: Boolean = false, init: (Select.() -> Unit)? = null
- ): Select {
- val select = Select(options, value, name, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) }
- this.add(select)
- return select
- }
}
}
+
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.select(
+ options: List<StringPair>? = null, value: String? = null, name: String? = null,
+ multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
+ rich: Boolean = false, init: (Select.() -> Unit)? = null
+): Select {
+ val select = Select(options, value, name, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) }
+ this.add(select)
+ return select
+}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
index 84eccaf7..b515ea3e 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
@@ -354,22 +354,19 @@ open class SelectInput(
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.selectInput(
- options: List<StringPair>? = null, value: String? = null,
- multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
- classes: Set<String> = setOf(), init: (SelectInput.() -> Unit)? = null
- ): SelectInput {
- val selectInput = SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) }
- this.add(selectInput)
- return selectInput
- }
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.selectInput(
+ options: List<StringPair>? = null, value: String? = null,
+ multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
+ classes: Set<String> = setOf(), init: (SelectInput.() -> Unit)? = null
+): SelectInput {
+ val selectInput = SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) }
+ this.add(selectInput)
+ return selectInput
}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
index 3f07a9bf..7893f891 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
@@ -88,36 +88,34 @@ open class SelectOptGroup(
}
return sn
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Select.selectOptGroup(
- label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
- disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
- ): SelectOptGroup {
- val selectOptGroup =
- SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
- this.add(selectOptGroup)
- return selectOptGroup
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Select.selectOptGroup(
+ label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
+ disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
+): SelectOptGroup {
+ val selectOptGroup =
+ SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
+ this.add(selectOptGroup)
+ return selectOptGroup
+}
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun SelectInput.selectOptGroup(
- label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
- disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
- ): SelectOptGroup {
- val selectOptGroup =
- SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
- this.add(selectOptGroup)
- return selectOptGroup
- }
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun SelectInput.selectOptGroup(
+ label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
+ disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
+): SelectOptGroup {
+ val selectOptGroup =
+ SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
+ this.add(selectOptGroup)
+ return selectOptGroup
}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
index 91c269a8..a9c7eda5 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
@@ -104,67 +104,64 @@ open class SelectOption(
}
return sn
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Select.selectOption(
- value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
- divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
- classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
- ): SelectOption {
- val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
- init?.invoke(
- this
- )
- }
- this.add(selectOption)
- return selectOption
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Select.selectOption(
+ value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
+ divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
+ classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
+): SelectOption {
+ val selectOption =
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ init?.invoke(
+ this
+ )
}
+ this.add(selectOption)
+ return selectOption
+}
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun SelectInput.selectOption(
- value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
- divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
- classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
- ): SelectOption {
- val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
- init?.invoke(
- this
- )
- }
- this.add(selectOption)
- return selectOption
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun SelectInput.selectOption(
+ value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
+ divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
+ classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
+): SelectOption {
+ val selectOption =
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ init?.invoke(
+ this
+ )
}
+ this.add(selectOption)
+ return selectOption
+}
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun SelectOptGroup.selectOption(
- value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
- divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
- classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
- ): SelectOption {
- val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
- init?.invoke(
- this
- )
- }
- this.add(selectOption)
- return selectOption
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun SelectOptGroup.selectOption(
+ value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
+ divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
+ classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
+): SelectOption {
+ val selectOption =
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ init?.invoke(
+ this
+ )
}
-
- }
+ this.add(selectOption)
+ return selectOption
}
diff --git a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
index 7e3048d1..450d4466 100644
--- a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
+++ b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
@@ -254,34 +254,34 @@ open class Spinner(
companion object {
internal var counter = 0
+ }
+}
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.spinner(
- value: Number? = null,
- name: String? = null,
- min: Int? = null,
- max: Int? = null,
- step: Double = DEFAULT_STEP,
- decimals: Int = 0,
- buttonsType: ButtonsType = ButtonsType.VERTICAL,
- forceType: ForceType = ForceType.NONE,
- buttonStyle: ButtonStyle? = null,
- label: String? = null,
- rich: Boolean = false,
- init: (Spinner.() -> Unit)? = null
- ): Spinner {
- val spinner =
- Spinner(value, name, min, max, step, decimals, buttonsType, forceType, buttonStyle, label, rich).apply {
- init?.invoke(
- this
- )
- }
- this.add(spinner)
- return spinner
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.spinner(
+ value: Number? = null,
+ name: String? = null,
+ min: Int? = null,
+ max: Int? = null,
+ step: Double = DEFAULT_STEP,
+ decimals: Int = 0,
+ buttonsType: ButtonsType = ButtonsType.VERTICAL,
+ forceType: ForceType = ForceType.NONE,
+ buttonStyle: ButtonStyle? = null,
+ label: String? = null,
+ rich: Boolean = false,
+ init: (Spinner.() -> Unit)? = null
+): Spinner {
+ val spinner =
+ Spinner(value, name, min, max, step, decimals, buttonsType, forceType, buttonStyle, label, rich).apply {
+ init?.invoke(
+ this
+ )
}
- }
+ this.add(spinner)
+ return spinner
}
diff --git a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
index c75bbfc4..c68df816 100644
--- a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
+++ b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
@@ -313,28 +313,25 @@ open class SpinnerInput(
override fun blur() {
getElementJQuery()?.blur()
}
+}
- companion object {
-
- /*