@blaze-cms/plugin-data-ui 0.146.0-node18-core-styles-tooltips.1 → 0.146.0-node18-core-styles-tooltips.3

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 (139) hide show
  1. package/lib-es/components/EntityDataListing/EntityDataListing.js +33 -0
  2. package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -0
  3. package/lib-es/components/EntityDataListing/index.js +3 -0
  4. package/lib-es/components/EntityDataListing/index.js.map +1 -0
  5. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +30 -0
  6. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
  7. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
  8. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
  9. package/lib-es/components/EntityManager/Entity/Entity.js +447 -0
  10. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -0
  11. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +103 -0
  12. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -0
  13. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +45 -0
  14. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -0
  15. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +3 -0
  16. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -0
  17. package/lib-es/components/EntityManager/Entity/EntityHeader/index.js +3 -0
  18. package/lib-es/components/EntityManager/Entity/EntityHeader/index.js.map +1 -0
  19. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +30 -0
  20. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
  21. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +29 -0
  22. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
  23. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +49 -0
  24. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
  25. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +117 -0
  26. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -0
  27. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +36 -0
  28. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
  29. package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js +5 -0
  30. package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -0
  31. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +46 -0
  32. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -0
  33. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js +32 -0
  34. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -0
  35. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js +5 -0
  36. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -0
  37. package/lib-es/components/EntityManager/Entity/actions-handlers/index.js +12 -0
  38. package/lib-es/components/EntityManager/Entity/actions-handlers/index.js.map +1 -0
  39. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js +5 -0
  40. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -0
  41. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js +39 -0
  42. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -0
  43. package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js +5 -0
  44. package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -0
  45. package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +53 -0
  46. package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -0
  47. package/lib-es/components/EntityManager/Entity/index.js +3 -0
  48. package/lib-es/components/EntityManager/Entity/index.js.map +1 -0
  49. package/lib-es/components/EntityManager/EntityManager.js +133 -0
  50. package/lib-es/components/EntityManager/EntityManager.js.map +1 -0
  51. package/lib-es/components/EntityManager/index.js +3 -0
  52. package/lib-es/components/EntityManager/index.js.map +1 -0
  53. package/lib-es/components/EntityManager/utils/RecordEditContext/index.js +6 -0
  54. package/lib-es/components/EntityManager/utils/RecordEditContext/index.js.map +1 -0
  55. package/lib-es/components/EntityManager/utils/data-mappers.js +55 -0
  56. package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -0
  57. package/lib-es/components/EntityManager/utils/entity.js +69 -0
  58. package/lib-es/components/EntityManager/utils/entity.js.map +1 -0
  59. package/lib-es/components/EntityManager/utils/entityAvailableActions.js +56 -0
  60. package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -0
  61. package/lib-es/components/EntityManager/utils/is-form-empty.js +9 -0
  62. package/lib-es/components/EntityManager/utils/is-form-empty.js.map +1 -0
  63. package/lib-es/components/EntityManager/utils/query.js +23 -0
  64. package/lib-es/components/EntityManager/utils/query.js.map +1 -0
  65. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
  66. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
  67. package/lib-es/components/InfoBoxes/InfoBoxes.js +28 -0
  68. package/lib-es/components/InfoBoxes/InfoBoxes.js.map +1 -0
  69. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +38 -0
  70. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
  71. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +28 -0
  72. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
  73. package/lib-es/components/InfoBoxes/hooks/useData.js +39 -0
  74. package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -0
  75. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +17 -0
  76. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
  77. package/lib-es/components/InfoBoxes/index.js +3 -0
  78. package/lib-es/components/InfoBoxes/index.js.map +1 -0
  79. package/lib-es/components/InfoBoxes/presentational/InfoBox.js +40 -0
  80. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
  81. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js +12 -0
  82. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -0
  83. package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js +30 -0
  84. package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -0
  85. package/lib-es/components/ListingTable/ListingTable.js +207 -0
  86. package/lib-es/components/ListingTable/ListingTable.js.map +1 -0
  87. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +57 -0
  88. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -0
  89. package/lib-es/components/ListingTable/ListingTableContent/index.js +3 -0
  90. package/lib-es/components/ListingTable/ListingTableContent/index.js.map +1 -0
  91. package/lib-es/components/ListingTable/TableActions/TableActions.js +34 -0
  92. package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -0
  93. package/lib-es/components/ListingTable/TableActions/index.js +3 -0
  94. package/lib-es/components/ListingTable/TableActions/index.js.map +1 -0
  95. package/lib-es/components/ListingTable/index.js +3 -0
  96. package/lib-es/components/ListingTable/index.js.map +1 -0
  97. package/lib-es/components/ListingTable/mappers/populate-rows.js +140 -0
  98. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -0
  99. package/lib-es/components/ListingTable/service/index.js +86 -0
  100. package/lib-es/components/ListingTable/service/index.js.map +1 -0
  101. package/lib-es/components/Tabs/index.js +40 -0
  102. package/lib-es/components/Tabs/index.js.map +1 -0
  103. package/lib-es/components/hooks/useCallbackDebounce.js +12 -0
  104. package/lib-es/components/hooks/useCallbackDebounce.js.map +1 -0
  105. package/lib-es/constants.js +39 -0
  106. package/lib-es/constants.js.map +1 -0
  107. package/lib-es/icons/ContentIcon.js +80 -0
  108. package/lib-es/icons/ContentIcon.js.map +1 -0
  109. package/lib-es/icons/SettingsIcon.js +36 -0
  110. package/lib-es/icons/SettingsIcon.js.map +1 -0
  111. package/lib-es/icons/TaxonomyIcon.js +60 -0
  112. package/lib-es/icons/TaxonomyIcon.js.map +1 -0
  113. package/lib-es/icons/UsersIcon.js +33 -0
  114. package/lib-es/icons/UsersIcon.js.map +1 -0
  115. package/lib-es/icons/index.js +6 -0
  116. package/lib-es/icons/index.js.map +1 -0
  117. package/lib-es/index.js +84 -0
  118. package/lib-es/index.js.map +1 -0
  119. package/lib-es/utils/add-content-menu-items.js +72 -0
  120. package/lib-es/utils/add-content-menu-items.js.map +1 -0
  121. package/lib-es/utils/build-create-entity-mutation.js +21 -0
  122. package/lib-es/utils/build-create-entity-mutation.js.map +1 -0
  123. package/lib-es/utils/build-delete-entity-mutation.js +18 -0
  124. package/lib-es/utils/build-delete-entity-mutation.js.map +1 -0
  125. package/lib-es/utils/build-listing-query.js +28 -0
  126. package/lib-es/utils/build-listing-query.js.map +1 -0
  127. package/lib-es/utils/build-update-data-query.js +24 -0
  128. package/lib-es/utils/build-update-data-query.js.map +1 -0
  129. package/lib-es/utils/build-update-publish-unpublish-mutation.js +22 -0
  130. package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -0
  131. package/lib-es/utils/get-default-query-params.js +17 -0
  132. package/lib-es/utils/get-default-query-params.js.map +1 -0
  133. package/lib-es/utils/hoc/withContext.js +8 -0
  134. package/lib-es/utils/hoc/withContext.js.map +1 -0
  135. package/lib-es/utils/hooks/useToggle.js +8 -0
  136. package/lib-es/utils/hooks/useToggle.js.map +1 -0
  137. package/lib-es/utils/index.js +3 -0
  138. package/lib-es/utils/index.js.map +1 -0
  139. package/package.json +10 -10
@@ -0,0 +1,12 @@
1
+ import createActions from './create';
2
+ import updateActions from './update';
3
+ import sharedActions from './shared';
4
+ import deleteActions from './delete';
5
+ const availableActions = {
6
+ create: createActions,
7
+ update: updateActions,
8
+ shared: sharedActions,
9
+ delete: deleteActions
10
+ };
11
+ export default availableActions;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["createActions","updateActions","sharedActions","deleteActions","availableActions","create","update","shared","delete"],"sources":["../../../../../src/components/EntityManager/Entity/actions-handlers/index.js"],"sourcesContent":["import createActions from './create';\nimport updateActions from './update';\nimport sharedActions from './shared';\nimport deleteActions from './delete';\n\nconst availableActions = {\n create: createActions,\n update: updateActions,\n shared: sharedActions,\n delete: deleteActions\n};\n\nexport default availableActions;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,UAAU;AACpC,OAAOC,aAAa,MAAM,UAAU;AACpC,OAAOC,aAAa,MAAM,UAAU;AACpC,OAAOC,aAAa,MAAM,UAAU;AAEpC,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAEL,aAAa;EACrBM,MAAM,EAAEL,aAAa;EACrBM,MAAM,EAAEL,aAAa;EACrBM,MAAM,EAAEL;AACV,CAAC;AAED,eAAeC,gBAAgB","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import { triggerPublish } from './publish';
2
+ export default {
3
+ triggerPublish
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["triggerPublish"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/shared/index.js"],"sourcesContent":["import { triggerPublish } from './publish';\n\nexport default { triggerPublish };\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,WAAW;AAE1C,eAAe;EAAEA;AAAe,CAAC","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ import { buildUpdatePublishUnpublishMutation } from '../../../../../utils';
2
+ import { SAVE_BEFORE_PUBLISH_MESSAGE } from '../../../../../constants';
3
+ const triggerPublish = async ({
4
+ entityData,
5
+ client,
6
+ setEntityIsPublish,
7
+ entitySchema,
8
+ textContent = '',
9
+ refetchRecord
10
+ }, addToast) => {
11
+ if (!Object.keys(entityData).length) {
12
+ addToast(SAVE_BEFORE_PUBLISH_MESSAGE, {
13
+ appearance: 'info',
14
+ autoDismiss: true
15
+ });
16
+ return;
17
+ }
18
+ const actionType = textContent.toLowerCase();
19
+ const entityIsPublishedSwitch = `${actionType}ed`;
20
+ const mutation = buildUpdatePublishUnpublishMutation(entitySchema, entityData.id, actionType);
21
+ try {
22
+ await client.mutate({
23
+ mutation
24
+ });
25
+ addToast(`${textContent}ed`, {
26
+ appearance: 'success',
27
+ autoDismiss: true
28
+ });
29
+ } catch (error) {
30
+ addToast(error.message, {
31
+ appearance: 'error',
32
+ autoDismiss: true
33
+ });
34
+ }
35
+ setEntityIsPublish(entityIsPublishedSwitch);
36
+ refetchRecord(true);
37
+ };
38
+ export { triggerPublish };
39
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.js","names":["buildUpdatePublishUnpublishMutation","SAVE_BEFORE_PUBLISH_MESSAGE","triggerPublish","entityData","client","setEntityIsPublish","entitySchema","textContent","refetchRecord","addToast","Object","keys","length","appearance","autoDismiss","actionType","toLowerCase","entityIsPublishedSwitch","mutation","id","mutate","error","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,SAASA,mCAAmC,QAAQ,sBAAsB;AAC1E,SAASC,2BAA2B,QAAQ,0BAA0B;AAEtE,MAAMC,cAAc,GAAG,MAAAA,CACrB;EAAEC,UAAU;EAAEC,MAAM;EAAEC,kBAAkB;EAAEC,YAAY;EAAEC,WAAW,GAAG,EAAE;EAAEC;AAAc,CAAC,EACzFC,QAAQ,KACL;EACH,IAAI,CAACC,MAAM,CAACC,IAAI,CAACR,UAAU,CAAC,CAACS,MAAM,EAAE;IACnCH,QAAQ,CAACR,2BAA2B,EAAE;MACpCY,UAAU,EAAE,MAAM;MAClBC,WAAW,EAAE;IACf,CAAC,CAAC;IACF;EACF;EACA,MAAMC,UAAU,GAAGR,WAAW,CAACS,WAAW,CAAC,CAAC;EAC5C,MAAMC,uBAAuB,GAAG,GAAGF,UAAU,IAAI;EACjD,MAAMG,QAAQ,GAAGlB,mCAAmC,CAACM,YAAY,EAAEH,UAAU,CAACgB,EAAE,EAAEJ,UAAU,CAAC;EAE7F,IAAI;IACF,MAAMX,MAAM,CAACgB,MAAM,CAAC;MAClBF;IACF,CAAC,CAAC;IACFT,QAAQ,CAAC,GAAGF,WAAW,IAAI,EAAE;MAC3BM,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOO,KAAK,EAAE;IACdZ,QAAQ,CAACY,KAAK,CAACC,OAAO,EAAE;MACtBT,UAAU,EAAE,OAAO;MACnBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ;EAEAT,kBAAkB,CAACY,uBAAuB,CAAC;EAC3CT,aAAa,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,SAASN,cAAc","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import { submit } from './submit';
2
+ export default {
3
+ submit
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["submit"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/update/index.js"],"sourcesContent":["import { submit } from './submit';\n\nexport default { submit };\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,UAAU;AAEjC,eAAe;EAAEA;AAAO,CAAC","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
3
+ 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; }
4
+ import buildUpdateDataQuery from '../../../../../utils/build-update-data-query';
5
+ import { ERROR, SUCCESS, SAVE_BUTTON_TEXTS } from '../../../../../constants';
6
+ const submit = async ({
7
+ entitySchema,
8
+ entityData,
9
+ parsedFormValues,
10
+ client,
11
+ setIsSaveButtonAvailable,
12
+ setSaveButtonText,
13
+ setNewUpdatedDate,
14
+ newUpdatedDate,
15
+ handleUpdateFormData
16
+ }, addToast) => {
17
+ const mutation = buildUpdateDataQuery(entitySchema);
18
+ try {
19
+ setIsSaveButtonAvailable(false);
20
+ setSaveButtonText(SAVE_BUTTON_TEXTS.saving);
21
+ const {
22
+ data
23
+ } = await client.mutate({
24
+ mutation,
25
+ variables: {
26
+ input: _objectSpread(_objectSpread({
27
+ id: entityData.id
28
+ }, parsedFormValues), {}, {
29
+ updated: newUpdatedDate || entityData.updated
30
+ })
31
+ }
32
+ });
33
+ setSaveButtonText(SAVE_BUTTON_TEXTS.saved);
34
+ const updatedDate = data && data.updateEntity && data.updateEntity.result && data.updateEntity.result.updated;
35
+ setNewUpdatedDate(updatedDate);
36
+ addToast('Updated', {
37
+ appearance: SUCCESS,
38
+ autoDismiss: true
39
+ });
40
+ handleUpdateFormData();
41
+ return SUCCESS;
42
+ } catch (error) {
43
+ setIsSaveButtonAvailable(true);
44
+ setSaveButtonText(SAVE_BUTTON_TEXTS.save);
45
+ addToast(error.message, {
46
+ appearance: ERROR,
47
+ autoDismiss: true
48
+ });
49
+ return ERROR;
50
+ }
51
+ };
52
+ export { submit };
53
+ //# sourceMappingURL=submit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.js","names":["buildUpdateDataQuery","ERROR","SUCCESS","SAVE_BUTTON_TEXTS","submit","entitySchema","entityData","parsedFormValues","client","setIsSaveButtonAvailable","setSaveButtonText","setNewUpdatedDate","newUpdatedDate","handleUpdateFormData","addToast","mutation","saving","data","mutate","variables","input","_objectSpread","id","updated","saved","updatedDate","updateEntity","result","appearance","autoDismiss","error","save","message"],"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,OAAOA,oBAAoB,MAAM,8CAA8C;AAC/E,SAASC,KAAK,EAAEC,OAAO,EAAEC,iBAAiB,QAAQ,0BAA0B;AAE5E,MAAMC,MAAM,GAAG,MAAAA,CACb;EACEC,YAAY;EACZC,UAAU;EACVC,gBAAgB;EAChBC,MAAM;EACNC,wBAAwB;EACxBC,iBAAiB;EACjBC,iBAAiB;EACjBC,cAAc;EACdC;AACF,CAAC,EACDC,QAAQ,KACL;EACH,MAAMC,QAAQ,GAAGf,oBAAoB,CAACK,YAAY,CAAC;EAEnD,IAAI;IACFI,wBAAwB,CAAC,KAAK,CAAC;IAC/BC,iBAAiB,CAACP,iBAAiB,CAACa,MAAM,CAAC;IAC3C,MAAM;MAAEC;IAAK,CAAC,GAAG,MAAMT,MAAM,CAACU,MAAM,CAAC;MACnCH,QAAQ;MACRI,SAAS,EAAE;QACTC,KAAK,EAAAC,aAAA,CAAAA,aAAA;UACHC,EAAE,EAAEhB,UAAU,CAACgB;QAAE,GACdf,gBAAgB;UACnBgB,OAAO,EAAEX,cAAc,IAAIN,UAAU,CAACiB;QAAO;MAEjD;IACF,CAAC,CAAC;IACFb,iBAAiB,CAACP,iBAAiB,CAACqB,KAAK,CAAC;IAC1C,MAAMC,WAAW,GACfR,IAAI,IAAIA,IAAI,CAACS,YAAY,IAAIT,IAAI,CAACS,YAAY,CAACC,MAAM,IAAIV,IAAI,CAACS,YAAY,CAACC,MAAM,CAACJ,OAAO;IAE3FZ,iBAAiB,CAACc,WAAW,CAAC;IAE9BX,QAAQ,CAAC,SAAS,EAAE;MAClBc,UAAU,EAAE1B,OAAO;MACnB2B,WAAW,EAAE;IACf,CAAC,CAAC;IACFhB,oBAAoB,CAAC,CAAC;IACtB,OAAOX,OAAO;EAChB,CAAC,CAAC,OAAO4B,KAAK,EAAE;IACdrB,wBAAwB,CAAC,IAAI,CAAC;IAC9BC,iBAAiB,CAACP,iBAAiB,CAAC4B,IAAI,CAAC;IACzCjB,QAAQ,CAACgB,KAAK,CAACE,OAAO,EAAE;MACtBJ,UAAU,EAAE3B,KAAK;MACjB4B,WAAW,EAAE;IACf,CAAC,CAAC;IACF,OAAO5B,KAAK;EACd;AACF,CAAC;AAED,SAASG,MAAM","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import Entity from './Entity';
2
+ export default Entity;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Entity"],"sources":["../../../../src/components/EntityManager/Entity/index.js"],"sourcesContent":["import Entity from './Entity';\n\nexport default Entity;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,UAAU;AAE7B,eAAeA,MAAM","ignoreList":[]}
@@ -0,0 +1,133 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
3
+ 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; }
4
+ import React, { useEffect, useState } from 'react';
5
+ import { withRouter } from 'react-router-dom';
6
+ import { useApolloClient } from '@apollo/client';
7
+ import PropTypes from 'prop-types';
8
+ import { useToasts } from '@blaze-react/toaster';
9
+ import entityAvailableActions from './utils/entityAvailableActions';
10
+ import Entity from './Entity';
11
+ import { getAction } from './utils/query';
12
+ import { ERROR, PAGE_NOT_FOUND } from '../../constants';
13
+ const EntityManager = ({
14
+ match,
15
+ history
16
+ }) => {
17
+ const [formData, setFormData] = useState(null);
18
+ const [entity, setEntity] = useState(null);
19
+ const [schema, setSchema] = useState({
20
+ id: null
21
+ });
22
+ const [previousQuery, setPreviousQuery] = useState(null);
23
+ const [shouldRefetch, setShouldRefetch] = useState(false);
24
+ const client = useApolloClient();
25
+ const {
26
+ addToast
27
+ } = useToasts();
28
+ const {
29
+ action,
30
+ entityIdentifier,
31
+ id = null,
32
+ onViewUrl
33
+ } = match.params;
34
+ useEffect(() => {
35
+ (async () => {
36
+ try {
37
+ const [entitySchema, data = {}, requestedQuery] = await entityAvailableActions[action]({
38
+ client,
39
+ identifier: entityIdentifier,
40
+ id
41
+ });
42
+ if (!data) {
43
+ addToast(PAGE_NOT_FOUND, {
44
+ appearance: ERROR,
45
+ autoDismiss: true
46
+ });
47
+ history.push(`/data-listing/${entityIdentifier}`);
48
+ }
49
+ let localData = data;
50
+ if (isPageBuilderTemplateSet(data)) {
51
+ const pageBuilderComponents = await getPageBuilderComponents({
52
+ entitySchema,
53
+ client,
54
+ id
55
+ });
56
+ localData = _objectSpread(_objectSpread({}, localData), {}, {
57
+ pageBuilder: pageBuilderComponents || localData.pageBuilder
58
+ });
59
+ }
60
+ setFormData({
61
+ values: localData
62
+ });
63
+ setEntity(data);
64
+ setSchema(entitySchema);
65
+ setPreviousQuery(requestedQuery);
66
+ setShouldRefetch(false);
67
+ } catch (error) {
68
+ addToast(error.message, {
69
+ appearance: ERROR,
70
+ autoDismiss: true
71
+ });
72
+ history.push(`/data-listing/${entityIdentifier}`);
73
+ }
74
+ })();
75
+ }, [action, addToast, client, entityIdentifier, history, history.push, id, schema, shouldRefetch]);
76
+ const updateFormData = (updatedFormData, shouldRefresh) => {
77
+ if (shouldRefresh) setShouldRefetch(true);
78
+ setFormData(updatedFormData);
79
+ };
80
+
81
+ // Reset when entity/record changes
82
+ if (!formData || !schema.id || recordHasChanged(entity, id, schema.id, entityIdentifier)) {
83
+ return null;
84
+ }
85
+ return /*#__PURE__*/React.createElement(Entity, {
86
+ action: match.params.action,
87
+ formData: formData,
88
+ updateFormData: updateFormData,
89
+ entity: entity,
90
+ schema: schema,
91
+ previousQuery: previousQuery,
92
+ onViewUrl: onViewUrl,
93
+ refetchRecord: setShouldRefetch
94
+ });
95
+ };
96
+ EntityManager.propTypes = {
97
+ match: PropTypes.shape({
98
+ params: PropTypes.shape({
99
+ action: PropTypes.string,
100
+ entityIdentifier: PropTypes.string,
101
+ id: PropTypes.string,
102
+ onViewUrl: PropTypes.func
103
+ })
104
+ }).isRequired,
105
+ history: PropTypes.object.isRequired
106
+ };
107
+ export default withRouter(EntityManager);
108
+ async function getPageBuilderComponents({
109
+ entitySchema,
110
+ client,
111
+ id
112
+ }) {
113
+ const actionName = entitySchema && entitySchema.actions.getAll || 'get';
114
+ const {
115
+ data: pageBuilderData = {}
116
+ } = await client.query({
117
+ query: getAction(actionName, 'pageBuilderComponents'),
118
+ variables: {
119
+ where: {
120
+ id
121
+ }
122
+ },
123
+ fetchPolicy: 'network-only'
124
+ });
125
+ return pageBuilderData[actionName] && pageBuilderData[actionName].length ? pageBuilderData[actionName][0].pageBuilderComponents : null;
126
+ }
127
+ function isPageBuilderTemplateSet(data) {
128
+ return data && data.pageBuilderTemplateId && data.pageBuilderTemplateId !== '';
129
+ }
130
+ function recordHasChanged(entity, id, currentEntityIdentifier, entityIdentifier) {
131
+ return entity && entity.id && entity.id !== id || currentEntityIdentifier && currentEntityIdentifier !== entityIdentifier;
132
+ }
133
+ //# sourceMappingURL=EntityManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityManager.js","names":["React","useEffect","useState","withRouter","useApolloClient","PropTypes","useToasts","entityAvailableActions","Entity","getAction","ERROR","PAGE_NOT_FOUND","EntityManager","match","history","formData","setFormData","entity","setEntity","schema","setSchema","id","previousQuery","setPreviousQuery","shouldRefetch","setShouldRefetch","client","addToast","action","entityIdentifier","onViewUrl","params","entitySchema","data","requestedQuery","identifier","appearance","autoDismiss","push","localData","isPageBuilderTemplateSet","pageBuilderComponents","getPageBuilderComponents","_objectSpread","pageBuilder","values","error","message","updateFormData","updatedFormData","shouldRefresh","recordHasChanged","createElement","refetchRecord","propTypes","shape","string","func","isRequired","object","actionName","actions","getAll","pageBuilderData","query","variables","where","fetchPolicy","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 { useToasts } from '@blaze-react/toaster';\nimport entityAvailableActions from './utils/entityAvailableActions';\nimport Entity from './Entity';\nimport { getAction } from './utils/query';\nimport { ERROR, PAGE_NOT_FOUND } from '../../constants';\n\nconst EntityManager = ({ match, history }) => {\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 const { addToast } = useToasts();\n\n const { action, entityIdentifier, id = null, onViewUrl } = match.params;\n\n useEffect(() => {\n (async () => {\n try {\n const [entitySchema, data = {}, requestedQuery] = await entityAvailableActions[action]({\n client,\n identifier: entityIdentifier,\n id\n });\n\n if (!data) {\n addToast(PAGE_NOT_FOUND, {\n appearance: ERROR,\n autoDismiss: true\n });\n\n history.push(`/data-listing/${entityIdentifier}`);\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 } catch (error) {\n addToast(error.message, {\n appearance: ERROR,\n autoDismiss: true\n });\n history.push(`/data-listing/${entityIdentifier}`);\n }\n })();\n }, [\n action,\n addToast,\n client,\n entityIdentifier,\n history,\n history.push,\n id,\n schema,\n 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 history: PropTypes.object.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,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,sBAAsB,MAAM,gCAAgC;AACnE,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,KAAK,EAAEC,cAAc,QAAQ,iBAAiB;AAEvD,MAAMC,aAAa,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAQ,CAAC,KAAK;EAC5C,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGd,QAAQ,CAAC,IAAI,CAAC;EAC9C,MAAM,CAACe,MAAM,EAAEC,SAAS,CAAC,GAAGhB,QAAQ,CAAC,IAAI,CAAC;EAC1C,MAAM,CAACiB,MAAM,EAAEC,SAAS,CAAC,GAAGlB,QAAQ,CAAC;IAAEmB,EAAE,EAAE;EAAK,CAAC,CAAC;EAClD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGrB,QAAQ,CAAC,IAAI,CAAC;EACxD,MAAM,CAACsB,aAAa,EAAEC,gBAAgB,CAAC,GAAGvB,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAMwB,MAAM,GAAGtB,eAAe,CAAC,CAAC;EAChC,MAAM;IAAEuB;EAAS,CAAC,GAAGrB,SAAS,CAAC,CAAC;EAEhC,MAAM;IAAEsB,MAAM;IAAEC,gBAAgB;IAAER,EAAE,GAAG,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;AAExC,eAAe8B,wBAAwBA,CAAC;EAAEV,YAAY;EAAEN,MAAM;EAAEL;AAAG,CAAC,EAAE;EACpE,MAAMuC,UAAU,GAAI5B,YAAY,IAAIA,YAAY,CAAC6B,OAAO,CAACC,MAAM,IAAK,KAAK;EACzE,MAAM;IAAE7B,IAAI,EAAE8B,eAAe,GAAG,CAAC;EAAE,CAAC,GAAG,MAAMrC,MAAM,CAACsC,KAAK,CAAC;IACxDA,KAAK,EAAEvD,SAAS,CAACmD,UAAU,EAAE,uBAAuB,CAAC;IACrDK,SAAS,EAAE;MACTC,KAAK,EAAE;QACL7C;MACF;IACF,CAAC;IACD8C,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,OAAOJ,eAAe,CAACH,UAAU,CAAC,IAAIG,eAAe,CAACH,UAAU,CAAC,CAACQ,MAAM,GACpEL,eAAe,CAACH,UAAU,CAAC,CAAC,CAAC,CAAC,CAACnB,qBAAqB,GACpD,IAAI;AACV;AAEA,SAASD,wBAAwBA,CAACP,IAAI,EAAE;EACtC,OAAOA,IAAI,IAAIA,IAAI,CAACoC,qBAAqB,IAAIpC,IAAI,CAACoC,qBAAqB,KAAK,EAAE;AAChF;AAEA,SAASlB,gBAAgBA,CAAClC,MAAM,EAAEI,EAAE,EAAEiD,uBAAuB,EAAEzC,gBAAgB,EAAE;EAC/E,OACGZ,MAAM,IAAIA,MAAM,CAACI,EAAE,IAAIJ,MAAM,CAACI,EAAE,KAAKA,EAAE,IACvCiD,uBAAuB,IAAIA,uBAAuB,KAAKzC,gBAAiB;AAE7E","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import EntityManager from './EntityManager';
2
+ export default EntityManager;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["EntityManager"],"sources":["../../../src/components/EntityManager/index.js"],"sourcesContent":["import EntityManager from './EntityManager';\n\nexport default EntityManager;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3C,eAAeA,aAAa","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ const RecordEditContext = React.createContext();
3
+ const RecordEditContextProvider = RecordEditContext.Provider;
4
+ const RecordEditContextConsumer = RecordEditContext.Consumer;
5
+ export { RecordEditContext, RecordEditContextProvider, RecordEditContextConsumer };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","RecordEditContext","createContext","RecordEditContextProvider","Provider","RecordEditContextConsumer","Consumer"],"sources":["../../../../../src/components/EntityManager/utils/RecordEditContext/index.js"],"sourcesContent":["import React from 'react';\n\nconst RecordEditContext = React.createContext();\nconst RecordEditContextProvider = RecordEditContext.Provider;\nconst RecordEditContextConsumer = RecordEditContext.Consumer;\n\nexport { RecordEditContext, RecordEditContextProvider, RecordEditContextConsumer };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,iBAAiB,GAAGD,KAAK,CAACE,aAAa,CAAC,CAAC;AAC/C,MAAMC,yBAAyB,GAAGF,iBAAiB,CAACG,QAAQ;AAC5D,MAAMC,yBAAyB,GAAGJ,iBAAiB,CAACK,QAAQ;AAE5D,SAASL,iBAAiB,EAAEE,yBAAyB,EAAEE,yBAAyB","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
3
+ 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; }
4
+ import { BlazeError } from '@blaze-cms/core-errors';
5
+ const getPageName = (displayProperties = {}, entity = {}) => {
6
+ if (!displayProperties || !displayProperties.adminHeader) {
7
+ const {
8
+ name,
9
+ id: fieldId
10
+ } = entity;
11
+ return name || fieldId || '';
12
+ }
13
+ const {
14
+ adminHeader
15
+ } = displayProperties;
16
+ return adminHeader.reduce((acc, headerProperty) => {
17
+ const item = entity[headerProperty];
18
+ if (item) acc.push(item);
19
+ return acc;
20
+ }, []).join(' ');
21
+ };
22
+ const createNewListItem = ({
23
+ listingData,
24
+ result
25
+ }) => [...listingData, result];
26
+ const updateListItems = ({
27
+ listingData,
28
+ result,
29
+ id
30
+ } = {}) => {
31
+ if (!listingData || !result || !id) throw new BlazeError('Expected object with: listingData, result, id');
32
+ return listingData.map(item => {
33
+ const mapperResult = _objectSpread({}, item);
34
+ if (item.id === id) {
35
+ Object.keys(item).forEach(key => {
36
+ if (result[key] && key !== 'id') {
37
+ mapperResult[key] = result[key];
38
+ }
39
+ });
40
+ return mapperResult;
41
+ }
42
+ return mapperResult;
43
+ });
44
+ };
45
+ const deleteFromListItems = ({
46
+ listingData,
47
+ id
48
+ } = {}) => {
49
+ if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');
50
+ return listingData.filter(({
51
+ id: itemId
52
+ }) => itemId !== id);
53
+ };
54
+ export { getPageName, createNewListItem, updateListItems, deleteFromListItems };
55
+ //# sourceMappingURL=data-mappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-mappers.js","names":["BlazeError","getPageName","displayProperties","entity","adminHeader","name","id","fieldId","reduce","acc","headerProperty","item","push","join","createNewListItem","listingData","result","updateListItems","map","mapperResult","_objectSpread","Object","keys","forEach","key","deleteFromListItems","filter","itemId"],"sources":["../../../../src/components/EntityManager/utils/data-mappers.js"],"sourcesContent":["import { BlazeError } from '@blaze-cms/core-errors';\n\nconst getPageName = (displayProperties = {}, entity = {}) => {\n if (!displayProperties || !displayProperties.adminHeader) {\n const { name, id: fieldId } = entity;\n return name || fieldId || '';\n }\n\n const { adminHeader } = displayProperties;\n return adminHeader\n .reduce((acc, headerProperty) => {\n const item = entity[headerProperty];\n if (item) acc.push(item);\n return acc;\n }, [])\n .join(' ');\n};\n\nconst createNewListItem = ({ listingData, result }) => [...listingData, result];\n\nconst updateListItems = ({ listingData, result, id } = {}) => {\n if (!listingData || !result || !id)\n throw new BlazeError('Expected object with: listingData, result, id');\n return listingData.map(item => {\n const mapperResult = { ...item };\n if (item.id === id) {\n Object.keys(item).forEach(key => {\n if (result[key] && key !== 'id') {\n mapperResult[key] = result[key];\n }\n });\n return mapperResult;\n }\n return mapperResult;\n });\n};\n\nconst deleteFromListItems = ({ listingData, id } = {}) => {\n if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');\n return listingData.filter(({ id: itemId }) => itemId !== id);\n};\n\nexport { getPageName, createNewListItem, updateListItems, deleteFromListItems };\n"],"mappings":";;;AAAA,SAASA,UAAU,QAAQ,wBAAwB;AAEnD,MAAMC,WAAW,GAAGA,CAACC,iBAAiB,GAAG,CAAC,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,KAAK;EAC3D,IAAI,CAACD,iBAAiB,IAAI,CAACA,iBAAiB,CAACE,WAAW,EAAE;IACxD,MAAM;MAAEC,IAAI;MAAEC,EAAE,EAAEC;IAAQ,CAAC,GAAGJ,MAAM;IACpC,OAAOE,IAAI,IAAIE,OAAO,IAAI,EAAE;EAC9B;EAEA,MAAM;IAAEH;EAAY,CAAC,GAAGF,iBAAiB;EACzC,OAAOE,WAAW,CACfI,MAAM,CAAC,CAACC,GAAG,EAAEC,cAAc,KAAK;IAC/B,MAAMC,IAAI,GAAGR,MAAM,CAACO,cAAc,CAAC;IACnC,IAAIC,IAAI,EAAEF,GAAG,CAACG,IAAI,CAACD,IAAI,CAAC;IACxB,OAAOF,GAAG;EACZ,CAAC,EAAE,EAAE,CAAC,CACLI,IAAI,C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/defineProperty";
2
+ 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; }
3
+ 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; }
4
+ import has from 'lodash.has';
5
+ import { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';
6
+ function canViewPage(formData, entity, schema, entityIsPublished) {
7
+ return has(formData, KEY_TO_CHECK) && entity && entity.id && schema && schema.id && entityIsPublished === ENTITY_PUBLISHED;
8
+ }
9
+ function validateSideBarRelations(updatedFormValues, requiredChildField) {
10
+ if (!requiredChildField) return true;
11
+ const parentEntityField = updatedFormValues.find(({
12
+ id
13
+ }) => id === 'parentEntity');
14
+ const parentIdField = updatedFormValues.find(({
15
+ id
16
+ }) => id === 'parentId');
17
+ const parentEntityFieldHasValue = parentEntityField && parentEntityField.value && parentEntityField.value !== SELECT_DEFAULT_VALUE;
18
+ const parentIdFieldHasValue = parentIdField && parentIdField.value;
19
+ return !!(!parentEntityFieldHasValue || parentEntityFieldHasValue && parentIdFieldHasValue);
20
+ }
21
+ async function onViewUrlClick(getFullUrl) {
22
+ const fullUrl = await getFullUrl();
23
+ if (fullUrl) {
24
+ const delimiter = fullUrl.includes('?') ? '&' : '?';
25
+ window.open(`${fullUrl}${delimiter}blaze_debug=1`, '_blank');
26
+ }
27
+ }
28
+ function getUpdatedFormValues({
29
+ id,
30
+ value,
31
+ requiredChildField,
32
+ formValues
33
+ }) {
34
+ const updatedFormValues = formValues ? formValues.slice() : [];
35
+ const fieldIndex = updatedFormValues.findIndex(({
36
+ id: _id
37
+ }) => _id === id);
38
+ if (fieldIndex > -1) {
39
+ updatedFormValues[fieldIndex] = _objectSpread(_objectSpread({}, updatedFormValues[fieldIndex]), {}, {
40
+ value
41
+ });
42
+ } else {
43
+ updatedFormValues.push({
44
+ id,
45
+ value
46
+ });
47
+ }
48
+ if (requiredChildField && requiredChildField.id) {
49
+ const requiredChildFieldIndex = updatedFormValues.findIndex(({
50
+ id: _id
51
+ }) => _id === requiredChildField.id);
52
+ if (requiredChildFieldIndex > -1) {
53
+ updatedFormValues[requiredChildFieldIndex] = _objectSpread(_objectSpread({}, updatedFormValues[requiredChildFieldIndex]), {}, {
54
+ value: requiredChildField.value
55
+ });
56
+ } else {
57
+ updatedFormValues.push({
58
+ id: requiredChildField.id,
59
+ value: requiredChildField.value
60
+ });
61
+ }
62
+ }
63
+ return updatedFormValues;
64
+ }
65
+ function checkFulfilConditions(...args) {
66
+ return args.every(param => param);
67
+ }
68
+ export { canViewPage, validateSideBarRelations, onViewUrlClick, getUpdatedFormValues, checkFulfilConditions };
69
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.js","names":["has","ENTITY_PUBLISHED","KEY_TO_CHECK","SELECT_DEFAULT_VALUE","canViewPage","formData","entity","schema","entityIsPublished","id","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","delimiter","includes","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","_objectSpread","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) {\n const delimiter = fullUrl.includes('?') ? '&' : '?';\n window.open(`${fullUrl}${delimiter}blaze_debug=1`, '_blank');\n }\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,OAAOA,GAAG,MAAM,YAAY;AAC5B,SAASC,gBA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C,WAAW,EACXM,wBAAwB,EACxBS,cAAc,EACdO,oBAAoB,EACpBS,qBAAqB","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ import { getQuery, getDynamicQuery } from '@blaze-cms/admin-ui-utils';
2
+ import { BlazeError } from '@blaze-cms/core-errors';
3
+ const entityAvailableActions = {
4
+ create: async ({
5
+ client,
6
+ identifier
7
+ } = {
8
+ client: null,
9
+ identifier: null
10
+ }) => {
11
+ if (!client && !identifier) {
12
+ throw new BlazeError('Expected params client or identifier not found');
13
+ }
14
+ const query = getQuery('GET_ENTITY_SCHEMA');
15
+ const {
16
+ data: {
17
+ getEntitySchemas: [schema]
18
+ }
19
+ } = await client.query({
20
+ query,
21
+ variables: {
22
+ identifier
23
+ }
24
+ });
25
+ return [schema];
26
+ },
27
+ update: async ({
28
+ client,
29
+ identifier,
30
+ id
31
+ } = {
32
+ client: null,
33
+ identifier: null,
34
+ id: null
35
+ }) => {
36
+ if (!client && !identifier && !id) {
37
+ throw new BlazeError('Expected params client, identifier or id not found');
38
+ }
39
+ const [schema] = await entityAvailableActions.create({
40
+ client,
41
+ identifier
42
+ });
43
+ const formDataQuery = getDynamicQuery('DATA_QUERY')(schema, id);
44
+ const {
45
+ data: {
46
+ entityData
47
+ }
48
+ } = await client.query({
49
+ query: formDataQuery,
50
+ fetchPolicy: 'network-only'
51
+ });
52
+ return [schema, entityData, formDataQuery];
53
+ }
54
+ };
55
+ export default entityAvailableActions;
56
+ //# sourceMappingURL=entityAvailableActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityAvailableActions.js","names":["getQuery","getDynamicQuery","BlazeError","entityAvailableActions","create","client","identifier","query","data","getEntitySchemas","schema","variables","update","id","formDataQuery","entityData","fetchPolicy"],"sources":["../../../../src/components/EntityManager/utils/entityAvailableActions.js"],"sourcesContent":["import { getQuery, getDynamicQuery } from '@blaze-cms/admin-ui-utils';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nconst entityAvailableActions = {\n create: async ({ client, identifier } = { client: null, identifier: null }) => {\n if (!client && !identifier) {\n throw new BlazeError('Expected params client or identifier not found');\n }\n const query = getQuery('GET_ENTITY_SCHEMA');\n const {\n data: {\n getEntitySchemas: [schema]\n }\n } = await client.query({ query, variables: { identifier } });\n return [schema];\n },\n update: async ({ client, identifier, id } = { client: null, identifier: null, id: null }) => {\n if (!client && !identifier && !id) {\n throw new BlazeError('Expected params client, identifier or id not found');\n }\n const [schema] = await entityAvailableActions.create({ client, identifier });\n const formDataQuery = getDynamicQuery('DATA_QUERY')(schema, id);\n const {\n data: { entityData }\n } = await client.query({ query: formDataQuery, fetchPolicy: 'network-only' });\n return [schema, entityData, formDataQuery];\n }\n};\n\nexport default entityAvailableActions;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,eAAe,QAAQ,2BAA2B;AACrE,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,MAAMC,sBAAsB,GAAG;EAC7BC,MAAM,EAAE,MAAAA,CAAO;IAAEC,MAAM;IAAEC;EAAW,CAAC,GAAG;IAAED,MAAM,EAAE,IAAI;IAAEC,UAAU,EAAE;EAAK,CAAC,KAAK;IAC7E,IAAI,CAACD,MAAM,IAAI,CAACC,UAAU,EAAE;MAC1B,MAAM,IAAIJ,UAAU,CAAC,gDAAgD,CAAC;IACxE;IACA,MAAMK,KAAK,GAAGP,QAAQ,CAAC,mBAAmB,CAAC;IAC3C,MAAM;MACJQ,IAAI,EAAE;QACJC,gBAAgB,EAAE,CAACC,MAAM;MAC3B;IACF,CAAC,GAAG,MAAML,MAAM,CAACE,KAAK,CAAC;MAAEA,KAAK;MAAEI,SAAS,EAAE;QAAEL;MAAW;IAAE,CAAC,CAAC;IAC5D,OAAO,CAACI,MAAM,CAAC;EACjB,CAAC;EACDE,MAAM,EAAE,MAAAA,CAAO;IAAEP,MAAM;IAAEC,UAAU;IAAEO;EAAG,CAAC,GAAG;IAAER,MAAM,EAAE,IAAI;IAAEC,UAAU,EAAE,IAAI;IAAEO,EAAE,EAAE;EAAK,CAAC,KAAK;IAC3F,IAAI,CAACR,MAAM,IAAI,CAACC,UAAU,IAAI,CAACO,EAAE,EAAE;MACjC,MAAM,IAAIX,UAAU,CAAC,oDAAoD,CAAC;IAC5E;IACA,MAAM,CAACQ,MAAM,CAAC,GAAG,MAAMP,sBAAsB,CAACC,MAAM,CAAC;MAAEC,MAAM;MAAEC;IAAW,CAAC,CAAC;IAC5E,MAAMQ,aAAa,GAAGb,eAAe,CAAC,YAAY,CAAC,CAACS,MAAM,EAAEG,EAAE,CAAC;IAC/D,MAAM;MACJL,IAAI,EAAE;QAAEO;MAAW;IACrB,CAAC,GAAG,MAAMV,MAAM,CAACE,KAAK,CAAC;MAAEA,KAAK,EAAEO,aAAa;MAAEE,WAAW,EAAE;IAAe,CAAC,CAAC;IAC7E,OAAO,CAACN,MAAM,EAAEK,UAAU,EAAED,aAAa,CAAC;EAC5C;AACF,CAAC;AAED,eAAeX,sBAAsB","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import isEmpty from 'lodash.isempty';
2
+ const isFormEmpty = formValues => {
3
+ if (!formValues) return false;
4
+ return !formValues.some(({
5
+ value
6
+ }) => typeof value === 'boolean' ? value : !isEmpty(value));
7
+ };
8
+ export default isFormEmpty;
9
+ //# sourceMappingURL=is-form-empty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-form-empty.js","names":["isEmpty","isFormEmpty","formValues","some","value"],"sources":["../../../../src/components/EntityManager/utils/is-form-empty.js"],"sourcesContent":["import isEmpty from 'lodash.isempty';\n\nconst isFormEmpty = formValues => {\n if (!formValues) return false;\n return !formValues.some(({ value }) => (typeof value === 'boolean' ? value : !isEmpty(value)));\n};\n\nexport default isFormEmpty;\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,gBAAgB;AAEpC,MAAMC,WAAW,GAAGC,UAAU,IAAI;EAChC,IAAI,CAACA,UAAU,EAAE,OAAO,KAAK;EAC7B,OAAO,CAACA,UAAU,CAACC,IAAI,CAAC,CAAC;IAAEC;EAAM,CAAC,KAAM,OAAOA,KAAK,KAAK,SAAS,GAAGA,KAAK,GAAG,CAACJ,OAAO,CAACI,KAAK,CAAE,CAAC;AAChG,CAAC;AAED,eAAeH,WAAW","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ import { gql } from '@apollo/client';
2
+ import upperFirst from 'lodash.upperfirst';
3
+ const generateQuery = (action, props) => `
4
+ query getEntityData(
5
+ $where: JSON
6
+ $limit: Int
7
+ $offset: Int
8
+ $sort: [${upperFirst(action)}SortItem]){
9
+ ${action} (where: $where, limit: $limit, offset: $offset, sort: $sort){
10
+ ${props}
11
+ }
12
+ }
13
+ `;
14
+
15
+ // TODO: extend function to handle properties and make them dynamic with a config schema for each entity.
16
+ const getAction = (action, props) => {
17
+ const query = generateQuery(action, props);
18
+ return gql`
19
+ ${query}
20
+ `;
21
+ };
22
+ export { getAction };
23
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","names":["gql","upperFirst","generateQuery","action","props","getAction","query"],"sources":["../../../../src/components/EntityManager/utils/query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport upperFirst from 'lodash.upperfirst';\n\nconst generateQuery = (action, props) => `\n query getEntityData(\n $where: JSON\n $limit: Int\n $offset: Int\n $sort: [${upperFirst(action)}SortItem]){\n ${action} (where: $where, limit: $limit, offset: $offset, sort: $sort){\n ${props}\n }\n }\n `;\n\n// TODO: extend function to handle properties and make them dynamic with a config schema for each entity.\nconst getAction = (action, props) => {\n const query = generateQuery(action, props);\n return gql`\n ${query}\n `;\n};\n\nexport { getAction };\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,OAAOC,UAAU,MAAM,mBAAmB;AAE1C,MAAMC,aAAa,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;AACzC;AACA;AACA;AACA;AACA,cAAcH,UAAU,CAACE,MAAM,CAAC;AAChC,MAAMA,MAAM;AACZ,QAAQC,KAAK;AACb;AACA;AACA,GAAG;;AAEH;AACA,MAAMC,SAAS,GAAGA,CAACF,MAAM,EAAEC,KAAK,KAAK;EACnC,MAAME,KAAK,GAAGJ,aAAa,CAACC,MAAM,EAAEC,KAAK,CAAC;EAC1C,OAAOJ,GAAG;AACZ,MAAMM,KAAK;AACX,GAAG;AACH,CAAC;AAED,SAASD,SAAS","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ const _excluded = ["info"];
4
+ import React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import Tooltip from '@blaze-react/tooltip';
7
+ const InfoBoxTooltip = _ref => {
8
+ let {
9
+ info
10
+ } = _ref,
11
+ tooltipProps = _objectWithoutProperties(_ref, _excluded);
12
+ const {
13
+ tooltipContent,
14
+ tooltipIcon
15
+ } = info;
16
+ if (!tooltipContent) return null;
17
+ const renderTooltipIcon = icon => {
18
+ if (!icon) return null;
19
+ return /*#__PURE__*/React.createElement("i", {
20
+ className: `${icon} info-box--icon`
21
+ });
22
+ };
23
+ return /*#__PURE__*/React.createElement(Tooltip, _extends({
24
+ tooltipContent: tooltipContent,
25
+ trigger: "click",
26
+ className: "info-box--tooltip"
27
+ }, tooltipProps), renderTooltipIcon(tooltipIcon));
28
+ };
29
+ InfoBoxTooltip.propTypes = {
30
+ info: PropTypes.shape({
31
+ tooltipContent: PropTypes.node,
32
+ tooltipIcon: PropTypes.string
33
+ }).isRequired
34
+ };
35
+ export default InfoBoxTooltip;
36
+ //# sourceMappingURL=InfoBoxTooltip.js.map