@ukhomeoffice/cop-react-form-renderer 5.28.1 → 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.js +59 -0
- package/dist/components/CollectionSummary/BannerStrip.scss +47 -0
- package/dist/components/CollectionSummary/BannerStrip.test.js +111 -0
- package/dist/components/CollectionSummary/CollectionSummary.js +183 -0
- package/dist/components/CollectionSummary/CollectionSummary.scss +21 -0
- package/dist/components/CollectionSummary/CollectionSummary.test.js +170 -0
- package/dist/components/CollectionSummary/Confirmation.js +60 -0
- package/dist/components/CollectionSummary/Confirmation.scss +14 -0
- package/dist/components/CollectionSummary/Confirmation.test.js +102 -0
- package/dist/components/CollectionSummary/SummaryCard.js +274 -0
- package/dist/components/CollectionSummary/SummaryCard.scss +248 -0
- package/dist/components/CollectionSummary/SummaryCard.test.js +1164 -0
- package/dist/components/CollectionSummary/index.js +10 -0
- package/dist/components/FormComponent/Collection.js +2 -2
- package/dist/components/FormComponent/FormComponent.js +23 -6
- package/dist/components/FormComponent/FormComponent.test.js +66 -34
- package/dist/components/FormPage/FormPage.js +12 -5
- package/dist/components/FormPage/FormPage.test.js +2 -2
- package/dist/components/FormRenderer/FormRenderer.js +10 -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 +12 -16
- package/dist/components/FormRenderer/onPageAction.test.js +11 -7
- 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/models/ComponentTypes.js +2 -0
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +1 -1
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +4 -21
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +32 -0
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +68 -0
- package/dist/utils/CollectionPage/getQuickEditPage.js +74 -0
- package/dist/utils/CollectionPage/getQuickEditPage.test.js +109 -0
- package/dist/utils/CollectionPage/index.js +4 -0
- package/dist/utils/CollectionPage/removeCollectionPageEntry.js +36 -0
- package/dist/utils/CollectionPage/removeCollectionPageEntry.test.js +61 -0
- 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
package/dist/hooks/index.js
CHANGED
|
@@ -51,6 +51,6 @@ var _useValidation = _interopRequireDefault(require("./useValidation"));
|
|
|
51
51
|
var _useHooks = _interopRequireDefault(require("./useHooks"));
|
|
52
52
|
var _useGetRequest = _interopRequireDefault(require("./useGetRequest"));
|
|
53
53
|
var _useRefData = _interopRequireWildcard(require("./useRefData"));
|
|
54
|
-
function _getRequireWildcardCache(
|
|
55
|
-
function _interopRequireWildcard(
|
|
54
|
+
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); }
|
|
55
|
+
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; }
|
|
56
56
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/dist/hooks/useRefData.js
CHANGED
|
@@ -8,8 +8,8 @@ var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _Data = _interopRequireDefault(require("../utils/Data"));
|
|
10
10
|
var _useGetRequest2 = _interopRequireWildcard(require("./useGetRequest"));
|
|
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 _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); }
|
|
15
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
package/dist/index.js
CHANGED
|
@@ -76,8 +76,8 @@ var _context = require("./context");
|
|
|
76
76
|
var _models = _interopRequireWildcard(require("./models"));
|
|
77
77
|
var _utils = _interopRequireDefault(require("./utils"));
|
|
78
78
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
79
|
-
function _getRequireWildcardCache(
|
|
80
|
-
function _interopRequireWildcard(
|
|
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
|
+
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
82
|
var _default = _components.FormRenderer;
|
|
83
83
|
exports.default = _default;
|
|
@@ -9,6 +9,7 @@ var TYPE_AUTOCOMPLETE = 'autocomplete';
|
|
|
9
9
|
var TYPE_CALCULATION = 'calculation';
|
|
10
10
|
var TYPE_CHECKBOXES = 'checkboxes';
|
|
11
11
|
var TYPE_COLLECTION = 'collection';
|
|
12
|
+
var TYPE_COLLECTION_SUMMARY = 'collection-summary';
|
|
12
13
|
var TYPE_CONTAINER = 'container';
|
|
13
14
|
var TYPE_DATE = 'date';
|
|
14
15
|
var TYPE_DETAILS = 'details';
|
|
@@ -33,6 +34,7 @@ var ComponentTypes = {
|
|
|
33
34
|
CALCULATION: TYPE_CALCULATION,
|
|
34
35
|
CHECKBOXES: TYPE_CHECKBOXES,
|
|
35
36
|
COLLECTION: TYPE_COLLECTION,
|
|
37
|
+
COLLECTION_SUMMARY: TYPE_COLLECTION_SUMMARY,
|
|
36
38
|
CONTAINER: TYPE_CONTAINER,
|
|
37
39
|
DATE: TYPE_DATE,
|
|
38
40
|
DETAILS: TYPE_DETAILS,
|
|
@@ -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.HEADING, _models.ComponentTypes.HTML, _models.ComponentTypes.INSET_TEXT];
|
|
15
|
+
var 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.
|
|
@@ -4,15 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _getCollectionPageActiveId = _interopRequireDefault(require("./getCollectionPageActiveId"));
|
|
8
|
+
var _duplicateCollectionPageEntry = _interopRequireDefault(require("./duplicateCollectionPageEntry"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
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); }
|
|
11
|
-
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
|
-
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
|
-
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; }
|
|
14
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
-
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); }
|
|
16
10
|
/**
|
|
17
11
|
* Duplicates the currently active entry in a named collection's data.
|
|
18
12
|
* Once duplicated, the new entry is set as the active entry.
|
|
@@ -25,19 +19,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
25
19
|
* @return true if the entry ws successfully duplicated, false if not.
|
|
26
20
|
*/
|
|
27
21
|
var duplicateCollectionPageActiveEntry = function duplicateCollectionPageActiveEntry(collectionName, formData) {
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var currentEntry = collectionData === null || collectionData === void 0 ? void 0 : collectionData[currentIndex];
|
|
31
|
-
if (!currentEntry) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
var newEntry = _objectSpread(_objectSpread({}, currentEntry), {}, {
|
|
35
|
-
id: Date.now().toString()
|
|
36
|
-
});
|
|
37
|
-
collectionData.push(newEntry);
|
|
38
|
-
// eslint-disable-next-line no-param-reassign
|
|
39
|
-
formData["".concat(collectionName.split('.').pop(), "ActiveId")] = newEntry.id;
|
|
40
|
-
return true;
|
|
22
|
+
var currentEntryId = (0, _getCollectionPageActiveId.default)(collectionName, formData);
|
|
23
|
+
return (0, _duplicateCollectionPageEntry.default)(collectionName, formData, currentEntryId);
|
|
41
24
|
};
|
|
42
25
|
var _default = duplicateCollectionPageActiveEntry;
|
|
43
26
|
exports.default = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _getCollectionPageData = _interopRequireDefault(require("./getCollectionPageData"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
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); }
|
|
15
|
+
var duplicateCollectionPageEntry = function duplicateCollectionPageEntry(collectionName, formData, entryId) {
|
|
16
|
+
var collectionData = (0, _getCollectionPageData.default)(collectionName, formData);
|
|
17
|
+
var entryToDuplicate = collectionData === null || collectionData === void 0 ? void 0 : collectionData.find(function (entry) {
|
|
18
|
+
return entry.id === entryId;
|
|
19
|
+
});
|
|
20
|
+
if (!entryToDuplicate) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
var newEntry = _objectSpread(_objectSpread({}, entryToDuplicate), {}, {
|
|
24
|
+
id: Date.now().toString()
|
|
25
|
+
});
|
|
26
|
+
collectionData.push(newEntry);
|
|
27
|
+
// eslint-disable-next-line no-param-reassign
|
|
28
|
+
formData["".concat(collectionName.split('.').pop(), "ActiveId")] = newEntry.id;
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
var _default = duplicateCollectionPageEntry;
|
|
32
|
+
exports.default = _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _duplicateCollectionPageEntry = _interopRequireDefault(require("./duplicateCollectionPageEntry"));
|
|
4
|
+
var _getCollectionPageActiveId = _interopRequireDefault(require("./getCollectionPageActiveId"));
|
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
+
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); }
|
|
7
|
+
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
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
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); }
|
|
10
|
+
describe('utils.CollectionPage.duplicateCollectionPageEntry', function () {
|
|
11
|
+
var COLLECTION_NAME = 'testCollection';
|
|
12
|
+
var OBJ = {
|
|
13
|
+
id: '1',
|
|
14
|
+
value: 'value'
|
|
15
|
+
};
|
|
16
|
+
it('should duplicate the active entry if one exists', function () {
|
|
17
|
+
var _FORM_DATA;
|
|
18
|
+
var FORM_DATA = (_FORM_DATA = {}, _defineProperty(_FORM_DATA, "".concat(COLLECTION_NAME, "ActiveId"), '1'), _defineProperty(_FORM_DATA, COLLECTION_NAME, [OBJ]), _FORM_DATA);
|
|
19
|
+
(0, _duplicateCollectionPageEntry.default)(COLLECTION_NAME, FORM_DATA, '1');
|
|
20
|
+
expect(FORM_DATA[COLLECTION_NAME].length).toEqual(2);
|
|
21
|
+
expect(FORM_DATA[COLLECTION_NAME][1].value).toEqual(FORM_DATA[COLLECTION_NAME][0].value);
|
|
22
|
+
expect(FORM_DATA[COLLECTION_NAME][1].id).toBeTruthy();
|
|
23
|
+
expect(FORM_DATA[COLLECTION_NAME][1].id === '1').toBeFalsy();
|
|
24
|
+
expect(FORM_DATA["".concat(COLLECTION_NAME, "ActiveId")]).toBeTruthy();
|
|
25
|
+
expect(FORM_DATA["".concat(COLLECTION_NAME, "ActiveId")] === '1').toBeFalsy();
|
|
26
|
+
});
|
|
27
|
+
it('should duplicate entries in nested collections correctly', function () {
|
|
28
|
+
var FORM_DATA = {
|
|
29
|
+
parentsActiveId: '2',
|
|
30
|
+
childrenActiveId: '2',
|
|
31
|
+
parents: [{
|
|
32
|
+
id: '1',
|
|
33
|
+
children: [{
|
|
34
|
+
id: '1',
|
|
35
|
+
value: 'Alpha'
|
|
36
|
+
}]
|
|
37
|
+
}, {
|
|
38
|
+
id: '2',
|
|
39
|
+
children: [{
|
|
40
|
+
id: '1',
|
|
41
|
+
value: 'Alpha'
|
|
42
|
+
}, {
|
|
43
|
+
id: '2',
|
|
44
|
+
value: 'Duplicate me!'
|
|
45
|
+
}]
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
(0, _duplicateCollectionPageEntry.default)('parents.children', FORM_DATA, '2');
|
|
49
|
+
expect(FORM_DATA.parents[1].children.length).toEqual(3);
|
|
50
|
+
expect(FORM_DATA.parents[1].children[2].value).toEqual(FORM_DATA.parents[1].children[1].value);
|
|
51
|
+
expect(FORM_DATA.parents[1].children[2].id).toBeTruthy();
|
|
52
|
+
expect(FORM_DATA.parents[1].children[2].id === FORM_DATA.parents[1].children[1].id).toBeFalsy();
|
|
53
|
+
expect((0, _getCollectionPageActiveId.default)('parents.children', FORM_DATA)).toBeTruthy();
|
|
54
|
+
expect((0, _getCollectionPageActiveId.default)('parents.children', FORM_DATA) === '2').toBeFalsy();
|
|
55
|
+
});
|
|
56
|
+
it('should do nothing if an entry with the given id does not exist', function () {
|
|
57
|
+
var _FORM_DATA2, _expect$toEqual;
|
|
58
|
+
var FORM_DATA = (_FORM_DATA2 = {}, _defineProperty(_FORM_DATA2, "".concat(COLLECTION_NAME, "ActiveId"), '1'), _defineProperty(_FORM_DATA2, COLLECTION_NAME, [OBJ]), _FORM_DATA2);
|
|
59
|
+
;
|
|
60
|
+
(0, _duplicateCollectionPageEntry.default)(COLLECTION_NAME, FORM_DATA, '0');
|
|
61
|
+
expect(FORM_DATA).toEqual((_expect$toEqual = {}, _defineProperty(_expect$toEqual, "".concat(COLLECTION_NAME, "ActiveId"), '1'), _defineProperty(_expect$toEqual, COLLECTION_NAME, [OBJ]), _expect$toEqual));
|
|
62
|
+
});
|
|
63
|
+
it('should do nothing if the collection does not exist', function () {
|
|
64
|
+
var FORM_DATA = {};
|
|
65
|
+
(0, _duplicateCollectionPageEntry.default)(COLLECTION_NAME, FORM_DATA, '1');
|
|
66
|
+
expect(FORM_DATA).toEqual({});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
13
|
+
/**
|
|
14
|
+
* Generates a new renderable page configuration containing just the components specified in the config.
|
|
15
|
+
* Page is intended for rendering within a CollectionSummarys QuickEdit section.
|
|
16
|
+
* @param {object} config object specifying which components should be rendered, may extend in the future to allow futher configuration
|
|
17
|
+
* Expected object structure:
|
|
18
|
+
* {
|
|
19
|
+
"components": [
|
|
20
|
+
{
|
|
21
|
+
"use": "exampleComponent"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"use": "exampleComponent2"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
* @param {array} pages all the pages in the form
|
|
29
|
+
* @returns Page suitble for rendering in a QuickEdit
|
|
30
|
+
*/
|
|
31
|
+
var getQuickEditPage = function getQuickEditPage(config, pages, entryData) {
|
|
32
|
+
if (!config || !pages) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Create array of full component definitions
|
|
37
|
+
var components = config.components;
|
|
38
|
+
var componentsRaised = components.map(function (component) {
|
|
39
|
+
return component.use;
|
|
40
|
+
});
|
|
41
|
+
var fullComponents = [];
|
|
42
|
+
pages.forEach(function (page) {
|
|
43
|
+
var _page$components;
|
|
44
|
+
(_page$components = page.components) === null || _page$components === void 0 ? void 0 : _page$components.forEach(function (component) {
|
|
45
|
+
if (componentsRaised.includes(component.id)) {
|
|
46
|
+
var providedConfig = components.find(function (c) {
|
|
47
|
+
return c.use === component.id;
|
|
48
|
+
});
|
|
49
|
+
fullComponents.push(_objectSpread(_objectSpread({}, component), providedConfig));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Put components and actions onto page object
|
|
55
|
+
var pageToReturn = _objectSpread({}, pages[0]);
|
|
56
|
+
pageToReturn.components = fullComponents;
|
|
57
|
+
pageToReturn.actions = [{
|
|
58
|
+
type: 'save',
|
|
59
|
+
label: 'Save',
|
|
60
|
+
validate: true,
|
|
61
|
+
classModifiers: 'primary'
|
|
62
|
+
}, {
|
|
63
|
+
type: 'cancel',
|
|
64
|
+
label: 'Cancel',
|
|
65
|
+
classModifiers: 'secondary'
|
|
66
|
+
}];
|
|
67
|
+
|
|
68
|
+
// Need to have the collection data at the top level
|
|
69
|
+
pageToReturn.formData = _objectSpread(_objectSpread({}, pageToReturn.formData), entryData);
|
|
70
|
+
delete pageToReturn.title;
|
|
71
|
+
return pageToReturn;
|
|
72
|
+
};
|
|
73
|
+
var _default = getQuickEditPage;
|
|
74
|
+
exports.default = _default;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _getQuickEditPage = _interopRequireDefault(require("./getQuickEditPage"));
|
|
4
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
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); }
|
|
11
|
+
describe('Utils.CollectionPage.getQuickEditPage', function () {
|
|
12
|
+
var pages = [{
|
|
13
|
+
id: 'parentPage',
|
|
14
|
+
name: 'parentPage',
|
|
15
|
+
title: 'Parent',
|
|
16
|
+
collection: {
|
|
17
|
+
name: 'parents',
|
|
18
|
+
labels: {
|
|
19
|
+
item: 'Parent'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
components: [{
|
|
23
|
+
id: 'testText',
|
|
24
|
+
type: 'text',
|
|
25
|
+
label: 'Test text',
|
|
26
|
+
fieldId: 'testText',
|
|
27
|
+
required: true,
|
|
28
|
+
use: 'testText',
|
|
29
|
+
cya_label: 'Test text',
|
|
30
|
+
full_path: 'testText'
|
|
31
|
+
}],
|
|
32
|
+
formData: {
|
|
33
|
+
businessKey: 'DEV-20230915-705',
|
|
34
|
+
parentsActiveId: '1694777136455',
|
|
35
|
+
id: '1694777136455',
|
|
36
|
+
parents: [{
|
|
37
|
+
id: '1694777136455',
|
|
38
|
+
testText: 'test'
|
|
39
|
+
}]
|
|
40
|
+
},
|
|
41
|
+
index: 1
|
|
42
|
+
}];
|
|
43
|
+
var config = {
|
|
44
|
+
components: [{
|
|
45
|
+
use: 'testText'
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
var expectedOutput = {
|
|
49
|
+
id: 'parentPage',
|
|
50
|
+
name: 'parentPage',
|
|
51
|
+
collection: {
|
|
52
|
+
name: 'parents',
|
|
53
|
+
labels: {
|
|
54
|
+
item: 'Parent'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
components: [{
|
|
58
|
+
id: 'testText',
|
|
59
|
+
type: 'text',
|
|
60
|
+
label: 'Test text',
|
|
61
|
+
fieldId: 'testText',
|
|
62
|
+
required: true,
|
|
63
|
+
use: 'testText',
|
|
64
|
+
cya_label: 'Test text',
|
|
65
|
+
full_path: 'testText'
|
|
66
|
+
}],
|
|
67
|
+
formData: {
|
|
68
|
+
businessKey: 'DEV-20230915-705',
|
|
69
|
+
parentsActiveId: '1694777136455',
|
|
70
|
+
id: '1694777136455',
|
|
71
|
+
parents: [{
|
|
72
|
+
id: '1694777136455',
|
|
73
|
+
testText: 'test'
|
|
74
|
+
}],
|
|
75
|
+
testText: 'test'
|
|
76
|
+
},
|
|
77
|
+
index: 1,
|
|
78
|
+
actions: [{
|
|
79
|
+
type: 'save',
|
|
80
|
+
label: 'Save',
|
|
81
|
+
validate: true,
|
|
82
|
+
classModifiers: 'primary'
|
|
83
|
+
}, {
|
|
84
|
+
type: 'cancel',
|
|
85
|
+
label: 'Cancel',
|
|
86
|
+
classModifiers: 'secondary'
|
|
87
|
+
}]
|
|
88
|
+
};
|
|
89
|
+
it('should return a quick edit page', function () {
|
|
90
|
+
var createdPage = (0, _getQuickEditPage.default)(config, pages, {
|
|
91
|
+
testText: 'test'
|
|
92
|
+
});
|
|
93
|
+
expect(createdPage).toEqual(expectedOutput);
|
|
94
|
+
});
|
|
95
|
+
it('should return a quick edit page with overridden component properties', function () {
|
|
96
|
+
var configWithOverride = {
|
|
97
|
+
components: [{
|
|
98
|
+
use: 'testText',
|
|
99
|
+
label: 'override'
|
|
100
|
+
}]
|
|
101
|
+
};
|
|
102
|
+
var createdPage = (0, _getQuickEditPage.default)(configWithOverride, pages, {
|
|
103
|
+
testText: 'test'
|
|
104
|
+
});
|
|
105
|
+
var expectedOutputOverride = _objectSpread({}, expectedOutput);
|
|
106
|
+
expectedOutputOverride.components[0].label = 'override';
|
|
107
|
+
expect(createdPage).toEqual(expectedOutput);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _addCollectionPageEntry = _interopRequireDefault(require("./addCollectionPageEntry"));
|
|
8
8
|
var _duplicateCollectionPageActiveEntry = _interopRequireDefault(require("./duplicateCollectionPageActiveEntry"));
|
|
9
|
+
var _duplicateCollectionPageEntry = _interopRequireDefault(require("./duplicateCollectionPageEntry"));
|
|
9
10
|
var _getCollectionPageActiveId = _interopRequireDefault(require("./getCollectionPageActiveId"));
|
|
10
11
|
var _getCollectionPageActiveIndex = _interopRequireDefault(require("./getCollectionPageActiveIndex"));
|
|
11
12
|
var _getCollectionPageData = _interopRequireDefault(require("./getCollectionPageData"));
|
|
12
13
|
var _mergeCollectionPages = _interopRequireDefault(require("./mergeCollectionPages"));
|
|
14
|
+
var _removeCollectionPageEntry = _interopRequireDefault(require("./removeCollectionPageEntry"));
|
|
13
15
|
var _setCollectionPageData = _interopRequireDefault(require("./setCollectionPageData"));
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
// Local imports
|
|
@@ -17,10 +19,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
19
|
var CollectionPage = {
|
|
18
20
|
addEntry: _addCollectionPageEntry.default,
|
|
19
21
|
duplicateActiveEntry: _duplicateCollectionPageActiveEntry.default,
|
|
22
|
+
duplicateEntry: _duplicateCollectionPageEntry.default,
|
|
20
23
|
getActiveId: _getCollectionPageActiveId.default,
|
|
21
24
|
getActiveIndex: _getCollectionPageActiveIndex.default,
|
|
22
25
|
getData: _getCollectionPageData.default,
|
|
23
26
|
mergePages: _mergeCollectionPages.default,
|
|
27
|
+
removeEntry: _removeCollectionPageEntry.default,
|
|
24
28
|
setData: _setCollectionPageData.default
|
|
25
29
|
};
|
|
26
30
|
var _default = CollectionPage;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _getCollectionPageData = _interopRequireDefault(require("./getCollectionPageData"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
// Local imports.
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Removes an entry with a given id from a collection.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} collectionName The name of the collection to delete the entry from.
|
|
15
|
+
* @param {object} formData The top-level formData object.
|
|
16
|
+
* @param {string} id The id of the entry to be deleted.
|
|
17
|
+
* @returns null if the target entry could not be deleted.
|
|
18
|
+
* The deleted entry if it was deleted successfully.
|
|
19
|
+
*/
|
|
20
|
+
var removeCollectionPageEntry = function removeCollectionPageEntry(collectionName, formData, id) {
|
|
21
|
+
var collectionData = (0, _getCollectionPageData.default)(collectionName, formData);
|
|
22
|
+
if (!collectionData) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
var indexToDelete = collectionData.findIndex(function (entry) {
|
|
26
|
+
return entry.id === id;
|
|
27
|
+
});
|
|
28
|
+
if (indexToDelete === -1) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
var deletedEntry = collectionData[indexToDelete];
|
|
32
|
+
collectionData.splice(indexToDelete, 1);
|
|
33
|
+
return deletedEntry;
|
|
34
|
+
};
|
|
35
|
+
var _default = removeCollectionPageEntry;
|
|
36
|
+
exports.default = _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _removeCollectionPageEntry = _interopRequireDefault(require("./removeCollectionPageEntry"));
|
|
4
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5
|
+
// Local imports.
|
|
6
|
+
|
|
7
|
+
describe('utils.collectionPage.removeCollectionPageEntry', function () {
|
|
8
|
+
var FORM_DATA = {
|
|
9
|
+
parentsActiveId: '1',
|
|
10
|
+
childrenActiveId: '1',
|
|
11
|
+
grandchildrenActiveId: '1',
|
|
12
|
+
parents: [{
|
|
13
|
+
id: '1',
|
|
14
|
+
children: [{
|
|
15
|
+
id: '1',
|
|
16
|
+
grandchildren: [{
|
|
17
|
+
id: '1',
|
|
18
|
+
value: 'Alpha'
|
|
19
|
+
}, {
|
|
20
|
+
id: '2',
|
|
21
|
+
value: 'Bravo'
|
|
22
|
+
}, {
|
|
23
|
+
id: '3',
|
|
24
|
+
value: 'Charlie'
|
|
25
|
+
}, {
|
|
26
|
+
id: '4',
|
|
27
|
+
value: 'Delta'
|
|
28
|
+
}]
|
|
29
|
+
}]
|
|
30
|
+
}]
|
|
31
|
+
};
|
|
32
|
+
it('should return null if a parent collection does not exist', function () {
|
|
33
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.chainbreak.grandchildren', FORM_DATA, '1');
|
|
34
|
+
expect(removedEntry).toEqual(null);
|
|
35
|
+
});
|
|
36
|
+
it('should return null if an entry with the provided id does not exist', function () {
|
|
37
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.children.grandchildren', FORM_DATA, '0');
|
|
38
|
+
expect(removedEntry).toEqual(null);
|
|
39
|
+
});
|
|
40
|
+
it('should return null if form data is invalid', function () {
|
|
41
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.children.grandchildren', null, '1');
|
|
42
|
+
expect(removedEntry).toEqual(null);
|
|
43
|
+
});
|
|
44
|
+
it('should correctly remove the target entry', function () {
|
|
45
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.children.grandchildren', FORM_DATA, '3');
|
|
46
|
+
expect(removedEntry).toEqual({
|
|
47
|
+
id: '3',
|
|
48
|
+
value: 'Charlie'
|
|
49
|
+
});
|
|
50
|
+
expect(FORM_DATA.parents[0].children[0].grandchildren).toEqual([{
|
|
51
|
+
id: '1',
|
|
52
|
+
value: 'Alpha'
|
|
53
|
+
}, {
|
|
54
|
+
id: '2',
|
|
55
|
+
value: 'Bravo'
|
|
56
|
+
}, {
|
|
57
|
+
id: '4',
|
|
58
|
+
value: 'Delta'
|
|
59
|
+
}]);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
var _cleanAttributes = _interopRequireWildcard(require("./cleanAttributes"));
|
|
5
|
-
function _getRequireWildcardCache(
|
|
6
|
-
function _interopRequireWildcard(
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
7
|
// Local imports
|
|
8
8
|
|
|
9
9
|
describe('utils', function () {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
var _isEditable = _interopRequireWildcard(require("./isEditable"));
|
|
5
|
-
function _getRequireWildcardCache(
|
|
6
|
-
function _interopRequireWildcard(
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
7
|
// Local imports
|
|
8
8
|
|
|
9
9
|
describe('utils', function () {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _models = require("../../models");
|
|
4
4
|
var _formatDataForComponent = _interopRequireWildcard(require("./formatDataForComponent"));
|
|
5
|
-
function _getRequireWildcardCache(
|
|
6
|
-
function _interopRequireWildcard(
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
7
|
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); }
|
|
8
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
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); }
|
|
4
4
|
var _models = require("../../models");
|
|
5
5
|
var _formatDataForPage = _interopRequireWildcard(require("./formatDataForPage"));
|
|
6
|
-
function _getRequireWildcardCache(
|
|
7
|
-
function _interopRequireWildcard(
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
8
8
|
// Local imports
|
|
9
9
|
|
|
10
10
|
describe('utils', function () {
|