package pl.treksoft.kvision import pl.treksoft.kvision.basic.Label import pl.treksoft.kvision.core.* import pl.treksoft.kvision.dropdown.DD.* import pl.treksoft.kvision.dropdown.DropDown import pl.treksoft.kvision.form.* import pl.treksoft.kvision.html.* import pl.treksoft.kvision.html.TAG.DIV import pl.treksoft.kvision.html.TAG.H1 import pl.treksoft.kvision.modal.Alert import pl.treksoft.kvision.modal.Confirm import pl.treksoft.kvision.modal.Modal import pl.treksoft.kvision.panel.* import pl.treksoft.kvision.routing.routing import pl.treksoft.kvision.utils.perc import pl.treksoft.kvision.utils.px class Showcase : ApplicationBase() { override fun start(state: Map) { val root = Root("showcase") val container = Container(setOf("abc", "def")) val h1 = Tag(H1, "To jest test pisania tekstu", false, null, classes = setOf("test", "test2")) container.add(h1) val label = Label("KVLabel1") container.add(label) val label2 = Label("KVLabel2") container.add(label2) root.add(container) label.hide() label.show() val link = Link("test", "http://www.google.pl") link.add(Tag(TAG.P, "Cośtam")) root.add(link) val textField = TextInput(placeholder = "Wprowadź hasło ...", value = "abc") root.add(textField) textField.setEventListener { input = { e -> println("i" + self.value) } change = { e -> println("c" + self.value) } } val passwordField = TextInput(TEXTINPUTTYPE.PASSWORD) root.add(passwordField) val textField2 = TextInput(placeholder = "Disabled") textField2.disabled = true textField2.size = INPUTSIZE.LARGE root.add(textField2) val checkbox = CheckBox(true, label = "Kliknij aby przetestować", rich = true, circled = true, style = CHECKBOXSTYLE.DANGER) root.add(checkbox) checkbox.setEventListener { click = { e -> println("click" + self.value) } change = { e -> println("change" + self.value) } } val radio = Radio(true, name = "radios", label = "Opcja 1", inline = true, style = RADIOSTYLE.DANGER, extraValue = "o1") val radio2 = Radio(false, name = "radios", label = "Opcja 2", rich = true, inline = true, style = RADIOSTYLE.WARNING, extraValue = "o2") val radio3 = Radio(false, name = "radios", label = "Opcja 3", inline = true, style = RADIOSTYLE.PRIMARY, squared = true, extraValue = "o3") root.add(radio) root.add(radio2) root.add(radio3) radio.setEventListener { click = { e -> println("rclick" + self.value) } change = { e -> println("rchange" + self.value) } } val text = Text(placeholder = "Pole formularza", maxlength = 5, label = "To jest pole") root.add(text) val textareainput = TextAreaInput(cols = 5, rows = 2, placeholder = "...", value = "To jest tekst\nTo jest tekst2") root.add(textareainput) val textarea = TextArea(cols = 5, rows = 2, placeholder = "...", value = "To jest tekst\nTo jest tekst2", label = "Pole długie") root.add(textarea) textarea.setEventListener