From 9fcfceb1da0ec7ecc48043d2dae519b0a5a02622 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Tue, 31 Jan 2023 14:05:49 +0100 Subject: [PATCH] Put checkbox/radio components back to the right location in the components tree (broken in 5.14.0!) --- src/main/kotlin/io/kvision/form/check/CheckBox.kt | 7 ++++++- src/main/kotlin/io/kvision/form/check/Radio.kt | 7 ++++++- src/main/kotlin/io/kvision/form/check/TriStateCheckBox.kt | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/io/kvision/form/check/CheckBox.kt b/src/main/kotlin/io/kvision/form/check/CheckBox.kt index d4408369b20..7dac219183e 100644 --- a/src/main/kotlin/io/kvision/form/check/CheckBox.kt +++ b/src/main/kotlin/io/kvision/form/check/CheckBox.kt @@ -136,13 +136,18 @@ open class CheckBox( private val idc = "kv_form_checkbox_$counter" final override val input: CheckBoxInput = CheckBoxInput(value).apply { + this.parent = this@CheckBox this.id = this@CheckBox.idc this.name = name } final override val flabel: FieldLabel = FieldLabelCheck(idc, label, rich, className = "form-check-label") { + this.parent = this@CheckBox span() } - final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false } + final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { + this.parent = this@CheckBox + visible = false + } init { @Suppress("LeakingThis") diff --git a/src/main/kotlin/io/kvision/form/check/Radio.kt b/src/main/kotlin/io/kvision/form/check/Radio.kt index a07d1c2d153..23af277f63c 100644 --- a/src/main/kotlin/io/kvision/form/check/Radio.kt +++ b/src/main/kotlin/io/kvision/form/check/Radio.kt @@ -136,14 +136,19 @@ open class Radio( private val idc = "kv_form_radio_$counter" final override val input: RadioInput = RadioInput(value).apply { + this.parent = this@Radio this.id = this@Radio.idc this.extraValue = extraValue this.name = name } final override val flabel: FieldLabel = FieldLabelCheck(idc, label, rich, className = "form-check-label") { + this.parent = this@Radio span() } - final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false } + final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { + this.parent = this@Radio + visible = false + } init { @Suppress("LeakingThis") diff --git a/src/main/kotlin/io/kvision/form/check/TriStateCheckBox.kt b/src/main/kotlin/io/kvision/form/check/TriStateCheckBox.kt index e4ed0dd30fe..7513fe752dc 100644 --- a/src/main/kotlin/io/kvision/form/check/TriStateCheckBox.kt +++ b/src/main/kotlin/io/kvision/form/check/TriStateCheckBox.kt @@ -143,14 +143,19 @@ open class TriStateCheckBox( private val idc = "kv_form_tristatecheckbox_$counter" final override val input: TriStateCheckBoxInput = TriStateCheckBoxInput(value ?: false).apply { + this.parent = this@TriStateCheckBox this.id = this@TriStateCheckBox.idc this.name = name this.indeterminate = value == null } final override val flabel: FieldLabel = FieldLabelCheck(idc, label, rich, className = "form-check-label") { + this.parent = this@TriStateCheckBox span() } - final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { visible = false } + final override val invalidFeedback: InvalidFeedback = InvalidFeedback().apply { + this.parent = this@TriStateCheckBox + visible = false + } init { @Suppress("LeakingThis")