diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel')
10 files changed, 52 insertions, 35 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt index 15e66766..4573b6a4 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt @@ -189,12 +189,14 @@ open class DockPanel(classes: Set<String> = setOf(), init: (DockPanel.() -> Unit companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ - fun Container.dockPanel(classes: Set<String> = setOf(), init: (DockPanel.() -> Unit)? = null) { - this.add(DockPanel(classes, init)) + fun Container.dockPanel(classes: Set<String> = setOf(), init: (DockPanel.() -> Unit)? = null): DockPanel { + val dockPanel = DockPanel(classes, init) + this.add(dockPanel) + return dockPanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt index 9cff2a7e..4a4f4086 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt @@ -278,7 +278,7 @@ internal class FlexWrapper( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -286,8 +286,10 @@ internal class FlexWrapper( direction: FLEXDIR? = null, wrap: FLEXWRAP? = null, justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null, alignContent: FLEXALIGNCONTENT? = null, spacing: Int? = null, classes: Set<String> = setOf(), init: (FlexPanel.() -> Unit)? = null - ) { - this.add(FlexPanel(direction, wrap, justify, alignItems, alignContent, spacing, classes, init)) + ): FlexPanel { + val flexPanel = FlexPanel(direction, wrap, justify, alignItems, alignContent, spacing, classes, init) + this.add(flexPanel) + return flexPanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt index 48e4a784..178c1e7f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/GridPanel.kt @@ -306,7 +306,7 @@ open class GridPanel( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -316,13 +316,13 @@ open class GridPanel( columnGap: Int? = null, rowGap: Int? = null, justifyItems: GRIDJUSTIFY? = null, alignItems: GRIDALIGN? = null, justifyContent: GRIDJUSTIFYCONTENT? = null, alignContent: GRIDALIGNCONTENT? = null, classes: Set<String> = setOf(), init: (GridPanel.() -> Unit)? = null - ) { - this.add( - GridPanel( - autoColumns, autoRows, autoFlow, templateColumns, templateRows, templateAreas, - columnGap, rowGap, justifyItems, alignItems, justifyContent, alignContent, classes, init - ) + ): GridPanel { + val gridPanel = GridPanel( + autoColumns, autoRows, autoFlow, templateColumns, templateRows, templateAreas, + columnGap, rowGap, justifyItems, alignItems, justifyContent, alignContent, classes, init ) + this.add(gridPanel) + return gridPanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt index 20cc72f8..d0176481 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt @@ -50,7 +50,7 @@ open class HPanel( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -61,8 +61,10 @@ open class HPanel( spacing: Int? = null, classes: Set<String> = setOf(), init: (HPanel.() -> Unit)? = null - ) { - this.add(HPanel(wrap, justify, alignItems, spacing, classes, init)) + ): HPanel { + val hpanel = HPanel(wrap, justify, alignItems, spacing, classes, init) + this.add(hpanel) + return hpanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt index 9ac66d20..dbada3dc 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt @@ -180,7 +180,7 @@ open class ResponsiveGridPanel( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -188,8 +188,10 @@ open class ResponsiveGridPanel( gridsize: GRIDSIZE = GRIDSIZE.MD, rows: Int = 0, cols: Int = 0, align: ALIGN? = null, classes: Set<String> = setOf(), init: (ResponsiveGridPanel.() -> Unit)? = null - ) { - this.add(ResponsiveGridPanel(gridsize, rows, cols, align, classes, init)) + ): ResponsiveGridPanel { + val responsiveGridPanel = ResponsiveGridPanel(gridsize, rows, cols, align, classes, init) + this.add(responsiveGridPanel) + return responsiveGridPanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt index f642b353..916cbba3 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SimplePanel.kt @@ -103,12 +103,14 @@ open class SimplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() -> companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ - fun Container.simplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() -> Unit)? = null) { - this.add(SimplePanel(classes, init)) + fun Container.simplePanel(classes: Set<String> = setOf(), init: (SimplePanel.() -> Unit)? = null): SimplePanel { + val simplePanel = SimplePanel(classes, init) + this.add(simplePanel) + return simplePanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt index c9ee7197..d5e4cb03 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt @@ -101,15 +101,17 @@ open class SplitPanel( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ fun Container.splitPanel( direction: DIRECTION = DIRECTION.VERTICAL, classes: Set<String> = setOf(), init: (SplitPanel.() -> Unit)? = null - ) { - this.add(SplitPanel(direction, classes, init)) + ): SplitPanel { + val splitPanel = SplitPanel(direction, classes, init) + this.add(splitPanel) + return splitPanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt index c5234f88..235c76ec 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt @@ -104,14 +104,16 @@ open class StackPanel( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ fun Container.stackPanel( activateLast: Boolean = true, classes: Set<String> = setOf(), init: (StackPanel.() -> Unit)? = null - ) { - this.add(StackPanel(activateLast, classes, init)) + ): StackPanel { + val stackPanel = StackPanel(activateLast, classes, init) + this.add(stackPanel) + return stackPanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt index 3e882710..4572036d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt @@ -139,12 +139,14 @@ open class TabPanel(classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)? companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ - fun Container.tabPanel(classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)? = null) { - this.add(TabPanel(classes, init)) + fun Container.tabPanel(classes: Set<String> = setOf(), init: (TabPanel.() -> Unit)? = null): TabPanel { + val tabPanel = TabPanel(classes, init) + this.add(tabPanel) + return tabPanel } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt index a0eccb50..c2cb602b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/VPanel.kt @@ -49,16 +49,17 @@ open class VPanel( companion object { /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ fun Container.vPanel( justify: FLEXJUSTIFY? = null, alignItems: FLEXALIGNITEMS? = null, spacing: Int? = null, classes: Set<String> = setOf(), init: (VPanel.() -> Unit)? = null - ) { - this.add(VPanel(justify, alignItems, spacing, classes, init)) + ): VPanel { + val vpanel = VPanel(justify, alignItems, spacing, classes, init) + this.add(vpanel) + return vpanel } } } - |