@blaze-cms/plugin-data-ui 0.146.0-alpha.52 → 0.146.0-alpha.57

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +36 -0
  3. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +1 -0
  4. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
  5. package/lib/components/EntityManager/Entity/Entity.js +71 -72
  6. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  7. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +11 -11
  8. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  9. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -0
  10. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  11. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +30 -28
  12. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  13. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +13 -13
  14. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  15. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +13 -13
  16. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  17. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +16 -16
  18. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  19. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +12 -12
  20. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  21. package/lib/components/EntityManager/EntityManager.js +25 -26
  22. package/lib/components/EntityManager/EntityManager.js.map +1 -1
  23. package/lib/components/EntityManager/utils/entity.js +5 -5
  24. package/lib/components/EntityManager/utils/entity.js.map +1 -1
  25. package/lib/components/EntityManager/utils/entityAvailableActions.js +16 -16
  26. package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  27. package/lib/components/InfoBoxes/InfoBoxes.js +1 -0
  28. package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
  29. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +1 -2
  30. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
  31. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
  32. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  33. package/lib/components/ListingTable/ListingTable.js +52 -45
  34. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  35. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  36. package/lib/components/ListingTable/SearchFilter/SearchContainer.js +312 -0
  37. package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
  38. package/lib/components/ListingTable/SearchFilter/SearchFilter.js +58 -0
  39. package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
  40. package/lib/components/ListingTable/SearchFilter/helpers.js +128 -0
  41. package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -0
  42. package/lib/components/ListingTable/SearchFilter/querys.js +13 -0
  43. package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -0
  44. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  45. package/lib/components/ListingTable/service/index.js +11 -10
  46. package/lib/components/ListingTable/service/index.js.map +1 -1
  47. package/lib/components/Tabs/index.js +1 -2
  48. package/lib/components/Tabs/index.js.map +1 -1
  49. package/lib/constants.js +3 -1
  50. package/lib/constants.js.map +1 -1
  51. package/lib/index.js +10 -11
  52. package/lib/index.js.map +1 -1
  53. package/lib/utils/add-content-menu-items.js +7 -7
  54. package/lib/utils/add-content-menu-items.js.map +1 -1
  55. package/lib/utils/build-listing-query.js +4 -4
  56. package/lib/utils/build-listing-query.js.map +1 -1
  57. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  58. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  59. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  60. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  61. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
  62. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +2 -1
  63. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  64. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
  65. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  66. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  67. package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
  68. package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
  69. package/lib-es/components/EntityManager/utils/query.js.map +1 -1
  70. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
  71. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  72. package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
  73. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  74. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
  75. package/lib-es/components/ListingTable/ListingTable.js +10 -2
  76. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  77. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  78. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +207 -0
  79. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
  80. package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +40 -0
  81. package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
  82. package/lib-es/components/ListingTable/SearchFilter/helpers.js +96 -0
  83. package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -0
  84. package/lib-es/components/ListingTable/SearchFilter/querys.js +8 -0
  85. package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -0
  86. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  87. package/lib-es/components/ListingTable/service/index.js +3 -2
  88. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  89. package/lib-es/constants.js +3 -1
  90. package/lib-es/constants.js.map +1 -1
  91. package/lib-es/index.js +2 -2
  92. package/lib-es/index.js.map +1 -1
  93. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  94. package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
  95. package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
  96. package/lib-es/utils/build-listing-query.js +4 -4
  97. package/lib-es/utils/build-listing-query.js.map +1 -1
  98. package/lib-es/utils/build-update-data-query.js.map +1 -1
  99. package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  100. package/package.json +5 -5
  101. package/src/components/EntityManager/Entity/SideBarRelations/index.js +6 -0
  102. package/src/components/ListingTable/ListingTable.js +10 -1
  103. package/src/components/ListingTable/SearchFilter/SearchContainer.js +243 -0
  104. package/src/components/ListingTable/SearchFilter/SearchFilter.js +38 -0
  105. package/src/components/ListingTable/SearchFilter/helpers.js +99 -0
  106. package/src/components/ListingTable/SearchFilter/querys.js +9 -0
  107. package/src/components/ListingTable/service/index.js +2 -2
  108. package/src/constants.js +7 -1
  109. package/src/utils/build-listing-query.js +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
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.146.0-alpha.57](https://github.com/thebyte9/blaze/compare/v0.146.0-alpha.56...v0.146.0-alpha.57) (2025-07-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * admin listing search filter fixes ([#4827](https://github.com/thebyte9/blaze/issues/4827)) ([8f72d2c](https://github.com/thebyte9/blaze/commit/8f72d2c4e9bb1fa585e20dc899fae6120a3d644e))
12
+ * revert save text change ([#4833](https://github.com/thebyte9/blaze/issues/4833)) ([2cfc73b](https://github.com/thebyte9/blaze/commit/2cfc73bfc06dac1dc682f696ca30f932ac79e42b))
13
+
14
+
15
+ ### Features
16
+
17
+ * query for getting the audit details in dynamic properties ([#3287](https://github.com/thebyte9/blaze/issues/3287)) ([39d889b](https://github.com/thebyte9/blaze/commit/39d889b18a6c6b8bc43ae1a5fddb4d19751cf159))
18
+
19
+
20
+
21
+
22
+
23
+ # [0.146.0-alpha.56](https://github.com/thebyte9/blaze/compare/v0.146.0-alpha.55...v0.146.0-alpha.56) (2025-07-09)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * get index from source data ([64425ec](https://github.com/thebyte9/blaze/commit/64425ec1b9e69385b45659f4b941631ae4c8b871))
29
+
30
+
31
+ ### Features
32
+
33
+ * add admin listing filters based on schema settings ([#4797](https://github.com/thebyte9/blaze/issues/4797)) ([84b3109](https://github.com/thebyte9/blaze/commit/84b310900222a60050e3cf32928ab62a12a99b8d))
34
+
35
+
36
+
37
+
38
+
6
39
  # [0.146.0-alpha.52](https://github.com/thebyte9/blaze/compare/v0.146.0-alpha.51...v0.146.0-alpha.52) (2025-06-12)
7
40
 
8
41
  **Note:** Version bump only for package @blaze-cms/plugin-data-ui
package/README.md CHANGED
@@ -31,6 +31,12 @@ The `displayProperties` property can be set on entity schema in the api to provi
31
31
  "firstname": {
32
32
  "_exists": false
33
33
  }
34
+ },
35
+ "adminListings": {
36
+ "dataSource": {
37
+ "source": "search",
38
+ "index": "admin"
39
+ }
34
40
  }
35
41
  }
36
42
  ```
@@ -40,7 +46,37 @@ The `displayProperties` property can be set on entity schema in the api to provi
40
46
  - adminHeader: properties to build admin header
41
47
  - adminMainInfoProperty: indicates a property that returns data to be displayed in the admin edit sidebar. Data is returned is formatted with the [data/info-properties](#Info properties) definition
42
48
  - disableDefaultAdminInfo: boolean value that can be used to hide default sidebar values updated/created
49
+ - adminListings.dataSource:
50
+ -- adminListings.dataSource.source: indicates whether to get listing data from search queries instead of direct entity queries.
51
+ -- adminListings.dataSource.index: which index to search. This changes the query used e.g. searchAdmin
43
52
 
53
+ ### Listing filters
54
+ You can add the following to an entity properties/dynamicProperties to have them generate filters that appear at the top of admin record listings.
55
+ ```json
56
+ // this will be represented as a select
57
+ "relationKeyId": {
58
+ "type": "string",
59
+ "label": "Related records",
60
+ "searchable": true,
61
+ "showInForm": true,
62
+ "formFieldType": "relation",
63
+ "adminListingOptions": {
64
+ "filterType": "select"
65
+ }
66
+ },
67
+
68
+ // will include this property in a keyword search
69
+ "name": {
70
+ "type": "string",
71
+ "label": "Name",
72
+ "searchable": true,
73
+ "adminListingOptions": {
74
+ "includeInKeywordSeach": true
75
+ }
76
+ }
77
+ ```
78
+ - `filterType: "select"`: This will get relevant options and display them in a select. If the property is relation data the select will be populated with the `name` property from the related records
79
+ - `includeInKeywordSeach`: This property will be included in a keyword search
44
80
 
45
81
  ### Info properties
46
82
 
@@ -9,6 +9,7 @@ exports["default"] = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  require("core-js/modules/es.array.map.js");
11
11
  require("core-js/modules/es.object.entries.js");
12
+ require("core-js/modules/es.object.to-string.js");
12
13
  require("core-js/modules/es.string.starts-with.js");
13
14
  var _reactRouterDom = require("react-router-dom");
14
15
  var _react = _interopRequireDefault(require("react"));
@@ -1 +1 @@
1
- {"version":3,"file":"EntityNavLinks.js","names":["_reactRouterDom","require","_react","_interopRequireDefault","EntityNavLinks","_ref","schema","adminSectionNavigation","displayProperties","links","Object","entries","map","_ref2","_ref3","_slicedToArray2","k","v","label","uri","Wrapper","startsWith","Link","createElement","className","href","to","_default","exports"],"sources":["../../../../../src/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js"],"sourcesContent":["import { Link } from 'react-router-dom';\nimport React from 'react';\n\nconst EntityNavLinks = ({ schema }) => {\n if (!schema) return null;\n\n const {\n displayProperties: { adminSectionNavigation }\n } = schema;\n\n if (!adminSectionNavigation) return null;\n\n const links = Object.entries(adminSectionNavigation).map(([k, v]) => {\n const { label, uri } = v;\n const Wrapper = uri.startsWith('#') ? 'a' : Link;\n\n return (\n <Wrapper className=\"entity-section-link\" href={uri} to={uri}>\n {label}\n </Wrapper>\n );\n });\n\n return <div className=\"entity-section-links\">{links}</div>;\n};\n\nexport default EntityNavLinks;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAMG,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAAmB;EAAA,IAAbC,MAAM,GAAAD,IAAA,CAANC,MAAM;EAC9B,IAAI,CAACA,MAAM,EAAE,OAAO,IAAI;EAExB,IACuBC,sBAAsB,GACzCD,MAAM,CADRE,iBAAiB,CAAID,sBAAsB;EAG7C,IAAI,CAACA,sBAAsB,EAAE,OAAO,IAAI;EAExC,IAAME,KAAK,GAAGC,MAAM,CAACC,OAAO,CAACJ,sBAAsB,CAAC,CAACK,GAAG,CAAC,UAAAC,KAAA,EAAY;IAAA,IAAAC,KAAA,OAAAC,eAAA,aAAAF,KAAA;MAAVG,CAAC,GAAAF,KAAA;MAAEG,CAAC,GAAAH,KAAA;IAC7D,IAAQI,KAAK,GAAUD,CAAC,CAAhBC,KAAK;MAAEC,GAAG,GAAKF,CAAC,CAATE,GAAG;IAClB,IAAMC,OAAO,GAAGD,GAAG,CAACE,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG,GAAGC,oBAAI;IAEhD,oBACEpB,MAAA,YAAAqB,aAAA,CAACH,OAAO;MAACI,SAAS,EAAC,qBAAqB;MAACC,IAAI,EAAEN,GAAI;MAACO,EAAE,EAAEP;IAAI,GACzDD,KACM,CAAC;EAEd,CAAC,CAAC;EAEF,oBAAOhB,MAAA,YAAAqB,aAAA;IAAKC,SAAS,EAAC;EAAsB,GAAEf,KAAW,CAAC;AAC5D,CAAC;AAAC,IAAAkB,QAAA,GAAAC,OAAA,cAEaxB,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"EntityNavLinks.js","names":["_reactRouterDom","require","_react","_interopRequireDefault","EntityNavLinks","_ref","schema","adminSectionNavigation","displayProperties","links","Object","entries","map","_ref2","_ref3","_slicedToArray2","k","v","label","uri","Wrapper","startsWith","Link","createElement","className","href","to","_default","exports"],"sources":["../../../../../src/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js"],"sourcesContent":["import { Link } from 'react-router-dom';\nimport React from 'react';\n\nconst EntityNavLinks = ({ schema }) => {\n if (!schema) return null;\n\n const {\n displayProperties: { adminSectionNavigation }\n } = schema;\n\n if (!adminSectionNavigation) return null;\n\n const links = Object.entries(adminSectionNavigation).map(([k, v]) => {\n const { label, uri } = v;\n const Wrapper = uri.startsWith('#') ? 'a' : Link;\n\n return (\n <Wrapper className=\"entity-section-link\" href={uri} to={uri}>\n {label}\n </Wrapper>\n );\n });\n\n return <div className=\"entity-section-links\">{links}</div>;\n};\n\nexport default EntityNavLinks;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAMG,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAAmB;EAAA,IAAbC,MAAM,GAAAD,IAAA,CAANC,MAAM;EAC9B,IAAI,CAACA,MAAM,EAAE,OAAO,IAAI;EAExB,IACuBC,sBAAsB,GACzCD,MAAM,CADRE,iBAAiB,CAAID,sBAAsB;EAG7C,IAAI,CAACA,sBAAsB,EAAE,OAAO,IAAI;EAExC,IAAME,KAAK,GAAGC,MAAM,CAACC,OAAO,CAACJ,sBAAsB,CAAC,CAACK,GAAG,CAAC,UAAAC,KAAA,EAAY;IAAA,IAAAC,KAAA,OAAAC,eAAA,aAAAF,KAAA;MAAVG,CAAC,GAAAF,KAAA;MAAEG,CAAC,GAAAH,KAAA;IAC7D,IAAQI,KAAK,GAAUD,CAAC,CAAhBC,KAAK;MAAEC,GAAG,GAAKF,CAAC,CAATE,GAAG;IAClB,IAAMC,OAAO,GAAGD,GAAG,CAACE,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG,GAAGC,oBAAI;IAEhD,oBACEpB,MAAA,YAAAqB,aAAA,CAACH,OAAO;MAACI,SAAS,EAAC,qBAAqB;MAACC,IAAI,EAAEN,GAAI;MAACO,EAAE,EAAEP;IAAI,GACzDD,KACM,CAAC;EAEd,CAAC,CAAC;EAEF,oBAAOhB,MAAA,YAAAqB,aAAA;IAAKC,SAAS,EAAC;EAAsB,GAAEf,KAAW,CAAC;AAC5D,CAAC;AAAC,IAAAkB,QAAA,GAAAC,OAAA,cAEaxB,cAAc","ignoreList":[]}
@@ -57,8 +57,7 @@ var _InfoBoxes = _interopRequireDefault(require("../../InfoBoxes/InfoBoxes"));
57
57
  var _RecordEditContext = require("../utils/RecordEditContext");
58
58
  var _excluded = ["isValid", "fields", "isNewValueSet", "valuesChecked", "currentField", "value"];
59
59
  /* eslint-disable no-undef */
60
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
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; }
60
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
62
61
  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
62
  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; }
64
63
  var Entity = function Entity(_ref) {
@@ -88,29 +87,29 @@ var Entity = function Entity(_ref) {
88
87
  entityData = _useState8[0],
89
88
  setEntityData = _useState8[1];
90
89
  var _useState9 = (0, _react.useState)(null),
91
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
92
- entityIdentifier = _useState10[0],
93
- setEntityIdentifier = _useState10[1];
94
- var _useState11 = (0, _react.useState)(''),
90
+ _useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
91
+ entityIdentifier = _useState0[0],
92
+ setEntityIdentifier = _useState0[1];
93
+ var _useState1 = (0, _react.useState)(''),
94
+ _useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
95
+ pageTitle = _useState10[0],
96
+ setPageTitle = _useState10[1];
97
+ var _useState11 = (0, _react.useState)(false),
95
98
  _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
96
- pageTitle = _useState12[0],
97
- setPageTitle = _useState12[1];
98
- var _useState13 = (0, _react.useState)(false),
99
+ isSaveButtonAvailable = _useState12[0],
100
+ setIsSaveButtonAvailable = _useState12[1];
101
+ var _useState13 = (0, _react.useState)(formData && formData.values && formData.values.status),
99
102
  _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
100
- isSaveButtonAvailable = _useState14[0],
101
- setIsSaveButtonAvailable = _useState14[1];
102
- var _useState15 = (0, _react.useState)(formData && formData.values && formData.values.status),
103
+ entityIsPublished = _useState14[0],
104
+ setEntityIsPublish = _useState14[1];
105
+ var _useState15 = (0, _react.useState)(false),
103
106
  _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
104
- entityIsPublished = _useState16[0],
105
- setEntityIsPublish = _useState16[1];
107
+ isEnablePublishButton = _useState16[0],
108
+ setEnablePublishButton = _useState16[1];
106
109
  var _useState17 = (0, _react.useState)(false),
107
110
  _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];
111
+ isEnablePreviewButton = _useState18[0],
112
+ setEnablePreviewButton = _useState18[1];
114
113
  var _useToggle = (0, _useToggle5["default"])(false),
115
114
  _useToggle2 = (0, _slicedToArray2["default"])(_useToggle, 2),
116
115
  modalStatus = _useToggle2[0],
@@ -119,39 +118,39 @@ var Entity = function Entity(_ref) {
119
118
  _useToggle4 = (0, _slicedToArray2["default"])(_useToggle3, 2),
120
119
  copyModalStatus = _useToggle4[0],
121
120
  setCopyModalStatus = _useToggle4[1];
122
- var _useState21 = (0, _react.useState)(true),
121
+ var _useState19 = (0, _react.useState)(true),
122
+ _useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
123
+ pageBuilderTemplateStatus = _useState20[0],
124
+ setPageBuilderTemplateStatus = _useState20[1];
125
+ var _useState21 = (0, _react.useState)(false),
123
126
  _useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
124
- pageBuilderTemplateStatus = _useState22[0],
125
- setPageBuilderTemplateStatus = _useState22[1];
127
+ shouldCopyData = _useState22[0],
128
+ setShouldCopyData = _useState22[1];
126
129
  var _useState23 = (0, _react.useState)(false),
127
130
  _useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
128
- shouldCopyData = _useState24[0],
129
- setShouldCopyData = _useState24[1];
130
- var _useState25 = (0, _react.useState)(false),
131
+ isFormValid = _useState24[0],
132
+ setIsFormValid = _useState24[1];
133
+ var _useState25 = (0, _react.useState)(null),
131
134
  _useState26 = (0, _slicedToArray2["default"])(_useState25, 2),
132
- isFormValid = _useState26[0],
133
- setIsFormValid = _useState26[1];
135
+ formDataFromCopy = _useState26[0],
136
+ setFormDataFromCopy = _useState26[1];
134
137
  var _useState27 = (0, _react.useState)(null),
135
138
  _useState28 = (0, _slicedToArray2["default"])(_useState27, 2),
136
- formDataFromCopy = _useState28[0],
137
- setFormDataFromCopy = _useState28[1];
138
- var _useState29 = (0, _react.useState)(null),
139
+ newUpdatedDate = _useState28[0],
140
+ setNewUpdatedDate = _useState28[1];
141
+ var _useState29 = (0, _react.useState)(_constants.SAVE_BUTTON_TEXTS.save),
139
142
  _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
+ saveButtonText = _useState30[0],
144
+ setSaveButtonText = _useState30[1];
145
+ var _useState31 = (0, _react.useState)(null),
143
146
  _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];
147
+ externalUpdateTime = _useState32[0],
148
+ setExternalUpdateTime = _useState32[1];
150
149
  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];
150
+ var _useState33 = (0, _react.useState)(isCreatePage),
151
+ _useState34 = (0, _slicedToArray2["default"])(_useState33, 2),
152
+ isNewEntity = _useState34[0],
153
+ setIsNewEntity = _useState34[1];
155
154
  var client = (0, _client.useApolloClient)();
156
155
  var shouldUpdateState = !entityIdentifier || (0, _entity.checkFulfilConditions)(entity, schema, previousQuery, !entityData) || entityData && entityData.id !== entity.id;
157
156
  var clonedFormData = (0, _lodash["default"])(formData);
@@ -202,13 +201,13 @@ var Entity = function Entity(_ref) {
202
201
  }
203
202
  }, [client, entity, entityData, formData, formValues, pageBuilderTemplateStatus, previousQuery, schema, shouldUpdateState]);
204
203
  var getFullUrl = /*#__PURE__*/function () {
205
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
204
+ var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
206
205
  var query, _yield$client$query, _yield$client$query$d, _yield$client$query$d2, _yield$client$query$d3, getEntityUrl;
207
- return _regenerator["default"].wrap(function _callee$(_context) {
206
+ return _regenerator["default"].wrap(function (_context) {
208
207
  while (1) switch (_context.prev = _context.next) {
209
208
  case 0:
210
209
  query = (0, _adminUiUtils.getQuery)('GET_ENTITY_URL');
211
- _context.next = 3;
210
+ _context.next = 1;
212
211
  return client.query({
213
212
  query: query,
214
213
  variables: {
@@ -218,14 +217,14 @@ var Entity = function Entity(_ref) {
218
217
  },
219
218
  fetchPolicy: 'network-only'
220
219
  });
221
- case 3:
220
+ case 1:
222
221
  _yield$client$query = _context.sent;
223
222
  _yield$client$query$d = _yield$client$query.data;
224
223
  _yield$client$query$d2 = _yield$client$query$d === void 0 ? {} : _yield$client$query$d;
225
224
  _yield$client$query$d3 = _yield$client$query$d2.getEntityUrl;
226
225
  getEntityUrl = _yield$client$query$d3 === void 0 ? '' : _yield$client$query$d3;
227
226
  return _context.abrupt("return", getEntityUrl);
228
- case 9:
227
+ case 2:
229
228
  case "end":
230
229
  return _context.stop();
231
230
  }
@@ -261,15 +260,15 @@ var Entity = function Entity(_ref) {
261
260
  }
262
261
  };
263
262
  var onChangeFormValues = /*#__PURE__*/function () {
264
- var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref4) {
263
+ var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref4) {
265
264
  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;
266
- return _regenerator["default"].wrap(function _callee2$(_context2) {
265
+ return _regenerator["default"].wrap(function (_context2) {
267
266
  while (1) switch (_context2.prev = _context2.next) {
268
267
  case 0:
269
268
  isValid = _ref4.isValid, fields = _ref4.fields, isNewValueSet = _ref4.isNewValueSet, valuesChecked = _ref4.valuesChecked, currentField = _ref4.currentField, fieldValue = _ref4.value, otherProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
270
269
  updatedFormValues = valuesChecked ? valuesChecked.slice() : [];
271
270
  if (!(currentField === _constants.PAGE_BUILDER_TEMPLATE_FIELD_ID)) {
272
- _context2.next = 14;
271
+ _context2.next = 2;
273
272
  break;
274
273
  }
275
274
  pageBuilderTemplateId = fieldValue;
@@ -287,10 +286,10 @@ var Entity = function Entity(_ref) {
287
286
  return formValue.id === _constants.PAGE_BUILDER_FIELD_ID;
288
287
  });
289
288
  if (!pageBuilderTemplateId) {
290
- _context2.next = 14;
289
+ _context2.next = 2;
291
290
  break;
292
291
  }
293
- _context2.next = 10;
292
+ _context2.next = 1;
294
293
  return client.query({
295
294
  query: (0, _adminUiUtils.getQuery)('MERGE_PB_TEMPLATE_CHANGES'),
296
295
  variables: {
@@ -301,7 +300,7 @@ var Entity = function Entity(_ref) {
301
300
  entityIdentifier: entityIdentifier
302
301
  }
303
302
  });
304
- case 10:
303
+ case 1:
305
304
  _yield$client$query2 = _context2.sent;
306
305
  _yield$client$query2$ = _yield$client$query2.data;
307
306
  data = _yield$client$query2$ === void 0 ? {} : _yield$client$query2$;
@@ -315,7 +314,7 @@ var Entity = function Entity(_ref) {
315
314
  return updatedFormValue;
316
315
  });
317
316
  }
318
- case 14:
317
+ case 2:
319
318
  itemsToAdd = [];
320
319
  if (formValues && formValues.length > updatedFormValues.length) {
321
320
  [].concat((0, _toConsumableArray2["default"])(updatedFormValues), (0, _toConsumableArray2["default"])(formValues)).forEach(function (item) {
@@ -347,7 +346,7 @@ var Entity = function Entity(_ref) {
347
346
  if (componentIsMounted.current) {
348
347
  setFormValues([].concat((0, _toConsumableArray2["default"])(updatedFormValues), itemsToAdd));
349
348
  }
350
- case 24:
349
+ case 3:
351
350
  case "end":
352
351
  return _context2.stop();
353
352
  }
@@ -398,16 +397,16 @@ var Entity = function Entity(_ref) {
398
397
  return _actionsHandlers["default"][action].submit(currentAction, addToast);
399
398
  };
400
399
  var onDelete = /*#__PURE__*/function () {
401
- var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
400
+ var _ref7 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
402
401
  var id;
403
- return _regenerator["default"].wrap(function _callee3$(_context3) {
402
+ return _regenerator["default"].wrap(function (_context3) {
404
403
  while (1) switch (_context3.prev = _context3.next) {
405
404
  case 0:
406
405
  id = formData.values.id;
407
406
  if (componentIsMounted.current) {
408
407
  setIsSaveButtonAvailable(false);
409
408
  }
410
- _context3.next = 4;
409
+ _context3.next = 1;
411
410
  return _actionsHandlers["default"]["delete"].submit({
412
411
  entitySchema: entitySchema,
413
412
  client: client,
@@ -415,9 +414,9 @@ var Entity = function Entity(_ref) {
415
414
  id: id
416
415
  }
417
416
  }, addToast);
418
- case 4:
417
+ case 1:
419
418
  history.push("/data-listing/".concat(entitySchema.id));
420
- case 5:
419
+ case 2:
421
420
  case "end":
422
421
  return _context3.stop();
423
422
  }
@@ -453,9 +452,9 @@ var Entity = function Entity(_ref) {
453
452
  setFormDataFromCopy(formDataUpdated);
454
453
  };
455
454
  var handlePublishAndUnpublish = /*#__PURE__*/function () {
456
- var _ref9 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_ref8) {
455
+ var _ref9 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(_ref8) {
457
456
  var textContent, isPublishButton, isPublished, isUnpublish, savedPageMessage;
458
- return _regenerator["default"].wrap(function _callee4$(_context4) {
457
+ return _regenerator["default"].wrap(function (_context4) {
459
458
  while (1) switch (_context4.prev = _context4.next) {
460
459
  case 0:
461
460
  textContent = _ref8.target.textContent;
@@ -463,31 +462,31 @@ var Entity = function Entity(_ref) {
463
462
  isPublished = entityIsPublished === _constants.ENTITY_PUBLISHED;
464
463
  isUnpublish = (0, _entity.checkFulfilConditions)(!isPublishButton, !isPublished);
465
464
  if (!isUnpublish) {
466
- _context4.next = 6;
465
+ _context4.next = 1;
467
466
  break;
468
467
  }
469
468
  return _context4.abrupt("return", addToast(_constants.UNPUBLISHED_WARNING, {
470
469
  appearance: 'warning',
471
470
  autoDismiss: true
472
471
  }));
473
- case 6:
472
+ case 1:
474
473
  if (!(0, _entity.checkFulfilConditions)(isPublishButton, isSaveButtonAvailable)) {
475
- _context4.next = 12;
474
+ _context4.next = 3;
476
475
  break;
477
476
  }
478
- _context4.next = 9;
477
+ _context4.next = 2;
479
478
  return onSubmit();
480
- case 9:
479
+ case 2:
481
480
  savedPageMessage = _context4.sent;
482
481
  if (!(savedPageMessage === _constants.ERROR)) {
483
- _context4.next = 12;
482
+ _context4.next = 3;
484
483
  break;
485
484
  }
486
485
  return _context4.abrupt("return", addToast("Content not published", {
487
486
  appearance: _constants.ERROR,
488
487
  autoDismiss: true
489
488
  }));
490
- case 12:
489
+ case 3:
491
490
  return _context4.abrupt("return", _actionsHandlers["default"].shared.triggerPublish({
492
491
  entityData: entityData,
493
492
  client: client,
@@ -496,7 +495,7 @@ var Entity = function Entity(_ref) {
496
495
  textContent: textContent,
497
496
  refetchRecord: refetchRecord
498
497
  }, addToast));
499
- case 13:
498
+ case 4:
500
499
  case "end":
501
500
  return _context4.stop();
502
501
  }