@ukhomeoffice/cop-react-form-renderer 4.89.0 → 4.89.2
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.
|
@@ -166,7 +166,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
setGoingBack(true);
|
|
169
|
-
hooks.onGoingBack();
|
|
169
|
+
hooks.onGoingBack(e.state ? e.state : null);
|
|
170
170
|
clearErrors();
|
|
171
171
|
if (components && pages && data && (_formState$page = formState.page) !== null && _formState$page !== void 0 && _formState$page.formData && pagePoint === undefined) {
|
|
172
172
|
var submissionData = _utils.default.Format.form({
|
|
@@ -25,6 +25,18 @@ var nestComponents = function nestComponents(container) {
|
|
|
25
25
|
setupNesting(ret)
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
+
if (component.type === _models.ComponentTypes.RADIOS) {
|
|
29
|
+
var _ret$data, _ret$data$options;
|
|
30
|
+
(_ret$data = ret.data) === null || _ret$data === void 0 ? void 0 : (_ret$data$options = _ret$data.options) === null || _ret$data$options === void 0 ? void 0 : _ret$data$options.forEach(function (option, optionIndex) {
|
|
31
|
+
var _option$nested;
|
|
32
|
+
(_option$nested = option.nested) === null || _option$nested === void 0 ? void 0 : _option$nested.forEach(function (nest, nestIndex) {
|
|
33
|
+
if (nest.type === _models.ComponentTypes.CONTAINER) {
|
|
34
|
+
// eslint-disable-next-line no-use-before-define
|
|
35
|
+
ret.data.options[optionIndex].nested[nestIndex] = setupNesting(nest);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
28
40
|
return ret;
|
|
29
41
|
});
|
|
30
42
|
};
|
|
@@ -83,4 +83,63 @@ describe('utils.Container.setupNesting', function () {
|
|
|
83
83
|
}]
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
|
+
it('should handle a container under a radio button', function () {
|
|
87
|
+
var CONTAINER = _objectSpread(_objectSpread({}, getComponent('container', _models.ComponentTypes.CONTAINER)), {}, {
|
|
88
|
+
components: [getComponent('text', _models.ComponentTypes.TEXT), getComponent('email', _models.ComponentTypes.EMAIL)]
|
|
89
|
+
});
|
|
90
|
+
var RADIO = {
|
|
91
|
+
id: 'radio',
|
|
92
|
+
fieldId: 'radio',
|
|
93
|
+
type: 'radios',
|
|
94
|
+
data: {
|
|
95
|
+
options: [{
|
|
96
|
+
value: 'yes',
|
|
97
|
+
label: 'Yes'
|
|
98
|
+
}, {
|
|
99
|
+
value: 'no',
|
|
100
|
+
label: 'No',
|
|
101
|
+
nested: [CONTAINER]
|
|
102
|
+
}]
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var TOP_CONTAINER = _objectSpread(_objectSpread({}, getComponent('topContainer', _models.ComponentTypes.CONTAINER)), {}, {
|
|
106
|
+
components: [RADIO]
|
|
107
|
+
});
|
|
108
|
+
expect((0, _setupNesting.default)(TOP_CONTAINER)).toEqual({
|
|
109
|
+
id: 'topContainer',
|
|
110
|
+
fieldId: 'topContainer',
|
|
111
|
+
type: _models.ComponentTypes.CONTAINER,
|
|
112
|
+
components: [{
|
|
113
|
+
id: 'radio',
|
|
114
|
+
fieldId: 'radio',
|
|
115
|
+
type: 'radios',
|
|
116
|
+
full_path: 'topContainer.radio',
|
|
117
|
+
data: {
|
|
118
|
+
options: [{
|
|
119
|
+
value: 'yes',
|
|
120
|
+
label: 'Yes'
|
|
121
|
+
}, {
|
|
122
|
+
value: 'no',
|
|
123
|
+
label: 'No',
|
|
124
|
+
nested: [{
|
|
125
|
+
id: 'container',
|
|
126
|
+
fieldId: 'container',
|
|
127
|
+
type: 'container',
|
|
128
|
+
components: [{
|
|
129
|
+
id: 'text',
|
|
130
|
+
fieldId: 'text',
|
|
131
|
+
full_path: 'container.text',
|
|
132
|
+
type: _models.ComponentTypes.TEXT
|
|
133
|
+
}, {
|
|
134
|
+
id: 'email',
|
|
135
|
+
fieldId: 'email',
|
|
136
|
+
full_path: 'container.email',
|
|
137
|
+
type: _models.ComponentTypes.EMAIL
|
|
138
|
+
}]
|
|
139
|
+
}]
|
|
140
|
+
}]
|
|
141
|
+
}
|
|
142
|
+
}]
|
|
143
|
+
});
|
|
144
|
+
});
|
|
86
145
|
});
|