diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-09-03 03:23:34 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-09-03 03:23:34 +0200 |
commit | 70bc6412e0b54119d3f0b6a82c1def78a9088d16 (patch) | |
tree | 5df87cf5b18ac4623116851f55bd5244a50a3191 /src/main/kotlin/pl/treksoft/kvision/html | |
parent | c056275c522db3f2f391ce44a405da0cedae60ca (diff) | |
download | kvision-70bc6412e0b54119d3f0b6a82c1def78a9088d16.tar.gz kvision-70bc6412e0b54119d3f0b6a82c1def78a9088d16.tar.bz2 kvision-70bc6412e0b54119d3f0b6a82c1def78a9088d16.zip |
DropDown attributes
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/List.kt | 18 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/Tag.kt | 3 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/List.kt b/src/main/kotlin/pl/treksoft/kvision/html/List.kt index b2801ce9..e525d9a5 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/List.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/List.kt @@ -1,11 +1,9 @@ package pl.treksoft.kvision.html import com.github.snabbdom.VNode -import com.github.snabbdom.array import com.github.snabbdom.h import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.KVManager -import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.snabbdom.StringBoolPair enum class LIST(val tagName: String) { @@ -49,8 +47,20 @@ open class ListTag(type: LIST, elements: List<String>? = null, rich: Boolean = f override fun childrenVNodes(): Array<VNode> { val childrenElements = children.filter { it.visible } val res = when (type) { - LIST.UL, LIST.OL, LIST.UNSTYLED, LIST.INLINE -> childrenElements.map { v -> h("li", arrayOf(v.render())) } - LIST.DL, LIST.DL_HORIZ -> childrenElements.mapIndexed { index, v -> h(if (index % 2 == 0) "dt" else "dd", arrayOf(v.render())) } + LIST.UL, LIST.OL, LIST.UNSTYLED, LIST.INLINE -> childrenElements.map { v -> + if (v is Tag && v.type == TAG.LI) { + v.render() + } else { + h("li", arrayOf(v.render())) + } + } + LIST.DL, LIST.DL_HORIZ -> childrenElements.mapIndexed { index, v -> + if (v is Tag && v.type == TAG.LI) { + v.render() + } else { + h(if (index % 2 == 0) "dt" else "dd", arrayOf(v.render())) + } + } } return res.toTypedArray() } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt index cbaa611e..4a3f708f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt @@ -32,7 +32,8 @@ enum class TAG(val tagName: String) { KBD("kbd"), VAR("var"), SAMP("samp"), - SPAN("span") + SPAN("span"), + LI("li") } enum class ALIGN(val className: String) { |