@ukhomeoffice/cop-react-form-renderer 5.68.1 → 5.68.2
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.
|
@@ -185,7 +185,8 @@ var SummaryCard = function SummaryCard(_ref) {
|
|
|
185
185
|
});
|
|
186
186
|
},
|
|
187
187
|
classModifiers: "primary",
|
|
188
|
-
disabled: quickEdit
|
|
188
|
+
disabled: quickEdit,
|
|
189
|
+
name: "QuickEdit"
|
|
189
190
|
}, DEFAULT_EDIT_LABEL), config.changeAction && typeof onFullEdit === 'function' && /*#__PURE__*/_react.default.createElement(_copReactComponents.Button, {
|
|
190
191
|
id: "".concat(id, ".changeButton"),
|
|
191
192
|
onClick: function onClick() {
|
|
@@ -193,21 +194,24 @@ var SummaryCard = function SummaryCard(_ref) {
|
|
|
193
194
|
return onFullEdit((_config$changeAction = config.changeAction) === null || _config$changeAction === void 0 ? void 0 : _config$changeAction.page, entryData.id);
|
|
194
195
|
},
|
|
195
196
|
classModifiers: ((_config$changeAction2 = config.changeAction) === null || _config$changeAction2 === void 0 ? void 0 : _config$changeAction2.classModifiers) || DEFAULT_CHANGE_BUTTON_CLASS,
|
|
196
|
-
"aria-label": _utils.default.FormPage.getConditionalText((_config$changeAction3 = config.changeAction) === null || _config$changeAction3 === void 0 ? void 0 : _config$changeAction3.aria_label, entryData)
|
|
197
|
+
"aria-label": _utils.default.FormPage.getConditionalText((_config$changeAction3 = config.changeAction) === null || _config$changeAction3 === void 0 ? void 0 : _config$changeAction3.aria_label, entryData),
|
|
198
|
+
name: "Change"
|
|
197
199
|
}, ((_config$changeAction4 = config.changeAction) === null || _config$changeAction4 === void 0 ? void 0 : _config$changeAction4.label) || DEFAULT_CHANGE_BUTTON_LABEL), config.deleteAction && typeof onDelete === 'function' && /*#__PURE__*/_react.default.createElement(_copReactComponents.Button, {
|
|
198
200
|
id: "".concat(id, ".deleteButton"),
|
|
199
201
|
onClick: function onClick() {
|
|
200
202
|
return onDelete(entryData);
|
|
201
203
|
},
|
|
202
204
|
classModifiers: "secondary",
|
|
203
|
-
"aria-label": _utils.default.FormPage.getConditionalText((_config$deleteAction = config.deleteAction) === null || _config$deleteAction === void 0 ? void 0 : _config$deleteAction.aria_label, entryData)
|
|
205
|
+
"aria-label": _utils.default.FormPage.getConditionalText((_config$deleteAction = config.deleteAction) === null || _config$deleteAction === void 0 ? void 0 : _config$deleteAction.aria_label, entryData),
|
|
206
|
+
name: "Delete"
|
|
204
207
|
}, ((_config$deleteAction2 = config.deleteAction) === null || _config$deleteAction2 === void 0 ? void 0 : _config$deleteAction2.label) || DEFAULT_DELETE_BUTTON_LABEL), config.duplicateAction && typeof onDuplicate === 'function' && /*#__PURE__*/_react.default.createElement(_copReactComponents.Button, {
|
|
205
208
|
id: "".concat(id, ".duplicateButton"),
|
|
206
209
|
onClick: function onClick() {
|
|
207
210
|
onDuplicate(entryData);
|
|
208
211
|
},
|
|
209
212
|
classModifiers: "secondary",
|
|
210
|
-
"aria-label": _utils.default.FormPage.getConditionalText((_config$duplicateActi = config.duplicateAction) === null || _config$duplicateActi === void 0 ? void 0 : _config$duplicateActi.aria_label, entryData)
|
|
213
|
+
"aria-label": _utils.default.FormPage.getConditionalText((_config$duplicateActi = config.duplicateAction) === null || _config$duplicateActi === void 0 ? void 0 : _config$duplicateActi.aria_label, entryData),
|
|
214
|
+
name: "Duplicate"
|
|
211
215
|
}, ((_config$duplicateActi2 = config.duplicateAction) === null || _config$duplicateActi2 === void 0 ? void 0 : _config$duplicateActi2.label) || DEFAULT_DUPLICATE_BUTTON_LABEL))), quickEdit && quickEditPage && /*#__PURE__*/_react.default.createElement(_FormPage.default, {
|
|
212
216
|
page: quickEditPage,
|
|
213
217
|
onAction: function onAction(action, patch) {
|
|
@@ -278,6 +278,7 @@ describe('components.CollectionSummary.SummaryCard', function () {
|
|
|
278
278
|
headerActionDiv = _checkSetup7.headerActionDiv;
|
|
279
279
|
expect(headerActionDiv.children.length).toEqual(1);
|
|
280
280
|
var changeButton = headerActionDiv.children[0];
|
|
281
|
+
expect(changeButton.name).toEqual('Change');
|
|
281
282
|
expect(changeButton.tagName).toEqual('BUTTON');
|
|
282
283
|
expect(changeButton.textContent).toEqual(CONFIG.changeAction.label);
|
|
283
284
|
expect(changeButton.getAttribute('aria-label')).toEqual(CONFIG.changeAction.aria_label[0].text);
|
|
@@ -389,6 +390,7 @@ describe('components.CollectionSummary.SummaryCard', function () {
|
|
|
389
390
|
headerActionDiv = _checkSetup11.headerActionDiv;
|
|
390
391
|
expect(headerActionDiv.children.length).toEqual(1);
|
|
391
392
|
var deleteButton = headerActionDiv.children[0];
|
|
393
|
+
expect(deleteButton.name).toEqual('Delete');
|
|
392
394
|
expect(deleteButton.tagName).toEqual('BUTTON');
|
|
393
395
|
expect(deleteButton.textContent).toEqual(CONFIG.deleteAction.label);
|
|
394
396
|
expect(deleteButton.getAttribute('aria-label')).toEqual(CONFIG.deleteAction.aria_label[0].text);
|
|
@@ -512,6 +514,7 @@ describe('components.CollectionSummary.SummaryCard', function () {
|
|
|
512
514
|
headerActionDiv = _checkSetup15.headerActionDiv;
|
|
513
515
|
expect(headerActionDiv.children.length).toEqual(1);
|
|
514
516
|
var duplicateButton = headerActionDiv.children[0];
|
|
517
|
+
expect(duplicateButton.name).toEqual('Duplicate');
|
|
515
518
|
expect(duplicateButton.tagName).toEqual('BUTTON');
|
|
516
519
|
expect(duplicateButton.textContent).toEqual(CONFIG.duplicateAction.label);
|
|
517
520
|
_react.fireEvent.click(duplicateButton, {});
|
|
@@ -625,6 +628,7 @@ describe('components.CollectionSummary.SummaryCard', function () {
|
|
|
625
628
|
|
|
626
629
|
// Shows edit button but no quick edit
|
|
627
630
|
var editButton = headerActionDiv.children[0];
|
|
631
|
+
expect(editButton.name).toEqual('QuickEdit');
|
|
628
632
|
expect(editButton.tagName).toEqual('BUTTON');
|
|
629
633
|
expect(editButton.textContent).toEqual('Quick Edit');
|
|
630
634
|
expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
|
|
@@ -174,9 +174,9 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
174
174
|
});
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
+
clearErrors();
|
|
177
178
|
setGoingBack(true);
|
|
178
179
|
hooks.onGoingBack(e.state ? e.state : null);
|
|
179
|
-
clearErrors();
|
|
180
180
|
if (components && pages && data && (_formState$page = formState.page) !== null && _formState$page !== void 0 && _formState$page.formData && pagePoint === undefined) {
|
|
181
181
|
var submissionData = _utils.default.Format.form({
|
|
182
182
|
pages: pages,
|
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _meetsAllConditions = _interopRequireDefault(require("../Condition/meetsAllConditions"));
|
|
8
8
|
var _showFormPage = _interopRequireDefault(require("../FormPage/showFormPage"));
|
|
9
|
+
var _excluded = ["id"];
|
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
11
|
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); }
|
|
12
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
13
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
16
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -104,7 +107,10 @@ var getQuickEditPage = function getQuickEditPage(masterPage, entryData) {
|
|
|
104
107
|
}];
|
|
105
108
|
|
|
106
109
|
// Need to have the collection data at the top level
|
|
107
|
-
|
|
110
|
+
// Remove ID to stop overwriting top-level form ID.
|
|
111
|
+
var id = entryData.id,
|
|
112
|
+
entryWithNoId = _objectWithoutProperties(entryData, _excluded);
|
|
113
|
+
pageToReturn.formData = _objectSpread(_objectSpread({}, pageToReturn.formData), entryWithNoId);
|
|
108
114
|
delete pageToReturn.title;
|
|
109
115
|
delete pageToReturn.collection;
|
|
110
116
|
return pageToReturn;
|