@blaze-cms/plugin-data-ui 0.130.0-admin-updates.1 → 0.130.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 +15 -11
- 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 +15 -2
- 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 +12 -2
- 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 +5 -26
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +5 -12
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.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-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 +15 -2
- 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 +4 -25
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +6 -13
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.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/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 +9 -0
- 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 +4 -18
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +5 -16
- package/src/index.js +1 -8
- package/src/utils/add-content-menu-items.js +45 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const InfoBox = ({
|
|
4
|
+
items,
|
|
5
|
+
infoBoxKey
|
|
6
|
+
}) => {
|
|
7
|
+
if (!items) return null;
|
|
8
|
+
const infoBoxItems = items.map(item => Object.values(item).map(info => {
|
|
9
|
+
if (!info.label || !info.value) return null;
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "info-box--item",
|
|
12
|
+
key: `${infoBoxKey}-${info.label.toLowerCase()}`
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: "info-box--label"
|
|
15
|
+
}, info.label, ": "), /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
className: "info-box--value"
|
|
17
|
+
}, info.value));
|
|
18
|
+
}).filter(Boolean));
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: "info-box",
|
|
21
|
+
key: infoBoxKey
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: "info-box--container"
|
|
24
|
+
}, infoBoxItems));
|
|
25
|
+
};
|
|
26
|
+
export default InfoBox;
|
|
27
|
+
InfoBox.propTypes = {
|
|
28
|
+
infoBoxKey: PropTypes.string.isRequired,
|
|
29
|
+
items: PropTypes.array.isRequired
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=InfoBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBox.js","names":["PropTypes","React","InfoBox","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","createElement","className","key","toLowerCase","filter","Boolean","propTypes","string","isRequired","array"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBox.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nconst InfoBox = ({ items, infoBoxKey }) => {\n if (!items) return null;\n\n const infoBoxItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <div className=\"info-box--item\" key={`${infoBoxKey}-${info.label.toLowerCase()}`}>\n <div className=\"info-box--label\">{info.label}: </div>\n <div className=\"info-box--value\">{info.value}</div>\n </div>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"info-box\" key={infoBoxKey}>\n <div className=\"info-box--container\">{infoBoxItems}</div>\n </div>\n );\n};\n\nexport default InfoBox;\n\nInfoBox.propTypes = {\n infoBoxKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AAEzB,MAAMC,OAAO,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAW,CAAC,KAAK;EACzC,IAAI,CAACD,KAAK,EAAE,OAAO,IAAI;EAEvB,MAAME,YAAY,GAAGF,KAAK,CAACG,GAAG,CAACC,IAAI,IACjCC,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,CAChBD,GAAG,CAACI,IAAI,IAAI;IACX,IAAI,CAACA,IAAI,CAACC,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK,EAAE,OAAO,IAAI;IAE3C,oBACEX,KAAA,CAAAY,aAAA;MAAKC,SAAS,EAAC,gBAAgB;MAACC,GAAG,EAAG,GAAEX,UAAW,IAAGM,IAAI,CAACC,KAAK,CAACK,WAAW,CAAC,CAAE;IAAE,gBAC/Ef,KAAA,CAAAY,aAAA;MAAKC,SAAS,EAAC;IAAiB,GAAEJ,IAAI,CAACC,KAAK,EAAC,IAAO,CAAC,eACrDV,KAAA,CAAAY,aAAA;MAAKC,SAAS,EAAC;IAAiB,GAAEJ,IAAI,CAACE,KAAW,CAC/C,CAAC;EAEV,CAAC,CAAC,CACDK,MAAM,CAACC,OAAO,CACnB,CAAC;EAED,oBACEjB,KAAA,CAAAY,aAAA;IAAKC,SAAS,EAAC,UAAU;IAACC,GAAG,EAAEX;EAAW,gBACxCH,KAAA,CAAAY,aAAA;IAAKC,SAAS,EAAC;EAAqB,GAAET,YAAkB,CACrD,CAAC;AAEV,CAAC;AAED,eAAeH,OAAO;AAEtBA,OAAO,CAACiB,SAAS,GAAG;EAClBf,UAAU,EAAEJ,SAAS,CAACoB,MAAM,CAACC,UAAU;EACvClB,KAAK,EAAEH,SAAS,CAACsB,KAAK,CAACD;AACzB,CAAC"}
|
|
@@ -6,7 +6,6 @@ import React, { useEffect, useState, Fragment } from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { withRouter, Link } from 'react-router-dom';
|
|
8
8
|
import More from '@blaze-react/more';
|
|
9
|
-
import { MainContext, useMainContext } from '@blaze-cms/admin-ui-utils';
|
|
10
9
|
import { PageHeader, DeleteAction } from '@blaze-cms/admin';
|
|
11
10
|
import { useToasts } from '@blaze-react/toaster';
|
|
12
11
|
import ListingTableContent from './ListingTableContent';
|
|
@@ -17,8 +16,7 @@ import { getDefaultQueryParams } from '../../utils/get-default-query-params';
|
|
|
17
16
|
const OVER_SCAN_BUFFER = 10;
|
|
18
17
|
const ListingTable = ({
|
|
19
18
|
match,
|
|
20
|
-
entitySchema
|
|
21
|
-
selectedMenuItem
|
|
19
|
+
entitySchema
|
|
22
20
|
}) => {
|
|
23
21
|
const [tableData, setTableData] = useState({});
|
|
24
22
|
const [modalStatus, setModalStatus] = useState(false);
|
|
@@ -32,10 +30,6 @@ const ListingTable = ({
|
|
|
32
30
|
schema: entitySchema
|
|
33
31
|
});
|
|
34
32
|
const [queryParams, setQueryParams] = useState(queryParamsDefault);
|
|
35
|
-
const {
|
|
36
|
-
menuItems,
|
|
37
|
-
setMenuItems
|
|
38
|
-
} = useMainContext(MainContext);
|
|
39
33
|
const client = useApolloClient();
|
|
40
34
|
const {
|
|
41
35
|
addToast
|
|
@@ -65,20 +59,7 @@ const ListingTable = ({
|
|
|
65
59
|
}, [client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps
|
|
66
60
|
);
|
|
67
61
|
|
|
68
|
-
const onCloseCardPrompt = () =>
|
|
69
|
-
const updatedSelectedMenuItem = _objectSpread(_objectSpread({}, selectedMenuItem), {}, {
|
|
70
|
-
isDisplayedPrompt: false
|
|
71
|
-
});
|
|
72
|
-
const [{
|
|
73
|
-
header,
|
|
74
|
-
items
|
|
75
|
-
}] = menuItems;
|
|
76
|
-
const updatedItems = items.map(item => item.name === selectedMenuItem.name ? updatedSelectedMenuItem : item);
|
|
77
|
-
setMenuItems([{
|
|
78
|
-
header,
|
|
79
|
-
items: updatedItems
|
|
80
|
-
}]);
|
|
81
|
-
};
|
|
62
|
+
const onCloseCardPrompt = () => null;
|
|
82
63
|
const toggleModal = item => {
|
|
83
64
|
setModalStatus(!!item);
|
|
84
65
|
setItemToDelete(item || {});
|
|
@@ -173,7 +154,7 @@ const ListingTable = ({
|
|
|
173
154
|
}), /*#__PURE__*/React.createElement(PageHeader, {
|
|
174
155
|
title: entitySchema.displayName,
|
|
175
156
|
subtitle: ""
|
|
176
|
-
},
|
|
157
|
+
}, !!tableData.rows.length && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Link, {
|
|
177
158
|
"data-testid": "addEntity",
|
|
178
159
|
className: "button button--small",
|
|
179
160
|
to: `${match.url}/create`
|
|
@@ -189,14 +170,12 @@ const ListingTable = ({
|
|
|
189
170
|
onRenderItems: handleRenderedItems,
|
|
190
171
|
tableData: tableData,
|
|
191
172
|
onCloseCardPrompt: onCloseCardPrompt,
|
|
192
|
-
selectedMenuItem: selectedMenuItem,
|
|
193
173
|
scrollToIndex: scrollToIndex
|
|
194
174
|
}));
|
|
195
175
|
};
|
|
196
176
|
ListingTable.propTypes = {
|
|
197
177
|
entitySchema: PropTypes.object.isRequired,
|
|
198
|
-
match: PropTypes.object.isRequired
|
|
199
|
-
selectedMenuItem: PropTypes.object.isRequired
|
|
178
|
+
match: PropTypes.object.isRequired
|
|
200
179
|
};
|
|
201
180
|
export default withRouter(ListingTable);
|
|
202
181
|
//# sourceMappingURL=ListingTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListingTable.js","names":["useApolloClient","React","useEffect","useState","Fragment","PropTypes","withRouter","Link","More","MainContext","useMainContext","PageHeader","DeleteAction","useToasts","ListingTableContent","availableActions","fetchData","populateRows","formatRows","getDefaultQueryParams","OVER_SCAN_BUFFER","ListingTable","match","entitySchema","selectedMenuItem","tableData","setTableData","modalStatus","setModalStatus","itemToDelete","setItemToDelete","previousSchema","setPreviousSchema","id","scrollToIndex","setScrollToIndex","verifiedRanges","setVerifiedRanges","queryParamsDefault","schema","queryParams","setQueryParams","menuItems","setMenuItems","client","addToast","data","querySettings","populatedTable","toggleModal","url","rows","onCloseCardPrompt","updatedSelectedMenuItem","_objectSpread","isDisplayedPrompt","header","items","updatedItems","map","item","name","deleteAction","delete","submit","parsedFormValues","updatedTableData","filter","handleSort","event","property","direction","Object","entries","sortQueryParams","sort","columns","firstColumn","appliedSort","handleRenderedItems","params","startIndex","rowsLength","length","loadIndex","Math","floor","includes","updatedQueryParams","offset","updatedRows","createElement","className","onClose","itemName","title","displayName","subtitle","to","Actions","Avatar","isMoreMenu","Content","overScanBuffer","onSort","onRenderItems","propTypes","object","isRequired"],"sources":["../../../src/components/ListingTable/ListingTable.js"],"sourcesContent":["import { useApolloClient } from '@apollo/client';\nimport React, { useEffect, useState, Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport { withRouter, Link } from 'react-router-dom';\nimport More from '@blaze-react/more';\nimport { MainContext, useMainContext } from '@blaze-cms/admin-ui-utils';\nimport { PageHeader, DeleteAction } from '@blaze-cms/admin';\nimport { useToasts } from '@blaze-react/toaster';\nimport ListingTableContent from './ListingTableContent';\nimport availableActions from '../EntityManager/Entity/actions-handlers';\nimport { fetchData } from './service';\nimport { populateRows, formatRows } from './mappers/populate-rows';\nimport { getDefaultQueryParams } from '../../utils/get-default-query-params';\n\nconst OVER_SCAN_BUFFER = 10;\n\nconst ListingTable = ({ match, entitySchema, selectedMenuItem }) => {\n const [tableData, setTableData] = useState({});\n const [modalStatus, setModalStatus] = useState(false);\n const [itemToDelete, setItemToDelete] = useState({});\n const [previousSchema, setPreviousSchema] = useState({ id: null });\n const [scrollToIndex, setScrollToIndex] = useState(0);\n const [verifiedRanges, setVerifiedRanges] = useState([]);\n const queryParamsDefault = getDefaultQueryParams({ schema: entitySchema });\n const [queryParams, setQueryParams] = useState(queryParamsDefault);\n const { menuItems, setMenuItems } = useMainContext(MainContext);\n const client = useApolloClient();\n const { addToast } = useToasts();\n\n useEffect(\n () => {\n (async () => {\n if (\n entitySchema.id !== previousSchema.id ||\n (previousSchema.id === null && entitySchema.id)\n ) {\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: queryParamsDefault\n }\n });\n const populatedTable = populateRows({\n toggleModal,\n url: match.url,\n entitySchema,\n rows: data\n });\n setTableData(populatedTable);\n setPreviousSchema({ id: entitySchema.id });\n }\n })();\n },\n [client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps\n );\n\n const onCloseCardPrompt = () => {\n const updatedSelectedMenuItem = {\n ...selectedMenuItem,\n isDisplayedPrompt: false\n };\n const [{ header, items }] = menuItems;\n const updatedItems = items.map(\n item => (item.name === selectedMenuItem.name ? updatedSelectedMenuItem : item)\n );\n setMenuItems([{ header, items: updatedItems }]);\n };\n\n const toggleModal = item => {\n setModalStatus(!!item);\n setItemToDelete(item || {});\n };\n\n const deleteAction = async () => {\n await availableActions.delete.submit(\n {\n entitySchema,\n parsedFormValues: { id: itemToDelete.id },\n client\n },\n addToast\n );\n\n toggleModal();\n\n const updatedTableData = {\n ...tableData,\n rows: tableData.rows.filter(({ id }) => id !== itemToDelete.id)\n };\n\n setTableData(updatedTableData);\n };\n\n const handleSort = async event => {\n const [[property, direction]] = Object.entries(event);\n const sortQueryParams = {\n ...queryParamsDefault,\n sort: [{ property, direction }]\n };\n setScrollToIndex(0);\n setVerifiedRanges([]);\n setQueryParams(sortQueryParams);\n\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: sortQueryParams\n }\n });\n const { columns } = tableData;\n const [firstColumn] = columns;\n\n setTableData({\n ...tableData,\n appliedSort: { [property]: direction },\n rows: formatRows({ rows: data, url: match.url, toggleModal, firstColumn })\n });\n };\n\n const handleRenderedItems = async params => {\n const { startIndex } = params;\n const rowsLength = tableData.rows.length;\n const loadIndex = Math.floor(rowsLength / 3) - OVER_SCAN_BUFFER;\n if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {\n const updatedQueryParams = {\n ...queryParams,\n offset: rowsLength\n };\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: updatedQueryParams\n }\n });\n const updatedRows = [\n ...tableData.rows,\n ...formatRows({ rows: data, url: match.url, toggleModal })\n ];\n\n setVerifiedRanges([...verifiedRanges, loadIndex]);\n setQueryParams(updatedQueryParams);\n setTableData({\n ...tableData,\n rows: updatedRows\n });\n setScrollToIndex(startIndex + OVER_SCAN_BUFFER);\n }\n };\n\n if (!tableData || !tableData.rows) return 'loading';\n\n return (\n <div className=\"page\">\n {modalStatus && (\n <DeleteAction\n onClose={toggleModal}\n deleteAction={deleteAction}\n itemName={itemToDelete.name}\n />\n )}\n <PageHeader title={entitySchema.displayName} subtitle=\"\">\n {(!selectedMenuItem.isDisplayedPrompt || !!tableData.rows.length) && (\n <Fragment>\n <Link\n data-testid=\"addEntity\"\n className=\"button button--small\"\n to={`${match.url}/create`}>\n Add\n </Link>\n <PageHeader.Actions>\n <More>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu />\n </More>\n </PageHeader.Actions>\n </Fragment>\n )}\n </PageHeader>\n <ListingTableContent\n overScanBuffer={OVER_SCAN_BUFFER}\n onSort={handleSort}\n onRenderItems={handleRenderedItems}\n tableData={tableData}\n onCloseCardPrompt={onCloseCardPrompt}\n selectedMenuItem={selectedMenuItem}\n scrollToIndex={scrollToIndex}\n />\n </div>\n );\n};\nListingTable.propTypes = {\n entitySchema: PropTypes.object.isRequired,\n match: PropTypes.object.isRequired,\n selectedMenuItem: PropTypes.object.isRequired\n};\n\nexport default withRouter(ListingTable);\n"],"mappings":";;;AAAA,SAASA,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,IAAI,QAAQ,kBAAkB;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EF,CAAC,eACbpG,KAAA,CAAA0F,aAAA,CAAC7E,mBAAmB;IAClByF,cAAc,EAAEnF,gBAAiB;IACjCoF,MAAM,EAAEpC,UAAW;IACnBqC,aAAa,EAAE1B,mBAAoB;IACnCtD,SAAS,EAAEA,SAAU;IACrB2B,iBAAiB,EAAEA,iBAAkB;IACrC5B,gBAAgB,EAAEA,gBAAiB;IACnCU,aAAa,EAAEA;EAAc,CAC9B,CACE,CAAC;AAEV,CAAC;AACDb,YAAY,CAACqF,SAAS,GAAG;EACvBnF,YAAY,EAAElB,SAAS,CAACsG,MAAM,CAACC,UAAU;EACzCtF,KAAK,EAAEjB,SAAS,CAACsG,MAAM,CAACC,UAAU;EAClCpF,gBAAgB,EAAEnB,SAAS,CAACsG,MAAM,CAACC;AACrC,CAAC;AAED,eAAetG,UAAU,CAACe,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"ListingTable.js","names":["useApolloClient","React","useEffect","useState","Fragment","PropTypes","withRouter","Link","More","PageHeader","DeleteAction","useToasts","ListingTableContent","availableActions","fetchData","populateRows","formatRows","getDefaultQueryParams","OVER_SCAN_BUFFER","ListingTable","match","entitySchema","tableData","setTableData","modalStatus","setModalStatus","itemToDelete","setItemToDelete","previousSchema","setPreviousSchema","id","scrollToIndex","setScrollToIndex","verifiedRanges","setVerifiedRanges","queryParamsDefault","schema","queryParams","setQueryParams","client","addToast","data","querySettings","populatedTable","toggleModal","url","rows","onCloseCardPrompt","item","deleteAction","delete","submit","parsedFormValues","updatedTableData","_objectSpread","filter","handleSort","event","property","direction","Object","entries","sortQueryParams","sort","columns","firstColumn","appliedSort","handleRenderedItems","params","startIndex","rowsLength","length","loadIndex","Math","floor","includes","updatedQueryParams","offset","updatedRows","createElement","className","onClose","itemName","name","title","displayName","subtitle","to","Actions","Avatar","isMoreMenu","Content","overScanBuffer","onSort","onRenderItems","propTypes","object","isRequired"],"sources":["../../../src/components/ListingTable/ListingTable.js"],"sourcesContent":["import { useApolloClient } from '@apollo/client';\nimport React, { useEffect, useState, Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport { withRouter, Link } from 'react-router-dom';\nimport More from '@blaze-react/more';\nimport { PageHeader, DeleteAction } from '@blaze-cms/admin';\nimport { useToasts } from '@blaze-react/toaster';\nimport ListingTableContent from './ListingTableContent';\nimport availableActions from '../EntityManager/Entity/actions-handlers';\nimport { fetchData } from './service';\nimport { populateRows, formatRows } from './mappers/populate-rows';\nimport { getDefaultQueryParams } from '../../utils/get-default-query-params';\n\nconst OVER_SCAN_BUFFER = 10;\n\nconst ListingTable = ({ match, entitySchema }) => {\n const [tableData, setTableData] = useState({});\n const [modalStatus, setModalStatus] = useState(false);\n const [itemToDelete, setItemToDelete] = useState({});\n const [previousSchema, setPreviousSchema] = useState({ id: null });\n const [scrollToIndex, setScrollToIndex] = useState(0);\n const [verifiedRanges, setVerifiedRanges] = useState([]);\n const queryParamsDefault = getDefaultQueryParams({ schema: entitySchema });\n const [queryParams, setQueryParams] = useState(queryParamsDefault);\n const client = useApolloClient();\n const { addToast } = useToasts();\n\n useEffect(\n () => {\n (async () => {\n if (\n entitySchema.id !== previousSchema.id ||\n (previousSchema.id === null && entitySchema.id)\n ) {\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: queryParamsDefault\n }\n });\n const populatedTable = populateRows({\n toggleModal,\n url: match.url,\n entitySchema,\n rows: data\n });\n setTableData(populatedTable);\n setPreviousSchema({ id: entitySchema.id });\n }\n })();\n },\n [client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps\n );\n\n const onCloseCardPrompt = () => null;\n\n const toggleModal = item => {\n setModalStatus(!!item);\n setItemToDelete(item || {});\n };\n\n const deleteAction = async () => {\n await availableActions.delete.submit(\n {\n entitySchema,\n parsedFormValues: { id: itemToDelete.id },\n client\n },\n addToast\n );\n\n toggleModal();\n\n const updatedTableData = {\n ...tableData,\n rows: tableData.rows.filter(({ id }) => id !== itemToDelete.id)\n };\n\n setTableData(updatedTableData);\n };\n\n const handleSort = async event => {\n const [[property, direction]] = Object.entries(event);\n const sortQueryParams = {\n ...queryParamsDefault,\n sort: [{ property, direction }]\n };\n setScrollToIndex(0);\n setVerifiedRanges([]);\n setQueryParams(sortQueryParams);\n\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: sortQueryParams\n }\n });\n const { columns } = tableData;\n const [firstColumn] = columns;\n\n setTableData({\n ...tableData,\n appliedSort: { [property]: direction },\n rows: formatRows({ rows: data, url: match.url, toggleModal, firstColumn })\n });\n };\n\n const handleRenderedItems = async params => {\n const { startIndex } = params;\n const rowsLength = tableData.rows.length;\n const loadIndex = Math.floor(rowsLength / 3) - OVER_SCAN_BUFFER;\n if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {\n const updatedQueryParams = {\n ...queryParams,\n offset: rowsLength\n };\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: updatedQueryParams\n }\n });\n const updatedRows = [\n ...tableData.rows,\n ...formatRows({ rows: data, url: match.url, toggleModal })\n ];\n\n setVerifiedRanges([...verifiedRanges, loadIndex]);\n setQueryParams(updatedQueryParams);\n setTableData({\n ...tableData,\n rows: updatedRows\n });\n setScrollToIndex(startIndex + OVER_SCAN_BUFFER);\n }\n };\n\n if (!tableData || !tableData.rows) return 'loading';\n\n return (\n <div className=\"page\">\n {modalStatus && (\n <DeleteAction\n onClose={toggleModal}\n deleteAction={deleteAction}\n itemName={itemToDelete.name}\n />\n )}\n <PageHeader title={entitySchema.displayName} subtitle=\"\">\n {!!tableData.rows.length && (\n <Fragment>\n <Link\n data-testid=\"addEntity\"\n className=\"button button--small\"\n to={`${match.url}/create`}>\n Add\n </Link>\n <PageHeader.Actions>\n <More>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu />\n </More>\n </PageHeader.Actions>\n </Fragment>\n )}\n </PageHeader>\n <ListingTableContent\n overScanBuffer={OVER_SCAN_BUFFER}\n onSort={handleSort}\n onRenderItems={handleRenderedItems}\n tableData={tableData}\n onCloseCardPrompt={onCloseCardPrompt}\n scrollToIndex={scrollToIndex}\n />\n </div>\n );\n};\nListingTable.propTypes = {\n entitySchema: PropTypes.object.isRequired,\n match: PropTypes.object.isRequired\n};\n\nexport default withRouter(ListingTable);\n"],"mappings":";;;AAAA,SAASA,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,IAAI,QAAQ,kBAAkB;AACnD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,UAAU,EAAEC,YAAY,QAAQ,kBAAkB;AAC3D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,gBAAgB,MAAM,0CAA0C;AACvE,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,YAAY,EAAEC,UAAU,QAAQ,yBAAyB;AAClE,SAASC,qBAAqB,QAAQ,sCAAsC;AAE5E,MAAMC,gBAAgB,GAAG,EAAE;AAE3B,MAAMC,YAAY,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAa,CAAC,KAAK;EAChD,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGpB,QAAQ,CAAC,CAAC,CAAC,CAAC;EAC9C,MAAM,CAACqB,WAAW,EAAEC,cAAc,CAAC,GAAGtB,QAAQ,CAAC,KAAK,CAAC;EACrD,MAAM,CAACuB,YAAY,EAAEC,eAAe,CAAC,GAAGxB,QAAQ,CAAC,CAAC,CAAC,CAAC;EACpD,MAAM,CAACyB,cAAc,EAAEC,iBAAiB,CAAC,GAAG1B,QAAQ,CAAC;IAAE2B,EAAE,EAAE;EAAK,CAAC,CAAC;EAClE,MAAM,CAACC,aAAa,EAAEC,gBAAgB,C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AEA,iBAAkB;IACrChB,aAAa,EAAEA;EAAc,CAC9B,CACE,CAAC;AAEV,CAAC;AACDZ,YAAY,CAAC4E,SAAS,GAAG;EACvB1E,YAAY,EAAEhB,SAAS,CAAC2F,MAAM,CAACC,UAAU;EACzC7E,KAAK,EAAEf,SAAS,CAAC2F,MAAM,CAACC;AAC1B,CAAC;AAED,eAAe3F,UAAU,CAACa,YAAY,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
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
|
const ListingTableContent = ({
|
|
7
6
|
tableData,
|
|
8
7
|
handleSelect,
|
|
@@ -16,7 +15,7 @@ const ListingTableContent = ({
|
|
|
16
15
|
scrollToIndex
|
|
17
16
|
}) => {
|
|
18
17
|
const displayTable = tableData && tableData.rows && !!tableData.rows.length;
|
|
19
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, displayTable
|
|
18
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, displayTable && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
20
19
|
className: "page__content"
|
|
21
20
|
}, /*#__PURE__*/React.createElement(Table, {
|
|
22
21
|
scrollToIndex: scrollToIndex,
|
|
@@ -28,19 +27,12 @@ const ListingTableContent = ({
|
|
|
28
27
|
checkboxes: true,
|
|
29
28
|
onSelect: handleSelect,
|
|
30
29
|
"data-testid": "listing-table-content"
|
|
31
|
-
})))
|
|
32
|
-
onClose: onCloseCardPrompt,
|
|
33
|
-
"data-testid": "card-prompt"
|
|
34
|
-
}, /*#__PURE__*/React.createElement(Link, {
|
|
35
|
-
className: "button button--rounded button--cta",
|
|
36
|
-
to: `${match.url}/create`,
|
|
37
|
-
"data-testid": "add-button"
|
|
38
|
-
}, "Add")));
|
|
30
|
+
}))));
|
|
39
31
|
};
|
|
40
32
|
ListingTableContent.propTypes = {
|
|
41
33
|
tableData: PropTypes.object.isRequired,
|
|
42
34
|
onCloseCardPrompt: PropTypes.func.isRequired,
|
|
43
|
-
selectedMenuItem: PropTypes.object
|
|
35
|
+
selectedMenuItem: PropTypes.object,
|
|
44
36
|
match: PropTypes.shape({
|
|
45
37
|
url: PropTypes.string
|
|
46
38
|
}).isRequired,
|
|
@@ -57,7 +49,8 @@ ListingTableContent.defaultProps = {
|
|
|
57
49
|
onClickRow: () => {},
|
|
58
50
|
overScanBuffer: 0,
|
|
59
51
|
scrollToIndex: 0,
|
|
60
|
-
onRenderItems: () => {}
|
|
52
|
+
onRenderItems: () => {},
|
|
53
|
+
selectedMenuItem: null
|
|
61
54
|
};
|
|
62
55
|
export default withRouter(ListingTableContent);
|
|
63
56
|
//# sourceMappingURL=ListingTableContent.js.map
|
|
@@ -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","onCloseCardPrompt","selectedMenuItem","match","onSort","onClickRow","overScanBuffer","onRenderItems","scrollToIndex","displayTable","rows","length","createElement","Fragment","className","data","checkboxes","onSelect","propTypes","object","isRequired","func","shape","url","string","number","defaultProps"],"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 onCloseCardPrompt,\n selectedMenuItem,\n match,\n onSort,\n onClickRow,\n overScanBuffer,\n onRenderItems,\n scrollToIndex\n}) => {\n const displayTable = tableData && tableData.rows && !!tableData.rows.length;\n\n return (\n <>\n {displayTable && (\n <>\n <div className=\"page__content\">\n <Table\n scrollToIndex={scrollToIndex}\n onSort={onSort}\n onClickRow={onClickRow}\n overScanBuffer={overScanBuffer}\n onRenderItems={onRenderItems}\n data={tableData}\n checkboxes\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 onCloseCardPrompt: PropTypes.func.isRequired,\n selectedMenuItem: PropTypes.object,\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,iBAAiB;EACjBC,gBAAgB;EAChBC,KAAK;EACLC,MAAM;EACNC,UAAU;EACVC,cAAc;EACdC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAGV,SAAS,IAAIA,SAAS,CAACW,IAAI,IAAI,CAAC,CAACX,SAAS,CAACW,IAAI,CAACC,MAAM;EAE3E,oBACEjB,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAmB,QAAA,QACGJ,YAAY,iBACXf,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAmB,QAAA,qBACEnB,KAAA,CAAAkB,aAAA;IAAKE,SAAS,EAAC;EAAe,gBAC5BpB,KAAA,CAAAkB,aAAA,CAACjB,KAAK;IACJa,aAA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';
|
|
|
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,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@@ 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(menuConfig);\n };\n}\n\nexport default getAddContentMenuItems;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AAEpD,MAAM;EAAEC;AAAiB,CAAC,GAAGC,OAAO,CAAC,cAAc,CAAC;AAEpD,SAASC,sBAAsBA,CAACC,GAAG,EAAE;EACnC,OAAO,OAAO;IAAEC;EAAU,CAAC,KAAK;IAC9B,MAAMC,MAAM,GAAGF,GAAG,CAACG,SAAS,CAAC,CAAC;IAC9B,MAAM;MACJC,IAAI,EAAE;QAAEC;MAAiB;IAC3B,CAAC,GAAG,MAAMH,MAAM,CAACI,KAAK,CAAC;MACrBA,KAAK,EAAEV,QAAQ,CAAC,4BAA4B,CAAC;MAC7CW,SAAS,EAAE;QACT;QACAC,YAAY,EAAEX;MAChB;IACF,CAAC,CAAC;IAEF,IAAI,CAACQ,gBAAgB,IAAI,CAACA,gBAAgB,CAACI,MAAM,EAAE,OAAO,CAAC;;IAE3D,MAAMC,SAAS,GAAG,CAAC,CAAC;IACpB,MAAMC,gBAAgB,GAAG;MAAEC,OAAO,EAAE,CAAC;IAAE,CAAC;IAExCP,gBAAgB,CAACQ,OAAO,CAAC,CAAC;MAAEC,EAAE;MAAEC,WAAW;MAAEC;IAAkB,CAAC,KAAK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-1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-data-ui",
|
|
3
|
-
"version": "0.130.0-admin-
|
|
3
|
+
"version": "0.130.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": "0.130.0-admin-
|
|
31
|
-
"@blaze-cms/core-errors": "0.
|
|
32
|
-
"@blaze-cms/
|
|
33
|
-
"@blaze-cms/react-
|
|
34
|
-
"@blaze-cms/
|
|
35
|
-
"@blaze-cms/
|
|
30
|
+
"@blaze-cms/admin-ui-utils": "0.130.0-project-admin-customisations.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.129.0-project-admin-customisations.3",
|
|
32
|
+
"@blaze-cms/plugin-render-hooks-ui": "0.129.0-project-admin-customisations.3",
|
|
33
|
+
"@blaze-cms/react-form-builder": "0.130.0-project-admin-customisations.0",
|
|
34
|
+
"@blaze-cms/react-page-builder": "0.130.0-project-admin-customisations.0",
|
|
35
|
+
"@blaze-cms/setup-ui": "0.129.0-project-admin-customisations.3",
|
|
36
|
+
"@blaze-cms/versioning-ui": "0.129.0-project-admin-customisations.3",
|
|
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": "0.130.0-admin-
|
|
57
|
+
"@blaze-cms/core-ui": "0.130.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": "f7b80031a95d3ce85f39e7a500be3de2c4e960da"
|
|
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;
|
|
@@ -3,6 +3,7 @@ import React, { useEffect, useState, useRef } from 'react';
|
|
|
3
3
|
import { withRouter, Prompt } from 'react-router-dom';
|
|
4
4
|
import { useApolloClient } from '@apollo/client';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
6
7
|
import { getQuery, GET_CURRENT_TAB_ID } from '@blaze-cms/admin-ui-utils';
|
|
7
8
|
import { FormBuilder, parseFormValues } from '@blaze-cms/react-form-builder';
|
|
8
9
|
import { DeleteAction, CopyDataFromAction } from '@blaze-cms/admin';
|
|
@@ -34,6 +35,7 @@ import {
|
|
|
34
35
|
checkFulfilConditions
|
|
35
36
|
} from '../utils/entity';
|
|
36
37
|
import useToggle from '../../../utils/hooks/useToggle';
|
|
38
|
+
import InfoBoxes from '../../InfoBoxes/InfoBoxes';
|
|
37
39
|
|
|
38
40
|
const Entity = ({
|
|
39
41
|
formData,
|
|
@@ -440,6 +442,8 @@ const Entity = ({
|
|
|
440
442
|
<div className="page__content--fixed">
|
|
441
443
|
<div className="page__content">
|
|
442
444
|
<div className="content">
|
|
445
|
+
<RenderHook hookKey={`entity:${action}:main:top`} entity={entity} schema={schema} />
|
|
446
|
+
<InfoBoxes id={entity.id} schema={schema} />
|
|
443
447
|
<Tabs
|
|
444
448
|
enabled={showPageBuilderTabs}
|
|
445
449
|
onTabChange={tabId => {
|
|
@@ -461,6 +465,11 @@ const Entity = ({
|
|
|
461
465
|
isNewEntity={isNewEntity}
|
|
462
466
|
/>
|
|
463
467
|
</Tabs>
|
|
468
|
+
<RenderHook
|
|
469
|
+
hookKey={`entity:${action}:main:bottom`}
|
|
470
|
+
entity={entity}
|
|
471
|
+
schema={schema}
|
|
472
|
+
/>
|
|
464
473
|
</div>
|
|
465
474
|
</div>
|
|
466
475
|
</div>
|
package/src/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import useCustomSidebarData from '../hooks/useCustomSidebarData';
|
|
4
|
+
import CustomSidebarInfo from '../presentational/CustomSidebarInfo';
|
|
5
|
+
|
|
6
|
+
const CustomSibebarInfoContainer = ({ id, schema, displayProperties }) => {
|
|
7
|
+
const { data } = useCustomSidebarData({ id, schema, displayProperties });
|
|
8
|
+
|
|
9
|
+
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
10
|
+
|
|
11
|
+
const items = Object.values(data).flatMap(item => Object.values(item));
|
|
12
|
+
|
|
13
|
+
return <CustomSidebarInfo items={items} customSidebarInfoKey={displayProperties.key} />;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default CustomSibebarInfoContainer;
|
|
17
|
+
|
|
18
|
+
CustomSibebarInfoContainer.propTypes = {
|
|
19
|
+
id: PropTypes.string.isRequired,
|
|
20
|
+
displayProperties: PropTypes.object.isRequired,
|
|
21
|
+
schema: PropTypes.object.isRequired
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
+
|
|
4
|
+
export default function buildDynamicQuery({ id, schema, displayProperties }) {
|
|
5
|
+
if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
|
|
6
|
+
throw new BlazeError(
|
|
7
|
+
'DataEntity query requires get action, properties and fields from entity schema'
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (
|
|
12
|
+
displayProperties.adminMainInfoProperty &&
|
|
13
|
+
Array.isArray(displayProperties.adminMainInfoProperty)
|
|
14
|
+
) {
|
|
15
|
+
const fields = displayProperties.adminMainInfoProperty.map(
|
|
16
|
+
infoProperty =>
|
|
17
|
+
`${infoProperty} {
|
|
18
|
+
label
|
|
19
|
+
value
|
|
20
|
+
}`
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return gql`query getInfoBoxData($id: String!){
|
|
24
|
+
${schema.actions.get}( id: $id ) {
|
|
25
|
+
id
|
|
26
|
+
${fields.map(field => field)}
|
|
27
|
+
__typename
|
|
28
|
+
}
|
|
29
|
+
}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import ProptTypes from 'prop-types';
|
|
2
|
+
import { useQuery, gql } from '@apollo/client';
|
|
3
|
+
import buildDynamicQuery from '../helpers/build-dynamic-query';
|
|
4
|
+
|
|
5
|
+
const useCustomSidebarData = ({ id, schema, displayProperties }) => {
|
|
6
|
+
const query = buildDynamicQuery({ id, schema, displayProperties });
|
|
7
|
+
|
|
8
|
+
const customSidebarInfoQuery =
|
|
9
|
+
query ||
|
|
10
|
+
gql`
|
|
11
|
+
query {
|
|
12
|
+
__typename
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const { data = {}, loading, error } = useQuery(customSidebarInfoQuery, {
|
|
17
|
+
variables: { id },
|
|
18
|
+
skip: !query
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return { data: data.__typename !== 'Query' ? data : null, loading, error };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default useCustomSidebarData;
|
|
25
|
+
|
|
26
|
+
useCustomSidebarData.propTypes = {
|
|
27
|
+
displayProperties: ProptTypes.object.isRequired
|
|
28
|
+
};
|