@ukhomeoffice/cop-react-form-renderer 5.14.2 → 5.14.4
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 +15 -15
- package/dist/components/CheckYourAnswers/Answer.test.js +94 -128
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +99 -129
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +291 -501
- package/dist/components/CheckYourAnswers/index.js +2 -3
- package/dist/components/CollectionPage/CollectionPage.js +64 -58
- package/dist/components/CollectionPage/CollectionPage.test.js +212 -238
- package/dist/components/CollectionPage/index.js +2 -3
- package/dist/components/FormComponent/Collection.js +77 -113
- package/dist/components/FormComponent/Collection.test.js +688 -787
- package/dist/components/FormComponent/Container.js +44 -43
- package/dist/components/FormComponent/Container.test.js +316 -346
- package/dist/components/FormComponent/FormComponent.js +58 -64
- package/dist/components/FormComponent/FormComponent.test.js +180 -219
- package/dist/components/FormComponent/helpers/addLabel.js +5 -9
- package/dist/components/FormComponent/helpers/getComponentDisabled.js +2 -3
- package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +8 -8
- package/dist/components/FormComponent/helpers/getComponentError.js +4 -7
- package/dist/components/FormComponent/helpers/getComponentError.test.js +15 -15
- package/dist/components/FormComponent/helpers/getComponentFieldSet.js +2 -2
- package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +7 -7
- package/dist/components/FormComponent/helpers/index.js +5 -5
- package/dist/components/FormComponent/index.js +2 -3
- package/dist/components/FormPage/FormPage.js +65 -79
- package/dist/components/FormPage/FormPage.test.js +134 -170
- package/dist/components/FormPage/index.js +2 -3
- package/dist/components/FormRenderer/FormRenderer.js +151 -193
- package/dist/components/FormRenderer/FormRenderer.test.js +598 -920
- package/dist/components/FormRenderer/handlers/cyaAction.js +4 -5
- package/dist/components/FormRenderer/handlers/getPageId.js +2 -5
- package/dist/components/FormRenderer/handlers/getPageId.test.js +15 -15
- package/dist/components/FormRenderer/handlers/handlers.test.js +33 -33
- package/dist/components/FormRenderer/handlers/index.js +3 -4
- package/dist/components/FormRenderer/handlers/navigate.js +5 -6
- package/dist/components/FormRenderer/handlers/submissionError.js +2 -3
- package/dist/components/FormRenderer/helpers/canActionProceed.js +2 -3
- package/dist/components/FormRenderer/helpers/canActionProceed.test.js +10 -10
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +2 -5
- package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +17 -21
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +19 -27
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +17 -17
- package/dist/components/FormRenderer/helpers/getCYA.js +6 -9
- package/dist/components/FormRenderer/helpers/getCYA.test.js +12 -12
- package/dist/components/FormRenderer/helpers/getFormState.js +7 -10
- package/dist/components/FormRenderer/helpers/getFormState.test.js +11 -11
- package/dist/components/FormRenderer/helpers/getNextPageId.js +19 -34
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +68 -68
- package/dist/components/FormRenderer/helpers/getPage.js +3 -6
- package/dist/components/FormRenderer/helpers/getPage.test.js +12 -12
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +9 -13
- package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +15 -15
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +12 -13
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +98 -92
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +66 -66
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +72 -79
- package/dist/components/FormRenderer/helpers/index.js +3 -4
- package/dist/components/FormRenderer/index.js +2 -3
- package/dist/components/FormRenderer/onCYAAction.js +52 -62
- package/dist/components/FormRenderer/onCYAAction.test.js +146 -138
- package/dist/components/FormRenderer/onPageAction.js +48 -47
- package/dist/components/FormRenderer/onPageAction.test.js +219 -205
- package/dist/components/FormRenderer/onTaskAction.js +12 -17
- package/dist/components/FormRenderer/onTaskAction.test.js +94 -89
- package/dist/components/PageActions/ActionButton.js +15 -19
- package/dist/components/PageActions/ActionButton.test.js +58 -79
- package/dist/components/PageActions/PageActions.js +12 -13
- package/dist/components/PageActions/PageActions.test.js +88 -116
- package/dist/components/PageActions/index.js +2 -3
- package/dist/components/SummaryList/GroupAction.js +15 -23
- package/dist/components/SummaryList/GroupAction.test.js +41 -37
- package/dist/components/SummaryList/RowAction.js +14 -19
- package/dist/components/SummaryList/RowAction.test.js +41 -37
- package/dist/components/SummaryList/SummaryList.js +25 -30
- package/dist/components/SummaryList/SummaryList.test.js +160 -182
- package/dist/components/SummaryList/SummaryListHeadingRow.js +9 -8
- package/dist/components/SummaryList/SummaryListRow.js +9 -8
- package/dist/components/SummaryList/SummaryListTitleRow.js +8 -7
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +5 -8
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +24 -24
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +5 -8
- package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +24 -24
- package/dist/components/SummaryList/helpers/index.js +2 -2
- package/dist/components/SummaryList/index.js +2 -3
- package/dist/components/TaskList/Task.js +22 -33
- package/dist/components/TaskList/Task.test.js +84 -77
- package/dist/components/TaskList/TaskList.js +46 -75
- package/dist/components/TaskList/TaskList.test.js +118 -113
- package/dist/components/TaskList/TaskState.js +9 -9
- package/dist/components/TaskList/TaskState.test.js +56 -49
- package/dist/components/TaskList/index.js +2 -3
- package/dist/components/index.js +8 -8
- package/dist/context/HooksContext/HooksContext.js +59 -85
- package/dist/context/HooksContext/HooksContext.test.js +28 -36
- package/dist/context/HooksContext/index.js +4 -6
- package/dist/context/ValidationContext/ValidationContext.js +35 -76
- package/dist/context/ValidationContext/ValidationContext.test.js +50 -61
- package/dist/context/ValidationContext/index.js +4 -6
- package/dist/context/index.js +3 -3
- package/dist/hooks/index.js +10 -11
- package/dist/hooks/useAxios.js +17 -43
- package/dist/hooks/useGetRequest.js +61 -106
- package/dist/hooks/useHooks.js +2 -5
- package/dist/hooks/useRefData.js +29 -45
- package/dist/hooks/useValidation.js +2 -5
- package/dist/index.js +15 -17
- package/dist/models/CollectionLabels.js +2 -3
- package/dist/models/ComponentTypes.js +25 -26
- package/dist/models/EventTypes.js +5 -6
- package/dist/models/FormPages.js +5 -6
- package/dist/models/FormTypes.js +9 -10
- package/dist/models/HubFormats.js +4 -5
- package/dist/models/PageAction.js +45 -42
- package/dist/models/TaskStates.js +30 -31
- package/dist/models/index.js +11 -12
- package/dist/setupTests.js +20 -24
- package/dist/utils/CheckYourAnswers/getCYAAction.js +6 -7
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +53 -55
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +18 -20
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +21 -23
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +17 -21
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +18 -20
- package/dist/utils/CheckYourAnswers/getCYARow.js +8 -10
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +72 -72
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +20 -27
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +16 -17
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +41 -47
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +72 -75
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +71 -78
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +133 -114
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +27 -23
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +112 -106
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +16 -23
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +77 -83
- package/dist/utils/CheckYourAnswers/index.js +3 -4
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +7 -9
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +25 -25
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +9 -16
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +19 -20
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +4 -8
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +15 -15
- package/dist/utils/CollectionPage/index.js +3 -4
- package/dist/utils/CollectionPage/mergeCollectionPages.js +26 -29
- package/dist/utils/CollectionPage/mergeCollectionPages.test.js +15 -15
- package/dist/utils/Component/addShowWhen.js +5 -10
- package/dist/utils/Component/addShowWhen.test.js +38 -38
- package/dist/utils/Component/applyToComponentTree.js +20 -22
- package/dist/utils/Component/applyToComponentTree.test.js +28 -33
- package/dist/utils/Component/cleanAttributes.js +11 -16
- package/dist/utils/Component/cleanAttributes.test.js +17 -18
- package/dist/utils/Component/elevateNestedComponents.js +7 -9
- package/dist/utils/Component/elevateNestedComponents.test.js +19 -19
- package/dist/utils/Component/getComponent.js +91 -99
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +19 -18
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +51 -63
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +41 -49
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +33 -37
- package/dist/utils/Component/getComponentTests/getComponent.details.test.js +21 -19
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +23 -27
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +12 -11
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +18 -16
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +10 -9
- package/dist/utils/Component/getComponentTests/getComponent.list.test.js +18 -16
- package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +24 -27
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +156 -175
- package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +18 -16
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +59 -73
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +35 -41
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +24 -32
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +10 -9
- package/dist/utils/Component/getDefaultValue.js +7 -9
- package/dist/utils/Component/getDefaultValue.test.js +14 -14
- package/dist/utils/Component/index.js +3 -4
- package/dist/utils/Component/isEditable.js +3 -7
- package/dist/utils/Component/isEditable.test.js +14 -15
- package/dist/utils/Component/optionIsSelected.js +2 -3
- package/dist/utils/Component/optionIsSelected.test.js +10 -10
- package/dist/utils/Component/setupContainerComponentsPath.js +30 -33
- package/dist/utils/Component/setupContainerComponentsPath.test.js +16 -16
- package/dist/utils/Component/showComponent.js +4 -6
- package/dist/utils/Component/showComponent.test.js +29 -29
- package/dist/utils/Component/wrapInFormGroup.js +6 -6
- package/dist/utils/Condition/index.js +3 -4
- package/dist/utils/Condition/meetsAllConditions.js +9 -10
- package/dist/utils/Condition/meetsAllConditions.test.js +18 -18
- package/dist/utils/Condition/meetsCondition.js +19 -27
- package/dist/utils/Condition/meetsCondition.test.js +377 -377
- package/dist/utils/Condition/meetsOneCondition.js +7 -8
- package/dist/utils/Condition/meetsOneCondition.test.js +17 -17
- package/dist/utils/Condition/setupConditions.js +15 -21
- package/dist/utils/Condition/setupConditions.test.js +8 -8
- package/dist/utils/Container/getEditableComponents.js +5 -8
- package/dist/utils/Container/getEditableComponents.test.js +44 -46
- package/dist/utils/Container/index.js +3 -4
- package/dist/utils/Container/setupNesting.js +17 -24
- package/dist/utils/Container/setupNesting.test.js +28 -31
- package/dist/utils/Container/showContainer.js +5 -10
- package/dist/utils/Container/showContainer.test.js +31 -31
- package/dist/utils/Data/applyFormula.js +41 -52
- package/dist/utils/Data/applyFormula.test.js +26 -26
- package/dist/utils/Data/getAutocompleteSource.js +11 -14
- package/dist/utils/Data/getAutocompleteSource.test.js +59 -59
- package/dist/utils/Data/getDataPath.js +21 -32
- package/dist/utils/Data/getDataPath.test.js +20 -20
- package/dist/utils/Data/getOptions.js +22 -28
- package/dist/utils/Data/getOptions.test.js +21 -21
- package/dist/utils/Data/getSourceData.js +7 -21
- package/dist/utils/Data/getSourceData.test.js +85 -81
- package/dist/utils/Data/index.js +3 -4
- package/dist/utils/Data/refDataToOptions.js +12 -17
- package/dist/utils/Data/refDataToOptions.test.js +20 -20
- package/dist/utils/Data/setDataItem.js +8 -10
- package/dist/utils/Data/setDataItem.test.js +38 -38
- package/dist/utils/Data/setupFormData.js +32 -48
- package/dist/utils/Data/setupFormData.test.js +99 -98
- package/dist/utils/Data/setupRefDataUrlForComponent.js +22 -30
- package/dist/utils/Data/setupRefDataUrlForComponent.test.js +28 -28
- package/dist/utils/FormPage/applyConditionalProperties.js +7 -12
- package/dist/utils/FormPage/applyConditionalProperties.test.js +16 -19
- package/dist/utils/FormPage/getFormPage.js +17 -19
- package/dist/utils/FormPage/getFormPage.test.js +49 -48
- package/dist/utils/FormPage/getFormPages.js +9 -15
- package/dist/utils/FormPage/getFormPages.test.js +22 -25
- package/dist/utils/FormPage/getPageActions.js +11 -19
- package/dist/utils/FormPage/getPageActions.test.js +33 -33
- package/dist/utils/FormPage/getParagraphFromText.js +6 -9
- package/dist/utils/FormPage/getParagraphFromText.test.js +7 -7
- package/dist/utils/FormPage/index.js +3 -4
- package/dist/utils/FormPage/showFormPage.js +5 -10
- package/dist/utils/FormPage/showFormPage.test.js +33 -33
- package/dist/utils/FormPage/showFormPageCYA.js +4 -5
- package/dist/utils/FormPage/showFormPageCYA.test.js +9 -9
- package/dist/utils/FormPage/useComponent.js +21 -29
- package/dist/utils/FormPage/useComponent.test.js +71 -73
- package/dist/utils/Format/formatData.js +2 -3
- package/dist/utils/Format/formatData.test.js +19 -19
- package/dist/utils/Format/formatDataForComponent.js +6 -9
- package/dist/utils/Format/formatDataForComponent.test.js +50 -78
- package/dist/utils/Format/formatDataForForm.js +7 -10
- package/dist/utils/Format/formatDataForForm.test.js +14 -17
- package/dist/utils/Format/formatDataForPage.js +4 -7
- package/dist/utils/Format/formatDataForPage.test.js +20 -25
- package/dist/utils/Format/index.js +3 -4
- package/dist/utils/Hub/getFormHub.js +3 -4
- package/dist/utils/Hub/getFormHub.test.js +29 -32
- package/dist/utils/Hub/index.js +3 -4
- package/dist/utils/Meta/constants.js +2 -4
- package/dist/utils/Meta/documents/getDocuments.js +2 -6
- package/dist/utils/Meta/documents/getDocuments.test.js +25 -17
- package/dist/utils/Meta/documents/index.js +3 -4
- package/dist/utils/Meta/documents/setDocumentsForField.js +16 -19
- package/dist/utils/Meta/documents/setDocumentsForField.test.js +69 -35
- package/dist/utils/Meta/index.js +3 -4
- package/dist/utils/Operate/checkValueIsTruthy.js +5 -6
- package/dist/utils/Operate/checkValueIsTruthy.test.js +17 -17
- package/dist/utils/Operate/getFirstOf.js +9 -10
- package/dist/utils/Operate/getFirstOf.test.js +33 -33
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +13 -14
- package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +47 -53
- package/dist/utils/Operate/index.js +3 -4
- package/dist/utils/Operate/persistValueInFormData.js +7 -8
- package/dist/utils/Operate/persistValueInFormData.test.js +23 -21
- package/dist/utils/Operate/runPageOperations.js +10 -11
- package/dist/utils/Operate/runPageOperations.test.js +36 -37
- package/dist/utils/Operate/setValueInFormData.js +6 -7
- package/dist/utils/Operate/setValueInFormData.test.js +17 -17
- package/dist/utils/Operate/shouldRun.js +9 -10
- package/dist/utils/Operate/shouldRun.test.js +22 -28
- package/dist/utils/Validate/additional/conditionallyRequired.js +5 -7
- package/dist/utils/Validate/additional/conditionallyRequired.test.js +19 -19
- package/dist/utils/Validate/additional/index.js +8 -9
- package/dist/utils/Validate/additional/index.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeAfter.js +4 -5
- package/dist/utils/Validate/additional/mustBeAfter.test.js +41 -41
- package/dist/utils/Validate/additional/mustBeBefore.js +4 -5
- package/dist/utils/Validate/additional/mustBeBefore.test.js +29 -29
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +8 -14
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +34 -38
- package/dist/utils/Validate/additional/mustBeGreaterThan.js +3 -4
- package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +19 -19
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +5 -6
- package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeInThePast.js +6 -7
- package/dist/utils/Validate/additional/mustBeInThePast.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeLessThan.js +3 -4
- package/dist/utils/Validate/additional/mustBeLessThan.test.js +18 -18
- package/dist/utils/Validate/additional/mustBeLongerThan.js +2 -3
- package/dist/utils/Validate/additional/mustBeLongerThan.test.js +17 -17
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +3 -4
- package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +21 -21
- package/dist/utils/Validate/additional/mustBeShorterThan.js +2 -3
- package/dist/utils/Validate/additional/mustBeShorterThan.test.js +17 -17
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +4 -7
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +15 -17
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +2 -3
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +13 -13
- package/dist/utils/Validate/additional/mustSelectOnlyOne.js +4 -7
- package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +29 -27
- package/dist/utils/Validate/additional/utils.js +9 -25
- package/dist/utils/Validate/index.js +3 -4
- package/dist/utils/Validate/validateCollection.js +22 -29
- package/dist/utils/Validate/validateCollection.test.js +85 -77
- package/dist/utils/Validate/validateComponent.js +19 -19
- package/dist/utils/Validate/validateComponent.test.js +169 -147
- package/dist/utils/Validate/validateContainer.js +16 -22
- package/dist/utils/Validate/validateContainer.test.js +52 -48
- package/dist/utils/Validate/validateDate.js +14 -21
- package/dist/utils/Validate/validateDate.test.js +28 -29
- package/dist/utils/Validate/validateEmail.js +8 -11
- package/dist/utils/Validate/validateEmail.test.js +26 -26
- package/dist/utils/Validate/validateMultifile.js +6 -10
- package/dist/utils/Validate/validateMultifile.test.js +17 -18
- package/dist/utils/Validate/validatePage.js +20 -22
- package/dist/utils/Validate/validatePage.test.js +146 -143
- package/dist/utils/Validate/validateRegex.js +6 -10
- package/dist/utils/Validate/validateRegex.test.js +17 -17
- package/dist/utils/Validate/validateRequired.js +6 -9
- package/dist/utils/Validate/validateRequired.test.js +19 -19
- package/dist/utils/Validate/validateTextArea.js +6 -9
- package/dist/utils/Validate/validateTextArea.test.js +21 -21
- package/dist/utils/Validate/validateTime.js +8 -16
- package/dist/utils/Validate/validateTime.test.js +15 -15
- package/dist/utils/index.js +10 -12
- package/package.json +9 -6
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -20,44 +19,34 @@ var _handlers = _interopRequireDefault(require("./handlers"));
|
|
|
20
19
|
var _helpers = _interopRequireDefault(require("./helpers"));
|
|
21
20
|
var _onCYAAction = _interopRequireDefault(require("./onCYAAction"));
|
|
22
21
|
var _onPageAction = _interopRequireDefault(require("./onPageAction"));
|
|
23
|
-
var
|
|
22
|
+
var _onTaskAction = _interopRequireDefault(require("./onTaskAction"));
|
|
24
23
|
require("./FormRenderer.scss");
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
function
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
hashLink = _ref.hashLink,
|
|
52
|
-
hooks = _ref.hooks,
|
|
53
|
-
classBlock = _ref.classBlock,
|
|
54
|
-
classModifiers = _ref.classModifiers,
|
|
55
|
-
className = _ref.className,
|
|
56
|
-
hideTitle = _ref.hide_title,
|
|
57
|
-
summaryListClassModifiers = _ref.summaryListClassModifiers,
|
|
58
|
-
noChangeAction = _ref.noChangeAction,
|
|
59
|
-
newPageId = _ref.newPageId,
|
|
60
|
-
viewOnly = _ref.viewOnly;
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
|
+
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; }
|
|
27
|
+
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); } /* eslint-disable no-shadow */ // Global imports
|
|
28
|
+
// Local imports
|
|
29
|
+
// Styles
|
|
30
|
+
const FormRenderer = _ref => {
|
|
31
|
+
let {
|
|
32
|
+
title,
|
|
33
|
+
type,
|
|
34
|
+
components,
|
|
35
|
+
pages,
|
|
36
|
+
hub,
|
|
37
|
+
cya,
|
|
38
|
+
data,
|
|
39
|
+
hashLink,
|
|
40
|
+
hooks,
|
|
41
|
+
classBlock,
|
|
42
|
+
classModifiers,
|
|
43
|
+
className,
|
|
44
|
+
hide_title: hideTitle,
|
|
45
|
+
summaryListClassModifiers,
|
|
46
|
+
noChangeAction,
|
|
47
|
+
newPageId,
|
|
48
|
+
viewOnly
|
|
49
|
+
} = _ref;
|
|
61
50
|
return /*#__PURE__*/_react.default.createElement(_context.HooksContextProvider, {
|
|
62
51
|
overrides: hooks
|
|
63
52
|
}, /*#__PURE__*/_react.default.createElement(_context.ValidationContextProvider, null, /*#__PURE__*/_react.default.createElement(InternalFormRenderer, {
|
|
@@ -79,205 +68,176 @@ var FormRenderer = function FormRenderer(_ref) {
|
|
|
79
68
|
viewOnly: viewOnly
|
|
80
69
|
})));
|
|
81
70
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
71
|
+
const DEFAULT_CLASS = exports.DEFAULT_CLASS = 'hods-form';
|
|
72
|
+
const InternalFormRenderer = _ref2 => {
|
|
73
|
+
let {
|
|
74
|
+
title,
|
|
75
|
+
type,
|
|
76
|
+
components,
|
|
77
|
+
pages: _pages,
|
|
78
|
+
hub: _hub,
|
|
79
|
+
cya,
|
|
80
|
+
data: _data,
|
|
81
|
+
classBlock,
|
|
82
|
+
classModifiers,
|
|
83
|
+
className,
|
|
84
|
+
hashLink,
|
|
85
|
+
hide_title: hideTitle,
|
|
86
|
+
summaryListClassModifiers,
|
|
87
|
+
noChangeAction,
|
|
88
|
+
newPageId,
|
|
89
|
+
viewOnly
|
|
90
|
+
} = _ref2;
|
|
102
91
|
// Set up the initial states.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
pages = _useState6[0],
|
|
114
|
-
setPages = _useState6[1];
|
|
115
|
-
var _useState7 = (0, _react.useState)(undefined),
|
|
116
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
117
|
-
hub = _useState8[0],
|
|
118
|
-
setHub = _useState8[1];
|
|
119
|
-
var _useState9 = (0, _react.useState)(_helpers.default.getNextPageId(type, _pages, null, null, _data)),
|
|
120
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
121
|
-
pageId = _useState10[0],
|
|
122
|
-
setPageId = _useState10[1];
|
|
123
|
-
var _useState11 = (0, _react.useState)(_helpers.default.getFormState(pageId, pages, hub)),
|
|
124
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
125
|
-
formState = _useState12[0],
|
|
126
|
-
setFormState = _useState12[1];
|
|
127
|
-
var _useState13 = (0, _react.useState)({}),
|
|
128
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
129
|
-
currentTask = _useState14[0],
|
|
130
|
-
setCurrentTask = _useState14[1];
|
|
131
|
-
var _useState15 = (0, _react.useState)({}),
|
|
132
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
133
|
-
hubDetails = _useState16[0],
|
|
134
|
-
setHubDetails = _useState16[1];
|
|
135
|
-
var _useState17 = (0, _react.useState)('load'),
|
|
136
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
137
|
-
pagePoint = _useState18[0],
|
|
138
|
-
setPagePoint = _useState18[1];
|
|
139
|
-
var _useState19 = (0, _react.useState)(false),
|
|
140
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
141
|
-
goingBack = _useState20[0],
|
|
142
|
-
setGoingBack = _useState20[1];
|
|
92
|
+
const [data, setData] = (0, _react.useState)({});
|
|
93
|
+
const [submitted, setSubmitted] = (0, _react.useState)();
|
|
94
|
+
const [pages, setPages] = (0, _react.useState)([]);
|
|
95
|
+
const [hub, setHub] = (0, _react.useState)(undefined);
|
|
96
|
+
const [pageId, setPageId] = (0, _react.useState)(_helpers.default.getNextPageId(type, _pages, null, null, _data));
|
|
97
|
+
const [formState, setFormState] = (0, _react.useState)(_helpers.default.getFormState(pageId, pages, hub));
|
|
98
|
+
const [currentTask, setCurrentTask] = (0, _react.useState)({});
|
|
99
|
+
const [hubDetails, setHubDetails] = (0, _react.useState)({});
|
|
100
|
+
const [pagePoint, setPagePoint] = (0, _react.useState)('load');
|
|
101
|
+
const [goingBack, setGoingBack] = (0, _react.useState)(false);
|
|
143
102
|
|
|
144
103
|
// Set up hooks.
|
|
145
|
-
|
|
146
|
-
hooks
|
|
104
|
+
const {
|
|
105
|
+
hooks
|
|
106
|
+
} = (0, _hooks.useHooks)();
|
|
147
107
|
|
|
148
108
|
// Set up the useValidation hook.
|
|
149
|
-
|
|
150
|
-
addErrors
|
|
151
|
-
clearErrors
|
|
152
|
-
validate
|
|
109
|
+
const {
|
|
110
|
+
addErrors,
|
|
111
|
+
clearErrors,
|
|
112
|
+
validate
|
|
113
|
+
} = (0, _hooks.useValidation)();
|
|
153
114
|
|
|
154
115
|
// Need to set submission data when going back
|
|
155
|
-
window.onpopstate =
|
|
156
|
-
var _formState$page;
|
|
116
|
+
window.onpopstate = e => {
|
|
157
117
|
if (document.location.hash) {
|
|
158
118
|
return;
|
|
159
119
|
}
|
|
160
120
|
if (e.state && e.state.fullPages !== undefined) {
|
|
161
|
-
setCurrentTask(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
});
|
|
166
|
-
});
|
|
121
|
+
setCurrentTask(prev => ({
|
|
122
|
+
...prev,
|
|
123
|
+
fullPages: e.state?.fullPages
|
|
124
|
+
}));
|
|
167
125
|
}
|
|
168
126
|
setGoingBack(true);
|
|
169
127
|
hooks.onGoingBack(e.state ? e.state : null);
|
|
170
128
|
clearErrors();
|
|
171
|
-
if (components && pages && data &&
|
|
172
|
-
|
|
173
|
-
pages
|
|
174
|
-
components
|
|
175
|
-
},
|
|
129
|
+
if (components && pages && data && formState.page?.formData && pagePoint === undefined) {
|
|
130
|
+
const submissionData = _utils.default.Format.form({
|
|
131
|
+
pages,
|
|
132
|
+
components
|
|
133
|
+
}, {
|
|
134
|
+
...data,
|
|
135
|
+
...formState.page.formData
|
|
136
|
+
}, _models.EventTypes.SUBMIT);
|
|
176
137
|
setData(submissionData);
|
|
177
138
|
}
|
|
178
139
|
};
|
|
179
140
|
|
|
180
141
|
// Setup data.
|
|
181
|
-
(0, _react.useEffect)(
|
|
142
|
+
(0, _react.useEffect)(() => {
|
|
182
143
|
if (components && _pages && _data && (pagePoint === 'load' || viewOnly)) {
|
|
183
|
-
var _data$formStatus;
|
|
184
144
|
setData(_utils.default.Data.setupForm(_pages, components, _data));
|
|
185
|
-
if (
|
|
145
|
+
if (_data.formStatus?.page) {
|
|
186
146
|
setPageId(_data.formStatus.page);
|
|
187
147
|
}
|
|
188
148
|
}
|
|
189
149
|
}, [components, _pages, _data, setData, pagePoint, viewOnly]);
|
|
190
150
|
|
|
191
151
|
// Setup pages.
|
|
192
|
-
(0, _react.useEffect)(
|
|
193
|
-
setPages(_utils.default.FormPage.getAll(_pages, components,
|
|
152
|
+
(0, _react.useEffect)(() => {
|
|
153
|
+
setPages(_utils.default.FormPage.getAll(_pages, components, {
|
|
154
|
+
...data
|
|
155
|
+
}));
|
|
194
156
|
}, [components, _pages, data, setPages]);
|
|
195
157
|
|
|
196
158
|
// Setup initial pageId.
|
|
197
|
-
(0, _react.useEffect)(
|
|
198
|
-
setPageId(
|
|
199
|
-
return prev || _helpers.default.getNextPageId(type, pages);
|
|
200
|
-
});
|
|
159
|
+
(0, _react.useEffect)(() => {
|
|
160
|
+
setPageId(prev => prev || _helpers.default.getNextPageId(type, pages));
|
|
201
161
|
}, [type, pages, setPageId]);
|
|
202
162
|
|
|
203
163
|
// Setup hub.
|
|
204
|
-
(0, _react.useEffect)(
|
|
205
|
-
setHub(_utils.default.Hub.get(type, _hub, components,
|
|
164
|
+
(0, _react.useEffect)(() => {
|
|
165
|
+
setHub(_utils.default.Hub.get(type, _hub, components, {
|
|
166
|
+
...data
|
|
167
|
+
}));
|
|
206
168
|
}, [type, _hub, data, components, setHub]);
|
|
207
169
|
|
|
208
170
|
// Form state.
|
|
209
|
-
(0, _react.useEffect)(
|
|
210
|
-
var _formState$page2;
|
|
171
|
+
(0, _react.useEffect)(() => {
|
|
211
172
|
// revert formData changes if going back in hub-and-spoke
|
|
212
|
-
if (type === _models.FormTypes.HUB && goingBack && data &&
|
|
213
|
-
formState.page.formData =
|
|
173
|
+
if (type === _models.FormTypes.HUB && goingBack && data && formState.page?.formData) {
|
|
174
|
+
formState.page.formData = {
|
|
175
|
+
...data
|
|
176
|
+
};
|
|
214
177
|
}
|
|
215
178
|
setGoingBack(false);
|
|
216
179
|
setFormState(_helpers.default.getFormState(pageId, pages, hub));
|
|
217
180
|
}, [pages, hub, pageId, setFormState, type, goingBack, data, formState.page]);
|
|
218
181
|
|
|
219
182
|
// Call the onFormLoad hook just when this component first renders.
|
|
220
|
-
(0, _react.useEffect)(
|
|
183
|
+
(0, _react.useEffect)(() => {
|
|
221
184
|
setPagePoint(undefined);
|
|
222
185
|
// In case of refresh the current task needs to be reset
|
|
223
|
-
hooks.onFormLoad(
|
|
186
|
+
hooks.onFormLoad(currentTask => {
|
|
224
187
|
setCurrentTask(currentTask);
|
|
225
188
|
});
|
|
226
189
|
}, [hooks]);
|
|
227
|
-
(0, _react.useEffect)(
|
|
190
|
+
(0, _react.useEffect)(() => {
|
|
228
191
|
setHubDetails(_hub);
|
|
229
192
|
}, [_hub]);
|
|
230
193
|
|
|
231
194
|
// Calling setData directly within the hooks.onSubmit success handler
|
|
232
195
|
// resulted in a synchronisation error. Handling it in a useEffect appears
|
|
233
196
|
// to be the way to deal with this... and it certainly seems to work.
|
|
234
|
-
(0, _react.useEffect)(
|
|
235
|
-
if (submitted
|
|
197
|
+
(0, _react.useEffect)(() => {
|
|
198
|
+
if (submitted?.data) {
|
|
236
199
|
setData(submitted.data);
|
|
237
200
|
setSubmitted(undefined);
|
|
238
201
|
}
|
|
239
202
|
}, [submitted, setData, setSubmitted]);
|
|
240
|
-
|
|
241
|
-
|
|
203
|
+
const theSections = _hub?.sections;
|
|
204
|
+
const nonSequential = _hub?.nonSequential;
|
|
242
205
|
// Update task list pages with form data and update states
|
|
243
|
-
(0, _react.useEffect)(
|
|
244
|
-
|
|
206
|
+
(0, _react.useEffect)(() => {
|
|
207
|
+
const pages = currentTask.fullPages;
|
|
245
208
|
if (pages) {
|
|
246
|
-
pages.forEach(
|
|
247
|
-
|
|
209
|
+
pages.forEach(page => {
|
|
210
|
+
const p = page;
|
|
248
211
|
if (p) {
|
|
249
212
|
p.formData = data;
|
|
250
213
|
}
|
|
251
214
|
});
|
|
252
|
-
setCurrentTask(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
});
|
|
215
|
+
setCurrentTask(prev => ({
|
|
216
|
+
...prev,
|
|
217
|
+
fullPages: pages
|
|
218
|
+
}));
|
|
257
219
|
}
|
|
258
220
|
if (theSections) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
});
|
|
266
|
-
});
|
|
221
|
+
const tasks = data?.formStatus?.tasks || {};
|
|
222
|
+
const updatedSections = _helpers.default.getUpdatedSectionStates(theSections, tasks, nonSequential, data);
|
|
223
|
+
setHubDetails(prev => ({
|
|
224
|
+
...prev,
|
|
225
|
+
sections: [].concat(updatedSections)
|
|
226
|
+
}));
|
|
267
227
|
}
|
|
268
228
|
}, [currentTask.fullPages, data, theSections, nonSequential]);
|
|
269
|
-
|
|
270
|
-
|
|
229
|
+
const onPageChange = function (newPageId) {
|
|
230
|
+
let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
271
231
|
clearErrors();
|
|
272
232
|
setPageId(newPageId);
|
|
273
233
|
hooks.onPageChange(newPageId, state);
|
|
274
234
|
};
|
|
275
|
-
(0, _react.useEffect)(
|
|
235
|
+
(0, _react.useEffect)(() => {
|
|
276
236
|
if (newPageId !== undefined) setPageId(newPageId);
|
|
277
237
|
}, [newPageId]);
|
|
278
238
|
|
|
279
239
|
// Handle change to form data in pages.
|
|
280
|
-
|
|
240
|
+
const onChange = data => {
|
|
281
241
|
hooks.onChange(data);
|
|
282
242
|
};
|
|
283
243
|
|
|
@@ -285,67 +245,66 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
285
245
|
// Passing a dataCallback allows changes to formData from the
|
|
286
246
|
// CYA screen. This is necessary to allow changing the active
|
|
287
247
|
// entry in page collections.
|
|
288
|
-
|
|
289
|
-
var _formState$page3;
|
|
248
|
+
const onCYARowAction = (page, dataCallback) => {
|
|
290
249
|
if (typeof dataCallback === 'function') {
|
|
291
|
-
|
|
250
|
+
const newData = dataCallback({
|
|
251
|
+
...data
|
|
252
|
+
});
|
|
292
253
|
if (newData) {
|
|
293
254
|
setData(newData);
|
|
294
255
|
}
|
|
295
256
|
}
|
|
296
|
-
if (
|
|
297
|
-
hubDetails.sections.every(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
});
|
|
305
|
-
});
|
|
257
|
+
if (formState.page?.type === _models.FormPages.PARTIAL_CYA) {
|
|
258
|
+
hubDetails.sections.every(section => section.tasks.every(task => {
|
|
259
|
+
if (task.pages.includes(page.pageId) && task.name !== currentTask.name) {
|
|
260
|
+
(0, _onTaskAction.default)(task, pages, setCurrentTask, hubDetails, data, onPageChange);
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
}));
|
|
306
265
|
}
|
|
307
266
|
if (page) {
|
|
308
267
|
_handlers.default.cyaAction(page, pageId, onPageChange);
|
|
309
268
|
}
|
|
310
269
|
};
|
|
311
|
-
|
|
270
|
+
const classes = _utils.default.classBuilder(classBlock, classModifiers, className);
|
|
312
271
|
if (hub === _models.HubFormats.TASK) {
|
|
313
|
-
|
|
272
|
+
const currentCYA = cya;
|
|
314
273
|
currentCYA.actions = [_models.PageAction.TYPES.SAVE_AND_CONTINUE, _models.PageAction.TYPES.SAVE_AND_RETURN];
|
|
315
274
|
}
|
|
316
275
|
|
|
317
276
|
// filter out invalid attribs
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
277
|
+
const {
|
|
278
|
+
noTaskCYAs: _noCYA,
|
|
279
|
+
nonSequential: _nonSeq,
|
|
280
|
+
...taskDetails
|
|
281
|
+
} = hubDetails;
|
|
321
282
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
322
283
|
className: classes()
|
|
323
284
|
}, title && !hideTitle && pageId === _models.FormPages.HUB && /*#__PURE__*/_react.default.createElement(_copReactComponents.LargeHeading, null, title), formState.cya && /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, _extends({
|
|
324
285
|
pages: _helpers.default.getRelevantPages(formState, pages, currentTask.fullPages)
|
|
325
|
-
}, cya,
|
|
326
|
-
actions:
|
|
327
|
-
return _utils.default.Component.show(action, data);
|
|
328
|
-
})
|
|
286
|
+
}, cya, formState.page?.type === _models.FormPages.PARTIAL_CYA && {
|
|
287
|
+
actions: formState.page.actions?.filter(action => _utils.default.Component.show(action, data))
|
|
329
288
|
}, formState.cya, {
|
|
330
|
-
onAction:
|
|
289
|
+
onAction: action => {
|
|
331
290
|
(0, _onCYAAction.default)(setPagePoint, action, pages, validate, components, data, setData, type, pageId, currentTask, hooks, addErrors, hub, onPageChange, formState);
|
|
332
291
|
},
|
|
333
292
|
onRowAction: onCYARowAction,
|
|
334
293
|
summaryListClassModifiers: summaryListClassModifiers,
|
|
335
294
|
hide_title: hideTitle,
|
|
336
|
-
noChangeAction:
|
|
337
|
-
noGroupAction:
|
|
295
|
+
noChangeAction: formState.cya.hideChangeActions ?? noChangeAction,
|
|
296
|
+
noGroupAction: formState.cya.hideGroupActions ?? false,
|
|
338
297
|
sections: typeof hubDetails !== 'undefined' ? hubDetails.sections : [],
|
|
339
298
|
type: type
|
|
340
299
|
})), hub === _models.HubFormats.TASK && formState.pageId === _models.FormPages.HUB && /*#__PURE__*/_react.default.createElement(_TaskList.default, _extends({}, taskDetails, {
|
|
341
300
|
refNumber: data.businessKey,
|
|
342
|
-
onTaskAction:
|
|
343
|
-
(0,
|
|
301
|
+
onTaskAction: task => {
|
|
302
|
+
(0, _onTaskAction.default)(task, pages, setCurrentTask, hubDetails, data, onPageChange);
|
|
344
303
|
},
|
|
345
304
|
formData: data
|
|
346
305
|
})), formState.page && !formState.cya && !formState.page.collection && /*#__PURE__*/_react.default.createElement(_FormPage.default, {
|
|
347
306
|
page: formState.page,
|
|
348
|
-
onAction:
|
|
307
|
+
onAction: (action, patch, patchLabel) => {
|
|
349
308
|
(0, _onPageAction.default)(action, patch, patchLabel, hooks, data, formState, validate, onPageChange, type, pages, components, pageId, setPagePoint, currentTask, setData, hubDetails, setSubmitted, addErrors);
|
|
350
309
|
},
|
|
351
310
|
onChange: onChange,
|
|
@@ -355,7 +314,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
355
314
|
}), formState.page && !formState.cya && formState.page.collection && /*#__PURE__*/_react.default.createElement(_CollectionPage.default, {
|
|
356
315
|
page: formState.page,
|
|
357
316
|
onCollectionChange: onChange,
|
|
358
|
-
onAction:
|
|
317
|
+
onAction: (action, patch, patchLabel) => {
|
|
359
318
|
(0, _onPageAction.default)(action, patch, patchLabel, hooks, data, formState, validate, onPageChange, type, pages, components, pageId, setPagePoint, currentTask, setData, hubDetails, setSubmitted, addErrors);
|
|
360
319
|
},
|
|
361
320
|
hashLink: hashLink,
|
|
@@ -363,7 +322,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
363
322
|
className: formState.page.className
|
|
364
323
|
}));
|
|
365
324
|
};
|
|
366
|
-
|
|
325
|
+
const propTypes = {
|
|
367
326
|
classBlock: _propTypes.default.string,
|
|
368
327
|
classModifiers: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
369
328
|
className: _propTypes.default.string,
|
|
@@ -392,7 +351,7 @@ var propTypes = {
|
|
|
392
351
|
type: _propTypes.default.oneOf([_models.FormTypes.CYA, _models.FormTypes.FORM, _models.FormTypes.HUB, _models.FormTypes.TASK, _models.FormTypes.WIZARD, _models.FormTypes.TASK_CYA, _models.FormTypes.FORM_WITH_TASK]).isRequired,
|
|
393
352
|
viewOnly: _propTypes.default.bool
|
|
394
353
|
};
|
|
395
|
-
|
|
354
|
+
const defaultProps = {
|
|
396
355
|
classBlock: DEFAULT_CLASS,
|
|
397
356
|
className: '',
|
|
398
357
|
classModifiers: [],
|
|
@@ -417,5 +376,4 @@ FormRenderer.propTypes = propTypes;
|
|
|
417
376
|
InternalFormRenderer.propTypes = propTypes;
|
|
418
377
|
FormRenderer.defaultProps = defaultProps;
|
|
419
378
|
InternalFormRenderer.defaultProps = defaultProps;
|
|
420
|
-
var _default = FormRenderer;
|
|
421
|
-
exports.default = _default;
|
|
379
|
+
var _default = exports.default = FormRenderer;
|