diff options
author | Bartosz Malkowski <bmalkowski@tigase.pl> | 2020-04-29 10:20:10 +0200 |
---|---|---|
committer | Bartosz Malkowski <bmalkowski@tigase.pl> | 2020-04-29 10:20:10 +0200 |
commit | 9fbc710662e398199ba0082cbd3add9aa22c16a3 (patch) | |
tree | 82ad7ad34871c259658398bfa46932fa8ea1e504 /kvision-modules/kvision-bootstrap/src/main/kotlin/pl | |
parent | d45d14cbe62fff32c9f1c44f90e6bf66ddc2304e (diff) | |
download | kvision-9fbc710662e398199ba0082cbd3add9aa22c16a3.tar.gz kvision-9fbc710662e398199ba0082cbd3add9aa22c16a3.tar.bz2 kvision-9fbc710662e398199ba0082cbd3add9aa22c16a3.zip |
Add property to scrolling long content in Modal
Diffstat (limited to 'kvision-modules/kvision-bootstrap/src/main/kotlin/pl')
-rw-r--r-- | kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt index baf1d4e0..afc5f5fd 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt @@ -60,7 +60,7 @@ enum class ModalSize(val className: String) { @Suppress("TooManyFunctions") open class Modal( caption: String? = null, closeButton: Boolean = true, - size: ModalSize? = null, animation: Boolean = true, centered: Boolean = false, private val escape: Boolean = true, + size: ModalSize? = null, animation: Boolean = true, centered: Boolean = false, scrollable: Boolean = false, private val escape: Boolean = true, classes: Set<String> = setOf(), init: (Modal.() -> Unit)? = null ) : SimplePanel(classes) { @@ -105,7 +105,16 @@ open class Modal( dialog.centered = value } - private val dialog = ModalDialog(size, centered) + /** + * Determines if modal body is scrollable. + */ + var scrollable + get() = dialog.scrollable + set(value) { + dialog.scrollable = value + } + + private val dialog = ModalDialog(size, centered, scrollable) private val header = SimplePanel(setOf("modal-header")) /** * @suppress @@ -284,7 +293,7 @@ open class Modal( * @param size modal window size * @param centered determines if modal dialog is vertically centered */ -internal class ModalDialog(size: ModalSize?, centered: Boolean = false) : SimplePanel(setOf("modal-dialog")) { +internal class ModalDialog(size: ModalSize?, centered: Boolean = false, scrollable: Boolean = false) : SimplePanel(setOf("modal-dialog")) { /** * Modal window size. @@ -296,6 +305,11 @@ internal class ModalDialog(size: ModalSize?, centered: Boolean = false) : Simple */ var centered by refreshOnUpdate(centered) + /** + * Determines if content is scrollable. + */ + var scrollable by refreshOnUpdate(scrollable) + override fun getSnClass(): List<StringBoolPair> { val cl = super.getSnClass().toMutableList() size?.let { @@ -304,6 +318,9 @@ internal class ModalDialog(size: ModalSize?, centered: Boolean = false) : Simple if (centered) { cl.add("modal-dialog-centered" to true) } + if (scrollable) { + cl.add("modal-dialog-scrollable" to true) + } return cl } } |