aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/dropdown
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-09-17 23:34:00 +0200
committerRobert Jaros <rjaros@finn.pl>2017-09-17 23:34:00 +0200
commitc40b93a416acd7e5f72ce0025668f1a9d8267fd4 (patch)
tree63e018b9789be0dc6ac0ed215fc3c25359455eb8 /src/main/kotlin/pl/treksoft/kvision/dropdown
parent9a8a42e60947083352eed78a8fea5f92ea5a9a4e (diff)
downloadkvision-c40b93a416acd7e5f72ce0025668f1a9d8267fd4.tar.gz
kvision-c40b93a416acd7e5f72ce0025668f1a9d8267fd4.tar.bz2
kvision-c40b93a416acd7e5f72ce0025668f1a9d8267fd4.zip
Refactoring event handlers
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/dropdown')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
index 708752ea..00e8fd9b 100644
--- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
@@ -131,21 +131,21 @@ open class DropDown(text: String, elements: List<StringPair>? = null, icon: Stri
@Suppress("UnsafeCastFromDynamic")
override fun afterInsert(node: VNode) {
- this.getElementJQuery()?.on("show.bs.dropdown", { _, _ ->
- val event = CustomEvent("showBsDropdown", obj({ detail = button }))
+ this.getElementJQuery()?.on("show.bs.dropdown", { e, _ ->
+ val event = CustomEvent("showBsDropdown", obj({ detail = e }))
this.getElement()?.dispatchEvent(event)
})
- this.getElementJQuery()?.on("shown.bs.dropdown", { _, _ ->
- val event = CustomEvent("shownBsDropdown", obj({ detail = button }))
+ this.getElementJQuery()?.on("shown.bs.dropdown", { e, _ ->
+ val event = CustomEvent("shownBsDropdown", obj({ detail = e }))
this.getElement()?.dispatchEvent(event)
})
- this.getElementJQuery()?.on("hide.bs.dropdown", { _, _ ->
- val event = CustomEvent("hideBsDropdown", obj({ detail = button }))
+ this.getElementJQuery()?.on("hide.bs.dropdown", { e, _ ->
+ val event = CustomEvent("hideBsDropdown", obj({ detail = e }))
this.getElement()?.dispatchEvent(event)
})
- this.getElementJQuery()?.on("hidden.bs.dropdown", { _, _ ->
+ this.getElementJQuery()?.on("hidden.bs.dropdown", { e, _ ->
list.visible = false
- val event = CustomEvent("hiddenBsDropdown", obj({ detail = button }))
+ val event = CustomEvent("hiddenBsDropdown", obj({ detail = e }))
this.getElement()?.dispatchEvent(event)
})
}
@@ -161,7 +161,7 @@ open class DropDown(text: String, elements: List<StringPair>? = null, icon: Stri
open fun toggle() {
if (list.visible)
- list.hide()
+ list.hideInternal()
else
list.show()
}
@@ -199,14 +199,14 @@ open class DropDownListTag(private val ariaId: String, classes: Set<String> = se
}
@Suppress("UnsafeCastFromDynamic")
- private fun showInternal() {
+ internal fun showInternal() {
if (getElementJQueryD()?.`is`(":hidden")) {
getElementJQueryD()?.dropdown("toggle")
}
}
@Suppress("UnsafeCastFromDynamic")
- private fun hideInternal() {
+ internal fun hideInternal() {
if (!getElementJQueryD()?.`is`(":hidden")) {
getElementJQueryD()?.dropdown("toggle")
}