@rebasepro/cms 0.28.2 → 0.29.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 (339) hide show
  1. package/README.md +3 -3
  2. package/dist/collection_editor/_cms_internals.d.ts +0 -1
  3. package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -2
  4. package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -1
  5. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +2 -2
  6. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
  7. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +1 -1
  8. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -1
  9. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +1 -1
  10. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -1
  11. package/dist/components/AdditionalFieldValue.d.ts +9 -3
  12. package/dist/components/AdditionalFieldValue.js +7 -4
  13. package/dist/components/AdditionalFieldValue.js.map +1 -1
  14. package/dist/components/CollectionPanel.d.ts +117 -18
  15. package/dist/components/CollectionPanel.js +115 -37
  16. package/dist/components/CollectionPanel.js.map +1 -1
  17. package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +5 -5
  18. package/dist/components/CollectionTableBinding/CollectionRowActions.js +16 -12
  19. package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
  20. package/dist/components/CollectionTableBinding/CollectionTableBinding.js +33 -8
  21. package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
  22. package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +8 -3
  23. package/dist/components/CollectionTableBinding/PropertyTableCell.js +2 -2
  24. package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
  25. package/dist/components/CollectionTableBinding/column_utils.d.ts +9 -1
  26. package/dist/components/CollectionTableBinding/column_utils.js +6 -3
  27. package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
  28. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +2 -2
  29. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
  30. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
  31. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
  32. package/dist/components/CollectionTableBinding/fields/TableRelationField.js +2 -2
  33. package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
  34. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +3 -2
  35. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +9 -7
  36. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
  37. package/dist/components/CollectionTableBinding/internal/common.d.ts +26 -2
  38. package/dist/components/CollectionTableBinding/internal/common.js +88 -4
  39. package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
  40. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +4 -3
  41. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
  42. package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +7 -1
  43. package/dist/components/CollectionViewBinding/BoardCardBinding.js +19 -14
  44. package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
  45. package/dist/components/CollectionViewBinding/CollectionAddButton.d.ts +28 -0
  46. package/dist/components/CollectionViewBinding/CollectionAddButton.js +50 -0
  47. package/dist/components/CollectionViewBinding/CollectionAddButton.js.map +1 -0
  48. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +11 -3
  49. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -4
  50. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
  51. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +5 -3
  52. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +5 -3
  53. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
  54. package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +29 -0
  55. package/dist/components/CollectionViewBinding/CollectionEntityActions.js +112 -0
  56. package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -0
  57. package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +2 -2
  58. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +58 -16
  59. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
  60. package/dist/components/CollectionViewBinding/CollectionToolbar.d.ts +57 -0
  61. package/dist/components/CollectionViewBinding/CollectionToolbar.js +146 -0
  62. package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -0
  63. package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +2 -2
  64. package/dist/components/CollectionViewBinding/CollectionViewActions.js +22 -26
  65. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
  66. package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +58 -22
  67. package/dist/components/CollectionViewBinding/CollectionViewBinding.js +81 -1089
  68. package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
  69. package/dist/components/CollectionViewBinding/CollectionViewContent.d.ts +9 -0
  70. package/dist/components/CollectionViewBinding/CollectionViewContent.js +152 -0
  71. package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -0
  72. package/dist/components/CollectionViewBinding/CollectionViewDialogs.d.ts +9 -0
  73. package/dist/components/CollectionViewBinding/CollectionViewDialogs.js +38 -0
  74. package/dist/components/CollectionViewBinding/CollectionViewDialogs.js.map +1 -0
  75. package/dist/components/CollectionViewBinding/CollectionViewFrame.d.ts +13 -0
  76. package/dist/components/CollectionViewBinding/CollectionViewFrame.js +32 -0
  77. package/dist/components/CollectionViewBinding/CollectionViewFrame.js.map +1 -0
  78. package/dist/components/CollectionViewBinding/CollectionViewScope.d.ts +14 -0
  79. package/dist/components/CollectionViewBinding/CollectionViewScope.js +22 -0
  80. package/dist/components/CollectionViewBinding/CollectionViewScope.js.map +1 -0
  81. package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +2 -2
  82. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +39 -67
  83. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
  84. package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +28 -0
  85. package/dist/components/CollectionViewBinding/CustomViewHost.js +54 -0
  86. package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -0
  87. package/dist/components/CollectionViewBinding/EntitiesCount.d.ts +24 -0
  88. package/dist/components/CollectionViewBinding/EntitiesCount.js +69 -0
  89. package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -0
  90. package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +7 -1
  91. package/dist/components/CollectionViewBinding/EntityCardBinding.js +34 -23
  92. package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
  93. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.d.ts +17 -0
  94. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +107 -0
  95. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -0
  96. package/dist/components/CollectionViewBinding/FiltersButton.d.ts +15 -0
  97. package/dist/components/CollectionViewBinding/FiltersButton.js +49 -0
  98. package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -0
  99. package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +35 -0
  100. package/dist/components/CollectionViewBinding/PluginColumnSlots.js +45 -0
  101. package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -0
  102. package/dist/components/CollectionViewBinding/RowActions.d.ts +40 -0
  103. package/dist/components/CollectionViewBinding/RowActions.js +60 -0
  104. package/dist/components/CollectionViewBinding/RowActions.js.map +1 -0
  105. package/dist/components/CollectionViewBinding/SplitListView.d.ts +7 -4
  106. package/dist/components/CollectionViewBinding/SplitListView.js +20 -21
  107. package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
  108. package/dist/components/CollectionViewBinding/builtin_action_props.d.ts +13 -0
  109. package/dist/components/CollectionViewBinding/fields.d.ts +22 -0
  110. package/dist/components/CollectionViewBinding/fields.js +47 -0
  111. package/dist/components/CollectionViewBinding/fields.js.map +1 -0
  112. package/dist/components/CollectionViewBinding/useBoardDataController.js +6 -7
  113. package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
  114. package/dist/components/CollectionViewBinding/useCollectionLargeLayout.d.ts +19 -0
  115. package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js +28 -0
  116. package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js.map +1 -0
  117. package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +125 -0
  118. package/dist/components/CollectionViewBinding/useCollectionViewState.js +844 -0
  119. package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -0
  120. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +20 -0
  121. package/dist/components/CollectionViewBinding/usePreviewSlots.js +23 -2
  122. package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
  123. package/dist/components/CollectionViewBinding/useSelectionController.d.ts +21 -3
  124. package/dist/components/CollectionViewBinding/useSelectionController.js +37 -6
  125. package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
  126. package/dist/components/CollectionsProvider.d.ts +3 -3
  127. package/dist/components/CollectionsProvider.js +4 -4
  128. package/dist/components/CollectionsProvider.js.map +1 -1
  129. package/dist/components/CollectionsScopeContext.d.ts +1 -1
  130. package/dist/components/CollectionsScopeContext.js +1 -1
  131. package/dist/components/CollectionsScopeContext.js.map +1 -1
  132. package/dist/components/DeleteEntityDialog.d.ts +1 -1
  133. package/dist/components/DeleteEntityDialog.js +2 -2
  134. package/dist/components/DeleteEntityDialog.js.map +1 -1
  135. package/dist/components/DetailViewBinding.js +32 -68
  136. package/dist/components/DetailViewBinding.js.map +1 -1
  137. package/dist/components/EditFormActions.js +5 -4
  138. package/dist/components/EditFormActions.js.map +1 -1
  139. package/dist/components/EditViewBinding.d.ts +2 -2
  140. package/dist/components/EditViewBinding.js +25 -15
  141. package/dist/components/EditViewBinding.js.map +1 -1
  142. package/dist/components/EntityDisplayHeader.js +8 -5
  143. package/dist/components/EntityDisplayHeader.js.map +1 -1
  144. package/dist/components/EntityPreviewBinding.js +1 -1
  145. package/dist/components/EntityPreviewBinding.js.map +1 -1
  146. package/dist/components/EntityViewBinding.d.ts +8 -1
  147. package/dist/components/EntityViewBinding.js +43 -14
  148. package/dist/components/EntityViewBinding.js.map +1 -1
  149. package/dist/components/EntityViewBody.d.ts +40 -0
  150. package/dist/components/EntityViewBody.js +90 -0
  151. package/dist/components/EntityViewBody.js.map +1 -0
  152. package/dist/components/FieldValue.d.ts +50 -0
  153. package/dist/components/FieldValue.js +81 -0
  154. package/dist/components/FieldValue.js.map +1 -0
  155. package/dist/components/InlineEntityPreview.js +1 -1
  156. package/dist/components/InlineEntityPreview.js.map +1 -1
  157. package/dist/components/PanelNotFound.d.ts +5 -0
  158. package/dist/components/PanelNotFound.js +21 -0
  159. package/dist/components/PanelNotFound.js.map +1 -0
  160. package/dist/components/RebaseCMS.d.ts +1 -1
  161. package/dist/components/RebaseCMS.js +11 -3
  162. package/dist/components/RebaseCMS.js.map +1 -1
  163. package/dist/components/RebaseNavigation.js +9 -3
  164. package/dist/components/RebaseNavigation.js.map +1 -1
  165. package/dist/components/RebaseShell.js +10 -5
  166. package/dist/components/RebaseShell.js.map +1 -1
  167. package/dist/components/RecordDetail.d.ts +61 -0
  168. package/dist/components/RecordDetail.js +123 -0
  169. package/dist/components/RecordDetail.js.map +1 -0
  170. package/dist/components/RecordForm.d.ts +126 -0
  171. package/dist/components/{EntityFormPanel.js → RecordForm.js} +64 -36
  172. package/dist/components/RecordForm.js.map +1 -0
  173. package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +47 -17
  174. package/dist/components/ReferenceTable/SelectionTableBinding.js +89 -53
  175. package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
  176. package/dist/components/ReferenceWidget.d.ts +5 -3
  177. package/dist/components/ReferenceWidget.js +10 -7
  178. package/dist/components/ReferenceWidget.js.map +1 -1
  179. package/dist/components/RelationSelector.js +4 -4
  180. package/dist/components/RelationSelector.js.map +1 -1
  181. package/dist/components/SelectableTable/SelectableTable.js +2 -3
  182. package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
  183. package/dist/components/SelectableTable/SelectionStore.d.ts +1 -1
  184. package/dist/components/SelectableTable/SelectionStore.js +1 -1
  185. package/dist/components/SelectableTable/SelectionStore.js.map +1 -1
  186. package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
  187. package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
  188. package/dist/components/SidePanelBinding.js +13 -12
  189. package/dist/components/SidePanelBinding.js.map +1 -1
  190. package/dist/components/collection_prop.d.ts +18 -0
  191. package/dist/components/collection_prop.js +23 -0
  192. package/dist/components/collection_prop.js.map +1 -0
  193. package/dist/components/common/default_entity_actions.js +54 -54
  194. package/dist/components/common/default_entity_actions.js.map +1 -1
  195. package/dist/components/history/EntityHistoryView.d.ts +4 -1
  196. package/dist/components/history/EntityHistoryView.js +1 -1
  197. package/dist/components/history/EntityHistoryView.js.map +1 -1
  198. package/dist/components/history/LastEditedByFormAction.d.ts +1 -1
  199. package/dist/components/index.d.ts +4 -2
  200. package/dist/data_export/export/ExportCollectionAction.d.ts +3 -2
  201. package/dist/data_export/export/ExportCollectionAction.js +4 -3
  202. package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
  203. package/dist/data_export/export/additional_fields.d.ts +6 -3
  204. package/dist/data_export/export/additional_fields.js +8 -4
  205. package/dist/data_export/export/additional_fields.js.map +1 -1
  206. package/dist/data_import/import/ImportCollectionAction.js +2 -2
  207. package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
  208. package/dist/form/EntityForm.d.ts +1 -1
  209. package/dist/form/EntityForm.js +255 -150
  210. package/dist/form/EntityForm.js.map +1 -1
  211. package/dist/form/EntityFormActions.js +3 -2
  212. package/dist/form/EntityFormActions.js.map +1 -1
  213. package/dist/form/EntityFormBinding.d.ts +1 -1
  214. package/dist/form/EntityFormBinding.js +22 -11
  215. package/dist/form/EntityFormBinding.js.map +1 -1
  216. package/dist/form/FormField.d.ts +36 -0
  217. package/dist/form/FormField.js +41 -0
  218. package/dist/form/FormField.js.map +1 -0
  219. package/dist/form/FormFieldsContext.d.ts +69 -0
  220. package/dist/form/FormFieldsContext.js +143 -0
  221. package/dist/form/FormFieldsContext.js.map +1 -0
  222. package/dist/form/PropertyFieldBinding.js +4 -4
  223. package/dist/form/PropertyFieldBinding.js.map +1 -1
  224. package/dist/form/collection_showing.d.ts +8 -0
  225. package/dist/form/collection_showing.js +29 -0
  226. package/dist/form/collection_showing.js.map +1 -0
  227. package/dist/form/components/ErrorFocus.js +2 -1
  228. package/dist/form/components/ErrorFocus.js.map +1 -1
  229. package/dist/form/components/FieldBlock.js +3 -1
  230. package/dist/form/components/FieldBlock.js.map +1 -1
  231. package/dist/form/components/FormRail.d.ts +5 -1
  232. package/dist/form/components/FormRail.js +5 -1
  233. package/dist/form/components/FormRail.js.map +1 -1
  234. package/dist/form/components/FormSections.d.ts +5 -1
  235. package/dist/form/components/FormSections.js +11 -4
  236. package/dist/form/components/FormSections.js.map +1 -1
  237. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
  238. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
  239. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
  240. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
  241. package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
  242. package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
  243. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
  244. package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
  245. package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
  246. package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
  247. package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
  248. package/dist/form/field_bindings/StorageUploadFieldBinding.js +1 -1
  249. package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
  250. package/dist/form/form_dom_ids.d.ts +25 -0
  251. package/dist/form/form_dom_ids.js +42 -0
  252. package/dist/form/form_dom_ids.js.map +1 -0
  253. package/dist/form/index.d.ts +3 -1
  254. package/dist/form/resolve_cell_property.d.ts +5 -0
  255. package/dist/form/resolve_cell_property.js +22 -1
  256. package/dist/form/resolve_cell_property.js.map +1 -1
  257. package/dist/hooks/index.d.ts +1 -1
  258. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +2 -2
  259. package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
  260. package/dist/hooks/navigation/useNavigationResolution.d.ts +3 -3
  261. package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
  262. package/dist/hooks/navigation/useResolvedCollections.d.ts +2 -2
  263. package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
  264. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -2
  265. package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
  266. package/dist/hooks/useBuildSidePanel.js +9 -9
  267. package/dist/hooks/useBuildSidePanel.js.map +1 -1
  268. package/dist/hooks/useEntityDisplay.js +6 -4
  269. package/dist/hooks/useEntityDisplay.js.map +1 -1
  270. package/dist/hooks/useRecordActions.js +2 -2
  271. package/dist/hooks/useRecordActions.js.map +1 -1
  272. package/dist/hooks/useSelectionDialog.d.ts +20 -7
  273. package/dist/hooks/useSelectionDialog.js +29 -8
  274. package/dist/hooks/useSelectionDialog.js.map +1 -1
  275. package/dist/index.d.ts +8 -3
  276. package/dist/index.js +15 -9
  277. package/dist/mcp-view.d.ts +9 -0
  278. package/dist/mcp-view.js +2 -0
  279. package/dist/mcp_view/app_modules.d.ts +29 -0
  280. package/dist/mcp_view/app_modules.js +163 -0
  281. package/dist/mcp_view/app_modules.js.map +1 -0
  282. package/dist/mcp_view/bridge.d.ts +90 -0
  283. package/dist/mcp_view/bridge.js +205 -0
  284. package/dist/mcp_view/bridge.js.map +1 -0
  285. package/dist/mcp_view/code_app.d.ts +65 -0
  286. package/dist/mcp_view/code_app.js +139 -0
  287. package/dist/mcp_view/code_app.js.map +1 -0
  288. package/dist/mcp_view/index.d.ts +54 -0
  289. package/dist/mcp_view/index.js +262 -0
  290. package/dist/mcp_view/index.js.map +1 -0
  291. package/dist/mcp_view/payload.d.ts +78 -0
  292. package/dist/mcp_view/payload.js +155 -0
  293. package/dist/mcp_view/payload.js.map +1 -0
  294. package/dist/mcp_view/screen.d.ts +30 -0
  295. package/dist/mcp_view/screen.js +245 -0
  296. package/dist/mcp_view/screen.js.map +1 -0
  297. package/dist/mcp_view/storage_source.d.ts +14 -0
  298. package/dist/mcp_view/storage_source.js +29 -0
  299. package/dist/mcp_view/storage_source.js.map +1 -0
  300. package/dist/mcp_view/store.d.ts +9 -0
  301. package/dist/mcp_view/store.js +27 -0
  302. package/dist/mcp_view/store.js.map +1 -0
  303. package/dist/mcp_view/tool_driver.d.ts +160 -0
  304. package/dist/mcp_view/tool_driver.js +575 -0
  305. package/dist/mcp_view/tool_driver.js.map +1 -0
  306. package/dist/preview/components/DatePreview.d.ts +34 -1
  307. package/dist/preview/components/DatePreview.js +72 -37
  308. package/dist/preview/components/DatePreview.js.map +1 -1
  309. package/dist/routes/RebaseRoute.js +1 -1
  310. package/dist/routes/RebaseRoute.js.map +1 -1
  311. package/dist/selection/SelectionMenu.d.ts +5 -3
  312. package/dist/selection/SelectionMenu.js +16 -9
  313. package/dist/selection/SelectionMenu.js.map +1 -1
  314. package/dist/selection/index.d.ts +2 -1
  315. package/dist/selection/resolve_selection.d.ts +61 -7
  316. package/dist/selection/resolve_selection.js +93 -11
  317. package/dist/selection/resolve_selection.js.map +1 -1
  318. package/dist/types/components/EntityFormProps.d.ts +60 -10
  319. package/dist/types/fields.d.ts +2 -65
  320. package/dist/util/dataControllerAdapter.d.ts +8 -0
  321. package/dist/util/dataControllerAdapter.js +11 -0
  322. package/dist/util/dataControllerAdapter.js.map +1 -1
  323. package/dist/util/navigation_utils.d.ts +5 -4
  324. package/dist/util/navigation_utils.js +6 -6
  325. package/dist/util/navigation_utils.js.map +1 -1
  326. package/dist/util/propertyConfigMapper.d.ts +8 -0
  327. package/dist/util/propertyConfigMapper.js +16 -2
  328. package/dist/util/propertyConfigMapper.js.map +1 -1
  329. package/package.json +15 -9
  330. package/recipes/README.md +79 -26
  331. package/recipes/approval-queue.tsx +79 -0
  332. package/recipes/bulk-set-status.tsx +23 -17
  333. package/recipes/calendar-view.tsx +28 -23
  334. package/recipes/master-detail.tsx +75 -0
  335. package/recipes/my-preferences.tsx +3 -3
  336. package/recipes/orders-dashboard.tsx +58 -84
  337. package/recipes/site-settings.tsx +4 -4
  338. package/dist/components/EntityFormPanel.d.ts +0 -63
  339. package/dist/components/EntityFormPanel.js.map +0 -1
@@ -6,24 +6,24 @@ import { addInitialSlash, getCollectionBySlugWithin, getCollectionPathsCombinati
6
6
  * Navigate to a entity using either a side panel or full-screen mode.
7
7
  * This is an admin-specific UI concern and lives here (not in common).
8
8
  */
9
- function navigateToEntity({ openEntityMode, collection, entityId, copy, path, selectedTab, defaultValues, sidePanelController, onClose, onUpdate, navigation, replace }) {
9
+ function navigateToEntity({ openEntityMode, collection, id, copy, path, selectedTab, defaultValues, sidePanelController, onClose, onSaved, navigation, replace }) {
10
10
  const mode = navigation.routesMounted === false && openEntityMode !== "dialog" ? "side_panel" : openEntityMode;
11
11
  if (mode === "side_panel" || mode === "dialog") sidePanelController.open({
12
- entityId,
12
+ id,
13
13
  path,
14
14
  copy,
15
15
  selectedTab,
16
16
  collection,
17
17
  updateUrl: mode !== "dialog",
18
18
  onClose,
19
- onUpdate,
19
+ onSaved,
20
20
  defaultValues
21
21
  });
22
22
  else {
23
- let to = navigation.buildUrlCollectionPath(hasEntityId(entityId) ? `${path}/${entityId}` : path);
24
- if (hasEntityId(entityId) && selectedTab) to += `/${selectedTab}`;
23
+ let to = navigation.buildUrlCollectionPath(hasEntityId(id) ? `${path}/${id}` : path);
24
+ if (hasEntityId(id) && selectedTab) to += `/${selectedTab}`;
25
25
  to = withListState(to);
26
- if (!hasEntityId(entityId)) to += "#new";
26
+ if (!hasEntityId(id)) to += "#new";
27
27
  if (copy) to += "#copy";
28
28
  const navigateOptions = {};
29
29
  if (replace !== void 0) navigateOptions.replace = replace;
@@ -1 +1 @@
1
- {"version":3,"file":"navigation_utils.js","names":[],"sources":["../../src/util/navigation_utils.ts"],"sourcesContent":["\nimport type { UrlController, SidePanelBindingProps, SidePanelController, NavigateOptions, AdminCollection } from \"@rebasepro/cms-types\";\nimport { hasEntityId } from \"@rebasepro/common\";\nimport { withListState } from \"./view_mode\";\n\n// Canonical path utilities — single source of truth in @rebasepro/common\nexport { removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, addInitialSlash, getLastSegment, resolveCollectionPathIds, getCollectionBySlugWithin, getCollectionPathsCombinations } from \"@rebasepro/app\";\n\n/**\n * Navigate to a entity using either a side panel or full-screen mode.\n * This is an admin-specific UI concern and lives here (not in common).\n */\nexport function navigateToEntity({\n openEntityMode,\n collection,\n entityId,\n copy,\n path,\n selectedTab,\n defaultValues,\n sidePanelController,\n onClose,\n onUpdate,\n navigation,\n replace\n}:\n\n {\n openEntityMode?: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n collection?: AdminCollection;\n entityId?: string | number;\n selectedTab?: string;\n copy?: boolean;\n /**\n * Pre-populate the new entity form with these values.\n * Only applied when entityId is not set (i.e. \"new\" mode).\n *\n * Side panel: passed through SidePanelBindingProps → EditViewBinding.\n * Full screen: carried via React Router location.state so the route\n * component can read it on mount without polluting the URL.\n */\n defaultValues?: Record<string, unknown>;\n path: string;\n sidePanelController: SidePanelController;\n onClose?: () => void;\n /**\n * Called when the side panel or dialog saves the record. A full-screen\n * record replaces the view that opened it, and that view reads\n * everything again when it comes back, so nothing is called there.\n */\n onUpdate?: SidePanelBindingProps[\"onUpdate\"];\n navigation: UrlController;\n replace?: boolean;\n }) {\n\n // No CMS route serves this page (a collection embedded in the host app's\n // own page): there is no URL to go to, so the record opens over the page.\n const mode = navigation.routesMounted === false && openEntityMode !== \"dialog\"\n ? \"side_panel\"\n : openEntityMode;\n\n if (mode === \"side_panel\" || mode === \"dialog\") {\n\n sidePanelController.open({\n entityId,\n path: path,\n copy,\n selectedTab,\n collection,\n updateUrl: mode !== \"dialog\",\n onClose,\n onUpdate,\n defaultValues\n });\n\n } else {\n let to = navigation.buildUrlCollectionPath(hasEntityId(entityId) ? `${path}/${entityId}` : path);\n if (hasEntityId(entityId) && selectedTab) {\n to += `/${selectedTab}`;\n }\n // The whole list state, not just the view mode: a record opened from a\n // search must come back to that search.\n to = withListState(to);\n if (!hasEntityId(entityId)) {\n to += \"#new\";\n }\n if (copy) {\n to += \"#copy\";\n }\n // Use React Router location.state to carry defaultValues — the correct SPA\n // approach. No URL size limits, no encoding, nothing in the address bar.\n // EntityFullScreenRoute reads location.state.defaultValues on mount.\n const navigateOptions: NavigateOptions = {};\n if (replace !== undefined) {\n navigateOptions.replace = replace;\n }\n if (defaultValues) {\n navigateOptions.state = { defaultValues };\n }\n const hasOptions = Object.keys(navigateOptions).length > 0;\n navigation.navigate(to, hasOptions ? navigateOptions : undefined);\n }\n\n}\n\n/**\n * Whether `pathname` is the record at `entityPath` or somewhere below it — one\n * of its tabs, its `/edit`. A path segment, not a string prefix:\n * `/c/products/12` is another record, not a place inside `/c/products/1`.\n */\nexport function isPathWithinRecord(pathname: string, entityPath: string): boolean {\n return pathname === entityPath || pathname.startsWith(`${entityPath}/`);\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,iBAAiB,EAC7B,gBACA,YACA,UACA,MACA,MACA,aACA,eACA,qBACA,SACA,UACA,YACA,WA6BG;CAIH,MAAM,OAAO,WAAW,kBAAkB,SAAS,mBAAmB,WAChE,eACA;CAEN,IAAI,SAAS,gBAAgB,SAAS,UAElC,oBAAoB,KAAK;EACrB;EACM;EACN;EACA;EACA;EACA,WAAW,SAAS;EACpB;EACA;EACA;CACJ,CAAC;MAEE;EACH,IAAI,KAAK,WAAW,uBAAuB,YAAY,QAAQ,IAAI,GAAG,KAAK,GAAG,aAAa,IAAI;EAC/F,IAAI,YAAY,QAAQ,KAAK,aACzB,MAAM,IAAI;EAId,KAAK,cAAc,EAAE;EACrB,IAAI,CAAC,YAAY,QAAQ,GACrB,MAAM;EAEV,IAAI,MACA,MAAM;EAKV,MAAM,kBAAmC,CAAC;EAC1C,IAAI,YAAY,KAAA,GACZ,gBAAgB,UAAU;EAE9B,IAAI,eACA,gBAAgB,QAAQ,EAAE,cAAc;EAE5C,MAAM,aAAa,OAAO,KAAK,eAAe,CAAC,CAAC,SAAS;EACzD,WAAW,SAAS,IAAI,aAAa,kBAAkB,KAAA,CAAS;CACpE;AAEJ;;;;;;AAOA,SAAgB,mBAAmB,UAAkB,YAA6B;CAC9E,OAAO,aAAa,cAAc,SAAS,WAAW,GAAG,WAAW,EAAE;AAC1E"}
1
+ {"version":3,"file":"navigation_utils.js","names":[],"sources":["../../src/util/navigation_utils.ts"],"sourcesContent":["\nimport type { UrlController, SidePanelBindingProps, SidePanelController, NavigateOptions, AdminCollection } from \"@rebasepro/cms-types\";\nimport { hasEntityId } from \"@rebasepro/common\";\nimport { withListState } from \"./view_mode\";\n\n// Canonical path utilities — single source of truth in @rebasepro/common\nexport { removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, addInitialSlash, getLastSegment, resolveCollectionPathIds, getCollectionBySlugWithin, getCollectionPathsCombinations } from \"@rebasepro/app\";\n\n/**\n * Navigate to a entity using either a side panel or full-screen mode.\n * This is an admin-specific UI concern and lives here (not in common).\n */\nexport function navigateToEntity({\n openEntityMode,\n collection,\n id,\n copy,\n path,\n selectedTab,\n defaultValues,\n sidePanelController,\n onClose,\n onSaved,\n navigation,\n replace\n}:\n\n {\n openEntityMode?: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n collection?: AdminCollection;\n /** Id of the record to open; unset opens the form for a new record. */\n id?: string | number;\n selectedTab?: string;\n copy?: boolean;\n /**\n * Pre-populate the new entity form with these values.\n * Only applied when `id` is not set (i.e. \"new\" mode).\n *\n * Side panel: passed through SidePanelBindingProps → EditViewBinding.\n * Full screen: carried via React Router location.state so the route\n * component can read it on mount without polluting the URL.\n */\n defaultValues?: Record<string, unknown>;\n path: string;\n sidePanelController: SidePanelController;\n onClose?: () => void;\n /**\n * Called when the side panel or dialog saves the record. A full-screen\n * record replaces the view that opened it, and that view reads\n * everything again when it comes back, so nothing is called there.\n */\n onSaved?: SidePanelBindingProps[\"onSaved\"];\n navigation: UrlController;\n replace?: boolean;\n }) {\n\n // No CMS route serves this page (a collection embedded in the host app's\n // own page): there is no URL to go to, so the record opens over the page.\n const mode = navigation.routesMounted === false && openEntityMode !== \"dialog\"\n ? \"side_panel\"\n : openEntityMode;\n\n if (mode === \"side_panel\" || mode === \"dialog\") {\n\n sidePanelController.open({\n id,\n path: path,\n copy,\n selectedTab,\n collection,\n updateUrl: mode !== \"dialog\",\n onClose,\n onSaved,\n defaultValues\n });\n\n } else {\n let to = navigation.buildUrlCollectionPath(hasEntityId(id) ? `${path}/${id}` : path);\n if (hasEntityId(id) && selectedTab) {\n to += `/${selectedTab}`;\n }\n // The whole list state, not just the view mode: a record opened from a\n // search must come back to that search.\n to = withListState(to);\n if (!hasEntityId(id)) {\n to += \"#new\";\n }\n if (copy) {\n to += \"#copy\";\n }\n // Use React Router location.state to carry defaultValues — the correct SPA\n // approach. No URL size limits, no encoding, nothing in the address bar.\n // EntityFullScreenRoute reads location.state.defaultValues on mount.\n const navigateOptions: NavigateOptions = {};\n if (replace !== undefined) {\n navigateOptions.replace = replace;\n }\n if (defaultValues) {\n navigateOptions.state = { defaultValues };\n }\n const hasOptions = Object.keys(navigateOptions).length > 0;\n navigation.navigate(to, hasOptions ? navigateOptions : undefined);\n }\n\n}\n\n/**\n * Whether `pathname` is the record at `entityPath` or somewhere below it — one\n * of its tabs, its `/edit`. A path segment, not a string prefix:\n * `/c/products/12` is another record, not a place inside `/c/products/1`.\n */\nexport function isPathWithinRecord(pathname: string, entityPath: string): boolean {\n return pathname === entityPath || pathname.startsWith(`${entityPath}/`);\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,iBAAiB,EAC7B,gBACA,YACA,IACA,MACA,MACA,aACA,eACA,qBACA,SACA,SACA,YACA,WA8BG;CAIH,MAAM,OAAO,WAAW,kBAAkB,SAAS,mBAAmB,WAChE,eACA;CAEN,IAAI,SAAS,gBAAgB,SAAS,UAElC,oBAAoB,KAAK;EACrB;EACM;EACN;EACA;EACA;EACA,WAAW,SAAS;EACpB;EACA;EACA;CACJ,CAAC;MAEE;EACH,IAAI,KAAK,WAAW,uBAAuB,YAAY,EAAE,IAAI,GAAG,KAAK,GAAG,OAAO,IAAI;EACnF,IAAI,YAAY,EAAE,KAAK,aACnB,MAAM,IAAI;EAId,KAAK,cAAc,EAAE;EACrB,IAAI,CAAC,YAAY,EAAE,GACf,MAAM;EAEV,IAAI,MACA,MAAM;EAKV,MAAM,kBAAmC,CAAC;EAC1C,IAAI,YAAY,KAAA,GACZ,gBAAgB,UAAU;EAE9B,IAAI,eACA,gBAAgB,QAAQ,EAAE,cAAc;EAE5C,MAAM,aAAa,OAAO,KAAK,eAAe,CAAC,CAAC,SAAS;EACzD,WAAW,SAAS,IAAI,aAAa,kBAAkB,KAAA,CAAS;CACpE;AAEJ;;;;;;AAOA,SAAgB,mBAAmB,UAAkB,YAA6B;CAC9E,OAAO,aAAa,cAAc,SAAS,WAAW,GAAG,WAAW,EAAE;AAC1E"}
@@ -9,9 +9,17 @@ import type { Property, Properties } from "@rebasepro/types";
9
9
  import type { CollectionPropertyConfig } from "@rebasepro/ui";
10
10
  /**
11
11
  * Convert a single Property to a CollectionPropertyConfig.
12
+ *
13
+ * @deprecated It feeds `CollectionView` from `@rebasepro/ui`, which is
14
+ * deprecated: render the collection with `CollectionPanel` instead. Will be
15
+ * removed in a future release.
12
16
  */
13
17
  export declare function mapPropertyToConfig(property: Property, key?: string): CollectionPropertyConfig;
14
18
  /**
15
19
  * Convert a Properties record to a CollectionPropertyConfig record.
20
+ *
21
+ * @deprecated It feeds `CollectionView` from `@rebasepro/ui`, which is
22
+ * deprecated: render the collection with `CollectionPanel` instead. Will be
23
+ * removed in a future release.
16
24
  */
17
25
  export declare function mapPropertiesToConfigs(properties: Properties): Record<string, CollectionPropertyConfig>;
@@ -1,3 +1,4 @@
1
+ import { warnDeprecated } from "@rebasepro/common";
1
2
  import { prettifyIdentifier } from "@rebasepro/utils";
2
3
  //#region src/util/propertyConfigMapper.ts
3
4
  /**
@@ -19,8 +20,16 @@ var TYPE_MAP = {
19
20
  };
20
21
  /**
21
22
  * Convert a single Property to a CollectionPropertyConfig.
23
+ *
24
+ * @deprecated It feeds `CollectionView` from `@rebasepro/ui`, which is
25
+ * deprecated: render the collection with `CollectionPanel` instead. Will be
26
+ * removed in a future release.
22
27
  */
23
28
  function mapPropertyToConfig(property, key) {
29
+ warnDeprecated("cms.mapPropertyToConfig", "`mapPropertyToConfig` is deprecated, with the `CollectionView` it feeds; render the collection with `CollectionPanel` instead.");
30
+ return propertyToConfig(property, key);
31
+ }
32
+ function propertyToConfig(property, key) {
24
33
  const base = {
25
34
  type: TYPE_MAP[property.type] ?? "string",
26
35
  name: property.name ?? (key ? prettifyIdentifier(key) : ""),
@@ -38,7 +47,7 @@ function mapPropertyToConfig(property, key) {
38
47
  if (property.email) base.email = true;
39
48
  }
40
49
  if (property.type === "number" && property.enum) base.enum = mapEnumValues(property.enum);
41
- if (property.type === "array" && property.of && !Array.isArray(property.of)) base.of = mapPropertyToConfig(property.of, key);
50
+ if (property.type === "array" && property.of && !Array.isArray(property.of)) base.of = propertyToConfig(property.of, key);
42
51
  if (property.type === "map" && property.properties) {
43
52
  base.properties = mapPropertiesToConfigs(property.properties);
44
53
  if (property.propertiesOrder) base.propertiesOrder = property.propertiesOrder;
@@ -49,10 +58,15 @@ function mapPropertyToConfig(property, key) {
49
58
  }
50
59
  /**
51
60
  * Convert a Properties record to a CollectionPropertyConfig record.
61
+ *
62
+ * @deprecated It feeds `CollectionView` from `@rebasepro/ui`, which is
63
+ * deprecated: render the collection with `CollectionPanel` instead. Will be
64
+ * removed in a future release.
52
65
  */
53
66
  function mapPropertiesToConfigs(properties) {
67
+ warnDeprecated("cms.mapPropertiesToConfigs", "`mapPropertiesToConfigs` is deprecated, with the `CollectionView` it feeds; render the collection with `CollectionPanel` instead.");
54
68
  const result = {};
55
- for (const [key, property] of Object.entries(properties)) result[key] = mapPropertyToConfig(property, key);
69
+ for (const [key, property] of Object.entries(properties)) result[key] = propertyToConfig(property, key);
56
70
  return result;
57
71
  }
58
72
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"propertyConfigMapper.js","names":[],"sources":["../../src/util/propertyConfigMapper.ts"],"sourcesContent":["/**\n * Maps a Rebase `Property` (from @rebasepro/types) to a `CollectionPropertyConfig`\n * (from @rebasepro/ui), stripping all entity-specific fields and keeping only\n * the UI-relevant subset.\n *\n * This is the bridge between the entity-aware and headless layers.\n */\n\nimport type { Property, Properties, EnumValues, EnumValueConfig } from \"@rebasepro/types\";\nimport type { CollectionPropertyConfig, CollectionEnumValueConfig } from \"@rebasepro/ui\";\nimport { prettifyIdentifier } from \"@rebasepro/utils\";\n\n/**\n * Map Rebase property types to headless-supported types.\n * `vector` and `binary` are not directly renderable, so we fall back to `string`.\n */\nconst TYPE_MAP: Record<string, CollectionPropertyConfig[\"type\"]> = {\n string: \"string\",\n number: \"number\",\n boolean: \"boolean\",\n date: \"date\",\n geopoint: \"geopoint\",\n reference: \"reference\",\n relation: \"relation\",\n array: \"array\",\n map: \"map\",\n vector: \"string\", // vectors display as text\n binary: \"string\", // binary displays as text\n};\n\n/**\n * Convert a single Property to a CollectionPropertyConfig.\n */\nexport function mapPropertyToConfig(property: Property, key?: string): CollectionPropertyConfig {\n const base: CollectionPropertyConfig = {\n type: TYPE_MAP[property.type] ?? \"string\",\n // A column header has to say something, and `name` is optional on the\n // property — a headless project has no UI and no reason to invent\n // labels. Falling back to the key is what the collection editor already\n // does when it suggests a name, so a derived label reads the same\n // wherever it appears: `publishDate` -> \"Publish Date\".\n name: property.name ?? (key ? prettifyIdentifier(key) : \"\"),\n description: property.description,\n columnWidth: property.admin?.columnWidth,\n hideFromCollection: property.admin?.hideFromCollection,\n };\n\n // String-specific\n if (property.type === \"string\") {\n if (property.enum) {\n base.enum = mapEnumValues(property.enum);\n }\n if (property.admin?.multiline) base.multiline = true;\n if (property.admin?.previewAsTag) base.previewAsTag = true;\n if (property.admin?.urlPreview) base.url = property.admin.urlPreview;\n if (property.admin?.markdown) base.markdown = true;\n if (property.storage) base.storage = true;\n if (property.email) base.email = true;\n }\n\n // Number-specific\n if (property.type === \"number\" && property.enum) {\n base.enum = mapEnumValues(property.enum);\n }\n\n // Array-specific\n if (property.type === \"array\" && property.of && !Array.isArray(property.of)) {\n base.of = mapPropertyToConfig(property.of, key);\n }\n\n // Map-specific\n if (property.type === \"map\" && property.properties) {\n base.properties = mapPropertiesToConfigs(property.properties);\n if (property.propertiesOrder) {\n base.propertiesOrder = property.propertiesOrder;\n }\n }\n\n // Date-specific\n if (property.type === \"date\" && property.mode) {\n base.mode = property.mode;\n }\n\n // Custom preview component\n if (property.admin?.Preview) {\n // The connected wrapper will handle this by injecting via cellRenderer override\n // We don't copy it here because Preview may reference entity-aware components\n }\n\n return base;\n}\n\n/**\n * Convert a Properties record to a CollectionPropertyConfig record.\n */\nexport function mapPropertiesToConfigs(\n properties: Properties\n): Record<string, CollectionPropertyConfig> {\n const result: Record<string, CollectionPropertyConfig> = {};\n for (const [key, property] of Object.entries(properties)) {\n result[key] = mapPropertyToConfig(property, key);\n }\n return result;\n}\n\n/**\n * Convert Rebase EnumValues to CollectionEnumValueConfig format.\n * Handles both array form (EnumValueConfig[]) and record form.\n */\nfunction mapEnumValues(\n enumValues: EnumValues | undefined\n): Record<string, CollectionEnumValueConfig> | Map<string | number, CollectionEnumValueConfig> | undefined {\n if (!enumValues) return undefined;\n\n // Array form: EnumValueConfig[]\n if (Array.isArray(enumValues)) {\n const result: Record<string, CollectionEnumValueConfig> = {};\n for (const item of enumValues) {\n result[String(item.id)] = normalizeEnumValueConfig(item);\n }\n return result;\n }\n\n // Record form: Record<string | number, string | EnumValueConfig>\n const result: Record<string, CollectionEnumValueConfig> = {};\n for (const [key, value] of Object.entries(enumValues)) {\n result[key] = typeof value === \"string\"\n ? value\n : normalizeEnumValueConfig(value);\n }\n return result;\n}\n\nfunction normalizeEnumValueConfig(config: EnumValueConfig): CollectionEnumValueConfig {\n return {\n label: config.label,\n color: typeof config.color === \"string\" ? config.color : undefined,\n disabled: config.disabled,\n };\n}\n"],"mappings":";;;;;;AAgBA,IAAM,WAA6D;CAC/D,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,MAAM;CACN,UAAU;CACV,WAAW;CACX,UAAU;CACV,OAAO;CACP,KAAK;CACL,QAAQ;CACR,QAAQ;AACZ;;;;AAKA,SAAgB,oBAAoB,UAAoB,KAAwC;CAC5F,MAAM,OAAiC;EACnC,MAAM,SAAS,SAAS,SAAS;EAMjC,MAAM,SAAS,SAAS,MAAM,mBAAmB,GAAG,IAAI;EACxD,aAAa,SAAS;EACtB,aAAa,SAAS,OAAO;EAC7B,oBAAoB,SAAS,OAAO;CACxC;CAGA,IAAI,SAAS,SAAS,UAAU;EAC5B,IAAI,SAAS,MACT,KAAK,OAAO,cAAc,SAAS,IAAI;EAE3C,IAAI,SAAS,OAAO,WAAW,KAAK,YAAY;EAChD,IAAI,SAAS,OAAO,cAAc,KAAK,eAAe;EACtD,IAAI,SAAS,OAAO,YAAY,KAAK,MAAM,SAAS,MAAM;EAC1D,IAAI,SAAS,OAAO,UAAU,KAAK,WAAW;EAC9C,IAAI,SAAS,SAAS,KAAK,UAAU;EACrC,IAAI,SAAS,OAAO,KAAK,QAAQ;CACrC;CAGA,IAAI,SAAS,SAAS,YAAY,SAAS,MACvC,KAAK,OAAO,cAAc,SAAS,IAAI;CAI3C,IAAI,SAAS,SAAS,WAAW,SAAS,MAAM,CAAC,MAAM,QAAQ,SAAS,EAAE,GACtE,KAAK,KAAK,oBAAoB,SAAS,IAAI,GAAG;CAIlD,IAAI,SAAS,SAAS,SAAS,SAAS,YAAY;EAChD,KAAK,aAAa,uBAAuB,SAAS,UAAU;EAC5D,IAAI,SAAS,iBACT,KAAK,kBAAkB,SAAS;CAExC;CAGA,IAAI,SAAS,SAAS,UAAU,SAAS,MACrC,KAAK,OAAO,SAAS;CAIzB,IAAI,SAAS,OAAO,SAAS,CAG7B;CAEA,OAAO;AACX;;;;AAKA,SAAgB,uBACZ,YACwC;CACxC,MAAM,SAAmD,CAAC;CAC1D,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QAAQ,UAAU,GACnD,OAAO,OAAO,oBAAoB,UAAU,GAAG;CAEnD,OAAO;AACX;;;;;AAMA,SAAS,cACL,YACuG;CACvG,IAAI,CAAC,YAAY,OAAO,KAAA;CAGxB,IAAI,MAAM,QAAQ,UAAU,GAAG;EAC3B,MAAM,SAAoD,CAAC;EAC3D,KAAK,MAAM,QAAQ,YACf,OAAO,OAAO,KAAK,EAAE,KAAK,yBAAyB,IAAI;EAE3D,OAAO;CACX;CAGA,MAAM,SAAoD,CAAC;CAC3D,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,GAChD,OAAO,OAAO,OAAO,UAAU,WACzB,QACA,yBAAyB,KAAK;CAExC,OAAO;AACX;AAEA,SAAS,yBAAyB,QAAoD;CAClF,OAAO;EACH,OAAO,OAAO;EACd,OAAO,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,KAAA;EACzD,UAAU,OAAO;CACrB;AACJ"}
1
+ {"version":3,"file":"propertyConfigMapper.js","names":[],"sources":["../../src/util/propertyConfigMapper.ts"],"sourcesContent":["/**\n * Maps a Rebase `Property` (from @rebasepro/types) to a `CollectionPropertyConfig`\n * (from @rebasepro/ui), stripping all entity-specific fields and keeping only\n * the UI-relevant subset.\n *\n * This is the bridge between the entity-aware and headless layers.\n */\n\nimport type { Property, Properties, EnumValues, EnumValueConfig } from \"@rebasepro/types\";\nimport type { CollectionPropertyConfig, CollectionEnumValueConfig } from \"@rebasepro/ui\";\nimport { prettifyIdentifier } from \"@rebasepro/utils\";\nimport { warnDeprecated } from \"@rebasepro/common\";\n\n/**\n * Map Rebase property types to headless-supported types.\n * `vector` and `binary` are not directly renderable, so we fall back to `string`.\n */\nconst TYPE_MAP: Record<string, CollectionPropertyConfig[\"type\"]> = {\n string: \"string\",\n number: \"number\",\n boolean: \"boolean\",\n date: \"date\",\n geopoint: \"geopoint\",\n reference: \"reference\",\n relation: \"relation\",\n array: \"array\",\n map: \"map\",\n vector: \"string\", // vectors display as text\n binary: \"string\", // binary displays as text\n};\n\n/**\n * Convert a single Property to a CollectionPropertyConfig.\n *\n * @deprecated It feeds `CollectionView` from `@rebasepro/ui`, which is\n * deprecated: render the collection with `CollectionPanel` instead. Will be\n * removed in a future release.\n */\nexport function mapPropertyToConfig(property: Property, key?: string): CollectionPropertyConfig {\n warnDeprecated(\n \"cms.mapPropertyToConfig\",\n \"`mapPropertyToConfig` is deprecated, with the `CollectionView` it feeds; render the collection with `CollectionPanel` instead.\"\n );\n return propertyToConfig(property, key);\n}\n\nfunction propertyToConfig(property: Property, key?: string): CollectionPropertyConfig {\n const base: CollectionPropertyConfig = {\n type: TYPE_MAP[property.type] ?? \"string\",\n // A column header has to say something, and `name` is optional on the\n // property — a headless project has no UI and no reason to invent\n // labels. Falling back to the key is what the collection editor already\n // does when it suggests a name, so a derived label reads the same\n // wherever it appears: `publishDate` -> \"Publish Date\".\n name: property.name ?? (key ? prettifyIdentifier(key) : \"\"),\n description: property.description,\n columnWidth: property.admin?.columnWidth,\n hideFromCollection: property.admin?.hideFromCollection,\n };\n\n // String-specific\n if (property.type === \"string\") {\n if (property.enum) {\n base.enum = mapEnumValues(property.enum);\n }\n if (property.admin?.multiline) base.multiline = true;\n if (property.admin?.previewAsTag) base.previewAsTag = true;\n if (property.admin?.urlPreview) base.url = property.admin.urlPreview;\n if (property.admin?.markdown) base.markdown = true;\n if (property.storage) base.storage = true;\n if (property.email) base.email = true;\n }\n\n // Number-specific\n if (property.type === \"number\" && property.enum) {\n base.enum = mapEnumValues(property.enum);\n }\n\n // Array-specific\n if (property.type === \"array\" && property.of && !Array.isArray(property.of)) {\n base.of = propertyToConfig(property.of, key);\n }\n\n // Map-specific\n if (property.type === \"map\" && property.properties) {\n base.properties = mapPropertiesToConfigs(property.properties);\n if (property.propertiesOrder) {\n base.propertiesOrder = property.propertiesOrder;\n }\n }\n\n // Date-specific\n if (property.type === \"date\" && property.mode) {\n base.mode = property.mode;\n }\n\n // Custom preview component\n if (property.admin?.Preview) {\n // The connected wrapper will handle this by injecting via cellRenderer override\n // We don't copy it here because Preview may reference entity-aware components\n }\n\n return base;\n}\n\n/**\n * Convert a Properties record to a CollectionPropertyConfig record.\n *\n * @deprecated It feeds `CollectionView` from `@rebasepro/ui`, which is\n * deprecated: render the collection with `CollectionPanel` instead. Will be\n * removed in a future release.\n */\nexport function mapPropertiesToConfigs(\n properties: Properties\n): Record<string, CollectionPropertyConfig> {\n warnDeprecated(\n \"cms.mapPropertiesToConfigs\",\n \"`mapPropertiesToConfigs` is deprecated, with the `CollectionView` it feeds; render the collection with `CollectionPanel` instead.\"\n );\n const result: Record<string, CollectionPropertyConfig> = {};\n for (const [key, property] of Object.entries(properties)) {\n result[key] = propertyToConfig(property, key);\n }\n return result;\n}\n\n/**\n * Convert Rebase EnumValues to CollectionEnumValueConfig format.\n * Handles both array form (EnumValueConfig[]) and record form.\n */\nfunction mapEnumValues(\n enumValues: EnumValues | undefined\n): Record<string, CollectionEnumValueConfig> | Map<string | number, CollectionEnumValueConfig> | undefined {\n if (!enumValues) return undefined;\n\n // Array form: EnumValueConfig[]\n if (Array.isArray(enumValues)) {\n const result: Record<string, CollectionEnumValueConfig> = {};\n for (const item of enumValues) {\n result[String(item.id)] = normalizeEnumValueConfig(item);\n }\n return result;\n }\n\n // Record form: Record<string | number, string | EnumValueConfig>\n const result: Record<string, CollectionEnumValueConfig> = {};\n for (const [key, value] of Object.entries(enumValues)) {\n result[key] = typeof value === \"string\"\n ? value\n : normalizeEnumValueConfig(value);\n }\n return result;\n}\n\nfunction normalizeEnumValueConfig(config: EnumValueConfig): CollectionEnumValueConfig {\n return {\n label: config.label,\n color: typeof config.color === \"string\" ? config.color : undefined,\n disabled: config.disabled,\n };\n}\n"],"mappings":";;;;;;;AAiBA,IAAM,WAA6D;CAC/D,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,MAAM;CACN,UAAU;CACV,WAAW;CACX,UAAU;CACV,OAAO;CACP,KAAK;CACL,QAAQ;CACR,QAAQ;AACZ;;;;;;;;AASA,SAAgB,oBAAoB,UAAoB,KAAwC;CAC5F,eACI,2BACA,gIACJ;CACA,OAAO,iBAAiB,UAAU,GAAG;AACzC;AAEA,SAAS,iBAAiB,UAAoB,KAAwC;CAClF,MAAM,OAAiC;EACnC,MAAM,SAAS,SAAS,SAAS;EAMjC,MAAM,SAAS,SAAS,MAAM,mBAAmB,GAAG,IAAI;EACxD,aAAa,SAAS;EACtB,aAAa,SAAS,OAAO;EAC7B,oBAAoB,SAAS,OAAO;CACxC;CAGA,IAAI,SAAS,SAAS,UAAU;EAC5B,IAAI,SAAS,MACT,KAAK,OAAO,cAAc,SAAS,IAAI;EAE3C,IAAI,SAAS,OAAO,WAAW,KAAK,YAAY;EAChD,IAAI,SAAS,OAAO,cAAc,KAAK,eAAe;EACtD,IAAI,SAAS,OAAO,YAAY,KAAK,MAAM,SAAS,MAAM;EAC1D,IAAI,SAAS,OAAO,UAAU,KAAK,WAAW;EAC9C,IAAI,SAAS,SAAS,KAAK,UAAU;EACrC,IAAI,SAAS,OAAO,KAAK,QAAQ;CACrC;CAGA,IAAI,SAAS,SAAS,YAAY,SAAS,MACvC,KAAK,OAAO,cAAc,SAAS,IAAI;CAI3C,IAAI,SAAS,SAAS,WAAW,SAAS,MAAM,CAAC,MAAM,QAAQ,SAAS,EAAE,GACtE,KAAK,KAAK,iBAAiB,SAAS,IAAI,GAAG;CAI/C,IAAI,SAAS,SAAS,SAAS,SAAS,YAAY;EAChD,KAAK,aAAa,uBAAuB,SAAS,UAAU;EAC5D,IAAI,SAAS,iBACT,KAAK,kBAAkB,SAAS;CAExC;CAGA,IAAI,SAAS,SAAS,UAAU,SAAS,MACrC,KAAK,OAAO,SAAS;CAIzB,IAAI,SAAS,OAAO,SAAS,CAG7B;CAEA,OAAO;AACX;;;;;;;;AASA,SAAgB,uBACZ,YACwC;CACxC,eACI,8BACA,mIACJ;CACA,MAAM,SAAmD,CAAC;CAC1D,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QAAQ,UAAU,GACnD,OAAO,OAAO,iBAAiB,UAAU,GAAG;CAEhD,OAAO;AACX;;;;;AAMA,SAAS,cACL,YACuG;CACvG,IAAI,CAAC,YAAY,OAAO,KAAA;CAGxB,IAAI,MAAM,QAAQ,UAAU,GAAG;EAC3B,MAAM,SAAoD,CAAC;EAC3D,KAAK,MAAM,QAAQ,YACf,OAAO,OAAO,KAAK,EAAE,KAAK,yBAAyB,IAAI;EAE3D,OAAO;CACX;CAGA,MAAM,SAAoD,CAAC;CAC3D,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,GAChD,OAAO,OAAO,OAAO,UAAU,WACzB,QACA,yBAAyB,KAAK;CAExC,OAAO;AACX;AAEA,SAAS,yBAAyB,QAAoD;CAClF,OAAO;EACH,OAAO,OAAO;EACd,OAAO,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,KAAA;EACzD,UAAU,OAAO;CACrB;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebasepro/cms",
3
- "version": "0.28.2",
3
+ "version": "0.29.0",
4
4
  "description": "Rebase CMS — content management views, forms, and routing",
5
5
  "keywords": [
6
6
  "rebase",
@@ -51,6 +51,12 @@
51
51
  "import": "./dist/editor.js",
52
52
  "default": "./dist/editor.js"
53
53
  },
54
+ "./mcp-view": {
55
+ "types": "./dist/mcp-view.d.ts",
56
+ "development": "./dist/mcp-view.js",
57
+ "import": "./dist/mcp-view.js",
58
+ "default": "./dist/mcp-view.js"
59
+ },
54
60
  "./collection_editor_ui": {
55
61
  "types": "./dist/collection_editor_ui.d.ts",
56
62
  "development": "./dist/collection_editor_ui.js",
@@ -93,14 +99,14 @@
93
99
  "react-use-measure": "^2.1.7",
94
100
  "read-excel-file": "^9.3.10",
95
101
  "zod": "^4.4.3",
96
- "@rebasepro/app": "0.28.2",
97
- "@rebasepro/cms-types": "0.28.2",
98
- "@rebasepro/inference": "0.28.2",
99
- "@rebasepro/types": "0.28.2",
100
- "@rebasepro/forms": "0.28.2",
101
- "@rebasepro/common": "0.28.2",
102
- "@rebasepro/utils": "0.28.2",
103
- "@rebasepro/ui": "0.28.2"
102
+ "@rebasepro/app": "0.29.0",
103
+ "@rebasepro/forms": "0.29.0",
104
+ "@rebasepro/cms-types": "0.29.0",
105
+ "@rebasepro/inference": "0.29.0",
106
+ "@rebasepro/common": "0.29.0",
107
+ "@rebasepro/types": "0.29.0",
108
+ "@rebasepro/utils": "0.29.0",
109
+ "@rebasepro/ui": "0.29.0"
104
110
  },
105
111
  "peerDependencies": {
106
112
  "react": "^19.2.7",
package/recipes/README.md CHANGED
@@ -18,22 +18,50 @@ always match the version you have installed.
18
18
 
19
19
  | Recipe | What it shows |
20
20
  |---|---|
21
- | [Site settings singleton](site-settings.tsx) | One settings record on its own page, created on first save. A page + `EntityFormPanel` at a fixed id. |
21
+ | [Site settings singleton](site-settings.tsx) | One settings record on its own page, created on first save. A page + `RecordForm` at a fixed id. |
22
22
  | [Per-user preferences](my-preferences.tsx) | Each user edits their own record, keyed by their uid. |
23
- | [Bulk set status](bulk-set-status.tsx) | A toolbar button that updates every selected row. |
23
+ | [Bulk set status](bulk-set-status.tsx) | A toolbar button that updates every selected row with `useRowWrites`. |
24
+ | [Approval queue](approval-queue.tsx) | The rows waiting for review, Approve and Reject on every row and card (`entityActions` through `collectionOverrides`), and a live count (`useRowCount`). |
25
+ | [Master-detail](master-detail.tsx) | `SplitView`: a `CollectionPanel` (`fields`, `onRowClick`, `highlightedIds`) beside the picked row's `RecordForm` (`fields`); in a narrow container the form covers the list. |
24
26
  | [Calendar view](calendar-view.tsx) | A new view mode for a collection: rows on a month grid. |
25
- | [Orders dashboard](orders-dashboard.tsx) | A page that reads data, draws a chart and links into the admin. |
27
+ | [Orders dashboard](orders-dashboard.tsx) | A total (`useRowCount`) and a count per status (`useAggregate`), drawn with `KpiTile` and `BarChart`; each bar opens the collection filtered to it. |
26
28
  | [Custom login screen](custom-login.tsx) | Replacing a built-in screen through `<Rebase components>`. |
27
29
 
30
+ ## Which part for which job
31
+
32
+ | To… | Use |
33
+ |---|---|
34
+ | Show a collection: table, cards, board, its toolbar and record panel | `CollectionPanel`: `fields` for the columns, `where` to narrow it, `orderBy`, `toolbar` (`"compact"`, `"none"`, or composed) |
35
+ | Do something with the row clicked, instead of opening it | `CollectionPanel` `onRowClick(row, id)` |
36
+ | A button on every row or card (Approve, Ship) | `CollectionPanel` `rowActions={(row, id) => <Button…/>}` |
37
+ | Edit one record, or some of its fields | `RecordForm` with `id`, and `fields`, or `FormField` children; `compact` for a side card |
38
+ | Show one record read-only | `RecordDetail` |
39
+ | Show one value of a row in your own JSX | `FieldValue` |
40
+ | A list beside the picked record, folding to drill-down when narrow | `SplitView` (master-detail recipe) |
41
+ | A button on every row and card | `entityActions`: the collection's `admin.entityActions`, or one panel's `collectionOverrides.entityActions` |
42
+ | Read rows, one row, a count or an aggregate | `useRows`, `useRow`, `useRowCount`, `useAggregate` |
43
+ | Create, change or delete rows | `useRowWrites` |
44
+ | KPI figures and charts | `KpiGrid` + `KpiTile`, `ChartCard` + `BarChart` / `TimeSeriesChart`, fed by `useRowCount` / `useAggregate` |
45
+
28
46
  ## Building blocks
29
47
 
30
48
  Components you render anywhere under `<Rebase>` and a router.
31
49
 
32
50
  | Name | Package | What it is |
33
51
  |---|---|---|
34
- | `CollectionPanel` | `@rebasepro/cms` | A collection's table, cards, board or custom view, with its toolbar, filters and record panel. |
35
- | `EntityFormPanel` | `@rebasepro/cms` | One record's form: loads it, validates, saves. Given an id no record has yet, it creates it there. |
52
+ | `CollectionPanel` | `@rebasepro/cms` | A collection's table, cards, board or custom view, with its toolbar, filters and record panel. `collection="orders"` names it. `fields` picks what it shows, `where` which rows it holds (as `useRows` takes it, and following state), `orderBy` their order, `rowActions` your JSX on every row and card, `toolbar` replaces or removes its toolbar, `onRowClick` takes the clicked row, as `useRows` reads it, instead of opening it. It sizes to its rows. |
53
+ | `CollectionToolbar` | `@rebasepro/cms` | A collection panel's toolbar, for its `toolbar` prop: the full one, or `start` / `end` holding `CollectionSearchBar`, `CollectionFiltersButton`, `CollectionViewModeToggle` and `CollectionAddButton`. |
54
+ | `RecordForm` | `@rebasepro/cms` | One record's form: loads it, validates, saves. `collection="orders"` names a registered collection; a collection value works too. `FormField` children lay it out your way, and `compact` makes it dense. Given an id no record has yet, it creates it there. `fields` shows some fields, in order; `collectionOverrides` changes the collection for this form only. It validates only the fields it shows. |
55
+ | `FormField` | `@rebasepro/cms` | One field of the record form it sits in, by property name: `<FormField name="status"/>`, inside `RecordForm`, as its children, or a `formView.Builder`. |
56
+ | `RecordDetail` | `@rebasepro/cms` | One record, read-only, drawn as the admin's record page draws it. Takes `fields` and `collectionOverrides` like `RecordForm`, and leaves out what the form leaves out: a field a `conditions.hidden` rule hides for this record, or one the user may not read. |
57
+ | `FieldValue` | `@rebasepro/cms` | One value of a row as the server sends it (`useRows`, `client.data`), drawn as the admin draws it: `<FieldValue collection="orders" field="status" value={order.status}/>`; a belongsTo's foreign key (`field="customer" value={order.customerId}`) draws the related record's title. An enum is its chip, a date is in its timezone, a belongsTo is read from its foreign-key column and shown as its target's title. |
36
58
  | `CollectionsProvider` | `@rebasepro/cms` | Makes collections known to the blocks in a page of your own that has no admin shell around it. |
59
+ | `SplitView` | `@rebasepro/ui` | Master beside detail when its own container is wide (768px+), the detail over the master under a back bar when narrow. `master`, `detail` (absent or `false`: the master alone), `selected`, `onClearSelection`, `detailTitle`. Fills its parent, so give the parent a height. |
60
+ | `KpiGrid` | `@rebasepro/ui` | Two to four `KpiTile`s across, as its own width allows. |
61
+ | `KpiTile` | `@rebasepro/ui` | One headline figure: `label`, `value`, `loading`, `error` (an `Error`), and `previous` for the change. |
62
+ | `ChartCard` | `@rebasepro/ui` | A chart's card: `title`, `icon`, `headline`, `action`. |
63
+ | `BarChart` | `@rebasepro/ui` | Categories by size: `bars` (`{ key, label, value }[]`), `onBarClick` makes each bar a button. `loading` / `error` / no bars draw in its place. |
64
+ | `TimeSeriesChart` | `@rebasepro/ui` | Values over time: `series` (`{ id, label, points: { at, value }[] }[]`), `at` a `Date` or an ISO string. |
37
65
  | `RebaseAuthGate` | `@rebasepro/cms` | Shows the login screen until someone is signed in, then its children. |
38
66
  | `LoginView` | `@rebasepro/app` | The built-in login screen, to frame or reuse. |
39
67
  | `Button` | `@rebasepro/ui` | And `Card`, `Typography`, `TextField`, `Select`, `Chip`, `Container`, … — the UI kit the admin is drawn with. Use it so your pages look like the rest. |
@@ -42,24 +70,29 @@ Components you render anywhere under `<Rebase>` and a router.
42
70
 
43
71
  | Name | Package | What it gives you |
44
72
  |---|---|---|
45
- | `useData` | `@rebasepro/app` | The data layer: `useData().collection("orders").find / findById / create / update / delete`. Saves go through the server, so callbacks and security rules apply. |
46
- | `useCollection` | `@rebasepro/app` | A live list of a collection's rows, re-rendering on change. |
47
- | `useFetch` | `@rebasepro/app` | One record, live. |
73
+ | `useRows` | `@rebasepro/app` | `useRows("orders", { where, orderBy, limit, searchString })` → `{ rows, total, hasMore, loadMore, loading, error, refresh }`. Rows in the server's shape (see the facts below), kept current after every write. |
74
+ | `useRow` | `@rebasepro/app` | `useRow("orders", id)` → `{ row, loading, error, refresh }`. |
75
+ | `useRowCount` | `@rebasepro/app` | `useRowCount("orders", where)` → `{ count, loading, error }`, counted by the data source. |
76
+ | `useAggregate` | `@rebasepro/app` | `useAggregate("orders", { select: [{ fn: "count" }], groupBy: ["status"], orderBy: ["count", "desc"] })` → `{ result, loading, error }`: one row per group, each aggregate under its alias (`count`, `sum_total`). Computed by the data source; `error` says so where it cannot. |
77
+ | `useRowWrites` | `@rebasepro/app` | `{ create, update, remove, saving, error }`: `update("orders", id, { status: "shipped" })`. Each write is the record form's save: the collection's `browserCallbacks` run, then the server's callbacks and rules, and every view of the collection reads it again. |
78
+ | `useRebaseContext` | `@rebasepro/app` | The context: `context.data.collection("orders").find / findById / create / update / delete`, outside React state. Rows as the hooks return them; a write runs the collection's `browserCallbacks` and refreshes its views, as `useRowWrites` does. |
79
+ | `usePermissions` | `@rebasepro/app` | `canCreate(collection, path)`, `canEdit(collection, path, row)`, `canDelete(collection, path, row)`: what the signed-in user may do, by the collection's rules. |
48
80
  | `useAuthController` | `@rebasepro/app` | The signed-in `user` (uid, roles), and sign-in / sign-out. |
49
81
  | `useSnackbarController` | `@rebasepro/app` | `open({ type, message })` for a toast. |
50
- | `useSidePanel` | `@rebasepro/cms` | Open any record in the side panel: `open({ path, entityId })`. |
82
+ | `useSidePanel` | `@rebasepro/cms` | Open any record in the side panel: `open({ path, id })`. |
51
83
  | `useUrlController` | `@rebasepro/cms` | Admin URLs and navigation: `buildUrlCollectionPath`, `navigate`. |
52
- | `useCollectionRegistryController` | `@rebasepro/cms` | Look up a collection by slug. |
53
- | `resolveSelection` | `@rebasepro/cms` | Turn a table selection — ticked rows or "all matching" — into the rows. |
84
+ | `useCollectionRegistryController` | `@rebasepro/cms` | Look up a collection by slug: `getCollection("orders")`, once `initialised`. |
85
+ | `resolveSelection` | `@rebasepro/cms` | Turn a table selection — ticked rows or "all matching" — into the rows and their ids: `const { rows, ids } = await resolveSelection({ selection, data: context.data, collection })`. |
86
+ | `useElementWidth` | `@rebasepro/ui` | `[ref, width]`: an element's own width, to lay out by its container rather than the window. |
54
87
 
55
88
  ## Places
56
89
 
57
90
  | To add… | Put a component in | Recipe |
58
91
  |---|---|---|
59
- | A page | `<RebaseCMS views={[{ slug, name, icon, view }]}>` | site settings, dashboard |
92
+ | A page | `<RebaseCMS views={[{ slug, name, icon, view }]}>` | site settings, dashboard, master-detail |
60
93
  | A view mode for a collection | `collectionViews={[{ key, name, Builder }]}` + `admin.customViews: ["key"]` | calendar view |
61
94
  | A button in a collection's toolbar | `admin.Actions: [Component]` | bulk set status |
62
- | A button on a record | `admin.entityActions: [{ key, name, onClick }]` | |
95
+ | A button on a record, and on every row and card | `admin.entityActions: [{ key, name, icon, onClick, collapsed: false }]`, or for one panel `collectionOverrides.entityActions` | approval queue |
63
96
  | A tab on a record | `admin.entityViews: [{ key, name, Builder }]` | |
64
97
  | How one field is edited or shown | `admin.Field` / `admin.Preview` on the property | |
65
98
  | Something beside a built-in part | `<Rebase slots={[{ slot, Component }]}>` (`home.cards`, `form.after`, `collection.toolbar`, …) | |
@@ -70,29 +103,49 @@ Components you render anywhere under `<Rebase>` and a router.
70
103
  | Place | Your component receives |
71
104
  |---|---|
72
105
  | A page (`views`) | Nothing: read what you need with the hooks. It renders inside the admin's router, so `useUrlController().navigate(…)` (or `react-router`) works. |
73
- | A view mode `Builder` | `CollectionCustomViewParams`: `collection`, `path`, `tableController` (its `data` is the rows the toolbar's search and filters select, `dataLoading`, …), `onEntityClick(entity)` to open a row the way the collection opens rows, `selectionController`, `emptyComponent`. |
74
- | `admin.Actions` | `CollectionActionsProps`: `path`, `collection`, `selectionController` (`hasSelection`, `selection`, `clearSelection()`), `tableController`, `openNewDocument(defaults?)`. Turn `selection` into rows with `resolveSelection({ selection, accessor: useData().collection(path) })` — it may stand for "every row matching the filter", not only the ticked ones. |
75
- | `admin.entityViews` `Builder` | `EntityCustomViewParams`: `collection`, the record (`entity`, absent while it is being created), its unsaved values (`modifiedValues`) and the form (`formContext`). |
106
+ | A view mode `Builder` | `CollectionCustomViewParams`: `collection`, `path`, `tableController` (its `rows` are the rows the toolbar's search and filters select, `ids` their ids at the same positions; `loading`, `error`, …), `onRowClick(row)` to open a row the way the collection opens rows, `selectionController`, `highlightedIds`, `emptyComponent`. |
107
+ | `admin.Actions` | `CollectionActionsProps`: `path`, `collection`, `selectionController` (`hasSelection`, `selection`, `isSelected(id)`, `setSelectedRows(rows)`, `clearSelection()`), `tableController` (`rows`, `ids`), `openNewDocument(defaults?)`. `context`, whose `data` reads rows. Turn `selection` into rows and their ids with `const { rows, ids } = await resolveSelection({ selection, data: context.data, collection })` — it may stand for "every row matching the filter", not only the ticked ones. |
108
+ | `entityActions` `onClick` | `EntityActionClickProps`: `row` (the record, as the server sends it), `id`, `path`, `collection`, `context`, `view` (`"collection"` or `"form"`). |
109
+ | `admin.entityViews` `Builder` | `EntityCustomViewParams`: `collection`, the saved record (`row`) and its id (`id`), both absent while it is being created, the form's values with unsaved edits (`modifiedValues`) and the form (`formContext`). |
76
110
  | `"Auth.LoginView"` | `{ authController }`. Sign in with `authController.emailPasswordLogin?.(email, password)` (optional: present when email sign-in is enabled); a failure throws and is also on `authController.authProviderError`. Once `authController.user` is set the admin replaces your screen by itself. |
77
111
  | Any other override | The props of the part it replaces; with `wrap: true`, those plus `OriginalComponent`. |
78
112
 
79
113
  ## Facts that save a trip to the source
80
114
 
81
- - **Rows are `Entity` objects.** `useData().collection("orders").find()` resolves to
82
- `{ data: Entity[], meta }`; a row's fields are on `row.values`, its id is
83
- `row.id`. `find({ limit, offset, where: { status: ["==", "paid"] }, orderBy: ["createdAt", "desc"] })`.
84
- - **Dates in `values` are `Date` objects** in the admin, not strings. A
85
- `columnType: "date"` column (a calendar day) is that day's UTC midnight, so
86
- read its day with `getUTCDate()`, not `getDate()`, or it lands on the day
87
- before west of Greenwich. `getDatePropertyTimezone(property)` names the zone
88
- the admin shows any date property in.
115
+ - **Rows are the server's rows** wherever your code asks for them: `useRows`,
116
+ `useRow`, `useRowWrites`' results, `context.data`, `resolveSelection`,
117
+ `CollectionPanel`'s `onRowClick`, `client.data` — and what a collection's
118
+ `browserCallbacks`, its `entityActions`, `admin.display` resolvers,
119
+ `additionalFields`, entity views, a form's `context.row`, a view mode
120
+ `Builder`'s `tableController.rows`, a collection action's selection and the
121
+ slots are handed. A row is a flat object, exactly the table's columns (an
122
+ `id` column as `row.id`, with its type), a date as an ISO string (`"2026-11-08"` for a `columnType:
123
+ "date"` column, a full timestamp otherwise), and a belongsTo relation as its
124
+ foreign-key column (`customerId`). A relation the admin loaded arrives nested
125
+ under its name, as REST's `include` returns it (`row.customer` is the
126
+ customer's row, exactly its columns, beside `customerId`). Draw a value with
127
+ `<FieldValue collection="orders" field="customer" value={row.customerId}/>` rather than
128
+ formatting it yourself.
129
+ - **A row's id is handed beside it**, as a string (a composite key's parts
130
+ joined by `:::`): `id` beside a `row`, and `ids` beside `rows` at the same
131
+ positions — `tableController.ids[i]` is the id of `tableController.rows[i]`;
132
+ a selection and `resolveSelection` hand `{ rows, ids }`. Write and open with
133
+ that id, not `String(row.id)`: a collection keyed by another column has no
134
+ `row.id`.
135
+ - **`where` and `orderBy`** are the same everywhere: `{ status: ["==",
136
+ "paid"], total: [">", 100] }` and `["createdAt", "desc"]`.
137
+ - **An `Entity` is the admin's own record**, handed only to a copy of one of
138
+ its parts (`Collection.Table`, a card). It is `{ id, path, values }`: fields
139
+ are on `entity.values`, and there dates are `Date` objects and a relation an
140
+ `EntityRelation`. `getDatePropertyTimezone(property)` names the zone the
141
+ admin shows any date property in.
89
142
  - **Defaults for a new record:** a property's `defaultValue` applies everywhere a
90
- record is created; `EntityFormPanel`'s `defaultValues` apply to that form only,
143
+ record is created; `RecordForm`'s `defaultValues` apply to that form only,
91
144
  on top of them.
92
145
  - **Enum fields** are `enum: [{ id: "draft", label: "Draft" }, …]` on a string
93
146
  property — see `defineCollection` and the collections docs for every property
94
147
  option.
95
- - **A record keyed by its user:** `entityId={useAuthController().user?.uid}`.
148
+ - **A record keyed by its user:** `id={useAuthController().user?.uid}`.
96
149
 
97
150
  The override names are `Shell.AppBar`, `Shell.Drawer`, `HomePage`,
98
151
  `HomePage.CollectionCard`, `Auth.LoginView`, `Collection.View`,
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Recipe: an approval queue — the rows waiting for review, an Approve and a
3
+ * Reject on every one, and how many are left.
4
+ *
5
+ * The queue is the collection's own panel narrowed to `status == "pending"`
6
+ * with `where`, the filter `useRowCount` takes too, so it has the
7
+ * collection's table, cards, search and record panel for free. The two
8
+ * buttons are the collection's `entityActions`, given for this panel only
9
+ * through `collectionOverrides`: `collapsed: false` draws each as a button on every row of the
10
+ * table and on every card and board card, not inside the ⋮ menu.
11
+ *
12
+ * A decision is one `useRowWrites().update`: the save the record form makes,
13
+ * so the collection's callbacks and security rules apply. The row then no
14
+ * longer matches the filter, and the panel and the `useRowCount` above it read
15
+ * again by themselves.
16
+ *
17
+ * To use it: add `approvalQueueView` to `<RebaseCMS views={[…]}>`. Change
18
+ * `COLLECTION` / `STATUS_FIELD` and the three values to your own.
19
+ */
20
+ import React, { useMemo } from "react";
21
+ import type { AdminCollection, AppView, EntityAction } from "@rebasepro/cms-types";
22
+ import type { FilterValues } from "@rebasepro/types";
23
+ import { useRowCount, useRowWrites, useSnackbarController } from "@rebasepro/app";
24
+ import { CollectionPanel } from "@rebasepro/cms";
25
+ import { Container, Typography } from "@rebasepro/ui";
26
+
27
+ const COLLECTION = "comments";
28
+ const STATUS_FIELD = "status";
29
+ const PENDING = "pending";
30
+
31
+ /** The rows the queue holds: the panel's filter and the count's. */
32
+ const WAITING: FilterValues<string> = { [STATUS_FIELD]: ["==", PENDING] };
33
+
34
+ export function ApprovalQueue() {
35
+ const { update } = useRowWrites();
36
+ const snackbar = useSnackbarController();
37
+ const { count } = useRowCount(COLLECTION, WAITING);
38
+
39
+ // Memoised: a new object every render would redraw every row.
40
+ const overrides = useMemo<Partial<AdminCollection>>(() => {
41
+ const decide = (name: string, icon: string, status: string): EntityAction => ({
42
+ key: status,
43
+ name,
44
+ icon,
45
+ collapsed: false,
46
+ // An action is handed the row and its id, as `useRows` returns them.
47
+ onClick: async ({ id }) => {
48
+ if (id === undefined) return;
49
+ try {
50
+ await update(COLLECTION, id, { [STATUS_FIELD]: status });
51
+ } catch (error) {
52
+ snackbar.open({ type: "error", message: error instanceof Error ? error.message : String(error) });
53
+ }
54
+ }
55
+ });
56
+ return {
57
+ entityActions: [decide("Approve", "Check", "approved"), decide("Reject", "X", "rejected")]
58
+ };
59
+ }, [update, snackbar]);
60
+
61
+ return (
62
+ <Container maxWidth={"5xl"} className={"py-8 flex flex-col gap-4 h-full"}>
63
+ <div className={"flex items-baseline gap-3"}>
64
+ <Typography variant={"h4"}>Review queue</Typography>
65
+ <Typography variant={"body2"} color={"secondary"}>
66
+ {count === undefined ? "" : count === 0 ? "Nothing waiting" : `${count} waiting`}
67
+ </Typography>
68
+ </div>
69
+ <CollectionPanel collection={COLLECTION} title={false} where={WAITING} collectionOverrides={overrides} className={"flex-1"}/>
70
+ </Container>
71
+ );
72
+ }
73
+
74
+ export const approvalQueueView: AppView = {
75
+ slug: "review",
76
+ name: "Review queue",
77
+ icon: "ListChecks",
78
+ view: <ApprovalQueue/>
79
+ };
@@ -5,25 +5,27 @@
5
5
  * and hands each the selection and the collection's path. This one appears
6
6
  * once rows are ticked and archives them: it reads the selection (which may be
7
7
  * "every row matching the filter", not just the ticked ones — `resolveSelection`
8
- * handles both), updates each row through the data layer, and clears the
9
- * selection. Saves go through the server, so its callbacks and security rules
10
- * apply to every row. When one is refused, the rows before it are already
11
- * archived: it says how many, and leaves the rest selected for another try.
8
+ * handles both), updates each row with `useRowWrites`, and clears the
9
+ * selection. Each update is the save the record form makes: the collection's
10
+ * `browserCallbacks` run, then the server's callbacks and security rules, and
11
+ * every view of the collection reads it again. When one is refused, the rows
12
+ * before it are already archived: it says how many, and leaves the rest
13
+ * selected for another try.
12
14
  *
13
15
  * To use it: `admin: { Actions: [ArchiveSelectedAction] }` on the collection,
14
16
  * or copy it and change `FIELD` / `VALUE` / the label.
15
17
  */
16
18
  import React, { useState } from "react";
17
19
  import type { CollectionActionsProps } from "@rebasepro/cms-types";
18
- import { useData, useSnackbarController } from "@rebasepro/app";
20
+ import { useRowWrites, useSnackbarController } from "@rebasepro/app";
19
21
  import { resolveSelection } from "@rebasepro/cms";
20
22
  import { Button } from "@rebasepro/ui";
21
23
 
22
24
  const FIELD = "status";
23
25
  const VALUE = "archived";
24
26
 
25
- export function ArchiveSelectedAction({ path, selectionController }: CollectionActionsProps) {
26
- const data = useData();
27
+ export function ArchiveSelectedAction({ path, collection, context, selectionController }: CollectionActionsProps) {
28
+ const { update } = useRowWrites();
27
29
  const snackbar = useSnackbarController();
28
30
  const [running, setRunning] = useState(false);
29
31
 
@@ -31,23 +33,27 @@ export function ArchiveSelectedAction({ path, selectionController }: CollectionA
31
33
 
32
34
  const archive = async () => {
33
35
  setRunning(true);
34
- let rows: Awaited<ReturnType<typeof resolveSelection>> = [];
35
- let done = 0;
36
+ let ids: string[] = [];
37
+ const archived = new Set<string>();
36
38
  try {
37
- const accessor = data.collection(path);
38
- rows = await resolveSelection({ selection: selectionController.selection, accessor });
39
- for (const row of rows) {
40
- await accessor.update(row.id, { [FIELD]: VALUE });
41
- done++;
39
+ // Each row's id comes beside it, whatever the collection is keyed by.
40
+ ({ ids } = await resolveSelection({ selection: selectionController.selection, data: context.data, collection }));
41
+ for (const id of ids) {
42
+ await update(path, id, { [FIELD]: VALUE });
43
+ archived.add(id);
42
44
  }
43
45
  selectionController.clearSelection();
44
- snackbar.open({ type: "success", message: `Archived ${rows.length} row${rows.length === 1 ? "" : "s"}` });
46
+ snackbar.open({ type: "success", message: `Archived ${ids.length} row${ids.length === 1 ? "" : "s"}` });
45
47
  } catch (error) {
46
48
  const reason = error instanceof Error ? error.message : String(error);
47
- if (done > 0) selectionController.setSelectedEntities(rows.slice(done));
49
+ // The ticked rows not yet archived stay ticked, for another try.
50
+ const { selection } = selectionController;
51
+ if (archived.size > 0 && selection.type === "rows") {
52
+ selectionController.setSelectedRows(selection.rows.filter((_, i) => !archived.has(selection.ids[i])));
53
+ }
48
54
  snackbar.open({
49
55
  type: "error",
50
- message: rows.length > 0 ? `Archived ${done} of ${rows.length} rows. ${reason}` : reason
56
+ message: ids.length > 0 ? `Archived ${archived.size} of ${ids.length} rows. ${reason}` : reason
51
57
  });
52
58
  } finally {
53
59
  setRunning(false);