diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-06-03 18:31:49 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-06-03 18:31:49 +0200 |
commit | f9398d1ae7da496d3a290d7b225225d70a4bb174 (patch) | |
tree | 9deb7578e9814c3155adb8fe0ffa3d146cecc584 /src/main/kotlin/pl/treksoft/kvision/panel | |
parent | fc7f3588472423ce915113c8d2089e4df3793de0 (diff) | |
download | kvision-f9398d1ae7da496d3a290d7b225225d70a4bb174.tar.gz kvision-f9398d1ae7da496d3a290d7b225225d70a4bb174.tar.bz2 kvision-f9398d1ae7da496d3a290d7b225225d70a4bb174.zip |
Refactor support for additional attributes from Tag up to the Widget class.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/panel/Root.kt | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt index 310d4d49..010f7cba 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt @@ -24,7 +24,7 @@ package pl.treksoft.kvision.panel import pl.treksoft.kvision.core.Component import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.StringPair -import pl.treksoft.kvision.core.StyledComponent +import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.core.WidgetWrapper import pl.treksoft.kvision.utils.px @@ -152,10 +152,10 @@ open class FlexPanel( } private fun refreshSpacing() { - getChildren().filterIsInstance<StyledComponent>().map { applySpacing(it) } + getChildren().filterIsInstance<Widget>().map { applySpacing(it) } } - private fun applySpacing(wrapper: StyledComponent): StyledComponent { + private fun applySpacing(wrapper: Widget): Widget { wrapper.marginTop = null wrapper.marginRight = null wrapper.marginBottom = null diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt index dd3d39b6..2d9dcc46 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt @@ -71,7 +71,6 @@ class Root( } roots.add(this) if (isFirstRoot) { - Style.styles.forEach { it.parent = this } Modal.modals.forEach { it.parent = this } } @Suppress("LeakingThis") @@ -102,9 +101,8 @@ class Root( private fun stylesVNodes(): Array<VNode> { return if (isFirstRoot) { - val visibleStyles = Style.styles.filter { it.visible } - if (visibleStyles.isNotEmpty()) { - val stylesDesc = visibleStyles.joinToString("\n") { it.generateStyle() } + if (Style.styles.isNotEmpty()) { + val stylesDesc = Style.styles.joinToString("\n") { it.generateStyle() } arrayOf(h("style", arrayOf(stylesDesc))) } else { arrayOf() |