-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Note: this is incomplete to use as example to kick off discussion
An ability to set options based on conditional logic formatted in a consistent way that can be implemented in all potential framework variations.
I implement this on my server, but something that covers this for both would be useful.
"readonly": {
"$$switch": {
"$$options": [
{
"$$when": [ "workflow=/^(new|modify)$/" ],
"$$then": false
}
],
"$$else": true
}
}Even allowing RegEx for matching values.
There is also rules as defined in EclipseSource JSONForms as defined here: https://github.com/eclipsesource/jsonforms/blob/master/examples/app/local/local.controller.js#L58
"rule":{
"effect":"HIDE",
"condition":{
"type":"LEAF" ,
"scope": {
"$ref": "#/properties/personalData/properties/age"
},
"expectedValue":36
}
}I propose a combination approach that allows a rule to define a set of value changes for the object.
"myfield": {
"title": "My Field with rules",
"key": "personalData.myfield",
"rules": [
{
"condition": {
"scope": { "$ref": "#/properties/personalData/properties/age" },
"match": 36
},
"then": {
"readonly": true,
"hide": true,
"default": 21
}
},
{
"condition": [
{
"scope": { "$ref": "#/properties/personalData/properties/role" },
"patternMatch": "/^manager$/"
},
{
"scope": { "$state": "access" },
"match": "Admin"
}
],
"then": {
"readonly": false,
"hide": false,
"model": 42
}
},
],
"else": {
"readonly": true,
"hide": true,
"default": 11
}
}All keywords, key, scope etc.. can be defined later...
Metadata
Metadata
Assignees
Labels
No labels