diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-11-05 10:50:01 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-11-05 10:50:01 +0100 |
commit | a128f5e1a8e70530380d30cc0cb5168fe7a9bdea (patch) | |
tree | bf944d07b476e95ce97cdc17512246cc099d76fd /src/main/kotlin/pl/treksoft/kvision/form/check | |
parent | bd5ca4eb07b8b7f6cff1ac8abfb34cfb638076e4 (diff) | |
download | kvision-a128f5e1a8e70530380d30cc0cb5168fe7a9bdea.tar.gz kvision-a128f5e1a8e70530380d30cc0cb5168fe7a9bdea.tar.bz2 kvision-a128f5e1a8e70530380d30cc0cb5168fe7a9bdea.zip |
Add labels/fields horizontal ratio option for FormPanel component.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/form/check')
3 files changed, 14 insertions, 11 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt index ac25b30d..4fa30d7b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckBox.kt @@ -27,6 +27,7 @@ import pl.treksoft.kvision.core.StringBoolPair import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.form.BoolFormControl import pl.treksoft.kvision.form.FieldLabel +import pl.treksoft.kvision.form.FormHorizontalRatio import pl.treksoft.kvision.form.InvalidFeedback import pl.treksoft.kvision.panel.SimplePanel import pl.treksoft.kvision.utils.SnOn @@ -174,11 +175,11 @@ open class CheckBox( input.blur() } - override fun styleForHorizontalFormPanel() { + override fun styleForHorizontalFormPanel(horizontalRatio: FormHorizontalRatio) { addCssClass("form-group") addSurroundingCssClass("row") - addCssClass("offset-sm-2") - addCssClass("col-sm-10") + addCssClass("offset-sm-${horizontalRatio.labels}") + addCssClass("col-sm-${horizontalRatio.fields}") } override fun styleForInlineFormPanel() { diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt index bb73da60..d2c58c87 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt @@ -27,6 +27,7 @@ import pl.treksoft.kvision.core.StringBoolPair import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.form.BoolFormControl import pl.treksoft.kvision.form.FieldLabel +import pl.treksoft.kvision.form.FormHorizontalRatio import pl.treksoft.kvision.form.InvalidFeedback import pl.treksoft.kvision.panel.SimplePanel import pl.treksoft.kvision.utils.SnOn @@ -189,11 +190,11 @@ open class Radio( input.blur() } - override fun styleForHorizontalFormPanel() { + override fun styleForHorizontalFormPanel(horizontalRatio: FormHorizontalRatio) { addCssClass("form-group") addSurroundingCssClass("row") - addCssClass("offset-sm-2") - addCssClass("col-sm-10") + addCssClass("offset-sm-${horizontalRatio.labels}") + addCssClass("col-sm-${horizontalRatio.fields}") } override fun styleForInlineFormPanel() { diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt index bee57db4..b162abc8 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt @@ -25,6 +25,7 @@ import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.StringBoolPair import pl.treksoft.kvision.core.StringPair import pl.treksoft.kvision.form.FieldLabel +import pl.treksoft.kvision.form.FormHorizontalRatio import pl.treksoft.kvision.form.InputSize import pl.treksoft.kvision.form.InvalidFeedback import pl.treksoft.kvision.form.StringFormControl @@ -216,13 +217,13 @@ open class RadioGroup( container.getChildren().filterIsInstance<Radio>().firstOrNull()?.blur() } - override fun styleForHorizontalFormPanel() { + override fun styleForHorizontalFormPanel(horizontalRatio: FormHorizontalRatio) { addCssClass("row") - flabel.addCssClass("col-sm-2") + flabel.addCssClass("col-sm-${horizontalRatio.labels}") flabel.addCssClass("col-form-label") - container.addCssClass("col-sm-10") - invalidFeedback.addCssClass("offset-sm-2") - invalidFeedback.addCssClass("col-sm-10") + container.addCssClass("col-sm-${horizontalRatio.fields}") + invalidFeedback.addCssClass("offset-sm-${horizontalRatio.labels}") + invalidFeedback.addCssClass("col-sm-${horizontalRatio.fields}") } companion object { |