diff options
author | Robert Jaros <rjaros@finn.pl> | 2020-05-09 23:53:57 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2020-05-09 23:53:57 +0200 |
commit | 134cb687c4e05fd81a03b682505f9fb9d741a8d7 (patch) | |
tree | f9f41f28c01dc29d1d4fdd576cc9b21958fd9c3b /kvision-modules/kvision-tabulator/src/main/kotlin | |
parent | 4a2aa49e0e561c1bc25aa962449fa2fcce9207ba (diff) | |
download | kvision-134cb687c4e05fd81a03b682505f9fb9d741a8d7.tar.gz kvision-134cb687c4e05fd81a03b682505f9fb9d741a8d7.tar.bz2 kvision-134cb687c4e05fd81a03b682505f9fb9d741a8d7.zip |
Add new className parameter to all DSL builder functions.
Diffstat (limited to 'kvision-modules/kvision-tabulator/src/main/kotlin')
-rw-r--r-- | kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt index 0292a0a4..d830f8a2 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt @@ -33,6 +33,7 @@ import pl.treksoft.kvision.state.ObservableState import pl.treksoft.kvision.table.TableType import pl.treksoft.kvision.utils.createInstance import pl.treksoft.kvision.utils.obj +import pl.treksoft.kvision.utils.set import pl.treksoft.kvision.utils.syncWithList import kotlin.browser.window import pl.treksoft.kvision.tabulator.js.Tabulator as JsTabulator @@ -739,10 +740,11 @@ fun <T : Any> Container.tabulator( dataUpdateOnEdit: Boolean = true, options: TabulatorOptions<T> = TabulatorOptions(), types: Set<TableType> = setOf(), - classes: Set<String> = setOf(), + classes: Set<String>? = null, + className: String? = null, init: (Tabulator<T>.() -> Unit)? = null ): Tabulator<T> { - val tabulator = Tabulator.create(data, dataUpdateOnEdit, options, types, classes) + val tabulator = Tabulator.create(data, dataUpdateOnEdit, options, types, classes ?: className.set) init?.invoke(tabulator) this.add(tabulator) return tabulator @@ -756,10 +758,11 @@ fun <T : Any, S : Any> Container.tabulator( dataFactory: (S) -> List<T>, options: TabulatorOptions<T> = TabulatorOptions(), types: Set<TableType> = setOf(), - classes: Set<String> = setOf(), + classes: Set<String>? = null, + className: String? = null, init: (Tabulator<T>.() -> Unit)? = null ): Tabulator<T> { - val tabulator = Tabulator.create(store, dataFactory, options, types, classes) + val tabulator = Tabulator.create(store, dataFactory, options, types, classes ?: className.set) init?.invoke(tabulator) this.add(tabulator) return tabulator @@ -771,10 +774,12 @@ fun <T : Any, S : Any> Container.tabulator( fun <T : Any> Container.tabulator( options: TabulatorOptions<T> = TabulatorOptions(), types: Set<TableType> = setOf(), - classes: Set<String> = setOf(), + classes: Set<String>? = null, + className: String? = null, init: (Tabulator<T>.() -> Unit)? = null ): Tabulator<T> { - val tabulator = Tabulator(dataUpdateOnEdit = false, options = options, types = types, classes = classes) + val tabulator = + Tabulator(dataUpdateOnEdit = false, options = options, types = types, classes = classes ?: className.set) init?.invoke(tabulator) this.add(tabulator) return tabulator |