aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-03-28 23:04:13 +0100
committerRobert Jaros <rjaros@finn.pl>2020-03-28 23:04:13 +0100
commit13f8c6d1c9db565ee63cfddbc716d819ce72a2ca (patch)
tree0442db8ae9330da809e30c75ed7f6c4425fc4b15 /kvision-modules
parent16dc3d8105ed1580c2203e5af5052acf56331d7d (diff)
downloadkvision-13f8c6d1c9db565ee63cfddbc716d819ce72a2ca.tar.gz
kvision-13f8c6d1c9db565ee63cfddbc716d819ce72a2ca.tar.bz2
kvision-13f8c6d1c9db565ee63cfddbc716d819ce72a2ca.zip
Placeholder support for Upload control
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt8
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt25
2 files changed, 33 insertions, 0 deletions
diff --git a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt
index ce885ff3..96672587 100644
--- a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt
+++ b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt
@@ -185,6 +185,14 @@ open class Upload(
input.dropZoneEnabled = value
}
/**
+ * The placeholder for the upload control.
+ */
+ var placeholder
+ get() = input.placeholder
+ set(value) {
+ input.placeholder = value
+ }
+ /**
* The label text bound to the spinner input element.
*/
var label
diff --git a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
index ecdbf1b8..5bdaad9b 100644
--- a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
+++ b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
@@ -64,78 +64,102 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
* If not set the upload button action will default to form submission.
*/
var uploadUrl: String? by refreshOnUpdate(uploadUrl) { refreshUploadInput() }
+
/**
* Determines if multiple file upload is supported.
*/
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() }
+
/**
* Determines if the explorer theme is used.
*/
var explorerTheme: Boolean by refreshOnUpdate(false) { refreshUploadInput() }
+
/**
* Determines if the input selection is required.
*/
var required: Boolean by refreshOnUpdate(false) { refreshUploadInput() }
+
/**
* Determines if the caption is shown.
*/
var showCaption: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
+
/**
* Determines if the preview is shown.
*/
var showPreview: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
+
/**
* Determines if the remove button is shown.
*/
var showRemove: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
+
/**
* Determines if the upload button is shown.
*/
var showUpload: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
+
/**
* Determines if the cancel button is shown.
*/
var showCancel: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
+
/**
* Determines if the file browse button is shown.
*/
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() }
+
/**
* Determines if the iconic preview is prefered.
*/
var preferIconicPreview: Boolean by refreshOnUpdate(false) { refreshUploadInput() }
+
/**
* Allowed file types.
*/
var allowedFileTypes: Set<String>? by refreshOnUpdate { refreshUploadInput() }
+
/**
* Allowed file extensions.
*/
var allowedFileExtensions: Set<String>? by refreshOnUpdate { refreshUploadInput() }
+
/**
* Determines if Drag&Drop zone is enabled.
*/
var dropZoneEnabled: Boolean by refreshOnUpdate(true) { refreshUploadInput() }
+
+ /**
+ * The placeholder for the upload control.
+ */
+ var placeholder: String? by refreshOnUpdate { refreshUploadInput() }
+
/**
* The name attribute of the generated HTML input element.
*/
override var name: String? by refreshOnUpdate()
+
/**
* Determines if the field is disabled.
*/
override var disabled by refreshOnUpdate(false) { refresh(); refreshUploadInput() }
+
/**
* The size of the input (currently not working)
*/
override var size: InputSize? by refreshOnUpdate()
+
/**
* The validation status of the input.
*/
@@ -331,6 +355,7 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
}
this.autoOrientImage = false
this.purifyHtml = false
+ if (placeholder != null) this.msgPlaceholder = placeholder
this.language = language
}
}