aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/form
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/form')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
index b0c07c3e..d77a9b9b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
@@ -144,8 +144,27 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
return if (v.isNotEmpty()) v else null
}
+ @Suppress("UnsafeCastFromDynamic")
override fun afterInsert(node: VNode) {
getElementJQueryD()?.fileinput(getSettingsObj())
+ this.getElementJQuery()?.on("fileselect", { e, _ ->
+ this.dispatchEvent("fileSelectUpload", obj { detail = e })
+ })
+ this.getElementJQuery()?.on("fileclear", { e, _ ->
+ this.dispatchEvent("fileClearUpload", obj { detail = e })
+ })
+ this.getElementJQuery()?.on("filereset", { e, _ ->
+ this.dispatchEvent("fileResetUpload", obj { detail = e })
+ })
+ this.getElementJQuery()?.on("filebrowse", { e, _ ->
+ this.dispatchEvent("fileBrowseUpload", obj { detail = e })
+ })
+ 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() {