diff options
9 files changed, 29 insertions, 19 deletions
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 7c1c8d71..5858d04b 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 @@ -282,14 +282,14 @@ open class DateTimeInput( /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } diff --git a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt index f19081e1..db8a5b3b 100644 --- a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt +++ b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt @@ -39,7 +39,7 @@ import pl.treksoft.kvision.utils.SnOn * [SelectOption] or [SelectOptGroup] components to the container. * * @constructor - * @param options an optional list of options (label to value pairs) for the select control + * @param options an optional list of options (value to label pairs) for the select control * @param value selected value * @param name the name attribute of the generated HTML input element * @param multiple allows multiple value selection (multiple values are comma delimited) @@ -55,7 +55,7 @@ open class Select( ) : SimplePanel(setOf("form-group")), StringFormControl { /** - * A list of options (label to value pairs) for the select control. + * A list of options (value to label pairs) for the select control. */ var options get() = input.options 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 7ffdf2c2..9ae1a4e9 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 @@ -50,7 +50,7 @@ enum class SelectWidthType(internal val value: String) { * [SelectOption] or [SelectOptGroup] components to the container. * * @constructor - * @param options an optional list of options (label to value pairs) for the select control + * @param options an optional list of options (value to label pairs) for the select control * @param value selected value * @param multiple allows multiple value selection (multiple values are comma delimited) * @param ajaxOptions additional options for remote (AJAX) data source @@ -64,9 +64,9 @@ open class SelectInput( ) : SimplePanel(classes), FormInput { /** - * A list of options (label to value pairs) for the select control. + * A list of options (value to label pairs) for the select control. */ - internal var options by refreshOnUpdate(options) { setChildrenFromOptions() } + var options by refreshOnUpdate(options) { setChildrenFromOptions() } /** * A value of the selected option. */ @@ -337,14 +337,14 @@ open class SelectInput( /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } 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 c60aab2f..66e98ab5 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 @@ -293,14 +293,14 @@ open class SpinnerInput( /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } 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 a250df42..39c4c4c6 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 @@ -278,14 +278,14 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt b/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt index 57ce88eb..3019fb6f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/FormControl.kt @@ -47,6 +47,16 @@ interface FormInput : Component { * The name attribute of the generated HTML input element. */ var name: String? + + /** + * Makes the input element focused. + */ + fun focus() + + /** + * Makes the input element blur. + */ + fun blur() } /** diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt index 6973efe9..07b86b4c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt @@ -152,14 +152,14 @@ abstract class CheckInput( /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt index 98839982..fca681f6 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroupInput.kt @@ -150,11 +150,11 @@ open class RadioGroupInput( } } - fun focus() { + override fun focus() { getChildren().filterIsInstance<Radio>().firstOrNull()?.focus() } - fun blur() { + override fun blur() { getChildren().filterIsInstance<Radio>().firstOrNull()?.blur() } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt index c9ea2dba..393ae63f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt @@ -157,14 +157,14 @@ abstract class AbstractTextInput( /** * Makes the input element focused. */ - open fun focus() { + override fun focus() { getElementJQuery()?.focus() } /** * Makes the input element blur. */ - open fun blur() { + override fun blur() { getElementJQuery()?.blur() } |