diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-11-04 00:06:10 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-11-04 00:06:10 +0100 |
commit | c28f003eb5c588c5942b86521991c46374ad190a (patch) | |
tree | 60cf94702f5ebb46e679349cc781592cea1818b7 | |
parent | 398cfa0a80bc10c6580557e9688ba4390b89917b (diff) | |
download | kvision-c28f003eb5c588c5942b86521991c46374ad190a.tar.gz kvision-c28f003eb5c588c5942b86521991c46374ad190a.tar.bz2 kvision-c28f003eb5c588c5942b86521991c46374ad190a.zip |
Small fixes for select component
3 files changed, 10 insertions, 5 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt index 7ef29754..bd67868d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt @@ -144,6 +144,7 @@ class SelectInput(options: List<StringPair>? = null, override var value: String? return cl } + @Suppress("ComplexMethod") override fun getSnAttrs(): List<StringPair> { val sn = super.getSnAttrs().toMutableList() name?.let { diff --git a/src/main/kotlin/pl/treksoft/kvision/form/SelectOptGroup.kt b/src/main/kotlin/pl/treksoft/kvision/form/SelectOptGroup.kt index 22483777..41eb951e 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/SelectOptGroup.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/SelectOptGroup.kt @@ -57,4 +57,4 @@ class SelectOptGroup(label: String, options: List<StringPair>? = null, maxOption } return sn } -}
\ No newline at end of file +} diff --git a/src/main/kotlin/pl/treksoft/kvision/form/SelectOption.kt b/src/main/kotlin/pl/treksoft/kvision/form/SelectOption.kt index 48412e17..f3be295c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/SelectOption.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/SelectOption.kt @@ -45,15 +45,19 @@ open class SelectOption(value: String? = null, label: String? = null, subtext: S } override fun render(): VNode { - return kvh("option", arrayOf(label ?: value)) + return if (!divider) { + kvh("option", arrayOf(label ?: value)) + } else { + kvh("option") + } } override fun getSnAttrs(): List<StringPair> { val sn = super.getSnAttrs().toMutableList() - value?.let { - sn.add("value" to it) - } if (!divider) { + value?.let { + sn.add("value" to it) + } subtext?.let { sn.add("data-subtext" to it) } |