aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-tabulator/src
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-05-09 23:53:57 +0200
committerRobert Jaros <rjaros@finn.pl>2020-05-09 23:53:57 +0200
commit134cb687c4e05fd81a03b682505f9fb9d741a8d7 (patch)
treef9f41f28c01dc29d1d4fdd576cc9b21958fd9c3b /kvision-modules/kvision-tabulator/src
parent4a2aa49e0e561c1bc25aa962449fa2fcce9207ba (diff)
downloadkvision-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')
-rw-r--r--kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt17
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