diff options
5 files changed, 16 insertions, 16 deletions
diff --git a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt index 7625ed7a..45f743f3 100644 --- a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt +++ b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt @@ -76,7 +76,7 @@ class ReduxStore<S : Any, A : RAction>( } }, initialState, applyMiddleware(createThunkMiddleware(), *middlewares)) - fun getState(): S { + override fun getState(): S { return store.getState() } diff --git a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt index 2fd0b744..474206fc 100644 --- a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt +++ b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt @@ -84,7 +84,7 @@ class ReduxStore<S : Any, A : RAction>( ) } - fun getState(): S { + override fun getState(): S { return store.getState() } diff --git a/kvision-modules/kvision-tabulator/build.gradle b/kvision-modules/kvision-tabulator/build.gradle index 980b44a3..ef9b50c3 100644 --- a/kvision-modules/kvision-tabulator/build.gradle +++ b/kvision-modules/kvision-tabulator/build.gradle @@ -1,9 +1,5 @@ apply from: "../shared.gradle" -dependencies { - compile project(":kvision-modules:kvision-redux") -} - kotlinFrontend { npm { 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 9d9b7ae8..ac7ff533 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 @@ -28,13 +28,12 @@ import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.StringBoolPair import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.i18n.I18n -import pl.treksoft.kvision.redux.ReduxStore import pl.treksoft.kvision.state.ObservableList +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.syncWithList -import redux.RAction import kotlin.browser.window import pl.treksoft.kvision.tabulator.js.Tabulator as JsTabulator @@ -711,8 +710,8 @@ open class Tabulator<T : Any>( /** * A helper function to create a Tabulator object with correct serializer and general redux store. */ - fun <T : Any, S : Any, A : RAction> create( - store: ReduxStore<S, A>, + fun <T : Any, S : Any> create( + store: ObservableState<S>, dataFactory: (S) -> List<T>, options: TabulatorOptions<T> = TabulatorOptions(), types: Set<TableType> = setOf(), @@ -731,8 +730,8 @@ open class Tabulator<T : Any>( /** * A helper function to create a Tabulator object with correct serializer and dedicated redux store. */ - fun <T : Any, A : RAction> create( - store: ReduxStore<List<T>, A>, + fun <T : Any> create( + store: ObservableState<List<T>>, options: TabulatorOptions<T> = TabulatorOptions(), types: Set<TableType> = setOf(), classes: Set<String> = setOf(), @@ -771,8 +770,8 @@ fun <T : Any> Container.tabulator( /** * DSL builder extension function for general redux store. */ -fun <T : Any, S : Any, A : RAction> Container.tabulator( - store: ReduxStore<S, A>, +fun <T : Any, S : Any> Container.tabulator( + store: ObservableState<S>, dataFactory: (S) -> List<T>, options: TabulatorOptions<T> = TabulatorOptions(), types: Set<TableType> = setOf(), @@ -788,8 +787,8 @@ fun <T : Any, S : Any, A : RAction> Container.tabulator( /** * DSL builder extension function for dedicated redux store (backed with a list). */ -fun <T : Any, A : RAction> Container.tabulator( - store: ReduxStore<List<T>, A>, +fun <T : Any> Container.tabulator( + store: ObservableState<List<T>>, options: TabulatorOptions<T> = TabulatorOptions(), types: Set<TableType> = setOf(), classes: Set<String> = setOf(), diff --git a/src/main/kotlin/pl/treksoft/kvision/state/ObservableState.kt b/src/main/kotlin/pl/treksoft/kvision/state/ObservableState.kt index f1cba7f0..c1fd0936 100644 --- a/src/main/kotlin/pl/treksoft/kvision/state/ObservableState.kt +++ b/src/main/kotlin/pl/treksoft/kvision/state/ObservableState.kt @@ -26,6 +26,11 @@ package pl.treksoft.kvision.state */ interface ObservableState<S> { /** + * Get current state. + */ + fun getState(): S + + /** * Subscribe for the state change notifications. */ fun subscribe(observer: (S) -> Unit): () -> Unit |