@blaze-cms/plugin-data-ui 0.146.0-translations.6 → 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/README.md +57 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +21 -19
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +2 -3
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +18 -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 +289 -452
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +62 -66
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +34 -50
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +20 -26
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +20 -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 +104 -150
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +24 -24
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +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 -73
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +51 -110
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +6 -10
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +17 -10
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxTooltip.js +43 -0
- package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib/components/InfoBoxes/InfoBoxes.js +19 -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 +28 -32
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js +11 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js +12 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +163 -303
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +61 -40
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +2 -3
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js +215 -0
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js +48 -0
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/helpers.js +105 -0
- package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/querys.js +13 -0
- package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -0
- package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +2 -3
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +2 -3
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +104 -120
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +66 -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 +31 -29
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +17 -20
- package/lib/icons/ContentIcon.js.map +1 -1
- package/lib/icons/SettingsIcon.js +12 -15
- package/lib/icons/SettingsIcon.js.map +1 -1
- package/lib/icons/TaxonomyIcon.js +15 -18
- package/lib/icons/TaxonomyIcon.js.map +1 -1
- package/lib/icons/UsersIcon.js +11 -14
- package/lib/icons/UsersIcon.js.map +1 -1
- package/lib/icons/index.js +8 -9
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +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 +20 -17
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +15 -9
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +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/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib-es/components/EntityDataListing/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +21 -28
- 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 +6 -1
- 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/container/CustomSidebarInfoContainer.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +26 -7
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +8 -2
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.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/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.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.map +1 -1
- package/lib-es/components/EntityManager/Entity/index.js.map +1 -1
- 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/RecordEditContext/index.js.map +1 -1
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js +6 -2
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib-es/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib-es/components/EntityManager/utils/query.js.map +1 -1
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.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 +2 -0
- 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/hooks/useInfoBox.js.map +1 -1
- package/lib-es/components/InfoBoxes/index.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +4 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +12 -11
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +34 -16
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +207 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +40 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js +96 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js +8 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -0
- package/lib-es/components/ListingTable/TableActions/TableActions.js.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 +3 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js +3 -2
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +6 -7
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/components/hooks/useCallbackDebounce.js.map +1 -1
- package/lib-es/constants.js +4 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/icons/ContentIcon.js.map +1 -1
- package/lib-es/icons/SettingsIcon.js.map +1 -1
- package/lib-es/icons/TaxonomyIcon.js.map +1 -1
- package/lib-es/icons/UsersIcon.js.map +1 -1
- package/lib-es/icons/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 +4 -4
- 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/get-default-query-params.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/lib-es/utils/hooks/useToggle.js.map +1 -1
- package/lib-es/utils/index.js.map +1 -1
- package/package.json +28 -22
- package/src/components/EntityManager/Entity/Entity.js +72 -80
- package/src/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
- package/src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +8 -1
- package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +9 -7
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +82 -59
- package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +5 -3
- package/src/components/EntityManager/EntityManager.js +52 -45
- package/src/components/EntityManager/utils/entity.js +13 -2
- package/src/components/InfoBoxes/InfoBoxTooltip.js +32 -0
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +3 -6
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
- package/src/components/InfoBoxes/hooks/useData.js +6 -1
- package/src/components/InfoBoxes/presentational/InfoBox.js +4 -2
- package/src/components/ListingTable/ListingTable.js +23 -31
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +43 -27
- package/src/components/ListingTable/SearchFilter/SearchContainer.js +228 -0
- package/src/components/ListingTable/SearchFilter/SearchFilter.js +38 -0
- package/src/components/ListingTable/SearchFilter/helpers.js +99 -0
- package/src/components/ListingTable/SearchFilter/querys.js +9 -0
- package/src/components/ListingTable/mappers/populate-rows.js +3 -0
- package/src/components/ListingTable/service/index.js +3 -4
- package/src/components/Tabs/index.js +17 -21
- package/src/constants.js +9 -1
- package/src/index.js +9 -7
- package/src/utils/build-listing-query.js +4 -4
- package/src/utils/hoc/withContext.js +5 -4
- package/CHANGELOG.md +0 -1939
- package/babel.config.js +0 -3
- package/jest.config.js +0 -5
|
@@ -1,38 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.keys.js");
|
|
4
|
-
require("core-js/modules/es.symbol.js");
|
|
5
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
7
|
-
require("core-js/modules/es.object.define-properties.js");
|
|
8
|
-
require("core-js/modules/es.object.define-property.js");
|
|
9
|
-
require("core-js/modules/es.string.iterator.js");
|
|
10
|
-
require("core-js/modules/es.weak-map.js");
|
|
11
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
12
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
13
4
|
Object.defineProperty(exports, "__esModule", {
|
|
14
5
|
value: true
|
|
15
6
|
});
|
|
16
|
-
exports
|
|
17
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
7
|
+
exports.default = void 0;
|
|
18
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
20
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
21
|
-
require("core-js/modules/es.array.iterator.js");
|
|
22
|
-
require("core-js/modules/es.object.to-string.js");
|
|
23
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
24
|
-
require("core-js/modules/es.array.includes.js");
|
|
25
|
-
require("core-js/modules/es.string.includes.js");
|
|
26
|
-
require("core-js/modules/es.array.slice.js");
|
|
27
|
-
require("core-js/modules/es.array.filter.js");
|
|
28
|
-
require("core-js/modules/es.array.map.js");
|
|
29
|
-
require("core-js/modules/es.array.for-each.js");
|
|
30
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
31
|
-
require("core-js/modules/es.array.concat.js");
|
|
32
|
-
require("core-js/modules/es.array.find-index.js");
|
|
33
|
-
require("core-js/modules/es.function.name.js");
|
|
34
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
35
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
36
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
37
11
|
var _reactRouterDom = require("react-router-dom");
|
|
38
12
|
var _client = require("@apollo/client");
|
|
@@ -44,134 +18,77 @@ var _admin = require("@blaze-cms/admin");
|
|
|
44
18
|
var _toaster = require("@blaze-react/toaster");
|
|
45
19
|
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
|
46
20
|
var _dataMappers = require("../utils/data-mappers");
|
|
47
|
-
var _isFormEmpty = _interopRequireDefault(require("../utils/is-form-empty"));
|
|
48
21
|
var _actionsHandlers = _interopRequireDefault(require("./actions-handlers"));
|
|
49
22
|
var _SideBarRelations = _interopRequireDefault(require("./SideBarRelations"));
|
|
50
|
-
var _Tabs = _interopRequireDefault(require("../../Tabs"));
|
|
51
23
|
var _useCallbackDebounce = _interopRequireDefault(require("../../hooks/useCallbackDebounce"));
|
|
52
24
|
var _constants = require("../../../constants");
|
|
53
25
|
var _EntityHeader = _interopRequireDefault(require("./EntityHeader"));
|
|
54
26
|
var _entity = require("../utils/entity");
|
|
55
|
-
var
|
|
27
|
+
var _useToggle = _interopRequireDefault(require("../../../utils/hooks/useToggle"));
|
|
56
28
|
var _InfoBoxes = _interopRequireDefault(require("../../InfoBoxes/InfoBoxes"));
|
|
57
29
|
var _RecordEditContext = require("../utils/RecordEditContext");
|
|
58
|
-
|
|
30
|
+
const _excluded = ["isValid", "fields", "isNewValueSet", "valuesChecked", "currentField", "value"];
|
|
59
31
|
/* eslint-disable no-undef */
|
|
60
|
-
function
|
|
61
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
32
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
62
33
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
63
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
setEntityIsPublish = _useState16[1];
|
|
106
|
-
var _useState17 = (0, _react.useState)(false),
|
|
107
|
-
_useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
|
|
108
|
-
isEnablePublishButton = _useState18[0],
|
|
109
|
-
setEnablePublishButton = _useState18[1];
|
|
110
|
-
var _useState19 = (0, _react.useState)(false),
|
|
111
|
-
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
|
112
|
-
isEnablePreviewButton = _useState20[0],
|
|
113
|
-
setEnablePreviewButton = _useState20[1];
|
|
114
|
-
var _useToggle = (0, _useToggle5["default"])(false),
|
|
115
|
-
_useToggle2 = (0, _slicedToArray2["default"])(_useToggle, 2),
|
|
116
|
-
modalStatus = _useToggle2[0],
|
|
117
|
-
setModalStatus = _useToggle2[1];
|
|
118
|
-
var _useToggle3 = (0, _useToggle5["default"])(false),
|
|
119
|
-
_useToggle4 = (0, _slicedToArray2["default"])(_useToggle3, 2),
|
|
120
|
-
copyModalStatus = _useToggle4[0],
|
|
121
|
-
setCopyModalStatus = _useToggle4[1];
|
|
122
|
-
var _useState21 = (0, _react.useState)(true),
|
|
123
|
-
_useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
|
|
124
|
-
pageBuilderTemplateStatus = _useState22[0],
|
|
125
|
-
setPageBuilderTemplateStatus = _useState22[1];
|
|
126
|
-
var _useState23 = (0, _react.useState)(false),
|
|
127
|
-
_useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
|
|
128
|
-
shouldCopyData = _useState24[0],
|
|
129
|
-
setShouldCopyData = _useState24[1];
|
|
130
|
-
var _useState25 = (0, _react.useState)(false),
|
|
131
|
-
_useState26 = (0, _slicedToArray2["default"])(_useState25, 2),
|
|
132
|
-
isFormValid = _useState26[0],
|
|
133
|
-
setIsFormValid = _useState26[1];
|
|
134
|
-
var _useState27 = (0, _react.useState)(null),
|
|
135
|
-
_useState28 = (0, _slicedToArray2["default"])(_useState27, 2),
|
|
136
|
-
formDataFromCopy = _useState28[0],
|
|
137
|
-
setFormDataFromCopy = _useState28[1];
|
|
138
|
-
var _useState29 = (0, _react.useState)(null),
|
|
139
|
-
_useState30 = (0, _slicedToArray2["default"])(_useState29, 2),
|
|
140
|
-
newUpdatedDate = _useState30[0],
|
|
141
|
-
setNewUpdatedDate = _useState30[1];
|
|
142
|
-
var _useState31 = (0, _react.useState)(_constants.SAVE_BUTTON_TEXTS.save),
|
|
143
|
-
_useState32 = (0, _slicedToArray2["default"])(_useState31, 2),
|
|
144
|
-
saveButtonText = _useState32[0],
|
|
145
|
-
setSaveButtonText = _useState32[1];
|
|
146
|
-
var _useState33 = (0, _react.useState)(null),
|
|
147
|
-
_useState34 = (0, _slicedToArray2["default"])(_useState33, 2),
|
|
148
|
-
externalUpdateTime = _useState34[0],
|
|
149
|
-
setExternalUpdateTime = _useState34[1];
|
|
150
|
-
var isCreatePage = history.location.pathname.includes('create');
|
|
151
|
-
var _useState35 = (0, _react.useState)(isCreatePage),
|
|
152
|
-
_useState36 = (0, _slicedToArray2["default"])(_useState35, 2),
|
|
153
|
-
isNewEntity = _useState36[0],
|
|
154
|
-
setIsNewEntity = _useState36[1];
|
|
155
|
-
var client = (0, _client.useApolloClient)();
|
|
156
|
-
var shouldUpdateState = !entityIdentifier || (0, _entity.checkFulfilConditions)(entity, schema, previousQuery, !entityData) || entityData && entityData.id !== entity.id;
|
|
157
|
-
var clonedFormData = (0, _lodash["default"])(formData);
|
|
158
|
-
var _useToasts = (0, _toaster.useToasts)(),
|
|
159
|
-
addToast = _useToasts.addToast;
|
|
34
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
|
+
const Entity = ({
|
|
36
|
+
formData,
|
|
37
|
+
entity,
|
|
38
|
+
schema,
|
|
39
|
+
previousQuery,
|
|
40
|
+
action,
|
|
41
|
+
history,
|
|
42
|
+
updateFormData,
|
|
43
|
+
onViewUrl,
|
|
44
|
+
refetchRecord
|
|
45
|
+
}) => {
|
|
46
|
+
var _formData$values;
|
|
47
|
+
const [formValues, setFormValues] = (0, _react.useState)(null);
|
|
48
|
+
const [entitySchema, setEntitySchema] = (0, _react.useState)(null);
|
|
49
|
+
const [entityData, setEntityData] = (0, _react.useState)(null);
|
|
50
|
+
const [entityIdentifier, setEntityIdentifier] = (0, _react.useState)(null);
|
|
51
|
+
const [pageTitle, setPageTitle] = (0, _react.useState)('');
|
|
52
|
+
const [isSaveButtonAvailable, setIsSaveButtonAvailable] = (0, _react.useState)(false);
|
|
53
|
+
const [entityIsPublished, setEntityIsPublish] = (0, _react.useState)(formData && formData.values && formData.values.status);
|
|
54
|
+
const [isEnablePublishButton, setEnablePublishButton] = (0, _react.useState)(false);
|
|
55
|
+
const [isEnablePreviewButton, setEnablePreviewButton] = (0, _react.useState)(false);
|
|
56
|
+
const [modalStatus, setModalStatus] = (0, _useToggle.default)(false);
|
|
57
|
+
const [copyModalStatus, setCopyModalStatus] = (0, _useToggle.default)(false);
|
|
58
|
+
const [pageBuilderTemplateStatus, setPageBuilderTemplateStatus] = (0, _react.useState)(true);
|
|
59
|
+
const [shouldCopyData, setShouldCopyData] = (0, _react.useState)(false);
|
|
60
|
+
const [isFormValid, setIsFormValid] = (0, _react.useState)(false);
|
|
61
|
+
const [formDataFromCopy, setFormDataFromCopy] = (0, _react.useState)(null);
|
|
62
|
+
const [newUpdatedDate, setNewUpdatedDate] = (0, _react.useState)(null);
|
|
63
|
+
const [saveButtonText, setSaveButtonText] = (0, _react.useState)(_constants.SAVE_BUTTON_TEXTS.save);
|
|
64
|
+
const [externalUpdateTime, setExternalUpdateTime] = (0, _react.useState)(null);
|
|
65
|
+
const [suppressPrompt, setSuppressPrompt] = (0, _react.useState)(false);
|
|
66
|
+
const [isRightSidebarOpen, setIsRightSidebarOpen] = (0, _react.useState)(true);
|
|
67
|
+
const handleToggleRightSidebar = () => setIsRightSidebarOpen(!isRightSidebarOpen);
|
|
68
|
+
const isCreatePage = history.location.pathname.includes('create');
|
|
69
|
+
const [isNewEntity, setIsNewEntity] = (0, _react.useState)(isCreatePage);
|
|
70
|
+
const client = (0, _client.useApolloClient)();
|
|
71
|
+
const shouldUpdateState = !entityIdentifier || (0, _entity.checkFulfilConditions)(entity, schema, previousQuery, !entityData) || entityData && entityData.id !== entity.id;
|
|
72
|
+
const clonedFormData = (0, _lodash.default)(formData);
|
|
73
|
+
const {
|
|
74
|
+
addToast
|
|
75
|
+
} = (0, _toaster.useToasts)();
|
|
160
76
|
|
|
161
77
|
// Here's how we'll keep track of our component's mounted state
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
78
|
+
const componentIsMounted = (0, _react.useRef)(true);
|
|
79
|
+
const {
|
|
80
|
+
displayProperties: {
|
|
81
|
+
saveOnChange = false
|
|
82
|
+
}
|
|
83
|
+
} = schema;
|
|
84
|
+
(0, _useCallbackDebounce.default)(() => {
|
|
166
85
|
isSaveButtonAvailable && onSubmit();
|
|
167
86
|
}, 500, [isSaveButtonAvailable], !saveOnChange);
|
|
168
|
-
(0, _react.useEffect)(
|
|
169
|
-
|
|
170
|
-
componentIsMounted.current = false;
|
|
171
|
-
};
|
|
87
|
+
(0, _react.useEffect)(() => () => {
|
|
88
|
+
componentIsMounted.current = false;
|
|
172
89
|
}, []); // Using an empty dependency array ensures this only runs on unmount
|
|
173
90
|
|
|
174
|
-
(0, _react.useEffect)(
|
|
91
|
+
(0, _react.useEffect)(() => {
|
|
175
92
|
if (shouldUpdateState) {
|
|
176
93
|
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
177
94
|
setEntityData(entity);
|
|
@@ -183,7 +100,7 @@ var Entity = function Entity(_ref) {
|
|
|
183
100
|
setEnablePreviewButton(!!schema.interfaces.includes(_constants.PREVIEW_INTERFACE));
|
|
184
101
|
}
|
|
185
102
|
if (formData && pageBuilderTemplateStatus) {
|
|
186
|
-
|
|
103
|
+
const isPageBuilderTemplateSet = !!formData.values.pageBuilderTemplateId;
|
|
187
104
|
client.writeQuery({
|
|
188
105
|
query: (0, _adminUiUtils.getQuery)('GET_PB_TEMPLATE_STATUS'),
|
|
189
106
|
data: {
|
|
@@ -196,60 +113,45 @@ var Entity = function Entity(_ref) {
|
|
|
196
113
|
client.writeQuery({
|
|
197
114
|
query: (0, _adminUiUtils.getQuery)('GET_CURRENT_ENTITY'),
|
|
198
115
|
data: {
|
|
199
|
-
currentEntity: schema.id
|
|
116
|
+
currentEntity: schema.id,
|
|
117
|
+
currentItemId: entity ? entity.id : null
|
|
200
118
|
}
|
|
201
119
|
});
|
|
202
120
|
}
|
|
203
121
|
}, [client, entity, entityData, formData, formValues, pageBuilderTemplateStatus, previousQuery, schema, shouldUpdateState]);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
_yield$client$query = _context.sent;
|
|
223
|
-
_yield$client$query$d = _yield$client$query.data;
|
|
224
|
-
_yield$client$query$d2 = _yield$client$query$d === void 0 ? {} : _yield$client$query$d;
|
|
225
|
-
_yield$client$query$d3 = _yield$client$query$d2.getEntityUrl;
|
|
226
|
-
getEntityUrl = _yield$client$query$d3 === void 0 ? '' : _yield$client$query$d3;
|
|
227
|
-
return _context.abrupt("return", getEntityUrl);
|
|
228
|
-
case 9:
|
|
229
|
-
case "end":
|
|
230
|
-
return _context.stop();
|
|
231
|
-
}
|
|
232
|
-
}, _callee);
|
|
233
|
-
}));
|
|
234
|
-
return function getFullUrl() {
|
|
235
|
-
return _ref2.apply(this, arguments);
|
|
236
|
-
};
|
|
237
|
-
}();
|
|
238
|
-
var getFormValues = function getFormValues(values) {
|
|
122
|
+
const getFullUrl = async () => {
|
|
123
|
+
const query = (0, _adminUiUtils.getQuery)('GET_ENTITY_URL');
|
|
124
|
+
const {
|
|
125
|
+
data: {
|
|
126
|
+
getEntityUrl = ''
|
|
127
|
+
} = {}
|
|
128
|
+
} = await client.query({
|
|
129
|
+
query,
|
|
130
|
+
variables: {
|
|
131
|
+
itemId: entity.id,
|
|
132
|
+
itemEntity: schema.id,
|
|
133
|
+
fullUrl: true
|
|
134
|
+
},
|
|
135
|
+
fetchPolicy: 'network-only'
|
|
136
|
+
});
|
|
137
|
+
return getEntityUrl;
|
|
138
|
+
};
|
|
139
|
+
const getFormValues = values => {
|
|
239
140
|
if (componentIsMounted.current) {
|
|
240
141
|
setFormValues(values);
|
|
241
142
|
}
|
|
242
143
|
};
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
144
|
+
const onChangeSideBarRelations = ({
|
|
145
|
+
id,
|
|
146
|
+
value
|
|
147
|
+
}, requiredChildField) => {
|
|
148
|
+
const updatedFormValues = (0, _entity.getUpdatedFormValues)({
|
|
149
|
+
id,
|
|
150
|
+
value,
|
|
151
|
+
requiredChildField,
|
|
152
|
+
formValues
|
|
251
153
|
});
|
|
252
|
-
|
|
154
|
+
const shouldActiveSaveButton = (0, _entity.validateSideBarRelations)(updatedFormValues, requiredChildField);
|
|
253
155
|
if (isFormValid && shouldActiveSaveButton && componentIsMounted.current) {
|
|
254
156
|
setIsSaveButtonAvailable(true);
|
|
255
157
|
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
@@ -260,174 +162,143 @@ var Entity = function Entity(_ref) {
|
|
|
260
162
|
setFormValues(updatedFormValues);
|
|
261
163
|
}
|
|
262
164
|
};
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
_yield$client$query2 = _context2.sent;
|
|
306
|
-
_yield$client$query2$ = _yield$client$query2.data;
|
|
307
|
-
data = _yield$client$query2$ === void 0 ? {} : _yield$client$query2$;
|
|
308
|
-
if (data && data.mergePageBuilderTemplateChanges) {
|
|
309
|
-
updatedFormValues = updatedFormValues.map(function (updatedFormValue) {
|
|
310
|
-
if (updatedFormValue.id === _constants.PAGE_BUILDER_FIELD_ID) {
|
|
311
|
-
return _objectSpread(_objectSpread({}, updatedFormValue), {}, {
|
|
312
|
-
value: data.mergePageBuilderTemplateChanges
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
return updatedFormValue;
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
case 14:
|
|
319
|
-
itemsToAdd = [];
|
|
320
|
-
if (formValues && formValues.length > updatedFormValues.length) {
|
|
321
|
-
[].concat((0, _toConsumableArray2["default"])(updatedFormValues), (0, _toConsumableArray2["default"])(formValues)).forEach(function (item) {
|
|
322
|
-
var index = updatedFormValues.findIndex(function (value) {
|
|
323
|
-
return value.id === item.id;
|
|
324
|
-
});
|
|
325
|
-
if (index === -1) {
|
|
326
|
-
itemsToAdd.push(item);
|
|
327
|
-
}
|
|
165
|
+
const onChangeFormValues = async _ref => {
|
|
166
|
+
let {
|
|
167
|
+
isValid,
|
|
168
|
+
fields,
|
|
169
|
+
isNewValueSet,
|
|
170
|
+
valuesChecked,
|
|
171
|
+
currentField,
|
|
172
|
+
value: fieldValue
|
|
173
|
+
} = _ref,
|
|
174
|
+
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
175
|
+
let updatedFormValues = valuesChecked ? valuesChecked.slice() : [];
|
|
176
|
+
if (currentField === _constants.PAGE_BUILDER_TEMPLATE_FIELD_ID) {
|
|
177
|
+
const pageBuilderTemplateId = fieldValue;
|
|
178
|
+
client.writeQuery({
|
|
179
|
+
query: (0, _adminUiUtils.getQuery)('GET_PB_TEMPLATE_STATUS'),
|
|
180
|
+
data: {
|
|
181
|
+
pageBuilderTemplateSet: !!pageBuilderTemplateId,
|
|
182
|
+
pageBuilderTemplateId
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
if (componentIsMounted.current) {
|
|
186
|
+
setPageBuilderTemplateStatus(false);
|
|
187
|
+
}
|
|
188
|
+
const pageBuilder = updatedFormValues.filter(formValue => formValue.id === _constants.PAGE_BUILDER_FIELD_ID);
|
|
189
|
+
if (pageBuilderTemplateId) {
|
|
190
|
+
const {
|
|
191
|
+
data = {}
|
|
192
|
+
} = await client.query({
|
|
193
|
+
query: (0, _adminUiUtils.getQuery)('MERGE_PB_TEMPLATE_CHANGES'),
|
|
194
|
+
variables: {
|
|
195
|
+
parent: {
|
|
196
|
+
pageBuilder: pageBuilder[0].value,
|
|
197
|
+
pageBuilderTemplateId
|
|
198
|
+
},
|
|
199
|
+
entityIdentifier
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
if (data && data.mergePageBuilderTemplateChanges) {
|
|
203
|
+
updatedFormValues = updatedFormValues.map(updatedFormValue => {
|
|
204
|
+
if (updatedFormValue.id === _constants.PAGE_BUILDER_FIELD_ID) {
|
|
205
|
+
return _objectSpread(_objectSpread({}, updatedFormValue), {}, {
|
|
206
|
+
value: data.mergePageBuilderTemplateChanges
|
|
328
207
|
});
|
|
329
208
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return id === 'name';
|
|
333
|
-
}), _fields$filter2 = (0, _slicedToArray2["default"])(_fields$filter, 1), _fields$filter2$ = _fields$filter2[0], updatedEntity = _fields$filter2$ === void 0 ? null : _fields$filter2$;
|
|
334
|
-
updatedEntity && setPageTitle(updatedEntity.value);
|
|
335
|
-
isValidAndNewValueSet = isValid && isNewValueSet;
|
|
336
|
-
isNotValidOrNotNewValueSet = !isValid || !isNewValueSet;
|
|
337
|
-
if (componentIsMounted.current) {
|
|
338
|
-
setIsFormValid(isValid);
|
|
339
|
-
}
|
|
340
|
-
if (isValidAndNewValueSet && componentIsMounted.current) {
|
|
341
|
-
setIsSaveButtonAvailable(true);
|
|
342
|
-
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
343
|
-
}
|
|
344
|
-
if (isNotValidOrNotNewValueSet && componentIsMounted.current) {
|
|
345
|
-
setIsSaveButtonAvailable(false);
|
|
346
|
-
}
|
|
347
|
-
if (componentIsMounted.current) {
|
|
348
|
-
setFormValues([].concat((0, _toConsumableArray2["default"])(updatedFormValues), itemsToAdd));
|
|
349
|
-
}
|
|
350
|
-
case 24:
|
|
351
|
-
case "end":
|
|
352
|
-
return _context2.stop();
|
|
209
|
+
return updatedFormValue;
|
|
210
|
+
});
|
|
353
211
|
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const itemsToAdd = [];
|
|
215
|
+
if (formValues && formValues.length > updatedFormValues.length) {
|
|
216
|
+
[...updatedFormValues, ...formValues].forEach(item => {
|
|
217
|
+
const index = updatedFormValues.findIndex(value => value.id === item.id);
|
|
218
|
+
if (index === -1) {
|
|
219
|
+
itemsToAdd.push(item);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
const [updatedEntity = null] = fields.filter(({
|
|
224
|
+
id
|
|
225
|
+
}) => id === 'name');
|
|
226
|
+
updatedEntity && setPageTitle(updatedEntity.value);
|
|
227
|
+
const isNotValidOrNotNewValueSet = !isValid || !isNewValueSet;
|
|
228
|
+
if (componentIsMounted.current) {
|
|
229
|
+
setIsFormValid(isValid);
|
|
230
|
+
}
|
|
231
|
+
if (isValid && isNewValueSet && componentIsMounted.current) {
|
|
232
|
+
setIsSaveButtonAvailable(true);
|
|
233
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
234
|
+
}
|
|
235
|
+
if (isNotValidOrNotNewValueSet && componentIsMounted.current) {
|
|
236
|
+
setIsSaveButtonAvailable(false);
|
|
237
|
+
}
|
|
238
|
+
if (componentIsMounted.current) {
|
|
239
|
+
setFormValues([...updatedFormValues, ...itemsToAdd]);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const onSubmit = event => {
|
|
361
243
|
event && event.preventDefault();
|
|
362
244
|
if (!isSaveButtonAvailable) return null;
|
|
363
|
-
|
|
364
|
-
|
|
245
|
+
if (isCreatePage) {
|
|
246
|
+
setSuppressPrompt(true);
|
|
247
|
+
}
|
|
248
|
+
const parsedFormValues = (0, _reactFormBuilder.parseFormValues)(formValues);
|
|
249
|
+
const updatedFormValues = newUpdatedDate ? _objectSpread(_objectSpread({}, formData.values), {}, {
|
|
365
250
|
update: newUpdatedDate
|
|
366
251
|
}) : _objectSpread({}, formData.values);
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
};
|
|
372
|
-
var submitParams = {
|
|
252
|
+
const handleUpdateFormData = () => updateFormData({
|
|
253
|
+
values: _objectSpread(_objectSpread({}, updatedFormValues), parsedFormValues)
|
|
254
|
+
}, true);
|
|
255
|
+
const submitParams = {
|
|
373
256
|
update: {
|
|
374
|
-
entitySchema
|
|
375
|
-
entityData
|
|
376
|
-
parsedFormValues
|
|
377
|
-
client
|
|
378
|
-
setIsSaveButtonAvailable
|
|
379
|
-
setNewUpdatedDate
|
|
380
|
-
newUpdatedDate
|
|
381
|
-
previousQuery
|
|
382
|
-
setSaveButtonText
|
|
383
|
-
handleUpdateFormData
|
|
257
|
+
entitySchema,
|
|
258
|
+
entityData,
|
|
259
|
+
parsedFormValues,
|
|
260
|
+
client,
|
|
261
|
+
setIsSaveButtonAvailable,
|
|
262
|
+
setNewUpdatedDate,
|
|
263
|
+
newUpdatedDate,
|
|
264
|
+
previousQuery,
|
|
265
|
+
setSaveButtonText,
|
|
266
|
+
handleUpdateFormData
|
|
384
267
|
},
|
|
385
268
|
create: {
|
|
386
|
-
entitySchema
|
|
387
|
-
parsedFormValues
|
|
388
|
-
client
|
|
389
|
-
setEntityData
|
|
390
|
-
setIsSaveButtonAvailable
|
|
391
|
-
history
|
|
392
|
-
setIsNewEntity
|
|
393
|
-
setSaveButtonText
|
|
394
|
-
handleUpdateFormData
|
|
269
|
+
entitySchema,
|
|
270
|
+
parsedFormValues,
|
|
271
|
+
client,
|
|
272
|
+
setEntityData,
|
|
273
|
+
setIsSaveButtonAvailable,
|
|
274
|
+
history,
|
|
275
|
+
setIsNewEntity,
|
|
276
|
+
setSaveButtonText,
|
|
277
|
+
handleUpdateFormData
|
|
395
278
|
}
|
|
396
279
|
};
|
|
397
|
-
|
|
398
|
-
return _actionsHandlers
|
|
280
|
+
const currentAction = submitParams[action];
|
|
281
|
+
return _actionsHandlers.default[action].submit(currentAction, addToast);
|
|
399
282
|
};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
history.push("/data-listing/".concat(entitySchema.id));
|
|
420
|
-
case 5:
|
|
421
|
-
case "end":
|
|
422
|
-
return _context3.stop();
|
|
423
|
-
}
|
|
424
|
-
}, _callee3);
|
|
425
|
-
}));
|
|
426
|
-
return function onDelete() {
|
|
427
|
-
return _ref7.apply(this, arguments);
|
|
428
|
-
};
|
|
429
|
-
}();
|
|
430
|
-
var onCopy = function onCopy() {
|
|
283
|
+
const onDelete = async () => {
|
|
284
|
+
const {
|
|
285
|
+
values: {
|
|
286
|
+
id
|
|
287
|
+
}
|
|
288
|
+
} = formData;
|
|
289
|
+
if (componentIsMounted.current) {
|
|
290
|
+
setIsSaveButtonAvailable(false);
|
|
291
|
+
}
|
|
292
|
+
await _actionsHandlers.default.delete.submit({
|
|
293
|
+
entitySchema,
|
|
294
|
+
client,
|
|
295
|
+
parsedFormValues: {
|
|
296
|
+
id
|
|
297
|
+
}
|
|
298
|
+
}, addToast);
|
|
299
|
+
history.push(`/data-listing/${entitySchema.id}`);
|
|
300
|
+
};
|
|
301
|
+
const onCopy = () => {
|
|
431
302
|
if (formDataFromCopy && componentIsMounted.current) {
|
|
432
303
|
updateFormData(formDataFromCopy);
|
|
433
304
|
setShouldCopyData(true);
|
|
@@ -438,91 +309,65 @@ var Entity = function Entity(_ref) {
|
|
|
438
309
|
}
|
|
439
310
|
}
|
|
440
311
|
};
|
|
441
|
-
|
|
312
|
+
const updateCopyData = () => {
|
|
442
313
|
setCopyModalStatus(!copyModalStatus);
|
|
443
314
|
setShouldCopyData(false);
|
|
444
315
|
};
|
|
445
|
-
|
|
316
|
+
const handleCopyDataFromClose = () => {
|
|
446
317
|
setCopyModalStatus(false);
|
|
447
318
|
setFormDataFromCopy(null);
|
|
448
319
|
};
|
|
449
|
-
|
|
450
|
-
|
|
320
|
+
const getFormData = formDataValues => {
|
|
321
|
+
const formDataUpdated = {
|
|
451
322
|
values: _objectSpread({}, formDataValues)
|
|
452
323
|
};
|
|
453
324
|
setFormDataFromCopy(formDataUpdated);
|
|
454
325
|
};
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
client: client,
|
|
494
|
-
setEntityIsPublish: setEntityIsPublish,
|
|
495
|
-
entitySchema: entitySchema,
|
|
496
|
-
textContent: textContent,
|
|
497
|
-
refetchRecord: refetchRecord
|
|
498
|
-
}, addToast));
|
|
499
|
-
case 13:
|
|
500
|
-
case "end":
|
|
501
|
-
return _context4.stop();
|
|
502
|
-
}
|
|
503
|
-
}, _callee4);
|
|
504
|
-
}));
|
|
505
|
-
return function handlePublishAndUnpublish(_x2) {
|
|
506
|
-
return _ref9.apply(this, arguments);
|
|
507
|
-
};
|
|
508
|
-
}();
|
|
509
|
-
var showModal = (0, _entity.checkFulfilConditions)(formData, modalStatus);
|
|
510
|
-
var onViewUrlHandler = (0, _entity.canViewPage)(formData, entity, schema, entityIsPublished) ? function () {
|
|
511
|
-
return (0, _entity.onViewUrlClick)(getFullUrl);
|
|
512
|
-
} : onViewUrl;
|
|
513
|
-
var pageName = formData && formData.values && formData.values.name;
|
|
514
|
-
var hasNewFormValues = (0, _entity.checkFulfilConditions)(isNewEntity, !(0, _isFormEmpty["default"])(formValues));
|
|
515
|
-
var hasToDisplayPrompt = isSaveButtonAvailable || hasNewFormValues;
|
|
516
|
-
var showSideBarRelations = (0, _entity.checkFulfilConditions)(schema, formData);
|
|
517
|
-
var 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'));
|
|
518
|
-
return /*#__PURE__*/_react["default"].createElement(_RecordEditContext.RecordEditContextProvider, {
|
|
326
|
+
const handlePublishAndUnpublish = async ({
|
|
327
|
+
target: {
|
|
328
|
+
textContent
|
|
329
|
+
}
|
|
330
|
+
}) => {
|
|
331
|
+
const isPublishButton = textContent === _constants.TEXT_CONTENT_TYPE;
|
|
332
|
+
const isPublished = entityIsPublished === _constants.ENTITY_PUBLISHED;
|
|
333
|
+
const isUnpublish = (0, _entity.checkFulfilConditions)(!isPublishButton, !isPublished);
|
|
334
|
+
if (isUnpublish) {
|
|
335
|
+
return addToast(_constants.UNPUBLISHED_WARNING, {
|
|
336
|
+
appearance: 'warning',
|
|
337
|
+
autoDismiss: true
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if ((0, _entity.checkFulfilConditions)(isPublishButton, isSaveButtonAvailable)) {
|
|
341
|
+
const savedPageMessage = await onSubmit();
|
|
342
|
+
if (savedPageMessage === _constants.ERROR) {
|
|
343
|
+
return addToast(`Content not published`, {
|
|
344
|
+
appearance: _constants.ERROR,
|
|
345
|
+
autoDismiss: true
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return _actionsHandlers.default.shared.triggerPublish({
|
|
350
|
+
entityData,
|
|
351
|
+
client,
|
|
352
|
+
setEntityIsPublish,
|
|
353
|
+
entitySchema,
|
|
354
|
+
textContent,
|
|
355
|
+
refetchRecord
|
|
356
|
+
}, addToast);
|
|
357
|
+
};
|
|
358
|
+
const showModal = (0, _entity.checkFulfilConditions)(formData, modalStatus);
|
|
359
|
+
const onViewUrlHandler = (0, _entity.canViewPage)(formData, entity, schema, entityIsPublished) ? () => (0, _entity.onViewUrlClick)(getFullUrl) : onViewUrl;
|
|
360
|
+
const pageName = formData && formData.values && formData.values.name;
|
|
361
|
+
const hasToDisplayPrompt = isSaveButtonAvailable && !suppressPrompt;
|
|
362
|
+
const showSideBarRelations = (0, _entity.checkFulfilConditions)(schema, formData);
|
|
363
|
+
return /*#__PURE__*/_react.default.createElement(_RecordEditContext.RecordEditContextProvider, {
|
|
519
364
|
value: {
|
|
520
|
-
externalUpdateTime
|
|
365
|
+
externalUpdateTime,
|
|
521
366
|
updated: formData === null || formData === void 0 ? void 0 : (_formData$values = formData.values) === null || _formData$values === void 0 ? void 0 : _formData$values.updated
|
|
522
367
|
}
|
|
523
|
-
}, /*#__PURE__*/_react
|
|
368
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
524
369
|
className: "page"
|
|
525
|
-
}, /*#__PURE__*/_react
|
|
370
|
+
}, /*#__PURE__*/_react.default.createElement(_EntityHeader.default, {
|
|
526
371
|
entityData: entityData,
|
|
527
372
|
entityIdentifier: entityIdentifier,
|
|
528
373
|
pageTitle: pageTitle,
|
|
@@ -539,46 +384,35 @@ var Entity = function Entity(_ref) {
|
|
|
539
384
|
saveButtonText: saveButtonText,
|
|
540
385
|
saveOnChange: saveOnChange,
|
|
541
386
|
entitySchema: entitySchema
|
|
542
|
-
}), /*#__PURE__*/_react
|
|
387
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
543
388
|
className: "page-wrapper__content"
|
|
544
|
-
}, /*#__PURE__*/_react
|
|
389
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
545
390
|
className: "tabs-wrapper tabs-wrapper__tab"
|
|
546
|
-
}, /*#__PURE__*/_react
|
|
391
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Prompt, {
|
|
547
392
|
when: hasToDisplayPrompt,
|
|
548
393
|
message: _constants.LEAVE_PAGE_MESSAGE
|
|
549
|
-
}), showModal && /*#__PURE__*/_react
|
|
394
|
+
}), showModal && /*#__PURE__*/_react.default.createElement(_admin.DeleteAction, {
|
|
550
395
|
onClose: setModalStatus,
|
|
551
396
|
deleteAction: onDelete,
|
|
552
397
|
itemName: formData.values.name
|
|
553
|
-
}), copyModalStatus && /*#__PURE__*/_react
|
|
398
|
+
}), copyModalStatus && /*#__PURE__*/_react.default.createElement(_admin.CopyDataFromAction, {
|
|
554
399
|
onClose: handleCopyDataFromClose,
|
|
555
400
|
copyAction: onCopy,
|
|
556
401
|
getFormData: getFormData
|
|
557
|
-
}), /*#__PURE__*/_react
|
|
558
|
-
className:
|
|
559
|
-
}, /*#__PURE__*/_react
|
|
402
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
403
|
+
className: `page__content${!isRightSidebarOpen ? ' right-sidebar-collapsed' : ''}`
|
|
404
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
560
405
|
className: "page__content"
|
|
561
|
-
}, /*#__PURE__*/_react
|
|
406
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
562
407
|
className: "content"
|
|
563
|
-
}, /*#__PURE__*/_react
|
|
564
|
-
hookKey:
|
|
408
|
+
}, /*#__PURE__*/_react.default.createElement(_pluginRenderHooksUi.RenderHook, {
|
|
409
|
+
hookKey: `entity:${action}:main:top`,
|
|
565
410
|
entity: entity,
|
|
566
411
|
schema: schema
|
|
567
|
-
}), /*#__PURE__*/_react
|
|
412
|
+
}), /*#__PURE__*/_react.default.createElement(_InfoBoxes.default, {
|
|
568
413
|
id: entity.id,
|
|
569
414
|
schema: schema
|
|
570
|
-
}), /*#__PURE__*/_react
|
|
571
|
-
enabled: showPageBuilderTabs,
|
|
572
|
-
onTabChange: function onTabChange(tabId) {
|
|
573
|
-
client.writeQuery({
|
|
574
|
-
query: _adminUiUtils.GET_CURRENT_TAB_ID,
|
|
575
|
-
data: {
|
|
576
|
-
currentTabId: tabId
|
|
577
|
-
}
|
|
578
|
-
});
|
|
579
|
-
setCurrentTabId(tabId);
|
|
580
|
-
}
|
|
581
|
-
}, /*#__PURE__*/_react["default"].createElement(_reactFormBuilder.FormBuilder, {
|
|
415
|
+
}), /*#__PURE__*/_react.default.createElement(_reactFormBuilder.FormBuilder, {
|
|
582
416
|
getIsFormValid: setIsFormValid,
|
|
583
417
|
getFormValues: getFormValues,
|
|
584
418
|
schema: schema,
|
|
@@ -588,30 +422,33 @@ var Entity = function Entity(_ref) {
|
|
|
588
422
|
updateCopyData: updateCopyData,
|
|
589
423
|
formValues: formValues,
|
|
590
424
|
isNewEntity: isNewEntity,
|
|
591
|
-
onExternalUpdate: setExternalUpdateTime
|
|
592
|
-
|
|
593
|
-
|
|
425
|
+
onExternalUpdate: setExternalUpdateTime,
|
|
426
|
+
mode: isNewEntity ? 'create' : 'update'
|
|
427
|
+
}), /*#__PURE__*/_react.default.createElement(_pluginRenderHooksUi.RenderHook, {
|
|
428
|
+
hookKey: `entity:${action}:main:bottom`,
|
|
594
429
|
entity: entity,
|
|
595
430
|
schema: schema
|
|
596
|
-
}))))), /*#__PURE__*/_react
|
|
597
|
-
className:
|
|
598
|
-
}, showSideBarRelations && /*#__PURE__*/_react
|
|
431
|
+
}))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
432
|
+
className: `column column--one-third page-sidebar page-sidebar--relations${!isRightSidebarOpen ? ' sidebar--collapsed' : ''}`
|
|
433
|
+
}, showSideBarRelations && /*#__PURE__*/_react.default.createElement(_SideBarRelations.default, {
|
|
599
434
|
entity: entity,
|
|
600
435
|
formData: formData.values,
|
|
601
436
|
schema: schema,
|
|
602
|
-
onChange: onChangeSideBarRelations
|
|
437
|
+
onChange: onChangeSideBarRelations,
|
|
438
|
+
isOpen: isRightSidebarOpen,
|
|
439
|
+
onToggle: handleToggleRightSidebar
|
|
603
440
|
})))));
|
|
604
441
|
};
|
|
605
442
|
Entity.propTypes = {
|
|
606
|
-
entity: _propTypes
|
|
607
|
-
schema: _propTypes
|
|
608
|
-
previousQuery: _propTypes
|
|
609
|
-
action: _propTypes
|
|
610
|
-
history: _propTypes
|
|
611
|
-
formData: _propTypes
|
|
612
|
-
updateFormData: _propTypes
|
|
613
|
-
onViewUrl: _propTypes
|
|
614
|
-
refetchRecord: _propTypes
|
|
443
|
+
entity: _propTypes.default.object,
|
|
444
|
+
schema: _propTypes.default.object,
|
|
445
|
+
previousQuery: _propTypes.default.object,
|
|
446
|
+
action: _propTypes.default.string.isRequired,
|
|
447
|
+
history: _propTypes.default.object.isRequired,
|
|
448
|
+
formData: _propTypes.default.object,
|
|
449
|
+
updateFormData: _propTypes.default.func.isRequired,
|
|
450
|
+
onViewUrl: _propTypes.default.func,
|
|
451
|
+
refetchRecord: _propTypes.default.func.isRequired
|
|
615
452
|
};
|
|
616
453
|
Entity.defaultProps = {
|
|
617
454
|
previousQuery: null,
|
|
@@ -620,5 +457,5 @@ Entity.defaultProps = {
|
|
|
620
457
|
formData: null,
|
|
621
458
|
onViewUrl: null
|
|
622
459
|
};
|
|
623
|
-
var _default = exports
|
|
460
|
+
var _default = exports.default = (0, _reactRouterDom.withRouter)(Entity);
|
|
624
461
|
//# sourceMappingURL=Entity.js.map
|