@blaze-cms/plugin-data-ui 0.146.0-node18-core-styles-tooltips.45 → 0.146.0-node18-tooltips.38
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 +33 -129
- 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 +452 -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 +47 -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 +133 -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 +70 -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 +208 -0
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +72 -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/SearchFilter/SearchContainer.js +207 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +40 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js +96 -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/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 +87 -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 +42 -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,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Button from '@blaze-react/button';
|
|
4
|
+
import { useMutation } from '@apollo/client';
|
|
5
|
+
import { getMutation } from '@blaze-cms/admin-ui-utils';
|
|
6
|
+
import { DEBUG_PARAM } from '../../../../../constants';
|
|
7
|
+
const HeaderPreviewButton = ({
|
|
8
|
+
itemId,
|
|
9
|
+
itemEntity
|
|
10
|
+
}) => {
|
|
11
|
+
const [createPreviewToken] = useMutation(getMutation('PREVIEW_TOKEN_MUTATION'));
|
|
12
|
+
if (process.env.BLAZE_DISABLE_PREVIEW) return null;
|
|
13
|
+
const onViewPreview = async () => {
|
|
14
|
+
try {
|
|
15
|
+
const {
|
|
16
|
+
data: {
|
|
17
|
+
createPreviewToken: {
|
|
18
|
+
result: {
|
|
19
|
+
url
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
} = {}
|
|
23
|
+
} = await createPreviewToken({
|
|
24
|
+
variables: {
|
|
25
|
+
itemId,
|
|
26
|
+
itemEntity
|
|
27
|
+
}
|
|
28
|
+
});
|
|
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
|
+
}
|
|
34
|
+
// eslint-disable-next-line no-empty
|
|
35
|
+
} catch (err) {}
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
38
|
+
className: "more-menu__link",
|
|
39
|
+
onClick: onViewPreview
|
|
40
|
+
}, "Preview");
|
|
41
|
+
};
|
|
42
|
+
HeaderPreviewButton.propTypes = {
|
|
43
|
+
itemId: PropTypes.string.isRequired,
|
|
44
|
+
itemEntity: PropTypes.string.isRequired
|
|
45
|
+
};
|
|
46
|
+
export default HeaderPreviewButton;
|
|
47
|
+
//# sourceMappingURL=HeaderPreviewButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OAA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EAAEN,SAAS,CAAC4B,MAAM,CAACC,UAAU;EACnCtB,UAAU,EAAEP,SAAS,CAAC4B,MAAM,CAACC;AAC/B,CAAC;AAED,eAAexB,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["HeaderPreviewButton"],"sources":["../../../../../../src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js"],"sourcesContent":["import HeaderPreviewButton from './HeaderPreviewButton';\n\nexport default HeaderPreviewButton;\n"],"mappings":"AAAA,OAAOA,mBAAmB,MAAM,uBAAuB;AAEvD,eAAeA,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["EntityHeader"],"sources":["../../../../../src/components/EntityManager/Entity/EntityHeader/index.js"],"sourcesContent":["import EntityHeader from './EntityHeader';\n\nexport default EntityHeader;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import useCustomSidebarData from '../hooks/useCustomSidebarData';
|
|
4
|
+
import CustomSidebarInfo from '../presentational/CustomSidebarInfo';
|
|
5
|
+
const CustomSibebarInfoContainer = ({
|
|
6
|
+
id,
|
|
7
|
+
schema,
|
|
8
|
+
displayProperties
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
data
|
|
12
|
+
} = useCustomSidebarData({
|
|
13
|
+
id,
|
|
14
|
+
schema,
|
|
15
|
+
displayProperties
|
|
16
|
+
});
|
|
17
|
+
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
18
|
+
const items = Object.values(data).flatMap(item => Object.values(item));
|
|
19
|
+
return /*#__PURE__*/React.createElement(CustomSidebarInfo, {
|
|
20
|
+
items: items,
|
|
21
|
+
customSidebarInfoKey: displayProperties.key
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export default CustomSibebarInfoContainer;
|
|
25
|
+
CustomSibebarInfoContainer.propTypes = {
|
|
26
|
+
id: PropTypes.string.isRequired,
|
|
27
|
+
displayProperties: PropTypes.object.isRequired,
|
|
28
|
+
schema: PropTypes.object.isRequired
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=CustomSidebarInfoContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomSidebarInfoContainer.js","names":["PropTypes","React","useCustomSidebarData","CustomSidebarInfo","CustomSibebarInfoContainer","id","schema","displayProperties","data","Object","keys","length","items","values","flatMap","item","createElement","customSidebarInfoKey","key","propTypes","string","isRequired","object"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport useCustomSidebarData from '../hooks/useCustomSidebarData';\nimport CustomSidebarInfo from '../presentational/CustomSidebarInfo';\n\nconst CustomSibebarInfoContainer = ({ id, schema, displayProperties }) => {\n const { data } = useCustomSidebarData({ id, schema, displayProperties });\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 <CustomSidebarInfo items={items} customSidebarInfoKey={displayProperties.key} />;\n};\n\nexport default CustomSibebarInfoContainer;\n\nCustomSibebarInfoContainer.propTypes = {\n id: PropTypes.string.isRequired,\n displayProperties: PropTypes.object.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,oBAAoB,MAAM,+BAA+B;AAChE,OAAOC,iBAAiB,MAAM,qCAAqC;AAEnE,MAAMC,0BAA0B,GAAGA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAkB,CAAC,KAAK;EACxE,MAAM;IAAEC;EAAK,CAAC,GAAGN,oBAAoB,CAAC;IAAEG,EAAE;IAAEC,MAAM;IAAEC;EAAkB,CAAC,CAAC;EAExE,IAAI,CAACC,IAAI,IAAI,CAACC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAE9E,MAAMC,KAAK,GAAGH,MAAM,CAACI,MAAM,CAACL,IAAI,CAAC,CAACM,OAAO,CAACC,IAAI,IAAIN,MAAM,CAACI,MAAM,CAACE,IAAI,CAAC,CAAC;EAEtE,oBAAOd,KAAA,CAAAe,aAAA,CAACb,iBAAiB;IAACS,KAAK,EAAEA,KAAM;IAACK,oBAAoB,EAAEV,iBAAiB,CAACW;EAAI,CAAE,CAAC;AACzF,CAAC;AAED,eAAed,0BAA0B;AAEzCA,0BAA0B,CAACe,SAAS,GAAG;EACrCd,EAAE,EAAEL,SAAS,CAACoB,MAAM,CAACC,UAAU;EAC/Bd,iBAAiB,EAAEP,SAAS,CAACsB,MAAM,CAACD,UAAU;EAC9Cf,MAAM,EAAEN,SAAS,CAACsB,MAAM,CAACD;AAC3B,CAAC","ignoreList":[]}
|
package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
+
export default function buildDynamicQuery({
|
|
4
|
+
id,
|
|
5
|
+
schema,
|
|
6
|
+
displayProperties
|
|
7
|
+
}) {
|
|
8
|
+
if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
|
|
9
|
+
throw new BlazeError('DataEntity query requires get action, properties and fields from entity schema');
|
|
10
|
+
}
|
|
11
|
+
if (displayProperties.adminMainInfoProperty && Array.isArray(displayProperties.adminMainInfoProperty)) {
|
|
12
|
+
const fields = displayProperties.adminMainInfoProperty.map(infoProperty => `${infoProperty} {
|
|
13
|
+
label
|
|
14
|
+
value
|
|
15
|
+
showLabel
|
|
16
|
+
tooltipIcon
|
|
17
|
+
tooltipContent
|
|
18
|
+
}`);
|
|
19
|
+
return gql`query getInfoBoxData($id: String!){
|
|
20
|
+
${schema.actions.get}( id: $id ) {
|
|
21
|
+
id
|
|
22
|
+
${fields.map(field => field)}
|
|
23
|
+
__typename
|
|
24
|
+
}
|
|
25
|
+
}`;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=build-dynamic-query.js.map
|
package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map
ADDED
|
@@ -0,0 +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 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":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import ProptTypes from 'prop-types';
|
|
3
|
+
import { useQuery, gql } from '@apollo/client';
|
|
4
|
+
import buildDynamicQuery from '../../../../InfoBoxes/helpers/build-dynamic-query';
|
|
5
|
+
import { RecordEditContext } from '../../../utils/RecordEditContext';
|
|
6
|
+
const useCustomSidebarData = ({
|
|
7
|
+
id,
|
|
8
|
+
schema,
|
|
9
|
+
displayProperties
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
externalUpdateTime,
|
|
13
|
+
updated
|
|
14
|
+
} = useContext(RecordEditContext);
|
|
15
|
+
const query = displayProperties.adminMainInfoProperty && Array.isArray(displayProperties.adminMainInfoProperty) ? buildDynamicQuery({
|
|
16
|
+
id,
|
|
17
|
+
schema,
|
|
18
|
+
properties: displayProperties.adminMainInfoProperty
|
|
19
|
+
}) : null;
|
|
20
|
+
const customSidebarInfoQuery = query || gql`
|
|
21
|
+
query {
|
|
22
|
+
__typename
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const {
|
|
26
|
+
data = {},
|
|
27
|
+
loading,
|
|
28
|
+
error,
|
|
29
|
+
refetch
|
|
30
|
+
} = useQuery(customSidebarInfoQuery, {
|
|
31
|
+
variables: {
|
|
32
|
+
id
|
|
33
|
+
},
|
|
34
|
+
skip: !query
|
|
35
|
+
});
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
refetch();
|
|
38
|
+
}, [externalUpdateTime, updated, refetch]);
|
|
39
|
+
return {
|
|
40
|
+
data: data.__typename !== 'Query' ? data : null,
|
|
41
|
+
loading,
|
|
42
|
+
error
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export default useCustomSidebarData;
|
|
46
|
+
useCustomSidebarData.propTypes = {
|
|
47
|
+
displayProperties: ProptTypes.object.isRequired
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=useCustomSidebarData.js.map
|
package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCustomSidebarData.js","names":["useContext","useEffect","ProptTypes","useQuery","gql","buildDynamicQuery","RecordEditContext","useCustomSidebarData","id","schema","displayProperties","externalUpdateTime","updated","query","adminMainInfoProperty","Array","isArray","properties","customSidebarInfoQuery","data","loading","error","refetch","variables","skip","__typename","propTypes","object","isRequired"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js"],"sourcesContent":["import { useContext, useEffect } from 'react';\nimport ProptTypes from 'prop-types';\nimport { useQuery, gql } from '@apollo/client';\nimport buildDynamicQuery from '../../../../InfoBoxes/helpers/build-dynamic-query';\nimport { RecordEditContext } from '../../../utils/RecordEditContext';\n\nconst useCustomSidebarData = ({ id, schema, displayProperties }) => {\n const { externalUpdateTime, updated } = useContext(RecordEditContext);\n\n const query =\n displayProperties.adminMainInfoProperty &&\n Array.isArray(displayProperties.adminMainInfoProperty)\n ? buildDynamicQuery({ id, schema, properties: displayProperties.adminMainInfoProperty })\n : null;\n\n const customSidebarInfoQuery =\n query ||\n gql`\n query {\n __typename\n }\n `;\n\n const {\n data = {},\n loading,\n error,\n refetch\n } = useQuery(customSidebarInfoQuery, {\n variables: { id },\n skip: !query\n });\n\n useEffect(() => {\n refetch();\n }, [externalUpdateTime, updated, refetch]);\n\n return { data: data.__typename !== 'Query' ? data : null, loading, error };\n};\n\nexport default useCustomSidebarData;\n\nuseCustomSidebarData.propTypes = {\n displayProperties: ProptTypes.object.isRequired\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7C,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,QAAQ,EAAEC,GAAG,QAAQ,gBAAgB;AAC9C,OAAOC,iBAAiB,MAAM,mDAAmD;AACjF,SAASC,iBAAiB,QAAQ,kCAAkC;AAEpE,MAAMC,oBAAoB,GAAGA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAkB,CAAC,KAAK;EAClE,MAAM;IAAEC,kBAAkB;IAAEC;EAAQ,CAAC,GAAGZ,UAAU,CAACM,iBAAiB,CAAC;EAErE,MAAMO,KAAK,GACTH,iBAAiB,CAACI,qBAAqB,IACvCC,KAAK,CAACC,OAAO,CAACN,iBAAiB,CAACI,qBAAqB,CAAC,GAClDT,iBAAiB,CAAC;IAAEG,EAAE;IAAEC,MAAM;IAAEQ,UAAU,EAAEP,iBAAiB,CAACI;EAAsB,CAAC,CAAC,GACtF,IAAI;EAEV,MAAMI,sBAAsB,GAC1BL,KAAK,IACLT,GAAG;AACP;AACA;AACA;AACA,KAAK;EAEH,MAAM;IACJe,IAAI,GAAG,CAAC,CAAC;IACTC,OAAO;IACPC,KAAK;IACLC;EACF,CAAC,GAAGnB,QAAQ,CAACe,sBAAsB,EAAE;IACnCK,SAAS,EAAE;MAAEf;IAAG,CAAC;IACjBgB,IAAI,EAAE,CAACX;EACT,CAAC,CAAC;EAEFZ,SAAS,CAAC,MAAM;IACdqB,OAAO,CAAC,CAAC;EACX,CAAC,EAAE,CAACX,kBAAkB,EAAEC,OAAO,EAAEU,OAAO,CAAC,CAAC;EAE1C,OAAO;IAAEH,IAAI,EAAEA,IAAI,CAACM,UAAU,KAAK,OAAO,GAAGN,IAAI,GAAG,IAAI;IAAEC,OAAO;IAAEC;EAAM,CAAC;AAC5E,CAAC;AAED,eAAed,oBAAoB;AAEnCA,oBAAoB,CAACmB,SAAS,GAAG;EAC/BhB,iBAAiB,EAAER,UAAU,CAACyB,MAAM,CAACC;AACvC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import uuidv1 from 'uuid/v1';
|
|
4
|
+
import { useApolloClient } from '@apollo/client';
|
|
5
|
+
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
6
|
+
import { formFieldTypes } from '@blaze-cms/react-form-builder';
|
|
7
|
+
import classnames from 'classnames';
|
|
8
|
+
import { VersionsList } from '@blaze-cms/versioning-ui';
|
|
9
|
+
import { PUBLISHED, UNPUBLISHED } from '../../../../constants';
|
|
10
|
+
import CustomSidebarInfoContainer from './container/CustomSidebarInfoContainer';
|
|
11
|
+
import EntityNavLinks from '../EntitiyNavLinks';
|
|
12
|
+
const SideBarRelations = ({
|
|
13
|
+
schema,
|
|
14
|
+
onChange,
|
|
15
|
+
formData,
|
|
16
|
+
entity,
|
|
17
|
+
isOpen,
|
|
18
|
+
onToggle
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
relation: RelationComponent
|
|
22
|
+
} = formFieldTypes;
|
|
23
|
+
const {
|
|
24
|
+
formattedStatus,
|
|
25
|
+
formattedUpdated,
|
|
26
|
+
formattedCreated,
|
|
27
|
+
formattedPublished,
|
|
28
|
+
updatedBy,
|
|
29
|
+
status
|
|
30
|
+
} = formData;
|
|
31
|
+
const client = useApolloClient();
|
|
32
|
+
const [relationsComponents, setRelationsComponents] = useState(null);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
(async () => {
|
|
35
|
+
const fetchRelationSchema = async ({
|
|
36
|
+
entityIdentifier
|
|
37
|
+
}) => {
|
|
38
|
+
if (!entityIdentifier) return null;
|
|
39
|
+
const {
|
|
40
|
+
data: {
|
|
41
|
+
getEntitySchemas: [relationSchema]
|
|
42
|
+
}
|
|
43
|
+
} = await client.query({
|
|
44
|
+
query: getQuery('GET_ENTITY_SCHEMA'),
|
|
45
|
+
variables: {
|
|
46
|
+
identifier: entityIdentifier
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return relationSchema;
|
|
50
|
+
};
|
|
51
|
+
if (!relationsComponents && schema) {
|
|
52
|
+
const allRelationComponents = await Promise.all(schema.relations.filter(({
|
|
53
|
+
showInForm,
|
|
54
|
+
foreignKey
|
|
55
|
+
}) => showInForm && schema.properties[foreignKey]).map(async relation => ({
|
|
56
|
+
id: uuidv1(),
|
|
57
|
+
staticData: relation,
|
|
58
|
+
schema: await fetchRelationSchema(relation)
|
|
59
|
+
})));
|
|
60
|
+
setRelationsComponents(allRelationComponents);
|
|
61
|
+
}
|
|
62
|
+
})();
|
|
63
|
+
}, [client, relationsComponents, schema, schema.relations]);
|
|
64
|
+
const {
|
|
65
|
+
id: itemId
|
|
66
|
+
} = entity;
|
|
67
|
+
const {
|
|
68
|
+
identifier: itemEntity,
|
|
69
|
+
interfaces
|
|
70
|
+
} = schema;
|
|
71
|
+
const statusClassName = classnames('sidebar__status__badge', {
|
|
72
|
+
'sidebar__status__badge--published': status === PUBLISHED,
|
|
73
|
+
'sidebar__status__badge--unpublished': status === UNPUBLISHED
|
|
74
|
+
});
|
|
75
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: classnames('sidebar', {
|
|
77
|
+
'sidebar--collapsed': !isOpen
|
|
78
|
+
}),
|
|
79
|
+
"data-testid": "sideBarRelations-main-div"
|
|
80
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: "sidebar__toggle-button",
|
|
82
|
+
onClick: onToggle,
|
|
83
|
+
role: "button",
|
|
84
|
+
"aria-label": isOpen ? 'Collapse sidebar' : 'Expand sidebar'
|
|
85
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
86
|
+
className: "material-icons"
|
|
87
|
+
}, isOpen ? 'keyboard_arrow_right' : 'keyboard_arrow_left')), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "sidebar__content"
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "sidebar__status"
|
|
91
|
+
}, formattedCreated && /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "sidebar__top"
|
|
93
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: "sidebar__status__wrapper"
|
|
95
|
+
}, /*#__PURE__*/React.createElement("b", null, "Status"), /*#__PURE__*/React.createElement("span", {
|
|
96
|
+
className: statusClassName
|
|
97
|
+
}, 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, {
|
|
98
|
+
id: itemId,
|
|
99
|
+
schema: schema,
|
|
100
|
+
displayProperties: schema.displayProperties
|
|
101
|
+
})), /*#__PURE__*/React.createElement(VersionsList, {
|
|
102
|
+
itemEntity: itemEntity,
|
|
103
|
+
itemId: itemId,
|
|
104
|
+
interfaces: interfaces
|
|
105
|
+
}), /*#__PURE__*/React.createElement(EntityNavLinks, {
|
|
106
|
+
schema: schema
|
|
107
|
+
}), relationsComponents && relationsComponents.map(({
|
|
108
|
+
id,
|
|
109
|
+
staticData,
|
|
110
|
+
schema: entitySchema
|
|
111
|
+
}) => /*#__PURE__*/React.createElement(RelationComponent, {
|
|
112
|
+
formData: formData,
|
|
113
|
+
schema: entitySchema,
|
|
114
|
+
key: id,
|
|
115
|
+
staticData: staticData,
|
|
116
|
+
onSelect: onChange
|
|
117
|
+
}))));
|
|
118
|
+
};
|
|
119
|
+
SideBarRelations.propTypes = {
|
|
120
|
+
schema: PropTypes.object.isRequired,
|
|
121
|
+
onChange: PropTypes.func.isRequired,
|
|
122
|
+
formData: PropTypes.object.isRequired,
|
|
123
|
+
entity: PropTypes.object,
|
|
124
|
+
isOpen: PropTypes.bool,
|
|
125
|
+
onToggle: PropTypes.func
|
|
126
|
+
};
|
|
127
|
+
SideBarRelations.defaultProps = {
|
|
128
|
+
entity: {},
|
|
129
|
+
isOpen: true,
|
|
130
|
+
onToggle: () => {}
|
|
131
|
+
};
|
|
132
|
+
export default SideBarRelations;
|
|
133
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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","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","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 { 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 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 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,SAA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,UAAW;IAACD,MAAM,EAAEA,MAAO;IAACE,UAAU,EAAEA;EAAW,CAAE,CAAC,eAChFrD,KAAA,CAAAuD,aAAA,CAAC1C,cAAc;IAACE,MAAM,EAAEA;EAAO,CAAE,CAAC,EAEjCe,mBAAmB,IAClBA,mBAAmB,CAACkB,GAAG,CAAC,CAAC;IAAEC,EAAE;IAAEC,UAAU;IAAEnC,MAAM,EAAEgD;EAAa,CAAC,kBAC/D/D,KAAA,CAAAuD,aAAA,CAACjC,iBAAiB;IAChBL,QAAQ,EAAEA,QAAS;IACnBF,MAAM,EAAEgD,YAAa;IACrBC,GAAG,EAAEf,EAAG;IACRC,UAAU,EAAEA,UAAW;IACvBe,QAAQ,EAAEjD;EAAS,CACpB,CACF,CACA,CACF,CAAC;AAEV,CAAC;AAEDF,gBAAgB,CAACoD,SAAS,GAAG;EAC3BnD,MAAM,EAAEZ,SAAS,CAACgE,MAAM,CAACC,UAAU;EACnCpD,QAAQ,EAAEb,SAAS,CAACkE,IAAI,CAACD,UAAU;EACnCnD,QAAQ,EAAEd,SAAS,CAACgE,MAAM,CAACC,UAAU;EACrClD,MAAM,EAAEf,SAAS,CAACgE,MAAM;EACxBhD,MAAM,EAAEhB,SAAS,CAACmE,IAAI;EACtBlD,QAAQ,EAAEjB,SAAS,CAACkE;AACtB,CAAC;AACDvD,gBAAgB,CAACyD,YAAY,GAAG;EAC9BrD,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
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import InfoBoxValue from '../../../../InfoBoxes/presentational/InfoBoxValue';
|
|
4
|
+
import InfoBoxLabel from '../../../../InfoBoxes/presentational/InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../../../../InfoBoxes/InfoBoxTooltip';
|
|
6
|
+
const CustomSidebarInfo = ({
|
|
7
|
+
items,
|
|
8
|
+
customSidebarInfoKey
|
|
9
|
+
}) => {
|
|
10
|
+
if (!items) return null;
|
|
11
|
+
const customSidebarInfoItems = items.map(item => Object.values(item).map(info => {
|
|
12
|
+
if (!info.label || !info.value) return null;
|
|
13
|
+
return /*#__PURE__*/React.createElement("p", {
|
|
14
|
+
key: `${customSidebarInfoKey}-${info.label.toLowerCase()}`
|
|
15
|
+
}, /*#__PURE__*/React.createElement(InfoBoxLabel, {
|
|
16
|
+
item: info
|
|
17
|
+
}), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
18
|
+
item: info
|
|
19
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
20
|
+
info: info,
|
|
21
|
+
position: "left"
|
|
22
|
+
})));
|
|
23
|
+
}).filter(Boolean));
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: "custom-sidebar-info",
|
|
26
|
+
key: customSidebarInfoKey
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "custom-sidebar-info--container"
|
|
29
|
+
}, customSidebarInfoItems));
|
|
30
|
+
};
|
|
31
|
+
CustomSidebarInfo.propTypes = {
|
|
32
|
+
customSidebarInfoKey: PropTypes.string.isRequired,
|
|
33
|
+
items: PropTypes.array.isRequired
|
|
34
|
+
};
|
|
35
|
+
export default CustomSidebarInfo;
|
|
36
|
+
//# sourceMappingURL=CustomSidebarInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["submit"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/create/index.js"],"sourcesContent":["import { submit } from './submit';\n\nexport default {\n submit\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,UAAU;AAEjC,eAAe;EACbA;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import buildCreateEntityMutation from '../../../../../utils/build-create-entity-mutation';
|
|
2
|
+
import { SAVE_BUTTON_TEXTS } from '../../../../../constants';
|
|
3
|
+
const submit = async ({
|
|
4
|
+
entitySchema,
|
|
5
|
+
parsedFormValues,
|
|
6
|
+
client,
|
|
7
|
+
setEntityData,
|
|
8
|
+
setIsSaveButtonAvailable,
|
|
9
|
+
setSaveButtonText,
|
|
10
|
+
history,
|
|
11
|
+
setIsNewEntity
|
|
12
|
+
}, addToast) => {
|
|
13
|
+
const mutation = buildCreateEntityMutation(entitySchema);
|
|
14
|
+
try {
|
|
15
|
+
setIsSaveButtonAvailable(false);
|
|
16
|
+
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
|
+
});
|
|
27
|
+
setSaveButtonText(SAVE_BUTTON_TEXTS.saved);
|
|
28
|
+
setEntityData(createdEntityResult.result);
|
|
29
|
+
setIsNewEntity(false);
|
|
30
|
+
const updatePathname = history.location.pathname.replace('create', 'update');
|
|
31
|
+
history.push(`${updatePathname}/${createdEntityResult.result.id}`);
|
|
32
|
+
addToast(`Created`, {
|
|
33
|
+
appearance: 'success',
|
|
34
|
+
autoDismiss: true
|
|
35
|
+
});
|
|
36
|
+
} catch (error) {
|
|
37
|
+
setIsSaveButtonAvailable(true);
|
|
38
|
+
setSaveButtonText(SAVE_BUTTON_TEXTS.save);
|
|
39
|
+
addToast(error.message, {
|
|
40
|
+
appearance: 'error',
|
|
41
|
+
autoDismiss: true
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export { submit };
|
|
46
|
+
//# sourceMappingURL=submit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit.js","names":["buildCreateEntityMutation","SAVE_BUTTON_TEXTS","submit","entitySchema","parsedFormValues","client","setEntityData","setIsSaveButtonAvailable","setSaveButtonText","history","setIsNewEntity","addToast","mutation","saving","data","createdEntity","createdEntityResult","mutate","variables","input","saved","result","updatePathname","location","pathname","replace","push","id","appearance","autoDismiss","error","save","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/create/submit.js"],"sourcesContent":["import buildCreateEntityMutation from '../../../../../utils/build-create-entity-mutation';\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 const mutation = buildCreateEntityMutation(entitySchema);\n\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const {\n data: { createdEntity: createdEntityResult }\n } = await client.mutate({\n mutation,\n variables: { input: parsedFormValues }\n });\n\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n setEntityData(createdEntityResult.result);\n setIsNewEntity(false);\n\n const updatePathname = history.location.pathname.replace('create', 'update');\n history.push(`${updatePathname}/${createdEntityResult.result.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,OAAOA,yBAAyB,MAAM,mDAAmD;AACzF,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,MAAMC,QAAQ,GAAGZ,yBAAyB,CAACG,YAAY,CAAC;EAExD,IAAI;IACFI,wBAAwB,CAAC,KAAK,CAAC;IAC/BC,iBAAiB,CAACP,iBAAiB,CAACY,MAAM,CAAC;IAC3C,MAAM;MACJC,IAAI,EAAE;QAAEC,aAAa,EAAEC;MAAoB;IAC7C,CAAC,GAAG,MAAMX,MAAM,CAACY,MAAM,CAAC;MACtBL,QAAQ;MACRM,SAAS,EAAE;QAAEC,KAAK,EAAEf;MAAiB;IACvC,CAAC,CAAC;IAEFI,iBAAiB,CAACP,iBAAiB,CAACmB,KAAK,CAAC;IAC1Cd,aAAa,CAACU,mBAAmB,CAACK,MAAM,CAAC;IACzCX,cAAc,CAAC,KAAK,CAAC;IAErB,MAAMY,cAAc,GAAGb,OAAO,CAACc,QAAQ,CAACC,QAAQ,CAACC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5EhB,OAAO,CAACiB,IAAI,CAAC,GAAGJ,cAAc,IAAIN,mBAAmB,CAACK,MAAM,CAACM,EAAE,EAAE,CAAC;IAClEhB,QAAQ,CAAC,SAAS,EAAE;MAClBiB,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdvB,wBAAwB,CAAC,IAAI,CAAC;IAC9BC,iBAAiB,CAACP,iBAAiB,CAAC8B,IAAI,CAAC;IACzCpB,QAAQ,CAACmB,KAAK,CAACE,OAAO,EAAE;MACtBJ,UAAU,EAAE,OAAO;MACnBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ;AACF,CAAC;AAED,SAAS3B,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import buildDeleteEntityMutation from '../../../../../utils/build-delete-entity-mutation';
|
|
2
|
+
const submit = async ({
|
|
3
|
+
entitySchema,
|
|
4
|
+
parsedFormValues,
|
|
5
|
+
client
|
|
6
|
+
}, addToast) => {
|
|
7
|
+
const mutation = buildDeleteEntityMutation(entitySchema);
|
|
8
|
+
const {
|
|
9
|
+
id
|
|
10
|
+
} = parsedFormValues;
|
|
11
|
+
try {
|
|
12
|
+
await client.mutate({
|
|
13
|
+
mutation,
|
|
14
|
+
variables: {
|
|
15
|
+
input: {
|
|
16
|
+
id
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
addToast('Deleted', {
|
|
21
|
+
appearance: 'success',
|
|
22
|
+
autoDismiss: true
|
|
23
|
+
});
|
|
24
|
+
} catch (error) {
|
|
25
|
+
addToast(error.message, {
|
|
26
|
+
appearance: 'error',
|
|
27
|
+
autoDismiss: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export { submit };
|
|
32
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","names":["buildDeleteEntityMutation","submit","entitySchema","parsedFormValues","client","addToast","mutation","id","mutate","variables","input","appearance","autoDismiss","error","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/delete/delete.js"],"sourcesContent":["import buildDeleteEntityMutation from '../../../../../utils/build-delete-entity-mutation';\n\nconst submit = async ({ entitySchema, parsedFormValues, client }, addToast) => {\n const mutation = buildDeleteEntityMutation(entitySchema);\n const { id } = parsedFormValues;\n\n try {\n await client.mutate({\n mutation,\n variables: { input: { id } }\n });\n addToast('Deleted', {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n};\n\nexport { submit };\n"],"mappings":"AAAA,OAAOA,yBAAyB,MAAM,mDAAmD;AAEzF,MAAMC,MAAM,GAAG,MAAAA,CAAO;EAAEC,YAAY;EAAEC,gBAAgB;EAAEC;AAAO,CAAC,EAAEC,QAAQ,KAAK;EAC7E,MAAMC,QAAQ,GAAGN,yBAAyB,CAACE,YAAY,CAAC;EACxD,MAAM;IAAEK;EAAG,CAAC,GAAGJ,gBAAgB;EAE/B,IAAI;IACF,MAAMC,MAAM,CAACI,MAAM,CAAC;MAClBF,QAAQ;MACRG,SAAS,EAAE;QAAEC,KAAK,EAAE;UAAEH;QAAG;MAAE;IAC7B,CAAC,CAAC;IACFF,QAAQ,CAAC,SAAS,EAAE;MAClBM,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdR,QAAQ,CAACQ,KAAK,CAACC,OAAO,EAAE;MACtBH,UAAU,EAAE,OAAO;MACnBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ;AACF,CAAC;AAED,SAASX,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["submit"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/delete/index.js"],"sourcesContent":["import { submit } from './delete';\n\nexport default { submit };\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,UAAU;AAEjC,eAAe;EAAEA;AAAO,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import createActions from './create';
|
|
2
|
+
import updateActions from './update';
|
|
3
|
+
import sharedActions from './shared';
|
|
4
|
+
import deleteActions from './delete';
|
|
5
|
+
const availableActions = {
|
|
6
|
+
create: createActions,
|
|
7
|
+
update: updateActions,
|
|
8
|
+
shared: sharedActions,
|
|
9
|
+
delete: deleteActions
|
|
10
|
+
};
|
|
11
|
+
export default availableActions;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["createActions","updateActions","sharedActions","deleteActions","availableActions","create","update","shared","delete"],"sources":["../../../../../src/components/EntityManager/Entity/actions-handlers/index.js"],"sourcesContent":["import createActions from './create';\nimport updateActions from './update';\nimport sharedActions from './shared';\nimport deleteActions from './delete';\n\nconst availableActions = {\n create: createActions,\n update: updateActions,\n shared: sharedActions,\n delete: deleteActions\n};\n\nexport default availableActions;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,UAAU;AACpC,OAAOC,aAAa,MAAM,UAAU;AACpC,OAAOC,aAAa,MAAM,UAAU;AACpC,OAAOC,aAAa,MAAM,UAAU;AAEpC,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAEL,aAAa;EACrBM,MAAM,EAAEL,aAAa;EACrBM,MAAM,EAAEL,aAAa;EACrBM,MAAM,EAAEL;AACV,CAAC;AAED,eAAeC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["triggerPublish"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/shared/index.js"],"sourcesContent":["import { triggerPublish } from './publish';\n\nexport default { triggerPublish };\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,WAAW;AAE1C,eAAe;EAAEA;AAAe,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { buildUpdatePublishUnpublishMutation } from '../../../../../utils';
|
|
2
|
+
import { SAVE_BEFORE_PUBLISH_MESSAGE } from '../../../../../constants';
|
|
3
|
+
const triggerPublish = async ({
|
|
4
|
+
entityData,
|
|
5
|
+
client,
|
|
6
|
+
setEntityIsPublish,
|
|
7
|
+
entitySchema,
|
|
8
|
+
textContent = '',
|
|
9
|
+
refetchRecord
|
|
10
|
+
}, addToast) => {
|
|
11
|
+
if (!Object.keys(entityData).length) {
|
|
12
|
+
addToast(SAVE_BEFORE_PUBLISH_MESSAGE, {
|
|
13
|
+
appearance: 'info',
|
|
14
|
+
autoDismiss: true
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const actionType = textContent.toLowerCase();
|
|
19
|
+
const entityIsPublishedSwitch = `${actionType}ed`;
|
|
20
|
+
const mutation = buildUpdatePublishUnpublishMutation(entitySchema, entityData.id, actionType);
|
|
21
|
+
try {
|
|
22
|
+
await client.mutate({
|
|
23
|
+
mutation
|
|
24
|
+
});
|
|
25
|
+
addToast(`${textContent}ed`, {
|
|
26
|
+
appearance: 'success',
|
|
27
|
+
autoDismiss: true
|
|
28
|
+
});
|
|
29
|
+
} catch (error) {
|
|
30
|
+
addToast(error.message, {
|
|
31
|
+
appearance: 'error',
|
|
32
|
+
autoDismiss: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
setEntityIsPublish(entityIsPublishedSwitch);
|
|
36
|
+
refetchRecord(true);
|
|
37
|
+
};
|
|
38
|
+
export { triggerPublish };
|
|
39
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","names":["buildUpdatePublishUnpublishMutation","SAVE_BEFORE_PUBLISH_MESSAGE","triggerPublish","entityData","client","setEntityIsPublish","entitySchema","textContent","refetchRecord","addToast","Object","keys","length","appearance","autoDismiss","actionType","toLowerCase","entityIsPublishedSwitch","mutation","id","mutate","error","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/shared/publish.js"],"sourcesContent":["import { buildUpdatePublishUnpublishMutation } from '../../../../../utils';\nimport { SAVE_BEFORE_PUBLISH_MESSAGE } from '../../../../../constants';\n\nconst triggerPublish = async (\n { entityData, client, setEntityIsPublish, entitySchema, textContent = '', refetchRecord },\n addToast\n) => {\n if (!Object.keys(entityData).length) {\n addToast(SAVE_BEFORE_PUBLISH_MESSAGE, {\n appearance: 'info',\n autoDismiss: true\n });\n return;\n }\n const actionType = textContent.toLowerCase();\n const entityIsPublishedSwitch = `${actionType}ed`;\n const mutation = buildUpdatePublishUnpublishMutation(entitySchema, entityData.id, actionType);\n\n try {\n await client.mutate({\n mutation\n });\n addToast(`${textContent}ed`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n\n setEntityIsPublish(entityIsPublishedSwitch);\n refetchRecord(true);\n};\n\nexport { triggerPublish };\n"],"mappings":"AAAA,SAASA,mCAAmC,QAAQ,sBAAsB;AAC1E,SAASC,2BAA2B,QAAQ,0BAA0B;AAEtE,MAAMC,cAAc,GAAG,MAAAA,CACrB;EAAEC,UAAU;EAAEC,MAAM;EAAEC,kBAAkB;EAAEC,YAAY;EAAEC,WAAW,GAAG,EAAE;EAAEC;AAAc,CAAC,EACzFC,QAAQ,KACL;EACH,IAAI,CAACC,MAAM,CAACC,IAAI,CAACR,UAAU,CAAC,CAACS,MAAM,EAAE;IACnCH,QAAQ,CAACR,2BAA2B,EAAE;MACpCY,UAAU,EAAE,MAAM;MAClBC,WAAW,EAAE;IACf,CAAC,CAAC;IACF;EACF;EACA,MAAMC,UAAU,GAAGR,WAAW,CAACS,WAAW,CAAC,CAAC;EAC5C,MAAMC,uBAAuB,GAAG,GAAGF,UAAU,IAAI;EACjD,MAAMG,QAAQ,GAAGlB,mCAAmC,CAACM,YAAY,EAAEH,UAAU,CAACgB,EAAE,EAAEJ,UAAU,CAAC;EAE7F,IAAI;IACF,MAAMX,MAAM,CAACgB,MAAM,CAAC;MAClBF;IACF,CAAC,CAAC;IACFT,QAAQ,CAAC,GAAGF,WAAW,IAAI,EAAE;MAC3BM,UAAU,EAAE,SAAS;MACrBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOO,KAAK,EAAE;IACdZ,QAAQ,CAACY,KAAK,CAACC,OAAO,EAAE;MACtBT,UAAU,EAAE,OAAO;MACnBC,WAAW,EAAE;IACf,CAAC,CAAC;EACJ;EAEAT,kBAAkB,CAACY,uBAAuB,CAAC;EAC3CT,aAAa,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,SAASN,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["submit"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/update/index.js"],"sourcesContent":["import { submit } from './submit';\n\nexport default { submit };\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,UAAU;AAEjC,eAAe;EAAEA;AAAO,CAAC","ignoreList":[]}
|