diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-02-12 12:00:15 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-02-12 12:00:15 +0100 |
commit | eea44b35add0d036119888f41e4ed38e75190934 (patch) | |
tree | 01ff2b73042ab08941df082d74241dc5e229a37d /src/main/kotlin/pl/treksoft/kvision/dropdown | |
parent | 4191287261b46b95908469c2ec3fa9d886681861 (diff) | |
download | kvision-eea44b35add0d036119888f41e4ed38e75190934.tar.gz kvision-eea44b35add0d036119888f41e4ed38e75190934.tar.bz2 kvision-eea44b35add0d036119888f41e4ed38e75190934.zip |
DSL builders returning built components.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/dropdown')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt index 1af71dc8..0f653d30 100644 --- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt +++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt @@ -239,7 +239,7 @@ open class DropDown( internal var counter = 0 /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -247,8 +247,10 @@ open class DropDown( text: String, elements: List<StringPair>? = null, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT, disabled: Boolean = false, classes: Set<String> = setOf(), init: (DropDown.() -> Unit)? = null - ) { - this.add(DropDown(text, elements, icon, style, disabled, classes).apply { init?.invoke(this) }) + ): DropDown { + val dropDown = DropDown(text, elements, icon, style, disabled, classes).apply { init?.invoke(this) } + this.add(dropDown) + return dropDown } } } |