aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-03-22 20:23:00 +0100
committerRobert Jaros <rjaros@finn.pl>2018-03-22 20:23:00 +0100
commit6ba1eefc59a2940a7258655da4e88b4118e61746 (patch)
treedac0d0103d1828b4bab4eb2a3e6187b43046919a /src/main
parent6e89e35577a5425bb6d584ec19d99f3e3856db37 (diff)
downloadkvision-6ba1eefc59a2940a7258655da4e88b4118e61746.tar.gz
kvision-6ba1eefc59a2940a7258655da4e88b4118e61746.tar.bz2
kvision-6ba1eefc59a2940a7258655da4e88b4118e61746.zip
Support for display CSS property.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Css.kt28
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt7
2 files changed, 35 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
index bfbfac7e..f3ff5d5e 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt
@@ -258,6 +258,34 @@ enum class BgClip(internal val clip: String) {
}
/**
+ * Definitions of CSS display options.
+ */
+enum class Display(internal val display: String) {
+ INLINE("inline"),
+ BLOCK("block"),
+ FLEX("flex"),
+ GRID("grid"),
+ INLINEBLOCK("inline-block"),
+ INLINEFLEX("inline-flex"),
+ INLINEGRID("inline-grid"),
+ INLINETABLE("inline-table"),
+ LISTITEM("list-item"),
+ RUNIN("run-in"),
+ TABLE("table"),
+ TABLECAPTION("table-caption"),
+ TABLECOLUMNGROUP("table-column-group"),
+ TABLEHEADERGROUP("table-header-group"),
+ TABLEFOOTERGROUP("table-footer-group"),
+ TABLEROWGROUP("table-row-group"),
+ TABLECELL("table-cell"),
+ TABLECOLUMN("table-column"),
+ TABLEROW("table-row"),
+ NONE("none"),
+ INITIAL("initial"),
+ INHERIT("inherit")
+}
+
+/**
* Definitions of CSS position options.
*/
enum class Position(internal val position: String) {
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
index da1decf7..9b759f79 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
@@ -55,6 +55,10 @@ abstract class StyledComponent : Component {
*/
open var maxHeight: CssSize? by refreshOnUpdate()
/**
+ * CSS display of the current component.
+ */
+ open var display: Display? by refreshOnUpdate()
+ /**
* CSS position of the current component.
*/
open var position: Position? by refreshOnUpdate()
@@ -313,6 +317,9 @@ abstract class StyledComponent : Component {
maxHeight?.let {
snstyle.add("max-height" to it.asString())
}
+ display?.let {
+ snstyle.add("display" to it.display)
+ }
position?.let {
snstyle.add("position" to it.position)
}