aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-10-13 03:37:40 +0200
committerRobert Jaros <rjaros@finn.pl>2018-10-13 03:37:40 +0200
commitebce2c4b839c0b2f8be78bc31c1ce12c45a0164c (patch)
tree7cac3c5449eb8aa398b279d62d9a67ed34fa4115 /kvision-modules
parent470953c78c2509224bb452c16f8bbea54e53b3d7 (diff)
downloadkvision-ebce2c4b839c0b2f8be78bc31c1ce12c45a0164c.tar.gz
kvision-ebce2c4b839c0b2f8be78bc31c1ce12c45a0164c.tar.bz2
kvision-ebce2c4b839c0b2f8be78bc31c1ce12c45a0164c.zip
Major refactoring of the multi-platform components.
Dependencies upgrade. A lot of code style fixes.
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt)27
-rw-r--r--kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/KVManagerDatetime.kt2
-rw-r--r--kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt10
-rw-r--r--kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt43
-rw-r--r--kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt4
-rw-r--r--kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt4
-rw-r--r--kvision-modules/kvision-handlebars/src/main/kotlin/pl/treksoft/kvision/KVManagerHandlebars.kt5
-rw-r--r--kvision-modules/kvision-i18n/src/main/kotlin/pl/treksoft/kvision/KVManagerI18n.kt5
-rw-r--r--kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/KVManagerRichText.kt2
-rw-r--r--kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt11
-rw-r--r--kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt2
-rw-r--r--kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt42
-rw-r--r--kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt2
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt7
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt40
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt)24
-rw-r--r--kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/KVManagerSpinner.kt2
-rw-r--r--kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt28
-rw-r--r--kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/KVManagerUpload.kt2
-rw-r--r--kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt56
20 files changed, 144 insertions, 174 deletions
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index 0cb1a1f1..86a72b33 100644
--- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt
+++ b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -21,29 +21,8 @@
*/
package pl.treksoft.kvision.types
-import kotlinx.serialization.Serializable
+expect class Date
-expect val KDATE_FORMAT: String
+expect fun String.toDateF(format: String = "YYYY-MM-DD HH:mm:ss"): Date
-/**
- * A serializable wrapper for a multiplatform Date type.
- */
-@Serializable
-data class KDate(val time: Long) {
- constructor() : this(now().time)
- constructor(str: String) : this(str.toKDateF(KDATE_FORMAT).time)
-
- override fun toString(): String {
- return this.toStringF(KDATE_FORMAT)
- }
-
- companion object {
- fun now() = nowDate()
- }
-}
-
-expect fun nowDate(): KDate
-
-expect fun String.toKDateF(format: String): KDate
-
-expect fun KDate.toStringF(format: String): String
+expect fun Date.toStringF(format: String = "YYYY-MM-DD HH:mm:ss"): String
diff --git a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/KVManagerDatetime.kt b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/KVManagerDatetime.kt
index cde55b1e..4cc71c8b 100644
--- a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/KVManagerDatetime.kt
+++ b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/KVManagerDatetime.kt
@@ -21,7 +21,7 @@
*/
package pl.treksoft.kvision
-internal val KVManagerDatetimeInit = KVManagerDatetime.init()
+internal val kVManagerDatetimeInit = KVManagerDatetime.init()
/**
* Internal singleton object which initializes and configures KVision datetime module.
diff --git a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
index 9cdd0369..3d32fd8c 100644
--- a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
+++ b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
@@ -24,12 +24,12 @@ package pl.treksoft.kvision.form.time
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.StringBoolPair
import pl.treksoft.kvision.core.Widget
+import pl.treksoft.kvision.form.DateFormControl
import pl.treksoft.kvision.form.FieldLabel
import pl.treksoft.kvision.form.HelpBlock
-import pl.treksoft.kvision.form.KDateFormControl
import pl.treksoft.kvision.panel.SimplePanel
-import pl.treksoft.kvision.types.KDate
import pl.treksoft.kvision.utils.SnOn
+import kotlin.js.Date
/**
* Form field date/time chooser component.
@@ -42,9 +42,9 @@ import pl.treksoft.kvision.utils.SnOn
* @param rich determines if [label] can contain HTML code
*/
open class DateTime(
- value: KDate? = null, name: String? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
+ value: Date? = null, name: String? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
rich: Boolean = false
-) : SimplePanel(setOf("form-group")), KDateFormControl {
+) : SimplePanel(setOf("form-group")), DateFormControl {
/**
* Date/time input value.
@@ -235,7 +235,7 @@ open class DateTime(
* It takes the same parameters as the constructor of the built component.
*/
fun Container.dateTime(
- value: KDate? = null, name: String? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
+ value: Date? = null, name: String? = null, format: String = "YYYY-MM-DD HH:mm", label: String? = null,
rich: Boolean = false, init: (DateTime.() -> Unit)? = null
): DateTime {
val dateTime = DateTime(value, name, format, label, rich).apply { init?.invoke(this) }
diff --git a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
index 1df8a082..69b84c87 100644
--- a/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
+++ b/kvision-modules/kvision-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
@@ -29,11 +29,10 @@ import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.form.FormInput
import pl.treksoft.kvision.form.InputSize
import pl.treksoft.kvision.i18n.I18n
-import pl.treksoft.kvision.types.KDate
-import pl.treksoft.kvision.types.toJS
-import pl.treksoft.kvision.types.toKDateF
+import pl.treksoft.kvision.types.toDateF
import pl.treksoft.kvision.types.toStringF
import pl.treksoft.kvision.utils.obj
+import kotlin.js.Date
internal const val DEFAULT_MINUTE_STEP = 5
internal const val MAX_VIEW = 4
@@ -48,7 +47,7 @@ internal const val MAX_VIEW = 4
*/
@Suppress("TooManyFunctions")
open class DateTimeInput(
- value: KDate? = null, format: String = "YYYY-MM-DD HH:mm",
+ value: Date? = null, format: String = "YYYY-MM-DD HH:mm",
classes: Set<String> = setOf()
) : Widget(classes + "form-control"), FormInput {
@@ -63,11 +62,11 @@ open class DateTimeInput(
/**
* Date/time input value.
*/
- var value by refreshOnUpdate(value, { refreshState() })
+ var value by refreshOnUpdate(value) { refreshState() }
/**
* Date/time format.
*/
- var format by refreshOnUpdate(format, { refreshDatePicker() })
+ var format by refreshOnUpdate(format) { refreshDatePicker() }
/**
* The placeholder for the date/time input.
*/
@@ -95,31 +94,31 @@ open class DateTimeInput(
/**
* Day of the week start. 0 (Sunday) to 6 (Saturday).
*/
- var weekStart by refreshOnUpdate(0, { refreshDatePicker() })
+ var weekStart by refreshOnUpdate(0) { refreshDatePicker() }
/**
* Days of the week that should be disabled. Multiple values should be comma separated.
*/
- var daysOfWeekDisabled by refreshOnUpdate(arrayOf<Int>(), { refreshDatePicker() })
+ var daysOfWeekDisabled by refreshOnUpdate(arrayOf<Int>()) { refreshDatePicker() }
/**
* Determines if *Clear* button should be visible.
*/
- var clearBtn by refreshOnUpdate(true, { refreshDatePicker() })
+ var clearBtn by refreshOnUpdate(true) { refreshDatePicker() }
/**
* Determines if *Today* button should be visible.
*/
- var todayBtn by refreshOnUpdate(false, { refreshDatePicker() })
+ var todayBtn by refreshOnUpdate(false) { refreshDatePicker() }
/**
* Determines if the current day should be highlighted.
*/
- var todayHighlight by refreshOnUpdate(false, { refreshDatePicker() })
+ var todayHighlight by refreshOnUpdate(false) { refreshDatePicker() }
/**
* The increment used to build the hour view.
*/
- var minuteStep by refreshOnUpdate(DEFAULT_MINUTE_STEP, { refreshDatePicker() })
+ var minuteStep by refreshOnUpdate(DEFAULT_MINUTE_STEP) { refreshDatePicker() }
/**
* Determines if meridian views are visible in day and hour views.
*/
- var showMeridian by refreshOnUpdate(false, { refreshDatePicker() })
+ var showMeridian by refreshOnUpdate(false) { refreshDatePicker() }
override fun render(): VNode {
return render("input")
@@ -164,7 +163,7 @@ open class DateTimeInput(
@Suppress("UnsafeCastFromDynamic")
protected open fun refreshState() {
value?.let {
- getElementJQueryD()?.datetimepicker("update", it.toJS())
+ getElementJQueryD()?.datetimepicker("update", it)
} ?: run {
getElementJQueryD()?.`val`(null)
getElementJQueryD()?.datetimepicker("update", null)
@@ -181,7 +180,7 @@ open class DateTimeInput(
protected open fun changeValue() {
val v = getElementJQuery()?.`val`() as String?
if (v != null && v.isNotEmpty()) {
- this.value = v.toKDateF(format)
+ this.value = v.toDateF(format)
} else {
this.value = null
}
@@ -205,15 +204,15 @@ open class DateTimeInput(
override fun afterInsert(node: VNode) {
if (!this.disabled) {
this.initDateTimePicker()
- this.getElementJQuery()?.on("changeDate", { e, _ ->
+ this.getElementJQuery()?.on("changeDate") { e, _ ->
this.dispatchEvent("change", obj { detail = e })
- })
- this.getElementJQuery()?.on("show", { e, _ ->
+ }
+ this.getElementJQuery()?.on("show") { e, _ ->
this.dispatchEvent("showBsDateTime", obj { detail = e })
- })
- this.getElementJQuery()?.on("hide", { e, _ ->
+ }
+ this.getElementJQuery()?.on("hide") { e, _ ->
this.dispatchEvent("hideBsDateTime", obj { detail = e })
- })
+ }
refreshState()
}
}
@@ -280,7 +279,7 @@ open class DateTimeInput(
* It takes the same parameters as the constructor of the built component.
*/
fun Container.dateTimeInput(
- value: KDate? = null, format: String = "YYYY-MM-DD HH:mm", classes: Set<String> = setOf(),
+ value: Date? = null, format: String = "YYYY-MM-DD HH:mm", classes: Set<String> = setOf(),
init: (DateTimeInput.() -> Unit)? = null
): DateTimeInput {
val dateTimeInput = DateTimeInput(value, format, classes).apply { init?.invoke(this) }
diff --git a/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt b/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
index d824125b..69ab46ec 100644
--- a/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
+++ b/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeInputSpec.kt
@@ -23,9 +23,9 @@ package test.pl.treksoft.kvision.form.time
import pl.treksoft.kvision.form.time.DateTimeInput
import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.types.KDate
import pl.treksoft.kvision.types.toStringF
import test.pl.treksoft.kvision.DomSpec
+import kotlin.js.Date
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -35,7 +35,7 @@ class DateTimeInputSpec : DomSpec {
fun render() {
run {
val root = Root("test", true)
- val data = KDate()
+ val data = Date()
val dti = DateTimeInput(value = data).apply {
placeholder = "place"
id = "idti"
diff --git a/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt b/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
index 482a7b7a..19cefd86 100644
--- a/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
+++ b/kvision-modules/kvision-datetime/src/test/kotlin/test/pl/treksoft/kvision/form/time/DateTimeSpec.kt
@@ -23,10 +23,10 @@ package test.pl.treksoft.kvision.form.time
import pl.treksoft.kvision.form.time.DateTime
import pl.treksoft.kvision.panel.Root
-import pl.treksoft.kvision.types.KDate
import pl.treksoft.kvision.types.toStringF
import test.pl.treksoft.kvision.DomSpec
import kotlin.browser.document
+import kotlin.js.Date
import kotlin.test.Test
class DateTimeSpec : DomSpec {
@@ -35,7 +35,7 @@ class DateTimeSpec : DomSpec {
fun render() {
run {
val root = Root("test", true)
- val data = KDate()
+ val data = Date()
val ti = DateTime(value = data, label = "Label").apply {
placeholder = "place"
name = "name"
diff --git a/kvision-modules/kvision-handlebars/src/main/kotlin/pl/treksoft/kvision/KVManagerHandlebars.kt b/kvision-modules/kvision-handlebars/src/main/kotlin/pl/treksoft/kvision/KVManagerHandlebars.kt
index b7f5fbc6..b2e52bf7 100644
--- a/kvision-modules/kvision-handlebars/src/main/kotlin/pl/treksoft/kvision/KVManagerHandlebars.kt
+++ b/kvision-modules/kvision-handlebars/src/main/kotlin/pl/treksoft/kvision/KVManagerHandlebars.kt
@@ -21,10 +21,7 @@
*/
package pl.treksoft.kvision
-import org.w3c.dom.asList
-import kotlin.browser.document
-
-internal val KVManagerHandlebarsInit = KVManagerHandlebars.init()
+internal val kVManagerHandlebarsInit = KVManagerHandlebars.init()
/**
* Internal singleton object which initializes and configures KVision handlebars module.
diff --git a/kvision-modules/kvision-i18n/src/main/kotlin/pl/treksoft/kvision/KVManagerI18n.kt b/kvision-modules/kvision-i18n/src/main/kotlin/pl/treksoft/kvision/KVManagerI18n.kt
index 66e3e72c..9e24327b 100644
--- a/kvision-modules/kvision-i18n/src/main/kotlin/pl/treksoft/kvision/KVManagerI18n.kt
+++ b/kvision-modules/kvision-i18n/src/main/kotlin/pl/treksoft/kvision/KVManagerI18n.kt
@@ -21,10 +21,7 @@
*/
package pl.treksoft.kvision
-import org.w3c.dom.asList
-import kotlin.browser.document
-
-internal val KVManagerI18nInit = KVManagerI18n.init()
+internal val kVManagerI18nInit = KVManagerI18n.init()
/**
* Internal singleton object which initializes and configures KVision i18n module.
diff --git a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/KVManagerRichText.kt b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/KVManagerRichText.kt
index 1ccd7a85..c7cd444c 100644
--- a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/KVManagerRichText.kt
+++ b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/KVManagerRichText.kt
@@ -25,7 +25,7 @@ import pl.treksoft.kvision.i18n.I18n
import pl.treksoft.kvision.utils.obj
import kotlin.browser.window
-internal val KVManagerRichTextInit = KVManagerRichText.init()
+internal val kVManagerRichTextInit = KVManagerRichText.init()
/**
* Internal singleton object which initializes and configures KVision RichText module.
diff --git a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
index 961c27cd..43b018f4 100644
--- a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
+++ b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
@@ -23,7 +23,6 @@ package pl.treksoft.kvision.form.text
import com.github.snabbdom.VNode
import pl.treksoft.jquery.jQuery
-import pl.treksoft.kvision.KVManagerRichText
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.StringPair
import kotlin.browser.document
@@ -67,7 +66,7 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf())
if (this.disabled || this.readonly == true) {
this.getElementJQuery()?.removeAttr("contenteditable")
} else {
- this.getElementJQuery()?.on("trix-change", { _, _ ->
+ this.getElementJQuery()?.on("trix-change") { _, _ ->
if (trixId != null) {
val v = document.getElementById("trix-input-$trixId")?.let { jQuery(it).`val`() as String? }
value = if (v != null && v.isNotEmpty()) {
@@ -78,9 +77,9 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf())
val event = org.w3c.dom.events.Event("change")
this.getElement()?.dispatchEvent(event)
}
- })
+ }
}
- this.getElementJQuery()?.on("trix-initialize", { _, _ ->
+ this.getElementJQuery()?.on("trix-initialize") { _, _ ->
trixId = this.getElementJQuery()?.attr("trix-id")
if (trixId != null) {
value?.let {
@@ -89,8 +88,8 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf())
}
}
}
- })
- this.getElementJQuery()?.on("trix-file-accept", { e, _ -> e.preventDefault() })
+ }
+ this.getElementJQuery()?.on("trix-file-accept") { e, _ -> e.preventDefault() }
}
override fun afterDestroy() {
diff --git a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt
index c7c3815a..e2c556c1 100644
--- a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt
+++ b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/KVManagerSelect.kt
@@ -21,7 +21,7 @@
*/
package pl.treksoft.kvision
-internal val KVManagerSelectInit = KVManagerSelect.init()
+internal val kVManagerSelectInit = KVManagerSelect.init()
/**
* Internal singleton object which initializes and configures KVision select module.
diff --git a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
index 8f4569c7..30609907 100644
--- a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
+++ b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
@@ -66,11 +66,11 @@ open class SelectInput(
/**
* A list of options (label to value pairs) for the select control.
*/
- internal var options by refreshOnUpdate(options, { setChildrenFromOptions() })
+ internal var options by refreshOnUpdate(options) { setChildrenFromOptions() }
/**
* A value of the selected option.
*/
- var value by refreshOnUpdate(value, { refreshState() })
+ var value by refreshOnUpdate(value) { refreshState() }
/**
* The name attribute of the generated HTML select element.
*/
@@ -82,12 +82,12 @@ open class SelectInput(
/**
* Additional options for remote (AJAX) data source.
*/
- var ajaxOptions by refreshOnUpdate(ajaxOptions, {
+ var ajaxOptions by refreshOnUpdate(ajaxOptions) {
if (it != null) {
liveSearch = true
}
refresh()
- })
+ }
/**
* Maximal number of selected options.
*/
@@ -115,7 +115,7 @@ open class SelectInput(
/**
* Determines if an empty option is automatically generated.
*/
- var emptyOption by refreshOnUpdate(false, { setChildrenFromOptions() })
+ var emptyOption by refreshOnUpdate(false) { setChildrenFromOptions() }
/**
* Determines if the field is disabled.
*/
@@ -291,31 +291,31 @@ open class SelectInput(
getElementJQueryD()?.selectpicker("render").ajaxSelectPicker(it.toJs(emptyOption))
} ?: getElementJQueryD()?.selectpicker("render")
- this.getElementJQuery()?.on("show.bs.select", { e, _ ->
+ this.getElementJQuery()?.on("show.bs.select") { e, _ ->
this.dispatchEvent("showBsSelect", obj { detail = e })
- })
- this.getElementJQuery()?.on("shown.bs.select", { e, _ ->
+ }
+ this.getElementJQuery()?.on("shown.bs.select") { e, _ ->
this.dispatchEvent("shownBsSelect", obj { detail = e })
- })
- this.getElementJQuery()?.on("hide.bs.select", { e, _ ->
+ }
+ this.getElementJQuery()?.on("hide.bs.select") { e, _ ->
this.dispatchEvent("hideBsSelect", obj { detail = e })
- })
- this.getElementJQuery()?.on("hidden.bs.select", { e, _ ->
+ }
+ this.getElementJQuery()?.on("hidden.bs.select") { e, _ ->
this.dispatchEvent("hiddenBsSelect", obj { detail = e })
- })
- this.getElementJQuery()?.on("loaded.bs.select", { e, _ ->
+ }
+ this.getElementJQuery()?.on("loaded.bs.select") { e, _ ->
this.dispatchEvent("loadedBsSelect", obj { detail = e })
- })
- this.getElementJQuery()?.on("rendered.bs.select", { e, _ ->
+ }
+ this.getElementJQuery()?.on("rendered.bs.select") { e, _ ->
this.dispatchEvent("renderedBsSelect", obj { detail = e })
- })
- this.getElementJQuery()?.on("refreshed.bs.select", { e, _ ->
+ }
+ this.getElementJQuery()?.on("refreshed.bs.select") { e, _ ->
this.dispatchEvent("refreshedBsSelect", obj { detail = e })
- })
- this.getElementJQueryD()?.on("changed.bs.select", { e, cIndex: Int ->
+ }
+ this.getElementJQueryD()?.on("changed.bs.select") { e, cIndex: Int ->
e["clickedIndex"] = cIndex
this.dispatchEvent("changedBsSelect", obj { detail = e })
- })
+ }
refreshState()
}
diff --git a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
index e33b3457..d90f0e6d 100644
--- a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
+++ b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
@@ -49,7 +49,7 @@ open class SelectOptGroup(
/**
* A list of options (label to value pairs) for the group.
*/
- var options by refreshOnUpdate(options, { setChildrenFromOptions() })
+ var options by refreshOnUpdate(options) { setChildrenFromOptions() }
/**
* Maximal number of selected options in the group.
*/
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
index 76f1ee30..38edc1b8 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
@@ -19,8 +19,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-@file:Suppress("EXPERIMENTAL_FEATURE_WARNING")
-
package pl.treksoft.kvision.remote
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
@@ -31,6 +29,7 @@ import org.jooby.Kooby
import org.jooby.Session
import org.jooby.json.Jackson
import org.pac4j.core.profile.CommonProfile
+import java.text.SimpleDateFormat
import kotlinx.coroutines.async as coroutinesAsync
/**
@@ -42,7 +41,9 @@ actual open class KVServer(init: KVServer.() -> Unit) : Kooby() {
assets("/", "index.html")
@Suppress("LeakingThis")
assets("/**").onMissing(0)
- val mapper = jacksonObjectMapper()
+ val mapper = jacksonObjectMapper().apply {
+ dateFormat = SimpleDateFormat("YYYY-MM-DD HH:mm:ss")
+ }
@Suppress("LeakingThis")
use(Jackson(mapper))
@Suppress("LeakingThis")
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
index b37d7319..3091ce26 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
@@ -28,11 +28,11 @@ import org.jooby.Response
import org.jooby.Status
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import java.text.SimpleDateFormat
/**
* Multiplatform service manager.
*/
-@Suppress("EXPERIMENTAL_FEATURE_WARNING")
actual open class ServiceManager<out T> actual constructor(val service: T) {
companion object {
@@ -40,7 +40,9 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
}
protected val routes: MutableList<KVServer.() -> Unit> = mutableListOf()
- val mapper = jacksonObjectMapper()
+ val mapper = jacksonObjectMapper().apply {
+ dateFormat = SimpleDateFormat("YYYY-MM-DD HH:mm:ss")
+ }
var counter: Int = 0
/**
@@ -50,12 +52,13 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
* @param method a HTTP method
* @param prefix an URL address prefix
*/
+ @Suppress("TooGenericExceptionCaught")
protected actual inline fun <reified RET> bind(
noinline function: T.(Request?) -> Deferred<RET>,
route: String?, method: RpcHttpMethod, prefix: String
) {
val routeDef = route ?: "route${this::class.simpleName}${counter++}"
- routes.add({
+ routes.add {
call(method, "$prefix$routeDef") { req, res ->
if (service != null) {
val jsonRpcRequest = req.body(JsonRpcRequest::class.java)
@@ -75,7 +78,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
res.status(Status.SERVER_ERROR)
}
}.invoke(this)
- })
+ }
}
/**
@@ -85,12 +88,13 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
* @param method a HTTP method
* @param prefix an URL address prefix
*/
+ @Suppress("TooGenericExceptionCaught")
protected actual inline fun <reified PAR, reified RET> bind(
noinline function: T.(PAR, Request?) -> Deferred<RET>,
route: String?, method: RpcHttpMethod, prefix: String
) {
val routeDef = route ?: "route${this::class.simpleName}${counter++}"
- routes.add({
+ routes.add {
call(method, "$prefix$routeDef") { req, res ->
if (service != null) {
val jsonRpcRequest = req.body(JsonRpcRequest::class.java)
@@ -115,7 +119,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
res.status(Status.SERVER_ERROR)
}
}.invoke(this)
- })
+ }
}
/**
@@ -125,12 +129,13 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
* @param method a HTTP method
* @param prefix an URL address prefix
*/
+ @Suppress("TooGenericExceptionCaught")
protected actual inline fun <reified PAR1, reified PAR2, reified RET> bind(
noinline function: T.(PAR1, PAR2, Request?) -> Deferred<RET>,
route: String?, method: RpcHttpMethod, prefix: String
) {
val routeDef = route ?: "route${this::class.simpleName}${counter++}"
- routes.add({
+ routes.add {
call(method, "$prefix$routeDef") { req, res ->
if (service != null) {
val jsonRpcRequest = req.body(JsonRpcRequest::class.java)
@@ -156,7 +161,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
res.status(Status.SERVER_ERROR)
}
}.invoke(this)
- })
+ }
}
/**
@@ -166,15 +171,17 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
* @param method a HTTP method
* @param prefix an URL address prefix
*/
+ @Suppress("TooGenericExceptionCaught")
protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(
noinline function: T.(PAR1, PAR2, PAR3, Request?) -> Deferred<RET>,
route: String?, method: RpcHttpMethod, prefix: String
) {
val routeDef = route ?: "route${this::class.simpleName}${counter++}"
- routes.add({
+ routes.add {
call(method, "$prefix$routeDef") { req, res ->
if (service != null) {
val jsonRpcRequest = req.body(JsonRpcRequest::class.java)
+ @Suppress("MagicNumber")
if (jsonRpcRequest.params.size == 3) {
val param1 = getParameter<PAR1>(jsonRpcRequest.params[0])
val param2 = getParameter<PAR2>(jsonRpcRequest.params[1])
@@ -198,7 +205,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
res.status(Status.SERVER_ERROR)
}
}.invoke(this)
- })
+ }
}
/**
@@ -208,15 +215,17 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
* @param method a HTTP method
* @param prefix an URL address prefix
*/
+ @Suppress("TooGenericExceptionCaught")
protected actual inline fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(
noinline function: T.(PAR1, PAR2, PAR3, PAR4, Request?) -> Deferred<RET>,
route: String?, method: RpcHttpMethod, prefix: String
) {
val routeDef = route ?: "route${this::class.simpleName}${counter++}"
- routes.add({
+ routes.add {
call(method, "$prefix$routeDef") { req, res ->
if (service != null) {
val jsonRpcRequest = req.body(JsonRpcRequest::class.java)
+ @Suppress("MagicNumber")
if (jsonRpcRequest.params.size == 4) {
val param1 = getParameter<PAR1>(jsonRpcRequest.params[0])
val param2 = getParameter<PAR2>(jsonRpcRequest.params[1])
@@ -242,7 +251,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
res.status(Status.SERVER_ERROR)
}
}.invoke(this)
- })
+ }
}
/**
@@ -252,6 +261,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
* @param method a HTTP method
* @param prefix an URL address prefix
*/
+ @Suppress("TooGenericExceptionCaught")
protected actual inline fun <reified PAR1, reified PAR2, reified PAR3,
reified PAR4, reified PAR5, reified RET> bind(
noinline function: T.(PAR1, PAR2, PAR3, PAR4, PAR5, Request?) -> Deferred<RET>,
@@ -260,10 +270,11 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
prefix: String
) {
val routeDef = route ?: "route${this::class.simpleName}${counter++}"
- routes.add({
+ routes.add {
call(method, "$prefix$routeDef") { req, res ->
if (service != null) {
val jsonRpcRequest = req.body(JsonRpcRequest::class.java)
+ @Suppress("MagicNumber")
if (jsonRpcRequest.params.size == 5) {
val param1 = getParameter<PAR1>(jsonRpcRequest.params[0])
val param2 = getParameter<PAR2>(jsonRpcRequest.params[1])
@@ -292,7 +303,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
res.status(Status.SERVER_ERROR)
}
}.invoke(this)
- })
+ }
}
fun call(
@@ -310,6 +321,7 @@ actual open class ServiceManager<out T> actual constructor(val service: T) {
}
}
+ @Suppress("TooGenericExceptionCaught")
protected inline fun <reified T> getParameter(str: String?): T {
return str?.let {
if (T::class == String::class) {
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index 9fc534c4..32c8923e 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -28,31 +28,19 @@ import com.github.andrewoma.kwery.mapper.standardConverters
import com.github.andrewoma.kwery.mapper.util.camelToLowerUnderscore
import java.sql.Timestamp
import java.text.SimpleDateFormat
-import java.util.*
-/**
- * A serializable wrapper for a multiplatform Date type.
- */
-@Suppress("MayBeConstant")
-actual val KDATE_FORMAT = "yyyy-MM-dd HH:mm:ss"
-
-actual fun nowDate(): KDate =
- KDate(Date().time)
-
-actual fun String.toKDateF(format: String): KDate =
- KDate(SimpleDateFormat(format).parse(this).time)
+actual typealias Date = java.util.Date
-actual fun KDate.toStringF(format: String) =
- SimpleDateFormat(format).format(this.toJava())
+actual fun String.toDateF(format: String): Date = SimpleDateFormat(format).parse(this)
-fun KDate.toJava(): java.util.Date = java.util.Date(this.time)
+actual fun Date.toStringF(format: String): String = SimpleDateFormat(format).format(this)
-object KDateConverter : SimpleConverter<KDate>(
- { row, c -> KDate(row.timestamp(c).time) },
+object DateConverter : SimpleConverter<Date>(
+ { row, c -> Date(row.timestamp(c).time) },
{ Timestamp(it.time) }
)
val kvTableConfig = TableConfiguration(
- converters = standardConverters + reifiedConverter(KDateConverter),
+ converters = standardConverters + reifiedConverter(DateConverter),
namingConvention = camelToLowerUnderscore
)
diff --git a/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/KVManagerSpinner.kt b/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/KVManagerSpinner.kt
index 0de06c8c..ca4d3764 100644
--- a/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/KVManagerSpinner.kt
+++ b/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/KVManagerSpinner.kt
@@ -21,7 +21,7 @@
*/
package pl.treksoft.kvision
-internal val KVManagerSpinnerInit = KVManagerSpinner.init()
+internal val kVManagerSpinnerInit = KVManagerSpinner.init()
/**
* Internal singleton object which initializes and configures KVision spinner module.
diff --git a/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
index 7d3af684..b4a8138a 100644
--- a/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
+++ b/kvision-modules/kvision-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
@@ -98,38 +98,38 @@ open class SpinnerInput(
/**
* Spinner value.
*/
- var value by refreshOnUpdate(value, { refreshState() })
+ var value by refreshOnUpdate(value) { refreshState() }
/**
* The value attribute of the generated HTML input element.
*
* This value is placed directly in generated HTML code, while the [value] property is dynamically
* bound to the spinner input value.
*/
- var startValue by refreshOnUpdate(value, { this.value = it; refresh() })
+ var startValue by refreshOnUpdate(value) { this.value = it; refresh() }
/**
* Minimal value.
*/
- var min by refreshOnUpdate(min, { refreshSpinner() })
+ var min by refreshOnUpdate(min) { refreshSpinner() }
/**
* Maximal value.
*/
- var max by refreshOnUpdate(max, { refreshSpinner() })
+ var max by refreshOnUpdate(max) { refreshSpinner() }
/**
* Step value.
*/
- var step by refreshOnUpdate(step, { refreshSpinner() })
+ var step by refreshOnUpdate(step) { refreshSpinner() }
/**
* Number of decimal digits value.
*/
- var decimals by refreshOnUpdate(decimals, { refreshSpinner() })
+ var decimals by refreshOnUpdate(decimals) { refreshSpinner() }
/**
* Spinner buttons type.
*/
- var buttonsType by refreshOnUpdate(buttonsType, { refreshSpinner() })
+ var buttonsType by refreshOnUpdate(buttonsType) { refreshSpinner() }
/**
* Spinner force rounding type.
*/
- var forceType by refreshOnUpdate(forceType, { refreshSpinner() })
+ var forceType by refreshOnUpdate(forceType) { refreshSpinner() }
/**
* The placeholder for the spinner input.
*/
@@ -217,18 +217,18 @@ open class SpinnerInput(
size?.let {
siblings?.find("button")?.addClass(it.className)
}
- this.getElementJQuery()?.on("change", { e, _ ->
+ this.getElementJQuery()?.on("change") { e, _ ->
if (e.asDynamic().isTrigger != null) {
val event = org.w3c.dom.events.Event("change")
this.getElement()?.dispatchEvent(event)
}
- })
- this.getElementJQuery()?.on("touchspin.on.min", { e, _ ->
+ }
+ this.getElementJQuery()?.on("touchspin.on.min") { e, _ ->
this.dispatchEvent("onMinBsSpinner", obj { detail = e })
- })
- this.getElementJQuery()?.on("touchspin.on.max", { e, _ ->
+ }
+ this.getElementJQuery()?.on("touchspin.on.max") { e, _ ->
this.dispatchEvent("onMaxBsSpinner", obj { detail = e })
- })
+ }
refreshState()
}
diff --git a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/KVManagerUpload.kt b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/KVManagerUpload.kt
index 64a25545..af0950eb 100644
--- a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/KVManagerUpload.kt
+++ b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/KVManagerUpload.kt
@@ -21,7 +21,7 @@
*/
package pl.treksoft.kvision
-internal val KVManagerUploadInit = KVManagerUpload.init()
+internal val kVManagerUploadInit = KVManagerUpload.init()
/**
* Internal singleton object which initializes and configures KVision upload module.
diff --git a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
index 51b73aa1..da35f9ef 100644
--- a/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
+++ b/kvision-modules/kvision-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
@@ -62,67 +62,67 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
* The optional URL for the upload processing action.
* If not set the upload button action will default to form submission.
*/
- var uploadUrl: String? by refreshOnUpdate(uploadUrl, { refreshUploadInput() })
+ var uploadUrl: String? by refreshOnUpdate(uploadUrl) { refreshUploadInput() }
/**
* Determines if multiple file upload is supported.
*/
- var multiple: Boolean by refreshOnUpdate(multiple, { refresh(); refreshUploadInput() })
+ var multiple: Boolean by refreshOnUpdate(multiple) { refresh(); refreshUploadInput() }
/**
* The extra data that will be passed as data to the AJAX server call via POST.
*/
- var uploadExtraData: ((String, Int) -> dynamic)? by refreshOnUpdate({ refreshUploadInput() })
+ var uploadExtraData: ((String, Int) -> dynamic)? by refreshOnUpdate { refreshUploadInput() }
/**
* Determines if the explorer theme is used.
*/
- var explorerTheme: Boolean by refreshOnUpdate(false, { refreshUploadInput() })
+ var explorerTheme: Boolean by refreshOnUpdate(false) { refreshUploadInput() }
/**
* Determines if the input selection is required.
*/
- var required: Boolean by refreshOnUpdate(false, { refreshUploadInput() })
+ var required: Boolean by refreshOnUpdate(false) { refreshUploadInput() }
/**
* Determines if the caption is shown.
*/
- var showCaption: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var showCaption: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* Determines if the preview is shown.
*/
- var showPreview: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var showPreview: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* Determines if the remove button is shown.
*/
- var showRemove: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var showRemove: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* Determines if the upload button is shown.
*/
- var showUpload: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var showUpload: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* Determines if the cancel button is shown.
*/
- var showCancel: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var showCancel: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* Determines if the file browse button is shown.
*/
- var showBrowse: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var showBrowse: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* Determines if the click on the preview zone opens file browse window.
*/
- var browseOnZoneClick: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var browseOnZoneClick: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* Determines if the iconic preview is prefered.
*/
- var preferIconicPreview: Boolean by refreshOnUpdate(false, { refreshUploadInput() })
+ var preferIconicPreview: Boolean by refreshOnUpdate(false) { refreshUploadInput() }
/**
* Allowed file types.
*/
- var allowedFileTypes: Set<String>? by refreshOnUpdate({ refreshUploadInput() })
+ var allowedFileTypes: Set<String>? by refreshOnUpdate { refreshUploadInput() }
/**
* Allowed file extensions.
*/
- var allowedFileExtensions: Set<String>? by refreshOnUpdate({ refreshUploadInput() })
+ var allowedFileExtensions: Set<String>? by refreshOnUpdate { refreshUploadInput() }
/**
* Determines if Drag&Drop zone is enabled.
*/
- var dropZoneEnabled: Boolean by refreshOnUpdate(true, { refreshUploadInput() })
+ var dropZoneEnabled: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
/**
* The name attribute of the generated HTML input element.
*/
@@ -130,7 +130,7 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
/**
* Determines if the field is disabled.
*/
- override var disabled by refreshOnUpdate(false, { refresh(); refreshUploadInput() })
+ override var disabled by refreshOnUpdate(false) { refresh(); refreshUploadInput() }
/**
* The size of the input (currently not working)
*/
@@ -173,24 +173,24 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
@Suppress("UnsafeCastFromDynamic")
override fun afterInsert(node: VNode) {
getElementJQueryD()?.fileinput(getSettingsObj())
- this.getElementJQuery()?.on("fileselect", { e, _ ->
+ this.getElementJQuery()?.on("fileselect") { e, _ ->
this.dispatchEvent("fileSelectUpload", obj { detail = e })
- })
- this.getElementJQuery()?.on("fileclear", { e, _ ->
+ }
+ this.getElementJQuery()?.on("fileclear") { e, _ ->
this.dispatchEvent("fileClearUpload", obj { detail = e })
- })
- this.getElementJQuery()?.on("filereset", { e, _ ->
+ }
+ this.getElementJQuery()?.on("filereset") { e, _ ->
this.dispatchEvent("fileResetUpload", obj { detail = e })
- })
- this.getElementJQuery()?.on("filebrowse", { e, _ ->
+ }
+ this.getElementJQuery()?.on("filebrowse") { e, _ ->
this.dispatchEvent("fileBrowseUpload", obj { detail = e })
- })
- this.getElementJQueryD()?.on("filepreupload", lambda@{ _, data, previewId, index ->
+ }
+ this.getElementJQueryD()?.on("filepreupload") lambda@{ _, data, previewId, index ->
data["previewId"] = previewId
data["index"] = index
this.dispatchEvent("filePreUpload", obj { detail = data })
return@lambda null
- })
+ }
}
override fun afterDestroy() {
@@ -334,7 +334,6 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
* @param kFile object identifying the file
* @return KFile object
*/
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
suspend fun <K : Any> Form<K>.getContent(
key: KProperty1<K, List<KFile>?>,
kFile: KFile
@@ -351,7 +350,6 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
* @param kFile object identifying the file
* @return KFile object
*/
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
suspend fun <K : Any> FormPanel<K>.getContent(
key: KProperty1<K, List<KFile>?>,
kFile: KFile