@blaze-cms/plugin-data-ui 0.139.0-alpha.4 → 0.139.0-alpha.6

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 (153) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +42 -0
  3. package/lib/components/EntityDataListing/EntityDataListing.js +3 -24
  4. package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
  5. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +38 -0
  6. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
  7. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +11 -0
  8. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
  9. package/lib/components/EntityManager/Entity/Entity.js +16 -3
  10. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  11. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +43 -0
  12. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
  13. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +32 -0
  14. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
  15. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +44 -0
  16. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
  17. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +12 -2
  18. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  19. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +37 -0
  20. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
  21. package/lib/components/InfoBoxes/InfoBoxes.js +35 -0
  22. package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -0
  23. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +43 -0
  24. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
  25. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
  26. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
  27. package/lib/components/InfoBoxes/hooks/useData.js +41 -0
  28. package/lib/components/InfoBoxes/hooks/useData.js.map +1 -0
  29. package/lib/components/InfoBoxes/hooks/useInfoBox.js +25 -0
  30. package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
  31. package/lib/components/InfoBoxes/index.js +11 -0
  32. package/lib/components/InfoBoxes/index.js.map +1 -0
  33. package/lib/components/InfoBoxes/presentational/InfoBox.js +45 -0
  34. package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
  35. package/lib/components/ListingTable/ListingTable.js +124 -79
  36. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  37. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +8 -20
  38. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  39. package/lib/components/ListingTable/mappers/populate-rows.js +91 -25
  40. package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
  41. package/lib/components/ListingTable/service/index.js +73 -11
  42. package/lib/components/ListingTable/service/index.js.map +1 -1
  43. package/lib/constants.js +9 -1
  44. package/lib/constants.js.map +1 -1
  45. package/lib/icons/ContentIcon.js +90 -0
  46. package/lib/icons/ContentIcon.js.map +1 -0
  47. package/lib/icons/SettingsIcon.js +46 -0
  48. package/lib/icons/SettingsIcon.js.map +1 -0
  49. package/lib/icons/TaxonomyIcon.js +70 -0
  50. package/lib/icons/TaxonomyIcon.js.map +1 -0
  51. package/lib/icons/UsersIcon.js +43 -0
  52. package/lib/icons/UsersIcon.js.map +1 -0
  53. package/lib/icons/index.js +36 -0
  54. package/lib/icons/index.js.map +1 -0
  55. package/lib/index.js +38 -11
  56. package/lib/index.js.map +1 -1
  57. package/lib/utils/add-content-menu-items.js +61 -13
  58. package/lib/utils/add-content-menu-items.js.map +1 -1
  59. package/lib/utils/build-listing-query.js +11 -2
  60. package/lib/utils/build-listing-query.js.map +1 -1
  61. package/lib/utils/get-default-query-params.js +3 -4
  62. package/lib/utils/get-default-query-params.js.map +1 -1
  63. package/lib-es/components/EntityDataListing/EntityDataListing.js +3 -14
  64. package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
  65. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +30 -0
  66. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
  67. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
  68. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
  69. package/lib-es/components/EntityManager/Entity/Entity.js +16 -3
  70. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  71. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +30 -0
  72. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
  73. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +26 -0
  74. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
  75. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +39 -0
  76. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
  77. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +12 -2
  78. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  79. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +24 -0
  80. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
  81. package/lib-es/components/InfoBoxes/InfoBoxes.js +28 -0
  82. package/lib-es/components/InfoBoxes/InfoBoxes.js.map +1 -0
  83. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +30 -0
  84. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
  85. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
  86. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
  87. package/lib-es/components/InfoBoxes/hooks/useData.js +37 -0
  88. package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -0
  89. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +19 -0
  90. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
  91. package/lib-es/components/InfoBoxes/index.js +3 -0
  92. package/lib-es/components/InfoBoxes/index.js.map +1 -0
  93. package/lib-es/components/InfoBoxes/presentational/InfoBox.js +31 -0
  94. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
  95. package/lib-es/components/ListingTable/ListingTable.js +56 -50
  96. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  97. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +11 -19
  98. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  99. package/lib-es/components/ListingTable/mappers/populate-rows.js +76 -24
  100. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  101. package/lib-es/components/ListingTable/service/index.js +65 -7
  102. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  103. package/lib-es/constants.js +9 -1
  104. package/lib-es/constants.js.map +1 -1
  105. package/lib-es/icons/ContentIcon.js +80 -0
  106. package/lib-es/icons/ContentIcon.js.map +1 -0
  107. package/lib-es/icons/SettingsIcon.js +36 -0
  108. package/lib-es/icons/SettingsIcon.js.map +1 -0
  109. package/lib-es/icons/TaxonomyIcon.js +60 -0
  110. package/lib-es/icons/TaxonomyIcon.js.map +1 -0
  111. package/lib-es/icons/UsersIcon.js +33 -0
  112. package/lib-es/icons/UsersIcon.js.map +1 -0
  113. package/lib-es/icons/index.js +6 -0
  114. package/lib-es/icons/index.js.map +1 -0
  115. package/lib-es/index.js +37 -9
  116. package/lib-es/index.js.map +1 -1
  117. package/lib-es/utils/add-content-menu-items.js +46 -5
  118. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  119. package/lib-es/utils/build-listing-query.js +10 -1
  120. package/lib-es/utils/build-listing-query.js.map +1 -1
  121. package/lib-es/utils/get-default-query-params.js +1 -3
  122. package/lib-es/utils/get-default-query-params.js.map +1 -1
  123. package/package.json +6 -5
  124. package/src/components/EntityDataListing/EntityDataListing.js +3 -12
  125. package/src/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +26 -0
  126. package/src/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
  127. package/src/components/EntityManager/Entity/Entity.js +10 -1
  128. package/src/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +22 -0
  129. package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +33 -0
  130. package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +28 -0
  131. package/src/components/EntityManager/Entity/SideBarRelations/index.js +34 -16
  132. package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +33 -0
  133. package/src/components/InfoBoxes/InfoBoxes.js +24 -0
  134. package/src/components/InfoBoxes/container/InfoBoxContainer.js +22 -0
  135. package/src/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
  136. package/src/components/InfoBoxes/hooks/useData.js +20 -0
  137. package/src/components/InfoBoxes/hooks/useInfoBox.js +13 -0
  138. package/src/components/InfoBoxes/index.js +3 -0
  139. package/src/components/InfoBoxes/presentational/InfoBox.js +34 -0
  140. package/src/components/ListingTable/ListingTable.js +73 -39
  141. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +8 -22
  142. package/src/components/ListingTable/mappers/populate-rows.js +83 -18
  143. package/src/components/ListingTable/service/index.js +42 -5
  144. package/src/constants.js +13 -1
  145. package/src/icons/ContentIcon.js +83 -0
  146. package/src/icons/SettingsIcon.js +41 -0
  147. package/src/icons/TaxonomyIcon.js +62 -0
  148. package/src/icons/UsersIcon.js +37 -0
  149. package/src/icons/index.js +6 -0
  150. package/src/index.js +36 -8
  151. package/src/utils/add-content-menu-items.js +42 -3
  152. package/src/utils/build-listing-query.js +11 -1
  153. package/src/utils/get-default-query-params.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","buildListingQuery","entitySchema","actions","getAll","listingProperties","sortType","toUpperCase","substr","join"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildListingQuery(entitySchema) {\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 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 }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,iBAAiB,EAAE;IAC5F,MAAM,IAAIL,UAAU,CAClB,+EACF,CAAC;EACH;EAEA,MAAMM,QAAQ,GACZJ,YAAY,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACG,WAAW,CAAC,CAAC,GAAGL,YAAY,CAACC,OAAO,CAACC,MAAM,CAACI,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAOT,GAAI;AACb,YACMG,YAAY,CAACC,OAAO,CAACC,MACtB,oDAAmDE,QAAS;AACjE,qBACQJ,YAAY,CAACC,OAAO,CAACC,MACtB;AACP;AACA,UAAUF,YAAY,CAACG,iBAAiB,CAACI,IAAI,CAAC,KAAK,CAAE;AACrD;AACA;AACA,GAAG;AACH;AAEA,eAAeR,iBAAiB"}
1
+ {"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","getDynamicQuery","buildAdminSearchQuery","entitySchema","listingProperties","parsedProperties","join","buildListingQuery","isSearchQuery","actions","getAll","sortType","toUpperCase","substr"],"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 => {\n const { listingProperties = [] } = entitySchema || {};\n const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;\n\n return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true);\n};\n\nfunction buildListingQuery(entitySchema, 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);\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 }\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,GAAGC,YAAY,IAAI;EAC5C,MAAM;IAAEC,iBAAiB,GAAG;EAAG,CAAC,GAAGD,YAAY,IAAI,CAAC,CAAC;EACrD,MAAME,gBAAgB,GAAI,OAAMD,iBAAiB,CAACE,IAAI,CAAC,GAAG,CAAC,IAAI,SAAU,EAAC;EAE1E,OAAOL,eAAe,CAAC,cAAc,CAAC,CAAC,CAACE,YAAY,CAAC,EAAEE,gBAAgB,EAAE,IAAI,CAAC;AAChF,CAAC;AAED,SAASE,iBAAiBA,CAACJ,YAAY,EAAEK,aAAa,EAAE;EACtD,IAAI,CAACL,YAAY,CAACM,OAAO,IAAI,CAACN,YAAY,CAACM,OAAO,CAACC,MAAM,IAAI,CAACP,YAAY,CAACC,iBAAiB,EAAE;IAC5F,MAAM,IAAIJ,UAAU,CAClB,+EACF,CAAC;EACH;EAEA,IAAIQ,aAAa,EAAE,OAAON,qBAAqB,CAACC,YAAY,CAAC;EAE7D,MAAMQ,QAAQ,GACZR,YAAY,CAACM,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,GAAGT,YAAY,CAACM,OAAO,CAACC,MAAM,CAACG,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAOd,GAAI;AACb,YACMI,YAAY,CAACM,OAAO,CAACC,MACtB,oDAAmDC,QAAS;AACjE,qBACQR,YAAY,CAACM,OAAO,CAACC,MACtB;AACP;AACA,UAAUP,YAAY,CAACC,iBAAiB,CAACE,IAAI,CAAC,KAAK,CAAE;AACrD;AACA;AACA,GAAG;AACH;AAEA,eAAeC,iBAAiB"}
@@ -1,6 +1,4 @@
1
- const getDefaultQueryParams = ({
2
- schema
3
- }) => {
1
+ const getDefaultQueryParams = schema => {
4
2
  const updated = schema.properties && schema.properties.updated;
5
3
  const {
6
4
  adminDefaultListingFilter: where
@@ -1 +1 @@
1
- {"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","adminDefaultListingFilter","where","displayProperties","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = ({ schema }) => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where } = schema.displayProperties || {};\n\n return {\n where,\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EAC5C,MAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAC9D,MAAM;IAAEE,yBAAyB,EAAEC;EAAM,CAAC,GAAGJ,MAAM,CAACK,iBAAiB,IAAI,CAAC,CAAC;EAE3E,OAAO;IACLD,KAAK;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEP,OAAO,GACT,CACE;MACEQ,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAED,SAASX,qBAAqB"}
1
+ {"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","adminDefaultListingFilter","where","displayProperties","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = schema => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where } = schema.displayProperties || {};\n\n return {\n where,\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAGC,MAAM,IAAI;EACtC,MAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAC9D,MAAM;IAAEE,yBAAyB,EAAEC;EAAM,CAAC,GAAGJ,MAAM,CAACK,iBAAiB,IAAI,CAAC,CAAC;EAE3E,OAAO;IACLD,KAAK;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEP,OAAO,GACT,CACE;MACEQ,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAED,SAASX,qBAAqB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/plugin-data-ui",
3
- "version": "0.139.0-alpha.4",
3
+ "version": "0.139.0-alpha.6",
4
4
  "description": "Blaze plugin data ui",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -27,10 +27,11 @@
27
27
  },
28
28
  "license": "GPL-3.0",
29
29
  "dependencies": {
30
- "@blaze-cms/admin-ui-utils": "0.139.0-alpha.4",
30
+ "@blaze-cms/admin-ui-utils": "0.139.0-alpha.6",
31
31
  "@blaze-cms/core-errors": "^0.131.0",
32
- "@blaze-cms/react-form-builder": "0.139.0-alpha.4",
33
- "@blaze-cms/react-page-builder": "0.139.0-alpha.4",
32
+ "@blaze-cms/plugin-render-hooks-ui": "0.139.0-alpha.6",
33
+ "@blaze-cms/react-form-builder": "0.139.0-alpha.6",
34
+ "@blaze-cms/react-page-builder": "0.139.0-alpha.6",
34
35
  "@blaze-cms/setup-ui": "^0.131.0",
35
36
  "@blaze-cms/versioning-ui": "^0.136.0",
36
37
  "@blaze-react/button": "0.5.19",
@@ -65,5 +66,5 @@
65
66
  "lib/*",
66
67
  "lib-es/*"
67
68
  ],
68
- "gitHead": "718fa23556026a90878b25d1ba751052dfdb5494"
69
+ "gitHead": "cadf0cce4d05d747f493e4eafe479fd082169a01"
69
70
  }
@@ -6,31 +6,22 @@ import { getQuery } from '@blaze-cms/admin-ui-utils';
6
6
  import ListingTable from '../ListingTable/ListingTable';
7
7
  import { withContext } from '../../utils/hoc/withContext';
8
8
 
9
- const EntityDataListing = ({ match, menuItems }) => {
9
+ const EntityDataListing = ({ match }) => {
10
10
  const {
11
11
  params: { entityIdentifier: identifier }
12
12
  } = match;
13
13
 
14
- const [[selectedMenuItem]] = menuItems
15
- .map(([_, { items }]) => {
16
- const item = items.filter(({ uri }) => uri.endsWith(`/${identifier}`));
17
-
18
- return item.length ? item : null;
19
- })
20
- .filter(Boolean);
21
-
22
14
  const { data: { getEntitySchemas = [] } = {} } = useQuery(getQuery('GET_ENTITY_SCHEMA'), {
23
15
  variables: { identifier }
24
16
  });
25
17
 
26
18
  if (!getEntitySchemas.length) return '';
27
19
 
28
- return <ListingTable entitySchema={getEntitySchemas[0]} selectedMenuItem={selectedMenuItem} />;
20
+ return <ListingTable entitySchema={getEntitySchemas[0]} />;
29
21
  };
30
22
 
31
23
  EntityDataListing.propTypes = {
32
- match: PropTypes.object.isRequired,
33
- menuItems: PropTypes.array.isRequired
24
+ match: PropTypes.object.isRequired
34
25
  };
35
26
 
36
27
  export default withContext(EntityDataListing);
@@ -0,0 +1,26 @@
1
+ import { Link } from 'react-router-dom';
2
+ import React from 'react';
3
+
4
+ const EntityNavLinks = ({ schema }) => {
5
+ if (!schema) return null;
6
+
7
+ const {
8
+ displayProperties: { adminSectionNavigation }
9
+ } = schema;
10
+
11
+ if (!adminSectionNavigation) return null;
12
+
13
+ const links = Object.entries(adminSectionNavigation).map(([k, v]) => {
14
+ const { label, uri } = v;
15
+ const Wrapper = uri.startsWith('#') ? 'a' : Link;
16
+ return (
17
+ <Wrapper className="entity-section-link" href={uri} to={uri}>
18
+ {label}
19
+ </Wrapper>
20
+ );
21
+ });
22
+
23
+ return <div className="entity-section-links">{links}</div>;
24
+ };
25
+
26
+ export default EntityNavLinks;
@@ -0,0 +1,3 @@
1
+ import EntityNavLinks from './EntityNavLinks';
2
+
3
+ export default EntityNavLinks;
@@ -3,6 +3,7 @@ import React, { useEffect, useState, useRef } from 'react';
3
3
  import { withRouter, Prompt } from 'react-router-dom';
4
4
  import { useApolloClient } from '@apollo/client';
5
5
  import PropTypes from 'prop-types';
6
+ import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
6
7
  import { getQuery, GET_CURRENT_TAB_ID } from '@blaze-cms/admin-ui-utils';
7
8
  import { FormBuilder, parseFormValues } from '@blaze-cms/react-form-builder';
8
9
  import { DeleteAction, CopyDataFromAction } from '@blaze-cms/admin';
@@ -34,6 +35,7 @@ import {
34
35
  checkFulfilConditions
35
36
  } from '../utils/entity';
36
37
  import useToggle from '../../../utils/hooks/useToggle';
38
+ import InfoBoxes from '../../InfoBoxes/InfoBoxes';
37
39
 
38
40
  const Entity = ({
39
41
  formData,
@@ -440,6 +442,8 @@ const Entity = ({
440
442
  <div className="page__content--fixed">
441
443
  <div className="page__content">
442
444
  <div className="content">
445
+ <RenderHook hookKey={`entity:${action}:main:top`} entity={entity} schema={schema} />
446
+ <InfoBoxes id={entity.id} schema={schema} />
443
447
  <Tabs
444
448
  enabled={showPageBuilderTabs}
445
449
  onTabChange={tabId => {
@@ -461,12 +465,17 @@ const Entity = ({
461
465
  isNewEntity={isNewEntity}
462
466
  />
463
467
  </Tabs>
468
+ <RenderHook
469
+ hookKey={`entity:${action}:main:bottom`}
470
+ entity={entity}
471
+ schema={schema}
472
+ />
464
473
  </div>
465
474
  </div>
466
475
  </div>
467
476
  </div>
468
477
 
469
- <div className="column column--one-third page-sidebar">
478
+ <div className="column column--one-third page-sidebar page-sidebar--relations">
470
479
  {showSideBarRelations && (
471
480
  <SideBarRelations
472
481
  entity={entity}
@@ -0,0 +1,22 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import useCustomSidebarData from '../hooks/useCustomSidebarData';
4
+ import CustomSidebarInfo from '../presentational/CustomSidebarInfo';
5
+
6
+ const CustomSibebarInfoContainer = ({ id, schema, displayProperties }) => {
7
+ const { data } = useCustomSidebarData({ id, schema, displayProperties });
8
+
9
+ if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
10
+
11
+ const items = Object.values(data).flatMap(item => Object.values(item));
12
+
13
+ return <CustomSidebarInfo items={items} customSidebarInfoKey={displayProperties.key} />;
14
+ };
15
+
16
+ export default CustomSibebarInfoContainer;
17
+
18
+ CustomSibebarInfoContainer.propTypes = {
19
+ id: PropTypes.string.isRequired,
20
+ displayProperties: PropTypes.object.isRequired,
21
+ schema: PropTypes.object.isRequired
22
+ };
@@ -0,0 +1,33 @@
1
+ import { gql } from '@apollo/client';
2
+ import { BlazeError } from '@blaze-cms/core-errors';
3
+
4
+ export default function buildDynamicQuery({ id, schema, displayProperties }) {
5
+ if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
6
+ throw new BlazeError(
7
+ 'DataEntity query requires get action, properties and fields from entity schema'
8
+ );
9
+ }
10
+
11
+ if (
12
+ displayProperties.adminMainInfoProperty &&
13
+ Array.isArray(displayProperties.adminMainInfoProperty)
14
+ ) {
15
+ const fields = displayProperties.adminMainInfoProperty.map(
16
+ infoProperty =>
17
+ `${infoProperty} {
18
+ label
19
+ value
20
+ }`
21
+ );
22
+
23
+ return gql`query getInfoBoxData($id: String!){
24
+ ${schema.actions.get}( id: $id ) {
25
+ id
26
+ ${fields.map(field => field)}
27
+ __typename
28
+ }
29
+ }`;
30
+ }
31
+
32
+ return null;
33
+ }
@@ -0,0 +1,28 @@
1
+ import ProptTypes from 'prop-types';
2
+ import { useQuery, gql } from '@apollo/client';
3
+ import buildDynamicQuery from '../helpers/build-dynamic-query';
4
+
5
+ const useCustomSidebarData = ({ id, schema, displayProperties }) => {
6
+ const query = buildDynamicQuery({ id, schema, displayProperties });
7
+
8
+ const customSidebarInfoQuery =
9
+ query ||
10
+ gql`
11
+ query {
12
+ __typename
13
+ }
14
+ `;
15
+
16
+ const { data = {}, loading, error } = useQuery(customSidebarInfoQuery, {
17
+ variables: { id },
18
+ skip: !query
19
+ });
20
+
21
+ return { data: data.__typename !== 'Query' ? data : null, loading, error };
22
+ };
23
+
24
+ export default useCustomSidebarData;
25
+
26
+ useCustomSidebarData.propTypes = {
27
+ displayProperties: ProptTypes.object.isRequired
28
+ };
@@ -7,6 +7,8 @@ import { formFieldTypes } from '@blaze-cms/react-form-builder';
7
7
  import classnames from 'classnames';
8
8
  import { VersionsList } from '@blaze-cms/versioning-ui';
9
9
  import { PUBLISHED, UNPUBLISHED } from '../../../../constants';
10
+ import CustomSidebarInfoContainer from './container/CustomSidebarInfoContainer';
11
+ import EntityNavLinks from '../EntitiyNavLinks';
10
12
 
11
13
  const SideBarRelations = ({ schema, onChange, formData, entity }) => {
12
14
  const { relation: RelationComponent } = formFieldTypes;
@@ -18,7 +20,9 @@ const SideBarRelations = ({ schema, onChange, formData, entity }) => {
18
20
  status
19
21
  } = formData;
20
22
  const client = useApolloClient();
23
+
21
24
  const [relationsComponents, setRelationsComponents] = useState(null);
25
+
22
26
  useEffect(
23
27
  () => {
24
28
  (async () => {
@@ -64,28 +68,42 @@ const SideBarRelations = ({ schema, onChange, formData, entity }) => {
64
68
  return (
65
69
  <div className="sidebar" data-testid="sideBarRelations-main-div">
66
70
  <div className="sidebar__content">
67
- {formattedCreated && (
68
- <div className="sidebar__status">
69
- <div className="sidebar__status__wrapper">
70
- <b>Status</b>
71
- <span className={statusClassName}>{formattedStatus}</span>
71
+ <div className="sidebar__status">
72
+ {formattedCreated && (
73
+ <div className="sidebar__top">
74
+ <div className="sidebar__status__wrapper">
75
+ <b>Status</b>
76
+ <span className={statusClassName}>{formattedStatus}</span>
77
+ </div>
78
+ {formattedStatus === PUBLISHED && (
79
+ <p>
80
+ {formattedStatus} on: <span> {formattedPublished}</span>
81
+ </p>
82
+ )}
72
83
  </div>
73
- {formattedStatus === PUBLISHED && (
84
+ )}
85
+
86
+ {!schema.displayProperties.adminMainInfoProperty && (
87
+ <>
74
88
  <p>
75
- {formattedStatus} on: <span> {formattedPublished}</span>
89
+ Created: <span>{formattedCreated}</span>
76
90
  </p>
77
- )}
91
+ <p>
92
+ Updated: <span>{formattedUpdated}</span>
93
+ </p>
94
+ </>
95
+ )}
78
96
 
79
- <p>
80
- Created: <span>{formattedCreated}</span>
81
- </p>
82
- <p>
83
- Updated: <span>{formattedUpdated}</span>
84
- </p>
85
- </div>
86
- )}
97
+ <CustomSidebarInfoContainer
98
+ id={itemId}
99
+ schema={schema}
100
+ displayProperties={schema.displayProperties}
101
+ />
102
+ </div>
87
103
 
88
104
  <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />
105
+ <EntityNavLinks schema={schema} />
106
+
89
107
  {relationsComponents &&
90
108
  relationsComponents.map(({ id, staticData, schema: entitySchema }) => (
91
109
  <RelationComponent
@@ -0,0 +1,33 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+
4
+ const CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {
5
+ if (!items) return null;
6
+
7
+ const customSidebarInfoItems = items.map(item =>
8
+ Object.values(item)
9
+ .map(info => {
10
+ if (!info.label || !info.value) return null;
11
+
12
+ return (
13
+ <p>
14
+ {info.label}: <span>{info.value}</span>
15
+ </p>
16
+ );
17
+ })
18
+ .filter(Boolean)
19
+ );
20
+
21
+ return (
22
+ <div className="custom-sidebar-info" key={customSidebarInfoKey}>
23
+ <div className="custom-sidebar-info--container">{customSidebarInfoItems}</div>
24
+ </div>
25
+ );
26
+ };
27
+
28
+ export default CustomSidebarInfo;
29
+
30
+ CustomSidebarInfo.propTypes = {
31
+ customSidebarInfoKey: PropTypes.string.isRequired,
32
+ items: PropTypes.array.isRequired
33
+ };
@@ -0,0 +1,24 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import InfoBoxContainer from './container/InfoBoxContainer';
4
+
5
+ const InfoBoxes = ({ id, schema }) => {
6
+ const {
7
+ displayProperties: { adminInfoBoxes = [] }
8
+ } = schema;
9
+
10
+ if (adminInfoBoxes.length <= 0) {
11
+ return null;
12
+ }
13
+
14
+ return adminInfoBoxes.map(infoBox => (
15
+ <InfoBoxContainer id={id} schema={schema} key={infoBox.key} infoBox={infoBox} />
16
+ ));
17
+ };
18
+
19
+ export default InfoBoxes;
20
+
21
+ InfoBoxes.propTypes = {
22
+ id: PropTypes.string.isRequired,
23
+ schema: PropTypes.object.isRequired
24
+ };
@@ -0,0 +1,22 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import useData from '../hooks/useData';
4
+ import InfoBox from '../presentational/InfoBox';
5
+
6
+ const InfoBoxContainer = ({ id, schema, infoBox }) => {
7
+ const { data } = useData({ id, schema, infoBox });
8
+
9
+ if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
10
+
11
+ const items = Object.values(data).flatMap(item => Object.values(item));
12
+
13
+ return <InfoBox items={items} infoBoxKey={infoBox.key} />;
14
+ };
15
+
16
+ export default InfoBoxContainer;
17
+
18
+ InfoBoxContainer.propTypes = {
19
+ id: PropTypes.string.isRequired,
20
+ infoBox: PropTypes.object.isRequired,
21
+ schema: PropTypes.object.isRequired
22
+ };
@@ -0,0 +1,25 @@
1
+ import { gql } from '@apollo/client';
2
+ import { BlazeError } from '@blaze-cms/core-errors';
3
+
4
+ export default function buildDynamicQuery({ id, schema, infoBox }) {
5
+ if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
6
+ throw new BlazeError(
7
+ 'DataEntity query requires get action, properties and fields from entity schema'
8
+ );
9
+ }
10
+
11
+ const fields = `${infoBox.property} {
12
+ label
13
+ value
14
+ }`;
15
+
16
+ return {
17
+ query: gql`query getInfoBoxData($id: String!){
18
+ ${schema.actions.get}( id: $id ) {
19
+ id
20
+ ${fields}
21
+ __typename
22
+ }
23
+ }`
24
+ };
25
+ }
@@ -0,0 +1,20 @@
1
+ import { useQuery, gql } from '@apollo/client';
2
+ import useInfoBoxData from './useInfoBox';
3
+
4
+ function useData({ id, schema, infoBox }) {
5
+ const { query } = useInfoBoxData({ id, schema, infoBox });
6
+
7
+ const infoBoxQuery =
8
+ query ||
9
+ gql`
10
+ query {
11
+ __typename
12
+ }
13
+ `;
14
+
15
+ const { data = {}, loading, error } = useQuery(infoBoxQuery, { variables: { id }, skip: !query });
16
+
17
+ return { data: data.__typename !== 'Query' ? data : null, loading, error };
18
+ }
19
+
20
+ export default useData;
@@ -0,0 +1,13 @@
1
+ import buildDynamicQuery from '../helpers/build-dynamic-query';
2
+
3
+ function useInfoBox({ id, schema, infoBox }) {
4
+ const { query } = buildDynamicQuery({
5
+ id,
6
+ schema,
7
+ infoBox
8
+ });
9
+
10
+ return { query: query || null };
11
+ }
12
+
13
+ export default useInfoBox;
@@ -0,0 +1,3 @@
1
+ import InfoBoxes from './InfoBoxes';
2
+
3
+ export default InfoBoxes;
@@ -0,0 +1,34 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+
4
+ const InfoBox = ({ items, infoBoxKey }) => {
5
+ if (!items) return null;
6
+
7
+ const infoBoxItems = items.map(item =>
8
+ Object.values(item)
9
+ .map(info => {
10
+ if (!info.label || !info.value) return null;
11
+
12
+ return (
13
+ <div className="info-box--item" key={`${infoBoxKey}-${info.label.toLowerCase()}`}>
14
+ <div className="info-box--label">{info.label}: </div>
15
+ <div className="info-box--value">{info.value}</div>
16
+ </div>
17
+ );
18
+ })
19
+ .filter(Boolean)
20
+ );
21
+
22
+ return (
23
+ <div className="info-box" key={infoBoxKey}>
24
+ <div className="info-box--container">{infoBoxItems}</div>
25
+ </div>
26
+ );
27
+ };
28
+
29
+ export default InfoBox;
30
+
31
+ InfoBox.propTypes = {
32
+ infoBoxKey: PropTypes.string.isRequired,
33
+ items: PropTypes.array.isRequired
34
+ };