@ukhomeoffice/cop-react-form-renderer 5.74.1 → 5.74.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.
|
@@ -61,6 +61,17 @@ var SummaryCard = function SummaryCard(_ref) {
|
|
|
61
61
|
formData = _ref.formData,
|
|
62
62
|
masterPage = _ref.masterPage,
|
|
63
63
|
hideDetails = _ref.hideDetails;
|
|
64
|
+
var summaryCardRef = (0, _react.useRef)(null);
|
|
65
|
+
var handleDuplicateAndScroll = function handleDuplicateAndScroll() {
|
|
66
|
+
onDuplicate(entryData);
|
|
67
|
+
var currentSummaryCard = summaryCardRef.current;
|
|
68
|
+
if (currentSummaryCard && currentSummaryCard.nextSibling) {
|
|
69
|
+
currentSummaryCard.nextSibling.scrollIntoView({
|
|
70
|
+
behavior: 'smooth',
|
|
71
|
+
block: 'start'
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
64
75
|
var _useState = (0, _react.useState)(false),
|
|
65
76
|
_useState2 = _slicedToArray(_useState, 2),
|
|
66
77
|
quickEdit = _useState2[0],
|
|
@@ -159,6 +170,7 @@ var SummaryCard = function SummaryCard(_ref) {
|
|
|
159
170
|
});
|
|
160
171
|
}
|
|
161
172
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
173
|
+
ref: summaryCardRef,
|
|
162
174
|
className: classes(),
|
|
163
175
|
id: id
|
|
164
176
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -207,7 +219,7 @@ var SummaryCard = function SummaryCard(_ref) {
|
|
|
207
219
|
}, ((_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, {
|
|
208
220
|
id: "".concat(id, ".duplicateButton"),
|
|
209
221
|
onClick: function onClick() {
|
|
210
|
-
|
|
222
|
+
handleDuplicateAndScroll();
|
|
211
223
|
},
|
|
212
224
|
classModifiers: "secondary",
|
|
213
225
|
"aria-label": _utils.default.FormPage.getConditionalText((_config$duplicateActi = config.duplicateAction) === null || _config$duplicateActi === void 0 ? void 0 : _config$duplicateActi.aria_label, entryData),
|