package pl.treksoft.kvision import com.lightningkite.kotlin.observable.list.observableListOf import pl.treksoft.kvision.basic.Label import pl.treksoft.kvision.core.BGATTACH import pl.treksoft.kvision.core.BGREPEAT import pl.treksoft.kvision.core.BGSIZE import pl.treksoft.kvision.core.BORDERSTYLE import pl.treksoft.kvision.core.Background import pl.treksoft.kvision.core.Border import pl.treksoft.kvision.core.COLOR import pl.treksoft.kvision.core.Img import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.data.DataComponent import pl.treksoft.kvision.data.DataContainer import pl.treksoft.kvision.dropdown.DD.* import pl.treksoft.kvision.dropdown.DropDown import pl.treksoft.kvision.form.CheckBox import pl.treksoft.kvision.form.INPUTSIZE import pl.treksoft.kvision.form.TEXTINPUTTYPE import pl.treksoft.kvision.form.Text import pl.treksoft.kvision.form.TextArea import pl.treksoft.kvision.form.TextAreaInput import pl.treksoft.kvision.form.TextInput 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") class Model(p: Boolean, t: String) : DataComponent() { var p: Boolean by obs(p) var t: String by obs(t) } val model = observableListOf(Model(true, "Pierwszy"), Model(false, "Drugi"), Model(false, "Trzeci")) val datac = DataContainer(model, { element, index -> CheckBox(value = element.p, label = if (element.p) "" + (index + 1) + " " + element.t + "" else element.t, rich = true).setEventListener({ click = { element.p = self.value } }) }) root.add(datac) val mbutton = Button("Pokaż wartości").setEventListener