aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobbie Cronin <robert.cronin@uqconnect.edu.au>2019-06-26 12:42:55 +0800
committerGitHub <noreply@github.com>2019-06-26 12:42:55 +0800
commitd20bc8739b1ad58c1222d63258f01ef9e9d34064 (patch)
tree078b87746de4a305452224de39272529def43679 /kvision-modules
parent97d136f14f086cf457453f1c94da1ecdae835234 (diff)
parent1f5742bebbafbe20a9d7527794798db7ebe5ab98 (diff)
downloadkvision-d20bc8739b1ad58c1222d63258f01ef9e9d34064.tar.gz
kvision-d20bc8739b1ad58c1222d63258f01ef9e9d34064.tar.bz2
kvision-d20bc8739b1ad58c1222d63258f01ef9e9d34064.zip
Merge pull request #2 from rjaros/master
pull version 0.0.37
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-datetime/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt1
-rw-r--r--kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt1
-rw-r--r--kvision-modules/kvision-pace/build.gradle4
-rw-r--r--kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/KVManagerPace.kt8
-rw-r--r--kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt174
-rw-r--r--kvision-modules/kvision-pace/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt30
-rw-r--r--kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/ReduxStoreSpec.kt19
-rw-r--r--kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/StateBindingSpec.kt2
-rw-r--r--kvision-modules/kvision-richtext/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-select/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-spinner/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-tabulator/build.gradle2
-rw-r--r--kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Options.kt535
-rw-r--r--kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt137
-rw-r--r--kvision-modules/kvision-tabulator/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-upload/webpack.config.d/css.js2
-rw-r--r--kvision-modules/kvision-upload/webpack.config.d/file.js6
19 files changed, 498 insertions, 435 deletions
diff --git a/kvision-modules/kvision-datetime/webpack.config.d/css.js b/kvision-modules/kvision-datetime/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-datetime/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt
index 0000db83..330d818d 100644
--- a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt
+++ b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-present Robert Jaros
+ * Copyright (c) 2019-present Robert Cronin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt
index 39e7c2dc..5f21bfe2 100644
--- a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt
+++ b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-present Robert Jaros
+ * Copyright (c) 2019-present Robert Cronin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/kvision-modules/kvision-pace/build.gradle b/kvision-modules/kvision-pace/build.gradle
index d577df20..238f9efa 100644
--- a/kvision-modules/kvision-pace/build.gradle
+++ b/kvision-modules/kvision-pace/build.gradle
@@ -4,6 +4,10 @@ kotlinFrontend {
npm {
dependency("pace-progressbar", "1.0.8")
+ devDependency("karma", "3.1.4")
+ devDependency("karma-chrome-launcher", "2.2.0")
+ devDependency("karma-webpack", "3.0.5")
+ devDependency("qunit", "2.8.0")
}
} \ No newline at end of file
diff --git a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/KVManagerPace.kt b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/KVManagerPace.kt
index 38a83fb5..9678d1fa 100644
--- a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/KVManagerPace.kt
+++ b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/KVManagerPace.kt
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-present Robert Jaros
+ * Copyright (c) 2019-present Robert Cronin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,10 +27,13 @@ internal val kVManagerPaceInit = KVManagerPace.init()
/**
* Internal singleton object which initializes and configures KVision Moment module.
*/
+@Suppress("EmptyCatchBlock", "TooGenericExceptionCaught")
internal object KVManagerPace {
- fun init() {}
+ fun init() {
+ }
private val pace = try {
require("pace-progressbar").default
- } catch (e: Throwable) {}
+ } catch (e: Throwable) {
+ }
}
diff --git a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
index a5d80908..d5c77534 100644
--- a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
+++ b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-present Robert Jaros
+ * Copyright (c) 2019-present Robert Cronin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -22,108 +23,125 @@
package pl.treksoft.kvision.pace
-import pl.treksoft.kvision.require
-import pl.treksoft.kvision.utils.obj
import org.w3c.dom.events.Event
import org.w3c.dom.get
+import pl.treksoft.kvision.require
+import pl.treksoft.kvision.utils.obj
import kotlin.browser.window
-class PaceAjaxOptions(trackMethods:Array<dynamic>? = null,
- trackWebSockets:Boolean? = null,
- ignoreURLs:Array<dynamic>? = null) {
+class PaceAjaxOptions(
+ trackMethods: Array<dynamic>? = null,
+ trackWebSockets: Boolean? = null,
+ ignoreURLs: Array<dynamic>? = null
+) {
internal var paceAjaxOptionsJs: dynamic = obj {
- if (trackMethods != null) { this.trackMethods = trackMethods }
- if (trackWebSockets != null) { this.trackWebSockets = trackWebSockets }
- if (ignoreURLs != null) { this.ignoreURLs = ignoreURLs }
+ if (trackMethods != null) {
+ this.trackMethods = trackMethods
+ }
+ if (trackWebSockets != null) {
+ this.trackWebSockets = trackWebSockets
+ }
+ if (ignoreURLs != null) {
+ this.ignoreURLs = ignoreURLs
+ }
}
}
-class PaceElementsOptions(minSamples:Int? = null,
- selectors:Array<dynamic>? = null) {
+class PaceElementsOptions(
+ minSamples: Int? = null,
+ selectors: Array<dynamic>? = null
+) {
internal var paceElementsOptionsJs: dynamic = obj {
- if (minSamples != null) { this.minSamples = minSamples }
- if (selectors != null) { this.selectors = selectors }
+ if (minSamples != null) {
+ this.minSamples = minSamples
+ }
+ if (selectors != null) {
+ this.selectors = selectors
+ }
}
}
-class PaceEventLagOptions(minSamples:Int? = null,
- sampleCount:Int? = null,
- lagThreshold:Int? = null) {
+class PaceEventLagOptions(
+ minSamples: Int? = null,
+ sampleCount: Int? = null,
+ lagThreshold: Int? = null
+) {
internal var paceEventLagOptionsJs: dynamic = obj {
- if (minSamples != null) { this.minSamples = minSamples }
- if (sampleCount != null) { this.sampleCount = sampleCount }
- if (lagThreshold != null) { this.lagThreshold = lagThreshold }
+ if (minSamples != null) {
+ this.minSamples = minSamples
+ }
+ if (sampleCount != null) {
+ this.sampleCount = sampleCount
+ }
+ if (lagThreshold != null) {
+ this.lagThreshold = lagThreshold
+ }
}
}
class PaceOptions(
- ajax:PaceAjaxOptions? = null,
- catchupTime:Int? = null,
- easeFactor:Double? = null,
- elements:PaceElementsOptions? = null,
- eventLag:PaceEventLagOptions? = null,
- ghostTime:Int? = null,
- initialRate:Double? = null,
- maxProgressPerFrame:Int? = null,
- minTime:Int? = null,
- restartOnPushState:Boolean? = null,
- restartOnRequestAfter:Double? = null,
- startOnPageLoad:Boolean? = null,
- target:String? = null
+ ajax: PaceAjaxOptions? = null,
+ catchupTime: Int? = null,
+ easeFactor: Double? = null,
+ elements: PaceElementsOptions? = null,
+ eventLag: PaceEventLagOptions? = null,
+ ghostTime: Int? = null,
+ initialRate: Double? = null,
+ maxProgressPerFrame: Int? = null,
+ minTime: Int? = null,
+ restartOnPushState: Boolean? = null,
+ restartOnRequestAfter: Double? = null,
+ startOnPageLoad: Boolean? = null,
+ target: String? = null
) {
internal var paceOptionsJs: dynamic = obj {
- if (ajax != null) { this.ajax = ajax.paceAjaxOptionsJs }
- if (catchupTime != null) { this.catchupTime = catchupTime }
- if (easeFactor != null) { this.easeFactor = easeFactor }
- if (elements != null) { this.elements = elements.paceElementsOptionsJs }
- if (eventLag != null) { this.eventLag = eventLag.paceEventLagOptionsJs }
- if (ghostTime != null) { this.ghostTime = ghostTime }
- if (initialRate != null) { this.initialRate = initialRate }
- if (maxProgressPerFrame != null) { this.maxProgressPerFrame = maxProgressPerFrame }
- if (minTime != null) { this.minTime = minTime }
- if (restartOnPushState != null) { this.restartOnPushState = restartOnPushState }
- if (restartOnRequestAfter != null) { this.restartOnRequestAfter = restartOnRequestAfter }
- if (startOnPageLoad != null) { this.startOnPageLoad = startOnPageLoad }
- if (target != null) { this.target = target }
+ if (ajax != null) {
+ this.ajax = ajax.paceAjaxOptionsJs
+ }
+ if (catchupTime != null) {
+ this.catchupTime = catchupTime
+ }
+ if (easeFactor != null) {
+ this.easeFactor = easeFactor
+ }
+ if (elements != null) {
+ this.elements = elements.paceElementsOptionsJs
+ }
+ if (eventLag != null) {
+ this.eventLag = eventLag.paceEventLagOptionsJs
+ }
+ if (ghostTime != null) {
+ this.ghostTime = ghostTime
+ }
+ if (initialRate != null) {
+ this.initialRate = initialRate
+ }
+ if (maxProgressPerFrame != null) {
+ this.maxProgressPerFrame = maxProgressPerFrame
+ }
+ if (minTime != null) {
+ this.minTime = minTime
+ }
+ if (restartOnPushState != null) {
+ this.restartOnPushState = restartOnPushState
+ }
+ if (restartOnRequestAfter != null) {
+ this.restartOnRequestAfter = restartOnRequestAfter
+ }
+ if (startOnPageLoad != null) {
+ this.startOnPageLoad = startOnPageLoad
+ }
+ if (target != null) {
+ this.target = target
+ }
}
}
-enum class PaceColor(var paceColorString: String) {
- Black("black"),
- Blue("blue"),
- Green("green"),
- Orange("orange"),
- Pink("pink"),
- Purple("purple"),
- Red("red"),
- Silver("silver"),
- White("white"),
- Yellow("yellow")
-}
-
-enum class PaceTheme(var paceThemeString: String) {
- BarberShop("barber-shop"),
- BigCounter("big-counter"),
- Bounce("bounce"),
- CenterAtom("center-atom"),
- CenterCircle("center-circle"),
- CenterRadar("center-radar"),
- CenterSimple("center-simple"),
- CornerIndicator("corner-indicator"),
- FillLeft("fill-left"),
- Flash("flash"),
- FlatTop("flat-top"),
- LoadingBar("loading-bar"),
- MacOSX("mac-osx"),
- Material("material"),
- Minimal("minimal")
-}
-
class Pace {
companion object {
- fun setNewTheme(color: PaceColor, theme: PaceTheme) {
- require("pace-progressbar/themes/${color.paceColorString}/pace-theme-${theme.paceThemeString}.css")
+ fun init(req: dynamic = require("pace-progressbar/themes/blue/pace-theme-flash.css")) {
}
+
fun setOptions(options: PaceOptions) {
window["Pace"].options = options.paceOptionsJs
}
@@ -140,4 +158,4 @@ class Pace {
window["Pace"].stop()
}
}
-} \ No newline at end of file
+}
diff --git a/kvision-modules/kvision-pace/webpack.config.d/css.js b/kvision-modules/kvision-pace/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-pace/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
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 246ccef5..bfe7bc50 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
@@ -21,11 +21,7 @@
*/
package pl.treksoft.kvision.redux
-import kotlinx.serialization.ImplicitReflectionSerializer
-import kotlinx.serialization.KSerializer
-import kotlinx.serialization.serializer
import pl.treksoft.kvision.KVManagerRedux
-import pl.treksoft.kvision.utils.JSON
import redux.RAction
import redux.Reducer
import redux.Store
@@ -43,49 +39,45 @@ typealias ActionCreator<A, S> = (Dispatch<A>, GetState<S>) -> Unit
* @param initialState an initial state
* @param middlewares a list of optional Redux JS middlewares
*/
-@UseExperimental(ImplicitReflectionSerializer::class)
-inline fun <reified S : Any, A : RAction> createReduxStore(
- noinline reducer: Reducer<S, A>,
+fun <S : Any, A : RAction> createReduxStore(
+ reducer: Reducer<S, A>,
initialState: S,
vararg middlewares: dynamic
): ReduxStore<S, A> {
@Suppress("SpreadOperator")
- return ReduxStore(reducer, initialState, S::class.serializer(), *middlewares)
+ return ReduxStore(reducer, initialState, *middlewares)
}
/**
* A class implementing redux pattern backed by the original Redux JS library.
- * It requires @Serializable state.
*
* @constructor Creates a Redux store with given reducer function and initial state.
- * @param S redux state type (@Serializable)
+ * @param S redux state type
* @param A redux action type
* @param reducer a reducer function
* @param initialState an initial state
- * @param stateSerializer a serializer for the state type
* @param middlewares a list of optional Redux JS middlewares
*/
class ReduxStore<S : Any, A : RAction>(
reducer: Reducer<S, A>,
initialState: S,
- val stateSerializer: KSerializer<S>,
vararg middlewares: dynamic
) {
- private val store: Store<String, dynamic, WrapperAction>
+ private val store: Store<S, dynamic, WrapperAction>
init {
@Suppress("UnsafeCastFromDynamic")
store = KVManagerRedux.createStore(
- { s: String, a: RAction ->
+ { s: S, a: RAction ->
@Suppress("UnsafeCastFromDynamic")
if (a == undefined || (a.asDynamic().type is String && a.asDynamic().type.startsWith("@@"))) {
s
} else {
@Suppress("UNCHECKED_CAST")
- JSON.plain.stringify(stateSerializer, reducer(JSON.plain.parse(stateSerializer, s), a as A))
+ reducer(s, a as A)
}
},
- JSON.plain.stringify(stateSerializer, initialState),
+ initialState,
@Suppress("SpreadOperator")
KVManagerRedux.compose(KVManagerRedux.applyMiddleware(KVManagerRedux.reduxThunk, *middlewares), rEnhancer())
)
@@ -95,7 +87,7 @@ class ReduxStore<S : Any, A : RAction>(
* Returns the current state.
*/
fun getState(): S {
- return JSON.plain.parse(stateSerializer, store.getState())
+ return store.getState()
}
/**
@@ -109,7 +101,7 @@ class ReduxStore<S : Any, A : RAction>(
* Dispatches an asynchronous action function.
*/
fun dispatch(actionCreator: ActionCreator<dynamic, S>): WrapperAction {
- return store.dispatch({ reduxDispatch: Dispatch<dynamic>, reduxGetState: GetState<String> ->
+ return store.dispatch({ reduxDispatch: Dispatch<dynamic>, reduxGetState: GetState<S> ->
val newDispatch: Dispatch<dynamic> = { elem ->
@Suppress("UnsafeCastFromDynamic")
if (js("typeof elem === 'function'")) {
@@ -118,7 +110,7 @@ class ReduxStore<S : Any, A : RAction>(
reduxDispatch(elem)
}
}
- actionCreator(newDispatch) { JSON.plain.parse(stateSerializer, reduxGetState()) }
+ actionCreator(newDispatch) { reduxGetState() }
})
}
diff --git a/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/ReduxStoreSpec.kt b/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/ReduxStoreSpec.kt
index 3be83556..b45eb9dd 100644
--- a/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/ReduxStoreSpec.kt
+++ b/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/ReduxStoreSpec.kt
@@ -21,15 +21,13 @@
*/
package test.pl.treksoft.kvision.redux
-import kotlinx.serialization.Serializable
import pl.treksoft.kvision.redux.createReduxStore
import redux.RAction
import test.pl.treksoft.kvision.SimpleSpec
import kotlin.test.Test
import kotlin.test.assertEquals
-@Serializable
-data class TestState(val counter: Int)
+data class TestState(val counter: Int, val values: List<Int>)
sealed class TestAction : RAction {
object Inc : TestAction()
@@ -38,10 +36,10 @@ sealed class TestAction : RAction {
fun testReducer(state: TestState, action: TestAction): TestState = when (action) {
is TestAction.Inc -> {
- state.copy(counter = state.counter + 1)
+ state.copy(counter = state.counter + 1, values = state.values + state.counter)
}
is TestAction.Dec -> {
- state.copy(counter = state.counter - 1)
+ state.copy(counter = state.counter - 1, values = state.values + state.counter)
}
}
@@ -50,20 +48,21 @@ class ReduxStoreSpec : SimpleSpec {
@Test
fun getState() {
run {
- val store = createReduxStore(::testReducer, TestState(10))
- assertEquals(TestState(10), store.getState())
+ val store = createReduxStore(::testReducer, TestState(10, listOf()))
+ assertEquals(TestState(10, listOf()), store.getState())
}
}
@Test
fun dispatch() {
run {
- val store = createReduxStore(::testReducer, TestState(10))
+ val store = createReduxStore(::testReducer, TestState(10, listOf()))
store.dispatch(TestAction.Inc)
store.dispatch(TestAction.Inc)
store.dispatch(TestAction.Inc)
store.dispatch(TestAction.Dec)
- assertEquals(TestState(12), store.getState())
+ store.dispatch(TestAction.Dec)
+ assertEquals(TestState(11, listOf(10, 11, 12, 13, 12)), store.getState())
}
}
@@ -71,7 +70,7 @@ class ReduxStoreSpec : SimpleSpec {
fun subscribe() {
run {
var counter = 0
- val store = createReduxStore(::testReducer, TestState(10))
+ val store = createReduxStore(::testReducer, TestState(10, listOf()))
store.subscribe {
counter++
}
diff --git a/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/StateBindingSpec.kt b/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/StateBindingSpec.kt
index 5204402d..ec32d0d6 100644
--- a/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/StateBindingSpec.kt
+++ b/kvision-modules/kvision-redux/src/test/kotlin/test/pl/treksoft/kvision/redux/StateBindingSpec.kt
@@ -21,7 +21,6 @@
*/
package test.pl.treksoft.kvision.redux
-import kotlinx.serialization.Serializable
import pl.treksoft.kvision.html.Div.Companion.div
import pl.treksoft.kvision.panel.Root
import pl.treksoft.kvision.panel.SimplePanel
@@ -33,7 +32,6 @@ import test.pl.treksoft.kvision.DomSpec
import kotlin.browser.document
import kotlin.test.Test
-@Serializable
data class State(val counter: Int)
sealed class StateAction : RAction {
diff --git a/kvision-modules/kvision-richtext/webpack.config.d/css.js b/kvision-modules/kvision-richtext/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-richtext/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-select/webpack.config.d/css.js b/kvision-modules/kvision-select/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-select/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-spinner/webpack.config.d/css.js b/kvision-modules/kvision-spinner/webpack.config.d/css.js
new file mode 100644
index 00000000..5d710d35
--- /dev/null
+++ b/kvision-modules/kvision-spinner/webpack.config.d/css.js
@@ -0,0 +1,2 @@
+config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" });
+
diff --git a/kvision-modules/kvision-tabulator/build.gradle b/kvision-modules/kvision-tabulator/build.gradle
index 5ea97e50..b74ef2d4 100644
--- a/kvision-modules/kvision-tabulator/build.gradle
+++ b/kvision-modules/kvision-tabulator/build.gradle
@@ -8,7 +8,7 @@ dependencies {
kotlinFrontend {
npm {
- dependency("tabulator-tables", "4.2.5")
+ dependency("tabulator-tables", "4.2.7")
devDependency("karma", "3.1.4")
devDependency("karma-chrome-launcher", "2.2.0")
devDependency("karma-webpack", "3.0.5")
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 906b0c82..a6f9c740 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
@@ -30,7 +30,6 @@ import pl.treksoft.kvision.panel.Root
import pl.treksoft.kvision.tabulator.EditorRoot.disposeTimer
import pl.treksoft.kvision.tabulator.EditorRoot.root
import pl.treksoft.kvision.tabulator.js.Tabulator
-import pl.treksoft.kvision.utils.JSON
import pl.treksoft.kvision.utils.obj
import kotlin.browser.document
import kotlin.browser.window
@@ -238,9 +237,9 @@ enum class AddRowMode(internal val mode: String) {
* Download config options.
*/
data class DownloadConfig(
- val columnGroups: Boolean? = null,
- val rowGroups: Boolean? = null,
- val columnCalcs: Boolean? = null
+ val columnGroups: Boolean? = null,
+ val rowGroups: Boolean? = null,
+ val columnCalcs: Boolean? = null
)
/**
@@ -259,102 +258,103 @@ fun DownloadConfig.toJs(): Tabulator.DownloadConfig {
* Column definition options.
*/
data class ColumnDefinition<T : Any>(
- val title: String,
- val field: String? = null,
- val visible: Boolean? = null,
- val align: Align? = null,
- val width: String? = null,
- val minWidth: Int? = null,
- val widthGrow: Int? = null,
- val widthShrink: Int? = null,
- val resizable: Boolean? = null,
- val frozen: Boolean? = null,
- val responsive: Int? = null,
- val tooltip: ((cell: Tabulator.CellComponent) -> String)? = null,
- val cssClass: String? = null,
- val rowHandle: Boolean? = null,
- val hideInHtml: Boolean? = null,
- val sorter: Sorter? = null,
- val sorterFunction: ((
- a: dynamic, b: dynamic, aRow: Tabulator.RowComponent, bRow: Tabulator.RowComponent,
- column: Tabulator.ColumnComponent, dir: SortingDir, sorterParams: dynamic
- ) -> Number)? = null,
- val sorterParams: dynamic = null,
- val formatter: Formatter? = null,
- val formatterFunction: ((
- cell: Tabulator.CellComponent, formatterParams: dynamic,
- onRendered: (callback: () -> Unit) -> Unit
- ) -> dynamic)? = null,
- val formatterComponentFunction: ((
- cell: Tabulator.CellComponent, onRendered: (callback: () -> Unit) -> Unit, data: T
- ) -> Component)? = null,
- val formatterParams: dynamic = null,
- val variableHeight: Boolean? = null,
- val editable: ((cell: Tabulator.CellComponent) -> Boolean)? = null,
- val editor: Editor? = null,
- val editorFunction: ((
- cell: Tabulator.CellComponent,
- onRendered: (callback: () -> Unit) -> Unit,
- success: (value: dynamic) -> Unit, cancel: (value: dynamic) -> Unit, editorParams: dynamic
- ) -> dynamic)? = null,
- val editorComponentFunction: ((
- cell: Tabulator.CellComponent,
- onRendered: (callback: () -> Unit) -> Unit,
- success: (value: dynamic) -> Unit, cancel: (value: dynamic) -> Unit, data: T
- ) -> Component)? = null,
- val editorParams: dynamic = null,
- val validator: Validator? = null,
- val validatorFunction: dynamic = null,
- val validatorParams: String? = null,
- val download: Boolean? = null,
- val downloadTitle: String? = null,
- val topCalc: Calc? = null,
- val topCalcParams: dynamic = null,
- val topCalcFormatter: Formatter? = null,
- val topCalcFormatterParams: dynamic = null,
- val bottomCalc: Calc? = null,
- val bottomCalcParams: dynamic = null,
- val bottomCalcFormatter: Formatter? = null,
- val bottomCalcFormatterParams: dynamic = null,
- val headerSort: Boolean? = null,
- val headerSortStartingDir: SortingDir? = null,
- val headerSortTristate: Boolean? = null,
- val headerClick: ((e: dynamic, column: Tabulator.ColumnComponent) -> Unit)? = null,
- val headerDblClick: ((e: dynamic, column: Tabulator.ColumnComponent) -> Unit)? = null,
- val headerContext: ((e: dynamic, column: Tabulator.ColumnComponent) -> Unit)? = null,
- val headerTap: ((e: dynamic, column: Tabulator.ColumnComponent) -> Unit)? = null,
- val headerDblTap: ((e: dynamic, column: Tabulator.ColumnComponent) -> Unit)? = null,
- val headerTapHold: ((e: dynamic, column: Tabulator.ColumnComponent) -> Unit)? = null,
- val headerTooltip: ((column: Tabulator.ColumnComponent) -> String)? = null,
- val headerVertical: Boolean? = null,
- val editableTitle: Boolean? = null,
- val titleFormatter: Formatter? = null,
- val titleFormatterParams: dynamic = null,
- val headerFilter: Editor? = null,
- val headerFilterParams: dynamic = null,
- val headerFilterPlaceholder: String? = null,
- val headerFilterEmptyCheck: ((value: Any) -> Boolean)? = null,
- val headerFilterFunc: Filter? = null,
- val headerFilterFuncParams: dynamic = null,
- val headerFilterLiveFilter: Boolean? = null,
- val cellClick: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellDblClick: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellContext: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellTap: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellDblTap: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellTapHold: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellMouseEnter: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellMouseLeave: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellMouseOver: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellMouseOut: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellMouseMove: ((e: dynamic, cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellEditing: ((cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellEdited: ((cell: Tabulator.CellComponent) -> Unit)? = null,
- val cellEditCancelled: ((cell: Tabulator.CellComponent) -> Unit)? = null
+ val title: String,
+ val field: String? = null,
+ val visible: Boolean? = null,
+ val align: Align? = null,
+ val width: String? = null,
+ val minWidth: Int? = null,
+ val widthGrow: Int? = null,
+ val widthShrink: Int? = null,
+ val resizable: Boolean? = null,
+ val frozen: Boolean? = null,
+ val responsive: Int? = null,
+ val tooltip: ((cell: Tabulator.CellComponent) -> String)? = null,
+ val cssClass: String? = null,
+ val rowHandle: Boolean? = null,
+ val hideInHtml: Boolean? = null,
+ val sorter: Sorter? = null,
+ val sorterFunction: ((
+ a: dynamic, b: dynamic, aRow: Tabulator.RowComponent, bRow: Tabulator.RowComponent,
+ column: Tabulator.ColumnComponent, dir: SortingDir, sorterParams: dynamic
+ ) -> Number)? = null,
+ val sorterParams: dynamic = null,
+ val formatter: Formatter? = null,
+ val formatterFunction: ((
+ cell: Tabulator.CellComponent, formatterParams: dynamic,
+ onRendered: (callback: () -> Unit) -> Unit
+ ) -> dynamic)? = null,
+ val formatterComponentFunction: ((
+ cell: Tabulator.CellComponent, onRendered: (callback: () -> Unit) -> Unit, data: T
+ ) -> Component)? = null,
+ val formatterParams: dynamic = null,
+ val variableHeight: Boolean? = null,
+ val editable: ((cell: Tabulator.CellComponent) -> Boolean)? = null,
+ val editor: Editor? = null,
+ val editorFunction: ((
+ cell: Tabulator.CellComponent,
+ onRendered: (callback: () -> Unit) -> Unit,
+ success: (value: dynamic) -> Unit, cancel: (value: dynamic) -> Unit, editorParams: dynamic
+ ) -> dynamic)? = null,
+ val editorComponentFunction: ((
+ cell: Tabulator.CellComponent,
+ onRendered: (callback: () -> Unit) -> Unit,
+ success: (value: dynamic) -> Unit, cancel: (value: dynamic) -> Unit, data: T
+ ) -> Component)? = null,
+ val editorParams: dynamic = null,
+ val validator: Validator? = null,
+ val validatorFunction: dynamic = null,
+ val validatorParams: String? = null,
+ val download: Boolean? = null,
+ val downloadTitle: String? = null,
+ val topCalc: Calc? = null,
+ val topCalcParams: dynamic = null,
+ val topCalcFormatter: Formatter? = null,
+ val topCalcFormatterParams: dynamic = null,
+ val bottomCalc: Calc? = null,</