@firecms/core 3.0.0-canary.2 → 3.0.0-canary.200

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 (409) hide show
  1. package/README.md +4 -4
  2. package/dist/app/AppBar.d.ts +12 -0
  3. package/dist/app/Drawer.d.ts +16 -0
  4. package/dist/app/Scaffold.d.ts +30 -0
  5. package/dist/app/index.d.ts +4 -0
  6. package/dist/app/useApp.d.ts +16 -0
  7. package/dist/components/ArrayContainer.d.ts +23 -6
  8. package/dist/components/CircularProgressCenter.d.ts +1 -1
  9. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  10. package/dist/components/{DeleteConfirmationDialog.d.ts → ConfirmationDialog.d.ts} +1 -1
  11. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +13 -13
  12. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +3 -3
  13. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +22 -6
  14. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
  15. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  16. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +3 -1
  17. package/dist/components/EntityCollectionTable/index.d.ts +1 -1
  18. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  19. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  20. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +7 -4
  21. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +17 -4
  22. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  23. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  24. package/dist/components/EntityCollectionView/utils.d.ts +3 -0
  25. package/dist/components/EntityPreview.d.ts +26 -7
  26. package/dist/components/EntityView.d.ts +11 -0
  27. package/dist/components/ErrorView.d.ts +1 -1
  28. package/dist/components/FieldCaption.d.ts +5 -0
  29. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  30. package/dist/components/HomePage/NavigationCard.d.ts +8 -0
  31. package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +3 -3
  32. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  33. package/dist/components/HomePage/index.d.ts +3 -1
  34. package/dist/components/PropertyConfigBadge.d.ts +2 -1
  35. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  36. package/dist/components/ReferenceWidget.d.ts +6 -4
  37. package/dist/components/SelectableTable/SelectableTable.d.ts +13 -3
  38. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  39. package/dist/components/UnsavedChangesDialog.d.ts +8 -0
  40. package/dist/components/VirtualTable/VirtualTableProps.d.ts +29 -13
  41. package/dist/components/VirtualTable/types.d.ts +3 -3
  42. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -3
  43. package/dist/components/common/index.d.ts +2 -1
  44. package/dist/components/common/table_height.d.ts +5 -0
  45. package/dist/components/common/types.d.ts +4 -6
  46. package/dist/components/common/useColumnsIds.d.ts +3 -1
  47. package/dist/components/common/{useDataSourceEntityCollectionTableController.d.ts → useDataSourceTableController.d.ts} +13 -2
  48. package/dist/components/common/useDebouncedCallback.d.ts +1 -0
  49. package/dist/components/common/useScrollRestoration.d.ts +14 -0
  50. package/dist/components/index.d.ts +8 -5
  51. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  52. package/dist/contexts/BreacrumbsContext.d.ts +8 -0
  53. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
  54. package/dist/core/DefaultDrawer.d.ts +19 -0
  55. package/dist/core/DrawerNavigationItem.d.ts +10 -0
  56. package/dist/core/EntityEditView.d.ts +44 -0
  57. package/dist/core/EntityEditViewFormActions.d.ts +2 -0
  58. package/dist/core/FireCMS.d.ts +2 -2
  59. package/dist/core/FireCMSRouter.d.ts +4 -0
  60. package/dist/core/NavigationRoutes.d.ts +2 -3
  61. package/dist/core/SideDialogs.d.ts +4 -2
  62. package/dist/core/index.d.ts +4 -6
  63. package/dist/form/EntityForm.d.ts +45 -69
  64. package/dist/form/EntityFormActions.d.ts +17 -0
  65. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  66. package/dist/form/components/ErrorFocus.d.ts +1 -1
  67. package/dist/form/components/FieldHelperText.d.ts +3 -3
  68. package/dist/form/components/FormEntry.d.ts +6 -0
  69. package/dist/form/components/FormLayout.d.ts +5 -0
  70. package/dist/{components → form/components}/LabelWithIcon.d.ts +1 -1
  71. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  72. package/dist/form/components/StorageItemPreview.d.ts +4 -3
  73. package/dist/form/components/StorageUploadProgress.d.ts +1 -1
  74. package/dist/form/components/index.d.ts +4 -1
  75. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  76. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
  77. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  78. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  79. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  80. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
  81. package/dist/form/field_bindings/{MultiSelectBinding.d.ts → MultiSelectFieldBinding.d.ts} +1 -1
  82. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  83. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -2
  84. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  85. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  86. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
  87. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
  88. package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
  89. package/dist/form/index.d.ts +17 -18
  90. package/dist/form/useClearRestoreValue.d.ts +2 -2
  91. package/dist/form/validation.d.ts +1 -1
  92. package/dist/hooks/data/delete.d.ts +4 -4
  93. package/dist/hooks/data/save.d.ts +4 -5
  94. package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
  95. package/dist/hooks/data/useDataSource.d.ts +2 -2
  96. package/dist/hooks/data/useEntityFetch.d.ts +4 -3
  97. package/dist/hooks/index.d.ts +4 -1
  98. package/dist/hooks/useAuthController.d.ts +1 -1
  99. package/dist/hooks/useBreadcrumbsController.d.ts +26 -0
  100. package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
  101. package/dist/hooks/useBuildNavigationController.d.ts +11 -6
  102. package/dist/hooks/useFireCMSContext.d.ts +1 -1
  103. package/dist/hooks/useModeController.d.ts +1 -2
  104. package/dist/hooks/useProjectLog.d.ts +12 -2
  105. package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
  106. package/dist/hooks/useStorageSource.d.ts +2 -2
  107. package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
  108. package/dist/index.d.ts +1 -0
  109. package/dist/index.es.js +22131 -14039
  110. package/dist/index.es.js.map +1 -1
  111. package/dist/index.umd.js +24420 -588
  112. package/dist/index.umd.js.map +1 -1
  113. package/dist/internal/useBuildDataSource.d.ts +1 -12
  114. package/dist/internal/useUnsavedChangesDialog.d.ts +7 -9
  115. package/dist/preview/PropertyPreview.d.ts +1 -1
  116. package/dist/preview/PropertyPreviewProps.d.ts +7 -5
  117. package/dist/preview/components/BooleanPreview.d.ts +5 -1
  118. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  119. package/dist/preview/components/ReferencePreview.d.ts +4 -9
  120. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  121. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  122. package/dist/preview/util.d.ts +3 -3
  123. package/dist/routes/CustomCMSRoute.d.ts +4 -0
  124. package/dist/routes/FireCMSRoute.d.ts +1 -0
  125. package/dist/routes/HomePageRoute.d.ts +3 -0
  126. package/dist/types/analytics.d.ts +1 -1
  127. package/dist/types/auth.d.ts +37 -3
  128. package/dist/types/collections.d.ts +86 -24
  129. package/dist/types/datasource.d.ts +53 -37
  130. package/dist/types/dialogs_controller.d.ts +7 -3
  131. package/dist/types/entities.d.ts +8 -2
  132. package/dist/types/entity_actions.d.ts +28 -4
  133. package/dist/types/entity_callbacks.d.ts +16 -16
  134. package/dist/types/entity_overrides.d.ts +6 -0
  135. package/dist/types/export_import.d.ts +4 -4
  136. package/dist/types/fields.d.ts +71 -42
  137. package/dist/types/firecms.d.ts +6 -2
  138. package/dist/types/firecms_context.d.ts +1 -1
  139. package/dist/types/index.d.ts +2 -1
  140. package/dist/types/navigation.d.ts +45 -26
  141. package/dist/types/permissions.d.ts +8 -4
  142. package/dist/types/plugins.d.ts +40 -31
  143. package/dist/types/properties.d.ts +54 -26
  144. package/dist/types/property_config.d.ts +2 -4
  145. package/dist/types/roles.d.ts +31 -0
  146. package/dist/types/side_dialogs_controller.d.ts +10 -0
  147. package/dist/types/side_entity_controller.d.ts +6 -1
  148. package/dist/types/storage.d.ts +86 -3
  149. package/dist/types/user.d.ts +6 -0
  150. package/dist/util/builders.d.ts +3 -3
  151. package/dist/util/collections.d.ts +9 -1
  152. package/dist/util/entities.d.ts +3 -3
  153. package/dist/util/entity_actions.d.ts +2 -0
  154. package/dist/util/entity_cache.d.ts +23 -0
  155. package/dist/util/icon_list.d.ts +5 -1
  156. package/dist/util/icon_synonyms.d.ts +1 -98
  157. package/dist/util/icons.d.ts +13 -4
  158. package/dist/util/index.d.ts +2 -0
  159. package/dist/util/navigation_from_path.d.ts +6 -1
  160. package/dist/util/navigation_utils.d.ts +14 -3
  161. package/dist/util/objects.d.ts +2 -1
  162. package/dist/util/permissions.d.ts +4 -4
  163. package/dist/util/plurals.d.ts +0 -2
  164. package/dist/util/property_utils.d.ts +3 -3
  165. package/dist/util/references.d.ts +4 -2
  166. package/dist/util/resolutions.d.ts +31 -17
  167. package/dist/util/storage.d.ts +23 -2
  168. package/dist/util/useStorageUploadController.d.ts +3 -3
  169. package/dist/util/useTraceUpdate.d.ts +1 -0
  170. package/package.json +64 -51
  171. package/src/app/AppBar.tsx +18 -0
  172. package/src/app/Drawer.tsx +24 -0
  173. package/src/app/Scaffold.tsx +243 -0
  174. package/src/app/index.ts +4 -0
  175. package/src/app/useApp.tsx +32 -0
  176. package/src/components/ArrayContainer.tsx +126 -40
  177. package/src/components/CircularProgressCenter.tsx +2 -2
  178. package/src/components/ClearFilterSortButton.tsx +41 -0
  179. package/src/components/{DeleteConfirmationDialog.tsx → ConfirmationDialog.tsx} +3 -3
  180. package/src/components/DeleteEntityDialog.tsx +14 -23
  181. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +56 -39
  182. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +283 -280
  183. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +29 -8
  184. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +58 -50
  185. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  186. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +40 -33
  187. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +22 -20
  188. package/src/components/EntityCollectionTable/index.tsx +1 -1
  189. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +31 -36
  190. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +36 -34
  191. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +20 -8
  192. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +81 -80
  193. package/src/components/EntityCollectionView/EntityCollectionView.tsx +228 -155
  194. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +9 -8
  195. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  196. package/src/components/EntityCollectionView/useSelectionController.tsx +43 -0
  197. package/src/components/EntityCollectionView/utils.ts +19 -0
  198. package/src/components/EntityPreview.tsx +218 -71
  199. package/src/components/EntityView.tsx +84 -0
  200. package/src/components/ErrorView.tsx +4 -4
  201. package/src/components/FieldCaption.tsx +14 -0
  202. package/src/components/HomePage/DefaultHomePage.tsx +39 -28
  203. package/src/components/HomePage/FavouritesView.tsx +6 -11
  204. package/src/components/HomePage/NavigationCard.tsx +69 -0
  205. package/src/components/HomePage/NavigationCardBinding.tsx +111 -0
  206. package/src/components/HomePage/NavigationGroup.tsx +2 -2
  207. package/src/components/HomePage/SmallNavigationCard.tsx +44 -0
  208. package/src/components/HomePage/index.tsx +3 -1
  209. package/src/components/NotFoundPage.tsx +2 -2
  210. package/src/components/PropertyConfigBadge.tsx +9 -3
  211. package/src/components/PropertyIdCopyTooltip.tsx +47 -0
  212. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +22 -17
  213. package/src/components/ReferenceWidget.tsx +26 -16
  214. package/src/components/SearchIconsView.tsx +10 -7
  215. package/src/components/SelectableTable/SelectableTable.tsx +27 -12
  216. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  217. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +25 -8
  218. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +46 -30
  219. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +92 -23
  220. package/src/components/UnsavedChangesDialog.tsx +42 -0
  221. package/src/components/VirtualTable/VirtualTable.tsx +96 -48
  222. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -9
  223. package/src/components/VirtualTable/VirtualTableHeader.tsx +10 -10
  224. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  225. package/src/components/VirtualTable/VirtualTableProps.tsx +34 -15
  226. package/src/components/VirtualTable/VirtualTableRow.tsx +5 -6
  227. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +5 -5
  228. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +3 -2
  229. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
  230. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +16 -28
  231. package/src/components/VirtualTable/types.tsx +2 -3
  232. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +40 -43
  233. package/src/components/common/index.ts +2 -1
  234. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  235. package/src/components/common/types.tsx +4 -6
  236. package/src/components/common/useColumnsIds.tsx +24 -3
  237. package/src/components/common/useDataSourceTableController.tsx +420 -0
  238. package/src/components/common/useDebouncedCallback.tsx +20 -0
  239. package/src/components/common/useScrollRestoration.tsx +68 -0
  240. package/src/components/common/useTableSearchHelper.ts +53 -12
  241. package/src/components/index.tsx +8 -5
  242. package/src/contexts/AuthControllerContext.tsx +1 -1
  243. package/src/contexts/BreacrumbsContext.tsx +38 -0
  244. package/src/contexts/DialogsProvider.tsx +5 -4
  245. package/src/contexts/ModeController.tsx +1 -3
  246. package/src/contexts/SnackbarProvider.tsx +2 -0
  247. package/src/core/DefaultAppBar.tsx +207 -0
  248. package/src/core/DefaultDrawer.tsx +185 -0
  249. package/src/core/DrawerNavigationItem.tsx +66 -0
  250. package/src/core/EntityEditView.tsx +455 -0
  251. package/src/core/EntityEditViewFormActions.tsx +199 -0
  252. package/src/core/EntitySidePanel.tsx +87 -18
  253. package/src/core/FireCMS.tsx +67 -44
  254. package/src/core/FireCMSRouter.tsx +17 -0
  255. package/src/core/NavigationRoutes.tsx +36 -38
  256. package/src/core/SideDialogs.tsx +22 -12
  257. package/src/core/field_configs.tsx +11 -12
  258. package/src/core/index.tsx +6 -7
  259. package/src/form/EntityForm.tsx +565 -519
  260. package/src/form/EntityFormActions.tsx +169 -0
  261. package/src/form/PropertyFieldBinding.tsx +85 -44
  262. package/src/form/components/CustomIdField.tsx +6 -2
  263. package/src/form/components/FieldHelperText.tsx +4 -4
  264. package/src/form/components/FormEntry.tsx +22 -0
  265. package/src/form/components/FormLayout.tsx +16 -0
  266. package/src/form/components/LabelWithIcon.tsx +44 -0
  267. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  268. package/src/form/components/StorageItemPreview.tsx +23 -11
  269. package/src/form/components/StorageUploadProgress.tsx +9 -9
  270. package/src/form/components/index.tsx +4 -1
  271. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +32 -21
  272. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +54 -45
  273. package/src/form/field_bindings/BlockFieldBinding.tsx +57 -36
  274. package/src/form/field_bindings/DateTimeFieldBinding.tsx +21 -17
  275. package/src/form/field_bindings/KeyValueFieldBinding.tsx +76 -67
  276. package/src/form/field_bindings/MapFieldBinding.tsx +82 -65
  277. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +153 -0
  278. package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +26 -22
  279. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +12 -17
  280. package/src/form/field_bindings/ReferenceFieldBinding.tsx +47 -34
  281. package/src/form/field_bindings/RepeatFieldBinding.tsx +57 -36
  282. package/src/form/field_bindings/SelectFieldBinding.tsx +24 -17
  283. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +47 -46
  284. package/src/form/field_bindings/SwitchFieldBinding.tsx +31 -27
  285. package/src/form/field_bindings/TextFieldBinding.tsx +35 -30
  286. package/src/form/index.tsx +17 -37
  287. package/src/form/useClearRestoreValue.tsx +2 -2
  288. package/src/form/validation.ts +15 -26
  289. package/src/hooks/data/delete.ts +7 -6
  290. package/src/hooks/data/save.ts +13 -9
  291. package/src/hooks/data/useCollectionFetch.tsx +4 -4
  292. package/src/hooks/data/useDataSource.tsx +15 -2
  293. package/src/hooks/data/useEntityFetch.tsx +11 -7
  294. package/src/hooks/index.tsx +6 -1
  295. package/src/hooks/useAuthController.tsx +1 -1
  296. package/src/hooks/useBreadcrumbsController.tsx +31 -0
  297. package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +8 -10
  298. package/src/{core → hooks}/useBuildModeController.tsx +23 -30
  299. package/src/hooks/useBuildNavigationController.tsx +278 -117
  300. package/src/hooks/useFireCMSContext.tsx +5 -5
  301. package/src/hooks/useLargeLayout.tsx +0 -35
  302. package/src/hooks/useModeController.tsx +1 -2
  303. package/src/hooks/useProjectLog.tsx +41 -9
  304. package/src/hooks/useReferenceDialog.tsx +2 -2
  305. package/src/hooks/useResolvedNavigationFrom.tsx +10 -12
  306. package/src/hooks/useStorageSource.tsx +7 -2
  307. package/src/hooks/useValidateAuthenticator.tsx +115 -0
  308. package/src/index.ts +1 -0
  309. package/src/internal/useBuildDataSource.ts +72 -77
  310. package/src/internal/useBuildSideDialogsController.tsx +4 -2
  311. package/src/internal/useBuildSideEntityController.tsx +177 -70
  312. package/src/internal/useUnsavedChangesDialog.tsx +127 -91
  313. package/src/preview/PropertyPreview.tsx +19 -26
  314. package/src/preview/PropertyPreviewProps.tsx +5 -9
  315. package/src/preview/components/BooleanPreview.tsx +19 -4
  316. package/src/preview/components/EmptyValue.tsx +1 -1
  317. package/src/preview/components/EnumValuesChip.tsx +2 -2
  318. package/src/preview/components/ImagePreview.tsx +25 -36
  319. package/src/preview/components/ReferencePreview.tsx +73 -176
  320. package/src/preview/components/StorageThumbnail.tsx +5 -1
  321. package/src/preview/components/UrlComponentPreview.tsx +60 -28
  322. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -3
  323. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +4 -3
  324. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -3
  325. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -2
  326. package/src/preview/property_previews/ArrayOneOfPreview.tsx +4 -5
  327. package/src/preview/property_previews/ArrayPropertyPreview.tsx +4 -5
  328. package/src/preview/property_previews/MapPropertyPreview.tsx +12 -11
  329. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +12 -12
  330. package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
  331. package/src/preview/util.ts +10 -10
  332. package/src/routes/CustomCMSRoute.tsx +21 -0
  333. package/src/routes/FireCMSRoute.tsx +236 -0
  334. package/src/routes/HomePageRoute.tsx +17 -0
  335. package/src/types/analytics.ts +1 -0
  336. package/src/types/auth.tsx +48 -3
  337. package/src/types/collections.ts +102 -27
  338. package/src/types/customization_controller.tsx +0 -1
  339. package/src/types/datasource.ts +62 -44
  340. package/src/types/dialogs_controller.tsx +7 -3
  341. package/src/types/entities.ts +16 -2
  342. package/src/types/entity_actions.tsx +33 -4
  343. package/src/types/entity_callbacks.ts +18 -18
  344. package/src/types/entity_overrides.tsx +7 -0
  345. package/src/types/export_import.ts +4 -4
  346. package/src/types/fields.tsx +81 -46
  347. package/src/types/firecms.tsx +6 -2
  348. package/src/types/firecms_context.tsx +1 -1
  349. package/src/types/index.ts +2 -1
  350. package/src/types/navigation.ts +52 -31
  351. package/src/types/permissions.ts +10 -5
  352. package/src/types/plugins.tsx +47 -39
  353. package/src/types/properties.ts +63 -27
  354. package/src/types/property_config.tsx +2 -4
  355. package/src/types/roles.ts +41 -0
  356. package/src/types/side_dialogs_controller.tsx +15 -0
  357. package/src/types/side_entity_controller.tsx +7 -1
  358. package/src/types/storage.ts +94 -3
  359. package/src/types/user.ts +9 -0
  360. package/src/util/builders.ts +10 -8
  361. package/src/util/collections.ts +22 -0
  362. package/src/util/entities.ts +9 -6
  363. package/src/util/entity_actions.ts +28 -0
  364. package/src/util/entity_cache.ts +204 -0
  365. package/src/util/enums.ts +1 -1
  366. package/src/util/icon_list.ts +16 -10
  367. package/src/util/icon_synonyms.ts +3 -100
  368. package/src/util/icons.tsx +26 -8
  369. package/src/util/index.ts +2 -0
  370. package/src/util/join_collections.ts +3 -0
  371. package/src/util/make_properties_editable.ts +13 -5
  372. package/src/util/navigation_from_path.ts +13 -6
  373. package/src/util/navigation_utils.ts +59 -7
  374. package/src/util/objects.ts +45 -28
  375. package/src/util/parent_references_from_path.ts +3 -3
  376. package/src/util/permissions.ts +20 -16
  377. package/src/util/plurals.ts +0 -2
  378. package/src/util/property_utils.tsx +11 -4
  379. package/src/util/references.ts +45 -5
  380. package/src/util/resolutions.ts +79 -46
  381. package/src/util/storage.ts +79 -21
  382. package/src/util/strings.ts +2 -2
  383. package/src/util/useStorageUploadController.tsx +71 -27
  384. package/src/util/useTraceUpdate.tsx +2 -1
  385. package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
  386. package/dist/components/VirtualTable/common.d.ts +0 -2
  387. package/dist/core/Drawer.d.ts +0 -23
  388. package/dist/core/Scaffold.d.ts +0 -55
  389. package/dist/form/components/FormikArrayContainer.d.ts +0 -18
  390. package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
  391. package/dist/internal/EntityView.d.ts +0 -22
  392. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  393. package/dist/internal/useLocaleConfig.d.ts +0 -1
  394. package/dist/types/appcheck.d.ts +0 -26
  395. package/src/components/FireCMSAppBar.tsx +0 -157
  396. package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
  397. package/src/components/LabelWithIcon.tsx +0 -33
  398. package/src/components/PropertyIdCopyTooltipContent.tsx +0 -28
  399. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +0 -225
  400. package/src/core/Drawer.tsx +0 -164
  401. package/src/core/Scaffold.tsx +0 -281
  402. package/src/form/components/FormikArrayContainer.tsx +0 -44
  403. package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -696
  404. package/src/internal/EntityView.tsx +0 -578
  405. package/src/internal/useBuildCustomizationController.tsx +0 -5
  406. package/src/internal/useLocaleConfig.tsx +0 -18
  407. package/src/types/appcheck.ts +0 -29
  408. /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
  409. /package/src/util/{common.tsx → common.ts} +0 -0
@@ -44,7 +44,7 @@ export type CMSViewsBuilder = (params: {
44
44
  /**
45
45
  * @group Models
46
46
  */
47
- export type FireCMSProps<UserType extends User, EC extends EntityCollection> = {
47
+ export type FireCMSProps<USER extends User, EC extends EntityCollection> = {
48
48
  /**
49
49
  * Use this function to return the components you want to render under
50
50
  * FireCMS
@@ -62,6 +62,10 @@ export type FireCMSProps<UserType extends User, EC extends EntityCollection> = {
62
62
  */
63
63
  loading: boolean;
64
64
  }) => React.ReactNode;
65
+ /**
66
+ * If you have a custom API key, you can use it here.
67
+ */
68
+ apiKey?: string;
65
69
  /**
66
70
  * Record of custom form fields to be used in the CMS.
67
71
  * You can use the key to reference the custom field in
@@ -101,7 +105,7 @@ export type FireCMSProps<UserType extends User, EC extends EntityCollection> = {
101
105
  /**
102
106
  * Delegate for implementing your auth operations.
103
107
  */
104
- authController: AuthController<UserType>;
108
+ authController: AuthController<USER>;
105
109
  /**
106
110
  * Use this controller to access the configuration that is stored locally,
107
111
  * and not defined in code
@@ -17,7 +17,7 @@ import { AnalyticsController } from "./analytics_controller";
17
17
  * @group Hooks and utilities
18
18
  * @see useFireCMSContext
19
19
  */
20
- export type FireCMSContext<UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>> = {
20
+ export type FireCMSContext<USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>> = {
21
21
  /**
22
22
  * Connector to your database, e.g. your Firestore database
23
23
  */
@@ -17,11 +17,12 @@ export * from "./side_entity_controller";
17
17
  export * from "./side_dialogs_controller";
18
18
  export * from "./firecms_context";
19
19
  export * from "./entity_callbacks";
20
+ export * from "./entity_overrides";
20
21
  export * from "./local_config_persistence";
21
22
  export * from "./plugins";
22
23
  export * from "./analytics";
23
24
  export * from "./firecms";
24
- export * from "./appcheck";
25
+ export * from "./roles";
25
26
  export * from "./export_import";
26
27
  export * from "./modify_collections";
27
28
  export * from "./analytics_controller";
@@ -1,11 +1,13 @@
1
+ import React from "react";
1
2
  import { EntityCollection } from "./collections";
2
3
  import { EntityReference } from "./entities";
3
4
  /**
4
5
  * Controller that includes the resolved navigation and utility methods and
5
6
  * attributes.
7
+ * This controller holds the state of the navigation including the collections.
6
8
  * @group Models
7
9
  */
8
- export type NavigationController = {
10
+ export type NavigationController<EC extends EntityCollection = EntityCollection<any>> = {
9
11
  /**
10
12
  * List of the mapped collections in the CMS.
11
13
  * Each entry relates to a collection in the root database.
@@ -18,6 +20,11 @@ export type NavigationController = {
18
20
  * navigation
19
21
  */
20
22
  views?: CMSView[];
23
+ /**
24
+ * Custom additional views created by the developer, added to the admin
25
+ * navigation
26
+ */
27
+ adminViews?: CMSView[];
21
28
  /**
22
29
  * Configuration for the views that should be displayed at the top
23
30
  * level of the navigation (e.g. in the home page or the navigation
@@ -41,21 +48,23 @@ export type NavigationController = {
41
48
  * Get the collection configuration for a given path.
42
49
  * The collection is resolved from the given path or alias.
43
50
  */
44
- getCollection: <EC extends EntityCollection = EntityCollection<any>>(pathOrAlias: string, entityId?: string, includeUserOverride?: boolean) => EC | undefined;
51
+ getCollection: (pathOrId: string, includeUserOverride?: boolean) => EC | undefined;
45
52
  /**
46
- * Get the collection configuration from its parent path segments.
53
+ * Get the collection configuration from its parent ids.
47
54
  */
48
- getCollectionFromIds: <EC extends EntityCollection = EntityCollection<any>>(ids: string[]) => EC | undefined;
55
+ getCollectionFromIds: (ids: string[]) => EC | undefined;
49
56
  /**
50
57
  * Get the collection configuration from its parent path segments.
51
58
  */
52
- getCollectionFromPaths: <EC extends EntityCollection = EntityCollection<any>>(pathSegments: string[]) => EC | undefined;
59
+ getCollectionFromPaths: (pathSegments: string[]) => EC | undefined;
53
60
  /**
54
- * Default path under the navigation routes of the CMS will be created
61
+ * Default path under the navigation routes of the CMS will be created.
62
+ * Defaults to '/'. You may want to change this `basepath` to 'admin' for example.
55
63
  */
56
64
  basePath: string;
57
65
  /**
58
- * Default path under the collection routes of the CMS will be created
66
+ * Default path under the collection routes of the CMS will be created.
67
+ * It defaults to '/c'
59
68
  */
60
69
  baseCollectionPath: string;
61
70
  /**
@@ -66,14 +75,6 @@ export type NavigationController = {
66
75
  * @param cmsPath
67
76
  */
68
77
  urlPathToDataPath: (cmsPath: string) => string;
69
- /**
70
- * Convert a collection or entity path to a URL path
71
- * @param path
72
- */
73
- buildCMSUrlPath: (path: string) => string;
74
- buildUrlEditCollectionPath: (props: {
75
- path: string;
76
- }) => string;
77
78
  /**
78
79
  * Base url path for the home screen
79
80
  */
@@ -91,16 +92,11 @@ export type NavigationController = {
91
92
  */
92
93
  buildUrlCollectionPath: (path: string) => string;
93
94
  /**
94
- * Turn a path with aliases into a resolved path
95
+ * Turn a path with collection ids into a resolved path.
96
+ * The ids (typically used in urls) will be replaced with relative paths (typically used in database paths)
95
97
  * @param pathWithAliases
96
98
  */
97
- resolveAliasesFrom: (pathWithAliases: string) => string;
98
- /**
99
- * Location used as the base for routes.
100
- * This is the location that will be used underneath, when the url changes while
101
- * opening a side dialog
102
- */
103
- baseLocation: string;
99
+ resolveIdsFrom: (pathWithAliases: string) => string;
104
100
  /**
105
101
  * Call this method to recalculate the navigation
106
102
  */
@@ -120,6 +116,27 @@ export type NavigationController = {
120
116
  * @param ids
121
117
  */
122
118
  convertIdsToPaths: (ids: string[]) => string[];
119
+ /**
120
+ * A function to navigate to a specified route or URL.
121
+ *
122
+ * @param {string} to - The target route or URL to navigate to.
123
+ * @param {NavigateOptions} [options] - Optional configuration settings for navigation, such as replace behavior or state data.
124
+ */
125
+ navigate: (to: string, options?: NavigateOptions) => void;
126
+ };
127
+ export interface NavigateOptions {
128
+ replace?: boolean;
129
+ state?: any;
130
+ preventScrollReset?: boolean;
131
+ relative?: "route" | "path";
132
+ flushSync?: boolean;
133
+ viewTransition?: boolean;
134
+ }
135
+ export type NavigationBlocker = {
136
+ updateBlockListener: (path: string, block: boolean, basePath?: string) => () => void;
137
+ isBlocked: (path: string) => boolean;
138
+ proceed?: () => void;
139
+ reset?: () => void;
123
140
  };
124
141
  /**
125
142
  * Custom additional views created by the developer, added to the main
@@ -144,6 +161,7 @@ export interface CMSView {
144
161
  * You can use any of the icons in the Material specs:
145
162
  * https://fonts.google.com/icons
146
163
  * e.g. 'account_tree' or 'person'
164
+ * Find all the icons in https://firecms.co/docs/icons
147
165
  */
148
166
  icon?: string;
149
167
  /**
@@ -159,6 +177,7 @@ export interface CMSView {
159
177
  /**
160
178
  * Optional field used to group top level navigation entries under a
161
179
  * navigation view.
180
+ * This prop is ignored for admin views.
162
181
  */
163
182
  group?: string;
164
183
  }
@@ -166,11 +185,11 @@ export interface TopNavigationEntry {
166
185
  url: string;
167
186
  name: string;
168
187
  path: string;
169
- type: "collection" | "view";
188
+ type: "collection" | "view" | "admin";
170
189
  collection?: EntityCollection;
171
- view: CMSView;
190
+ view?: CMSView;
172
191
  description?: string;
173
- group?: string;
192
+ group: string;
174
193
  }
175
194
  export type TopNavigationResult = {
176
195
  navigationEntries: TopNavigationEntry[];
@@ -30,7 +30,7 @@ export interface Permissions {
30
30
  * Props passed to a {@link PermissionsBuilder}
31
31
  * @group Models
32
32
  */
33
- export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCollection, UserType extends User = User, M extends object = InferCollectionType<EC>> {
33
+ export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCollection, USER extends User = User, M extends object = InferCollectionType<EC>> {
34
34
  /**
35
35
  * Entity being edited, might be null in some cases, when the operation
36
36
  * refers to the collection.
@@ -38,6 +38,10 @@ export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCol
38
38
  * in a collection, the entity will be null.
39
39
  */
40
40
  entity: Entity<M> | null;
41
+ /**
42
+ * Path of the collection e.g. 'products/12345/locales'
43
+ */
44
+ path: string;
41
45
  /**
42
46
  * Path segments of the collection e.g. ['products', 'locales']
43
47
  */
@@ -45,7 +49,7 @@ export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCol
45
49
  /**
46
50
  * Logged in user
47
51
  */
48
- user: UserType | null;
52
+ user: USER | null;
49
53
  /**
50
54
  * Collection these permissions apply to
51
55
  */
@@ -53,11 +57,11 @@ export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCol
53
57
  /**
54
58
  * Auth controller
55
59
  */
56
- authController: AuthController<UserType>;
60
+ authController: AuthController<USER>;
57
61
  }
58
62
  /**
59
63
  * Builder used to assign permissions to entities,
60
64
  * based on the logged user or collection.
61
65
  * @group Models
62
66
  */
63
- export type PermissionsBuilder<EC extends EntityCollection = EntityCollection, UserType extends User = User, M extends object = InferCollectionType<EC>> = (({ pathSegments, user, collection, authController }: PermissionsBuilderProps<EC, UserType, M>) => Permissions);
67
+ export type PermissionsBuilder<EC extends EntityCollection = EntityCollection, USER extends User = User, M extends object = InferCollectionType<EC>> = (({ pathSegments, user, collection, authController }: PermissionsBuilderProps<EC, USER, M>) => Permissions | undefined);
@@ -1,6 +1,6 @@
1
1
  import React, { PropsWithChildren } from "react";
2
2
  import { FireCMSContext } from "./firecms_context";
3
- import { CollectionActionsProps, EntityCollection } from "./collections";
3
+ import { CollectionActionsProps, EntityCollection, EntityTableController } from "./collections";
4
4
  import { User } from "./user";
5
5
  import { FieldProps, FormContext } from "./fields";
6
6
  import { CMSType, Property } from "./properties";
@@ -11,33 +11,16 @@ import { ResolvedProperty } from "./resolved_entities";
11
11
  * NOTE: This is a work in progress and the API is not stable yet.
12
12
  * @group Core
13
13
  */
14
- export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any> = {
14
+ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any, COL_ACTIONS_START__PROPS = any> = {
15
15
  /**
16
- * Name of the plugin
16
+ * Key of the plugin. This is used to identify the plugin in the CMS.
17
17
  */
18
- name: string;
18
+ key: string;
19
19
  /**
20
20
  * If this flag is set to true, no content will be shown in the CMS
21
21
  * until the plugin is fully loaded.
22
22
  */
23
23
  loading?: boolean;
24
- collections?: {
25
- /**
26
- * Use this component to add custom actions to the entity collections
27
- * toolbar.
28
- */
29
- CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
30
- collectionActionsProps?: COL_ACTIONS_PROPS;
31
- };
32
- form?: {
33
- provider?: {
34
- Component: React.ComponentType<PropsWithChildren<FORM_PROPS & PluginFormActionProps<any, EC>>>;
35
- props?: FORM_PROPS;
36
- };
37
- Actions?: React.ComponentType<PluginFormActionProps<any, EC>>;
38
- fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T, any, EC>) => React.ComponentType<FieldProps<T>> | null;
39
- fieldBuilderEnabled?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => boolean;
40
- };
41
24
  /**
42
25
  * You can use this prop to add higher order components to the CMS.
43
26
  * The components will be added to the root of the CMS, so any component
@@ -89,6 +72,20 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
89
72
  };
90
73
  };
91
74
  collectionView?: {
75
+ /**
76
+ * Use this component to add custom actions to the entity collections
77
+ * toolbar.
78
+ */
79
+ CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
80
+ collectionActionsProps?: COL_ACTIONS_PROPS;
81
+ CollectionActionsStart?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS>[];
82
+ collectionActionsStartProps?: COL_ACTIONS_START__PROPS;
83
+ blockSearch?: (props: {
84
+ context: FireCMSContext;
85
+ path: string;
86
+ collection: EC;
87
+ parentCollectionIds?: string[];
88
+ }) => boolean;
92
89
  showTextSearchBar?: (props: {
93
90
  context: FireCMSContext;
94
91
  path: string;
@@ -112,6 +109,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
112
109
  parentCollectionIds: string[];
113
110
  onHover: boolean;
114
111
  collection: EC;
112
+ tableController: EntityTableController;
115
113
  }>;
116
114
  /**
117
115
  * If you add this callback to your plugin, an add button will be added to the collection table.
@@ -121,8 +119,18 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
121
119
  fullPath: string;
122
120
  parentCollectionIds: string[];
123
121
  collection: EC;
122
+ tableController: EntityTableController;
124
123
  }>;
125
124
  };
125
+ form?: {
126
+ provider?: {
127
+ Component: React.ComponentType<PropsWithChildren<FORM_PROPS & PluginFormActionProps<any, EC>>>;
128
+ props?: FORM_PROPS;
129
+ };
130
+ Actions?: React.ComponentType<PluginFormActionProps<any, EC>>;
131
+ fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T, any, EC>) => React.ComponentType<FieldProps<T>> | null;
132
+ fieldBuilderEnabled?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => boolean;
133
+ };
126
134
  };
127
135
  /**
128
136
  * Props passed to the {@link FireCMSPlugin.homePage.CollectionActions} method.
@@ -130,7 +138,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
130
138
  *
131
139
  * @group Models
132
140
  */
133
- export interface PluginHomePageActionsProps<EP extends object = object, M extends Record<string, any> = any, UserType extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
141
+ export interface PluginHomePageActionsProps<EP extends object = object, M extends Record<string, any> = any, USER extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
134
142
  /**
135
143
  * Collection path of this entity. This is the full path, like
136
144
  * `users/1234/addresses`
@@ -143,17 +151,18 @@ export interface PluginHomePageActionsProps<EP extends object = object, M extend
143
151
  /**
144
152
  * Context of the app status
145
153
  */
146
- context: FireCMSContext<UserType>;
154
+ context: FireCMSContext<USER>;
147
155
  extraProps?: EP;
148
156
  }
149
- export interface PluginFormActionProps<UserType extends User = User, EC extends EntityCollection = EntityCollection> {
157
+ export interface PluginFormActionProps<USER extends User = User, EC extends EntityCollection = EntityCollection> {
150
158
  entityId?: string;
151
159
  path: string;
152
160
  status: EntityStatus;
153
161
  collection: EC;
154
162
  formContext?: FormContext<any>;
155
- context: FireCMSContext<UserType>;
163
+ context: FireCMSContext<USER>;
156
164
  currentEntityId?: string;
165
+ openEntityMode: "side_panel" | "full_screen";
157
166
  }
158
167
  export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Record<string, any> = any, EC extends EntityCollection<M> = EntityCollection<M>> = {
159
168
  fieldConfigId: string;
@@ -161,13 +170,13 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
161
170
  property: Property<T> | ResolvedProperty<T>;
162
171
  Field: React.ComponentType<FieldProps<T, any, M>>;
163
172
  plugin: FireCMSPlugin;
164
- path: string;
165
- collection: EC;
173
+ path?: string;
174
+ collection?: EC;
166
175
  };
167
- export interface PluginGenericProps<UserType extends User = User> {
168
- context: FireCMSContext<UserType>;
176
+ export interface PluginGenericProps<USER extends User = User> {
177
+ context: FireCMSContext<USER>;
169
178
  }
170
- export interface PluginHomePageAdditionalCardsProps<UserType extends User = User> {
179
+ export interface PluginHomePageAdditionalCardsProps<USER extends User = User> {
171
180
  group?: string;
172
- context: FireCMSContext<UserType>;
181
+ context: FireCMSContext<USER>;
173
182
  }
@@ -1,14 +1,14 @@
1
1
  import React from "react";
2
2
  import { FieldProps } from "./fields";
3
3
  import { PropertyPreviewProps } from "../preview";
4
- import { EntityReference, EntityValues, GeoPoint } from "./entities";
4
+ import { EntityReference, EntityValues, GeoPoint, Vector } from "./entities";
5
5
  import { ResolvedArrayProperty, ResolvedStringProperty } from "./resolved_entities";
6
6
  import { FilterValues } from "./collections";
7
7
  import { ChipColorKey, ChipColorScheme } from "@firecms/ui";
8
8
  /**
9
9
  * @group Entity properties
10
10
  */
11
- export type DataType<T extends CMSType = CMSType> = T extends string ? "string" : T extends number ? "number" : T extends boolean ? "boolean" : T extends Date ? "date" : T extends GeoPoint ? "geopoint" : T extends EntityReference ? "reference" : T extends Array<CMSType> ? "array" : T extends Record<string, any> ? "map" : never;
11
+ export type DataType<T extends CMSType = CMSType> = T extends string ? "string" : T extends number ? "number" : T extends boolean ? "boolean" : T extends Date ? "date" : T extends GeoPoint ? "geopoint" : T extends Vector ? "vector" : T extends EntityReference ? "reference" : T extends Array<any> ? "array" : T extends Record<string, any> ? "map" : never;
12
12
  /**
13
13
  * @group Entity properties
14
14
  */
@@ -20,7 +20,7 @@ export type AnyProperty = StringProperty | NumberProperty | BooleanProperty | Da
20
20
  /**
21
21
  * @group Entity properties
22
22
  */
23
- export type Property<T extends CMSType = CMSType> = T extends string ? StringProperty : T extends number ? NumberProperty : T extends boolean ? BooleanProperty : T extends Date ? DateProperty : T extends GeoPoint ? GeopointProperty : T extends EntityReference ? ReferenceProperty : T extends Array<CMSType> ? ArrayProperty<T> : T extends Record<string, any> ? MapProperty<T> : AnyProperty;
23
+ export type Property<T extends CMSType = any> = T extends string ? StringProperty : T extends number ? NumberProperty : T extends boolean ? BooleanProperty : T extends Date ? DateProperty : T extends GeoPoint ? GeopointProperty : T extends EntityReference ? ReferenceProperty : T extends Array<CMSType> ? ArrayProperty<T> : T extends Record<string, any> ? MapProperty<T> : AnyProperty;
24
24
  /**
25
25
  * Interface including all common properties of a CMS property
26
26
  * @group Entity properties
@@ -97,12 +97,17 @@ export interface BaseProperty<T extends CMSType, CustomProps = any> {
97
97
  /**
98
98
  * This value will be set by default for new entities.
99
99
  */
100
- defaultValue?: T;
100
+ defaultValue?: T | null;
101
101
  /**
102
102
  * Should this property be editable. If set to true, the user will be able to modify the property and
103
103
  * save the new config. The saved config will then become the source of truth.
104
104
  */
105
105
  editable?: boolean;
106
+ /**
107
+ * A number between 0 and 100 that indicates the width of the field in the form view.
108
+ * It defaults to 100, but you can set it to 50 to have two fields in the same row.
109
+ */
110
+ widthPercentage?: number;
106
111
  }
107
112
  /**
108
113
  * @group Entity properties
@@ -207,15 +212,15 @@ export type PropertyBuilderProps<M extends Record<string, any> = any> = {
207
212
  * current value of the property, as well as the path and entity ID.
208
213
  * @group Entity properties
209
214
  */
210
- export type PropertyBuilder<T extends CMSType = any, M extends Record<string, any> = any> = ({ values, previousValues, propertyValue, path, entityId }: PropertyBuilderProps<M>) => Property<T> | null;
215
+ export type PropertyBuilder<T extends CMSType = any, M extends Record<string, any> = any> = ({ values, previousValues, propertyValue, index, path, entityId }: PropertyBuilderProps<M>) => Property<T> | null;
211
216
  /**
212
217
  * @group Entity properties
213
218
  */
214
- export type PropertyOrBuilder<T extends CMSType = CMSType, M extends Record<string, any> = Record<string, any>> = Property<T> | PropertyBuilder<T, M>;
219
+ export type PropertyOrBuilder<T extends CMSType = CMSType, M extends Record<string, any> = any> = Property<T> | PropertyBuilder<T, M>;
215
220
  /**
216
221
  * @group Entity properties
217
222
  */
218
- export type PropertiesOrBuilders<M extends Record<string, any> = Record<string, any>> = {
223
+ export type PropertiesOrBuilders<M extends Record<string, any> = any> = {
219
224
  [k in keyof M]: PropertyOrBuilder<M[k], M>;
220
225
  };
221
226
  /**
@@ -278,7 +283,7 @@ export interface StringProperty extends BaseProperty<string> {
278
283
  enumValues?: EnumValues;
279
284
  /**
280
285
  * You can specify a `Storage` configuration. It is used to
281
- * indicate that this string refers to a path in Google Cloud Storage.
286
+ * indicate that this string refers to a path in your storage provider.
282
287
  */
283
288
  storage?: StorageConfig;
284
289
  /**
@@ -306,7 +311,7 @@ export interface StringProperty extends BaseProperty<string> {
306
311
  /**
307
312
  * @group Entity properties
308
313
  */
309
- export interface ArrayProperty<T extends ArrayT[] = any[], ArrayT extends CMSType = CMSType> extends BaseProperty<T> {
314
+ export interface ArrayProperty<T extends ArrayT[] = any[], ArrayT extends CMSType = any> extends BaseProperty<T> {
310
315
  dataType: "array";
311
316
  /**
312
317
  * The property of this array.
@@ -361,6 +366,11 @@ export interface ArrayProperty<T extends ArrayT[] = any[], ArrayT extends CMSTyp
361
366
  * Should the field be initially expanded. Defaults to `true`
362
367
  */
363
368
  expanded?: boolean;
369
+ /**
370
+ * Display the child properties directly, without being wrapped in an
371
+ * extendable panel.
372
+ */
373
+ minimalistView?: boolean;
364
374
  }
365
375
  /**
366
376
  * @group Entity properties
@@ -400,6 +410,11 @@ export interface MapProperty<T extends Record<string, CMSType> = Record<string,
400
410
  * view
401
411
  */
402
412
  spreadChildren?: boolean;
413
+ /**
414
+ * Display the child properties directly, without being wrapped in an
415
+ * extendable panel. Note that this will also hide the title of this property.
416
+ */
417
+ minimalistView?: boolean;
403
418
  /**
404
419
  * Should the field be initially expanded. Defaults to `true`
405
420
  */
@@ -474,6 +489,14 @@ export interface ReferenceProperty extends BaseProperty<EntityReference> {
474
489
  * specified values are considered.
475
490
  */
476
491
  previewProperties?: string[];
492
+ /**
493
+ * Should the reference include the ID of the entity. Defaults to `true`
494
+ */
495
+ includeId?: boolean;
496
+ /**
497
+ * Should the reference include a link to the entity (open the entity details). Defaults to `true`
498
+ */
499
+ includeEntityLink?: boolean;
477
500
  }
478
501
  /**
479
502
  * Rules to validate any property. Some properties have specific rules
@@ -552,7 +575,7 @@ export interface ArrayPropertyValidationSchema extends PropertyValidationSchema
552
575
  * Additional configuration related to Storage related fields
553
576
  * @group Entity properties
554
577
  */
555
- export interface StorageConfig {
578
+ export type StorageConfig = {
556
579
  /**
557
580
  * File MIME types that can be uploaded to this reference. Don't specify for
558
581
  * all.
@@ -575,13 +598,13 @@ export interface StorageConfig {
575
598
  * You can use this prop to customize the uploaded filename.
576
599
  * You can use a function as a callback or a string where you
577
600
  * specify some placeholders that get replaced with the corresponding values.
578
- * - {file} - Full file name
579
- * - {file.name} - Name of the file without extension
580
- * - {file.ext} - Extension of the file
581
- * - {rand} - Random value used to avoid name collisions
582
- * - {entityId} - ID of the entity
583
- * - {propertyKey} - ID of this property
584
- * - {path} - Path of this entity
601
+ * - `{file}` - Full file name
602
+ * - `{file.name}` - Name of the file without extension
603
+ * - `{file.ext}` - Extension of the file
604
+ * - `{rand}` - Random value used to avoid name collisions
605
+ * - `{entityId}` - ID of the entity
606
+ * - `{propertyKey}` - ID of this property
607
+ * - `{path}` - Path of this entity
585
608
  *
586
609
  * @param context
587
610
  */
@@ -591,13 +614,13 @@ export interface StorageConfig {
591
614
  *
592
615
  * You can use a function as a callback or a string where you
593
616
  * specify some placeholders that get replaced with the corresponding values.
594
- * - {file} - Full file name
595
- * - {file.name} - Name of the file without extension
596
- * - {file.ext} - Extension of the file
597
- * - {rand} - Random value used to avoid name collisions
598
- * - {entityId} - ID of the entity
599
- * - {propertyKey} - ID of this property
600
- * - {path} - Path of this entity
617
+ * - `{file}` - Full file name
618
+ * - `{file.name}` - Name of the file without extension
619
+ * - `{file.ext}` - Extension of the file
620
+ * - `{rand}` - Random value used to avoid name collisions
621
+ * - `{entityId}` - ID of the entity
622
+ * - `{propertyKey}` - ID of this property
623
+ * - `{path}` - Path of this entity
601
624
  */
602
625
  storagePath: string | ((context: UploadedFileContext) => string);
603
626
  /**
@@ -620,7 +643,12 @@ export interface StorageConfig {
620
643
  * after it has been resolved.
621
644
  */
622
645
  postProcess?: (pathOrUrl: string) => Promise<string>;
623
- }
646
+ /**
647
+ * You can use this prop in order to provide a custom preview URL.
648
+ * Useful when the file's path is different from the original field value
649
+ */
650
+ previewUrl?: (fileName: string) => string;
651
+ };
624
652
  /**
625
653
  * @group Entity properties
626
654
  */
@@ -644,7 +672,7 @@ export interface UploadedFileContext {
644
672
  /**
645
673
  * Entity path. E.g. `products/PID/locales`
646
674
  */
647
- path: string;
675
+ path?: string;
648
676
  /**
649
677
  * Values of the current entity
650
678
  */
@@ -9,7 +9,7 @@ export type PropertyConfig<T extends CMSType = any> = {
9
9
  /**
10
10
  * Key used to identify this property config.
11
11
  */
12
- key: string;
12
+ key: PropertyConfigId | string;
13
13
  /**
14
14
  * Name of this field type.
15
15
  * This is not the name of the property.
@@ -19,8 +19,6 @@ export type PropertyConfig<T extends CMSType = any> = {
19
19
  * Default config for the property.
20
20
  * This property or builder will be used as the base values for the resulting property.
21
21
  * You can also use a builder function to generate the base property.
22
- * You can use a builder function to generate the property based on the values or the path.
23
- * You can also define a custom Field as a React component to be used for this property.
24
22
  */
25
23
  property: PropertyOrBuilder<T>;
26
24
  /**
@@ -39,4 +37,4 @@ export type PropertyConfig<T extends CMSType = any> = {
39
37
  */
40
38
  description?: string;
41
39
  };
42
- export type FieldConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "multi_references" | "switch" | "date_time" | "repeat" | "custom_array" | "block";
40
+ export type PropertyConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "multi_references" | "switch" | "date_time" | "repeat" | "custom_array" | "block";
@@ -0,0 +1,31 @@
1
+ import { Permissions } from "../index";
2
+ export type Role = {
3
+ /**
4
+ * ID of the role
5
+ */
6
+ id: string;
7
+ /**
8
+ * Name of the role
9
+ */
10
+ name: string;
11
+ /**
12
+ * If this flag is true, the user can perform any action
13
+ */
14
+ isAdmin?: boolean;
15
+ /**
16
+ * Default permissions for all collections for this role.
17
+ * You can override this values at the collection level using
18
+ * {@link collectionPermissions}
19
+ */
20
+ defaultPermissions?: Permissions;
21
+ /**
22
+ * Record of stripped collection ids to their permissions.
23
+ * @see stripCollectionPath
24
+ */
25
+ collectionPermissions?: Record<string, Permissions>;
26
+ config?: {
27
+ createCollections?: boolean;
28
+ editCollections?: boolean | "own";
29
+ deleteCollections?: boolean | "own";
30
+ };
31
+ };
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  /**
2
3
  * Controller to open the side dialog
3
4
  * @group Hooks and utilities
@@ -11,6 +12,11 @@ export interface SideDialogsController {
11
12
  * List of side panels currently open
12
13
  */
13
14
  sidePanels: SideDialogPanelProps[];
15
+ /**
16
+ * Override the current side panels
17
+ * @param panels
18
+ */
19
+ setSidePanels: (panels: SideDialogPanelProps[]) => void;
14
20
  /**
15
21
  * Open one or multiple side panels
16
22
  * @param props
@@ -54,4 +60,8 @@ export interface SideDialogPanelProps {
54
60
  * Callback when the panel is closed
55
61
  */
56
62
  onClose?: () => void;
63
+ /**
64
+ * Use this prop to store additional data in the panel
65
+ */
66
+ additional?: any;
57
67
  }