@blaze-cms/plugin-data-ui 0.134.0-project-admin-customisations.0 → 0.134.0

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 (123) hide show
  1. package/CHANGELOG.md +4 -33
  2. package/README.md +0 -42
  3. package/lib/components/EntityDataListing/EntityDataListing.js +24 -3
  4. package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
  5. package/lib/components/EntityManager/Entity/Entity.js +17 -32
  6. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  7. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +7 -23
  8. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  9. package/lib/components/ListingTable/ListingTable.js +80 -113
  10. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  11. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +20 -8
  12. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  13. package/lib/components/ListingTable/mappers/populate-rows.js +26 -92
  14. package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
  15. package/lib/components/ListingTable/service/index.js +11 -73
  16. package/lib/components/ListingTable/service/index.js.map +1 -1
  17. package/lib/index.js +11 -3
  18. package/lib/index.js.map +1 -1
  19. package/lib/utils/add-content-menu-items.js +13 -64
  20. package/lib/utils/add-content-menu-items.js.map +1 -1
  21. package/lib/utils/build-listing-query.js +2 -11
  22. package/lib/utils/build-listing-query.js.map +1 -1
  23. package/lib/utils/get-default-query-params.js +4 -3
  24. package/lib/utils/get-default-query-params.js.map +1 -1
  25. package/lib-es/components/EntityDataListing/EntityDataListing.js +14 -3
  26. package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
  27. package/lib-es/components/EntityManager/Entity/Entity.js +17 -32
  28. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  29. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +8 -24
  30. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  31. package/lib-es/components/ListingTable/ListingTable.js +49 -46
  32. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  33. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +19 -11
  34. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  35. package/lib-es/components/ListingTable/mappers/populate-rows.js +24 -76
  36. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  37. package/lib-es/components/ListingTable/service/index.js +7 -65
  38. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  39. package/lib-es/index.js +9 -1
  40. package/lib-es/index.js.map +1 -1
  41. package/lib-es/utils/add-content-menu-items.js +5 -49
  42. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  43. package/lib-es/utils/build-listing-query.js +1 -10
  44. package/lib-es/utils/build-listing-query.js.map +1 -1
  45. package/lib-es/utils/get-default-query-params.js +3 -1
  46. package/lib-es/utils/get-default-query-params.js.map +1 -1
  47. package/package.json +9 -10
  48. package/src/components/EntityDataListing/EntityDataListing.js +12 -3
  49. package/src/components/EntityManager/Entity/Entity.js +57 -68
  50. package/src/components/EntityManager/Entity/SideBarRelations/index.js +19 -51
  51. package/src/components/ListingTable/ListingTable.js +38 -57
  52. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +22 -8
  53. package/src/components/ListingTable/mappers/populate-rows.js +18 -83
  54. package/src/components/ListingTable/service/index.js +5 -42
  55. package/src/index.js +8 -1
  56. package/src/utils/add-content-menu-items.js +3 -45
  57. package/src/utils/build-listing-query.js +1 -11
  58. package/src/utils/get-default-query-params.js +1 -1
  59. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -39
  60. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +0 -1
  61. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +0 -12
  62. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +0 -1
  63. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +0 -44
  64. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +0 -1
  65. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -32
  66. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +0 -1
  67. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +0 -45
  68. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +0 -1
  69. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +0 -38
  70. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +0 -1
  71. package/lib/components/InfoBoxes/InfoBoxes.js +0 -36
  72. package/lib/components/InfoBoxes/InfoBoxes.js.map +0 -1
  73. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +0 -44
  74. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
  75. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  76. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
  77. package/lib/components/InfoBoxes/hooks/useData.js +0 -42
  78. package/lib/components/InfoBoxes/hooks/useData.js.map +0 -1
  79. package/lib/components/InfoBoxes/hooks/useInfoBox.js +0 -26
  80. package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
  81. package/lib/components/InfoBoxes/index.js +0 -12
  82. package/lib/components/InfoBoxes/index.js.map +0 -1
  83. package/lib/components/InfoBoxes/presentational/InfoBox.js +0 -46
  84. package/lib/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
  85. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -30
  86. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +0 -1
  87. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +0 -3
  88. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +0 -1
  89. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +0 -30
  90. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +0 -1
  91. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -26
  92. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +0 -1
  93. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +0 -39
  94. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +0 -1
  95. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +0 -24
  96. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +0 -1
  97. package/lib-es/components/InfoBoxes/InfoBoxes.js +0 -28
  98. package/lib-es/components/InfoBoxes/InfoBoxes.js.map +0 -1
  99. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +0 -30
  100. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
  101. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  102. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
  103. package/lib-es/components/InfoBoxes/hooks/useData.js +0 -37
  104. package/lib-es/components/InfoBoxes/hooks/useData.js.map +0 -1
  105. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +0 -19
  106. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
  107. package/lib-es/components/InfoBoxes/index.js +0 -3
  108. package/lib-es/components/InfoBoxes/index.js.map +0 -1
  109. package/lib-es/components/InfoBoxes/presentational/InfoBox.js +0 -31
  110. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
  111. package/src/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -26
  112. package/src/components/EntityManager/Entity/EntitiyNavLinks/index.js +0 -3
  113. package/src/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +0 -22
  114. package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -33
  115. package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +0 -28
  116. package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +0 -33
  117. package/src/components/InfoBoxes/InfoBoxes.js +0 -24
  118. package/src/components/InfoBoxes/container/InfoBoxContainer.js +0 -22
  119. package/src/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  120. package/src/components/InfoBoxes/hooks/useData.js +0 -20
  121. package/src/components/InfoBoxes/hooks/useInfoBox.js +0 -13
  122. package/src/components/InfoBoxes/index.js +0 -3
  123. package/src/components/InfoBoxes/presentational/InfoBox.js +0 -34
@@ -1,24 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- const CustomSidebarInfo = ({
4
- items,
5
- customSidebarInfoKey
6
- }) => {
7
- if (!items) return null;
8
- const customSidebarInfoItems = items.map(item => Object.values(item).map(info => {
9
- if (!info.label || !info.value) return null;
10
- return /*#__PURE__*/React.createElement("p", null, info.label, ": ", /*#__PURE__*/React.createElement("span", null, info.value));
11
- }).filter(Boolean));
12
- return /*#__PURE__*/React.createElement("div", {
13
- className: "custom-sidebar-info",
14
- key: customSidebarInfoKey
15
- }, /*#__PURE__*/React.createElement("div", {
16
- className: "custom-sidebar-info--container"
17
- }, customSidebarInfoItems));
18
- };
19
- export default CustomSidebarInfo;
20
- CustomSidebarInfo.propTypes = {
21
- customSidebarInfoKey: PropTypes.string.isRequired,
22
- items: PropTypes.array.isRequired
23
- };
24
- //# sourceMappingURL=CustomSidebarInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CustomSidebarInfo.js","names":["PropTypes","React","CustomSidebarInfo","items","customSidebarInfoKey","customSidebarInfoItems","map","item","Object","values","info","label","value","createElement","filter","Boolean","className","key","propTypes","string","isRequired","array"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nconst CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {\n if (!items) return null;\n\n const customSidebarInfoItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <p>\n {info.label}: <span>{info.value}</span>\n </p>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"custom-sidebar-info\" key={customSidebarInfoKey}>\n <div className=\"custom-sidebar-info--container\">{customSidebarInfoItems}</div>\n </div>\n );\n};\n\nexport default CustomSidebarInfo;\n\nCustomSidebarInfo.propTypes = {\n customSidebarInfoKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AAEzB,MAAMC,iBAAiB,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAqB,CAAC,KAAK;EAC7D,IAAI,CAACD,KAAK,EAAE,OAAO,IAAI;EAEvB,MAAME,sBAAsB,GAAGF,KAAK,CAACG,GAAG,CAACC,IAAI,IAC3CC,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,CAChBD,GAAG,CAACI,IAAI,IAAI;IACX,IAAI,CAACA,IAAI,CAACC,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK,EAAE,OAAO,IAAI;IAE3C,oBACEX,KAAA,CAAAY,aAAA,YACGH,IAAI,CAACC,KAAK,EAAC,IAAE,eAAAV,KAAA,CAAAY,aAAA,eAAOH,IAAI,CAACE,KAAY,CACrC,CAAC;EAER,CAAC,CAAC,CACDE,MAAM,CAACC,OAAO,CACnB,CAAC;EAED,oBACEd,KAAA,CAAAY,aAAA;IAAKG,SAAS,EAAC,qBAAqB;IAACC,GAAG,EAAEb;EAAqB,gBAC7DH,KAAA,CAAAY,aAAA;IAAKG,SAAS,EAAC;EAAgC,GAAEX,sBAA4B,CAC1E,CAAC;AAEV,CAAC;AAED,eAAeH,iBAAiB;AAEhCA,iBAAiB,CAACgB,SAAS,GAAG;EAC5Bd,oBAAoB,EAAEJ,SAAS,CAACmB,MAAM,CAACC,UAAU;EACjDjB,KAAK,EAAEH,SAAS,CAACqB,KAAK,CAACD;AACzB,CAAC"}
@@ -1,28 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import InfoBoxContainer from './container/InfoBoxContainer';
4
- const InfoBoxes = ({
5
- id,
6
- schema
7
- }) => {
8
- const {
9
- displayProperties: {
10
- adminInfoBoxes = []
11
- }
12
- } = schema;
13
- if (adminInfoBoxes.length <= 0) {
14
- return null;
15
- }
16
- return adminInfoBoxes.map(infoBox => /*#__PURE__*/React.createElement(InfoBoxContainer, {
17
- id: id,
18
- schema: schema,
19
- key: infoBox.key,
20
- infoBox: infoBox
21
- }));
22
- };
23
- export default InfoBoxes;
24
- InfoBoxes.propTypes = {
25
- id: PropTypes.string.isRequired,
26
- schema: PropTypes.object.isRequired
27
- };
28
- //# sourceMappingURL=InfoBoxes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InfoBoxes.js","names":["PropTypes","React","InfoBoxContainer","InfoBoxes","id","schema","displayProperties","adminInfoBoxes","length","map","infoBox","createElement","key","propTypes","string","isRequired","object"],"sources":["../../../src/components/InfoBoxes/InfoBoxes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxContainer from './container/InfoBoxContainer';\n\nconst InfoBoxes = ({ id, schema }) => {\n const {\n displayProperties: { adminInfoBoxes = [] }\n } = schema;\n\n if (adminInfoBoxes.length <= 0) {\n return null;\n }\n\n return adminInfoBoxes.map(infoBox => (\n <InfoBoxContainer id={id} schema={schema} key={infoBox.key} infoBox={infoBox} />\n ));\n};\n\nexport default InfoBoxes;\n\nInfoBoxes.propTypes = {\n id: PropTypes.string.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,gBAAgB,MAAM,8BAA8B;AAE3D,MAAMC,SAAS,GAAGA,CAAC;EAAEC,EAAE;EAAEC;AAAO,CAAC,KAAK;EACpC,MAAM;IACJC,iBAAiB,EAAE;MAAEC,cAAc,GAAG;IAAG;EAC3C,CAAC,GAAGF,MAAM;EAEV,IAAIE,cAAc,CAACC,MAAM,IAAI,CAAC,EAAE;IAC9B,OAAO,IAAI;EACb;EAEA,OAAOD,cAAc,CAACE,GAAG,CAACC,OAAO,iBAC/BT,KAAA,CAAAU,aAAA,CAACT,gBAAgB;IAACE,EAAE,EAAEA,EAAG;IAACC,MAAM,EAAEA,MAAO;IAACO,GAAG,EAAEF,OAAO,CAACE,GAAI;IAACF,OAAO,EAAEA;EAAQ,CAAE,CAChF,CAAC;AACJ,CAAC;AAED,eAAeP,SAAS;AAExBA,SAAS,CAACU,SAAS,GAAG;EACpBT,EAAE,EAAEJ,SAAS,CAACc,MAAM,CAACC,UAAU;EAC/BV,MAAM,EAAEL,SAAS,CAACgB,MAAM,CAACD;AAC3B,CAAC"}
@@ -1,30 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import useData from '../hooks/useData';
4
- import InfoBox from '../presentational/InfoBox';
5
- const InfoBoxContainer = ({
6
- id,
7
- schema,
8
- infoBox
9
- }) => {
10
- const {
11
- data
12
- } = useData({
13
- id,
14
- schema,
15
- infoBox
16
- });
17
- if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
18
- const items = Object.values(data).flatMap(item => Object.values(item));
19
- return /*#__PURE__*/React.createElement(InfoBox, {
20
- items: items,
21
- infoBoxKey: infoBox.key
22
- });
23
- };
24
- export default InfoBoxContainer;
25
- InfoBoxContainer.propTypes = {
26
- id: PropTypes.string.isRequired,
27
- infoBox: PropTypes.object.isRequired,
28
- schema: PropTypes.object.isRequired
29
- };
30
- //# sourceMappingURL=InfoBoxContainer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InfoBoxContainer.js","names":["PropTypes","React","useData","InfoBox","InfoBoxContainer","id","schema","infoBox","data","Object","keys","length","items","values","flatMap","item","createElement","infoBoxKey","key","propTypes","string","isRequired","object"],"sources":["../../../../src/components/InfoBoxes/container/InfoBoxContainer.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport useData from '../hooks/useData';\nimport InfoBox from '../presentational/InfoBox';\n\nconst InfoBoxContainer = ({ id, schema, infoBox }) => {\n const { data } = useData({ id, schema, infoBox });\n\n if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;\n\n const items = Object.values(data).flatMap(item => Object.values(item));\n\n return <InfoBox items={items} infoBoxKey={infoBox.key} />;\n};\n\nexport default InfoBoxContainer;\n\nInfoBoxContainer.propTypes = {\n id: PropTypes.string.isRequired,\n infoBox: PropTypes.object.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,OAAO,MAAM,2BAA2B;AAE/C,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,KAAK;EACpD,MAAM;IAAEC;EAAK,CAAC,GAAGN,OAAO,CAAC;IAAEG,EAAE;IAAEC,MAAM;IAAEC;EAAQ,CAAC,CAAC;EAEjD,IAAI,CAACC,IAAI,IAAI,CAACC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAE9E,MAAMC,KAAK,GAAGH,MAAM,CAACI,MAAM,CAACL,IAAI,CAAC,CAACM,OAAO,CAACC,IAAI,IAAIN,MAAM,CAACI,MAAM,CAACE,IAAI,CAAC,CAAC;EAEtE,oBAAOd,KAAA,CAAAe,aAAA,CAACb,OAAO;IAACS,KAAK,EAAEA,KAAM;IAACK,UAAU,EAAEV,OAAO,CAACW;EAAI,CAAE,CAAC;AAC3D,CAAC;AAED,eAAed,gBAAgB;AAE/BA,gBAAgB,CAACe,SAAS,GAAG;EAC3Bd,EAAE,EAAEL,SAAS,CAACoB,MAAM,CAACC,UAAU;EAC/Bd,OAAO,EAAEP,SAAS,CAACsB,MAAM,CAACD,UAAU;EACpCf,MAAM,EAAEN,SAAS,CAACsB,MAAM,CAACD;AAC3B,CAAC"}
@@ -1,25 +0,0 @@
1
- import { gql } from '@apollo/client';
2
- import { BlazeError } from '@blaze-cms/core-errors';
3
- export default function buildDynamicQuery({
4
- id,
5
- schema,
6
- infoBox
7
- }) {
8
- if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
9
- throw new BlazeError('DataEntity query requires get action, properties and fields from entity schema');
10
- }
11
- const fields = `${infoBox.property} {
12
- label
13
- value
14
- }`;
15
- return {
16
- query: gql`query getInfoBoxData($id: String!){
17
- ${schema.actions.get}( id: $id ) {
18
- id
19
- ${fields}
20
- __typename
21
- }
22
- }`
23
- };
24
- }
25
- //# sourceMappingURL=build-dynamic-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","infoBox","actions","get","properties","fields","property","query"],"sources":["../../../../src/components/InfoBoxes/helpers/build-dynamic-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nexport default function buildDynamicQuery({ id, schema, infoBox }) {\n if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {\n throw new BlazeError(\n 'DataEntity query requires get action, properties and fields from entity schema'\n );\n }\n\n const fields = `${infoBox.property} {\n label\n value\n }`;\n\n return {\n query: gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields}\n __typename\n }\n }`\n };\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EACjE,IAAI,CAACD,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;IAC3E,MAAM,IAAIP,UAAU,CAClB,gFACF,CAAC;EACH;EAEA,MAAMQ,MAAM,GAAI,GAAEJ,OAAO,CAACK,QAAS;AACrC;AACA;AACA,MAAM;EAEJ,OAAO;IACLC,KAAK,EAAEX,GAAI;AACf,MAAMI,MAAM,CAACE,OAAO,CAACC,GAAI;AACzB;AACA,OAAOE,MAAO;AACd;AACA;AACA;EACE,CAAC;AACH"}
@@ -1,37 +0,0 @@
1
- import { useQuery, gql } from '@apollo/client';
2
- import useInfoBoxData from './useInfoBox';
3
- function useData({
4
- id,
5
- schema,
6
- infoBox
7
- }) {
8
- const {
9
- query
10
- } = useInfoBoxData({
11
- id,
12
- schema,
13
- infoBox
14
- });
15
- const infoBoxQuery = query || gql`
16
- query {
17
- __typename
18
- }
19
- `;
20
- const {
21
- data = {},
22
- loading,
23
- error
24
- } = useQuery(infoBoxQuery, {
25
- variables: {
26
- id
27
- },
28
- skip: !query
29
- });
30
- return {
31
- data: data.__typename !== 'Query' ? data : null,
32
- loading,
33
- error
34
- };
35
- }
36
- export default useData;
37
- //# sourceMappingURL=useData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useData.js","names":["useQuery","gql","useInfoBoxData","useData","id","schema","infoBox","query","infoBoxQuery","data","loading","error","variables","skip","__typename"],"sources":["../../../../src/components/InfoBoxes/hooks/useData.js"],"sourcesContent":["import { useQuery, gql } from '@apollo/client';\nimport useInfoBoxData from './useInfoBox';\n\nfunction useData({ id, schema, infoBox }) {\n const { query } = useInfoBoxData({ id, schema, infoBox });\n\n const infoBoxQuery =\n query ||\n gql`\n query {\n __typename\n }\n `;\n\n const { data = {}, loading, error } = useQuery(infoBoxQuery, { variables: { id }, skip: !query });\n\n return { data: data.__typename !== 'Query' ? data : null, loading, error };\n}\n\nexport default useData;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,GAAG,QAAQ,gBAAgB;AAC9C,OAAOC,cAAc,MAAM,cAAc;AAEzC,SAASC,OAAOA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EACxC,MAAM;IAAEC;EAAM,CAAC,GAAGL,cAAc,CAAC;IAAEE,EAAE;IAAEC,MAAM;IAAEC;EAAQ,CAAC,CAAC;EAEzD,MAAME,YAAY,GAChBD,KAAK,IACLN,GAAI;AACR;AACA;AACA;AACA,KAAK;EAEH,MAAM;IAAEQ,IAAI,GAAG,CAAC,CAAC;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGX,QAAQ,CAACQ,YAAY,EAAE;IAAEI,SAAS,EAAE;MAAER;IAAG,CAAC;IAAES,IAAI,EAAE,CAACN;EAAM,CAAC,CAAC;EAEjG,OAAO;IAAEE,IAAI,EAAEA,IAAI,CAACK,UAAU,KAAK,OAAO,GAAGL,IAAI,GAAG,IAAI;IAAEC,OAAO;IAAEC;EAAM,CAAC;AAC5E;AAEA,eAAeR,OAAO"}
@@ -1,19 +0,0 @@
1
- import buildDynamicQuery from '../helpers/build-dynamic-query';
2
- function useInfoBox({
3
- id,
4
- schema,
5
- infoBox
6
- }) {
7
- const {
8
- query
9
- } = buildDynamicQuery({
10
- id,
11
- schema,
12
- infoBox
13
- });
14
- return {
15
- query: query || null
16
- };
17
- }
18
- export default useInfoBox;
19
- //# sourceMappingURL=useInfoBox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInfoBox.js","names":["buildDynamicQuery","useInfoBox","id","schema","infoBox","query"],"sources":["../../../../src/components/InfoBoxes/hooks/useInfoBox.js"],"sourcesContent":["import buildDynamicQuery from '../helpers/build-dynamic-query';\n\nfunction useInfoBox({ id, schema, infoBox }) {\n const { query } = buildDynamicQuery({\n id,\n schema,\n infoBox\n });\n\n return { query: query || null };\n}\n\nexport default useInfoBox;\n"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,gCAAgC;AAE9D,SAASC,UAAUA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EAC3C,MAAM;IAAEC;EAAM,CAAC,GAAGL,iBAAiB,CAAC;IAClCE,EAAE;IACFC,MAAM;IACNC;EACF,CAAC,CAAC;EAEF,OAAO;IAAEC,KAAK,EAAEA,KAAK,IAAI;EAAK,CAAC;AACjC;AAEA,eAAeJ,UAAU"}
@@ -1,3 +0,0 @@
1
- import InfoBoxes from './InfoBoxes';
2
- export default InfoBoxes;
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["InfoBoxes"],"sources":["../../../src/components/InfoBoxes/index.js"],"sourcesContent":["import InfoBoxes from './InfoBoxes';\n\nexport default InfoBoxes;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AAEnC,eAAeA,SAAS"}
@@ -1,31 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- const InfoBox = ({
4
- items,
5
- infoBoxKey
6
- }) => {
7
- if (!items) return null;
8
- const infoBoxItems = items.map(item => Object.values(item).map(info => {
9
- if (!info.label || !info.value) return null;
10
- return /*#__PURE__*/React.createElement("div", {
11
- className: "info-box--item",
12
- key: `${infoBoxKey}-${info.label.toLowerCase()}`
13
- }, /*#__PURE__*/React.createElement("div", {
14
- className: "info-box--label"
15
- }, info.label, ": "), /*#__PURE__*/React.createElement("div", {
16
- className: "info-box--value"
17
- }, info.value));
18
- }).filter(Boolean));
19
- return /*#__PURE__*/React.createElement("div", {
20
- className: "info-box",
21
- key: infoBoxKey
22
- }, /*#__PURE__*/React.createElement("div", {
23
- className: "info-box--container"
24
- }, infoBoxItems));
25
- };
26
- export default InfoBox;
27
- InfoBox.propTypes = {
28
- infoBoxKey: PropTypes.string.isRequired,
29
- items: PropTypes.array.isRequired
30
- };
31
- //# sourceMappingURL=InfoBox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InfoBox.js","names":["PropTypes","React","InfoBox","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","createElement","className","key","toLowerCase","filter","Boolean","propTypes","string","isRequired","array"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBox.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nconst InfoBox = ({ items, infoBoxKey }) => {\n if (!items) return null;\n\n const infoBoxItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <div className=\"info-box--item\" key={`${infoBoxKey}-${info.label.toLowerCase()}`}>\n <div className=\"info-box--label\">{info.label}: </div>\n <div className=\"info-box--value\">{info.value}</div>\n </div>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"info-box\" key={infoBoxKey}>\n <div className=\"info-box--container\">{infoBoxItems}</div>\n </div>\n );\n};\n\nexport default InfoBox;\n\nInfoBox.propTypes = {\n infoBoxKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AAEzB,MAAMC,OAAO,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAW,CAAC,KAAK;EACzC,IAAI,CAACD,KAAK,EAAE,OAAO,IAAI;EAEvB,MAAME,YAAY,GAAGF,KAAK,CAACG,GAAG,CAACC,IAAI,IACjCC,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,CAChBD,GAAG,CAACI,IAAI,IAAI;IACX,IAAI,CAACA,IAAI,CAACC,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK,EAAE,OAAO,IAAI;IAE3C,oBACEX,KAAA,CAAAY,aAAA;MAAKC,SAAS,EAAC,gBAAgB;MAACC,GAAG,EAAG,GAAEX,UAAW,IAAGM,IAAI,CAACC,KAAK,CAACK,WAAW,CAAC,CAAE;IAAE,gBAC/Ef,KAAA,CAAAY,aAAA;MAAKC,SAAS,EAAC;IAAiB,GAAEJ,IAAI,CAACC,KAAK,EAAC,IAAO,CAAC,eACrDV,KAAA,CAAAY,aAAA;MAAKC,SAAS,EAAC;IAAiB,GAAEJ,IAAI,CAACE,KAAW,CAC/C,CAAC;EAEV,CAAC,CAAC,CACDK,MAAM,CAACC,OAAO,CACnB,CAAC;EAED,oBACEjB,KAAA,CAAAY,aAAA;IAAKC,SAAS,EAAC,UAAU;IAACC,GAAG,EAAEX;EAAW,gBACxCH,KAAA,CAAAY,aAAA;IAAKC,SAAS,EAAC;EAAqB,GAAET,YAAkB,CACrD,CAAC;AAEV,CAAC;AAED,eAAeH,OAAO;AAEtBA,OAAO,CAACiB,SAAS,GAAG;EAClBf,UAAU,EAAEJ,SAAS,CAACoB,MAAM,CAACC,UAAU;EACvClB,KAAK,EAAEH,SAAS,CAACsB,KAAK,CAACD;AACzB,CAAC"}
@@ -1,26 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- import EntityNavLinks from './EntityNavLinks';
2
-
3
- export default EntityNavLinks;
@@ -1,22 +0,0 @@
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
- };
@@ -1,33 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
- };
@@ -1,33 +0,0 @@
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
- };
@@ -1,24 +0,0 @@
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
- };
@@ -1,22 +0,0 @@
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
- };
@@ -1,25 +0,0 @@
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
- }
@@ -1,20 +0,0 @@
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;
@@ -1,13 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- import InfoBoxes from './InfoBoxes';
2
-
3
- export default InfoBoxes;
@@ -1,34 +0,0 @@
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
- };