@rebasepro/cms 0.30.0 → 0.31.0-canary.g59cd6fd

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 (583) hide show
  1. package/README.md +8 -8
  2. package/dist/collection_editor/ConfigControllerProvider.js +25 -22
  3. package/dist/collection_editor/ConfigControllerProvider.js.map +1 -1
  4. package/dist/collection_editor/firestore_callee.d.ts +10 -0
  5. package/dist/collection_editor/firestore_callee.js +15 -0
  6. package/dist/collection_editor/firestore_callee.js.map +1 -0
  7. package/dist/collection_editor/firestore_edit.d.ts +62 -0
  8. package/dist/collection_editor/firestore_edit.js +339 -0
  9. package/dist/collection_editor/firestore_edit.js.map +1 -0
  10. package/dist/collection_editor/index.d.ts +2 -3
  11. package/dist/collection_editor/liveSchemaClient.d.ts +44 -22
  12. package/dist/collection_editor/liveSchemaClient.js +9 -3
  13. package/dist/collection_editor/liveSchemaClient.js.map +1 -1
  14. package/dist/collection_editor/property_column.d.ts +86 -0
  15. package/dist/collection_editor/property_column.js +719 -0
  16. package/dist/collection_editor/property_column.js.map +1 -0
  17. package/dist/collection_editor/serializable_types.d.ts +2 -24
  18. package/dist/collection_editor/serializable_utils.d.ts +1 -1
  19. package/dist/collection_editor/serializable_utils.js +2 -1
  20. package/dist/collection_editor/serializable_utils.js.map +1 -1
  21. package/dist/collection_editor/split_edit.d.ts +106 -0
  22. package/dist/collection_editor/split_edit.js +564 -0
  23. package/dist/collection_editor/split_edit.js.map +1 -0
  24. package/dist/collection_editor/split_edit_error.d.ts +25 -0
  25. package/dist/collection_editor/split_edit_error.js +35 -0
  26. package/dist/collection_editor/split_edit_error.js.map +1 -0
  27. package/dist/collection_editor/types/collection_editor_controller.d.ts +1 -1
  28. package/dist/collection_editor/types/config_controller.d.ts +67 -1
  29. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +6 -5
  30. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +44 -12
  31. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -1
  32. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +18 -3
  33. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -1
  34. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +94 -55
  35. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -1
  36. package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +2 -1
  37. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -1
  38. package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +1 -1
  39. package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
  40. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +3 -3
  41. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -1
  42. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -1
  43. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +2 -3
  44. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +1 -1
  45. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -1
  46. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +1 -1
  47. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +1 -1
  48. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -1
  49. package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +7 -4
  50. package/dist/collection_editor/ui/collection_editor/PropertyTree.js +15 -5
  51. package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -1
  52. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js +1 -1
  53. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -1
  54. package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.d.ts +20 -0
  55. package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js +74 -0
  56. package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js.map +1 -0
  57. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
  58. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
  59. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -1
  60. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +1 -1
  61. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -1
  62. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -1
  63. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -1
  64. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +1 -1
  65. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
  66. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -1
  67. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -1
  68. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -1
  69. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -1
  70. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +1 -1
  71. package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +1 -1
  72. package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +1 -1
  73. package/dist/collection_editor/ui/collection_editor/rlsRuleForm.d.ts +34 -0
  74. package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js +50 -0
  75. package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js.map +1 -0
  76. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +1 -2
  77. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -1
  78. package/dist/collection_editor/useDetachRulesConfirmation.d.ts +16 -0
  79. package/dist/collection_editor/useDetachRulesConfirmation.js +48 -0
  80. package/dist/collection_editor/useDetachRulesConfirmation.js.map +1 -0
  81. package/dist/collection_editor/useLiveSchemaEditing.d.ts +2 -2
  82. package/dist/collection_editor/useLiveSchemaEditing.js +1 -1
  83. package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -1
  84. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +54 -10
  85. package/dist/collection_editor/useLocalCollectionsConfigController.js +394 -122
  86. package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -1
  87. package/dist/collection_editor/validateCollectionJson.js.map +1 -1
  88. package/dist/components/CollectionPanel.d.ts +10 -9
  89. package/dist/components/CollectionPanel.js +5 -2
  90. package/dist/components/CollectionPanel.js.map +1 -1
  91. package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +1 -2
  92. package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
  93. package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
  94. package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +3 -5
  95. package/dist/components/CollectionTableBinding/PropertyTableCell.d.ts +2 -2
  96. package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
  97. package/dist/components/CollectionTableBinding/column_utils.d.ts +1 -1
  98. package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
  99. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.d.ts +2 -2
  100. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +1 -2
  101. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
  102. package/dist/components/CollectionTableBinding/fields/TableReferenceField.d.ts +2 -2
  103. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
  104. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
  105. package/dist/components/CollectionTableBinding/fields/TableRelationField.d.ts +2 -2
  106. package/dist/components/CollectionTableBinding/fields/TableRelationField.js +1 -2
  107. package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
  108. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.d.ts +2 -1
  109. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -1
  110. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.d.ts +2 -2
  111. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -1
  112. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.d.ts +1 -1
  113. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +1 -1
  114. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -1
  115. package/dist/components/CollectionTableBinding/internal/common.d.ts +1 -2
  116. package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
  117. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
  118. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +2 -2
  119. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
  120. package/dist/components/CollectionTableBinding/table_bindings.d.ts +2 -2
  121. package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -1
  122. package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +1 -1
  123. package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
  124. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +1 -2
  125. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -5
  126. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
  127. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +1 -2
  128. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
  129. package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +1 -1
  130. package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -1
  131. package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +1 -2
  132. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +1 -1
  133. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
  134. package/dist/components/CollectionViewBinding/CollectionToolbar.js +1 -1
  135. package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -1
  136. package/dist/components/CollectionViewBinding/CollectionViewActions.js +2 -4
  137. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
  138. package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +6 -6
  139. package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
  140. package/dist/components/CollectionViewBinding/CollectionViewContent.js +1 -2
  141. package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -1
  142. package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +1 -1
  143. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
  144. package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +1 -2
  145. package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -1
  146. package/dist/components/CollectionViewBinding/EntitiesCount.js +3 -3
  147. package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -1
  148. package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +1 -2
  149. package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
  150. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +1 -1
  151. package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -1
  152. package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +1 -2
  153. package/dist/components/CollectionViewBinding/FilterPresetsButton.js +1 -1
  154. package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -1
  155. package/dist/components/CollectionViewBinding/FiltersButton.d.ts +1 -2
  156. package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -1
  157. package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +1 -1
  158. package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -1
  159. package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +1 -2
  160. package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -1
  161. package/dist/components/CollectionViewBinding/RowActions.d.ts +1 -2
  162. package/dist/components/CollectionViewBinding/RowActions.js.map +1 -1
  163. package/dist/components/CollectionViewBinding/SortButton.d.ts +1 -1
  164. package/dist/components/CollectionViewBinding/SortButton.js.map +1 -1
  165. package/dist/components/CollectionViewBinding/SplitListView.d.ts +1 -2
  166. package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
  167. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.d.ts +1 -2
  168. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +1 -1
  169. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -1
  170. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +1 -2
  171. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -1
  172. package/dist/components/CollectionViewBinding/useBoardDataController.d.ts +2 -1
  173. package/dist/components/CollectionViewBinding/useBoardDataController.js +3 -3
  174. package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
  175. package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +2 -4
  176. package/dist/components/CollectionViewBinding/useCollectionViewState.js +14 -19
  177. package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -1
  178. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +1 -3
  179. package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
  180. package/dist/components/CollectionViewBinding/useSelectionController.d.ts +1 -2
  181. package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
  182. package/dist/components/CollectionsProvider.d.ts +23 -8
  183. package/dist/components/CollectionsProvider.js +23 -7
  184. package/dist/components/CollectionsProvider.js.map +1 -1
  185. package/dist/components/DefaultDrawer.js +1 -1
  186. package/dist/components/DeleteEntityDialog.d.ts +1 -1
  187. package/dist/components/DeleteEntityDialog.js +1 -1
  188. package/dist/components/DeleteEntityDialog.js.map +1 -1
  189. package/dist/components/DetailViewBinding.js +3 -3
  190. package/dist/components/DetailViewBinding.js.map +1 -1
  191. package/dist/components/EditFormActions.js.map +1 -1
  192. package/dist/components/EditViewBinding.d.ts +2 -1
  193. package/dist/components/EditViewBinding.js +6 -6
  194. package/dist/components/EditViewBinding.js.map +1 -1
  195. package/dist/components/EntityDisplayHeader.d.ts +1 -2
  196. package/dist/components/EntityDisplayHeader.js.map +1 -1
  197. package/dist/components/EntityInspector.d.ts +1 -2
  198. package/dist/components/EntityInspector.js.map +1 -1
  199. package/dist/components/EntityPreviewBinding.d.ts +1 -1
  200. package/dist/components/EntityPreviewBinding.js +1 -1
  201. package/dist/components/EntityPreviewBinding.js.map +1 -1
  202. package/dist/components/EntityViewBinding.d.ts +1 -1
  203. package/dist/components/EntityViewBinding.js.map +1 -1
  204. package/dist/components/EntityViewBody.d.ts +1 -1
  205. package/dist/components/EntityViewBody.js +3 -4
  206. package/dist/components/EntityViewBody.js.map +1 -1
  207. package/dist/components/FieldValue.js +2 -2
  208. package/dist/components/FieldValue.js.map +1 -1
  209. package/dist/components/HomePage/ContentHomePage.js +12 -3
  210. package/dist/components/HomePage/ContentHomePage.js.map +1 -1
  211. package/dist/components/InlineEntityPreview.d.ts +1 -1
  212. package/dist/components/InlineEntityPreview.js.map +1 -1
  213. package/dist/components/PropertyCollectionView.d.ts +2 -2
  214. package/dist/components/PropertyCollectionView.js.map +1 -1
  215. package/dist/components/PropertyConfigBadge.js.map +1 -1
  216. package/dist/components/RebaseCMS.d.ts +22 -3
  217. package/dist/components/RebaseCMS.js +32 -14
  218. package/dist/components/RebaseCMS.js.map +1 -1
  219. package/dist/components/RebaseNavigation.js +106 -31
  220. package/dist/components/RebaseNavigation.js.map +1 -1
  221. package/dist/components/RecordDetail.js +4 -1
  222. package/dist/components/RecordDetail.js.map +1 -1
  223. package/dist/components/RecordForm.d.ts +5 -5
  224. package/dist/components/RecordForm.js +5 -2
  225. package/dist/components/RecordForm.js.map +1 -1
  226. package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +2 -2
  227. package/dist/components/ReferenceTable/SelectionTableBinding.js +1 -1
  228. package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
  229. package/dist/components/ReferenceWidget.d.ts +2 -1
  230. package/dist/components/ReferenceWidget.js +2 -2
  231. package/dist/components/ReferenceWidget.js.map +1 -1
  232. package/dist/components/RelationSelector.d.ts +2 -1
  233. package/dist/components/RelationSelector.js +2 -3
  234. package/dist/components/RelationSelector.js.map +1 -1
  235. package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
  236. package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
  237. package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +2 -1
  238. package/dist/components/SelectableTable/filters/FilterFieldBinding.js +3 -3
  239. package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -1
  240. package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
  241. package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
  242. package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +1 -1
  243. package/dist/components/SelectableTable/filters/RelationFilterField.js +1 -1
  244. package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -1
  245. package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +1 -1
  246. package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
  247. package/dist/components/SelectableTable/filters/null_filter.d.ts +1 -3
  248. package/dist/components/SelectableTable/filters/null_filter.js.map +1 -1
  249. package/dist/components/SidePanelBinding.js +1 -1
  250. package/dist/components/SidePanelBinding.js.map +1 -1
  251. package/dist/components/field_configs.d.ts +1 -2
  252. package/dist/components/field_configs.js.map +1 -1
  253. package/dist/components/field_ids.d.ts +1 -1
  254. package/dist/components/field_ids.js +1 -1
  255. package/dist/components/field_ids.js.map +1 -1
  256. package/dist/components/history/EntityHistoryEntry.js.map +1 -1
  257. package/dist/components/history/EntityHistoryView.d.ts +1 -2
  258. package/dist/components/history/EntityHistoryView.js +1 -1
  259. package/dist/components/history/EntityHistoryView.js.map +1 -1
  260. package/dist/data_export/export/BasicExportAction.d.ts +1 -1
  261. package/dist/data_export/export/BasicExportAction.js.map +1 -1
  262. package/dist/data_export/export/ExportCollectionAction.js +2 -2
  263. package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
  264. package/dist/data_export/export/additional_fields.d.ts +1 -1
  265. package/dist/data_export/export/additional_fields.js.map +1 -1
  266. package/dist/data_export/export/export.d.ts +1 -1
  267. package/dist/data_export/export/export.js +1 -1
  268. package/dist/data_export/export/export.js.map +1 -1
  269. package/dist/data_export/export/fetch_export_data.d.ts +3 -2
  270. package/dist/data_export/export/fetch_export_data.js.map +1 -1
  271. package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
  272. package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -1
  273. package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +1 -1
  274. package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -1
  275. package/dist/data_import/hooks/useImportConfig.js.map +1 -1
  276. package/dist/data_import/import/ImportCollectionAction.d.ts +2 -2
  277. package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
  278. package/dist/data_import/types/column_mapping.d.ts +1 -1
  279. package/dist/data_import/utils/data.d.ts +1 -2
  280. package/dist/data_import/utils/data.js +1 -2
  281. package/dist/data_import/utils/data.js.map +1 -1
  282. package/dist/data_import/utils/get_import_inference_type.d.ts +1 -1
  283. package/dist/data_import/utils/get_import_inference_type.js.map +1 -1
  284. package/dist/data_import/utils/id_column.d.ts +1 -1
  285. package/dist/data_import/utils/id_column.js.map +1 -1
  286. package/dist/data_import/utils/import_columns.d.ts +1 -1
  287. package/dist/data_import/utils/import_columns.js.map +1 -1
  288. package/dist/data_import/utils/save_entities.d.ts +3 -3
  289. package/dist/data_import/utils/save_entities.js +1 -1
  290. package/dist/data_import/utils/save_entities.js.map +1 -1
  291. package/dist/form/EntityForm.js +2 -1
  292. package/dist/form/EntityForm.js.map +1 -1
  293. package/dist/form/EntityFormActions.js.map +1 -1
  294. package/dist/form/EntityFormBinding.js +2 -2
  295. package/dist/form/EntityFormBinding.js.map +1 -1
  296. package/dist/form/FormFieldsContext.d.ts +1 -4
  297. package/dist/form/FormFieldsContext.js +1 -1
  298. package/dist/form/FormFieldsContext.js.map +1 -1
  299. package/dist/form/PropertyFieldBinding.js +6 -8
  300. package/dist/form/PropertyFieldBinding.js.map +1 -1
  301. package/dist/form/components/FieldBlock.d.ts +1 -2
  302. package/dist/form/components/FieldBlock.js.map +1 -1
  303. package/dist/form/components/FieldHelperText.d.ts +1 -1
  304. package/dist/form/components/FieldHelperText.js.map +1 -1
  305. package/dist/form/components/FormRail.d.ts +1 -1
  306. package/dist/form/components/FormRail.js.map +1 -1
  307. package/dist/form/components/LocalChangesMenu.d.ts +1 -1
  308. package/dist/form/components/LocalChangesMenu.js.map +1 -1
  309. package/dist/form/components/StorageItemPreview.d.ts +1 -1
  310. package/dist/form/components/StorageItemPreview.js.map +1 -1
  311. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  312. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +1 -1
  313. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -1
  314. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +2 -2
  315. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
  316. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
  317. package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
  318. package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -1
  319. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  320. package/dist/form/field_bindings/BlockFieldBinding.js +1 -1
  321. package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -1
  322. package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
  323. package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -1
  324. package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
  325. package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -1
  326. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  327. package/dist/form/field_bindings/KeyValueFieldBinding.js +1 -2
  328. package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
  329. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  330. package/dist/form/field_bindings/MapFieldBinding.js.map +1 -1
  331. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
  332. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
  333. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
  334. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
  335. package/dist/form/field_bindings/MultiSelectFieldBinding.js +1 -1
  336. package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -1
  337. package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +1 -1
  338. package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
  339. package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
  340. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  341. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
  342. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +1 -1
  343. package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
  344. package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
  345. package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
  346. package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
  347. package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
  348. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  349. package/dist/form/field_bindings/RepeatFieldBinding.js +1 -1
  350. package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -1
  351. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  352. package/dist/form/field_bindings/SelectFieldBinding.js +1 -1
  353. package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -1
  354. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -2
  355. package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
  356. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
  357. package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -1
  358. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  359. package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
  360. package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
  361. package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -1
  362. package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
  363. package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -1
  364. package/dist/form/form_utils.d.ts +3 -3
  365. package/dist/form/form_utils.js +1 -2
  366. package/dist/form/form_utils.js.map +1 -1
  367. package/dist/form/label_placement.d.ts +1 -2
  368. package/dist/form/label_placement.js.map +1 -1
  369. package/dist/form/resolve_cell_property.d.ts +1 -2
  370. package/dist/form/resolve_cell_property.js +1 -1
  371. package/dist/form/resolve_cell_property.js.map +1 -1
  372. package/dist/form/resolve_form_properties.d.ts +2 -2
  373. package/dist/form/resolve_form_properties.js +1 -1
  374. package/dist/form/resolve_form_properties.js.map +1 -1
  375. package/dist/form/useClearRestoreValue.d.ts +1 -1
  376. package/dist/form/useClearRestoreValue.js.map +1 -1
  377. package/dist/form/validation.d.ts +2 -2
  378. package/dist/form/validation.js +1 -1
  379. package/dist/form/validation.js.map +1 -1
  380. package/dist/hooks/navigation/compose_collections.d.ts +59 -0
  381. package/dist/hooks/navigation/compose_collections.js +48 -0
  382. package/dist/hooks/navigation/compose_collections.js.map +1 -0
  383. package/dist/hooks/navigation/compose_collections_input.d.ts +8 -0
  384. package/dist/hooks/navigation/compose_collections_input.js +17 -0
  385. package/dist/hooks/navigation/compose_collections_input.js.map +1 -0
  386. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
  387. package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -1
  388. package/dist/hooks/navigation/registered_collection.d.ts +15 -0
  389. package/dist/hooks/navigation/registered_collection.js +20 -0
  390. package/dist/hooks/navigation/registered_collection.js.map +1 -0
  391. package/dist/hooks/navigation/ui_preferences.d.ts +47 -0
  392. package/dist/hooks/navigation/ui_preferences.js +179 -0
  393. package/dist/hooks/navigation/ui_preferences.js.map +1 -0
  394. package/dist/hooks/navigation/useAsyncResolver.d.ts +8 -1
  395. package/dist/hooks/navigation/useAsyncResolver.js +9 -3
  396. package/dist/hooks/navigation/useAsyncResolver.js.map +1 -1
  397. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +1 -3
  398. package/dist/hooks/navigation/useBuildCollectionRegistryController.js +3 -3
  399. package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -1
  400. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +9 -5
  401. package/dist/hooks/navigation/useBuildNavigationStateController.js +2 -1
  402. package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
  403. package/dist/hooks/navigation/useBuildUrlController.d.ts +1 -1
  404. package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
  405. package/dist/hooks/navigation/useNavigationResolution.js +1 -2
  406. package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
  407. package/dist/hooks/navigation/usePanelTables.d.ts +11 -0
  408. package/dist/hooks/navigation/usePanelTables.js +33 -0
  409. package/dist/hooks/navigation/usePanelTables.js.map +1 -0
  410. package/dist/hooks/navigation/useResolvedCollections.d.ts +8 -3
  411. package/dist/hooks/navigation/useResolvedCollections.js +3 -2
  412. package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
  413. package/dist/hooks/navigation/useResolvedViews.d.ts +1 -2
  414. package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
  415. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -2
  416. package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -1
  417. package/dist/hooks/navigation/user_preferences_overlay.d.ts +21 -0
  418. package/dist/hooks/navigation/user_preferences_overlay.js +101 -0
  419. package/dist/hooks/navigation/user_preferences_overlay.js.map +1 -0
  420. package/dist/hooks/navigation/utils.js +1 -1
  421. package/dist/hooks/navigation/utils.js.map +1 -1
  422. package/dist/hooks/useAdminContext.d.ts +1 -2
  423. package/dist/hooks/useAdminContext.js.map +1 -1
  424. package/dist/hooks/useBuildSidePanel.d.ts +1 -2
  425. package/dist/hooks/useBuildSidePanel.js +2 -1
  426. package/dist/hooks/useBuildSidePanel.js.map +1 -1
  427. package/dist/hooks/useChildViewSource.d.ts +1 -1
  428. package/dist/hooks/useChildViewSource.js +1 -1
  429. package/dist/hooks/useChildViewSource.js.map +1 -1
  430. package/dist/hooks/useEntityDisplay.d.ts +1 -2
  431. package/dist/hooks/useEntityDisplay.js +1 -1
  432. package/dist/hooks/useEntityDisplay.js.map +1 -1
  433. package/dist/hooks/useEntityDisplayTitle.d.ts +2 -2
  434. package/dist/hooks/useEntityDisplayTitle.js.map +1 -1
  435. package/dist/hooks/useHistory.js +1 -1
  436. package/dist/hooks/useHistory.js.map +1 -1
  437. package/dist/hooks/useRecordActions.d.ts +1 -2
  438. package/dist/hooks/useRecordActions.js.map +1 -1
  439. package/dist/hooks/useReferencePaths.d.ts +21 -7
  440. package/dist/hooks/useReferencePaths.js +23 -6
  441. package/dist/hooks/useReferencePaths.js.map +1 -1
  442. package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
  443. package/dist/hooks/useResolvedNavigationFrom.js +1 -1
  444. package/dist/hooks/useResolvedNavigationFrom.js.map +1 -1
  445. package/dist/index.d.ts +11 -0
  446. package/dist/index.js +8 -2
  447. package/dist/mcp_view/app_modules.d.ts +2 -2
  448. package/dist/mcp_view/app_modules.js +4 -4
  449. package/dist/mcp_view/app_modules.js.map +1 -1
  450. package/dist/mcp_view/index.d.ts +16 -19
  451. package/dist/mcp_view/index.js +43 -62
  452. package/dist/mcp_view/index.js.map +1 -1
  453. package/dist/mcp_view/payload.d.ts +54 -18
  454. package/dist/mcp_view/payload.js +49 -24
  455. package/dist/mcp_view/payload.js.map +1 -1
  456. package/dist/mcp_view/screen.js +11 -11
  457. package/dist/mcp_view/screen.js.map +1 -1
  458. package/dist/mcp_view/tool_driver.d.ts +5 -34
  459. package/dist/mcp_view/tool_driver.js +17 -16
  460. package/dist/mcp_view/tool_driver.js.map +1 -1
  461. package/dist/mcp_view/write_review.d.ts +1 -2
  462. package/dist/mcp_view/write_review.js +1 -1
  463. package/dist/mcp_view/write_review.js.map +1 -1
  464. package/dist/preview/PropertyPreview.d.ts +1 -1
  465. package/dist/preview/PropertyPreview.js +4 -3
  466. package/dist/preview/PropertyPreview.js.map +1 -1
  467. package/dist/preview/components/ArrayEnumPreview.d.ts +1 -1
  468. package/dist/preview/components/ArrayEnumPreview.js.map +1 -1
  469. package/dist/preview/components/BooleanPreview.d.ts +1 -1
  470. package/dist/preview/components/BooleanPreview.js.map +1 -1
  471. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  472. package/dist/preview/components/EnumValuesChip.js +1 -1
  473. package/dist/preview/components/EnumValuesChip.js.map +1 -1
  474. package/dist/preview/components/ReferencePreview.d.ts +1 -1
  475. package/dist/preview/components/ReferencePreview.js.map +1 -1
  476. package/dist/preview/components/RelationPreview.d.ts +1 -1
  477. package/dist/preview/components/RelationPreview.js.map +1 -1
  478. package/dist/preview/components/StorageThumbnail.js +2 -1
  479. package/dist/preview/components/StorageThumbnail.js.map +1 -1
  480. package/dist/preview/components/UserPreview.d.ts +1 -1
  481. package/dist/preview/components/UserPreview.js.map +1 -1
  482. package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
  483. package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -1
  484. package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
  485. package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -1
  486. package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
  487. package/dist/preview/property_previews/ArrayOfRelationsPreview.js +2 -1
  488. package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -1
  489. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
  490. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -1
  491. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
  492. package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -1
  493. package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
  494. package/dist/preview/property_previews/ArrayOneOfPreview.js +1 -1
  495. package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -1
  496. package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
  497. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +1 -1
  498. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -1
  499. package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
  500. package/dist/preview/property_previews/ArrayPropertyPreview.js +1 -1
  501. package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -1
  502. package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
  503. package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -1
  504. package/dist/preview/property_previews/NumberPropertyPreview.d.ts +1 -1
  505. package/dist/preview/property_previews/NumberPropertyPreview.js +1 -1
  506. package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -1
  507. package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
  508. package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -1
  509. package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
  510. package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -1
  511. package/dist/preview/util.d.ts +1 -1
  512. package/dist/preview/util.js.map +1 -1
  513. package/dist/routes/RebaseRoute.js +2 -2
  514. package/dist/routes/RebaseRoute.js.map +1 -1
  515. package/dist/saved_apps/SavedAppsView.d.ts +1 -1
  516. package/dist/saved_apps/SavedAppsView.js +1 -1
  517. package/dist/saved_apps/SavedAppsView.js.map +1 -1
  518. package/dist/selection/SelectionMenu.d.ts +1 -1
  519. package/dist/selection/SelectionMenu.js.map +1 -1
  520. package/dist/selection/resolve_selection.d.ts +3 -3
  521. package/dist/selection/resolve_selection.js +3 -2
  522. package/dist/selection/resolve_selection.js.map +1 -1
  523. package/dist/tables/apply_customization.d.ts +65 -0
  524. package/dist/tables/apply_customization.js +644 -0
  525. package/dist/tables/apply_customization.js.map +1 -0
  526. package/dist/tables/column_property.d.ts +64 -0
  527. package/dist/tables/column_property.js +549 -0
  528. package/dist/tables/column_property.js.map +1 -0
  529. package/dist/tables/customize_table.d.ts +39 -0
  530. package/dist/tables/customize_table.js +247 -0
  531. package/dist/tables/customize_table.js.map +1 -0
  532. package/dist/tables/index.d.ts +12 -0
  533. package/dist/tables/labels.d.ts +18 -0
  534. package/dist/tables/labels.js +18 -0
  535. package/dist/tables/labels.js.map +1 -0
  536. package/dist/tables/project_table.d.ts +79 -0
  537. package/dist/tables/project_table.js +148 -0
  538. package/dist/tables/project_table.js.map +1 -0
  539. package/dist/tables/relations.d.ts +47 -0
  540. package/dist/tables/relations.js +112 -0
  541. package/dist/tables/relations.js.map +1 -0
  542. package/dist/tables/rls.d.ts +39 -0
  543. package/dist/tables/rls.js +111 -0
  544. package/dist/tables/rls.js.map +1 -0
  545. package/dist/tables/update_record.d.ts +32 -0
  546. package/dist/tables/update_record.js +40 -0
  547. package/dist/tables/update_record.js.map +1 -0
  548. package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
  549. package/dist/types/components/PropertyPreviewProps.d.ts +2 -2
  550. package/dist/types/fields.d.ts +2 -2
  551. package/dist/util/dataControllerAdapter.js.map +1 -1
  552. package/dist/util/entity_pages.d.ts +2 -1
  553. package/dist/util/entity_pages.js.map +1 -1
  554. package/dist/util/find_entities_by_ids.d.ts +2 -2
  555. package/dist/util/find_entities_by_ids.js +1 -1
  556. package/dist/util/find_entities_by_ids.js.map +1 -1
  557. package/dist/util/format_collection_date.d.ts +1 -1
  558. package/dist/util/format_collection_date.js.map +1 -1
  559. package/dist/util/identity.d.ts +8 -0
  560. package/dist/util/identity.js +16 -0
  561. package/dist/util/identity.js.map +1 -0
  562. package/dist/util/navigation_utils.js +1 -1
  563. package/dist/util/navigation_utils.js.map +1 -1
  564. package/dist/util/previews.js +1 -1
  565. package/dist/util/previews.js.map +1 -1
  566. package/dist/util/propertyConfigMapper.d.ts +1 -1
  567. package/dist/util/propertyConfigMapper.js.map +1 -1
  568. package/dist/util/property_utils.d.ts +1 -3
  569. package/dist/util/property_utils.js +1 -1
  570. package/dist/util/property_utils.js.map +1 -1
  571. package/dist/util/relations.d.ts +18 -0
  572. package/dist/util/relations.js +32 -0
  573. package/dist/util/relations.js.map +1 -0
  574. package/package.json +12 -10
  575. package/recipes/README.md +4 -4
  576. package/recipes/my-preferences.tsx +34 -26
  577. package/recipes/site-settings.tsx +34 -27
  578. package/dist/collection_editor/collection_wire.d.ts +0 -13
  579. package/dist/collection_editor/collection_wire.js +0 -49
  580. package/dist/collection_editor/collection_wire.js.map +0 -1
  581. package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +0 -37
  582. package/dist/collection_editor/useJsonCollectionsConfigController.js +0 -191
  583. package/dist/collection_editor/useJsonCollectionsConfigController.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"field_configs.js","names":[],"sources":["../../src/components/field_configs.tsx"],"sourcesContent":["\nimport type { DefaultFieldConfig } from \"../types/fields\";\nimport type { Property } from \"@rebasepro/types\";\nimport type { PropertyConfig } from \"@rebasepro/cms-types\";\nimport { ArrayCustomShapedFieldBinding } from \"../form/field_bindings/ArrayCustomShapedFieldBinding\";\nimport { ArrayOfReferencesFieldBinding } from \"../form/field_bindings/ArrayOfReferencesFieldBinding\";\nimport { BlockFieldBinding } from \"../form/field_bindings/BlockFieldBinding\";\nimport { DateTimeFieldBinding } from \"../form/field_bindings/DateTimeFieldBinding\";\nimport { KeyValueFieldBinding } from \"../form/field_bindings/KeyValueFieldBinding\";\nimport { MapFieldBinding } from \"../form/field_bindings/MapFieldBinding\";\nimport { MarkdownEditorFieldBinding } from \"../form/field_bindings/MarkdownEditorFieldBinding\";\nimport { MultiSelectFieldBinding } from \"../form/field_bindings/MultiSelectFieldBinding\";\nimport { ReferenceFieldBinding } from \"../form/field_bindings/ReferenceFieldBinding\";\nimport { RepeatFieldBinding } from \"../form/field_bindings/RepeatFieldBinding\";\nimport { SelectFieldBinding } from \"../form/field_bindings/SelectFieldBinding\";\nimport { StorageUploadFieldBinding } from \"../form/field_bindings/StorageUploadFieldBinding\";\nimport { SwitchFieldBinding } from \"../form/field_bindings/SwitchFieldBinding\";\nimport { TextFieldBinding } from \"../form/field_bindings/TextFieldBinding\";\nimport { VectorFieldBinding } from \"../form/field_bindings/VectorFieldBinding\";\nimport { GeopointFieldBinding } from \"../form/field_bindings/GeopointFieldBinding\";\nimport { BinaryFieldBinding } from \"../form/field_bindings/BinaryFieldBinding\";\n\nimport {\n AlignLeftIcon,\n CalendarIcon,\n FlagIcon,\n FolderUpIcon,\n GlobeIcon,\n HashIcon,\n LinkIcon,\n ListIcon,\n ListOrderedIcon,\n MailIcon,\n QuoteIcon,\n RepeatIcon,\n Rows3Icon,\n TextIcon,\n UploadIcon,\n UserCheckIcon,\n UserIcon,\n VoteIcon\n} from \"@rebasepro/ui\";\nimport { RelationFieldBinding } from \"../form/field_bindings/RelationFieldBinding\";\nimport { UserSelectFieldBinding } from \"../form/field_bindings/UserSelectFieldBinding\";\nimport { mergeDeep } from \"@rebasepro/utils\";\n// Which widget a property gets is decided without the widgets: those two\n// functions live in a module that imports no field binding, so code that only\n// asks (the AI plugin, the import mapper) does not pull every field binding —\n// and through them the whole entity form — into its bundle.\nimport { getDefaultFieldId, getFieldId } from \"./field_ids\";\n\nexport { getDefaultFieldId, getFieldId };\n\n/**\n * Every `Field` below is a getter on purpose — do not inline it back to\n * `Field: SomeBinding`.\n *\n * This module and the field bindings form an import cycle: we import the\n * bindings, the container bindings (map, repeat, block, custom-shaped array)\n * import `PropertyFieldBinding` to render their children, and that imports\n * `getFieldConfig` from here. Enter the cycle at a binding rather than here and\n * this object is built while that binding's module is still initialising.\n *\n * As a plain value the binding would be read at that moment. It happens to\n * survive today only because every binding is declared `export function`, which\n * hoists; rewriting a single one as `export const` would make the read a\n * temporal dead zone ReferenceError at import time, surfacing as a blank screen\n * far from its cause. The getter defers the read to first access, long after\n * every module has initialised, so declaration style stops mattering.\n */\nexport const DEFAULT_FIELD_CONFIGS: Record<DefaultFieldConfig, PropertyConfig> = {\n text_field: {\n key: \"text_field\",\n name: \"Text field\",\n description: \"Simple short text\",\n Icon: TextIcon,\n color: \"#2d7ff9\",\n property: {\n type: \"string\",\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n multiline: {\n key: \"multiline\",\n name: \"Multiline\",\n description: \"Text with multiple lines\",\n Icon: AlignLeftIcon,\n color: \"#2d7ff9\",\n property: {\n type: \"string\",\n admin: { multiline: true,\nget Field() { return TextFieldBinding; } }\n }\n },\n markdown: {\n key: \"markdown\",\n name: \"Markdown\",\n description: \"Text with advanced markdown syntax\",\n Icon: QuoteIcon,\n color: \"#2d7ff9\",\n property: {\n type: \"string\",\n admin: { markdown: true,\nget Field() { return MarkdownEditorFieldBinding; } }\n }\n },\n url: {\n key: \"url\",\n name: \"Url\",\n description: \"Text with URL validation\",\n Icon: GlobeIcon,\n color: \"#154fb3\",\n property: {\n type: \"string\",\n url: true,\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n email: {\n key: \"email\",\n name: \"Email\",\n description: \"Text with email validation\",\n Icon: MailIcon,\n color: \"#154fb3\",\n property: {\n type: \"string\",\n email: true,\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n switch: {\n key: \"switch\",\n name: \"Switch\",\n description: \"Boolean true or false field (or yes or no, 0 or 1...)\",\n Icon: FlagIcon,\n color: \"#20d9d2\",\n property: {\n type: \"boolean\",\n admin: { get Field() { return SwitchFieldBinding; } }\n }\n },\n select: {\n key: \"select\",\n name: \"Select/enum\",\n description: \"Select one text value from within an enumeration\",\n Icon: ListIcon,\n color: \"#4223c9\",\n property: {\n type: \"string\",\n enum: [],\n admin: { get Field() { return SelectFieldBinding; } }\n }\n },\n multi_select: {\n key: \"multi_select\",\n name: \"Multi select (enum)\",\n description: \"Select multiple text values from within an enumeration\",\n Icon: ListIcon,\n color: \"#4223c9\",\n property: {\n type: \"array\",\n of: {\n type: \"string\",\n enum: []\n },\n admin: { get Field() { return MultiSelectFieldBinding; } }\n }\n },\n user_select: {\n key: \"user_select\",\n name: \"User select\",\n description: \"Select a user from the user management system. Store the user ID.\",\n Icon: UserIcon,\n property: {\n type: \"string\",\n admin: { get Field() { return UserSelectFieldBinding; } }\n }\n },\n number_input: {\n key: \"number_input\",\n name: \"Number input\",\n description: \"Simple number field with validation\",\n Icon: HashIcon,\n color: \"#bec920\",\n property: {\n type: \"number\",\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n number_select: {\n key: \"number_select\",\n name: \"Number select\",\n description: \"Select a number value from within an enumeration\",\n Icon: ListOrderedIcon,\n color: \"#bec920\",\n property: {\n type: \"number\",\n enum: [],\n admin: { get Field() { return SelectFieldBinding; } }\n }\n },\n multi_number_select: {\n key: \"multi_number_select\",\n name: \"Multiple number select\",\n description: \"Select multiple number values from within an enumeration\",\n Icon: ListOrderedIcon,\n color: \"#bec920\",\n property: {\n type: \"array\",\n of: {\n type: \"number\",\n enum: []\n },\n admin: { get Field() { return MultiSelectFieldBinding; } }\n }\n },\n file_upload: {\n key: \"file_upload\",\n name: \"File upload\",\n description: \"Input for uploading single files\",\n Icon: UploadIcon,\n color: \"#f92d9a\",\n property: {\n type: \"string\",\n storage: {\n storagePath: \"{path}\"\n },\n admin: { get Field() { return StorageUploadFieldBinding; } }\n }\n },\n multi_file_upload: {\n key: \"multi_file_upload\",\n name: \"Multiple file upload\",\n description: \"Input for uploading multiple files\",\n Icon: FolderUpIcon,\n color: \"#f92d9a\",\n property: {\n type: \"array\",\n of: {\n type: \"string\",\n storage: {\n storagePath: \"{path}\"\n }\n },\n admin: { get Field() { return StorageUploadFieldBinding; } }\n }\n },\n reference: {\n key: \"reference\",\n name: \"Reference\",\n description: \"The value refers to a different collection (it is saved as a reference)\",\n Icon: LinkIcon,\n color: \"#ff0042\",\n property: {\n type: \"reference\",\n admin: { get Field() { return ReferenceFieldBinding; } }\n }\n },\n multi_references: {\n key: \"multi_references\",\n name: \"Multiple references\",\n description: \"Multiple values that refer to a different collection\",\n Icon: LinkIcon,\n color: \"#ff0042\",\n property: {\n type: \"array\",\n of: {\n type: \"reference\"\n },\n admin: { get Field() { return ArrayOfReferencesFieldBinding; } }\n }\n },\n relation: {\n key: \"relation\",\n name: \"Relation\",\n description: \"Multiple values that refer to a different collection\",\n Icon: LinkIcon,\n color: \"#ff0042\",\n property: {\n // relationName now lives on the link\n // relationName: \"\",\n type: \"relation\",\n admin: { get Field() { return RelationFieldBinding; } }\n }\n },\n date_time: {\n key: \"date_time\",\n name: \"Date/time\",\n description: \"A date time select field\",\n Icon: CalendarIcon,\n color: \"#8b46ff\",\n property: {\n type: \"date\",\n admin: { get Field() { return DateTimeFieldBinding; } }\n }\n },\n group: {\n key: \"group\",\n name: \"Group\",\n description: \"Group of multiple fields\",\n Icon: VoteIcon,\n color: \"#ff9408\",\n property: {\n type: \"map\",\n properties: {},\n admin: { get Field() { return MapFieldBinding; } }\n }\n },\n key_value: {\n key: \"key_value\",\n name: \"Key-value\",\n description: \"Flexible field that allows the user to add multiple key-value pairs\",\n Icon: VoteIcon,\n color: \"#ff9408\",\n property: {\n type: \"map\",\n keyValue: true,\n admin: { get Field() { return KeyValueFieldBinding; } }\n }\n },\n repeat: {\n key: \"repeat\",\n name: \"Repeat/list\",\n description: \"A field that gets repeated multiple times (e.g. multiple text fields)\",\n Icon: RepeatIcon,\n color: \"#ff9408\",\n property: {\n type: \"array\",\n of: {\n type: \"string\"\n },\n admin: { get Field() { return RepeatFieldBinding; } }\n }\n },\n custom_array: {\n key: \"custom_array\",\n name: \"Custom array\",\n description: \"A field that saved its value as an array of custom objects\",\n Icon: RepeatIcon,\n color: \"#ff9408\",\n property: {\n type: \"array\",\n admin: { get Field() { return ArrayCustomShapedFieldBinding; } }\n }\n },\n block: {\n key: \"block\",\n name: \"Block\",\n description: \"A complex field that allows the user to compose different fields together, with a key/value format\",\n Icon: Rows3Icon,\n color: \"#ff9408\",\n property: {\n type: \"array\",\n oneOf: {\n properties: {}\n },\n admin: { get Field() { return BlockFieldBinding; } }\n }\n },\n vector_input: {\n key: \"vector_input\",\n name: \"Vector input\",\n description: \"Vector array for embeddings\",\n Icon: HashIcon,\n color: \"#bec920\",\n property: {\n type: \"vector\",\n dimensions: 1536,\n admin: { get Field() { return VectorFieldBinding; } }\n }\n },\n geopoint: {\n key: \"geopoint\",\n name: \"Location\",\n description: \"A latitude and longitude\",\n Icon: GlobeIcon,\n color: \"#3f9e5c\",\n property: {\n type: \"geopoint\",\n admin: { get Field() { return GeopointFieldBinding; } }\n }\n },\n binary: {\n key: \"binary\",\n name: \"Binary\",\n description: \"Base64-encoded bytes\",\n Icon: HashIcon,\n color: \"#7a6ff0\",\n property: {\n type: \"binary\",\n admin: { get Field() { return BinaryFieldBinding; } }\n }\n }\n};\n\nexport function getDefaultFieldConfig(property: Property): PropertyConfig | undefined {\n const fieldId = getDefaultFieldId(property);\n if (!fieldId) {\n console.error(\"No field id found for property\", property);\n return undefined;\n }\n return DEFAULT_FIELD_CONFIGS[fieldId];\n}\n\nexport function getFieldConfig(property: Property, propertyConfigs: Record<string, PropertyConfig>): PropertyConfig | undefined {\n const fieldId = getFieldId(property);\n const defaultFieldId = getDefaultFieldId(property);\n if (!defaultFieldId) {\n console.error(\"No field id found for property\", property);\n return undefined;\n }\n const defaultFieldConfig = defaultFieldId ? DEFAULT_FIELD_CONFIGS[defaultFieldId] : undefined;\n const customField = fieldId && propertyConfigs ? propertyConfigs[fieldId] : undefined;\n return mergeDeep(defaultFieldConfig ?? {}, customField ?? {} as PropertyConfig);\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,IAAa,wBAAoE;CAC7E,YAAY;EACR,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO,EAAE,IAAI,QAAQ;IAAE,OAAO;GAAkB,EAAE;EACtD;CACJ;CACA,WAAW;EACP,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO;IAAE,WAAW;IAChC,IAAI,QAAQ;KAAE,OAAO;IAAkB;GAAE;EACjC;CACJ;CACA,UAAU;EACN,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO;IAAE,UAAU;IAC/B,IAAI,QAAQ;KAAE,OAAO;IAA4B;GAAE;EAC3C;CACJ;CACA,KAAK;EACD,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,KAAK;GACL,OAAO,EAAE,IAAI,QAAQ;IAAE,OAAO;GAAkB,EAAE;EACtD;CACJ;CACA,OAAO;EACH,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO;GACP,OAAO,EAAE,IAAI,QAAQ;IAAE,OAAO;GAAkB,EAAE;EACtD;CACJ;CACA,QAAQ;EACJ,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OA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B,eAAe,UAAoB,iBAA6E;CAC5H,MAAM,UAAU,WAAW,QAAQ;CACnC,MAAM,iBAAiB,kBAAkB,QAAQ;CACjD,IAAI,CAAC,gBAAgB;EACjB,QAAQ,MAAM,kCAAkC,QAAQ;EACxD;CACJ;CACA,MAAM,qBAAqB,iBAAiB,sBAAsB,kBAAkB,KAAA;CACpF,MAAM,cAAc,WAAW,kBAAkB,gBAAgB,WAAW,KAAA;CAC5E,OAAO,UAAU,sBAAsB,CAAC,GAAG,eAAe,CAAC,CAAmB;AAClF"}
1
+ {"version":3,"file":"field_configs.js","names":[],"sources":["../../src/components/field_configs.tsx"],"sourcesContent":["\nimport type { DefaultFieldConfig } from \"../types/fields\";\nimport type { PropertyConfig, Property } from \"@rebasepro/cms-types\";\nimport { ArrayCustomShapedFieldBinding } from \"../form/field_bindings/ArrayCustomShapedFieldBinding\";\nimport { ArrayOfReferencesFieldBinding } from \"../form/field_bindings/ArrayOfReferencesFieldBinding\";\nimport { BlockFieldBinding } from \"../form/field_bindings/BlockFieldBinding\";\nimport { DateTimeFieldBinding } from \"../form/field_bindings/DateTimeFieldBinding\";\nimport { KeyValueFieldBinding } from \"../form/field_bindings/KeyValueFieldBinding\";\nimport { MapFieldBinding } from \"../form/field_bindings/MapFieldBinding\";\nimport { MarkdownEditorFieldBinding } from \"../form/field_bindings/MarkdownEditorFieldBinding\";\nimport { MultiSelectFieldBinding } from \"../form/field_bindings/MultiSelectFieldBinding\";\nimport { ReferenceFieldBinding } from \"../form/field_bindings/ReferenceFieldBinding\";\nimport { RepeatFieldBinding } from \"../form/field_bindings/RepeatFieldBinding\";\nimport { SelectFieldBinding } from \"../form/field_bindings/SelectFieldBinding\";\nimport { StorageUploadFieldBinding } from \"../form/field_bindings/StorageUploadFieldBinding\";\nimport { SwitchFieldBinding } from \"../form/field_bindings/SwitchFieldBinding\";\nimport { TextFieldBinding } from \"../form/field_bindings/TextFieldBinding\";\nimport { VectorFieldBinding } from \"../form/field_bindings/VectorFieldBinding\";\nimport { GeopointFieldBinding } from \"../form/field_bindings/GeopointFieldBinding\";\nimport { BinaryFieldBinding } from \"../form/field_bindings/BinaryFieldBinding\";\n\nimport {\n AlignLeftIcon,\n CalendarIcon,\n FlagIcon,\n FolderUpIcon,\n GlobeIcon,\n HashIcon,\n LinkIcon,\n ListIcon,\n ListOrderedIcon,\n MailIcon,\n QuoteIcon,\n RepeatIcon,\n Rows3Icon,\n TextIcon,\n UploadIcon,\n UserCheckIcon,\n UserIcon,\n VoteIcon\n} from \"@rebasepro/ui\";\nimport { RelationFieldBinding } from \"../form/field_bindings/RelationFieldBinding\";\nimport { UserSelectFieldBinding } from \"../form/field_bindings/UserSelectFieldBinding\";\nimport { mergeDeep } from \"@rebasepro/utils\";\n// Which widget a property gets is decided without the widgets: those two\n// functions live in a module that imports no field binding, so code that only\n// asks (the AI plugin, the import mapper) does not pull every field binding —\n// and through them the whole entity form — into its bundle.\nimport { getDefaultFieldId, getFieldId } from \"./field_ids\";\n\nexport { getDefaultFieldId, getFieldId };\n\n/**\n * Every `Field` below is a getter on purpose — do not inline it back to\n * `Field: SomeBinding`.\n *\n * This module and the field bindings form an import cycle: we import the\n * bindings, the container bindings (map, repeat, block, custom-shaped array)\n * import `PropertyFieldBinding` to render their children, and that imports\n * `getFieldConfig` from here. Enter the cycle at a binding rather than here and\n * this object is built while that binding's module is still initialising.\n *\n * As a plain value the binding would be read at that moment. It happens to\n * survive today only because every binding is declared `export function`, which\n * hoists; rewriting a single one as `export const` would make the read a\n * temporal dead zone ReferenceError at import time, surfacing as a blank screen\n * far from its cause. The getter defers the read to first access, long after\n * every module has initialised, so declaration style stops mattering.\n */\nexport const DEFAULT_FIELD_CONFIGS: Record<DefaultFieldConfig, PropertyConfig> = {\n text_field: {\n key: \"text_field\",\n name: \"Text field\",\n description: \"Simple short text\",\n Icon: TextIcon,\n color: \"#2d7ff9\",\n property: {\n type: \"string\",\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n multiline: {\n key: \"multiline\",\n name: \"Multiline\",\n description: \"Text with multiple lines\",\n Icon: AlignLeftIcon,\n color: \"#2d7ff9\",\n property: {\n type: \"string\",\n admin: { multiline: true,\nget Field() { return TextFieldBinding; } }\n }\n },\n markdown: {\n key: \"markdown\",\n name: \"Markdown\",\n description: \"Text with advanced markdown syntax\",\n Icon: QuoteIcon,\n color: \"#2d7ff9\",\n property: {\n type: \"string\",\n admin: { markdown: true,\nget Field() { return MarkdownEditorFieldBinding; } }\n }\n },\n url: {\n key: \"url\",\n name: \"Url\",\n description: \"Text with URL validation\",\n Icon: GlobeIcon,\n color: \"#154fb3\",\n property: {\n type: \"string\",\n url: true,\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n email: {\n key: \"email\",\n name: \"Email\",\n description: \"Text with email validation\",\n Icon: MailIcon,\n color: \"#154fb3\",\n property: {\n type: \"string\",\n email: true,\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n switch: {\n key: \"switch\",\n name: \"Switch\",\n description: \"Boolean true or false field (or yes or no, 0 or 1...)\",\n Icon: FlagIcon,\n color: \"#20d9d2\",\n property: {\n type: \"boolean\",\n admin: { get Field() { return SwitchFieldBinding; } }\n }\n },\n select: {\n key: \"select\",\n name: \"Select/enum\",\n description: \"Select one text value from within an enumeration\",\n Icon: ListIcon,\n color: \"#4223c9\",\n property: {\n type: \"string\",\n enum: [],\n admin: { get Field() { return SelectFieldBinding; } }\n }\n },\n multi_select: {\n key: \"multi_select\",\n name: \"Multi select (enum)\",\n description: \"Select multiple text values from within an enumeration\",\n Icon: ListIcon,\n color: \"#4223c9\",\n property: {\n type: \"array\",\n of: {\n type: \"string\",\n enum: []\n },\n admin: { get Field() { return MultiSelectFieldBinding; } }\n }\n },\n user_select: {\n key: \"user_select\",\n name: \"User select\",\n description: \"Select a user from the user management system. Store the user ID.\",\n Icon: UserIcon,\n property: {\n type: \"string\",\n admin: { get Field() { return UserSelectFieldBinding; } }\n }\n },\n number_input: {\n key: \"number_input\",\n name: \"Number input\",\n description: \"Simple number field with validation\",\n Icon: HashIcon,\n color: \"#bec920\",\n property: {\n type: \"number\",\n admin: { get Field() { return TextFieldBinding; } }\n }\n },\n number_select: {\n key: \"number_select\",\n name: \"Number select\",\n description: \"Select a number value from within an enumeration\",\n Icon: ListOrderedIcon,\n color: \"#bec920\",\n property: {\n type: \"number\",\n enum: [],\n admin: { get Field() { return SelectFieldBinding; } }\n }\n },\n multi_number_select: {\n key: \"multi_number_select\",\n name: \"Multiple number select\",\n description: \"Select multiple number values from within an enumeration\",\n Icon: ListOrderedIcon,\n color: \"#bec920\",\n property: {\n type: \"array\",\n of: {\n type: \"number\",\n enum: []\n },\n admin: { get Field() { return MultiSelectFieldBinding; } }\n }\n },\n file_upload: {\n key: \"file_upload\",\n name: \"File upload\",\n description: \"Input for uploading single files\",\n Icon: UploadIcon,\n color: \"#f92d9a\",\n property: {\n type: \"string\",\n storage: {\n storagePath: \"{path}\"\n },\n admin: { get Field() { return StorageUploadFieldBinding; } }\n }\n },\n multi_file_upload: {\n key: \"multi_file_upload\",\n name: \"Multiple file upload\",\n description: \"Input for uploading multiple files\",\n Icon: FolderUpIcon,\n color: \"#f92d9a\",\n property: {\n type: \"array\",\n of: {\n type: \"string\",\n storage: {\n storagePath: \"{path}\"\n }\n },\n admin: { get Field() { return StorageUploadFieldBinding; } }\n }\n },\n reference: {\n key: \"reference\",\n name: \"Reference\",\n description: \"The value refers to a different collection (it is saved as a reference)\",\n Icon: LinkIcon,\n color: \"#ff0042\",\n property: {\n type: \"reference\",\n admin: { get Field() { return ReferenceFieldBinding; } }\n }\n },\n multi_references: {\n key: \"multi_references\",\n name: \"Multiple references\",\n description: \"Multiple values that refer to a different collection\",\n Icon: LinkIcon,\n color: \"#ff0042\",\n property: {\n type: \"array\",\n of: {\n type: \"reference\"\n },\n admin: { get Field() { return ArrayOfReferencesFieldBinding; } }\n }\n },\n relation: {\n key: \"relation\",\n name: \"Relation\",\n description: \"Multiple values that refer to a different collection\",\n Icon: LinkIcon,\n color: \"#ff0042\",\n property: {\n // relationName now lives on the link\n // relationName: \"\",\n type: \"relation\",\n admin: { get Field() { return RelationFieldBinding; } }\n }\n },\n date_time: {\n key: \"date_time\",\n name: \"Date/time\",\n description: \"A date time select field\",\n Icon: CalendarIcon,\n color: \"#8b46ff\",\n property: {\n type: \"date\",\n admin: { get Field() { return DateTimeFieldBinding; } }\n }\n },\n group: {\n key: \"group\",\n name: \"Group\",\n description: \"Group of multiple fields\",\n Icon: VoteIcon,\n color: \"#ff9408\",\n property: {\n type: \"map\",\n properties: {},\n admin: { get Field() { return MapFieldBinding; } }\n }\n },\n key_value: {\n key: \"key_value\",\n name: \"Key-value\",\n description: \"Flexible field that allows the user to add multiple key-value pairs\",\n Icon: VoteIcon,\n color: \"#ff9408\",\n property: {\n type: \"map\",\n keyValue: true,\n admin: { get Field() { return KeyValueFieldBinding; } }\n }\n },\n repeat: {\n key: \"repeat\",\n name: \"Repeat/list\",\n description: \"A field that gets repeated multiple times (e.g. multiple text fields)\",\n Icon: RepeatIcon,\n color: \"#ff9408\",\n property: {\n type: \"array\",\n of: {\n type: \"string\"\n },\n admin: { get Field() { return RepeatFieldBinding; } }\n }\n },\n custom_array: {\n key: \"custom_array\",\n name: \"Custom array\",\n description: \"A field that saved its value as an array of custom objects\",\n Icon: RepeatIcon,\n color: \"#ff9408\",\n property: {\n type: \"array\",\n admin: { get Field() { return ArrayCustomShapedFieldBinding; } }\n }\n },\n block: {\n key: \"block\",\n name: \"Block\",\n description: \"A complex field that allows the user to compose different fields together, with a key/value format\",\n Icon: Rows3Icon,\n color: \"#ff9408\",\n property: {\n type: \"array\",\n oneOf: {\n properties: {}\n },\n admin: { get Field() { return BlockFieldBinding; } }\n }\n },\n vector_input: {\n key: \"vector_input\",\n name: \"Vector input\",\n description: \"Vector array for embeddings\",\n Icon: HashIcon,\n color: \"#bec920\",\n property: {\n type: \"vector\",\n dimensions: 1536,\n admin: { get Field() { return VectorFieldBinding; } }\n }\n },\n geopoint: {\n key: \"geopoint\",\n name: \"Location\",\n description: \"A latitude and longitude\",\n Icon: GlobeIcon,\n color: \"#3f9e5c\",\n property: {\n type: \"geopoint\",\n admin: { get Field() { return GeopointFieldBinding; } }\n }\n },\n binary: {\n key: \"binary\",\n name: \"Binary\",\n description: \"Base64-encoded bytes\",\n Icon: HashIcon,\n color: \"#7a6ff0\",\n property: {\n type: \"binary\",\n admin: { get Field() { return BinaryFieldBinding; } }\n }\n }\n};\n\nexport function getDefaultFieldConfig(property: Property): PropertyConfig | undefined {\n const fieldId = getDefaultFieldId(property);\n if (!fieldId) {\n console.error(\"No field id found for property\", property);\n return undefined;\n }\n return DEFAULT_FIELD_CONFIGS[fieldId];\n}\n\nexport function getFieldConfig(property: Property, propertyConfigs: Record<string, PropertyConfig>): PropertyConfig | undefined {\n const fieldId = getFieldId(property);\n const defaultFieldId = getDefaultFieldId(property);\n if (!defaultFieldId) {\n console.error(\"No field id found for property\", property);\n return undefined;\n }\n const defaultFieldConfig = defaultFieldId ? DEFAULT_FIELD_CONFIGS[defaultFieldId] : undefined;\n const customField = fieldId && propertyConfigs ? propertyConfigs[fieldId] : undefined;\n return mergeDeep(defaultFieldConfig ?? {}, customField ?? {} as PropertyConfig);\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,IAAa,wBAAoE;CAC7E,YAAY;EACR,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO,EAAE,IAAI,QAAQ;IAAE,OAAO;GAAkB,EAAE;EACtD;CACJ;CACA,WAAW;EACP,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO;IAAE,WAAW;IAChC,IAAI,QAAQ;KAAE,OAAO;IAAkB;GAAE;EACjC;CACJ;CACA,UAAU;EACN,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP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CACJ;CACA,UAAU;EACN,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO,EAAE,IAAI,QAAQ;IAAE,OAAO;GAAsB,EAAE;EAC1D;CACJ;CACA,QAAQ;EACJ,KAAK;EACL,MAAM;EACN,aAAa;EACb,MAAM;EACN,OAAO;EACP,UAAU;GACN,MAAM;GACN,OAAO,EAAE,IAAI,QAAQ;IAAE,OAAO;GAAoB,EAAE;EACxD;CACJ;AACJ;AAEA,SAAgB,sBAAsB,UAAgD;CAClF,MAAM,UAAU,kBAAkB,QAAQ;CAC1C,IAAI,CAAC,SAAS;EACV,QAAQ,MAAM,kCAAkC,QAAQ;EACxD;CACJ;CACA,OAAO,sBAAsB;AACjC;AAEA,SAAgB,eAAe,UAAoB,iBAA6E;CAC5H,MAAM,UAAU,WAAW,QAAQ;CACnC,MAAM,iBAAiB,kBAAkB,QAAQ;CACjD,IAAI,CAAC,gBAAgB;EACjB,QAAQ,MAAM,kCAAkC,QAAQ;EACxD;CACJ;CACA,MAAM,qBAAqB,iBAAiB,sBAAsB,kBAAkB,KAAA;CACpF,MAAM,cAAc,WAAW,kBAAkB,gBAAgB,WAAW,KAAA;CAC5E,OAAO,UAAU,sBAAsB,CAAC,GAAG,eAAe,CAAC,CAAmB;AAClF"}
@@ -1,4 +1,4 @@
1
- import type { Property } from "@rebasepro/types";
1
+ import type { Property } from "@rebasepro/cms-types";
2
2
  /**
3
3
  * The id of the widget a property is edited with, decided from the property
4
4
  * alone. Kept apart from `field_configs.tsx`, which maps those ids to the
@@ -1,4 +1,4 @@
1
- import { isPropertyBuilder } from "@rebasepro/common";
1
+ import { isPropertyBuilder } from "@rebasepro/cms-types";
2
2
  //#region src/components/field_ids.ts
3
3
  /**
4
4
  * The id of the widget a property is edited with, decided from the property
@@ -1 +1 @@
1
- {"version":3,"file":"field_ids.js","names":[],"sources":["../../src/components/field_ids.ts"],"sourcesContent":["import type { ArrayProperty, NumberProperty, Property, StringProperty } from \"@rebasepro/types\";\nimport { isPropertyBuilder } from \"@rebasepro/common\";\n\n/**\n * The id of the widget a property is edited with, decided from the property\n * alone. Kept apart from `field_configs.tsx`, which maps those ids to the\n * field binding components: importing that module imports every binding, and\n * with them the entity form, so a caller that only needs the id — the AI\n * plugin asks it for every property on every page — paid for the whole form\n * on the login screen.\n */\nexport function getDefaultFieldId(property: Property) {\n if (property.type === \"string\") {\n if (property.admin?.markdown) {\n return \"markdown\";\n } else if (property.admin?.multiline) {\n return \"multiline\";\n } else if (property.storage) {\n return \"file_upload\";\n } else if (property.admin?.urlPreview) {\n return \"url\";\n } else if (property.email) {\n return \"email\";\n } else if (property.enum) {\n return \"select\";\n } else if (property.userSelect) {\n return \"user_select\";\n } else {\n return \"text_field\";\n }\n } else if (property.type === \"number\") {\n if (property.enum) {\n return \"number_select\";\n }\n return \"number_input\";\n } else if (property.type === \"map\") {\n if (property.keyValue)\n return \"key_value\";\n return \"group\";\n } else if (property.type === \"array\") {\n const of = (property as ArrayProperty).of;\n const oneOf = (property as ArrayProperty).oneOf;\n if (oneOf) {\n return \"block\";\n } else if (Array.isArray(of)) {\n return \"custom_array\";\n } else if (isPropertyBuilder(of)) {\n return \"repeat\";\n } else if (of) {\n const ofProperty = of as Property;\n if (ofProperty.type === \"string\" && (ofProperty as StringProperty).enum) {\n return \"multi_select\";\n } else if (ofProperty.type === \"number\" && (ofProperty as NumberProperty).enum) {\n return \"multi_number_select\";\n } else if (ofProperty.type === \"string\" && (ofProperty as StringProperty).storage) {\n return \"multi_file_upload\";\n } else if (ofProperty.type === \"reference\") {\n return \"multi_references\";\n } else if (of?.type === \"relation\") {\n // Genuinely unsupported — a relation is a join, not a value, so\n // there is nothing sensible to put in an array cell. But this\n // used to `throw`, and it is called during render: an array of\n // relations took down the whole property dialog with an error\n // boundary instead of showing which property was at fault.\n // Returning undefined routes it to the \"no editor\" notice.\n console.error(\n \"A `relation` cannot go inside an array — a relation is a join, not a stored value. \" +\n \"Use a `reference` for an array of links, or declare a to-many relation on the collection.\",\n property\n );\n return undefined;\n } else {\n return \"repeat\";\n }\n } else {\n return \"repeat\";\n }\n } else if (property.type === \"boolean\") {\n return \"switch\";\n } else if (property.type === \"date\") {\n return \"date_time\";\n } else if (property.type === \"relation\") {\n return \"relation\";\n } else if (property.type === \"reference\") {\n return \"reference\";\n } else if (property.type === \"vector\") {\n return \"vector_input\";\n } else if (property.type === \"binary\") {\n // Was \"text_field\": a binary column rendered as a string input, and the\n // string widget's editor merges `type: \"string\"`, so touching the widget\n // silently changed the property's type.\n return \"binary\";\n } else if (property.type === \"geopoint\") {\n // Was missing entirely — this fell through to the console.error below,\n // returned undefined, and the field never rendered at all.\n return \"geopoint\";\n }\n\n console.error(\"Unsupported field config mapping\", property);\n return undefined;\n}\n\nexport function getFieldId(property: Property): string | undefined {\n if (property.propertyConfig)\n return property.propertyConfig;\n return getDefaultFieldId(property);\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,kBAAkB,UAAoB;CAClD,IAAI,SAAS,SAAS,UAClB,IAAI,SAAS,OAAO,UAChB,OAAO;MACJ,IAAI,SAAS,OAAO,WACvB,OAAO;MACJ,IAAI,SAAS,SAChB,OAAO;MACJ,IAAI,SAAS,OAAO,YACvB,OAAO;MACJ,IAAI,SAAS,OAChB,OAAO;MACJ,IAAI,SAAS,MAChB,OAAO;MACJ,IAAI,SAAS,YAChB,OAAO;MAEP,OAAO;MAER,IAAI,SAAS,SAAS,UAAU;EACnC,IAAI,SAAS,MACT,OAAO;EAEX,OAAO;CACX,OAAO,IAAI,SAAS,SAAS,OAAO;EAChC,IAAI,SAAS,UACT,OAAO;EACX,OAAO;CACX,OAAO,IAAI,SAAS,SAAS,SAAS;EAClC,MAAM,KAAM,SAA2B;EAEvC,IADe,SAA2B,OAEtC,OAAO;OACJ,IAAI,MAAM,QAAQ,EAAE,GACvB,OAAO;OACJ,IAAI,kBAAkB,EAAE,GAC3B,OAAO;OACJ,IAAI,IAAI;GACX,MAAM,aAAa;GACnB,IAAI,WAAW,SAAS,YAAa,WAA8B,MAC/D,OAAO;QACJ,IAAI,WAAW,SAAS,YAAa,WAA8B,MACtE,OAAO;QACJ,IAAI,WAAW,SAAS,YAAa,WAA8B,SACtE,OAAO;QACJ,IAAI,WAAW,SAAS,aAC3B,OAAO;QACJ,IAAI,IAAI,SAAS,YAAY;IAOhC,QAAQ,MACJ,gLAEA,QACJ;IACA;GACJ,OACI,OAAO;EAEf,OACI,OAAO;CAEf,OAAO,IAAI,SAAS,SAAS,WACzB,OAAO;MACJ,IAAI,SAAS,SAAS,QACzB,OAAO;MACJ,IAAI,SAAS,SAAS,YACzB,OAAO;MACJ,IAAI,SAAS,SAAS,aACzB,OAAO;MACJ,IAAI,SAAS,SAAS,UACzB,OAAO;MACJ,IAAI,SAAS,SAAS,UAIzB,OAAO;MACJ,IAAI,SAAS,SAAS,YAGzB,OAAO;CAGX,QAAQ,MAAM,oCAAoC,QAAQ;AAE9D;AAEA,SAAgB,WAAW,UAAwC;CAC/D,IAAI,SAAS,gBACT,OAAO,SAAS;CACpB,OAAO,kBAAkB,QAAQ;AACrC"}
1
+ {"version":3,"file":"field_ids.js","names":[],"sources":["../../src/components/field_ids.ts"],"sourcesContent":["import type { ArrayProperty, NumberProperty, Property, StringProperty } from \"@rebasepro/cms-types\";\nimport { isPropertyBuilder } from \"@rebasepro/cms-types\";\n\n/**\n * The id of the widget a property is edited with, decided from the property\n * alone. Kept apart from `field_configs.tsx`, which maps those ids to the\n * field binding components: importing that module imports every binding, and\n * with them the entity form, so a caller that only needs the id — the AI\n * plugin asks it for every property on every page — paid for the whole form\n * on the login screen.\n */\nexport function getDefaultFieldId(property: Property) {\n if (property.type === \"string\") {\n if (property.admin?.markdown) {\n return \"markdown\";\n } else if (property.admin?.multiline) {\n return \"multiline\";\n } else if (property.storage) {\n return \"file_upload\";\n } else if (property.admin?.urlPreview) {\n return \"url\";\n } else if (property.email) {\n return \"email\";\n } else if (property.enum) {\n return \"select\";\n } else if (property.userSelect) {\n return \"user_select\";\n } else {\n return \"text_field\";\n }\n } else if (property.type === \"number\") {\n if (property.enum) {\n return \"number_select\";\n }\n return \"number_input\";\n } else if (property.type === \"map\") {\n if (property.keyValue)\n return \"key_value\";\n return \"group\";\n } else if (property.type === \"array\") {\n const of = (property as ArrayProperty).of;\n const oneOf = (property as ArrayProperty).oneOf;\n if (oneOf) {\n return \"block\";\n } else if (Array.isArray(of)) {\n return \"custom_array\";\n } else if (isPropertyBuilder(of)) {\n return \"repeat\";\n } else if (of) {\n const ofProperty = of as Property;\n if (ofProperty.type === \"string\" && (ofProperty as StringProperty).enum) {\n return \"multi_select\";\n } else if (ofProperty.type === \"number\" && (ofProperty as NumberProperty).enum) {\n return \"multi_number_select\";\n } else if (ofProperty.type === \"string\" && (ofProperty as StringProperty).storage) {\n return \"multi_file_upload\";\n } else if (ofProperty.type === \"reference\") {\n return \"multi_references\";\n } else if (of?.type === \"relation\") {\n // Genuinely unsupported — a relation is a join, not a value, so\n // there is nothing sensible to put in an array cell. But this\n // used to `throw`, and it is called during render: an array of\n // relations took down the whole property dialog with an error\n // boundary instead of showing which property was at fault.\n // Returning undefined routes it to the \"no editor\" notice.\n console.error(\n \"A `relation` cannot go inside an array — a relation is a join, not a stored value. \" +\n \"Use a `reference` for an array of links, or declare a to-many relation on the collection.\",\n property\n );\n return undefined;\n } else {\n return \"repeat\";\n }\n } else {\n return \"repeat\";\n }\n } else if (property.type === \"boolean\") {\n return \"switch\";\n } else if (property.type === \"date\") {\n return \"date_time\";\n } else if (property.type === \"relation\") {\n return \"relation\";\n } else if (property.type === \"reference\") {\n return \"reference\";\n } else if (property.type === \"vector\") {\n return \"vector_input\";\n } else if (property.type === \"binary\") {\n // Was \"text_field\": a binary column rendered as a string input, and the\n // string widget's editor merges `type: \"string\"`, so touching the widget\n // silently changed the property's type.\n return \"binary\";\n } else if (property.type === \"geopoint\") {\n // Was missing entirely — this fell through to the console.error below,\n // returned undefined, and the field never rendered at all.\n return \"geopoint\";\n }\n\n console.error(\"Unsupported field config mapping\", property);\n return undefined;\n}\n\nexport function getFieldId(property: Property): string | undefined {\n if (property.propertyConfig)\n return property.propertyConfig;\n return getDefaultFieldId(property);\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,kBAAkB,UAAoB;CAClD,IAAI,SAAS,SAAS,UAClB,IAAI,SAAS,OAAO,UAChB,OAAO;MACJ,IAAI,SAAS,OAAO,WACvB,OAAO;MACJ,IAAI,SAAS,SAChB,OAAO;MACJ,IAAI,SAAS,OAAO,YACvB,OAAO;MACJ,IAAI,SAAS,OAChB,OAAO;MACJ,IAAI,SAAS,MAChB,OAAO;MACJ,IAAI,SAAS,YAChB,OAAO;MAEP,OAAO;MAER,IAAI,SAAS,SAAS,UAAU;EACnC,IAAI,SAAS,MACT,OAAO;EAEX,OAAO;CACX,OAAO,IAAI,SAAS,SAAS,OAAO;EAChC,IAAI,SAAS,UACT,OAAO;EACX,OAAO;CACX,OAAO,IAAI,SAAS,SAAS,SAAS;EAClC,MAAM,KAAM,SAA2B;EAEvC,IADe,SAA2B,OAEtC,OAAO;OACJ,IAAI,MAAM,QAAQ,EAAE,GACvB,OAAO;OACJ,IAAI,kBAAkB,EAAE,GAC3B,OAAO;OACJ,IAAI,IAAI;GACX,MAAM,aAAa;GACnB,IAAI,WAAW,SAAS,YAAa,WAA8B,MAC/D,OAAO;QACJ,IAAI,WAAW,SAAS,YAAa,WAA8B,MACtE,OAAO;QACJ,IAAI,WAAW,SAAS,YAAa,WAA8B,SACtE,OAAO;QACJ,IAAI,WAAW,SAAS,aAC3B,OAAO;QACJ,IAAI,IAAI,SAAS,YAAY;IAOhC,QAAQ,MACJ,gLAEA,QACJ;IACA;GACJ,OACI,OAAO;EAEf,OACI,OAAO;CAEf,OAAO,IAAI,SAAS,SAAS,WACzB,OAAO;MACJ,IAAI,SAAS,SAAS,QACzB,OAAO;MACJ,IAAI,SAAS,SAAS,YACzB,OAAO;MACJ,IAAI,SAAS,SAAS,aACzB,OAAO;MACJ,IAAI,SAAS,SAAS,UACzB,OAAO;MACJ,IAAI,SAAS,SAAS,UAIzB,OAAO;MACJ,IAAI,SAAS,SAAS,YAGzB,OAAO;CAGX,QAAQ,MAAM,oCAAoC,QAAQ;AAE9D;AAEA,SAAgB,WAAW,UAAwC;CAC/D,IAAI,SAAS,gBACT,OAAO,SAAS;CACpB,OAAO,kBAAkB,QAAQ;AACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityHistoryEntry.js","names":[],"sources":["../../../src/components/history/EntityHistoryEntry.tsx"],"sourcesContent":["\nimport type { Property } from \"@rebasepro/types\";\nimport * as React from \"react\";\n\nimport { ArrowLeftIcon, Chip, cls, defaultBorderMixin, iconSize, Tooltip, Typography } from \"@rebasepro/ui\";\nimport { PreviewSize } from \"../../types/components/PropertyPreviewProps\";\nimport { getPropertyInPath } from \"../../util/property_utils\";\nimport { PropertyPreview } from \"../../preview/PropertyPreview\";\nimport { SkeletonPropertyComponent } from \"../../preview/property_previews/SkeletonPropertyComponent\";\nimport { useAuthController } from \"@rebasepro/app\";\nimport { UserChip } from \"./UserChip\";\nimport { HistoryEntryData } from \"../../hooks\";\nimport { getValueInPath } from \"@rebasepro/utils\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\n/**\n * Recursive deep equality for primitives, arrays and plain objects.\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a == null || b == null) return a === b;\n if (typeof a !== typeof b) return false;\n if (typeof a !== \"object\") return false;\n\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== (b as unknown[]).length) return false;\n return a.every((item, i) => deepEqual(item, (b as unknown[])[i]));\n }\n\n if (Array.isArray(b)) return false;\n\n const aObj = a as Record<string, unknown>;\n const bObj = b as Record<string, unknown>;\n const aKeys = Object.keys(aObj);\n const bKeys = Object.keys(bObj);\n if (aKeys.length !== bKeys.length) return false;\n return aKeys.every(key => key in bObj && deepEqual(aObj[key], bObj[key]));\n}\n\nexport type EntityHistoryEntryProps = {\n size: PreviewSize;\n actions?: React.ReactNode;\n collection?: AdminCollection;\n hover?: boolean;\n entry: HistoryEntryData;\n onClick?: (e: React.SyntheticEvent) => void;\n};\n\nfunction PreviousValueView({\n previousValueInPath,\n childProperty,\n propertyKey\n}: {\n previousValueInPath: unknown;\n childProperty: Property;\n propertyKey: string;\n}) {\n if (typeof previousValueInPath === \"string\" || typeof previousValueInPath === \"number\") {\n return <Typography variant={\"caption\"} color={\"secondary\"} className=\"line-through\">\n {previousValueInPath}\n </Typography>;\n } else if (typeof previousValueInPath === \"boolean\") {\n return <Typography variant={\"caption\"} color={\"secondary\"} className=\"line-through\">\n {previousValueInPath ? \"true\" : \"false\"}\n </Typography>;\n } else {\n return <Tooltip\n side={\"left\"}\n title={<div className={\"flex flex-col gap-2\"}>\n <Typography variant={\"caption\"} color={\"secondary\"}>\n Previous value\n </Typography>\n <PropertyPreview\n propertyKey={propertyKey as string}\n value={previousValueInPath}\n property={childProperty as Property}\n size={\"small\"}/>\n </div>}>\n <ArrowLeftIcon size={iconSize.smallest} color={\"disabled\"} className={\"mb-1\"}/>\n </Tooltip>\n }\n}\n\n/**\n * Displays a single entity history revision entry.\n * Adapted from the entity_history plugin — now reads from backend API data.\n */\nexport function EntityHistoryEntry({\n actions,\n hover,\n collection,\n size,\n entry\n}: EntityHistoryEntryProps) {\n\n const authController = useAuthController();\n\n // The backend reports the whole row as changed, which includes the columns\n // that cannot meaningfully change: a timestamp it stamps itself on every\n // write, and the primary key, which is what identifies the row being\n // revised. Every revision was listing `updated_at: <now>` and `id: <the id\n // in the title bar>` around the one field the user actually edited.\n const changedFields = React.useMemo(() => {\n const all = entry.changed_fields;\n if (!all || !collection) return all;\n return all.filter(key => {\n const property = getPropertyInPath(collection.properties, key);\n if (!property) return true;\n if (\"isId\" in property && property.isId) return false;\n return !(property.type === \"date\" && \"autoValue\" in property && property.autoValue);\n });\n }, [entry.changed_fields, collection]);\n\n const previousValues = entry.previous_values;\n const updatedOn = new Date(entry.updated_at);\n const updatedBy = entry.updated_by;\n\n // Resolve user display\n const currentUser = authController.user;\n const userDisplay = updatedBy === currentUser?.uid\n ? currentUser\n : undefined;\n\n return <div className={\"@container/histentry w-full flex flex-col gap-2\"}>\n <div className={\"flex items-center flex-wrap gap-2\"}>\n <Typography variant={\"body2\"} color={\"secondary\"}>\n {updatedOn.toLocaleString()}\n </Typography>\n <Chip size={\"small\"}>\n {entry.action}\n </Chip>\n {!userDisplay && updatedBy && <Chip size={\"small\"}>{updatedBy}</Chip>}\n {userDisplay && <UserChip user={userDisplay}/>}\n </div>\n <div\n className={cls(\n \"bg-surface-card\",\n \"min-h-[44px]\",\n \"w-full\",\n \"items-center\",\n hover ? \"hover:bg-surface-hover\" : \"\",\n size === \"small\" ? \"p-1\" : \"px-2 py-1\",\n \"flex border rounded-lg\",\n defaultBorderMixin\n )}>\n\n {actions}\n\n <div className={\"flex flex-col grow w-full m-1 shrink min-w-0\"}>\n\n {changedFields && collection && changedFields.map((key: string) => {\n const childProperty = getPropertyInPath(collection.properties, key);\n const valueInPath = entry.values ? getValueInPath(entry.values, key) : undefined;\n const previousValueInPath = previousValues ? getValueInPath(previousValues, key) : undefined;\n\n const element = childProperty\n ? <PropertyPreview\n propertyKey={key}\n value={valueInPath}\n property={childProperty as Property}\n size={\"small\"}/>\n : <Typography variant={\"body2\"}>\n {typeof valueInPath === \"string\" ? valueInPath : JSON.stringify(valueInPath)}\n </Typography>;\n\n // The key column used to be `min-w-[200px] w-1/5` beside a\n // `w-4/5` value — 200px of label and 80% of the row, which\n // adds up to more than the row in anything narrower than a\n // full page. In the inspector that pushed every value off\n // the right edge and wrapped ids one character per line.\n // It stacks until the entry itself is wide enough.\n return (\n <div key={\"ref_prev_\" + key}\n className=\"flex flex-col @sm/histentry:flex-row @sm/histentry:items-baseline gap-x-4 gap-y-0.5 w-full my-1.5\">\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className=\"shrink-0 break-all @sm/histentry:w-40 @sm/histentry:text-right @sm/histentry:break-normal @sm/histentry:truncate\">\n {key}\n </Typography>\n <div className=\"min-w-0 flex-1 flex flex-col items-start gap-0.5\">\n {previousValueInPath !== undefined && !deepEqual(previousValueInPath, valueInPath) &&\n <PreviousValueView previousValueInPath={previousValueInPath}\n childProperty={childProperty as Property}\n propertyKey={key}/>\n }\n {element}\n </div>\n </div>\n );\n })}\n\n {(!changedFields || changedFields.length === 0) && (\n <Typography variant={\"caption\"} color={\"secondary\"}>\n {entry.action === \"create\" ? \"Entity created\" :\n entry.action === \"delete\" ? \"Entity deleted\" : \"No field changes recorded\"}\n </Typography>\n )}\n\n </div>\n\n </div>\n </div>;\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAS,UAAU,GAAY,GAAqB;CAChD,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,KAAK,QAAQ,KAAK,MAAM,OAAO,MAAM;CACzC,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAClC,IAAI,OAAO,MAAM,UAAU,OAAO;CAElC,IAAI,MAAM,QAAQ,CAAC,GAAG;EAClB,IAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAY,EAAgB,QAAQ,OAAO;EACtE,OAAO,EAAE,OAAO,MAAM,MAAM,UAAU,MAAO,EAAgB,EAAE,CAAC;CACpE;CAEA,IAAI,MAAM,QAAQ,CAAC,GAAG,OAAO;CAE7B,MAAM,OAAO;CACb,MAAM,OAAO;CACb,MAAM,QAAQ,OAAO,KAAK,IAAI;CAC9B,MAAM,QAAQ,OAAO,KAAK,IAAI;CAC9B,IAAI,MAAM,WAAW,MAAM,QAAQ,OAAO;CAC1C,OAAO,MAAM,OAAM,QAAO,OAAO,QAAQ,UAAU,KAAK,MAAM,KAAK,IAAI,CAAC;AAC5E;AAWA,SAAS,kBAAkB,EACvB,qBACA,eACA,eAKD;CACC,IAAI,OAAO,wBAAwB,YAAY,OAAO,wBAAwB,UAC1E,OAAO,oBAAC,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,CAGf;KAEJ;IACJ;;AACT"}
1
+ {"version":3,"file":"EntityHistoryEntry.js","names":[],"sources":["../../../src/components/history/EntityHistoryEntry.tsx"],"sourcesContent":["\nimport * as React from \"react\";\n\nimport { ArrowLeftIcon, Chip, cls, defaultBorderMixin, iconSize, Tooltip, Typography } from \"@rebasepro/ui\";\nimport { PreviewSize } from \"../../types/components/PropertyPreviewProps\";\nimport { getPropertyInPath } from \"../../util/property_utils\";\nimport { PropertyPreview } from \"../../preview/PropertyPreview\";\nimport { SkeletonPropertyComponent } from \"../../preview/property_previews/SkeletonPropertyComponent\";\nimport { useAuthController } from \"@rebasepro/app\";\nimport { UserChip } from \"./UserChip\";\nimport { HistoryEntryData } from \"../../hooks\";\nimport { getValueInPath } from \"@rebasepro/utils\";\nimport type { AdminCollection, Property } from \"@rebasepro/cms-types\";\n\n/**\n * Recursive deep equality for primitives, arrays and plain objects.\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (a == null || b == null) return a === b;\n if (typeof a !== typeof b) return false;\n if (typeof a !== \"object\") return false;\n\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== (b as unknown[]).length) return false;\n return a.every((item, i) => deepEqual(item, (b as unknown[])[i]));\n }\n\n if (Array.isArray(b)) return false;\n\n const aObj = a as Record<string, unknown>;\n const bObj = b as Record<string, unknown>;\n const aKeys = Object.keys(aObj);\n const bKeys = Object.keys(bObj);\n if (aKeys.length !== bKeys.length) return false;\n return aKeys.every(key => key in bObj && deepEqual(aObj[key], bObj[key]));\n}\n\nexport type EntityHistoryEntryProps = {\n size: PreviewSize;\n actions?: React.ReactNode;\n collection?: AdminCollection;\n hover?: boolean;\n entry: HistoryEntryData;\n onClick?: (e: React.SyntheticEvent) => void;\n};\n\nfunction PreviousValueView({\n previousValueInPath,\n childProperty,\n propertyKey\n}: {\n previousValueInPath: unknown;\n childProperty: Property;\n propertyKey: string;\n}) {\n if (typeof previousValueInPath === \"string\" || typeof previousValueInPath === \"number\") {\n return <Typography variant={\"caption\"} color={\"secondary\"} className=\"line-through\">\n {previousValueInPath}\n </Typography>;\n } else if (typeof previousValueInPath === \"boolean\") {\n return <Typography variant={\"caption\"} color={\"secondary\"} className=\"line-through\">\n {previousValueInPath ? \"true\" : \"false\"}\n </Typography>;\n } else {\n return <Tooltip\n side={\"left\"}\n title={<div className={\"flex flex-col gap-2\"}>\n <Typography variant={\"caption\"} color={\"secondary\"}>\n Previous value\n </Typography>\n <PropertyPreview\n propertyKey={propertyKey as string}\n value={previousValueInPath}\n property={childProperty as Property}\n size={\"small\"}/>\n </div>}>\n <ArrowLeftIcon size={iconSize.smallest} color={\"disabled\"} className={\"mb-1\"}/>\n </Tooltip>\n }\n}\n\n/**\n * Displays a single entity history revision entry.\n * Adapted from the entity_history plugin — now reads from backend API data.\n */\nexport function EntityHistoryEntry({\n actions,\n hover,\n collection,\n size,\n entry\n}: EntityHistoryEntryProps) {\n\n const authController = useAuthController();\n\n // The backend reports the whole row as changed, which includes the columns\n // that cannot meaningfully change: a timestamp it stamps itself on every\n // write, and the primary key, which is what identifies the row being\n // revised. Every revision was listing `updated_at: <now>` and `id: <the id\n // in the title bar>` around the one field the user actually edited.\n const changedFields = React.useMemo(() => {\n const all = entry.changed_fields;\n if (!all || !collection) return all;\n return all.filter(key => {\n const property = getPropertyInPath(collection.properties, key);\n if (!property) return true;\n if (\"isId\" in property && property.isId) return false;\n return !(property.type === \"date\" && \"autoValue\" in property && property.autoValue);\n });\n }, [entry.changed_fields, collection]);\n\n const previousValues = entry.previous_values;\n const updatedOn = new Date(entry.updated_at);\n const updatedBy = entry.updated_by;\n\n // Resolve user display\n const currentUser = authController.user;\n const userDisplay = updatedBy === currentUser?.uid\n ? currentUser\n : undefined;\n\n return <div className={\"@container/histentry w-full flex flex-col gap-2\"}>\n <div className={\"flex items-center flex-wrap gap-2\"}>\n <Typography variant={\"body2\"} color={\"secondary\"}>\n {updatedOn.toLocaleString()}\n </Typography>\n <Chip size={\"small\"}>\n {entry.action}\n </Chip>\n {!userDisplay && updatedBy && <Chip size={\"small\"}>{updatedBy}</Chip>}\n {userDisplay && <UserChip user={userDisplay}/>}\n </div>\n <div\n className={cls(\n \"bg-surface-card\",\n \"min-h-[44px]\",\n \"w-full\",\n \"items-center\",\n hover ? \"hover:bg-surface-hover\" : \"\",\n size === \"small\" ? \"p-1\" : \"px-2 py-1\",\n \"flex border rounded-lg\",\n defaultBorderMixin\n )}>\n\n {actions}\n\n <div className={\"flex flex-col grow w-full m-1 shrink min-w-0\"}>\n\n {changedFields && collection && changedFields.map((key: string) => {\n const childProperty = getPropertyInPath(collection.properties, key);\n const valueInPath = entry.values ? getValueInPath(entry.values, key) : undefined;\n const previousValueInPath = previousValues ? getValueInPath(previousValues, key) : undefined;\n\n const element = childProperty\n ? <PropertyPreview\n propertyKey={key}\n value={valueInPath}\n property={childProperty as Property}\n size={\"small\"}/>\n : <Typography variant={\"body2\"}>\n {typeof valueInPath === \"string\" ? valueInPath : JSON.stringify(valueInPath)}\n </Typography>;\n\n // The key column used to be `min-w-[200px] w-1/5` beside a\n // `w-4/5` value — 200px of label and 80% of the row, which\n // adds up to more than the row in anything narrower than a\n // full page. In the inspector that pushed every value off\n // the right edge and wrapped ids one character per line.\n // It stacks until the entry itself is wide enough.\n return (\n <div key={\"ref_prev_\" + key}\n className=\"flex flex-col @sm/histentry:flex-row @sm/histentry:items-baseline gap-x-4 gap-y-0.5 w-full my-1.5\">\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className=\"shrink-0 break-all @sm/histentry:w-40 @sm/histentry:text-right @sm/histentry:break-normal @sm/histentry:truncate\">\n {key}\n </Typography>\n <div className=\"min-w-0 flex-1 flex flex-col items-start gap-0.5\">\n {previousValueInPath !== undefined && !deepEqual(previousValueInPath, valueInPath) &&\n <PreviousValueView previousValueInPath={previousValueInPath}\n childProperty={childProperty as Property}\n propertyKey={key}/>\n }\n {element}\n </div>\n </div>\n );\n })}\n\n {(!changedFields || changedFields.length === 0) && (\n <Typography variant={\"caption\"} color={\"secondary\"}>\n {entry.action === \"create\" ? \"Entity created\" :\n entry.action === \"delete\" ? \"Entity deleted\" : \"No field changes recorded\"}\n </Typography>\n )}\n\n </div>\n\n </div>\n </div>;\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,SAAS,UAAU,GAAY,GAAqB;CAChD,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,KAAK,QAAQ,KAAK,MAAM,OAAO,MAAM;CACzC,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAClC,IAAI,OAAO,MAAM,UAAU,OAAO;CAElC,IAAI,MAAM,QAAQ,CAAC,GAAG;EAClB,IAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAY,EAAgB,QAAQ,OAAO;EACtE,OAAO,EAAE,OAAO,MAAM,MAAM,UAAU,MAAO,EAAgB,EAAE,CAAC;CACpE;CAEA,IAAI,MAAM,QAAQ,CAAC,GAAG,OAAO;CAE7B,MAAM,OAAO;CACb,MAAM,OAAO;CACb,MAAM,QAAQ,OAAO,KAAK,IAAI;CAC9B,MAAM,QAAQ,OAAO,KAAK,IAAI;CAC9B,IAAI,MAAM,WAAW,MAAM,QAAQ,OAAO;CAC1C,OAAO,MAAM,OAAM,QAAO,OAAO,QAAQ,UAAU,KAAK,MAAM,KAAK,IAAI,CAAC;AAC5E;AAWA,SAAS,kBAAkB,EACvB,qBACA,eACA,eAKD;CACC,IAAI,OAAO,wBAAwB,YAAY,OAAO,wBAAwB,UAC1E,OAAO,oBAAC,YAAD;EAAY,SAAS;EAAW,OAAO;EAAa,WAAU;YAChE;CACO,CAAA;MACT,IAAI,OAAO,wBAAwB,WACtC,OAAO,oBAAC,YAAD;EAAY,SAAS;EAAW,OAAO;EAAa,WAAU;YAChE,sBAAsB,SAAS;CACxB,CAAA;MAEZ,OAAO,oBAAC,SAAD;EACH,MAAM;EACN,OAAO,qBAAC,OAAD;GAAK,WAAW;aAAhB,CACH,oBAAC,YAAD;IAAY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AAS,UAAU,QAAQ,aAC3B,0BACA,kBACJ;aAVJ,CAYK,SAED,qBAAC,OAAD;IAAK,WAAW;cAAhB,CAEK,iBAAiB,cAAc,cAAc,KAAK,QAAgB;KAC/D,MAAM,gBAAgB,oBAAkB,WAAW,YAAY,GAAG;KAClE,MAAM,cAAc,MAAM,SAAS,eAAe,MAAM,QAAQ,GAAG,IAAI,KAAA;KACvE,MAAM,sBAAsB,iBAAiB,eAAe,gBAAgB,GAAG,IAAI,KAAA;KAEnF,MAAM,UAAU,gBACV,oBAAC,iBAAD;MACE,aAAa;MACb,OAAO;MACP,UAAU;MACV,MAAM;KAAS,CAAA,IACjB,oBAAC,YAAD;MAAY,SAAS;gBAClB,OAAO,gBAAgB,WAAW,cAAc,KAAK,UAAU,WAAW;KACnE,CAAA;KAQhB,OACI,qBAAC,OAAD;MACI,WAAU;gBADd,CAEI,oBAAC,YAAD;OAAY,SAAS;OACjB,OAAO;OACP,WAAU;iBACT;MACO,CAAA,GACZ,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACK,wBAAwB,KAAA,KAAa,CAAC,UAAU,qBAAqB,WAAW,KAC7E,oBAAC,mBAAD;QAAwC;QACrB;QACf,aAAa;OAAK,CAAA,GAEzB,OACA;QACJ;QAfK,cAAc,GAenB;IAEb,CAAC,IAEC,CAAC,iBAAiB,cAAc,WAAW,MACzC,oBAAC,YAAD;KAAY,SAAS;KAAW,OAAO;eAClC,MAAM,WAAW,WAAW,mBACzB,MAAM,WAAW,WAAW,mBAAmB;IAC3C,CAAA,CAGf;KAEJ;IACJ;;AACT"}
@@ -1,5 +1,4 @@
1
- import type { EntityCustomViewParams } from "@rebasepro/cms-types";
2
- import type { Entity } from "@rebasepro/types";
1
+ import type { EntityCustomViewParams, Entity } from "@rebasepro/cms-types";
3
2
  /**
4
3
  * Entity history tab view. Shows a paginated list of entity revisions
5
4
  * fetched from the backend API. Supports infinite scroll and revert.
@@ -1,9 +1,9 @@
1
+ import { hasEntityId } from "../../util/identity.js";
1
2
  import { useHistory } from "../../hooks/useHistory.js";
2
3
  import { EntityHistoryEntry } from "./EntityHistoryEntry.js";
3
4
  import { useEffect, useRef, useState } from "react";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
6
  import { ErrorBoundary, HistoryIcon, IconButton, Label, Tooltip, Typography, cls } from "@rebasepro/ui";
6
- import { hasEntityId } from "@rebasepro/common";
7
7
  import { ConfirmationDialog, usePermissions, useSnackbarController, useTranslation } from "@rebasepro/app";
8
8
  //#region src/components/history/EntityHistoryView.tsx
9
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"EntityHistoryView.js","names":[],"sources":["../../../src/components/history/EntityHistoryView.tsx"],"sourcesContent":["\nimport type { EntityCustomViewParams } from \"@rebasepro/cms-types\";\nimport type { Entity } from \"@rebasepro/types\";\nimport { hasEntityId } from \"@rebasepro/common\";\nimport { useRef, useEffect } from \"react\";\nimport { cls, IconButton, Label, Tooltip, Typography } from \"@rebasepro/ui\";\nimport { ErrorBoundary, HistoryIcon } from \"@rebasepro/ui\";\nimport { EntityHistoryEntry } from \"./EntityHistoryEntry\";\nimport { usePermissions, useSnackbarController, useTranslation } from \"@rebasepro/app\";\nimport { ConfirmationDialog } from \"@rebasepro/app\";\nimport { useState } from \"react\";\nimport { useHistory } from \"../../hooks/useHistory\";\n\n/**\n * Entity history tab view. Shows a paginated list of entity revisions\n * fetched from the backend API. Supports infinite scroll and revert.\n */\nexport function EntityHistoryView<M extends Record<string, unknown>>({\n entity,\n collection,\n formContext,\n refreshToken\n}: Omit<EntityCustomViewParams<M>, \"row\"> & {\n /** The record whose revisions are listed: the inspector's, which holds the admin's own view model. */\n entity?: Entity<M>;\n /** Bumped once per save, so the list picks up the revision it just made. */\n refreshToken?: number;\n}) {\n\n const { t } = useTranslation();\n const snackbarController = useSnackbarController();\n const { canEdit } = usePermissions();\n const dirty = formContext?.formex.dirty;\n\n const slug = collection.slug;\n const entityId = entity?.id;\n\n const {\n entries,\n isLoading,\n hasMore,\n loadMore,\n revert\n } = useHistory({\n slug,\n entityId,\n enabled: hasEntityId(entityId),\n pageSize: 10,\n refreshToken\n });\n\n const [revertHistoryId, setRevertHistoryId] = useState<string | undefined>();\n const [isReverting, setIsReverting] = useState(false);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const loadMoreRef = useRef<HTMLDivElement>(null);\n\n // Intersection observer for infinite scroll\n useEffect(() => {\n const currentContainer = containerRef.current;\n const currentLoadMore = loadMoreRef.current;\n\n if (!currentContainer || !currentLoadMore || !hasMore || isLoading) return;\n\n const observer = new IntersectionObserver(\n (observerEntries) => {\n if (observerEntries[0].isIntersecting && hasMore && !isLoading) {\n loadMore();\n }\n },\n {\n root: currentContainer,\n rootMargin: \"0px 0px 200px 0px\",\n threshold: 0.01\n }\n );\n\n observer.observe(currentLoadMore);\n\n return () => observer.disconnect();\n }, [hasMore, isLoading, entries.length, loadMore]);\n\n if (!entity) {\n return <div className=\"flex items-center justify-center h-full\">\n <Label>{t(\"history_new_entity\") ?? \"History is only available for existing records\"}</Label>\n </div>;\n }\n\n // A revert writes the record: offered only to someone who may edit it,\n // which no one may while access is simulated.\n const editable = canEdit(collection, entity.path ?? slug, entity.values);\n\n async function doRevert(historyId: string) {\n setIsReverting(true);\n try {\n const revertedValues = await revert(historyId);\n setRevertHistoryId(undefined);\n\n // Reset the form with the reverted values so the UI updates\n // immediately without requiring a page refresh.\n if (formContext?.formex?.resetForm && revertedValues) {\n formContext.formex.resetForm({\n values: revertedValues as M,\n submitCount: 0,\n touched: {}\n });\n }\n\n snackbarController.open({\n message: t(\"history_reverted\") ?? \"Reverted to selected version\",\n type: \"info\"\n });\n } catch (error) {\n console.error(\"Error reverting entity:\", error);\n const reason = error instanceof Error ? error.message : undefined;\n snackbarController.open({\n message: [t(\"history_revert_error\") ?? \"Error reverting entity\", reason].filter(Boolean).join(\": \"),\n type: \"error\"\n });\n } finally {\n setIsReverting(false);\n }\n }\n\n const revertEntry = revertHistoryId\n ? entries.find(e => e.id === revertHistoryId)\n : undefined;\n\n // `p-8` plus a `mt-24` heading were sized for a full-width tab that no\n // longer exists. In the inspector panel that was 96px of nothing above the\n // first revision, and 32px of gutter on each side of a 448px column.\n return <div\n ref={containerRef}\n className={cls(\"relative flex-1 h-full overflow-auto w-full flex flex-col gap-4 p-4 sm:p-5\")}>\n <div className=\"flex flex-col gap-2 max-w-6xl mx-auto w-full\">\n\n {isLoading && entries.length === 0 && (\n <div className=\"flex flex-col gap-4\">\n {[1, 2, 3].map(i => (\n <div key={i} className=\"flex flex-col gap-2 animate-pulse\">\n <div className=\"h-4 w-48 bg-surface-raised rounded\"/>\n <div className=\"h-12 w-full bg-surface-raised rounded-lg border border-hairline-strong\"/>\n </div>\n ))}\n </div>\n )}\n\n {!isLoading && entries.length === 0 && <>\n <Label>\n {t(\"history_empty\") ?? \"No history available\"}\n </Label>\n <Typography variant={\"caption\"}>\n {t(\"history_empty_description\") ?? \"When you save a record, a new version is created and stored in the history.\"}\n </Typography>\n </>}\n\n {entries.map((entry) => (\n <div key={entry.id} className=\"flex flex-col gap-2 w-full\">\n <EntityHistoryEntry\n entry={entry}\n collection={collection}\n size={\"medium\"}\n actions={editable &&\n <Tooltip title={t(\"history_revert\") ?? \"Revert to this version\"}\n className={\"m-2 grow-0 self-start\"}>\n <IconButton aria-label={t(\"history_revert\") ?? \"Revert to this version\"}\n onClick={() => {\n if (dirty) {\n snackbarController.open({\n message: t(\"history_revert_dirty\") ?? \"Please save or discard your changes before reverting\",\n type: \"warning\"\n });\n } else {\n setRevertHistoryId(entry.id);\n }\n }}>\n <HistoryIcon/>\n </IconButton>\n </Tooltip>\n }\n />\n </div>\n ))}\n\n {/* Load more sentinel */}\n {entries.length > 0 && (\n <div ref={loadMoreRef} className=\"py-4 text-center\">\n {isLoading && <Label>{t(\"loading\")}</Label>}\n {!hasMore && entries.length > 10 && <Label>{t(\"history_no_more\") ?? \"No more history\"}</Label>}\n </div>\n )}\n </div>\n\n <ErrorBoundary>\n <ConfirmationDialog\n open={Boolean(revertHistoryId)}\n onAccept={() => {\n if (revertHistoryId) doRevert(revertHistoryId);\n }}\n onCancel={() => setRevertHistoryId(undefined)}\n title={<Typography variant={\"subtitle2\"}>{t(\"history_revert_title\") ?? \"Revert data to this version?\"}</Typography>}\n body={revertEntry\n ? <div className=\"p-4\">\n <Typography variant={\"caption\"} color={\"secondary\"}>\n This will save the entity with the values from{\" \"}\n {new Date(revertEntry.updated_at).toLocaleString()}.\n A new history entry will be created for the revert.\n </Typography>\n </div>\n : null\n }\n />\n </ErrorBoundary>\n </div>;\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,SAAgB,kBAAqD,EACjE,QACA,YACA,aACA,gBAMD;CAEC,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,qBAAqB,sBAAsB;CACjD,MAAM,EAAE,YAAY,eAAe;CACnC,MAAM,QAAQ,aAAa,OAAO;CAElC,MAAM,OAAO,WAAW;CACxB,MAAM,WAAW,QAAQ;CAEzB,MAAM,EACF,SACA,WACA,SACA,UACA,WACA,WAAW;EACX;EACA;EACA,SAAS,YAAY,QAAQ;EAC7B,UAAU;EACV;CACJ,CAAC;CAED,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B;CAC3E,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CAEpD,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,cAAc,OAAuB,IAAI;CAG/C,gBAAgB;EACZ,MAAM,mBAAmB,aAAa;EACtC,MAAM,kBAAkB,YAAY;EAEpC,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,WAAW,WAAW;EAEpE,MAAM,WAAW,IAAI,sBAChB,oBAAoB;GACjB,IAAI,gBAAgB,EAAE,CAAC,kBAAkB,WAAW,CAAC,WACjD,SAAS;EAEjB,GACA;GACI,MAAM;GACN,YAAY;GACZ,WAAW;EACf,CACJ;EAEA,SAAS,QAAQ,eAAe;EAEhC,aAAa,SAAS,WAAW;CACrC,GAAG;EAAC;EAAS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AD;KAAY,SAAS;KAAW,OAAO;eAAvC;MAAoD;MACD;MAC9C,IAAI,KAAK,YAAY,UAAU,CAAC,CAAC,eAAe;MAAE;KAE3C;;GACX,CAAA,IACH;EAET,CAAA,EACU,CAAA,CACd;;AACT"}
1
+ {"version":3,"file":"EntityHistoryView.js","names":[],"sources":["../../../src/components/history/EntityHistoryView.tsx"],"sourcesContent":["\nimport type { EntityCustomViewParams, Entity } from \"@rebasepro/cms-types\";\nimport { hasEntityId } from \"../../util/identity\";\nimport { useRef, useEffect } from \"react\";\nimport { cls, IconButton, Label, Tooltip, Typography } from \"@rebasepro/ui\";\nimport { ErrorBoundary, HistoryIcon } from \"@rebasepro/ui\";\nimport { EntityHistoryEntry } from \"./EntityHistoryEntry\";\nimport { usePermissions, useSnackbarController, useTranslation } from \"@rebasepro/app\";\nimport { ConfirmationDialog } from \"@rebasepro/app\";\nimport { useState } from \"react\";\nimport { useHistory } from \"../../hooks/useHistory\";\n\n/**\n * Entity history tab view. Shows a paginated list of entity revisions\n * fetched from the backend API. Supports infinite scroll and revert.\n */\nexport function EntityHistoryView<M extends Record<string, unknown>>({\n entity,\n collection,\n formContext,\n refreshToken\n}: Omit<EntityCustomViewParams<M>, \"row\"> & {\n /** The record whose revisions are listed: the inspector's, which holds the admin's own view model. */\n entity?: Entity<M>;\n /** Bumped once per save, so the list picks up the revision it just made. */\n refreshToken?: number;\n}) {\n\n const { t } = useTranslation();\n const snackbarController = useSnackbarController();\n const { canEdit } = usePermissions();\n const dirty = formContext?.formex.dirty;\n\n const slug = collection.slug;\n const entityId = entity?.id;\n\n const {\n entries,\n isLoading,\n hasMore,\n loadMore,\n revert\n } = useHistory({\n slug,\n entityId,\n enabled: hasEntityId(entityId),\n pageSize: 10,\n refreshToken\n });\n\n const [revertHistoryId, setRevertHistoryId] = useState<string | undefined>();\n const [isReverting, setIsReverting] = useState(false);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const loadMoreRef = useRef<HTMLDivElement>(null);\n\n // Intersection observer for infinite scroll\n useEffect(() => {\n const currentContainer = containerRef.current;\n const currentLoadMore = loadMoreRef.current;\n\n if (!currentContainer || !currentLoadMore || !hasMore || isLoading) return;\n\n const observer = new IntersectionObserver(\n (observerEntries) => {\n if (observerEntries[0].isIntersecting && hasMore && !isLoading) {\n loadMore();\n }\n },\n {\n root: currentContainer,\n rootMargin: \"0px 0px 200px 0px\",\n threshold: 0.01\n }\n );\n\n observer.observe(currentLoadMore);\n\n return () => observer.disconnect();\n }, [hasMore, isLoading, entries.length, loadMore]);\n\n if (!entity) {\n return <div className=\"flex items-center justify-center h-full\">\n <Label>{t(\"history_new_entity\") ?? \"History is only available for existing records\"}</Label>\n </div>;\n }\n\n // A revert writes the record: offered only to someone who may edit it,\n // which no one may while access is simulated.\n const editable = canEdit(collection, entity.path ?? slug, entity.values);\n\n async function doRevert(historyId: string) {\n setIsReverting(true);\n try {\n const revertedValues = await revert(historyId);\n setRevertHistoryId(undefined);\n\n // Reset the form with the reverted values so the UI updates\n // immediately without requiring a page refresh.\n if (formContext?.formex?.resetForm && revertedValues) {\n formContext.formex.resetForm({\n values: revertedValues as M,\n submitCount: 0,\n touched: {}\n });\n }\n\n snackbarController.open({\n message: t(\"history_reverted\") ?? \"Reverted to selected version\",\n type: \"info\"\n });\n } catch (error) {\n console.error(\"Error reverting entity:\", error);\n const reason = error instanceof Error ? error.message : undefined;\n snackbarController.open({\n message: [t(\"history_revert_error\") ?? \"Error reverting entity\", reason].filter(Boolean).join(\": \"),\n type: \"error\"\n });\n } finally {\n setIsReverting(false);\n }\n }\n\n const revertEntry = revertHistoryId\n ? entries.find(e => e.id === revertHistoryId)\n : undefined;\n\n // `p-8` plus a `mt-24` heading were sized for a full-width tab that no\n // longer exists. In the inspector panel that was 96px of nothing above the\n // first revision, and 32px of gutter on each side of a 448px column.\n return <div\n ref={containerRef}\n className={cls(\"relative flex-1 h-full overflow-auto w-full flex flex-col gap-4 p-4 sm:p-5\")}>\n <div className=\"flex flex-col gap-2 max-w-6xl mx-auto w-full\">\n\n {isLoading && entries.length === 0 && (\n <div className=\"flex flex-col gap-4\">\n {[1, 2, 3].map(i => (\n <div key={i} className=\"flex flex-col gap-2 animate-pulse\">\n <div className=\"h-4 w-48 bg-surface-raised rounded\"/>\n <div className=\"h-12 w-full bg-surface-raised rounded-lg border border-hairline-strong\"/>\n </div>\n ))}\n </div>\n )}\n\n {!isLoading && entries.length === 0 && <>\n <Label>\n {t(\"history_empty\") ?? \"No history available\"}\n </Label>\n <Typography variant={\"caption\"}>\n {t(\"history_empty_description\") ?? \"When you save a record, a new version is created and stored in the history.\"}\n </Typography>\n </>}\n\n {entries.map((entry) => (\n <div key={entry.id} className=\"flex flex-col gap-2 w-full\">\n <EntityHistoryEntry\n entry={entry}\n collection={collection}\n size={\"medium\"}\n actions={editable &&\n <Tooltip title={t(\"history_revert\") ?? \"Revert to this version\"}\n className={\"m-2 grow-0 self-start\"}>\n <IconButton aria-label={t(\"history_revert\") ?? \"Revert to this version\"}\n onClick={() => {\n if (dirty) {\n snackbarController.open({\n message: t(\"history_revert_dirty\") ?? \"Please save or discard your changes before reverting\",\n type: \"warning\"\n });\n } else {\n setRevertHistoryId(entry.id);\n }\n }}>\n <HistoryIcon/>\n </IconButton>\n </Tooltip>\n }\n />\n </div>\n ))}\n\n {/* Load more sentinel */}\n {entries.length > 0 && (\n <div ref={loadMoreRef} className=\"py-4 text-center\">\n {isLoading && <Label>{t(\"loading\")}</Label>}\n {!hasMore && entries.length > 10 && <Label>{t(\"history_no_more\") ?? \"No more history\"}</Label>}\n </div>\n )}\n </div>\n\n <ErrorBoundary>\n <ConfirmationDialog\n open={Boolean(revertHistoryId)}\n onAccept={() => {\n if (revertHistoryId) doRevert(revertHistoryId);\n }}\n onCancel={() => setRevertHistoryId(undefined)}\n title={<Typography variant={\"subtitle2\"}>{t(\"history_revert_title\") ?? \"Revert data to this version?\"}</Typography>}\n body={revertEntry\n ? <div className=\"p-4\">\n <Typography variant={\"caption\"} color={\"secondary\"}>\n This will save the entity with the values from{\" \"}\n {new Date(revertEntry.updated_at).toLocaleString()}.\n A new history entry will be created for the revert.\n </Typography>\n </div>\n : null\n }\n />\n </ErrorBoundary>\n </div>;\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAgB,kBAAqD,EACjE,QACA,YACA,aACA,gBAMD;CAEC,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,qBAAqB,sBAAsB;CACjD,MAAM,EAAE,YAAY,eAAe;CACnC,MAAM,QAAQ,aAAa,OAAO;CAElC,MAAM,OAAO,WAAW;CACxB,MAAM,WAAW,QAAQ;CAEzB,MAAM,EACF,SACA,WACA,SACA,UACA,WACA,WAAW;EACX;EACA;EACA,SAAS,YAAY,QAAQ;EAC7B,UAAU;EACV;CACJ,CAAC;CAED,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B;CAC3E,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CAEpD,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,cAAc,OAAuB,IAAI;CAG/C,gBAAgB;EACZ,MAAM,mBAAmB,aAAa;EACtC,MAAM,kBAAkB,YAAY;EAEpC,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,WAAW,WAAW;EAEpE,MAAM,WAAW,IAAI,sBAChB,oBAAoB;GACjB,IAAI,gBAAgB,EAAE,CAAC,kBAAkB,WAAW,CAAC,WACjD,SAAS;EAEjB,GACA;GACI,MAAM;GACN,YAAY;GACZ,WAAW;EACf,CACJ;EAEA,SAAS,QAAQ,eAAe;EAEhC,aAAa,SAAS,WAAW;CACrC,GAAG;EAAC;EAAS;EAAW,QAAQ;EAAQ;CAAQ,CAAC;CAEjD,IAAI,CAAC,QACD,OAAO,oBAAC,OAAD;EAAK,WAAU;YAClB,oBAAC,OAAD,EAAA,UAAQ,EAAE,oBAAoB,KAAK,iDAAwD,CAAA;CAC1F,CAAA;CAKT,MAAM,WAAW,QAAQ,YAAY,OAAO,QAAQ,MAAM,OAAO,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+ import { Properties, Entity } from "@rebasepro/cms-types";
3
3
  export type BasicExportActionProps = {
4
4
  data: Entity<any>[];
5
5
  properties: Properties;
@@ -1 +1 @@
1
- {"version":3,"file":"BasicExportAction.js","names":[],"sources":["../../../src/data_export/export/BasicExportAction.tsx"],"sourcesContent":["\nimport React, { useCallback } from \"react\";\n\nimport { useTranslation } from \"@rebasepro/app\";\nimport { Entity, Properties } from \"@rebasepro/types\";\nimport {\n BooleanSwitchWithLabel,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n iconSize,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\n\nexport type BasicExportActionProps = {\n data: Entity<any>[];\n properties: Properties;\n propertiesOrder?: string[];\n}\n\nexport function BasicExportAction({\n data,\n properties,\n propertiesOrder\n}: BasicExportActionProps) {\n\n const { t } = useTranslation();\n const dateRef = React.useRef<Date>(new Date());\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onOkClicked = useCallback(() => {\n downloadEntitiesExport({\n data,\n additionalData: [],\n properties,\n propertiesOrder,\n // The writer appends the extension for the chosen format.\n name: \"export\",\n flattenArrays,\n additionalHeaders: [],\n exportType,\n dateExportType\n });\n handleClose();\n }, [data, properties, propertiesOrder, flattenArrays, exportType, dateExportType, handleClose]);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton aria-label={\"Export\"}\n size={\"small\"}\n onClick={handleClickOpen}>\n <DownloadIcon\n size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n </DialogContent>\n\n <DialogActions>\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n"],"mappings":";;;;;;AA6BA,SAAgB,kBAAkB,EAC9B,MACA,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
1
+ {"version":3,"file":"BasicExportAction.js","names":[],"sources":["../../../src/data_export/export/BasicExportAction.tsx"],"sourcesContent":["\nimport React, { useCallback } from \"react\";\n\nimport { useTranslation } from \"@rebasepro/app\";\nimport { Properties, Entity } from \"@rebasepro/cms-types\";\nimport {\n BooleanSwitchWithLabel,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n iconSize,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\n\nexport type BasicExportActionProps = {\n data: Entity<any>[];\n properties: Properties;\n propertiesOrder?: string[];\n}\n\nexport function BasicExportAction({\n data,\n properties,\n propertiesOrder\n}: BasicExportActionProps) {\n\n const { t } = useTranslation();\n const dateRef = React.useRef<Date>(new Date());\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onOkClicked = useCallback(() => {\n downloadEntitiesExport({\n data,\n additionalData: [],\n properties,\n propertiesOrder,\n // The writer appends the extension for the chosen format.\n name: \"export\",\n flattenArrays,\n additionalHeaders: [],\n exportType,\n dateExportType\n });\n handleClose();\n }, [data, properties, propertiesOrder, flattenArrays, exportType, dateExportType, handleClose]);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton aria-label={\"Export\"}\n size={\"small\"}\n onClick={handleClickOpen}>\n <DownloadIcon\n size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n </DialogContent>\n\n <DialogActions>\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n"],"mappings":";;;;;;AA6BA,SAAgB,kBAAkB,EAC9B,MACA,YACA,mBACuB;CAEvB,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,UAAU,MAAM,uBAAa,IAAI,KAAK,CAAC;CAC7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AC3C,oBAAC,OAAD;UAAO,SAAQ;oBAAa,EAAE,KAAK;SAAS,CAAA,CAC3C;YACL,qBAAC,OAAD;SAAK,WAAU;mBAAf,CACI,oBAAC,gBAAD;UAAgB,OAAM;UAAO,IAAG;SAAa,CAAA,GAC7C,oBAAC,OAAD;UAAO,SAAQ;oBAAc,EAAE,MAAM;SAAS,CAAA,CAC7C;UACG;;MACX,CAAA,GAEL,oBAAC,OAAD;OAAK,WAAW;iBACZ,qBAAC,YAAD;QAAY,OAAO;QAAgB,gBAAgB,MAAM,kBAAkB,CAA2B;kBAAtG,CACI,qBAAC,OAAD;SAAK,WAAU;mBAAf,CACI,oBAAC,gBAAD;UAAgB,OAAM;UAAY,IAAG;SAAkB,CAAA,GACvD,qBAAC,OAAD;UAAO,SAAQ;oBAAf;WAAkC,EAAE,qBAAqB;WAAE;WAAG,QAAQ,QAAQ,QAAQ;WAAE;UAAQ;WAC/F;YACL,qBAAC,OAAD;SAAK,WAAU;mBAAf,CACI,oBAAC,gBAAD;UAAgB,OAAM;UAAS,IAAG;SAAe,CAAA,GACjD,qBAAC,OAAD;UAAO,SAAQ;oBAAf;WAA+B,EAAE,kBAAkB;WAAE;WAAG,QAAQ,QAAQ,YAAY;WAAE;UAAQ;WAC7F;UACG;;MACX,CAAA,CACJ;;KAEL,oBAAC,wBAAD;MACI,MAAM;MACN,UAAU,eAAe;MACzB,OAAO;MACP,eAAe;MACf,OAAO,EAAE,gBAAgB;KAAG,CAAA;IAErB;;GAEf,qBAAC,eAAD,EAAA,UAAA,CAEI,oBAAC,QAAD;IAAQ,SAAS;IACb,SAAS;cACR,EAAE,QAAQ;GACP,CAAA,GAER,oBAAC,QAAD;IAAQ,SAAS;cACZ,EAAE,UAAU;GACT,CAAA,CAEG,EAAA,CAAA;EAEX;GAEV,EAAA,CAAA;AACN"}
@@ -6,7 +6,7 @@ import { resolveAdditionalExportValues } from "./additional_fields.js";
6
6
  import React, { useCallback, useMemo } from "react";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Alert, BooleanSwitchWithLabel, Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle, DownloadIcon, IconButton, Label, RadioGroup, RadioGroupItem, Tooltip, iconSize } from "@rebasepro/ui";
9
- import { getDefaultValuesFor } from "@rebasepro/common";
9
+ import { getDefaultValuesFor } from "@rebasepro/cms-types";
10
10
  import { useData, useTranslation } from "@rebasepro/app";
11
11
  //#region src/data_export/export/ExportCollectionAction.tsx
12
12
  var DOCS_LIMIT = 500;
@@ -70,7 +70,7 @@ function ExportCollectionAction({ collection, path, collectionEntitiesCount, sel
70
70
  loaded,
71
71
  total
72
72
  });
73
- const accessor = dataClient.collection(path);
73
+ const accessor = dataClient.table(path);
74
74
  const additionalHeaders = [...exportConfig?.additionalFields?.map((column) => column.key) ?? [], ...collection.additionalFields?.map((field) => field.key) ?? []];
75
75
  const defaultValues = includeUndefinedValues ? getDefaultValuesFor(collection.properties) : void 0;
76
76
  const withDefaults = (data) => defaultValues ? data.map((entity) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"ExportCollectionAction.js","names":[],"sources":["../../../src/data_export/export/ExportCollectionAction.tsx"],"sourcesContent":["\nimport React, { useCallback, useMemo } from \"react\";\n\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n useTranslation\n} from \"@rebasepro/app\";\nimport { useAdminContext } from \"../../hooks\";\nimport { Entity, User } from \"@rebasepro/types\";\nimport { ExportConfig, RebaseContext, AdminCollection, SelectionQuery } from \"@rebasepro/cms-types\";\nimport { getDefaultValuesFor } from \"@rebasepro/common\";\nimport {\n Alert,\n BooleanSwitchWithLabel,\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n iconSize,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { createCsvExportWriter, downloadBlob, downloadEntitiesExport } from \"./export\";\nimport { fetchAllEntitiesForExport, forEachEntityPageForExport, MAX_EXPORT_ROWS } from \"./fetch_export_data\";\nimport { resolveAdditionalExportValues } from \"./additional_fields\";\nimport { resolveEntitySelection, selectionQueryToFindParams } from \"../../selection/resolve_selection\";\nimport type { BuiltInCollectionActionProps } from \"../../components/CollectionViewBinding/builtin_action_props\";\n\nconst DOCS_LIMIT = 500;\n\nexport function ExportCollectionAction<M extends Record<string, unknown>, USER extends User>({\n collection,\n path,\n collectionEntitiesCount,\n selectionController,\n tableController,\n onAnalyticsEvent,\n exportAllowed,\n notAllowedView\n}: BuiltInCollectionActionProps<M, USER, AdminCollection<M>> & {\n exportAllowed?: (props: { collectionEntitiesCount: number, path: string, collection: AdminCollection }) => boolean;\n notAllowedView?: React.ReactNode;\n onAnalyticsEvent?: (event: string, params?: any) => void;\n}) {\n\n const { t } = useTranslation();\n\n const exportConfig = typeof collection.exportable === \"object\" ? collection.exportable : undefined;\n\n const dateRef = React.useRef<Date>(new Date());\n\n const [includeUndefinedValues, setIncludeUndefinedValues] = React.useState<boolean>(false);\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const context = useAdminContext<USER>();\n const dataClient = useData();\n\n // A selection narrows the export to it; with none, the export is the view\n // — filter, search and sort included.\n const exportSelection = selectionController?.hasSelection ? selectionController.selection : undefined;\n\n const liveQuery: SelectionQuery<M> = useMemo(() => ({\n path,\n filterValues: tableController?.filterValues,\n searchString: tableController?.searchString,\n sortBy: tableController?.sortBy\n }), [path, tableController?.filterValues, tableController?.searchString, tableController?.sortBy]);\n\n // Said before the download starts, not discovered halfway through it: the\n // walk refuses rather than writing a short file, so the dialog has to name\n // the ceiling it is about to hit.\n const rowsToExport = exportSelection ? selectionController?.selectedCount : collectionEntitiesCount;\n const tooManyToExport = rowsToExport !== undefined && rowsToExport > MAX_EXPORT_ROWS;\n\n const canExport = !exportAllowed || exportAllowed({\n collectionEntitiesCount: collectionEntitiesCount ?? 0,\n path,\n collection\n });\n\n const [dataLoading, setDataLoading] = React.useState<boolean>(false);\n const [dataLoadingError, setDataLoadingError] = React.useState<Error | undefined>();\n const [progress, setProgress] = React.useState<{ loaded: number, total?: number }>({ loaded: 0 });\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const fetchAdditionalFields = useCallback((entities: Entity<M>[]) => resolveAdditionalExportValues({\n entities,\n collection,\n exportFields: exportConfig?.additionalFields,\n additionalFields: collection.additionalFields,\n context: context as RebaseContext\n }), [collection, exportConfig?.additionalFields, context]);\n\n const doDownload = useCallback(async (collection: AdminCollection<M>,\n exportConfig: ExportConfig<any> | undefined): Promise<boolean> => {\n\n onAnalyticsEvent?.(\"export_collection\", {\n collection: collection.slug\n });\n setDataLoading(true);\n setDataLoadingError(undefined);\n setProgress({ loaded: 0 });\n try {\n const onProgress = (loaded: number, total: number | undefined) => setProgress({ loaded, total });\n const accessor = dataClient.collection(path) as { find: (params?: any) => Promise<any> };\n\n const additionalHeaders = [\n ...exportConfig?.additionalFields?.map(column => column.key) ?? [],\n ...collection.additionalFields?.map(field => field.key) ?? []\n ];\n const defaultValues = includeUndefinedValues ? getDefaultValuesFor(collection.properties) : undefined;\n const withDefaults = (data: Entity<M>[]) => defaultValues\n ? data.map(entity => ({\n ...entity,\n values: { ...defaultValues,\n...entity.values }\n }))\n : data;\n\n // What the user is looking at, or what they picked out of it.\n //\n // Neither used to be true: the export read the collection with no\n // params at all, so a filtered, searched table of 40 rows exported\n // every row in the table — and ticking rows first changed nothing.\n //\n // Paginated, not `find({})`: an absent limit resolves to 50 rows\n // server-side, so the export used to be the first page of the\n // collection under a filename that read like all of it.\n const findParams = selectionQueryToFindParams(liveQuery);\n const resolveSelected = (selection: NonNullable<typeof exportSelection>) => resolveEntitySelection<M>({\n selection,\n accessor,\n maxRows: MAX_EXPORT_ROWS,\n onProgress\n });\n\n if (exportType === \"csv\") {\n // Written a page at a time as the pages arrive, and each page\n // let go once written: holding every entity until the end, then\n // a copy of every row beside it, peaked at ~211 MB for a 32 MB\n // file of 100,000 rows × 20 columns.\n const writer = createCsvExportWriter({\n properties: collection.properties,\n propertiesOrder: collection.propertiesOrder,\n additionalHeaders,\n flattenArrays,\n dateExportType\n });\n const writePage = async (page: Entity<M>[]) => {\n writer.addPage(withDefaults(page), await fetchAdditionalFields(page));\n };\n if (exportSelection) {\n await writePage(await resolveSelected(exportSelection));\n } else {\n await forEachEntityPageForExport<M>({ accessor, params: findParams, onProgress, onPage: writePage });\n }\n downloadBlob(writer.finish(), `${collection.name}.csv`, \"text/csv\");\n } else {\n const data = exportSelection\n ? await resolveSelected(exportSelection)\n : await fetchAllEntitiesForExport<M>({ accessor, params: findParams, onProgress });\n downloadEntitiesExport({\n data: withDefaults(data),\n additionalData: await fetchAdditionalFields(data),\n properties: collection.properties,\n propertiesOrder: collection.propertiesOrder,\n name: collection.name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n });\n }\n onAnalyticsEvent?.(\"export_collection_success\", {\n collection: collection.slug\n });\n return true;\n } catch (e) {\n console.error(\"Error loading export data\", e);\n setDataLoadingError(e as Error);\n return false;\n } finally {\n setDataLoading(false);\n }\n\n }, [onAnalyticsEvent, dataClient, path, exportSelection, liveQuery, fetchAdditionalFields, includeUndefinedValues, flattenArrays, exportType, dateExportType]);\n\n const onOkClicked = useCallback(() => {\n // The dialog stays open until the walk finishes: it is the only place a\n // multi-page export reports progress, or reports that it failed.\n doDownload(collection, exportConfig).then((downloaded) => {\n if (downloaded) handleClose();\n });\n }, [doDownload, collection, exportConfig, handleClose]);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton aria-label={\"Export\"}\n size={\"small\"}\n onClick={handleClickOpen}>\n <DownloadIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n {/* What is about to be downloaded, in as many words. The export\n now follows the selection, or the view's filter and search —\n so \"the content of this table\" would be describing something\n it no longer does. */}\n <div>{exportSelection\n ? (rowsToExport === undefined\n ? (t(\"export_selection_all_matching\", { collection: collection.name })\n ?? `Download every ${collection.name} matching the current filter as a ${exportType.toUpperCase()}`)\n : (t(\"export_selection_count\", {\n total: rowsToExport.toLocaleString(),\n format: exportType.toUpperCase()\n }) ?? `Download the ${rowsToExport.toLocaleString()} selected rows as a ${exportType.toUpperCase()}`))\n : t(\"download_table_csv\")}</div>\n\n {!exportSelection && collectionEntitiesCount !== undefined && collectionEntitiesCount > DOCS_LIMIT && !tooManyToExport &&\n <Alert color={\"warning\"}>\n <div>\n {t(\"large_number_of_documents\", { count: collectionEntitiesCount.toString() })}\n </div>\n </Alert>}\n\n {tooManyToExport &&\n <Alert color={\"error\"}>\n <div>\n {t(\"too_many_documents_to_export\", {\n count: (collectionEntitiesCount ?? 0).toString(),\n limit: MAX_EXPORT_ROWS.toString()\n })}\n </div>\n </Alert>}\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n value={includeUndefinedValues}\n onValueChange={setIncludeUndefinedValues}\n label={t(\"include_undefined_values\")}/>\n\n {dataLoadingError && <Alert color={\"error\"}>\n <div>{dataLoadingError.message}</div>\n </Alert>}\n\n {!canExport && notAllowedView}\n\n </DialogContent>\n\n <DialogActions>\n\n {dataLoading && <CircularProgress size={\"smallest\"}/>}\n\n {dataLoading && <Label>\n {progress.total !== undefined\n ? `${progress.loaded} / ${progress.total}`\n : `${progress.loaded}`}\n </Label>}\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}\n disabled={dataLoading || !canExport || tooManyToExport}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n"],"mappings":";;;;;;;;;;;AAoCA,IAAM,aAAa;AAEnB,SAAgB,uBAA6E,EACzF,YACA,MACA,yBACA,qBACA,iBACA,kBACA,eACA,kBAKD;CAEC,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,eAAe,OAAO,WAAW,eAAe,WAAW,WAAW,aAAa,KAAA;CAEzF,MAAM,UAAU,MAAM,uBAAa,IAAI,KAAK,CAAC;CAE7C,MAAM,CAAC,wBAAwB,6BAA6B,MAAM,SAAkB,KAAK;CACzF,MAAM,CAA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AgB,OAAM;UAAS,IAAG;SAAe,CAAA,GACjD,qBAAC,OAAD;UAAO,SAAQ;oBAAf;WAA+B,EAAE,kBAAkB;WAAE;WAAG,QAAQ,QAAQ,YAAY;WAAE;UAAQ;WAC7F;UACG;;MACX,CAAA,CACJ;;KAEL,oBAAC,wBAAD;MACI,MAAM;MACN,UAAU,eAAe;MACzB,OAAO;MACP,eAAe;MACf,OAAO,EAAE,gBAAgB;KAAG,CAAA;KAEhC,oBAAC,wBAAD;MACI,MAAM;MACN,OAAO;MACP,eAAe;MACf,OAAO,EAAE,0BAA0B;KAAG,CAAA;KAEzC,oBAAoB,oBAAC,OAAD;MAAO,OAAO;gBAC/B,oBAAC,OAAD,EAAA,UAAM,iBAAiB,QAAa,CAAA;KACjC,CAAA;KAEN,CAAC,aAAa;IAEJ;;GAEf,qBAAC,eAAD,EAAA,UAAA;IAEK,eAAe,oBAAC,kBAAD,EAAkB,MAAM,WAAY,CAAA;IAEnD,eAAe,oBAAC,OAAD,EAAA,UACX,SAAS,UAAU,KAAA,IACd,GAAG,SAAS,OAAO,KAAK,SAAS,UACjC,GAAG,SAAS,SACf,CAAA;IAEP,oBAAC,QAAD;KAAQ,SAAS;KACb,SAAS;eACR,EAAE,QAAQ;IACP,CAAA;IAER,oBAAC,QAAD;KAAQ,SAAS;KACb,UAAU,eAAe,CAAC,aAAa;eACtC,EAAE,UAAU;IACT,CAAA;GAEG,EAAA,CAAA;EAEX;GAEV,EAAA,CAAA;AACN"}
1
+ {"version":3,"file":"ExportCollectionAction.js","names":[],"sources":["../../../src/data_export/export/ExportCollectionAction.tsx"],"sourcesContent":["\nimport React, { useCallback, useMemo } from \"react\";\n\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n useTranslation\n} from \"@rebasepro/app\";\nimport { useAdminContext } from \"../../hooks\";\nimport { User } from \"@rebasepro/types\";\nimport { ExportConfig, RebaseContext, AdminCollection, SelectionQuery, getDefaultValuesFor, Entity } from \"@rebasepro/cms-types\";\nimport {\n Alert,\n BooleanSwitchWithLabel,\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n iconSize,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { createCsvExportWriter, downloadBlob, downloadEntitiesExport } from \"./export\";\nimport { fetchAllEntitiesForExport, forEachEntityPageForExport, MAX_EXPORT_ROWS } from \"./fetch_export_data\";\nimport { resolveAdditionalExportValues } from \"./additional_fields\";\nimport { resolveEntitySelection, selectionQueryToFindParams } from \"../../selection/resolve_selection\";\nimport type { BuiltInCollectionActionProps } from \"../../components/CollectionViewBinding/builtin_action_props\";\n\nconst DOCS_LIMIT = 500;\n\nexport function ExportCollectionAction<M extends Record<string, unknown>, USER extends User>({\n collection,\n path,\n collectionEntitiesCount,\n selectionController,\n tableController,\n onAnalyticsEvent,\n exportAllowed,\n notAllowedView\n}: BuiltInCollectionActionProps<M, USER, AdminCollection<M>> & {\n exportAllowed?: (props: { collectionEntitiesCount: number, path: string, collection: AdminCollection }) => boolean;\n notAllowedView?: React.ReactNode;\n onAnalyticsEvent?: (event: string, params?: any) => void;\n}) {\n\n const { t } = useTranslation();\n\n const exportConfig = typeof collection.exportable === \"object\" ? collection.exportable : undefined;\n\n const dateRef = React.useRef<Date>(new Date());\n\n const [includeUndefinedValues, setIncludeUndefinedValues] = React.useState<boolean>(false);\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const context = useAdminContext<USER>();\n const dataClient = useData();\n\n // A selection narrows the export to it; with none, the export is the view\n // — filter, search and sort included.\n const exportSelection = selectionController?.hasSelection ? selectionController.selection : undefined;\n\n const liveQuery: SelectionQuery<M> = useMemo(() => ({\n path,\n filterValues: tableController?.filterValues,\n searchString: tableController?.searchString,\n sortBy: tableController?.sortBy\n }), [path, tableController?.filterValues, tableController?.searchString, tableController?.sortBy]);\n\n // Said before the download starts, not discovered halfway through it: the\n // walk refuses rather than writing a short file, so the dialog has to name\n // the ceiling it is about to hit.\n const rowsToExport = exportSelection ? selectionController?.selectedCount : collectionEntitiesCount;\n const tooManyToExport = rowsToExport !== undefined && rowsToExport > MAX_EXPORT_ROWS;\n\n const canExport = !exportAllowed || exportAllowed({\n collectionEntitiesCount: collectionEntitiesCount ?? 0,\n path,\n collection\n });\n\n const [dataLoading, setDataLoading] = React.useState<boolean>(false);\n const [dataLoadingError, setDataLoadingError] = React.useState<Error | undefined>();\n const [progress, setProgress] = React.useState<{ loaded: number, total?: number }>({ loaded: 0 });\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const fetchAdditionalFields = useCallback((entities: Entity<M>[]) => resolveAdditionalExportValues({\n entities,\n collection,\n exportFields: exportConfig?.additionalFields,\n additionalFields: collection.additionalFields,\n context: context as RebaseContext\n }), [collection, exportConfig?.additionalFields, context]);\n\n const doDownload = useCallback(async (collection: AdminCollection<M>,\n exportConfig: ExportConfig<any> | undefined): Promise<boolean> => {\n\n onAnalyticsEvent?.(\"export_collection\", {\n collection: collection.slug\n });\n setDataLoading(true);\n setDataLoadingError(undefined);\n setProgress({ loaded: 0 });\n try {\n const onProgress = (loaded: number, total: number | undefined) => setProgress({ loaded, total });\n const accessor = dataClient.table(path) as { find: (params?: any) => Promise<any> };\n\n const additionalHeaders = [\n ...exportConfig?.additionalFields?.map(column => column.key) ?? [],\n ...collection.additionalFields?.map(field => field.key) ?? []\n ];\n const defaultValues = includeUndefinedValues ? getDefaultValuesFor(collection.properties) : undefined;\n const withDefaults = (data: Entity<M>[]) => defaultValues\n ? data.map(entity => ({\n ...entity,\n values: { ...defaultValues,\n...entity.values }\n }))\n : data;\n\n // What the user is looking at, or what they picked out of it.\n //\n // Neither used to be true: the export read the collection with no\n // params at all, so a filtered, searched table of 40 rows exported\n // every row in the table — and ticking rows first changed nothing.\n //\n // Paginated, not `find({})`: an absent limit resolves to 50 rows\n // server-side, so the export used to be the first page of the\n // collection under a filename that read like all of it.\n const findParams = selectionQueryToFindParams(liveQuery);\n const resolveSelected = (selection: NonNullable<typeof exportSelection>) => resolveEntitySelection<M>({\n selection,\n accessor,\n maxRows: MAX_EXPORT_ROWS,\n onProgress\n });\n\n if (exportType === \"csv\") {\n // Written a page at a time as the pages arrive, and each page\n // let go once written: holding every entity until the end, then\n // a copy of every row beside it, peaked at ~211 MB for a 32 MB\n // file of 100,000 rows × 20 columns.\n const writer = createCsvExportWriter({\n properties: collection.properties,\n propertiesOrder: collection.propertiesOrder,\n additionalHeaders,\n flattenArrays,\n dateExportType\n });\n const writePage = async (page: Entity<M>[]) => {\n writer.addPage(withDefaults(page), await fetchAdditionalFields(page));\n };\n if (exportSelection) {\n await writePage(await resolveSelected(exportSelection));\n } else {\n await forEachEntityPageForExport<M>({ accessor, params: findParams, onProgress, onPage: writePage });\n }\n downloadBlob(writer.finish(), `${collection.name}.csv`, \"text/csv\");\n } else {\n const data = exportSelection\n ? await resolveSelected(exportSelection)\n : await fetchAllEntitiesForExport<M>({ accessor, params: findParams, onProgress });\n downloadEntitiesExport({\n data: withDefaults(data),\n additionalData: await fetchAdditionalFields(data),\n properties: collection.properties,\n propertiesOrder: collection.propertiesOrder,\n name: collection.name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n });\n }\n onAnalyticsEvent?.(\"export_collection_success\", {\n collection: collection.slug\n });\n return true;\n } catch (e) {\n console.error(\"Error loading export data\", e);\n setDataLoadingError(e as Error);\n return false;\n } finally {\n setDataLoading(false);\n }\n\n }, [onAnalyticsEvent, dataClient, path, exportSelection, liveQuery, fetchAdditionalFields, includeUndefinedValues, flattenArrays, exportType, dateExportType]);\n\n const onOkClicked = useCallback(() => {\n // The dialog stays open until the walk finishes: it is the only place a\n // multi-page export reports progress, or reports that it failed.\n doDownload(collection, exportConfig).then((downloaded) => {\n if (downloaded) handleClose();\n });\n }, [doDownload, collection, exportConfig, handleClose]);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton aria-label={\"Export\"}\n size={\"small\"}\n onClick={handleClickOpen}>\n <DownloadIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n {/* What is about to be downloaded, in as many words. The export\n now follows the selection, or the view's filter and search —\n so \"the content of this table\" would be describing something\n it no longer does. */}\n <div>{exportSelection\n ? (rowsToExport === undefined\n ? (t(\"export_selection_all_matching\", { collection: collection.name })\n ?? `Download every ${collection.name} matching the current filter as a ${exportType.toUpperCase()}`)\n : (t(\"export_selection_count\", {\n total: rowsToExport.toLocaleString(),\n format: exportType.toUpperCase()\n }) ?? `Download the ${rowsToExport.toLocaleString()} selected rows as a ${exportType.toUpperCase()}`))\n : t(\"download_table_csv\")}</div>\n\n {!exportSelection && collectionEntitiesCount !== undefined && collectionEntitiesCount > DOCS_LIMIT && !tooManyToExport &&\n <Alert color={\"warning\"}>\n <div>\n {t(\"large_number_of_documents\", { count: collectionEntitiesCount.toString() })}\n </div>\n </Alert>}\n\n {tooManyToExport &&\n <Alert color={\"error\"}>\n <div>\n {t(\"too_many_documents_to_export\", {\n count: (collectionEntitiesCount ?? 0).toString(),\n limit: MAX_EXPORT_ROWS.toString()\n })}\n </div>\n </Alert>}\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n value={includeUndefinedValues}\n onValueChange={setIncludeUndefinedValues}\n label={t(\"include_undefined_values\")}/>\n\n {dataLoadingError && <Alert color={\"error\"}>\n <div>{dataLoadingError.message}</div>\n </Alert>}\n\n {!canExport && notAllowedView}\n\n </DialogContent>\n\n <DialogActions>\n\n {dataLoading && <CircularProgress size={\"smallest\"}/>}\n\n {dataLoading && <Label>\n {progress.total !== undefined\n ? `${progress.loaded} / ${progress.total}`\n : `${progress.loaded}`}\n </Label>}\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}\n disabled={dataLoading || !canExport || tooManyToExport}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n"],"mappings":";;;;;;;;;;;AAmCA,IAAM,aAAa;AAEnB,SAAgB,uBAA6E,EACzF,YACA,MACA,yBACA,qB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, Entity } from "@rebasepro/cms-types";
2
2
  import { AdditionalFieldDelegate, ExportMappingFunction, RebaseContext } from "@rebasepro/cms-types";
3
3
  /**
4
4
  * The values of the export's extra columns, one record per entity: the
@@ -1 +1 @@
1
- {"version":3,"file":"additional_fields.js","names":[],"sources":["../../../src/data_export/export/additional_fields.ts"],"sourcesContent":["import type { CollectionConfig, Entity } from \"@rebasepro/types\";\nimport { AdditionalFieldDelegate, ExportMappingFunction, RebaseContext } from \"@rebasepro/cms-types\";\nimport { rowOfEntity } from \"@rebasepro/app\";\n\n/**\n * Additional-field builders run per row and may do I/O, so a `Promise.all` over\n * the whole export is one request per row all at once. That was bounded only by\n * the 50-row cap the export used to have; now that the read is paginated, it is\n * bounded here instead.\n */\nconst ADDITIONAL_FIELDS_CONCURRENCY = 50;\n\nasync function mapInChunks<T, R>(items: T[], fn: (item: T) => Promise<R>, chunkSize = ADDITIONAL_FIELDS_CONCURRENCY): Promise<R[]> {\n const results: R[] = [];\n for (let i = 0; i < items.length; i += chunkSize) {\n results.push(...await Promise.all(items.slice(i, i + chunkSize).map(fn)));\n }\n return results;\n}\n\n/**\n * The values of the export's extra columns, one record per entity: the\n * collection's `exportable.additionalFields` and its `additionalFields` that\n * declare a `value`, both in the same record. Both are handed each record as\n * the server sends the row.\n */\nexport async function resolveAdditionalExportValues<M extends Record<string, unknown>>({\n entities,\n collection,\n exportFields,\n additionalFields,\n context\n}: {\n entities: Entity<M>[];\n /** What the rows are converted by. */\n collection: CollectionConfig | undefined;\n exportFields: ExportMappingFunction[] | undefined;\n additionalFields: AdditionalFieldDelegate<M>[] | undefined;\n context: RebaseContext;\n}): Promise<Record<string, unknown>[]> {\n\n const resolvedExportColumnsValues: Record<string, unknown>[] = exportFields\n ? await mapInChunks(entities, async (entity) => {\n // `fromEntries`, not a pairwise spread, which copied the row once\n // per column.\n return Object.fromEntries(await Promise.all(exportFields.map(async (column) => [\n column.key,\n await column.builder({\n row: rowOfEntity(entity, collection),\n id: String(entity.id),\n context\n })\n ])));\n })\n : [];\n\n const resolvedColumnsValues: Record<string, unknown>[] = additionalFields\n ? await mapInChunks(entities, async (entity) => {\n return Object.fromEntries(await Promise.all(additionalFields\n .filter((field) => field.value)\n .map(async (field) => [\n field.key,\n await field.value!({\n row: rowOfEntity(entity, collection),\n id: String(entity.id),\n context\n })\n ])));\n })\n : [];\n // One record per entity, index for index — the export merges\n // `additionalData[i]` into row `i`.\n return entities.map((_, i) => ({\n ...resolvedExportColumnsValues[i],\n ...resolvedColumnsValues[i]\n }));\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,gCAAgC;AAEtC,eAAe,YAAkB,OAAY,IAA6B,YAAY,+BAA6C;CAC/H,MAAM,UAAe,CAAC;CACtB,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,WACnC,QAAQ,KAAK,GAAG,MAAM,QAAQ,IAAI,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;CAE5E,OAAO;AACX;;;;;;;AAQA,eAAsB,8BAAiE,EACnF,UACA,YACA,cACA,kBACA,WAQmC;CAEnC,MAAM,8BAAyD,eACzD,MAAM,YAAY,UAAU,OAAO,WAAW;EAG5C,OAAO,OAAO,YAAY,MAAM,QAAQ,IAAI,aAAa,IAAI,OAAO,WAAW,CAC3E,OAAO,KACP,MAAM,OAAO,QAAQ;GACjB,KAAK,YAAY,QAAQ,UAAU;GACnC,IAAI,OAAO,OAAO,EAAE;GACpB;EACJ,CAAC,CACL,CAAC,CAAC,CAAC;CACP,CAAC,IACC,CAAC;CAEP,MAAM,wBAAmD,mBACnD,MAAM,YAAY,UAAU,OAAO,WAAW;EAC5C,OAAO,OAAO,YAAY,MAAM,QAAQ,IAAI,iBACvC,QAAQ,UAAU,MAAM,KAAK,CAAC,CAC9B,IAAI,OAAO,UAAU,CAClB,MAAM,KACN,MAAM,MAAM,MAAO;GACf,KAAK,YAAY,QAAQ,UAAU;GACnC,IAAI,OAAO,OAAO,EAAE;GACpB;EACJ,CAAC,CACL,CAAC,CAAC,CAAC;CACX,CAAC,IACC,CAAC;CAGP,OAAO,SAAS,KAAK,GAAG,OAAO;EAC3B,GAAG,4BAA4B;EAC/B,GAAG,sBAAsB;CAC7B,EAAE;AACN"}
1
+ {"version":3,"file":"additional_fields.js","names":[],"sources":["../../../src/data_export/export/additional_fields.ts"],"sourcesContent":["import type { CollectionConfig, Entity } from \"@rebasepro/cms-types\";\nimport { AdditionalFieldDelegate, ExportMappingFunction, RebaseContext } from \"@rebasepro/cms-types\";\nimport { rowOfEntity } from \"@rebasepro/app\";\n\n/**\n * Additional-field builders run per row and may do I/O, so a `Promise.all` over\n * the whole export is one request per row all at once. That was bounded only by\n * the 50-row cap the export used to have; now that the read is paginated, it is\n * bounded here instead.\n */\nconst ADDITIONAL_FIELDS_CONCURRENCY = 50;\n\nasync function mapInChunks<T, R>(items: T[], fn: (item: T) => Promise<R>, chunkSize = ADDITIONAL_FIELDS_CONCURRENCY): Promise<R[]> {\n const results: R[] = [];\n for (let i = 0; i < items.length; i += chunkSize) {\n results.push(...await Promise.all(items.slice(i, i + chunkSize).map(fn)));\n }\n return results;\n}\n\n/**\n * The values of the export's extra columns, one record per entity: the\n * collection's `exportable.additionalFields` and its `additionalFields` that\n * declare a `value`, both in the same record. Both are handed each record as\n * the server sends the row.\n */\nexport async function resolveAdditionalExportValues<M extends Record<string, unknown>>({\n entities,\n collection,\n exportFields,\n additionalFields,\n context\n}: {\n entities: Entity<M>[];\n /** What the rows are converted by. */\n collection: CollectionConfig | undefined;\n exportFields: ExportMappingFunction[] | undefined;\n additionalFields: AdditionalFieldDelegate<M>[] | undefined;\n context: RebaseContext;\n}): Promise<Record<string, unknown>[]> {\n\n const resolvedExportColumnsValues: Record<string, unknown>[] = exportFields\n ? await mapInChunks(entities, async (entity) => {\n // `fromEntries`, not a pairwise spread, which copied the row once\n // per column.\n return Object.fromEntries(await Promise.all(exportFields.map(async (column) => [\n column.key,\n await column.builder({\n row: rowOfEntity(entity, collection),\n id: String(entity.id),\n context\n })\n ])));\n })\n : [];\n\n const resolvedColumnsValues: Record<string, unknown>[] = additionalFields\n ? await mapInChunks(entities, async (entity) => {\n return Object.fromEntries(await Promise.all(additionalFields\n .filter((field) => field.value)\n .map(async (field) => [\n field.key,\n await field.value!({\n row: rowOfEntity(entity, collection),\n id: String(entity.id),\n context\n })\n ])));\n })\n : [];\n // One record per entity, index for index — the export merges\n // `additionalData[i]` into row `i`.\n return entities.map((_, i) => ({\n ...resolvedExportColumnsValues[i],\n ...resolvedColumnsValues[i]\n }));\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,gCAAgC;AAEtC,eAAe,YAAkB,OAAY,IAA6B,YAAY,+BAA6C;CAC/H,MAAM,UAAe,CAAC;CACtB,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,WACnC,QAAQ,KAAK,GAAG,MAAM,QAAQ,IAAI,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;CAE5E,OAAO;AACX;;;;;;;AAQA,eAAsB,8BAAiE,EACnF,UACA,YACA,cACA,kBACA,WAQmC;CAEnC,MAAM,8BAAyD,eACzD,MAAM,YAAY,UAAU,OAAO,WAAW;EAG5C,OAAO,OAAO,YAAY,MAAM,QAAQ,IAAI,aAAa,IAAI,OAAO,WAAW,CAC3E,OAAO,KACP,MAAM,OAAO,QAAQ;GACjB,KAAK,YAAY,QAAQ,UAAU;GACnC,IAAI,OAAO,OAAO,EAAE;GACpB;EACJ,CAAC,CACL,CAAC,CAAC,CAAC;CACP,CAAC,IACC,CAAC;CAEP,MAAM,wBAAmD,mBACnD,MAAM,YAAY,UAAU,OAAO,WAAW;EAC5C,OAAO,OAAO,YAAY,MAAM,QAAQ,IAAI,iBACvC,QAAQ,UAAU,MAAM,KAAK,CAAC,CAC9B,IAAI,OAAO,UAAU,CAClB,MAAM,KACN,MAAM,MAAM,MAAO;GACf,KAAK,YAAY,QAAQ,UAAU;GACnC,IAAI,OAAO,OAAO,EAAE;GACpB;EACJ,CAAC,CACL,CAAC,CAAC,CAAC;CACX,CAAC,IACC,CAAC;CAGP,OAAO,SAAS,KAAK,GAAG,OAAO;EAC3B,GAAG,4BAA4B;EAC/B,GAAG,sBAAsB;CAC7B,EAAE;AACN"}
@@ -1,4 +1,4 @@
1
- import { Entity, Properties } from "@rebasepro/types";
1
+ import { Properties, Entity } from "@rebasepro/cms-types";
2
2
  import { escapeCsvFormula, unescapeCsvFormula } from "@rebasepro/utils";
3
3
  interface Header {
4
4
  key: string;
@@ -1,4 +1,4 @@
1
- import { EntityRelation } from "@rebasepro/types";
1
+ import { EntityRelation } from "@rebasepro/cms-types";
2
2
  import { escapeCsvFormula, getArrayValuesCount, getValueInPath, unescapeCsvFormula } from "@rebasepro/utils";
3
3
  //#region src/data_export/export/export.ts
4
4
  function downloadEntitiesExport({ data, additionalData, properties, propertiesOrder, name, flattenArrays, additionalHeaders, exportType, dateExportType }) {