@ukhomeoffice/cop-react-form-renderer 5.12.1 → 5.12.2-bravo
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.
|
@@ -101,7 +101,11 @@ var onCYAAction = function onCYAAction(setPagePoint, action, pages, validate, co
|
|
|
101
101
|
onPageChange(_helpers.default.getNextPageId(type, pages, pageId, action, (_formState$page = formState.page) === null || _formState$page === void 0 ? void 0 : _formState$page.formData));
|
|
102
102
|
}
|
|
103
103
|
if (action.type === _models.PageAction.TYPES.CANCEL) {
|
|
104
|
-
|
|
104
|
+
var formData = _utils.default.Format.form({
|
|
105
|
+
pages: pages,
|
|
106
|
+
components: components
|
|
107
|
+
}, _objectSpread({}, data), _models.EventTypes.CANCEL);
|
|
108
|
+
hooks.onCancel(formData);
|
|
105
109
|
}
|
|
106
110
|
};
|
|
107
111
|
var _default = onCYAAction;
|
|
@@ -21,7 +21,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
21
21
|
// for display purposes after submission.)
|
|
22
22
|
var onPageAction = function onPageAction(action, patch, patchLabel, hooks, data, formState, validate, onPageChange, type, pages, components, pageId, setPagePoint, currentTask, setData, hubDetails, setSubmitted, addErrors) {
|
|
23
23
|
if (action.type === _models.PageAction.TYPES.CANCEL) {
|
|
24
|
-
hooks.onCancel();
|
|
24
|
+
hooks.onCancel(formState.page.formData);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
;
|
|
@@ -56,7 +56,7 @@ var DEFAULT_HOOKS = {
|
|
|
56
56
|
return errors;
|
|
57
57
|
},
|
|
58
58
|
// Returns the list of errors already found in FR by default.
|
|
59
|
-
onCancel: function onCancel() {} // Consuming application must provide function to action, else this does nothing.
|
|
59
|
+
onCancel: function onCancel(data) {} // Consuming application must provide function to action, else this does nothing.
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
var ALLOWED_HOOKS = Object.keys(DEFAULT_HOOKS);
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var TYPE_BLUR = 'blur';
|
|
8
8
|
var TYPE_SUBMIT = 'submit';
|
|
9
|
+
var TYPE_CANCEL = 'cancel';
|
|
9
10
|
var EventTypes = {
|
|
10
11
|
BLUR: TYPE_BLUR,
|
|
11
|
-
SUBMIT: TYPE_SUBMIT
|
|
12
|
+
SUBMIT: TYPE_SUBMIT,
|
|
13
|
+
CANCEL: TYPE_CANCEL
|
|
12
14
|
};
|
|
13
15
|
var _default = EventTypes;
|
|
14
16
|
exports.default = _default;
|