From 1a41c5d06bb51907b752afa9c13c08dd1e82455a Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 4 Nov 2017 12:47:52 +0100 Subject: Refactoring events handling --- src/main/kotlin/pl/treksoft/kvision/Showcase.kt | 53 +++++++++++--- src/main/kotlin/pl/treksoft/kvision/core/Widget.kt | 3 +- .../pl/treksoft/kvision/form/AbstractTextInput.kt | 20 ++++-- .../kotlin/pl/treksoft/kvision/form/CheckBox.kt | 2 + .../kotlin/pl/treksoft/kvision/form/CheckInput.kt | 20 +++--- src/main/kotlin/pl/treksoft/kvision/form/Radio.kt | 2 + src/main/kotlin/pl/treksoft/kvision/form/Select.kt | 2 + .../kotlin/pl/treksoft/kvision/form/SelectInput.kt | 80 ++++++++++++++++++++-- src/main/kotlin/pl/treksoft/kvision/form/Text.kt | 2 + .../kotlin/pl/treksoft/kvision/form/TextArea.kt | 2 + .../pl/treksoft/kvision/form/TextAreaInput.kt | 2 +- .../kotlin/pl/treksoft/kvision/snabbdom/Types.kt | 14 +++- 12 files changed, 173 insertions(+), 29 deletions(-) diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt index a0ea6881..41ceacd9 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt @@ -110,10 +110,50 @@ class Showcase : ApplicationBase() { val select5 = Select(listOf("a" to "Pierwsza", "b" to "Druga"), "a", label = "Lista wyboru") root.add(select5) - val select6 = Select(label = "Lista wyboru 2") + val text = Text(label = "To jest pole").apply { + placeholder = "Pole formularza" + maxlength = 5 + } + + val select6 = Select(label = "Lista wyboru 2", value = "b") select6.add(SelectOption("a", "Opcja 1")) select6.add(SelectOption("b", "Opcja 2")) select6.add(SelectOption("c", "Opcja 3")) + select6.setEventListener