aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/panel
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt24
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt32
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt10
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt12
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt6
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt10
10 files changed, 74 insertions, 42 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
index 376e34b9..e9670c1a 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt
@@ -17,8 +17,10 @@ open class DockPanel(classes: Set<String> = setOf()) : SimplePanel(classes = cla
protected var up: Component? = null
protected var down: Component? = null
- protected val mainContainer = FlexPanel(direction = FLEXDIR.COLUMN, justify = FLEXJUSTIFY.SPACEBETWEEN,
- alignItems = FLEXALIGNITEMS.STRETCH)
+ protected val mainContainer = FlexPanel(
+ direction = FLEXDIR.COLUMN, justify = FLEXJUSTIFY.SPACEBETWEEN,
+ alignItems = FLEXALIGNITEMS.STRETCH
+ )
protected val subContainer = FlexPanel(justify = FLEXJUSTIFY.SPACEBETWEEN, alignItems = FLEXALIGNITEMS.CENTER)
init {
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
index 80eddb23..86f1abc9 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt
@@ -43,9 +43,11 @@ enum class FLEXALIGNCONTENT(val alignContent: String) {
STRETCH("stretch")
}
-open class FlexPanel(direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify: FLEXJUSTIFY? = null,
- alignItems: FLEXALIGNITEMS? = null, alignContent: FLEXALIGNCONTENT? = null,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class FlexPanel(
+ direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify: FLEXJUSTIFY? = null,
+ alignItems: FLEXALIGNITEMS? = null, alignContent: FLEXALIGNCONTENT? = null,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var direction = direction
set(value) {
field = value
@@ -73,8 +75,10 @@ open class FlexPanel(direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify
}
@Suppress("LongParameterList")
- fun add(child: Component, order: Int? = null, grow: Int? = null, shrink: Int? = null,
- basis: Int? = null, alignSelf: FLEXALIGNITEMS? = null, classes: Set<String> = setOf()): FlexPanel {
+ fun add(
+ child: Component, order: Int? = null, grow: Int? = null, shrink: Int? = null,
+ basis: Int? = null, alignSelf: FLEXALIGNITEMS? = null, classes: Set<String> = setOf()
+ ): FlexPanel {
addInternal(FlexWrapper(child, order, grow, shrink, basis, alignSelf, classes))
return this
}
@@ -128,10 +132,12 @@ open class FlexPanel(direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify
}
}
-class FlexWrapper(delegate: Component, private val order: Int? = null, private val grow: Int? = null,
- private val shrink: Int? = null, private val basis: Int? = null,
- private val alignSelf: FLEXALIGNITEMS? = null,
- classes: Set<String> = setOf()) : WidgetWrapper(delegate, classes) {
+class FlexWrapper(
+ delegate: Component, private val order: Int? = null, private val grow: Int? = null,
+ private val shrink: Int? = null, private val basis: Int? = null,
+ private val alignSelf: FLEXALIGNITEMS? = null,
+ classes: Set<String> = setOf()
+) : WidgetWrapper(delegate, classes) {
override fun getSnStyle(): List<StringPair> {
val snstyle = super.getSnStyle().toMutableList()
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
index dac5867c..3b226102 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt
@@ -45,11 +45,13 @@ enum class GRIDFLOW(val flow: String) {
COLUMNDENSE("column dense")
}
-open class GridPanel(autoColumns: String? = null, autoRows: String? = null, autoFlow: GRIDFLOW? = null,
- templateColumns: String? = null, templateRows: String? = null, templateAreas: List<String>? = null,
- columnGap: Int? = null, rowGap: Int? = null, justifyItems: GRIDJUSTIFY? = null,
- alignItems: GRIDALIGN? = null, justifyContent: GRIDJUSTIFYCONTENT? = null,
- alignContent: GRIDALIGNCONTENT? = null, classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class GridPanel(
+ autoColumns: String? = null, autoRows: String? = null, autoFlow: GRIDFLOW? = null,
+ templateColumns: String? = null, templateRows: String? = null, templateAreas: List<String>? = null,
+ columnGap: Int? = null, rowGap: Int? = null, justifyItems: GRIDJUSTIFY? = null,
+ alignItems: GRIDALIGN? = null, justifyContent: GRIDJUSTIFYCONTENT? = null,
+ alignContent: GRIDALIGNCONTENT? = null, classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var autoColumns = autoColumns
set(value) {
field = value
@@ -112,9 +114,11 @@ open class GridPanel(autoColumns: String? = null, autoRows: String? = null, auto
}
@Suppress("LongParameterList")
- fun add(child: Component, columnStart: Int? = null, rowStart: Int? = null,
- columnEnd: String? = null, rowEnd: String? = null, area: String? = null, justifySelf: GRIDJUSTIFY? = null,
- alignSelf: GRIDALIGN? = null, classes: Set<String> = setOf()): GridPanel {
+ fun add(
+ child: Component, columnStart: Int? = null, rowStart: Int? = null,
+ columnEnd: String? = null, rowEnd: String? = null, area: String? = null, justifySelf: GRIDJUSTIFY? = null,
+ alignSelf: GRIDALIGN? = null, classes: Set<String> = setOf()
+ ): GridPanel {
addInternal(GridWrapper(child, columnStart, rowStart, columnEnd, rowEnd, area, justifySelf, alignSelf, classes))
return this
}
@@ -190,11 +194,13 @@ open class GridPanel(autoColumns: String? = null, autoRows: String? = null, auto
}
}
-class GridWrapper(delegate: Component, private val columnStart: Int? = null, private val rowStart: Int? = null,
- private val columnEnd: String? = null, private val rowEnd: String? = null,
- private val area: String? = null, private val justifySelf: GRIDJUSTIFY? = null,
- private val alignSelf: GRIDALIGN? = null,
- classes: Set<String> = setOf()) : WidgetWrapper(delegate, classes) {
+class GridWrapper(
+ delegate: Component, private val columnStart: Int? = null, private val rowStart: Int? = null,
+ private val columnEnd: String? = null, private val rowEnd: String? = null,
+ private val area: String? = null, private val justifySelf: GRIDJUSTIFY? = null,
+ private val alignSelf: GRIDALIGN? = null,
+ classes: Set<String> = setOf()
+) : WidgetWrapper(delegate, classes) {
override fun getSnStyle(): List<StringPair> {
val snstyle = super.getSnStyle().toMutableList()
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
index c9317374..93d60f1d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
@@ -1,5 +1,9 @@
package pl.treksoft.kvision.panel
-open class HPanel(justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
- classes: Set<String> = setOf()) : FlexPanel(null,
- null, justify, alignItems, null, classes)
+open class HPanel(
+ justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
+ classes: Set<String> = setOf()
+) : FlexPanel(
+ null,
+ null, justify, alignItems, null, classes
+)
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
index 88d70a64..740a208f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
@@ -17,9 +17,11 @@ const val MAX_COLUMNS = 12
internal data class WidgetParam(val widget: Component, val size: Int, val offset: Int)
-open class ResponsiveGridPanel(private val gridsize: GRIDSIZE = GRIDSIZE.MD,
- private var rows: Int = 0, private var cols: Int = 0, align: ALIGN? = null,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class ResponsiveGridPanel(
+ private val gridsize: GRIDSIZE = GRIDSIZE.MD,
+ private var rows: Int = 0, private var cols: Int = 0, align: ALIGN? = null,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
protected var align = align
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
index 90362127..51c42a06 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt
@@ -1,8 +1,8 @@
package pl.treksoft.kvision.panel
import com.github.snabbdom.VNode
-import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Component
+import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Widget
open class SimplePanel(classes: Set<String> = setOf()) : Widget(classes), Container {
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
index b8c9c580..4f06a38f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
@@ -13,8 +13,10 @@ enum class DIRECTION(val dir: String) {
VERTICAL("vertical")
}
-open class SplitPanel(private val direction: DIRECTION = DIRECTION.VERTICAL,
- classes: Set<String> = setOf()) : SimplePanel(classes + ("splitpanel-" + direction.dir)) {
+open class SplitPanel(
+ private val direction: DIRECTION = DIRECTION.VERTICAL,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes + ("splitpanel-" + direction.dir)) {
@Suppress("LeakingThis")
internal val splitter = Splitter(this, direction)
@@ -56,8 +58,10 @@ open class SplitPanel(private val direction: DIRECTION = DIRECTION.VERTICAL,
}
}
-class Splitter(private val splitPanel: SplitPanel, direction: DIRECTION) : Tag(TAG.DIV,
- classes = setOf("splitter-" + direction.dir)) {
+class Splitter(private val splitPanel: SplitPanel, direction: DIRECTION) : Tag(
+ TAG.DIV,
+ classes = setOf("splitter-" + direction.dir)
+) {
private val idc = "kv_splitter_" + counter
init {
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
index 55bd2cca..1d4b1b68 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
@@ -3,8 +3,10 @@ package pl.treksoft.kvision.panel
import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.Component
-open class StackPanel(private val activateLast: Boolean = true,
- classes: Set<String> = setOf()) : SimplePanel(classes) {
+open class StackPanel(
+ private val activateLast: Boolean = true,
+ classes: Set<String> = setOf()
+) : SimplePanel(classes) {
var activeIndex = -1
set(value) {
field = value
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
index e60d9480..72063be0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
@@ -25,8 +25,10 @@ open class TabPanel : SimplePanel(setOf()) {
this.addInternal(content)
}
- open fun addTab(title: String, panel: Component, icon: String? = null,
- image: ResString? = null): TabPanel {
+ open fun addTab(
+ title: String, panel: Component, icon: String? = null,
+ image: ResString? = null
+ ): TabPanel {
val tag = Tag(TAG.LI)
tag.role = "presentation"
tag.add(Link(title, "#", icon, image))
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
index 42e33637..883d9d75 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt
@@ -1,5 +1,9 @@
package pl.treksoft.kvision.panel
-open class VPanel(justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
- classes: Set<String> = setOf()) : FlexPanel(FLEXDIR.COLUMN,
- null, justify, alignItems, null, classes)
+open class VPanel(
+ justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null,
+ classes: Set<String> = setOf()
+) : FlexPanel(
+ FLEXDIR.COLUMN,
+ null, justify, alignItems, null, classes
+)