diff options
| author | Robert Jaros <rjaros@finn.pl> | 2018-01-17 19:29:30 +0100 |
|---|---|---|
| committer | Robert Jaros <rjaros@finn.pl> | 2018-01-17 19:29:30 +0100 |
| commit | 31c9d3c4121107974a8419752aa7face5c96f821 (patch) | |
| tree | 77aaac10c5a120b028c14f53ab74eb5491f4a443 /src/main/kotlin/pl/treksoft/kvision/form/select | |
| parent | 646e82e383850447fd4d10f71ecc0aeab11623e0 (diff) | |
| download | kvision-31c9d3c4121107974a8419752aa7face5c96f821.tar.gz kvision-31c9d3c4121107974a8419752aa7face5c96f821.tar.bz2 kvision-31c9d3c4121107974a8419752aa7face5c96f821.zip | |
Code formatting (Kotlin Style Guide)
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/form/select')
5 files changed, 32 insertions, 20 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt index d86e6899..0cff73db 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt @@ -17,12 +17,14 @@ enum class DataType(val type: String) { SCRIPT("script") } -data class AjaxOptions(val url: String, val processData: (dynamic) -> dynamic, - val processParams: dynamic = null, val httpType: HttpType = HttpType.GET, - val dataType: DataType = DataType.JSON, val minLength: Int = 0, - val cache: Boolean = true, val clearOnEmpty: Boolean = true, val clearOnError: Boolean = true, - val emptyRequest: Boolean = false, val preserveSelected: Boolean = true, - val requestDelay: Int = AJAX_REQUEST_DELAY, val restoreOnError: Boolean = false) +data class AjaxOptions( + val url: String, val processData: (dynamic) -> dynamic, + val processParams: dynamic = null, val httpType: HttpType = HttpType.GET, + val dataType: DataType = DataType.JSON, val minLength: Int = 0, + val cache: Boolean = true, val clearOnEmpty: Boolean = true, val clearOnError: Boolean = true, + val emptyRequest: Boolean = false, val preserveSelected: Boolean = true, + val requestDelay: Int = AJAX_REQUEST_DELAY, val restoreOnError: Boolean = false +) fun AjaxOptions.toJs(emptyOption: Boolean): dynamic { val procData = { data: dynamic -> 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 2d750683..5f10191f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt @@ -11,9 +11,11 @@ import pl.treksoft.kvision.snabbdom.StringBoolPair import pl.treksoft.kvision.snabbdom.StringPair @Suppress("TooManyFunctions") -open class Select(options: List<StringPair>? = null, value: String? = null, - multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null, - rich: Boolean = false) : SimplePanel(setOf("form-group")), StringFormControl { +open class Select( + options: List<StringPair>? = null, value: String? = null, + multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null, + rich: Boolean = false +) : SimplePanel(setOf("form-group")), StringFormControl { var options get() = input.options @@ -102,8 +104,10 @@ open class Select(options: List<StringPair>? = null, value: String? = null, } private val idc = "kv_form_select_" + counter - final override val input: SelectInput = SelectInput(options, value, multiple, ajaxOptions, - setOf("form-control")).apply { id = idc } + final override val input: SelectInput = SelectInput( + options, value, multiple, ajaxOptions, + setOf("form-control") + ).apply { id = idc } final override val flabel: FieldLabel = FieldLabel(idc, label, rich) final override val validationInfo: HelpBlock = HelpBlock().apply { visible = false } 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 2dcbe99b..9e35fb6b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt @@ -1,9 +1,9 @@ package pl.treksoft.kvision.form.select import com.github.snabbdom.VNode +import pl.treksoft.kvision.core.Component import pl.treksoft.kvision.core.CssSize import pl.treksoft.kvision.core.KVManager.KVNULL -import pl.treksoft.kvision.core.Component import pl.treksoft.kvision.form.INPUTSIZE import pl.treksoft.kvision.html.BUTTONSTYLE import pl.treksoft.kvision.panel.SimplePanel @@ -17,9 +17,11 @@ enum class SELECTWIDTHTYPE(val value: String) { } @Suppress("TooManyFunctions") -open class SelectInput(options: List<StringPair>? = null, value: String? = null, - multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, - classes: Set<String> = setOf()) : SimplePanel(classes) { +open class SelectInput( + options: List<StringPair>? = null, value: String? = null, + multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, + classes: Set<String> = setOf() +) : SimplePanel(classes) { internal var options = options set(value) { diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt index 38a578fe..cfd2be19 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt @@ -4,8 +4,10 @@ import com.github.snabbdom.VNode import pl.treksoft.kvision.panel.SimplePanel import pl.treksoft.kvision.snabbdom.StringPair -open class SelectOptGroup(label: String, options: List<StringPair>? = null, maxOptions: Int? = null, - disabled: Boolean = false, classes: Set<String> = setOf()) : SimplePanel(classes) { +open class SelectOptGroup( + label: String, options: List<StringPair>? = null, maxOptions: Int? = null, + disabled: Boolean = false, classes: Set<String> = setOf() +) : SimplePanel(classes) { var label: String = label set(value) { diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt index 3ff44c61..020d8f4b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt @@ -4,9 +4,11 @@ import com.github.snabbdom.VNode import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.snabbdom.StringPair -open class SelectOption(value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null, - divider: Boolean = false, disabled: Boolean = false, - classes: Set<String> = setOf()) : Widget(classes) { +open class SelectOption( + value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null, + divider: Boolean = false, disabled: Boolean = false, + classes: Set<String> = setOf() +) : Widget(classes) { var value: String? = value set(value) { |
