@blaze-cms/plugin-data-ui 0.125.0-alpha.1 → 0.125.0-alpha.13
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 +24 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +17 -40
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +0 -4
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +67 -204
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +13 -28
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +5 -26
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +0 -4
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +0 -4
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +13 -57
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +0 -16
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +0 -11
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +0 -7
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +0 -18
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +0 -3
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +0 -25
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +0 -4
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +24 -83
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +0 -4
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +5 -38
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +3 -38
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +17 -42
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +0 -7
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +2 -11
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +31 -116
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +9 -22
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +0 -4
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +2 -11
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +0 -4
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +0 -4
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +13 -49
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +0 -11
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +5 -16
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/constants.js +0 -1
- package/lib/constants.js.map +1 -1
- package/lib/index.js +0 -29
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +2 -17
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +0 -12
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +0 -10
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +0 -10
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +0 -12
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +0 -9
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +0 -3
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +0 -7
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +3 -10
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js +0 -3
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityDataListing/EntityDataListing.js +0 -2
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib-es/components/EntityDataListing/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +10 -55
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +0 -2
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +2 -5
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +0 -3
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +0 -3
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js +0 -3
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js +0 -5
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +0 -6
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/index.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js +2 -14
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/EntityManager/index.js.map +1 -1
- package/lib-es/components/EntityManager/utils/data-mappers.js +0 -11
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js +0 -13
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js +0 -2
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib-es/components/EntityManager/utils/is-form-empty.js +0 -2
- package/lib-es/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib-es/components/EntityManager/utils/query.js +2 -4
- package/lib-es/components/EntityManager/utils/query.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +0 -17
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +0 -2
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/TableActions.js +0 -2
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib-es/components/ListingTable/index.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js +0 -13
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js +0 -2
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +0 -2
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/index.js +2 -6
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js +0 -3
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-create-entity-mutation.js +0 -3
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-delete-entity-mutation.js +0 -3
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-listing-query.js +0 -3
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/build-update-data-query.js +0 -3
- package/lib-es/utils/build-update-data-query.js.map +1 -1
- package/lib-es/utils/build-update-publish-unpublish-mutation.js +0 -3
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib-es/utils/get-default-query-params.js +0 -1
- package/lib-es/utils/get-default-query-params.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/lib-es/utils/hooks/useToggle.js +0 -2
- package/lib-es/utils/hooks/useToggle.js.map +1 -1
- package/lib-es/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","uuidv1","useApolloClient","getQuery","formFieldTypes","Badge","VersionsList","PUBLISHED","SideBarRelations","schema","onChange","formData","entity","relation","RelationComponent","formattedStatus","formattedUpdated","formattedCreated","formattedPublished","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","entitySchema","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 Badge from '@blaze-react/badge';\nimport { VersionsList } from '@blaze-cms/versioning-ui';\nimport { PUBLISHED } from '../../../../constants';\n\nconst SideBarRelations = ({ schema, onChange, formData, entity }) => {\n const { relation: RelationComponent } = formFieldTypes;\n const { formattedStatus, formattedUpdated, formattedCreated, formattedPublished } = formData;\n const client = useApolloClient();\n const [relationsComponents, setRelationsComponents] = useState(null);\n\n useEffect(\n () => {\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 },\n [client, relationsComponents, schema, schema.relations]\n );\n const { id: itemId } = entity;\n const { identifier: itemEntity, interfaces } = schema;\n\n return (\n <div className=\"sidebar\" data-testid=\"sideBarRelations-main-div\">\n <div className=\"sidebar__content\">\n {formattedCreated && (\n <div className=\"sidebar__status\">\n {formattedStatus && (\n <Badge type=\"status\" modifiers={formattedStatus}>\n {formattedStatus}\n {formattedStatus === PUBLISHED && `: ${formattedPublished}`}\n </Badge>\n )}\n <p>\n Created: <span>{formattedCreated}</span>\n </p>\n <p>\n Updated: <span>{formattedUpdated}</span>\n </p>\n </div>\n )}\n\n <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />\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,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","uuidv1","useApolloClient","getQuery","formFieldTypes","Badge","VersionsList","PUBLISHED","SideBarRelations","schema","onChange","formData","entity","relation","RelationComponent","formattedStatus","formattedUpdated","formattedCreated","formattedPublished","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","entitySchema","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 Badge from '@blaze-react/badge';\nimport { VersionsList } from '@blaze-cms/versioning-ui';\nimport { PUBLISHED } from '../../../../constants';\n\nconst SideBarRelations = ({ schema, onChange, formData, entity }) => {\n const { relation: RelationComponent } = formFieldTypes;\n const { formattedStatus, formattedUpdated, formattedCreated, formattedPublished } = formData;\n const client = useApolloClient();\n const [relationsComponents, setRelationsComponents] = useState(null);\n\n useEffect(\n () => {\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 },\n [client, relationsComponents, schema, schema.relations]\n );\n const { id: itemId } = entity;\n const { identifier: itemEntity, interfaces } = schema;\n\n return (\n <div className=\"sidebar\" data-testid=\"sideBarRelations-main-div\">\n <div className=\"sidebar__content\">\n {formattedCreated && (\n <div className=\"sidebar__status\">\n {formattedStatus && (\n <Badge type=\"status\" modifiers={formattedStatus}>\n {formattedStatus}\n {formattedStatus === PUBLISHED && `: ${formattedPublished}`}\n </Badge>\n )}\n <p>\n Created: <span>{formattedCreated}</span>\n </p>\n <p>\n Updated: <span>{formattedUpdated}</span>\n </p>\n </div>\n )}\n\n <VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />\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,KAAK,MAAM,oBAAoB;AACtC,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,SAAS,QAAQ,uBAAuB;AAEjD,MAAMC,gBAAgB,GAAG,CAAC;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,QAAQ;EAAEC;AAAO,CAAC,KAAK;EACnE,MAAM;IAAEC,QAAQ,EAAEC;EAAkB,CAAC,GAAGV,cAAc;EACtD,MAAM;IAAEW,eAAe;I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gB"}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import buildCreateEntityMutation from '../../../../../utils/build-create-entity-mutation';
|
|
2
2
|
import { SAVE_BUTTON_TEXTS } from '../../../../../constants';
|
|
3
|
-
|
|
4
3
|
const submit = async ({
|
|
5
4
|
entitySchema,
|
|
6
5
|
parsedFormValues,
|
|
@@ -12,7 +11,6 @@ const submit = async ({
|
|
|
12
11
|
setIsNewEntity
|
|
13
12
|
}, addToast) => {
|
|
14
13
|
const mutation = buildCreateEntityMutation(entitySchema);
|
|
15
|
-
|
|
16
14
|
try {
|
|
17
15
|
setIsSaveButtonAvailable(false);
|
|
18
16
|
setSaveButtonText(SAVE_BUTTON_TEXTS.saving);
|
|
@@ -44,6 +42,5 @@ const submit = async ({
|
|
|
44
42
|
});
|
|
45
43
|
}
|
|
46
44
|
};
|
|
47
|
-
|
|
48
45
|
export { submit };
|
|
49
46
|
//# sourceMappingURL=submit.js.map
|
|
@@ -1 +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,
|
|
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,OACb;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,CAAE,GAAEJ,cAAe,IAAGN,mBAAmB,CAACK,MAAM,CAACM,EAAG,EAAC,CAAC;IAClEhB,QAAQ,CAAE,SAAQ,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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import buildDeleteEntityMutation from '../../../../../utils/build-delete-entity-mutation';
|
|
2
|
-
|
|
3
2
|
const submit = async ({
|
|
4
3
|
entitySchema,
|
|
5
4
|
parsedFormValues,
|
|
@@ -9,7 +8,6 @@ const submit = async ({
|
|
|
9
8
|
const {
|
|
10
9
|
id
|
|
11
10
|
} = parsedFormValues;
|
|
12
|
-
|
|
13
11
|
try {
|
|
14
12
|
await client.mutate({
|
|
15
13
|
mutation,
|
|
@@ -30,6 +28,5 @@ const submit = async ({
|
|
|
30
28
|
});
|
|
31
29
|
}
|
|
32
30
|
};
|
|
33
|
-
|
|
34
31
|
export { submit };
|
|
35
32
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +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,
|
|
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,OAAO;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"}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { buildUpdatePublishUnpublishMutation } from '../../../../../utils';
|
|
2
2
|
import { SAVE_BEFORE_PUBLISH_MESSAGE } from '../../../../../constants';
|
|
3
|
-
|
|
4
3
|
const triggerPublish = async ({
|
|
5
4
|
entityData,
|
|
6
5
|
client,
|
|
@@ -16,11 +15,9 @@ const triggerPublish = async ({
|
|
|
16
15
|
});
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
const actionType = textContent.toLowerCase();
|
|
21
19
|
const entityIsPublishedSwitch = `${actionType}ed`;
|
|
22
20
|
const mutation = buildUpdatePublishUnpublishMutation(entitySchema, entityData.id, actionType);
|
|
23
|
-
|
|
24
21
|
try {
|
|
25
22
|
await client.mutate({
|
|
26
23
|
mutation
|
|
@@ -35,10 +32,8 @@ const triggerPublish = async ({
|
|
|
35
32
|
autoDismiss: true
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
setEntityIsPublish(entityIsPublishedSwitch);
|
|
40
36
|
refetchRecord(true);
|
|
41
37
|
};
|
|
42
|
-
|
|
43
38
|
export { triggerPublish };
|
|
44
39
|
//# sourceMappingURL=publish.js.map
|
|
@@ -1 +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,
|
|
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,OACrB;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,EAAE;EAC5C,MAAMC,uBAAuB,GAAI,GAAEF,UAAW,IAAG;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,CAAE,GAAEF,WAAY,IAAG,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"}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import buildUpdateDataQuery from '../../../../../utils/build-update-data-query';
|
|
8
5
|
import { ERROR, SUCCESS, SAVE_BUTTON_TEXTS } from '../../../../../constants';
|
|
9
|
-
|
|
10
6
|
const submit = async ({
|
|
11
7
|
entitySchema,
|
|
12
8
|
entityData,
|
|
@@ -19,7 +15,6 @@ const submit = async ({
|
|
|
19
15
|
handleUpdateFormData
|
|
20
16
|
}, addToast) => {
|
|
21
17
|
const mutation = buildUpdateDataQuery(entitySchema);
|
|
22
|
-
|
|
23
18
|
try {
|
|
24
19
|
setIsSaveButtonAvailable(false);
|
|
25
20
|
setSaveButtonText(SAVE_BUTTON_TEXTS.saving);
|
|
@@ -54,6 +49,5 @@ const submit = async ({
|
|
|
54
49
|
return ERROR;
|
|
55
50
|
}
|
|
56
51
|
};
|
|
57
|
-
|
|
58
52
|
export { submit };
|
|
59
53
|
//# sourceMappingURL=submit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.js","names":["buildUpdateDataQuery","ERROR","SUCCESS","SAVE_BUTTON_TEXTS","submit","entitySchema","entityData","parsedFormValues","client","setIsSaveButtonAvailable","setSaveButtonText","setNewUpdatedDate","newUpdatedDate","handleUpdateFormData","addToast","mutation","saving","data","mutate","variables","input","id","updated","saved","updatedDate","updateEntity","result","appearance","autoDismiss","error","save","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/update/submit.js"],"sourcesContent":["import buildUpdateDataQuery from '../../../../../utils/build-update-data-query';\nimport { ERROR, SUCCESS, SAVE_BUTTON_TEXTS } from '../../../../../constants';\n\nconst submit = async (\n {\n entitySchema,\n entityData,\n parsedFormValues,\n client,\n setIsSaveButtonAvailable,\n setSaveButtonText,\n setNewUpdatedDate,\n newUpdatedDate,\n handleUpdateFormData\n },\n addToast\n) => {\n const mutation = buildUpdateDataQuery(entitySchema);\n\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const { data } = await client.mutate({\n mutation,\n variables: {\n input: {\n id: entityData.id,\n ...parsedFormValues,\n updated: newUpdatedDate || entityData.updated\n }\n }\n });\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n const updatedDate =\n data && data.updateEntity && data.updateEntity.result && data.updateEntity.result.updated;\n\n setNewUpdatedDate(updatedDate);\n\n addToast('Updated', {\n appearance: SUCCESS,\n autoDismiss: true\n });\n handleUpdateFormData();\n return SUCCESS;\n } catch (error) {\n setIsSaveButtonAvailable(true);\n setSaveButtonText(SAVE_BUTTON_TEXTS.save);\n addToast(error.message, {\n appearance: ERROR,\n autoDismiss: true\n });\n return ERROR;\n }\n};\n\nexport { submit };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"submit.js","names":["buildUpdateDataQuery","ERROR","SUCCESS","SAVE_BUTTON_TEXTS","submit","entitySchema","entityData","parsedFormValues","client","setIsSaveButtonAvailable","setSaveButtonText","setNewUpdatedDate","newUpdatedDate","handleUpdateFormData","addToast","mutation","saving","data","mutate","variables","input","id","updated","saved","updatedDate","updateEntity","result","appearance","autoDismiss","error","save","message"],"sources":["../../../../../../src/components/EntityManager/Entity/actions-handlers/update/submit.js"],"sourcesContent":["import buildUpdateDataQuery from '../../../../../utils/build-update-data-query';\nimport { ERROR, SUCCESS, SAVE_BUTTON_TEXTS } from '../../../../../constants';\n\nconst submit = async (\n {\n entitySchema,\n entityData,\n parsedFormValues,\n client,\n setIsSaveButtonAvailable,\n setSaveButtonText,\n setNewUpdatedDate,\n newUpdatedDate,\n handleUpdateFormData\n },\n addToast\n) => {\n const mutation = buildUpdateDataQuery(entitySchema);\n\n try {\n setIsSaveButtonAvailable(false);\n setSaveButtonText(SAVE_BUTTON_TEXTS.saving);\n const { data } = await client.mutate({\n mutation,\n variables: {\n input: {\n id: entityData.id,\n ...parsedFormValues,\n updated: newUpdatedDate || entityData.updated\n }\n }\n });\n setSaveButtonText(SAVE_BUTTON_TEXTS.saved);\n const updatedDate =\n data && data.updateEntity && data.updateEntity.result && data.updateEntity.result.updated;\n\n setNewUpdatedDate(updatedDate);\n\n addToast('Updated', {\n appearance: SUCCESS,\n autoDismiss: true\n });\n handleUpdateFormData();\n return SUCCESS;\n } catch (error) {\n setIsSaveButtonAvailable(true);\n setSaveButtonText(SAVE_BUTTON_TEXTS.save);\n addToast(error.message, {\n appearance: ERROR,\n autoDismiss: true\n });\n return ERROR;\n }\n};\n\nexport { submit };\n"],"mappings":";;;AAAA,OAAOA,oBAAoB,MAAM,8CAA8C;AAC/E,SAASC,KAAK,EAAEC,OAAO,EAAEC,iBAAiB,QAAQ,0BAA0B;AAE5E,MAAMC,MAAM,GAAG,OACb;EACEC,YAAY;EACZC,UAAU;EACVC,gBAAgB;EAChBC,MAAM;EACNC,wBAAwB;EACxBC,iBAAiB;EACjBC,iBAAiB;EACjBC,cAAc;EACdC;AACF,CAAC,EACDC,QAAQ,KACL;EACH,MAAMC,QAAQ,GAAGf,oBAAoB,CAACK,YAAY,CAAC;EAEnD,IAAI;IACFI,wBAAwB,CAAC,KAAK,CAAC;IAC/BC,iBAAiB,CAACP,iBAAiB,CAACa,MAAM,CAAC;IAC3C,MAAM;MAAEC;IAAK,CAAC,GAAG,MAAMT,MAAM,CAACU,MAAM,CAAC;MACnCH,QAAQ;MACRI,SAAS,EAAE;QACTC,KAAK;UACHC,EAAE,EAAEf,UAAU,CAACe;QAAE,GACdd,gBAAgB;UACnBe,OAAO,EAAEV,cAAc,IAAIN,UAAU,CAACgB;QAAO;MAEjD;IACF,CAAC,CAAC;IACFZ,iBAAiB,CAACP,iBAAiB,CAACoB,KAAK,CAAC;IAC1C,MAAMC,WAAW,GACfP,IAAI,IAAIA,IAAI,CAACQ,YAAY,IAAIR,IAAI,CAACQ,YAAY,CAACC,MAAM,IAAIT,IAAI,CAACQ,YAAY,CAACC,MAAM,CAACJ,OAAO;IAE3FX,iBAAiB,CAACa,WAAW,CAAC;IAE9BV,QAAQ,CAAC,SAAS,EAAE;MAClBa,UAAU,EAAEzB,OAAO;MACnB0B,WAAW,EAAE;IACf,CAAC,CAAC;IACFf,oBAAoB,EAAE;IACtB,OAAOX,OAAO;EAChB,CAAC,CAAC,OAAO2B,KAAK,EAAE;IACdpB,wBAAwB,CAAC,IAAI,CAAC;IAC9BC,iBAAiB,CAACP,iBAAiB,CAAC2B,IAAI,CAAC;IACzChB,QAAQ,CAACe,KAAK,CAACE,OAAO,EAAE;MACtBJ,UAAU,EAAE1B,KAAK;MACjB2B,WAAW,EAAE;IACf,CAAC,CAAC;IACF,OAAO3B,KAAK;EACd;AACF,CAAC;AAED,SAASG,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Entity"],"sources":["../../../../src/components/EntityManager/Entity/index.js"],"sourcesContent":["import Entity from './Entity';\n\nexport default Entity;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["Entity"],"sources":["../../../../src/components/EntityManager/Entity/index.js"],"sourcesContent":["import Entity from './Entity';\n\nexport default Entity;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,UAAU;AAE7B,eAAeA,MAAM"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import React, { useEffect, useState } from 'react';
|
|
8
5
|
import { withRouter } from 'react-router-dom';
|
|
9
6
|
import { useApolloClient } from '@apollo/client';
|
|
@@ -11,7 +8,6 @@ import PropTypes from 'prop-types';
|
|
|
11
8
|
import entityAvailableActions from './utils/entityAvailableActions';
|
|
12
9
|
import Entity from './Entity';
|
|
13
10
|
import { getAction } from './utils/query';
|
|
14
|
-
|
|
15
11
|
const EntityManager = ({
|
|
16
12
|
match
|
|
17
13
|
}) => {
|
|
@@ -37,7 +33,6 @@ const EntityManager = ({
|
|
|
37
33
|
id
|
|
38
34
|
});
|
|
39
35
|
let localData = data;
|
|
40
|
-
|
|
41
36
|
if (isPageBuilderTemplateSet(data)) {
|
|
42
37
|
const pageBuilderComponents = await getPageBuilderComponents({
|
|
43
38
|
entitySchema,
|
|
@@ -48,7 +43,6 @@ const EntityManager = ({
|
|
|
48
43
|
pageBuilder: pageBuilderComponents || localData.pageBuilder
|
|
49
44
|
});
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
setFormData({
|
|
53
47
|
values: localData
|
|
54
48
|
});
|
|
@@ -58,17 +52,15 @@ const EntityManager = ({
|
|
|
58
52
|
setShouldRefetch(false);
|
|
59
53
|
})();
|
|
60
54
|
}, [action, client, entityIdentifier, id, schema, shouldRefetch]);
|
|
61
|
-
|
|
62
55
|
const updateFormData = (updatedFormData, shouldRefresh) => {
|
|
63
56
|
if (shouldRefresh) setShouldRefetch(true);
|
|
64
57
|
setFormData(updatedFormData);
|
|
65
|
-
};
|
|
66
|
-
|
|
58
|
+
};
|
|
67
59
|
|
|
60
|
+
// Reset when entity/record changes
|
|
68
61
|
if (!formData || !schema.id || recordHasChanged(entity, id, schema.id, entityIdentifier)) {
|
|
69
62
|
return null;
|
|
70
63
|
}
|
|
71
|
-
|
|
72
64
|
return /*#__PURE__*/React.createElement(Entity, {
|
|
73
65
|
action: match.params.action,
|
|
74
66
|
formData: formData,
|
|
@@ -80,7 +72,6 @@ const EntityManager = ({
|
|
|
80
72
|
refetchRecord: setShouldRefetch
|
|
81
73
|
});
|
|
82
74
|
};
|
|
83
|
-
|
|
84
75
|
EntityManager.propTypes = {
|
|
85
76
|
match: PropTypes.shape({
|
|
86
77
|
params: PropTypes.shape({
|
|
@@ -92,7 +83,6 @@ EntityManager.propTypes = {
|
|
|
92
83
|
}).isRequired
|
|
93
84
|
};
|
|
94
85
|
export default withRouter(EntityManager);
|
|
95
|
-
|
|
96
86
|
async function getPageBuilderComponents({
|
|
97
87
|
entitySchema,
|
|
98
88
|
client,
|
|
@@ -112,11 +102,9 @@ async function getPageBuilderComponents({
|
|
|
112
102
|
});
|
|
113
103
|
return pageBuilderData[actionName] && pageBuilderData[actionName].length ? pageBuilderData[actionName][0].pageBuilderComponents : null;
|
|
114
104
|
}
|
|
115
|
-
|
|
116
105
|
function isPageBuilderTemplateSet(data) {
|
|
117
106
|
return data && data.pageBuilderTemplateId && data.pageBuilderTemplateId !== '';
|
|
118
107
|
}
|
|
119
|
-
|
|
120
108
|
function recordHasChanged(entity, id, currentEntityIdentifier, entityIdentifier) {
|
|
121
109
|
return entity && entity.id && entity.id !== id || currentEntityIdentifier && currentEntityIdentifier !== entityIdentifier;
|
|
122
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityManager.js","names":["React","useEffect","useState","withRouter","useApolloClient","PropTypes","entityAvailableActions","Entity","getAction","EntityManager","match","formData","setFormData","entity","setEntity","schema","setSchema","id","previousQuery","setPreviousQuery","shouldRefetch","setShouldRefetch","client","action","entityIdentifier","onViewUrl","params","entitySchema","data","requestedQuery","identifier","localData","isPageBuilderTemplateSet","pageBuilderComponents","getPageBuilderComponents","pageBuilder","values","updateFormData","updatedFormData","shouldRefresh","recordHasChanged","propTypes","shape","string","func","isRequired","actionName","actions","getAll","pageBuilderData","query","variables","where","fetchPolicy","length","pageBuilderTemplateId","currentEntityIdentifier"],"sources":["../../../src/components/EntityManager/EntityManager.js"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { withRouter } from 'react-router-dom';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport entityAvailableActions from './utils/entityAvailableActions';\nimport Entity from './Entity';\nimport { getAction } from './utils/query';\n\nconst EntityManager = ({ match }) => {\n const [formData, setFormData] = useState(null);\n const [entity, setEntity] = useState(null);\n const [schema, setSchema] = useState({ id: null });\n const [previousQuery, setPreviousQuery] = useState(null);\n const [shouldRefetch, setShouldRefetch] = useState(false);\n const client = useApolloClient();\n\n const { action, entityIdentifier, id = null, onViewUrl } = match.params;\n\n useEffect(\n () => {\n (async () => {\n const [entitySchema, data = {}, requestedQuery = {}] = await entityAvailableActions[action](\n {\n client,\n identifier: entityIdentifier,\n id\n }\n );\n let localData = data;\n\n if (isPageBuilderTemplateSet(data)) {\n const pageBuilderComponents = await getPageBuilderComponents({\n entitySchema,\n client,\n id\n });\n\n localData = {\n ...localData,\n pageBuilder: pageBuilderComponents || localData.pageBuilder\n };\n }\n\n setFormData({ values: localData });\n setEntity(data);\n setSchema(entitySchema);\n setPreviousQuery(requestedQuery);\n setShouldRefetch(false);\n })();\n },\n [action, client, entityIdentifier, id, schema, shouldRefetch]\n );\n\n const updateFormData = (updatedFormData, shouldRefresh) => {\n if (shouldRefresh) setShouldRefetch(true);\n setFormData(updatedFormData);\n };\n\n // Reset when entity/record changes\n if (!formData || !schema.id || recordHasChanged(entity, id, schema.id, entityIdentifier)) {\n return null;\n }\n\n return (\n <Entity\n action={match.params.action}\n formData={formData}\n updateFormData={updateFormData}\n entity={entity}\n schema={schema}\n previousQuery={previousQuery}\n onViewUrl={onViewUrl}\n refetchRecord={setShouldRefetch}\n />\n );\n};\n\nEntityManager.propTypes = {\n match: PropTypes.shape({\n params: PropTypes.shape({\n action: PropTypes.string,\n entityIdentifier: PropTypes.string,\n id: PropTypes.string,\n onViewUrl: PropTypes.func\n })\n }).isRequired\n};\n\nexport default withRouter(EntityManager);\n\nasync function getPageBuilderComponents({ entitySchema, client, id }) {\n const actionName = (entitySchema && entitySchema.actions.getAll) || 'get';\n const { data: pageBuilderData = {} } = await client.query({\n query: getAction(actionName, 'pageBuilderComponents'),\n variables: {\n where: {\n id\n }\n },\n fetchPolicy: 'network-only'\n });\n\n return pageBuilderData[actionName] && pageBuilderData[actionName].length\n ? pageBuilderData[actionName][0].pageBuilderComponents\n : null;\n}\n\nfunction isPageBuilderTemplateSet(data) {\n return data && data.pageBuilderTemplateId && data.pageBuilderTemplateId !== '';\n}\n\nfunction recordHasChanged(entity, id, currentEntityIdentifier, entityIdentifier) {\n return (\n (entity && entity.id && entity.id !== id) ||\n (currentEntityIdentifier && currentEntityIdentifier !== entityIdentifier)\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityManager.js","names":["React","useEffect","useState","withRouter","useApolloClient","PropTypes","entityAvailableActions","Entity","getAction","EntityManager","match","formData","setFormData","entity","setEntity","schema","setSchema","id","previousQuery","setPreviousQuery","shouldRefetch","setShouldRefetch","client","action","entityIdentifier","onViewUrl","params","entitySchema","data","requestedQuery","identifier","localData","isPageBuilderTemplateSet","pageBuilderComponents","getPageBuilderComponents","pageBuilder","values","updateFormData","updatedFormData","shouldRefresh","recordHasChanged","propTypes","shape","string","func","isRequired","actionName","actions","getAll","pageBuilderData","query","variables","where","fetchPolicy","length","pageBuilderTemplateId","currentEntityIdentifier"],"sources":["../../../src/components/EntityManager/EntityManager.js"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { withRouter } from 'react-router-dom';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport entityAvailableActions from './utils/entityAvailableActions';\nimport Entity from './Entity';\nimport { getAction } from './utils/query';\n\nconst EntityManager = ({ match }) => {\n const [formData, setFormData] = useState(null);\n const [entity, setEntity] = useState(null);\n const [schema, setSchema] = useState({ id: null });\n const [previousQuery, setPreviousQuery] = useState(null);\n const [shouldRefetch, setShouldRefetch] = useState(false);\n const client = useApolloClient();\n\n const { action, entityIdentifier, id = null, onViewUrl } = match.params;\n\n useEffect(\n () => {\n (async () => {\n const [entitySchema, data = {}, requestedQuery = {}] = await entityAvailableActions[action](\n {\n client,\n identifier: entityIdentifier,\n id\n }\n );\n let localData = data;\n\n if (isPageBuilderTemplateSet(data)) {\n const pageBuilderComponents = await getPageBuilderComponents({\n entitySchema,\n client,\n id\n });\n\n localData = {\n ...localData,\n pageBuilder: pageBuilderComponents || localData.pageBuilder\n };\n }\n\n setFormData({ values: localData });\n setEntity(data);\n setSchema(entitySchema);\n setPreviousQuery(requestedQuery);\n setShouldRefetch(false);\n })();\n },\n [action, client, entityIdentifier, id, schema, shouldRefetch]\n );\n\n const updateFormData = (updatedFormData, shouldRefresh) => {\n if (shouldRefresh) setShouldRefetch(true);\n setFormData(updatedFormData);\n };\n\n // Reset when entity/record changes\n if (!formData || !schema.id || recordHasChanged(entity, id, schema.id, entityIdentifier)) {\n return null;\n }\n\n return (\n <Entity\n action={match.params.action}\n formData={formData}\n updateFormData={updateFormData}\n entity={entity}\n schema={schema}\n previousQuery={previousQuery}\n onViewUrl={onViewUrl}\n refetchRecord={setShouldRefetch}\n />\n );\n};\n\nEntityManager.propTypes = {\n match: PropTypes.shape({\n params: PropTypes.shape({\n action: PropTypes.string,\n entityIdentifier: PropTypes.string,\n id: PropTypes.string,\n onViewUrl: PropTypes.func\n })\n }).isRequired\n};\n\nexport default withRouter(EntityManager);\n\nasync function getPageBuilderComponents({ entitySchema, client, id }) {\n const actionName = (entitySchema && entitySchema.actions.getAll) || 'get';\n const { data: pageBuilderData = {} } = await client.query({\n query: getAction(actionName, 'pageBuilderComponents'),\n variables: {\n where: {\n id\n }\n },\n fetchPolicy: 'network-only'\n });\n\n return pageBuilderData[actionName] && pageBuilderData[actionName].length\n ? pageBuilderData[actionName][0].pageBuilderComponents\n : null;\n}\n\nfunction isPageBuilderTemplateSet(data) {\n return data && data.pageBuilderTemplateId && data.pageBuilderTemplateId !== '';\n}\n\nfunction recordHasChanged(entity, id, currentEntityIdentifier, entityIdentifier) {\n return (\n (entity && entity.id && entity.id !== id) ||\n (currentEntityIdentifier && currentEntityIdentifier !== entityIdentifier)\n );\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,sBAAsB,MAAM,gCAAgC;AACnE,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,SAAS,QAAQ,eAAe;AAEzC,MAAMC,aAAa,GAAG,CAAC;EAAEC;AAAM,CAAC,KAAK;EACnC,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGV,QAAQ,CAAC,IAAI,CAAC;EAC9C,MAAM,CAACW,MAAM,EAAEC,SAAS,CAAC,GAAGZ,QAAQ,CAAC,IAAI,CAAC;EAC1C,MAAM,CAACa,MAAM,EAAEC,SAAS,CAAC,GAAGd,QAAQ,CAAC;IAAEe,EAAE,EAAE;EAAK,CAAC,CAAC;EAClD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGjB,QAAQ,CAAC,IAAI,CAAC;EACxD,MAAM,CAACkB,aAAa,EAAEC,gBAAgB,CAAC,GAAGnB,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAMoB,MAAM,GAAGlB,eAAe,EAAE;EAEhC,MAAM;IAAEmB,MAAM;IAAEC,gBAAgB;IAAEP,EAAE,GAAG,IAAI;IAAEQ;EAAU,CAAC,GAAGf,KAAK,CAACgB,MAAM;EAEvEzB,SAAS,CACP,MAAM;IACJ,CAAC,YAAY;MACX,MAAM,CAAC0B,YAAY,EAAEC,IAAI,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AE;AAChF;AAEA,SAASf,gBAAgB,CAAC3B,MAAM,EAAEI,EAAE,EAAEuC,uBAAuB,EAAEhC,gBAAgB,EAAE;EAC/E,OACGX,MAAM,IAAIA,MAAM,CAACI,EAAE,IAAIJ,MAAM,CAACI,EAAE,KAAKA,EAAE,IACvCuC,uBAAuB,IAAIA,uBAAuB,KAAKhC,gBAAiB;AAE7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["EntityManager"],"sources":["../../../src/components/EntityManager/index.js"],"sourcesContent":["import EntityManager from './EntityManager';\n\nexport default EntityManager;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["EntityManager"],"sources":["../../../src/components/EntityManager/index.js"],"sourcesContent":["import EntityManager from './EntityManager';\n\nexport default EntityManager;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3C,eAAeA,aAAa"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import { BlazeError } from '@blaze-cms/core-errors';
|
|
8
|
-
|
|
9
5
|
const getPageName = (displayProperties = {}, entity = {}) => {
|
|
10
6
|
if (!displayProperties || !displayProperties.adminHeader) {
|
|
11
7
|
const {
|
|
@@ -14,7 +10,6 @@ const getPageName = (displayProperties = {}, entity = {}) => {
|
|
|
14
10
|
} = entity;
|
|
15
11
|
return name || fieldId || '';
|
|
16
12
|
}
|
|
17
|
-
|
|
18
13
|
const {
|
|
19
14
|
adminHeader
|
|
20
15
|
} = displayProperties;
|
|
@@ -24,12 +19,10 @@ const getPageName = (displayProperties = {}, entity = {}) => {
|
|
|
24
19
|
return acc;
|
|
25
20
|
}, []).join(' ');
|
|
26
21
|
};
|
|
27
|
-
|
|
28
22
|
const createNewListItem = ({
|
|
29
23
|
listingData,
|
|
30
24
|
result
|
|
31
25
|
}) => [...listingData, result];
|
|
32
|
-
|
|
33
26
|
const updateListItems = ({
|
|
34
27
|
listingData,
|
|
35
28
|
result,
|
|
@@ -38,7 +31,6 @@ const updateListItems = ({
|
|
|
38
31
|
if (!listingData || !result || !id) throw new BlazeError('Expected object with: listingData, result, id');
|
|
39
32
|
return listingData.map(item => {
|
|
40
33
|
const mapperResult = _objectSpread({}, item);
|
|
41
|
-
|
|
42
34
|
if (item.id === id) {
|
|
43
35
|
Object.keys(item).forEach(key => {
|
|
44
36
|
if (result[key] && key !== 'id') {
|
|
@@ -47,11 +39,9 @@ const updateListItems = ({
|
|
|
47
39
|
});
|
|
48
40
|
return mapperResult;
|
|
49
41
|
}
|
|
50
|
-
|
|
51
42
|
return mapperResult;
|
|
52
43
|
});
|
|
53
44
|
};
|
|
54
|
-
|
|
55
45
|
const deleteFromListItems = ({
|
|
56
46
|
listingData,
|
|
57
47
|
id
|
|
@@ -61,6 +51,5 @@ const deleteFromListItems = ({
|
|
|
61
51
|
id: itemId
|
|
62
52
|
}) => itemId !== id);
|
|
63
53
|
};
|
|
64
|
-
|
|
65
54
|
export { getPageName, createNewListItem, updateListItems, deleteFromListItems };
|
|
66
55
|
//# sourceMappingURL=data-mappers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-mappers.js","names":["BlazeError","getPageName","displayProperties","entity","adminHeader","name","id","fieldId","reduce","acc","headerProperty","item","push","join","createNewListItem","listingData","result","updateListItems","map","mapperResult","Object","keys","forEach","key","deleteFromListItems","filter","itemId"],"sources":["../../../../src/components/EntityManager/utils/data-mappers.js"],"sourcesContent":["import { BlazeError } from '@blaze-cms/core-errors';\n\nconst getPageName = (displayProperties = {}, entity = {}) => {\n if (!displayProperties || !displayProperties.adminHeader) {\n const { name, id: fieldId } = entity;\n return name || fieldId || '';\n }\n\n const { adminHeader } = displayProperties;\n return adminHeader\n .reduce((acc, headerProperty) => {\n const item = entity[headerProperty];\n if (item) acc.push(item);\n return acc;\n }, [])\n .join(' ');\n};\n\nconst createNewListItem = ({ listingData, result }) => [...listingData, result];\n\nconst updateListItems = ({ listingData, result, id }) => {\n if (!listingData || !result || !id)\n throw new BlazeError('Expected object with: listingData, result, id');\n return listingData.map(item => {\n const mapperResult = { ...item };\n if (item.id === id) {\n Object.keys(item).forEach(key => {\n if (result[key] && key !== 'id') {\n mapperResult[key] = result[key];\n }\n });\n return mapperResult;\n }\n return mapperResult;\n });\n};\n\nconst deleteFromListItems = ({ listingData, id }) => {\n if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');\n return listingData.filter(({ id: itemId }) => itemId !== id);\n};\n\nexport { getPageName, createNewListItem, updateListItems, deleteFromListItems };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-mappers.js","names":["BlazeError","getPageName","displayProperties","entity","adminHeader","name","id","fieldId","reduce","acc","headerProperty","item","push","join","createNewListItem","listingData","result","updateListItems","map","mapperResult","Object","keys","forEach","key","deleteFromListItems","filter","itemId"],"sources":["../../../../src/components/EntityManager/utils/data-mappers.js"],"sourcesContent":["import { BlazeError } from '@blaze-cms/core-errors';\n\nconst getPageName = (displayProperties = {}, entity = {}) => {\n if (!displayProperties || !displayProperties.adminHeader) {\n const { name, id: fieldId } = entity;\n return name || fieldId || '';\n }\n\n const { adminHeader } = displayProperties;\n return adminHeader\n .reduce((acc, headerProperty) => {\n const item = entity[headerProperty];\n if (item) acc.push(item);\n return acc;\n }, [])\n .join(' ');\n};\n\nconst createNewListItem = ({ listingData, result }) => [...listingData, result];\n\nconst updateListItems = ({ listingData, result, id }) => {\n if (!listingData || !result || !id)\n throw new BlazeError('Expected object with: listingData, result, id');\n return listingData.map(item => {\n const mapperResult = { ...item };\n if (item.id === id) {\n Object.keys(item).forEach(key => {\n if (result[key] && key !== 'id') {\n mapperResult[key] = result[key];\n }\n });\n return mapperResult;\n }\n return mapperResult;\n });\n};\n\nconst deleteFromListItems = ({ listingData, id }) => {\n if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');\n return listingData.filter(({ id: itemId }) => itemId !== id);\n};\n\nexport { getPageName, createNewListItem, updateListItems, deleteFromListItems };\n"],"mappings":";;;AAAA,SAASA,UAAU,QAAQ,wBAAwB;AAEnD,MAAMC,WAAW,GAAG,CAACC,iBAAiB,GAAG,CAAC,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,KAAK;EAC3D,IAAI,CAACD,iBAAiB,IAAI,CAACA,iBAAiB,CAACE,WAAW,EAAE;IACxD,MAAM;MAAEC,IAAI;MAAEC,EAAE,EAAEC;IAAQ,CAAC,GAAGJ,MAAM;IACpC,OAAOE,IAAI,IAAIE,OAAO,IAAI,EAAE;EAC9B;EAEA,MAAM;IAAEH;EAAY,CAAC,GAAGF,iBAAiB;EACzC,OAAOE,WAAW,CACfI,MAAM,CAAC,CAACC,GAAG,EAAEC,cAAc,KAAK;IAC/B,MAAMC,IAAI,GAAGR,MAAM,CAACO,cAAc,CAAC;IACnC,IAAIC,IAAI,EAAEF,GAAG,CAACG,IAAI,CAACD,IAAI,CAAC;IACxB,OAAOF,GAAG;EACZ,CAAC,EAAE,EAAE,CAAC,CACLI,IAAI,CAAC,GAAG,CAAC;AACd,CAAC;AAED,MAAMC,iBAAiB,GAAG,CAAC;EAAEC,WAAW;EAAEC;AAAO,CAAC,KAAK,CAAC,GAAGD,WAAW,EAAEC,MAAM,CAAC;AAE/E,MAAMC,eAAe,GAAG,CAAC;EAAEF,WAAW;EAAEC,MAAM;EAAEV;AAAG,CAAC,KAAK;EACvD,IAAI,CAACS,WAAW,IAAI,CAACC,MAAM,IAAI,CAACV,EAAE,EAChC,MAAM,IAAIN,UAAU,CAAC,+CAA+C,CAAC;EACvE,OAAOe,WAAW,CAACG,GAAG,CAACP,IAAI,IAAI;IAC7B,MAAMQ,YAAY,qBAAQR,IAAI,CAAE;IAChC,IAAIA,IAAI,CAACL,EAAE,KAAKA,EAAE,EAAE;MAClBc,MAAM,CAACC,IAAI,CAACV,IAAI,CAAC,CAACW,OAAO,CAACC,GAAG,IAAI;QAC/B,IAAIP,MAAM,CAACO,GAAG,CAAC,IAAIA,GAAG,KAAK,IAAI,EAAE;UAC/BJ,YAAY,CAACI,GAAG,CAAC,GAAGP,MAAM,CAACO,GAAG,CAAC;QACjC;MACF,CAAC,CAAC;MACF,OAAOJ,YAAY;IACrB;IACA,OAAOA,YAAY;EACrB,CAAC,CAAC;AACJ,CAAC;AAED,MAAMK,mBAAmB,GAAG,CAAC;EAAET,WAAW;EAAET;AAAG,CAAC,KAAK;EACnD,IAAI,CAACS,WAAW,IAAI,CAACT,EAAE,EAAE,MAAM,IAAIN,UAAU,CAAC,uCAAuC,CAAC;EACtF,OAAOe,WAAW,CAACU,MAAM,CAAC,CAAC;IAAEnB,EAAE,EAAEoB;EAAO,CAAC,KAAKA,MAAM,KAAKpB,EAAE,CAAC;AAC9D,CAAC;AAED,SAASL,WAAW,EAAEa,iBAAiB,EAAEG,eAAe,EAAEO,mBAAmB"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import has from 'lodash.has';
|
|
8
5
|
import { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';
|
|
9
|
-
|
|
10
6
|
function canViewPage(formData, entity, schema, entityIsPublished) {
|
|
11
7
|
return has(formData, KEY_TO_CHECK) && entity && entity.id && schema && schema.id && entityIsPublished === ENTITY_PUBLISHED;
|
|
12
8
|
}
|
|
13
|
-
|
|
14
9
|
function validateSideBarRelations(updatedFormValues, requiredChildField) {
|
|
15
10
|
if (!requiredChildField) return true;
|
|
16
11
|
const parentEntityField = updatedFormValues.find(({
|
|
@@ -23,12 +18,10 @@ function validateSideBarRelations(updatedFormValues, requiredChildField) {
|
|
|
23
18
|
const parentIdFieldHasValue = parentIdField && parentIdField.value;
|
|
24
19
|
return !!(!parentEntityFieldHasValue || parentEntityFieldHasValue && parentIdFieldHasValue);
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
async function onViewUrlClick(getFullUrl) {
|
|
28
22
|
const fullUrl = await getFullUrl();
|
|
29
23
|
if (fullUrl) window.open(fullUrl, '_blank');
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
function getUpdatedFormValues({
|
|
33
26
|
id,
|
|
34
27
|
value,
|
|
@@ -39,7 +32,6 @@ function getUpdatedFormValues({
|
|
|
39
32
|
const fieldIndex = updatedFormValues.findIndex(({
|
|
40
33
|
id: _id
|
|
41
34
|
}) => _id === id);
|
|
42
|
-
|
|
43
35
|
if (fieldIndex > -1) {
|
|
44
36
|
updatedFormValues[fieldIndex] = _objectSpread(_objectSpread({}, updatedFormValues[fieldIndex]), {}, {
|
|
45
37
|
value
|
|
@@ -50,12 +42,10 @@ function getUpdatedFormValues({
|
|
|
50
42
|
value
|
|
51
43
|
});
|
|
52
44
|
}
|
|
53
|
-
|
|
54
45
|
if (requiredChildField && requiredChildField.id) {
|
|
55
46
|
const requiredChildFieldIndex = updatedFormValues.findIndex(({
|
|
56
47
|
id: _id
|
|
57
48
|
}) => _id === requiredChildField.id);
|
|
58
|
-
|
|
59
49
|
if (requiredChildFieldIndex > -1) {
|
|
60
50
|
updatedFormValues[requiredChildFieldIndex] = _objectSpread(_objectSpread({}, updatedFormValues[requiredChildFieldIndex]), {}, {
|
|
61
51
|
value: requiredChildField.value
|
|
@@ -67,13 +57,10 @@ function getUpdatedFormValues({
|
|
|
67
57
|
});
|
|
68
58
|
}
|
|
69
59
|
}
|
|
70
|
-
|
|
71
60
|
return updatedFormValues;
|
|
72
61
|
}
|
|
73
|
-
|
|
74
62
|
function checkFulfilConditions(...args) {
|
|
75
63
|
return args.every(param => param);
|
|
76
64
|
}
|
|
77
|
-
|
|
78
65
|
export { canViewPage, validateSideBarRelations, onViewUrlClick, getUpdatedFormValues, checkFulfilConditions };
|
|
79
66
|
//# sourceMappingURL=entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","names":["has","ENTITY_PUBLISHED","KEY_TO_CHECK","SELECT_DEFAULT_VALUE","canViewPage","formData","entity","schema","entityIsPublished","id","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","push","requiredChildFieldIndex","checkFulfilConditions","args","every","param"],"sources":["../../../../src/components/EntityManager/utils/entity.js"],"sourcesContent":["import has from 'lodash.has';\nimport { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';\n\nfunction canViewPage(formData, entity, schema, entityIsPublished) {\n return (\n has(formData, KEY_TO_CHECK) &&\n entity &&\n entity.id &&\n schema &&\n schema.id &&\n entityIsPublished === ENTITY_PUBLISHED\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) window.open(fullUrl, '_blank');\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":"
|
|
1
|
+
{"version":3,"file":"entity.js","names":["has","ENTITY_PUBLISHED","KEY_TO_CHECK","SELECT_DEFAULT_VALUE","canViewPage","formData","entity","schema","entityIsPublished","id","validateSideBarRelations","updatedFormValues","requiredChildField","parentEntityField","find","parentIdField","parentEntityFieldHasValue","value","parentIdFieldHasValue","onViewUrlClick","getFullUrl","fullUrl","window","open","getUpdatedFormValues","formValues","slice","fieldIndex","findIndex","_id","push","requiredChildFieldIndex","checkFulfilConditions","args","every","param"],"sources":["../../../../src/components/EntityManager/utils/entity.js"],"sourcesContent":["import has from 'lodash.has';\nimport { ENTITY_PUBLISHED, KEY_TO_CHECK, SELECT_DEFAULT_VALUE } from '../../../constants';\n\nfunction canViewPage(formData, entity, schema, entityIsPublished) {\n return (\n has(formData, KEY_TO_CHECK) &&\n entity &&\n entity.id &&\n schema &&\n schema.id &&\n entityIsPublished === ENTITY_PUBLISHED\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) window.open(fullUrl, '_blank');\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,OAAOA,GAAG,MAAM,YAAY;AAC5B,SAASC,gBAAgB,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,oBAAoB;AAEzF,SAASC,WAAW,CAACC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,EAAEC,iBAAiB,EAAE;EAChE,OACER,GAAG,CAACK,QAAQ,EAAEH,YAAY,CAAC,IAC3BI,MAAM,IACNA,MAAM,CAACG,EAAE,IACTF,MAAM,IACNA,MAAM,CAACE,EAAE,IACTD,iBAAiB,KAAKP,gBAAgB;AAE1C;AAEA,SAASS,wBAAwB,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;EACvE,IAAI,CAACA,kBAAkB,EAAE,OAAO,IAAI;EACpC,MAAMC,iBAAiB,GAAGF,iBAAiB,CAACG,IAAI,CAAC,CAAC;IAAEL;EAAG,CAAC,KAAKA,EAAE,KAAK,cAAc,CAAC;EACnF,MAAMM,aAAa,GAAGJ,iBAAiB,CAACG,IAAI,CAAC,CAAC;IAAEL;EAAG,CAAC,KAAKA,EAAE,KAAK,UAAU,CAAC;EAE3E,MAAMO,yBAAyB,GAC7BH,iBAAiB,IACjBA,iBAAiB,CAACI,KAAK,IACvBJ,iBAAiB,CAACI,KAAK,KAAKd,oBAAoB;EAClD,MAAMe,qBAAqB,GAAGH,aAAa,IAAIA,aAA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