@blaze-cms/plugin-data-ui 0.127.0-project-admin-customisations.1 → 0.127.0-project-admin-customisations.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.
- package/CHANGELOG.md +12 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +4 -4
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +171 -173
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +26 -28
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +77 -83
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +31 -33
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +43 -45
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +65 -69
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +10 -12
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +62 -66
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +121 -129
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +17 -19
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/index.js +56 -60
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +25 -27
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +6 -1
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/package.json +6 -5
- package/src/components/EntityManager/Entity/Entity.js +2 -0
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
|
@@ -15,49 +15,47 @@ var triggerPublish = /*#__PURE__*/function () {
|
|
|
15
15
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref, addToast) {
|
|
16
16
|
var entityData, client, setEntityIsPublish, entitySchema, _ref$textContent, textContent, refetchRecord, actionType, entityIsPublishedSwitch, mutation;
|
|
17
17
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_context.next = 4;
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
addToast(_constants.SAVE_BEFORE_PUBLISH_MESSAGE, {
|
|
27
|
-
appearance: 'info',
|
|
28
|
-
autoDismiss: true
|
|
29
|
-
});
|
|
30
|
-
return _context.abrupt("return");
|
|
31
|
-
case 4:
|
|
32
|
-
actionType = textContent.toLowerCase();
|
|
33
|
-
entityIsPublishedSwitch = "".concat(actionType, "ed");
|
|
34
|
-
mutation = (0, _utils.buildUpdatePublishUnpublishMutation)(entitySchema, entityData.id, actionType);
|
|
35
|
-
_context.prev = 7;
|
|
36
|
-
_context.next = 10;
|
|
37
|
-
return client.mutate({
|
|
38
|
-
mutation: mutation
|
|
39
|
-
});
|
|
40
|
-
case 10:
|
|
41
|
-
addToast("".concat(textContent, "ed"), {
|
|
42
|
-
appearance: 'success',
|
|
43
|
-
autoDismiss: true
|
|
44
|
-
});
|
|
45
|
-
_context.next = 16;
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
entityData = _ref.entityData, client = _ref.client, setEntityIsPublish = _ref.setEntityIsPublish, entitySchema = _ref.entitySchema, _ref$textContent = _ref.textContent, textContent = _ref$textContent === void 0 ? '' : _ref$textContent, refetchRecord = _ref.refetchRecord;
|
|
21
|
+
if (Object.keys(entityData).length) {
|
|
22
|
+
_context.next = 4;
|
|
46
23
|
break;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
24
|
+
}
|
|
25
|
+
addToast(_constants.SAVE_BEFORE_PUBLISH_MESSAGE, {
|
|
26
|
+
appearance: 'info',
|
|
27
|
+
autoDismiss: true
|
|
28
|
+
});
|
|
29
|
+
return _context.abrupt("return");
|
|
30
|
+
case 4:
|
|
31
|
+
actionType = textContent.toLowerCase();
|
|
32
|
+
entityIsPublishedSwitch = "".concat(actionType, "ed");
|
|
33
|
+
mutation = (0, _utils.buildUpdatePublishUnpublishMutation)(entitySchema, entityData.id, actionType);
|
|
34
|
+
_context.prev = 7;
|
|
35
|
+
_context.next = 10;
|
|
36
|
+
return client.mutate({
|
|
37
|
+
mutation: mutation
|
|
38
|
+
});
|
|
39
|
+
case 10:
|
|
40
|
+
addToast("".concat(textContent, "ed"), {
|
|
41
|
+
appearance: 'success',
|
|
42
|
+
autoDismiss: true
|
|
43
|
+
});
|
|
44
|
+
_context.next = 16;
|
|
45
|
+
break;
|
|
46
|
+
case 13:
|
|
47
|
+
_context.prev = 13;
|
|
48
|
+
_context.t0 = _context["catch"](7);
|
|
49
|
+
addToast(_context.t0.message, {
|
|
50
|
+
appearance: 'error',
|
|
51
|
+
autoDismiss: true
|
|
52
|
+
});
|
|
53
|
+
case 16:
|
|
54
|
+
setEntityIsPublish(entityIsPublishedSwitch);
|
|
55
|
+
refetchRecord(true);
|
|
56
|
+
case 18:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
61
59
|
}
|
|
62
60
|
}, _callee, null, [[7, 13]]);
|
|
63
61
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","names":["triggerPublish","addToast","entityData","client","setEntityIsPublish","entitySchema","textContent","refetchRecord","Object","keys","length","SAVE_BEFORE_PUBLISH_MESSAGE","appearance","autoDismiss","actionType","toLowerCase","entityIsPublishedSwitch","mutation","buildUpdatePublishUnpublishMutation","id","mutate","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/shared/publish.js"],"sourcesContent":["import { buildUpdatePublishUnpublishMutation } from '../../../../../utils';\nimport { SAVE_BEFORE_PUBLISH_MESSAGE } from '../../../../../constants';\n\nconst triggerPublish = async (\n { entityData, client, setEntityIsPublish, entitySchema, textContent = '', refetchRecord },\n addToast\n) => {\n if (!Object.keys(entityData).length) {\n addToast(SAVE_BEFORE_PUBLISH_MESSAGE, {\n appearance: 'info',\n autoDismiss: true\n });\n return;\n }\n const actionType = textContent.toLowerCase();\n const entityIsPublishedSwitch = `${actionType}ed`;\n const mutation = buildUpdatePublishUnpublishMutation(entitySchema, entityData.id, actionType);\n\n try {\n await client.mutate({\n mutation\n });\n addToast(`${textContent}ed`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n\n setEntityIsPublish(entityIsPublishedSwitch);\n refetchRecord(true);\n};\n\nexport { triggerPublish };\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AAEA,IAAMA,cAAc;EAAA,0FAAG,uBAErBC,QAAQ;IAAA;IAAA;MAAA;QAAA;
|
|
1
|
+
{"version":3,"file":"publish.js","names":["triggerPublish","addToast","entityData","client","setEntityIsPublish","entitySchema","textContent","refetchRecord","Object","keys","length","SAVE_BEFORE_PUBLISH_MESSAGE","appearance","autoDismiss","actionType","toLowerCase","entityIsPublishedSwitch","mutation","buildUpdatePublishUnpublishMutation","id","mutate","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/shared/publish.js"],"sourcesContent":["import { buildUpdatePublishUnpublishMutation } from '../../../../../utils';\nimport { SAVE_BEFORE_PUBLISH_MESSAGE } from '../../../../../constants';\n\nconst triggerPublish = async (\n { entityData, client, setEntityIsPublish, entitySchema, textContent = '', refetchRecord },\n addToast\n) => {\n if (!Object.keys(entityData).length) {\n addToast(SAVE_BEFORE_PUBLISH_MESSAGE, {\n appearance: 'info',\n autoDismiss: true\n });\n return;\n }\n const actionType = textContent.toLowerCase();\n const entityIsPublishedSwitch = `${actionType}ed`;\n const mutation = buildUpdatePublishUnpublishMutation(entitySchema, entityData.id, actionType);\n\n try {\n await client.mutate({\n mutation\n });\n addToast(`${textContent}ed`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n\n setEntityIsPublish(entityIsPublishedSwitch);\n refetchRecord(true);\n};\n\nexport { triggerPublish };\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AAEA,IAAMA,cAAc;EAAA,0FAAG,uBAErBC,QAAQ;IAAA;IAAA;MAAA;QAAA;UADNC,UAAU,QAAVA,UAAU,EAAEC,MAAM,QAANA,MAAM,EAAEC,kBAAkB,QAAlBA,kBAAkB,EAAEC,YAAY,QAAZA,YAAY,0BAAEC,WAAW,EAAXA,WAAW,iCAAG,EAAE,qBAAEC,aAAa,QAAbA,aAAa;UAAA,IAGlFC,MAAM,CAACC,IAAI,CAACP,UAAU,CAAC,CAACQ,MAAM;YAAA;YAAA;UAAA;UACjCT,QAAQ,CAACU,sCAA2B,EAAE;YACpCC,UAAU,EAAE,MAAM;YAClBC,WAAW,EAAE;UACf,CAAC,CAAC;UAAC;QAAA;UAGCC,UAAU,GAAGR,WAAW,CAACS,WAAW,EAAE;UACtCC,uBAAuB,aAAMF,UAAU;UACvCG,QAAQ,GAAG,IAAAC,0CAAmC,EAACb,YAAY,EAAEH,UAAU,CAACiB,EAAE,EAAEL,UAAU,CAAC;UAAA;UAAA;UAAA,OAGrFX,MAAM,CAACiB,MAAM,CAAC;YAClBH,QAAQ,EAARA;UACF,CAAC,CAAC;QAAA;UACFhB,QAAQ,WAAIK,WAAW,SAAM;YAC3BM,UAAU,EAAE,SAAS;YACrBC,WAAW,EAAE;UACf,CAAC,CAAC;UAAC;UAAA;QAAA;UAAA;UAAA;UAEHZ,QAAQ,CAAC,YAAMoB,OAAO,EAAE;YACtBT,UAAU,EAAE,OAAO;YACnBC,WAAW,EAAE;UACf,CAAC,CAAC;QAAC;UAGLT,kBAAkB,CAACY,uBAAuB,CAAC;UAC3CT,aAAa,CAAC,IAAI,CAAC;QAAC;QAAA;UAAA;MAAA;IAAA;EAAA,CACrB;EAAA,gBAhCKP,cAAc;IAAA;EAAA;AAAA,GAgCnB;AAAC"}
|
|
@@ -26,51 +26,49 @@ var submit = /*#__PURE__*/function () {
|
|
|
26
26
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref, addToast) {
|
|
27
27
|
var entitySchema, entityData, parsedFormValues, client, setIsSaveButtonAvailable, setSaveButtonText, setNewUpdatedDate, newUpdatedDate, handleUpdateFormData, mutation, _yield$client$mutate, data, updatedDate;
|
|
28
28
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
29
|
-
while (1) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return _context.stop();
|
|
73
|
-
}
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
entitySchema = _ref.entitySchema, entityData = _ref.entityData, parsedFormValues = _ref.parsedFormValues, client = _ref.client, setIsSaveButtonAvailable = _ref.setIsSaveButtonAvailable, setSaveButtonText = _ref.setSaveButtonText, setNewUpdatedDate = _ref.setNewUpdatedDate, newUpdatedDate = _ref.newUpdatedDate, handleUpdateFormData = _ref.handleUpdateFormData;
|
|
32
|
+
mutation = (0, _buildUpdateDataQuery["default"])(entitySchema);
|
|
33
|
+
_context.prev = 2;
|
|
34
|
+
setIsSaveButtonAvailable(false);
|
|
35
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.saving);
|
|
36
|
+
_context.next = 7;
|
|
37
|
+
return client.mutate({
|
|
38
|
+
mutation: mutation,
|
|
39
|
+
variables: {
|
|
40
|
+
input: _objectSpread(_objectSpread({
|
|
41
|
+
id: entityData.id
|
|
42
|
+
}, parsedFormValues), {}, {
|
|
43
|
+
updated: newUpdatedDate || entityData.updated
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
case 7:
|
|
48
|
+
_yield$client$mutate = _context.sent;
|
|
49
|
+
data = _yield$client$mutate.data;
|
|
50
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.saved);
|
|
51
|
+
updatedDate = data && data.updateEntity && data.updateEntity.result && data.updateEntity.result.updated;
|
|
52
|
+
setNewUpdatedDate(updatedDate);
|
|
53
|
+
addToast('Updated', {
|
|
54
|
+
appearance: _constants.SUCCESS,
|
|
55
|
+
autoDismiss: true
|
|
56
|
+
});
|
|
57
|
+
handleUpdateFormData();
|
|
58
|
+
return _context.abrupt("return", _constants.SUCCESS);
|
|
59
|
+
case 17:
|
|
60
|
+
_context.prev = 17;
|
|
61
|
+
_context.t0 = _context["catch"](2);
|
|
62
|
+
setIsSaveButtonAvailable(true);
|
|
63
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
64
|
+
addToast(_context.t0.message, {
|
|
65
|
+
appearance: _constants.ERROR,
|
|
66
|
+
autoDismiss: true
|
|
67
|
+
});
|
|
68
|
+
return _context.abrupt("return", _constants.ERROR);
|
|
69
|
+
case 23:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context.stop();
|
|
74
72
|
}
|
|
75
73
|
}, _callee, null, [[2, 17]]);
|
|
76
74
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.js","names":["submit","addToast","entitySchema","entityData","parsedFormValues","client","setIsSaveButtonAvailable","setSaveButtonText","setNewUpdatedDate","newUpdatedDate","handleUpdateFormData","mutation","buildUpdateDataQuery","SAVE_BUTTON_TEXTS","saving","mutate","variables","input","id","updated","data","saved","updatedDate","updateEntity","result","appearance","SUCCESS","autoDismiss","save","message","ERROR"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/update/submit.js"],"sourcesContent":["import buildUpdateDataQuery from '../../../../../utils/build-update-data-query';\nimport { ERROR, SUCCESS, SAVE_BUTTON_TEXTS } from '../../../../../constants';\n\nconst submit = async (\n {\n entitySchema,\n entityData,\n parsedFormValues,\n client,\n setIsSaveButtonAvailable,\n setSaveButtonText,\n setNewUpdatedDate,\n newUpdatedDate,\n handleUpdateFormData\n },\n addToast\n) => {\n const mutation = buildUpdateDataQuery(entitySchema);\n\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const { data } = await client.mutate({\n mutation,\n variables: {\n input: {\n id: entityData.id,\n ...parsedFormValues,\n updated: newUpdatedDate || entityData.updated\n }\n }\n });\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n const updatedDate =\n data && data.updateEntity && data.updateEntity.result && data.updateEntity.result.updated;\n\n setNewUpdatedDate(updatedDate);\n\n addToast('Updated', {\n appearance: SUCCESS,\n autoDismiss: true\n });\n handleUpdateFormData();\n return SUCCESS;\n } catch (error) {\n setIsSaveButtonAvailable(true);\n setSaveButtonText(SAVE_BUTTON_TEXTS.save);\n addToast(error.message, {\n appearance: ERROR,\n autoDismiss: true\n });\n return ERROR;\n }\n};\n\nexport { submit };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAA6E;AAAA;AAE7E,IAAMA,MAAM;EAAA,0FAAG,uBAYbC,QAAQ;IAAA;IAAA;MAAA;QAAA;
|
|
1
|
+
{"version":3,"file":"submit.js","names":["submit","addToast","entitySchema","entityData","parsedFormValues","client","setIsSaveButtonAvailable","setSaveButtonText","setNewUpdatedDate","newUpdatedDate","handleUpdateFormData","mutation","buildUpdateDataQuery","SAVE_BUTTON_TEXTS","saving","mutate","variables","input","id","updated","data","saved","updatedDate","updateEntity","result","appearance","SUCCESS","autoDismiss","save","message","ERROR"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/update/submit.js"],"sourcesContent":["import buildUpdateDataQuery from '../../../../../utils/build-update-data-query';\nimport { ERROR, SUCCESS, SAVE_BUTTON_TEXTS } from '../../../../../constants';\n\nconst submit = async (\n {\n entitySchema,\n entityData,\n parsedFormValues,\n client,\n setIsSaveButtonAvailable,\n setSaveButtonText,\n setNewUpdatedDate,\n newUpdatedDate,\n handleUpdateFormData\n },\n addToast\n) => {\n const mutation = buildUpdateDataQuery(entitySchema);\n\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const { data } = await client.mutate({\n mutation,\n variables: {\n input: {\n id: entityData.id,\n ...parsedFormValues,\n updated: newUpdatedDate || entityData.updated\n }\n }\n });\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n const updatedDate =\n data && data.updateEntity && data.updateEntity.result && data.updateEntity.result.updated;\n\n setNewUpdatedDate(updatedDate);\n\n addToast('Updated', {\n appearance: SUCCESS,\n autoDismiss: true\n });\n handleUpdateFormData();\n return SUCCESS;\n } catch (error) {\n setIsSaveButtonAvailable(true);\n setSaveButtonText(SAVE_BUTTON_TEXTS.save);\n addToast(error.message, {\n appearance: ERROR,\n autoDismiss: true\n });\n return ERROR;\n }\n};\n\nexport { submit };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAA6E;AAAA;AAE7E,IAAMA,MAAM;EAAA,0FAAG,uBAYbC,QAAQ;IAAA;IAAA;MAAA;QAAA;UAVNC,YAAY,QAAZA,YAAY,EACZC,UAAU,QAAVA,UAAU,EACVC,gBAAgB,QAAhBA,gBAAgB,EAChBC,M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gBAlDK9B,MAAM;IAAA;EAAA;AAAA,GAkDX;AAAC"}
|
|
@@ -72,51 +72,49 @@ var EntityManager = function EntityManager(_ref) {
|
|
|
72
72
|
(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
73
73
|
var _yield$entityAvailabl, _yield$entityAvailabl2, entitySchema, _yield$entityAvailabl3, data, _yield$entityAvailabl4, requestedQuery, localData, pageBuilderComponents;
|
|
74
74
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
75
|
-
while (1) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return _context.stop();
|
|
119
|
-
}
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
_context.next = 2;
|
|
78
|
+
return _entityAvailableActions["default"][action]({
|
|
79
|
+
client: client,
|
|
80
|
+
identifier: entityIdentifier,
|
|
81
|
+
id: id
|
|
82
|
+
});
|
|
83
|
+
case 2:
|
|
84
|
+
_yield$entityAvailabl = _context.sent;
|
|
85
|
+
_yield$entityAvailabl2 = (0, _slicedToArray2["default"])(_yield$entityAvailabl, 3);
|
|
86
|
+
entitySchema = _yield$entityAvailabl2[0];
|
|
87
|
+
_yield$entityAvailabl3 = _yield$entityAvailabl2[1];
|
|
88
|
+
data = _yield$entityAvailabl3 === void 0 ? {} : _yield$entityAvailabl3;
|
|
89
|
+
_yield$entityAvailabl4 = _yield$entityAvailabl2[2];
|
|
90
|
+
requestedQuery = _yield$entityAvailabl4 === void 0 ? {} : _yield$entityAvailabl4;
|
|
91
|
+
localData = data;
|
|
92
|
+
if (!isPageBuilderTemplateSet(data)) {
|
|
93
|
+
_context.next = 15;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
_context.next = 13;
|
|
97
|
+
return getPageBuilderComponents({
|
|
98
|
+
entitySchema: entitySchema,
|
|
99
|
+
client: client,
|
|
100
|
+
id: id
|
|
101
|
+
});
|
|
102
|
+
case 13:
|
|
103
|
+
pageBuilderComponents = _context.sent;
|
|
104
|
+
localData = _objectSpread(_objectSpread({}, localData), {}, {
|
|
105
|
+
pageBuilder: pageBuilderComponents || localData.pageBuilder
|
|
106
|
+
});
|
|
107
|
+
case 15:
|
|
108
|
+
setFormData({
|
|
109
|
+
values: localData
|
|
110
|
+
});
|
|
111
|
+
setEntity(data);
|
|
112
|
+
setSchema(entitySchema);
|
|
113
|
+
setPreviousQuery(requestedQuery);
|
|
114
|
+
setShouldRefetch(false);
|
|
115
|
+
case 20:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context.stop();
|
|
120
118
|
}
|
|
121
119
|
}, _callee);
|
|
122
120
|
}))();
|
|
@@ -160,30 +158,28 @@ function _getPageBuilderComponents() {
|
|
|
160
158
|
_getPageBuilderComponents = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref3) {
|
|
161
159
|
var entitySchema, client, id, actionName, _yield$client$query, _yield$client$query$d, pageBuilderData;
|
|
162
160
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
163
|
-
while (1) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return _context2.stop();
|
|
186
|
-
}
|
|
161
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
entitySchema = _ref3.entitySchema, client = _ref3.client, id = _ref3.id;
|
|
164
|
+
actionName = entitySchema && entitySchema.actions.getAll || 'get';
|
|
165
|
+
_context2.next = 4;
|
|
166
|
+
return client.query({
|
|
167
|
+
query: (0, _query.getAction)(actionName, 'pageBuilderComponents'),
|
|
168
|
+
variables: {
|
|
169
|
+
where: {
|
|
170
|
+
id: id
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
fetchPolicy: 'network-only'
|
|
174
|
+
});
|
|
175
|
+
case 4:
|
|
176
|
+
_yield$client$query = _context2.sent;
|
|
177
|
+
_yield$client$query$d = _yield$client$query.data;
|
|
178
|
+
pageBuilderData = _yield$client$query$d === void 0 ? {} : _yield$client$query$d;
|
|
179
|
+
return _context2.abrupt("return", pageBuilderData[actionName] && pageBuilderData[actionName].length ? pageBuilderData[actionName][0].pageBuilderComponents : null);
|
|
180
|
+
case 8:
|
|
181
|
+
case "end":
|
|
182
|
+
return _context2.stop();
|
|
187
183
|
}
|
|
188
184
|
}, _callee2);
|
|
189
185
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityManager.js","names":["EntityManager","match","useState","formData","setFormData","entity","setEntity","id","schema","setSchema","previousQuery","setPreviousQuery","shouldRefetch","setShouldRefetch","client","useApolloClient","params","action","entityIdentifier","onViewUrl","useEffect","entityAvailableActions","identifier","entitySchema","data","requestedQuery","localData","isPageBuilderTemplateSet","getPageBuilderComponents","pageBuilderComponents","pageBuilder","values","updateFormData","updatedFormData","shouldRefresh","recordHasChanged","propTypes","PropTypes","shape","string","func","isRequired","withRouter","actionName","actions","getAll","query","getAction","variables","where","fetchPolicy","pageBuilderData","length","pageBuilderTemplateId","currentEntityIdentifier"],"sources":["../../../src/components/EntityManager/EntityManager.js"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { withRouter } from 'react-router-dom';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport entityAvailableActions from './utils/entityAvailableActions';\nimport Entity from './Entity';\nimport { getAction } from './utils/query';\n\nconst EntityManager = ({ match }) => {\n const [formData, setFormData] = useState(null);\n const [entity, setEntity] = useState(null);\n const [schema, setSchema] = useState({ id: null });\n const [previousQuery, setPreviousQuery] = useState(null);\n const [shouldRefetch, setShouldRefetch] = useState(false);\n const client = useApolloClient();\n\n const { action, entityIdentifier, id = null, onViewUrl } = match.params;\n\n useEffect(\n () => {\n (async () => {\n const [entitySchema, data = {}, requestedQuery = {}] = await entityAvailableActions[action](\n {\n client,\n identifier: entityIdentifier,\n id\n }\n );\n let localData = data;\n\n if (isPageBuilderTemplateSet(data)) {\n const pageBuilderComponents = await getPageBuilderComponents({\n entitySchema,\n client,\n id\n });\n\n localData = {\n ...localData,\n pageBuilder: pageBuilderComponents || localData.pageBuilder\n };\n }\n\n setFormData({ values: localData });\n setEntity(data);\n setSchema(entitySchema);\n setPreviousQuery(requestedQuery);\n setShouldRefetch(false);\n })();\n },\n [action, client, entityIdentifier, id, schema, shouldRefetch]\n );\n\n const updateFormData = (updatedFormData, shouldRefresh) => {\n if (shouldRefresh) setShouldRefetch(true);\n setFormData(updatedFormData);\n };\n\n // Reset when entity/record changes\n if (!formData || !schema.id || recordHasChanged(entity, id, schema.id, entityIdentifier)) {\n return null;\n }\n\n return (\n <Entity\n action={match.params.action}\n formData={formData}\n updateFormData={updateFormData}\n entity={entity}\n schema={schema}\n previousQuery={previousQuery}\n onViewUrl={onViewUrl}\n refetchRecord={setShouldRefetch}\n />\n );\n};\n\nEntityManager.propTypes = {\n match: PropTypes.shape({\n params: PropTypes.shape({\n action: PropTypes.string,\n entityIdentifier: PropTypes.string,\n id: PropTypes.string,\n onViewUrl: PropTypes.func\n })\n }).isRequired\n};\n\nexport default withRouter(EntityManager);\n\nasync function getPageBuilderComponents({ entitySchema, client, id }) {\n const actionName = (entitySchema && entitySchema.actions.getAll) || 'get';\n const { data: pageBuilderData = {} } = await client.query({\n query: getAction(actionName, 'pageBuilderComponents'),\n variables: {\n where: {\n id\n }\n },\n fetchPolicy: 'network-only'\n });\n\n return pageBuilderData[actionName] && pageBuilderData[actionName].length\n ? pageBuilderData[actionName][0].pageBuilderComponents\n : null;\n}\n\nfunction isPageBuilderTemplateSet(data) {\n return data && data.pageBuilderTemplateId && data.pageBuilderTemplateId !== '';\n}\n\nfunction recordHasChanged(entity, id, currentEntityIdentifier, entityIdentifier) {\n return (\n (entity && entity.id && entity.id !== id) ||\n (currentEntityIdentifier && currentEntityIdentifier !== entityIdentifier)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAA0C;AAAA;AAAA;AAAA;AAE1C,IAAMA,aAAa,GAAG,SAAhBA,aAAa,OAAkB;EAAA,IAAZC,KAAK,QAALA,KAAK;EAC5B,gBAAgC,IAAAC,eAAQ,EAAC,IAAI,CAAC;IAAA;IAAvCC,QAAQ;IAAEC,WAAW;EAC5B,iBAA4B,IAAAF,eAAQ,EAAC,IAAI,CAAC;IAAA;IAAnCG,MAAM;IAAEC,SAAS;EACxB,iBAA4B,IAAAJ,eAAQ,EAAC;MAAEK,EAAE,EAAE;IAAK,CAAC,CAAC;IAAA;IAA3CC,MAAM;IAAEC,SAAS;EACxB,iBAA0C,IAAAP,eAAQ,EAAC,IAAI,CAAC;IAAA;IAAjDQ,aAAa;IAAEC,gBAAgB;EACtC,iBAA0C,IAAAT,eAAQ,EAAC,KAAK,CAAC;IAAA;IAAlDU,aAAa;IAAEC,gBAAgB;EACtC,IAAMC,MAAM,GAAG,IAAAC,uBAAe,GAAE;EAEhC,oBAA2Dd,KAAK,CAACe,MAAM;IAA/DC,MAAM,iBAANA,MAAM;IAAEC,gBAAgB,iBAAhBA,gBAAgB;IAAA,iCAAEX,EAAE;IAAFA,EAAE,iCAAG,IAAI;IAAEY,SAAS,iBAATA,SAAS;EAEtD,IAAAC,gBAAS,EACP,YAAM;IACJ,8EAAC;MAAA;MAAA;QAAA;UAAA;YAAA;
|
|
1
|
+
{"version":3,"file":"EntityManager.js","names":["EntityManager","match","useState","formData","setFormData","entity","setEntity","id","schema","setSchema","previousQuery","setPreviousQuery","shouldRefetch","setShouldRefetch","client","useApolloClient","params","action","entityIdentifier","onViewUrl","useEffect","entityAvailableActions","identifier","entitySchema","data","requestedQuery","localData","isPageBuilderTemplateSet","getPageBuilderComponents","pageBuilderComponents","pageBuilder","values","updateFormData","updatedFormData","shouldRefresh","recordHasChanged","propTypes","PropTypes","shape","string","func","isRequired","withRouter","actionName","actions","getAll","query","getAction","variables","where","fetchPolicy","pageBuilderData","length","pageBuilderTemplateId","currentEntityIdentifier"],"sources":["../../../src/components/EntityManager/EntityManager.js"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { withRouter } from 'react-router-dom';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport entityAvailableActions from './utils/entityAvailableActions';\nimport Entity from './Entity';\nimport { getAction } from './utils/query';\n\nconst EntityManager = ({ match }) => {\n const [formData, setFormData] = useState(null);\n const [entity, setEntity] = useState(null);\n const [schema, setSchema] = useState({ id: null });\n const [previousQuery, setPreviousQuery] = useState(null);\n const [shouldRefetch, setShouldRefetch] = useState(false);\n const client = useApolloClient();\n\n const { action, entityIdentifier, id = null, onViewUrl } = match.params;\n\n useEffect(\n () => {\n (async () => {\n const [entitySchema, data = {}, requestedQuery = {}] = await entityAvailableActions[action](\n {\n client,\n identifier: entityIdentifier,\n id\n }\n );\n let localData = data;\n\n if (isPageBuilderTemplateSet(data)) {\n const pageBuilderComponents = await getPageBuilderComponents({\n entitySchema,\n client,\n id\n });\n\n localData = {\n ...localData,\n pageBuilder: pageBuilderComponents || localData.pageBuilder\n };\n }\n\n setFormData({ values: localData });\n setEntity(data);\n setSchema(entitySchema);\n setPreviousQuery(requestedQuery);\n setShouldRefetch(false);\n })();\n },\n [action, client, entityIdentifier, id, schema, shouldRefetch]\n );\n\n const updateFormData = (updatedFormData, shouldRefresh) => {\n if (shouldRefresh) setShouldRefetch(true);\n setFormData(updatedFormData);\n };\n\n // Reset when entity/record changes\n if (!formData || !schema.id || recordHasChanged(entity, id, schema.id, entityIdentifier)) {\n return null;\n }\n\n return (\n <Entity\n action={match.params.action}\n formData={formData}\n updateFormData={updateFormData}\n entity={entity}\n schema={schema}\n previousQuery={previousQuery}\n onViewUrl={onViewUrl}\n refetchRecord={setShouldRefetch}\n />\n );\n};\n\nEntityManager.propTypes = {\n match: PropTypes.shape({\n params: PropTypes.shape({\n action: PropTypes.string,\n entityIdentifier: PropTypes.string,\n id: PropTypes.string,\n onViewUrl: PropTypes.func\n })\n }).isRequired\n};\n\nexport default withRouter(EntityManager);\n\nasync function getPageBuilderComponents({ entitySchema, client, id }) {\n const actionName = (entitySchema && entitySchema.actions.getAll) || 'get';\n const { data: pageBuilderData = {} } = await client.query({\n query: getAction(actionName, 'pageBuilderComponents'),\n variables: {\n where: {\n id\n }\n },\n fetchPolicy: 'network-only'\n });\n\n return pageBuilderData[actionName] && pageBuilderData[actionName].length\n ? pageBuilderData[actionName][0].pageBuilderComponents\n : null;\n}\n\nfunction isPageBuilderTemplateSet(data) {\n return data && data.pageBuilderTemplateId && data.pageBuilderTemplateId !== '';\n}\n\nfunction recordHasChanged(entity, id, currentEntityIdentifier, entityIdentifier) {\n return (\n (entity && entity.id && entity.id !== id) ||\n (currentEntityIdentifier && currentEntityIdentifier !== entityIdentifier)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA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AC9B,MAAM,EAAEE,EAAE,EAAE+C,uBAAuB,EAAEpC,gBAAgB,EAAE;EAC/E,OACGb,MAAM,IAAIA,MAAM,CAACE,EAAE,IAAIF,MAAM,CAACE,EAAE,KAAKA,EAAE,IACvC+C,uBAAuB,IAAIA,uBAAuB,KAAKpC,gBAAiB;AAE7E"}
|
|
@@ -54,18 +54,16 @@ function _onViewUrlClick() {
|
|
|
54
54
|
_onViewUrlClick = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(getFullUrl) {
|
|
55
55
|
var fullUrl;
|
|
56
56
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
57
|
-
while (1) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return _context.stop();
|
|
68
|
-
}
|
|
57
|
+
while (1) switch (_context.prev = _context.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
_context.next = 2;
|
|
60
|
+
return getFullUrl();
|
|
61
|
+
case 2:
|
|
62
|
+
fullUrl = _context.sent;
|
|
63
|
+
if (fullUrl) window.open(fullUrl, '_blank');
|
|
64
|
+
case 4:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context.stop();
|
|
69
67
|
}
|
|
70
68
|
}, _callee);
|
|
71
69
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","names":["canViewPage","formData","entity","schema","entityIsPublished","has","KEY_TO_CHECK","id","ENTITY_PUBLISHED","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","SELECT_DEFAULT_VALUE","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","push","requiredChildFieldIndex","checkFulfilConditions","args","every","param"],"sources":["../../../../src/components/EntityManager/utils/entity.js"],"sourcesContent":["import has from 'lodash.has';\nimport { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';\n\nfunction canViewPage(formData, entity, schema, entityIsPublished) {\n return (\n has(formData, KEY_TO_CHECK) &&\n entity &&\n entity.id &&\n schema &&\n schema.id &&\n entityIsPublished === ENTITY_PUBLISHED\n );\n}\n\nfunction validateSideBarRelations(updatedFormValues, requiredChildField) {\n if (!requiredChildField) return true;\n const parentEntityField = updatedFormValues.find(({ id }) => id === 'parentEntity');\n const parentIdField = updatedFormValues.find(({ id }) => id === 'parentId');\n\n const parentEntityFieldHasValue =\n parentEntityField &&\n parentEntityField.value &&\n parentEntityField.value !== SELECT_DEFAULT_VALUE;\n const parentIdFieldHasValue = parentIdField && parentIdField.value;\n\n return !!(!parentEntityFieldHasValue || (parentEntityFieldHasValue && parentIdFieldHasValue));\n}\n\nasync function onViewUrlClick(getFullUrl) {\n const fullUrl = await getFullUrl();\n if (fullUrl) window.open(fullUrl, '_blank');\n}\n\nfunction getUpdatedFormValues({ id, value, requiredChildField, formValues }) {\n const updatedFormValues = formValues ? formValues.slice() : [];\n const fieldIndex = updatedFormValues.findIndex(({ id: _id }) => _id === id);\n\n if (fieldIndex > -1) {\n updatedFormValues[fieldIndex] = { ...updatedFormValues[fieldIndex], value };\n } else {\n updatedFormValues.push({ id, value });\n }\n\n if (requiredChildField && requiredChildField.id) {\n const requiredChildFieldIndex = updatedFormValues.findIndex(\n ({ id: _id }) => _id === requiredChildField.id\n );\n if (requiredChildFieldIndex > -1) {\n updatedFormValues[requiredChildFieldIndex] = {\n ...updatedFormValues[requiredChildFieldIndex],\n value: requiredChildField.value\n };\n } else {\n updatedFormValues.push({\n id: requiredChildField.id,\n value: requiredChildField.value\n });\n }\n }\n\n return updatedFormValues;\n}\n\nfunction checkFulfilConditions(...args) {\n return args.every(param => param);\n}\n\nexport {\n canViewPage,\n validateSideBarRelations,\n onViewUrlClick,\n getUpdatedFormValues,\n checkFulfilConditions\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAA0F;AAAA;AAE1F,SAASA,WAAW,CAACC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,EAAEC,iBAAiB,EAAE;EAChE,OACE,IAAAC,kBAAG,EAACJ,QAAQ,EAAEK,uBAAY,CAAC,IAC3BJ,MAAM,IACNA,MAAM,CAACK,EAAE,IACTJ,MAAM,IACNA,MAAM,CAACI,EAAE,IACTH,iBAAiB,KAAKI,2BAAgB;AAE1C;AAEA,SAASC,wBAAwB,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;EACvE,IAAI,CAACA,kBAAkB,EAAE,OAAO,IAAI;EACpC,IAAMC,iBAAiB,GAAGF,iBAAiB,CAACG,IAAI,CAAC;IAAA,IAAGN,EAAE,QAAFA,EAAE;IAAA,OAAOA,EAAE,KAAK,cAAc;EAAA,EAAC;EACnF,IAAMO,aAAa,GAAGJ,iBAAiB,CAACG,IAAI,CAAC;IAAA,IAAGN,EAAE,SAAFA,EAAE;IAAA,OAAOA,EAAE,KAAK,UAAU;EAAA,EAAC;EAE3E,IAAMQ,yBAAyB,GAC7BH,iBAAiB,IACjBA,iBAAiB,CAACI,KAAK,IACvBJ,iBAAiB,CAACI,KAAK,KAAKC,+BAAoB;EAClD,IAAMC,qBAAqB,GAAGJ,aAAa,IAAIA,aAAa,CAACE,KAAK;EAElE,OAAO,CAAC,EAAE,CAACD,yBAAyB,IAAKA,yBAAyB,IAAIG,qBAAsB,CAAC;AAC/F;AAAC,SAEcC,cAAc;EAAA;AAAA;AAAA;EAAA,gGAA7B,iBAA8BC,UAAU;IAAA;IAAA;MAAA;QAAA;UAAA;
|
|
1
|
+
{"version":3,"file":"entity.js","names":["canViewPage","formData","entity","schema","entityIsPublished","has","KEY_TO_CHECK","id","ENTITY_PUBLISHED","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","SELECT_DEFAULT_VALUE","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","push","requiredChildFieldIndex","checkFulfilConditions","args","every","param"],"sources":["../../../../src/components/EntityManager/utils/entity.js"],"sourcesContent":["import has from 'lodash.has';\nimport { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';\n\nfunction canViewPage(formData, entity, schema, entityIsPublished) {\n return (\n has(formData, KEY_TO_CHECK) &&\n entity &&\n entity.id &&\n schema &&\n schema.id &&\n entityIsPublished === ENTITY_PUBLISHED\n );\n}\n\nfunction validateSideBarRelations(updatedFormValues, requiredChildField) {\n if (!requiredChildField) return true;\n const parentEntityField = updatedFormValues.find(({ id }) => id === 'parentEntity');\n const parentIdField = updatedFormValues.find(({ id }) => id === 'parentId');\n\n const parentEntityFieldHasValue =\n parentEntityField &&\n parentEntityField.value &&\n parentEntityField.value !== SELECT_DEFAULT_VALUE;\n const parentIdFieldHasValue = parentIdField && parentIdField.value;\n\n return !!(!parentEntityFieldHasValue || (parentEntityFieldHasValue && parentIdFieldHasValue));\n}\n\nasync function onViewUrlClick(getFullUrl) {\n const fullUrl = await getFullUrl();\n if (fullUrl) window.open(fullUrl, '_blank');\n}\n\nfunction getUpdatedFormValues({ id, value, requiredChildField, formValues }) {\n const updatedFormValues = formValues ? formValues.slice() : [];\n const fieldIndex = updatedFormValues.findIndex(({ id: _id }) => _id === id);\n\n if (fieldIndex > -1) {\n updatedFormValues[fieldIndex] = { ...updatedFormValues[fieldIndex], value };\n } else {\n updatedFormValues.push({ id, value });\n }\n\n if (requiredChildField && requiredChildField.id) {\n const requiredChildFieldIndex = updatedFormValues.findIndex(\n ({ id: _id }) => _id === requiredChildField.id\n );\n if (requiredChildFieldIndex > -1) {\n updatedFormValues[requiredChildFieldIndex] = {\n ...updatedFormValues[requiredChildFieldIndex],\n value: requiredChildField.value\n };\n } else {\n updatedFormValues.push({\n id: requiredChildField.id,\n value: requiredChildField.value\n });\n }\n }\n\n return updatedFormValues;\n}\n\nfunction checkFulfilConditions(...args) {\n return args.every(param => param);\n}\n\nexport {\n canViewPage,\n validateSideBarRelations,\n onViewUrlClick,\n getUpdatedFormValues,\n checkFulfilConditions\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAA0F;AAAA;AAE1F,SAASA,WAAW,CAACC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,EAAEC,iBAAiB,EAAE;EAChE,OACE,IAAAC,kBAAG,EAACJ,QAAQ,EAAEK,uBAAY,CAAC,IAC3BJ,MAAM,IACNA,MAAM,CAACK,EAAE,IACTJ,MAAM,IACNA,MAAM,CAACI,EAAE,IACTH,iBAAiB,KAAKI,2BAAgB;AAE1C;AAEA,SAASC,wBAAwB,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;EACvE,IAAI,CAACA,kBAAkB,EAAE,OAAO,IAAI;EACpC,IAAMC,iBAAiB,GAAGF,iBAAiB,CAACG,IAAI,CAAC;IAAA,IAAGN,EAAE,QAAFA,EAAE;IAAA,OAAOA,EAAE,KAAK,cAAc;EAAA,EAAC;EACnF,IAAMO,aAAa,GAAGJ,iBAAiB,CAACG,IAAI,CAAC;IAAA,IAAGN,EAAE,SAAFA,EAAE;IAAA,OAAOA,EAAE,KAAK,UAAU;EAAA,EAAC;EAE3E,IAAMQ,yBAAyB,GAC7BH,iBAAiB,IACjBA,iBAAiB,CAACI,KAAK,IACvBJ,iBAAiB,CAACI,KAAK,KAAKC,+BAAoB;EAClD,IAAMC,qBAAqB,GAAGJ,aAAa,IAAIA,aAAa,CAACE,KAAK;EAElE,OAAO,CAAC,EAAE,CAACD,yBAAyB,IAAKA,yBAAyB,IAAIG,qBAAsB,CAAC;AAC/F;AAAC,SAEcC,cAAc;EAAA;AAAA;AAAA;EAAA,gGAA7B,iBAA8BC,UAAU;IAAA;IAAA;MAAA;QAAA;UAAA;UAAA,OAChBA,UAAU,EAAE;QAAA;UAA5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