aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-select-remote/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-07-13 00:21:33 +0200
committerRobert Jaros <rjaros@finn.pl>2019-07-13 00:59:50 +0200
commita804e0aa277efc1b46c1111b0ad8302d267684b2 (patch)
treedbd5329f003b386b5196b510526c9cee75db3514 /kvision-modules/kvision-select-remote/src/main/kotlin/pl
parent7fe158d0f2243c460c4f1848bb7989c559362cdf (diff)
downloadkvision-a804e0aa277efc1b46c1111b0ad8302d267684b2.tar.gz
kvision-a804e0aa277efc1b46c1111b0ad8302d267684b2.tar.bz2
kvision-a804e0aa277efc1b46c1111b0ad8302d267684b2.zip
Refactor RemoteSelect -> SelectRemote and RemoteTabulator -> TabulatorRemote
Diffstat (limited to 'kvision-modules/kvision-select-remote/src/main/kotlin/pl')
-rw-r--r--kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt (renamed from kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/RemoteSelect.kt)28
-rw-r--r--kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt (renamed from kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/RemoteSelectInput.kt)30
2 files changed, 29 insertions, 29 deletions
diff --git a/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/RemoteSelect.kt b/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
index 0e30d0fd..ea9d369b 100644
--- a/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/RemoteSelect.kt
+++ b/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
@@ -30,11 +30,11 @@ import pl.treksoft.kvision.form.HelpBlock
import pl.treksoft.kvision.form.StringFormControl
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.remote.KVServiceManager
-import pl.treksoft.kvision.remote.RemoteSelectOption
+import pl.treksoft.kvision.remote.RemoteOption
import pl.treksoft.kvision.utils.SnOn
/**
- * The form field component for RemoteSelect control.
+ * The form field component for SelectRemote control.
*
* @constructor
* @param value selected value
@@ -47,10 +47,10 @@ import pl.treksoft.kvision.utils.SnOn
* @param rich determines if [label] can contain HTML code
*/
@Suppress("TooManyFunctions")
-open class RemoteSelect<T : Any>(
+open class SelectRemote<T : Any>(
value: String? = null,
serviceManager: KVServiceManager<T>,
- function: T.(String?, String?) -> List<RemoteSelectOption>,
+ function: T.(String?, String?) -> List<RemoteOption>,
name: String? = null,
multiple: Boolean = false,
ajaxOptions: AjaxOptions? = null,
@@ -146,8 +146,8 @@ open class RemoteSelect<T : Any>(
flabel.rich = value
}
- private val idc = "kv_form_remoteselect_$counter"
- final override val input: RemoteSelectInput<T> = RemoteSelectInput(
+ private val idc = "kv_form_SelectRemote_$counter"
+ final override val input: SelectRemoteInput<T> = SelectRemoteInput(
value, serviceManager, function, multiple, ajaxOptions,
setOf("form-control")
).apply {
@@ -251,15 +251,15 @@ open class RemoteSelect<T : Any>(
*
* It takes the same parameters as the constructor of the built component.
*/
- fun <T : Any> Container.remoteSelect(
+ fun <T : Any> Container.selectRemote(
value: String? = null,
serviceManager: KVServiceManager<T>,
- function: T.(String?, String?) -> List<RemoteSelectOption>, name: String? = null,
+ function: T.(String?, String?) -> List<RemoteOption>, name: String? = null,
multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
- rich: Boolean = false, init: (RemoteSelect<T>.() -> Unit)? = null
- ): RemoteSelect<T> {
- val remoteSelect =
- RemoteSelect(
+ rich: Boolean = false, init: (SelectRemote<T>.() -> Unit)? = null
+ ): SelectRemote<T> {
+ val selectRemote =
+ SelectRemote(
value,
serviceManager,
function,
@@ -269,8 +269,8 @@ open class RemoteSelect<T : Any>(
label,
rich
).apply { init?.invoke(this) }
- this.add(remoteSelect)
- return remoteSelect
+ this.add(selectRemote)
+ return selectRemote
}
}
}
diff --git a/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/RemoteSelectInput.kt b/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
index ff1b04f4..4c891d30 100644
--- a/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/RemoteSelectInput.kt
+++ b/kvision-modules/kvision-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
@@ -32,7 +32,7 @@ import pl.treksoft.kvision.remote.CallAgent
import pl.treksoft.kvision.remote.HttpMethod
import pl.treksoft.kvision.remote.JsonRpcRequest
import pl.treksoft.kvision.remote.KVServiceManager
-import pl.treksoft.kvision.remote.RemoteSelectOption
+import pl.treksoft.kvision.remote.RemoteOption
import pl.treksoft.kvision.utils.JSON
import pl.treksoft.kvision.utils.obj
@@ -50,10 +50,10 @@ external fun decodeURIComponent(encodedURI: String): String
* @param classes a set of CSS class names
*/
@UseExperimental(ImplicitReflectionSerializer::class)
-open class RemoteSelectInput<T : Any>(
+open class SelectRemoteInput<T : Any>(
value: String? = null,
serviceManager: KVServiceManager<T>,
- function: T.(String?, String?) -> List<RemoteSelectOption>,
+ function: T.(String?, String?) -> List<RemoteOption>,
multiple: Boolean = false,
ajaxOptions: AjaxOptions? = null,
classes: Set<String> = setOf()
@@ -68,7 +68,7 @@ open class RemoteSelectInput<T : Any>(
val tempAjaxOptions = ajaxOptions ?: AjaxOptions()
this.ajaxOptions = tempAjaxOptions.copy(url = url, preprocessData = {
@Suppress("UnsafeCastFromDynamic")
- JSON.plain.parse(RemoteSelectOption.serializer().list, it.result as String).map {
+ JSON.plain.parse(RemoteOption.serializer().list, it.result as String).map {
obj {
this.value = it.value
if (it.text != null) this.text = it.text
@@ -96,14 +96,14 @@ open class RemoteSelectInput<T : Any>(
JSON.plain.stringify(JsonRpcRequest(0, url, listOf(null, value))),
HttpMethod.POST
).asDeferred().await()
- JSON.plain.parse(RemoteSelectOption.serializer().list, initials.result as String).map {
+ JSON.plain.parse(RemoteOption.serializer().list, initials.result as String).map {
add(SelectOption(it.value, it.text, selected = true))
}
- this@RemoteSelectInput.refreshSelectInput()
+ this@SelectRemoteInput.refreshSelectInput()
}
}
if (this.ajaxOptions?.emptyRequest == true) {
- this.setInternalEventListener<RemoteSelect<*>> {
+ this.setInternalEventListener<SelectRemote<*>> {
shownBsSelect = {
val input = self.getElementJQuery()?.parent()?.find("input")
input?.trigger("keyup", null)
@@ -120,20 +120,20 @@ open class RemoteSelectInput<T : Any>(
*
* It takes the same parameters as the constructor of the built component.
*/
- fun <T : Any> Container.remoteSelectInput(
+ fun <T : Any> Container.selectRemoteInput(
value: String? = null,
serviceManager: KVServiceManager<T>,
- function: T.(String?, String?) -> List<RemoteSelectOption>,
+ function: T.(String?, String?) -> List<RemoteOption>,
multiple: Boolean = false,
ajaxOptions: AjaxOptions? = null,
- classes: Set<String> = setOf(), init: (RemoteSelectInput<T>.() -> Unit)? = null
- ): RemoteSelectInput<T> {
- val remoteSelectInput =
- RemoteSelectInput(value, serviceManager, function, multiple, ajaxOptions, classes).apply {
+ 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(remoteSelectInput)
- return remoteSelectInput
+ this.add(selectRemoteInput)
+ return selectRemoteInput
}
}