@blaze-cms/plugin-data-ui 0.139.0-alpha.3 → 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.
- package/CHANGELOG.md +56 -0
- package/README.md +42 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +4 -26
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +1 -2
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +38 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +11 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib/components/EntityManager/Entity/Entity.js +19 -7
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +1 -2
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +43 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +32 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +44 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +15 -6
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +37 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +1 -2
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +1 -2
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +3 -4
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +1 -2
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +4 -8
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +1 -2
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +1 -2
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +1 -2
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +35 -0
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +43 -0
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
- package/lib/components/InfoBoxes/hooks/useData.js +41 -0
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +25 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib/components/InfoBoxes/index.js +11 -0
- package/lib/components/InfoBoxes/index.js.map +1 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js +45 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib/components/ListingTable/ListingTable.js +127 -84
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +9 -22
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +1 -2
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +1 -2
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +1 -2
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +1 -2
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +92 -29
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +74 -13
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +3 -4
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/constants.js +33 -49
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +90 -0
- package/lib/icons/ContentIcon.js.map +1 -0
- package/lib/icons/SettingsIcon.js +46 -0
- package/lib/icons/SettingsIcon.js.map +1 -0
- package/lib/icons/TaxonomyIcon.js +70 -0
- package/lib/icons/TaxonomyIcon.js.map +1 -0
- package/lib/icons/UsersIcon.js +43 -0
- package/lib/icons/UsersIcon.js.map +1 -0
- package/lib/icons/index.js +36 -0
- package/lib/icons/index.js.map +1 -0
- package/lib/index.js +40 -13
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +62 -15
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +1 -2
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +1 -2
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +12 -4
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +1 -2
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +1 -2
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +3 -5
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +1 -2
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +1 -2
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib-es/components/EntityDataListing/EntityDataListing.js +3 -14
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +30 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/Entity.js +16 -3
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +30 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +26 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +39 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +12 -2
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +24 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js +28 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +30 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js +37 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +19 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib-es/components/InfoBoxes/index.js +3 -0
- package/lib-es/components/InfoBoxes/index.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +31 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTable.js +56 -51
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +11 -19
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js +76 -24
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js +65 -7
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/constants.js +9 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/icons/ContentIcon.js +80 -0
- package/lib-es/icons/ContentIcon.js.map +1 -0
- package/lib-es/icons/SettingsIcon.js +36 -0
- package/lib-es/icons/SettingsIcon.js.map +1 -0
- package/lib-es/icons/TaxonomyIcon.js +60 -0
- package/lib-es/icons/TaxonomyIcon.js.map +1 -0
- package/lib-es/icons/UsersIcon.js +33 -0
- package/lib-es/icons/UsersIcon.js.map +1 -0
- package/lib-es/icons/index.js +6 -0
- package/lib-es/icons/index.js.map +1 -0
- package/lib-es/index.js +37 -9
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js +46 -5
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-listing-query.js +10 -1
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/get-default-query-params.js +1 -3
- package/lib-es/utils/get-default-query-params.js.map +1 -1
- package/package.json +6 -5
- package/src/components/EntityDataListing/EntityDataListing.js +3 -12
- package/src/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +26 -0
- package/src/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
- package/src/components/EntityManager/Entity/Entity.js +10 -1
- package/src/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +22 -0
- package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +33 -0
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +28 -0
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +34 -16
- package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +33 -0
- package/src/components/InfoBoxes/InfoBoxes.js +24 -0
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +22 -0
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +25 -0
- package/src/components/InfoBoxes/hooks/useData.js +20 -0
- package/src/components/InfoBoxes/hooks/useInfoBox.js +13 -0
- package/src/components/InfoBoxes/index.js +3 -0
- package/src/components/InfoBoxes/presentational/InfoBox.js +34 -0
- package/src/components/ListingTable/ListingTable.js +73 -39
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +8 -22
- package/src/components/ListingTable/mappers/populate-rows.js +83 -18
- package/src/components/ListingTable/service/index.js +42 -5
- package/src/constants.js +13 -1
- package/src/icons/ContentIcon.js +83 -0
- package/src/icons/SettingsIcon.js +41 -0
- package/src/icons/TaxonomyIcon.js +62 -0
- package/src/icons/UsersIcon.js +37 -0
- package/src/icons/index.js +6 -0
- package/src/index.js +36 -8
- package/src/utils/add-content-menu-items.js +42 -3
- package/src/utils/build-listing-query.js +11 -1
- package/src/utils/get-default-query-params.js +1 -1
|
@@ -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
|
-
|
|
68
|
-
|
|
69
|
-
<div className="
|
|
70
|
-
<
|
|
71
|
-
|
|
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
|
-
|
|
84
|
+
)}
|
|
85
|
+
|
|
86
|
+
{!schema.displayProperties.adminMainInfoProperty && (
|
|
87
|
+
<>
|
|
74
88
|
<p>
|
|
75
|
-
|
|
89
|
+
Created: <span>{formattedCreated}</span>
|
|
76
90
|
</p>
|
|
77
|
-
|
|
91
|
+
<p>
|
|
92
|
+
Updated: <span>{formattedUpdated}</span>
|
|
93
|
+
</p>
|
|
94
|
+
</>
|
|
95
|
+
)}
|
|
78
96
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js
ADDED
|
@@ -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,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
|
+
};
|
|
@@ -3,27 +3,28 @@ import React, { useEffect, useState, Fragment } from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { withRouter, Link } from 'react-router-dom';
|
|
5
5
|
import More from '@blaze-react/more';
|
|
6
|
-
import {
|
|
7
|
-
import { PageHeader, DeleteAction } from '@blaze-cms/admin';
|
|
6
|
+
import { PageHeader, DeleteAction, CardPrompt } from '@blaze-cms/admin';
|
|
8
7
|
import { useToasts } from '@blaze-react/toaster';
|
|
8
|
+
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
9
9
|
import ListingTableContent from './ListingTableContent';
|
|
10
10
|
import availableActions from '../EntityManager/Entity/actions-handlers';
|
|
11
11
|
import { fetchData } from './service';
|
|
12
|
-
import { populateRows, formatRows } from './mappers/populate-rows';
|
|
12
|
+
import { populateRows, formatRows, getParsedRowData } from './mappers/populate-rows';
|
|
13
13
|
import { getDefaultQueryParams } from '../../utils/get-default-query-params';
|
|
14
14
|
|
|
15
15
|
const OVER_SCAN_BUFFER = 10;
|
|
16
16
|
|
|
17
|
-
const ListingTable = ({ match, entitySchema
|
|
17
|
+
const ListingTable = ({ match, entitySchema }) => {
|
|
18
18
|
const [tableData, setTableData] = useState({});
|
|
19
19
|
const [modalStatus, setModalStatus] = useState(false);
|
|
20
20
|
const [itemToDelete, setItemToDelete] = useState({});
|
|
21
21
|
const [previousSchema, setPreviousSchema] = useState({ id: null });
|
|
22
22
|
const [scrollToIndex, setScrollToIndex] = useState(0);
|
|
23
23
|
const [verifiedRanges, setVerifiedRanges] = useState([]);
|
|
24
|
-
const queryParamsDefault = getDefaultQueryParams(
|
|
24
|
+
const queryParamsDefault = getDefaultQueryParams(entitySchema);
|
|
25
25
|
const [queryParams, setQueryParams] = useState(queryParamsDefault);
|
|
26
|
-
const
|
|
26
|
+
const [listFilters, setListFilters] = useState([]);
|
|
27
|
+
const [displayCardPrompt, setDisplayCardPrompt] = useState(true);
|
|
27
28
|
const client = useApolloClient();
|
|
28
29
|
const { addToast } = useToasts();
|
|
29
30
|
|
|
@@ -34,20 +35,7 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
34
35
|
entitySchema.id !== previousSchema.id ||
|
|
35
36
|
(previousSchema.id === null && entitySchema.id)
|
|
36
37
|
) {
|
|
37
|
-
|
|
38
|
-
client,
|
|
39
|
-
querySettings: {
|
|
40
|
-
entitySchema,
|
|
41
|
-
queryParams: queryParamsDefault
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const populatedTable = populateRows({
|
|
45
|
-
toggleModal,
|
|
46
|
-
url: match.url,
|
|
47
|
-
entitySchema,
|
|
48
|
-
rows: data
|
|
49
|
-
});
|
|
50
|
-
setTableData(populatedTable);
|
|
38
|
+
await doQuery();
|
|
51
39
|
setPreviousSchema({ id: entitySchema.id });
|
|
52
40
|
}
|
|
53
41
|
})();
|
|
@@ -55,18 +43,33 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
55
43
|
[client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps
|
|
56
44
|
);
|
|
57
45
|
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
);
|
|
67
|
-
|
|
46
|
+
const doQuery = async (filters = listFilters) => {
|
|
47
|
+
const data = await fetchData({
|
|
48
|
+
client,
|
|
49
|
+
querySettings: {
|
|
50
|
+
entitySchema,
|
|
51
|
+
queryParams: queryParamsDefault
|
|
52
|
+
},
|
|
53
|
+
listFilters: filters
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const populatedTable = populateRows({
|
|
57
|
+
toggleModal,
|
|
58
|
+
url: match.url,
|
|
59
|
+
entitySchema,
|
|
60
|
+
rows: data
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
setTableData(populatedTable);
|
|
68
64
|
};
|
|
69
65
|
|
|
66
|
+
const updateListingFilters = async filters => {
|
|
67
|
+
await doQuery(filters);
|
|
68
|
+
setListFilters(filters);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const onCloseCardPrompt = () => null;
|
|
72
|
+
|
|
70
73
|
const toggleModal = item => {
|
|
71
74
|
setModalStatus(!!item);
|
|
72
75
|
setItemToDelete(item || {});
|
|
@@ -107,15 +110,22 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
107
110
|
querySettings: {
|
|
108
111
|
entitySchema,
|
|
109
112
|
queryParams: sortQueryParams
|
|
110
|
-
}
|
|
113
|
+
},
|
|
114
|
+
listFilters
|
|
111
115
|
});
|
|
112
|
-
const { columns } = tableData;
|
|
116
|
+
const { columns, isEnquiry } = tableData;
|
|
113
117
|
const [firstColumn] = columns;
|
|
114
118
|
|
|
115
119
|
setTableData({
|
|
116
120
|
...tableData,
|
|
117
121
|
appliedSort: { [property]: direction },
|
|
118
|
-
rows: formatRows({
|
|
122
|
+
rows: formatRows({
|
|
123
|
+
rows: getParsedRowData(data),
|
|
124
|
+
url: match.url,
|
|
125
|
+
toggleModal,
|
|
126
|
+
firstColumn,
|
|
127
|
+
isEnquiry
|
|
128
|
+
})
|
|
119
129
|
});
|
|
120
130
|
};
|
|
121
131
|
|
|
@@ -133,11 +143,17 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
133
143
|
querySettings: {
|
|
134
144
|
entitySchema,
|
|
135
145
|
queryParams: updatedQueryParams
|
|
136
|
-
}
|
|
146
|
+
},
|
|
147
|
+
listFilters
|
|
137
148
|
});
|
|
138
149
|
const updatedRows = [
|
|
139
150
|
...tableData.rows,
|
|
140
|
-
...formatRows({
|
|
151
|
+
...formatRows({
|
|
152
|
+
rows: getParsedRowData(data),
|
|
153
|
+
url: match.url,
|
|
154
|
+
toggleModal,
|
|
155
|
+
isEnquiry: tableData.isEnquiry
|
|
156
|
+
})
|
|
141
157
|
];
|
|
142
158
|
|
|
143
159
|
setVerifiedRanges([...verifiedRanges, loadIndex]);
|
|
@@ -151,6 +167,7 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
151
167
|
};
|
|
152
168
|
|
|
153
169
|
if (!tableData || !tableData.rows) return 'loading';
|
|
170
|
+
const showAddButton = !!tableData.rows.length && !tableData.isEnquiry;
|
|
154
171
|
|
|
155
172
|
return (
|
|
156
173
|
<div className="page">
|
|
@@ -162,7 +179,7 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
162
179
|
/>
|
|
163
180
|
)}
|
|
164
181
|
<PageHeader title={entitySchema.displayName} subtitle="">
|
|
165
|
-
{
|
|
182
|
+
{showAddButton && (
|
|
166
183
|
<Fragment>
|
|
167
184
|
<Link
|
|
168
185
|
data-testid="addEntity"
|
|
@@ -181,13 +198,31 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
181
198
|
</Fragment>
|
|
182
199
|
)}
|
|
183
200
|
</PageHeader>
|
|
201
|
+
{displayCardPrompt &&
|
|
202
|
+
!showAddButton && (
|
|
203
|
+
<CardPrompt
|
|
204
|
+
onClose={() => {
|
|
205
|
+
setDisplayCardPrompt(false);
|
|
206
|
+
}}>
|
|
207
|
+
<Link
|
|
208
|
+
className="button button--rounded button--cta"
|
|
209
|
+
to={`${match.url}/create`}
|
|
210
|
+
data-testid="add-button">
|
|
211
|
+
Add
|
|
212
|
+
</Link>
|
|
213
|
+
</CardPrompt>
|
|
214
|
+
)}
|
|
215
|
+
<RenderHook
|
|
216
|
+
hookKey="entity:listing:main:top"
|
|
217
|
+
schema={entitySchema}
|
|
218
|
+
setListFilters={updateListingFilters}
|
|
219
|
+
/>
|
|
184
220
|
<ListingTableContent
|
|
185
221
|
overScanBuffer={OVER_SCAN_BUFFER}
|
|
186
222
|
onSort={handleSort}
|
|
187
223
|
onRenderItems={handleRenderedItems}
|
|
188
224
|
tableData={tableData}
|
|
189
225
|
onCloseCardPrompt={onCloseCardPrompt}
|
|
190
|
-
selectedMenuItem={selectedMenuItem}
|
|
191
226
|
scrollToIndex={scrollToIndex}
|
|
192
227
|
/>
|
|
193
228
|
</div>
|
|
@@ -195,8 +230,7 @@ const ListingTable = ({ match, entitySchema, selectedMenuItem }) => {
|
|
|
195
230
|
};
|
|
196
231
|
ListingTable.propTypes = {
|
|
197
232
|
entitySchema: PropTypes.object.isRequired,
|
|
198
|
-
match: PropTypes.object.isRequired
|
|
199
|
-
selectedMenuItem: PropTypes.object.isRequired
|
|
233
|
+
match: PropTypes.object.isRequired
|
|
200
234
|
};
|
|
201
235
|
|
|
202
236
|
export default withRouter(ListingTable);
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Table from '@blaze-react/table';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
-
import { Link, withRouter } from 'react-router-dom';
|
|
4
|
+
import { withRouter } from 'react-router-dom';
|
|
6
5
|
|
|
7
6
|
const ListingTableContent = ({
|
|
8
7
|
tableData,
|
|
9
8
|
handleSelect,
|
|
10
|
-
onCloseCardPrompt,
|
|
11
|
-
selectedMenuItem,
|
|
12
|
-
match,
|
|
13
9
|
onSort,
|
|
14
10
|
onClickRow,
|
|
15
11
|
overScanBuffer,
|
|
@@ -17,12 +13,14 @@ const ListingTableContent = ({
|
|
|
17
13
|
scrollToIndex
|
|
18
14
|
}) => {
|
|
19
15
|
const displayTable = tableData && tableData.rows && !!tableData.rows.length;
|
|
16
|
+
const { isEnquiry } = tableData;
|
|
17
|
+
const className = `page__content${isEnquiry ? ' array-table' : ''}`;
|
|
20
18
|
|
|
21
19
|
return (
|
|
22
20
|
<>
|
|
23
|
-
{displayTable
|
|
21
|
+
{displayTable && (
|
|
24
22
|
<>
|
|
25
|
-
<div className=
|
|
23
|
+
<div className={className}>
|
|
26
24
|
<Table
|
|
27
25
|
scrollToIndex={scrollToIndex}
|
|
28
26
|
onSort={onSort}
|
|
@@ -30,23 +28,12 @@ const ListingTableContent = ({
|
|
|
30
28
|
overScanBuffer={overScanBuffer}
|
|
31
29
|
onRenderItems={onRenderItems}
|
|
32
30
|
data={tableData}
|
|
33
|
-
checkboxes
|
|
31
|
+
checkboxes={!isEnquiry}
|
|
34
32
|
onSelect={handleSelect}
|
|
35
33
|
data-testid="listing-table-content"
|
|
36
34
|
/>
|
|
37
35
|
</div>
|
|
38
36
|
</>
|
|
39
|
-
) : (
|
|
40
|
-
selectedMenuItem.isDisplayedPrompt && (
|
|
41
|
-
<CardPrompt onClose={onCloseCardPrompt} data-testid="card-prompt">
|
|
42
|
-
<Link
|
|
43
|
-
className="button button--rounded button--cta"
|
|
44
|
-
to={`${match.url}/create`}
|
|
45
|
-
data-testid="add-button">
|
|
46
|
-
Add
|
|
47
|
-
</Link>
|
|
48
|
-
</CardPrompt>
|
|
49
|
-
)
|
|
50
37
|
)}
|
|
51
38
|
</>
|
|
52
39
|
);
|
|
@@ -54,8 +41,6 @@ const ListingTableContent = ({
|
|
|
54
41
|
|
|
55
42
|
ListingTableContent.propTypes = {
|
|
56
43
|
tableData: PropTypes.object.isRequired,
|
|
57
|
-
onCloseCardPrompt: PropTypes.func.isRequired,
|
|
58
|
-
selectedMenuItem: PropTypes.object.isRequired,
|
|
59
44
|
match: PropTypes.shape({
|
|
60
45
|
url: PropTypes.string
|
|
61
46
|
}).isRequired,
|
|
@@ -73,7 +58,8 @@ ListingTableContent.defaultProps = {
|
|
|
73
58
|
onClickRow: () => {},
|
|
74
59
|
overScanBuffer: 0,
|
|
75
60
|
scrollToIndex: 0,
|
|
76
|
-
onRenderItems: () => {}
|
|
61
|
+
onRenderItems: () => {},
|
|
62
|
+
selectedMenuItem: null
|
|
77
63
|
};
|
|
78
64
|
|
|
79
65
|
export default withRouter(ListingTableContent);
|
|
@@ -3,18 +3,22 @@ import { Link } from 'react-router-dom';
|
|
|
3
3
|
import TableActions from '../TableActions';
|
|
4
4
|
import { ACTIONS } from '../../../constants';
|
|
5
5
|
|
|
6
|
-
const formatRows = ({ rows, url, toggleModal, label, firstColumn = 'name' }) =>
|
|
6
|
+
const formatRows = ({ rows, url, toggleModal, label, firstColumn = 'name', isEnquiry }) =>
|
|
7
7
|
rows.map(data => {
|
|
8
8
|
const editUrl = `${url}/update/${data.id}`;
|
|
9
|
-
|
|
9
|
+
const rowProps = {
|
|
10
10
|
...data,
|
|
11
11
|
[firstColumn]: (
|
|
12
12
|
<Link to={editUrl} role="button">
|
|
13
13
|
{data[firstColumn]}
|
|
14
14
|
</Link>
|
|
15
|
-
)
|
|
16
|
-
actions: <TableActions editUrl={editUrl} data={data} showDeleteModal={toggleModal} />
|
|
15
|
+
)
|
|
17
16
|
};
|
|
17
|
+
if (!isEnquiry)
|
|
18
|
+
rowProps.actions = (
|
|
19
|
+
<TableActions editUrl={editUrl} data={data} showDeleteModal={toggleModal} />
|
|
20
|
+
);
|
|
21
|
+
return rowProps;
|
|
18
22
|
});
|
|
19
23
|
|
|
20
24
|
const getSanitizedColumnLabel = columnProp => {
|
|
@@ -28,22 +32,82 @@ const getSanitizedColumnLabel = columnProp => {
|
|
|
28
32
|
return sanitizedChar;
|
|
29
33
|
};
|
|
30
34
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const buildArrayRowContent = rowData => (
|
|
36
|
+
<div className="table-row-list">
|
|
37
|
+
{rowData.map(rowGroup => (
|
|
38
|
+
<div className="table-row-list__group">
|
|
39
|
+
{rowGroup.map(({ label, value, url }) => (
|
|
40
|
+
<div className="table-row-list__group__item">
|
|
41
|
+
<span className="table-row-list__group__item__label"> {label}:</span>
|
|
42
|
+
{url ? (
|
|
43
|
+
<Link to={url} role="button" className="table-row-list__group__item__value">
|
|
44
|
+
{value}
|
|
45
|
+
</Link>
|
|
46
|
+
) : (
|
|
47
|
+
<span className="table-row-list__group__item__value"> {value}</span>
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
))}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const buildArrayRowData = rowData => {
|
|
57
|
+
const dataGroups = [];
|
|
58
|
+
const groups = Math.ceil(rowData.length / 3) || 1;
|
|
59
|
+
for (let index = 0; index < groups; index += 1) {
|
|
60
|
+
const currentStart = index * groups;
|
|
61
|
+
dataGroups[index] = rowData.slice(currentStart, currentStart + 3);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return buildArrayRowContent(dataGroups);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const getParsedRowData = rows =>
|
|
68
|
+
rows.map(rowData =>
|
|
69
|
+
Object.keys(rowData).reduce((acc, key) => {
|
|
70
|
+
const parsedData = Array.isArray(rowData[key])
|
|
71
|
+
? buildArrayRowData(rowData[key])
|
|
72
|
+
: rowData[key];
|
|
73
|
+
return { ...acc, [key]: parsedData };
|
|
74
|
+
}, {})
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const getColumnsAndLabels = (listingProperties, allProperties, rows) => {
|
|
78
|
+
const columns = [];
|
|
79
|
+
const labels = {};
|
|
80
|
+
|
|
81
|
+
listingProperties.forEach(listingProperty => {
|
|
82
|
+
const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;
|
|
83
|
+
const { label } = allProperties[propKey] || {};
|
|
84
|
+
columns.push(propKey);
|
|
85
|
+
labels[propKey] = label || getSanitizedColumnLabel(propKey);
|
|
86
|
+
});
|
|
87
|
+
const parsedRowData = getParsedRowData(rows);
|
|
88
|
+
|
|
89
|
+
return { columns, labels, parsedRowData };
|
|
37
90
|
};
|
|
38
91
|
|
|
39
92
|
const populateRows = ({ toggleModal, url, entitySchema, rows }) => {
|
|
40
|
-
const {
|
|
41
|
-
|
|
93
|
+
const {
|
|
94
|
+
id: schemaId,
|
|
95
|
+
listingProperties,
|
|
96
|
+
properties,
|
|
97
|
+
dynamicProperties = {},
|
|
98
|
+
formProperties
|
|
99
|
+
} = entitySchema;
|
|
100
|
+
|
|
101
|
+
const isEnquiry = schemaId === 'enquiry';
|
|
102
|
+
const columnOptions = !isEnquiry ? [...listingProperties, ACTIONS] : [...listingProperties];
|
|
103
|
+
|
|
104
|
+
const allProperties = { ...properties, ...dynamicProperties };
|
|
105
|
+
const { columns, labels, parsedRowData } = getColumnsAndLabels(
|
|
106
|
+
columnOptions,
|
|
107
|
+
allProperties,
|
|
108
|
+
rows
|
|
109
|
+
);
|
|
42
110
|
const [firstColumn] = columns;
|
|
43
|
-
const labels = {
|
|
44
|
-
...getColumnLabels(listingProperties, properties, dynamicProperties),
|
|
45
|
-
[ACTIONS]: ACTIONS
|
|
46
|
-
};
|
|
47
111
|
|
|
48
112
|
return {
|
|
49
113
|
identification: 'id',
|
|
@@ -51,8 +115,9 @@ const populateRows = ({ toggleModal, url, entitySchema, rows }) => {
|
|
|
51
115
|
columns,
|
|
52
116
|
labels,
|
|
53
117
|
orderBy: [...formProperties],
|
|
54
|
-
rows: formatRows({ firstColumn, rows, url, toggleModal })
|
|
118
|
+
rows: formatRows({ firstColumn, rows: parsedRowData, url, toggleModal, isEnquiry }),
|
|
119
|
+
isEnquiry
|
|
55
120
|
};
|
|
56
121
|
};
|
|
57
122
|
|
|
58
|
-
export { populateRows, formatRows };
|
|
123
|
+
export { populateRows, formatRows, getParsedRowData };
|