dynamic-mui 1.0.45 → 1.0.46

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.
@@ -114,7 +114,8 @@ function FormGenerator(_ref) {
114
114
  rules: rules,
115
115
  onChange: onUpdate,
116
116
  onStepUpdate: onStepUpdate,
117
- currentStep: activeStep
117
+ currentStep: activeStep,
118
+ patch: patch
118
119
  }));
119
120
  };
120
121
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Grid.default, _extends({
@@ -46,10 +46,7 @@ function reducer(state, action) {
46
46
  ...state,
47
47
  stepperResponse: {
48
48
  ...state.stepperResponse,
49
- [action.guid]: {
50
- ...state.stepperResponse[action.guid],
51
- [action.id]: action.value
52
- }
49
+ [action.id]: action.value
53
50
  }
54
51
  };
55
52
  }
@@ -57,24 +54,33 @@ function reducer(state, action) {
57
54
  return state;
58
55
  }
59
56
  }
57
+ const response = {};
60
58
  function Stepper(_ref) {
61
59
  let {
62
60
  attributes,
63
61
  onChange,
64
62
  onStepUpdate,
65
- currentStep
63
+ currentStep,
64
+ patch
66
65
  } = _ref;
67
66
  const [state, dispatch] = (0, _react.useReducer)(reducer, {
68
67
  ...initialState,
69
68
  activeStep: currentStep,
70
69
  stepperResponse: {
71
- [attributes.id]: attributes.value
70
+ ...patch
72
71
  }
73
72
  });
74
73
  const {
75
74
  activeStep,
76
75
  stepperResponse
77
76
  } = state;
77
+ (0, _react.useEffect)(() => {
78
+ response[attributes.id] = {
79
+ ...patch
80
+ };
81
+ // eslint-disable-next-line no-return-assign
82
+ return () => response[attributes.id] = {};
83
+ }, [patch]);
78
84
  (0, _react.useEffect)(() => {
79
85
  dispatch({
80
86
  type: 'PATCH_STEP',
@@ -89,7 +95,7 @@ function Stepper(_ref) {
89
95
  if (isLastStep) {
90
96
  onChange === null || onChange === void 0 || onChange({
91
97
  id: attributes.id,
92
- value: stepperResponse[attributes.id] || {}
98
+ value: response
93
99
  });
94
100
  }
95
101
  };
@@ -98,9 +104,9 @@ function Stepper(_ref) {
98
104
  id,
99
105
  value
100
106
  } = _ref2;
107
+ response[attributes.id][id] = value;
101
108
  dispatch({
102
109
  type: 'UPDATE_RESPONSE',
103
- guid: attributes.id,
104
110
  id,
105
111
  value
106
112
  });
@@ -145,7 +151,7 @@ function Stepper(_ref) {
145
151
  }, attributes.MuiStepLabelOptionalLabel || 'Last step')
146
152
  }, attributes.MuiStepLabelAttributes), step.label), /*#__PURE__*/_react.default.createElement(_StepContent.default, attributes.MuiStepContentAttributes, step.components ? /*#__PURE__*/_react.default.createElement(_stepperComponents.default, {
147
153
  onUpdate: handleUpdate,
148
- components: (0, _helper.updatePatchData)(step.components, stepperResponse[attributes.id] || {}, attributes.id, stepperResponse || {})
154
+ components: (0, _helper.updatePatchData)(step.components, stepperResponse, attributes.id, response)
149
155
  }) : /*#__PURE__*/_react.default.createElement(_Typography.default, null, step.description), renderStepButtons(index, step.isScreenChange))))));
150
156
  }
151
157
  Stepper.propTypes = process.env.NODE_ENV !== "production" ? {
@@ -155,12 +161,15 @@ Stepper.propTypes = process.env.NODE_ENV !== "production" ? {
155
161
  onChange: _propTypes.default.func,
156
162
  /** Function */
157
163
  onStepUpdate: _propTypes.default.func,
158
- /** Default Spet */
159
- currentStep: _propTypes.number
164
+ /** Default Step */
165
+ currentStep: _propTypes.number,
166
+ /** Default Patch */
167
+ patch: _propTypes.default.objectOf(_propTypes.default.object)
160
168
  } : {};
161
169
  Stepper.defaultProps = {
162
170
  attributes: {},
163
171
  onChange: null,
164
172
  onStepUpdate: null,
165
- currentStep: 0
173
+ currentStep: 0,
174
+ patch: {}
166
175
  };
@@ -14,6 +14,7 @@ const mui = exports.mui = [{
14
14
  orientation: 'horizontal',
15
15
  MuiSteps: [{
16
16
  label: 'Select Service Request',
17
+ mandatoryIds: ['servicetype'],
17
18
  components: [{
18
19
  type: 'select',
19
20
  props: {
@@ -49,6 +50,7 @@ const mui = exports.mui = [{
49
50
  }, {
50
51
  label: 'Assign Priority',
51
52
  isScreenChange: true,
53
+ mandatoryIds: ['priority'],
52
54
  components: [{
53
55
  type: 'select',
54
56
  props: {
@@ -74,6 +76,7 @@ const mui = exports.mui = [{
74
76
  }]
75
77
  }, {
76
78
  label: 'Choose Schedule In Calendar',
79
+ mandatoryIds: ['start', 'end'],
77
80
  components: [{
78
81
  id: 'start',
79
82
  type: 'datetime',
@@ -106,6 +109,7 @@ const mui = exports.mui = [{
106
109
  }]
107
110
  }, {
108
111
  label: 'Assign User',
112
+ mandatoryIds: ['assigntouser'],
109
113
  components: [{
110
114
  type: 'select',
111
115
  props: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamic-mui",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "author": "Dinakaran S",
5
5
  "user": "dinakarans",
6
6
  "repository": {