Customize the conditions for enum property

I have a context that I want to render a enum value which will have the suggestion value based on another property. Example

  • We have 2 properties a and b
  • When a is true, b can only be one of: 10 20 30 (suggestion)
  • When a is false, b can only be one of: 40 50 60(suggestion)
    I wonder if we could add a new effect beside HIDE SHOW DISABLE ENABLE. It is possible?
    It could seem like this
{
	"type": "Control",
	"scope": "#property/B",
	"mode": "select",
	"rule": {
		"effect": "CONDITIONAL_SHOW",
	  "condition": {
			[
		         {
			    "scope": "#/properties/A",
			    "schema": { const: true },
					"suggestions": [
						"10",
						"20",
						"30"
						]
				},
	
				{
					"scope": "#/properties/A",
			        "schema": { const: false },
					"suggestions": [
						"10",
						"20",
						"30"
						]
				},
			]
		 }
	}
}

Hi @autinn123,

In general you can modify/extend the UI Schema in any way you like as long as custom renderers then take care of your customization.

So in this case you could implement a custom enum renderer which is able to understand the CONDITIONAL_SHOW rule and modifies its output accordingly.

However I would like to suggest to rather handle this within a separate property. That’ll allow an easier reuse of existing bindings and utils.

1 Like

Hi @sdirix, Thank for your answer