@blaze-cms/plugin-data-ui 0.146.0-node18-core-styles-tooltips.1 → 0.146.0-node18-core-styles-tooltips.3
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/lib-es/components/EntityDataListing/EntityDataListing.js +33 -0
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -0
- package/lib-es/components/EntityDataListing/index.js +3 -0
- package/lib-es/components/EntityDataListing/index.js.map +1 -0
- 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 +447 -0
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +103 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +45 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js.map +1 -0
- 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 +29 -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 +49 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +117 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +36 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +46 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js +32 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js +12 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js +39 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +53 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/index.js.map +1 -0
- package/lib-es/components/EntityManager/EntityManager.js +133 -0
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -0
- package/lib-es/components/EntityManager/index.js +3 -0
- package/lib-es/components/EntityManager/index.js.map +1 -0
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js +6 -0
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js.map +1 -0
- package/lib-es/components/EntityManager/utils/data-mappers.js +55 -0
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -0
- package/lib-es/components/EntityManager/utils/entity.js +69 -0
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -0
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js +56 -0
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -0
- package/lib-es/components/EntityManager/utils/is-form-empty.js +9 -0
- package/lib-es/components/EntityManager/utils/is-form-empty.js.map +1 -0
- package/lib-es/components/EntityManager/utils/query.js +23 -0
- package/lib-es/components/EntityManager/utils/query.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.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 +38 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +28 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js +39 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +17 -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 +40 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js +12 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js +30 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTable.js +207 -0
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +57 -0
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTableContent/index.js +3 -0
- package/lib-es/components/ListingTable/ListingTableContent/index.js.map +1 -0
- package/lib-es/components/ListingTable/TableActions/TableActions.js +34 -0
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -0
- package/lib-es/components/ListingTable/TableActions/index.js +3 -0
- package/lib-es/components/ListingTable/TableActions/index.js.map +1 -0
- package/lib-es/components/ListingTable/index.js +3 -0
- package/lib-es/components/ListingTable/index.js.map +1 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js +140 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -0
- package/lib-es/components/ListingTable/service/index.js +86 -0
- package/lib-es/components/ListingTable/service/index.js.map +1 -0
- package/lib-es/components/Tabs/index.js +40 -0
- package/lib-es/components/Tabs/index.js.map +1 -0
- package/lib-es/components/hooks/useCallbackDebounce.js +12 -0
- package/lib-es/components/hooks/useCallbackDebounce.js.map +1 -0
- package/lib-es/constants.js +39 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/icons/ContentIcon.js +80 -0
- package/lib-es/icons/ContentIcon.js.map +1 -0
- package/lib-es/icons/SettingsIcon.js +36 -0
- package/lib-es/icons/SettingsIcon.js.map +1 -0
- package/lib-es/icons/TaxonomyIcon.js +60 -0
- package/lib-es/icons/TaxonomyIcon.js.map +1 -0
- package/lib-es/icons/UsersIcon.js +33 -0
- package/lib-es/icons/UsersIcon.js.map +1 -0
- package/lib-es/icons/index.js +6 -0
- package/lib-es/icons/index.js.map +1 -0
- package/lib-es/index.js +84 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/utils/add-content-menu-items.js +72 -0
- package/lib-es/utils/add-content-menu-items.js.map +1 -0
- package/lib-es/utils/build-create-entity-mutation.js +21 -0
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -0
- package/lib-es/utils/build-delete-entity-mutation.js +18 -0
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -0
- package/lib-es/utils/build-listing-query.js +28 -0
- package/lib-es/utils/build-listing-query.js.map +1 -0
- package/lib-es/utils/build-update-data-query.js +24 -0
- package/lib-es/utils/build-update-data-query.js.map +1 -0
- package/lib-es/utils/build-update-publish-unpublish-mutation.js +22 -0
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -0
- package/lib-es/utils/get-default-query-params.js +17 -0
- package/lib-es/utils/get-default-query-params.js.map +1 -0
- package/lib-es/utils/hoc/withContext.js +8 -0
- package/lib-es/utils/hoc/withContext.js.map +1 -0
- package/lib-es/utils/hooks/useToggle.js +8 -0
- package/lib-es/utils/hooks/useToggle.js.map +1 -0
- package/lib-es/utils/index.js +3 -0
- package/lib-es/utils/index.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBoxTooltip.js","names":["React","PropTypes","Tooltip","InfoBoxTooltip","_ref","info","tooltipProps","_objectWithoutProperties","_excluded","tooltipContent","tooltipIcon","renderTooltipIcon","icon","createElement","className","_extends","trigger","propTypes","shape","node","string","isRequired"],"sources":["../../../src/components/InfoBoxes/InfoBoxTooltip.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Tooltip from '@blaze-react/tooltip';\n\nconst InfoBoxTooltip = ({ info, ...tooltipProps }) => {\n const { tooltipContent, tooltipIcon } = info;\n if (!tooltipContent) return null;\n\n const renderTooltipIcon = icon => {\n if (!icon) return null;\n return <i className={`${icon} info-box--icon`} />;\n };\n\n return (\n <Tooltip\n tooltipContent={tooltipContent}\n trigger=\"click\"\n className=\"info-box--tooltip\"\n {...tooltipProps}>\n {renderTooltipIcon(tooltipIcon)}\n </Tooltip>\n );\n};\n\nInfoBoxTooltip.propTypes = {\n info: PropTypes.shape({\n tooltipContent: PropTypes.node,\n tooltipIcon: PropTypes.string\n }).isRequired\n};\n\nexport default InfoBoxTooltip;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,sBAAsB;AAE1C,MAAMC,cAAc,GAAGC,IAAA,IAA+B;EAAA,IAA9B;MAAEC;IAAsB,CAAC,GAAAD,IAAA;IAAdE,YAAY,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAC7C,MAAM;IAAEC,cAAc;IAAEC;EAAY,CAAC,GAAGL,IAAI;EAC5C,IAAI,CAACI,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,iBAAiB,GAAGC,IAAI,IAAI;IAChC,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;IACtB,oBAAOZ,KAAA,CAAAa,aAAA;MAAGC,SAAS,EAAE,GAAGF,IAAI;IAAkB,CAAE,CAAC;EACnD,CAAC;EAED,oBACEZ,KAAA,CAAAa,aAAA,CAACX,OAAO,EAAAa,QAAA;IACNN,cAAc,EAAEA,cAAe;IAC/BO,OAAO,EAAC,OAAO;IACfF,SAAS,EAAC;EAAmB,GACzBR,YAAY,GACfK,iBAAiB,CAACD,WAAW,CACvB,CAAC;AAEd,CAAC;AAEDP,cAAc,CAACc,SAAS,GAAG;EACzBZ,IAAI,EAAEJ,SAAS,CAACiB,KAAK,CAAC;IACpBT,cAAc,EAAER,SAAS,CAACkB,IAAI;IAC9BT,WAAW,EAAET,SAAS,CAACmB;EACzB,CAAC,CAAC,CAACC;AACL,CAAC;AAED,eAAelB,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import InfoBoxContainer from './container/InfoBoxContainer';
|
|
4
|
+
const InfoBoxes = ({
|
|
5
|
+
id,
|
|
6
|
+
schema
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
displayProperties: {
|
|
10
|
+
adminInfoBoxes = []
|
|
11
|
+
}
|
|
12
|
+
} = schema;
|
|
13
|
+
if (adminInfoBoxes.length <= 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return adminInfoBoxes.map(infoBox => /*#__PURE__*/React.createElement(InfoBoxContainer, {
|
|
17
|
+
id: id,
|
|
18
|
+
schema: schema,
|
|
19
|
+
key: infoBox.key,
|
|
20
|
+
infoBox: infoBox
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
export default InfoBoxes;
|
|
24
|
+
InfoBoxes.propTypes = {
|
|
25
|
+
id: PropTypes.string.isRequired,
|
|
26
|
+
schema: PropTypes.object.isRequired
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=InfoBoxes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBoxes.js","names":["PropTypes","React","InfoBoxContainer","InfoBoxes","id","schema","displayProperties","adminInfoBoxes","length","map","infoBox","createElement","key","propTypes","string","isRequired","object"],"sources":["../../../src/components/InfoBoxes/InfoBoxes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxContainer from './container/InfoBoxContainer';\n\nconst InfoBoxes = ({ id, schema }) => {\n const {\n displayProperties: { adminInfoBoxes = [] }\n } = schema;\n\n if (adminInfoBoxes.length <= 0) {\n return null;\n }\n\n return adminInfoBoxes.map(infoBox => (\n <InfoBoxContainer id={id} schema={schema} key={infoBox.key} infoBox={infoBox} />\n ));\n};\n\nexport default InfoBoxes;\n\nInfoBoxes.propTypes = {\n id: PropTypes.string.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,gBAAgB,MAAM,8BAA8B;AAE3D,MAAMC,SAAS,GAAGA,CAAC;EAAEC,EAAE;EAAEC;AAAO,CAAC,KAAK;EACpC,MAAM;IACJC,iBAAiB,EAAE;MAAEC,cAAc,GAAG;IAAG;EAC3C,CAAC,GAAGF,MAAM;EAEV,IAAIE,cAAc,CAACC,MAAM,IAAI,CAAC,EAAE;IAC9B,OAAO,IAAI;EACb;EAEA,OAAOD,cAAc,CAACE,GAAG,CAACC,OAAO,iBAC/BT,KAAA,CAAAU,aAAA,CAACT,gBAAgB;IAACE,EAAE,EAAEA,EAAG;IAACC,MAAM,EAAEA,MAAO;IAACO,GAAG,EAAEF,OAAO,CAACE,GAAI;IAACF,OAAO,EAAEA;EAAQ,CAAE,CAChF,CAAC;AACJ,CAAC;AAED,eAAeP,SAAS;AAExBA,SAAS,CAACU,SAAS,GAAG;EACpBT,EAAE,EAAEJ,SAAS,CAACc,MAAM,CAACC,UAAU;EAC/BV,MAAM,EAAEL,SAAS,CAACgB,MAAM,CAACD;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
|
+
import useData from '../hooks/useData';
|
|
4
|
+
import InfoBox from '../presentational/InfoBox';
|
|
5
|
+
import { RecordEditContext } from '../../EntityManager/utils/RecordEditContext';
|
|
6
|
+
const InfoBoxContainer = ({
|
|
7
|
+
id,
|
|
8
|
+
schema,
|
|
9
|
+
infoBox
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
externalUpdateTime
|
|
13
|
+
} = useContext(RecordEditContext);
|
|
14
|
+
const {
|
|
15
|
+
data,
|
|
16
|
+
refetch
|
|
17
|
+
} = useData({
|
|
18
|
+
id,
|
|
19
|
+
schema,
|
|
20
|
+
infoBox
|
|
21
|
+
});
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
refetch();
|
|
24
|
+
}, [externalUpdateTime, refetch]);
|
|
25
|
+
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
26
|
+
const items = Object.values(data).flatMap(item => Object.values(item));
|
|
27
|
+
return /*#__PURE__*/React.createElement(InfoBox, {
|
|
28
|
+
items: items,
|
|
29
|
+
infoBoxKey: infoBox.key
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export default InfoBoxContainer;
|
|
33
|
+
InfoBoxContainer.propTypes = {
|
|
34
|
+
id: PropTypes.string.isRequired,
|
|
35
|
+
infoBox: PropTypes.object.isRequired,
|
|
36
|
+
schema: PropTypes.object.isRequired
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=InfoBoxContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBoxContainer.js","names":["PropTypes","React","useContext","useEffect","useData","InfoBox","RecordEditContext","InfoBoxContainer","id","schema","infoBox","externalUpdateTime","data","refetch","Object","keys","length","items","values","flatMap","item","createElement","infoBoxKey","key","propTypes","string","isRequired","object"],"sources":["../../../../src/components/InfoBoxes/container/InfoBoxContainer.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useContext, useEffect } from 'react';\nimport useData from '../hooks/useData';\nimport InfoBox from '../presentational/InfoBox';\nimport { RecordEditContext } from '../../EntityManager/utils/RecordEditContext';\n\nconst InfoBoxContainer = ({ id, schema, infoBox }) => {\n const { externalUpdateTime } = useContext(RecordEditContext);\n\n const { data, refetch } = useData({ id, schema, infoBox });\n\n useEffect(() => {\n refetch();\n }, [externalUpdateTime, refetch]);\n\n if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;\n\n const items = Object.values(data).flatMap(item => Object.values(item));\n\n return <InfoBox items={items} infoBoxKey={infoBox.key} />;\n};\n\nexport default InfoBoxContainer;\n\nInfoBoxContainer.propTypes = {\n id: PropTypes.string.isRequired,\n infoBox: PropTypes.object.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,IAAIC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AACpD,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,OAAO,MAAM,2BAA2B;AAC/C,SAASC,iBAAiB,QAAQ,6CAA6C;AAE/E,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,KAAK;EACpD,MAAM;IAAEC;EAAmB,CAAC,GAAGT,UAAU,CAACI,iBAAiB,CAAC;EAE5D,MAAM;IAAEM,IAAI;IAAEC;EAAQ,CAAC,GAAGT,OAAO,CAAC;IAAEI,EAAE;IAAEC,MAAM;IAAEC;EAAQ,CAAC,CAAC;EAE1DP,SAAS,CAAC,MAAM;IACdU,OAAO,CAAC,CAAC;EACX,CAAC,EAAE,CAACF,kBAAkB,EAAEE,OAAO,CAAC,CAAC;EAEjC,IAAI,CAACD,IAAI,IAAI,CAACE,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC,IAAIE,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAE9E,MAAMC,KAAK,GAAGH,MAAM,CAACI,MAAM,CAACN,IAAI,CAAC,CAACO,OAAO,CAACC,IAAI,IAAIN,MAAM,CAACI,MAAM,CAACE,IAAI,CAAC,CAAC;EAEtE,oBAAOnB,KAAA,CAAAoB,aAAA,CAAChB,OAAO;IAACY,KAAK,EAAEA,KAAM;IAACK,UAAU,EAAEZ,OAAO,CAACa;EAAI,CAAE,CAAC;AAC3D,CAAC;AAED,eAAehB,gBAAgB;AAE/BA,gBAAgB,CAACiB,SAAS,GAAG;EAC3BhB,EAAE,EAAER,SAAS,CAACyB,MAAM,CAACC,UAAU;EAC/BhB,OAAO,EAAEV,SAAS,CAAC2B,MAAM,CAACD,UAAU;EACpCjB,MAAM,EAAET,SAAS,CAAC2B,MAAM,CAACD;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
+
export default function buildDynamicQuery({
|
|
4
|
+
id,
|
|
5
|
+
schema,
|
|
6
|
+
properties
|
|
7
|
+
}) {
|
|
8
|
+
if (!id) return null;
|
|
9
|
+
if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
|
|
10
|
+
throw new BlazeError('DataEntity query requires get action, properties and fields from entity schema');
|
|
11
|
+
}
|
|
12
|
+
const fields = properties.map(infoProperty => `${infoProperty} {
|
|
13
|
+
label
|
|
14
|
+
value
|
|
15
|
+
showLabel
|
|
16
|
+
url
|
|
17
|
+
tooltipIcon
|
|
18
|
+
tooltipContent
|
|
19
|
+
}`);
|
|
20
|
+
return gql`query getInfoBoxData($id: String!){
|
|
21
|
+
${schema.actions.get}( id: $id ) {
|
|
22
|
+
id
|
|
23
|
+
${fields.map(field => field)}
|
|
24
|
+
__typename
|
|
25
|
+
}
|
|
26
|
+
}`;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=build-dynamic-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","properties","actions","get","fields","map","infoProperty","field"],"sources":["../../../../src/components/InfoBoxes/helpers/build-dynamic-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nexport default function buildDynamicQuery({ id, schema, properties }) {\n if (!id) return null;\n\n if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {\n throw new BlazeError(\n 'DataEntity query requires get action, properties and fields from entity schema'\n );\n }\n\n const fields = properties.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n url\n tooltipIcon\n tooltipContent\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAW,CAAC,EAAE;EACpE,IAAI,CAACF,EAAE,EAAE,OAAO,IAAI;EAEpB,IAAI,CAACC,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACC,UAAU,EAAE;IAC3E,MAAM,IAAIJ,UAAU,CAClB,gFACF,CAAC;EACH;EAEA,MAAMO,MAAM,GAAGH,UAAU,CAACI,GAAG,CAC3BC,YAAY,IACV,GAAGA,YAAY;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,MACE,CAAC;EAED,OAAOV,GAAG;AACZ,MAAMI,MAAM,CAACE,OAAO,CAACC,GAAG;AACxB;AACA,QAAQC,MAAM,CAACC,GAAG,CAACE,KAAK,IAAIA,KAAK,CAAC;AAClC;AACA;AACA,IAAI;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useQuery, gql } from '@apollo/client';
|
|
2
|
+
import useInfoBoxData from './useInfoBox';
|
|
3
|
+
function useData({
|
|
4
|
+
id,
|
|
5
|
+
schema,
|
|
6
|
+
infoBox
|
|
7
|
+
}) {
|
|
8
|
+
const {
|
|
9
|
+
query
|
|
10
|
+
} = useInfoBoxData({
|
|
11
|
+
id,
|
|
12
|
+
schema,
|
|
13
|
+
infoBox
|
|
14
|
+
});
|
|
15
|
+
const infoBoxQuery = query || gql`
|
|
16
|
+
query {
|
|
17
|
+
__typename
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const {
|
|
21
|
+
data = {},
|
|
22
|
+
loading,
|
|
23
|
+
error,
|
|
24
|
+
refetch
|
|
25
|
+
} = useQuery(infoBoxQuery, {
|
|
26
|
+
variables: {
|
|
27
|
+
id
|
|
28
|
+
},
|
|
29
|
+
skip: !query
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
data: data.__typename !== 'Query' ? data : null,
|
|
33
|
+
loading,
|
|
34
|
+
error,
|
|
35
|
+
refetch
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export default useData;
|
|
39
|
+
//# sourceMappingURL=useData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useData.js","names":["useQuery","gql","useInfoBoxData","useData","id","schema","infoBox","query","infoBoxQuery","data","loading","error","refetch","variables","skip","__typename"],"sources":["../../../../src/components/InfoBoxes/hooks/useData.js"],"sourcesContent":["import { useQuery, gql } from '@apollo/client';\nimport useInfoBoxData from './useInfoBox';\n\nfunction useData({ id, schema, infoBox }) {\n const { query } = useInfoBoxData({ id, schema, infoBox });\n\n const infoBoxQuery =\n query ||\n gql`\n query {\n __typename\n }\n `;\n\n const {\n data = {},\n loading,\n error,\n refetch\n } = useQuery(infoBoxQuery, {\n variables: { id },\n skip: !query\n });\n\n return { data: data.__typename !== 'Query' ? data : null, loading, error, refetch };\n}\n\nexport default useData;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,GAAG,QAAQ,gBAAgB;AAC9C,OAAOC,cAAc,MAAM,cAAc;AAEzC,SAASC,OAAOA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EACxC,MAAM;IAAEC;EAAM,CAAC,GAAGL,cAAc,CAAC;IAAEE,EAAE;IAAEC,MAAM;IAAEC;EAAQ,CAAC,CAAC;EAEzD,MAAME,YAAY,GAChBD,KAAK,IACLN,GAAG;AACP;AACA;AACA;AACA,KAAK;EAEH,MAAM;IACJQ,IAAI,GAAG,CAAC,CAAC;IACTC,OAAO;IACPC,KAAK;IACLC;EACF,CAAC,GAAGZ,QAAQ,CAACQ,YAAY,EAAE;IACzBK,SAAS,EAAE;MAAET;IAAG,CAAC;IACjBU,IAAI,EAAE,CAACP;EACT,CAAC,CAAC;EAEF,OAAO;IAAEE,IAAI,EAAEA,IAAI,CAACM,UAAU,KAAK,OAAO,GAAGN,IAAI,GAAG,IAAI;IAAEC,OAAO;IAAEC,KAAK;IAAEC;EAAQ,CAAC;AACrF;AAEA,eAAeT,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import buildDynamicQuery from '../helpers/build-dynamic-query';
|
|
2
|
+
function useInfoBox({
|
|
3
|
+
id,
|
|
4
|
+
schema,
|
|
5
|
+
infoBox
|
|
6
|
+
}) {
|
|
7
|
+
const query = buildDynamicQuery({
|
|
8
|
+
id,
|
|
9
|
+
schema,
|
|
10
|
+
properties: [infoBox.property]
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
query: query || null
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export default useInfoBox;
|
|
17
|
+
//# sourceMappingURL=useInfoBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInfoBox.js","names":["buildDynamicQuery","useInfoBox","id","schema","infoBox","query","properties","property"],"sources":["../../../../src/components/InfoBoxes/hooks/useInfoBox.js"],"sourcesContent":["import buildDynamicQuery from '../helpers/build-dynamic-query';\n\nfunction useInfoBox({ id, schema, infoBox }) {\n const query = buildDynamicQuery({\n id,\n schema,\n properties: [infoBox.property]\n });\n\n return { query: query || null };\n}\n\nexport default useInfoBox;\n"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,gCAAgC;AAE9D,SAASC,UAAUA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EAC3C,MAAMC,KAAK,GAAGL,iBAAiB,CAAC;IAC9BE,EAAE;IACFC,MAAM;IACNG,UAAU,EAAE,CAACF,OAAO,CAACG,QAAQ;EAC/B,CAAC,CAAC;EAEF,OAAO;IAAEF,KAAK,EAAEA,KAAK,IAAI;EAAK,CAAC;AACjC;AAEA,eAAeJ,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["InfoBoxes"],"sources":["../../../src/components/InfoBoxes/index.js"],"sourcesContent":["import InfoBoxes from './InfoBoxes';\n\nexport default InfoBoxes;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AAEnC,eAAeA,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import InfoBoxValue from './InfoBoxValue';
|
|
4
|
+
import InfoBoxLabel from './InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../InfoBoxTooltip';
|
|
6
|
+
const InfoBox = ({
|
|
7
|
+
items,
|
|
8
|
+
infoBoxKey
|
|
9
|
+
}) => {
|
|
10
|
+
if (!items) return null;
|
|
11
|
+
const infoBoxItems = items.map(item => Object.values(item).map(info => {
|
|
12
|
+
if (!info.label || !info.value) return null;
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: "info-box--item",
|
|
15
|
+
key: `${infoBoxKey}-${info.label.toLowerCase()}`
|
|
16
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: "info-box--label"
|
|
18
|
+
}, /*#__PURE__*/React.createElement(InfoBoxLabel, {
|
|
19
|
+
item: info
|
|
20
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "info-box--value"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
23
|
+
item: info
|
|
24
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
25
|
+
info: info
|
|
26
|
+
})));
|
|
27
|
+
}).filter(Boolean));
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "info-box",
|
|
30
|
+
key: infoBoxKey
|
|
31
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "info-box--container"
|
|
33
|
+
}, infoBoxItems));
|
|
34
|
+
};
|
|
35
|
+
InfoBox.propTypes = {
|
|
36
|
+
infoBoxKey: PropTypes.string.isRequired,
|
|
37
|
+
items: PropTypes.array.isRequired
|
|
38
|
+
};
|
|
39
|
+
export default InfoBox;
|
|
40
|
+
//# sourceMappingURL=InfoBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBox.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","InfoBoxTooltip","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';\nimport InfoBoxValue from './InfoBoxValue';\nimport InfoBoxLabel from './InfoBoxLabel';\nimport InfoBoxTooltip from '../InfoBoxTooltip';\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\">\n <InfoBoxLabel item={info} />\n </div>\n <div className=\"info-box--value\">\n <InfoBoxValue item={info} />\n <InfoBoxTooltip info={info} />\n </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\nInfoBox.propTypes = {\n infoBoxKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n\nexport default InfoBox;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,cAAc,MAAM,mBAAmB;AAE9C,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,oBACEd,KAAA,CAAAe,aAAA;MAAKC,SAAS,EAAC,gBAAgB;MAACC,GAAG,EAAE,GAAGX,UAAU,IAAIM,IAAI,CAACC,KAAK,CAACK,WAAW,CAAC,CAAC;IAAG,gBAC/ElB,KAAA,CAAAe,aAAA;MAAKC,SAAS,EAAC;IAAiB,gBAC9BhB,KAAA,CAAAe,aAAA,CAACb,YAAY;MAACO,IAAI,EAAEG;IAAK,CAAE,CACxB,CAAC,eACNZ,KAAA,CAAAe,aAAA;MAAKC,SAAS,EAAC;IAAiB,gBAC9BhB,KAAA,CAAAe,aAAA,CAACd,YAAY;MAACQ,IAAI,EAAEG;IAAK,CAAE,CAAC,eAC5BZ,KAAA,CAAAe,aAAA,CAACZ,cAAc;MAACS,IAAI,EAAEA;IAAK,CAAE,CAC1B,CACF,CAAC;EAEV,CAAC,CAAC,CACDO,MAAM,CAACC,OAAO,CACnB,CAAC;EAED,oBACEpB,KAAA,CAAAe,aAAA;IAAKC,SAAS,EAAC,UAAU;IAACC,GAAG,EAAEX;EAAW,gBACxCN,KAAA,CAAAe,aAAA;IAAKC,SAAS,EAAC;EAAqB,GAAET,YAAkB,CACrD,CAAC;AAEV,CAAC;AAEDH,OAAO,CAACiB,SAAS,GAAG;EAClBf,UAAU,EAAEP,SAAS,CAACuB,MAAM,CAACC,UAAU;EACvClB,KAAK,EAAEN,SAAS,CAACyB,KAAK,CAACD;AACzB,CAAC;AAED,eAAenB,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBoxLabel.js","names":["InfoBoxLabel","item","suffix","label","showLabel"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBoxLabel.js"],"sourcesContent":["const InfoBoxLabel = ({ item, suffix = ' ' }) => {\n const { label, showLabel = true } = item;\n return showLabel ? `${label}:${suffix}` : null;\n};\n\nexport default InfoBoxLabel;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGA,CAAC;EAAEC,IAAI;EAAEC,MAAM,GAAG;AAAI,CAAC,KAAK;EAC/C,MAAM;IAAEC,KAAK;IAAEC,SAAS,GAAG;EAAK,CAAC,GAAGH,IAAI;EACxC,OAAOG,SAAS,GAAG,GAAGD,KAAK,IAAID,MAAM,EAAE,GAAG,IAAI;AAChD,CAAC;AAED,eAAeF,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
const InfoBoxValue = ({
|
|
5
|
+
item = {}
|
|
6
|
+
}) => {
|
|
7
|
+
const {
|
|
8
|
+
url,
|
|
9
|
+
value
|
|
10
|
+
} = item;
|
|
11
|
+
if (url) {
|
|
12
|
+
if (url.startsWith('http')) {
|
|
13
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
14
|
+
href: url,
|
|
15
|
+
target: "_blank",
|
|
16
|
+
rel: "noopener noreferrer"
|
|
17
|
+
}, value);
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
20
|
+
to: url,
|
|
21
|
+
target: "_blank"
|
|
22
|
+
}, value);
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
InfoBoxValue.propTypes = {
|
|
27
|
+
item: PropTypes.object.isRequired
|
|
28
|
+
};
|
|
29
|
+
export default InfoBoxValue;
|
|
30
|
+
//# sourceMappingURL=InfoBoxValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBoxValue.js","names":["PropTypes","React","Link","InfoBoxValue","item","url","value","startsWith","createElement","href","target","rel","to","propTypes","object","isRequired"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBoxValue.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport { Link } from 'react-router-dom';\n\nconst InfoBoxValue = ({ item = {} }) => {\n const { url, value } = item;\n if (url) {\n if (url.startsWith('http')) {\n return (\n <a href={url} target=\"_blank\" rel=\"noopener noreferrer\">\n {value}\n </a>\n );\n }\n return (\n <Link to={url} target=\"_blank\">\n {value}\n </Link>\n );\n }\n\n return value;\n};\n\nInfoBoxValue.propTypes = {\n item: PropTypes.object.isRequired\n};\n\nexport default InfoBoxValue;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AAEvC,MAAMC,YAAY,GAAGA,CAAC;EAAEC,IAAI,GAAG,CAAC;AAAE,CAAC,KAAK;EACtC,MAAM;IAAEC,GAAG;IAAEC;EAAM,CAAC,GAAGF,IAAI;EAC3B,IAAIC,GAAG,EAAE;IACP,IAAIA,GAAG,CAACE,UAAU,CAAC,MAAM,CAAC,EAAE;MAC1B,oBACEN,KAAA,CAAAO,aAAA;QAAGC,IAAI,EAAEJ,GAAI;QAACK,MAAM,EAAC,QAAQ;QAACC,GAAG,EAAC;MAAqB,GACpDL,KACA,CAAC;IAER;IACA,oBACEL,KAAA,CAAAO,aAAA,CAACN,IAAI;MAACU,EAAE,EAAEP,GAAI;MAACK,MAAM,EAAC;IAAQ,GAC3BJ,KACG,CAAC;EAEX;EAEA,OAAOA,KAAK;AACd,CAAC;AAEDH,YAAY,CAACU,SAAS,GAAG;EACvBT,IAAI,EAAEJ,SAAS,CAACc,MAAM,CAACC;AACzB,CAAC;AAED,eAAeZ,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,207 @@
|
|
|
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; }
|
|
4
|
+
import React, { useEffect, useState, Fragment } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import More from '@blaze-react/more';
|
|
7
|
+
import { useApolloClient } from '@apollo/client';
|
|
8
|
+
import { withRouter, Link, useLocation } from 'react-router-dom';
|
|
9
|
+
import { PageHeader, DeleteAction, CardPrompt } from '@blaze-cms/admin';
|
|
10
|
+
import { useToasts } from '@blaze-react/toaster';
|
|
11
|
+
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
12
|
+
import ListingTableContent from './ListingTableContent';
|
|
13
|
+
import availableActions from '../EntityManager/Entity/actions-handlers';
|
|
14
|
+
import { fetchData } from './service';
|
|
15
|
+
import { populateRows, formatRows, getParsedRowData } from './mappers/populate-rows';
|
|
16
|
+
import { getDefaultQueryParams } from '../../utils/get-default-query-params';
|
|
17
|
+
const ListingTable = ({
|
|
18
|
+
match,
|
|
19
|
+
entitySchema,
|
|
20
|
+
history
|
|
21
|
+
}) => {
|
|
22
|
+
const [tableData, setTableData] = useState({});
|
|
23
|
+
const [modalStatus, setModalStatus] = useState(false);
|
|
24
|
+
const [itemToDelete, setItemToDelete] = useState({});
|
|
25
|
+
const [previousSchema, setPreviousSchema] = useState({
|
|
26
|
+
id: null
|
|
27
|
+
});
|
|
28
|
+
const [totalItems, setTotalItems] = useState(0);
|
|
29
|
+
const queryParamsDefault = getDefaultQueryParams(entitySchema);
|
|
30
|
+
const [queryParams, setQueryParams] = useState(queryParamsDefault);
|
|
31
|
+
const [listFilters, setListFilters] = useState([]);
|
|
32
|
+
const client = useApolloClient();
|
|
33
|
+
const {
|
|
34
|
+
addToast
|
|
35
|
+
} = useToasts();
|
|
36
|
+
const location = useLocation();
|
|
37
|
+
const searchParams = new URLSearchParams(location.search);
|
|
38
|
+
const currentPage = Number(searchParams.get('page')) || 1;
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
(async () => {
|
|
41
|
+
if (entitySchema.id !== previousSchema.id || previousSchema.id === null && entitySchema.id) {
|
|
42
|
+
const updatedQueryParams = _objectSpread(_objectSpread({}, queryParams), {}, {
|
|
43
|
+
offset: currentPage * queryParamsDefault.limit - queryParamsDefault.limit
|
|
44
|
+
});
|
|
45
|
+
await doQuery(listFilters, updatedQueryParams);
|
|
46
|
+
setPreviousSchema({
|
|
47
|
+
id: entitySchema.id
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
}, [client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps
|
|
52
|
+
);
|
|
53
|
+
const doQuery = async (filters = listFilters, params = queryParamsDefault) => {
|
|
54
|
+
const {
|
|
55
|
+
listingData,
|
|
56
|
+
totalRecords
|
|
57
|
+
} = await fetchData({
|
|
58
|
+
client,
|
|
59
|
+
querySettings: {
|
|
60
|
+
entitySchema,
|
|
61
|
+
queryParams: params
|
|
62
|
+
},
|
|
63
|
+
listFilters: filters
|
|
64
|
+
});
|
|
65
|
+
const populatedTable = populateRows({
|
|
66
|
+
toggleModal,
|
|
67
|
+
url: match.url,
|
|
68
|
+
entitySchema,
|
|
69
|
+
rows: listingData
|
|
70
|
+
});
|
|
71
|
+
setTableData(populatedTable);
|
|
72
|
+
setTotalItems(totalRecords);
|
|
73
|
+
};
|
|
74
|
+
const handleOnPageChange = async ({
|
|
75
|
+
pageNumber,
|
|
76
|
+
offset: _offset
|
|
77
|
+
}) => {
|
|
78
|
+
const updatedQueryParams = _objectSpread(_objectSpread({}, queryParams), {}, {
|
|
79
|
+
offset: _offset
|
|
80
|
+
});
|
|
81
|
+
await doQuery(listFilters, updatedQueryParams);
|
|
82
|
+
history.push(`?page=${pageNumber}`);
|
|
83
|
+
document.getElementsByClassName('page')[0].scrollTo(0, 0);
|
|
84
|
+
};
|
|
85
|
+
const updateListingFilters = async filters => {
|
|
86
|
+
await doQuery(filters);
|
|
87
|
+
setListFilters(filters);
|
|
88
|
+
};
|
|
89
|
+
const onCloseCardPrompt = () => null;
|
|
90
|
+
const toggleModal = item => {
|
|
91
|
+
setModalStatus(!!item);
|
|
92
|
+
setItemToDelete(item || {});
|
|
93
|
+
};
|
|
94
|
+
const deleteAction = async () => {
|
|
95
|
+
await availableActions.delete.submit({
|
|
96
|
+
entitySchema,
|
|
97
|
+
parsedFormValues: {
|
|
98
|
+
id: itemToDelete.id
|
|
99
|
+
},
|
|
100
|
+
client
|
|
101
|
+
}, addToast);
|
|
102
|
+
toggleModal();
|
|
103
|
+
const updatedTableData = _objectSpread(_objectSpread({}, tableData), {}, {
|
|
104
|
+
rows: tableData.rows.filter(({
|
|
105
|
+
id
|
|
106
|
+
}) => id !== itemToDelete.id)
|
|
107
|
+
});
|
|
108
|
+
setTableData(updatedTableData);
|
|
109
|
+
};
|
|
110
|
+
const handleSort = async event => {
|
|
111
|
+
const [[property, direction]] = Object.entries(event);
|
|
112
|
+
const sortQueryParams = _objectSpread(_objectSpread({}, queryParamsDefault), {}, {
|
|
113
|
+
sort: [{
|
|
114
|
+
property,
|
|
115
|
+
direction
|
|
116
|
+
}]
|
|
117
|
+
});
|
|
118
|
+
setQueryParams(sortQueryParams);
|
|
119
|
+
const {
|
|
120
|
+
listingData
|
|
121
|
+
} = await fetchData({
|
|
122
|
+
client,
|
|
123
|
+
querySettings: {
|
|
124
|
+
entitySchema,
|
|
125
|
+
queryParams: sortQueryParams
|
|
126
|
+
},
|
|
127
|
+
listFilters
|
|
128
|
+
});
|
|
129
|
+
const {
|
|
130
|
+
columns,
|
|
131
|
+
isEnquiry
|
|
132
|
+
} = tableData;
|
|
133
|
+
const [firstColumn] = columns;
|
|
134
|
+
setTableData(_objectSpread(_objectSpread({}, tableData), {}, {
|
|
135
|
+
appliedSort: {
|
|
136
|
+
[property]: direction
|
|
137
|
+
},
|
|
138
|
+
rows: formatRows({
|
|
139
|
+
rows: getParsedRowData(listingData),
|
|
140
|
+
url: match.url,
|
|
141
|
+
toggleModal,
|
|
142
|
+
firstColumn,
|
|
143
|
+
isEnquiry,
|
|
144
|
+
entitySchema
|
|
145
|
+
})
|
|
146
|
+
}));
|
|
147
|
+
history.push('?page=1');
|
|
148
|
+
};
|
|
149
|
+
if (!tableData || !tableData.rows) return 'loading';
|
|
150
|
+
const {
|
|
151
|
+
displayProperties: {
|
|
152
|
+
adminCrudActions: {
|
|
153
|
+
create: createAction = {
|
|
154
|
+
active: true
|
|
155
|
+
},
|
|
156
|
+
delete: _deleteAction = {
|
|
157
|
+
active: true
|
|
158
|
+
}
|
|
159
|
+
} = {}
|
|
160
|
+
} = {}
|
|
161
|
+
} = entitySchema;
|
|
162
|
+
const showAddButton = !tableData.rows.length && listFilters.length === 0;
|
|
163
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
className: "page"
|
|
165
|
+
}, modalStatus && _deleteAction.active && /*#__PURE__*/React.createElement(DeleteAction, {
|
|
166
|
+
"data-testid": "deleteEntity",
|
|
167
|
+
onClose: toggleModal,
|
|
168
|
+
deleteAction: deleteAction,
|
|
169
|
+
itemName: itemToDelete.name
|
|
170
|
+
}), /*#__PURE__*/React.createElement(PageHeader, {
|
|
171
|
+
title: entitySchema.displayName,
|
|
172
|
+
subtitle: ""
|
|
173
|
+
}, createAction.active && !showAddButton && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Link, {
|
|
174
|
+
"data-testid": "addEntity",
|
|
175
|
+
className: "button button--small",
|
|
176
|
+
to: `${match.url}/create`
|
|
177
|
+
}, "Add"), /*#__PURE__*/React.createElement(PageHeader.Actions, null, /*#__PURE__*/React.createElement(More, null, /*#__PURE__*/React.createElement(More.Avatar, {
|
|
178
|
+
isMoreMenu: true
|
|
179
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
180
|
+
className: "material-icons"
|
|
181
|
+
}, "more_vert")), /*#__PURE__*/React.createElement(More.Content, {
|
|
182
|
+
isMoreMenu: true
|
|
183
|
+
}))))), showAddButton ? /*#__PURE__*/React.createElement(CardPrompt, null, /*#__PURE__*/React.createElement(Link, {
|
|
184
|
+
className: "button button--rounded button--cta",
|
|
185
|
+
to: `${match.url}/create`,
|
|
186
|
+
"data-testid": "add-button"
|
|
187
|
+
}, "Add")) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(RenderHook, {
|
|
188
|
+
hookKey: "entity:listing:main:top",
|
|
189
|
+
schema: entitySchema,
|
|
190
|
+
listFilters: listFilters,
|
|
191
|
+
setListFilters: updateListingFilters
|
|
192
|
+
}), /*#__PURE__*/React.createElement(ListingTableContent, {
|
|
193
|
+
totalItems: totalItems,
|
|
194
|
+
currentPage: currentPage,
|
|
195
|
+
onSort: handleSort,
|
|
196
|
+
handleOnPageChange: handleOnPageChange,
|
|
197
|
+
tableData: tableData,
|
|
198
|
+
onCloseCardPrompt: onCloseCardPrompt
|
|
199
|
+
})));
|
|
200
|
+
};
|
|
201
|
+
ListingTable.propTypes = {
|
|
202
|
+
entitySchema: PropTypes.object.isRequired,
|
|
203
|
+
match: PropTypes.object.isRequired,
|
|
204
|
+
history: PropTypes.object.isRequired
|
|
205
|
+
};
|
|
206
|
+
export default withRouter(ListingTable);
|
|
207
|
+
//# sourceMappingURL=ListingTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListingTable.js","names":["React","useEffect","useState","Fragment","PropTypes","More","useApolloClient","withRouter","Link","useLocation","PageHeader","DeleteAction","CardPrompt","useToasts","RenderHook","ListingTableContent","availableActions","fetchData","populateRows","formatRows","getParsedRowData","getDefaultQueryParams","ListingTable","match","entitySchema","history","tableData","setTableData","modalStatus","setModalStatus","itemToDelete","setItemToDelete","previousSchema","setPreviousSchema","id","totalItems","setTotalItems","queryParamsDefault","queryParams","setQueryParams","listFilters","setListFilters","client","addToast","location","searchParams","URLSearchParams","search","currentPage","Number","get","updatedQueryParams","_objectSpread","offset","limit","doQuery","url","filters","params","listingData","totalRecords","querySettings","populatedTable","toggleModal","rows","handleOnPageChange","pageNumber","_offset","push","document","getElementsByClassName","scrollTo","updateListingFilters","onCloseCardPrompt","item","deleteAction","delete","submit","parsedFormValues","updatedTableData","filter","handleSort","event","property","direction","Object","entries","sortQueryParams","sort","columns","isEnquiry","firstColumn","appliedSort","displayProperties","adminCrudActions","create","createAction","active","_deleteAction","showAddButton","length","createElement","className","onClose","itemName","name","title","displayName","subtitle","to","Actions","Avatar","isMoreMenu","Content","hookKey","schema","onSort","propTypes","object","isRequired"],"sources":["../../../src/components/ListingTable/ListingTable.js"],"sourcesContent":["import React, { useEffect, useState, Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport More from '@blaze-react/more';\nimport { useApolloClient } from '@apollo/client';\nimport { withRouter, Link, useLocation } from 'react-router-dom';\nimport { PageHeader, DeleteAction, CardPrompt } from '@blaze-cms/admin';\nimport { useToasts } from '@blaze-react/toaster';\nimport { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';\nimport ListingTableContent from './ListingTableContent';\nimport availableActions from '../EntityManager/Entity/actions-handlers';\nimport { fetchData } from './service';\nimport { populateRows, formatRows, getParsedRowData } from './mappers/populate-rows';\nimport { getDefaultQueryParams } from '../../utils/get-default-query-params';\n\nconst ListingTable = ({ match, entitySchema, history }) => {\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 [totalItems, setTotalItems] = useState(0);\n const queryParamsDefault = getDefaultQueryParams(entitySchema);\n const [queryParams, setQueryParams] = useState(queryParamsDefault);\n const [listFilters, setListFilters] = useState([]);\n const client = useApolloClient();\n const { addToast } = useToasts();\n const location = useLocation();\n const searchParams = new URLSearchParams(location.search);\n const currentPage = Number(searchParams.get('page')) || 1;\n\n useEffect(\n () => {\n (async () => {\n if (\n entitySchema.id !== previousSchema.id ||\n (previousSchema.id === null && entitySchema.id)\n ) {\n const updatedQueryParams = {\n ...queryParams,\n offset: currentPage * queryParamsDefault.limit - queryParamsDefault.limit\n };\n await doQuery(listFilters, updatedQueryParams);\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 doQuery = async (filters = listFilters, params = queryParamsDefault) => {\n const { listingData, totalRecords } = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: params\n },\n listFilters: filters\n });\n\n const populatedTable = populateRows({\n toggleModal,\n url: match.url,\n entitySchema,\n rows: listingData\n });\n\n setTableData(populatedTable);\n setTotalItems(totalRecords);\n };\n\n const handleOnPageChange = async ({ pageNumber, offset: _offset }) => {\n const updatedQueryParams = {\n ...queryParams,\n offset: _offset\n };\n\n await doQuery(listFilters, updatedQueryParams);\n\n history.push(`?page=${pageNumber}`);\n document.getElementsByClassName('page')[0].scrollTo(0, 0);\n };\n\n const updateListingFilters = async filters => {\n await doQuery(filters);\n setListFilters(filters);\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 setQueryParams(sortQueryParams);\n\n const { listingData } = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: sortQueryParams\n },\n listFilters\n });\n const { columns, isEnquiry } = tableData;\n const [firstColumn] = columns;\n\n setTableData({\n ...tableData,\n appliedSort: { [property]: direction },\n rows: formatRows({\n rows: getParsedRowData(listingData),\n url: match.url,\n toggleModal,\n firstColumn,\n isEnquiry,\n entitySchema\n })\n });\n history.push('?page=1');\n };\n if (!tableData || !tableData.rows) return 'loading';\n\n const {\n displayProperties: {\n adminCrudActions: {\n create: createAction = { active: true },\n delete: _deleteAction = { active: true }\n } = {}\n } = {}\n } = entitySchema;\n\n const showAddButton = !tableData.rows.length && listFilters.length === 0;\n\n return (\n <div className=\"page\">\n {modalStatus && _deleteAction.active && (\n <DeleteAction\n data-testid=\"deleteEntity\"\n onClose={toggleModal}\n deleteAction={deleteAction}\n itemName={itemToDelete.name}\n />\n )}\n <PageHeader title={entitySchema.displayName} subtitle=\"\">\n {createAction.active && !showAddButton && (\n <>\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 </>\n )}\n </PageHeader>\n {showAddButton ? (\n <CardPrompt>\n <Link\n className=\"button button--rounded button--cta\"\n to={`${match.url}/create`}\n data-testid=\"add-button\">\n Add\n </Link>\n </CardPrompt>\n ) : (\n <>\n <RenderHook\n hookKey=\"entity:listing:main:top\"\n schema={entitySchema}\n listFilters={listFilters}\n setListFilters={updateListingFilters}\n />\n <ListingTableContent\n totalItems={totalItems}\n currentPage={currentPage}\n onSort={handleSort}\n handleOnPageChange={handleOnPageChange}\n tableData={tableData}\n onCloseCardPrompt={onCloseCardPrompt}\n />\n </>\n )}\n </div>\n );\n};\nListingTable.propTypes = {\n entitySchema: PropTypes.object.isRequired,\n match: PropTypes.object.isRequired,\n history: PropTypes.object.isRequired\n};\n\nexport default withRouter(ListingTable);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,UAAU,EAAEC,IAAI,EAAEC,WAAW,QAAQ,kBAAkB;AAChE,SAASC,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,kBAAkB;AACvE,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,gBAAgB,MAAM,0CAA0C;AACvE,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,YAAY,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,yBAAyB;AACpF,SAASC,qBAAqB,QAAQ,sCAAsC;AAE5E,MAAMC,YAAY,GAAGA,CAAC;EAAEC,KAAK;EAAEC,YAAY;EAAEC;AAAQ,CAAC,KAAK;EACzD,MAAM,CAACC,SAAS,EAAEC,YA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ACtF,mBAAmB;IAClBoB,UAAU,EAAEA,UAAW;IACvBa,WAAW,EAAEA,WAAY;IACzBoE,MAAM,EAAEnC,UAAW;IACnBhB,kBAAkB,EAAEA,kBAAmB;IACvCvC,SAAS,EAAEA,SAAU;IACrB+C,iBAAiB,EAAEA;EAAkB,CACtC,CACD,CAED,CAAC;AAEV,CAAC;AACDnD,YAAY,CAAC+F,SAAS,GAAG;EACvB7F,YAAY,EAAEpB,SAAS,CAACkH,MAAM,CAACC,UAAU;EACzChG,KAAK,EAAEnB,SAAS,CAACkH,MAAM,CAACC,UAAU;EAClC9F,OAAO,EAAErB,SAAS,CAACkH,MAAM,CAACC;AAC5B,CAAC;AAED,eAAehH,UAAU,CAACe,YAAY,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Table from '@blaze-react/table';
|
|
3
|
+
import Pagination from '@blaze-react/pagination';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { withRouter } from 'react-router-dom';
|
|
6
|
+
const ListingTableContent = ({
|
|
7
|
+
tableData,
|
|
8
|
+
handleSelect,
|
|
9
|
+
onSort,
|
|
10
|
+
handleOnPageChange,
|
|
11
|
+
currentPage,
|
|
12
|
+
totalItems
|
|
13
|
+
}) => {
|
|
14
|
+
const displayTable = tableData && tableData.rows && !!tableData.rows.length;
|
|
15
|
+
const {
|
|
16
|
+
isEnquiry
|
|
17
|
+
} = tableData;
|
|
18
|
+
const className = `page__content${isEnquiry ? ' array-table' : ''}`;
|
|
19
|
+
if (displayTable) {
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: className
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
23
|
+
onSort: onSort,
|
|
24
|
+
data: tableData,
|
|
25
|
+
checkboxes: !isEnquiry,
|
|
26
|
+
onSelect: handleSelect,
|
|
27
|
+
"data-testid": "listing-table-content"
|
|
28
|
+
}), /*#__PURE__*/React.createElement(Pagination, {
|
|
29
|
+
visiblePages: 10,
|
|
30
|
+
totalItems: totalItems,
|
|
31
|
+
currentPage: currentPage,
|
|
32
|
+
onPageChange: handleOnPageChange
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: "table-no-results",
|
|
37
|
+
"data-testid": "no-results"
|
|
38
|
+
}, "No results");
|
|
39
|
+
};
|
|
40
|
+
ListingTableContent.propTypes = {
|
|
41
|
+
tableData: PropTypes.object.isRequired,
|
|
42
|
+
match: PropTypes.shape({
|
|
43
|
+
url: PropTypes.string
|
|
44
|
+
}).isRequired,
|
|
45
|
+
handleSelect: PropTypes.func,
|
|
46
|
+
onSort: PropTypes.func,
|
|
47
|
+
handleOnPageChange: PropTypes.func,
|
|
48
|
+
currentPage: PropTypes.number.isRequired,
|
|
49
|
+
totalItems: PropTypes.number.isRequired
|
|
50
|
+
};
|
|
51
|
+
ListingTableContent.defaultProps = {
|
|
52
|
+
handleSelect: () => {},
|
|
53
|
+
onSort: () => {},
|
|
54
|
+
handleOnPageChange: () => {}
|
|
55
|
+
};
|
|
56
|
+
export default withRouter(ListingTableContent);
|
|
57
|
+
//# sourceMappingURL=ListingTableContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListingTableContent.js","names":["React","Table","Pagination","PropTypes","withRouter","ListingTableContent","tableData","handleSelect","onSort","handleOnPageChange","currentPage","totalItems","displayTable","rows","length","isEnquiry","className","createElement","data","checkboxes","onSelect","visiblePages","onPageChange","propTypes","object","isRequired","match","shape","url","string","func","number","defaultProps"],"sources":["../../../../src/components/ListingTable/ListingTableContent/ListingTableContent.js"],"sourcesContent":["import React from 'react';\nimport Table from '@blaze-react/table';\nimport Pagination from '@blaze-react/pagination';\nimport PropTypes from 'prop-types';\nimport { withRouter } from 'react-router-dom';\n\nconst ListingTableContent = ({\n tableData,\n handleSelect,\n onSort,\n handleOnPageChange,\n currentPage,\n totalItems\n}) => {\n const displayTable = tableData && tableData.rows && !!tableData.rows.length;\n const { isEnquiry } = tableData;\n const className = `page__content${isEnquiry ? ' array-table' : ''}`;\n\n if (displayTable) {\n return (\n <div className={className}>\n <Table\n onSort={onSort}\n data={tableData}\n checkboxes={!isEnquiry}\n onSelect={handleSelect}\n data-testid=\"listing-table-content\"\n />\n <Pagination\n visiblePages={10}\n totalItems={totalItems}\n currentPage={currentPage}\n onPageChange={handleOnPageChange}\n />\n </div>\n );\n }\n\n return (\n <span className=\"table-no-results\" data-testid=\"no-results\">\n No results\n </span>\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 handleOnPageChange: PropTypes.func,\n currentPage: PropTypes.number.isRequired,\n totalItems: PropTypes.number.isRequired\n};\n\nListingTableContent.defaultProps = {\n handleSelect: () => {},\n onSort: () => {},\n handleOnPageChange: () => {}\n};\n\nexport default withRouter(ListingTableContent);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,UAAU,MAAM,yBAAyB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,kBAAkB;AAE7C,MAAMC,mBAAmB,GAAGA,CAAC;EAC3BC,SAAS;EACTC,YAAY;EACZC,MAAM;EACNC,kBAAkB;EAClBC,WAAW;EACXC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAGN,SAAS,IAAIA,SAAS,CAACO,IAAI,IAAI,CAAC,CAACP,SAAS,CAACO,IAAI,CAACC,MAAM;EAC3E,MAAM;IAAEC;EAAU,CAAC,GAAGT,SAAS;EAC/B,MAAMU,SAAS,GAAG,gBAAgBD,SAAS,GAAG,cAAc,GAAG,EAAE,EAAE;EAEnE,IAAIH,YAAY,EAAE;IAChB,oBACEZ,KAAA,CAAAi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ListingTableContent"],"sources":["../../../../src/components/ListingTable/ListingTableContent/index.js"],"sourcesContent":["import ListingTableContent from './ListingTableContent';\n\nexport default ListingTableContent;\n"],"mappings":"AAAA,OAAOA,mBAAmB,MAAM,uBAAuB;AAEvD,eAAeA,mBAAmB","ignoreList":[]}
|