aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/html
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/List.kt18
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Tag.kt3
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) {