diff options
Diffstat (limited to 'src/main/kotlin/pl')
8 files changed, 4 insertions, 30 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt index 2b2c7ef1..e17d7ba9 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt @@ -86,10 +86,6 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component * Determines if the current widget is draggable. */ var draggable: Boolean? by refreshOnUpdate() - /** - * Determines if the current widget is strictly bound to the DOM. - */ - var strictDOM: Boolean by refreshOnUpdate(false) protected var surroundingSpan by refreshOnUpdate(false) @@ -101,7 +97,7 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component var eventTarget: Widget? = null - protected var vnkey: String? by refreshOnUpdate() + private var vnkey = "kv_widget_${counter++}" protected var vnode: VNode? = null private var snAttrsCache: List<StringPair>? = null @@ -188,11 +184,7 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component */ private fun getSnOpt(): VNodeData { return snOpt { - if (vnkey != null) { - key = vnkey - } else if (strictDOM) { - key = hashCode().toString() - } + key = vnkey attrs = snAttrs(getSnAttrsInternal()) style = snStyle(getSnStyleInternal()) `class` = snClasses(getSnClassInternal()) @@ -819,6 +811,8 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component } companion object { + private var counter: Long = 0 + /** * DSL builder extension function. * diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt index b58860ff..a521fe95 100644 --- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt +++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt @@ -149,7 +149,6 @@ open class DropDown( internal val list: DropDownListTag = DropDownListTag(idc, setOf("dropdown-menu")) init { - this.vnkey = "kv_dropdown_$counter" setChildrenFromElements() this.addInternal(button) this.addInternal(list) diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt index 07b86b4c..a486b82e 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/check/CheckInput.kt @@ -51,7 +51,6 @@ abstract class CheckInput( ) : Widget(classes), FormInput { init { - this.vnkey = "kv_checkinput_${counter++}" this.setInternalEventListener<CheckInput> { click = { val v = getElementJQuery()?.prop("checked") as Boolean? @@ -162,8 +161,4 @@ abstract class CheckInput( override fun blur() { getElementJQuery()?.blur() } - - companion object { - internal var counter = 0 - } } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt index df334c1c..b2ba1d43 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/select/SimpleSelectInput.kt @@ -85,7 +85,6 @@ open class SimpleSelectInput( override var size: InputSize? by refreshOnUpdate() init { - this.vnkey = "kv_simpleselectinput_${counter++}" setChildrenFromOptions() this.setInternalEventListener<SimpleSelectInput> { change = { @@ -194,7 +193,6 @@ open class SimpleSelectInput( } companion object { - internal var counter = 0 /** * DSL builder extension function. diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt index 393ae63f..e7ecba8a 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt @@ -41,7 +41,6 @@ abstract class AbstractTextInput( ) : Widget(classes), FormInput { init { - this.vnkey = "kv_textinput_${counter++}" this.setInternalEventListener<AbstractTextInput> { input = { self.changeValue() @@ -167,8 +166,4 @@ abstract class AbstractTextInput( override fun blur() { getElementJQuery()?.blur() } - - companion object { - internal var counter = 0 - } } diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt b/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt index 476ee118..feb9a970 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Canvas.kt @@ -53,10 +53,6 @@ open class Canvas( */ lateinit var context2D: CanvasRenderingContext2D - init { - this.vnkey = "kv_canvas_${counter++}" - } - override fun render(): VNode { return render("canvas") } diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt index 5d872b08..5f911539 100644 --- a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt +++ b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt @@ -110,7 +110,6 @@ open class Modal( private val footer = SimplePanel(setOf("modal-footer")) init { - this.vnkey = "kv_modal_${counter++}" this.hide() this.role = "dialog" this.addInternal(dialog) @@ -271,7 +270,6 @@ open class Modal( } companion object { - internal var counter = 0 internal var modals = mutableListOf<Modal>() } } diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt index 7b046e1a..8b46ae0b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt @@ -123,7 +123,6 @@ internal class Splitter(private val splitPanel: SplitPanel, direction: Direction private val idc = "kv_splitter_$counter" init { - this.vnkey = "kv_splitter_$counter" this.id = idc counter++ } |