mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-22 16:47:24 +00:00
add UIKitDialog
This commit is contained in:
parent
2e28334b41
commit
c81c1125a0
@ -99,9 +99,7 @@ fun Dialog(
|
|||||||
}
|
}
|
||||||
htmlElement.addEventListener("hidden", wrapper)
|
htmlElement.addEventListener("hidden", wrapper)
|
||||||
|
|
||||||
val dialog = UIKit.modal("#${htmlElement.id}")
|
UIKit.modal("#${htmlElement.id}").show()
|
||||||
dialog.show()
|
|
||||||
Unit
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,4 +2,5 @@ package dev.inmo.jsuikit.types
|
|||||||
|
|
||||||
external interface UIKit {
|
external interface UIKit {
|
||||||
val notification: UIKitNotifications
|
val notification: UIKitNotifications
|
||||||
|
val modal: UIKitDialogs
|
||||||
}
|
}
|
||||||
|
40
src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitDialog.kt
Normal file
40
src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitDialog.kt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package dev.inmo.jsuikit.types
|
||||||
|
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
import kotlin.js.Promise
|
||||||
|
|
||||||
|
external interface UIKitDialogs {
|
||||||
|
operator fun invoke(element: Element): UIKitDialog
|
||||||
|
operator fun invoke(selector: String): UIKitDialog
|
||||||
|
fun alert(text: String): UIKitDialogPromiseAlert
|
||||||
|
fun confirm(text: String): UIKitDialogPromiseConfirm
|
||||||
|
fun prompt(title: String): UIKitDialogPromisePrompt
|
||||||
|
fun prompt(title: String, preset: String): UIKitDialogPromisePrompt
|
||||||
|
fun dialog(element: Element): UIKitDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
external class UIKitDialogPromiseConfirm : Promise<Unit> {
|
||||||
|
val dialog: UIKitDialog
|
||||||
|
|
||||||
|
fun then(
|
||||||
|
onConfirm: () -> Unit = definedExternally,
|
||||||
|
onRejected: () -> Unit = definedExternally,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
external class UIKitDialogPromisePrompt : Promise<Unit> {
|
||||||
|
val dialog: UIKitDialog
|
||||||
|
|
||||||
|
fun then(onResult: (data: String?) -> Unit)
|
||||||
|
}
|
||||||
|
|
||||||
|
external class UIKitDialogPromiseAlert : Promise<Unit> {
|
||||||
|
val dialog: UIKitDialog
|
||||||
|
|
||||||
|
fun then(onClose: () -> Unit)
|
||||||
|
}
|
||||||
|
|
||||||
|
external interface UIKitDialog {
|
||||||
|
fun show()
|
||||||
|
fun hide()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user