aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap-select/src
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-bootstrap-select/src')
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/Select.kt30
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectInput.kt31
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOptGroup.kt58
-rw-r--r--kvision-modules/kvision-bootstrap-select/src/main/kotlin/pl/treksoft/kvision/form/select/SelectOption.kt111
4 files changed, 111 insertions, 119 deletions
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 4b2505d2..ea98e369 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
@@ -266,20 +266,20 @@ open class Select(
companion object {
internal var counter = 0
-
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.select(
- options: List<StringPair>? = null, value: String? = null, name: String? = null,
- multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
- rich: Boolean = false, init: (Select.() -> Unit)? = null
- ): Select {
- val select = Select(options, value, name, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) }
- this.add(select)
- return select
- }
}
}
+
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.select(
+ options: List<StringPair>? = null, value: String? = null, name: String? = null,
+ multiple: Boolean = false, ajaxOptions: AjaxOptions? = null, label: String? = null,
+ rich: Boolean = false, init: (Select.() -> Unit)? = null
+): Select {
+ val select = Select(options, value, name, multiple, ajaxOptions, label, rich).apply { init?.invoke(this) }
+ this.add(select)
+ return select
+}
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 84eccaf7..b515ea3e 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
@@ -354,22 +354,19 @@ open class SelectInput(
override fun blur() {
getElementJQuery()?.blur()
}
+}
- companion object {
-
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.selectInput(
- options: List<StringPair>? = null, value: String? = null,
- multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
- classes: Set<String> = setOf(), init: (SelectInput.() -> Unit)? = null
- ): SelectInput {
- val selectInput = SelectInput(options, value, multiple, ajaxOptions, classes).apply { init?.invoke(this) }
- this.add(selectInput)
- return selectInput
- }
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.selectInput(
+ options: List<StringPair>? = null, value: String? = null,
+ multiple: Boolean = false, ajaxOptions: AjaxOptions? = null,
+ classes: Set<String> = setOf(), init: (SelectInput.() -> Unit)? = null
+): SelectInput {
+ val selectInput = SelectInput(options, value, multiple, ajaxOptions, classes).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 3f07a9bf..7893f891 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
@@ -88,36 +88,34 @@ open class SelectOptGroup(
}
return sn
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Select.selectOptGroup(
- label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
- disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
- ): SelectOptGroup {
- val selectOptGroup =
- SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
- this.add(selectOptGroup)
- return selectOptGroup
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Select.selectOptGroup(
+ label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
+ disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
+): SelectOptGroup {
+ val selectOptGroup =
+ SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
+ this.add(selectOptGroup)
+ return selectOptGroup
+}
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun SelectInput.selectOptGroup(
- label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
- disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
- ): SelectOptGroup {
- val selectOptGroup =
- SelectOptGroup(label, options, maxOptions, disabled, classes).apply { init?.invoke(this) }
- this.add(selectOptGroup)
- return selectOptGroup
- }
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun SelectInput.selectOptGroup(
+ label: String, options: List<StringPair>? = null, maxOptions: Int? = null,
+ disabled: Boolean = false, classes: Set<String> = setOf(), init: (SelectOptGroup.() -> Unit)? = null
+): SelectOptGroup {
+ val selectOptGroup =
+ SelectOptGroup(label, options, maxOptions, disabled, classes).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 91c269a8..a9c7eda5 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
@@ -104,67 +104,64 @@ open class SelectOption(
}
return sn
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- 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
- ): SelectOption {
- val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
- init?.invoke(
- this
- )
- }
- this.add(selectOption)
- return selectOption
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+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
+): SelectOption {
+ val selectOption =
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ init?.invoke(
+ this
+ )
}
+ this.add(selectOption)
+ return selectOption
+}
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- 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
- ): SelectOption {
- val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
- init?.invoke(
- this
- )
- }
- this.add(selectOption)
- return selectOption
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+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
+): SelectOption {
+ val selectOption =
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ init?.invoke(
+ this
+ )
}
+ this.add(selectOption)
+ return selectOption
+}
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- 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
- ): SelectOption {
- val selectOption =
- SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
- init?.invoke(
- this
- )
- }
- this.add(selectOption)
- return selectOption
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+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
+): SelectOption {
+ val selectOption =
+ SelectOption(value, label, subtext, icon, divider, disabled, selected, classes).apply {
+ init?.invoke(
+ this
+ )
}
-
- }
+ this.add(selectOption)
+ return selectOption
}