@ukhomeoffice/cop-react-form-renderer 4.18.0 → 5.0.0-alpha
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 +1 -14
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +19 -57
- package/dist/components/CheckYourAnswers/index.js +0 -3
- package/dist/components/CollectionPage/CollectionPage.js +8 -38
- package/dist/components/CollectionPage/index.js +0 -3
- package/dist/components/FormComponent/Collection.js +13 -54
- package/dist/components/FormComponent/Container.js +6 -30
- package/dist/components/FormComponent/FormComponent.js +14 -57
- package/dist/components/FormComponent/helpers/addLabel.js +4 -7
- package/dist/components/FormComponent/helpers/getComponentDisabled.js +0 -4
- package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +0 -2
- package/dist/components/FormComponent/helpers/getComponentError.js +0 -6
- package/dist/components/FormComponent/helpers/getComponentError.test.js +0 -2
- package/dist/components/FormComponent/helpers/index.js +0 -4
- package/dist/components/FormComponent/index.js +0 -3
- package/dist/components/FormPage/FormPage.js +14 -45
- package/dist/components/FormPage/index.js +0 -3
- package/dist/components/FormRenderer/FormRenderer.js +106 -189
- package/dist/components/FormRenderer/handlers/cyaAction.js +0 -5
- package/dist/components/FormRenderer/handlers/getPageId.js +0 -2
- package/dist/components/FormRenderer/handlers/getPageId.test.js +1 -2
- package/dist/components/FormRenderer/handlers/handlers.test.js +1 -18
- package/dist/components/FormRenderer/handlers/index.js +0 -5
- package/dist/components/FormRenderer/handlers/navigate.js +0 -5
- package/dist/components/FormRenderer/handlers/submissionError.js +0 -2
- package/dist/components/FormRenderer/helpers/canActionProceed.js +0 -3
- package/dist/components/FormRenderer/helpers/canActionProceed.test.js +1 -3
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +0 -2
- package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +1 -5
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +0 -5
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +1 -2
- package/dist/components/FormRenderer/helpers/getCYA.js +0 -6
- package/dist/components/FormRenderer/helpers/getCYA.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getFormState.js +0 -5
- package/dist/components/FormRenderer/helpers/getFormState.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getNextPageId.js +0 -25
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +1 -4
- package/dist/components/FormRenderer/helpers/getPage.js +0 -5
- package/dist/components/FormRenderer/helpers/getPage.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +0 -6
- package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +0 -10
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +0 -6
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +6 -20
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +3 -8
- package/dist/components/FormRenderer/helpers/index.js +1 -11
- package/dist/components/FormRenderer/index.js +0 -3
- package/dist/components/PageActions/ActionButton.js +2 -17
- package/dist/components/PageActions/PageActions.js +3 -10
- package/dist/components/PageActions/index.js +0 -3
- package/dist/components/SummaryList/GroupAction.js +3 -24
- package/dist/components/SummaryList/RowAction.js +3 -23
- package/dist/components/SummaryList/SummaryList.js +6 -28
- package/dist/components/SummaryList/SummaryListRow.js +4 -8
- package/dist/components/SummaryList/SummaryListTitleRow.js +2 -7
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +0 -3
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +0 -6
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +0 -3
- package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +0 -6
- package/dist/components/SummaryList/helpers/index.js +0 -2
- package/dist/components/SummaryList/index.js +0 -3
- package/dist/components/TaskList/Task.js +7 -29
- package/dist/components/TaskList/TaskList.js +12 -33
- package/dist/components/TaskList/TaskState.js +2 -10
- package/dist/components/TaskList/index.js +0 -3
- package/dist/components/index.js +0 -6
- package/dist/context/HooksContext/HooksContext.js +14 -34
- package/dist/context/HooksContext/index.js +0 -5
- package/dist/context/ValidationContext/ValidationContext.js +8 -34
- package/dist/context/ValidationContext/index.js +0 -5
- package/dist/context/index.js +0 -3
- package/dist/hooks/index.js +0 -9
- package/dist/hooks/useAxios.js +8 -25
- package/dist/hooks/useGetRequest.js +13 -47
- package/dist/hooks/useHooks.js +2 -4
- package/dist/hooks/useRefData.js +8 -37
- package/dist/hooks/useValidation.js +2 -4
- package/dist/index.js +0 -6
- package/dist/models/PageAction.js +0 -3
- package/dist/models/TaskStates.js +0 -3
- package/dist/models/index.js +0 -9
- package/dist/utils/CheckYourAnswers/getCYAAction.js +1 -9
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +0 -10
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +0 -8
- package/dist/utils/CheckYourAnswers/getCYARow.js +1 -10
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +2 -20
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +0 -18
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +0 -20
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +0 -13
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +2 -22
- package/dist/utils/CheckYourAnswers/index.js +1 -3
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +2 -11
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +0 -11
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +0 -6
- package/dist/utils/CollectionPage/index.js +1 -5
- package/dist/utils/CollectionPage/mergeCollectionPages.js +1 -12
- package/dist/utils/Component/cleanAttributes.js +1 -8
- package/dist/utils/Component/elevateNestedComponents.js +0 -3
- package/dist/utils/Component/getComponent.js +4 -68
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +6 -10
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +10 -28
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +6 -33
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +10 -27
- package/dist/utils/Component/getComponentTests/getComponent.details.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +4 -22
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +3 -7
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +3 -7
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +6 -15
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +6 -33
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.textarea.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +10 -29
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +1 -2
- package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +3 -7
- package/dist/utils/Component/getDefaultValue.js +0 -7
- package/dist/utils/Component/index.js +0 -9
- package/dist/utils/Component/isEditable.js +1 -4
- package/dist/utils/Component/showComponent.js +1 -8
- package/dist/utils/Component/wrapInFormGroup.js +0 -7
- package/dist/utils/Condition/index.js +0 -5
- package/dist/utils/Condition/meetsAllConditions.js +0 -9
- package/dist/utils/Condition/meetsCondition.js +7 -19
- package/dist/utils/Condition/meetsOneCondition.js +1 -9
- package/dist/utils/Condition/setupConditions.js +0 -12
- package/dist/utils/Container/getEditableComponents.js +0 -7
- package/dist/utils/Container/index.js +0 -5
- package/dist/utils/Container/setupNesting.js +0 -11
- package/dist/utils/Container/showContainer.js +9 -18
- package/dist/utils/Data/applyFormula.js +2 -28
- package/dist/utils/Data/getAutocompleteSource.js +1 -4
- package/dist/utils/Data/getDataPath.js +3 -17
- package/dist/utils/Data/getOptions.js +0 -9
- package/dist/utils/Data/getSourceData.js +4 -19
- package/dist/utils/Data/index.js +1 -11
- package/dist/utils/Data/refDataToOptions.js +1 -12
- package/dist/utils/Data/setDataItem.js +0 -5
- package/dist/utils/Data/setupFormData.js +2 -20
- package/dist/utils/Data/setupRefDataUrlForComponent.js +0 -14
- package/dist/utils/FormPage/getFormPage.js +0 -15
- package/dist/utils/FormPage/getFormPages.js +0 -8
- package/dist/utils/FormPage/getPageActions.js +3 -18
- package/dist/utils/FormPage/getParagraphFromText.js +0 -3
- package/dist/utils/FormPage/index.js +0 -6
- package/dist/utils/FormPage/showFormPage.js +9 -18
- package/dist/utils/FormPage/showFormPageCYA.js +0 -5
- package/dist/utils/FormPage/useComponent.js +3 -18
- package/dist/utils/Format/formatData.js +0 -5
- package/dist/utils/Format/formatDataForComponent.js +1 -6
- package/dist/utils/Format/formatDataForForm.js +0 -8
- package/dist/utils/Format/formatDataForPage.js +1 -5
- package/dist/utils/Format/index.js +1 -6
- package/dist/utils/Hub/getFormHub.js +0 -8
- package/dist/utils/Hub/index.js +1 -3
- package/dist/utils/Meta/documents/getDocuments.js +1 -4
- package/dist/utils/Meta/documents/getDocuments.test.js +0 -9
- package/dist/utils/Meta/documents/index.js +1 -5
- package/dist/utils/Meta/documents/setDocumentForField.js +0 -11
- package/dist/utils/Meta/documents/setDocumentForField.test.js +0 -11
- package/dist/utils/Meta/index.js +2 -6
- package/dist/utils/Operate/checkValueIsTruthy.js +1 -7
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +7 -21
- package/dist/utils/Operate/index.js +0 -3
- package/dist/utils/Operate/persistValueInFormData.js +1 -8
- package/dist/utils/Operate/runPageOperations.js +3 -18
- package/dist/utils/Operate/setValueInFormData.js +2 -7
- package/dist/utils/Operate/shouldRun.js +1 -14
- package/dist/utils/Validate/additional/index.js +1 -18
- package/dist/utils/Validate/additional/index.test.js +0 -6
- package/dist/utils/Validate/additional/mustBeAfter.js +3 -8
- package/dist/utils/Validate/additional/mustBeAfter.test.js +0 -4
- package/dist/utils/Validate/additional/mustBeBefore.js +3 -8
- package/dist/utils/Validate/additional/mustBeBefore.test.js +0 -4
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +5 -16
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +0 -7
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +3 -12
- package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +0 -3
- package/dist/utils/Validate/additional/mustBeInThePast.js +5 -13
- package/dist/utils/Validate/additional/mustBeInThePast.test.js +0 -3
- package/dist/utils/Validate/additional/mustBeLessThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeLessThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeLongerThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeLongerThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +0 -4
- package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeShorterThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeShorterThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +0 -5
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +0 -4
- package/dist/utils/Validate/additional/utils.js +8 -24
- package/dist/utils/Validate/index.js +1 -9
- package/dist/utils/Validate/validateCollection.js +0 -9
- package/dist/utils/Validate/validateComponent.js +2 -35
- package/dist/utils/Validate/validateContainer.js +0 -13
- package/dist/utils/Validate/validateDate.js +4 -36
- package/dist/utils/Validate/validateEmail.js +1 -7
- package/dist/utils/Validate/validatePage.js +0 -15
- package/dist/utils/Validate/validateRegex.js +0 -10
- package/dist/utils/Validate/validateRequired.js +0 -8
- package/dist/utils/Validate/validateTime.js +3 -20
- package/dist/utils/index.js +0 -19
- package/package.json +50 -34
- package/dist/components/CheckYourAnswers/Answer.test.js +0 -95
- package/dist/components/CheckYourAnswers/CheckYourAnswers.stories.mdx +0 -410
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +0 -680
- package/dist/components/CollectionPage/CollectionPage.test.js +0 -428
- package/dist/components/FormComponent/Collection.test.js +0 -381
- package/dist/components/FormComponent/Container.test.js +0 -423
- package/dist/components/FormComponent/FormComponent.stories.mdx +0 -184
- package/dist/components/FormComponent/FormComponent.test.js +0 -264
- package/dist/components/FormPage/FormPage.stories.mdx +0 -131
- package/dist/components/FormPage/FormPage.test.js +0 -368
- package/dist/components/FormRenderer/FormRenderer.stories.mdx +0 -183
- package/dist/components/FormRenderer/FormRenderer.test.js +0 -1006
- package/dist/components/PageActions/ActionButton.test.js +0 -116
- package/dist/components/PageActions/PageActions.stories.mdx +0 -74
- package/dist/components/PageActions/PageActions.test.js +0 -157
- package/dist/components/SummaryList/GroupAction.test.js +0 -94
- package/dist/components/SummaryList/RowAction.test.js +0 -94
- package/dist/components/SummaryList/SummaryList.stories.mdx +0 -90
- package/dist/components/SummaryList/SummaryList.test.js +0 -361
- package/dist/components/TaskList/Task.test.js +0 -194
- package/dist/components/TaskList/TaskList.stories.mdx +0 -164
- package/dist/components/TaskList/TaskList.test.js +0 -334
- package/dist/components/TaskList/TaskState.test.js +0 -104
- package/dist/context/HooksContext/HooksContext.test.js +0 -60
- package/dist/context/ValidationContext/ValidationContext.test.js +0 -98
- package/dist/json/areYouACivilServant.json +0 -7
- package/dist/json/firstForm.json +0 -94
- package/dist/json/grade.json +0 -108
- package/dist/json/group.data.json +0 -21
- package/dist/json/group.json +0 -402
- package/dist/json/groupOfRow.json +0 -137
- package/dist/json/groupOfRowData.json +0 -15
- package/dist/json/port.json +0 -346
- package/dist/json/saveAndContinue.json +0 -98
- package/dist/json/sublocation.json +0 -859
- package/dist/json/taskList.json +0 -265
- package/dist/json/team.json +0 -17351
- package/dist/json/terminal.json +0 -81
- package/dist/json/userProfile.data.json +0 -21
- package/dist/json/userProfile.json +0 -276
- package/dist/setupTests.js +0 -59
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +0 -139
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +0 -76
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +0 -59
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +0 -256
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +0 -77
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +0 -199
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +0 -170
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +0 -323
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +0 -281
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +0 -64
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +0 -41
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +0 -54
- package/dist/utils/CollectionPage/mergeCollectionPages.test.js +0 -131
- package/dist/utils/Component/cleanAttributes.test.js +0 -69
- package/dist/utils/Component/elevateNestedComponents.test.js +0 -92
- package/dist/utils/Component/getDefaultValue.test.js +0 -53
- package/dist/utils/Component/isEditable.test.js +0 -42
- package/dist/utils/Component/showComponent.test.js +0 -157
- package/dist/utils/Condition/meetsAllConditions.test.js +0 -62
- package/dist/utils/Condition/meetsCondition.test.js +0 -391
- package/dist/utils/Condition/meetsOneCondition.test.js +0 -101
- package/dist/utils/Condition/setupConditions.test.js +0 -35
- package/dist/utils/Container/getEditableComponents.test.js +0 -146
- package/dist/utils/Container/setupNesting.test.js +0 -92
- package/dist/utils/Container/showContainer.test.js +0 -179
- package/dist/utils/Data/applyFormula.test.js +0 -264
- package/dist/utils/Data/getAutocompleteSource.test.js +0 -146
- package/dist/utils/Data/getDataPath.test.js +0 -52
- package/dist/utils/Data/getOptions.test.js +0 -71
- package/dist/utils/Data/getSourceData.test.js +0 -141
- package/dist/utils/Data/refDataToOptions.test.js +0 -197
- package/dist/utils/Data/setDataItem.test.js +0 -112
- package/dist/utils/Data/setupFormData.test.js +0 -276
- package/dist/utils/Data/setupRefDataUrlForComponent.test.js +0 -133
- package/dist/utils/FormPage/getFormPage.test.js +0 -205
- package/dist/utils/FormPage/getFormPages.test.js +0 -98
- package/dist/utils/FormPage/getPageActions.test.js +0 -89
- package/dist/utils/FormPage/getParagraphFromText.test.js +0 -29
- package/dist/utils/FormPage/showFormPage.test.js +0 -182
- package/dist/utils/FormPage/showFormPageCYA.test.js +0 -30
- package/dist/utils/FormPage/useComponent.test.js +0 -169
- package/dist/utils/Format/formatData.test.js +0 -46
- package/dist/utils/Format/formatDataForComponent.test.js +0 -161
- package/dist/utils/Format/formatDataForForm.test.js +0 -78
- package/dist/utils/Format/formatDataForPage.test.js +0 -96
- package/dist/utils/Hub/getFormHub.test.js +0 -107
- package/dist/utils/Operate/checkValueIsTruthy.test.js +0 -44
- package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +0 -159
- package/dist/utils/Operate/persistValueInFormData.test.js +0 -106
- package/dist/utils/Operate/runPageOperations.test.js +0 -107
- package/dist/utils/Operate/setValueInFormData.test.js +0 -46
- package/dist/utils/Operate/shouldRun.test.js +0 -69
- package/dist/utils/Validate/validateCollection.test.js +0 -74
- package/dist/utils/Validate/validateComponent.test.js +0 -267
- package/dist/utils/Validate/validateContainer.test.js +0 -81
- package/dist/utils/Validate/validateDate.test.js +0 -118
- package/dist/utils/Validate/validateEmail.test.js +0 -57
- package/dist/utils/Validate/validatePage.test.js +0 -383
- package/dist/utils/Validate/validateRegex.test.js +0 -41
- package/dist/utils/Validate/validateRequired.test.js +0 -62
- package/dist/utils/Validate/validateTime.test.js +0 -61
|
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
9
|
-
|
|
10
8
|
var _Component = _interopRequireDefault(require("../Component"));
|
|
11
|
-
|
|
12
9
|
var _getCYAAction = _interopRequireDefault(require("./getCYAAction"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
// Global imports
|
|
12
|
+
|
|
17
13
|
// Local imports
|
|
18
14
|
|
|
19
15
|
/**
|
|
@@ -27,12 +23,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
23
|
*/
|
|
28
24
|
var getCYARow = function getCYARow(page, component, onAction) {
|
|
29
25
|
var value = '';
|
|
30
|
-
|
|
31
26
|
if (page.formData && component.fieldId) {
|
|
32
27
|
value = page.formData[component.fieldId];
|
|
33
28
|
setNestedValue(component, page);
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
return {
|
|
37
31
|
pageId: page.id,
|
|
38
32
|
id: component.id,
|
|
@@ -45,10 +39,8 @@ var getCYARow = function getCYARow(page, component, onAction) {
|
|
|
45
39
|
action: (0, _getCYAAction.default)(component.readonly, page, onAction)
|
|
46
40
|
};
|
|
47
41
|
};
|
|
48
|
-
|
|
49
42
|
var setNestedValue = function setNestedValue(component, page) {
|
|
50
43
|
var _component$data, _component$data$optio;
|
|
51
|
-
|
|
52
44
|
(_component$data = component.data) === null || _component$data === void 0 ? void 0 : (_component$data$optio = _component$data.options) === null || _component$data$optio === void 0 ? void 0 : _component$data$optio.forEach(function (option) {
|
|
53
45
|
//check if option is selected and has nested component
|
|
54
46
|
if (Array.isArray(option.nested) && page.formData[component.id] === option.value) {
|
|
@@ -58,6 +50,5 @@ var setNestedValue = function setNestedValue(component, page) {
|
|
|
58
50
|
}
|
|
59
51
|
});
|
|
60
52
|
};
|
|
61
|
-
|
|
62
53
|
var _default = getCYARow;
|
|
63
54
|
exports.default = _default;
|
|
@@ -4,30 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _FormComponent = _interopRequireDefault(require("../../components/FormComponent"));
|
|
11
|
-
|
|
12
9
|
var _getCYAAction = _interopRequireDefault(require("./getCYAAction"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
-
|
|
20
13
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
-
|
|
22
14
|
var getRowValue = function getRowValue(row) {
|
|
23
15
|
if (!row.value) {
|
|
24
16
|
return null;
|
|
25
17
|
}
|
|
26
|
-
|
|
27
18
|
if (!row.component) {
|
|
28
19
|
return row.value;
|
|
29
20
|
}
|
|
30
|
-
|
|
31
21
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
22
|
key: row.id
|
|
33
23
|
}, /*#__PURE__*/_react.default.createElement(_FormComponent.default, {
|
|
@@ -38,33 +28,26 @@ var getRowValue = function getRowValue(row) {
|
|
|
38
28
|
value: row.value
|
|
39
29
|
}));
|
|
40
30
|
};
|
|
41
|
-
|
|
42
31
|
var getGroupValue = function getGroupValue(group, rows) {
|
|
43
32
|
var firstComponentIndex = -1;
|
|
44
|
-
|
|
45
33
|
var value = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, group.components.map(function (componentId) {
|
|
46
34
|
var rowIndex = rows.findIndex(function (r) {
|
|
47
35
|
return r.id === componentId;
|
|
48
36
|
});
|
|
49
|
-
|
|
50
37
|
if (firstComponentIndex < 0) {
|
|
51
38
|
firstComponentIndex = rowIndex;
|
|
52
39
|
}
|
|
53
|
-
|
|
54
40
|
return rowIndex > -1 ? getRowValue(rows[rowIndex]) : null;
|
|
55
41
|
}));
|
|
56
|
-
|
|
57
42
|
return {
|
|
58
43
|
value: value,
|
|
59
44
|
firstComponentIndex: firstComponentIndex
|
|
60
45
|
};
|
|
61
46
|
};
|
|
62
|
-
|
|
63
47
|
var getCYARowForGroup = function getCYARowForGroup(page, group, rows, onAction) {
|
|
64
48
|
var _getGroupValue = getGroupValue(group, rows),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
value = _getGroupValue.value,
|
|
50
|
+
firstComponentIndex = _getGroupValue.firstComponentIndex;
|
|
68
51
|
var row = {
|
|
69
52
|
pageId: page.id,
|
|
70
53
|
fieldId: group.id,
|
|
@@ -78,6 +61,5 @@ var getCYARowForGroup = function getCYARowForGroup(page, group, rows, onAction)
|
|
|
78
61
|
insertAt: firstComponentIndex
|
|
79
62
|
};
|
|
80
63
|
};
|
|
81
|
-
|
|
82
64
|
var _default = getCYARowForGroup;
|
|
83
65
|
exports.default = _default;
|
|
@@ -4,28 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
9
|
-
|
|
10
8
|
var _models = require("../../models");
|
|
11
|
-
|
|
12
9
|
var _getCYAAction = _interopRequireDefault(require("./getCYAAction"));
|
|
13
|
-
|
|
14
10
|
var _getCYARowsForContainer = _interopRequireDefault(require("./getCYARowsForContainer"));
|
|
15
|
-
|
|
16
11
|
var _showComponentCYA = _interopRequireDefault(require("./showComponentCYA"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
-
|
|
22
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
-
|
|
24
15
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
-
|
|
26
16
|
var getEntryToCollectionRow = function getEntryToCollectionRow(page, onAction) {
|
|
27
17
|
var _page$components$0$la;
|
|
28
|
-
|
|
29
18
|
return [{
|
|
30
19
|
pageId: page.id,
|
|
31
20
|
key: ((_page$components$0$la = page.components[0].labels) === null || _page$components$0$la === void 0 ? void 0 : _page$components$0$la.empty) || 'Nothing entered',
|
|
@@ -33,7 +22,6 @@ var getEntryToCollectionRow = function getEntryToCollectionRow(page, onAction) {
|
|
|
33
22
|
action: (0, _getCYAAction.default)(false, page, onAction)
|
|
34
23
|
}];
|
|
35
24
|
};
|
|
36
|
-
|
|
37
25
|
var getContainerForItem = function getContainerForItem(collection, item, labelCount, full_path) {
|
|
38
26
|
return {
|
|
39
27
|
id: item.id,
|
|
@@ -51,10 +39,8 @@ var getContainerForItem = function getContainerForItem(collection, item, labelCo
|
|
|
51
39
|
})
|
|
52
40
|
};
|
|
53
41
|
};
|
|
54
|
-
|
|
55
42
|
var getTitleRowForItem = function getTitleRowForItem(collection, item, pageId, labelCount, full_path) {
|
|
56
43
|
var labels = _objectSpread(_objectSpread({}, _models.CollectionLabels), collection.labels);
|
|
57
|
-
|
|
58
44
|
if (labels.item) {
|
|
59
45
|
return {
|
|
60
46
|
pageId: pageId,
|
|
@@ -67,10 +53,8 @@ var getTitleRowForItem = function getTitleRowForItem(collection, item, pageId, l
|
|
|
67
53
|
action: null
|
|
68
54
|
};
|
|
69
55
|
}
|
|
70
|
-
|
|
71
56
|
return null;
|
|
72
57
|
};
|
|
73
|
-
|
|
74
58
|
var getCYARowsForCollection = function getCYARowsForCollection(page, collection, items, onAction) {
|
|
75
59
|
if (Array.isArray(items) && items.length && (0, _showComponentCYA.default)(collection, page.formData)) {
|
|
76
60
|
return items.flatMap(function (item, index) {
|
|
@@ -82,9 +66,7 @@ var getCYARowsForCollection = function getCYARowsForCollection(page, collection,
|
|
|
82
66
|
return !!r;
|
|
83
67
|
});
|
|
84
68
|
}
|
|
85
|
-
|
|
86
69
|
return getEntryToCollectionRow(page, onAction);
|
|
87
70
|
};
|
|
88
|
-
|
|
89
71
|
var _default = getCYARowsForCollection;
|
|
90
72
|
exports.default = _default;
|
|
@@ -4,29 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
9
|
-
|
|
10
8
|
var _elevateNestedComponents = _interopRequireDefault(require("../Component/elevateNestedComponents"));
|
|
11
|
-
|
|
12
9
|
var _models = require("../../models");
|
|
13
|
-
|
|
14
10
|
var _getCYARowsForContainer = _interopRequireDefault(require("./getCYARowsForContainer"));
|
|
15
|
-
|
|
16
11
|
var _getCYACollectionDeleteAction = _interopRequireDefault(require("./getCYACollectionDeleteAction"));
|
|
17
|
-
|
|
18
12
|
var _getCYACollectionChangeAction = _interopRequireDefault(require("./getCYACollectionChangeAction"));
|
|
19
|
-
|
|
20
13
|
var _showComponentCYA = _interopRequireDefault(require("./showComponentCYA"));
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
-
|
|
26
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
-
|
|
28
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
|
-
|
|
30
18
|
var getContainerForPage = function getContainerForPage(page, item, labelCount, full_path) {
|
|
31
19
|
var allComponents = (0, _elevateNestedComponents.default)(page.components, item);
|
|
32
20
|
return {
|
|
@@ -44,17 +32,14 @@ var getContainerForPage = function getContainerForPage(page, item, labelCount, f
|
|
|
44
32
|
full_path: "".concat(full_path, ".").concat(component.fieldId)
|
|
45
33
|
});
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
return undefined;
|
|
49
36
|
}).filter(function (c) {
|
|
50
37
|
return c;
|
|
51
38
|
})
|
|
52
39
|
};
|
|
53
40
|
};
|
|
54
|
-
|
|
55
41
|
var getTitleRowForItem = function getTitleRowForItem(page, item, pageId, labelCount, full_path) {
|
|
56
42
|
var labels = _objectSpread(_objectSpread({}, _models.CollectionLabels), page.collection.labels);
|
|
57
|
-
|
|
58
43
|
return {
|
|
59
44
|
pageId: pageId,
|
|
60
45
|
fieldId: 'Title',
|
|
@@ -65,10 +50,8 @@ var getTitleRowForItem = function getTitleRowForItem(page, item, pageId, labelCo
|
|
|
65
50
|
type: 'title'
|
|
66
51
|
};
|
|
67
52
|
};
|
|
68
|
-
|
|
69
53
|
var getActionRows = function getActionRows(page, item, onAction, labelCount) {
|
|
70
54
|
var _page$collection, _page$collection$acti;
|
|
71
|
-
|
|
72
55
|
var actions = (_page$collection = page.collection) === null || _page$collection === void 0 ? void 0 : (_page$collection$acti = _page$collection.actions) === null || _page$collection$acti === void 0 ? void 0 : _page$collection$acti.map(function (action) {
|
|
73
56
|
if (action.type === 'remove') {
|
|
74
57
|
return (0, _getCYACollectionDeleteAction.default)(page, item, onAction, labelCount, action);
|
|
@@ -82,10 +65,8 @@ var getActionRows = function getActionRows(page, item, onAction, labelCount) {
|
|
|
82
65
|
});
|
|
83
66
|
return actions;
|
|
84
67
|
};
|
|
85
|
-
|
|
86
68
|
var getCYARowsForCollectionPage = function getCYARowsForCollectionPage(page, onAction) {
|
|
87
69
|
var _page$formData, _page$formData$page$c;
|
|
88
|
-
|
|
89
70
|
var rows = [];
|
|
90
71
|
(_page$formData = page.formData) === null || _page$formData === void 0 ? void 0 : (_page$formData$page$c = _page$formData[page.collection.name]) === null || _page$formData$page$c === void 0 ? void 0 : _page$formData$page$c.forEach(function (item, index) {
|
|
91
72
|
var labelCount = index + 1;
|
|
@@ -102,6 +83,5 @@ var getCYARowsForCollectionPage = function getCYARowsForCollectionPage(page, onA
|
|
|
102
83
|
return !!row;
|
|
103
84
|
});
|
|
104
85
|
};
|
|
105
|
-
|
|
106
86
|
var _default = getCYARowsForCollectionPage;
|
|
107
87
|
exports.default = _default;
|
|
@@ -4,44 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _models = require("../../models");
|
|
9
|
-
|
|
10
8
|
var _getCYARow = _interopRequireDefault(require("./getCYARow"));
|
|
11
|
-
|
|
12
9
|
var _getCYARowsForCollection = _interopRequireDefault(require("./getCYARowsForCollection"));
|
|
13
|
-
|
|
14
10
|
var _showComponentCYA = _interopRequireDefault(require("./showComponentCYA"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
15
|
var getCYARowsForContainer = function getCYARowsForContainer(page, container, formData, onAction) {
|
|
25
16
|
if ((0, _showComponentCYA.default)(container, page.formData)) {
|
|
26
17
|
return container.components.filter(function (c) {
|
|
27
18
|
return (0, _showComponentCYA.default)(c, page.formData);
|
|
28
19
|
}).flatMap(function (component) {
|
|
29
20
|
var fd = formData ? formData[component.fieldId] : undefined;
|
|
30
|
-
|
|
31
21
|
if (component.type === _models.ComponentTypes.CONTAINER) {
|
|
32
22
|
return getCYARowsForContainer(page, component, fd, onAction);
|
|
33
23
|
}
|
|
34
|
-
|
|
35
24
|
if (component.type === _models.ComponentTypes.COLLECTION) {
|
|
36
25
|
return (0, _getCYARowsForCollection.default)(page, component, fd, onAction);
|
|
37
26
|
}
|
|
38
|
-
|
|
39
27
|
return (0, _getCYARow.default)(_objectSpread(_objectSpread({}, page), {}, {
|
|
40
28
|
formData: formData
|
|
41
29
|
}), component, onAction);
|
|
42
30
|
});
|
|
43
31
|
}
|
|
44
32
|
};
|
|
45
|
-
|
|
46
33
|
var _default = getCYARowsForContainer;
|
|
47
34
|
exports.default = _default;
|
|
@@ -4,27 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _elevateNestedComponents = _interopRequireDefault(require("../Component/elevateNestedComponents"));
|
|
9
|
-
|
|
10
8
|
var _models = require("../../models");
|
|
11
|
-
|
|
12
9
|
var _FormPage = _interopRequireDefault(require("../FormPage"));
|
|
13
|
-
|
|
14
10
|
var _getCYARow = _interopRequireDefault(require("./getCYARow"));
|
|
15
|
-
|
|
16
11
|
var _getCYARowsForCollectionPage = _interopRequireDefault(require("./getCYARowsForCollectionPage"));
|
|
17
|
-
|
|
18
12
|
var _getCYARowForGroup2 = _interopRequireDefault(require("./getCYARowForGroup"));
|
|
19
|
-
|
|
20
13
|
var _getCYARowsForCollection = _interopRequireDefault(require("./getCYARowsForCollection"));
|
|
21
|
-
|
|
22
14
|
var _getCYARowsForContainer = _interopRequireDefault(require("./getCYARowsForContainer"));
|
|
23
|
-
|
|
24
15
|
var _showComponentCYA = _interopRequireDefault(require("./showComponentCYA"));
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
17
|
// Local imports
|
|
29
18
|
|
|
30
19
|
/**
|
|
@@ -38,11 +27,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
38
27
|
var getCYARowsForPage = function getCYARowsForPage(page, onAction) {
|
|
39
28
|
if (_FormPage.default.showCYA(page, page.formData)) {
|
|
40
29
|
var _page$groups;
|
|
41
|
-
|
|
42
30
|
if (page.collection) {
|
|
43
31
|
return (0, _getCYARowsForCollectionPage.default)(page, onAction);
|
|
44
32
|
}
|
|
45
|
-
|
|
46
33
|
var allComponents = (0, _elevateNestedComponents.default)(page.components, page.formData);
|
|
47
34
|
var rows = allComponents.filter(function (c) {
|
|
48
35
|
return (0, _showComponentCYA.default)(c, page.formData);
|
|
@@ -50,21 +37,17 @@ var getCYARowsForPage = function getCYARowsForPage(page, onAction) {
|
|
|
50
37
|
switch (component.type) {
|
|
51
38
|
case _models.ComponentTypes.CONTAINER:
|
|
52
39
|
return (0, _getCYARowsForContainer.default)(page, component, page.formData[component.fieldId], onAction);
|
|
53
|
-
|
|
54
40
|
case _models.ComponentTypes.COLLECTION:
|
|
55
41
|
return (0, _getCYARowsForCollection.default)(page, component, page.formData[component.fieldId], onAction);
|
|
56
|
-
|
|
57
42
|
default:
|
|
58
43
|
return (0, _getCYARow.default)(page, component, onAction);
|
|
59
44
|
}
|
|
60
45
|
});
|
|
61
|
-
|
|
62
46
|
if (((_page$groups = page.groups) === null || _page$groups === void 0 ? void 0 : _page$groups.length) > 0) {
|
|
63
47
|
page.groups.forEach(function (group) {
|
|
64
48
|
var _getCYARowForGroup = (0, _getCYARowForGroup2.default)(page, group, rows, onAction),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
row = _getCYARowForGroup.row,
|
|
50
|
+
insertAt = _getCYARowForGroup.insertAt;
|
|
68
51
|
if (insertAt > -1) {
|
|
69
52
|
rows.splice(insertAt, 0, row);
|
|
70
53
|
} else {
|
|
@@ -78,12 +61,9 @@ var getCYARowsForPage = function getCYARowsForPage(page, onAction) {
|
|
|
78
61
|
return !allReplacedIds.includes(r.id);
|
|
79
62
|
});
|
|
80
63
|
}
|
|
81
|
-
|
|
82
64
|
return rows;
|
|
83
65
|
}
|
|
84
|
-
|
|
85
66
|
return [];
|
|
86
67
|
};
|
|
87
|
-
|
|
88
68
|
var _default = getCYARowsForPage;
|
|
89
69
|
exports.default = _default;
|
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _getCYARowsForPage = _interopRequireDefault(require("./getCYARowsForPage"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
// Local imports
|
|
10
|
+
|
|
13
11
|
var CheckYourAnswers = {
|
|
14
12
|
getRows: _getCYARowsForPage.default
|
|
15
13
|
};
|
|
@@ -4,17 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _models = require("../../models");
|
|
9
|
-
|
|
10
8
|
var _Component = _interopRequireDefault(require("../Component"));
|
|
11
|
-
|
|
12
9
|
var _Container = _interopRequireDefault(require("../Container"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
// Local imports
|
|
12
|
+
|
|
17
13
|
var EXCLUDE_FROM_CYA = [_models.ComponentTypes.HEADING, _models.ComponentTypes.HTML, _models.ComponentTypes.INSET_TEXT];
|
|
14
|
+
|
|
18
15
|
/**
|
|
19
16
|
* Determines whether a given component should display on the Check your answers screen.
|
|
20
17
|
*
|
|
@@ -23,26 +20,20 @@ var EXCLUDE_FROM_CYA = [_models.ComponentTypes.HEADING, _models.ComponentTypes.H
|
|
|
23
20
|
*
|
|
24
21
|
* @returns A boolean true if the component should show; otherwise false.
|
|
25
22
|
*/
|
|
26
|
-
|
|
27
23
|
var showComponentCYA = function showComponentCYA(options, data) {
|
|
28
24
|
if (!options) {
|
|
29
25
|
return false;
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
if (EXCLUDE_FROM_CYA.includes(options.type)) {
|
|
33
28
|
return false;
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
if (options.hasOwnProperty('show_on_cya') && !options.show_on_cya) {
|
|
37
31
|
return false;
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
if (options.type === _models.ComponentTypes.CONTAINER) {
|
|
41
34
|
return _Container.default.show(options, data);
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
return _Component.default.show(options, data);
|
|
45
37
|
};
|
|
46
|
-
|
|
47
38
|
var _default = showComponentCYA;
|
|
48
39
|
exports.default = _default;
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _getCollectionPageActiveIndex = _interopRequireDefault(require("./getCollectionPageActiveIndex"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
|
|
14
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
|
|
16
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Duplicates the currently active entry in a named collection's data.
|
|
20
14
|
* Once duplicated, the new entry is set as the active entry.
|
|
@@ -24,22 +18,17 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
24
18
|
*/
|
|
25
19
|
var duplicateCollectionPageActiveEntry = function duplicateCollectionPageActiveEntry(collectionName, formData) {
|
|
26
20
|
var _formData$collectionN;
|
|
27
|
-
|
|
28
21
|
var currentIndex = (0, _getCollectionPageActiveIndex.default)(collectionName, formData);
|
|
29
22
|
var currentEntry = (_formData$collectionN = formData[collectionName]) === null || _formData$collectionN === void 0 ? void 0 : _formData$collectionN[currentIndex];
|
|
30
|
-
|
|
31
23
|
if (!currentEntry) {
|
|
32
24
|
return false;
|
|
33
25
|
}
|
|
34
|
-
|
|
35
26
|
var newEntry = _objectSpread(_objectSpread({}, currentEntry), {}, {
|
|
36
27
|
id: Date.now().toString()
|
|
37
28
|
});
|
|
38
|
-
|
|
39
29
|
formData[collectionName].push(newEntry);
|
|
40
30
|
formData["".concat(collectionName, "ActiveId")] = newEntry.id;
|
|
41
31
|
return true;
|
|
42
32
|
};
|
|
43
|
-
|
|
44
33
|
var _default = duplicateCollectionPageActiveEntry;
|
|
45
34
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Gets the index of the active entry in a named collection's data.
|
|
10
9
|
* @param {string} collectionName The name of the collection.
|
|
@@ -13,22 +12,17 @@ exports.default = void 0;
|
|
|
13
12
|
*/
|
|
14
13
|
var getCollectionPageActiveIndex = function getCollectionPageActiveIndex(collectionName, formData) {
|
|
15
14
|
var _formData$collectionN;
|
|
16
|
-
|
|
17
15
|
if (!collectionName) {
|
|
18
16
|
return null;
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
var id = formData === null || formData === void 0 ? void 0 : formData["".concat(collectionName, "ActiveId")];
|
|
22
|
-
|
|
23
19
|
if (!id) {
|
|
24
20
|
return null;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
var activeIndex = (_formData$collectionN = formData[collectionName]) === null || _formData$collectionN === void 0 ? void 0 : _formData$collectionN.findIndex(function (item) {
|
|
28
23
|
return item.id === id;
|
|
29
24
|
});
|
|
30
25
|
return activeIndex > -1 ? activeIndex : null;
|
|
31
26
|
};
|
|
32
|
-
|
|
33
27
|
var _default = getCollectionPageActiveIndex;
|
|
34
28
|
exports.default = _default;
|
|
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _duplicateCollectionPageActiveEntry = _interopRequireDefault(require("./duplicateCollectionPageActiveEntry"));
|
|
9
|
-
|
|
10
8
|
var _getCollectionPageActiveIndex = _interopRequireDefault(require("./getCollectionPageActiveIndex"));
|
|
11
|
-
|
|
12
9
|
var _mergeCollectionPages = _interopRequireDefault(require("./mergeCollectionPages"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
// Local imports
|
|
12
|
+
|
|
17
13
|
var CollectionPage = {
|
|
18
14
|
duplicateActiveEntry: _duplicateCollectionPageActiveEntry.default,
|
|
19
15
|
getActiveIndex: _getCollectionPageActiveIndex.default,
|
|
@@ -4,28 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _showFormPageCYA = _interopRequireDefault(require("../FormPage/showFormPageCYA"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
|
|
14
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
|
|
16
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
|
|
18
12
|
var createMasterPage = function createMasterPage(page) {
|
|
19
13
|
return _objectSpread(_objectSpread({}, page), {}, {
|
|
20
14
|
title: page.collection.name.charAt(0).toUpperCase() + page.collection.name.slice(1)
|
|
21
15
|
});
|
|
22
16
|
};
|
|
23
|
-
|
|
24
17
|
var mergeIntoMasterPage = function mergeIntoMasterPage(page, masterPage) {
|
|
25
18
|
masterPage.collection = _objectSpread(_objectSpread({}, masterPage.collection), page.collection);
|
|
26
19
|
masterPage.components = [].concat(masterPage.components, page.components);
|
|
27
20
|
masterPage.formData = _objectSpread({}, page.formData);
|
|
28
21
|
};
|
|
22
|
+
|
|
29
23
|
/**
|
|
30
24
|
* Loop over an array of pages, merging any CollectionPages into a
|
|
31
25
|
* single master page for that collection. A master page is created
|
|
@@ -37,13 +31,10 @@ var mergeIntoMasterPage = function mergeIntoMasterPage(page, masterPage) {
|
|
|
37
31
|
* @param { array } pages Array of pages in the form.
|
|
38
32
|
* @returns An array of the same pages, with a master page for each collection.
|
|
39
33
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
34
|
var mergeCollectionPages = function mergeCollectionPages(pages) {
|
|
43
35
|
var masterPages = {};
|
|
44
36
|
return pages.map(function (page) {
|
|
45
37
|
var _page$collection;
|
|
46
|
-
|
|
47
38
|
if ((_page$collection = page.collection) !== null && _page$collection !== void 0 && _page$collection.name && (0, _showFormPageCYA.default)(page, page.formData)) {
|
|
48
39
|
if (!masterPages[page.collection.name]) {
|
|
49
40
|
// If no master page exists for this collection.name, then
|
|
@@ -58,12 +49,10 @@ var mergeCollectionPages = function mergeCollectionPages(pages) {
|
|
|
58
49
|
return null;
|
|
59
50
|
}
|
|
60
51
|
}
|
|
61
|
-
|
|
62
52
|
return page;
|
|
63
53
|
}).filter(function (page) {
|
|
64
54
|
return !!page;
|
|
65
55
|
});
|
|
66
56
|
};
|
|
67
|
-
|
|
68
57
|
var _default = mergeCollectionPages;
|
|
69
58
|
exports.default = _default;
|
|
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.JSON_ONLY_PROPERTIES = void 0;
|
|
7
|
-
|
|
8
7
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
-
|
|
10
8
|
var JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additionalValidation', 'full_path', 'formData'];
|
|
9
|
+
|
|
11
10
|
/**
|
|
12
11
|
* This method removes and properties that are entirely specific to the JSON
|
|
13
12
|
* configuration and that should not be used as HTML attributes.
|
|
@@ -19,25 +18,19 @@ var JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additional
|
|
|
19
18
|
* @param {Array} alsoRemove An array of additional properties to remove.
|
|
20
19
|
* @returns A clean(er) JSON object.
|
|
21
20
|
*/
|
|
22
|
-
|
|
23
21
|
exports.JSON_ONLY_PROPERTIES = JSON_ONLY_PROPERTIES;
|
|
24
|
-
|
|
25
22
|
var cleanAttributes = function cleanAttributes(options) {
|
|
26
23
|
var alsoRemove = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
27
24
|
var removeKeys = Array.isArray(alsoRemove) ? [].concat(JSON_ONLY_PROPERTIES, alsoRemove) : JSON_ONLY_PROPERTIES;
|
|
28
|
-
|
|
29
25
|
if (options && _typeof(options) === 'object') {
|
|
30
26
|
return Object.keys(options).reduce(function (obj, key) {
|
|
31
27
|
if (!removeKeys.includes(key)) {
|
|
32
28
|
obj[key] = options[key];
|
|
33
29
|
}
|
|
34
|
-
|
|
35
30
|
return obj;
|
|
36
31
|
}, {});
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
return {};
|
|
40
34
|
};
|
|
41
|
-
|
|
42
35
|
var _default = cleanAttributes;
|
|
43
36
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Iterates over an array of components and brings any nested
|
|
10
9
|
* components that should be visible into the top level array.
|
|
@@ -35,7 +34,6 @@ var elevateNestedComponents = function elevateNestedComponents(components, data)
|
|
|
35
34
|
var allComponents = [];
|
|
36
35
|
components === null || components === void 0 ? void 0 : components.forEach(function (component) {
|
|
37
36
|
var _component$data, _component$data$optio;
|
|
38
|
-
|
|
39
37
|
allComponents.push(component);
|
|
40
38
|
(_component$data = component.data) === null || _component$data === void 0 ? void 0 : (_component$data$optio = _component$data.options) === null || _component$data$optio === void 0 ? void 0 : _component$data$optio.forEach(function (option) {
|
|
41
39
|
// If this option has nested components and is
|
|
@@ -47,6 +45,5 @@ var elevateNestedComponents = function elevateNestedComponents(components, data)
|
|
|
47
45
|
});
|
|
48
46
|
return allComponents;
|
|
49
47
|
};
|
|
50
|
-
|
|
51
48
|
var _default = elevateNestedComponents;
|
|
52
49
|
exports.default = _default;
|