@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.
Files changed (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/components/EntityDataListing/EntityDataListing.js +4 -4
  3. package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
  4. package/lib/components/EntityManager/Entity/Entity.js +171 -173
  5. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  6. package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  7. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +26 -28
  8. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  9. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +77 -83
  10. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  11. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +40 -42
  12. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  13. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +31 -33
  14. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  15. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +40 -42
  16. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  17. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +43 -45
  18. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  19. package/lib/components/EntityManager/EntityManager.js +65 -69
  20. package/lib/components/EntityManager/EntityManager.js.map +1 -1
  21. package/lib/components/EntityManager/utils/entity.js +10 -12
  22. package/lib/components/EntityManager/utils/entity.js.map +1 -1
  23. package/lib/components/EntityManager/utils/entityAvailableActions.js +62 -66
  24. package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  25. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -1
  26. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  27. package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  28. package/lib/components/ListingTable/ListingTable.js +121 -129
  29. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  30. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  31. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  32. package/lib/components/ListingTable/service/index.js +17 -19
  33. package/lib/components/ListingTable/service/index.js.map +1 -1
  34. package/lib/index.js +56 -60
  35. package/lib/index.js.map +1 -1
  36. package/lib/utils/add-content-menu-items.js +25 -27
  37. package/lib/utils/add-content-menu-items.js.map +1 -1
  38. package/lib-es/components/EntityManager/Entity/Entity.js +6 -1
  39. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  40. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  41. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  42. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  43. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
  44. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  45. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  46. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  47. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  48. package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
  49. package/package.json +6 -5
  50. package/src/components/EntityManager/Entity/Entity.js +2 -0
  51. 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
- switch (_context.prev = _context.next) {
20
- case 0:
21
- 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;
22
- if (Object.keys(entityData).length) {
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
- case 13:
48
- _context.prev = 13;
49
- _context.t0 = _context["catch"](7);
50
- addToast(_context.t0.message, {
51
- appearance: 'error',
52
- autoDismiss: true
53
- });
54
- case 16:
55
- setEntityIsPublish(entityIsPublishedSwitch);
56
- refetchRecord(true);
57
- case 18:
58
- case "end":
59
- return _context.stop();
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;UAAA;YADNC,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;YAAA,IAGlFC,MAAM,CAACC,IAAI,CAACP,UAAU,CAAC,CAACQ,MAAM;cAAA;cAAA;YAAA;YACjCT,QAAQ,CAACU,sCAA2B,EAAE;cACpCC,UAAU,EAAE,MAAM;cAClBC,WAAW,EAAE;YACf,CAAC,CAAC;YAAC;UAAA;YAGCC,UAAU,GAAGR,WAAW,CAACS,WAAW,EAAE;YACtCC,uBAAuB,aAAMF,UAAU;YACvCG,QAAQ,GAAG,IAAAC,0CAAmC,EAACb,YAAY,EAAEH,UAAU,CAACiB,EAAE,EAAEL,UAAU,CAAC;YAAA;YAAA;YAAA,OAGrFX,MAAM,CAACiB,MAAM,CAAC;cAClBH,QAAQ,EAARA;YACF,CAAC,CAAC;UAAA;YACFhB,QAAQ,WAAIK,WAAW,SAAM;cAC3BM,UAAU,EAAE,SAAS;cACrBC,WAAW,EAAE;YACf,CAAC,CAAC;YAAC;YAAA;UAAA;YAAA;YAAA;YAEHZ,QAAQ,CAAC,YAAMoB,OAAO,EAAE;cACtBT,UAAU,EAAE,OAAO;cACnBC,WAAW,EAAE;YACf,CAAC,CAAC;UAAC;YAGLT,kBAAkB,CAACY,uBAAuB,CAAC;YAC3CT,aAAa,CAAC,IAAI,CAAC;UAAC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACrB;EAAA,gBAhCKP,cAAc;IAAA;EAAA;AAAA,GAgCnB;AAAC"}
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
- switch (_context.prev = _context.next) {
31
- case 0:
32
- 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;
33
- mutation = (0, _buildUpdateDataQuery["default"])(entitySchema);
34
- _context.prev = 2;
35
- setIsSaveButtonAvailable(false);
36
- setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.saving);
37
- _context.next = 7;
38
- return client.mutate({
39
- mutation: mutation,
40
- variables: {
41
- input: _objectSpread(_objectSpread({
42
- id: entityData.id
43
- }, parsedFormValues), {}, {
44
- updated: newUpdatedDate || entityData.updated
45
- })
46
- }
47
- });
48
- case 7:
49
- _yield$client$mutate = _context.sent;
50
- data = _yield$client$mutate.data;
51
- setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.saved);
52
- updatedDate = data && data.updateEntity && data.updateEntity.result && data.updateEntity.result.updated;
53
- setNewUpdatedDate(updatedDate);
54
- addToast('Updated', {
55
- appearance: _constants.SUCCESS,
56
- autoDismiss: true
57
- });
58
- handleUpdateFormData();
59
- return _context.abrupt("return", _constants.SUCCESS);
60
- case 17:
61
- _context.prev = 17;
62
- _context.t0 = _context["catch"](2);
63
- setIsSaveButtonAvailable(true);
64
- setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
65
- addToast(_context.t0.message, {
66
- appearance: _constants.ERROR,
67
- autoDismiss: true
68
- });
69
- return _context.abrupt("return", _constants.ERROR);
70
- case 23:
71
- case "end":
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;UAAA;YAVNC,YAAY,QAAZA,YAAY,EACZC,UAAU,QAAVA,UAAU,EACVC,gBAAgB,QAAhBA,gBAAgB,EAChBC,MAAM,QAANA,MAAM,EACNC,wBAAwB,QAAxBA,wBAAwB,EACxBC,iBAAiB,QAAjBA,iBAAiB,EACjBC,iBAAiB,QAAjBA,iBAAiB,EACjBC,cAAc,QAAdA,cAAc,EACdC,oBAAoB,QAApBA,oBAAoB;YAIhBC,QAAQ,GAAG,IAAAC,gCAAoB,EAACV,YAAY,CAAC;YAAA;YAGjDI,wBAAwB,CAAC,KAAK,CAAC;YAC/BC,iBAAiB,CAACM,4BAAiB,CAACC,MAAM,CAAC;YAAC;YAAA,OACrBT,MAAM,CAACU,MAAM,CAAC;cACnCJ,QAAQ,EAARA,QAAQ;cACRK,SAAS,EAAE;gBACTC,KAAK;kBACHC,EAAE,EAAEf,UAAU,CAACe;gBAAE,GACdd,gBAAgB;kBACnBe,OAAO,EAAEV,cAAc,IAAIN,UAAU,CAACgB;gBAAO;cAEjD;YACF,CAAC,CAAC;UAAA;YAAA;YATMC,IAAI,wBAAJA,IAAI;YAUZb,iBAAiB,CAACM,4BAAiB,CAACQ,KAAK,CAAC;YACpCC,WAAW,GACfF,IAAI,IAAIA,IAAI,CAACG,YAAY,IAAIH,IAAI,CAACG,YAAY,CAACC,MAAM,IAAIJ,IAAI,CAACG,YAAY,CAACC,MAAM,CAACL,OAAO;YAE3FX,iBAAiB,CAACc,WAAW,CAAC;YAE9BrB,QAAQ,CAAC,SAAS,EAAE;cAClBwB,UAAU,EAAEC,kBAAO;cACnBC,WAAW,EAAE;YACf,CAAC,CAAC;YACFjB,oBAAoB,EAAE;YAAC,iCAChBgB,kBAAO;UAAA;YAAA;YAAA;YAEdpB,wBAAwB,CAAC,IAAI,CAAC;YAC9BC,iBAAiB,CAACM,4BAAiB,CAACe,IAAI,CAAC;YACzC3B,QAAQ,CAAC,YAAM4B,OAAO,EAAE;cACtBJ,UAAU,EAAEK,gBAAK;cACjBH,WAAW,EAAE;YACf,CAAC,CAAC;YAAC,iCACIG,gBAAK;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAEf;EAAA,gBAlDK9B,MAAM;IAAA;EAAA;AAAA,GAkDX;AAAC"}
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,MAAM,QAANA,MAAM,EACNC,wBAAwB,QAAxBA,wBAAwB,EACxBC,iBAAiB,QAAjBA,iBAAiB,EACjBC,iBAAiB,QAAjBA,iBAAiB,EACjBC,cAA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#__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
- switch (_context.prev = _context.next) {
77
- case 0:
78
- _context.next = 2;
79
- return _entityAvailableActions["default"][action]({
80
- client: client,
81
- identifier: entityIdentifier,
82
- id: id
83
- });
84
- case 2:
85
- _yield$entityAvailabl = _context.sent;
86
- _yield$entityAvailabl2 = (0, _slicedToArray2["default"])(_yield$entityAvailabl, 3);
87
- entitySchema = _yield$entityAvailabl2[0];
88
- _yield$entityAvailabl3 = _yield$entityAvailabl2[1];
89
- data = _yield$entityAvailabl3 === void 0 ? {} : _yield$entityAvailabl3;
90
- _yield$entityAvailabl4 = _yield$entityAvailabl2[2];
91
- requestedQuery = _yield$entityAvailabl4 === void 0 ? {} : _yield$entityAvailabl4;
92
- localData = data;
93
- if (!isPageBuilderTemplateSet(data)) {
94
- _context.next = 15;
95
- break;
96
- }
97
- _context.next = 13;
98
- return getPageBuilderComponents({
99
- entitySchema: entitySchema,
100
- client: client,
101
- id: id
102
- });
103
- case 13:
104
- pageBuilderComponents = _context.sent;
105
- localData = _objectSpread(_objectSpread({}, localData), {}, {
106
- pageBuilder: pageBuilderComponents || localData.pageBuilder
107
- });
108
- case 15:
109
- setFormData({
110
- values: localData
111
- });
112
- setEntity(data);
113
- setSchema(entitySchema);
114
- setPreviousQuery(requestedQuery);
115
- setShouldRefetch(false);
116
- case 20:
117
- case "end":
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
- switch (_context2.prev = _context2.next) {
165
- case 0:
166
- entitySchema = _ref3.entitySchema, client = _ref3.client, id = _ref3.id;
167
- actionName = entitySchema && entitySchema.actions.getAll || 'get';
168
- _context2.next = 4;
169
- return client.query({
170
- query: (0, _query.getAction)(actionName, 'pageBuilderComponents'),
171
- variables: {
172
- where: {
173
- id: id
174
- }
175
- },
176
- fetchPolicy: 'network-only'
177
- });
178
- case 4:
179
- _yield$client$query = _context2.sent;
180
- _yield$client$query$d = _yield$client$query.data;
181
- pageBuilderData = _yield$client$query$d === void 0 ? {} : _yield$client$query$d;
182
- return _context2.abrupt("return", pageBuilderData[actionName] && pageBuilderData[actionName].length ? pageBuilderData[actionName][0].pageBuilderComponents : null);
183
- case 8:
184
- case "end":
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,IAA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AC;cACD2C,WAAW,EAAE;YACf,CAAC,CAAC;UAAA;YAAA;YAAA,4CARM1B,IAAI;YAAE2B,eAAe,sCAAG,CAAC,CAAC;YAAA,kCAU3BA,eAAe,CAACR,UAAU,CAAC,IAAIQ,eAAe,CAACR,UAAU,CAAC,CAACS,MAAM,GACpED,eAAe,CAACR,UAAU,CAAC,CAAC,CAAC,CAAC,CAACd,qBAAqB,GACpD,IAAI;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACT;EAAA;AAAA;AAED,SAASF,wBAAwB,CAACH,IAAI,EAAE;EACtC,OAAOA,IAAI,IAAIA,IAAI,CAAC6B,qBAAqB,IAAI7B,IAAI,CAAC6B,qBAAqB,KAAK,EAAE;AAChF;AAEA,SAASlB,gBAAgB,CAAC9B,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"}
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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e,sCAAG,CAAC,CAAC;UAAA,kCAU3BA,eAAe,CAACR,UAAU,CAAC,IAAIQ,eAAe,CAACR,UAAU,CAAC,CAACS,MAAM,GACpED,eAAe,CAACR,UAAU,CAAC,CAAC,CAAC,CAAC,CAACd,qBAAqB,GACpD,IAAI;QAAA;QAAA;UAAA;MAAA;IAAA;EAAA,CACT;EAAA;AAAA;AAED,SAASF,wBAAwB,CAACH,IAAI,EAAE;EACtC,OAAOA,IAAI,IAAIA,IAAI,CAAC6B,qBAAqB,IAAI7B,IAAI,CAAC6B,qBAAqB,KAAK,EAAE;AAChF;AAEA,SAASlB,gBAAgB,CAAC9B,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
- switch (_context.prev = _context.next) {
59
- case 0:
60
- _context.next = 2;
61
- return getFullUrl();
62
- case 2:
63
- fullUrl = _context.sent;
64
- if (fullUrl) window.open(fullUrl, '_blank');
65
- case 4:
66
- case "end":
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;E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AC;QAC7Cf,KAAK,EAAEL,kBAAkB,CAACK;MAAK,EAChC;IACH,CAAC,MAAM;MACLN,iBAAiB,CAACoB,IAAI,CAAC;QACrBvB,EAAE,EAAEI,kBAAkB,CAACJ,EAAE;QACzBS,KAAK,EAAEL,kBAAkB,CAACK;MAC5B,CAAC,CAAC;IACJ;EACF;EAEA,OAAON,iBAAiB;AAC1B;AAEA,SAASsB,qBAAqB,GAAU;EAAA,kCAANC,IAAI;IAAJA,IAAI;EAAA;EACpC,OAAOA,IAAI,CAACC,KAAK,CAAC,UAAAC,KAAK;IAAA,OAAIA,KAAK;EAAA,EAAC;AACnC"}
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,EA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