package pl.treksoft.kvision import pl.treksoft.kvision.basic.Label import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.Img import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.dropdown.DD.* import pl.treksoft.kvision.dropdown.DropDown import pl.treksoft.kvision.html.* import pl.treksoft.kvision.html.TAG.H1 import pl.treksoft.kvision.modal.Alert import pl.treksoft.kvision.modal.Confirm import pl.treksoft.kvision.modal.MODALSIZE import pl.treksoft.kvision.modal.Modal import pl.treksoft.kvision.routing.routing import kotlin.browser.window 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, ALIGN.NONE, 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 dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag") root.add(dd) dd.setEventListener { showBsDropdown = { e -> println("show" + (e.detail)) } shownBsDropdown = { e -> println("shown" + e.detail) } hideBsDropdown = { e -> println("hide" + e.detail) e.detail.preventDefault() } hiddenBsDropdown = { e -> println("hidden" + e.detail) } } val dd2 = DropDown("Dropdown2", listOf("abc" to "#!/abc", "def" to "#!/def", "xyz" to DISABLED.POS, "Header" to HEADER.POS, "Separtatorek" to SEPARATOR.POS ), "flag", dropup = true) root.add(dd2) dd2.setEventListener { hideBsDropdown = { e -> println("hide" + e.detail) } hiddenBsDropdown = { e -> println("hidden" + e.detail) } } val dd3 = DropDown("Dropdown3", icon = "file") dd3.add(Tag(TAG.H4, "ABC")) dd3.add(Button("To jest button")) dd3.add(Image(Img("kotlin.png"))) root.add(dd3) val p = Tag(TAG.P, "To jest prawo", align = ALIGN.RIGHT) p.title = "Tytuł" root.add(p) val del = Tag(TAG.DEL, "To jest deleted") root.add(del) val list = ListTag(LIST.DL_HORIZ, listOf("abc", "defdasdasdasddasdtdasdas", "Dasdsada", "dasdasdads"), true) root.add(list) val list2 = ListTag(LIST.OL, null) list2.add(Tag(TAG.H4, "ABC")) list2.add(Button("To jest button")) list2.add(Image(Img("kotlin.png"))) root.add(list2) val img = Image(Img("kotlin.png"), "Image", true, IMAGESHAPE.ROUNDED) root.add(img) val modal = Modal("Test okienka") modal.add(Tag(TAG.H4, "ABC")) modal.add(Image(Img("kotlin.png"))) modal.addButton(Button("To jest button")) /* modal.setEventListener { hideBsModal = { e -> e.detail.preventDefault() } }*/ val button = Button("To jest przycisk FA", "fa-flag", BUTTONSTYLE.DANGER) button.setEventListener