From 6ba1eefc59a2940a7258655da4e88b4118e61746 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 22 Mar 2018 20:23:00 +0100 Subject: Support for display CSS property. --- src/main/kotlin/pl/treksoft/kvision/core/Css.kt | 28 ++++++++++++++++++++++ .../pl/treksoft/kvision/core/StyledComponent.kt | 7 ++++++ 2 files changed, 35 insertions(+) (limited to 'src/main') 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 @@ -257,6 +257,34 @@ enum class BgClip(internal val clip: String) { CONTENT("content-box") } +/** + * 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. */ 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 @@ -54,6 +54,10 @@ abstract class StyledComponent : Component { * Maximal height of the current 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. */ @@ -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) } -- cgit