formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.86k stars 1.05k forks source link

FIO-4871: Fixed calculated value for data grid component #5448

Closed roma-formio closed 7 months ago

roma-formio commented 7 months ago

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-4871

Description

When the DataGrid component has the default 1st row, we can find some fields already have empty values in JSON. This is a reason why the calculated value doesn't apply for DataGrid with allow override. I tried to change this logic and save DataGrid with an empty array without nested fields. As a result, it caused a lot of tests to fail and can be an issue with the compatibility of existing forms. So I changed the isEmpty method for DataGrid to skip default empty fields and apply calculated value.

How has this PR been tested?

Unit testing

Checklist: