@blaze-cms/plugin-data-ui 0.146.0-node18.1 → 0.146.0-rc-eagle-3.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 +35 -12
- package/README.md +64 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +21 -19
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +2 -3
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +18 -20
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +290 -452
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +62 -66
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +34 -50
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +20 -26
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +20 -18
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +34 -32
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +105 -150
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +24 -24
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +34 -59
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +29 -45
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +7 -8
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +36 -57
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +47 -66
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +2 -3
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +92 -166
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +2 -3
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/RecordEditContext/index.js +3 -4
- package/lib/components/EntityManager/utils/RecordEditContext/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +34 -46
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +36 -75
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +51 -110
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +6 -10
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +17 -10
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxTooltip.js +43 -0
- package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib/components/InfoBoxes/InfoBoxes.js +19 -20
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +27 -38
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +21 -17
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useData.js +33 -30
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +10 -10
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/index.js +2 -3
- package/lib/components/InfoBoxes/index.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +28 -32
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js +11 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js +12 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +164 -303
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +62 -40
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +2 -3
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +182 -0
- package/lib/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js +505 -0
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js +53 -0
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/helpers.js +138 -0
- package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/querys.js +13 -0
- package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -0
- package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +2 -3
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +2 -3
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +104 -120
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +66 -84
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +27 -42
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/hooks/useCallbackDebounce.js +5 -9
- package/lib/components/hooks/useCallbackDebounce.js.map +1 -1
- package/lib/constants.js +31 -29
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +17 -20
- package/lib/icons/ContentIcon.js.map +1 -1
- package/lib/icons/SettingsIcon.js +12 -15
- package/lib/icons/SettingsIcon.js.map +1 -1
- package/lib/icons/TaxonomyIcon.js +15 -18
- package/lib/icons/TaxonomyIcon.js.map +1 -1
- package/lib/icons/UsersIcon.js +11 -14
- package/lib/icons/UsersIcon.js.map +1 -1
- package/lib/icons/index.js +8 -9
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +88 -121
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +67 -93
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +5 -18
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +11 -8
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +20 -17
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +15 -9
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +23 -10
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +4 -6
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +4 -12
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js +2 -3
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +23 -30
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +6 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +26 -7
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +8 -2
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +4 -14
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js +8 -5
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +4 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +12 -11
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +34 -16
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +173 -0
- package/lib-es/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +496 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +44 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js +127 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js +8 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js +3 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js +3 -2
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +6 -7
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/constants.js +4 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/index.js +12 -3
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/build-create-entity-mutation.js +5 -19
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-listing-query.js +4 -4
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/get-default-query-params.js +17 -5
- package/lib-es/utils/get-default-query-params.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/package.json +21 -17
- package/src/components/EntityManager/Entity/Entity.js +35 -40
- package/src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +8 -1
- package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +51 -17
- package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +5 -3
- package/src/components/EntityManager/Entity/actions-handlers/create/submit.js +4 -11
- package/src/components/EntityManager/utils/entity.js +11 -6
- package/src/components/InfoBoxes/InfoBoxTooltip.js +32 -0
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
- package/src/components/InfoBoxes/presentational/InfoBox.js +4 -2
- package/src/components/ListingTable/ListingTable.js +13 -18
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +43 -25
- package/src/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +160 -0
- package/src/components/ListingTable/SearchFilter/SearchContainer.js +553 -0
- package/src/components/ListingTable/SearchFilter/SearchFilter.js +41 -0
- package/src/components/ListingTable/SearchFilter/helpers.js +146 -0
- package/src/components/ListingTable/SearchFilter/querys.js +9 -0
- package/src/components/ListingTable/mappers/populate-rows.js +3 -0
- package/src/components/ListingTable/service/index.js +2 -2
- package/src/components/Tabs/index.js +17 -21
- package/src/constants.js +9 -1
- package/src/index.js +11 -7
- package/src/utils/build-create-entity-mutation.js +5 -28
- package/src/utils/build-listing-query.js +4 -4
- package/src/utils/get-default-query-params.js +21 -9
- package/src/utils/hoc/withContext.js +5 -4
- package/babel.config.js +0 -3
- package/jest.config.js +0 -5
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import Button from '@blaze-react/button';
|
|
4
4
|
import { useMutation } from '@apollo/client';
|
|
5
5
|
import { getMutation } from '@blaze-cms/admin-ui-utils';
|
|
6
|
+
import { DEBUG_PARAM } from '../../../../../constants';
|
|
6
7
|
const HeaderPreviewButton = ({
|
|
7
8
|
itemId,
|
|
8
9
|
itemEntity
|
|
@@ -25,7 +26,11 @@ const HeaderPreviewButton = ({
|
|
|
25
26
|
itemEntity
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
|
-
if (url)
|
|
29
|
+
if (url) {
|
|
30
|
+
const delimiter = url.includes('?') ? '&' : '?';
|
|
31
|
+
const debugParam = process.env.BLAZE_DISABLE_URL_DEBUG_PARAM ? '' : `${delimiter}${DEBUG_PARAM}`;
|
|
32
|
+
window.open(`${url}${debugParam}`, '_blank');
|
|
33
|
+
}
|
|
29
34
|
// eslint-disable-next-line no-empty
|
|
30
35
|
} catch (err) {}
|
|
31
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderPreviewButton.js","names":["React","PropTypes","Button","useMutation","getMutation","HeaderPreviewButton","itemId","itemEntity","createPreviewToken","process","env","BLAZE_DISABLE_PREVIEW","onViewPreview","data","result","url","variables","window","open","err","createElement","className","onClick","propTypes","string","isRequired"],"sources":["../../../../../../src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@blaze-react/button';\nimport { useMutation } from '@apollo/client';\nimport { getMutation } from '@blaze-cms/admin-ui-utils';\n\nconst HeaderPreviewButton = ({ itemId, itemEntity }) => {\n const [createPreviewToken] = useMutation(getMutation('PREVIEW_TOKEN_MUTATION'));\n if (process.env.BLAZE_DISABLE_PREVIEW) return null;\n\n const onViewPreview = async () => {\n try {\n const {\n data: {\n createPreviewToken: {\n result: { url }\n }\n } = {}\n } = await createPreviewToken({\n variables: {\n itemId,\n itemEntity\n }\n });\n\n if (url) window.open(url
|
|
1
|
+
{"version":3,"file":"HeaderPreviewButton.js","names":["React","PropTypes","Button","useMutation","getMutation","DEBUG_PARAM","HeaderPreviewButton","itemId","itemEntity","createPreviewToken","process","env","BLAZE_DISABLE_PREVIEW","onViewPreview","data","result","url","variables","delimiter","includes","debugParam","BLAZE_DISABLE_URL_DEBUG_PARAM","window","open","err","createElement","className","onClick","propTypes","string","isRequired"],"sources":["../../../../../../src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@blaze-react/button';\nimport { useMutation } from '@apollo/client';\nimport { getMutation } from '@blaze-cms/admin-ui-utils';\nimport { DEBUG_PARAM } from '../../../../../constants';\n\nconst HeaderPreviewButton = ({ itemId, itemEntity }) => {\n const [createPreviewToken] = useMutation(getMutation('PREVIEW_TOKEN_MUTATION'));\n if (process.env.BLAZE_DISABLE_PREVIEW) return null;\n\n const onViewPreview = async () => {\n try {\n const {\n data: {\n createPreviewToken: {\n result: { url }\n }\n } = {}\n } = await createPreviewToken({\n variables: {\n itemId,\n itemEntity\n }\n });\n\n if (url) {\n const delimiter = url.includes('?') ? '&' : '?';\n const debugParam = process.env.BLAZE_DISABLE_URL_DEBUG_PARAM\n ? ''\n : `${delimiter}${DEBUG_PARAM}`;\n window.open(`${url}${debugParam}`, '_blank');\n }\n // eslint-disable-next-line no-empty\n } catch (err) {}\n };\n\n return (\n <Button className=\"more-menu__link\" onClick={onViewPreview}>\n Preview\n </Button>\n );\n};\n\nHeaderPreviewButton.propTypes = {\n itemId: PropTypes.string.isRequired,\n itemEntity: PropTypes.string.isRequired\n};\n\nexport default HeaderPreviewButton;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,WAAW,QAAQ,0BAA0B;AAEtD,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAAW,CAAC,KAAK;EACtD,MAAM,CAACC,kBAAkB,CAAC,GAAGN,WAAW,CAACC,WAAW,CAAC,wBAAwB,CAAC,CAAC;EAC/E,IAAIM,OAAO,CAACC,GAAG,CAACC,qBAAqB,EAAE,OAAO,IAAI;EAElD,MAAMC,aAAa,GAAG,MAAAA,CAAA,KAAY;IAChC,IAAI;MACF,MAAM;QACJC,IAAI,EAAE;UACJL,kBAAkB,EAAE;YAClBM,MAAM,EAAE;cAAEC;YAAI;UAChB;QACF,CAAC,GAAG,CAAC;MACP,CAAC,GAAG,MAAMP,kBAAkB,CAAC;QAC3BQ,SAAS,EAAE;UACTV,MAAM;UACNC;QACF;MACF,CAAC,CAAC;MAEF,IAAIQ,GAAG,EAAE;QACP,MAAME,SAAS,GAAGF,GAAG,CAACG,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG;QAC/C,MAAMC,UAAU,GAAGV,OAAO,CAACC,GAAG,CAACU,6BAA6B,GACxD,EAAE,GACF,GAAGH,SAAS,GAAGb,WAAW,EAAE;QAChCiB,MAAM,CAACC,IAAI,CAAC,GAAGP,GAAG,GAAGI,UAAU,EAAE,EAAE,QAAQ,CAAC;MAC9C;MACA;IACF,CAAC,CAAC,OAAOI,GAAG,EAAE,CAAC;EACjB,CAAC;EAED,oBACExB,KAAA,CAAAyB,aAAA,CAACvB,MAAM;IAACwB,SAAS,EAAC,iBAAiB;IAACC,OAAO,EAAEd;EAAc,GAAC,SAEpD,CAAC;AAEb,CAAC;AAEDP,mBAAmB,CAACsB,SAAS,GAAG;EAC9BrB,MAAM,EAAEN,SAAS,CAAC4B,MAAM,CAACC,UAAU;EACnCtB,UAAU,EAAEP,SAAS,CAAC4B,MAAM,CAACC;AAC/B,CAAC;AAED,eAAexB,mBAAmB","ignoreList":[]}
|
package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","displayProperties","actions","get","properties","adminMainInfoProperty","Array","isArray","fields","map","infoProperty","field"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/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, displayProperties }) {\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 if (\n displayProperties.adminMainInfoProperty &&\n Array.isArray(displayProperties.adminMainInfoProperty)\n ) {\n const fields = displayProperties.adminMainInfoProperty.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\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\n return null;\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAkB,CAAC,EAAE;EAC3E,IAAI,CAACD,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;IAC3E,MAAM,IAAIP,UAAU,CAClB,gFACF,CAAC;EACH;EAEA,IACEI,iBAAiB,CAACI,qBAAqB,IACvCC,KAAK,CAACC,OAAO,CAACN,iBAAiB,CAACI,qBAAqB,CAAC,EACtD;IACA,MAAMG,MAAM,GAAGP,iBAAiB,CAACI,qBAAqB,CAACI,GAAG,CACxDC,YAAY,IACV,GAAGA,YAAY;AACvB;AACA;AACA;AACA,QACI,CAAC;IAED,OAAOd,GAAG;AACd,QAAQI,MAAM,CAACE,OAAO,CAACC,GAAG;AAC1B;AACA,SAASK,MAAM,CAACC,GAAG,CAACE,KAAK,IAAIA,KAAK,CAAC;AACnC;AACA;AACA,MAAM;EACJ;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","displayProperties","actions","get","properties","adminMainInfoProperty","Array","isArray","fields","map","infoProperty","field"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/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, displayProperties }) {\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 if (\n displayProperties.adminMainInfoProperty &&\n Array.isArray(displayProperties.adminMainInfoProperty)\n ) {\n const fields = displayProperties.adminMainInfoProperty.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\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\n return null;\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAkB,CAAC,EAAE;EAC3E,IAAI,CAACD,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;IAC3E,MAAM,IAAIP,UAAU,CAClB,gFACF,CAAC;EACH;EAEA,IACEI,iBAAiB,CAACI,qBAAqB,IACvCC,KAAK,CAACC,OAAO,CAACN,iBAAiB,CAACI,qBAAqB,CAAC,EACtD;IACA,MAAMG,MAAM,GAAGP,iBAAiB,CAACI,qBAAqB,CAACI,GAAG,CACxDC,YAAY,IACV,GAAGA,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA,QACI,CAAC;IAED,OAAOd,GAAG;AACd,QAAQI,MAAM,CAACE,OAAO,CAACC,GAAG;AAC1B;AACA,SAASK,MAAM,CAACC,GAAG,CAACE,KAAK,IAAIA,KAAK,CAAC;AACnC;AACA;AACA,MAAM;EACJ;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import uuidv1 from 'uuid/v1';
|
|
4
|
+
import Accordion from '@blaze-react/accordion';
|
|
4
5
|
import { useApolloClient } from '@apollo/client';
|
|
5
6
|
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
6
7
|
import { formFieldTypes } from '@blaze-cms/react-form-builder';
|
|
@@ -13,7 +14,9 @@ const SideBarRelations = ({
|
|
|
13
14
|
schema,
|
|
14
15
|
onChange,
|
|
15
16
|
formData,
|
|
16
|
-
entity
|
|
17
|
+
entity,
|
|
18
|
+
isOpen,
|
|
19
|
+
onToggle
|
|
17
20
|
}) => {
|
|
18
21
|
const {
|
|
19
22
|
relation: RelationComponent
|
|
@@ -23,6 +26,7 @@ const SideBarRelations = ({
|
|
|
23
26
|
formattedUpdated,
|
|
24
27
|
formattedCreated,
|
|
25
28
|
formattedPublished,
|
|
29
|
+
updatedBy,
|
|
26
30
|
status
|
|
27
31
|
} = formData;
|
|
28
32
|
const client = useApolloClient();
|
|
@@ -70,9 +74,18 @@ const SideBarRelations = ({
|
|
|
70
74
|
'sidebar__status__badge--unpublished': status === UNPUBLISHED
|
|
71
75
|
});
|
|
72
76
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className:
|
|
77
|
+
className: classnames('sidebar', {
|
|
78
|
+
'sidebar--collapsed': !isOpen
|
|
79
|
+
}),
|
|
74
80
|
"data-testid": "sideBarRelations-main-div"
|
|
75
81
|
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: "sidebar__toggle-button",
|
|
83
|
+
onClick: onToggle,
|
|
84
|
+
role: "button",
|
|
85
|
+
"aria-label": isOpen ? 'Collapse sidebar' : 'Expand sidebar'
|
|
86
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
87
|
+
className: "material-icons"
|
|
88
|
+
}, isOpen ? 'keyboard_arrow_right' : 'keyboard_arrow_left')), /*#__PURE__*/React.createElement("div", {
|
|
76
89
|
className: "sidebar__content"
|
|
77
90
|
}, /*#__PURE__*/React.createElement("div", {
|
|
78
91
|
className: "sidebar__status"
|
|
@@ -82,7 +95,7 @@ const SideBarRelations = ({
|
|
|
82
95
|
className: "sidebar__status__wrapper"
|
|
83
96
|
}, /*#__PURE__*/React.createElement("b", null, "Status"), /*#__PURE__*/React.createElement("span", {
|
|
84
97
|
className: statusClassName
|
|
85
|
-
}, formattedStatus)), formattedStatus === PUBLISHED && /*#__PURE__*/React.createElement("p", null, formattedStatus, " on: ", /*#__PURE__*/React.createElement("span", null, " ", formattedPublished))), !schema.displayProperties.disableDefaultAdminInfo && formattedCreated && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "Created: ", /*#__PURE__*/React.createElement("span", null, formattedCreated)), /*#__PURE__*/React.createElement("p", null, "Updated: ", /*#__PURE__*/React.createElement("span", null, formattedUpdated))), /*#__PURE__*/React.createElement(CustomSidebarInfoContainer, {
|
|
98
|
+
}, formattedStatus)), formattedStatus === PUBLISHED && /*#__PURE__*/React.createElement("p", null, formattedStatus, " on: ", /*#__PURE__*/React.createElement("span", null, " ", formattedPublished))), !schema.displayProperties.disableDefaultAdminInfo && formattedCreated && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "Created: ", /*#__PURE__*/React.createElement("span", null, formattedCreated)), /*#__PURE__*/React.createElement("p", null, "Updated: ", /*#__PURE__*/React.createElement("span", null, formattedUpdated)), updatedBy && /*#__PURE__*/React.createElement("p", null, "Updated by: ", /*#__PURE__*/React.createElement("span", null, updatedBy.name))), /*#__PURE__*/React.createElement(CustomSidebarInfoContainer, {
|
|
86
99
|
id: itemId,
|
|
87
100
|
schema: schema,
|
|
88
101
|
displayProperties: schema.displayProperties
|
|
@@ -92,7 +105,9 @@ const SideBarRelations = ({
|
|
|
92
105
|
interfaces: interfaces
|
|
93
106
|
}), /*#__PURE__*/React.createElement(EntityNavLinks, {
|
|
94
107
|
schema: schema
|
|
95
|
-
}), relationsComponents &&
|
|
108
|
+
}), relationsComponents && /*#__PURE__*/React.createElement(Accordion, {
|
|
109
|
+
isOpen: true
|
|
110
|
+
}, /*#__PURE__*/React.createElement(Accordion.Header, null, /*#__PURE__*/React.createElement("b", null, "Classification")), /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Accordion.ContentDetails, null, relationsComponents.map(({
|
|
96
111
|
id,
|
|
97
112
|
staticData,
|
|
98
113
|
schema: entitySchema
|
|
@@ -102,16 +117,20 @@ const SideBarRelations = ({
|
|
|
102
117
|
key: id,
|
|
103
118
|
staticData: staticData,
|
|
104
119
|
onSelect: onChange
|
|
105
|
-
}))));
|
|
120
|
+
})))))));
|
|
106
121
|
};
|
|
107
122
|
SideBarRelations.propTypes = {
|
|
108
123
|
schema: PropTypes.object.isRequired,
|
|
109
124
|
onChange: PropTypes.func.isRequired,
|
|
110
125
|
formData: PropTypes.object.isRequired,
|
|
111
|
-
entity: PropTypes.object
|
|
126
|
+
entity: PropTypes.object,
|
|
127
|
+
isOpen: PropTypes.bool,
|
|
128
|
+
onToggle: PropTypes.func
|
|
112
129
|
};
|
|
113
130
|
SideBarRelations.defaultProps = {
|
|
114
|
-
entity: {}
|
|
131
|
+
entity: {},
|
|
132
|
+
isOpen: true,
|
|
133
|
+
onToggle: () => {}
|
|
115
134
|
};
|
|
116
135
|
export default SideBarRelations;
|
|
117
136
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","uuidv1","useApolloClient","getQuery","formFieldTypes","classnames","VersionsList","PUBLISHED","UNPUBLISHED","CustomSidebarInfoContainer","EntityNavLinks","SideBarRelations","schema","onChange","formData","entity","relation","RelationComponent","formattedStatus","formattedUpdated","formattedCreated","formattedPublished","status","client","relationsComponents","setRelationsComponents","fetchRelationSchema","entityIdentifier","data","getEntitySchemas","relationSchema","query","variables","identifier","allRelationComponents","Promise","all","relations","filter","showInForm","foreignKey","properties","map","id","staticData","itemId","itemEntity","interfaces","statusClassName","createElement","className","displayProperties","disableDefaultAdminInfo","Fragment","entitySchema","key","onSelect","propTypes","object","isRequired","func","defaultProps"],"sources":["../../../../../src/components/EntityManager/Entity/SideBarRelations/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport uuidv1 from 'uuid/v1';\nimport { useApolloClient } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { formFieldTypes } from '@blaze-cms/react-form-builder';\nimport classnames from 'classnames';\nimport { VersionsList } from '@blaze-cms/versioning-ui';\nimport { PUBLISHED, UNPUBLISHED } from '../../../../constants';\nimport CustomSidebarInfoContainer from './container/CustomSidebarInfoContainer';\nimport EntityNavLinks from '../EntitiyNavLinks';\n\nconst SideBarRelations = ({ schema, onChange, formData, entity }) => {\n const { relation: RelationComponent } = formFieldTypes;\n const { formattedStatus, formattedUpdated, formattedCreated, formattedPublished, status } =\n formData;\n const client = useApolloClient();\n\n const [relationsComponents, setRelationsComponents] = useState(null);\n\n useEffect(() => {\n (async () => {\n const fetchRelationSchema = async ({ entityIdentifier }) => {\n if (!entityIdentifier) return null;\n\n const {\n data: {\n getEntitySchemas: [relationSchema]\n }\n } = await client.query({\n query: getQuery('GET_ENTITY_SCHEMA'),\n variables: { identifier: entityIdentifier }\n });\n return relationSchema;\n };\n\n if (!relationsComponents && schema) {\n const allRelationComponents = await Promise.all(\n schema.relations\n .filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])\n .map(async relation => ({\n id: uuidv1(),\n staticData: relation,\n schema: await fetchRelationSchema(relation)\n }))\n );\n\n setRelationsComponents(allRelationComponents);\n }\n })();\n }, [client, relationsComponents, schema, schema.relations]);\n const { id: itemId } = entity;\n const { identifier: itemEntity, interfaces } = schema;\n\n const statusClassName = classnames('sidebar__status__badge', {\n 'sidebar__status__badge--published': status === PUBLISHED,\n 'sidebar__status__badge--unpublished': status === UNPUBLISHED\n });\n\n return (\n <div className=\"sidebar\" data-testid=\"sideBarRelations-main-div\">\n <div className=\"sidebar__content\">\n <div className=\"sidebar__status\">\n {formattedCreated && (\n <div className=\"sidebar__top\">\n <div className=\"sidebar__status__wrapper\">\n <b>Status</b>\n <span className={statusClassName}>{formattedStatus}</span>\n </div>\n {formattedStatus === PUBLISHED && (\n <p>\n {formattedStatus} on: <span> {formattedPublished}</span>\n </p>\n )}\n </div>\n )}\n {!schema.displayProperties.disableDefaultAdminInfo && formattedCreated && (\n <>\n <p>\n Created: <span>{formattedCreated}</span>\n </p>\n <p>\n Updated: <span>{formattedUpdated}</span>\n </p>\n </>\n )}\n\n <CustomSidebarInfoContainer\n id={itemId}\n schema={schema}\n displayProperties={schema.displayProperties}\n />\n </div>\n\n <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />\n <EntityNavLinks schema={schema} />\n\n {relationsComponents &&\n relationsComponents.map(({ id, staticData, schema: entitySchema }) => (\n <RelationComponent\n formData={formData}\n schema={entitySchema}\n key={id}\n staticData={staticData}\n onSelect={onChange}\n />\n ))}\n </div>\n </div>\n );\n};\n\nSideBarRelations.propTypes = {\n schema: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n formData: PropTypes.object.isRequired,\n entity: PropTypes.object\n};\n\nSideBarRelations.defaultProps = {\n entity: {}\n};\n\nexport default SideBarRelations;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,SAAS;AAC5B,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAuB;AAC9D,OAAOC,0BAA0B,MAAM,wCAAwC;AAC/E,OAAOC,cAAc,MAAM,oBAAoB;AAE/C,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,QAAQ;EAAEC;AAAO,CAAC,KAAK;EACnE,MAAM;IAAEC,QAAQ,EAAEC;EAAkB,CAA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B,gBAAuB,CACtC,CACH,CACH,eAEDtB,KAAA,CAAAoD,aAAA,CAACxC,0BAA0B;IACzBkC,EAAE,EAAEE,MAAO;IACXjC,MAAM,EAAEA,MAAO;IACfuC,iBAAiB,EAAEvC,MAAM,CAACuC;EAAkB,CAC7C,CACE,CAAC,eAENtD,KAAA,CAAAoD,aAAA,CAAC3C,YAAY;IAACwC,UAAU,EAAEA,UAAW;IAACD,MAAM,EAAEA,MAAO;IAACE,UAAU,EAAEA;EAAW,CAAE,CAAC,eAChFlD,KAAA,CAAAoD,aAAA,CAACvC,cAAc;IAACE,MAAM,EAAEA;EAAO,CAAE,CAAC,EAEjCY,mBAAmB,IAClBA,mBAAmB,CAACkB,GAAG,CAAC,CAAC;IAAEC,EAAE;IAAEC,UAAU;IAAEhC,MAAM,EAAE0C;EAAa,CAAC,kBAC/DzD,KAAA,CAAAoD,aAAA,CAAChC,iBAAiB;IAChBH,QAAQ,EAAEA,QAAS;IACnBF,MAAM,EAAE0C,YAAa;IACrBC,GAAG,EAAEZ,EAAG;IACRC,UAAU,EAAEA,UAAW;IACvBY,QAAQ,EAAE3C;EAAS,CACpB,CACF,CACA,CACF,CAAC;AAEV,CAAC;AAEDF,gBAAgB,CAAC8C,SAAS,GAAG;EAC3B7C,MAAM,EAAEZ,SAAS,CAAC0D,MAAM,CAACC,UAAU;EACnC9C,QAAQ,EAAEb,SAAS,CAAC4D,IAAI,CAACD,UAAU;EACnC7C,QAAQ,EAAEd,SAAS,CAAC0D,MAAM,CAACC,UAAU;EACrC5C,MAAM,EAAEf,SAAS,CAAC0D;AACpB,CAAC;AAED/C,gBAAgB,CAACkD,YAAY,GAAG;EAC9B9C,MAAM,EAAE,CAAC;AACX,CAAC;AAED,eAAeJ,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","uuidv1","Accordion","useApolloClient","getQuery","formFieldTypes","classnames","VersionsList","PUBLISHED","UNPUBLISHED","CustomSidebarInfoContainer","EntityNavLinks","SideBarRelations","schema","onChange","formData","entity","isOpen","onToggle","relation","RelationComponent","formattedStatus","formattedUpdated","formattedCreated","formattedPublished","updatedBy","status","client","relationsComponents","setRelationsComponents","fetchRelationSchema","entityIdentifier","data","getEntitySchemas","relationSchema","query","variables","identifier","allRelationComponents","Promise","all","relations","filter","showInForm","foreignKey","properties","map","id","staticData","itemId","itemEntity","interfaces","statusClassName","createElement","className","onClick","role","displayProperties","disableDefaultAdminInfo","Fragment","name","Header","Content","ContentDetails","entitySchema","key","onSelect","propTypes","object","isRequired","func","bool","defaultProps"],"sources":["../../../../../src/components/EntityManager/Entity/SideBarRelations/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport uuidv1 from 'uuid/v1';\nimport Accordion from '@blaze-react/accordion';\nimport { useApolloClient } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { formFieldTypes } from '@blaze-cms/react-form-builder';\nimport classnames from 'classnames';\nimport { VersionsList } from '@blaze-cms/versioning-ui';\nimport { PUBLISHED, UNPUBLISHED } from '../../../../constants';\nimport CustomSidebarInfoContainer from './container/CustomSidebarInfoContainer';\nimport EntityNavLinks from '../EntitiyNavLinks';\n\nconst SideBarRelations = ({ schema, onChange, formData, entity, isOpen, onToggle }) => {\n const { relation: RelationComponent } = formFieldTypes;\n const {\n formattedStatus,\n formattedUpdated,\n formattedCreated,\n formattedPublished,\n updatedBy,\n status\n } = formData;\n const client = useApolloClient();\n\n const [relationsComponents, setRelationsComponents] = useState(null);\n\n useEffect(() => {\n (async () => {\n const fetchRelationSchema = async ({ entityIdentifier }) => {\n if (!entityIdentifier) return null;\n\n const {\n data: {\n getEntitySchemas: [relationSchema]\n }\n } = await client.query({\n query: getQuery('GET_ENTITY_SCHEMA'),\n variables: { identifier: entityIdentifier }\n });\n return relationSchema;\n };\n\n if (!relationsComponents && schema) {\n const allRelationComponents = await Promise.all(\n schema.relations\n .filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])\n .map(async relation => ({\n id: uuidv1(),\n staticData: relation,\n schema: await fetchRelationSchema(relation)\n }))\n );\n\n setRelationsComponents(allRelationComponents);\n }\n })();\n }, [client, relationsComponents, schema, schema.relations]);\n const { id: itemId } = entity;\n const { identifier: itemEntity, interfaces } = schema;\n\n const statusClassName = classnames('sidebar__status__badge', {\n 'sidebar__status__badge--published': status === PUBLISHED,\n 'sidebar__status__badge--unpublished': status === UNPUBLISHED\n });\n\n return (\n <div\n className={classnames('sidebar', { 'sidebar--collapsed': !isOpen })}\n data-testid=\"sideBarRelations-main-div\">\n <div\n className=\"sidebar__toggle-button\"\n onClick={onToggle}\n role=\"button\"\n aria-label={isOpen ? 'Collapse sidebar' : 'Expand sidebar'}>\n <i className=\"material-icons\">{isOpen ? 'keyboard_arrow_right' : 'keyboard_arrow_left'}</i>\n </div>\n <div className=\"sidebar__content\">\n <div className=\"sidebar__status\">\n {formattedCreated && (\n <div className=\"sidebar__top\">\n <div className=\"sidebar__status__wrapper\">\n <b>Status</b>\n <span className={statusClassName}>{formattedStatus}</span>\n </div>\n {formattedStatus === PUBLISHED && (\n <p>\n {formattedStatus} on: <span> {formattedPublished}</span>\n </p>\n )}\n </div>\n )}\n {!schema.displayProperties.disableDefaultAdminInfo && formattedCreated && (\n <>\n <p>\n Created: <span>{formattedCreated}</span>\n </p>\n <p>\n Updated: <span>{formattedUpdated}</span>\n </p>\n {updatedBy && (\n <p>\n Updated by: <span>{updatedBy.name}</span>\n </p>\n )}\n </>\n )}\n\n <CustomSidebarInfoContainer\n id={itemId}\n schema={schema}\n displayProperties={schema.displayProperties}\n />\n </div>\n\n <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />\n <EntityNavLinks schema={schema} />\n\n {relationsComponents && (\n <Accordion isOpen>\n <Accordion.Header>\n <b>Classification</b>\n </Accordion.Header>\n <Accordion.Content>\n <Accordion.ContentDetails>\n {relationsComponents.map(({ id, staticData, schema: entitySchema }) => (\n <RelationComponent\n formData={formData}\n schema={entitySchema}\n key={id}\n staticData={staticData}\n onSelect={onChange}\n />\n ))}\n </Accordion.ContentDetails>\n </Accordion.Content>\n </Accordion>\n )}\n </div>\n </div>\n );\n};\n\nSideBarRelations.propTypes = {\n schema: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n formData: PropTypes.object.isRequired,\n entity: PropTypes.object,\n isOpen: PropTypes.bool,\n onToggle: PropTypes.func\n};\nSideBarRelations.defaultProps = {\n entity: {},\n isOpen: true,\n onToggle: () => {}\n};\n\nexport default SideBarRelations;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,SAAS;AAC5B,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAuB;AAC9D,OAAOC,0BAA0B,MAAM,wCAAwC;AAC/E,OAAOC,cAAc,MAAM,oBAAoB;AAE/C,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,QAAQ;EAAEC,MAAM;EAAEC,MAAM;EAAEC;AAAS,CAAC,KAAK;EACrF,MAAM;IAAEC,QAAQ,EAAEC;EAAkB,CAAC,GAAGf,cAAc;EACtD,MAAM;IACJgB,eAAe;IACfC,gBAAgB;IAChBC,gBAAgB;IAChBC,kBAAkB;IAClBC,SAAS;IACTC;EACF,CAAC,GAAGX,QAAQ;EACZ,MAAMY,MAAM,GAAGxB,eAAe,CAAC,CAAC;EAEhC,MAAM,CAACyB,mBAAmB,EAAEC,sBAAsB,CAAC,GAAG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S,CACpB,CACF,CACuB,CACT,CACV,CAEV,CACF,CAAC;AAEV,CAAC;AAEDF,gBAAgB,CAACuD,SAAS,GAAG;EAC3BtD,MAAM,EAAEb,SAAS,CAACoE,MAAM,CAACC,UAAU;EACnCvD,QAAQ,EAAEd,SAAS,CAACsE,IAAI,CAACD,UAAU;EACnCtD,QAAQ,EAAEf,SAAS,CAACoE,MAAM,CAACC,UAAU;EACrCrD,MAAM,EAAEhB,SAAS,CAACoE,MAAM;EACxBnD,MAAM,EAAEjB,SAAS,CAACuE,IAAI;EACtBrD,QAAQ,EAAElB,SAAS,CAACsE;AACtB,CAAC;AACD1D,gBAAgB,CAAC4D,YAAY,GAAG;EAC9BxD,MAAM,EAAE,CAAC,CAAC;EACVC,MAAM,EAAE,IAAI;EACZC,QAAQ,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC;AAED,eAAeN,gBAAgB","ignoreList":[]}
|
package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js
CHANGED
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import InfoBoxValue from '../../../../InfoBoxes/presentational/InfoBoxValue';
|
|
4
4
|
import InfoBoxLabel from '../../../../InfoBoxes/presentational/InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../../../../InfoBoxes/InfoBoxTooltip';
|
|
5
6
|
const CustomSidebarInfo = ({
|
|
6
7
|
items,
|
|
7
8
|
customSidebarInfoKey
|
|
@@ -9,10 +10,15 @@ const CustomSidebarInfo = ({
|
|
|
9
10
|
if (!items) return null;
|
|
10
11
|
const customSidebarInfoItems = items.map(item => Object.values(item).map(info => {
|
|
11
12
|
if (!info.label || !info.value) return null;
|
|
12
|
-
return /*#__PURE__*/React.createElement("p",
|
|
13
|
+
return /*#__PURE__*/React.createElement("p", {
|
|
14
|
+
key: `${customSidebarInfoKey}-${info.label.toLowerCase()}`
|
|
15
|
+
}, /*#__PURE__*/React.createElement(InfoBoxLabel, {
|
|
13
16
|
item: info
|
|
14
17
|
}), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
15
18
|
item: info
|
|
19
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
20
|
+
info: info,
|
|
21
|
+
position: "left"
|
|
16
22
|
})));
|
|
17
23
|
}).filter(Boolean));
|
|
18
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -22,9 +28,9 @@ const CustomSidebarInfo = ({
|
|
|
22
28
|
className: "custom-sidebar-info--container"
|
|
23
29
|
}, customSidebarInfoItems));
|
|
24
30
|
};
|
|
25
|
-
export default CustomSidebarInfo;
|
|
26
31
|
CustomSidebarInfo.propTypes = {
|
|
27
32
|
customSidebarInfoKey: PropTypes.string.isRequired,
|
|
28
33
|
items: PropTypes.array.isRequired
|
|
29
34
|
};
|
|
35
|
+
export default CustomSidebarInfo;
|
|
30
36
|
//# sourceMappingURL=CustomSidebarInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomSidebarInfo.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","CustomSidebarInfo","items","customSidebarInfoKey","customSidebarInfoItems","map","item","Object","values","info","label","value","createElement","filter","Boolean","className","
|
|
1
|
+
{"version":3,"file":"CustomSidebarInfo.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","InfoBoxTooltip","CustomSidebarInfo","items","customSidebarInfoKey","customSidebarInfoItems","map","item","Object","values","info","label","value","createElement","key","toLowerCase","position","filter","Boolean","className","propTypes","string","isRequired","array"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxValue from '../../../../InfoBoxes/presentational/InfoBoxValue';\nimport InfoBoxLabel from '../../../../InfoBoxes/presentational/InfoBoxLabel';\nimport InfoBoxTooltip from '../../../../InfoBoxes/InfoBoxTooltip';\n\nconst CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {\n if (!items) return null;\n\n const customSidebarInfoItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <p key={`${customSidebarInfoKey}-${info.label.toLowerCase()}`}>\n <InfoBoxLabel item={info} />\n <span>\n <InfoBoxValue item={info} />\n <InfoBoxTooltip info={info} position=\"left\" />\n </span>\n </p>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"custom-sidebar-info\" key={customSidebarInfoKey}>\n <div className=\"custom-sidebar-info--container\">{customSidebarInfoItems}</div>\n </div>\n );\n};\n\nCustomSidebarInfo.propTypes = {\n customSidebarInfoKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n\nexport default CustomSidebarInfo;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,YAAY,MAAM,mDAAmD;AAC5E,OAAOC,YAAY,MAAM,mDAAmD;AAC5E,OAAOC,cAAc,MAAM,sCAAsC;AAEjE,MAAMC,iBAAiB,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAqB,CAAC,KAAK;EAC7D,IAAI,CAACD,KAAK,EAAE,OAAO,IAAI;EAEvB,MAAME,sBAAsB,GAAGF,KAAK,CAACG,GAAG,CAACC,IAAI,IAC3CC,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;MAAGC,GAAG,EAAE,GAAGV,oBAAoB,IAAIM,IAAI,CAACC,KAAK,CAACI,WAAW,CAAC,CAAC;IAAG,gBAC5DjB,KAAA,CAAAe,aAAA,CAACb,YAAY;MAACO,IAAI,EAAEG;IAAK,CAAE,CAAC,eAC5BZ,KAAA,CAAAe,aAAA,4BACEf,KAAA,CAAAe,aAAA,CAACd,YAAY;MAACQ,IAAI,EAAEG;IAAK,CAAE,CAAC,eAC5BZ,KAAA,CAAAe,aAAA,CAACZ,cAAc;MAACS,IAAI,EAAEA,IAAK;MAACM,QAAQ,EAAC;IAAM,CAAE,CACzC,CACL,CAAC;EAER,CAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CACnB,CAAC;EAED,oBACEpB,KAAA,CAAAe,aAAA;IAAKM,SAAS,EAAC,qBAAqB;IAACL,GAAG,EAAEV;EAAqB,gBAC7DN,KAAA,CAAAe,aAAA;IAAKM,SAAS,EAAC;EAAgC,GAAEd,sBAA4B,CAC1E,CAAC;AAEV,CAAC;AAEDH,iBAAiB,CAACkB,SAAS,GAAG;EAC5BhB,oBAAoB,EAAEP,SAAS,CAACwB,MAAM,CAACC,UAAU;EACjDnB,KAAK,EAAEN,SAAS,CAAC0B,KAAK,CAACD;AACzB,CAAC;AAED,eAAepB,iBAAiB","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createEntityRecord } from '@blaze-cms/admin-ui-utils';
|
|
2
2
|
import { SAVE_BUTTON_TEXTS } from '../../../../../constants';
|
|
3
3
|
const submit = async ({
|
|
4
4
|
entitySchema,
|
|
@@ -10,25 +10,15 @@ const submit = async ({
|
|
|
10
10
|
history,
|
|
11
11
|
setIsNewEntity
|
|
12
12
|
}, addToast) => {
|
|
13
|
-
const mutation = buildCreateEntityMutation(entitySchema);
|
|
14
13
|
try {
|
|
15
14
|
setIsSaveButtonAvailable(false);
|
|
16
15
|
setSaveButtonText(SAVE_BUTTON_TEXTS.saving);
|
|
17
|
-
const
|
|
18
|
-
data: {
|
|
19
|
-
createdEntity: createdEntityResult
|
|
20
|
-
}
|
|
21
|
-
} = await client.mutate({
|
|
22
|
-
mutation,
|
|
23
|
-
variables: {
|
|
24
|
-
input: parsedFormValues
|
|
25
|
-
}
|
|
26
|
-
});
|
|
16
|
+
const createdRecord = await createEntityRecord(client, entitySchema, parsedFormValues);
|
|
27
17
|
setSaveButtonText(SAVE_BUTTON_TEXTS.saved);
|
|
28
|
-
setEntityData(
|
|
18
|
+
setEntityData(createdRecord);
|
|
29
19
|
setIsNewEntity(false);
|
|
30
20
|
const updatePathname = history.location.pathname.replace('create', 'update');
|
|
31
|
-
history.push(`${updatePathname}/${
|
|
21
|
+
history.push(`${updatePathname}/${createdRecord.id}`);
|
|
32
22
|
addToast(`Created`, {
|
|
33
23
|
appearance: 'success',
|
|
34
24
|
autoDismiss: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.js","names":["
|
|
1
|
+
{"version":3,"file":"submit.js","names":["createEntityRecord","SAVE_BUTTON_TEXTS","submit","entitySchema","parsedFormValues","client","setEntityData","setIsSaveButtonAvailable","setSaveButtonText","history","setIsNewEntity","addToast","saving","createdRecord","saved","updatePathname","location","pathname","replace","push","id","appearance","autoDismiss","error","save","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/create/submit.js"],"sourcesContent":["import { createEntityRecord } from '@blaze-cms/admin-ui-utils';\nimport { SAVE_BUTTON_TEXTS } from '../../../../../constants';\n\nconst submit = async (\n {\n entitySchema,\n parsedFormValues,\n client,\n setEntityData,\n setIsSaveButtonAvailable,\n setSaveButtonText,\n history,\n setIsNewEntity\n },\n addToast\n) => {\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const createdRecord = await createEntityRecord(client, entitySchema, parsedFormValues);\n\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n setEntityData(createdRecord);\n setIsNewEntity(false);\n\n const updatePathname = history.location.pathname.replace('create', 'update');\n history.push(`${updatePathname}/${createdRecord.id}`);\n addToast(`Created`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n setIsSaveButtonAvailable(true);\n setSaveButtonText(SAVE_BUTTON_TEXTS.save);\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n};\n\nexport { submit };\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,iBAAiB,QAAQ,0BAA0B;AAE5D,MAAMC,MAAM,GAAG,MAAAA,CACb;EACEC,YAAY;EACZC,gBAAgB;EAChBC,MAAM;EACNC,aAAa;EACbC,wBAAwB;EACxBC,iBAAiB;EACjBC,OAAO;EACPC;AACF,CAAC,EACDC,QAAQ,KACL;EACH,IAAI;IACFJ,wBAAwB,CAAC,KAAK,CAAC;IAC/BC,iBAAiB,CAACP,iBAAiB,CAACW,MAAM,CAAC;IAC3C,MAAMC,aAAa,GAAG,MAAMb,kBAAkB,CAACK,MAAM,EAAEF,YAAY,EAAEC,gBAAgB,CAAC;IAEtFI,iBAAiB,CAACP,iBAAiB,CAACa,KAAK,CAAC;IAC1CR,aAAa,CAACO,aAAa,CAAC;IAC5BH,cAAc,CAAC,KAAK,CAAC;IAErB,MAAMK,cAAc,GAAGN,OAAO,CAACO,QAAQ,CAACC,QAAQ,CAACC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5ET,OAAO,CAACU,IAAI,CAAC,GAAGJ,cAAc,IAAIF,aAAa,CAACO,EAAE,EAAE,CAAC;IACrDT,QAAQ,CAAC,SAAS,EAAE;MAClBU,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdhB,wBAAwB,CAAC,IAAI,CAAC;IAC9BC,iBAAiB,CAACP,iBAAiB,CAACuB,IAAI,CAAC;IACzCb,QAAQ,CAACY,KAAK,CAACE,OAAO,EAAE;MACtBJ,UAAU,EAAE,OAAO;MACnBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ;AACF,CAAC;AAED,SAASpB,MAAM","ignoreList":[]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
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
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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return has(formData, KEY_TO_CHECK) && entity && entity.id && schema && schema.id && entityIsPublished === ENTITY_PUBLISHED;
|
|
4
|
+
import { DEBUG_PARAM, ENTITY_PUBLISHED, SELECT_DEFAULT_VALUE } from '../../../constants';
|
|
5
|
+
function canViewPage(entity, schema, entityIsPublished) {
|
|
6
|
+
return entity && entity.id && schema && schema.id && entityIsPublished === ENTITY_PUBLISHED && schema.properties.slug;
|
|
8
7
|
}
|
|
9
8
|
function validateSideBarRelations(updatedFormValues, requiredChildField) {
|
|
10
9
|
if (!requiredChildField) return true;
|
|
@@ -20,7 +19,11 @@ function validateSideBarRelations(updatedFormValues, requiredChildField) {
|
|
|
20
19
|
}
|
|
21
20
|
async function onViewUrlClick(getFullUrl) {
|
|
22
21
|
const fullUrl = await getFullUrl();
|
|
23
|
-
if (fullUrl)
|
|
22
|
+
if (fullUrl) {
|
|
23
|
+
const delimiter = fullUrl.includes('?') ? '&' : '?';
|
|
24
|
+
const debugParam = process.env.BLAZE_DISABLE_URL_DEBUG_PARAM ? '' : `${delimiter}${DEBUG_PARAM}`;
|
|
25
|
+
window.open(`${fullUrl}${debugParam}`, '_blank');
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
function getUpdatedFormValues({
|
|
26
29
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","names":["
|
|
1
|
+
{"version":3,"file":"entity.js","names":["DEBUG_PARAM","ENTITY_PUBLISHED","SELECT_DEFAULT_VALUE","canViewPage","entity","schema","entityIsPublished","id","properties","slug","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","delimiter","includes","debugParam","process","env","BLAZE_DISABLE_URL_DEBUG_PARAM","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","_objectSpread","push","requiredChildFieldIndex","checkFulfilConditions","args","every","param"],"sources":["../../../../src/components/EntityManager/utils/entity.js"],"sourcesContent":["import { DEBUG_PARAM, ENTITY_PUBLISHED, SELECT_DEFAULT_VALUE } from '../../../constants';\n\nfunction canViewPage(entity, schema, entityIsPublished) {\n return (\n entity &&\n entity.id &&\n schema &&\n schema.id &&\n entityIsPublished === ENTITY_PUBLISHED &&\n schema.properties.slug\n );\n}\n\nfunction validateSideBarRelations(updatedFormValues, requiredChildField) {\n if (!requiredChildField) return true;\n const parentEntityField = updatedFormValues.find(({ id }) => id === 'parentEntity');\n const parentIdField = updatedFormValues.find(({ id }) => id === 'parentId');\n\n const parentEntityFieldHasValue =\n parentEntityField &&\n parentEntityField.value &&\n parentEntityField.value !== SELECT_DEFAULT_VALUE;\n const parentIdFieldHasValue = parentIdField && parentIdField.value;\n\n return !!(!parentEntityFieldHasValue || (parentEntityFieldHasValue && parentIdFieldHasValue));\n}\n\nasync function onViewUrlClick(getFullUrl) {\n const fullUrl = await getFullUrl();\n if (fullUrl) {\n const delimiter = fullUrl.includes('?') ? '&' : '?';\n const debugParam = process.env.BLAZE_DISABLE_URL_DEBUG_PARAM\n ? ''\n : `${delimiter}${DEBUG_PARAM}`;\n window.open(`${fullUrl}${debugParam}`, '_blank');\n }\n}\n\nfunction getUpdatedFormValues({ id, value, requiredChildField, formValues }) {\n const updatedFormValues = formValues ? formValues.slice() : [];\n const fieldIndex = updatedFormValues.findIndex(({ id: _id }) => _id === id);\n\n if (fieldIndex > -1) {\n updatedFormValues[fieldIndex] = { ...updatedFormValues[fieldIndex], value };\n } else {\n updatedFormValues.push({ id, value });\n }\n\n if (requiredChildField && requiredChildField.id) {\n const requiredChildFieldIndex = updatedFormValues.findIndex(\n ({ id: _id }) => _id === requiredChildField.id\n );\n if (requiredChildFieldIndex > -1) {\n updatedFormValues[requiredChildFieldIndex] = {\n ...updatedFormValues[requiredChildFieldIndex],\n value: requiredChildField.value\n };\n } else {\n updatedFormValues.push({\n id: requiredChildField.id,\n value: requiredChildField.value\n });\n }\n }\n\n return updatedFormValues;\n}\n\nfunction checkFulfilConditions(...args) {\n return args.every(param => param);\n}\n\nexport {\n canViewPage,\n validateSideBarRelations,\n onViewUrlClick,\n getUpdatedFormValues,\n checkFulfilConditions\n};\n"],"mappings":";;;AAAA,SAASA,WAAW,EAAEC,gBAAgB,EAAEC,oBAAoB,QAAQ,oBAAoB;AAExF,SAASC,WAAWA,CAACC,MAAM,EAAEC,MAAM,EAAEC,iBAAiB,EAAE;EACtD,OACEF,MAAM,IACNA,MAAM,CAACG,EAAE,IACTF,MAAM,IACNA,MAAM,CAACE,EAAE,IACTD,iBAAiB,KAAKL,gBAAgB,IACtCI,MAAM,CAACG,UAAU,CAACC,IAAI;AAE1B;AAEA,SAASC,wBAAwBA,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;EACvE,IAAI,CAACA,kBAAkB,EAAE,OAAO,IAAI;EACpC,MAAMC,iBAAiB,GAAGF,iBAAiB,CAACG,IAAI,CAAC,CAAC;IAAEP;EAAG,CAAC,KAAKA,EAAE,KAAK,cAAc,CAAC;EACnF,MAAMQ,aAAa,GAAGJ,iBAAiB,CAACG,IAAI,CAAC,CAAC;IAAEP;EAAG,CAAC,KAAKA,EAAE,KAAK,UAAU,CAAC;EAE3E,MAAMS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EA,IAAIL,kBAAkB,IAAIA,kBAAkB,CAACL,EAAE,EAAE;IAC/C,MAAM+B,uBAAuB,GAAG3B,iBAAiB,CAACuB,SAAS,CACzD,CAAC;MAAE3B,EAAE,EAAE4B;IAAI,CAAC,KAAKA,GAAG,KAAKvB,kBAAkB,CAACL,EAC9C,CAAC;IACD,IAAI+B,uBAAuB,GAAG,CAAC,CAAC,EAAE;MAChC3B,iBAAiB,CAAC2B,uBAAuB,CAAC,GAAAF,aAAA,CAAAA,aAAA,KACrCzB,iBAAiB,CAAC2B,uBAAuB,CAAC;QAC7CrB,KAAK,EAAEL,kBAAkB,CAACK;MAAK,EAChC;IACH,CAAC,MAAM;MACLN,iBAAiB,CAAC0B,IAAI,CAAC;QACrB9B,EAAE,EAAEK,kBAAkB,CAACL,EAAE;QACzBU,KAAK,EAAEL,kBAAkB,CAACK;MAC5B,CAAC,CAAC;IACJ;EACF;EAEA,OAAON,iBAAiB;AAC1B;AAEA,SAAS4B,qBAAqBA,CAAC,GAAGC,IAAI,EAAE;EACtC,OAAOA,IAAI,CAACC,KAAK,CAACC,KAAK,IAAIA,KAAK,CAAC;AACnC;AAEA,SACEvC,WAAW,EACXO,wBAAwB,EACxBS,cAAc,EACdW,oBAAoB,EACpBS,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["info"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Tooltip from '@blaze-react/tooltip';
|
|
7
|
+
const InfoBoxTooltip = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
info
|
|
10
|
+
} = _ref,
|
|
11
|
+
tooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
const {
|
|
13
|
+
tooltipContent,
|
|
14
|
+
tooltipIcon
|
|
15
|
+
} = info;
|
|
16
|
+
if (!tooltipContent) return null;
|
|
17
|
+
const renderTooltipIcon = icon => {
|
|
18
|
+
if (!icon) return null;
|
|
19
|
+
return /*#__PURE__*/React.createElement("i", {
|
|
20
|
+
className: `${icon} info-box--icon`
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
24
|
+
tooltipContent: tooltipContent,
|
|
25
|
+
trigger: "click",
|
|
26
|
+
className: "info-box--tooltip"
|
|
27
|
+
}, tooltipProps), renderTooltipIcon(tooltipIcon));
|
|
28
|
+
};
|
|
29
|
+
InfoBoxTooltip.propTypes = {
|
|
30
|
+
info: PropTypes.shape({
|
|
31
|
+
tooltipContent: PropTypes.node,
|
|
32
|
+
tooltipIcon: PropTypes.string
|
|
33
|
+
}).isRequired
|
|
34
|
+
};
|
|
35
|
+
export default InfoBoxTooltip;
|
|
36
|
+
//# sourceMappingURL=InfoBoxTooltip.js.map
|
|
@@ -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":[]}
|
|
@@ -1 +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 }`\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,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":[]}
|
|
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":[]}
|
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import InfoBoxValue from './InfoBoxValue';
|
|
4
4
|
import InfoBoxLabel from './InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../InfoBoxTooltip';
|
|
5
6
|
const InfoBox = ({
|
|
6
7
|
items,
|
|
7
8
|
infoBoxKey
|
|
@@ -20,6 +21,8 @@ const InfoBox = ({
|
|
|
20
21
|
className: "info-box--value"
|
|
21
22
|
}, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
22
23
|
item: info
|
|
24
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
25
|
+
info: info
|
|
23
26
|
})));
|
|
24
27
|
}).filter(Boolean));
|
|
25
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -29,9 +32,9 @@ const InfoBox = ({
|
|
|
29
32
|
className: "info-box--container"
|
|
30
33
|
}, infoBoxItems));
|
|
31
34
|
};
|
|
32
|
-
export default InfoBox;
|
|
33
35
|
InfoBox.propTypes = {
|
|
34
36
|
infoBoxKey: PropTypes.string.isRequired,
|
|
35
37
|
items: PropTypes.array.isRequired
|
|
36
38
|
};
|
|
39
|
+
export default InfoBox;
|
|
37
40
|
//# sourceMappingURL=InfoBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBox.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","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';\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 </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\
|
|
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":[]}
|
|
@@ -3,13 +3,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
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
4
|
import React, { useEffect, useState, Fragment } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import More from '@blaze-react/more';
|
|
7
6
|
import { useApolloClient } from '@apollo/client';
|
|
8
7
|
import { withRouter, Link, useLocation } from 'react-router-dom';
|
|
9
8
|
import { PageHeader, DeleteAction, CardPrompt } from '@blaze-cms/admin';
|
|
10
9
|
import { useToasts } from '@blaze-react/toaster';
|
|
11
10
|
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
12
11
|
import ListingTableContent from './ListingTableContent';
|
|
12
|
+
import SearchFilter from './SearchFilter/SearchFilter';
|
|
13
13
|
import availableActions from '../EntityManager/Entity/actions-handlers';
|
|
14
14
|
import { fetchData } from './service';
|
|
15
15
|
import { populateRows, formatRows, getParsedRowData } from './mappers/populate-rows';
|
|
@@ -42,7 +42,7 @@ const ListingTable = ({
|
|
|
42
42
|
const updatedQueryParams = _objectSpread(_objectSpread({}, queryParams), {}, {
|
|
43
43
|
offset: currentPage * queryParamsDefault.limit - queryParamsDefault.limit
|
|
44
44
|
});
|
|
45
|
-
await doQuery(
|
|
45
|
+
await doQuery([], updatedQueryParams);
|
|
46
46
|
setPreviousSchema({
|
|
47
47
|
id: entitySchema.id
|
|
48
48
|
});
|
|
@@ -170,17 +170,11 @@ const ListingTable = ({
|
|
|
170
170
|
}), /*#__PURE__*/React.createElement(PageHeader, {
|
|
171
171
|
title: entitySchema.displayName,
|
|
172
172
|
subtitle: ""
|
|
173
|
-
}, createAction.active && !showAddButton && /*#__PURE__*/React.createElement(
|
|
173
|
+
}, createAction.active && !showAddButton && /*#__PURE__*/React.createElement(Link, {
|
|
174
174
|
"data-testid": "addEntity",
|
|
175
175
|
className: "button button--small",
|
|
176
176
|
to: `${match.url}/create`
|
|
177
|
-
}, "Add"),
|
|
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, {
|
|
177
|
+
}, "Add")), showAddButton ? /*#__PURE__*/React.createElement(CardPrompt, null, /*#__PURE__*/React.createElement(Link, {
|
|
184
178
|
className: "button button--rounded button--cta",
|
|
185
179
|
to: `${match.url}/create`,
|
|
186
180
|
"data-testid": "add-button"
|
|
@@ -189,13 +183,20 @@ const ListingTable = ({
|
|
|
189
183
|
schema: entitySchema,
|
|
190
184
|
listFilters: listFilters,
|
|
191
185
|
setListFilters: updateListingFilters
|
|
186
|
+
}), /*#__PURE__*/React.createElement(SearchFilter, {
|
|
187
|
+
schema: entitySchema,
|
|
188
|
+
listFilters: listFilters,
|
|
189
|
+
setListFilters: updateListingFilters
|
|
192
190
|
}), /*#__PURE__*/React.createElement(ListingTableContent, {
|
|
193
191
|
totalItems: totalItems,
|
|
194
192
|
currentPage: currentPage,
|
|
195
193
|
onSort: handleSort,
|
|
196
194
|
handleOnPageChange: handleOnPageChange,
|
|
197
195
|
tableData: tableData,
|
|
198
|
-
onCloseCardPrompt: onCloseCardPrompt
|
|
196
|
+
onCloseCardPrompt: onCloseCardPrompt,
|
|
197
|
+
schema: entitySchema,
|
|
198
|
+
listFilters: listFilters,
|
|
199
|
+
setListFilters: updateListingFilters
|
|
199
200
|
})));
|
|
200
201
|
};
|
|
201
202
|
ListingTable.propTypes = {
|