dynamic-mui 1.0.37 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,7 +72,7 @@ const checkBoxCustom = exports.checkBoxCustom = [{
72
72
  type: 'checkbox',
73
73
  props: {
74
74
  id: 'label',
75
- value: true,
75
+ value: false,
76
76
  MuiAttributes: {},
77
77
  MuiFCLAttributes: {
78
78
  label: 'Label'
@@ -68,6 +68,17 @@ const generateKey = function () {
68
68
  return "".concat(prefix, "_").concat(index, "_").concat(random, "_").concat(currentTime);
69
69
  };
70
70
  exports.generateKey = generateKey;
71
+ function isEmptyCustom(value) {
72
+ return (
73
+ // null or undefined
74
+ value == null ||
75
+ // has length and it's zero
76
+ // eslint-disable-next-line no-prototype-builtins
77
+ value.hasOwnProperty('length') && value.length === 0 ||
78
+ // is an Object and has no keys
79
+ value.constructor === Object && Object.keys(value).length === 0
80
+ );
81
+ }
71
82
  const updatePatchData = (fields, patch, guid, response) => {
72
83
  response[guid] = patch;
73
84
  const formData = Object.assign([], fields);
@@ -78,8 +89,9 @@ const updatePatchData = (fields, patch, guid, response) => {
78
89
  ...field
79
90
  };
80
91
  const id = (newField === null || newField === void 0 ? void 0 : newField.id) || (newField === null || newField === void 0 || (_newField$props = newField.props) === null || _newField$props === void 0 ? void 0 : _newField$props.id);
81
- if (id && response[guid][id]) {
82
- newField.props.value = response[guid][id] || '';
92
+ if (id && !isEmptyCustom(response[guid][id])) {
93
+ const defaultValue = (newField === null || newField === void 0 ? void 0 : newField.type) === 'switch' || (newField === null || newField === void 0 ? void 0 : newField.type) === 'checkbox' ? false : '';
94
+ newField.props.value = response[guid][id] || defaultValue;
83
95
  }
84
96
  return newField;
85
97
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamic-mui",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "author": "Dinakaran S",
5
5
  "user": "dinakarans",
6
6
  "repository": {