@blaze-cms/plugin-data-ui 0.146.0-translations.8 → 0.147.0-rc-eagle.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 (205) hide show
  1. package/lib/components/EntityDataListing/EntityDataListing.js +21 -19
  2. package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
  3. package/lib/components/EntityDataListing/index.js +2 -3
  4. package/lib/components/EntityDataListing/index.js.map +1 -1
  5. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +18 -19
  6. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
  7. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +2 -3
  8. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
  9. package/lib/components/EntityManager/Entity/Entity.js +286 -458
  10. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  11. package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +62 -66
  12. package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  13. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +32 -56
  14. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  15. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -3
  16. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
  17. package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -3
  18. package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
  19. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +20 -26
  20. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
  21. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +20 -17
  22. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  23. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +34 -32
  24. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
  25. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +95 -158
  26. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  27. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +23 -30
  28. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
  29. package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -3
  30. package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
  31. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +42 -56
  32. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  33. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +29 -45
  34. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  35. package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +2 -3
  36. package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
  37. package/lib/components/EntityManager/Entity/actions-handlers/index.js +7 -8
  38. package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
  39. package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +2 -3
  40. package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
  41. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +36 -57
  42. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  43. package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +2 -3
  44. package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
  45. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +47 -66
  46. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  47. package/lib/components/EntityManager/Entity/index.js +2 -3
  48. package/lib/components/EntityManager/Entity/index.js.map +1 -1
  49. package/lib/components/EntityManager/EntityManager.js +91 -166
  50. package/lib/components/EntityManager/EntityManager.js.map +1 -1
  51. package/lib/components/EntityManager/index.js +2 -3
  52. package/lib/components/EntityManager/index.js.map +1 -1
  53. package/lib/components/EntityManager/utils/RecordEditContext/index.js +3 -4
  54. package/lib/components/EntityManager/utils/RecordEditContext/index.js.map +1 -1
  55. package/lib/components/EntityManager/utils/data-mappers.js +34 -46
  56. package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
  57. package/lib/components/EntityManager/utils/entity.js +35 -80
  58. package/lib/components/EntityManager/utils/entity.js.map +1 -1
  59. package/lib/components/EntityManager/utils/entityAvailableActions.js +51 -110
  60. package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  61. package/lib/components/EntityManager/utils/is-form-empty.js +6 -10
  62. package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
  63. package/lib/components/EntityManager/utils/query.js +17 -10
  64. package/lib/components/EntityManager/utils/query.js.map +1 -1
  65. package/lib/components/InfoBoxes/InfoBoxTooltip.js +19 -16
  66. package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
  67. package/lib/components/InfoBoxes/InfoBoxes.js +19 -19
  68. package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
  69. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +26 -38
  70. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
  71. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +21 -16
  72. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  73. package/lib/components/InfoBoxes/hooks/useData.js +33 -30
  74. package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
  75. package/lib/components/InfoBoxes/hooks/useInfoBox.js +10 -10
  76. package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -1
  77. package/lib/components/InfoBoxes/index.js +2 -3
  78. package/lib/components/InfoBoxes/index.js.map +1 -1
  79. package/lib/components/InfoBoxes/presentational/InfoBox.js +27 -34
  80. package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  81. package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js +11 -12
  82. package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
  83. package/lib/components/InfoBoxes/presentational/InfoBoxValue.js +12 -12
  84. package/lib/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
  85. package/lib/components/ListingTable/ListingTable.js +155 -296
  86. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  87. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +53 -58
  88. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  89. package/lib/components/ListingTable/ListingTableContent/index.js +2 -3
  90. package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
  91. package/lib/components/ListingTable/SearchFilter/SearchContainer.js +159 -257
  92. package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
  93. package/lib/components/ListingTable/SearchFilter/SearchFilter.js +25 -36
  94. package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
  95. package/lib/components/ListingTable/SearchFilter/helpers.js +46 -68
  96. package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
  97. package/lib/components/ListingTable/SearchFilter/querys.js +5 -5
  98. package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -1
  99. package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
  100. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  101. package/lib/components/ListingTable/TableActions/index.js +2 -3
  102. package/lib/components/ListingTable/TableActions/index.js.map +1 -1
  103. package/lib/components/ListingTable/index.js +2 -3
  104. package/lib/components/ListingTable/index.js.map +1 -1
  105. package/lib/components/ListingTable/mappers/populate-rows.js +103 -122
  106. package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
  107. package/lib/components/ListingTable/service/index.js +66 -83
  108. package/lib/components/ListingTable/service/index.js.map +1 -1
  109. package/lib/components/Tabs/index.js +26 -42
  110. package/lib/components/Tabs/index.js.map +1 -1
  111. package/lib/components/hooks/useCallbackDebounce.js +5 -9
  112. package/lib/components/hooks/useCallbackDebounce.js.map +1 -1
  113. package/lib/constants.js +30 -31
  114. package/lib/constants.js.map +1 -1
  115. package/lib/icons/ContentIcon.js +17 -20
  116. package/lib/icons/ContentIcon.js.map +1 -1
  117. package/lib/icons/SettingsIcon.js +12 -15
  118. package/lib/icons/SettingsIcon.js.map +1 -1
  119. package/lib/icons/TaxonomyIcon.js +15 -18
  120. package/lib/icons/TaxonomyIcon.js.map +1 -1
  121. package/lib/icons/UsersIcon.js +11 -14
  122. package/lib/icons/UsersIcon.js.map +1 -1
  123. package/lib/icons/index.js +8 -9
  124. package/lib/icons/index.js.map +1 -1
  125. package/lib/index.js +81 -121
  126. package/lib/index.js.map +1 -1
  127. package/lib/utils/add-content-menu-items.js +67 -93
  128. package/lib/utils/add-content-menu-items.js.map +1 -1
  129. package/lib/utils/build-create-entity-mutation.js +12 -9
  130. package/lib/utils/build-create-entity-mutation.js.map +1 -1
  131. package/lib/utils/build-delete-entity-mutation.js +11 -8
  132. package/lib/utils/build-delete-entity-mutation.js.map +1 -1
  133. package/lib/utils/build-listing-query.js +17 -14
  134. package/lib/utils/build-listing-query.js.map +1 -1
  135. package/lib/utils/build-update-data-query.js +15 -9
  136. package/lib/utils/build-update-data-query.js.map +1 -1
  137. package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
  138. package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  139. package/lib/utils/get-default-query-params.js +7 -6
  140. package/lib/utils/get-default-query-params.js.map +1 -1
  141. package/lib/utils/hoc/withContext.js +4 -6
  142. package/lib/utils/hoc/withContext.js.map +1 -1
  143. package/lib/utils/hooks/useToggle.js +4 -12
  144. package/lib/utils/hooks/useToggle.js.map +1 -1
  145. package/lib/utils/index.js +2 -3
  146. package/lib/utils/index.js.map +1 -1
  147. package/lib-es/components/EntityManager/Entity/Entity.js +15 -26
  148. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  149. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  150. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  151. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  152. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
  153. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +6 -3
  154. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  155. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
  156. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  157. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  158. package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
  159. package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
  160. package/lib-es/components/EntityManager/utils/query.js.map +1 -1
  161. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
  162. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
  163. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  164. package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
  165. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  166. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
  167. package/lib-es/components/ListingTable/ListingTable.js +2 -2
  168. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  169. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +20 -17
  170. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  171. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
  172. package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -1
  173. package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -1
  174. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  175. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  176. package/lib-es/components/Tabs/index.js +6 -7
  177. package/lib-es/components/Tabs/index.js.map +1 -1
  178. package/lib-es/index.js +11 -3
  179. package/lib-es/index.js.map +1 -1
  180. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  181. package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
  182. package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
  183. package/lib-es/utils/build-listing-query.js.map +1 -1
  184. package/lib-es/utils/build-update-data-query.js.map +1 -1
  185. package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  186. package/lib-es/utils/hoc/withContext.js +1 -1
  187. package/lib-es/utils/hoc/withContext.js.map +1 -1
  188. package/package.json +27 -22
  189. package/src/components/EntityManager/Entity/Entity.js +63 -81
  190. package/src/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
  191. package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +9 -7
  192. package/src/components/EntityManager/Entity/SideBarRelations/index.js +64 -59
  193. package/src/components/EntityManager/EntityManager.js +52 -45
  194. package/src/components/InfoBoxes/container/InfoBoxContainer.js +3 -6
  195. package/src/components/InfoBoxes/hooks/useData.js +6 -1
  196. package/src/components/ListingTable/ListingTable.js +13 -21
  197. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +38 -44
  198. package/src/components/ListingTable/SearchFilter/SearchContainer.js +105 -120
  199. package/src/components/ListingTable/service/index.js +2 -3
  200. package/src/components/Tabs/index.js +17 -21
  201. package/src/index.js +9 -7
  202. package/src/utils/hoc/withContext.js +5 -4
  203. package/CHANGELOG.md +0 -1947
  204. package/babel.config.js +0 -3
  205. package/jest.config.js +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"build-delete-entity-mutation.js","names":["gql","BlazeError","upperfirst","buildDeleteEntity","entitySchema","actions","delete","actionInput"],"sources":["../../src/utils/build-delete-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\n\nfunction buildDeleteEntity(entitySchema) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {\n throw new BlazeError('Delete query requires delete action from entity schema');\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.delete}Input`);\n\n return gql`\n mutation deleteEntity($input: ${actionInput}) {\n deleteEntity: ${entitySchema.actions.delete}(input: $input){\n result\n }\n }\n `;\n}\n\nexport default buildDeleteEntity;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAE1C,SAASC,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,EAAE;IAC1E,MAAM,IAAIL,UAAU,CAAC,wDAAwD,CAAC;EAChF;EAEA,MAAMM,WAAW,GAAGL,UAAU,CAAE,GAAEE,YAAY,CAACC,OAAO,CAACC,MAAO,OAAM,CAAC;EAErE,OAAON,GAAI;AACb,mCAAmCO,WAAY;AAC/C,oBAAoBH,YAAY,CAACC,OAAO,CAACC,MAAO;AAChD;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeH,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"build-delete-entity-mutation.js","names":["gql","BlazeError","upperfirst","buildDeleteEntity","entitySchema","actions","delete","actionInput"],"sources":["../../src/utils/build-delete-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\n\nfunction buildDeleteEntity(entitySchema) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {\n throw new BlazeError('Delete query requires delete action from entity schema');\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.delete}Input`);\n\n return gql`\n mutation deleteEntity($input: ${actionInput}) {\n deleteEntity: ${entitySchema.actions.delete}(input: $input){\n result\n }\n }\n `;\n}\n\nexport default buildDeleteEntity;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAE1C,SAASC,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,EAAE;IAC1E,MAAM,IAAIL,UAAU,CAAC,wDAAwD,CAAC;EAChF;EAEA,MAAMM,WAAW,GAAGL,UAAU,CAAC,GAAGE,YAAY,CAACC,OAAO,CAACC,MAAM,OAAO,CAAC;EAErE,OAAON,GAAG;AACZ,mCAAmCO,WAAW;AAC9C,oBAAoBH,YAAY,CAACC,OAAO,CAACC,MAAM;AAC/C;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeH,iBAAiB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","getDynamicQuery","buildAdminSearchQuery","entitySchema","index","listingProperties","parsedProperties","join","buildListingQuery","isSearchQuery","actions","getAll","sortType","toUpperCase","substr","countAll"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport { getDynamicQuery } from '@blaze-cms/admin-ui-utils';\n\nconst buildAdminSearchQuery = (entitySchema, index) => {\n const { listingProperties = [] } = entitySchema || {};\n const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;\n\n return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true, index);\n};\n\nfunction buildListingQuery(entitySchema, index, isSearchQuery) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n if (isSearchQuery) return buildAdminSearchQuery(entitySchema, index);\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${\n entitySchema.actions.getAll\n }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${\n entitySchema.actions.getAll\n }(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n totalRecords: ${entitySchema.actions.countAll}(where: $where)\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,eAAe,QAAQ,2BAA2B;AAE3D,MAAMC,qBAAqB,GAAGA,CAACC,YAAY,EAAEC,KAAK,KAAK;EACrD,MAAM;IAAEC,iBAAiB,GAAG;EAAG,CAAC,GAAGF,YAAY,IAAI,CAAC,CAAC;EACrD,MAAMG,gBAAgB,GAAI,OAAMD,iBAAiB,CAACE,IAAI,CAAC,GAAG,CAAC,IAAI,SAAU,EAAC;EAE1E,OAAON,eAAe,CAAC,cAAc,CAAC,CAAC,CAACE,YAAY,CAAC,EAAEG,gBAAgB,EAAE,IAAI,EAAEF,KAAK,CAAC;AACvF,CAAC;AAED,SAASI,iBAAiBA,CAACL,YAAY,EAAEC,KAAK,EAAEK,aAAa,EAAE;EAC7D,IAAI,CAACN,YAAY,CAACO,OAAO,IAAI,CAACP,YAAY,CAACO,OAAO,CAACC,MAAM,IAAI,CAACR,YAAY,CAACE,iBAAiB,EAAE;IAC5F,MAAM,IAAIL,UAAU,CAClB,+EACF,CAAC;EACH;EAEA,IAAIS,aAAa,EAAE,OAAOP,qBAAqB,CAACC,YAAY,EAAEC,KAAK,CAAC;EAEpE,MAAMQ,QAAQ,GACZT,YAAY,CAACO,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,GAAGV,YAAY,CAACO,OAAO,CAACC,MAAM,CAACG,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAOf,GAAI;AACb,YACMI,YAAY,CAACO,OAAO,CAACC,MACtB,oDAAmDC,QAAS;AACjE,qBACQT,YAAY,CAACO,OAAO,CAACC,MACtB;AACP;AACA,UAAUR,YAAY,CAACE,iBAAiB,CAACE,IAAI,CAAC,KAAK,CAAE;AACrD;AACA,sBAAsBJ,YAAY,CAACO,OAAO,CAACK,QAAS;AACpD;AACA,GAAG;AACH;AAEA,eAAeP,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","getDynamicQuery","buildAdminSearchQuery","entitySchema","index","listingProperties","parsedProperties","join","buildListingQuery","isSearchQuery","actions","getAll","sortType","toUpperCase","substr","countAll"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport { getDynamicQuery } from '@blaze-cms/admin-ui-utils';\n\nconst buildAdminSearchQuery = (entitySchema, index) => {\n const { listingProperties = [] } = entitySchema || {};\n const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;\n\n return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true, index);\n};\n\nfunction buildListingQuery(entitySchema, index, isSearchQuery) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n if (isSearchQuery) return buildAdminSearchQuery(entitySchema, index);\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${\n entitySchema.actions.getAll\n }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${\n entitySchema.actions.getAll\n }(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n totalRecords: ${entitySchema.actions.countAll}(where: $where)\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,eAAe,QAAQ,2BAA2B;AAE3D,MAAMC,qBAAqB,GAAGA,CAACC,YAAY,EAAEC,KAAK,KAAK;EACrD,MAAM;IAAEC,iBAAiB,GAAG;EAAG,CAAC,GAAGF,YAAY,IAAI,CAAC,CAAC;EACrD,MAAMG,gBAAgB,GAAG,OAAOD,iBAAiB,CAACE,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,EAAE;EAE1E,OAAON,eAAe,CAAC,cAAc,CAAC,CAAC,CAACE,YAAY,CAAC,EAAEG,gBAAgB,EAAE,IAAI,EAAEF,KAAK,CAAC;AACvF,CAAC;AAED,SAASI,iBAAiBA,CAACL,YAAY,EAAEC,KAAK,EAAEK,aAAa,EAAE;EAC7D,IAAI,CAACN,YAAY,CAACO,OAAO,IAAI,CAACP,YAAY,CAACO,OAAO,CAACC,MAAM,IAAI,CAACR,YAAY,CAACE,iBAAiB,EAAE;IAC5F,MAAM,IAAIL,UAAU,CAClB,+EACF,CAAC;EACH;EAEA,IAAIS,aAAa,EAAE,OAAOP,qBAAqB,CAACC,YAAY,EAAEC,KAAK,CAAC;EAEpE,MAAMQ,QAAQ,GACZT,YAAY,CAACO,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,GAAGV,YAAY,CAACO,OAAO,CAACC,MAAM,CAACG,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAOf,GAAG;AACZ,YACMI,YAAY,CAACO,OAAO,CAACC,MAAM,oDACuBC,QAAQ;AAChE,qBACQT,YAAY,CAACO,OAAO,CAACC,MAAM;AACnC;AACA,UACUR,YAAY,CAACE,iBAAiB,CAACE,IAAI,CAAC,KAAK,CAAC;AACpD;AACA,sBAAsBJ,YAAY,CAACO,OAAO,CAACK,QAAQ;AACnD;AACA,GAAG;AACH;AAEA,eAAeP,iBAAiB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"build-update-data-query.js","names":["gql","BlazeError","upperfirst","getDataProperties","buildUpdateDataQuery","entitySchema","actions","update","properties","actionInput","dataProperties","join"],"sources":["../../src/utils/build-update-data-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildUpdateDataQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.update || !entitySchema.properties) {\n throw new BlazeError(\n 'Update DataEntity query requires get action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.update}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`\n mutation updateEntity($input: ${actionInput}) {\n updateEntity: ${entitySchema.actions.update}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')},\n updated\n }\n }\n }\n `;\n}\n\nexport default buildUpdateDataQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,oBAAoBA,CAACC,YAAY,EAAE;EAC1C,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,UAAU,EAAE;IACrF,MAAM,IAAIP,UAAU,CAClB,+EACF,CAAC;EACH;EAEA,MAAMQ,WAAW,GAAGP,UAAU,CAAE,GAAEG,YAAY,CAACC,OAAO,CAACC,MAAO,OAAM,CAAC;EACrE,MAAMG,cAAc,GAAGP,iBAAiB,CAACE,YAAY,CAAC;EAEtD,OAAOL,GAAI;AACb,mCAAmCS,WAAY;AAC/C,oBAAoBJ,YAAY,CAACC,OAAO,CAACC,MAAO;AAChD;AACA;AACA,YAAYG,cAAc,CAACC,IAAI,CAAC,KAAK,CAAE;AACvC;AACA;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeP,oBAAoB","ignoreList":[]}
1
+ {"version":3,"file":"build-update-data-query.js","names":["gql","BlazeError","upperfirst","getDataProperties","buildUpdateDataQuery","entitySchema","actions","update","properties","actionInput","dataProperties","join"],"sources":["../../src/utils/build-update-data-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildUpdateDataQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.update || !entitySchema.properties) {\n throw new BlazeError(\n 'Update DataEntity query requires get action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.update}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`\n mutation updateEntity($input: ${actionInput}) {\n updateEntity: ${entitySchema.actions.update}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')},\n updated\n }\n }\n }\n `;\n}\n\nexport default buildUpdateDataQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,oBAAoBA,CAACC,YAAY,EAAE;EAC1C,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,UAAU,EAAE;IACrF,MAAM,IAAIP,UAAU,CAClB,+EACF,CAAC;EACH;EAEA,MAAMQ,WAAW,GAAGP,UAAU,CAAC,GAAGG,YAAY,CAACC,OAAO,CAACC,MAAM,OAAO,CAAC;EACrE,MAAMG,cAAc,GAAGP,iBAAiB,CAACE,YAAY,CAAC;EAEtD,OAAOL,GAAG;AACZ,mCAAmCS,WAAW;AAC9C,oBAAoBJ,YAAY,CAACC,OAAO,CAACC,MAAM;AAC/C;AACA;AACA,YAAYG,cAAc,CAACC,IAAI,CAAC,KAAK,CAAC;AACtC;AACA;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeP,oBAAoB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"build-update-publish-unpublish-mutation.js","names":["gql","BlazeError","buildUpdatePublishUnpublishMutation","entitySchema","id","action","cache","actions","publish","withClient"],"sources":["../../src/utils/build-update-publish-unpublish-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildUpdatePublishUnpublishMutation(entitySchema, id, action, cache) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.publish || !id || !action) {\n throw new BlazeError(\n 'Update DataEntity query requires publish action from entity schema and id'\n );\n }\n\n const withClient = `${cache ? '@client' : ''}`;\n\n return gql`\n mutation {\n response: ${entitySchema.actions[action]} ${withClient}(input: {\n id: \"${id}\"\n }){\n result {\n id,\n status\n }\n }\n }\n `;\n}\n\nexport default buildUpdatePublishUnpublishMutation;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,mCAAmCA,CAACC,YAAY,EAAEC,EAAE,EAAEC,MAAM,EAAEC,KAAK,EAAE;EAC5E,IAAI,CAACH,YAAY,IAAI,CAACA,YAAY,CAACI,OAAO,IAAI,CAACJ,YAAY,CAACI,OAAO,CAACC,OAAO,IAAI,CAACJ,EAAE,IAAI,CAACC,MAAM,EAAE;IAC7F,MAAM,IAAIJ,UAAU,CAClB,2EACF,CAAC;EACH;EAEA,MAAMQ,UAAU,GAAI,GAAEH,KAAK,GAAG,SAAS,GAAG,EAAG,EAAC;EAE9C,OAAON,GAAI;AACb;AACA,kBAAkBG,YAAY,CAACI,OAAO,CAACF,MAAM,CAAE,IAAGI,UAAW;AAC7D,eAAeL,EAAG;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeF,mCAAmC","ignoreList":[]}
1
+ {"version":3,"file":"build-update-publish-unpublish-mutation.js","names":["gql","BlazeError","buildUpdatePublishUnpublishMutation","entitySchema","id","action","cache","actions","publish","withClient"],"sources":["../../src/utils/build-update-publish-unpublish-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildUpdatePublishUnpublishMutation(entitySchema, id, action, cache) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.publish || !id || !action) {\n throw new BlazeError(\n 'Update DataEntity query requires publish action from entity schema and id'\n );\n }\n\n const withClient = `${cache ? '@client' : ''}`;\n\n return gql`\n mutation {\n response: ${entitySchema.actions[action]} ${withClient}(input: {\n id: \"${id}\"\n }){\n result {\n id,\n status\n }\n }\n }\n `;\n}\n\nexport default buildUpdatePublishUnpublishMutation;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,mCAAmCA,CAACC,YAAY,EAAEC,EAAE,EAAEC,MAAM,EAAEC,KAAK,EAAE;EAC5E,IAAI,CAACH,YAAY,IAAI,CAACA,YAAY,CAACI,OAAO,IAAI,CAACJ,YAAY,CAACI,OAAO,CAACC,OAAO,IAAI,CAACJ,EAAE,IAAI,CAACC,MAAM,EAAE;IAC7F,MAAM,IAAIJ,UAAU,CAClB,2EACF,CAAC;EACH;EAEA,MAAMQ,UAAU,GAAG,GAAGH,KAAK,GAAG,SAAS,GAAG,EAAE,EAAE;EAE9C,OAAON,GAAG;AACZ;AACA,kBAAkBG,YAAY,CAACI,OAAO,CAACF,MAAM,CAAC,IAAII,UAAU;AAC5D,eAAeL,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeF,mCAAmC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';
4
- export const withContext = Component => props => {
4
+ export const withContext = Component => function (props) {
5
5
  const contexts = useMainContext(MainContext);
6
6
  return /*#__PURE__*/React.createElement(Component, _extends({}, props, contexts));
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"withContext.js","names":["React","useMainContext","MainContext","withContext","Component","props","contexts","createElement","_extends"],"sources":["../../../src/utils/hoc/withContext.js"],"sourcesContent":["import React from 'react';\nimport { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';\n\nexport const withContext = Component => props => {\n const contexts = useMainContext(MainContext);\n return <Component {...props} {...contexts} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,WAAW,QAAQ,2BAA2B;AAEvE,OAAO,MAAMC,WAAW,GAAGC,SAAS,IAAIC,KAAK,IAAI;EAC/C,MAAMC,QAAQ,GAAGL,cAAc,CAACC,WAAW,CAAC;EAC5C,oBAAOF,KAAA,CAAAO,aAAA,CAACH,SAAS,EAAAI,QAAA,KAAKH,KAAK,EAAMC,QAAQ,CAAG,CAAC;AAC/C,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"withContext.js","names":["React","useMainContext","MainContext","withContext","Component","props","contexts","createElement","_extends"],"sources":["../../../src/utils/hoc/withContext.js"],"sourcesContent":["import React from 'react';\nimport { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';\n\nexport const withContext = Component =>\n function (props) {\n const contexts = useMainContext(MainContext);\n return <Component {...props} {...contexts} />;\n };\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,WAAW,QAAQ,2BAA2B;AAEvE,OAAO,MAAMC,WAAW,GAAGC,SAAS,IAClC,UAAUC,KAAK,EAAE;EACf,MAAMC,QAAQ,GAAGL,cAAc,CAACC,WAAW,CAAC;EAC5C,oBAAOF,KAAA,CAAAO,aAAA,CAACH,SAAS,EAAAI,QAAA,KAAKH,KAAK,EAAMC,QAAQ,CAAG,CAAC;AAC/C,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,24 +1,29 @@
1
1
  {
2
2
  "name": "@blaze-cms/plugin-data-ui",
3
- "version": "0.146.0-translations.8",
3
+ "version": "0.147.0-rc-eagle.2",
4
4
  "description": "Blaze plugin data ui",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
7
- "sideEffects": false,
7
+ "files": [
8
+ "lib",
9
+ "lib-es",
10
+ "src"
11
+ ],
12
+ "source": "src/index.js",
8
13
  "directories": {
9
14
  "src": "src/"
10
15
  },
11
16
  "scripts": {
12
17
  "test": "jest",
13
- "lint": "yarn run lint:js",
18
+ "lint": "npm run lint:js",
14
19
  "lint:js": "eslint .",
15
20
  "clean": "rm -Rf ./lib/ && rm -Rf ./lib-es/",
16
21
  "build:cjs": "BABEL_ENV=cjs ../../node_modules/.bin/babel ./src --out-dir ./lib --source-maps --root-mode upward",
17
22
  "build:esm": "BABEL_ENV=esm ../../node_modules/.bin/babel ./src --out-dir ./lib-es --source-maps --root-mode upward",
18
- "build": "yarn run build:cjs && yarn run build:esm",
19
- "build:clean": "yarn run clean && yarn run build",
20
- "prepublishOnly": "yarn run build:clean",
21
- "postpublish": "yarn run clean"
23
+ "build": "npm run build:cjs && npm run build:esm",
24
+ "build:clean": "npm run clean && npm run build",
25
+ "prepublishOnly": "npm run build:clean",
26
+ "postpublish": "npm run clean"
22
27
  },
23
28
  "author": {
24
29
  "email": "hello@thebyte9.com",
@@ -27,28 +32,28 @@
27
32
  },
28
33
  "license": "GPL-3.0",
29
34
  "dependencies": {
30
- "@blaze-cms/admin-ui-utils": "0.146.0-translations.8",
31
- "@blaze-cms/core-errors": "0.146.0-translations.8",
32
- "@blaze-cms/plugin-render-hooks-ui": "^0.140.3",
33
- "@blaze-cms/react-form-builder": "0.146.0-translations.8",
34
- "@blaze-cms/react-page-builder": "0.146.0-translations.8",
35
- "@blaze-cms/setup-ui": "^0.140.3",
36
- "@blaze-cms/versioning-ui": "0.146.0-translations.0",
35
+ "@blaze-cms/admin-ui-utils": "0.147.0-rc-eagle.2",
36
+ "@blaze-cms/core-errors": "0.147.0-rc-eagle.2",
37
+ "@blaze-cms/plugin-render-hooks-ui": "0.147.0-rc-eagle.2",
38
+ "@blaze-cms/react-form-builder": "0.147.0-rc-eagle.2",
39
+ "@blaze-cms/react-page-builder": "0.147.0-rc-eagle.2",
40
+ "@blaze-cms/setup-ui": "0.147.0-rc-eagle.2",
41
+ "@blaze-cms/versioning-ui": "0.147.0-rc-eagle.2",
37
42
  "@blaze-react/button": "0.8.0-alpha.82",
38
43
  "@blaze-react/more": "0.5.19",
39
- "@blaze-react/multiselect": "0.8.0-alpha.102",
44
+ "@blaze-react/multiselect": "0.8.0-alpha.103",
40
45
  "@blaze-react/pagination": "0.8.0-alpha.76",
41
- "@blaze-react/select": "0.8.0-alpha.80",
46
+ "@blaze-react/select": "0.8.0-alpha.100",
47
+ "@blaze-react/tab": "^0.7.0",
42
48
  "@blaze-react/table": "0.8.0-alpha.74",
43
- "@blaze-react/toaster": "0.5.17",
49
+ "@blaze-react/toaster": "^0.7.0",
44
50
  "@blaze-react/tooltip": "0.8.0-alpha.100",
45
51
  "@blaze-react/utils": "0.5.15",
46
- "core-js": "^3.2.1",
47
52
  "lodash.differencewith": "^4.5.0",
48
53
  "lodash.has": "^4.5.2",
49
54
  "lodash.isempty": "^4.4.0",
50
55
  "lodash.isequal": "^4.5.0",
51
- "lodash.omit": "^4.5.0",
56
+ "lodash.omit": "^4.18.0",
52
57
  "lodash.unionby": "^4.8.0",
53
58
  "lodash.upperfirst": "^4.3.1",
54
59
  "react-helmet": "^6.1.0",
@@ -56,17 +61,17 @@
56
61
  "uuid": "^3.3.3"
57
62
  },
58
63
  "devDependencies": {
59
- "@blaze-cms/core-ui": "0.146.0-translations.8"
64
+ "@blaze-cms/core-ui": "0.147.0-rc-eagle.2"
60
65
  },
61
66
  "peerDependencies": {
62
67
  "@apollo/client": "3.x",
63
68
  "prop-types": "^15.7.2",
64
- "react": "^17.0.2",
69
+ "react": ">= 18",
65
70
  "react-router-dom": "^5.0.1"
66
71
  },
67
72
  "eslintIgnore": [
68
73
  "lib/*",
69
74
  "lib-es/*"
70
75
  ],
71
- "gitHead": "5bcb583bf1d7442739af5bcf650980090670ac5d"
76
+ "gitHead": "156a1560d7bc2bbd57b5b51fdf11098349bb26f5"
72
77
  }
@@ -4,16 +4,14 @@ import { withRouter, Prompt } from 'react-router-dom';
4
4
  import { useApolloClient } from '@apollo/client';
5
5
  import PropTypes from 'prop-types';
6
6
  import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
7
- import { getQuery, GET_CURRENT_TAB_ID } from '@blaze-cms/admin-ui-utils';
7
+ import { getQuery } from '@blaze-cms/admin-ui-utils';
8
8
  import { FormBuilder, parseFormValues } from '@blaze-cms/react-form-builder';
9
9
  import { DeleteAction, CopyDataFromAction } from '@blaze-cms/admin';
10
10
  import { useToasts } from '@blaze-react/toaster';
11
11
  import cloneDeep from 'lodash.clonedeep';
12
12
  import { getPageName } from '../utils/data-mappers';
13
- import isFormEmpty from '../utils/is-form-empty';
14
13
  import availableActions from './actions-handlers';
15
14
  import SideBarRelations from './SideBarRelations';
16
- import Tabs from '../../Tabs';
17
15
  import useCallbackDebounce from '../../hooks/useCallbackDebounce';
18
16
 
19
17
  import {
@@ -51,7 +49,6 @@ const Entity = ({
51
49
  onViewUrl,
52
50
  refetchRecord
53
51
  }) => {
54
- const [, setCurrentTabId] = useState(null);
55
52
  const [formValues, setFormValues] = useState(null);
56
53
  const [entitySchema, setEntitySchema] = useState(null);
57
54
  const [entityData, setEntityData] = useState(null);
@@ -72,6 +69,7 @@ const Entity = ({
72
69
  const [newUpdatedDate, setNewUpdatedDate] = useState(null);
73
70
  const [saveButtonText, setSaveButtonText] = useState(SAVE_BUTTON_TEXTS.save);
74
71
  const [externalUpdateTime, setExternalUpdateTime] = useState(null);
72
+ const [suppressPrompt, setSuppressPrompt] = useState(false);
75
73
  const [isRightSidebarOpen, setIsRightSidebarOpen] = useState(true);
76
74
  const handleToggleRightSidebar = () => setIsRightSidebarOpen(!isRightSidebarOpen);
77
75
 
@@ -109,50 +107,48 @@ const Entity = ({
109
107
  []
110
108
  ); // Using an empty dependency array ensures this only runs on unmount
111
109
 
112
- useEffect(
113
- () => {
114
- if (shouldUpdateState) {
115
- setSaveButtonText(SAVE_BUTTON_TEXTS.save);
116
- setEntityData(entity);
117
- setPageTitle(getPageName(schema.displayProperties, entity));
118
- setEntityIsPublish(entity.status);
119
- setEntitySchema(schema);
120
- setEnablePublishButton(schema.actions.publish);
121
- setEntityIdentifier(schema.identifier);
122
- setEnablePreviewButton(!!schema.interfaces.includes(PREVIEW_INTERFACE));
123
- }
110
+ useEffect(() => {
111
+ if (shouldUpdateState) {
112
+ setSaveButtonText(SAVE_BUTTON_TEXTS.save);
113
+ setEntityData(entity);
114
+ setPageTitle(getPageName(schema.displayProperties, entity));
115
+ setEntityIsPublish(entity.status);
116
+ setEntitySchema(schema);
117
+ setEnablePublishButton(schema.actions.publish);
118
+ setEntityIdentifier(schema.identifier);
119
+ setEnablePreviewButton(!!schema.interfaces.includes(PREVIEW_INTERFACE));
120
+ }
124
121
 
125
- if (formData && pageBuilderTemplateStatus) {
126
- const isPageBuilderTemplateSet = !!formData.values.pageBuilderTemplateId;
127
- client.writeQuery({
128
- query: getQuery('GET_PB_TEMPLATE_STATUS'),
129
- data: {
130
- pageBuilderTemplateSet: isPageBuilderTemplateSet,
131
- pageBuilderTemplateId: formData.values.pageBuilderTemplateId || ''
132
- }
133
- });
134
- }
135
- if (schema) {
136
- client.writeQuery({
137
- query: getQuery('GET_CURRENT_ENTITY'),
138
- data: {
139
- currentEntity: schema.id
140
- }
141
- });
142
- }
143
- },
144
- [
145
- client,
146
- entity,
147
- entityData,
148
- formData,
149
- formValues,
150
- pageBuilderTemplateStatus,
151
- previousQuery,
152
- schema,
153
- shouldUpdateState
154
- ]
155
- );
122
+ if (formData && pageBuilderTemplateStatus) {
123
+ const isPageBuilderTemplateSet = !!formData.values.pageBuilderTemplateId;
124
+ client.writeQuery({
125
+ query: getQuery('GET_PB_TEMPLATE_STATUS'),
126
+ data: {
127
+ pageBuilderTemplateSet: isPageBuilderTemplateSet,
128
+ pageBuilderTemplateId: formData.values.pageBuilderTemplateId || ''
129
+ }
130
+ });
131
+ }
132
+ if (schema) {
133
+ client.writeQuery({
134
+ query: getQuery('GET_CURRENT_ENTITY'),
135
+ data: {
136
+ currentEntity: schema.id,
137
+ currentItemId: entity ? entity.id : null
138
+ }
139
+ });
140
+ }
141
+ }, [
142
+ client,
143
+ entity,
144
+ entityData,
145
+ formData,
146
+ formValues,
147
+ pageBuilderTemplateStatus,
148
+ previousQuery,
149
+ schema,
150
+ shouldUpdateState
151
+ ]);
156
152
 
157
153
  const getFullUrl = async () => {
158
154
  const query = getQuery('GET_ENTITY_URL');
@@ -253,13 +249,12 @@ const Entity = ({
253
249
  const [updatedEntity = null] = fields.filter(({ id }) => id === 'name');
254
250
  updatedEntity && setPageTitle(updatedEntity.value);
255
251
 
256
- const isValidAndNewValueSet = isValid && isNewValueSet;
257
252
  const isNotValidOrNotNewValueSet = !isValid || !isNewValueSet;
258
253
  if (componentIsMounted.current) {
259
254
  setIsFormValid(isValid);
260
255
  }
261
256
 
262
- if (isValidAndNewValueSet && componentIsMounted.current) {
257
+ if (isValid && isNewValueSet && componentIsMounted.current) {
263
258
  setIsSaveButtonAvailable(true);
264
259
  setSaveButtonText(SAVE_BUTTON_TEXTS.save);
265
260
  }
@@ -275,10 +270,12 @@ const Entity = ({
275
270
 
276
271
  const onSubmit = event => {
277
272
  event && event.preventDefault();
278
-
279
273
  if (!isSaveButtonAvailable) return null;
280
- const parsedFormValues = parseFormValues(formValues);
281
274
 
275
+ if (isCreatePage) {
276
+ setSuppressPrompt(true);
277
+ }
278
+ const parsedFormValues = parseFormValues(formValues);
282
279
  const updatedFormValues = newUpdatedDate
283
280
  ? { ...formData.values, update: newUpdatedDate }
284
281
  : { ...formData.values };
@@ -416,13 +413,9 @@ const Entity = ({
416
413
 
417
414
  const pageName = formData && formData.values && formData.values.name;
418
415
 
419
- const hasNewFormValues = checkFulfilConditions(isNewEntity, !isFormEmpty(formValues));
420
- const hasToDisplayPrompt = isSaveButtonAvailable || hasNewFormValues;
416
+ const hasToDisplayPrompt = isSaveButtonAvailable && !suppressPrompt;
421
417
 
422
418
  const showSideBarRelations = checkFulfilConditions(schema, formData);
423
- const showPageBuilderTabs =
424
- schema?.interfaces?.includes('page-builder/page-builder-template') ||
425
- schema?.interfaces?.includes('page-builder/page-builder');
426
419
 
427
420
  return (
428
421
  <RecordEditContextProvider value={{ externalUpdateTime, updated: formData?.values?.updated }}>
@@ -464,9 +457,7 @@ const Entity = ({
464
457
  )}
465
458
 
466
459
  <div
467
- className={`page__content--fixed${
468
- !isRightSidebarOpen ? ' right-sidebar-collapsed' : ''
469
- }`}>
460
+ className={`page__content${!isRightSidebarOpen ? ' right-sidebar-collapsed' : ''}`}>
470
461
  <div className="page__content">
471
462
  <div className="content">
472
463
  <RenderHook
@@ -475,28 +466,19 @@ const Entity = ({
475
466
  schema={schema}
476
467
  />
477
468
  <InfoBoxes id={entity.id} schema={schema} />
478
- <Tabs
479
- enabled={showPageBuilderTabs}
480
- onTabChange={tabId => {
481
- client.writeQuery({
482
- query: GET_CURRENT_TAB_ID,
483
- data: { currentTabId: tabId }
484
- });
485
- setCurrentTabId(tabId);
486
- }}>
487
- <FormBuilder
488
- getIsFormValid={setIsFormValid}
489
- getFormValues={getFormValues}
490
- schema={schema}
491
- data={clonedFormData}
492
- onChange={onChangeFormValues}
493
- shouldCopyData={shouldCopyData}
494
- updateCopyData={updateCopyData}
495
- formValues={formValues}
496
- isNewEntity={isNewEntity}
497
- onExternalUpdate={setExternalUpdateTime}
498
- />
499
- </Tabs>
469
+ <FormBuilder
470
+ getIsFormValid={setIsFormValid}
471
+ getFormValues={getFormValues}
472
+ schema={schema}
473
+ data={clonedFormData}
474
+ onChange={onChangeFormValues}
475
+ shouldCopyData={shouldCopyData}
476
+ updateCopyData={updateCopyData}
477
+ formValues={formValues}
478
+ isNewEntity={isNewEntity}
479
+ onExternalUpdate={setExternalUpdateTime}
480
+ mode={isNewEntity ? 'create' : 'update'}
481
+ />
500
482
  <RenderHook
501
483
  hookKey={`entity:${action}:main:bottom`}
502
484
  entity={entity}
@@ -30,8 +30,7 @@ const EntityHeader = ({
30
30
 
31
31
  const {
32
32
  displayProperties: { adminCrudActions: { delete: deleteAction = { active: true } } = {} } = {}
33
- } =
34
- entitySchema || {};
33
+ } = entitySchema || {};
35
34
 
36
35
  const showDeleteButton =
37
36
  deleteAction.active && formData && Object.keys(formData.values).length !== 0;
@@ -21,17 +21,19 @@ const useCustomSidebarData = ({ id, schema, displayProperties }) => {
21
21
  }
22
22
  `;
23
23
 
24
- const { data = {}, loading, error, refetch } = useQuery(customSidebarInfoQuery, {
24
+ const {
25
+ data = {},
26
+ loading,
27
+ error,
28
+ refetch
29
+ } = useQuery(customSidebarInfoQuery, {
25
30
  variables: { id },
26
31
  skip: !query
27
32
  });
28
33
 
29
- useEffect(
30
- () => {
31
- refetch();
32
- },
33
- [externalUpdateTime, updated, refetch]
34
- );
34
+ useEffect(() => {
35
+ refetch();
36
+ }, [externalUpdateTime, updated, refetch]);
35
37
 
36
38
  return { data: data.__typename !== 'Query' ? data : null, loading, error };
37
39
  };
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import uuidv1 from 'uuid/v1';
4
+ import Accordion from '@blaze-react/accordion';
4
5
  import { useApolloClient } from '@apollo/client';
5
6
  import { getQuery } from '@blaze-cms/admin-ui-utils';
6
7
  import { formFieldTypes } from '@blaze-cms/react-form-builder';
@@ -24,40 +25,37 @@ const SideBarRelations = ({ schema, onChange, formData, entity, isOpen, onToggle
24
25
 
25
26
  const [relationsComponents, setRelationsComponents] = useState(null);
26
27
 
27
- useEffect(
28
- () => {
29
- (async () => {
30
- const fetchRelationSchema = async ({ entityIdentifier }) => {
31
- if (!entityIdentifier) return null;
28
+ useEffect(() => {
29
+ (async () => {
30
+ const fetchRelationSchema = async ({ entityIdentifier }) => {
31
+ if (!entityIdentifier) return null;
32
32
 
33
- const {
34
- data: {
35
- getEntitySchemas: [relationSchema]
36
- }
37
- } = await client.query({
38
- query: getQuery('GET_ENTITY_SCHEMA'),
39
- variables: { identifier: entityIdentifier }
40
- });
41
- return relationSchema;
42
- };
33
+ const {
34
+ data: {
35
+ getEntitySchemas: [relationSchema]
36
+ }
37
+ } = await client.query({
38
+ query: getQuery('GET_ENTITY_SCHEMA'),
39
+ variables: { identifier: entityIdentifier }
40
+ });
41
+ return relationSchema;
42
+ };
43
43
 
44
- if (!relationsComponents && schema) {
45
- const allRelationComponents = await Promise.all(
46
- schema.relations
47
- .filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])
48
- .map(async relation => ({
49
- id: uuidv1(),
50
- staticData: relation,
51
- schema: await fetchRelationSchema(relation)
52
- }))
53
- );
44
+ if (!relationsComponents && schema) {
45
+ const allRelationComponents = await Promise.all(
46
+ schema.relations
47
+ .filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])
48
+ .map(async relation => ({
49
+ id: uuidv1(),
50
+ staticData: relation,
51
+ schema: await fetchRelationSchema(relation)
52
+ }))
53
+ );
54
54
 
55
- setRelationsComponents(allRelationComponents);
56
- }
57
- })();
58
- },
59
- [client, relationsComponents, schema, schema.relations]
60
- );
55
+ setRelationsComponents(allRelationComponents);
56
+ }
57
+ })();
58
+ }, [client, relationsComponents, schema, schema.relations]);
61
59
  const { id: itemId } = entity;
62
60
  const { identifier: itemEntity, interfaces } = schema;
63
61
 
@@ -92,24 +90,21 @@ const SideBarRelations = ({ schema, onChange, formData, entity, isOpen, onToggle
92
90
  )}
93
91
  </div>
94
92
  )}
95
- {!schema.displayProperties.disableDefaultAdminInfo &&
96
- formattedCreated && (
97
- <>
98
- <>
99
- <p>
100
- Created: <span>{formattedCreated}</span>
101
- </p>
102
- <p>
103
- Updated: <span>{formattedUpdated}</span>
104
- </p>
105
- {updatedBy && (
106
- <p>
107
- Updated by: <span>{updatedBy.name}</span>
108
- </p>
109
- )}
110
- </>
111
- </>
112
- )}
93
+ {!schema.displayProperties.disableDefaultAdminInfo && formattedCreated && (
94
+ <>
95
+ <p>
96
+ Created: <span>{formattedCreated}</span>
97
+ </p>
98
+ <p>
99
+ Updated: <span>{formattedUpdated}</span>
100
+ </p>
101
+ {updatedBy && (
102
+ <p>
103
+ Updated by: <span>{updatedBy.name}</span>
104
+ </p>
105
+ )}
106
+ </>
107
+ )}
113
108
 
114
109
  <CustomSidebarInfoContainer
115
110
  id={itemId}
@@ -121,16 +116,26 @@ const SideBarRelations = ({ schema, onChange, formData, entity, isOpen, onToggle
121
116
  <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />
122
117
  <EntityNavLinks schema={schema} />
123
118
 
124
- {relationsComponents &&
125
- relationsComponents.map(({ id, staticData, schema: entitySchema }) => (
126
- <RelationComponent
127
- formData={formData}
128
- schema={entitySchema}
129
- key={id}
130
- staticData={staticData}
131
- onSelect={onChange}
132
- />
133
- ))}
119
+ {relationsComponents && (
120
+ <Accordion isOpen>
121
+ <Accordion.Header>
122
+ <b>Classification</b>
123
+ </Accordion.Header>
124
+ <Accordion.Content>
125
+ <Accordion.ContentDetails>
126
+ {relationsComponents.map(({ id, staticData, schema: entitySchema }) => (
127
+ <RelationComponent
128
+ formData={formData}
129
+ schema={entitySchema}
130
+ key={id}
131
+ staticData={staticData}
132
+ onSelect={onChange}
133
+ />
134
+ ))}
135
+ </Accordion.ContentDetails>
136
+ </Accordion.Content>
137
+ </Accordion>
138
+ )}
134
139
  </div>
135
140
  </div>
136
141
  );