dynamic-mui 1.0.42 → 1.0.44

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.
@@ -76,7 +76,7 @@ function Stepper(_ref) {
76
76
  if (isLastStep) {
77
77
  onChange === null || onChange === void 0 || onChange({
78
78
  id: attributes.id,
79
- value: stepperResponse
79
+ value: stepperResponse[attributes.id] || {}
80
80
  });
81
81
  }
82
82
  };
@@ -107,7 +107,9 @@ function Stepper(_ref) {
107
107
  mt: 1,
108
108
  mr: 1
109
109
  }
110
- }, attributes.MuiButtonAttributes.back), index === attributes.MuiSteps.length - 1 ? attributes.MuiButtonAttributes.finalLabel || 'Finish' : attributes.MuiButtonAttributes.nextLabel || 'Continue'), /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
110
+ }, attributes.MuiButtonAttributes.next, index === attributes.MuiSteps.length - 1 && {
111
+ ...attributes.MuiButtonAttributes.final
112
+ }), index === attributes.MuiSteps.length - 1 ? attributes.MuiButtonAttributes.finalLabel || 'Finish' : attributes.MuiButtonAttributes.nextLabel || 'Continue'), /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
111
113
  disabled: index === 0,
112
114
  onClick: () => handleStepChange('PREVIOUS_STEP', isScreenChange, false),
113
115
  sx: {
@@ -130,7 +132,7 @@ function Stepper(_ref) {
130
132
  }, attributes.MuiStepLabelOptionalLabel || 'Last step')
131
133
  }, attributes.MuiStepLabelAttributes), step.label), /*#__PURE__*/_react.default.createElement(_StepContent.default, attributes.MuiStepContentAttributes, step.components ? /*#__PURE__*/_react.default.createElement(_stepperComponents.default, {
132
134
  onUpdate: handleUpdate,
133
- components: (0, _helper.updatePatchData)(step.components, stepperResponse[attributes.id], attributes.id, stepperResponse)
135
+ components: (0, _helper.updatePatchData)(step.components, stepperResponse[attributes.id] || {}, attributes.id, stepperResponse || {})
134
136
  }) : /*#__PURE__*/_react.default.createElement(_Typography.default, null, step.description), renderStepButtons(index, step.isScreenChange))))));
135
137
  }
136
138
  Stepper.propTypes = process.env.NODE_ENV !== "production" ? {
@@ -79,22 +79,28 @@ function isEmptyCustom(value) {
79
79
  value.constructor === Object && Object.keys(value).length === 0
80
80
  );
81
81
  }
82
- const updatePatchData = (fields, patch, guid, response) => {
83
- response[guid] = patch;
84
- const formData = Object.assign([], fields);
85
- // if (isEmpty(patch)) return fields;
86
- return (0, _lodash.map)(formData, field => {
87
- var _newField$props;
88
- const newField = {
89
- ...field
90
- };
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);
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;
95
- }
96
- return newField;
97
- });
82
+ const updatePatchData = function (fields, patch, guid) {
83
+ let response = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
84
+ try {
85
+ response[guid] = patch;
86
+ const formData = Object.assign([], fields);
87
+ return (0, _lodash.map)(formData, field => {
88
+ var _newField$props;
89
+ const newField = {
90
+ ...field
91
+ };
92
+ 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);
93
+ if (id && response[guid] && !isEmptyCustom(response[guid][id])) {
94
+ const defaultValue = (newField === null || newField === void 0 ? void 0 : newField.type) === 'switch' || (newField === null || newField === void 0 ? void 0 : newField.type) === 'checkbox' ? false : '';
95
+ newField.props.value = response[guid][id] || defaultValue;
96
+ }
97
+ return newField;
98
+ });
99
+ } catch (e) {
100
+ // eslint-disable-next-line no-console
101
+ console.log(e);
102
+ return fields;
103
+ }
98
104
  };
99
105
  exports.updatePatchData = updatePatchData;
100
106
  const DateComponent = name => {
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "files": {
3
- "main.js": "/DinakaranS/-dynamic-mui/build/main.5b2b2fe7.js",
4
- "runtime-main.js": "/DinakaranS/-dynamic-mui/build/bundle.2d61df25.js",
5
- "build/2.8784a577.js": "/DinakaranS/-dynamic-mui/build/2.8784a577.js",
6
- "build/2.8784a577.js.LICENSE.txt": "/DinakaranS/-dynamic-mui/build/2.8784a577.js.LICENSE.txt",
3
+ "main.js": "/DinakaranS/-dynamic-mui/build/bundle.b84aecd9.js",
7
4
  "index.html": "/DinakaranS/-dynamic-mui/index.html"
8
5
  },
9
6
  "entrypoints": [
10
- "build/bundle.2d61df25.js",
11
- "build/2.8784a577.js",
12
- "build/main.5b2b2fe7.js"
7
+ "build/bundle.b84aecd9.js"
13
8
  ]
14
9
  }