@blaze-cms/plugin-data-ui 0.134.0-project-admin-customisations.0 → 0.135.0-admin-updates.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 (126) hide show
  1. package/CHANGELOG.md +13 -22
  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 +3 -16
  6. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  7. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +2 -12
  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/components/Tabs/index.js.map +1 -1
  18. package/lib/index.js +11 -3
  19. package/lib/index.js.map +1 -1
  20. package/lib/utils/add-content-menu-items.js +13 -64
  21. package/lib/utils/add-content-menu-items.js.map +1 -1
  22. package/lib/utils/build-listing-query.js +2 -11
  23. package/lib/utils/build-listing-query.js.map +1 -1
  24. package/lib/utils/get-default-query-params.js +4 -3
  25. package/lib/utils/get-default-query-params.js.map +1 -1
  26. package/lib-es/components/EntityDataListing/EntityDataListing.js +14 -3
  27. package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
  28. package/lib-es/components/EntityManager/Entity/Entity.js +3 -16
  29. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  30. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +2 -12
  31. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  32. package/lib-es/components/ListingTable/ListingTable.js +49 -46
  33. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  34. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +19 -11
  35. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  36. package/lib-es/components/ListingTable/mappers/populate-rows.js +24 -76
  37. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  38. package/lib-es/components/ListingTable/service/index.js +7 -65
  39. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  40. package/lib-es/components/Tabs/index.js.map +1 -1
  41. package/lib-es/index.js +9 -1
  42. package/lib-es/index.js.map +1 -1
  43. package/lib-es/utils/add-content-menu-items.js +5 -49
  44. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  45. package/lib-es/utils/build-listing-query.js +1 -10
  46. package/lib-es/utils/build-listing-query.js.map +1 -1
  47. package/lib-es/utils/get-default-query-params.js +3 -1
  48. package/lib-es/utils/get-default-query-params.js.map +1 -1
  49. package/package.json +9 -10
  50. package/src/components/EntityDataListing/EntityDataListing.js +12 -3
  51. package/src/components/EntityManager/Entity/Entity.js +1 -10
  52. package/src/components/EntityManager/Entity/SideBarRelations/index.js +16 -34
  53. package/src/components/ListingTable/ListingTable.js +38 -57
  54. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +22 -8
  55. package/src/components/ListingTable/mappers/populate-rows.js +18 -83
  56. package/src/components/ListingTable/service/index.js +5 -42
  57. package/src/components/Tabs/index.js +0 -2
  58. package/src/index.js +8 -1
  59. package/src/utils/add-content-menu-items.js +3 -45
  60. package/src/utils/build-listing-query.js +1 -11
  61. package/src/utils/get-default-query-params.js +1 -1
  62. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -39
  63. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +0 -1
  64. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +0 -12
  65. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +0 -1
  66. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +0 -44
  67. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +0 -1
  68. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -32
  69. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +0 -1
  70. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +0 -45
  71. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +0 -1
  72. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +0 -38
  73. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +0 -1
  74. package/lib/components/InfoBoxes/InfoBoxes.js +0 -36
  75. package/lib/components/InfoBoxes/InfoBoxes.js.map +0 -1
  76. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +0 -44
  77. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
  78. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  79. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
  80. package/lib/components/InfoBoxes/hooks/useData.js +0 -42
  81. package/lib/components/InfoBoxes/hooks/useData.js.map +0 -1
  82. package/lib/components/InfoBoxes/hooks/useInfoBox.js +0 -26
  83. package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
  84. package/lib/components/InfoBoxes/index.js +0 -12
  85. package/lib/components/InfoBoxes/index.js.map +0 -1
  86. package/lib/components/InfoBoxes/presentational/InfoBox.js +0 -46
  87. package/lib/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
  88. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -30
  89. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +0 -1
  90. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +0 -3
  91. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +0 -1
  92. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +0 -30
  93. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +0 -1
  94. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -26
  95. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +0 -1
  96. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +0 -39
  97. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +0 -1
  98. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +0 -24
  99. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +0 -1
  100. package/lib-es/components/InfoBoxes/InfoBoxes.js +0 -28
  101. package/lib-es/components/InfoBoxes/InfoBoxes.js.map +0 -1
  102. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +0 -30
  103. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
  104. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  105. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
  106. package/lib-es/components/InfoBoxes/hooks/useData.js +0 -37
  107. package/lib-es/components/InfoBoxes/hooks/useData.js.map +0 -1
  108. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +0 -19
  109. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
  110. package/lib-es/components/InfoBoxes/index.js +0 -3
  111. package/lib-es/components/InfoBoxes/index.js.map +0 -1
  112. package/lib-es/components/InfoBoxes/presentational/InfoBox.js +0 -31
  113. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
  114. package/src/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -26
  115. package/src/components/EntityManager/Entity/EntitiyNavLinks/index.js +0 -3
  116. package/src/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +0 -22
  117. package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -33
  118. package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +0 -28
  119. package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +0 -33
  120. package/src/components/InfoBoxes/InfoBoxes.js +0 -24
  121. package/src/components/InfoBoxes/container/InfoBoxContainer.js +0 -22
  122. package/src/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  123. package/src/components/InfoBoxes/hooks/useData.js +0 -20
  124. package/src/components/InfoBoxes/hooks/useInfoBox.js +0 -13
  125. package/src/components/InfoBoxes/index.js +0 -3
  126. package/src/components/InfoBoxes/presentational/InfoBox.js +0 -34
@@ -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
- };