@blaze-cms/plugin-data-ui 0.146.0-node18.0 → 0.146.0-rc-eagle.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 (307) hide show
  1. package/CHANGELOG.md +30 -5
  2. package/README.md +57 -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 +289 -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 +104 -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 +42 -56
  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 +91 -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 +35 -73
  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 +26 -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 +163 -303
  88. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  89. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +61 -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/SearchContainer.js +215 -0
  94. package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
  95. package/lib/components/ListingTable/SearchFilter/SearchFilter.js +48 -0
  96. package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
  97. package/lib/components/ListingTable/SearchFilter/helpers.js +105 -0
  98. package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -0
  99. package/lib/components/ListingTable/SearchFilter/querys.js +13 -0
  100. package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -0
  101. package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
  102. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  103. package/lib/components/ListingTable/TableActions/index.js +2 -3
  104. package/lib/components/ListingTable/TableActions/index.js.map +1 -1
  105. package/lib/components/ListingTable/index.js +2 -3
  106. package/lib/components/ListingTable/index.js.map +1 -1
  107. package/lib/components/ListingTable/mappers/populate-rows.js +104 -120
  108. package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
  109. package/lib/components/ListingTable/service/index.js +66 -84
  110. package/lib/components/ListingTable/service/index.js.map +1 -1
  111. package/lib/components/Tabs/index.js +26 -42
  112. package/lib/components/Tabs/index.js.map +1 -1
  113. package/lib/components/hooks/useCallbackDebounce.js +5 -9
  114. package/lib/components/hooks/useCallbackDebounce.js.map +1 -1
  115. package/lib/constants.js +31 -29
  116. package/lib/constants.js.map +1 -1
  117. package/lib/icons/ContentIcon.js +17 -20
  118. package/lib/icons/ContentIcon.js.map +1 -1
  119. package/lib/icons/SettingsIcon.js +12 -15
  120. package/lib/icons/SettingsIcon.js.map +1 -1
  121. package/lib/icons/TaxonomyIcon.js +15 -18
  122. package/lib/icons/TaxonomyIcon.js.map +1 -1
  123. package/lib/icons/UsersIcon.js +11 -14
  124. package/lib/icons/UsersIcon.js.map +1 -1
  125. package/lib/icons/index.js +8 -9
  126. package/lib/icons/index.js.map +1 -1
  127. package/lib/index.js +81 -121
  128. package/lib/index.js.map +1 -1
  129. package/lib/utils/add-content-menu-items.js +67 -93
  130. package/lib/utils/add-content-menu-items.js.map +1 -1
  131. package/lib/utils/build-create-entity-mutation.js +12 -9
  132. package/lib/utils/build-create-entity-mutation.js.map +1 -1
  133. package/lib/utils/build-delete-entity-mutation.js +11 -8
  134. package/lib/utils/build-delete-entity-mutation.js.map +1 -1
  135. package/lib/utils/build-listing-query.js +20 -17
  136. package/lib/utils/build-listing-query.js.map +1 -1
  137. package/lib/utils/build-update-data-query.js +15 -9
  138. package/lib/utils/build-update-data-query.js.map +1 -1
  139. package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
  140. package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  141. package/lib/utils/get-default-query-params.js +7 -6
  142. package/lib/utils/get-default-query-params.js.map +1 -1
  143. package/lib/utils/hoc/withContext.js +4 -6
  144. package/lib/utils/hoc/withContext.js.map +1 -1
  145. package/lib/utils/hooks/useToggle.js +4 -12
  146. package/lib/utils/hooks/useToggle.js.map +1 -1
  147. package/lib/utils/index.js +2 -3
  148. package/lib/utils/index.js.map +1 -1
  149. package/package.json +17 -17
  150. package/src/components/EntityManager/Entity/Entity.js +34 -39
  151. package/src/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +8 -1
  152. package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
  153. package/src/components/EntityManager/Entity/SideBarRelations/index.js +51 -17
  154. package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +5 -3
  155. package/src/components/EntityManager/utils/entity.js +13 -2
  156. package/src/components/InfoBoxes/InfoBoxTooltip.js +32 -0
  157. package/src/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
  158. package/src/components/InfoBoxes/presentational/InfoBox.js +4 -2
  159. package/src/components/ListingTable/ListingTable.js +13 -18
  160. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +43 -25
  161. package/src/components/ListingTable/SearchFilter/SearchContainer.js +228 -0
  162. package/src/components/ListingTable/SearchFilter/SearchFilter.js +38 -0
  163. package/src/components/ListingTable/SearchFilter/helpers.js +99 -0
  164. package/src/components/ListingTable/SearchFilter/querys.js +9 -0
  165. package/src/components/ListingTable/mappers/populate-rows.js +3 -0
  166. package/src/components/ListingTable/service/index.js +2 -2
  167. package/src/components/Tabs/index.js +17 -21
  168. package/src/constants.js +9 -1
  169. package/src/index.js +9 -7
  170. package/src/utils/build-listing-query.js +4 -4
  171. package/src/utils/hoc/withContext.js +5 -4
  172. package/lib-es/components/EntityDataListing/EntityDataListing.js +0 -33
  173. package/lib-es/components/EntityDataListing/EntityDataListing.js.map +0 -1
  174. package/lib-es/components/EntityDataListing/index.js +0 -3
  175. package/lib-es/components/EntityDataListing/index.js.map +0 -1
  176. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -30
  177. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +0 -1
  178. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +0 -3
  179. package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +0 -1
  180. package/lib-es/components/EntityManager/Entity/Entity.js +0 -460
  181. package/lib-es/components/EntityManager/Entity/Entity.js.map +0 -1
  182. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +0 -103
  183. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +0 -1
  184. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +0 -42
  185. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +0 -1
  186. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +0 -3
  187. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +0 -1
  188. package/lib-es/components/EntityManager/Entity/EntityHeader/index.js +0 -3
  189. package/lib-es/components/EntityManager/Entity/EntityHeader/index.js.map +0 -1
  190. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +0 -30
  191. package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +0 -1
  192. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -27
  193. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +0 -1
  194. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +0 -49
  195. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +0 -1
  196. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +0 -117
  197. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +0 -1
  198. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +0 -30
  199. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +0 -1
  200. package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js +0 -5
  201. package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js.map +0 -1
  202. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +0 -46
  203. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +0 -1
  204. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js +0 -32
  205. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +0 -1
  206. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js +0 -5
  207. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js.map +0 -1
  208. package/lib-es/components/EntityManager/Entity/actions-handlers/index.js +0 -12
  209. package/lib-es/components/EntityManager/Entity/actions-handlers/index.js.map +0 -1
  210. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js +0 -5
  211. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js.map +0 -1
  212. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js +0 -39
  213. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +0 -1
  214. package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js +0 -5
  215. package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js.map +0 -1
  216. package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +0 -53
  217. package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +0 -1
  218. package/lib-es/components/EntityManager/Entity/index.js +0 -3
  219. package/lib-es/components/EntityManager/Entity/index.js.map +0 -1
  220. package/lib-es/components/EntityManager/EntityManager.js +0 -133
  221. package/lib-es/components/EntityManager/EntityManager.js.map +0 -1
  222. package/lib-es/components/EntityManager/index.js +0 -3
  223. package/lib-es/components/EntityManager/index.js.map +0 -1
  224. package/lib-es/components/EntityManager/utils/RecordEditContext/index.js +0 -6
  225. package/lib-es/components/EntityManager/utils/RecordEditContext/index.js.map +0 -1
  226. package/lib-es/components/EntityManager/utils/data-mappers.js +0 -55
  227. package/lib-es/components/EntityManager/utils/data-mappers.js.map +0 -1
  228. package/lib-es/components/EntityManager/utils/entity.js +0 -66
  229. package/lib-es/components/EntityManager/utils/entity.js.map +0 -1
  230. package/lib-es/components/EntityManager/utils/entityAvailableActions.js +0 -56
  231. package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +0 -1
  232. package/lib-es/components/EntityManager/utils/is-form-empty.js +0 -9
  233. package/lib-es/components/EntityManager/utils/is-form-empty.js.map +0 -1
  234. package/lib-es/components/EntityManager/utils/query.js +0 -23
  235. package/lib-es/components/EntityManager/utils/query.js.map +0 -1
  236. package/lib-es/components/InfoBoxes/InfoBoxes.js +0 -28
  237. package/lib-es/components/InfoBoxes/InfoBoxes.js.map +0 -1
  238. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +0 -38
  239. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
  240. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +0 -26
  241. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
  242. package/lib-es/components/InfoBoxes/hooks/useData.js +0 -39
  243. package/lib-es/components/InfoBoxes/hooks/useData.js.map +0 -1
  244. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +0 -17
  245. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
  246. package/lib-es/components/InfoBoxes/index.js +0 -3
  247. package/lib-es/components/InfoBoxes/index.js.map +0 -1
  248. package/lib-es/components/InfoBoxes/presentational/InfoBox.js +0 -37
  249. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
  250. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js +0 -12
  251. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +0 -1
  252. package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js +0 -30
  253. package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js.map +0 -1
  254. package/lib-es/components/ListingTable/ListingTable.js +0 -207
  255. package/lib-es/components/ListingTable/ListingTable.js.map +0 -1
  256. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +0 -54
  257. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +0 -1
  258. package/lib-es/components/ListingTable/ListingTableContent/index.js +0 -3
  259. package/lib-es/components/ListingTable/ListingTableContent/index.js.map +0 -1
  260. package/lib-es/components/ListingTable/TableActions/TableActions.js +0 -34
  261. package/lib-es/components/ListingTable/TableActions/TableActions.js.map +0 -1
  262. package/lib-es/components/ListingTable/TableActions/index.js +0 -3
  263. package/lib-es/components/ListingTable/TableActions/index.js.map +0 -1
  264. package/lib-es/components/ListingTable/index.js +0 -3
  265. package/lib-es/components/ListingTable/index.js.map +0 -1
  266. package/lib-es/components/ListingTable/mappers/populate-rows.js +0 -137
  267. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +0 -1
  268. package/lib-es/components/ListingTable/service/index.js +0 -86
  269. package/lib-es/components/ListingTable/service/index.js.map +0 -1
  270. package/lib-es/components/Tabs/index.js +0 -39
  271. package/lib-es/components/Tabs/index.js.map +0 -1
  272. package/lib-es/components/hooks/useCallbackDebounce.js +0 -12
  273. package/lib-es/components/hooks/useCallbackDebounce.js.map +0 -1
  274. package/lib-es/constants.js +0 -39
  275. package/lib-es/constants.js.map +0 -1
  276. package/lib-es/icons/ContentIcon.js +0 -80
  277. package/lib-es/icons/ContentIcon.js.map +0 -1
  278. package/lib-es/icons/SettingsIcon.js +0 -36
  279. package/lib-es/icons/SettingsIcon.js.map +0 -1
  280. package/lib-es/icons/TaxonomyIcon.js +0 -60
  281. package/lib-es/icons/TaxonomyIcon.js.map +0 -1
  282. package/lib-es/icons/UsersIcon.js +0 -33
  283. package/lib-es/icons/UsersIcon.js.map +0 -1
  284. package/lib-es/icons/index.js +0 -6
  285. package/lib-es/icons/index.js.map +0 -1
  286. package/lib-es/index.js +0 -84
  287. package/lib-es/index.js.map +0 -1
  288. package/lib-es/utils/add-content-menu-items.js +0 -72
  289. package/lib-es/utils/add-content-menu-items.js.map +0 -1
  290. package/lib-es/utils/build-create-entity-mutation.js +0 -21
  291. package/lib-es/utils/build-create-entity-mutation.js.map +0 -1
  292. package/lib-es/utils/build-delete-entity-mutation.js +0 -18
  293. package/lib-es/utils/build-delete-entity-mutation.js.map +0 -1
  294. package/lib-es/utils/build-listing-query.js +0 -28
  295. package/lib-es/utils/build-listing-query.js.map +0 -1
  296. package/lib-es/utils/build-update-data-query.js +0 -24
  297. package/lib-es/utils/build-update-data-query.js.map +0 -1
  298. package/lib-es/utils/build-update-publish-unpublish-mutation.js +0 -22
  299. package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +0 -1
  300. package/lib-es/utils/get-default-query-params.js +0 -17
  301. package/lib-es/utils/get-default-query-params.js.map +0 -1
  302. package/lib-es/utils/hoc/withContext.js +0 -8
  303. package/lib-es/utils/hoc/withContext.js.map +0 -1
  304. package/lib-es/utils/hooks/useToggle.js +0 -8
  305. package/lib-es/utils/hooks/useToggle.js.map +0 -1
  306. package/lib-es/utils/index.js +0 -3
  307. package/lib-es/utils/index.js.map +0 -1
@@ -1,7 +1,6 @@
1
- import React from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import Table from '@blaze-react/table';
3
3
  import Pagination from '@blaze-react/pagination';
4
-
5
4
  import PropTypes from 'prop-types';
6
5
  import { withRouter } from 'react-router-dom';
7
6
 
@@ -13,34 +12,53 @@ const ListingTableContent = ({
13
12
  currentPage,
14
13
  totalItems
15
14
  }) => {
15
+ const ref = useRef(null);
16
16
  const displayTable = tableData && tableData.rows && !!tableData.rows.length;
17
17
  const { isEnquiry } = tableData;
18
18
  const className = `page__content${isEnquiry ? ' array-table' : ''}`;
19
19
 
20
+ useEffect(() => {
21
+ // set table head to match body column widths to handle dynamic content
22
+ if (ref.current && displayTable) {
23
+ const tableHeadCells = ref.current.querySelectorAll('.table-head .table-cell');
24
+ const firstRowCells = ref.current.querySelectorAll(
25
+ '.table-body .table-row:first-child .table-cell'
26
+ );
27
+
28
+ firstRowCells.forEach((element, i) => {
29
+ const styles = window.getComputedStyle(element);
30
+
31
+ if (tableHeadCells[i]) {
32
+ tableHeadCells[i].style.flex = styles.flex;
33
+ tableHeadCells[i].style['justify-content'] = styles['justify-content'];
34
+ }
35
+ });
36
+ }
37
+ }, [tableData, displayTable]);
38
+
39
+ if (displayTable) {
40
+ return (
41
+ <div ref={ref} className={className}>
42
+ <Table
43
+ onSort={onSort}
44
+ data={tableData}
45
+ onSelect={handleSelect}
46
+ data-testid="listing-table-content"
47
+ />
48
+ <Pagination
49
+ visiblePages={10}
50
+ totalItems={totalItems}
51
+ currentPage={currentPage}
52
+ onPageChange={handleOnPageChange}
53
+ />
54
+ </div>
55
+ );
56
+ }
57
+
20
58
  return (
21
- <>
22
- {displayTable ? (
23
- <div className={className}>
24
- <Table
25
- onSort={onSort}
26
- data={tableData}
27
- checkboxes={!isEnquiry}
28
- onSelect={handleSelect}
29
- data-testid="listing-table-content"
30
- />
31
- <Pagination
32
- visiblePages={10}
33
- totalItems={totalItems}
34
- currentPage={currentPage}
35
- onPageChange={handleOnPageChange}
36
- />
37
- </div>
38
- ) : (
39
- <span className="table-no-results" data-testid="no-results">
40
- No results
41
- </span>
42
- )}
43
- </>
59
+ <span className="table-no-results" data-testid="no-results">
60
+ No results
61
+ </span>
44
62
  );
45
63
  };
46
64
 
@@ -0,0 +1,228 @@
1
+ import React, { useState, useMemo, useEffect, useCallback } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Select from '@blaze-react/select';
4
+ import { useQuery, useApolloClient } from '@apollo/client';
5
+ import { getDynamicQuery, getQuery } from '@blaze-cms/admin-ui-utils';
6
+ import { BsArrowCounterclockwise, BsSearch } from 'react-icons/bs';
7
+ import { updateListFilters, buildQueryFields } from './helpers';
8
+ import { NOOP_QUERY } from './querys';
9
+ import { ENTER_KEY, DEFAULT_FILTER_OPTION_LABEL } from '../../../constants';
10
+
11
+ const SearchContainer = ({
12
+ setListFilters,
13
+ keywordFiltersToUse = [],
14
+ selectFiltersToDisplay = [],
15
+ schema,
16
+ index
17
+ }) => {
18
+ const apolloClient = useApolloClient();
19
+ const [searchTerm, setSearchTerm] = useState('');
20
+ const [selectedFilters, setSelectedFilters] = useState({});
21
+ const [selectOptions, setSelectOptions] = useState([]);
22
+
23
+ const displaySearchFilter = keywordFiltersToUse.length > 0;
24
+ const displaySelectFilters = selectFiltersToDisplay.length > 0;
25
+
26
+ const { keywordSearchProperties, keywordSearchLabels } = useMemo(() => {
27
+ const labels = [];
28
+ const properties = [];
29
+
30
+ keywordFiltersToUse.forEach(([property, { label }]) => {
31
+ if (label) labels.push(label);
32
+ properties.push(property);
33
+ });
34
+
35
+ return { keywordSearchProperties: properties, keywordSearchLabels: labels };
36
+ }, [keywordFiltersToUse]);
37
+
38
+ const { gqlFields, rawQuery } = useMemo(
39
+ () => buildQueryFields(selectFiltersToDisplay, schema.id),
40
+ [selectFiltersToDisplay, schema.id]
41
+ );
42
+ const action = displaySelectFilters
43
+ ? getDynamicQuery('ADMIN_SEARCH')([schema], gqlFields, false, index)
44
+ : NOOP_QUERY;
45
+
46
+ const { data } = useQuery(action, {
47
+ skip: !displaySelectFilters,
48
+ variables: { where: rawQuery, limit: 0 },
49
+ fetchPolicy: 'cache-and-network'
50
+ });
51
+
52
+ const filterData = useMemo(() => {
53
+ const { searchResults: { rawResults: { aggregations = {} } = {} } = {} } = data || {};
54
+ const proccessedData = [];
55
+ Object.entries(aggregations).forEach(([key, { buckets }]) => {
56
+ proccessedData.push(
57
+ Array.isArray(buckets) ? [key, buckets.map(b => b.key).filter(Boolean)] : []
58
+ );
59
+ });
60
+
61
+ return proccessedData;
62
+ }, [data]);
63
+
64
+ useEffect(() => {
65
+ if (!filterData.length) {
66
+ setSelectOptions([]);
67
+ return;
68
+ }
69
+
70
+ (async () => {
71
+ const results = await Promise.all(
72
+ filterData.map(async ([property, ids]) => {
73
+ try {
74
+ if (!ids || !ids.length) return {};
75
+
76
+ const [, selectionDetails] =
77
+ selectFiltersToDisplay.find(([selectProperty]) => selectProperty === property) || [];
78
+
79
+ if (!selectionDetails) return null;
80
+
81
+ if (!selectionDetails.relation) {
82
+ return {
83
+ id: property,
84
+ label: selectionDetails.label,
85
+ options: ids.map(value => [value, value])
86
+ };
87
+ }
88
+ const query = getQuery('GET_ENTITY_SCHEMA');
89
+ const {
90
+ data: {
91
+ getEntitySchemas: [relationSchema]
92
+ }
93
+ } = await apolloClient.query({
94
+ query,
95
+ variables: { identifier: selectionDetails.relation.entityIdentifier }
96
+ });
97
+
98
+ const {
99
+ data: { result: selected = [] }
100
+ } = await apolloClient
101
+ .query({
102
+ query: getDynamicQuery('GET_ALL_ENTITIES')(relationSchema),
103
+ variables: {
104
+ where: {
105
+ id: {
106
+ _in: ids
107
+ }
108
+ },
109
+ sort: [{ property: 'name', direction: 'asc' }]
110
+ }
111
+ })
112
+ // eslint-disable-next-line no-console
113
+ .catch(e => console.error(e));
114
+
115
+ return {
116
+ id: property,
117
+ label: selectionDetails.label,
118
+ options: selected.map(item => [item.id, item.name])
119
+ };
120
+ } catch {
121
+ return null;
122
+ }
123
+ })
124
+ );
125
+
126
+ setSelectOptions(results.filter(Boolean));
127
+ })();
128
+ }, [apolloClient, filterData, schema, selectFiltersToDisplay]);
129
+
130
+ const updateFilters = useCallback(
131
+ (term, filters) => updateListFilters(term, filters, setListFilters, keywordSearchProperties),
132
+ [setListFilters, keywordSearchProperties]
133
+ );
134
+
135
+ const handleSearch = useCallback(
136
+ () => updateFilters(searchTerm, selectedFilters),
137
+ [searchTerm, selectedFilters, updateFilters]
138
+ );
139
+ const handleSearchChange = useCallback(e => setSearchTerm(e.target.value), []);
140
+ const handleEnterKey = useCallback(
141
+ e => {
142
+ if (e.key === ENTER_KEY) handleSearch();
143
+ },
144
+ [handleSearch]
145
+ );
146
+ const handleReset = useCallback(() => {
147
+ setSearchTerm('');
148
+ setSelectedFilters(
149
+ Object.keys(selectedFilters).reduce(
150
+ (acc, key) => ({ ...acc, [key]: DEFAULT_FILTER_OPTION_LABEL }),
151
+ {}
152
+ )
153
+ );
154
+ updateFilters('', {});
155
+ }, [selectedFilters, updateFilters]);
156
+ const handleSelect = useCallback(
157
+ (property, event) => {
158
+ const { value } = event;
159
+ const next = { ...selectedFilters, [property]: value };
160
+ setSelectedFilters(next);
161
+ updateFilters(searchTerm, next);
162
+ },
163
+ [searchTerm, selectedFilters, updateFilters]
164
+ );
165
+
166
+ const placeholderText = `Search ${keywordSearchLabels.join(', ')}`;
167
+
168
+ return (
169
+ <div className="search-container">
170
+ {displaySearchFilter && (
171
+ <div className="search-container__search-input-container">
172
+ <input
173
+ type="search"
174
+ className="search-container__search-input-container__search-input"
175
+ placeholder={placeholderText}
176
+ value={searchTerm}
177
+ onChange={handleSearchChange}
178
+ onKeyDown={handleEnterKey}
179
+ />
180
+ <i role="button" onClick={handleSearch}>
181
+ <BsSearch />
182
+ </i>
183
+ </div>
184
+ )}
185
+
186
+ {displaySelectFilters &&
187
+ selectOptions.map(({ id, options, label }) => (
188
+ <>
189
+ {options && !!options.length && (
190
+ <div className="search-container__select-wrapper">
191
+ <Select
192
+ label={label}
193
+ id={id}
194
+ name={id}
195
+ onChange={event => handleSelect(id, event)}
196
+ options={options}
197
+ value={selectedFilters[id]}
198
+ defaultTextValue={DEFAULT_FILTER_OPTION_LABEL}
199
+ />
200
+ </div>
201
+ )}
202
+ </>
203
+ ))}
204
+
205
+ <div className="search-container__reset-button">
206
+ <span role="button" onClick={handleReset}>
207
+ <BsArrowCounterclockwise />
208
+ </span>
209
+ </div>
210
+ </div>
211
+ );
212
+ };
213
+
214
+ SearchContainer.propTypes = {
215
+ setListFilters: PropTypes.func.isRequired,
216
+ keywordFiltersToUse: PropTypes.array,
217
+ selectFiltersToDisplay: PropTypes.array,
218
+ schema: PropTypes.object.isRequired,
219
+ index: PropTypes.string
220
+ };
221
+
222
+ SearchContainer.defaultProps = {
223
+ keywordFiltersToUse: [],
224
+ selectFiltersToDisplay: [],
225
+ index: 'admin'
226
+ };
227
+
228
+ export default SearchContainer;
@@ -0,0 +1,38 @@
1
+ import React, { useMemo } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { getKeywordSearchFilters, findSelectFilters } from './helpers';
4
+ import SearchContainer from './SearchContainer';
5
+
6
+ const SearchFilter = ({ schema, setListFilters }) => {
7
+ const { displayProperties = {} } = schema || {};
8
+ const {
9
+ adminListings: { dataSource: { source, index } = {}, disableListingFilter = false } = {}
10
+ } = displayProperties;
11
+
12
+ const keywordFiltersToUse = useMemo(() => getKeywordSearchFilters(schema), [schema]);
13
+ const selectFiltersToDisplay = useMemo(() => findSelectFilters(schema), [schema]);
14
+
15
+ if (disableListingFilter) return null;
16
+
17
+ const canSearch =
18
+ source === 'search' && (keywordFiltersToUse.length > 0 || selectFiltersToDisplay.length > 0);
19
+ if (!canSearch) return null;
20
+
21
+ return (
22
+ <SearchContainer
23
+ index={index}
24
+ key={schema.id}
25
+ setListFilters={setListFilters}
26
+ keywordFiltersToUse={keywordFiltersToUse}
27
+ selectFiltersToDisplay={selectFiltersToDisplay}
28
+ schema={schema}
29
+ />
30
+ );
31
+ };
32
+
33
+ SearchFilter.propTypes = {
34
+ setListFilters: PropTypes.func.isRequired,
35
+ schema: PropTypes.object.isRequired
36
+ };
37
+
38
+ export default SearchFilter;
@@ -0,0 +1,99 @@
1
+ import { DEFAULT_FILTER_OPTION_LABEL } from '../../../constants';
2
+
3
+ const updateListFilters = (searchTerm, selectedFilters, setListFilters, fields = []) => {
4
+ const filters = [];
5
+
6
+ if (searchTerm) {
7
+ filters.push({
8
+ simple_query_string: {
9
+ query: `${searchTerm}`,
10
+ default_operator: 'AND',
11
+ fields: fields.map(field => field)
12
+ }
13
+ });
14
+ }
15
+
16
+ Object.entries(selectedFilters).forEach(([filterKey, filterValue]) => {
17
+ if (!filterValue || filterValue === DEFAULT_FILTER_OPTION_LABEL) return;
18
+ filters.push({
19
+ match: {
20
+ [`${filterKey}.keyword`]: {
21
+ query: filterValue
22
+ }
23
+ }
24
+ });
25
+ });
26
+
27
+ setListFilters(filters);
28
+ };
29
+
30
+ const getKeywordSearchFilters = schema => {
31
+ if (!schema || !schema.properties) return [];
32
+
33
+ const { properties = {}, dynamicProperties = {} } = schema;
34
+
35
+ const propertyKeyword = Object.entries(properties).filter(isFilterKeywordItem);
36
+ const dynamicPropertyKeywords = Object.entries(dynamicProperties).filter(isFilterKeywordItem);
37
+
38
+ return [...propertyKeyword, ...dynamicPropertyKeywords];
39
+ };
40
+
41
+ const isFilterKeywordItem = ([, item]) =>
42
+ item.adminListingOptions && item.adminListingOptions.includeInKeywordSeach === true;
43
+
44
+ const findSelectFilters = schema => {
45
+ if (!schema || !schema.properties) return [];
46
+
47
+ const { properties = {}, dynamicProperties = {} } = schema;
48
+
49
+ const propertySelects = Object.entries(properties).filter(isFilterSelectItem);
50
+ const dynamicPropertySelects = Object.entries(dynamicProperties).filter(isFilterSelectItem);
51
+
52
+ return [...propertySelects, ...dynamicPropertySelects];
53
+ };
54
+
55
+ const isFilterSelectItem = ([, item]) =>
56
+ item.adminListingOptions && item.adminListingOptions.filterType === 'select';
57
+
58
+ const buildQueryFields = (selectFilters, entityId) => {
59
+ if (!Array.isArray(selectFilters) || selectFilters.length === 0) {
60
+ return { gqlFields: '', rawQuery: '{}' };
61
+ }
62
+
63
+ const aggs = {};
64
+ selectFilters.forEach(([property, details]) => {
65
+ aggs[property] = {
66
+ terms: {
67
+ field: `${property}.keyword`, // todo: handle different field types
68
+ size: 1000, // todo: customise size
69
+ order: {
70
+ _key: 'asc'
71
+ }
72
+ }
73
+ };
74
+ });
75
+
76
+ const docType = entityId;
77
+ const rawQueryObject = {
78
+ size: 0,
79
+ query: {
80
+ bool: {
81
+ filter: {
82
+ bool: {
83
+ must: [{ match: { docType } }]
84
+ }
85
+ }
86
+ }
87
+ },
88
+ aggs
89
+ };
90
+ const rawQuery = JSON.stringify(rawQueryObject);
91
+
92
+ const gqlFields = `
93
+ rawResults
94
+ `;
95
+
96
+ return { gqlFields, rawQuery };
97
+ };
98
+
99
+ export { buildQueryFields, updateListFilters, getKeywordSearchFilters, findSelectFilters };
@@ -0,0 +1,9 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ const NOOP_QUERY = gql`
4
+ query NoOp {
5
+ __typename
6
+ }
7
+ `;
8
+
9
+ export { NOOP_QUERY };
@@ -5,6 +5,7 @@ import TableActions from '../TableActions';
5
5
  import { ACTIONS } from '../../../constants';
6
6
  import InfoBoxValue from '../../InfoBoxes/presentational/InfoBoxValue';
7
7
  import InfoBoxLabel from '../../InfoBoxes/presentational/InfoBoxLabel';
8
+ import InfoBoxTooltip from '../../InfoBoxes/InfoBoxTooltip';
8
9
 
9
10
  const formatRows = ({
10
11
  rows,
@@ -17,6 +18,7 @@ const formatRows = ({
17
18
  }) =>
18
19
  rows.map(data => {
19
20
  const editUrl = `${url}/update/${data.id}`;
21
+
20
22
  const rowProps = {
21
23
  ...data,
22
24
  [firstColumn]: (
@@ -65,6 +67,7 @@ const buildArrayRowContent = rowData => (
65
67
  </span>
66
68
  <span className="table-row-list__group__item__value">
67
69
  <InfoBoxValue item={item} />
70
+ <InfoBoxTooltip info={item} />
68
71
  </span>
69
72
  </div>
70
73
  ))}
@@ -34,11 +34,11 @@ function buildVariables({ entitySchema, isSearchQuery, listFilters = [], queryPa
34
34
  }
35
35
 
36
36
  const fetchData = async ({ client, querySettings: { entitySchema, queryParams }, listFilters }) => {
37
- const { displayProperties: { adminListings: { dataSource: { source } = {} } = {} } = {} } =
37
+ const { displayProperties: { adminListings: { dataSource: { source, index } = {} } = {} } = {} } =
38
38
  entitySchema;
39
39
 
40
40
  const isSearchQuery = source === 'search';
41
- const query = buildListingQuery(entitySchema, isSearchQuery);
41
+ const query = buildListingQuery(entitySchema, index, isSearchQuery);
42
42
  const variables = buildVariables({ entitySchema, listFilters, queryParams, isSearchQuery });
43
43
 
44
44
  const { data = {} } = await client.query({
@@ -1,11 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Tab, TabItem } from '@blaze-react/tab';
4
- import {
5
- useReadFromCache,
6
- GET_CURRENT_TAB_ID,
7
- TabsContextProvider
8
- } from '@blaze-cms/admin-ui-utils';
4
+ import { useTabsContext, TabsContextProvider } from '@blaze-cms/admin-ui-utils';
9
5
  import {
10
6
  PAGE_BUILDER_TAB,
11
7
  PAGE_BUILDER_TAB_INDEX,
@@ -14,25 +10,25 @@ import {
14
10
  } from '../../constants';
15
11
 
16
12
  const Tabs = ({ children, onTabChange, enabled }) => {
17
- const { currentTabId } = useReadFromCache({ query: GET_CURRENT_TAB_ID }) || EDITOR_VIEW_TAB_INDEX;
13
+ const { currentTabId = EDITOR_VIEW_TAB_INDEX } = useTabsContext() || {};
18
14
  const [activeAccordions, setActiveAccordions] = useState([]);
19
- return enabled ? (
20
- <>
21
- <TabsContextProvider value={{ currentTabId, activeAccordions, setActiveAccordions }}>
22
- <Tab selected={currentTabId}>
23
- <TabItem title={EDITOR_VIEW_TAB} action={() => onTabChange(EDITOR_VIEW_TAB_INDEX)}>
24
- {children}
25
- </TabItem>
26
- <TabItem title={PAGE_BUILDER_TAB} action={() => onTabChange(PAGE_BUILDER_TAB_INDEX)}>
27
- {children}
28
- </TabItem>
29
- </Tab>
30
- </TabsContextProvider>
31
- </>
32
- ) : (
33
- <>{children}</>
15
+
16
+ if (!enabled) return children;
17
+
18
+ return (
19
+ <TabsContextProvider value={{ currentTabId, activeAccordions, setActiveAccordions }}>
20
+ <Tab selected={currentTabId}>
21
+ <TabItem title={EDITOR_VIEW_TAB} action={() => onTabChange(EDITOR_VIEW_TAB_INDEX)}>
22
+ {children}
23
+ </TabItem>
24
+ <TabItem title={PAGE_BUILDER_TAB} action={() => onTabChange(PAGE_BUILDER_TAB_INDEX)}>
25
+ {children}
26
+ </TabItem>
27
+ </Tab>
28
+ </TabsContextProvider>
34
29
  );
35
30
  };
31
+
36
32
  Tabs.propTypes = {
37
33
  children: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]).isRequired,
38
34
  onTabChange: PropTypes.func.isRequired,
package/src/constants.js CHANGED
@@ -26,6 +26,8 @@ const PAGE_BUILDER_TAB_INDEX = 1;
26
26
  const EDITOR_VIEW_TAB = 'Editor view';
27
27
  const EDITOR_VIEW_TAB_INDEX = 0;
28
28
 
29
+ const ENTER_KEY = 'Enter';
30
+
29
31
  const ICON_SIZE = {
30
32
  WIDTH: '25px',
31
33
  HEIGHT: '25px'
@@ -36,8 +38,12 @@ const ICON_COLOR = {
36
38
  FILL: '#63779C'
37
39
  };
38
40
 
41
+ const DEFAULT_FILTER_OPTION_LABEL = 'Any';
42
+ const DEBUG_PARAM = 'blaze_debug=1';
43
+
39
44
  export {
40
45
  DATA_LISTING_PREFIX,
46
+ DEBUG_PARAM,
41
47
  ENTITY_PUBLISHED,
42
48
  KEY_TO_CHECK,
43
49
  LEAVE_PAGE_MESSAGE,
@@ -63,5 +69,7 @@ export {
63
69
  SAVE_BEFORE_PUBLISH_MESSAGE,
64
70
  ICON_SIZE,
65
71
  ICON_COLOR,
66
- PAGE_NOT_FOUND
72
+ PAGE_NOT_FOUND,
73
+ ENTER_KEY,
74
+ DEFAULT_FILTER_OPTION_LABEL
67
75
  };
package/src/index.js CHANGED
@@ -1,16 +1,18 @@
1
1
  import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';
2
- import React from 'react';
3
2
  import pkg from '../package.json';
4
3
  import { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';
5
4
  import getAddContentMenuItems from './utils/add-content-menu-items';
6
5
  import { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';
6
+ import EntityDataListing from './components/EntityDataListing';
7
+ import EntityManager from './components/EntityManager';
7
8
 
8
- const EntityDataListing = React.lazy(
9
- () => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
10
- );
11
- const EntityManager = React.lazy(
12
- () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
13
- );
9
+ // todo: renable lazy loading after bundler optimisations, currently they are too slow in dev mode
10
+ // const EntityDataListing = React.lazy(
11
+ // () => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
12
+ // );
13
+ // const EntityManager = React.lazy(
14
+ // () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
15
+ // );
14
16
 
15
17
  export default async function load(app) {
16
18
  app.events.once('admin:menu:config:load', getAddContentMenuItems(app));
@@ -2,21 +2,21 @@ import { gql } from '@apollo/client';
2
2
  import { BlazeError } from '@blaze-cms/core-errors';
3
3
  import { getDynamicQuery } from '@blaze-cms/admin-ui-utils';
4
4
 
5
- const buildAdminSearchQuery = entitySchema => {
5
+ const buildAdminSearchQuery = (entitySchema, index) => {
6
6
  const { listingProperties = [] } = entitySchema || {};
7
7
  const parsedProperties = `id, ${listingProperties.join(' ') || 'id name'}`;
8
8
 
9
- return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true);
9
+ return getDynamicQuery('ADMIN_SEARCH')([entitySchema], parsedProperties, true, index);
10
10
  };
11
11
 
12
- function buildListingQuery(entitySchema, isSearchQuery) {
12
+ function buildListingQuery(entitySchema, index, isSearchQuery) {
13
13
  if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {
14
14
  throw new BlazeError(
15
15
  'Listing query requires getAll action and listingProperties from entity schema'
16
16
  );
17
17
  }
18
18
 
19
- if (isSearchQuery) return buildAdminSearchQuery(entitySchema);
19
+ if (isSearchQuery) return buildAdminSearchQuery(entitySchema, index);
20
20
 
21
21
  const sortType =
22
22
  entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';
3
3
 
4
- export const withContext = Component => props => {
5
- const contexts = useMainContext(MainContext);
6
- return <Component {...props} {...contexts} />;
7
- };
4
+ export const withContext = Component =>
5
+ function (props) {
6
+ const contexts = useMainContext(MainContext);
7
+ return <Component {...props} {...contexts} />;
8
+ };
@@ -1,33 +0,0 @@
1
- import { useQuery } from '@apollo/client';
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { getQuery } from '@blaze-cms/admin-ui-utils';
5
- import ListingTable from '../ListingTable/ListingTable';
6
- import { withContext } from '../../utils/hoc/withContext';
7
- const EntityDataListing = ({
8
- match
9
- }) => {
10
- const {
11
- params: {
12
- entityIdentifier: identifier
13
- }
14
- } = match;
15
- const {
16
- data: {
17
- getEntitySchemas = []
18
- } = {}
19
- } = useQuery(getQuery('GET_ENTITY_SCHEMA'), {
20
- variables: {
21
- identifier
22
- }
23
- });
24
- if (!getEntitySchemas.length) return '';
25
- return /*#__PURE__*/React.createElement(ListingTable, {
26
- entitySchema: getEntitySchemas[0]
27
- });
28
- };
29
- EntityDataListing.propTypes = {
30
- match: PropTypes.object.isRequired
31
- };
32
- export default withContext(EntityDataListing);
33
- //# sourceMappingURL=EntityDataListing.js.map