@blaze-cms/plugin-data-ui 0.133.0 → 0.134.0-project-admin-customisations.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.
- package/CHANGELOG.md +45 -0
- package/README.md +42 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +3 -24
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +39 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +12 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib/components/EntityManager/Entity/Entity.js +32 -17
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +44 -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 +45 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +23 -7
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +38 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib/components/InfoBoxes/InfoBoxes.js +36 -0
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +44 -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 +42 -0
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +26 -0
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib/components/InfoBoxes/index.js +12 -0
- package/lib/components/InfoBoxes/index.js.map +1 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js +46 -0
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib/components/ListingTable/ListingTable.js +113 -80
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +8 -20
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +92 -26
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +73 -11
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/index.js +3 -11
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +64 -13
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-listing-query.js +11 -2
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/get-default-query-params.js +3 -4
- package/lib/utils/get-default-query-params.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 +32 -17
- 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 +24 -8
- 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 +46 -49
- 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/index.js +1 -9
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js +49 -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 +10 -9
- 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 +68 -57
- 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 +51 -19
- 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 +57 -38
- 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/index.js +1 -8
- package/src/utils/add-content-menu-items.js +45 -3
- package/src/utils/build-listing-query.js +11 -1
- package/src/utils/get-default-query-params.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListingTableContent.js","names":["React","Table","PropTypes","
|
|
1
|
+
{"version":3,"file":"ListingTableContent.js","names":["React","Table","PropTypes","withRouter","ListingTableContent","tableData","handleSelect","onSort","onClickRow","overScanBuffer","onRenderItems","scrollToIndex","displayTable","rows","length","isEnquiry","className","createElement","Fragment","data","checkboxes","onSelect","propTypes","object","isRequired","match","shape","url","string","func","number","defaultProps","selectedMenuItem"],"sources":["../../../../src/components/ListingTable/ListingTableContent/ListingTableContent.js"],"sourcesContent":["import React from 'react';\nimport Table from '@blaze-react/table';\nimport PropTypes from 'prop-types';\nimport { withRouter } from 'react-router-dom';\n\nconst ListingTableContent = ({\n tableData,\n handleSelect,\n onSort,\n onClickRow,\n overScanBuffer,\n onRenderItems,\n scrollToIndex\n}) => {\n const displayTable = tableData && tableData.rows && !!tableData.rows.length;\n const { isEnquiry } = tableData;\n const className = `page__content${isEnquiry ? ' array-table' : ''}`;\n\n return (\n <>\n {displayTable && (\n <>\n <div className={className}>\n <Table\n scrollToIndex={scrollToIndex}\n onSort={onSort}\n onClickRow={onClickRow}\n overScanBuffer={overScanBuffer}\n onRenderItems={onRenderItems}\n data={tableData}\n checkboxes={!isEnquiry}\n onSelect={handleSelect}\n data-testid=\"listing-table-content\"\n />\n </div>\n </>\n )}\n </>\n );\n};\n\nListingTableContent.propTypes = {\n tableData: PropTypes.object.isRequired,\n match: PropTypes.shape({\n url: PropTypes.string\n }).isRequired,\n handleSelect: PropTypes.func,\n onSort: PropTypes.func,\n onClickRow: PropTypes.func,\n overScanBuffer: PropTypes.number,\n scrollToIndex: PropTypes.number,\n onRenderItems: PropTypes.func\n};\n\nListingTableContent.defaultProps = {\n handleSelect: () => {},\n onSort: () => {},\n onClickRow: () => {},\n overScanBuffer: 0,\n scrollToIndex: 0,\n onRenderItems: () => {},\n selectedMenuItem: null\n};\n\nexport default withRouter(ListingTableContent);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,kBAAkB;AAE7C,MAAMC,mBAAmB,GAAGA,CAAC;EAC3BC,SAAS;EACTC,YAAY;EACZC,MAAM;EACNC,UAAU;EACVC,cAAc;EACdC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAGP,SAAS,IAAIA,SAAS,CAACQ,IAAI,IAAI,CAAC,CAACR,SAAS,CAACQ,IAAI,CAACC,MAAM;EAC3E,MAAM;IAAEC;EAAU,CAAC,GAAGV,SAAS;EAC/B,MAAMW,SAAS,GAAI,gBAAeD,SAAS,GAAG,cAAc,GAAG,EAAG,EAAC;EAEnE,oBACEf,KAAA,CAAAiB,aAAA,CAAAjB,KAAA,CAAAkB,QAAA,QACGN,YAAY,iBACXZ,KAAA,CAAAiB,aAAA,CAAAjB,KAAA,CAAAkB,QAAA,qBACElB,KAAA,CAAAiB,aAAA;IAAKD,SAAS,EAAEA;EAAU,gBACxBhB,KAAA,CAAAiB,aAAA,CAAChB,KAAK;IACJU,aAAa,EAAEA,aAAc;IAC7BJ,MAAM,EAAEA,MAAO;IACfC,UAAU,EAAEA,UAAW;IACvBC,cAAc,EAAEA,cAAe;IAC/BC,aAAa,EAAEA,aAAc;IAC7BS,IAAI,EAAEd,SAAU;IAChBe,UAAU,EAAE,CAACL,SAAU;IACvBM,QAAQ,EAAEf,YAAa;IACvB,eAAY;EAAuB,CACpC,CACE,CACL,CAEJ,CAAC;AAEP,CAAC;AAEDF,mBAAmB,CAACkB,SAAS,GAAG;EAC9BjB,SAAS,EAAEH,SAAS,CAACqB,MAAM,CAACC,UAAU;EACtCC,KAAK,EAAEvB,SAAS,CAACwB,KAAK,CAAC;IACrBC,GAAG,EAAEzB,SAAS,CAAC0B;EACjB,CAAC,CAAC,CAACJ,UAAU;EACblB,YAAY,EAAEJ,SAAS,CAAC2B,IAAI;EAC5BtB,MAAM,EAAEL,SAAS,CAAC2B,IAAI;EACtBrB,UAAU,EAAEN,SAAS,CAAC2B,IAAI;EAC1BpB,cAAc,EAAEP,SAAS,CAAC4B,MAAM;EAChCnB,aAAa,EAAET,SAAS,CAAC4B,MAAM;EAC/BpB,aAAa,EAAER,SAAS,CAAC2B;AAC3B,CAAC;AAEDzB,mBAAmB,CAAC2B,YAAY,GAAG;EACjCzB,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;EAChBC,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,cAAc,EAAE,CAAC;EACjBE,aAAa,EAAE,CAAC;EAChBD,aAAa,EAAEA,CAAA,KAAM,CAAC,CAAC;EACvBsB,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAe7B,UAAU,CAACC,mBAAmB,CAAC"}
|
|
@@ -10,20 +10,22 @@ const formatRows = ({
|
|
|
10
10
|
url,
|
|
11
11
|
toggleModal,
|
|
12
12
|
label,
|
|
13
|
-
firstColumn = 'name'
|
|
13
|
+
firstColumn = 'name',
|
|
14
|
+
isEnquiry
|
|
14
15
|
}) => rows.map(data => {
|
|
15
16
|
const editUrl = `${url}/update/${data.id}`;
|
|
16
|
-
|
|
17
|
+
const rowProps = _objectSpread(_objectSpread({}, data), {}, {
|
|
17
18
|
[firstColumn]: /*#__PURE__*/React.createElement(Link, {
|
|
18
19
|
to: editUrl,
|
|
19
20
|
role: "button"
|
|
20
|
-
}, data[firstColumn])
|
|
21
|
-
actions: /*#__PURE__*/React.createElement(TableActions, {
|
|
22
|
-
editUrl: editUrl,
|
|
23
|
-
data: data,
|
|
24
|
-
showDeleteModal: toggleModal
|
|
25
|
-
})
|
|
21
|
+
}, data[firstColumn])
|
|
26
22
|
});
|
|
23
|
+
if (!isEnquiry) rowProps.actions = /*#__PURE__*/React.createElement(TableActions, {
|
|
24
|
+
editUrl: editUrl,
|
|
25
|
+
data: data,
|
|
26
|
+
showDeleteModal: toggleModal
|
|
27
|
+
});
|
|
28
|
+
return rowProps;
|
|
27
29
|
});
|
|
28
30
|
const getSanitizedColumnLabel = columnProp => {
|
|
29
31
|
let sanitizedChar = '';
|
|
@@ -32,14 +34,57 @@ const getSanitizedColumnLabel = columnProp => {
|
|
|
32
34
|
}
|
|
33
35
|
return sanitizedChar;
|
|
34
36
|
};
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const buildArrayRowContent = rowData => /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "table-row-list"
|
|
39
|
+
}, rowData.map(rowGroup => /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "table-row-list__group"
|
|
41
|
+
}, rowGroup.map(({
|
|
42
|
+
label,
|
|
43
|
+
value,
|
|
44
|
+
url
|
|
45
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "table-row-list__group__item"
|
|
47
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
48
|
+
className: "table-row-list__group__item__label"
|
|
49
|
+
}, " ", label, ":"), url ? /*#__PURE__*/React.createElement(Link, {
|
|
50
|
+
to: url,
|
|
51
|
+
role: "button",
|
|
52
|
+
className: "table-row-list__group__item__value"
|
|
53
|
+
}, value) : /*#__PURE__*/React.createElement("span", {
|
|
54
|
+
className: "table-row-list__group__item__value"
|
|
55
|
+
}, " ", value))))));
|
|
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
|
+
return buildArrayRowContent(dataGroups);
|
|
64
|
+
};
|
|
65
|
+
const getParsedRowData = rows => rows.map(rowData => Object.keys(rowData).reduce((acc, key) => {
|
|
66
|
+
const parsedData = Array.isArray(rowData[key]) ? buildArrayRowData(rowData[key]) : rowData[key];
|
|
67
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
68
|
+
[key]: parsedData
|
|
69
|
+
});
|
|
70
|
+
}, {}));
|
|
71
|
+
const getColumnsAndLabels = (listingProperties, allProperties, rows) => {
|
|
72
|
+
const columns = [];
|
|
73
|
+
const labels = {};
|
|
74
|
+
listingProperties.forEach(listingProperty => {
|
|
75
|
+
const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;
|
|
76
|
+
const {
|
|
77
|
+
label
|
|
78
|
+
} = allProperties[propKey] || {};
|
|
79
|
+
columns.push(propKey);
|
|
80
|
+
labels[propKey] = label || getSanitizedColumnLabel(propKey);
|
|
81
|
+
});
|
|
82
|
+
const parsedRowData = getParsedRowData(rows);
|
|
83
|
+
return {
|
|
84
|
+
columns,
|
|
85
|
+
labels,
|
|
86
|
+
parsedRowData
|
|
87
|
+
};
|
|
43
88
|
};
|
|
44
89
|
const populateRows = ({
|
|
45
90
|
toggleModal,
|
|
@@ -48,16 +93,21 @@ const populateRows = ({
|
|
|
48
93
|
rows
|
|
49
94
|
}) => {
|
|
50
95
|
const {
|
|
96
|
+
id: schemaId,
|
|
51
97
|
listingProperties,
|
|
52
98
|
properties,
|
|
53
99
|
dynamicProperties = {},
|
|
54
100
|
formProperties
|
|
55
101
|
} = entitySchema;
|
|
56
|
-
const
|
|
102
|
+
const isEnquiry = schemaId === 'enquiry';
|
|
103
|
+
const columnOptions = !isEnquiry ? [...listingProperties, ACTIONS] : [...listingProperties];
|
|
104
|
+
const allProperties = _objectSpread(_objectSpread({}, properties), dynamicProperties);
|
|
105
|
+
const {
|
|
106
|
+
columns,
|
|
107
|
+
labels,
|
|
108
|
+
parsedRowData
|
|
109
|
+
} = getColumnsAndLabels(columnOptions, allProperties, rows);
|
|
57
110
|
const [firstColumn] = columns;
|
|
58
|
-
const labels = _objectSpread(_objectSpread({}, getColumnLabels(listingProperties, properties, dynamicProperties)), {}, {
|
|
59
|
-
[ACTIONS]: ACTIONS
|
|
60
|
-
});
|
|
61
111
|
return {
|
|
62
112
|
identification: 'id',
|
|
63
113
|
sort: null,
|
|
@@ -66,11 +116,13 @@ const populateRows = ({
|
|
|
66
116
|
orderBy: [...formProperties],
|
|
67
117
|
rows: formatRows({
|
|
68
118
|
firstColumn,
|
|
69
|
-
rows,
|
|
119
|
+
rows: parsedRowData,
|
|
70
120
|
url,
|
|
71
|
-
toggleModal
|
|
72
|
-
|
|
121
|
+
toggleModal,
|
|
122
|
+
isEnquiry
|
|
123
|
+
}),
|
|
124
|
+
isEnquiry
|
|
73
125
|
};
|
|
74
126
|
};
|
|
75
|
-
export { populateRows, formatRows };
|
|
127
|
+
export { populateRows, formatRows, getParsedRowData };
|
|
76
128
|
//# sourceMappingURL=populate-rows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate-rows.js","names":["React","Link","TableActions","ACTIONS","formatRows","rows","url","toggleModal","label","firstColumn","map","data","editUrl","id","_objectSpread","createElement","to","role","actions","showDeleteModal","getSanitizedColumnLabel","columnProp","sanitizedChar","index","length","toUpperCase","toLowerCase","
|
|
1
|
+
{"version":3,"file":"populate-rows.js","names":["React","Link","TableActions","ACTIONS","formatRows","rows","url","toggleModal","label","firstColumn","isEnquiry","map","data","editUrl","id","rowProps","_objectSpread","createElement","to","role","actions","showDeleteModal","getSanitizedColumnLabel","columnProp","sanitizedChar","index","length","toUpperCase","toLowerCase","buildArrayRowContent","rowData","className","rowGroup","value","buildArrayRowData","dataGroups","groups","Math","ceil","currentStart","slice","getParsedRowData","Object","keys","reduce","acc","key","parsedData","Array","isArray","getColumnsAndLabels","listingProperties","allProperties","columns","labels","forEach","listingProperty","propKey","includes","split","push","parsedRowData","populateRows","entitySchema","schemaId","properties","dynamicProperties","formProperties","columnOptions","identification","sort","orderBy"],"sources":["../../../../src/components/ListingTable/mappers/populate-rows.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport TableActions from '../TableActions';\nimport { ACTIONS } from '../../../constants';\n\nconst formatRows = ({ rows, url, toggleModal, label, firstColumn = 'name', isEnquiry }) =>\n rows.map(data => {\n const editUrl = `${url}/update/${data.id}`;\n const rowProps = {\n ...data,\n [firstColumn]: (\n <Link to={editUrl} role=\"button\">\n {data[firstColumn]}\n </Link>\n )\n };\n if (!isEnquiry)\n rowProps.actions = (\n <TableActions editUrl={editUrl} data={data} showDeleteModal={toggleModal} />\n );\n return rowProps;\n });\n\nconst getSanitizedColumnLabel = columnProp => {\n let sanitizedChar = '';\n\n for (let index = 0; index < columnProp.length; index += 1) {\n if (index && columnProp[index] === columnProp[index].toUpperCase())\n sanitizedChar = `${sanitizedChar} ${columnProp[index].toLowerCase()}`;\n else sanitizedChar += columnProp[index];\n }\n return sanitizedChar;\n};\n\nconst buildArrayRowContent = rowData => (\n <div className=\"table-row-list\">\n {rowData.map(rowGroup => (\n <div className=\"table-row-list__group\">\n {rowGroup.map(({ label, value, url }) => (\n <div className=\"table-row-list__group__item\">\n <span className=\"table-row-list__group__item__label\"> {label}:</span>\n {url ? (\n <Link to={url} role=\"button\" className=\"table-row-list__group__item__value\">\n {value}\n </Link>\n ) : (\n <span className=\"table-row-list__group__item__value\"> {value}</span>\n )}\n </div>\n ))}\n </div>\n ))}\n </div>\n);\n\nconst buildArrayRowData = rowData => {\n const dataGroups = [];\n const groups = Math.ceil(rowData.length / 3) || 1;\n for (let index = 0; index < groups; index += 1) {\n const currentStart = index * groups;\n dataGroups[index] = rowData.slice(currentStart, currentStart + 3);\n }\n\n return buildArrayRowContent(dataGroups);\n};\n\nconst getParsedRowData = rows =>\n rows.map(rowData =>\n Object.keys(rowData).reduce((acc, key) => {\n const parsedData = Array.isArray(rowData[key])\n ? buildArrayRowData(rowData[key])\n : rowData[key];\n return { ...acc, [key]: parsedData };\n }, {})\n );\n\nconst getColumnsAndLabels = (listingProperties, allProperties, rows) => {\n const columns = [];\n const labels = {};\n\n listingProperties.forEach(listingProperty => {\n const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;\n const { label } = allProperties[propKey] || {};\n columns.push(propKey);\n labels[propKey] = label || getSanitizedColumnLabel(propKey);\n });\n const parsedRowData = getParsedRowData(rows);\n\n return { columns, labels, parsedRowData };\n};\n\nconst populateRows = ({ toggleModal, url, entitySchema, rows }) => {\n const {\n id: schemaId,\n listingProperties,\n properties,\n dynamicProperties = {},\n formProperties\n } = entitySchema;\n\n const isEnquiry = schemaId === 'enquiry';\n const columnOptions = !isEnquiry ? [...listingProperties, ACTIONS] : [...listingProperties];\n\n const allProperties = { ...properties, ...dynamicProperties };\n const { columns, labels, parsedRowData } = getColumnsAndLabels(\n columnOptions,\n allProperties,\n rows\n );\n const [firstColumn] = columns;\n\n return {\n identification: 'id',\n sort: null,\n columns,\n labels,\n orderBy: [...formProperties],\n rows: formatRows({ firstColumn, rows: parsedRowData, url, toggleModal, isEnquiry }),\n isEnquiry\n };\n};\n\nexport { populateRows, formatRows, getParsedRowData };\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,IAAI;EAAEC,GAAG;EAAEC,WAAW;EAAEC,KAAK;EAAEC,WAAW,GAAG,MAAM;EAAEC;AAAU,CAA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C,GAAG,CAAC,GAAGgD,iBAAiB,CAAC;EAE3F,MAAMC,aAAa,GAAApC,aAAA,CAAAA,aAAA,KAAQiD,UAAU,GAAKC,iBAAiB,CAAE;EAC7D,MAAM;IAAEb,OAAO;IAAEC,MAAM;IAAEO;EAAc,CAAC,GAAGX,mBAAmB,CAC5DkB,aAAa,EACbhB,aAAa,EACb/C,IACF,CAAC;EACD,MAAM,CAACI,WAAW,CAAC,GAAG4C,OAAO;EAE7B,OAAO;IACLgB,cAAc,EAAE,IAAI;IACpBC,IAAI,EAAE,IAAI;IACVjB,OAAO;IACPC,MAAM;IACNiB,OAAO,EAAE,CAAC,GAAGJ,cAAc,CAAC;IAC5B9D,IAAI,EAAED,UAAU,CAAC;MAAEK,WAAW;MAAEJ,IAAI,EAAEwD,aAAa;MAAEvD,GAAG;MAAEC,WAAW;MAAEG;IAAU,CAAC,CAAC;IACnFA;EACF,CAAC;AACH,CAAC;AAED,SAASoD,YAAY,EAAE1D,UAAU,EAAEqC,gBAAgB"}
|
|
@@ -1,22 +1,80 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import buildListingQuery from '../../../utils/build-listing-query';
|
|
5
|
+
function buildVariables({
|
|
6
|
+
entitySchema,
|
|
7
|
+
isSearchQuery,
|
|
8
|
+
listFilters = [],
|
|
9
|
+
queryParams = {}
|
|
10
|
+
}) {
|
|
11
|
+
const {
|
|
12
|
+
identifier
|
|
13
|
+
} = entitySchema;
|
|
14
|
+
const {
|
|
15
|
+
sort,
|
|
16
|
+
offset,
|
|
17
|
+
limit,
|
|
18
|
+
where
|
|
19
|
+
} = queryParams;
|
|
20
|
+
const [{
|
|
21
|
+
property,
|
|
22
|
+
direction
|
|
23
|
+
}] = sort;
|
|
24
|
+
const parsedOffset = `${property}:${direction}`;
|
|
25
|
+
if (!isSearchQuery) return _objectSpread(_objectSpread({}, queryParams), {}, {
|
|
26
|
+
where: !Array.isArray(listFilters) ? listFilters : where
|
|
27
|
+
});
|
|
28
|
+
const rawQuery = {
|
|
29
|
+
bool: {
|
|
30
|
+
must: listFilters || [],
|
|
31
|
+
filter: [{
|
|
32
|
+
term: {
|
|
33
|
+
entityIdentifier: identifier
|
|
34
|
+
}
|
|
35
|
+
}]
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
limit,
|
|
40
|
+
offset,
|
|
41
|
+
sort: parsedOffset,
|
|
42
|
+
where: JSON.stringify(rawQuery)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
2
45
|
const fetchData = async ({
|
|
3
46
|
client,
|
|
4
47
|
querySettings: {
|
|
5
48
|
entitySchema,
|
|
6
49
|
queryParams
|
|
7
|
-
}
|
|
50
|
+
},
|
|
51
|
+
listFilters
|
|
8
52
|
}) => {
|
|
9
|
-
const query = buildListingQuery(entitySchema);
|
|
10
53
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
54
|
+
displayProperties: {
|
|
55
|
+
adminListings: {
|
|
56
|
+
dataSource: {
|
|
57
|
+
source
|
|
58
|
+
} = {}
|
|
59
|
+
} = {}
|
|
60
|
+
} = {}
|
|
61
|
+
} = entitySchema;
|
|
62
|
+
const isSearchQuery = source === 'search';
|
|
63
|
+
const query = buildListingQuery(entitySchema, isSearchQuery);
|
|
64
|
+
const variables = buildVariables({
|
|
65
|
+
entitySchema,
|
|
66
|
+
listFilters,
|
|
67
|
+
queryParams,
|
|
68
|
+
isSearchQuery
|
|
69
|
+
});
|
|
70
|
+
const {
|
|
71
|
+
data = {}
|
|
14
72
|
} = await client.query({
|
|
15
73
|
query,
|
|
16
|
-
variables
|
|
74
|
+
variables,
|
|
17
75
|
fetchPolicy: 'network-only'
|
|
18
76
|
});
|
|
19
|
-
return listingData;
|
|
77
|
+
return data.searchResults ? data.searchResults.results : data.listingData;
|
|
20
78
|
};
|
|
21
79
|
export { fetchData };
|
|
22
80
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["buildListingQuery","fetchData","client","querySettings","
|
|
1
|
+
{"version":3,"file":"index.js","names":["buildListingQuery","buildVariables","entitySchema","isSearchQuery","listFilters","queryParams","identifier","sort","offset","limit","where","property","direction","parsedOffset","_objectSpread","Array","isArray","rawQuery","bool","must","filter","term","entityIdentifier","JSON","stringify","fetchData","client","querySettings","displayProperties","adminListings","dataSource","source","query","variables","data","fetchPolicy","searchResults","results","listingData"],"sources":["../../../../src/components/ListingTable/service/index.js"],"sourcesContent":["import buildListingQuery from '../../../utils/build-listing-query';\n\nfunction buildVariables({ entitySchema, isSearchQuery, listFilters = [], queryParams = {} }) {\n const { identifier } = entitySchema;\n const { sort, offset, limit, where } = queryParams;\n const [{ property, direction }] = sort;\n const parsedOffset = `${property}:${direction}`;\n\n if (!isSearchQuery)\n return {\n ...queryParams,\n where: !Array.isArray(listFilters) ? listFilters : where\n };\n\n const rawQuery = {\n bool: {\n must: listFilters || [],\n filter: [\n {\n term: {\n entityIdentifier: identifier\n }\n }\n ]\n }\n };\n\n return {\n limit,\n offset,\n sort: parsedOffset,\n where: JSON.stringify(rawQuery)\n };\n}\n\nconst fetchData = async ({ client, querySettings: { entitySchema, queryParams }, listFilters }) => {\n const {\n displayProperties: { adminListings: { dataSource: { source } = {} } = {} } = {}\n } = entitySchema;\n\n const isSearchQuery = source === 'search';\n const query = buildListingQuery(entitySchema, isSearchQuery);\n const variables = buildVariables({ entitySchema, listFilters, queryParams, isSearchQuery });\n const { data = {} } = await client.query({ query, variables, fetchPolicy: 'network-only' });\n\n return data.searchResults ? data.searchResults.results : data.listingData;\n};\n\nexport { fetchData };\n"],"mappings":";;;AAAA,OAAOA,iBAAiB,MAAM,oCAAoC;AAElE,SAASC,cAAcA,CAAC;EAAEC,YAAY;EAAEC,aAAa;EAAEC,WAAW,GAAG,EAAE;EAAEC,WAAW,GAAG,CAAC;AAAE,CAAC,EAAE;EAC3F,MAAM;IAAEC;EAAW,CAAC,GAAGJ,YAAY;EACnC,MAAM;IAAEK,IAAI;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGL,WAAW;EAClD,MAAM,CAAC;IAAEM,QAAQ;IAAEC;EAAU,CAAC,CAAC,GAAGL,IAAI;EACtC,MAAMM,YAAY,GAAI,GAAEF,QAAS,IAAGC,SAAU,EAAC;EAE/C,IAAI,CAACT,aAAa,EAChB,OAAAW,aAAA,CAAAA,aAAA,KACKT,WAAW;IACdK,KAAK,EAAE,CAACK,KAAK,CAACC,OAAO,CAACZ,WAAW,CAAC,GAAGA,WAAW,GAAGM;EAAK;EAG5D,MAAMO,QAAQ,GAAG;IACfC,IAAI,EAAE;MACJC,IAAI,EAAEf,WAAW,IAAI,EAAE;MACvBgB,MAAM,EAAE,CACN;QACEC,IAAI,EAAE;UACJC,gBAAgB,EAAEhB;QACpB;MACF,CAAC;IAEL;EACF,CAAC;EAED,OAAO;IACLG,KAAK;IACLD,MAAM;IACND,IAAI,EAAEM,YAAY;IAClBH,KAAK,EAAEa,IAAI,CAACC,SAAS,CAACP,QAAQ;EAChC,CAAC;AACH;AAEA,MAAMQ,SAAS,GAAG,MAAAA,CAAO;EAAEC,MAAM;EAAEC,aAAa,EAAE;IAAEzB,YAAY;IAAEG;EAAY,CAAC;EAAED;AAAY,CAAC,KAAK;EACjG,MAAM;IACJwB,iBAAiB,EAAE;MAAEC,aAAa,EAAE;QAAEC,UAAU,EAAE;UAAEC;QAAO,CAAC,GAAG,CAAC;MAAE,CAAC,GAAG,CAAC;IAAE,CAAC,GAAG,CAAC;EAChF,CAAC,GAAG7B,YAAY;EAEhB,MAAMC,aAAa,GAAG4B,MAAM,KAAK,QAAQ;EACzC,MAAMC,KAAK,GAAGhC,iBAAiB,CAACE,YAAY,EAAEC,aAAa,CAAC;EAC5D,MAAM8B,SAAS,GAAGhC,cAAc,CAAC;IAAEC,YAAY;IAAEE,WAAW;IAAEC,WAAW;IAAEF;EAAc,CAAC,CAAC;EAC3F,MAAM;IAAE+B,IAAI,GAAG,CAAC;EAAE,CAAC,GAAG,MAAMR,MAAM,CAACM,KAAK,CAAC;IAAEA,KAAK;IAAEC,SAAS;IAAEE,WAAW,EAAE;EAAe,CAAC,CAAC;EAE3F,OAAOD,IAAI,CAACE,aAAa,GAAGF,IAAI,CAACE,aAAa,CAACC,OAAO,GAAGH,IAAI,CAACI,WAAW;AAC3E,CAAC;AAED,SAASb,SAAS"}
|
package/lib-es/index.js
CHANGED
|
@@ -6,15 +6,7 @@ import getAddContentMenuItems from './utils/add-content-menu-items';
|
|
|
6
6
|
const EntityDataListing = React.lazy(() => import( /* webpackChunkName: 'EntityDataListing' */'./components/EntityDataListing'));
|
|
7
7
|
const EntityManager = React.lazy(() => import( /* webpackChunkName: 'EntityManager' */'./components/EntityManager'));
|
|
8
8
|
export default async function load(app) {
|
|
9
|
-
|
|
10
|
-
const sectionKey = 'content';
|
|
11
|
-
app.events.once('load:menu-section', addSection => {
|
|
12
|
-
addSection(sectionKey, {
|
|
13
|
-
header: 'content',
|
|
14
|
-
order: 100
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
app.events.once('load:menu-items', getAddContentMenuItems(app, sectionKey));
|
|
9
|
+
app.events.once('admin:menu:config:load', getAddContentMenuItems(app));
|
|
18
10
|
app.events.once('load:custom:field:type', addFieldType => {
|
|
19
11
|
Object.keys(formFieldTypes).forEach(type => {
|
|
20
12
|
addFieldType({
|
package/lib-es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getFormBuilderLookup","formFieldTypes","React","pkg","DATA_LISTING_PREFIX","PLUGIN_NAME","getAddContentMenuItems","EntityDataListing","lazy","EntityManager","load","app","
|
|
1
|
+
{"version":3,"file":"index.js","names":["getFormBuilderLookup","formFieldTypes","React","pkg","DATA_LISTING_PREFIX","PLUGIN_NAME","getAddContentMenuItems","EntityDataListing","lazy","EntityManager","load","app","events","once","addFieldType","Object","keys","forEach","type","component","emitAsync","entityDataListingRoute","path","key","exact","editEntityRoute","addEntityRoute","addRoute","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';\nimport React from 'react';\nimport pkg from '../package.json';\nimport { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';\nimport getAddContentMenuItems from './utils/add-content-menu-items';\n\nconst EntityDataListing = React.lazy(() =>\n import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')\n);\nconst EntityManager = React.lazy(() =>\n import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')\n);\n\nexport default async function load(app) {\n app.events.once('admin:menu:config:load', getAddContentMenuItems(app));\n\n app.events.once('load:custom:field:type', addFieldType => {\n Object.keys(formFieldTypes).forEach(type => {\n addFieldType({ type, component: formFieldTypes[type] });\n });\n });\n\n app.events.once('plugin:data-ui:load:loaded', async () => {\n await app.events.emitAsync('load:custom:field:type', getFormBuilderLookup.addFieldType);\n });\n\n const entityDataListingRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier`,\n key: 'entityDataListing',\n component: EntityDataListing,\n exact: true\n };\n\n const editEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action/:id`,\n key: 'editEntity',\n component: EntityManager,\n exact: true\n };\n\n const addEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action`,\n key: 'createEntity',\n component: EntityManager,\n exact: true\n };\n\n app.addRoute(entityDataListingRoute);\n app.addRoute(editEntityRoute);\n app.addRoute(addEntityRoute);\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"AAAA,SAASA,oBAAoB,EAAEC,cAAc,QAAQ,+BAA+B;AACpF,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,mBAAmB,EAAEC,WAAW,QAAQ,aAAa;AAC9D,OAAOC,sBAAsB,MAAM,gCAAgC;AAEnE,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,IAAI,CAAC,MACnC,MAAM,EAAC,2CAA4C,gCAAgC,CACrF,CAAC;AACD,MAAMC,aAAa,GAAGP,KAAK,CAACM,IAAI,CAAC,MAC/B,MAAM,EAAC,uCAAwC,4BAA4B,CAC7E,CAAC;AAED,eAAe,eAAeE,IAAIA,CAACC,GAAG,EAAE;EACtCA,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,wBAAwB,EAAEP,sBAAsB,CAACK,GAAG,CAAC,CAAC;EAEtEA,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,wBAAwB,EAAEC,YAAY,IAAI;IACxDC,MAAM,CAACC,IAAI,CAACf,cAAc,CAAC,CAACgB,OAAO,CAACC,IAAI,IAAI;MAC1CJ,YAAY,CAAC;QAAEI,IAAI;QAAEC,SAAS,EAAElB,cAAc,CAACiB,IAAI;MAAE,CAAC,CAAC;IACzD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFP,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,4BAA4B,EAAE,YAAY;IACxD,MAAMF,GAAG,CAACC,MAAM,CAACQ,SAAS,CAAC,wBAAwB,EAAEpB,oBAAoB,CAACc,YAAY,CAAC;EACzF,CAAC,CAAC;EAEF,MAAMO,sBAAsB,GAAG;IAC7BC,IAAI,EAAG,GAAElB,mBAAoB,oBAAmB;IAChDmB,GAAG,EAAE,mBAAmB;IACxBJ,SAAS,EAAEZ,iBAAiB;IAC5BiB,KAAK,EAAE;EACT,CAAC;EAED,MAAMC,eAAe,GAAG;IACtBH,IAAI,EAAG,GAAElB,mBAAoB,gCAA+B;IAC5DmB,GAAG,EAAE,YAAY;IACjBJ,SAAS,EAAEV,aAAa;IACxBe,KAAK,EAAE;EACT,CAAC;EAED,MAAME,cAAc,GAAG;IACrBJ,IAAI,EAAG,GAAElB,mBAAoB,4BAA2B;IACxDmB,GAAG,EAAE,cAAc;IACnBJ,SAAS,EAAEV,aAAa;IACxBe,KAAK,EAAE;EACT,CAAC;EAEDb,GAAG,CAACgB,QAAQ,CAACN,sBAAsB,CAAC;EACpCV,GAAG,CAACgB,QAAQ,CAACF,eAAe,CAAC;EAC7Bd,GAAG,CAACgB,QAAQ,CAACD,cAAc,CAAC;EAE5B,OAAO;IACLE,IAAI,EAAEvB,WAAW;IACjBwB,OAAO,EAAE1B,GAAG,CAAC0B;EACf,CAAC;AACH;AAEAnB,IAAI,CAACoB,UAAU,GAAGzB,WAAW"}
|
|
@@ -2,8 +2,10 @@ import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
|
2
2
|
const {
|
|
3
3
|
MENU_PERMISSIONS
|
|
4
4
|
} = require('../constants');
|
|
5
|
-
function getAddContentMenuItems(app
|
|
6
|
-
return async
|
|
5
|
+
function getAddContentMenuItems(app) {
|
|
6
|
+
return async ({
|
|
7
|
+
addConfig
|
|
8
|
+
}) => {
|
|
7
9
|
const client = app.getClient();
|
|
8
10
|
const {
|
|
9
11
|
data: {
|
|
@@ -16,15 +18,57 @@ function getAddContentMenuItems(app, sectionKey) {
|
|
|
16
18
|
canDoActions: MENU_PERMISSIONS
|
|
17
19
|
}
|
|
18
20
|
});
|
|
21
|
+
if (!getEntitySchemas || !getEntitySchemas.length) return; // no items so don't add section
|
|
22
|
+
|
|
23
|
+
const menuItems = {};
|
|
24
|
+
const sectionMenuItems = {
|
|
25
|
+
content: {}
|
|
26
|
+
};
|
|
27
|
+
getEntitySchemas.forEach(({
|
|
28
|
+
id,
|
|
29
|
+
displayName,
|
|
30
|
+
displayProperties
|
|
31
|
+
}) => {
|
|
32
|
+
if (!displayProperties) return null;
|
|
33
|
+
const {
|
|
34
|
+
adminMenu: {
|
|
35
|
+
sectionKey = 'content'
|
|
36
|
+
} = {}
|
|
37
|
+
} = displayProperties;
|
|
38
|
+
const sectionItems = sectionMenuItems[sectionKey] || {};
|
|
39
|
+
sectionItems[id] = {
|
|
40
|
+
label: displayName,
|
|
41
|
+
uri: `/data-listing/${id}`
|
|
42
|
+
};
|
|
43
|
+
sectionMenuItems[sectionKey] = sectionItems;
|
|
44
|
+
});
|
|
45
|
+
const menuConfig = {
|
|
46
|
+
main: {
|
|
47
|
+
items: {
|
|
48
|
+
content: {
|
|
49
|
+
label: 'Content',
|
|
50
|
+
loadOpen: true,
|
|
51
|
+
order: 10,
|
|
52
|
+
items: menuItems
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
Object.entries(sectionMenuItems).forEach(([sectionKey, sectionItems]) => {
|
|
58
|
+
const sectionConfig = menuConfig.main.items[sectionKey] || {};
|
|
59
|
+
sectionConfig.items = sectionItems;
|
|
60
|
+
menuConfig.main.items[sectionKey] = sectionConfig;
|
|
61
|
+
});
|
|
19
62
|
getEntitySchemas.forEach(({
|
|
20
63
|
id,
|
|
21
64
|
displayName
|
|
22
65
|
}) => {
|
|
23
|
-
|
|
24
|
-
|
|
66
|
+
menuItems[id] = {
|
|
67
|
+
label: displayName,
|
|
25
68
|
uri: `/data-listing/${id}`
|
|
26
|
-
}
|
|
69
|
+
};
|
|
27
70
|
});
|
|
71
|
+
addConfig(menuConfig);
|
|
28
72
|
};
|
|
29
73
|
}
|
|
30
74
|
export default getAddContentMenuItems;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-content-menu-items.js","names":["getQuery","MENU_PERMISSIONS","require","getAddContentMenuItems","app","
|
|
1
|
+
{"version":3,"file":"add-content-menu-items.js","names":["getQuery","MENU_PERMISSIONS","require","getAddContentMenuItems","app","addConfig","client","getClient","data","getEntitySchemas","query","variables","canDoActions","length","menuItems","sectionMenuItems","content","forEach","id","displayName","displayProperties","adminMenu","sectionKey","sectionItems","label","uri","menuConfig","main","items","loadOpen","order","Object","entries","sectionConfig"],"sources":["../../src/utils/add-content-menu-items.js"],"sourcesContent":["import { getQuery } from '@blaze-cms/admin-ui-utils';\n\nconst { MENU_PERMISSIONS } = require('../constants');\n\nfunction getAddContentMenuItems(app) {\n return async ({ addConfig }) => {\n const client = app.getClient();\n const {\n data: { getEntitySchemas }\n } = await client.query({\n query: getQuery('GET_USER_EDITABLE_ENTITIES'),\n variables: {\n // only return entities that the current user can do the following actions on\n canDoActions: MENU_PERMISSIONS\n }\n });\n\n if (!getEntitySchemas || !getEntitySchemas.length) return; // no items so don't add section\n\n const menuItems = {};\n const sectionMenuItems = { content: {} };\n\n getEntitySchemas.forEach(({ id, displayName, displayProperties }) => {\n if (!displayProperties) return null;\n\n const { adminMenu: { sectionKey = 'content' } = {} } = displayProperties;\n const sectionItems = sectionMenuItems[sectionKey] || {};\n sectionItems[id] = {\n label: displayName,\n uri: `/data-listing/${id}`\n };\n sectionMenuItems[sectionKey] = sectionItems;\n });\n\n const menuConfig = {\n main: {\n items: {\n content: {\n label: 'Content',\n loadOpen: true,\n order: 10,\n items: menuItems\n }\n }\n }\n };\n\n Object.entries(sectionMenuItems).forEach(([sectionKey, sectionItems]) => {\n const sectionConfig = menuConfig.main.items[sectionKey] || {};\n sectionConfig.items = sectionItems;\n menuConfig.main.items[sectionKey] = sectionConfig;\n });\n\n getEntitySchemas.forEach(({ id, displayName }) => {\n menuItems[id] = {\n label: displayName,\n uri: `/data-listing/${id}`\n };\n });\n\n addConfig(menu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E;UACLZ,OAAO,EAAE;YACPQ,KAAK,EAAE,SAAS;YAChBK,QAAQ,EAAE,IAAI;YACdC,KAAK,EAAE,EAAE;YACTF,KAAK,EAAEd;UACT;QACF;MACF;IACF,CAAC;IAEDiB,MAAM,CAACC,OAAO,CAACjB,gBAAgB,CAAC,CAACE,OAAO,CAAC,CAAC,CAACK,UAAU,EAAEC,YAAY,CAAC,KAAK;MACvE,MAAMU,aAAa,GAAGP,UAAU,CAACC,IAAI,CAACC,KAAK,CAACN,UAAU,CAAC,IAAI,CAAC,CAAC;MAC7DW,aAAa,CAACL,KAAK,GAAGL,YAAY;MAClCG,UAAU,CAACC,IAAI,CAACC,KAAK,CAACN,UAAU,CAAC,GAAGW,aAAa;IACnD,CAAC,CAAC;IAEFxB,gBAAgB,CAACQ,OAAO,CAAC,CAAC;MAAEC,EAAE;MAAEC;IAAY,CAAC,KAAK;MAChDL,SAAS,CAACI,EAAE,CAAC,GAAG;QACdM,KAAK,EAAEL,WAAW;QAClBM,GAAG,EAAG,iBAAgBP,EAAG;MAC3B,CAAC;IACH,CAAC,CAAC;IAEFb,SAAS,CAACqB,UAAU,CAAC;EACvB,CAAC;AACH;AAEA,eAAevB,sBAAsB"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
-
|
|
3
|
+
import { getDynamicQuery } from '@blaze-cms/admin-ui-utils';
|
|
4
|
+
const buildAdminSearchQuery = entitySchema => {
|
|
5
|
+
const {
|
|
6
|
+
listingProperties = []
|
|
7
|
+
} = entitySchema || {};
|
|
8
|
+
const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;
|
|
9
|
+
return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true);
|
|
10
|
+
};
|
|
11
|
+
function buildListingQuery(entitySchema, isSearchQuery) {
|
|
4
12
|
if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {
|
|
5
13
|
throw new BlazeError('Listing query requires getAll action and listingProperties from entity schema');
|
|
6
14
|
}
|
|
15
|
+
if (isSearchQuery) return buildAdminSearchQuery(entitySchema);
|
|
7
16
|
const sortType = entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
|
|
8
17
|
return gql`
|
|
9
18
|
query ${entitySchema.actions.getAll}($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","
|
|
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 +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 =
|
|
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.
|
|
3
|
+
"version": "0.134.0-project-admin-customisations.0",
|
|
4
4
|
"description": "Blaze plugin data ui",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/admin-ui-utils": "
|
|
31
|
-
"@blaze-cms/core-errors": "
|
|
32
|
-
"@blaze-cms/
|
|
33
|
-
"@blaze-cms/react-
|
|
34
|
-
"@blaze-cms/
|
|
35
|
-
"@blaze-cms/
|
|
30
|
+
"@blaze-cms/admin-ui-utils": "0.134.0-project-admin-customisations.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.134.0-project-admin-customisations.0",
|
|
32
|
+
"@blaze-cms/plugin-render-hooks-ui": "0.134.0-project-admin-customisations.0",
|
|
33
|
+
"@blaze-cms/react-form-builder": "0.134.0-project-admin-customisations.0",
|
|
34
|
+
"@blaze-cms/react-page-builder": "0.134.0-project-admin-customisations.0",
|
|
35
|
+
"@blaze-cms/setup-ui": "0.134.0-project-admin-customisations.0",
|
|
36
|
+
"@blaze-cms/versioning-ui": "0.134.0-project-admin-customisations.0",
|
|
36
37
|
"@blaze-react/button": "0.5.19",
|
|
37
38
|
"@blaze-react/more": "0.5.19",
|
|
38
39
|
"@blaze-react/multiselect": "0.6.6",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"uuid": "^3.3.3"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@blaze-cms/core-ui": "
|
|
57
|
+
"@blaze-cms/core-ui": "0.134.0-project-admin-customisations.0"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"@apollo/client": "3.x",
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"lib/*",
|
|
66
67
|
"lib-es/*"
|
|
67
68
|
],
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "ed7ba9d56aee2c4913b8204b0181fdc8c5975d94"
|
|
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
|
|
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]}
|
|
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;
|