@blaze-cms/plugin-data-ui 0.146.0-node18.1 → 0.146.0-rc-eagle-3.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.
Files changed (231) hide show
  1. package/CHANGELOG.md +35 -12
  2. package/README.md +64 -0
  3. package/lib/components/EntityDataListing/EntityDataListing.js +21 -19
  4. package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
  5. package/lib/components/EntityDataListing/index.js +2 -3
  6. package/lib/components/EntityDataListing/index.js.map +1 -1
  7. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +18 -20
  8. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
  9. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +2 -3
  10. package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
  11. package/lib/components/EntityManager/Entity/Entity.js +290 -452
  12. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  13. package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +62 -66
  14. package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  15. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +34 -50
  16. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  17. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -3
  18. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
  19. package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -3
  20. package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
  21. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +20 -26
  22. package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
  23. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +20 -18
  24. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  25. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +34 -32
  26. package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
  27. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +105 -150
  28. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  29. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +24 -24
  30. package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
  31. package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -3
  32. package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
  33. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +34 -59
  34. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  35. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +29 -45
  36. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  37. package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +2 -3
  38. package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
  39. package/lib/components/EntityManager/Entity/actions-handlers/index.js +7 -8
  40. package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
  41. package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +2 -3
  42. package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
  43. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +36 -57
  44. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  45. package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +2 -3
  46. package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
  47. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +47 -66
  48. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  49. package/lib/components/EntityManager/Entity/index.js +2 -3
  50. package/lib/components/EntityManager/Entity/index.js.map +1 -1
  51. package/lib/components/EntityManager/EntityManager.js +92 -166
  52. package/lib/components/EntityManager/EntityManager.js.map +1 -1
  53. package/lib/components/EntityManager/index.js +2 -3
  54. package/lib/components/EntityManager/index.js.map +1 -1
  55. package/lib/components/EntityManager/utils/RecordEditContext/index.js +3 -4
  56. package/lib/components/EntityManager/utils/RecordEditContext/index.js.map +1 -1
  57. package/lib/components/EntityManager/utils/data-mappers.js +34 -46
  58. package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
  59. package/lib/components/EntityManager/utils/entity.js +36 -75
  60. package/lib/components/EntityManager/utils/entity.js.map +1 -1
  61. package/lib/components/EntityManager/utils/entityAvailableActions.js +51 -110
  62. package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  63. package/lib/components/EntityManager/utils/is-form-empty.js +6 -10
  64. package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
  65. package/lib/components/EntityManager/utils/query.js +17 -10
  66. package/lib/components/EntityManager/utils/query.js.map +1 -1
  67. package/lib/components/InfoBoxes/InfoBoxTooltip.js +43 -0
  68. package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
  69. package/lib/components/InfoBoxes/InfoBoxes.js +19 -20
  70. package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
  71. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +27 -38
  72. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
  73. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +21 -17
  74. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  75. package/lib/components/InfoBoxes/hooks/useData.js +33 -30
  76. package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
  77. package/lib/components/InfoBoxes/hooks/useInfoBox.js +10 -10
  78. package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -1
  79. package/lib/components/InfoBoxes/index.js +2 -3
  80. package/lib/components/InfoBoxes/index.js.map +1 -1
  81. package/lib/components/InfoBoxes/presentational/InfoBox.js +28 -32
  82. package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  83. package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js +11 -12
  84. package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
  85. package/lib/components/InfoBoxes/presentational/InfoBoxValue.js +12 -12
  86. package/lib/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
  87. package/lib/components/ListingTable/ListingTable.js +164 -303
  88. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  89. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +62 -40
  90. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  91. package/lib/components/ListingTable/ListingTableContent/index.js +2 -3
  92. package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
  93. package/lib/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +182 -0
  94. package/lib/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js.map +1 -0
  95. package/lib/components/ListingTable/SearchFilter/SearchContainer.js +505 -0
  96. package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
  97. package/lib/components/ListingTable/SearchFilter/SearchFilter.js +53 -0
  98. package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
  99. package/lib/components/ListingTable/SearchFilter/helpers.js +138 -0
  100. package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -0
  101. package/lib/components/ListingTable/SearchFilter/querys.js +13 -0
  102. package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -0
  103. package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
  104. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  105. package/lib/components/ListingTable/TableActions/index.js +2 -3
  106. package/lib/components/ListingTable/TableActions/index.js.map +1 -1
  107. package/lib/components/ListingTable/index.js +2 -3
  108. package/lib/components/ListingTable/index.js.map +1 -1
  109. package/lib/components/ListingTable/mappers/populate-rows.js +104 -120
  110. package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
  111. package/lib/components/ListingTable/service/index.js +66 -84
  112. package/lib/components/ListingTable/service/index.js.map +1 -1
  113. package/lib/components/Tabs/index.js +27 -42
  114. package/lib/components/Tabs/index.js.map +1 -1
  115. package/lib/components/hooks/useCallbackDebounce.js +5 -9
  116. package/lib/components/hooks/useCallbackDebounce.js.map +1 -1
  117. package/lib/constants.js +31 -29
  118. package/lib/constants.js.map +1 -1
  119. package/lib/icons/ContentIcon.js +17 -20
  120. package/lib/icons/ContentIcon.js.map +1 -1
  121. package/lib/icons/SettingsIcon.js +12 -15
  122. package/lib/icons/SettingsIcon.js.map +1 -1
  123. package/lib/icons/TaxonomyIcon.js +15 -18
  124. package/lib/icons/TaxonomyIcon.js.map +1 -1
  125. package/lib/icons/UsersIcon.js +11 -14
  126. package/lib/icons/UsersIcon.js.map +1 -1
  127. package/lib/icons/index.js +8 -9
  128. package/lib/icons/index.js.map +1 -1
  129. package/lib/index.js +88 -121
  130. package/lib/index.js.map +1 -1
  131. package/lib/utils/add-content-menu-items.js +67 -93
  132. package/lib/utils/add-content-menu-items.js.map +1 -1
  133. package/lib/utils/build-create-entity-mutation.js +5 -18
  134. package/lib/utils/build-create-entity-mutation.js.map +1 -1
  135. package/lib/utils/build-delete-entity-mutation.js +11 -8
  136. package/lib/utils/build-delete-entity-mutation.js.map +1 -1
  137. package/lib/utils/build-listing-query.js +20 -17
  138. package/lib/utils/build-listing-query.js.map +1 -1
  139. package/lib/utils/build-update-data-query.js +15 -9
  140. package/lib/utils/build-update-data-query.js.map +1 -1
  141. package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
  142. package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  143. package/lib/utils/get-default-query-params.js +23 -10
  144. package/lib/utils/get-default-query-params.js.map +1 -1
  145. package/lib/utils/hoc/withContext.js +4 -6
  146. package/lib/utils/hoc/withContext.js.map +1 -1
  147. package/lib/utils/hooks/useToggle.js +4 -12
  148. package/lib/utils/hooks/useToggle.js.map +1 -1
  149. package/lib/utils/index.js +2 -3
  150. package/lib/utils/index.js.map +1 -1
  151. package/lib-es/components/EntityManager/Entity/Entity.js +23 -30
  152. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  153. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +6 -1
  154. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  155. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
  156. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  157. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +26 -7
  158. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  159. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +8 -2
  160. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
  161. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +4 -14
  162. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  163. package/lib-es/components/EntityManager/utils/entity.js +8 -5
  164. package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
  165. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
  166. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
  167. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
  168. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  169. package/lib-es/components/InfoBoxes/presentational/InfoBox.js +4 -1
  170. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  171. package/lib-es/components/ListingTable/ListingTable.js +12 -11
  172. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  173. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +34 -16
  174. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  175. package/lib-es/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +173 -0
  176. package/lib-es/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js.map +1 -0
  177. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +496 -0
  178. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
  179. package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +44 -0
  180. package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
  181. package/lib-es/components/ListingTable/SearchFilter/helpers.js +127 -0
  182. package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -0
  183. package/lib-es/components/ListingTable/SearchFilter/querys.js +8 -0
  184. package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -0
  185. package/lib-es/components/ListingTable/mappers/populate-rows.js +3 -0
  186. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  187. package/lib-es/components/ListingTable/service/index.js +3 -2
  188. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  189. package/lib-es/components/Tabs/index.js +6 -7
  190. package/lib-es/components/Tabs/index.js.map +1 -1
  191. package/lib-es/constants.js +4 -1
  192. package/lib-es/constants.js.map +1 -1
  193. package/lib-es/index.js +12 -3
  194. package/lib-es/index.js.map +1 -1
  195. package/lib-es/utils/build-create-entity-mutation.js +5 -19
  196. package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
  197. package/lib-es/utils/build-listing-query.js +4 -4
  198. package/lib-es/utils/build-listing-query.js.map +1 -1
  199. package/lib-es/utils/get-default-query-params.js +17 -5
  200. package/lib-es/utils/get-default-query-params.js.map +1 -1
  201. package/lib-es/utils/hoc/withContext.js +1 -1
  202. package/lib-es/utils/hoc/withContext.js.map +1 -1
  203. package/package.json +21 -17
  204. package/src/components/EntityManager/Entity/Entity.js +35 -40
  205. package/src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +8 -1
  206. package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
  207. package/src/components/EntityManager/Entity/SideBarRelations/index.js +51 -17
  208. package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +5 -3
  209. package/src/components/EntityManager/Entity/actions-handlers/create/submit.js +4 -11
  210. package/src/components/EntityManager/utils/entity.js +11 -6
  211. package/src/components/InfoBoxes/InfoBoxTooltip.js +32 -0
  212. package/src/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
  213. package/src/components/InfoBoxes/presentational/InfoBox.js +4 -2
  214. package/src/components/ListingTable/ListingTable.js +13 -18
  215. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +43 -25
  216. package/src/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +160 -0
  217. package/src/components/ListingTable/SearchFilter/SearchContainer.js +553 -0
  218. package/src/components/ListingTable/SearchFilter/SearchFilter.js +41 -0
  219. package/src/components/ListingTable/SearchFilter/helpers.js +146 -0
  220. package/src/components/ListingTable/SearchFilter/querys.js +9 -0
  221. package/src/components/ListingTable/mappers/populate-rows.js +3 -0
  222. package/src/components/ListingTable/service/index.js +2 -2
  223. package/src/components/Tabs/index.js +17 -21
  224. package/src/constants.js +9 -1
  225. package/src/index.js +11 -7
  226. package/src/utils/build-create-entity-mutation.js +5 -28
  227. package/src/utils/build-listing-query.js +4 -4
  228. package/src/utils/get-default-query-params.js +21 -9
  229. package/src/utils/hoc/withContext.js +5 -4
  230. package/babel.config.js +0 -3
  231. package/jest.config.js +0 -5
package/lib/index.js CHANGED
@@ -4,135 +4,102 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports["default"] = load;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- require("core-js/modules/es.array.for-each.js");
12
- require("core-js/modules/es.array.iterator.js");
13
- require("core-js/modules/es.object.define-property.js");
14
- require("core-js/modules/es.object.get-own-property-descriptor.js");
15
- require("core-js/modules/es.object.keys.js");
16
- require("core-js/modules/es.object.to-string.js");
17
- require("core-js/modules/es.promise.js");
18
- require("core-js/modules/es.string.iterator.js");
19
- require("core-js/modules/es.weak-map.js");
20
- require("core-js/modules/web.dom-collections.for-each.js");
21
- require("core-js/modules/web.dom-collections.iterator.js");
7
+ Object.defineProperty(exports, "SearchFilter", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _SearchFilter.default;
11
+ }
12
+ });
13
+ exports.default = load;
22
14
  var _reactFormBuilder = require("@blaze-cms/react-form-builder");
23
- var _react = _interopRequireDefault(require("react"));
24
15
  var _package = _interopRequireDefault(require("../package.json"));
25
16
  var _constants = require("./constants");
26
17
  var _addContentMenuItems = _interopRequireDefault(require("./utils/add-content-menu-items"));
27
18
  var _icons = require("./icons");
28
- 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); }
29
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2["default"])(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 && {}.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; }
30
- var EntityDataListing = /*#__PURE__*/_react["default"].lazy(function () {
31
- return Promise.resolve().then(function () {
32
- return _interopRequireWildcard(require(/* webpackChunkName: 'EntityDataListing' */'./components/EntityDataListing'));
19
+ var _EntityDataListing = _interopRequireDefault(require("./components/EntityDataListing"));
20
+ var _EntityManager = _interopRequireDefault(require("./components/EntityManager"));
21
+ var _SearchFilter = _interopRequireDefault(require("./components/ListingTable/SearchFilter/SearchFilter"));
22
+ // todo: renable lazy loading after bundler optimisations, currently they are too slow in dev mode
23
+ // const EntityDataListing = React.lazy(
24
+ // () => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
25
+ // );
26
+ // const EntityManager = React.lazy(
27
+ // () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
28
+ // );
29
+
30
+ async function load(app) {
31
+ app.events.once('admin:menu:config:load', (0, _addContentMenuItems.default)(app));
32
+ app.events.once('load:custom:field:type', addFieldType => {
33
+ Object.keys(_reactFormBuilder.formFieldTypes).forEach(type => {
34
+ addFieldType({
35
+ type,
36
+ component: _reactFormBuilder.formFieldTypes[type]
37
+ });
38
+ });
33
39
  });
34
- });
35
- var EntityManager = /*#__PURE__*/_react["default"].lazy(function () {
36
- return Promise.resolve().then(function () {
37
- return _interopRequireWildcard(require(/* webpackChunkName: 'EntityManager' */'./components/EntityManager'));
40
+ app.events.once('plugin:data-ui:load:loaded', async () => {
41
+ await app.events.emitAsync('load:custom:field:type', _reactFormBuilder.getFormBuilderLookup.addFieldType);
38
42
  });
39
- });
40
- function load(_x) {
41
- return _load.apply(this, arguments);
42
- }
43
- function _load() {
44
- _load = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(app) {
45
- var entityDataListingRoute, editEntityRoute, addEntityRoute;
46
- return _regenerator["default"].wrap(function _callee2$(_context2) {
47
- while (1) switch (_context2.prev = _context2.next) {
48
- case 0:
49
- app.events.once('admin:menu:config:load', (0, _addContentMenuItems["default"])(app));
50
- app.events.once('load:custom:field:type', function (addFieldType) {
51
- Object.keys(_reactFormBuilder.formFieldTypes).forEach(function (type) {
52
- addFieldType({
53
- type: type,
54
- component: _reactFormBuilder.formFieldTypes[type]
55
- });
56
- });
57
- });
58
- app.events.once('plugin:data-ui:load:loaded', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
59
- return _regenerator["default"].wrap(function _callee$(_context) {
60
- while (1) switch (_context.prev = _context.next) {
61
- case 0:
62
- _context.next = 2;
63
- return app.events.emitAsync('load:custom:field:type', _reactFormBuilder.getFormBuilderLookup.addFieldType);
64
- case 2:
65
- case "end":
66
- return _context.stop();
67
- }
68
- }, _callee);
69
- })));
70
- app.events.once('admin:menu:config:load', function (_ref2) {
71
- var addConfig = _ref2.addConfig;
72
- addConfig({
73
- main: {
74
- items: {
75
- content: {
76
- label: 'content',
77
- loadOpen: true,
78
- items: {},
79
- icon: _icons.ContentIcon,
80
- order: 10
81
- },
82
- taxonomy: {
83
- label: 'Taxonomy',
84
- items: {},
85
- icon: _icons.TaxonomyIcon,
86
- order: 40
87
- },
88
- user: {
89
- label: 'User',
90
- items: {},
91
- icon: _icons.UserIcon,
92
- order: 90
93
- },
94
- settings: {
95
- label: 'Settings',
96
- items: {},
97
- icon: _icons.SettingsIcon,
98
- order: 100
99
- }
100
- }
101
- }
102
- });
103
- });
104
- entityDataListingRoute = {
105
- path: "".concat(_constants.DATA_LISTING_PREFIX, "/:entityIdentifier"),
106
- key: 'entityDataListing',
107
- component: EntityDataListing,
108
- exact: true
109
- };
110
- editEntityRoute = {
111
- path: "".concat(_constants.DATA_LISTING_PREFIX, "/:entityIdentifier/:action/:id"),
112
- key: 'editEntity',
113
- component: EntityManager,
114
- exact: true
115
- };
116
- addEntityRoute = {
117
- path: "".concat(_constants.DATA_LISTING_PREFIX, "/:entityIdentifier/:action"),
118
- key: 'createEntity',
119
- component: EntityManager,
120
- exact: true
121
- };
122
- app.addRoute(entityDataListingRoute);
123
- app.addRoute(editEntityRoute);
124
- app.addRoute(addEntityRoute);
125
- return _context2.abrupt("return", {
126
- name: _constants.PLUGIN_NAME,
127
- version: _package["default"].version
128
- });
129
- case 11:
130
- case "end":
131
- return _context2.stop();
43
+ app.events.once('admin:menu:config:load', ({
44
+ addConfig
45
+ }) => {
46
+ addConfig({
47
+ main: {
48
+ items: {
49
+ content: {
50
+ label: 'content',
51
+ loadOpen: true,
52
+ items: {},
53
+ icon: _icons.ContentIcon,
54
+ order: 10
55
+ },
56
+ taxonomy: {
57
+ label: 'Taxonomy',
58
+ items: {},
59
+ icon: _icons.TaxonomyIcon,
60
+ order: 40
61
+ },
62
+ user: {
63
+ label: 'User',
64
+ items: {},
65
+ icon: _icons.UserIcon,
66
+ order: 90
67
+ },
68
+ settings: {
69
+ label: 'Settings',
70
+ items: {},
71
+ icon: _icons.SettingsIcon,
72
+ order: 100
73
+ }
74
+ }
132
75
  }
133
- }, _callee2);
134
- }));
135
- return _load.apply(this, arguments);
76
+ });
77
+ });
78
+ const entityDataListingRoute = {
79
+ path: `${_constants.DATA_LISTING_PREFIX}/:entityIdentifier`,
80
+ key: 'entityDataListing',
81
+ component: _EntityDataListing.default,
82
+ exact: true
83
+ };
84
+ const editEntityRoute = {
85
+ path: `${_constants.DATA_LISTING_PREFIX}/:entityIdentifier/:action/:id`,
86
+ key: 'editEntity',
87
+ component: _EntityManager.default,
88
+ exact: true
89
+ };
90
+ const addEntityRoute = {
91
+ path: `${_constants.DATA_LISTING_PREFIX}/:entityIdentifier/:action`,
92
+ key: 'createEntity',
93
+ component: _EntityManager.default,
94
+ exact: true
95
+ };
96
+ app.addRoute(entityDataListingRoute);
97
+ app.addRoute(editEntityRoute);
98
+ app.addRoute(addEntityRoute);
99
+ return {
100
+ name: _constants.PLUGIN_NAME,
101
+ version: _package.default.version
102
+ };
136
103
  }
137
104
  load.pluginName = _constants.PLUGIN_NAME;
138
105
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_reactFormBuilder","require","_react","_interopRequireDefault","_package","_constants","_addContentMenuItems","_icons","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","_typeof2","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","EntityDataListing","React","lazy","Promise","resolve","then","EntityManager","load","_x","_load","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee2","app","entityDataListingRoute","editEntityRoute","addEntityRoute","wrap","_callee2$","_context2","prev","next","events","once","getAddContentMenuItems","addFieldType","keys","formFieldTypes","forEach","type","component","_callee","_callee$","_context","emitAsync","getFormBuilderLookup","stop","_ref2","addConfig","main","items","content","label","loadOpen","icon","ContentIcon","order","taxonomy","TaxonomyIcon","user","UserIcon","settings","SettingsIcon","path","concat","DATA_LISTING_PREFIX","key","exact","addRoute","abrupt","name","PLUGIN_NAME","version","pkg","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';\nimport React from 'react';\nimport pkg from '../package.json';\nimport { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';\nimport getAddContentMenuItems from './utils/add-content-menu-items';\nimport { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';\n\nconst EntityDataListing = React.lazy(\n () => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')\n);\nconst EntityManager = React.lazy(\n () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')\n);\n\nexport default async function load(app) {\n app.events.once('admin:menu:config:load', getAddContentMenuItems(app));\n\n app.events.once('load:custom:field:type', addFieldType => {\n Object.keys(formFieldTypes).forEach(type => {\n addFieldType({ type, component: formFieldTypes[type] });\n });\n });\n\n app.events.once('plugin:data-ui:load:loaded', async () => {\n await app.events.emitAsync('load:custom:field:type', getFormBuilderLookup.addFieldType);\n });\n\n app.events.once('admin:menu:config:load', ({ addConfig }) => {\n addConfig({\n main: {\n items: {\n content: {\n label: 'content',\n loadOpen: true,\n items: {},\n icon: ContentIcon,\n order: 10\n },\n taxonomy: {\n label: 'Taxonomy',\n items: {},\n icon: TaxonomyIcon,\n order: 40\n },\n user: {\n label: 'User',\n items: {},\n icon: UserIcon,\n order: 90\n },\n settings: {\n label: 'Settings',\n items: {},\n icon: SettingsIcon,\n order: 100\n }\n }\n }\n });\n });\n\n const entityDataListingRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier`,\n key: 'entityDataListing',\n component: EntityDataListing,\n exact: true\n };\n\n const editEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action/:id`,\n key: 'editEntity',\n component: EntityManager,\n exact: true\n };\n\n const addEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action`,\n key: 'createEntity',\n component: EntityManager,\n exact: true\n };\n\n app.addRoute(entityDataListingRoute);\n app.addRoute(editEntityRoute);\n app.addRoute(addEntityRoute);\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA4E,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAA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,CAAC5C,sBAAsB,CAAC;UACpCD,GAAG,CAAC6C,QAAQ,CAAC3C,eAAe,CAAC;UAC7BF,GAAG,CAAC6C,QAAQ,CAAC1C,cAAc,CAAC;UAAC,OAAAG,SAAA,CAAAwC,MAAA,WAEtB;YACLC,IAAI,EAAEC,sBAAW;YACjBC,OAAO,EAAEC,mBAAG,CAACD;UACf,CAAC;QAAA;QAAA;UAAA,OAAA3C,SAAA,CAAAiB,IAAA;MAAA;IAAA,GAAAxB,QAAA;EAAA,CACF;EAAA,OAAAN,KAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAEDJ,IAAI,CAAC4D,UAAU,GAAGH,sBAAW","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_reactFormBuilder","require","_package","_interopRequireDefault","_constants","_addContentMenuItems","_icons","_EntityDataListing","_EntityManager","_SearchFilter","load","app","events","once","getAddContentMenuItems","addFieldType","Object","keys","formFieldTypes","forEach","type","component","emitAsync","getFormBuilderLookup","addConfig","main","items","content","label","loadOpen","icon","ContentIcon","order","taxonomy","TaxonomyIcon","user","UserIcon","settings","SettingsIcon","entityDataListingRoute","path","DATA_LISTING_PREFIX","key","EntityDataListing","exact","editEntityRoute","EntityManager","addEntityRoute","addRoute","name","PLUGIN_NAME","version","pkg","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';\nimport pkg from '../package.json';\nimport { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';\nimport getAddContentMenuItems from './utils/add-content-menu-items';\nimport { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';\nimport EntityDataListing from './components/EntityDataListing';\nimport EntityManager from './components/EntityManager';\n\n// todo: renable lazy loading after bundler optimisations, currently they are too slow in dev mode\n// const EntityDataListing = React.lazy(\n// () => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')\n// );\n// const EntityManager = React.lazy(\n// () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')\n// );\n\nexport { default as SearchFilter } from './components/ListingTable/SearchFilter/SearchFilter';\n\nexport default async function load(app) {\n app.events.once('admin:menu:config:load', getAddContentMenuItems(app));\n\n app.events.once('load:custom:field:type', addFieldType => {\n Object.keys(formFieldTypes).forEach(type => {\n addFieldType({ type, component: formFieldTypes[type] });\n });\n });\n\n app.events.once('plugin:data-ui:load:loaded', async () => {\n await app.events.emitAsync('load:custom:field:type', getFormBuilderLookup.addFieldType);\n });\n\n app.events.once('admin:menu:config:load', ({ addConfig }) => {\n addConfig({\n main: {\n items: {\n content: {\n label: 'content',\n loadOpen: true,\n items: {},\n icon: ContentIcon,\n order: 10\n },\n taxonomy: {\n label: 'Taxonomy',\n items: {},\n icon: TaxonomyIcon,\n order: 40\n },\n user: {\n label: 'User',\n items: {},\n icon: UserIcon,\n order: 90\n },\n settings: {\n label: 'Settings',\n items: {},\n icon: SettingsIcon,\n order: 100\n }\n }\n }\n });\n });\n\n const entityDataListingRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier`,\n key: 'entityDataListing',\n component: EntityDataListing,\n exact: true\n };\n\n const editEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action/:id`,\n key: 'editEntity',\n component: EntityManager,\n exact: true\n };\n\n const addEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action`,\n key: 'createEntity',\n component: EntityManager,\n exact: true\n };\n\n app.addRoute(entityDataListingRoute);\n app.addRoute(editEntityRoute);\n app.addRoute(addEntityRoute);\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,MAAA,GAAA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EAAE,MAAM;YACbF,KAAK,EAAE,CAAC,CAAC;YACTI,IAAI,EAAEM,eAAQ;YACdJ,KAAK,EAAE;UACT,CAAC;UACDK,QAAQ,EAAE;YACRT,KAAK,EAAE,UAAU;YACjBF,KAAK,EAAE,CAAC,CAAC;YACTI,IAAI,EAAEQ,mBAAY;YAClBN,KAAK,EAAE;UACT;QACF;MACF;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,MAAMO,sBAAsB,GAAG;IAC7BC,IAAI,EAAE,GAAGC,8BAAmB,oBAAoB;IAChDC,GAAG,EAAE,mBAAmB;IACxBrB,SAAS,EAAEsB,0BAAiB;IAC5BC,KAAK,EAAE;EACT,CAAC;EAED,MAAMC,eAAe,GAAG;IACtBL,IAAI,EAAE,GAAGC,8BAAmB,gCAAgC;IAC5DC,GAAG,EAAE,YAAY;IACjBrB,SAAS,EAAEyB,sBAAa;IACxBF,KAAK,EAAE;EACT,CAAC;EAED,MAAMG,cAAc,GAAG;IACrBP,IAAI,EAAE,GAAGC,8BAAmB,4BAA4B;IACxDC,GAAG,EAAE,cAAc;IACnBrB,SAAS,EAAEyB,sBAAa;IACxBF,KAAK,EAAE;EACT,CAAC;EAEDjC,GAAG,CAACqC,QAAQ,CAACT,sBAAsB,CAAC;EACpC5B,GAAG,CAACqC,QAAQ,CAACH,eAAe,CAAC;EAC7BlC,GAAG,CAACqC,QAAQ,CAACD,cAAc,CAAC;EAE5B,OAAO;IACLE,IAAI,EAAEC,sBAAW;IACjBC,OAAO,EAAEC,gBAAG,CAACD;EACf,CAAC;AACH;AAEAzC,IAAI,CAAC2C,UAAU,GAAGH,sBAAW","ignoreList":[]}
@@ -1,104 +1,78 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports["default"] = void 0;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- require("core-js/modules/es.array.for-each.js");
11
- require("core-js/modules/es.object.entries.js");
12
- require("core-js/modules/es.object.to-string.js");
13
- require("core-js/modules/web.dom-collections.for-each.js");
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
6
+ exports.default = void 0;
16
7
  var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
17
- var _require = require('../constants'),
18
- MENU_PERMISSIONS = _require.MENU_PERMISSIONS;
8
+ const {
9
+ MENU_PERMISSIONS
10
+ } = require('../constants');
19
11
  function getAddContentMenuItems(app) {
20
- return /*#__PURE__*/function () {
21
- var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
22
- var addConfig, client, _yield$client$query, getEntitySchemas, menuItems, sectionMenuItems, menuConfig;
23
- return _regenerator["default"].wrap(function _callee$(_context) {
24
- while (1) switch (_context.prev = _context.next) {
25
- case 0:
26
- addConfig = _ref.addConfig;
27
- client = app.getClient();
28
- _context.next = 4;
29
- return client.query({
30
- query: (0, _adminUiUtils.getQuery)('GET_USER_EDITABLE_ENTITIES'),
31
- variables: {
32
- // only return entities that the current user can do the following actions on
33
- canDoActions: MENU_PERMISSIONS
34
- }
35
- });
36
- case 4:
37
- _yield$client$query = _context.sent;
38
- getEntitySchemas = _yield$client$query.data.getEntitySchemas;
39
- if (!(!getEntitySchemas || !getEntitySchemas.length)) {
40
- _context.next = 8;
41
- break;
42
- }
43
- return _context.abrupt("return");
44
- case 8:
45
- // no items so don't add section
46
- menuItems = {};
47
- sectionMenuItems = {
48
- settings: {}
49
- };
50
- getEntitySchemas.forEach(function (_ref3) {
51
- var id = _ref3.id,
52
- displayName = _ref3.displayName,
53
- displayProperties = _ref3.displayProperties;
54
- if (!displayProperties) return null;
55
- var _displayProperties$ad = displayProperties.adminMenu,
56
- _displayProperties$ad2 = _displayProperties$ad === void 0 ? {} : _displayProperties$ad,
57
- _displayProperties$ad3 = _displayProperties$ad2.sectionKey,
58
- sectionKey = _displayProperties$ad3 === void 0 ? 'settings' : _displayProperties$ad3;
59
- var sectionItems = sectionMenuItems[sectionKey] || {};
60
- sectionItems[id] = {
61
- label: displayName,
62
- uri: "/data-listing/".concat(id)
63
- };
64
- sectionMenuItems[sectionKey] = sectionItems;
65
- });
66
- menuConfig = {
67
- main: {
68
- items: {
69
- settings: {
70
- items: menuItems
71
- }
72
- }
73
- }
74
- };
75
- Object.entries(sectionMenuItems).forEach(function (_ref4) {
76
- var _ref5 = (0, _slicedToArray2["default"])(_ref4, 2),
77
- sectionKey = _ref5[0],
78
- sectionItems = _ref5[1];
79
- var sectionConfig = menuConfig.main.items[sectionKey] || {};
80
- sectionConfig.items = sectionItems;
81
- menuConfig.main.items[sectionKey] = sectionConfig;
82
- });
83
- getEntitySchemas.forEach(function (_ref6) {
84
- var id = _ref6.id,
85
- displayName = _ref6.displayName;
86
- menuItems[id] = {
87
- label: displayName,
88
- uri: "/data-listing/".concat(id)
89
- };
90
- });
91
- addConfig(menuConfig);
92
- case 15:
93
- case "end":
94
- return _context.stop();
12
+ return async ({
13
+ addConfig
14
+ }) => {
15
+ const client = app.getClient();
16
+ const {
17
+ data: {
18
+ getEntitySchemas
19
+ }
20
+ } = await client.query({
21
+ query: (0, _adminUiUtils.getQuery)('GET_USER_EDITABLE_ENTITIES'),
22
+ variables: {
23
+ // only return entities that the current user can do the following actions on
24
+ canDoActions: MENU_PERMISSIONS
25
+ }
26
+ });
27
+ if (!getEntitySchemas || !getEntitySchemas.length) return; // no items so don't add section
28
+
29
+ const menuItems = {};
30
+ const sectionMenuItems = {
31
+ settings: {}
32
+ };
33
+ getEntitySchemas.forEach(({
34
+ id,
35
+ displayName,
36
+ displayProperties
37
+ }) => {
38
+ if (!displayProperties) return null;
39
+ const {
40
+ adminMenu: {
41
+ sectionKey = 'settings'
42
+ } = {}
43
+ } = displayProperties;
44
+ const sectionItems = sectionMenuItems[sectionKey] || {};
45
+ sectionItems[id] = {
46
+ label: displayName,
47
+ uri: `/data-listing/${id}`
48
+ };
49
+ sectionMenuItems[sectionKey] = sectionItems;
50
+ });
51
+ const menuConfig = {
52
+ main: {
53
+ items: {
54
+ settings: {
55
+ items: menuItems
56
+ }
95
57
  }
96
- }, _callee);
97
- }));
98
- return function (_x) {
99
- return _ref2.apply(this, arguments);
58
+ }
100
59
  };
101
- }();
60
+ Object.entries(sectionMenuItems).forEach(([sectionKey, sectionItems]) => {
61
+ const sectionConfig = menuConfig.main.items[sectionKey] || {};
62
+ sectionConfig.items = sectionItems;
63
+ menuConfig.main.items[sectionKey] = sectionConfig;
64
+ });
65
+ getEntitySchemas.forEach(({
66
+ id,
67
+ displayName
68
+ }) => {
69
+ menuItems[id] = {
70
+ label: displayName,
71
+ uri: `/data-listing/${id}`
72
+ };
73
+ });
74
+ addConfig(menuConfig);
75
+ };
102
76
  }
103
- var _default = exports["default"] = getAddContentMenuItems;
77
+ var _default = exports.default = getAddContentMenuItems;
104
78
  //# sourceMappingURL=add-content-menu-items.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-content-menu-items.js","names":["_adminUiUtils","require","_require","MENU_PERMISSIONS","getAddContentMenuItems","app","_ref2","_asyncToGenerator2","_regenerator","mark","_callee","_ref","addConfig","client","_yield$client$query","getEntitySchemas","menuItems","sectionMenuItems","menuConfig","wrap","_callee$","_context","prev","next","getClient","query","getQuery","variables","canDoActions","sent","data","length","abrupt","settings","forEach","_ref3","id","displayName","displayProperties","_displayProperties$ad","adminMenu","_displayProperties$ad2","_displayProperties$ad3","sectionKey","sectionItems","label","uri","concat","main","items","Object","entries","_ref4","_ref5","_slicedToArray2","sectionConfig","_ref6","stop","_x","apply","arguments","_default","exports"],"sources":["../../src/utils/add-content-menu-items.js"],"sourcesContent":["import { getQuery } from '@blaze-cms/admin-ui-utils';\n\nconst { MENU_PERMISSIONS } = require('../constants');\n\nfunction getAddContentMenuItems(app) {\n return async ({ addConfig }) => {\n const client = app.getClient();\n const {\n data: { getEntitySchemas }\n } = await client.query({\n query: getQuery('GET_USER_EDITABLE_ENTITIES'),\n variables: {\n // only return entities that the current user can do the following actions on\n canDoActions: MENU_PERMISSIONS\n }\n });\n\n if (!getEntitySchemas || !getEntitySchemas.length) return; // no items so don't add section\n\n const menuItems = {};\n const sectionMenuItems = { settings: {} };\n\n getEntitySchemas.forEach(({ id, displayName, displayProperties }) => {\n if (!displayProperties) return null;\n\n const { adminMenu: { sectionKey = 'settings' } = {} } = displayProperties;\n const sectionItems = sectionMenuItems[sectionKey] || {};\n sectionItems[id] = {\n label: displayName,\n uri: `/data-listing/${id}`\n };\n sectionMenuItems[sectionKey] = sectionItems;\n });\n\n const menuConfig = {\n main: {\n items: {\n settings: {\n items: menuItems\n }\n }\n }\n };\n\n Object.entries(sectionMenuItems).forEach(([sectionKey, sectionItems]) => {\n const sectionConfig = menuConfig.main.items[sectionKey] || {};\n sectionConfig.items = sectionItems;\n menuConfig.main.items[sectionKey] = sectionConfig;\n });\n\n getEntitySchemas.forEach(({ id, displayName }) => {\n menuItems[id] = {\n label: displayName,\n uri: `/data-listing/${id}`\n };\n });\n\n addConfig(menuConfig);\n };\n}\n\nexport default getAddContentMenuItems;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAA6BD,OAAO,CAAC,cAAc,CAAC;EAA5CE,gBAAgB,GAAAD,QAAA,CAAhBC,gBAAgB;AAExB,SAASC,sBAAsBA,CAACC,GAAG,EAAE;EACnC;IAAA,IAAAC,KAAA,OAAAC,kBAAA,0BAAAC,YAAA,YAAAC,IAAA,CAAO,SAAAC,QAAAC,IAAA;MAAA,IAAAC,SAAA,EAAAC,MAAA,EAAAC,mBAAA,EAAAC,gBAAA,EAAAC,SAAA,EAAAC,gBAAA,EAAAC,UAAA;MAAA,OAAAV,YAAA,YAAAW,IAAA,UA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H;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEc1D,sBAAsB","ignoreList":[]}
1
+ {"version":3,"file":"add-content-menu-items.js","names":["_adminUiUtils","require","MENU_PERMISSIONS","getAddContentMenuItems","app","addConfig","client","getClient","data","getEntitySchemas","query","getQuery","variables","canDoActions","length","menuItems","sectionMenuItems","settings","forEach","id","displayName","displayProperties","adminMenu","sectionKey","sectionItems","label","uri","menuConfig","main","items","Object","entries","sectionConfig","_default","exports","default"],"sources":["../../src/utils/add-content-menu-items.js"],"sourcesContent":["import { getQuery } from '@blaze-cms/admin-ui-utils';\n\nconst { MENU_PERMISSIONS } = require('../constants');\n\nfunction getAddContentMenuItems(app) {\n return async ({ addConfig }) => {\n const client = app.getClient();\n const {\n data: { getEntitySchemas }\n } = await client.query({\n query: getQuery('GET_USER_EDITABLE_ENTITIES'),\n variables: {\n // only return entities that the current user can do the following actions on\n canDoActions: MENU_PERMISSIONS\n }\n });\n\n if (!getEntitySchemas || !getEntitySchemas.length) return; // no items so don't add section\n\n const menuItems = {};\n const sectionMenuItems = { settings: {} };\n\n getEntitySchemas.forEach(({ id, displayName, displayProperties }) => {\n if (!displayProperties) return null;\n\n const { adminMenu: { sectionKey = 'settings' } = {} } = displayProperties;\n const sectionItems = sectionMenuItems[sectionKey] || {};\n sectionItems[id] = {\n label: displayName,\n uri: `/data-listing/${id}`\n };\n sectionMenuItems[sectionKey] = sectionItems;\n });\n\n const menuConfig = {\n main: {\n items: {\n settings: {\n items: menuItems\n }\n }\n }\n };\n\n Object.entries(sectionMenuItems).forEach(([sectionKey, sectionItems]) => {\n const sectionConfig = menuConfig.main.items[sectionKey] || {};\n sectionConfig.items = sectionItems;\n menuConfig.main.items[sectionKey] = sectionConfig;\n });\n\n getEntitySchemas.forEach(({ id, displayName }) => {\n menuItems[id] = {\n label: displayName,\n uri: `/data-listing/${id}`\n };\n });\n\n addConfig(menuConfig);\n };\n}\n\nexport default getAddContentMenuItems;\n"],"mappings":";;;;;;AAAA,IA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;MACF;IACF,CAAC;IAEDe,MAAM,CAACC,OAAO,CAACf,gBAAgB,CAAC,CAACE,OAAO,CAAC,CAAC,CAACK,UAAU,EAAEC,YAAY,CAAC,KAAK;MACvE,MAAMQ,aAAa,GAAGL,UAAU,CAACC,IAAI,CAACC,KAAK,CAACN,UAAU,CAAC,IAAI,CAAC,CAAC;MAC7DS,aAAa,CAACH,KAAK,GAAGL,YAAY;MAClCG,UAAU,CAACC,IAAI,CAACC,KAAK,CAACN,UAAU,CAAC,GAAGS,aAAa;IACnD,CAAC,CAAC;IAEFvB,gBAAgB,CAACS,OAAO,CAAC,CAAC;MAAEC,EAAE;MAAEC;IAAY,CAAC,KAAK;MAChDL,SAAS,CAACI,EAAE,CAAC,GAAG;QACdM,KAAK,EAAEL,WAAW;QAClBM,GAAG,EAAE,iBAAiBP,EAAE;MAC1B,CAAC;IACH,CAAC,CAAC;IAEFd,SAAS,CAACsB,UAAU,CAAC;EACvB,CAAC;AACH;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchC,sBAAsB","ignoreList":[]}
@@ -1,25 +1,12 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports["default"] = void 0;
9
- require("core-js/modules/es.array.join.js");
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
- var _client = require("@apollo/client");
12
- var _coreErrors = require("@blaze-cms/core-errors");
13
- var _lodash = _interopRequireDefault(require("lodash.upperfirst"));
6
+ exports.default = void 0;
14
7
  var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
15
- var _templateObject;
16
- function buildCreateEntityMutation(entitySchema) {
17
- if (!entitySchema || !entitySchema.actions || !entitySchema.actions.create || !entitySchema.properties) {
18
- throw new _coreErrors.BlazeError('Create entity query requires create action and properties from entity schema');
19
- }
20
- var actionInput = (0, _lodash["default"])("".concat(entitySchema.actions.create, "Input"));
21
- var dataProperties = (0, _adminUiUtils.getDataProperties)(entitySchema);
22
- return (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["mutation createEntity($input: ", ") {\n createdEntity: ", "(input: $input){\n result {\n id,\n ", "\n }\n }\n }"])), actionInput, entitySchema.actions.create, dataProperties.join(',\n'));
23
- }
24
- var _default = exports["default"] = buildCreateEntityMutation;
8
+ // Kept for back-compat: the builder now lives in the admin-ui-utils dynamic
9
+ // mutation registry so packages that cannot depend on this plugin can use it.
10
+ const buildCreateEntityMutation = entitySchema => (0, _adminUiUtils.getDynamicMutation)('CREATE_ENTITY_MUTATION')(entitySchema);
11
+ var _default = exports.default = buildCreateEntityMutation;
25
12
  //# sourceMappingURL=build-create-entity-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-create-entity-mutation.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","_adminUiUtils","_templateObject","buildCreateEntityMutation","entitySchema","actions","create","properties","BlazeError","actionInput","upperfirst","concat","dataProperties","getDataProperties","gql","_taggedTemplateLiteral2","join","_default","exports"],"sources":["../../src/utils/build-create-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildCreateEntityMutation(entitySchema) {\n if (\n !entitySchema ||\n !entitySchema.actions ||\n !entitySchema.actions.create ||\n !entitySchema.properties\n ) {\n throw new BlazeError(\n 'Create entity query requires create action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.create}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`mutation createEntity($input: ${actionInput}) {\n createdEntity: ${entitySchema.actions.create}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')}\n }\n }\n }`;\n}\n\nexport default buildCreateEntityMutation;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAA8D,IAAAK,eAAA;AAE9D,SAASC,yBAAyBA,CAACC,YAAY,EAAE;EAC/C,IACE,CAACA,YAAY,IACb,CAACA,YAAY,CAACC,OAAO,IACrB,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAC5B,CAACF,YAAY,CAACG,UAAU,EACxB;IACA,MAAM,IAAIC,sBAAU,CAClB,8EACF,CAAC;EACH;EAEA,IAAMC,WAAW,GAAG,IAAAC,kBAAU,KAAAC,MAAA,CAAIP,YAAY,CAACC,OAAO,CAACC,MAAM,UAAO,CAAC;EACrE,IAAMM,cAAc,GAAG,IAAAC,+BAAiB,EAACT,YAAY,CAAC;EAEtD,WAAOU,WAAG,EAAAZ,eAAA,KAAAA,eAAA,OAAAa,uBAAA,0KAAkCN,WAAW,EACpCL,YAAY,CAACC,OAAO,CAACC,MAAM,EAGpCM,cAAc,CAACI,IAAI,CAAC,KAAK,CAAC;AAItC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEcf,yBAAyB","ignoreList":[]}
1
+ {"version":3,"file":"build-create-entity-mutation.js","names":["_adminUiUtils","require","buildCreateEntityMutation","entitySchema","getDynamicMutation","_default","exports","default"],"sources":["../../src/utils/build-create-entity-mutation.js"],"sourcesContent":["import { getDynamicMutation } from '@blaze-cms/admin-ui-utils';\n\n// Kept for back-compat: the builder now lives in the admin-ui-utils dynamic\n// mutation registry so packages that cannot depend on this plugin can use it.\nconst buildCreateEntityMutation = entitySchema =>\n getDynamicMutation('CREATE_ENTITY_MUTATION')(entitySchema);\n\nexport default buildCreateEntityMutation;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEA;AACA;AACA,MAAMC,yBAAyB,GAAGC,YAAY,IAC5C,IAAAC,gCAAkB,EAAC,wBAAwB,CAAC,CAACD,YAAY,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE9CL,yBAAyB","ignoreList":[]}
@@ -1,22 +1,25 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports["default"] = void 0;
9
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
7
+ exports.default = void 0;
10
8
  var _client = require("@apollo/client");
11
9
  var _coreErrors = require("@blaze-cms/core-errors");
12
10
  var _lodash = _interopRequireDefault(require("lodash.upperfirst"));
13
- var _templateObject;
14
11
  function buildDeleteEntity(entitySchema) {
15
- if (!entitySchema || !entitySchema.actions || !entitySchema.actions["delete"]) {
12
+ if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {
16
13
  throw new _coreErrors.BlazeError('Delete query requires delete action from entity schema');
17
14
  }
18
- var actionInput = (0, _lodash["default"])("".concat(entitySchema.actions["delete"], "Input"));
19
- return (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n mutation deleteEntity($input: ", ") {\n deleteEntity: ", "(input: $input){\n result\n }\n }\n "])), actionInput, entitySchema.actions["delete"]);
15
+ const actionInput = (0, _lodash.default)(`${entitySchema.actions.delete}Input`);
16
+ return (0, _client.gql)`
17
+ mutation deleteEntity($input: ${actionInput}) {
18
+ deleteEntity: ${entitySchema.actions.delete}(input: $input){
19
+ result
20
+ }
21
+ }
22
+ `;
20
23
  }
21
- var _default = exports["default"] = buildDeleteEntity;
24
+ var _default = exports.default = buildDeleteEntity;
22
25
  //# sourceMappingURL=build-delete-entity-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-delete-entity-mutation.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","_templateObject","buildDeleteEntity","entitySchema","actions","BlazeError","actionInput","upperfirst","concat","gql","_taggedTemplateLiteral2","_default","exports"],"sources":["../../src/utils/build-delete-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\n\nfunction buildDeleteEntity(entitySchema) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {\n throw new BlazeError('Delete query requires delete action from entity schema');\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.delete}Input`);\n\n return gql`\n mutation deleteEntity($input: ${actionInput}) {\n deleteEntity: ${entitySchema.actions.delete}(input: $input){\n result\n }\n }\n `;\n}\n\nexport default buildDeleteEntity;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA2C,IAAAI,eAAA;AAE3C,SAASC,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,UAAO,EAAE;IAC1E,MAAM,IAAIC,sBAAU,CAAC,wDAAwD,CAAC;EAChF;EAEA,IAAMC,WAAW,GAAG,IAAAC,kBAAU,KAAAC,MAAA,CAAIL,YAAY,CAACC,OAAO,UAAO,UAAO,CAAC;EAErE,WAAOK,WAAG,EAAAR,eAAA,KAAAA,eAAA,OAAAS,uBAAA,qIACuBJ,WAAW,EAC1BH,YAAY,CAACC,OAAO,UAAO;AAK/C;AAAC,IAAAO,QAAA,GAAAC,OAAA,cAEcV,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"build-delete-entity-mutation.js","names":["_client","require","_coreErrors","_lodash","_interopRequireDefault","buildDeleteEntity","entitySchema","actions","delete","BlazeError","actionInput","upperfirst","gql","_default","exports","default"],"sources":["../../src/utils/build-delete-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\n\nfunction buildDeleteEntity(entitySchema) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {\n throw new BlazeError('Delete query requires delete action from entity schema');\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.delete}Input`);\n\n return gql`\n mutation deleteEntity($input: ${actionInput}) {\n deleteEntity: ${entitySchema.actions.delete}(input: $input){\n result\n }\n }\n `;\n}\n\nexport default buildDeleteEntity;\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,SAASI,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,EAAE;IAC1E,MAAM,IAAIC,sBAAU,CAAC,wDAAwD,CAAC;EAChF;EAEA,MAAMC,WAAW,GAAG,IAAAC,eAAU,EAAC,GAAGL,YAAY,CAACC,OAAO,CAACC,MAAM,OAAO,CAAC;EAErE,OAAO,IAAAI,WAAG;AACZ,mCAAmCF,WAAW;AAC9C,oBAAoBJ,YAAY,CAACC,OAAO,CAACC,MAAM;AAC/C;AACA;AACA;AACA,GAAG;AACH;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcV,iBAAiB","ignoreList":[]}
@@ -1,31 +1,34 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports["default"] = void 0;
9
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
- require("core-js/modules/es.array.join.js");
6
+ exports.default = void 0;
11
7
  var _client = require("@apollo/client");
12
8
  var _coreErrors = require("@blaze-cms/core-errors");
13
9
  var _adminUiUtils = require("@blaze-cms/admin-ui-utils");
14
- var _templateObject;
15
- var buildAdminSearchQuery = function buildAdminSearchQuery(entitySchema) {
16
- var _ref = entitySchema || {},
17
- _ref$listingPropertie = _ref.listingProperties,
18
- listingProperties = _ref$listingPropertie === void 0 ? [] : _ref$listingPropertie;
19
- var parsedProperties = "id, ".concat(listingProperties.join(' ') || 'id name');
20
- return (0, _adminUiUtils.getDynamicQuery)('ADMIN_SEARCH')([entitySchema], parsedProperties, true);
10
+ const buildAdminSearchQuery = (entitySchema, index) => {
11
+ const {
12
+ listingProperties = []
13
+ } = entitySchema || {};
14
+ const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;
15
+ return (0, _adminUiUtils.getDynamicQuery)('ADMIN_SEARCH')([entitySchema], parsedProperties, true, index);
21
16
  };
22
- function buildListingQuery(entitySchema, isSearchQuery) {
17
+ function buildListingQuery(entitySchema, index, isSearchQuery) {
23
18
  if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {
24
19
  throw new _coreErrors.BlazeError('Listing query requires getAll action and listingProperties from entity schema');
25
20
  }
26
- if (isSearchQuery) return buildAdminSearchQuery(entitySchema);
27
- var sortType = entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
28
- return (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n query ", "($where: JSON, $limit: Int, $offset:Int, $sort: [", "SortItem]) {\n listingData: ", "(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ", "\n }\n totalRecords: ", "(where: $where)\n }\n "])), entitySchema.actions.getAll, sortType, entitySchema.actions.getAll, entitySchema.listingProperties.join(',\n'), entitySchema.actions.countAll);
21
+ if (isSearchQuery) return buildAdminSearchQuery(entitySchema, index);
22
+ const sortType = entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
23
+ return (0, _client.gql)`
24
+ query ${entitySchema.actions.getAll}($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {
25
+ listingData: ${entitySchema.actions.getAll}(where: $where, limit: $limit, offset:$offset, sort:$sort){
26
+ id,
27
+ ${entitySchema.listingProperties.join(',\n')}
28
+ }
29
+ totalRecords: ${entitySchema.actions.countAll}(where: $where)
30
+ }
31
+ `;
29
32
  }
30
- var _default = exports["default"] = buildListingQuery;
33
+ var _default = exports.default = buildListingQuery;
31
34
  //# sourceMappingURL=build-listing-query.js.map