aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-bootstrap/src/main')
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/ContextMenu.kt7
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt51
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Header.kt17
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt15
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Nav.kt26
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/NavForm.kt8
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt19
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt7
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt6
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/progress/ProgressBar.kt15
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt14
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt7
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt15
13 files changed, 161 insertions, 46 deletions
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/ContextMenu.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/ContextMenu.kt
index 656b63b5..4d4a579c 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/ContextMenu.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/ContextMenu.kt
@@ -27,6 +27,7 @@ import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.html.Div
import pl.treksoft.kvision.panel.Root
import pl.treksoft.kvision.utils.px
+import pl.treksoft.kvision.utils.set
/**
* Context menu component.
@@ -103,9 +104,11 @@ fun Widget.setContextMenu(contextMenu: ContextMenu): Widget {
*/
fun Widget.contextMenu(
fixedPosition: Boolean = false,
- classes: Set<String> = setOf(), init: (ContextMenu.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (ContextMenu.() -> Unit)? = null
): ContextMenu {
- val contextMenu = ContextMenu(this, fixedPosition, classes).apply { init?.invoke(this) }
+ val contextMenu = ContextMenu(this, fixedPosition, classes ?: className.set).apply { init?.invoke(this) }
this.setContextMenu(contextMenu)
return contextMenu
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
index 3fa6cd36..ed9a917c 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
@@ -35,6 +35,7 @@ import pl.treksoft.kvision.html.Div
import pl.treksoft.kvision.html.Link
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
/**
* Useful options for use in DropDown's *elements* parameter.
@@ -84,6 +85,7 @@ open class DropDown(
button.text = value
}
private var elements by refreshOnUpdate(elements) { setChildrenFromElements() }
+
/**
* The icon of the dropdown button.
*/
@@ -92,6 +94,7 @@ open class DropDown(
set(value) {
button.icon = value
}
+
/**
* The style of the dropdown button.
*/
@@ -100,6 +103,7 @@ open class DropDown(
set(value) {
button.style = value
}
+
/**
* The size of the dropdown button.
*/
@@ -108,6 +112,7 @@ open class DropDown(
set(value) {
button.size = value
}
+
/**
* Determines if the dropdown button takes all the space horizontally.
*/
@@ -116,6 +121,7 @@ open class DropDown(
set(value) {
button.block = value
}
+
/**
* Determines if the dropdown is disabled.
*/
@@ -124,6 +130,7 @@ open class DropDown(
set(value) {
button.disabled = value
}
+
/**
* The image on the dropdown button.
*/
@@ -132,10 +139,12 @@ open class DropDown(
set(value) {
button.image = value
}
+
/**
* The direction of the dropdown.
*/
var direction by refreshOnUpdate(direction)
+
/**
* Width of the dropdown button.
*/
@@ -254,7 +263,9 @@ fun Container.dropDown(
text: String, elements: List<StringPair>? = null, icon: String? = null,
style: ButtonStyle = ButtonStyle.PRIMARY, direction: Direction = Direction.DROPDOWN,
disabled: Boolean = false, forNavbar: Boolean = false, forDropDown: Boolean = false,
- classes: Set<String> = setOf(), init: (DropDown.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (DropDown.() -> Unit)? = null
): DropDown {
val dropDown =
DropDown(
@@ -266,7 +277,7 @@ fun Container.dropDown(
disabled,
forNavbar,
forDropDown,
- classes
+ classes ?: className.set
).apply { init?.invoke(this) }
this.add(dropDown)
return dropDown
@@ -279,9 +290,11 @@ fun Container.dropDown(
*/
fun DropDown.ddLink(
label: String, url: String? = null, icon: String? = null, image: ResString? = null,
- classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Link.() -> Unit)? = null
): Link {
- val link = Link(label, url, icon, image, classes + "dropdown-item").apply {
+ val link = Link(label, url, icon, image, null, true, (classes ?: className.set) + "dropdown-item").apply {
init?.invoke(this)
}
this.add(link)
@@ -295,9 +308,11 @@ fun DropDown.ddLink(
*/
fun ContextMenu.cmLink(
label: String, url: String? = null, icon: String? = null, image: ResString? = null,
- classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Link.() -> Unit)? = null
): Link {
- val link = Link(label, url, icon, image, classes + "dropdown-item").apply {
+ val link = Link(label, url, icon, image, null, true, (classes ?: className.set) + "dropdown-item").apply {
init?.invoke(this)
}
this.add(link)
@@ -311,9 +326,17 @@ fun ContextMenu.cmLink(
*/
fun DropDown.ddLinkDisabled(
label: String, icon: String? = null, image: ResString? = null,
- classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Link.() -> Unit)? = null
): Link {
- val link = Link(label, "javascript:void(0)", icon, image, classes + "dropdown-item" + "disabled").apply {
+ val link = Link(
+ label,
+ "javascript:void(0)",
+ icon,
+ image, null, true,
+ (classes ?: className.set) + "dropdown-item" + "disabled"
+ ).apply {
tabindex = -1
setAttribute("aria-disabled", "true")
init?.invoke(this)
@@ -329,9 +352,17 @@ fun DropDown.ddLinkDisabled(
*/
fun ContextMenu.cmLinkDisabled(
label: String, icon: String? = null, image: ResString? = null,
- classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Link.() -> Unit)? = null
): Link {
- val link = Link(label, "javascript:void(0)", icon, image, classes + "dropdown-item" + "disabled").apply {
+ val link = Link(
+ label,
+ "javascript:void(0)",
+ icon,
+ image, null, true,
+ (classes ?: className.set) + "dropdown-item" + "disabled"
+ ).apply {
tabindex = -1
setAttribute("aria-disabled", "true")
init?.invoke(this)
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Header.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Header.kt
index b88a5955..1d489afc 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Header.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Header.kt
@@ -23,6 +23,7 @@ package pl.treksoft.kvision.dropdown
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
+import pl.treksoft.kvision.utils.set
/**
* Menu header component.
@@ -39,8 +40,12 @@ open class Header(content: String? = null, classes: Set<String> = setOf()) :
*
* It takes the same parameters as the constructor of the built component.
*/
-fun ContextMenu.header(content: String? = null, classes: Set<String> = setOf()): Header {
- val header = Header(content, classes)
+fun ContextMenu.header(
+ content: String? = null,
+ classes: Set<String>? = null,
+ className: String? = null
+): Header {
+ val header = Header(content, classes ?: className.set)
this.add(header)
return header
}
@@ -50,8 +55,12 @@ fun ContextMenu.header(content: String? = null, classes: Set<String> = setOf()):
*
* It takes the same parameters as the constructor of the built component.
*/
-fun DropDown.header(content: String? = null, classes: Set<String> = setOf()): Header {
- val header = Header(content, classes)
+fun DropDown.header(
+ content: String? = null,
+ classes: Set<String>? = null,
+ className: String? = null
+): Header {
+ val header = Header(content, classes ?: className.set)
this.add(header)
return header
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt
index 62abe588..f5d289f6 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt
@@ -22,6 +22,7 @@
package pl.treksoft.kvision.dropdown
import pl.treksoft.kvision.html.Div
+import pl.treksoft.kvision.utils.set
/**
* Menu separator component.
@@ -36,8 +37,11 @@ open class Separator(classes: Set<String> = setOf()) : Div(classes = classes + "
*
* It takes the same parameters as the constructor of the built component.
*/
-fun ContextMenu.separator(classes: Set<String> = setOf()): Separator {
- val separator = Separator(classes)
+fun ContextMenu.separator(
+ classes: Set<String>? = null,
+ className: String? = null
+): Separator {
+ val separator = Separator(classes ?: className.set)
this.add(separator)
return separator
}
@@ -47,8 +51,11 @@ fun ContextMenu.separator(classes: Set<String> = setOf()): Separator {
*
* It takes the same parameters as the constructor of the built component.
*/
-fun DropDown.separator(classes: Set<String> = setOf()): Separator {
- val separator = Separator(classes)
+fun DropDown.separator(
+ classes: Set<String>? = null,
+ className: String? = null
+): Separator {
+ val separator = Separator(classes ?: className.set)
this.add(separator)
return separator
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Nav.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Nav.kt
index 1254e0c9..98383141 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Nav.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Nav.kt
@@ -25,6 +25,7 @@ import pl.treksoft.kvision.core.ResString
import pl.treksoft.kvision.core.StringBoolPair
import pl.treksoft.kvision.html.Div
import pl.treksoft.kvision.html.Link
+import pl.treksoft.kvision.utils.set
/**
* The Bootstrap Nav container.
@@ -63,9 +64,12 @@ open class Nav(rightAlign: Boolean = false, classes: Set<String> = setOf(), init
* It takes the same parameters as the constructor of the built component.
*/
fun Navbar.nav(
- rightAlign: Boolean = false, classes: Set<String> = setOf(), init: (Nav.() -> Unit)? = null
+ rightAlign: Boolean = false,
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Nav.() -> Unit)? = null
): Nav {
- val nav = Nav(rightAlign, classes).apply { init?.invoke(this) }
+ val nav = Nav(rightAlign, classes ?: className.set).apply { init?.invoke(this) }
this.add(nav)
return nav
}
@@ -77,9 +81,11 @@ fun Navbar.nav(
*/
fun Nav.navLink(
label: String, url: String? = null, icon: String? = null, image: ResString? = null,
- classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Link.() -> Unit)? = null
): Link {
- val link = Link(label, url, icon, image, classes + "nav-item" + "nav-link").apply {
+ val link = Link(label, url, icon, image, null, true, (classes ?: className.set) + "nav-item" + "nav-link").apply {
init?.invoke(this)
}
this.add(link)
@@ -93,10 +99,18 @@ fun Nav.navLink(
*/
fun Nav.navLinkDisabled(
label: String, icon: String? = null, image: ResString? = null,
- classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Link.() -> Unit)? = null
): Link {
val link =
- Link(label, "javascript:void(0)", icon, image, classes + "nav-item" + "nav-link" + "disabled").apply {
+ Link(
+ label,
+ "javascript:void(0)",
+ icon,
+ image, null, true,
+ (classes ?: className.set) + "nav-item" + "nav-link" + "disabled"
+ ).apply {
tabindex = -1
setAttribute("aria-disabled", "true")
init?.invoke(this)
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/NavForm.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/NavForm.kt
index 6cbf6274..37bd566e 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/NavForm.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/NavForm.kt
@@ -24,6 +24,7 @@ package pl.treksoft.kvision.navbar
import pl.treksoft.kvision.core.StringBoolPair
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
+import pl.treksoft.kvision.utils.set
/**
* The Bootstrap Nav form container.
@@ -62,9 +63,12 @@ open class NavForm(rightAlign: Boolean = false, classes: Set<String> = setOf(),
* It takes the same parameters as the constructor of the built component.
*/
fun Navbar.navForm(
- rightAlign: Boolean = false, classes: Set<String> = setOf(), init: (NavForm.() -> Unit)? = null
+ rightAlign: Boolean = false,
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (NavForm.() -> Unit)? = null
): NavForm {
- val navForm = NavForm(rightAlign, classes).apply { init?.invoke(this) }
+ val navForm = NavForm(rightAlign, classes ?: className.set).apply { init?.invoke(this) }
this.add(navForm)
return navForm
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
index 81e061e8..6ba85b63 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
@@ -32,6 +32,7 @@ import pl.treksoft.kvision.html.Link
import pl.treksoft.kvision.html.Span
import pl.treksoft.kvision.html.span
import pl.treksoft.kvision.panel.SimplePanel
+import pl.treksoft.kvision.utils.set
/**
* Navbar types.
@@ -99,6 +100,7 @@ open class Navbar(
brandLink.hide()
}
}
+
/**
* The navbar header link.
*/
@@ -112,14 +114,17 @@ open class Navbar(
* The navbar type.
*/
var type by refreshOnUpdate(type)
+
/**
* The navbar responsive behavior.
*/
var expand by refreshOnUpdate(expand)
+
/**
* The navbar color.
*/
var nColor by refreshOnUpdate(nColor)
+
/**
* The navbar background color.
*/
@@ -215,15 +220,21 @@ fun Container.navbar(
nColor: NavbarColor = NavbarColor.LIGHT,
bgColor: BsBgColor = BsBgColor.LIGHT,
collapseOnClick: Boolean = false,
- classes: Set<String> = setOf(), init: (Navbar.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Navbar.() -> Unit)? = null
): Navbar {
- val navbar = Navbar(label, link, type, expand, nColor, bgColor, collapseOnClick, classes, init)
+ val navbar = Navbar(label, link, type, expand, nColor, bgColor, collapseOnClick, classes ?: className.set, init)
this.add(navbar)
return navbar
}
-fun Navbar.navText(label: String, classes: Set<String> = setOf()): Span {
- val text = Span(label, classes = classes + "navbar-text")
+fun Navbar.navText(
+ label: String,
+ classes: Set<String>? = null,
+ className: String? = null
+): Span {
+ val text = Span(label, classes = (classes ?: className.set) + "navbar-text")
this.add(text)
return text
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
index ec4cbc29..9d21f61f 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/ResponsiveGridPanel.kt
@@ -27,6 +27,7 @@ import pl.treksoft.kvision.core.WidgetWrapper
import pl.treksoft.kvision.html.Align
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
+import pl.treksoft.kvision.utils.set
/**
* Bootstrap grid sizes.
@@ -175,9 +176,11 @@ open class ResponsiveGridPanel(
fun Container.responsiveGridPanel(
gridSize: GridSize = GridSize.MD,
rows: Int = 0, cols: Int = 0, align: Align? = null,
- classes: Set<String> = setOf(), init: (ResponsiveGridPanel.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (ResponsiveGridPanel.() -> Unit)? = null
): ResponsiveGridPanel {
- val responsiveGridPanel = ResponsiveGridPanel(gridSize, rows, cols, align, classes, init)
+ val responsiveGridPanel = ResponsiveGridPanel(gridSize, rows, cols, align, classes ?: className.set, init)
this.add(responsiveGridPanel)
return responsiveGridPanel
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
index 36967e2b..3b2accad 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/panel/TabPanel.kt
@@ -31,6 +31,7 @@ import pl.treksoft.kvision.html.Tag
import pl.treksoft.kvision.html.link
import pl.treksoft.kvision.routing.routing
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
import pl.treksoft.kvision.html.icon as cicon
/**
@@ -273,10 +274,11 @@ fun Container.tabPanel(
tabPosition: TabPosition = TabPosition.TOP,
sideTabSize: SideTabSize = SideTabSize.SIZE_3,
scrollableTabs: Boolean = false,
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (TabPanel.() -> Unit)? = null
): TabPanel {
- val tabPanel = TabPanel(tabPosition, sideTabSize, scrollableTabs, classes, init)
+ val tabPanel = TabPanel(tabPosition, sideTabSize, scrollableTabs, classes ?: className.set, init)
this.add(tabPanel)
return tabPanel
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/progress/ProgressBar.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/progress/ProgressBar.kt
index 45ea316c..f9dd0617 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/progress/ProgressBar.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/progress/ProgressBar.kt
@@ -24,6 +24,7 @@ package pl.treksoft.kvision.progress
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.html.Align
import pl.treksoft.kvision.panel.SimplePanel
+import pl.treksoft.kvision.utils.set
/**
* The Bootstrap progress bar.
@@ -57,6 +58,7 @@ open class ProgressBar(
set(value) {
indicator.progress = value
}
+
/**
* The minimal progress.
*/
@@ -65,6 +67,7 @@ open class ProgressBar(
set(value) {
indicator.min = value
}
+
/**
* The maximal progress.
*/
@@ -73,6 +76,7 @@ open class ProgressBar(
set(value) {
indicator.max = value
}
+
/**
* The style of the progress bar.
*/
@@ -81,6 +85,7 @@ open class ProgressBar(
set(value) {
indicator.style = value
}
+
/**
* Determines if the progress bar is striped.
*/
@@ -89,6 +94,7 @@ open class ProgressBar(
set(value) {
indicator.striped = value
}
+
/**
* Determines if the progress bar is animated.
*/
@@ -97,6 +103,7 @@ open class ProgressBar(
set(value) {
indicator.animated = value
}
+
/**
* Text content of the progress bar.
*/
@@ -105,6 +112,7 @@ open class ProgressBar(
set(value) {
indicator.content = value
}
+
/**
* Determines if [content] can contain HTML code.
*/
@@ -113,6 +121,7 @@ open class ProgressBar(
set(value) {
indicator.rich = value
}
+
/**
* Text align of the progress bar.
*/
@@ -141,7 +150,9 @@ fun Container.progressBar(
progress: Int, min: Int = DEFAULT_MIN, max: Int = DEFAULT_MAX, style: ProgressBarStyle? = null,
striped: Boolean = false, animated: Boolean = false,
content: String? = null, rich: Boolean = false, align: Align? = null,
- classes: Set<String> = setOf(), init: (ProgressBar.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (ProgressBar.() -> Unit)? = null
): ProgressBar {
val progressBar = ProgressBar(
progress,
@@ -153,7 +164,7 @@ fun Container.progressBar(
content,
rich,
align,
- classes
+ classes ?: className.set
).apply { init?.invoke(this) }
this.add(progressBar)
return progressBar
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt
index 5d871a1c..70652fb7 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt
@@ -25,6 +25,7 @@ import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.StringBoolPair
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.utils.px
+import pl.treksoft.kvision.utils.set
/**
* Button group sizes.
@@ -52,6 +53,7 @@ open class ButtonGroup(
* Button group size.
*/
var size by refreshOnUpdate(size)
+
/**
* Vertical alignment.
*/
@@ -84,9 +86,11 @@ open class ButtonGroup(
*/
fun Container.buttonGroup(
size: ButtonGroupSize? = null, vertical: Boolean = false,
- classes: Set<String> = setOf(), init: (ButtonGroup.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (ButtonGroup.() -> Unit)? = null
): ButtonGroup {
- val group = ButtonGroup(size, vertical, classes).apply { init?.invoke(this) }
+ val group = ButtonGroup(size, vertical, classes ?: className.set).apply { init?.invoke(this) }
this.add(group)
return group
}
@@ -97,9 +101,11 @@ fun Container.buttonGroup(
* It creates button groups with size and vertical parameters of the toolbar.
*/
fun Toolbar.buttonGroup(
- classes: Set<String> = setOf(), init: (ButtonGroup.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (ButtonGroup.() -> Unit)? = null
): ButtonGroup {
- val group = ButtonGroup(this.size, this.vertical, classes).apply {
+ val group = ButtonGroup(this.size, this.vertical, classes ?: className.set).apply {
marginRight = this@buttonGroup.spacing.px
init?.invoke(this)
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt
index b942d1d5..eefd10b1 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt
@@ -23,6 +23,7 @@ package pl.treksoft.kvision.toolbar
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.panel.SimplePanel
+import pl.treksoft.kvision.utils.set
/**
* The Bootstrap toolbar.
@@ -53,9 +54,11 @@ open class Toolbar(
*/
fun Container.toolbar(
size: ButtonGroupSize? = null, spacing: Int = 2, vertical: Boolean = false,
- classes: Set<String> = setOf(), init: (Toolbar.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (Toolbar.() -> Unit)? = null
): Toolbar {
- val toolbar = Toolbar(size, spacing, vertical, classes).apply { init?.invoke(this) }
+ val toolbar = Toolbar(size, spacing, vertical, classes ?: className.set).apply { init?.invoke(this) }
this.add(toolbar)
return toolbar
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
index b34de18d..0cceb672 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/window/Window.kt
@@ -39,6 +39,7 @@ import pl.treksoft.kvision.modal.CloseIcon
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.utils.obj
import pl.treksoft.kvision.utils.px
+import pl.treksoft.kvision.utils.set
internal const val DEFAULT_Z_INDEX = 900
internal const val WINDOW_HEADER_HEIGHT = 40
@@ -84,6 +85,7 @@ open class Window(
captionTag.content = value
checkHeaderVisibility()
}
+
/**
* Window content width.
*/
@@ -92,6 +94,7 @@ open class Window(
set(value) {
width = value
}
+
/**
* Window content height.
*/
@@ -100,6 +103,7 @@ open class Window(
set(value) {
content.height = value
}
+
/**
* Window content height.
*/
@@ -108,14 +112,17 @@ open class Window(
set(value) {
content.overflow = value
}
+
/**
* Determines if the window is resizable.
*/
var isResizable by refreshOnUpdate(isResizable) { checkIsResizable() }
+
/**
* Determines if the window is draggable.
*/
var isDraggable by refreshOnUpdate(isDraggable) { checkIsDraggable(); checkHeaderVisibility() }
+
/**
* Determines if Close button is visible.
*/
@@ -125,6 +132,7 @@ open class Window(
closeIcon.visible = value
checkHeaderVisibility()
}
+
/**
* Determines if Maximize button is visible.
*/
@@ -134,6 +142,7 @@ open class Window(
maximizeIcon.visible = value
checkHeaderVisibility()
}
+
/**
* Determines if Maximize button is visible.
*/
@@ -143,6 +152,7 @@ open class Window(
minimizeIcon.visible = value
checkHeaderVisibility()
}
+
/**
* Window icon.
*/
@@ -426,7 +436,8 @@ fun Container.window(
maximizeButton: Boolean = false,
minimizeButton: Boolean = false,
icon: String? = null,
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (Window.() -> Unit)? = null
): Window {
val window =
@@ -440,7 +451,7 @@ fun Container.window(
maximizeButton,
minimizeButton,
icon,
- classes,
+ classes ?: className.set,
init
)
this.add(window)