From 0c6da96f0ce5ddbbfa58d9efed96ac62f2a22221 Mon Sep 17 00:00:00 2001 From: Robbie Cronin Date: Wed, 1 May 2019 09:13:53 +0800 Subject: Fix namespace issue Rename 2 conflicting Options variables in Charts and Tabulator packages to ChartOptions and TabulatorOptions respectively --- .../kotlin/pl/treksoft/kvision/chart/Configuration.kt | 2 +- .../main/kotlin/pl/treksoft/kvision/tabulator/Options.kt | 2 +- .../kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt | 16 ++++++++-------- .../test/pl/treksoft/kvision/tabulator/TabulatorSpec.kt | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt index 0925a0c8..a598bc5d 100644 --- a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt +++ b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt @@ -728,7 +728,7 @@ fun ChartScales.toJs(i18nTranslator: (String) -> (String)): dynamic { /** * Chart options. */ -data class Options( +data class ChartOptions( val responsive: Boolean = true, val responsiveAnimationDuration: Int = 0, val aspectRatio: Int = 2, diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt index c00af9cb..bb13372d 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt @@ -411,7 +411,7 @@ fun ColumnDefinition.toJs(i18nTranslator: (String) -> (String)): Tabulator.Colum /** * Tabulator options. */ -data class Options( +data class TabulatorOptions( val height: String? = null, val virtualDom: Boolean? = null, val virtualDomBuffer: Int? = null, 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 1b8becff..249c578f 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 @@ -54,7 +54,7 @@ import pl.treksoft.kvision.tabulator.js.Tabulator as JsTabulator @Suppress("LargeClass", "TooManyFunctions") open class Tabulator( protected val data: List? = null, - val options: Options = Options(), + val options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), protected val dataSerializer: KSerializer? = null @@ -561,7 +561,7 @@ open class Tabulator( */ inline fun Container.tabulator( data: List? = null, - options: Options = Options(), + options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), noinline init: (Tabulator.() -> Unit)? = null @@ -578,7 +578,7 @@ open class Tabulator( inline fun Container.tabulator( store: ReduxStore, noinline dataFactory: (S) -> List, - options: Options = Options(), + options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), noinline init: (Tabulator.() -> Unit)? = null @@ -594,7 +594,7 @@ open class Tabulator( */ inline fun Container.tabulator( store: ReduxStore, A>, - options: Options = Options(), + options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), noinline init: (Tabulator.() -> Unit)? = null @@ -609,7 +609,7 @@ open class Tabulator( * DSL builder extension function for dynamic data (send within options parameter). */ fun Container.tabulator( - options: Options = Options(), + options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), init: (Tabulator.() -> Unit)? = null @@ -625,7 +625,7 @@ open class Tabulator( */ @UseExperimental(ImplicitReflectionSerializer::class) inline fun create( - data: List? = null, options: Options = Options(), + data: List? = null, options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), noinline init: (Tabulator.() -> Unit)? = null @@ -642,7 +642,7 @@ open class Tabulator( inline fun create( store: ReduxStore, noinline dataFactory: (S) -> List, - options: Options = Options(), + options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), noinline init: (Tabulator.() -> Unit)? = null @@ -662,7 +662,7 @@ open class Tabulator( @UseExperimental(ImplicitReflectionSerializer::class) inline fun create( store: ReduxStore, A>, - options: Options = Options(), + options: TabulatorOptions = TabulatorOptions(), types: Set = setOf(), classes: Set = setOf(), noinline init: (Tabulator.() -> Unit)? = null diff --git a/kvision-modules/kvision-tabulator/src/test/kotlin/test/pl/treksoft/kvision/tabulator/TabulatorSpec.kt b/kvision-modules/kvision-tabulator/src/test/kotlin/test/pl/treksoft/kvision/tabulator/TabulatorSpec.kt index f90e1f46..d6b33a78 100644 --- a/kvision-modules/kvision-tabulator/src/test/kotlin/test/pl/treksoft/kvision/tabulator/TabulatorSpec.kt +++ b/kvision-modules/kvision-tabulator/src/test/kotlin/test/pl/treksoft/kvision/tabulator/TabulatorSpec.kt @@ -22,7 +22,7 @@ package test.pl.treksoft.kvision.tabulator import pl.treksoft.kvision.panel.Root -import pl.treksoft.kvision.tabulator.Options +import pl.treksoft.kvision.tabulator.TabulatorOptions import pl.treksoft.kvision.tabulator.Tabulator import pl.treksoft.kvision.utils.obj import test.pl.treksoft.kvision.DomSpec @@ -35,7 +35,7 @@ class TabulatorSpec : DomSpec { fun render() { run { val root = Root("test", true) - val tabulator = Tabulator(options = Options(data = arrayOf(obj { + val tabulator = Tabulator(options = TabulatorOptions(data = arrayOf(obj { id = 1 name = "Name" age = 40 -- cgit From 37e980522d2512b25e0bfa074fce42732d5c0596 Mon Sep 17 00:00:00 2001 From: Robbie Cronin Date: Wed, 1 May 2019 14:13:09 +0800 Subject: Update missed namespace changes Change Options to ChartOptions to match new variable name --- .../src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt index a598bc5d..df3b7973 100644 --- a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt +++ b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt @@ -758,7 +758,7 @@ data class ChartOptions( * An extension function to convert configuration class to JS object. */ @Suppress("ComplexMethod") -fun Options.toJs(i18nTranslator: (String) -> (String)): dynamic { +fun ChartOptions.toJs(i18nTranslator: (String) -> (String)): dynamic { return obj { this.responsive = responsive this.responsiveAnimationDuration = responsiveAnimationDuration @@ -889,7 +889,7 @@ data class Configuration( val type: ChartType, val dataSets: List, val labels: List? = null, - val options: Options? = null + val options: ChartOptions? = null ) /** -- cgit From 6971a2b7383b376223a49c7eb5e900e36fcd6e8f Mon Sep 17 00:00:00 2001 From: Robbie Cronin Date: Wed, 1 May 2019 17:22:33 +0800 Subject: Update Options name to TabulatorOptions in toJs extension --- .../src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt index bb13372d..dac29ab9 100644 --- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt +++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt @@ -572,7 +572,7 @@ data class TabulatorOptions( * An extension function to convert tabulator options class to JS object. */ @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE", "ComplexMethod") -fun Options.toJs(i18nTranslator: (String) -> (String)): Tabulator.Options { +fun TabulatorOptions.toJs(i18nTranslator: (String) -> (String)): Tabulator.Options { return obj { if (height != null) this.height = height if (virtualDom != null) this.virtualDom = virtualDom -- cgit From 63767fec9660bdcbfd041ec28fb76ba95b322f2a Mon Sep 17 00:00:00 2001 From: Robbie Cronin Date: Wed, 1 May 2019 17:42:04 +0800 Subject: Update ChartCanvasSpec and ChartSpec for new ChartOptions name --- .../src/test/kotlin/test/pl/treksoft/kvision/chart/ChartCanvasSpec.kt | 4 ++-- .../src/test/kotlin/test/pl/treksoft/kvision/chart/ChartSpec.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartCanvasSpec.kt b/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartCanvasSpec.kt index 9ea2ee6e..6fae54ad 100644 --- a/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartCanvasSpec.kt +++ b/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartCanvasSpec.kt @@ -25,7 +25,7 @@ import pl.treksoft.kvision.chart.ChartCanvas import pl.treksoft.kvision.chart.ChartType import pl.treksoft.kvision.chart.Configuration import pl.treksoft.kvision.chart.DataSets -import pl.treksoft.kvision.chart.Options +import pl.treksoft.kvision.chart.ChartOptions import pl.treksoft.kvision.panel.Root import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document @@ -62,7 +62,7 @@ class ChartCanvasSpec : DomSpec { configuration = Configuration( ChartType.SCATTER, listOf(DataSets(label = "Chart", data = listOf(0, 1))), - options = Options(responsive = false) + options = ChartOptions(responsive = false) ) ) root.add(chart) diff --git a/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartSpec.kt b/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartSpec.kt index 2e508107..7974ea78 100644 --- a/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartSpec.kt +++ b/kvision-modules/kvision-chart/src/test/kotlin/test/pl/treksoft/kvision/chart/ChartSpec.kt @@ -25,7 +25,7 @@ import pl.treksoft.kvision.chart.Chart import pl.treksoft.kvision.chart.ChartType import pl.treksoft.kvision.chart.Configuration import pl.treksoft.kvision.chart.DataSets -import pl.treksoft.kvision.chart.Options +import pl.treksoft.kvision.chart.ChartOptions import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.utils.px import test.pl.treksoft.kvision.DomSpec @@ -65,7 +65,7 @@ class ChartSpec : DomSpec { Configuration( ChartType.SCATTER, listOf(DataSets(label = "Chart", data = listOf(0, 1))), - options = Options(responsive = false) + options = ChartOptions(responsive = false) ), 300, 600 ) root.add(chart) -- cgit