@ukhomeoffice/cop-react-form-renderer 5.29.0 → 5.32.0
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/CheckYourAnswers.js +2 -2
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +2 -2
- package/dist/components/CollectionPage/CollectionPage.js +2 -2
- package/dist/components/CollectionPage/CollectionPage.test.js +2 -2
- package/dist/components/CollectionSummary/BannerStrip.test.js +2 -2
- package/dist/components/CollectionSummary/CollectionSummary.js +4 -3
- package/dist/components/CollectionSummary/CollectionSummary.test.js +51 -2
- package/dist/components/CollectionSummary/Confirmation.js +4 -2
- package/dist/components/CollectionSummary/Confirmation.scss +1 -1
- package/dist/components/CollectionSummary/Confirmation.test.js +2 -2
- package/dist/components/CollectionSummary/SummaryCard.js +2 -2
- package/dist/components/CollectionSummary/SummaryCard.scss +4 -0
- package/dist/components/CollectionSummary/SummaryCard.test.js +2 -2
- package/dist/components/FormComponent/Collection.js +2 -2
- package/dist/components/FormComponent/FormComponent.js +4 -3
- package/dist/components/FormComponent/FormComponent.test.js +66 -34
- package/dist/components/FormPage/FormPage.js +2 -2
- package/dist/components/FormPage/FormPage.test.js +2 -2
- package/dist/components/FormRenderer/FormRenderer.js +9 -5
- package/dist/components/FormRenderer/FormRenderer.test.js +218 -133
- package/dist/components/FormRenderer/onCYAAction.js +20 -9
- package/dist/components/FormRenderer/onCYAAction.test.js +8 -1
- package/dist/components/FormRenderer/onPageAction.js +7 -2
- package/dist/components/FormRenderer/onPageAction.test.js +8 -1
- package/dist/components/PageActions/ActionButton.test.js +2 -2
- package/dist/components/SummaryList/GroupAction.js +2 -2
- package/dist/components/SummaryList/RowAction.js +2 -2
- package/dist/components/SummaryList/SummaryList.test.js +2 -2
- package/dist/components/TaskList/Task.js +2 -2
- package/dist/components/TaskList/TaskList.js +2 -2
- package/dist/components/TaskList/TaskList.test.js +2 -2
- package/dist/context/HooksContext/HooksContext.js +2 -2
- package/dist/context/HooksContext/HooksContext.test.js +2 -2
- package/dist/context/HooksContext/index.js +2 -2
- package/dist/context/ValidationContext/ValidationContext.js +2 -2
- package/dist/context/ValidationContext/ValidationContext.test.js +2 -2
- package/dist/context/ValidationContext/index.js +2 -2
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/useRefData.js +2 -2
- package/dist/index.js +2 -2
- package/dist/utils/Component/cleanAttributes.test.js +2 -2
- package/dist/utils/Component/isEditable.test.js +2 -2
- package/dist/utils/Format/formatDataForComponent.test.js +2 -2
- package/dist/utils/Format/formatDataForPage.test.js +2 -2
- package/dist/utils/Validate/validateDate.test.js +2 -2
- package/dist/utils/Validate/validateMultifile.test.js +2 -2
- package/package.json +1 -1
|
@@ -143,14 +143,14 @@ describe('components', function () {
|
|
|
143
143
|
}
|
|
144
144
|
}, _callee4);
|
|
145
145
|
})));
|
|
146
|
-
it('should render
|
|
147
|
-
var hooks, ID, COMPONENT, _renderWithValidation5, container,
|
|
146
|
+
it('should render an overridden html component appropriately and pass through onAction', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
147
|
+
var hooks, ID, COMPONENT, _renderWithValidation5, container, div;
|
|
148
148
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
149
149
|
while (1) switch (_context5.prev = _context5.next) {
|
|
150
150
|
case 0:
|
|
151
151
|
hooks = {
|
|
152
|
-
onGetComponent: function onGetComponent() {
|
|
153
|
-
return null;
|
|
152
|
+
onGetComponent: function onGetComponent(config, wrap) {
|
|
153
|
+
return /*#__PURE__*/_react.default.createElement("div", null, "".concat(config.type, " | ").concat(config.tagName, " | ").concat(config.content, " | ").concat(wrap, " | ").concat(config.onAction));
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
ID = 'component';
|
|
@@ -161,23 +161,55 @@ describe('components', function () {
|
|
|
161
161
|
};
|
|
162
162
|
_renderWithValidation5 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react.default.createElement(_FormComponent.default, {
|
|
163
163
|
"data-testid": ID,
|
|
164
|
-
component: COMPONENT
|
|
164
|
+
component: COMPONENT,
|
|
165
|
+
onAction: "() => {}"
|
|
165
166
|
}), {
|
|
166
167
|
hooks: hooks
|
|
167
168
|
}), container = _renderWithValidation5.container;
|
|
168
|
-
|
|
169
|
-
expect(
|
|
170
|
-
expect(
|
|
169
|
+
div = container.childNodes[0];
|
|
170
|
+
expect(div.tagName).toEqual('DIV');
|
|
171
|
+
expect(div.textContent).toEqual("".concat(COMPONENT.type, " | ").concat(COMPONENT.tagName, " | ").concat(COMPONENT.content, " | true | () => {}"));
|
|
171
172
|
case 7:
|
|
172
173
|
case "end":
|
|
173
174
|
return _context5.stop();
|
|
174
175
|
}
|
|
175
176
|
}, _callee5);
|
|
176
177
|
})));
|
|
177
|
-
it('should render
|
|
178
|
-
var
|
|
178
|
+
it('should render the correct html component when the override returns null', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
179
|
+
var hooks, ID, COMPONENT, _renderWithValidation6, container, p;
|
|
179
180
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
180
181
|
while (1) switch (_context6.prev = _context6.next) {
|
|
182
|
+
case 0:
|
|
183
|
+
hooks = {
|
|
184
|
+
onGetComponent: function onGetComponent() {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
ID = 'component';
|
|
189
|
+
COMPONENT = {
|
|
190
|
+
type: 'html',
|
|
191
|
+
tagName: 'p',
|
|
192
|
+
content: 'HTML content'
|
|
193
|
+
};
|
|
194
|
+
_renderWithValidation6 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react.default.createElement(_FormComponent.default, {
|
|
195
|
+
"data-testid": ID,
|
|
196
|
+
component: COMPONENT
|
|
197
|
+
}), {
|
|
198
|
+
hooks: hooks
|
|
199
|
+
}), container = _renderWithValidation6.container;
|
|
200
|
+
p = container.childNodes[0];
|
|
201
|
+
expect(p.tagName).toEqual('P');
|
|
202
|
+
expect(p.textContent).toEqual(COMPONENT.content);
|
|
203
|
+
case 7:
|
|
204
|
+
case "end":
|
|
205
|
+
return _context6.stop();
|
|
206
|
+
}
|
|
207
|
+
}, _callee6);
|
|
208
|
+
})));
|
|
209
|
+
it('should render a text component appropriately with interpolated label', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
210
|
+
var ID, VALUE, COMPONENT, DATA, ON_CHANGE, _renderWithValidation7, container, formGroup, label, hint, input;
|
|
211
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
212
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
181
213
|
case 0:
|
|
182
214
|
ID = 'component';
|
|
183
215
|
VALUE = 'Text value'; // eslint-disable-next-line no-template-curly-in-string
|
|
@@ -193,13 +225,13 @@ describe('components', function () {
|
|
|
193
225
|
text: 'Interpolated'
|
|
194
226
|
};
|
|
195
227
|
ON_CHANGE = function ON_CHANGE() {};
|
|
196
|
-
|
|
228
|
+
_renderWithValidation7 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react.default.createElement(_FormComponent.default, {
|
|
197
229
|
"data-testid": ID,
|
|
198
230
|
component: COMPONENT,
|
|
199
231
|
value: VALUE,
|
|
200
232
|
onChange: ON_CHANGE,
|
|
201
233
|
formData: DATA
|
|
202
|
-
})), container =
|
|
234
|
+
})), container = _renderWithValidation7.container; // text components are wrapper in a FormGroup by default.
|
|
203
235
|
formGroup = container.childNodes[0];
|
|
204
236
|
expect(formGroup.tagName).toEqual('DIV');
|
|
205
237
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
@@ -219,14 +251,14 @@ describe('components', function () {
|
|
|
219
251
|
expect(input.value).toEqual(VALUE);
|
|
220
252
|
case 23:
|
|
221
253
|
case "end":
|
|
222
|
-
return
|
|
254
|
+
return _context7.stop();
|
|
223
255
|
}
|
|
224
|
-
},
|
|
256
|
+
}, _callee7);
|
|
225
257
|
})));
|
|
226
|
-
it('should correctly handle a component\'s default value when it has no existing value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
227
|
-
var ID, COMPONENT, DATA, ON_CHANGE_ARGS, ON_CHANGE_COUNT, ON_CHANGE,
|
|
228
|
-
return _regeneratorRuntime().wrap(function
|
|
229
|
-
while (1) switch (
|
|
258
|
+
it('should correctly handle a component\'s default value when it has no existing value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
259
|
+
var ID, COMPONENT, DATA, ON_CHANGE_ARGS, ON_CHANGE_COUNT, ON_CHANGE, _renderWithValidation8, container, rerender, formGroup, input;
|
|
260
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
261
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
230
262
|
case 0:
|
|
231
263
|
ID = 'component';
|
|
232
264
|
COMPONENT = {
|
|
@@ -239,19 +271,19 @@ describe('components', function () {
|
|
|
239
271
|
DATA = {};
|
|
240
272
|
ON_CHANGE_ARGS = [];
|
|
241
273
|
ON_CHANGE_COUNT = 0;
|
|
242
|
-
ON_CHANGE = function ON_CHANGE(
|
|
243
|
-
var target =
|
|
274
|
+
ON_CHANGE = function ON_CHANGE(_ref9) {
|
|
275
|
+
var target = _ref9.target;
|
|
244
276
|
ON_CHANGE_ARGS.push(target);
|
|
245
277
|
ON_CHANGE_COUNT += 1;
|
|
246
278
|
DATA[target.name] = target.value;
|
|
247
279
|
};
|
|
248
|
-
|
|
280
|
+
_renderWithValidation8 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react.default.createElement(_FormComponent.default, {
|
|
249
281
|
"data-testid": ID,
|
|
250
282
|
component: COMPONENT,
|
|
251
283
|
value: DATA[ID],
|
|
252
284
|
onChange: ON_CHANGE,
|
|
253
285
|
formData: DATA
|
|
254
|
-
})), container =
|
|
286
|
+
})), container = _renderWithValidation8.container, rerender = _renderWithValidation8.rerender;
|
|
255
287
|
expect(ON_CHANGE_COUNT).toEqual(1);
|
|
256
288
|
expect(ON_CHANGE_ARGS[0]).toMatchObject({
|
|
257
289
|
name: 'component',
|
|
@@ -271,14 +303,14 @@ describe('components', function () {
|
|
|
271
303
|
expect(input.value).toEqual(COMPONENT.defaultValue);
|
|
272
304
|
case 13:
|
|
273
305
|
case "end":
|
|
274
|
-
return
|
|
306
|
+
return _context8.stop();
|
|
275
307
|
}
|
|
276
|
-
},
|
|
308
|
+
}, _callee8);
|
|
277
309
|
})));
|
|
278
|
-
it('should correctly handle a component\'s default value when it has an existing value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
279
|
-
var ID, COMPONENT, DATA, ON_CHANGE_ARGS, ON_CHANGE_COUNT, ON_CHANGE,
|
|
280
|
-
return _regeneratorRuntime().wrap(function
|
|
281
|
-
while (1) switch (
|
|
310
|
+
it('should correctly handle a component\'s default value when it has an existing value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
311
|
+
var ID, COMPONENT, DATA, ON_CHANGE_ARGS, ON_CHANGE_COUNT, ON_CHANGE, _renderWithValidation9, container, formGroup, input;
|
|
312
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
313
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
282
314
|
case 0:
|
|
283
315
|
ID = 'component';
|
|
284
316
|
COMPONENT = {
|
|
@@ -293,27 +325,27 @@ describe('components', function () {
|
|
|
293
325
|
};
|
|
294
326
|
ON_CHANGE_ARGS = [];
|
|
295
327
|
ON_CHANGE_COUNT = 0;
|
|
296
|
-
ON_CHANGE = function ON_CHANGE(
|
|
297
|
-
var target =
|
|
328
|
+
ON_CHANGE = function ON_CHANGE(_ref11) {
|
|
329
|
+
var target = _ref11.target;
|
|
298
330
|
ON_CHANGE_ARGS.push(target);
|
|
299
331
|
ON_CHANGE_COUNT += 1;
|
|
300
332
|
};
|
|
301
|
-
|
|
333
|
+
_renderWithValidation9 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react.default.createElement(_FormComponent.default, {
|
|
302
334
|
"data-testid": ID,
|
|
303
335
|
component: COMPONENT,
|
|
304
336
|
value: DATA[ID],
|
|
305
337
|
onChange: ON_CHANGE,
|
|
306
338
|
formData: DATA
|
|
307
|
-
})), container =
|
|
339
|
+
})), container = _renderWithValidation9.container;
|
|
308
340
|
expect(ON_CHANGE_COUNT).toEqual(0);
|
|
309
341
|
formGroup = container.childNodes[0];
|
|
310
342
|
input = formGroup.childNodes[2];
|
|
311
343
|
expect(input.value).toEqual(DATA[ID]);
|
|
312
344
|
case 11:
|
|
313
345
|
case "end":
|
|
314
|
-
return
|
|
346
|
+
return _context9.stop();
|
|
315
347
|
}
|
|
316
|
-
},
|
|
348
|
+
}, _callee9);
|
|
317
349
|
})));
|
|
318
350
|
});
|
|
319
351
|
});
|
|
@@ -14,8 +14,8 @@ var _FormComponent = _interopRequireDefault(require("../FormComponent"));
|
|
|
14
14
|
var _PageActions = _interopRequireDefault(require("../PageActions"));
|
|
15
15
|
require("./FormPage.scss");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
function _getRequireWildcardCache(
|
|
18
|
-
function _interopRequireWildcard(
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
19
|
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; }
|
|
20
20
|
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; }
|
|
21
21
|
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; }
|
|
@@ -8,8 +8,8 @@ var _setupTests = require("../../setupTests");
|
|
|
8
8
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
9
9
|
var _ActionButton = require("../PageActions/ActionButton");
|
|
10
10
|
var _FormPage = _interopRequireWildcard(require("./FormPage"));
|
|
11
|
-
function _getRequireWildcardCache(
|
|
12
|
-
function _interopRequireWildcard(
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
15
15
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -24,8 +24,8 @@ var _onTaskAction2 = _interopRequireDefault(require("./onTaskAction"));
|
|
|
24
24
|
require("./FormRenderer.scss");
|
|
25
25
|
var _excluded = ["noTaskCYAs", "nonSequential"];
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
function _getRequireWildcardCache(
|
|
28
|
-
function _interopRequireWildcard(
|
|
27
|
+
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); }
|
|
28
|
+
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; }
|
|
29
29
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
30
30
|
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; }
|
|
31
31
|
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; }
|
|
@@ -142,6 +142,10 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
142
142
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
143
143
|
goingBack = _useState20[0],
|
|
144
144
|
setGoingBack = _useState20[1];
|
|
145
|
+
var _useState21 = (0, _react.useState)(false),
|
|
146
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
147
|
+
submitting = _useState22[0],
|
|
148
|
+
setSubmitting = _useState22[1];
|
|
145
149
|
|
|
146
150
|
// Set up hooks.
|
|
147
151
|
var _useHooks = (0, _hooks.useHooks)(),
|
|
@@ -330,7 +334,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
330
334
|
})
|
|
331
335
|
}, formState.cya, {
|
|
332
336
|
onAction: function onAction(action) {
|
|
333
|
-
(0, _onCYAAction.default)(setPagePoint, action, pages, validate, components, data, setData, type, pageId, currentTask, hooks, addErrors, hub, onPageChange, formState);
|
|
337
|
+
(0, _onCYAAction.default)(setPagePoint, action, pages, validate, components, data, setData, type, pageId, currentTask, hooks, addErrors, hub, onPageChange, formState, submitting, setSubmitting);
|
|
334
338
|
},
|
|
335
339
|
onRowAction: onCYARowAction,
|
|
336
340
|
summaryListClassModifiers: summaryListClassModifiers,
|
|
@@ -349,7 +353,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
349
353
|
page: formState.page,
|
|
350
354
|
pages: [].concat(pages),
|
|
351
355
|
onAction: function onAction(action, patch, patchLabel) {
|
|
352
|
-
(0, _onPageAction.default)(action, patch, patchLabel, hooks, data, formState, validate, onPageChange, type, pages, components, pageId, setPagePoint, currentTask, setData, hubDetails, setSubmitted, addErrors);
|
|
356
|
+
(0, _onPageAction.default)(action, patch, patchLabel, hooks, data, formState, validate, onPageChange, type, pages, components, pageId, setPagePoint, currentTask, setData, hubDetails, setSubmitted, addErrors, submitting, setSubmitting);
|
|
353
357
|
},
|
|
354
358
|
onChange: onChange,
|
|
355
359
|
hashLink: hashLink,
|
|
@@ -359,7 +363,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
359
363
|
page: formState.page,
|
|
360
364
|
onCollectionChange: onChange,
|
|
361
365
|
onAction: function onAction(action, patch, patchLabel) {
|
|
362
|
-
(0, _onPageAction.default)(action, patch, patchLabel, hooks, data, formState, validate, onPageChange, type, pages, components, pageId, setPagePoint, currentTask, setData, hubDetails, setSubmitted, addErrors);
|
|
366
|
+
(0, _onPageAction.default)(action, patch, patchLabel, hooks, data, formState, validate, onPageChange, type, pages, components, pageId, setPagePoint, currentTask, setData, hubDetails, setSubmitted, addErrors, submitting, setSubmitting);
|
|
363
367
|
},
|
|
364
368
|
hashLink: hashLink,
|
|
365
369
|
classModifiers: formState.page.classModifiers,
|