Commit 4b758cf2 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

erp5_json_form: react from add readonly and fix render when input json change

parent 45883f67
...@@ -66,16 +66,20 @@ function makeUiSchema(schema, uiSchema, visited) { ...@@ -66,16 +66,20 @@ function makeUiSchema(schema, uiSchema, visited) {
value: options.value, value: options.value,
key: options.key, key: options.key,
schema_url: options.schema, schema_url: options.schema,
readonly: options.readonly,
}); });
}) })
.onStateChange(function (modification_dict) { .onStateChange(function (modification_dict) {
var gadget = this; var gadget = this;
if (modification_dict.schema_url) { if (modification_dict.schema_url || modification_dict.value) {
return $RefParser return $RefParser
.dereference(modification_dict.schema_url) .dereference(gadget.state.schema_url)
.then(function (schema) { .then(function (schema) {
let uiSchema = {}; let uiSchema = {};
if (gadget.state.readonly) {
uiSchema["ui:readonly"] = true;
}
makeUiSchema(schema, uiSchema, new Set()) makeUiSchema(schema, uiSchema, new Set())
const log = (type) => console.log.bind(console, type); const log = (type) => console.log.bind(console, type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment