@ukhomeoffice/cop-react-form-renderer 5.39.1 → 5.41.1
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 -2
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +4 -8
- package/dist/components/CheckYourAnswers/index.js +1 -2
- package/dist/components/CollectionPage/CollectionPage.js +2 -4
- package/dist/components/CollectionPage/index.js +1 -2
- package/dist/components/CollectionSummary/BannerStrip.js +2 -4
- package/dist/components/CollectionSummary/CollectionSummary.js +34 -11
- package/dist/components/CollectionSummary/Confirmation.js +4 -8
- package/dist/components/CollectionSummary/SummaryCard.js +30 -29
- package/dist/components/CollectionSummary/SummaryCard.scss +4 -0
- package/dist/components/CollectionSummary/SummaryCard.test.js +152 -101
- package/dist/components/CollectionSummary/index.js +1 -2
- package/dist/components/FormComponent/Collection.js +3 -5
- package/dist/components/FormComponent/Container.js +2 -4
- package/dist/components/FormComponent/FormComponent.js +1 -2
- package/dist/components/FormComponent/helpers/addLabel.js +1 -2
- package/dist/components/FormComponent/helpers/getComponentDisabled.js +1 -2
- package/dist/components/FormComponent/helpers/getComponentError.js +1 -2
- package/dist/components/FormComponent/helpers/getComponentFieldSet.js +2 -3
- package/dist/components/FormComponent/index.js +1 -2
- package/dist/components/FormPage/FormPage.js +2 -4
- package/dist/components/FormPage/index.js +1 -2
- package/dist/components/FormRenderer/FormRenderer.js +2 -4
- package/dist/components/FormRenderer/handlers/cyaAction.js +1 -2
- package/dist/components/FormRenderer/handlers/getPageId.js +1 -2
- package/dist/components/FormRenderer/handlers/index.js +1 -2
- package/dist/components/FormRenderer/handlers/navigate.js +1 -2
- package/dist/components/FormRenderer/handlers/submissionError.js +1 -2
- package/dist/components/FormRenderer/helpers/canActionProceed.js +1 -2
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +1 -2
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +2 -3
- package/dist/components/FormRenderer/helpers/getCYA.js +1 -2
- package/dist/components/FormRenderer/helpers/getFormState.js +1 -2
- package/dist/components/FormRenderer/helpers/getNextPageId.js +2 -3
- package/dist/components/FormRenderer/helpers/getPage.js +1 -2
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +1 -2
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +1 -2
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +1 -2
- package/dist/components/FormRenderer/helpers/index.js +1 -2
- package/dist/components/FormRenderer/index.js +1 -2
- package/dist/components/FormRenderer/onCYAAction.js +1 -2
- package/dist/components/FormRenderer/onPageAction.js +1 -2
- package/dist/components/FormRenderer/onTaskAction.js +1 -2
- package/dist/components/PageActions/ActionButton.js +2 -4
- package/dist/components/PageActions/PageActions.js +1 -2
- package/dist/components/PageActions/index.js +1 -2
- package/dist/components/SummaryList/GroupAction.js +1 -2
- package/dist/components/SummaryList/RowAction.js +1 -2
- package/dist/components/SummaryList/SummaryList.js +2 -4
- package/dist/components/SummaryList/SummaryListHeadingRow.js +1 -2
- package/dist/components/SummaryList/SummaryListRow.js +1 -2
- package/dist/components/SummaryList/SummaryListTitleRow.js +1 -2
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +1 -2
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +1 -2
- package/dist/components/SummaryList/index.js +1 -2
- package/dist/components/TaskList/Task.js +2 -4
- package/dist/components/TaskList/TaskList.js +3 -6
- package/dist/components/TaskList/TaskState.js +2 -4
- package/dist/components/TaskList/index.js +1 -2
- package/dist/context/HooksContext/HooksContext.js +3 -6
- package/dist/context/HooksContext/index.js +1 -2
- package/dist/context/ValidationContext/ValidationContext.js +2 -4
- package/dist/context/ValidationContext/index.js +1 -2
- package/dist/hooks/useAxios.js +1 -2
- package/dist/hooks/useGetRequest.js +6 -12
- package/dist/hooks/useHooks.js +1 -2
- package/dist/hooks/useRefData.js +3 -6
- package/dist/hooks/useValidation.js +1 -2
- package/dist/index.js +1 -2
- package/dist/models/CollectionLabels.js +1 -2
- package/dist/models/ComponentTypes.js +1 -2
- package/dist/models/EventTypes.js +1 -2
- package/dist/models/FormPages.js +1 -2
- package/dist/models/FormTypes.js +1 -2
- package/dist/models/HubFormats.js +1 -2
- package/dist/models/PageAction.js +3 -6
- package/dist/models/TaskStates.js +2 -4
- package/dist/models/index.js +1 -2
- package/dist/setupTests.js +6 -11
- package/dist/utils/CheckYourAnswers/getCYAAction.js +1 -2
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +1 -2
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +1 -2
- package/dist/utils/CheckYourAnswers/getCYARow.js +2 -3
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +1 -2
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +1 -2
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +1 -2
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +1 -2
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +1 -2
- package/dist/utils/CheckYourAnswers/index.js +1 -2
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +2 -4
- package/dist/utils/CollectionPage/addCollectionPageEntry.js +1 -2
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +1 -2
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +5 -5
- package/dist/utils/CollectionPage/getCollectionPageActiveId.js +1 -2
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +1 -2
- package/dist/utils/CollectionPage/getCollectionPageData.js +1 -2
- package/dist/utils/CollectionPage/getQuickEditPage.js +2 -3
- package/dist/utils/CollectionPage/index.js +1 -2
- package/dist/utils/CollectionPage/mergeCollectionPages.js +1 -2
- package/dist/utils/CollectionPage/removeCollectionPageEntry.js +1 -2
- package/dist/utils/CollectionPage/setCollectionPageData.js +1 -2
- package/dist/utils/Component/addShowWhen.js +1 -2
- package/dist/utils/Component/applyToComponentTree.js +1 -2
- package/dist/utils/Component/cleanAttributes.js +2 -4
- package/dist/utils/Component/elevateNestedComponents.js +3 -4
- package/dist/utils/Component/getComponent.js +2 -4
- package/dist/utils/Component/getDefaultValue.js +1 -2
- package/dist/utils/Component/getDefaultValueFromConfig.js +1 -2
- package/dist/utils/Component/index.js +1 -2
- package/dist/utils/Component/isEditable.js +2 -4
- package/dist/utils/Component/optionIsSelected.js +1 -2
- package/dist/utils/Component/setupContainerComponentsPath.js +1 -2
- package/dist/utils/Component/showComponent.js +1 -2
- package/dist/utils/Component/wrapInFormGroup.js +1 -2
- package/dist/utils/Condition/index.js +1 -2
- package/dist/utils/Condition/meetsAllConditions.js +1 -2
- package/dist/utils/Condition/meetsCondition.js +1 -2
- package/dist/utils/Condition/meetsOneCondition.js +1 -2
- package/dist/utils/Condition/setupConditions.js +1 -2
- package/dist/utils/Container/getEditableComponents.js +1 -2
- package/dist/utils/Container/index.js +1 -2
- package/dist/utils/Container/setupNesting.js +3 -4
- package/dist/utils/Container/showContainer.js +1 -2
- package/dist/utils/Data/applyFormula.js +1 -2
- package/dist/utils/Data/getAutocompleteSource.js +12 -3
- package/dist/utils/Data/getAutocompleteSource.test.js +38 -0
- package/dist/utils/Data/getDataPath.js +1 -2
- package/dist/utils/Data/getOptions.js +1 -2
- package/dist/utils/Data/getSourceData.js +1 -2
- package/dist/utils/Data/index.js +1 -2
- package/dist/utils/Data/refDataToOptions.js +1 -2
- package/dist/utils/Data/setDataItem.js +1 -2
- package/dist/utils/Data/setupFormData.js +1 -2
- package/dist/utils/Data/setupRefDataUrlForComponent.js +1 -2
- package/dist/utils/FormPage/applyConditionalProperties.js +1 -2
- package/dist/utils/FormPage/getFormPage.js +1 -2
- package/dist/utils/FormPage/getFormPages.js +1 -2
- package/dist/utils/FormPage/getPageActions.js +1 -2
- package/dist/utils/FormPage/getPageTitle.js +1 -2
- package/dist/utils/FormPage/getParagraphFromText.js +1 -2
- package/dist/utils/FormPage/index.js +1 -2
- package/dist/utils/FormPage/showFormPage.js +1 -2
- package/dist/utils/FormPage/showFormPageCYA.js +1 -2
- package/dist/utils/FormPage/useComponent.js +1 -2
- package/dist/utils/Format/formatData.js +1 -2
- package/dist/utils/Format/formatDataForComponent.js +2 -4
- package/dist/utils/Format/formatDataForForm.js +1 -2
- package/dist/utils/Format/formatDataForPage.js +2 -4
- package/dist/utils/Format/index.js +1 -2
- package/dist/utils/Hub/getFormHub.js +1 -2
- package/dist/utils/Hub/index.js +1 -2
- package/dist/utils/Meta/constants.js +2 -4
- package/dist/utils/Meta/documents/getDocuments.js +1 -2
- package/dist/utils/Meta/documents/index.js +1 -2
- package/dist/utils/Meta/documents/setDocumentsForField.js +1 -2
- package/dist/utils/Meta/index.js +1 -2
- package/dist/utils/Operate/checkValueIsTruthy.js +1 -2
- package/dist/utils/Operate/getFirstOf.js +1 -2
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +1 -2
- package/dist/utils/Operate/index.js +1 -2
- package/dist/utils/Operate/persistValueInFormData.js +1 -2
- package/dist/utils/Operate/runPageOperations.js +1 -2
- package/dist/utils/Operate/setValueInFormData.js +1 -2
- package/dist/utils/Operate/shouldRun.js +1 -2
- package/dist/utils/Validate/additional/conditionallyRequired.js +1 -2
- package/dist/utils/Validate/additional/index.js +1 -2
- package/dist/utils/Validate/additional/mustBeAfter.js +1 -2
- package/dist/utils/Validate/additional/mustBeBefore.js +1 -2
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +1 -2
- package/dist/utils/Validate/additional/mustBeGreaterThan.js +1 -2
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +1 -2
- package/dist/utils/Validate/additional/mustBeInThePast.js +1 -2
- package/dist/utils/Validate/additional/mustBeLessThan.js +1 -2
- package/dist/utils/Validate/additional/mustBeLongerThan.js +1 -2
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +1 -2
- package/dist/utils/Validate/additional/mustBeShorterThan.js +1 -2
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +1 -2
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +1 -2
- package/dist/utils/Validate/additional/mustNotContainSql.js +1 -2
- package/dist/utils/Validate/additional/mustSelectOnlyOne.js +1 -2
- package/dist/utils/Validate/additional/utils.js +3 -6
- package/dist/utils/Validate/index.js +1 -2
- package/dist/utils/Validate/validateCollection.js +1 -2
- package/dist/utils/Validate/validateComponent.js +2 -3
- package/dist/utils/Validate/validateContainer.js +1 -2
- package/dist/utils/Validate/validateDate.js +2 -4
- package/dist/utils/Validate/validateEmail.js +1 -2
- package/dist/utils/Validate/validateMultifile.js +2 -4
- package/dist/utils/Validate/validatePage.js +1 -2
- package/dist/utils/Validate/validateRegex.js +1 -2
- package/dist/utils/Validate/validateRequired.js +1 -2
- package/dist/utils/Validate/validateTextArea.js +1 -2
- package/dist/utils/Validate/validateTime.js +1 -2
- package/dist/utils/index.js +1 -2
- package/package.json +2 -2
package/dist/hooks/useHooks.js
CHANGED
|
@@ -13,5 +13,4 @@ var _HooksContext = require("../context/HooksContext");
|
|
|
13
13
|
var useHooks = function useHooks() {
|
|
14
14
|
return (0, _react.useContext)(_HooksContext.HooksContext);
|
|
15
15
|
};
|
|
16
|
-
var _default = useHooks;
|
|
17
|
-
exports.default = _default;
|
|
16
|
+
var _default = exports.default = useHooks;
|
package/dist/hooks/useRefData.js
CHANGED
|
@@ -24,10 +24,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
24
24
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
25
25
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // Global imports
|
|
26
26
|
// Local imports
|
|
27
|
-
var STATUS_LOADING = 'loading';
|
|
28
|
-
exports.
|
|
29
|
-
var STATUS_COMPLETE = 'complete';
|
|
30
|
-
exports.STATUS_COMPLETE = STATUS_COMPLETE;
|
|
27
|
+
var STATUS_LOADING = exports.STATUS_LOADING = 'loading';
|
|
28
|
+
var STATUS_COMPLETE = exports.STATUS_COMPLETE = 'complete';
|
|
31
29
|
var getRefDataUrl = function getRefDataUrl(component) {
|
|
32
30
|
// eslint-disable-next-line prefer-destructuring
|
|
33
31
|
var data = component.data;
|
|
@@ -72,5 +70,4 @@ var useRefData = function useRefData(component, formData) {
|
|
|
72
70
|
status: status
|
|
73
71
|
};
|
|
74
72
|
};
|
|
75
|
-
var _default = useRefData;
|
|
76
|
-
exports.default = _default;
|
|
73
|
+
var _default = exports.default = useRefData;
|
|
@@ -13,5 +13,4 @@ var _ValidationContext = require("../context/ValidationContext");
|
|
|
13
13
|
var useValidation = function useValidation() {
|
|
14
14
|
return (0, _react.useContext)(_ValidationContext.ValidationContext);
|
|
15
15
|
};
|
|
16
|
-
var _default = useValidation;
|
|
17
|
-
exports.default = _default;
|
|
16
|
+
var _default = exports.default = useValidation;
|
package/dist/index.js
CHANGED
|
@@ -79,5 +79,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
79
79
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
80
80
|
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 && Object.prototype.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; }
|
|
81
81
|
// Local imports
|
|
82
|
-
var _default = _components.FormRenderer;
|
|
83
|
-
exports.default = _default;
|
|
82
|
+
var _default = exports.default = _components.FormRenderer;
|
package/dist/models/FormPages.js
CHANGED
package/dist/models/FormTypes.js
CHANGED
|
@@ -18,7 +18,7 @@ var TYPE_SAVE_AND_CONTINUE = 'saveAndContinue';
|
|
|
18
18
|
var TYPE_SAVE_AND_NAVIGATE = 'saveAndNavigate';
|
|
19
19
|
var TYPE_SAVE_AND_RETURN = 'saveAndReturn';
|
|
20
20
|
var TYPE_SUBMIT = 'submit';
|
|
21
|
-
var PageActionTypes = {
|
|
21
|
+
var PageActionTypes = exports.PageActionTypes = {
|
|
22
22
|
CANCEL: TYPE_CANCEL,
|
|
23
23
|
COLLECTION_ADD: TYPE_COLLECTION_ADD,
|
|
24
24
|
COLLECTION_DUPLICATE: TYPE_COLLECTION_DUPLICATE,
|
|
@@ -29,8 +29,7 @@ var PageActionTypes = {
|
|
|
29
29
|
SAVE_AND_RETURN: TYPE_SAVE_AND_RETURN,
|
|
30
30
|
SUBMIT: TYPE_SUBMIT
|
|
31
31
|
};
|
|
32
|
-
exports.
|
|
33
|
-
var DefaultPageActions = (_DefaultPageActions = {}, _defineProperty(_DefaultPageActions, TYPE_CANCEL, {
|
|
32
|
+
var DefaultPageActions = exports.DefaultPageActions = (_DefaultPageActions = {}, _defineProperty(_DefaultPageActions, TYPE_CANCEL, {
|
|
34
33
|
type: TYPE_CANCEL,
|
|
35
34
|
validate: false,
|
|
36
35
|
label: 'Cancel',
|
|
@@ -52,10 +51,8 @@ var DefaultPageActions = (_DefaultPageActions = {}, _defineProperty(_DefaultPage
|
|
|
52
51
|
type: TYPE_SUBMIT,
|
|
53
52
|
validate: true
|
|
54
53
|
}), _DefaultPageActions);
|
|
55
|
-
exports.DefaultPageActions = DefaultPageActions;
|
|
56
54
|
var PageAction = {
|
|
57
55
|
TYPES: PageActionTypes,
|
|
58
56
|
DEFAULTS: DefaultPageActions
|
|
59
57
|
};
|
|
60
|
-
var _default = PageAction;
|
|
61
|
-
exports.default = _default;
|
|
58
|
+
var _default = exports.default = PageAction;
|
|
@@ -14,14 +14,13 @@ var TYPE_IN_PROGRESS = 'inProgress';
|
|
|
14
14
|
var TYPE_NOT_STARTED = 'notStarted';
|
|
15
15
|
var TYPE_CANNOT_START_YET = 'cannotStartYet';
|
|
16
16
|
var TYPE_SKIPPED = 'skipped';
|
|
17
|
-
var StateTypes = {
|
|
17
|
+
var StateTypes = exports.StateTypes = {
|
|
18
18
|
COMPLETE: TYPE_COMPLETE,
|
|
19
19
|
IN_PROGRESS: TYPE_IN_PROGRESS,
|
|
20
20
|
NOT_STARTED: TYPE_NOT_STARTED,
|
|
21
21
|
CANNOT_START_YET: TYPE_CANNOT_START_YET,
|
|
22
22
|
SKIPPED: TYPE_SKIPPED
|
|
23
23
|
};
|
|
24
|
-
exports.StateTypes = StateTypes;
|
|
25
24
|
var StateDetails = (_StateDetails = {}, _defineProperty(_StateDetails, TYPE_COMPLETE, {
|
|
26
25
|
label: 'Completed',
|
|
27
26
|
colour: 'dark-blue'
|
|
@@ -42,5 +41,4 @@ var TaskStates = {
|
|
|
42
41
|
TYPES: StateTypes,
|
|
43
42
|
DETAILS: StateDetails
|
|
44
43
|
};
|
|
45
|
-
var _default = TaskStates;
|
|
46
|
-
exports.default = _default;
|
|
44
|
+
var _default = exports.default = TaskStates;
|
package/dist/models/index.js
CHANGED
package/dist/setupTests.js
CHANGED
|
@@ -8,31 +8,28 @@ var _react = require("@testing-library/react");
|
|
|
8
8
|
var _reactHooks = require("@testing-library/react-hooks");
|
|
9
9
|
var _reactDom = require("react-dom");
|
|
10
10
|
var _context = require("./context");
|
|
11
|
-
var renderWithValidation = function renderWithValidation(ui, options) {
|
|
11
|
+
var renderWithValidation = exports.renderWithValidation = function renderWithValidation(ui, options) {
|
|
12
12
|
return (0, _react.render)( /*#__PURE__*/React.createElement(_context.HooksContextProvider, {
|
|
13
13
|
overrides: options === null || options === void 0 ? void 0 : options.hooks
|
|
14
14
|
}, /*#__PURE__*/React.createElement(_context.ValidationContextProvider, {
|
|
15
15
|
key: "vcp"
|
|
16
16
|
}, ui)), options);
|
|
17
17
|
};
|
|
18
|
-
exports.
|
|
19
|
-
var rerenderWithValidation = function rerenderWithValidation(rerenderCallback, ui, options) {
|
|
18
|
+
var rerenderWithValidation = exports.rerenderWithValidation = function rerenderWithValidation(rerenderCallback, ui, options) {
|
|
20
19
|
return rerenderCallback( /*#__PURE__*/React.createElement(_context.HooksContextProvider, {
|
|
21
20
|
overrides: options === null || options === void 0 ? void 0 : options.hooks
|
|
22
21
|
}, /*#__PURE__*/React.createElement(_context.ValidationContextProvider, {
|
|
23
22
|
key: "vcp"
|
|
24
23
|
}, ui)), options);
|
|
25
24
|
};
|
|
26
|
-
exports.
|
|
27
|
-
var renderDomWithValidation = function renderDomWithValidation(ui, container, options) {
|
|
25
|
+
var renderDomWithValidation = exports.renderDomWithValidation = function renderDomWithValidation(ui, container, options) {
|
|
28
26
|
return (0, _reactDom.render)( /*#__PURE__*/React.createElement(_context.HooksContextProvider, {
|
|
29
27
|
overrides: options === null || options === void 0 ? void 0 : options.hooks
|
|
30
28
|
}, /*#__PURE__*/React.createElement(_context.ValidationContextProvider, {
|
|
31
29
|
key: "vcp"
|
|
32
30
|
}, ui)), container);
|
|
33
31
|
};
|
|
34
|
-
exports.
|
|
35
|
-
var renderHookWithProvider = function renderHookWithProvider(hook, options) {
|
|
32
|
+
var renderHookWithProvider = exports.renderHookWithProvider = function renderHookWithProvider(hook, options) {
|
|
36
33
|
var wrapper = function wrapper(_ref) {
|
|
37
34
|
var children = _ref.children;
|
|
38
35
|
return /*#__PURE__*/React.createElement(_context.HooksContextProvider, {
|
|
@@ -45,10 +42,8 @@ var renderHookWithProvider = function renderHookWithProvider(hook, options) {
|
|
|
45
42
|
wrapper: wrapper
|
|
46
43
|
});
|
|
47
44
|
};
|
|
48
|
-
exports.
|
|
49
|
-
var expectObjectLike = function expectObjectLike(received, expected) {
|
|
45
|
+
var expectObjectLike = exports.expectObjectLike = function expectObjectLike(received, expected) {
|
|
50
46
|
Object.keys(expected).forEach(function (key) {
|
|
51
47
|
expect(received[key]).toEqual(expected[key]);
|
|
52
48
|
});
|
|
53
|
-
};
|
|
54
|
-
exports.expectObjectLike = expectObjectLike;
|
|
49
|
+
};
|
|
@@ -15,7 +15,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
|
|
16
16
|
var setNestedValue = function setNestedValue(component, page) {
|
|
17
17
|
var _component$data;
|
|
18
|
-
(_component$data = component.data) === null || _component$data === void 0 || (_component$data = _component$data.options) === null || _component$data === void 0
|
|
18
|
+
(_component$data = component.data) === null || _component$data === void 0 || (_component$data = _component$data.options) === null || _component$data === void 0 || _component$data.forEach(function (option) {
|
|
19
19
|
// check if option is selected and has nested component
|
|
20
20
|
if (Array.isArray(option.nested) && (0, _optionIsSelected.default)(page.formData[component.id], option)) {
|
|
21
21
|
option.nested.forEach(function (paramChild) {
|
|
@@ -54,5 +54,4 @@ var getCYARow = function getCYARow(page, component, onAction) {
|
|
|
54
54
|
action: (_page$cya_link = page.cya_link) !== null && _page$cya_link !== void 0 && _page$cya_link.singleChangeLink ? null : (0, _getCYAAction.default)(component.readonly, page, onAction)
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
var _default = getCYARow;
|
|
58
|
-
exports.default = _default;
|
|
57
|
+
var _default = exports.default = getCYARow;
|
|
@@ -74,5 +74,4 @@ var getCYARowsForCollection = function getCYARowsForCollection(page, collection,
|
|
|
74
74
|
}
|
|
75
75
|
return getEntryToCollectionRow(page, onAction);
|
|
76
76
|
};
|
|
77
|
-
var _default = getCYARowsForCollection;
|
|
78
|
-
exports.default = _default;
|
|
77
|
+
var _default = exports.default = getCYARowsForCollection;
|
|
@@ -11,5 +11,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
11
|
var CheckYourAnswers = {
|
|
12
12
|
getRows: _getCYARowsForPage.default
|
|
13
13
|
};
|
|
14
|
-
var _default = CheckYourAnswers;
|
|
15
|
-
exports.default = _default;
|
|
14
|
+
var _default = exports.default = CheckYourAnswers;
|
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
/* eslint-disable no-console */
|
|
13
13
|
// Local imports
|
|
14
14
|
|
|
15
|
-
var EXCLUDE_FROM_CYA = [_models.ComponentTypes.ALERT, _models.ComponentTypes.COLLECTION_SUMMARY, _models.ComponentTypes.HEADING, _models.ComponentTypes.HTML, _models.ComponentTypes.INSET_TEXT];
|
|
15
|
+
var EXCLUDE_FROM_CYA = exports.EXCLUDE_FROM_CYA = [_models.ComponentTypes.ALERT, _models.ComponentTypes.COLLECTION_SUMMARY, _models.ComponentTypes.HEADING, _models.ComponentTypes.HTML, _models.ComponentTypes.INSET_TEXT];
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Determines whether a given component should display on the Check your answers screen.
|
|
@@ -22,7 +22,6 @@ var EXCLUDE_FROM_CYA = [_models.ComponentTypes.ALERT, _models.ComponentTypes.COL
|
|
|
22
22
|
*
|
|
23
23
|
* @returns A boolean true if the component should show; otherwise false.
|
|
24
24
|
*/
|
|
25
|
-
exports.EXCLUDE_FROM_CYA = EXCLUDE_FROM_CYA;
|
|
26
25
|
var showComponentCYA = function showComponentCYA(options, data) {
|
|
27
26
|
if (!options) {
|
|
28
27
|
return false;
|
|
@@ -51,5 +50,4 @@ var showComponentCYA = function showComponentCYA(options, data) {
|
|
|
51
50
|
}
|
|
52
51
|
return _Component.default.show(options, data);
|
|
53
52
|
};
|
|
54
|
-
var _default = showComponentCYA;
|
|
55
|
-
exports.default = _default;
|
|
53
|
+
var _default = exports.default = showComponentCYA;
|
|
@@ -18,5 +18,4 @@ var addCollectionPageEntry = function addCollectionPageEntry(collectionName, for
|
|
|
18
18
|
// eslint-disable-next-line no-param-reassign
|
|
19
19
|
formData["".concat(collectionName.split('.').pop(), "ActiveId")] = '0';
|
|
20
20
|
};
|
|
21
|
-
var _default = addCollectionPageEntry;
|
|
22
|
-
exports.default = _default;
|
|
21
|
+
var _default = exports.default = addCollectionPageEntry;
|
|
@@ -22,5 +22,4 @@ var duplicateCollectionPageActiveEntry = function duplicateCollectionPageActiveE
|
|
|
22
22
|
var currentEntryId = (0, _getCollectionPageActiveId.default)(collectionName, formData);
|
|
23
23
|
return (0, _duplicateCollectionPageEntry.default)(collectionName, formData, currentEntryId);
|
|
24
24
|
};
|
|
25
|
-
var _default = duplicateCollectionPageActiveEntry;
|
|
26
|
-
exports.default = _default;
|
|
25
|
+
var _default = exports.default = duplicateCollectionPageActiveEntry;
|
|
@@ -19,10 +19,11 @@ var duplicateCollectionPageEntry = function duplicateCollectionPageEntry(collect
|
|
|
19
19
|
return entry.id === entryId;
|
|
20
20
|
});
|
|
21
21
|
if (!entryToDuplicate) {
|
|
22
|
-
return
|
|
22
|
+
return null;
|
|
23
23
|
}
|
|
24
|
+
var newEntryId = Date.now().toString();
|
|
24
25
|
var newEntry = _objectSpread(_objectSpread({}, entryToDuplicate), {}, {
|
|
25
|
-
id:
|
|
26
|
+
id: newEntryId
|
|
26
27
|
});
|
|
27
28
|
fieldsToIgnore.forEach(function (field) {
|
|
28
29
|
return delete newEntry[field];
|
|
@@ -30,7 +31,6 @@ var duplicateCollectionPageEntry = function duplicateCollectionPageEntry(collect
|
|
|
30
31
|
collectionData.push(newEntry);
|
|
31
32
|
// eslint-disable-next-line no-param-reassign
|
|
32
33
|
formData["".concat(collectionName.split('.').pop(), "ActiveId")] = newEntry.id;
|
|
33
|
-
return
|
|
34
|
+
return newEntryId;
|
|
34
35
|
};
|
|
35
|
-
var _default = duplicateCollectionPageEntry;
|
|
36
|
-
exports.default = _default;
|
|
36
|
+
var _default = exports.default = duplicateCollectionPageEntry;
|
|
@@ -20,5 +20,4 @@ var getCollectionPageActiveId = function getCollectionPageActiveId(collectionNam
|
|
|
20
20
|
var targetName = collectionName.split('.').pop();
|
|
21
21
|
return formData["".concat(targetName, "ActiveId")] || null;
|
|
22
22
|
};
|
|
23
|
-
var _default = getCollectionPageActiveId;
|
|
24
|
-
exports.default = _default;
|
|
23
|
+
var _default = exports.default = getCollectionPageActiveId;
|
|
@@ -44,5 +44,4 @@ var getCollectionPageActiveIndex = function getCollectionPageActiveIndex(collect
|
|
|
44
44
|
var nameParts = collectionName.split('.');
|
|
45
45
|
return getLastActiveIndexInChain(nameParts, formData, formData);
|
|
46
46
|
};
|
|
47
|
-
var _default = getCollectionPageActiveIndex;
|
|
48
|
-
exports.default = _default;
|
|
47
|
+
var _default = exports.default = getCollectionPageActiveIndex;
|
|
@@ -53,5 +53,4 @@ var getCollectionPageData = function getCollectionPageData(collectionName, formD
|
|
|
53
53
|
var result = getLastDataInChain(nameParts, formData, formData);
|
|
54
54
|
return result;
|
|
55
55
|
};
|
|
56
|
-
var _default = getCollectionPageData;
|
|
57
|
-
exports.default = _default;
|
|
56
|
+
var _default = exports.default = getCollectionPageData;
|
|
@@ -41,7 +41,7 @@ var getQuickEditPage = function getQuickEditPage(config, pages, entryData) {
|
|
|
41
41
|
var fullComponents = [];
|
|
42
42
|
pages.forEach(function (page) {
|
|
43
43
|
var _page$components;
|
|
44
|
-
(_page$components = page.components) === null || _page$components === void 0
|
|
44
|
+
(_page$components = page.components) === null || _page$components === void 0 || _page$components.forEach(function (component) {
|
|
45
45
|
if (componentsRaised.includes(component.id)) {
|
|
46
46
|
var providedConfig = components.find(function (c) {
|
|
47
47
|
return c.use === component.id;
|
|
@@ -70,5 +70,4 @@ var getQuickEditPage = function getQuickEditPage(config, pages, entryData) {
|
|
|
70
70
|
delete pageToReturn.title;
|
|
71
71
|
return pageToReturn;
|
|
72
72
|
};
|
|
73
|
-
var _default = getQuickEditPage;
|
|
74
|
-
exports.default = _default;
|
|
73
|
+
var _default = exports.default = getQuickEditPage;
|
|
@@ -32,5 +32,4 @@ var removeCollectionPageEntry = function removeCollectionPageEntry(collectionNam
|
|
|
32
32
|
collectionData.splice(indexToDelete, 1);
|
|
33
33
|
return deletedEntry;
|
|
34
34
|
};
|
|
35
|
-
var _default = removeCollectionPageEntry;
|
|
36
|
-
exports.default = _default;
|
|
35
|
+
var _default = exports.default = removeCollectionPageEntry;
|
|
@@ -10,7 +10,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
10
10
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
11
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
12
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
-
var JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additionalValidation', 'full_path', 'fullPath', 'formData'];
|
|
13
|
+
var JSON_ONLY_PROPERTIES = exports.JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additionalValidation', 'full_path', 'fullPath', 'formData'];
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* This method removes and properties that are entirely specific to the JSON
|
|
@@ -23,7 +23,6 @@ var JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additional
|
|
|
23
23
|
* @param {Array} alsoRemove An array of additional properties to remove.
|
|
24
24
|
* @returns A clean(er) JSON object.
|
|
25
25
|
*/
|
|
26
|
-
exports.JSON_ONLY_PROPERTIES = JSON_ONLY_PROPERTIES;
|
|
27
26
|
var cleanAttributes = function cleanAttributes(options) {
|
|
28
27
|
var alsoRemove = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
29
28
|
var removeKeys = Array.isArray(alsoRemove) ? [].concat(JSON_ONLY_PROPERTIES, alsoRemove) : JSON_ONLY_PROPERTIES;
|
|
@@ -38,5 +37,4 @@ var cleanAttributes = function cleanAttributes(options) {
|
|
|
38
37
|
}
|
|
39
38
|
return {};
|
|
40
39
|
};
|
|
41
|
-
var _default = cleanAttributes;
|
|
42
|
-
exports.default = _default;
|
|
40
|
+
var _default = exports.default = cleanAttributes;
|
|
@@ -35,12 +35,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
35
35
|
*/
|
|
36
36
|
var elevateNestedComponents = function elevateNestedComponents(components, data) {
|
|
37
37
|
var allComponents = [];
|
|
38
|
-
components === null || components === void 0
|
|
38
|
+
components === null || components === void 0 || components.forEach(function (component) {
|
|
39
39
|
allComponents.push(component);
|
|
40
40
|
// If the component wasn't shown we shouldn't elevate anything nested under it
|
|
41
41
|
if ((0, _showComponent.default)(component, data)) {
|
|
42
42
|
var _component$data;
|
|
43
|
-
(_component$data = component.data) === null || _component$data === void 0 || (_component$data = _component$data.options) === null || _component$data === void 0
|
|
43
|
+
(_component$data = component.data) === null || _component$data === void 0 || (_component$data = _component$data.options) === null || _component$data === void 0 || _component$data.forEach(function (option) {
|
|
44
44
|
// If this option has nested components and is
|
|
45
45
|
// selected, then add its nested components to the array.
|
|
46
46
|
var sourceData = (data === null || data === void 0 ? void 0 : data[component.id]) || _Data.default.getSource(data, component.full_path);
|
|
@@ -53,5 +53,4 @@ var elevateNestedComponents = function elevateNestedComponents(components, data)
|
|
|
53
53
|
});
|
|
54
54
|
return allComponents;
|
|
55
55
|
};
|
|
56
|
-
var _default = elevateNestedComponents;
|
|
57
|
-
exports.default = _default;
|
|
56
|
+
var _default = exports.default = elevateNestedComponents;
|
|
@@ -263,14 +263,13 @@ var getChildJsx = function getChildJsx(parent, paramChild) {
|
|
|
263
263
|
* @param {*} parentConfig parent component which the childrenConfigs will be under
|
|
264
264
|
* @param {*} childrenConfigs array of configurations for the child components
|
|
265
265
|
*/
|
|
266
|
-
var getChildrenJsx = function getChildrenJsx(parentConfig, childrenConfigs) {
|
|
266
|
+
var getChildrenJsx = exports.getChildrenJsx = function getChildrenJsx(parentConfig, childrenConfigs) {
|
|
267
267
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenConfigs.map(function (config) {
|
|
268
268
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
269
269
|
key: config.id
|
|
270
270
|
}, getChildJsx(parentConfig, config));
|
|
271
271
|
}));
|
|
272
272
|
};
|
|
273
|
-
exports.getChildrenJsx = getChildrenJsx;
|
|
274
273
|
/**
|
|
275
274
|
* Get a renderable component, based on a configuration object.
|
|
276
275
|
* @param {object} config The configuration object for the component.
|
|
@@ -293,5 +292,4 @@ var getComponent = function getComponent(config) {
|
|
|
293
292
|
}
|
|
294
293
|
return component;
|
|
295
294
|
};
|
|
296
|
-
var _default = getComponent;
|
|
297
|
-
exports.default = _default;
|
|
295
|
+
var _default = exports.default = getComponent;
|
|
@@ -20,5 +20,4 @@ var getDefaultValue = function getDefaultValue(component, formData) {
|
|
|
20
20
|
var defaultValue = (0, _getDefaultValueFromConfig.default)(component, formData);
|
|
21
21
|
return defaultValue || DEFAULT_VALUES[component.type] || '';
|
|
22
22
|
};
|
|
23
|
-
var _default = getDefaultValue;
|
|
24
|
-
exports.default = _default;
|
|
23
|
+
var _default = exports.default = getDefaultValue;
|
|
@@ -7,10 +7,8 @@ exports.default = exports.EDITABLE_TYPES = void 0;
|
|
|
7
7
|
var _models = require("../../models");
|
|
8
8
|
// Local imports
|
|
9
9
|
|
|
10
|
-
var EDITABLE_TYPES = [_models.ComponentTypes.AUTOCOMPLETE, _models.ComponentTypes.CALCULATION, _models.ComponentTypes.CHECKBOXES, _models.ComponentTypes.DATE, _models.ComponentTypes.EMAIL, _models.ComponentTypes.FILE, _models.ComponentTypes.MULTI_FILE, _models.ComponentTypes.PHONE_NUMBER, _models.ComponentTypes.RADIOS, _models.ComponentTypes.SELECT, _models.ComponentTypes.TEXT, _models.ComponentTypes.TEXT_AREA, _models.ComponentTypes.TIME];
|
|
11
|
-
exports.EDITABLE_TYPES = EDITABLE_TYPES;
|
|
10
|
+
var EDITABLE_TYPES = exports.EDITABLE_TYPES = [_models.ComponentTypes.AUTOCOMPLETE, _models.ComponentTypes.CALCULATION, _models.ComponentTypes.CHECKBOXES, _models.ComponentTypes.DATE, _models.ComponentTypes.EMAIL, _models.ComponentTypes.FILE, _models.ComponentTypes.MULTI_FILE, _models.ComponentTypes.PHONE_NUMBER, _models.ComponentTypes.RADIOS, _models.ComponentTypes.SELECT, _models.ComponentTypes.TEXT, _models.ComponentTypes.TEXT_AREA, _models.ComponentTypes.TIME];
|
|
12
11
|
var isEditable = function isEditable(options) {
|
|
13
12
|
return EDITABLE_TYPES.includes(options === null || options === void 0 ? void 0 : options.type) || (options === null || options === void 0 ? void 0 : options.isEditable) || false;
|
|
14
13
|
};
|
|
15
|
-
var _default = isEditable;
|
|
16
|
-
exports.default = _default;
|
|
14
|
+
var _default = exports.default = isEditable;
|