@ukhomeoffice/cop-react-form-renderer 6.16.0-beta → 7.0.0-charlie
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.
- package/dist/components/CheckYourAnswers/Answer.js +5 -2
- package/dist/components/CheckYourAnswers/Answer.test.js +8 -7
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +86 -68
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +22 -22
- package/dist/components/CollectionPage/CollectionPage.js +3 -3
- package/dist/components/CollectionPage/CollectionPage.test.js +12 -12
- package/dist/components/CollectionSummary/BannerStrip.js +22 -21
- package/dist/components/CollectionSummary/BannerStrip.test.js +8 -8
- package/dist/components/CollectionSummary/CollectionSummary.js +105 -99
- package/dist/components/CollectionSummary/CollectionSummary.test.js +23 -19
- package/dist/components/CollectionSummary/Confirmation.js +16 -10
- package/dist/components/CollectionSummary/Confirmation.test.js +12 -11
- package/dist/components/CollectionSummary/RenderListView.js +78 -65
- package/dist/components/CollectionSummary/RenderListView.test.js +18 -12
- package/dist/components/CollectionSummary/SummaryCard.js +83 -72
- package/dist/components/CollectionSummary/SummaryCard.test.js +105 -101
- package/dist/components/CollectionSummary/SummaryCardButtons.js +17 -13
- package/dist/components/CollectionSummary/SummaryCardButtons.test.js +3 -2
- package/dist/components/CollectionSummary/SummaryCardDetails.js +72 -67
- package/dist/components/CollectionSummary/SummaryCardDetails.test.js +12 -12
- package/dist/components/CollectionSummary/SummaryCardValidationContext.js +6 -5
- package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +29 -13
- package/dist/components/FormComponent/Collection.js +91 -82
- package/dist/components/FormComponent/Collection.test.js +16 -15
- package/dist/components/FormComponent/Container.js +21 -22
- package/dist/components/FormComponent/Container.test.js +9 -8
- package/dist/components/FormComponent/FormComponent.js +7 -8
- package/dist/components/FormComponent/FormComponent.test.js +18 -13
- package/dist/components/FormPage/FormPage.js +29 -23
- package/dist/components/FormPage/FormPage.test.js +10 -10
- package/dist/components/FormRenderer/FormRenderer.js +81 -92
- package/dist/components/FormRenderer/FormRenderer.test.js +23 -24
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-hidden-component-with-nested-questions-visible-elsewhere.json +118 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-nested-answers-hidden-by-option-visible-elsewhere.json +113 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-page-nested-component.json +26003 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-hidden-component-with-nested-questions-visible-elsewhere.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-nested-answers-hidden-by-option-visible-elsewhere.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-page-nested-component.json +63 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-hidden-component-with-nested-questions-visible-elsewhere-removed.json +11 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-nested-answers-hidden-by-option-visible-elsewhere-removed.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-page-nested-component.json +63 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +18 -16
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +31 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.js +44 -35
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.test.js +1 -2
- package/dist/components/PageActions/ActionButton.js +12 -6
- package/dist/components/PageActions/ActionButton.test.js +5 -5
- package/dist/components/PageActions/PageActions.js +7 -5
- package/dist/components/PageActions/PageActions.test.js +5 -4
- package/dist/components/SummaryList/GroupAction.js +14 -8
- package/dist/components/SummaryList/GroupAction.test.js +5 -4
- package/dist/components/SummaryList/RowAction.js +12 -6
- package/dist/components/SummaryList/RowAction.test.js +5 -4
- package/dist/components/SummaryList/SummaryList.js +54 -49
- package/dist/components/SummaryList/SummaryList.test.js +33 -19
- package/dist/components/SummaryList/SummaryListHeadingRow.js +9 -3
- package/dist/components/SummaryList/SummaryListHeadingRowWithAction.js +20 -12
- package/dist/components/SummaryList/SummaryListRow.js +16 -11
- package/dist/components/SummaryList/SummaryListTitleRow.js +7 -3
- package/dist/components/TaskList/Task.js +20 -17
- package/dist/components/TaskList/Task.test.js +8 -7
- package/dist/components/TaskList/TaskList.js +68 -45
- package/dist/components/TaskList/TaskList.test.js +11 -11
- package/dist/components/TaskList/TaskState.js +5 -3
- package/dist/components/TaskList/TaskState.test.js +8 -7
- package/dist/context/HooksContext/HooksContext.js +6 -5
- package/dist/context/HooksContext/HooksContext.test.js +14 -6
- package/dist/context/HooksContext/index.js +1 -2
- package/dist/context/ValidationContext/ValidationContext.js +6 -5
- package/dist/context/ValidationContext/ValidationContext.test.js +33 -9
- package/dist/context/ValidationContext/index.js +1 -2
- package/dist/hooks/index.js +1 -2
- package/dist/hooks/useRefData.js +1 -2
- package/dist/index.js +1 -2
- package/dist/setupTests.js +23 -18
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +19 -16
- package/dist/utils/CheckYourAnswers/getSummaryListRowForDetails.js +5 -5
- package/dist/utils/CollectionPage/getQuickEditPage.js +2 -2
- package/dist/utils/Component/cleanAttributes.test.js +1 -2
- package/dist/utils/Component/getComponent.js +38 -28
- package/dist/utils/Component/getDefaultValueFromConfig.js +1 -2
- package/dist/utils/Component/isEditable.test.js +1 -2
- package/dist/utils/Component/wrapInFormGroup.js +10 -4
- package/dist/utils/Format/formatDataForComponent.test.js +1 -2
- package/dist/utils/Format/formatDataForPage.test.js +1 -2
- package/dist/utils/Validate/validateDate.test.js +1 -2
- package/dist/utils/Validate/validateMultifile.test.js +1 -2
- package/package.json +43 -13
|
@@ -9,6 +9,7 @@ var _utils = _interopRequireDefault(require("../../utils"));
|
|
|
9
9
|
var _Collection = require("./Collection");
|
|
10
10
|
var _Container = require("./Container");
|
|
11
11
|
var _FormComponent = _interopRequireDefault(require("./FormComponent"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -42,7 +43,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
42
43
|
};
|
|
43
44
|
const {
|
|
44
45
|
container
|
|
45
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
46
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
46
47
|
component: COLLECTION,
|
|
47
48
|
value: FORM_DATA[ID],
|
|
48
49
|
formData: FORM_DATA
|
|
@@ -98,7 +99,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
98
99
|
};
|
|
99
100
|
const {
|
|
100
101
|
container
|
|
101
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
102
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
102
103
|
component: COLLECTION,
|
|
103
104
|
value: FORM_DATA[ID],
|
|
104
105
|
formData: FORM_DATA,
|
|
@@ -133,7 +134,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
133
134
|
};
|
|
134
135
|
const {
|
|
135
136
|
container
|
|
136
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
137
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
137
138
|
component: COLLECTION
|
|
138
139
|
}));
|
|
139
140
|
|
|
@@ -164,7 +165,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
164
165
|
};
|
|
165
166
|
const {
|
|
166
167
|
container
|
|
167
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
168
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
168
169
|
component: COLLECTION
|
|
169
170
|
}));
|
|
170
171
|
|
|
@@ -198,7 +199,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
198
199
|
const container = document.createElement('div');
|
|
199
200
|
document.body.appendChild(container);
|
|
200
201
|
await (0, _testUtils.act)(async () => {
|
|
201
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
202
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
202
203
|
component: COLLECTION
|
|
203
204
|
}), container);
|
|
204
205
|
});
|
|
@@ -247,7 +248,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
247
248
|
const container = document.createElement('div');
|
|
248
249
|
document.body.appendChild(container);
|
|
249
250
|
await (0, _testUtils.act)(async () => {
|
|
250
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
251
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
251
252
|
component: COLLECTION
|
|
252
253
|
}), container);
|
|
253
254
|
});
|
|
@@ -295,7 +296,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
295
296
|
};
|
|
296
297
|
const {
|
|
297
298
|
container
|
|
298
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
299
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
299
300
|
component: COLLECTION,
|
|
300
301
|
value: FORM_DATA[ID],
|
|
301
302
|
formData: FORM_DATA
|
|
@@ -343,7 +344,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
343
344
|
};
|
|
344
345
|
const {
|
|
345
346
|
container
|
|
346
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
347
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
347
348
|
component: COLLECTION,
|
|
348
349
|
value: [],
|
|
349
350
|
formData: {}
|
|
@@ -406,7 +407,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
406
407
|
};
|
|
407
408
|
const {
|
|
408
409
|
container
|
|
409
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
410
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
410
411
|
component: _objectSpread(_objectSpread({}, COLLECTION), {}, {
|
|
411
412
|
restrictHint: true
|
|
412
413
|
}),
|
|
@@ -541,7 +542,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
541
542
|
};
|
|
542
543
|
const {
|
|
543
544
|
container
|
|
544
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
545
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
545
546
|
component: _objectSpread(_objectSpread({}, COLLECTION), {}, {
|
|
546
547
|
restrictHint: true
|
|
547
548
|
}),
|
|
@@ -660,7 +661,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
660
661
|
const container = document.createElement('div');
|
|
661
662
|
document.body.appendChild(container);
|
|
662
663
|
await (0, _testUtils.act)(async () => {
|
|
663
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
664
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
664
665
|
component: COLLECTION
|
|
665
666
|
}), container);
|
|
666
667
|
});
|
|
@@ -715,7 +716,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
715
716
|
const container = document.createElement('div');
|
|
716
717
|
document.body.appendChild(container);
|
|
717
718
|
await (0, _testUtils.act)(async () => {
|
|
718
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
719
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
719
720
|
component: COLLECTION
|
|
720
721
|
}), container);
|
|
721
722
|
});
|
|
@@ -778,7 +779,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
778
779
|
const container = document.createElement('div');
|
|
779
780
|
document.body.appendChild(container);
|
|
780
781
|
await (0, _testUtils.act)(async () => {
|
|
781
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
782
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
782
783
|
component: COLLECTION
|
|
783
784
|
}), container);
|
|
784
785
|
});
|
|
@@ -843,7 +844,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
843
844
|
const container = document.createElement('div');
|
|
844
845
|
document.body.appendChild(container);
|
|
845
846
|
await (0, _testUtils.act)(async () => {
|
|
846
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
847
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
847
848
|
component: COLLECTION
|
|
848
849
|
}), container);
|
|
849
850
|
});
|
|
@@ -888,7 +889,7 @@ describe('components.FormComponent.Collection', () => {
|
|
|
888
889
|
const container = document.createElement('div');
|
|
889
890
|
document.body.appendChild(container);
|
|
890
891
|
await (0, _testUtils.act)(async () => {
|
|
891
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
892
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
892
893
|
component: COLLECTION
|
|
893
894
|
}), container);
|
|
894
895
|
});
|
|
@@ -12,18 +12,18 @@ var _utils = _interopRequireDefault(require("../../utils"));
|
|
|
12
12
|
var _FormComponent = _interopRequireDefault(require("./FormComponent"));
|
|
13
13
|
var _getSourceData = _interopRequireDefault(require("../../utils/Data/getSourceData"));
|
|
14
14
|
require("./Container.scss");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
const _excluded = ["container", "value", "formData", "onChange", "wrap", "onTopLevelChange"]; // Global imports
|
|
16
17
|
// Local imports
|
|
17
18
|
// Styles
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
22
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
24
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
26
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
25
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
26
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
27
27
|
const DEFAULT_CLASS = exports.DEFAULT_CLASS = 'hods-form-container';
|
|
28
28
|
const Container = _ref => {
|
|
29
29
|
let {
|
|
@@ -71,26 +71,25 @@ const Container = _ref => {
|
|
|
71
71
|
};
|
|
72
72
|
const classes = _utils.default.classBuilder(DEFAULT_CLASS, [], container.className);
|
|
73
73
|
const cleanedAttrs = _copReactComponents.Utils.cleanHtmlAttributes(attrs);
|
|
74
|
-
return /*#__PURE__*/
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, cleanedAttrs), {}, {
|
|
75
75
|
className: classes(),
|
|
76
|
-
id: container.id
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}));
|
|
76
|
+
id: container.id,
|
|
77
|
+
children: container.components && container.components.filter(shouldShow).map((component, index) => {
|
|
78
|
+
const defaultValue = component.type === _models.ComponentTypes.FILE ? {} : '';
|
|
79
|
+
const val = value ? value[component.fieldId] : defaultValue;
|
|
80
|
+
const fullPath = "".concat(container.full_path || container.fieldId, ".").concat(component.fieldId);
|
|
81
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
82
|
+
component: _objectSpread(_objectSpread({}, component), {}, {
|
|
83
|
+
full_path: fullPath,
|
|
84
|
+
readonly: !!(container.readonly || component.readonly)
|
|
85
|
+
}),
|
|
86
|
+
formData: formData,
|
|
87
|
+
value: val || defaultValue,
|
|
88
|
+
wrap: wrap,
|
|
89
|
+
onChange: onComponentChange,
|
|
90
|
+
onTopLevelChange: onTopLevelChange
|
|
91
|
+
}), index);
|
|
92
|
+
})
|
|
94
93
|
}));
|
|
95
94
|
};
|
|
96
95
|
Container.propTypes = {
|
|
@@ -8,6 +8,7 @@ var _setupTests = require("../../setupTests");
|
|
|
8
8
|
var _constants = require("../../utils/Meta/constants");
|
|
9
9
|
var _Container = require("./Container");
|
|
10
10
|
var _FormComponent = _interopRequireDefault(require("./FormComponent"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -54,7 +55,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
54
55
|
};
|
|
55
56
|
const {
|
|
56
57
|
container
|
|
57
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
58
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
58
59
|
component: CONTAINER,
|
|
59
60
|
value: FORM_DATA[ID],
|
|
60
61
|
formData: FORM_DATA
|
|
@@ -98,7 +99,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
98
99
|
};
|
|
99
100
|
const {
|
|
100
101
|
container
|
|
101
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
102
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
102
103
|
component: CONTAINER,
|
|
103
104
|
value: FORM_DATA[ID],
|
|
104
105
|
formData: FORM_DATA
|
|
@@ -151,7 +152,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
151
152
|
};
|
|
152
153
|
const {
|
|
153
154
|
container
|
|
154
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
155
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
155
156
|
component: CONTAINER,
|
|
156
157
|
value: FORM_DATA[ID],
|
|
157
158
|
formData: FORM_DATA,
|
|
@@ -200,7 +201,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
200
201
|
};
|
|
201
202
|
const {
|
|
202
203
|
container
|
|
203
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
204
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
204
205
|
component: CONTAINER,
|
|
205
206
|
value: FORM_DATA[ID],
|
|
206
207
|
formData: FORM_DATA,
|
|
@@ -247,7 +248,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
247
248
|
};
|
|
248
249
|
const {
|
|
249
250
|
container
|
|
250
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
251
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
251
252
|
component: CONTAINER
|
|
252
253
|
}));
|
|
253
254
|
|
|
@@ -286,7 +287,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
286
287
|
};
|
|
287
288
|
const {
|
|
288
289
|
container
|
|
289
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
290
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
290
291
|
component: CONTAINER,
|
|
291
292
|
value: FORM_DATA[ID],
|
|
292
293
|
formData: FORM_DATA
|
|
@@ -308,7 +309,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
308
309
|
};
|
|
309
310
|
const {
|
|
310
311
|
container
|
|
311
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
312
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
312
313
|
component: CONTAINER,
|
|
313
314
|
value: FORM_DATA[ID],
|
|
314
315
|
formData: FORM_DATA
|
|
@@ -365,7 +366,7 @@ describe('components.FormComponent.Container', () => {
|
|
|
365
366
|
};
|
|
366
367
|
const {
|
|
367
368
|
container
|
|
368
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
369
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
369
370
|
component: CONTAINER,
|
|
370
371
|
value: FORM_DATA_CONDITIONAL[ID],
|
|
371
372
|
formData: FORM_DATA_CONDITIONAL
|
|
@@ -14,19 +14,18 @@ var _CollectionSummary = _interopRequireDefault(require("../CollectionSummary"))
|
|
|
14
14
|
var _Collection = _interopRequireDefault(require("./Collection"));
|
|
15
15
|
var _Container = _interopRequireDefault(require("./Container"));
|
|
16
16
|
var _helpers = require("./helpers");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
const _excluded = ["component", "value", "formData", "wrap", "onAction", "onChange", "onTopLevelChange", "pages", "submitting"]; // Global imports
|
|
18
19
|
// Local imports
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
-
function
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
22
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
24
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
26
26
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
|
-
function
|
|
28
|
-
function
|
|
29
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
27
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
28
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
30
29
|
const FormComponent = _ref => {
|
|
31
30
|
let {
|
|
32
31
|
component,
|
|
@@ -103,7 +102,7 @@ const FormComponent = _ref => {
|
|
|
103
102
|
}
|
|
104
103
|
}, []);
|
|
105
104
|
if (component.type === _models.ComponentTypes.CONTAINER) {
|
|
106
|
-
let container = /*#__PURE__*/
|
|
105
|
+
let container = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
107
106
|
container: component,
|
|
108
107
|
wrap: wrap,
|
|
109
108
|
onChange: onComponentChange,
|
|
@@ -117,7 +116,7 @@ const FormComponent = _ref => {
|
|
|
117
116
|
return container;
|
|
118
117
|
}
|
|
119
118
|
if (component.type === _models.ComponentTypes.COLLECTION) {
|
|
120
|
-
return /*#__PURE__*/
|
|
119
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Collection.default, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
121
120
|
config: component,
|
|
122
121
|
wrap: wrap,
|
|
123
122
|
onChange: onComponentChange,
|
|
@@ -127,7 +126,7 @@ const FormComponent = _ref => {
|
|
|
127
126
|
}));
|
|
128
127
|
}
|
|
129
128
|
if (component.type === _models.ComponentTypes.COLLECTION_SUMMARY) {
|
|
130
|
-
return (0, _wrapInFormGroup.default)(_objectSpread(_objectSpread({}, component), (0, _helpers.getComponentError)(component, validation === null || validation === void 0 ? void 0 : validation.errors)), /*#__PURE__*/
|
|
129
|
+
return (0, _wrapInFormGroup.default)(_objectSpread(_objectSpread({}, component), (0, _helpers.getComponentError)(component, validation === null || validation === void 0 ? void 0 : validation.errors)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
131
130
|
config: component,
|
|
132
131
|
formData: formData,
|
|
133
132
|
onAction: onAction,
|
|
@@ -5,6 +5,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
5
5
|
var _setupTests = require("../../setupTests");
|
|
6
6
|
var _FormComponent = _interopRequireDefault(require("./FormComponent"));
|
|
7
7
|
var _models = require("../../models");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
// Global imports
|
|
10
11
|
|
|
@@ -25,7 +26,7 @@ describe('components', () => {
|
|
|
25
26
|
const ON_CHANGE = () => {};
|
|
26
27
|
const {
|
|
27
28
|
container
|
|
28
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
29
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
29
30
|
"data-testid": ID,
|
|
30
31
|
component: COMPONENT,
|
|
31
32
|
value: VALUE,
|
|
@@ -64,7 +65,7 @@ describe('components', () => {
|
|
|
64
65
|
const ON_CHANGE = () => {};
|
|
65
66
|
const {
|
|
66
67
|
container
|
|
67
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
68
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
68
69
|
"data-testid": ID,
|
|
69
70
|
component: COMPONENT,
|
|
70
71
|
wrap: false,
|
|
@@ -88,7 +89,7 @@ describe('components', () => {
|
|
|
88
89
|
};
|
|
89
90
|
const {
|
|
90
91
|
container
|
|
91
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
92
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
92
93
|
"data-testid": ID,
|
|
93
94
|
component: COMPONENT
|
|
94
95
|
}));
|
|
@@ -98,7 +99,9 @@ describe('components', () => {
|
|
|
98
99
|
});
|
|
99
100
|
it('should render an overridden html component appropriately', async () => {
|
|
100
101
|
const hooks = {
|
|
101
|
-
onGetComponent: (config, wrap) => /*#__PURE__*/
|
|
102
|
+
onGetComponent: (config, wrap) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
103
|
+
children: "".concat(config.type, " | ").concat(config.tagName, " | ").concat(config.content, " | ").concat(wrap)
|
|
104
|
+
})
|
|
102
105
|
};
|
|
103
106
|
const ID = 'component';
|
|
104
107
|
const COMPONENT = {
|
|
@@ -108,7 +111,7 @@ describe('components', () => {
|
|
|
108
111
|
};
|
|
109
112
|
const {
|
|
110
113
|
container
|
|
111
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
114
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
112
115
|
"data-testid": ID,
|
|
113
116
|
component: COMPONENT
|
|
114
117
|
}), {
|
|
@@ -120,7 +123,9 @@ describe('components', () => {
|
|
|
120
123
|
});
|
|
121
124
|
it('should render an overridden html component appropriately and pass through onAction', async () => {
|
|
122
125
|
const hooks = {
|
|
123
|
-
onGetComponent: (config, wrap) => /*#__PURE__*/
|
|
126
|
+
onGetComponent: (config, wrap) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
127
|
+
children: "".concat(config.type, " | ").concat(config.tagName, " | ").concat(config.content, " | ").concat(wrap, " | ").concat(config.onAction)
|
|
128
|
+
})
|
|
124
129
|
};
|
|
125
130
|
const ID = 'component';
|
|
126
131
|
const COMPONENT = {
|
|
@@ -130,7 +135,7 @@ describe('components', () => {
|
|
|
130
135
|
};
|
|
131
136
|
const {
|
|
132
137
|
container
|
|
133
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
138
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
134
139
|
"data-testid": ID,
|
|
135
140
|
component: COMPONENT,
|
|
136
141
|
onAction: "() => {}"
|
|
@@ -153,7 +158,7 @@ describe('components', () => {
|
|
|
153
158
|
};
|
|
154
159
|
const {
|
|
155
160
|
container
|
|
156
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
161
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
157
162
|
"data-testid": ID,
|
|
158
163
|
component: COMPONENT
|
|
159
164
|
}), {
|
|
@@ -181,7 +186,7 @@ describe('components', () => {
|
|
|
181
186
|
const ON_CHANGE = () => {};
|
|
182
187
|
const {
|
|
183
188
|
container
|
|
184
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
189
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
185
190
|
"data-testid": ID,
|
|
186
191
|
component: COMPONENT,
|
|
187
192
|
value: VALUE,
|
|
@@ -231,7 +236,7 @@ describe('components', () => {
|
|
|
231
236
|
const {
|
|
232
237
|
container,
|
|
233
238
|
rerender
|
|
234
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
239
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
235
240
|
"data-testid": ID,
|
|
236
241
|
component: COMPONENT,
|
|
237
242
|
value: DATA[ID],
|
|
@@ -245,7 +250,7 @@ describe('components', () => {
|
|
|
245
250
|
});
|
|
246
251
|
const formGroup = container.childNodes[0];
|
|
247
252
|
const input = formGroup.childNodes[2];
|
|
248
|
-
(0, _setupTests.rerenderWithValidation)(rerender, /*#__PURE__*/
|
|
253
|
+
(0, _setupTests.rerenderWithValidation)(rerender, /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
249
254
|
"data-testid": ID,
|
|
250
255
|
component: COMPONENT,
|
|
251
256
|
value: DATA[ID],
|
|
@@ -279,7 +284,7 @@ describe('components', () => {
|
|
|
279
284
|
};
|
|
280
285
|
const {
|
|
281
286
|
container
|
|
282
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
287
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
283
288
|
"data-testid": ID,
|
|
284
289
|
component: COMPONENT,
|
|
285
290
|
value: DATA[ID],
|
|
@@ -335,7 +340,7 @@ describe('components', () => {
|
|
|
335
340
|
};
|
|
336
341
|
const {
|
|
337
342
|
container
|
|
338
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
343
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
339
344
|
"data-testid": ID,
|
|
340
345
|
component: COMPONENT,
|
|
341
346
|
value: DATA[ID],
|
|
@@ -13,14 +13,14 @@ var _FormComponent = _interopRequireDefault(require("../FormComponent"));
|
|
|
13
13
|
var _PageActions = _interopRequireDefault(require("../PageActions"));
|
|
14
14
|
require("./FormPage.scss");
|
|
15
15
|
var _validateOnPageLoad = require("../../utils/Validate/validateOnPageLoad");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
function
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
21
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
23
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
22
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
25
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Global imports
|
|
26
26
|
// Local imports.
|
|
@@ -115,13 +115,15 @@ const FormPage = _ref => {
|
|
|
115
115
|
label: _utils.default.interpolateString(action.label, formPage.formData)
|
|
116
116
|
}) : action);
|
|
117
117
|
formPage.formData = _utils.default.Operate.runPageOperations(formPage, _objectSpread(_objectSpread({}, formPage.formData), patch), onWrapperChange || onPageChange);
|
|
118
|
-
const headingContent = page.title ? /*#__PURE__*/
|
|
118
|
+
const headingContent = page.title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.LargeHeading, {
|
|
119
|
+
children: _utils.default.FormPage.getTitle(page.title, page.formData)
|
|
120
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.Label, {
|
|
119
121
|
id: page.id,
|
|
120
122
|
required: page.required,
|
|
121
|
-
hideOptionalSuffix: page.hideOptionalSuffix
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
hideOptionalSuffix: page.hideOptionalSuffix,
|
|
124
|
+
children: page.label
|
|
125
|
+
});
|
|
126
|
+
const formComponentContent = page.components.filter(c => _utils.default.Component.show(c, page.formData)).map((component, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
125
127
|
component: component,
|
|
126
128
|
onAction: action => onAction(action, patch, patchLabel),
|
|
127
129
|
onChange: onWrapperChange || onPageChange,
|
|
@@ -130,7 +132,7 @@ const FormPage = _ref => {
|
|
|
130
132
|
formData: page.formData,
|
|
131
133
|
pages: pages,
|
|
132
134
|
submitting: submitting
|
|
133
|
-
}));
|
|
135
|
+
}, index));
|
|
134
136
|
let errorMessages = null;
|
|
135
137
|
if (runOnLoad && (errors === null || errors === void 0 ? void 0 : errors.length) > 0) {
|
|
136
138
|
var _page$customValidatio;
|
|
@@ -140,20 +142,24 @@ const FormPage = _ref => {
|
|
|
140
142
|
} else if ((errors === null || errors === void 0 ? void 0 : errors.length) > 0 && !runOnLoad) {
|
|
141
143
|
errorMessages = errors;
|
|
142
144
|
}
|
|
143
|
-
return /*#__PURE__*/
|
|
145
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
144
146
|
className: classes(),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
children: [errorMessages && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.ErrorSummary, {
|
|
148
|
+
errors: errorMessages,
|
|
149
|
+
hashLink: hashLink
|
|
150
|
+
}), page.fieldset && /*#__PURE__*/(0, _jsxRuntime.jsxs)("fieldset", {
|
|
151
|
+
className: "govuk-fieldset",
|
|
152
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("legend", {
|
|
153
|
+
className: "govuk-fieldset__legend",
|
|
154
|
+
children: headingContent
|
|
155
|
+
}), formComponentContent]
|
|
156
|
+
}), !page.fieldset && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
157
|
+
children: [headingContent, formComponentContent]
|
|
158
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PageActions.default, {
|
|
159
|
+
actions: (_page$actions = page.actions) === null || _page$actions === void 0 ? void 0 : _page$actions.filter(action => _utils.default.Component.show(action, page.formData)),
|
|
160
|
+
onAction: action => onAction(action, patch, patchLabel)
|
|
161
|
+
})]
|
|
162
|
+
}, page.id);
|
|
157
163
|
};
|
|
158
164
|
FormPage.propTypes = {
|
|
159
165
|
classBlock: _propTypes.default.string,
|