@blaze-cms/plugin-data-ui 0.127.0-project-admin-customisations.2 → 0.127.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -33
- package/README.md +0 -2
- package/lib/components/EntityDataListing/EntityDataListing.js +4 -4
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +190 -194
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +28 -26
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +89 -89
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +42 -40
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +33 -31
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +42 -40
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +45 -43
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +69 -65
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +12 -10
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +66 -62
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +129 -121
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +19 -17
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/index.js +60 -56
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +27 -25
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +18 -29
- 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/index.js +7 -13
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/package.json +9 -10
- package/src/components/EntityManager/Entity/Entity.js +59 -65
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +9 -23
- package/lib/components/InfoBoxes/InfoBoxes.js +0 -36
- package/lib/components/InfoBoxes/InfoBoxes.js.map +0 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +0 -44
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
- package/lib/components/InfoBoxes/hooks/useData.js +0 -42
- package/lib/components/InfoBoxes/hooks/useData.js.map +0 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +0 -26
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
- package/lib/components/InfoBoxes/index.js +0 -12
- package/lib/components/InfoBoxes/index.js.map +0 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +0 -46
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
- package/lib-es/components/InfoBoxes/InfoBoxes.js +0 -28
- package/lib-es/components/InfoBoxes/InfoBoxes.js.map +0 -1
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +0 -30
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js +0 -37
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +0 -1
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +0 -19
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
- package/lib-es/components/InfoBoxes/index.js +0 -3
- package/lib-es/components/InfoBoxes/index.js.map +0 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +0 -31
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
- package/src/components/InfoBoxes/InfoBoxes.js +0 -24
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +0 -22
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/src/components/InfoBoxes/hooks/useData.js +0 -20
- package/src/components/InfoBoxes/hooks/useInfoBox.js +0 -13
- package/src/components/InfoBoxes/index.js +0 -3
- package/src/components/InfoBoxes/presentational/InfoBox.js +0 -34
package/CHANGELOG.md
CHANGED
|
@@ -3,19 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.127.0
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* add initial admin renderhook plugin with first hook ([#3785](https://github.com/thebyte9/blaze/issues/3785)) ([c535036](https://github.com/thebyte9/blaze/commit/c5350369d28e870afe8a10de1a284fd63592be33))
|
|
12
|
-
* support accordion rendering for form categories in FormBuilder ([#3784](https://github.com/thebyte9/blaze/issues/3784)) ([76d8421](https://github.com/thebyte9/blaze/commit/76d842153fa68bebb70ecf7c62fea1efaf839a88))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# [0.127.0-project-admin-customisations.1](https://github.com/thebyte9/blaze/compare/v0.127.0-project-admin-customisations.0...v0.127.0-project-admin-customisations.1) (2023-01-25)
|
|
6
|
+
# [0.127.0](https://github.com/thebyte9/blaze/compare/v0.126.1...v0.127.0) (2023-02-10)
|
|
19
7
|
|
|
20
8
|
**Note:** Version bump only for package @blaze-cms/plugin-data-ui
|
|
21
9
|
|
|
@@ -23,26 +11,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
23
11
|
|
|
24
12
|
|
|
25
13
|
|
|
26
|
-
# [0.127.0-project-admin-customisations.0](https://github.com/thebyte9/blaze/compare/v0.126.1...v0.127.0-project-admin-customisations.0) (2023-01-25)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Bug Fixes
|
|
30
|
-
|
|
31
|
-
* admin updates feedback ([0e69cbb](https://github.com/thebyte9/blaze/commit/0e69cbb0337df371c3e1cfc2f43c0d4ce666f33b))
|
|
32
|
-
* update snapshots ([c88c8be](https://github.com/thebyte9/blaze/commit/c88c8bec58af59a5707d15f5e212e6b515706676))
|
|
33
|
-
* update snapshots ([d490e17](https://github.com/thebyte9/blaze/commit/d490e1746d63ed5842799d15d6696c287f9b0d10))
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### Features
|
|
37
|
-
|
|
38
|
-
* add admin style feedback ([3f8b9a1](https://github.com/thebyte9/blaze/commit/3f8b9a1416a8a7977631583cff62fddb43cd2e9d))
|
|
39
|
-
* admin-ui info box component ([#3770](https://github.com/thebyte9/blaze/issues/3770)) ([01dff01](https://github.com/thebyte9/blaze/commit/01dff01c8bd2a9e522abf1c98ff32e4a1ca15fd1))
|
|
40
|
-
* style sidebar and add updated snapshots. Bz2 2870 ([#3539](https://github.com/thebyte9/blaze/issues/3539)) ([60640e5](https://github.com/thebyte9/blaze/commit/60640e5b65b4ed426ceefabc00c3beddb2113676))
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
14
|
# [0.126.0](https://github.com/thebyte9/blaze/compare/v0.126.0-alpha.6...v0.126.0) (2023-01-17)
|
|
47
15
|
|
|
48
16
|
**Note:** Version bump only for package @blaze-cms/plugin-data-ui
|
package/README.md
CHANGED
|
@@ -38,5 +38,3 @@ The `displayProperties` property can be set on entity schema in the api to provi
|
|
|
38
38
|
- adminDefaultListingFilter: this is a where query that will be passed to the api to filter records from the admin listing
|
|
39
39
|
- adminLabel: properties to build label when record is showing search listings
|
|
40
40
|
- adminHeader: properties to build admin header
|
|
41
|
-
|
|
42
|
-
-
|
|
@@ -41,10 +41,10 @@ var EntityDataListing = function EntityDataListing(_ref) {
|
|
|
41
41
|
identifier: identifier
|
|
42
42
|
}
|
|
43
43
|
}),
|
|
44
|
-
_useQuery$data = _useQuery.data
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
getEntitySchemas = _useQuery$
|
|
44
|
+
_useQuery$data = _useQuery.data;
|
|
45
|
+
_useQuery$data = _useQuery$data === void 0 ? {} : _useQuery$data;
|
|
46
|
+
var _useQuery$data$getEnt = _useQuery$data.getEntitySchemas,
|
|
47
|
+
getEntitySchemas = _useQuery$data$getEnt === void 0 ? [] : _useQuery$data$getEnt;
|
|
48
48
|
if (!getEntitySchemas.length) return '';
|
|
49
49
|
return /*#__PURE__*/_react["default"].createElement(_ListingTable["default"], {
|
|
50
50
|
entitySchema: getEntitySchemas[0],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDataListing.js","names":["EntityDataListing","match","menuItems","identifier","params","entityIdentifier","map","_","items","item","filter","uri","endsWith","length","Boolean","selectedMenuItem","useQuery","getQuery","variables","data","getEntitySchemas","propTypes","PropTypes","object","isRequired","array","withContext"],"sources":["../../../src/components/EntityDataListing/EntityDataListing.js"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\n\nimport ListingTable from '../ListingTable/ListingTable';\nimport { withContext } from '../../utils/hoc/withContext';\n\nconst EntityDataListing = ({ match, menuItems }) => {\n const {\n params: { entityIdentifier: identifier }\n } = match;\n\n const [[selectedMenuItem]] = menuItems\n .map(([_, { items }]) => {\n const item = items.filter(({ uri }) => uri.endsWith(`/${identifier}`));\n\n return item.length ? item : null;\n })\n .filter(Boolean);\n\n const { data: { getEntitySchemas = [] } = {} } = useQuery(getQuery('GET_ENTITY_SCHEMA'), {\n variables: { identifier }\n });\n\n if (!getEntitySchemas.length) return '';\n\n return <ListingTable entitySchema={getEntitySchemas[0]} selectedMenuItem={selectedMenuItem} />;\n};\n\nEntityDataListing.propTypes = {\n match: PropTypes.object.isRequired,\n menuItems: PropTypes.array.isRequired\n};\n\nexport default withContext(EntityDataListing);\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAEA;AACA;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiB,OAA6B;EAAA,IAAvBC,KAAK,QAALA,KAAK;IAAEC,SAAS,QAATA,SAAS;EAC3C,IAC8BC,UAAU,GACpCF,KAAK,CADPG,MAAM,CAAIC,gBAAgB;EAG5B,4BAA6BH,SAAS,CACnCI,GAAG,CAAC,iBAAoB;MAAA;QAAlBC,CAAC;QAAIC,KAAK,YAALA,KAAK;MACf,IAAMC,IAAI,GAAGD,KAAK,CAACE,MAAM,CAAC;QAAA,IAAGC,GAAG,SAAHA,GAAG;QAAA,OAAOA,GAAG,CAACC,QAAQ,YAAKT,UAAU,EAAG;MAAA,EAAC;MAEtE,OAAOM,IAAI,CAACI,MAAM,GAAGJ,IAAI,GAAG,IAAI;IAClC,CAAC,CAAC,CACDC,MAAM,CAACI,OAAO,CAAC;IAAA;IAAA;IANVC,gBAAgB;EAQxB,gBAAiD,IAAAC,gBAAQ,EAAC,IAAAC,sBAAQ,EAAC,mBAAmB,CAAC,EAAE;MACvFC,SAAS,EAAE;QAAEf,UAAU,EAAVA;MAAW;IAC1B,CAAC,CAAC;IAAA,2BAFMgB,IAAI;
|
|
1
|
+
{"version":3,"file":"EntityDataListing.js","names":["EntityDataListing","match","menuItems","identifier","params","entityIdentifier","map","_","items","item","filter","uri","endsWith","length","Boolean","selectedMenuItem","useQuery","getQuery","variables","data","getEntitySchemas","propTypes","PropTypes","object","isRequired","array","withContext"],"sources":["../../../src/components/EntityDataListing/EntityDataListing.js"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\n\nimport ListingTable from '../ListingTable/ListingTable';\nimport { withContext } from '../../utils/hoc/withContext';\n\nconst EntityDataListing = ({ match, menuItems }) => {\n const {\n params: { entityIdentifier: identifier }\n } = match;\n\n const [[selectedMenuItem]] = menuItems\n .map(([_, { items }]) => {\n const item = items.filter(({ uri }) => uri.endsWith(`/${identifier}`));\n\n return item.length ? item : null;\n })\n .filter(Boolean);\n\n const { data: { getEntitySchemas = [] } = {} } = useQuery(getQuery('GET_ENTITY_SCHEMA'), {\n variables: { identifier }\n });\n\n if (!getEntitySchemas.length) return '';\n\n return <ListingTable entitySchema={getEntitySchemas[0]} selectedMenuItem={selectedMenuItem} />;\n};\n\nEntityDataListing.propTypes = {\n match: PropTypes.object.isRequired,\n menuItems: PropTypes.array.isRequired\n};\n\nexport default withContext(EntityDataListing);\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAEA;AACA;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiB,OAA6B;EAAA,IAAvBC,KAAK,QAALA,KAAK;IAAEC,SAAS,QAATA,SAAS;EAC3C,IAC8BC,UAAU,GACpCF,KAAK,CADPG,MAAM,CAAIC,gBAAgB;EAG5B,4BAA6BH,SAAS,CACnCI,GAAG,CAAC,iBAAoB;MAAA;QAAlBC,CAAC;QAAIC,KAAK,YAALA,KAAK;MACf,IAAMC,IAAI,GAAGD,KAAK,CAACE,MAAM,CAAC;QAAA,IAAGC,GAAG,SAAHA,GAAG;QAAA,OAAOA,GAAG,CAACC,QAAQ,YAAKT,UAAU,EAAG;MAAA,EAAC;MAEtE,OAAOM,IAAI,CAACI,MAAM,GAAGJ,IAAI,GAAG,IAAI;IAClC,CAAC,CAAC,CACDC,MAAM,CAACI,OAAO,CAAC;IAAA;IAAA;IANVC,gBAAgB;EAQxB,gBAAiD,IAAAC,gBAAQ,EAAC,IAAAC,sBAAQ,EAAC,mBAAmB,CAAC,EAAE;MACvFC,SAAS,EAAE;QAAEf,UAAU,EAAVA;MAAW;IAC1B,CAAC,CAAC;IAAA,2BAFMgB,IAAI;EAAZ,6CAA0C,CAAC,CAAC;EAA5C,2CAAgBC,gBAAgB;IAAhBA,gBAAgB,sCAAG,EAAE;EAIrC,IAAI,CAACA,gBAAgB,CAACP,MAAM,EAAE,OAAO,EAAE;EAEvC,oBAAO,gCAAC,wBAAY;IAAC,YAAY,EAAEO,gBAAgB,CAAC,CAAC,CAAE;IAAC,gBAAgB,EAAEL;EAAiB,EAAG;AAChG,CAAC;AAEDf,iBAAiB,CAACqB,SAAS,GAAG;EAC5BpB,KAAK,EAAEqB,qBAAS,CAACC,MAAM,CAACC,UAAU;EAClCtB,SAAS,EAAEoB,qBAAS,CAACG,KAAK,CAACD;AAC7B,CAAC;AAAC,eAEa,IAAAE,wBAAW,EAAC1B,iBAAiB,CAAC;AAAA"}
|
|
@@ -37,7 +37,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
37
37
|
var _reactRouterDom = require("react-router-dom");
|
|
38
38
|
var _client = require("@apollo/client");
|
|
39
39
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
40
|
-
var _pluginRenderHooksUi = require("@blaze-cms/plugin-render-hooks-ui");
|
|
41
40
|
var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
|
|
42
41
|
var _reactFormBuilder = require("@blaze-cms/react-form-builder");
|
|
43
42
|
var _admin = require("@blaze-cms/admin");
|
|
@@ -52,7 +51,6 @@ var _constants = require("../../../constants");
|
|
|
52
51
|
var _EntityHeader = _interopRequireDefault(require("./EntityHeader"));
|
|
53
52
|
var _entity = require("../utils/entity");
|
|
54
53
|
var _useToggle5 = _interopRequireDefault(require("../../../utils/hooks/useToggle"));
|
|
55
|
-
var _InfoBoxes = _interopRequireDefault(require("../../InfoBoxes/InfoBoxes"));
|
|
56
54
|
var _excluded = ["isValid", "fields", "isNewValueSet", "valuesChecked", "currentField", "value"];
|
|
57
55
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
58
56
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -191,31 +189,32 @@ var Entity = function Entity(_ref) {
|
|
|
191
189
|
}, [client, entity, entityData, formData, formValues, pageBuilderTemplateStatus, previousQuery, schema, shouldUpdateState]);
|
|
192
190
|
var getFullUrl = /*#__PURE__*/function () {
|
|
193
191
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
194
|
-
var query, _yield$client$query, _yield$client$query$d, _yield$client$query$d2,
|
|
192
|
+
var query, _yield$client$query, _yield$client$query$d, _yield$client$query$d2, getEntityUrl;
|
|
195
193
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
196
|
-
while (1)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
194
|
+
while (1) {
|
|
195
|
+
switch (_context.prev = _context.next) {
|
|
196
|
+
case 0:
|
|
197
|
+
query = (0, _adminUiUtils.getQuery)('GET_ENTITY_URL');
|
|
198
|
+
_context.next = 3;
|
|
199
|
+
return client.query({
|
|
200
|
+
query: query,
|
|
201
|
+
variables: {
|
|
202
|
+
itemId: entity.id,
|
|
203
|
+
itemEntity: schema.id,
|
|
204
|
+
fullUrl: true
|
|
205
|
+
},
|
|
206
|
+
fetchPolicy: 'network-only'
|
|
207
|
+
});
|
|
208
|
+
case 3:
|
|
209
|
+
_yield$client$query = _context.sent;
|
|
210
|
+
_yield$client$query$d = _yield$client$query.data;
|
|
211
|
+
_yield$client$query$d = _yield$client$query$d === void 0 ? {} : _yield$client$query$d;
|
|
212
|
+
_yield$client$query$d2 = _yield$client$query$d.getEntityUrl, getEntityUrl = _yield$client$query$d2 === void 0 ? '' : _yield$client$query$d2;
|
|
213
|
+
return _context.abrupt("return", getEntityUrl);
|
|
214
|
+
case 8:
|
|
215
|
+
case "end":
|
|
216
|
+
return _context.stop();
|
|
217
|
+
}
|
|
219
218
|
}
|
|
220
219
|
}, _callee);
|
|
221
220
|
}));
|
|
@@ -252,92 +251,94 @@ var Entity = function Entity(_ref) {
|
|
|
252
251
|
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref4) {
|
|
253
252
|
var isValid, fields, isNewValueSet, valuesChecked, currentField, fieldValue, otherProps, updatedFormValues, pageBuilderTemplateId, pageBuilder, _yield$client$query2, _yield$client$query2$, data, itemsToAdd, _fields$filter, _fields$filter2, _fields$filter2$, updatedEntity, isValidAndNewValueSet, isNotValidOrNotNewValueSet;
|
|
254
253
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
255
|
-
while (1)
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
pageBuilderTemplateId = fieldValue;
|
|
264
|
-
client.writeQuery({
|
|
265
|
-
query: (0, _adminUiUtils.getQuery)('GET_PB_TEMPLATE_STATUS'),
|
|
266
|
-
data: {
|
|
267
|
-
pageBuilderTemplateSet: !!pageBuilderTemplateId,
|
|
268
|
-
pageBuilderTemplateId: pageBuilderTemplateId
|
|
254
|
+
while (1) {
|
|
255
|
+
switch (_context2.prev = _context2.next) {
|
|
256
|
+
case 0:
|
|
257
|
+
isValid = _ref4.isValid, fields = _ref4.fields, isNewValueSet = _ref4.isNewValueSet, valuesChecked = _ref4.valuesChecked, currentField = _ref4.currentField, fieldValue = _ref4.value, otherProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
|
|
258
|
+
updatedFormValues = valuesChecked ? valuesChecked.slice() : [];
|
|
259
|
+
if (!(currentField === _constants.PAGE_BUILDER_TEMPLATE_FIELD_ID)) {
|
|
260
|
+
_context2.next = 14;
|
|
261
|
+
break;
|
|
269
262
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return formValue.id === _constants.PAGE_BUILDER_FIELD_ID;
|
|
276
|
-
});
|
|
277
|
-
if (!pageBuilderTemplateId) {
|
|
278
|
-
_context2.next = 14;
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
_context2.next = 10;
|
|
282
|
-
return client.query({
|
|
283
|
-
query: (0, _adminUiUtils.getQuery)('MERGE_PB_TEMPLATE_CHANGES'),
|
|
284
|
-
variables: {
|
|
285
|
-
parent: {
|
|
286
|
-
pageBuilder: pageBuilder[0].value,
|
|
263
|
+
pageBuilderTemplateId = fieldValue;
|
|
264
|
+
client.writeQuery({
|
|
265
|
+
query: (0, _adminUiUtils.getQuery)('GET_PB_TEMPLATE_STATUS'),
|
|
266
|
+
data: {
|
|
267
|
+
pageBuilderTemplateSet: !!pageBuilderTemplateId,
|
|
287
268
|
pageBuilderTemplateId: pageBuilderTemplateId
|
|
288
|
-
},
|
|
289
|
-
entityIdentifier: entityIdentifier
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
case 10:
|
|
293
|
-
_yield$client$query2 = _context2.sent;
|
|
294
|
-
_yield$client$query2$ = _yield$client$query2.data;
|
|
295
|
-
data = _yield$client$query2$ === void 0 ? {} : _yield$client$query2$;
|
|
296
|
-
if (data && data.mergePageBuilderTemplateChanges) {
|
|
297
|
-
updatedFormValues = updatedFormValues.map(function (updatedFormValue) {
|
|
298
|
-
if (updatedFormValue.id === _constants.PAGE_BUILDER_FIELD_ID) {
|
|
299
|
-
return _objectSpread(_objectSpread({}, updatedFormValue), {}, {
|
|
300
|
-
value: data.mergePageBuilderTemplateChanges
|
|
301
|
-
});
|
|
302
269
|
}
|
|
303
|
-
return updatedFormValue;
|
|
304
270
|
});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
271
|
+
if (componentIsMounted.current) {
|
|
272
|
+
setPageBuilderTemplateStatus(false);
|
|
273
|
+
}
|
|
274
|
+
pageBuilder = updatedFormValues.filter(function (formValue) {
|
|
275
|
+
return formValue.id === _constants.PAGE_BUILDER_FIELD_ID;
|
|
276
|
+
});
|
|
277
|
+
if (!pageBuilderTemplateId) {
|
|
278
|
+
_context2.next = 14;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
_context2.next = 10;
|
|
282
|
+
return client.query({
|
|
283
|
+
query: (0, _adminUiUtils.getQuery)('MERGE_PB_TEMPLATE_CHANGES'),
|
|
284
|
+
variables: {
|
|
285
|
+
parent: {
|
|
286
|
+
pageBuilder: pageBuilder[0].value,
|
|
287
|
+
pageBuilderTemplateId: pageBuilderTemplateId
|
|
288
|
+
},
|
|
289
|
+
entityIdentifier: entityIdentifier
|
|
315
290
|
}
|
|
316
291
|
});
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
292
|
+
case 10:
|
|
293
|
+
_yield$client$query2 = _context2.sent;
|
|
294
|
+
_yield$client$query2$ = _yield$client$query2.data;
|
|
295
|
+
data = _yield$client$query2$ === void 0 ? {} : _yield$client$query2$;
|
|
296
|
+
if (data && data.mergePageBuilderTemplateChanges) {
|
|
297
|
+
updatedFormValues = updatedFormValues.map(function (updatedFormValue) {
|
|
298
|
+
if (updatedFormValue.id === _constants.PAGE_BUILDER_FIELD_ID) {
|
|
299
|
+
return _objectSpread(_objectSpread({}, updatedFormValue), {}, {
|
|
300
|
+
value: data.mergePageBuilderTemplateChanges
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
return updatedFormValue;
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
case 14:
|
|
307
|
+
itemsToAdd = [];
|
|
308
|
+
if (formValues && formValues.length > updatedFormValues.length) {
|
|
309
|
+
[].concat((0, _toConsumableArray2["default"])(updatedFormValues), (0, _toConsumableArray2["default"])(formValues)).forEach(function (item) {
|
|
310
|
+
var index = updatedFormValues.findIndex(function (value) {
|
|
311
|
+
return value.id === item.id;
|
|
312
|
+
});
|
|
313
|
+
if (index === -1) {
|
|
314
|
+
itemsToAdd.push(item);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
_fields$filter = fields.filter(function (_ref6) {
|
|
319
|
+
var id = _ref6.id;
|
|
320
|
+
return id === 'name';
|
|
321
|
+
}), _fields$filter2 = (0, _slicedToArray2["default"])(_fields$filter, 1), _fields$filter2$ = _fields$filter2[0], updatedEntity = _fields$filter2$ === void 0 ? null : _fields$filter2$;
|
|
322
|
+
updatedEntity && setPageTitle(updatedEntity.value);
|
|
323
|
+
isValidAndNewValueSet = isValid && isNewValueSet;
|
|
324
|
+
isNotValidOrNotNewValueSet = !isValid || !isNewValueSet;
|
|
325
|
+
if (componentIsMounted.current) {
|
|
326
|
+
setIsFormValid(isValid);
|
|
327
|
+
}
|
|
328
|
+
if (isValidAndNewValueSet && componentIsMounted.current) {
|
|
329
|
+
setIsSaveButtonAvailable(true);
|
|
330
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
331
|
+
}
|
|
332
|
+
if (isNotValidOrNotNewValueSet && componentIsMounted.current) {
|
|
333
|
+
setIsSaveButtonAvailable(false);
|
|
334
|
+
}
|
|
335
|
+
if (componentIsMounted.current) {
|
|
336
|
+
setFormValues([].concat((0, _toConsumableArray2["default"])(updatedFormValues), itemsToAdd));
|
|
337
|
+
}
|
|
338
|
+
case 24:
|
|
339
|
+
case "end":
|
|
340
|
+
return _context2.stop();
|
|
341
|
+
}
|
|
341
342
|
}
|
|
342
343
|
}, _callee2);
|
|
343
344
|
}));
|
|
@@ -389,25 +390,27 @@ var Entity = function Entity(_ref) {
|
|
|
389
390
|
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
390
391
|
var id;
|
|
391
392
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
392
|
-
while (1)
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
_context3.next = 4;
|
|
399
|
-
return _actionsHandlers["default"]["delete"].submit({
|
|
400
|
-
entitySchema: entitySchema,
|
|
401
|
-
client: client,
|
|
402
|
-
parsedFormValues: {
|
|
403
|
-
id: id
|
|
393
|
+
while (1) {
|
|
394
|
+
switch (_context3.prev = _context3.next) {
|
|
395
|
+
case 0:
|
|
396
|
+
id = formData.values.id;
|
|
397
|
+
if (componentIsMounted.current) {
|
|
398
|
+
setIsSaveButtonAvailable(false);
|
|
404
399
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
400
|
+
_context3.next = 4;
|
|
401
|
+
return _actionsHandlers["default"]["delete"].submit({
|
|
402
|
+
entitySchema: entitySchema,
|
|
403
|
+
client: client,
|
|
404
|
+
parsedFormValues: {
|
|
405
|
+
id: id
|
|
406
|
+
}
|
|
407
|
+
}, addToast);
|
|
408
|
+
case 4:
|
|
409
|
+
history.push("/data-listing/".concat(entitySchema.id));
|
|
410
|
+
case 5:
|
|
411
|
+
case "end":
|
|
412
|
+
return _context3.stop();
|
|
413
|
+
}
|
|
411
414
|
}
|
|
412
415
|
}, _callee3);
|
|
413
416
|
}));
|
|
@@ -444,49 +447,51 @@ var Entity = function Entity(_ref) {
|
|
|
444
447
|
var _ref9 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_ref8) {
|
|
445
448
|
var textContent, isPublishButton, isPublished, isUnpublish, savedPageMessage;
|
|
446
449
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
447
|
-
while (1)
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
|
|
450
|
+
while (1) {
|
|
451
|
+
switch (_context4.prev = _context4.next) {
|
|
452
|
+
case 0:
|
|
453
|
+
textContent = _ref8.target.textContent;
|
|
454
|
+
isPublishButton = textContent === _constants.TEXT_CONTENT_TYPE;
|
|
455
|
+
isPublished = entityIsPublished === _constants.ENTITY_PUBLISHED;
|
|
456
|
+
isUnpublish = (0, _entity.checkFulfilConditions)(!isPublishButton, !isPublished);
|
|
457
|
+
if (!isUnpublish) {
|
|
458
|
+
_context4.next = 6;
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
return _context4.abrupt("return", addToast(_constants.UNPUBLISHED_WARNING, {
|
|
462
|
+
appearance: 'warning',
|
|
463
|
+
autoDismiss: true
|
|
464
|
+
}));
|
|
465
|
+
case 6:
|
|
466
|
+
if (!(0, _entity.checkFulfilConditions)(isPublishButton, isSaveButtonAvailable)) {
|
|
467
|
+
_context4.next = 12;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
_context4.next = 9;
|
|
471
|
+
return onSubmit();
|
|
472
|
+
case 9:
|
|
473
|
+
savedPageMessage = _context4.sent;
|
|
474
|
+
if (!(savedPageMessage === _constants.ERROR)) {
|
|
475
|
+
_context4.next = 12;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
return _context4.abrupt("return", addToast("Content not published", {
|
|
479
|
+
appearance: _constants.ERROR,
|
|
480
|
+
autoDismiss: true
|
|
481
|
+
}));
|
|
482
|
+
case 12:
|
|
483
|
+
return _context4.abrupt("return", _actionsHandlers["default"].shared.triggerPublish({
|
|
484
|
+
entityData: entityData,
|
|
485
|
+
client: client,
|
|
486
|
+
setEntityIsPublish: setEntityIsPublish,
|
|
487
|
+
entitySchema: entitySchema,
|
|
488
|
+
textContent: textContent,
|
|
489
|
+
refetchRecord: refetchRecord
|
|
490
|
+
}, addToast));
|
|
491
|
+
case 13:
|
|
492
|
+
case "end":
|
|
493
|
+
return _context4.stop();
|
|
494
|
+
}
|
|
490
495
|
}
|
|
491
496
|
}, _callee4);
|
|
492
497
|
}));
|
|
@@ -505,6 +510,21 @@ var Entity = function Entity(_ref) {
|
|
|
505
510
|
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'));
|
|
506
511
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
507
512
|
className: "page"
|
|
513
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Prompt, {
|
|
514
|
+
when: hasToDisplayPrompt,
|
|
515
|
+
message: _constants.LEAVE_PAGE_MESSAGE
|
|
516
|
+
}), showModal && /*#__PURE__*/_react["default"].createElement(_admin.DeleteAction, {
|
|
517
|
+
onClose: setModalStatus,
|
|
518
|
+
deleteAction: onDelete,
|
|
519
|
+
itemName: formData.values.name
|
|
520
|
+
}), copyModalStatus && /*#__PURE__*/_react["default"].createElement(_admin.CopyDataFromAction, {
|
|
521
|
+
onClose: handleCopyDataFromClose,
|
|
522
|
+
copyAction: onCopy,
|
|
523
|
+
getFormData: getFormData
|
|
524
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
525
|
+
className: "row row--display-row"
|
|
526
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
527
|
+
className: "column column--three-quarters"
|
|
508
528
|
}, /*#__PURE__*/_react["default"].createElement(_EntityHeader["default"], {
|
|
509
529
|
entityData: entityData,
|
|
510
530
|
entityIdentifier: entityIdentifier,
|
|
@@ -521,34 +541,10 @@ var Entity = function Entity(_ref) {
|
|
|
521
541
|
onViewUrl: onViewUrlHandler,
|
|
522
542
|
saveButtonText: saveButtonText
|
|
523
543
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
524
|
-
className: "page-wrapper__content"
|
|
525
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
526
|
-
className: "tabs-wrapper tabs-wrapper__tab"
|
|
527
|
-
}, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Prompt, {
|
|
528
|
-
when: hasToDisplayPrompt,
|
|
529
|
-
message: _constants.LEAVE_PAGE_MESSAGE
|
|
530
|
-
}), showModal && /*#__PURE__*/_react["default"].createElement(_admin.DeleteAction, {
|
|
531
|
-
onClose: setModalStatus,
|
|
532
|
-
deleteAction: onDelete,
|
|
533
|
-
itemName: formData.values.name
|
|
534
|
-
}), copyModalStatus && /*#__PURE__*/_react["default"].createElement(_admin.CopyDataFromAction, {
|
|
535
|
-
onClose: handleCopyDataFromClose,
|
|
536
|
-
copyAction: onCopy,
|
|
537
|
-
getFormData: getFormData
|
|
538
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
539
|
-
className: "page__content--fixed"
|
|
540
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
541
544
|
className: "page__content"
|
|
542
545
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
543
546
|
className: "content"
|
|
544
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
545
|
-
hookKey: "entity:".concat(action, ":main:top"),
|
|
546
|
-
entity: entity,
|
|
547
|
-
schema: schema
|
|
548
|
-
}), /*#__PURE__*/_react["default"].createElement(_InfoBoxes["default"], {
|
|
549
|
-
id: entity.id,
|
|
550
|
-
schema: schema
|
|
551
|
-
}), /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
547
|
+
}, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
552
548
|
enabled: showPageBuilderTabs,
|
|
553
549
|
onTabChange: function onTabChange(tabId) {
|
|
554
550
|
client.writeQuery({
|
|
@@ -569,8 +565,8 @@ var Entity = function Entity(_ref) {
|
|
|
569
565
|
updateCopyData: updateCopyData,
|
|
570
566
|
formValues: formValues,
|
|
571
567
|
isNewEntity: isNewEntity
|
|
572
|
-
})))))
|
|
573
|
-
className: "column column--one-third
|
|
568
|
+
}))))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
569
|
+
className: "column column--one-third"
|
|
574
570
|
}, showSideBarRelations && /*#__PURE__*/_react["default"].createElement(_SideBarRelations["default"], {
|
|
575
571
|
entity: entity,
|
|
576
572
|
formData: formData.values,
|