diff --git a/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/tabComponent.kt b/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/tabComponent.kt index 5f22a353..fa61d3d4 100644 --- a/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/tabComponent.kt +++ b/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/tabComponent.kt @@ -45,7 +45,7 @@ public val TabPane: FunctionalComponent = functionalComponent("Tab +(cp.title ?: cp.id) attrs { if (cp.id == activeTab) { - classes += "active" + classes = classes + "active" } onClickFunction = { activeTab = cp.id diff --git a/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/threeControls.kt b/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/threeControls.kt index 7c26abbf..33b94244 100644 --- a/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/threeControls.kt +++ b/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/threeControls.kt @@ -22,7 +22,7 @@ public external interface ThreeControlsProps : RProps { @JsExport public val ThreeControls: FunctionalComponent = functionalComponent { props -> val vision = props.canvas.content - tabPane { + tabPane(if (props.selected != null) "Properties" else null) { tab("Canvas") { card("Canvas configuration") { canvasControls(props.canvas) diff --git a/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt b/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt index 53678275..28432ab0 100644 --- a/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt +++ b/ui/react/src/main/kotlin/hep/dataforge/vision/react/PropertyEditor.kt @@ -66,12 +66,9 @@ private val PropertyEditorItem: FunctionalComponent = private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) { var expanded: Boolean by useState { true } val descriptorItem: ItemDescriptor? = props.descriptor?.get(props.name) - if (descriptorItem?.hidden == true) return //fail fast for hidden property var ownProperty: MetaItem? by useState { props.ownProperties.getItem(props.name) } val actualItem: MetaItem? = props.allProperties?.getItem(props.name) - println("Actual item for ${props.name?.toString()} is ${actualItem.toString()}") - val token = props.name.lastOrNull()?.toString() ?: "Properties" fun update() { @@ -108,6 +105,17 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) { } if (actualItem is NodeItem) { + val keys = buildSet { + (descriptorItem as? NodeDescriptor)?.items?.filterNot { + it.key.startsWith("@") || it.value.hidden + }?.forEach { + add(NameToken(it.key)) + } + ownProperty?.node?.items?.keys?.filterNot { it.body.startsWith("@") }?.let { addAll(it) } + } + // Do not show nodes without visible children + if (keys.isEmpty()) return + styledDiv { css { +TreeStyles.treeLeaf @@ -138,14 +146,7 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) { css { +TreeStyles.tree } - val keys = buildSet { - (descriptorItem as? NodeDescriptor)?.items?.keys?.forEach { - add(NameToken(it)) - } - ownProperty?.node?.items?.keys?.let { addAll(it) } - } - - keys.filter { !it.body.startsWith("@") }.forEach { token -> + keys.forEach { token -> styledLi { css { +TreeStyles.treeItem