diff --git a/src/mixins/Json2Vue.js b/src/mixins/Json2Vue.js index cda7220d5..bb0778f7d 100644 --- a/src/mixins/Json2Vue.js +++ b/src/mixins/Json2Vue.js @@ -284,7 +284,7 @@ export default { Object.keys(component.watch).forEach((key) => { const watch = { deep: true }; component.watch[key].forEach(w => Object.assign(watch, w.options)); - watch.handler = new Function('value', component.watch[key].map(w => w.code).join('\n')); + watch.handler = new Function('value', component.watch[key].map(w => `try{${w.code}}catch(e){console.warn(e)}`).join('\n')); component.watch[key] = watch; }); // Add validation rules diff --git a/src/mixins/extensions/LoadFieldComponents.js b/src/mixins/extensions/LoadFieldComponents.js index a5a34564c..e36bd35fe 100644 --- a/src/mixins/extensions/LoadFieldComponents.js +++ b/src/mixins/extensions/LoadFieldComponents.js @@ -26,7 +26,7 @@ export default { } }); }, - loadFieldProperties({ properties, element, componentName, definition , formIndex}) { + loadFieldProperties({ properties, element, componentName, definition , formIndex, screen}) { properties.class = this.elementCssClass(element); properties[':validation-data'] = 'getValidationData()'; @@ -38,7 +38,19 @@ export default { properties[':image'] = this.byRef(element.config.image); } else if (this.validVariableName(element.config.name)) { this.registerVariable(element.config.name, element); - properties['v-model'] = `${element.config.name}`; + // v-model are not assigned directly to the field name, to prevent invalid references like: + // `person.content` when `person`=null + const computed_property = `computedProxy__${element.config.name.split('.').join('_DOT_')}`; + properties['v-model'] = computed_property; + screen.computed[computed_property] = { + get() { + return this.getValue(element.config.name); + }, + set(value) { + this.setValue(element.config.name, value); + return true; + }, + }; } } // Do not replace mustache in RichText control, it is replaced by the control diff --git a/tests/e2e/fixtures/FOUR-4849.json b/tests/e2e/fixtures/FOUR-4849.json new file mode 100644 index 000000000..bfb6b07b5 --- /dev/null +++ b/tests/e2e/fixtures/FOUR-4849.json @@ -0,0 +1 @@ +{"type":"screen_package","version":"2","screens":[{"id":1724,"screen_category_id":"3","title":"FOUR-4849","description":"FOUR-4849","type":"FORM","config":[{"name":"FOUR-4849","items":[{"label":"Rich Text","config":{"icon":"fas fa-pencil-ruler","label":null,"content":"
Checkbox<\/p>","interactive":true,"renderVarHtml":false},"component":"FormHtmlViewer","inspector":[{"type":"FormTextArea","field":"content","config":{"rows":5,"label":"Content","value":null,"helper":"The HTML text to display"}},{"type":"FormCheckbox","field":"renderVarHtml","config":{"label":"Render HTML from a Variable","value":null,"helper":null}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormHtmlEditor","editor-component":"FormHtmlEditor"},{"items":[[{"label":"Checkbox","config":{"icon":"fas fa-check-square","name":"check","label":"check","helper":null,"toggle":false,"disabled":false,"validation":[],"initiallyChecked":false},"component":"FormCheckbox","inspector":[{"type":"FormInput","field":"name","config":{"name":"Variable Name","label":"Variable Name","helper":"A variable name is a symbolic name to reference information.","validation":"regex:\/^(?:[A-Za-z])(?:[0-9A-Z_a-z])*(?:\\.[0-9A-Z_a-z]+)*$\/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super"}},{"type":"FormInput","field":"label","config":{"label":"Label","helper":"The label describes the field's name"}},{"type":"FormInput","field":"helper","config":{"label":"Helper Text","helper":"Help text is meant to provide additional guidance on the field's value"}},{"type":"ValidationSelect","field":"validation","config":{"label":"Validation Rules","helper":"The validation rules needed for this field"}},{"type":"FormCheckbox","field":"initiallyChecked","config":{"label":"Checked by default","helper":"Should the checkbox be checked by default"}},{"type":"ColorSelect","field":"color","config":{"label":"Text Color","helper":"Set the element's text color","options":[{"value":"text-primary","content":"primary"},{"value":"text-secondary","content":"secondary"},{"value":"text-success","content":"success"},{"value":"text-danger","content":"danger"},{"value":"text-warning","content":"warning"},{"value":"text-info","content":"info"},{"value":"text-light","content":"light"},{"value":"text-dark","content":"dark"}]}},{"type":"ColorSelect","field":"bgcolor","config":{"label":"Background Color","helper":"Set the element's background color","options":[{"value":"alert alert-primary","content":"primary"},{"value":"alert alert-secondary","content":"secondary"},{"value":"alert alert-success","content":"success"},{"value":"alert alert-danger","content":"danger"},{"value":"alert alert-warning","content":"warning"},{"value":"alert alert-info","content":"info"},{"value":"alert alert-light","content":"light"},{"value":"alert alert-dark","content":"dark"}]}},{"type":"FormCheckbox","field":"toggle","config":{"label":"Toggle Style","helper":null}},{"type":"FormCheckbox","field":"disabled","config":{"label":"Read Only","helper":null}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormCheckbox","editor-component":"FormCheckbox"}],[{"label":"Line Input","config":{"icon":"far fa-square","name":"select1.form_input_1","type":"text","label":"Visibility check enable","helper":null,"readonly":false,"dataFormat":"string","validation":[],"placeholder":null,"conditionalHide":"check"},"component":"FormInput","inspector":[{"type":"FormInput","field":"name","config":{"name":"Variable Name","label":"Variable Name","helper":"A variable name is a symbolic name to reference information.","validation":"regex:\/^(?:[A-Za-z])(?:[0-9A-Z_a-z])*(?:\\.[0-9A-Z_a-z]+)*$\/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super"}},{"type":"FormInput","field":"label","config":{"label":"Label","helper":"The label describes the field's name"}},{"type":"FormMultiselect","field":"dataFormat","config":{"name":"Data Type","label":"Data Type","helper":"The data type specifies what kind of data is stored in the variable.","options":[{"value":"string","content":"Text"},{"value":"int","content":"Integer"},{"value":"currency","content":"Currency"},{"value":"percentage","content":"Percentage"},{"value":"float","content":"Decimal"},{"value":"datetime","content":"Datetime"},{"value":"date","content":"Date"},{"value":"password","content":"Password"}],"validation":"required"}},{"type":{"extends":{"props":["label","error","options","helper","name","value","selectedControl"],"mixins":[{"props":{"validation":{"type":null},"validationData":{"type":null},"validationField":{"type":null},"validationMessages":{"type":null}},"watch":{"validationData":{"deep":true}},"methods":[],"computed":[]}],"methods":[],"computed":[],"_compiled":true,"components":{"Multiselect":{"name":"vue-multiselect","props":{"name":{"default":null},"limit":{"default":99999},"loading":{"default":false},"disabled":{"default":false},"tabindex":{"default":0},"limitText":[],"maxHeight":{"default":300},"showLabels":{"default":true},"selectLabel":{"default":"Press enter to select"},"deselectLabel":{"default":"Press enter to remove"},"openDirection":{"default":null},"selectedLabel":{"default":"Selected"},"showNoOptions":{"default":true},"showNoResults":{"default":true},"selectGroupLabel":{"default":"Press enter to select group"},"deselectGroupLabel":{"default":"Press enter to deselect group"}},"mixins":[{"props":{"id":{"default":null},"max":{"type":[null,null],"default":false},"label":[],"value":{"type":null},"options":{"required":true},"trackBy":[],"multiple":{"default":false},"taggable":{"default":false},"blockKeys":[],"allowEmpty":{"default":true},"groupLabel":[],"resetAfter":{"default":false},"searchable":{"default":true},"customLabel":[],"groupSelect":{"default":false},"groupValues":[],"placeholder":{"default":"Select option"},"tagPosition":{"default":"top"},"hideSelected":{"default":false},"optionsLimit":{"default":1000},"clearOnSelect":{"default":true},"closeOnSelect":{"default":true},"internalSearch":{"default":true},"preselectFirst":{"default":false},"preserveSearch":{"default":false},"tagPlaceholder":{"default":"Press enter to create a tag"}},"watch":[],"methods":[],"computed":[]},{"props":{"showPointer":{"default":true},"optionHeight":{"default":40}},"watch":[],"methods":[],"computed":[]}],"computed":[],"_compiled":true,"beforeCreate":[null],"staticRenderFns":[]}},"inheritAttrs":false,"staticRenderFns":[]},"computed":[],"_compiled":true,"staticRenderFns":[]},"field":"dataMask","config":{"name":"Data Format","label":"Data Format","helper":"The data format for the selected type."}},{"type":"ValidationSelect","field":"validation","config":{"label":"Validation Rules","helper":"The validation rules needed for this field"}},{"type":"FormInput","field":"placeholder","config":{"label":"Placeholder Text","helper":"The placeholder is what is shown in the field when no value is provided yet"}},{"type":"FormInput","field":"helper","config":{"label":"Helper Text","helper":"Help text is meant to provide additional guidance on the field's value"}},{"type":"FormCheckbox","field":"readonly","config":{"label":"Read Only","helper":null}},{"type":"ColorSelect","field":"color","config":{"label":"Text Color","helper":"Set the element's text color","options":[{"value":"text-primary","content":"primary"},{"value":"text-secondary","content":"secondary"},{"value":"text-success","content":"success"},{"value":"text-danger","content":"danger"},{"value":"text-warning","content":"warning"},{"value":"text-info","content":"info"},{"value":"text-light","content":"light"},{"value":"text-dark","content":"dark"}]}},{"type":"ColorSelect","field":"bgcolor","config":{"label":"Background Color","helper":"Set the element's background color","options":[{"value":"alert alert-primary","content":"primary"},{"value":"alert alert-secondary","content":"secondary"},{"value":"alert alert-success","content":"success"},{"value":"alert alert-danger","content":"danger"},{"value":"alert alert-warning","content":"warning"},{"value":"alert alert-info","content":"info"},{"value":"alert alert-light","content":"light"},{"value":"alert alert-dark","content":"dark"}]}},{"type":{"props":["value","helper"],"watch":{"value":{"immediate":true}},"methods":[],"_scopeId":"data-v-7c18055b","computed":{"effectiveValue":[]},"_compiled":true,"components":{"MonacoEditor":{"name":"monaco-editor","_Ctor":[],"props":{"amdRequire":[]},"extends":{"name":"MonacoEditor","model":{"event":"change"},"props":{"theme":{"default":"vs"},"value":{"required":true},"options":[],"language":[],"original":[],"amdRequire":[],"diffEditor":{"default":false}},"watch":{"options":{"deep":true,"user":true}},"methods":[]},"methods":[]}},"staticRenderFns":[]},"field":"defaultValue","config":{"label":"Default Value","helper":"The default value is pre populated using the existing request data. This feature will allow you to modify the value displayed on screen load if needed."}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormInput","editor-component":"FormInput"}]],"label":"Multicolumn \/ Table","config":{"icon":"fas fa-table","label":null,"options":[{"value":"1","content":"6"},{"value":"2","content":"6"}]},"component":"FormMultiColumn","container":true,"inspector":[{"type":"ContainerColumns","field":"options","config":{"label":"Column Width","helper":null,"validation":"columns-adds-to-12"}},{"type":"ColorSelect","field":"color","config":{"label":"Text Color","helper":"Set the element's text color","options":[{"value":"text-primary","content":"primary"},{"value":"text-secondary","content":"secondary"},{"value":"text-success","content":"success"},{"value":"text-danger","content":"danger"},{"value":"text-warning","content":"warning"},{"value":"text-info","content":"info"},{"value":"text-light","content":"light"},{"value":"text-dark","content":"dark"}]}},{"type":"ColorSelect","field":"bgcolor","config":{"label":"Background Color","helper":"Set the element's background color","options":[{"value":"alert alert-primary","content":"primary"},{"value":"alert alert-secondary","content":"secondary"},{"value":"alert alert-success","content":"success"},{"value":"alert alert-danger","content":"danger"},{"value":"alert alert-warning","content":"warning"},{"value":"alert alert-info","content":"info"},{"value":"alert alert-light","content":"light"},{"value":"alert alert-dark","content":"dark"}]}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormMultiColumn","editor-component":"MultiColumn"},{"label":"Rich Text","config":{"icon":"fas fa-pencil-ruler","label":null,"content":"
select list<\/p>","interactive":true,"renderVarHtml":false},"component":"FormHtmlViewer","inspector":[{"type":"FormTextArea","field":"content","config":{"rows":5,"label":"Content","value":null,"helper":"The HTML text to display"}},{"type":"FormCheckbox","field":"renderVarHtml","config":{"label":"Render HTML from a Variable","value":null,"helper":null}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormHtmlEditor","editor-component":"FormHtmlEditor"},{"items":[[{"label":"Line Input","config":{"icon":"far fa-square","name":"person.content","type":"text","label":"person.content","helper":null,"readonly":false,"dataFormat":"string","validation":[],"placeholder":null},"component":"FormInput","inspector":[{"type":"FormInput","field":"name","config":{"name":"Variable Name","label":"Variable Name","helper":"A variable name is a symbolic name to reference information.","validation":"regex:\/^(?:[A-Za-z])(?:[0-9A-Z_a-z])*(?:\\.[0-9A-Z_a-z]+)*$\/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super"}},{"type":"FormInput","field":"label","config":{"label":"Label","helper":"The label describes the field's name"}},{"type":"FormMultiselect","field":"dataFormat","config":{"name":"Data Type","label":"Data Type","helper":"The data type specifies what kind of data is stored in the variable.","options":[{"value":"string","content":"Text"},{"value":"int","content":"Integer"},{"value":"currency","content":"Currency"},{"value":"percentage","content":"Percentage"},{"value":"float","content":"Decimal"},{"value":"datetime","content":"Datetime"},{"value":"date","content":"Date"},{"value":"password","content":"Password"}],"validation":"required"}},{"type":{"_Ctor":[],"extends":{"_Ctor":[],"props":{"name":{"type":null},"error":{"type":null},"label":{"type":null},"value":{"type":null},"helper":{"type":null},"options":{"type":null},"selectedControl":{"type":null}},"mixins":[{"props":{"validation":{"type":null},"validationData":{"type":null},"validationField":{"type":null},"validationMessages":{"type":null}},"watch":{"validationData":{"deep":true,"user":true}},"methods":[],"computed":[]}],"methods":[],"computed":[],"_compiled":true,"components":{"Multiselect":{"name":"vue-multiselect","_Ctor":[],"props":{"name":{"default":null},"limit":{"default":99999},"loading":{"default":false},"disabled":{"default":false},"tabindex":{"default":0},"limitText":[],"maxHeight":{"default":300},"showLabels":{"default":true},"selectLabel":{"default":"Press enter to select"},"deselectLabel":{"default":"Press enter to remove"},"openDirection":{"default":null},"selectedLabel":{"default":"Selected"},"showNoOptions":{"default":true},"showNoResults":{"default":true},"selectGroupLabel":{"default":"Press enter to select group"},"deselectGroupLabel":{"default":"Press enter to deselect group"}},"mixins":[{"props":{"id":{"default":null},"max":{"type":[null,null],"default":false},"label":[],"value":{"type":null},"options":{"required":true},"trackBy":[],"multiple":{"default":false},"taggable":{"default":false},"blockKeys":[],"allowEmpty":{"default":true},"groupLabel":[],"resetAfter":{"default":false},"searchable":{"default":true},"customLabel":[],"groupSelect":{"default":false},"groupValues":[],"placeholder":{"default":"Select option"},"tagPosition":{"default":"top"},"hideSelected":{"default":false},"optionsLimit":{"default":1000},"clearOnSelect":{"default":true},"closeOnSelect":{"default":true},"internalSearch":{"default":true},"preselectFirst":{"default":false},"preserveSearch":{"default":false},"tagPlaceholder":{"default":"Press enter to create a tag"}},"watch":[],"methods":[],"computed":[]},{"props":{"showPointer":{"default":true},"optionHeight":{"default":40}},"watch":[],"methods":[],"computed":[]}],"computed":[],"_compiled":true,"beforeCreate":[null],"staticRenderFns":[]}},"inheritAttrs":false,"staticRenderFns":[]},"computed":[],"_compiled":true,"staticRenderFns":[]},"field":"dataMask","config":{"name":"Data Format","label":"Data Format","helper":"The data format for the selected type."}},{"type":"ValidationSelect","field":"validation","config":{"label":"Validation Rules","helper":"The validation rules needed for this field"}},{"type":"FormInput","field":"placeholder","config":{"label":"Placeholder Text","helper":"The placeholder is what is shown in the field when no value is provided yet"}},{"type":"FormInput","field":"helper","config":{"label":"Helper Text","helper":"Help text is meant to provide additional guidance on the field's value"}},{"type":"FormCheckbox","field":"readonly","config":{"label":"Read Only","helper":null}},{"type":"ColorSelect","field":"color","config":{"label":"Text Color","helper":"Set the element's text color","options":[{"value":"text-primary","content":"primary"},{"value":"text-secondary","content":"secondary"},{"value":"text-success","content":"success"},{"value":"text-danger","content":"danger"},{"value":"text-warning","content":"warning"},{"value":"text-info","content":"info"},{"value":"text-light","content":"light"},{"value":"text-dark","content":"dark"}]}},{"type":"ColorSelect","field":"bgcolor","config":{"label":"Background Color","helper":"Set the element's background color","options":[{"value":"alert alert-primary","content":"primary"},{"value":"alert alert-secondary","content":"secondary"},{"value":"alert alert-success","content":"success"},{"value":"alert alert-danger","content":"danger"},{"value":"alert alert-warning","content":"warning"},{"value":"alert alert-info","content":"info"},{"value":"alert alert-light","content":"light"},{"value":"alert alert-dark","content":"dark"}]}},{"type":{"_Ctor":[],"props":{"value":{"type":null},"helper":{"type":null}},"watch":{"value":{"user":true,"immediate":true}},"methods":[],"_scopeId":"data-v-7c18055b","computed":{"effectiveValue":[]},"_compiled":true,"components":{"MonacoEditor":{"name":"monaco-editor","_Ctor":[],"props":{"amdRequire":[]},"extends":{"name":"MonacoEditor","model":{"event":"change"},"props":{"theme":{"default":"vs"},"value":{"required":true},"options":[],"language":[],"original":[],"amdRequire":[],"diffEditor":{"default":false}},"watch":{"options":{"deep":true,"user":true}},"methods":[]},"methods":[]}},"staticRenderFns":[]},"field":"defaultValue","config":{"label":"Default Value","helper":"The default value is pre populated using the existing request data. This feature will allow you to modify the value displayed on screen load if needed."}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormInput","editor-component":"FormInput"}],[{"label":"Select List","config":{"icon":"fas fa-angle-double-down","name":"person","label":"person","helper":null,"options":{"key":"value","value":"content","dataName":"response","jsonData":"[{\"content\":\"1\",\"value\":\"1\"}]","renderAs":"dropdown","editIndex":null,"pmqlQuery":null,"dataSource":"provideData","optionsList":[{"value":"1","content":"1"}],"removeIndex":null,"showRenderAs":true,"showJsonEditor":false,"showOptionCard":false,"selectedOptions":[],"allowMultiSelect":false,"showRemoveWarning":false,"valueTypeReturned":"object"},"readonly":false,"validation":[],"placeholder":null,"rootElement":"response","dataSourceUrl":null,"dataSourceEndpoint":null},"component":"FormSelectList","inspector":[{"type":"FormInput","field":"name","config":{"name":"Variable Name","label":"Variable Name","helper":"A variable name is a symbolic name to reference information.","validation":"regex:\/^(?:[A-Za-z])(?:[0-9A-Z_a-z])*(?:\\.[0-9A-Z_a-z]+)*$\/|required|not_in:null,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,const,enum,export,extends,import,super"}},{"type":"FormInput","field":"label","config":{"label":"Label","helper":"The label describes the field's name"}},{"type":"FormInput","field":"placeholder","config":{"label":"Placeholder Text","helper":"The placeholder is what is shown in the field when no value is provided yet"}},{"type":"ValidationSelect","field":"validation","config":{"label":"Validation Rules","helper":"The validation rules needed for this field"}},{"type":"FormInput","field":"helper","config":{"label":"Helper Text","helper":"Help text is meant to provide additional guidance on the field's value"}},{"type":"OptionsList","field":"options","config":{"label":null,"helper":null}},{"type":"ColorSelect","field":"color","config":{"label":"Text Color","helper":"Set the element's text color","options":[{"value":"text-primary","content":"primary"},{"value":"text-secondary","content":"secondary"},{"value":"text-success","content":"success"},{"value":"text-danger","content":"danger"},{"value":"text-warning","content":"warning"},{"value":"text-info","content":"info"},{"value":"text-light","content":"light"},{"value":"text-dark","content":"dark"}]}},{"type":"ColorSelect","field":"bgcolor","config":{"label":"Background Color","helper":"Set the element's background color","options":[{"value":"alert alert-primary","content":"primary"},{"value":"alert alert-secondary","content":"secondary"},{"value":"alert alert-success","content":"success"},{"value":"alert alert-danger","content":"danger"},{"value":"alert alert-warning","content":"warning"},{"value":"alert alert-info","content":"info"},{"value":"alert alert-light","content":"light"},{"value":"alert alert-dark","content":"dark"}]}},{"type":{"_Ctor":[],"props":{"value":{"type":null},"helper":{"type":null}},"watch":{"value":{"user":true,"immediate":true}},"methods":[],"_scopeId":"data-v-7c18055b","computed":{"effectiveValue":[]},"_compiled":true,"components":{"MonacoEditor":{"name":"monaco-editor","_Ctor":[],"props":{"amdRequire":[]},"extends":{"name":"MonacoEditor","model":{"event":"change"},"props":{"theme":{"default":"vs"},"value":{"required":true},"options":[],"language":[],"original":[],"amdRequire":[],"diffEditor":{"default":false}},"watch":{"options":{"deep":true,"user":true}},"methods":[]},"methods":[]}},"staticRenderFns":[]},"field":"defaultValue","config":{"label":"Default Value","helper":"The default value is pre populated using the existing request data. This feature will allow you to modify the value displayed on screen load if needed."}},{"type":"FormCheckbox","field":"readonly","config":{"label":"Read Only","helper":null}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormSelectList","editor-component":"FormSelectList"}]],"label":"Multicolumn \/ Table","config":{"icon":"fas fa-table","label":null,"options":[{"value":"1","content":"6"},{"value":"2","content":"6"}]},"component":"FormMultiColumn","container":true,"inspector":[{"type":"ContainerColumns","field":"options","config":{"label":"Column Width","validation":"columns-adds-to-12"}},{"type":"ColorSelect","field":"color","config":{"label":"Text Color","helper":"Set the element's text color","options":[{"value":"text-primary","content":"primary"},{"value":"text-secondary","content":"secondary"},{"value":"text-success","content":"success"},{"value":"text-danger","content":"danger"},{"value":"text-warning","content":"warning"},{"value":"text-info","content":"info"},{"value":"text-light","content":"light"},{"value":"text-dark","content":"dark"}]}},{"type":"ColorSelect","field":"bgcolor","config":{"label":"Background Color","helper":"Set the element's background color","options":[{"value":"alert alert-primary","content":"primary"},{"value":"alert alert-secondary","content":"secondary"},{"value":"alert alert-success","content":"success"},{"value":"alert alert-danger","content":"danger"},{"value":"alert alert-warning","content":"warning"},{"value":"alert alert-info","content":"info"},{"value":"alert alert-light","content":"light"},{"value":"alert alert-dark","content":"dark"}]}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"MultiColumn","editor-component":"MultiColumn"},{"label":"Submit Button","config":{"icon":"fas fa-share-square","name":null,"event":"submit","label":"New Submit","variant":"primary","fieldValue":null,"defaultSubmit":true},"component":"FormButton","inspector":[{"type":"FormInput","field":"label","config":{"label":"Label","helper":"The label describes the button's text"}},{"type":"FormInput","field":"name","config":{"name":"Variable Name","label":"Variable Name","helper":"A variable name is a symbolic name to reference information."}},{"type":"FormMultiselect","field":"event","config":{"label":"Type","helper":"Choose whether the button should submit the form","options":[{"value":"submit","content":"Submit Button"},{"value":"script","content":"Regular Button"}]}},{"type":"FormInput","field":"fieldValue","config":{"label":"Value","helper":"The value being submitted"}},{"type":"FormMultiselect","field":"variant","config":{"label":"Button Variant Style","helper":"The variant determines the appearance of the button","options":[{"value":"primary","content":"Primary"},{"value":"secondary","content":"Secondary"},{"value":"success","content":"Success"},{"value":"danger","content":"Danger"},{"value":"warning","content":"Warning"},{"value":"info","content":"Info"},{"value":"light","content":"Light"},{"value":"dark","content":"Dark"},{"value":"link","content":"Link"}]}},{"type":"FormInput","field":"conditionalHide","config":{"label":"Visibility Rule","helper":"This control is hidden until this expression is true"}},{"type":"FormInput","field":"customFormatter","config":{"label":"Custom Format String","helper":"Use the Mask Pattern format
Date ##\/##\/####
SSN ###-##-####
Phone (###) ###-####","validation":null}},{"type":"FormInput","field":"customCssSelector","config":{"label":"CSS Selector Name","helper":"Use this in your custom css rules","validation":"regex: [-?[_a-zA-Z]+[_-a-zA-Z0-9]*]"}}],"editor-control":"FormSubmit","editor-component":"FormButton"}]}],"computed":[],"custom_css":null,"created_at":"2021-12-07T17:10:50+00:00","updated_at":"2021-12-15T13:29:02+00:00","status":"ACTIVE","key":null,"watchers":[{"input_data":"{}","script_configuration":"{}","synchronous":false,"name":"test","watching":"form_input_1","script":{"id":"script-144","key":null,"title":"Script to fill Screen with PDF 5","description":"Script to fill Screen with PDF","language":"php","code":" 'PAGE '.$i\n ]);\n}\n\nreturn [\"loop_1\" => $loop_1];","timeout":60,"run_as_user_id":2,"created_at":"2021-09-20T19:55:22+00:00","updated_at":"2021-11-16T17:24:12+00:00","status":"ACTIVE","script_category_id":"1","script_executor_id":3},"script_id":"144","script_key":null,"output_variable":"test","uid":"16389023986121"}],"categories":[{"id":3,"name":"catScreenPao","status":"ACTIVE","is_system":0,"created_at":"2021-02-02T16:09:50+00:00","updated_at":"2021-10-05T16:39:41+00:00","pivot":{"assignable_id":1724,"category_id":3,"category_type":"ProcessMaker\\Models\\ScreenCategory"}}]}],"screen_categories":[],"scripts":[]}
\ No newline at end of file
diff --git a/tests/e2e/specs/FOUR4849.spec.js b/tests/e2e/specs/FOUR4849.spec.js
new file mode 100644
index 000000000..b93da7e24
--- /dev/null
+++ b/tests/e2e/specs/FOUR4849.spec.js
@@ -0,0 +1,55 @@
+describe('Tests null object property bind to an input text', () => {
+ beforeEach(() => {
+ cy.server();
+ cy.visit('/');
+ });
+
+ it('Verify visibility rules do not break', () => {
+ cy.loadFromJson('FOUR-4849.json', 0);
+ cy.get('[data-cy=mode-preview]').click();
+
+ // When the person is null, the visibility rules should be working
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').should('not.be.visible');
+ cy.get('[data-cy=preview-content] [name=check]').click();
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').should('be.visible');
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').clear().type('it works with person=null');
+
+ cy.get('[data-cy=preview-content] [data-cy="screen-field-person"]').selectOption('1');
+
+ // When a person is selected, the visibility rules should still be working
+ cy.get('[data-cy=preview-content] [name=check]').click();
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').should('not.be.visible');
+ cy.get('[data-cy=preview-content] [name=check]').click();
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').should('be.visible');
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').clear().type('still working with person=1');
+ // Check the data of the screen
+ cy.assertPreviewData({
+ 'check': true,
+ 'select1': {
+ 'form_input_1': 'still working with person=1',
+ },
+ 'person': {
+ 'value': '1',
+ 'content': '1',
+ },
+ });
+
+ cy.get('[data-cy=preview-content] [data-cy="screen-field-person"]').unselectOption('1');
+
+ // When the person is deselected, the visibility rules should still be working
+ cy.get('[data-cy=preview-content] [name=check]').click();
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').should('not.be.visible');
+ cy.get('[data-cy=preview-content] [name=check]').click();
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').should('be.visible');
+ cy.get('[data-cy=preview-content] [name="select1.form_input_1"]').clear().type('still working with person back to null');
+
+ // Check the data of the screen
+ cy.assertPreviewData({
+ 'check': true,
+ 'select1': {
+ 'form_input_1': 'still working with person back to null',
+ },
+ 'person': null,
+ });
+ });
+});
diff --git a/tests/e2e/support/commands.js b/tests/e2e/support/commands.js
index b1511ba20..0f426488b 100644
--- a/tests/e2e/support/commands.js
+++ b/tests/e2e/support/commands.js
@@ -173,3 +173,8 @@ Cypress.Commands.add('selectOption', { prevSubject: true }, (subject, option) =>
cy.get(subject).find('input').clear().type(option);
cy.get(subject).find(`span:not(.multiselect__option--disabled) span:contains("${option}"):first`).click();
});
+
+Cypress.Commands.add('unselectOption', { prevSubject: true }, (subject, option) => {
+ cy.get(subject).click();
+ cy.get(subject).find(`span:not(.multiselect__option--disabled) span:contains("${option}"):first`).click();
+});