@blaze-cms/plugin-data-ui 0.127.0 → 0.127.3
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 +8 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +4 -4
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +166 -172
- 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 +26 -28
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +77 -83
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +31 -33
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +43 -45
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +65 -69
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +10 -12
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +62 -66
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +121 -129
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +17 -19
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/index.js +56 -60
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +25 -27
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
- 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.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/shared/publish.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -1
- 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/query.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/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.map +1 -1
- 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/get-default-query-params.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/lib-es/utils/hooks/useToggle.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.3](https://github.com/thebyte9/blaze/compare/v0.127.2...v0.127.3) (2023-03-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @blaze-cms/plugin-data-ui
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [0.127.0](https://github.com/thebyte9/blaze/compare/v0.126.1...v0.127.0) (2023-02-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @blaze-cms/plugin-data-ui
|
|
@@ -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$data2 = _useQuery$data === void 0 ? {} : _useQuery$data,
|
|
46
|
+
_useQuery$data2$getEn = _useQuery$data2.getEntitySchemas,
|
|
47
|
+
getEntitySchemas = _useQuery$data2$getEn === void 0 ? [] : _useQuery$data2$getEn;
|
|
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,
|
|
1
|
+
{"version":3,"file":"EntityDataListing.js","names":["_client","require","_react","_interopRequireDefault","_propTypes","_adminUiUtils","_ListingTable","_withContext","EntityDataListing","_ref","match","menuItems","identifier","params","entityIdentifier","_menuItems$map$filter","map","_ref2","_ref3","_slicedToArray2","_","items","item","filter","_ref4","uri","endsWith","concat","length","Boolean","_menuItems$map$filter2","_menuItems$map$filter3","selectedMenuItem","_useQuery","useQuery","getQuery","variables","_useQuery$data","data","_useQuery$data2","_useQuery$data2$getEn","getEntitySchemas","createElement","entitySchema","propTypes","PropTypes","object","isRequired","array","_default","withContext","exports"],"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,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAEA,IAAMO,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAA6B;EAAA,IAAvBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;EAC3C,IAC8BC,UAAU,GACpCF,KAAK,CADPG,MAAM,CAAIC,gBAAgB;EAG5B,IAAAC,qBAAA,GAA6BJ,SAAS,CACnCK,GAAG,CAAC,UAAAC,KAAA,EAAoB;MAAA,IAAAC,KAAA,OAAAC,eAAA,aAAAF,KAAA;QAAlBG,CAAC,GAAAF,KAAA;QAAIG,KAAK,GAAAH,KAAA,IAALG,KAAK;MACf,IAAMC,IAAI,GAAGD,KAAK,CAACE,MAAM,CAAC,UAAAC,KAAA;QAAA,IAAGC,GAAG,GAAAD,KAAA,CAAHC,GAAG;QAAA,OAAOA,GAAG,CAACC,QAAQ,KAAAC,MAAA,CAAKf,UAAU,EAAG;MAAA,EAAC;MAEtE,OAAOU,IAAI,CAACM,MAAM,GAAGN,IAAI,GAAG,IAAI;IAClC,CAAC,CAAC,CACDC,MAAM,CAACM,OAAO,CAAC;IAAAC,sBAAA,OAAAX,eAAA,aAAAJ,qBAAA;IAAAgB,sBAAA,OAAAZ,eAAA,aAAAW,sBAAA;IANVE,gBAAgB,GAAAD,sBAAA;EAQxB,IAAAE,SAAA,GAAiD,IAAAC,gBAAQ,EAAC,IAAAC,sBAAQ,EAAC,mBAAmB,CAAC,EAAE;MACvFC,SAAS,EAAE;QAAExB,UAAU,EAAVA;MAAW;IAC1B,CAAC,CAAC;IAAAyB,cAAA,GAAAJ,SAAA,CAFMK,IAAI;IAAAC,eAAA,GAAAF,cAAA,cAA8B,CAAC,CAAC,GAAAA,cAAA;IAAAG,qBAAA,GAAAD,eAAA,CAA5BE,gBAAgB;IAAhBA,gBAAgB,GAAAD,qBAAA,cAAG,EAAE,GAAAA,qBAAA;EAIrC,IAAI,CAACC,gBAAgB,CAACb,MAAM,EAAE,OAAO,EAAE;EAEvC,oBAAO1B,MAAA,YAAAwC,aAAA,CAACpC,aAAA,WAAY;IAACqC,YAAY,EAAEF,gBAAgB,CAAC,CAAC,CAAE;IAACT,gBAAgB,EAAEA;EAAiB,EAAG;AAChG,CAAC;AAEDxB,iBAAiB,CAACoC,SAAS,GAAG;EAC5BlC,KAAK,EAAEmC,qBAAS,CAACC,MAAM,CAACC,UAAU;EAClCpC,SAAS,EAAEkC,qBAAS,CAACG,KAAK,CAACD;AAC7B,CAAC;AAAC,IAAAE,QAAA,GAEa,IAAAC,wBAAW,EAAC1C,iBAAiB,CAAC;AAAA2C,OAAA,cAAAF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["EntityDataListing"],"sources":["../../../src/components/EntityDataListing/index.js"],"sourcesContent":["import EntityDataListing from './EntityDataListing';\n\nexport default EntityDataListing;\n"],"mappings":";;;;;;;;AAAA;AAAoD,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_EntityDataListing","_interopRequireDefault","require","_default","EntityDataListing","exports"],"sources":["../../../src/components/EntityDataListing/index.js"],"sourcesContent":["import EntityDataListing from './EntityDataListing';\n\nexport default EntityDataListing;\n"],"mappings":";;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoD,IAAAC,QAAA,GAErCC,6BAAiB;AAAAC,OAAA,cAAAF,QAAA"}
|
|
@@ -52,6 +52,7 @@ var _EntityHeader = _interopRequireDefault(require("./EntityHeader"));
|
|
|
52
52
|
var _entity = require("../utils/entity");
|
|
53
53
|
var _useToggle5 = _interopRequireDefault(require("../../../utils/hooks/useToggle"));
|
|
54
54
|
var _excluded = ["isValid", "fields", "isNewValueSet", "valuesChecked", "currentField", "value"];
|
|
55
|
+
/* eslint-disable no-undef */
|
|
55
56
|
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); }
|
|
56
57
|
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; }
|
|
57
58
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -189,32 +190,31 @@ var Entity = function Entity(_ref) {
|
|
|
189
190
|
}, [client, entity, entityData, formData, formValues, pageBuilderTemplateStatus, previousQuery, schema, shouldUpdateState]);
|
|
190
191
|
var getFullUrl = /*#__PURE__*/function () {
|
|
191
192
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
192
|
-
var query, _yield$client$query, _yield$client$query$d, _yield$client$query$d2, getEntityUrl;
|
|
193
|
+
var query, _yield$client$query, _yield$client$query$d, _yield$client$query$d2, _yield$client$query$d3, getEntityUrl;
|
|
193
194
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
194
|
-
while (1) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
195
|
+
while (1) 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$d2 = _yield$client$query$d === void 0 ? {} : _yield$client$query$d;
|
|
212
|
+
_yield$client$query$d3 = _yield$client$query$d2.getEntityUrl;
|
|
213
|
+
getEntityUrl = _yield$client$query$d3 === void 0 ? '' : _yield$client$query$d3;
|
|
214
|
+
return _context.abrupt("return", getEntityUrl);
|
|
215
|
+
case 9:
|
|
216
|
+
case "end":
|
|
217
|
+
return _context.stop();
|
|
218
218
|
}
|
|
219
219
|
}, _callee);
|
|
220
220
|
}));
|
|
@@ -251,94 +251,92 @@ var Entity = function Entity(_ref) {
|
|
|
251
251
|
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref4) {
|
|
252
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;
|
|
253
253
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
254
|
-
while (1) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
254
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
255
|
+
case 0:
|
|
256
|
+
isValid = _ref4.isValid, fields = _ref4.fields, isNewValueSet = _ref4.isNewValueSet, valuesChecked = _ref4.valuesChecked, currentField = _ref4.currentField, fieldValue = _ref4.value, otherProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
|
|
257
|
+
updatedFormValues = valuesChecked ? valuesChecked.slice() : [];
|
|
258
|
+
if (!(currentField === _constants.PAGE_BUILDER_TEMPLATE_FIELD_ID)) {
|
|
259
|
+
_context2.next = 14;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
pageBuilderTemplateId = fieldValue;
|
|
263
|
+
client.writeQuery({
|
|
264
|
+
query: (0, _adminUiUtils.getQuery)('GET_PB_TEMPLATE_STATUS'),
|
|
265
|
+
data: {
|
|
266
|
+
pageBuilderTemplateSet: !!pageBuilderTemplateId,
|
|
267
|
+
pageBuilderTemplateId: pageBuilderTemplateId
|
|
262
268
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
});
|
|
270
|
+
if (componentIsMounted.current) {
|
|
271
|
+
setPageBuilderTemplateStatus(false);
|
|
272
|
+
}
|
|
273
|
+
pageBuilder = updatedFormValues.filter(function (formValue) {
|
|
274
|
+
return formValue.id === _constants.PAGE_BUILDER_FIELD_ID;
|
|
275
|
+
});
|
|
276
|
+
if (!pageBuilderTemplateId) {
|
|
277
|
+
_context2.next = 14;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
_context2.next = 10;
|
|
281
|
+
return client.query({
|
|
282
|
+
query: (0, _adminUiUtils.getQuery)('MERGE_PB_TEMPLATE_CHANGES'),
|
|
283
|
+
variables: {
|
|
284
|
+
parent: {
|
|
285
|
+
pageBuilder: pageBuilder[0].value,
|
|
268
286
|
pageBuilderTemplateId: pageBuilderTemplateId
|
|
269
|
-
}
|
|
270
|
-
|
|
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;
|
|
287
|
+
},
|
|
288
|
+
entityIdentifier: entityIdentifier
|
|
280
289
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
});
|
|
291
|
+
case 10:
|
|
292
|
+
_yield$client$query2 = _context2.sent;
|
|
293
|
+
_yield$client$query2$ = _yield$client$query2.data;
|
|
294
|
+
data = _yield$client$query2$ === void 0 ? {} : _yield$client$query2$;
|
|
295
|
+
if (data && data.mergePageBuilderTemplateChanges) {
|
|
296
|
+
updatedFormValues = updatedFormValues.map(function (updatedFormValue) {
|
|
297
|
+
if (updatedFormValue.id === _constants.PAGE_BUILDER_FIELD_ID) {
|
|
298
|
+
return _objectSpread(_objectSpread({}, updatedFormValue), {}, {
|
|
299
|
+
value: data.mergePageBuilderTemplateChanges
|
|
300
|
+
});
|
|
290
301
|
}
|
|
302
|
+
return updatedFormValue;
|
|
291
303
|
});
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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
|
-
}
|
|
304
|
+
}
|
|
305
|
+
case 14:
|
|
306
|
+
itemsToAdd = [];
|
|
307
|
+
if (formValues && formValues.length > updatedFormValues.length) {
|
|
308
|
+
[].concat((0, _toConsumableArray2["default"])(updatedFormValues), (0, _toConsumableArray2["default"])(formValues)).forEach(function (item) {
|
|
309
|
+
var index = updatedFormValues.findIndex(function (value) {
|
|
310
|
+
return value.id === item.id;
|
|
316
311
|
});
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
312
|
+
if (index === -1) {
|
|
313
|
+
itemsToAdd.push(item);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
_fields$filter = fields.filter(function (_ref6) {
|
|
318
|
+
var id = _ref6.id;
|
|
319
|
+
return id === 'name';
|
|
320
|
+
}), _fields$filter2 = (0, _slicedToArray2["default"])(_fields$filter, 1), _fields$filter2$ = _fields$filter2[0], updatedEntity = _fields$filter2$ === void 0 ? null : _fields$filter2$;
|
|
321
|
+
updatedEntity && setPageTitle(updatedEntity.value);
|
|
322
|
+
isValidAndNewValueSet = isValid && isNewValueSet;
|
|
323
|
+
isNotValidOrNotNewValueSet = !isValid || !isNewValueSet;
|
|
324
|
+
if (componentIsMounted.current) {
|
|
325
|
+
setIsFormValid(isValid);
|
|
326
|
+
}
|
|
327
|
+
if (isValidAndNewValueSet && componentIsMounted.current) {
|
|
328
|
+
setIsSaveButtonAvailable(true);
|
|
329
|
+
setSaveButtonText(_constants.SAVE_BUTTON_TEXTS.save);
|
|
330
|
+
}
|
|
331
|
+
if (isNotValidOrNotNewValueSet && componentIsMounted.current) {
|
|
332
|
+
setIsSaveButtonAvailable(false);
|
|
333
|
+
}
|
|
334
|
+
if (componentIsMounted.current) {
|
|
335
|
+
setFormValues([].concat((0, _toConsumableArray2["default"])(updatedFormValues), itemsToAdd));
|
|
336
|
+
}
|
|
337
|
+
case 24:
|
|
338
|
+
case "end":
|
|
339
|
+
return _context2.stop();
|
|
342
340
|
}
|
|
343
341
|
}, _callee2);
|
|
344
342
|
}));
|
|
@@ -390,27 +388,25 @@ var Entity = function Entity(_ref) {
|
|
|
390
388
|
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
391
389
|
var id;
|
|
392
390
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
393
|
-
while (1) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
391
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
392
|
+
case 0:
|
|
393
|
+
id = formData.values.id;
|
|
394
|
+
if (componentIsMounted.current) {
|
|
395
|
+
setIsSaveButtonAvailable(false);
|
|
396
|
+
}
|
|
397
|
+
_context3.next = 4;
|
|
398
|
+
return _actionsHandlers["default"]["delete"].submit({
|
|
399
|
+
entitySchema: entitySchema,
|
|
400
|
+
client: client,
|
|
401
|
+
parsedFormValues: {
|
|
402
|
+
id: id
|
|
399
403
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
}
|
|
404
|
+
}, addToast);
|
|
405
|
+
case 4:
|
|
406
|
+
history.push("/data-listing/".concat(entitySchema.id));
|
|
407
|
+
case 5:
|
|
408
|
+
case "end":
|
|
409
|
+
return _context3.stop();
|
|
414
410
|
}
|
|
415
411
|
}, _callee3);
|
|
416
412
|
}));
|
|
@@ -447,51 +443,49 @@ var Entity = function Entity(_ref) {
|
|
|
447
443
|
var _ref9 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_ref8) {
|
|
448
444
|
var textContent, isPublishButton, isPublished, isUnpublish, savedPageMessage;
|
|
449
445
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
450
|
-
while (1) {
|
|
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
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
return _context4.stop();
|
|
494
|
-
}
|
|
446
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
447
|
+
case 0:
|
|
448
|
+
textContent = _ref8.target.textContent;
|
|
449
|
+
isPublishButton = textContent === _constants.TEXT_CONTENT_TYPE;
|
|
450
|
+
isPublished = entityIsPublished === _constants.ENTITY_PUBLISHED;
|
|
451
|
+
isUnpublish = (0, _entity.checkFulfilConditions)(!isPublishButton, !isPublished);
|
|
452
|
+
if (!isUnpublish) {
|
|
453
|
+
_context4.next = 6;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
return _context4.abrupt("return", addToast(_constants.UNPUBLISHED_WARNING, {
|
|
457
|
+
appearance: 'warning',
|
|
458
|
+
autoDismiss: true
|
|
459
|
+
}));
|
|
460
|
+
case 6:
|
|
461
|
+
if (!(0, _entity.checkFulfilConditions)(isPublishButton, isSaveButtonAvailable)) {
|
|
462
|
+
_context4.next = 12;
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
_context4.next = 9;
|
|
466
|
+
return onSubmit();
|
|
467
|
+
case 9:
|
|
468
|
+
savedPageMessage = _context4.sent;
|
|
469
|
+
if (!(savedPageMessage === _constants.ERROR)) {
|
|
470
|
+
_context4.next = 12;
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
return _context4.abrupt("return", addToast("Content not published", {
|
|
474
|
+
appearance: _constants.ERROR,
|
|
475
|
+
autoDismiss: true
|
|
476
|
+
}));
|
|
477
|
+
case 12:
|
|
478
|
+
return _context4.abrupt("return", _actionsHandlers["default"].shared.triggerPublish({
|
|
479
|
+
entityData: entityData,
|
|
480
|
+
client: client,
|
|
481
|
+
setEntityIsPublish: setEntityIsPublish,
|
|
482
|
+
entitySchema: entitySchema,
|
|
483
|
+
textContent: textContent,
|
|
484
|
+
refetchRecord: refetchRecord
|
|
485
|
+
}, addToast));
|
|
486
|
+
case 13:
|
|
487
|
+
case "end":
|
|
488
|
+
return _context4.stop();
|
|
495
489
|
}
|
|
496
490
|
}, _callee4);
|
|
497
491
|
}));
|