aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl
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/kvision-bootstrap-select-remote/src/main/kotlin/pl
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/kvision-bootstrap-select-remote/src/main/kotlin/pl')
-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
2 files changed, 46 insertions, 49 deletions
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
}