aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/form/select
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 /src/main/kotlin/pl/treksoft/kvision/form/select
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 'src/main/kotlin/pl/treksoft/kvision/form/select')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelect.kt38
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt29
2 files changed, 32 insertions, 35 deletions
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
}