diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-10-08 00:16:18 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-10-08 00:16:18 +0200 |
commit | ce691e9b1409324af359afc721b8561c298d7b71 (patch) | |
tree | 7961490919e788f4c3d2026bbe9b79b08f4c5b15 /src/main/kotlin/pl/treksoft/kvision/panel | |
parent | 381f872a4daab133ed53e85526281b6e29873007 (diff) | |
download | kvision-ce691e9b1409324af359afc721b8561c298d7b71.tar.gz kvision-ce691e9b1409324af359afc721b8561c298d7b71.tar.bz2 kvision-ce691e9b1409324af359afc721b8561c298d7b71.zip |
Refactoring
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel')
3 files changed, 9 insertions, 8 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt index 781f8dcd..10483a8d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt @@ -124,7 +124,6 @@ open class FlexPanel(direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify alignContent?.let { snstyle.add("align-content" to it.alignContent) } - println("abc") return snstyle } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt index af4dd53f..17b3803f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt @@ -19,7 +19,7 @@ const val MAX_COLUMNS = 12 internal data class WidgetParam(val widget: Widget, 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 = ALIGN.NONE, + private var rows: Int = 0, private var cols: Int = 0, align: ALIGN? = null, classes: Set<String> = setOf()) : Container(classes) { protected var align = align set(value) { @@ -87,8 +87,8 @@ open class ResponsiveGridPanel(private val gridsize: GRIDSIZE = GRIDSIZE.MD, val widget = wp?.widget?.let { WidgetWrapper(it, setOf("col-" + gridsize.size + "-" + num)) } ?: Tag(TAG.DIV, classes = setOf("col-" + gridsize.size + "-" + num)) - if (align != ALIGN.NONE) { - widget.addCssClass(align.className) + align?.let { + widget.addCssClass(it.className) } rowContainer.add(widget) } else { @@ -98,8 +98,8 @@ open class ResponsiveGridPanel(private val gridsize: GRIDSIZE = GRIDSIZE.MD, if (wp.offset > 0) { widget.addCssClass("col-" + gridsize.size + "-offset-" + wp.offset) } - if (align != ALIGN.NONE) { - widget.addCssClass(align.className) + align?.let { + widget.addCssClass(it.className) } rowContainer.add(widget) } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt index 569a5b85..06f9be59 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt @@ -4,6 +4,7 @@ import com.github.snabbdom.VNode import pl.treksoft.jquery.JQuery import pl.treksoft.jquery.JQueryEventObject import pl.treksoft.kvision.core.Container +import pl.treksoft.kvision.core.UNIT import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag import pl.treksoft.kvision.snabbdom.obj @@ -23,6 +24,7 @@ open class SplitPanel(private val direction: DIRECTION = DIRECTION.VERTICAL, internal fun afterInsertSplitter() { if (children.size == 2) { val horizontal = direction == DIRECTION.HORIZONTAL + val px = UNIT.px val self = this children[0].getElementJQueryD().resizable(obj { handleSelector = "#" + splitter.id @@ -36,9 +38,9 @@ open class SplitPanel(private val direction: DIRECTION = DIRECTION.VERTICAL, } onDragEnd = { e: JQueryEventObject, el: JQuery, _: dynamic -> if (horizontal) { - children[0].height = el.height().toInt() + children[0].height = el.height().toInt() to px } else { - children[0].width = el.width().toInt() + children[0].width = el.width().toInt() to px } self.dispatchEvent("dragEndSplitPanel", obj({ detail = e })) } |