aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt2
-rw-r--r--kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt26
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt2
-rw-r--r--kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt7
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt2
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt24
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt18
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt25
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt2
-rw-r--r--kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt31
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt7
-rw-r--r--kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt16
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt2
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt6
-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
-rw-r--r--kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt8
-rw-r--r--kvision-modules/kvision-maps/src/main/kotlin/pl/treksoft/kvision/maps/Maps.kt6
-rw-r--r--kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt8
-rw-r--r--kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt7
-rw-r--r--kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt17
32 files changed, 329 insertions, 94 deletions
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
index aa3e77b2..68ec96a2 100644
--- a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
+++ b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTime.kt
@@ -196,7 +196,7 @@ open class DateTime(
this.input.id = idc
this.name = name
}
- final override val flabel: FieldLabel = FieldLabel(idc, label, rich)
+ final override val flabel: FieldLabel = FieldLabel(idc, label, rich, setOf("control-label"))
final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false }
init {
diff --git a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
index daeda692..967ca9db 100644
--- a/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
+++ b/kvision-modules/kvision-bootstrap-datetime/src/main/kotlin/pl/treksoft/kvision/form/time/DateTimeInput.kt
@@ -36,6 +36,7 @@ import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.types.toDateF
import pl.treksoft.kvision.types.toStringF
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
import kotlin.js.Date
internal const val DEFAULT_STEPPING = 5
@@ -78,10 +79,12 @@ open class DateTimeInput(
input.value = value?.toStringF(format)
refreshState()
}
+
/**
* Date/time format.
*/
var format by refreshOnUpdate(format) { refreshDatePicker() }
+
/**
* The placeholder for the date/time input.
*/
@@ -90,6 +93,7 @@ open class DateTimeInput(
set(value) {
input.placeholder = value
}
+
/**
* The name attribute of the generated HTML input element.
*/
@@ -98,6 +102,7 @@ open class DateTimeInput(
set(value) {
input.name = value
}
+
/**
* Determines if the field is disabled.
*/
@@ -106,6 +111,7 @@ open class DateTimeInput(
set(value) {
input.disabled = value
}
+
/**
* Determines if the text input is automatically focused.
*/
@@ -114,6 +120,7 @@ open class DateTimeInput(
set(value) {
input.autofocus = value
}
+
/**
* Determines if the date/time input is read-only.
*/
@@ -122,6 +129,7 @@ open class DateTimeInput(
set(value) {
input.readonly = value
}
+
/**
* The size of the input.
*/
@@ -130,6 +138,7 @@ open class DateTimeInput(
set(value) {
input.size = value
}
+
/**
* The validation status of the input.
*/
@@ -139,46 +148,57 @@ open class DateTimeInput(
input.validationStatus = value
refresh()
}
+
/**
* Days of the week that should be disabled. Multiple values should be comma separated.
*/
var daysOfWeekDisabled by refreshOnUpdate(arrayOf<Int>()) { refreshDatePicker() }
+
/**
* Determines if *Clear* button should be visible.
*/
var showClear by refreshOnUpdate(true) { refreshDatePicker() }
+
/**
* Determines if *Close* button should be visible.
*/
var showClose by refreshOnUpdate(true) { refreshDatePicker() }
+
/**
* Determines if *Today* button should be visible.
*/
var showTodayButton by refreshOnUpdate(true) { refreshDatePicker() }
+
/**
* The increment used to build the hour view.
*/
var stepping by refreshOnUpdate(DEFAULT_STEPPING) { refreshDatePicker() }
+
/**
* Prevents date selection before this date.
*/
var minDate: Date? by refreshOnUpdate { refreshDatePicker() }
+
/**
* Prevents date selection after this date.
*/
var maxDate: Date? by refreshOnUpdate { refreshDatePicker() }
+
/**
* Shows date and time pickers side by side.
*/
var sideBySide by refreshOnUpdate(false) { refreshDatePicker() }
+
/**
* An array of enabled dates.
*/
var enabledDates by refreshOnUpdate(arrayOf<Date>()) { refreshDatePicker() }
+
/**
* An array of disabled dates.
*/
var disabledDates by refreshOnUpdate(arrayOf<Date>()) { refreshDatePicker() }
+
/**
* Allow date picker for readonly component.
*/
@@ -392,10 +412,12 @@ open class DateTimeInput(
* It takes the same parameters as the constructor of the built component.
*/
fun Container.dateTimeInput(
- value: Date? = null, format: String = "YYYY-MM-DD HH:mm", classes: Set<String> = setOf(),
+ value: Date? = null, format: String = "YYYY-MM-DD HH:mm",
+ classes: Set<String>? = null,
+ className: String? = null,
init: (DateTimeInput.() -> Unit)? = null
): DateTimeInput {
- val dateTimeInput = DateTimeInput(value, format, classes).apply { init?.invoke(this) }
+ val dateTimeInput = DateTimeInput(value, format, classes ?: className.set).apply { init?.invoke(this) }
this.add(dateTimeInput)
return dateTimeInput
}
diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
index dbd0aa70..b4e4738c 100644
--- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
+++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemote.kt
@@ -166,7 +166,7 @@ open class SelectRemote<T : Any>(
this.id = idc
this.name = name
}
- final override val flabel: FieldLabel = FieldLabel(idc, label, rich)
+ final override val flabel: FieldLabel = FieldLabel(idc, label, rich, setOf("control-label"))
final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false }
init {
diff --git a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
index e7fd384c..b6319a6b 100644
--- a/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
+++ b/kvision-modules/kvision-bootstrap-select-remote/src/main/kotlin/pl/treksoft/kvision/form/select/SelectRemoteInput.kt
@@ -36,6 +36,7 @@ import pl.treksoft.kvision.remote.KVServiceManager
import pl.treksoft.kvision.remote.RemoteOption
import pl.treksoft.kvision.utils.JSON
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
import kotlin.browser.window
external fun decodeURIComponent(encodedURI: String): String
@@ -197,7 +198,9 @@ fun <T : Any> Container.selectRemoteInput(
multiple: Boolean = false,
ajaxOptions: AjaxOptions? = null,
preload: Boolean = false,
- classes: Set<String> = setOf(), init: (SelectRemoteInput<T>.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (SelectRemoteInput<T>.() -> Unit)? = null
): SelectRemoteInput<T> {
val selectRemoteInput =
SelectRemoteInput(
@@ -208,7 +211,7 @@ fun <T : Any> Container.selectRemoteInput(
multiple,
ajaxOptions,
preload,
- classes
+ classes ?: className.set
).apply {
init?.invoke(this)
}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
index b3f5e1c1..4ffece7d 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt
@@ -183,7 +183,7 @@ open class Select(
this.id = idc
this.name = name
}
- final override val flabel: FieldLabel = FieldLabel(idc, label, rich)
+ final override val flabel: FieldLabel = FieldLabel(idc, label, rich, setOf("control-label"))
final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false }
init {
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
index 01b35ed2..ced0945d 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt
@@ -35,6 +35,7 @@ import pl.treksoft.kvision.html.ButtonStyle
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.utils.asString
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
/**
* Select width types. See [Bootstrap Select width](http://silviomoreto.github.io/bootstrap-select/examples/#width).
@@ -77,18 +78,22 @@ open class SelectInput(
* A list of options (value to label pairs) for the select control.
*/
var options by refreshOnUpdate(options) { setChildrenFromOptions() }
+
/**
* A value of the selected option.
*/
var value by refreshOnUpdate(value) { refreshState() }
+
/**
* The name attribute of the generated HTML select element.
*/
override var name: String? by refreshOnUpdate()
+
/**
* Determines if multiple value selection is allowed.
*/
var multiple by refreshOnUpdate(multiple)
+
/**
* Additional options for remote (AJAX) data source.
*/
@@ -98,50 +103,62 @@ open class SelectInput(
}
refresh()
}
+
/**
* Maximal number of selected options.
*/
var maxOptions: Int? by refreshOnUpdate()
+
/**
* Determines if live search is available.
*/
var liveSearch by refreshOnUpdate(false)
+
/**
* The placeholder for the select control.
*/
var placeholder: String? by refreshOnUpdate()
+
/**
* The style of the select control.
*/
var style: ButtonStyle? by refreshOnUpdate()
+
/**
* The width of the select control.
*/
var selectWidth: CssSize? by refreshOnUpdate()
+
/**
* The width type of the select control.
*/
var selectWidthType: SelectWidthType? by refreshOnUpdate()
+
/**
* The dropdown align of the select control.
*/
var dropdownAlign by refreshOnUpdate(SelectDropdownAlign.LEFT)
+
/**
* Determines if an empty option is automatically generated.
*/
var emptyOption by refreshOnUpdate(false) { setChildrenFromOptions() }
+
/**
* Determines if the field is disabled.
*/
override var disabled by refreshOnUpdate(false)
+
/**
* Determines if the select is automatically focused.
*/
var autofocus: Boolean? by refreshOnUpdate()
+
/**
* The size of the input.
*/
override var size: InputSize? by refreshOnUpdate()
+
/**
* The validation status of the input.
*/
@@ -389,9 +406,12 @@ open class SelectInput(
fun Container.selectInput(
options: List<StringPair>? = null, value: String? = null,
multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
- classes: Set<String> = setOf(), init: (SelectInput.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (SelectInput.() -> Unit)? = null
): SelectInput {
- val selectInput = SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) }
+ val selectInput =
+ SelectInput(options, value, multiple, ajaxOptions, classes ?: className.set).apply { init?.invoke(this) }
this.add(selectInput)
return selectInput
}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
index 7893f891..a265c35b 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt
@@ -24,6 +24,7 @@ package pl.treksoft.kvision.form.select
import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.StringPair
import pl.treksoft.kvision.panel.SimplePanel
+import pl.treksoft.kvision.utils.set
/**
* The helper container for adding option groups to [Select].
@@ -46,14 +47,17 @@ open class SelectOptGroup(
* A label for the group.
*/
var label by refreshOnUpdate(label)
+
/**
* A list of options (label to value pairs) for the group.
*/
var options by refreshOnUpdate(options) { setChildrenFromOptions() }
+
/**
* Maximal number of selected options in the group.
*/
var maxOptions by refreshOnUpdate(maxOptions)
+
/**
* Determines if the group is disabled.
*/
@@ -97,10 +101,13 @@ open class SelectOptGroup(
*/
fun Select.selectOptGroup(
label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
- disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
+ disabled: Boolean = false,
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (SelectOptGroup.() -> Unit)? = null
): SelectOptGroup {
val selectOptGroup =
- SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
+ SelectOptGroup(label, options, maxOptions, disabled, classes ?: className.set).apply { init?.invoke(this) }
this.add(selectOptGroup)
return selectOptGroup
}
@@ -112,10 +119,13 @@ fun Select.selectOptGroup(
*/
fun SelectInput.selectOptGroup(
label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
- disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
+ disabled: Boolean = false,
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (SelectOptGroup.() -> Unit)? = null
): SelectOptGroup {
val selectOptGroup =
- SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
+ SelectOptGroup(label, options, maxOptions, disabled, classes ?: className.set).apply { init?.invoke(this) }
this.add(selectOptGroup)
return selectOptGroup
}
diff --git a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
index a9c7eda5..1c8689c0 100644
--- a/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
+++ b/kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt
@@ -24,6 +24,7 @@ package pl.treksoft.kvision.form.select
import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.StringPair
import pl.treksoft.kvision.core.Widget
+import pl.treksoft.kvision.utils.set
/**
* The helper component for adding options to [Select] or [SelectOptGroup].
@@ -47,26 +48,32 @@ open class SelectOption(
* The value of the option.
*/
var value by refreshOnUpdate(value)
+
/**
* The label of the option.
*/
var label by refreshOnUpdate(label)
+
/**
* The subtext after the label of the option.
*/
var subtext by refreshOnUpdate(subtext)
+
/**
* The icon before the label of the option.
*/
var icon by refreshOnUpdate(icon)
+
/**
* Determines if the option should be rendered as divider.
*/
var divider by refreshOnUpdate(divider)
+
/**
* Determines if the option should be disabled.
*/
var disabled by refreshOnUpdate(disabled)
+
/**
* Determines if the option is selected.
*/
@@ -114,10 +121,12 @@ open class SelectOption(
fun Select.selectOption(
value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
- classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (SelectOption.() -> Unit)? = null
): SelectOption {
val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes ?: className.set).apply {
init?.invoke(
this
)
@@ -134,10 +143,12 @@ fun Select.selectOption(
fun SelectInput.selectOption(
value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
- classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (SelectOption.() -> Unit)? = null
): SelectOption {
val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes ?: className.set).apply {
init?.invoke(
this
)
@@ -154,10 +165,12 @@ fun SelectInput.selectOption(
fun SelectOptGroup.selectOption(
value: String? = null, label: String? = null, subtext: String? = null, icon: String? = null,
divider: Boolean = false, disabled: Boolean = false, selected: Boolean = false,
- classes: Set<String> = setOf(), init: (SelectOption.() -> Unit)? = null
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (SelectOption.() -> Unit)? = null
): SelectOption {
val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes ?: className.set).apply {
init?.invoke(
this
)
diff --git a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
index a842a37f..3901cc4f 100644
--- a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
+++ b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt
@@ -180,7 +180,7 @@ open class Spinner(
this.id = idc
this.name = name
}
- final override val flabel: FieldLabel = FieldLabel(idc, label, rich)
+ final override val flabel: FieldLabel = FieldLabel(idc, label, rich, setOf("control-label"))
final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false }
init {
diff --git a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
index 3a52fed2..98b7be62 100644
--- a/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
+++ b/kvision-modules/kvision-bootstrap-spinner/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt
@@ -32,6 +32,7 @@ import pl.treksoft.kvision.form.InputSize
import pl.treksoft.kvision.form.ValidationStatus
import pl.treksoft.kvision.html.ButtonStyle
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
/**
* Spinner buttons layout types.
@@ -80,6 +81,7 @@ open class SpinnerInput(
* Spinner value.
*/
var value by refreshOnUpdate(value) { refreshState() }
+
/**
* The value attribute of the generated HTML input element.
*
@@ -87,54 +89,67 @@ open class SpinnerInput(
* bound to the spinner input value.
*/
var startValue by refreshOnUpdate(value) { this.value = it; refresh() }
+
/**
* Minimal value.
*/
var min by refreshOnUpdate(min) { refreshSpinner() }
+
/**
* Maximal value.
*/
var max by refreshOnUpdate(max) { refreshSpinner() }
+
/**
* Step value.
*/
var step by refreshOnUpdate(step) { refreshSpinner() }
+
/**
* Number of decimal digits value.
*/
var decimals by refreshOnUpdate(decimals) { refreshSpinner() }
+
/**
* Spinner force rounding type.
*/
var forceType by refreshOnUpdate(forceType) { refreshSpinner() }
+
/**
* The style of the up/down buttons.
*/
var buttonStyle by refreshOnUpdate(buttonStyle) { refreshSpinner() }
+
/**
* The placeholder for the spinner input.
*/
var placeholder: String? by refreshOnUpdate()
+
/**
* The name attribute of the generated HTML input element.
*/
override var name: String? by refreshOnUpdate()
+
/**
* Determines if the field is disabled.
*/
override var disabled by refreshOnUpdate(false)
+
/**
* Determines if the spinner is automatically focused.
*/
var autofocus: Boolean? by refreshOnUpdate()
+
/**
* Determines if the spinner is read-only.
*/
var readonly: Boolean? by refreshOnUpdate()
+
/**
* The size of the input.
*/
override var size: InputSize? by refreshOnUpdate()
+
/**
* The validation status of the input.
*/
@@ -323,11 +338,23 @@ open class SpinnerInput(
fun Container.spinnerInput(
value: Number? = null, min: Number? = null, max: Number? = null, step: Number = DEFAULT_STEP,
decimals: Int = 0, buttonsType: ButtonsType = ButtonsType.VERTICAL,
- forceType: ForceType = ForceType.NONE, buttonStyle: ButtonStyle? = null, classes: Set<String> = setOf(),
+ forceType: ForceType = ForceType.NONE, buttonStyle: ButtonStyle? = null,
+ classes: Set<String>? = null,
+ className: String? = null,
init: (SpinnerInput.() -> Unit)? = null
): SpinnerInput {
val spinnerInput =
- SpinnerInput(value, min, max, step, decimals, buttonsType, forceType, buttonStyle, classes).apply {
+ SpinnerInput(
+ value,
+ min,
+ max,
+ step,
+ decimals,
+ buttonsType,
+ forceType,
+ buttonStyle,
+ classes ?: className.set
+ ).apply {
init?.invoke(
this
)
diff --git a/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt b/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt
index 42412ae4..0693756b 100644
--- a/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt
+++ b/kvision-modules/kvision-bootstrap-typeahead-remote/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadRemoteInput.kt
@@ -30,6 +30,7 @@ import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.remote.JsonRpcRequest
import pl.treksoft.kvision.remote.KVServiceManager
import pl.treksoft.kvision.utils.JSON
+import pl.treksoft.kvision.utils.set
import kotlin.browser.window
/**
@@ -86,12 +87,14 @@ fun <T : Any> Container.typeaheadRemoteInput(
function: suspend T.(String?, String?) -> List<String>,
stateFunction: (() -> String)? = null,
items: Int? = 8, minLength: Int = 1, delay: Int = 0,
- type: TextInputType = TextInputType.TEXT, value: String? = null, classes: Set<String> = setOf(),
+ type: TextInputType = TextInputType.TEXT, value: String? = null,
+ classes: Set<String>? = null,
+ className: String? = null,
init: (TypeaheadRemoteInput<T>.() -> Unit)? = null
): TypeaheadRemoteInput<T> {
val typeaheadRemoteInput =
TypeaheadRemoteInput(
- serviceManager, function, stateFunction, items, minLength, delay, type, value, classes
+ serviceManager, function, stateFunction, items, minLength, delay, type, value, classes ?: className.set
).apply {
init?.invoke(this)
}
diff --git a/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt b/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt
index bf0622f1..104c7f8d 100644
--- a/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt
+++ b/kvision-modules/kvision-bootstrap-typeahead/src/main/kotlin/pl/treksoft/kvision/form/text/TypeaheadInput.kt
@@ -26,6 +26,7 @@ import pl.treksoft.jquery.JQueryXHR
import pl.treksoft.jquery.jQuery
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
enum class ShowHintOnFocus {
NO,
@@ -183,14 +184,17 @@ open class TypeaheadInput(
fun Container.typeaheadInput(
options: List<String>? = null, taAjaxOptions: TaAjaxOptions? = null,
items: Int? = 8, minLength: Int = 1, delay: Int = 0,
- type: TextInputType = TextInputType.TEXT, value: String? = null, classes: Set<String> = setOf(),
+ type: TextInputType = TextInputType.TEXT, value: String? = null,
+ classes: Set<String>? = null,
+ className: String? = null,
init: (TypeaheadInput.() -> Unit)? = null
): TypeaheadInput {
- val typeaheadInput = TypeaheadInput(options, taAjaxOptions, items, minLength, delay, type, value, classes).apply {
- init?.invoke(
- this
- )
- }
+ val typeaheadInput =
+ TypeaheadInput(options, taAjaxOptions, items, minLength, delay, type, value, classes ?: className.set).apply {
+ init?.invoke(
+ this
+ )
+ }
this.add(typeaheadInput)
return typeaheadInput
}
diff --git a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt
index 96672587..1f28f252 100644
--- a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt
+++ b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/Upload.kt
@@ -215,7 +215,7 @@ open class Upload(
this.id = idc
this.name = name
}
- final override val flabel: FieldLabel = FieldLabel(idc, label, rich)
+ final override val flabel: FieldLabel = FieldLabel(idc, label, rich, setOf("control-label"))
final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false }
init {
diff --git a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
index 5bdaad9b..3930ace2 100644
--- a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
+++ b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
@@ -36,6 +36,7 @@ import pl.treksoft.kvision.i18n.I18n
import pl.treksoft.kvision.types.KFile
import pl.treksoft.kvision.utils.getContent
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
import kotlin.reflect.KProperty1
/**
@@ -369,10 +370,11 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
fun Container.uploadInput(
uploadUrl: String? = null,
multiple: Boolean = false,
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (UploadInput.() -> Unit)? = null
): UploadInput {
- val uploadInput = UploadInput(uploadUrl, multiple, classes).apply {
+ val uploadInput = UploadInput(uploadUrl, multiple, classes ?: className.set).apply {
init?.invoke(
this
)
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)
diff --git a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt
index 55718918..30ce529b 100644
--- a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt
+++ b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt
@@ -24,9 +24,10 @@ package pl.treksoft.kvision.chart
import com.github.snabbdom.VNode
import pl.treksoft.kvision.chart.js.Chart.ChartConfiguration
import pl.treksoft.kvision.chart.js.PluginServiceGlobalRegistration
-import pl.treksoft.kvision.chart.js.Chart as JsChart
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Widget
+import pl.treksoft.kvision.utils.set
+import pl.treksoft.kvision.chart.js.Chart as JsChart
/**
* Chart component.
@@ -133,10 +134,11 @@ fun Container.chart(
configuration: Configuration,
chartWidth: Int? = null,
chartHeight: Int? = null,
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (Chart.() -> Unit)? = null
): Chart {
- val chart = Chart(configuration, chartWidth, chartHeight, classes).apply { init?.invoke(this) }
+ val chart = Chart(configuration, chartWidth, chartHeight, classes ?: className.set).apply { init?.invoke(this) }
this.add(chart)
return chart
}
diff --git a/kvision-modules/kvision-maps/src/main/kotlin/pl/treksoft/kvision/maps/Maps.kt b/kvision-modules/kvision-maps/src/main/kotlin/pl/treksoft/kvision/maps/Maps.kt
index cb98fb8a..b76300c8 100644
--- a/kvision-modules/kvision-maps/src/main/kotlin/pl/treksoft/kvision/maps/Maps.kt
+++ b/kvision-modules/kvision-maps/src/main/kotlin/pl/treksoft/kvision/maps/Maps.kt
@@ -27,6 +27,7 @@ import pl.treksoft.kvision.KVManagerMaps
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
/**
* Maps component.
@@ -90,10 +91,11 @@ fun Container.maps(
lng: Number,
zoom: Number,
showMarker: Boolean = false,
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (Maps.() -> Unit)? = null
): Maps {
- val maps = Maps(lat, lng, zoom, showMarker, classes, init)
+ val maps = Maps(lat, lng, zoom, showMarker, classes ?: className.set, init)
this.add(maps)
return maps
}
diff --git a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
index 8b58e272..fc7957ca 100644
--- a/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
+++ b/kvision-modules/kvision-richtext/src/main/kotlin/pl/treksoft/kvision/form/text/RichTextInput.kt
@@ -25,6 +25,7 @@ import com.github.snabbdom.VNode
import pl.treksoft.jquery.jQuery
import pl.treksoft.kvision.core.Container
import pl.treksoft.kvision.core.StringPair
+import pl.treksoft.kvision.utils.set
import kotlin.browser.document
/**
@@ -122,9 +123,12 @@ open class RichTextInput(value: String? = null, classes: Set<String> = setOf())
* It takes the same parameters as the constructor of the built component.
*/
fun Container.richTextInput(
- value: String? = null, classes: Set<String> = setOf(), init: (RichTextInput.() -> Unit)? = null
+ value: String? = null,
+ classes: Set<String>? = null,
+ className: String? = null,
+ init: (RichTextInput.() -> Unit)? = null
): RichTextInput {
- val richTextInput = RichTextInput(value, classes).apply { init?.invoke(this) }
+ val richTextInput = RichTextInput(value, classes ?: className.set).apply { init?.invoke(this) }
this.add(richTextInput)
return richTextInput
}
diff --git a/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt b/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt
index c9e8e208..e4473ed8 100644
--- a/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt
+++ b/kvision-modules/kvision-tabulator-remote/src/main/kotlin/pl/treksoft/kvision/tabulator/TabulatorRemote.kt
@@ -34,6 +34,7 @@ import pl.treksoft.kvision.remote.RemoteFilter
import pl.treksoft.kvision.remote.RemoteSorter
import pl.treksoft.kvision.table.TableType
import pl.treksoft.kvision.utils.JSON
+import pl.treksoft.kvision.utils.set
import kotlin.browser.window
/**
@@ -114,10 +115,12 @@ fun <T : Any, E : Any> Container.tabulatorRemote(
stateFunction: (() -> String)? = null,
options: TabulatorOptions<T> = TabulatorOptions(),
types: Set<TableType> = setOf(),
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (TabulatorRemote<T, E>.() -> Unit)? = null
): TabulatorRemote<T, E> {
- val tabulatorRemote = TabulatorRemote(serviceManager, function, stateFunction, options, types, classes)
+ val tabulatorRemote =
+ TabulatorRemote(serviceManager, function, stateFunction, options, types, classes ?: className.set)
init?.invoke(tabulatorRemote)
this.add(tabulatorRemote)
return tabulatorRemote
diff --git a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt
index 0292a0a4..d830f8a2 100644
--- a/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt
+++ b/kvision-modules/kvision-tabulator/src/main/kotlin/pl/treksoft/kvision/tabulator/Tabulator.kt
@@ -33,6 +33,7 @@ import pl.treksoft.kvision.state.ObservableState
import pl.treksoft.kvision.table.TableType
import pl.treksoft.kvision.utils.createInstance
import pl.treksoft.kvision.utils.obj
+import pl.treksoft.kvision.utils.set
import pl.treksoft.kvision.utils.syncWithList
import kotlin.browser.window
import pl.treksoft.kvision.tabulator.js.Tabulator as JsTabulator
@@ -739,10 +740,11 @@ fun <T : Any> Container.tabulator(
dataUpdateOnEdit: Boolean = true,
options: TabulatorOptions<T> = TabulatorOptions(),
types: Set<TableType> = setOf(),
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (Tabulator<T>.() -> Unit)? = null
): Tabulator<T> {
- val tabulator = Tabulator.create(data, dataUpdateOnEdit, options, types, classes)
+ val tabulator = Tabulator.create(data, dataUpdateOnEdit, options, types, classes ?: className.set)
init?.invoke(tabulator)
this.add(tabulator)
return tabulator
@@ -756,10 +758,11 @@ fun <T : Any, S : Any> Container.tabulator(
dataFactory: (S) -> List<T>,
options: TabulatorOptions<T> = TabulatorOptions(),
types: Set<TableType> = setOf(),
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (Tabulator<T>.() -> Unit)? = null
): Tabulator<T> {
- val tabulator = Tabulator.create(store, dataFactory, options, types, classes)
+ val tabulator = Tabulator.create(store, dataFactory, options, types, classes ?: className.set)
init?.invoke(tabulator)
this.add(tabulator)
return tabulator
@@ -771,10 +774,12 @@ fun <T : Any, S : Any> Container.tabulator(
fun <T : Any> Container.tabulator(
options: TabulatorOptions<T> = TabulatorOptions(),
types: Set<TableType> = setOf(),
- classes: Set<String> = setOf(),
+ classes: Set<String>? = null,
+ className: String? = null,
init: (Tabulator<T>.() -> Unit)? = null
): Tabulator<T> {
- val tabulator = Tabulator(dataUpdateOnEdit = false, options = options, types = types, classes = classes)
+ val tabulator =
+ Tabulator(dataUpdateOnEdit = false, options = options, types = types, classes = classes ?: className.set)
init?.invoke(tabulator)
this.add(tabulator)
return tabulator