-
Notifications
You must be signed in to change notification settings - Fork 418
Open
Description
Describe the bug
In a horizontal layout controls that are not shown still consume space unexpectedly.
Expected behavior
I expect only controls that are shown will participate in the flex layout and space is not associated with controls that are not shown.
Steps to reproduce the issue
- Go to https://stackblitz.com/edit/jsonformsquerybuilder
- Click on "Add to query groups" to add a query group to the array. Click on "Add to queries" to a query to the sub array.
- Change "Property Name" to "connectionStatus".
Notice the unexpected reserved space after the connection status value that looks incorrect:

- Change "Property Name" to "description"
Notice that the spacing between the description and operator field is too large and looks incorrect:

The following are the schemas demonstrated. The issue appears on both the seeds I tested, the current angular seed and the current vue seed.
schema
{
"definitions": {
"query": {
"type": "object",
"properties": {
"propertyName": {
"type": "string",
"enum": ["connectionStatus", "description"]
}
},
"anyOf": [
{
"if": {
"properties": { "propertyName": { "const": "connectionStatus" } }
},
"then": {
"properties": {
"connectionStatusOperator": {
"type": "string",
"enum": ["equals", "doesNotEqual"]
},
"connectionStatusValue": {
"type": "string",
"enum": ["approved", "disconnected", "connected"]
}
}
}
},
{
"if": {
"properties": { "propertyName": { "const": "description" } }
},
"then": {
"properties": {
"descriptionOperator": {
"type": "string",
"enum": ["equals", "doesNotEqual"]
},
"descriptionValue": { "type": "string" }
}
}
}
]
},
"queryGroup": {
"type": "object",
"properties": {
"queryGroupsOperator": { "type": "string", "enum": ["AND", "OR"] },
"queries": {
"type": "array",
"items": { "$ref": "#/definitions/query" }
}
}
}
},
"type": "object",
"properties": {
"queryGroups": {
"type": "array",
"items": { "$ref": "#/definitions/queryGroup" }
}
}
}
uischema.json
{
"type": "HorizontalLayout",
"elements": [
{
"type": "Control",
"label": { "text": "Query Groups", "show": true },
"scope": "#/properties/queryGroups",
"options": {
"showSortButtons": true,
"detail": {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/queries",
"options": {
"showSortButtons": true,
"detail": {
"type": "HorizontalLayout",
"elements": [
{ "type": "Control", "scope": "#/properties/propertyName" },
{
"type": "Control",
"scope": "#/properties/connectionStatusOperator",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/propertyName",
"schema": { "const": "connectionStatus" }
}
}
},
{
"type": "Control",
"scope": "#/properties/connectionStatusValue",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/propertyName",
"schema": { "const": "connectionStatus" }
}
}
},
{
"type": "Control",
"scope": "#/properties/descriptionOperator",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/propertyName",
"schema": { "const": "description" }
}
}
},
{
"type": "Control",
"scope": "#/properties/descriptionValue",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/propertyName",
"schema": { "const": "description" }
}
}
}
]
}
}
},
{ "type": "Control", "scope": "#/properties/queryGroupsOperator" }
]
}
}
}
]
}
Screenshots
See above
Which Version of JSON Forms are you using?
v3.3.0
Package
Angular Material Renderers
Additional context
No response