@blaze-cms/plugin-data-ui 0.146.0-translations.8 → 0.147.0-rc-eagle.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/EntityDataListing/EntityDataListing.js +21 -19
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +2 -3
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +18 -19
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +286 -458
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +62 -66
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +32 -56
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +20 -26
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +20 -17
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +34 -32
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +95 -158
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +23 -30
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +42 -56
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +29 -45
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +7 -8
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +36 -57
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +47 -66
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +2 -3
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +91 -166
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +2 -3
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/RecordEditContext/index.js +3 -4
- package/lib/components/EntityManager/utils/RecordEditContext/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +34 -46
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +35 -80
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +51 -110
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +6 -10
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +17 -10
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxTooltip.js +19 -16
- package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +19 -19
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +26 -38
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +21 -16
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useData.js +33 -30
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +10 -10
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/index.js +2 -3
- package/lib/components/InfoBoxes/index.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +27 -34
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js +11 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js +12 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +155 -296
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +53 -58
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +2 -3
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js +159 -257
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js +25 -36
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/helpers.js +46 -68
- package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/querys.js +5 -5
- package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +2 -3
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +2 -3
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +103 -122
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +66 -83
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +26 -42
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/hooks/useCallbackDebounce.js +5 -9
- package/lib/components/hooks/useCallbackDebounce.js.map +1 -1
- package/lib/constants.js +30 -31
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +17 -20
- package/lib/icons/ContentIcon.js.map +1 -1
- package/lib/icons/SettingsIcon.js +12 -15
- package/lib/icons/SettingsIcon.js.map +1 -1
- package/lib/icons/TaxonomyIcon.js +15 -18
- package/lib/icons/TaxonomyIcon.js.map +1 -1
- package/lib/icons/UsersIcon.js +11 -14
- package/lib/icons/UsersIcon.js.map +1 -1
- package/lib/icons/index.js +8 -9
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +81 -121
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +67 -93
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +12 -9
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +11 -8
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +17 -14
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +15 -9
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +7 -6
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +4 -6
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +4 -12
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js +2 -3
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +15 -26
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +6 -3
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/EntityManager/utils/query.js.map +1 -1
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +2 -2
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +20 -17
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +6 -7
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/index.js +11 -3
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/build-update-data-query.js.map +1 -1
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/package.json +27 -22
- package/src/components/EntityManager/Entity/Entity.js +63 -81
- package/src/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +9 -7
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +64 -59
- package/src/components/EntityManager/EntityManager.js +52 -45
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +3 -6
- package/src/components/InfoBoxes/hooks/useData.js +6 -1
- package/src/components/ListingTable/ListingTable.js +13 -21
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +38 -44
- package/src/components/ListingTable/SearchFilter/SearchContainer.js +105 -120
- package/src/components/ListingTable/service/index.js +2 -3
- package/src/components/Tabs/index.js +17 -21
- package/src/index.js +9 -7
- package/src/utils/hoc/withContext.js +5 -4
- package/CHANGELOG.md +0 -1947
- package/babel.config.js +0 -3
- package/jest.config.js +0 -5
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
require("core-js/modules/es.array.join.js");
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
7
|
+
exports.default = void 0;
|
|
11
8
|
var _client = require("@apollo/client");
|
|
12
9
|
var _coreErrors = require("@blaze-cms/core-errors");
|
|
13
10
|
var _lodash = _interopRequireDefault(require("lodash.upperfirst"));
|
|
14
11
|
var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
|
|
15
|
-
var _templateObject;
|
|
16
12
|
function buildCreateEntityMutation(entitySchema) {
|
|
17
13
|
if (!entitySchema || !entitySchema.actions || !entitySchema.actions.create || !entitySchema.properties) {
|
|
18
14
|
throw new _coreErrors.BlazeError('Create entity query requires create action and properties from entity schema');
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return (0, _client.gql)
|
|
16
|
+
const actionInput = (0, _lodash.default)(`${entitySchema.actions.create}Input`);
|
|
17
|
+
const dataProperties = (0, _adminUiUtils.getDataProperties)(entitySchema);
|
|
18
|
+
return (0, _client.gql)`mutation createEntity($input: ${actionInput}) {
|
|
19
|
+
createdEntity: ${entitySchema.actions.create}(input: $input){
|
|
20
|
+
result {
|
|
21
|
+
id,
|
|
22
|
+
${dataProperties.join(',\n')}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}`;
|
|
23
26
|
}
|
|
24
|
-
var _default = exports
|
|
27
|
+
var _default = exports.default = buildCreateEntityMutation;
|
|
25
28
|
//# sourceMappingURL=build-create-entity-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-create-entity-mutation.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","_adminUiUtils","
|
|
1
|
+
{"version":3,"file":"build-create-entity-mutation.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","_adminUiUtils","buildCreateEntityMutation","entitySchema","actions","create","properties","BlazeError","actionInput","upperfirst","dataProperties","getDataProperties","gql","join","_default","exports","default"],"sources":["../../src/utils/build-create-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildCreateEntityMutation(entitySchema) {\n if (\n !entitySchema ||\n !entitySchema.actions ||\n !entitySchema.actions.create ||\n !entitySchema.properties\n ) {\n throw new BlazeError(\n 'Create entity query requires create action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.create}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`mutation createEntity($input: ${actionInput}) {\n createdEntity: ${entitySchema.actions.create}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')}\n }\n }\n }`;\n}\n\nexport default buildCreateEntityMutation;\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,SAASK,yBAAyBA,CAACC,YAAY,EAAE;EAC/C,IACE,CAACA,YAAY,IACb,CAACA,YAAY,CAACC,OAAO,IACrB,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAC5B,CAACF,YAAY,CAACG,UAAU,EACxB;IACA,MAAM,IAAIC,sBAAU,CAClB,8EACF,CAAC;EACH;EAEA,MAAMC,WAAW,GAAG,IAAAC,eAAU,EAAC,GAAGN,YAAY,CAACC,OAAO,CAACC,MAAM,OAAO,CAAC;EACrE,MAAMK,cAAc,GAAG,IAAAC,+BAAiB,EAACR,YAAY,CAAC;EAEtD,OAAO,IAAAS,WAAG,mCAAkCJ,WAAW;AACzD,qBAAqBL,YAAY,CAACC,OAAO,CAACC,MAAM;AAChD;AACA;AACA,YAAYK,cAAc,CAACG,IAAI,CAAC,KAAK,CAAC;AACtC;AACA;AACA,IAAI;AACJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,yBAAyB","ignoreList":[]}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
7
|
+
exports.default = void 0;
|
|
10
8
|
var _client = require("@apollo/client");
|
|
11
9
|
var _coreErrors = require("@blaze-cms/core-errors");
|
|
12
10
|
var _lodash = _interopRequireDefault(require("lodash.upperfirst"));
|
|
13
|
-
var _templateObject;
|
|
14
11
|
function buildDeleteEntity(entitySchema) {
|
|
15
|
-
if (!entitySchema || !entitySchema.actions || !entitySchema.actions
|
|
12
|
+
if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {
|
|
16
13
|
throw new _coreErrors.BlazeError('Delete query requires delete action from entity schema');
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
return (0, _client.gql)
|
|
15
|
+
const actionInput = (0, _lodash.default)(`${entitySchema.actions.delete}Input`);
|
|
16
|
+
return (0, _client.gql)`
|
|
17
|
+
mutation deleteEntity($input: ${actionInput}) {
|
|
18
|
+
deleteEntity: ${entitySchema.actions.delete}(input: $input){
|
|
19
|
+
result
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
20
23
|
}
|
|
21
|
-
var _default = exports
|
|
24
|
+
var _default = exports.default = buildDeleteEntity;
|
|
22
25
|
//# sourceMappingURL=build-delete-entity-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-delete-entity-mutation.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","
|
|
1
|
+
{"version":3,"file":"build-delete-entity-mutation.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","buildDeleteEntity","entitySchema","actions","delete","BlazeError","actionInput","upperfirst","gql","_default","exports","default"],"sources":["../../src/utils/build-delete-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\n\nfunction buildDeleteEntity(entitySchema) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {\n throw new BlazeError('Delete query requires delete action from entity schema');\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.delete}Input`);\n\n return gql`\n mutation deleteEntity($input: ${actionInput}) {\n deleteEntity: ${entitySchema.actions.delete}(input: $input){\n result\n }\n }\n `;\n}\n\nexport default buildDeleteEntity;\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,SAASI,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,EAAE;IAC1E,MAAM,IAAIC,sBAAU,CAAC,wDAAwD,CAAC;EAChF;EAEA,MAAMC,WAAW,GAAG,IAAAC,eAAU,EAAC,GAAGL,YAAY,CAACC,OAAO,CAACC,MAAM,OAAO,CAAC;EAErE,OAAO,IAAAI,WAAG;AACZ,mCAAmCF,WAAW;AAC9C,oBAAoBJ,YAAY,CAACC,OAAO,CAACC,MAAM;AAC/C;AACA;AACA;AACA,GAAG;AACH;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcV,iBAAiB","ignoreList":[]}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports
|
|
9
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
-
require("core-js/modules/es.array.join.js");
|
|
6
|
+
exports.default = void 0;
|
|
11
7
|
var _client = require("@apollo/client");
|
|
12
8
|
var _coreErrors = require("@blaze-cms/core-errors");
|
|
13
9
|
var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var parsedProperties = "id, ".concat(listingProperties.join(' ') || 'id name');
|
|
10
|
+
const buildAdminSearchQuery = (entitySchema, index) => {
|
|
11
|
+
const {
|
|
12
|
+
listingProperties = []
|
|
13
|
+
} = entitySchema || {};
|
|
14
|
+
const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;
|
|
20
15
|
return (0, _adminUiUtils.getDynamicQuery)('ADMIN_SEARCH')([entitySchema], parsedProperties, true, index);
|
|
21
16
|
};
|
|
22
17
|
function buildListingQuery(entitySchema, index, isSearchQuery) {
|
|
@@ -24,8 +19,16 @@ function buildListingQuery(entitySchema, index, isSearchQuery) {
|
|
|
24
19
|
throw new _coreErrors.BlazeError('Listing query requires getAll action and listingProperties from entity schema');
|
|
25
20
|
}
|
|
26
21
|
if (isSearchQuery) return buildAdminSearchQuery(entitySchema, index);
|
|
27
|
-
|
|
28
|
-
return (0, _client.gql)
|
|
22
|
+
const sortType = entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
|
|
23
|
+
return (0, _client.gql)`
|
|
24
|
+
query ${entitySchema.actions.getAll}($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {
|
|
25
|
+
listingData: ${entitySchema.actions.getAll}(where: $where, limit: $limit, offset:$offset, sort:$sort){
|
|
26
|
+
id,
|
|
27
|
+
${entitySchema.listingProperties.join(',\n')}
|
|
28
|
+
}
|
|
29
|
+
totalRecords: ${entitySchema.actions.countAll}(where: $where)
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
29
32
|
}
|
|
30
|
-
var _default = exports
|
|
33
|
+
var _default = exports.default = buildListingQuery;
|
|
31
34
|
//# sourceMappingURL=build-listing-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-listing-query.js","names":["_client","require","_coreErrors","_adminUiUtils","
|
|
1
|
+
{"version":3,"file":"build-listing-query.js","names":["_client","require","_coreErrors","_adminUiUtils","buildAdminSearchQuery","entitySchema","index","listingProperties","parsedProperties","join","getDynamicQuery","buildListingQuery","isSearchQuery","actions","getAll","BlazeError","sortType","toUpperCase","substr","gql","countAll","_default","exports","default"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport { getDynamicQuery } from '@blaze-cms/admin-ui-utils';\n\nconst buildAdminSearchQuery = (entitySchema, index) => {\n const { listingProperties = [] } = entitySchema || {};\n const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;\n\n return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true, index);\n};\n\nfunction buildListingQuery(entitySchema, index, isSearchQuery) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n if (isSearchQuery) return buildAdminSearchQuery(entitySchema, index);\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${\n entitySchema.actions.getAll\n }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${\n entitySchema.actions.getAll\n }(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n totalRecords: ${entitySchema.actions.countAll}(where: $where)\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEA,MAAMG,qBAAqB,GAAGA,CAACC,YAAY,EAAEC,KAAK,KAAK;EACrD,MAAM;IAAEC,iBAAiB,GAAG;EAAG,CAAC,GAAGF,YAAY,IAAI,CAAC,CAAC;EACrD,MAAMG,gBAAgB,GAAG,OAAOD,iBAAiB,CAACE,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,EAAE;EAE1E,OAAO,IAAAC,6BAAe,EAAC,cAAc,CAAC,CAAC,CAACL,YAAY,CAAC,EAAEG,gBAAgB,EAAE,IAAI,EAAEF,KAAK,CAAC;AACvF,CAAC;AAED,SAASK,iBAAiBA,CAACN,YAAY,EAAEC,KAAK,EAAEM,aAAa,EAAE;EAC7D,IAAI,CAACP,YAAY,CAACQ,OAAO,IAAI,CAACR,YAAY,CAACQ,OAAO,CAACC,MAAM,IAAI,CAACT,YAAY,CAACE,iBAAiB,EAAE;IAC5F,MAAM,IAAIQ,sBAAU,CAClB,+EACF,CAAC;EACH;EAEA,IAAIH,aAAa,EAAE,OAAOR,qBAAqB,CAACC,YAAY,EAAEC,KAAK,CAAC;EAEpE,MAAMU,QAAQ,GACZX,YAAY,CAACQ,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACG,WAAW,CAAC,CAAC,GAAGZ,YAAY,CAACQ,OAAO,CAACC,MAAM,CAACI,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAO,IAAAC,WAAG;AACZ,YACMd,YAAY,CAACQ,OAAO,CAACC,MAAM,oDACuBE,QAAQ;AAChE,qBACQX,YAAY,CAACQ,OAAO,CAACC,MAAM;AACnC;AACA,UACUT,YAAY,CAACE,iBAAiB,CAACE,IAAI,CAAC,KAAK,CAAC;AACpD;AACA,sBAAsBJ,YAAY,CAACQ,OAAO,CAACO,QAAQ;AACnD;AACA,GAAG;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcZ,iBAAiB","ignoreList":[]}
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
require("core-js/modules/es.array.join.js");
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
7
|
+
exports.default = void 0;
|
|
11
8
|
var _client = require("@apollo/client");
|
|
12
9
|
var _coreErrors = require("@blaze-cms/core-errors");
|
|
13
10
|
var _lodash = _interopRequireDefault(require("lodash.upperfirst"));
|
|
14
11
|
var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
|
|
15
|
-
var _templateObject;
|
|
16
12
|
function buildUpdateDataQuery(entitySchema) {
|
|
17
13
|
if (!entitySchema.actions || !entitySchema.actions.update || !entitySchema.properties) {
|
|
18
14
|
throw new _coreErrors.BlazeError('Update DataEntity query requires get action and properties from entity schema');
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return (0, _client.gql)
|
|
16
|
+
const actionInput = (0, _lodash.default)(`${entitySchema.actions.update}Input`);
|
|
17
|
+
const dataProperties = (0, _adminUiUtils.getDataProperties)(entitySchema);
|
|
18
|
+
return (0, _client.gql)`
|
|
19
|
+
mutation updateEntity($input: ${actionInput}) {
|
|
20
|
+
updateEntity: ${entitySchema.actions.update}(input: $input){
|
|
21
|
+
result {
|
|
22
|
+
id,
|
|
23
|
+
${dataProperties.join(',\n')},
|
|
24
|
+
updated
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
23
29
|
}
|
|
24
|
-
var _default = exports
|
|
30
|
+
var _default = exports.default = buildUpdateDataQuery;
|
|
25
31
|
//# sourceMappingURL=build-update-data-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-update-data-query.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","_adminUiUtils","
|
|
1
|
+
{"version":3,"file":"build-update-data-query.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","_adminUiUtils","buildUpdateDataQuery","entitySchema","actions","update","properties","BlazeError","actionInput","upperfirst","dataProperties","getDataProperties","gql","join","_default","exports","default"],"sources":["../../src/utils/build-update-data-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildUpdateDataQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.update || !entitySchema.properties) {\n throw new BlazeError(\n 'Update DataEntity query requires get action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.update}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`\n mutation updateEntity($input: ${actionInput}) {\n updateEntity: ${entitySchema.actions.update}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')},\n updated\n }\n }\n }\n `;\n}\n\nexport default buildUpdateDataQuery;\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,SAASK,oBAAoBA,CAACC,YAAY,EAAE;EAC1C,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,UAAU,EAAE;IACrF,MAAM,IAAIC,sBAAU,CAClB,+EACF,CAAC;EACH;EAEA,MAAMC,WAAW,GAAG,IAAAC,eAAU,EAAC,GAAGN,YAAY,CAACC,OAAO,CAACC,MAAM,OAAO,CAAC;EACrE,MAAMK,cAAc,GAAG,IAAAC,+BAAiB,EAACR,YAAY,CAAC;EAEtD,OAAO,IAAAS,WAAG;AACZ,mCAAmCJ,WAAW;AAC9C,oBAAoBL,YAAY,CAACC,OAAO,CAACC,MAAM;AAC/C;AACA;AACA,YAAYK,cAAc,CAACG,IAAI,CAAC,KAAK,CAAC;AACtC;AACA;AACA;AACA;AACA,GAAG;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,oBAAoB","ignoreList":[]}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports
|
|
9
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
6
|
+
exports.default = void 0;
|
|
10
7
|
var _client = require("@apollo/client");
|
|
11
8
|
var _coreErrors = require("@blaze-cms/core-errors");
|
|
12
|
-
var _templateObject;
|
|
13
9
|
function buildUpdatePublishUnpublishMutation(entitySchema, id, action, cache) {
|
|
14
10
|
if (!entitySchema || !entitySchema.actions || !entitySchema.actions.publish || !id || !action) {
|
|
15
11
|
throw new _coreErrors.BlazeError('Update DataEntity query requires publish action from entity schema and id');
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
return (0, _client.gql)
|
|
13
|
+
const withClient = `${cache ? '@client' : ''}`;
|
|
14
|
+
return (0, _client.gql)`
|
|
15
|
+
mutation {
|
|
16
|
+
response: ${entitySchema.actions[action]} ${withClient}(input: {
|
|
17
|
+
id: "${id}"
|
|
18
|
+
}){
|
|
19
|
+
result {
|
|
20
|
+
id,
|
|
21
|
+
status
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
19
26
|
}
|
|
20
|
-
var _default = exports
|
|
27
|
+
var _default = exports.default = buildUpdatePublishUnpublishMutation;
|
|
21
28
|
//# sourceMappingURL=build-update-publish-unpublish-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-update-publish-unpublish-mutation.js","names":["_client","require","_coreErrors","
|
|
1
|
+
{"version":3,"file":"build-update-publish-unpublish-mutation.js","names":["_client","require","_coreErrors","buildUpdatePublishUnpublishMutation","entitySchema","id","action","cache","actions","publish","BlazeError","withClient","gql","_default","exports","default"],"sources":["../../src/utils/build-update-publish-unpublish-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildUpdatePublishUnpublishMutation(entitySchema, id, action, cache) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.publish || !id || !action) {\n throw new BlazeError(\n 'Update DataEntity query requires publish action from entity schema and id'\n );\n }\n\n const withClient = `${cache ? '@client' : ''}`;\n\n return gql`\n mutation {\n response: ${entitySchema.actions[action]} ${withClient}(input: {\n id: \"${id}\"\n }){\n result {\n id,\n status\n }\n }\n }\n `;\n}\n\nexport default buildUpdatePublishUnpublishMutation;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,SAASE,mCAAmCA,CAACC,YAAY,EAAEC,EAAE,EAAEC,MAAM,EAAEC,KAAK,EAAE;EAC5E,IAAI,CAACH,YAAY,IAAI,CAACA,YAAY,CAACI,OAAO,IAAI,CAACJ,YAAY,CAACI,OAAO,CAACC,OAAO,IAAI,CAACJ,EAAE,IAAI,CAACC,MAAM,EAAE;IAC7F,MAAM,IAAII,sBAAU,CAClB,2EACF,CAAC;EACH;EAEA,MAAMC,UAAU,GAAG,GAAGJ,KAAK,GAAG,SAAS,GAAG,EAAE,EAAE;EAE9C,OAAO,IAAAK,WAAG;AACZ;AACA,kBAAkBR,YAAY,CAACI,OAAO,CAACF,MAAM,CAAC,IAAIK,UAAU;AAC5D,eAAeN,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcZ,mCAAmC","ignoreList":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.getDefaultQueryParams = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
where
|
|
7
|
+
const getDefaultQueryParams = schema => {
|
|
8
|
+
const updated = schema.properties && schema.properties.updated;
|
|
9
|
+
const {
|
|
10
|
+
adminDefaultListingFilter: where
|
|
11
|
+
} = schema.displayProperties || {};
|
|
12
12
|
return {
|
|
13
|
-
where
|
|
13
|
+
where,
|
|
14
14
|
limit: 10,
|
|
15
15
|
offset: 0,
|
|
16
16
|
sort: updated ? [{
|
|
@@ -19,4 +19,5 @@ var getDefaultQueryParams = exports.getDefaultQueryParams = function getDefaultQ
|
|
|
19
19
|
}] : []
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
+
exports.getDefaultQueryParams = getDefaultQueryParams;
|
|
22
23
|
//# sourceMappingURL=get-default-query-params.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","
|
|
1
|
+
{"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","adminDefaultListingFilter","where","displayProperties","limit","offset","sort","property","direction","exports"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = schema => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where } = schema.displayProperties || {};\n\n return {\n where,\n limit: 10,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":";;;;;;AAAA,MAAMA,qBAAqB,GAAGC,MAAM,IAAI;EACtC,MAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAC9D,MAAM;IAAEE,yBAAyB,EAAEC;EAAM,CAAC,GAAGJ,MAAM,CAACK,iBAAiB,IAAI,CAAC,CAAC;EAE3E,OAAO;IACLD,KAAK;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEP,OAAO,GACT,CACE;MACEQ,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAACC,OAAA,CAAAZ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
@@ -9,10 +8,9 @@ exports.withContext = void 0;
|
|
|
9
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var _react = _interopRequireDefault(require("react"));
|
|
11
10
|
var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, props, contexts));
|
|
16
|
-
};
|
|
11
|
+
const withContext = Component => function (props) {
|
|
12
|
+
const contexts = (0, _adminUiUtils.useMainContext)(_adminUiUtils.MainContext);
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, props, contexts));
|
|
17
14
|
};
|
|
15
|
+
exports.withContext = withContext;
|
|
18
16
|
//# sourceMappingURL=withContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withContext.js","names":["_react","_interopRequireDefault","require","_adminUiUtils","withContext","
|
|
1
|
+
{"version":3,"file":"withContext.js","names":["_react","_interopRequireDefault","require","_adminUiUtils","withContext","Component","props","contexts","useMainContext","MainContext","default","createElement","_extends2","exports"],"sources":["../../../src/utils/hoc/withContext.js"],"sourcesContent":["import React from 'react';\nimport { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';\n\nexport const withContext = Component =>\n function (props) {\n const contexts = useMainContext(MainContext);\n return <Component {...props} {...contexts} />;\n };\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEO,MAAME,WAAW,GAAGC,SAAS,IAClC,UAAUC,KAAK,EAAE;EACf,MAAMC,QAAQ,GAAG,IAAAC,4BAAc,EAACC,yBAAW,CAAC;EAC5C,oBAAOT,MAAA,CAAAU,OAAA,CAAAC,aAAA,CAACN,SAAS,MAAAO,SAAA,CAAAF,OAAA,MAAKJ,KAAK,EAAMC,QAAQ,CAAG,CAAC;AAC/C,CAAC;AAACM,OAAA,CAAAT,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
6
|
+
exports.default = void 0;
|
|
10
7
|
var _react = require("react");
|
|
11
8
|
function useToggle(initialValue) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
toggleValue = _useState2[0],
|
|
15
|
-
setToggleValue = _useState2[1];
|
|
16
|
-
var toggler = (0, _react.useCallback)(function () {
|
|
17
|
-
return setToggleValue(!toggleValue);
|
|
18
|
-
}, [toggleValue]);
|
|
9
|
+
const [toggleValue, setToggleValue] = (0, _react.useState)(initialValue);
|
|
10
|
+
const toggler = (0, _react.useCallback)(() => setToggleValue(!toggleValue), [toggleValue]);
|
|
19
11
|
return [toggleValue, toggler];
|
|
20
12
|
}
|
|
21
|
-
var _default = exports
|
|
13
|
+
var _default = exports.default = useToggle;
|
|
22
14
|
//# sourceMappingURL=useToggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggle.js","names":["_react","require","useToggle","initialValue","
|
|
1
|
+
{"version":3,"file":"useToggle.js","names":["_react","require","useToggle","initialValue","toggleValue","setToggleValue","useState","toggler","useCallback","_default","exports","default"],"sources":["../../../src/utils/hooks/useToggle.js"],"sourcesContent":["import { useState, useCallback } from 'react';\n\nfunction useToggle(initialValue) {\n const [toggleValue, setToggleValue] = useState(initialValue);\n const toggler = useCallback(() => setToggleValue(!toggleValue), [toggleValue]);\n\n return [toggleValue, toggler];\n}\n\nexport default useToggle;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,SAASC,SAASA,CAACC,YAAY,EAAE;EAC/B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAC,eAAQ,EAACH,YAAY,CAAC;EAC5D,MAAMI,OAAO,GAAG,IAAAC,kBAAW,EAAC,MAAMH,cAAc,CAAC,CAACD,WAAW,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAE9E,OAAO,CAACA,WAAW,EAAEG,OAAO,CAAC;AAC/B;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcT,SAAS","ignoreList":[]}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
Object.defineProperty(exports, "buildUpdatePublishUnpublishMutation", {
|
|
9
8
|
enumerable: true,
|
|
10
|
-
get: function
|
|
11
|
-
return _buildUpdatePublishUnpublishMutation
|
|
9
|
+
get: function () {
|
|
10
|
+
return _buildUpdatePublishUnpublishMutation.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
var _buildUpdatePublishUnpublishMutation = _interopRequireDefault(require("./build-update-publish-unpublish-mutation"));
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_buildUpdatePublishUnpublishMutation","_interopRequireDefault","require"],"sources":["../../src/utils/index.js"],"sourcesContent":["import buildUpdatePublishUnpublishMutation from './build-update-publish-unpublish-mutation';\n\nexport { buildUpdatePublishUnpublishMutation };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_buildUpdatePublishUnpublishMutation","_interopRequireDefault","require"],"sources":["../../src/utils/index.js"],"sourcesContent":["import buildUpdatePublishUnpublishMutation from './build-update-publish-unpublish-mutation';\n\nexport { buildUpdatePublishUnpublishMutation };\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,oCAAA,GAAAC,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -9,16 +9,14 @@ import { withRouter, Prompt } from 'react-router-dom';
|
|
|
9
9
|
import { useApolloClient } from '@apollo/client';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
12
|
-
import { getQuery
|
|
12
|
+
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
13
13
|
import { FormBuilder, parseFormValues } from '@blaze-cms/react-form-builder';
|
|
14
14
|
import { DeleteAction, CopyDataFromAction } from '@blaze-cms/admin';
|
|
15
15
|
import { useToasts } from '@blaze-react/toaster';
|
|
16
16
|
import cloneDeep from 'lodash.clonedeep';
|
|
17
17
|
import { getPageName } from '../utils/data-mappers';
|
|
18
|
-
import isFormEmpty from '../utils/is-form-empty';
|
|
19
18
|
import availableActions from './actions-handlers';
|
|
20
19
|
import SideBarRelations from './SideBarRelations';
|
|
21
|
-
import Tabs from '../../Tabs';
|
|
22
20
|
import useCallbackDebounce from '../../hooks/useCallbackDebounce';
|
|
23
21
|
import { ENTITY_PUBLISHED, TEXT_CONTENT_TYPE, LEAVE_PAGE_MESSAGE, PREVIEW_INTERFACE, PAGE_BUILDER_FIELD_ID, PAGE_BUILDER_TEMPLATE_FIELD_ID, ERROR, SAVE_BUTTON_TEXTS, UNPUBLISHED_WARNING } from '../../../constants';
|
|
24
22
|
import EntityHeader from './EntityHeader';
|
|
@@ -37,8 +35,7 @@ const Entity = ({
|
|
|
37
35
|
onViewUrl,
|
|
38
36
|
refetchRecord
|
|
39
37
|
}) => {
|
|
40
|
-
var
|
|
41
|
-
const [, setCurrentTabId] = useState(null);
|
|
38
|
+
var _formData$values;
|
|
42
39
|
const [formValues, setFormValues] = useState(null);
|
|
43
40
|
const [entitySchema, setEntitySchema] = useState(null);
|
|
44
41
|
const [entityData, setEntityData] = useState(null);
|
|
@@ -57,6 +54,7 @@ const Entity = ({
|
|
|
57
54
|
const [newUpdatedDate, setNewUpdatedDate] = useState(null);
|
|
58
55
|
const [saveButtonText, setSaveButtonText] = useState(SAVE_BUTTON_TEXTS.save);
|
|
59
56
|
const [externalUpdateTime, setExternalUpdateTime] = useState(null);
|
|
57
|
+
const [suppressPrompt, setSuppressPrompt] = useState(false);
|
|
60
58
|
const [isRightSidebarOpen, setIsRightSidebarOpen] = useState(true);
|
|
61
59
|
const handleToggleRightSidebar = () => setIsRightSidebarOpen(!isRightSidebarOpen);
|
|
62
60
|
const isCreatePage = history.location.pathname.includes('create');
|
|
@@ -107,7 +105,8 @@ const Entity = ({
|
|
|
107
105
|
client.writeQuery({
|
|
108
106
|
query: getQuery('GET_CURRENT_ENTITY'),
|
|
109
107
|
data: {
|
|
110
|
-
currentEntity: schema.id
|
|
108
|
+
currentEntity: schema.id,
|
|
109
|
+
currentItemId: entity ? entity.id : null
|
|
111
110
|
}
|
|
112
111
|
});
|
|
113
112
|
}
|
|
@@ -217,12 +216,11 @@ const Entity = ({
|
|
|
217
216
|
id
|
|
218
217
|
}) => id === 'name');
|
|
219
218
|
updatedEntity && setPageTitle(updatedEntity.value);
|
|
220
|
-
const isValidAndNewValueSet = isValid && isNewValueSet;
|
|
221
219
|
const isNotValidOrNotNewValueSet = !isValid || !isNewValueSet;
|
|
222
220
|
if (componentIsMounted.current) {
|
|
223
221
|
setIsFormValid(isValid);
|
|
224
222
|
}
|
|
225
|
-
if (
|
|
223
|
+
if (isValid && isNewValueSet && componentIsMounted.current) {
|
|
226
224
|
setIsSaveButtonAvailable(true);
|
|
227
225
|
setSaveButtonText(SAVE_BUTTON_TEXTS.save);
|
|
228
226
|
}
|
|
@@ -236,6 +234,9 @@ const Entity = ({
|
|
|
236
234
|
const onSubmit = event => {
|
|
237
235
|
event && event.preventDefault();
|
|
238
236
|
if (!isSaveButtonAvailable) return null;
|
|
237
|
+
if (isCreatePage) {
|
|
238
|
+
setSuppressPrompt(true);
|
|
239
|
+
}
|
|
239
240
|
const parsedFormValues = parseFormValues(formValues);
|
|
240
241
|
const updatedFormValues = newUpdatedDate ? _objectSpread(_objectSpread({}, formData.values), {}, {
|
|
241
242
|
update: newUpdatedDate
|
|
@@ -349,10 +350,8 @@ const Entity = ({
|
|
|
349
350
|
const showModal = checkFulfilConditions(formData, modalStatus);
|
|
350
351
|
const onViewUrlHandler = canViewPage(formData, entity, schema, entityIsPublished) ? () => onViewUrlClick(getFullUrl) : onViewUrl;
|
|
351
352
|
const pageName = formData && formData.values && formData.values.name;
|
|
352
|
-
const
|
|
353
|
-
const hasToDisplayPrompt = isSaveButtonAvailable || hasNewFormValues;
|
|
353
|
+
const hasToDisplayPrompt = isSaveButtonAvailable && !suppressPrompt;
|
|
354
354
|
const showSideBarRelations = checkFulfilConditions(schema, formData);
|
|
355
|
-
const showPageBuilderTabs = (schema === null || schema === void 0 ? void 0 : (_schema$interfaces = schema.interfaces) === null || _schema$interfaces === void 0 ? void 0 : _schema$interfaces.includes('page-builder/page-builder-template')) || (schema === null || schema === void 0 ? void 0 : (_schema$interfaces2 = schema.interfaces) === null || _schema$interfaces2 === void 0 ? void 0 : _schema$interfaces2.includes('page-builder/page-builder'));
|
|
356
355
|
return /*#__PURE__*/React.createElement(RecordEditContextProvider, {
|
|
357
356
|
value: {
|
|
358
357
|
externalUpdateTime,
|
|
@@ -393,7 +392,7 @@ const Entity = ({
|
|
|
393
392
|
copyAction: onCopy,
|
|
394
393
|
getFormData: getFormData
|
|
395
394
|
}), /*#__PURE__*/React.createElement("div", {
|
|
396
|
-
className: `page__content
|
|
395
|
+
className: `page__content${!isRightSidebarOpen ? ' right-sidebar-collapsed' : ''}`
|
|
397
396
|
}, /*#__PURE__*/React.createElement("div", {
|
|
398
397
|
className: "page__content"
|
|
399
398
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -405,18 +404,7 @@ const Entity = ({
|
|
|
405
404
|
}), /*#__PURE__*/React.createElement(InfoBoxes, {
|
|
406
405
|
id: entity.id,
|
|
407
406
|
schema: schema
|
|
408
|
-
}), /*#__PURE__*/React.createElement(
|
|
409
|
-
enabled: showPageBuilderTabs,
|
|
410
|
-
onTabChange: tabId => {
|
|
411
|
-
client.writeQuery({
|
|
412
|
-
query: GET_CURRENT_TAB_ID,
|
|
413
|
-
data: {
|
|
414
|
-
currentTabId: tabId
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
setCurrentTabId(tabId);
|
|
418
|
-
}
|
|
419
|
-
}, /*#__PURE__*/React.createElement(FormBuilder, {
|
|
407
|
+
}), /*#__PURE__*/React.createElement(FormBuilder, {
|
|
420
408
|
getIsFormValid: setIsFormValid,
|
|
421
409
|
getFormValues: getFormValues,
|
|
422
410
|
schema: schema,
|
|
@@ -426,8 +414,9 @@ const Entity = ({
|
|
|
426
414
|
updateCopyData: updateCopyData,
|
|
427
415
|
formValues: formValues,
|
|
428
416
|
isNewEntity: isNewEntity,
|
|
429
|
-
onExternalUpdate: setExternalUpdateTime
|
|
430
|
-
|
|
417
|
+
onExternalUpdate: setExternalUpdateTime,
|
|
418
|
+
mode: isNewEntity ? 'create' : 'update'
|
|
419
|
+
}), /*#__PURE__*/React.createElement(RenderHook, {
|
|
431
420
|
hookKey: `entity:${action}:main:bottom`,
|
|
432
421
|
entity: entity,
|
|
433
422
|
schema: schema
|