From 037c9c22bfe23064b2e110225261a26247649967 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 9 Sep 2017 22:17:34 +0200 Subject: Integrate jQuery mappings Globally disabled Data API Added support for dropdown events --- src/main/kotlin/pl/treksoft/kvision/Main.kt | 3 ++ src/main/kotlin/pl/treksoft/kvision/Showcase.kt | 16 ++++++- .../kotlin/pl/treksoft/kvision/core/Container.kt | 1 + .../kotlin/pl/treksoft/kvision/core/KVManager.kt | 5 +++ src/main/kotlin/pl/treksoft/kvision/core/Root.kt | 6 +-- src/main/kotlin/pl/treksoft/kvision/core/Widget.kt | 51 +++++++++++++++++++--- .../pl/treksoft/kvision/dropdown/DropDown.kt | 32 ++++++++++++++ .../kotlin/pl/treksoft/kvision/snabbdom/Types.kt | 22 +++++++++- 8 files changed, 125 insertions(+), 11 deletions(-) (limited to 'src/main/kotlin') diff --git a/src/main/kotlin/pl/treksoft/kvision/Main.kt b/src/main/kotlin/pl/treksoft/kvision/Main.kt index 385d23e8..e4816888 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Main.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Main.kt @@ -1,5 +1,6 @@ package pl.treksoft.kvision +import pl.treksoft.kvision.core.KVManager import kotlin.browser.document fun main(args: Array) { @@ -10,6 +11,7 @@ fun main(args: Array) { hot.dispose { data -> data.appState = application?.dispose() + KVManager.shutdown() application = null } @@ -19,6 +21,7 @@ fun main(args: Array) { if (document.body != null) { application = start(state) } else { + KVManager.init() application = null document.addEventListener("DOMContentLoaded", { application = start(state) }) } diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt index b2e6d764..6275fe88 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt @@ -3,7 +3,6 @@ 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.KVManager import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.dropdown.DD.* import pl.treksoft.kvision.dropdown.DropDown @@ -32,11 +31,21 @@ class Showcase : ApplicationBase() { val dd = DropDown("Dropdown", listOf("abc" to "#!/x", "def" to "#!/y"), "flag") root.add(dd) + dd.setEventListener