aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Configuration.kt6
-rw-r--r--kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt2
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Style.kt9
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/Root.kt3
6 files changed, 12 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 0c2ebf76..c97ea9b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
.*/
build/
-out/
*.iml
/build-mvn.sh
/build-mvnlocal.sh
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 7b1cddd6..0925a0c8 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
@@ -911,9 +911,9 @@ fun Configuration.toJs(i18nTranslator: (String) -> (String)): Chart.ChartConfigu
}
private fun Array<dynamic>.checkSingleValue(): dynamic {
- if (this.size == 1) {
- return this[0]
+ return if (this.size == 1) {
+ this[0]
} else {
- return this
+ this
}
}
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 47d2c3c8..246ccef5 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
@@ -118,7 +118,7 @@ class ReduxStore<S : Any, A : RAction>(
reduxDispatch(elem)
}
}
- actionCreator(newDispatch, { JSON.plain.parse(stateSerializer, reduxGetState()) })
+ actionCreator(newDispatch) { JSON.plain.parse(stateSerializer, reduxGetState()) }
})
}
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
index 1a9460f2..924a84c1 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
@@ -110,7 +110,7 @@ open class CallAgent {
* @param beforeSend a content type of the request
* @return a promise of the result
*/
- @Suppress("UnsafeCastFromDynamic")
+ @Suppress("UnsafeCastFromDynamic", "ComplexMethod")
fun remoteCall(
url: String,
data: dynamic = null,
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Style.kt b/src/main/kotlin/pl/treksoft/kvision/core/Style.kt
index 7510a650..c2858fa0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Style.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Style.kt
@@ -36,6 +36,7 @@ import pl.treksoft.kvision.panel.Root
* @param parentStyle parent CSS style object
* @param init an initializer extension function
*/
+@Suppress("TooManyFunctions")
open class Style(className: String? = null, parentStyle: Style? = null, init: (Style.() -> Unit)? = null) :
StyledComponent() {
@@ -54,6 +55,7 @@ open class Style(className: String? = null, parentStyle: Style? = null, init: (S
init {
val root = Root.getLastRoot()
+ @Suppress("LeakingThis")
parent = root
if (root != null) {
@Suppress("LeakingThis")
@@ -112,9 +114,9 @@ open class Style(className: String? = null, parentStyle: Style? = null, init: (S
internal fun generateStyle(): String {
val styles = getSnStyle()
- return ".${className} {\n" + styles.map {
+ return ".$className {\n" + styles.joinToString("\n") {
"${it.first}: ${it.second};"
- }.joinToString("\n") + "\n}"
+ } + "\n}"
}
override fun getElement(): Node? {
@@ -161,8 +163,7 @@ open class Style(className: String? = null, parentStyle: Style? = null, init: (S
* It takes the same parameters as the constructor of the built component.
*/
fun Style.style(className: String? = null, init: (Style.() -> Unit)? = null): Style {
- val style = Style(className, this, init)
- return style
+ return Style(className, this, init)
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt
index e069dd4c..1a90f7fc 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt
@@ -44,6 +44,7 @@ import pl.treksoft.kvision.utils.snOpt
* otherwise it's rendered with "container" class (default is false)
* @param init an initializer extension function
*/
+@Suppress("TooManyFunctions")
class Root(id: String, private val fixed: Boolean = false, init: (Root.() -> Unit)? = null) : SimplePanel() {
private val styles: MutableList<Style> = mutableListOf()
private val modals: MutableList<Modal> = mutableListOf()
@@ -97,7 +98,7 @@ class Root(id: String, private val fixed: Boolean = false, init: (Root.() -> Uni
private fun stylesVNodes(): Array<VNode> {
val visibleStyles = styles.filter { it.visible }
return if (visibleStyles.isNotEmpty()) {
- val stylesDesc = visibleStyles.map { it.generateStyle() }.joinToString("\n")
+ val stylesDesc = visibleStyles.joinToString("\n") { it.generateStyle() }
arrayOf(h("style", arrayOf(stylesDesc)))
} else {
arrayOf()