From 5c98e5bb469269d54fb508f2adf589da696cbcd6 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Mon, 26 Feb 2018 12:45:35 +0100 Subject: Add support for overflow and resize CSS properties. --- src/main/kotlin/pl/treksoft/kvision/core/Css.kt | 26 +++++++++++++++++++++- .../pl/treksoft/kvision/core/StyledComponent.kt | 14 ++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt index 091c806a..ff01cc9f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt @@ -28,7 +28,7 @@ import pl.treksoft.kvision.utils.toHexString * Definitions of CSS units. */ @Suppress("EnumNaming", "EnumEntryName") -enum class Unit(internal val unit: String) { +enum class UNIT(internal val unit: String) { px("px"), pt("pt"), em("em"), @@ -267,6 +267,30 @@ enum class Position(internal val position: String) { STICKY("sticky") } +/** + * Definitions of CSS overflow options. + */ +enum class Overflow(internal val overflow: String) { + VISIBLE("visible"), + HIDDEN("hidden"), + SCROLL("scroll"), + AUTO("auto"), + INITIAL("initial"), + INHERIT("inherit") +} + +/** + * Definitions of CSS resize options. + */ +enum class Resize(internal val resize: String) { + NONE("none"), + BOTH("both"), + HORIZONTAL("horizontal"), + VERTICAL("vertical"), + INITIAL("initial"), + INHERIT("inherit") +} + /** * Type-safe definition of CSS border. */ diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt index 37eb28c7..d871ff60 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt @@ -79,6 +79,14 @@ abstract class StyledComponent : Component { * Z-index of the current component. */ var zIndex: Int? by refreshOnUpdate() + /** + * CSS overflow of the current component. + */ + var overflow: Overflow? by refreshOnUpdate() + /** + * CSS resize of the current component. + */ + var resize: Resize? by refreshOnUpdate() /** * Border of the current component. */ @@ -244,6 +252,12 @@ abstract class StyledComponent : Component { zIndex?.let { snstyle.add("z-index" to it.toString()) } + overflow?.let { + snstyle.add("overflow" to it.toString()) + } + resize?.let { + snstyle.add("resize" to it.toString()) + } border?.let { snstyle.add("border" to it.asString()) } -- cgit