Open selobu opened 2 years ago
I am not sure I understand. Do you mean that you want to extend the schema dynamically ? vjsf does not guarantee that it will react property to any kind of dynamic change to the schema. In this case it is best to recreate the component instance.
Some forms could define computed fields based on another input on the same form. The computed fields should be readonly and have to evaluate expressions in a secure way by using a parser as peggy https://peggyjs.org/online.html, also I guess the computed field should evaluate simple tokens like COMA, IF, SUM, MINUS, and so on.
I don't know if this belongs to the scope of vjsf or if it should be done in the wrapping vue code. It feels a little bit like reinventing the wheel. Maybe having a readonly field in the form, and a computed property in vue whose setter writes into the model. Or using a slot.
Le lun. 14 mars 2022 à 23:16, Sebastian Lopez Buritica < @.***> a écrit :
Some forms could define computed fields based on another input on the same form. The computed fields should be readonly and have to evaluate expressions in a secure way by using a parser as peggy https://peggyjs.org/online.html, also I guess the computed field should evaluate simple tokens like COMA, IF, SUM, MINUS, and so on.
— Reply to this email directly, view it on GitHub https://github.com/koumoul-dev/vuetify-jsonschema-form/issues/348#issuecomment-1067355885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIIXSYEVUGPRAAQ6I2EXLU763CDANCNFSM5QWOMU7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
Hi, I am interested in computed fields as well. Immagine a form with 2 fields:
Can the JSON-schema specify that ID should be equal to "http://my/domain/" + name ?
I tried the following after passing Options: { "evalMethod": "newFunction" } to the form component but it doesn't work
{
"type": "object",
"title": "",
"required": [
"Name"
],
"properties": {
"ID": {
"type": "string",
"x-display": "hidden",
"x-fromData": "new Function('return root.Name')"
},
"Name": {
"type": "string",
"title": "Name "
}
}
}
it's posible to define computed fields?