@firecms/core 3.0.0-canary.1 → 3.0.0-canary.100

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 (301) hide show
  1. package/README.md +2 -2
  2. package/dist/app/AppBar.d.ts +12 -0
  3. package/dist/app/Drawer.d.ts +17 -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/CircularProgressCenter.d.ts +1 -1
  8. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  9. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
  10. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
  11. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  12. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
  13. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  14. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  15. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  16. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  17. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  18. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +13 -4
  19. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  20. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  21. package/dist/components/EntityPreview.d.ts +26 -7
  22. package/dist/components/EntityView.d.ts +11 -0
  23. package/dist/components/ErrorView.d.ts +1 -1
  24. package/dist/components/FieldCaption.d.ts +5 -0
  25. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  26. package/dist/components/HomePage/NavigationCard.d.ts +8 -0
  27. package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +3 -3
  28. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  29. package/dist/components/HomePage/index.d.ts +3 -1
  30. package/dist/components/ReferenceWidget.d.ts +6 -4
  31. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  32. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  33. package/dist/components/VirtualTable/VirtualTableProps.d.ts +16 -13
  34. package/dist/components/VirtualTable/types.d.ts +3 -3
  35. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  36. package/dist/components/common/index.d.ts +1 -0
  37. package/dist/components/common/table_height.d.ts +5 -0
  38. package/dist/components/common/types.d.ts +4 -6
  39. package/dist/components/common/useColumnsIds.d.ts +2 -1
  40. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  41. package/dist/components/index.d.ts +6 -4
  42. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  43. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
  44. package/dist/core/DefaultDrawer.d.ts +19 -0
  45. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  46. package/dist/core/EntityEditView.d.ts +36 -0
  47. package/dist/core/FireCMS.d.ts +1 -1
  48. package/dist/core/NavigationRoutes.d.ts +3 -3
  49. package/dist/core/index.d.ts +3 -6
  50. package/dist/form/PropertiesForm.d.ts +8 -0
  51. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  52. package/dist/form/components/ErrorFocus.d.ts +1 -1
  53. package/dist/form/components/FieldHelperText.d.ts +3 -3
  54. package/dist/form/components/StorageItemPreview.d.ts +4 -3
  55. package/dist/form/components/StorageUploadProgress.d.ts +1 -1
  56. package/dist/form/components/index.d.ts +1 -0
  57. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  58. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  59. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
  60. package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
  61. package/dist/form/index.d.ts +1 -2
  62. package/dist/form/validation.d.ts +1 -1
  63. package/dist/hooks/data/delete.d.ts +2 -2
  64. package/dist/hooks/data/save.d.ts +2 -3
  65. package/dist/hooks/data/useDataSource.d.ts +2 -2
  66. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  67. package/dist/hooks/index.d.ts +4 -1
  68. package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
  69. package/dist/hooks/useBuildNavigationController.d.ts +6 -4
  70. package/dist/hooks/useProjectLog.d.ts +6 -2
  71. package/dist/hooks/useStorageSource.d.ts +2 -2
  72. package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.es.js +16400 -12423
  75. package/dist/index.es.js.map +1 -1
  76. package/dist/index.umd.js +19713 -7
  77. package/dist/index.umd.js.map +1 -1
  78. package/dist/internal/useBuildDataSource.d.ts +1 -12
  79. package/dist/preview/PropertyPreview.d.ts +1 -1
  80. package/dist/preview/PropertyPreviewProps.d.ts +6 -4
  81. package/dist/preview/components/BooleanPreview.d.ts +5 -1
  82. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  83. package/dist/preview/components/ReferencePreview.d.ts +3 -8
  84. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  85. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  86. package/dist/types/analytics.d.ts +1 -1
  87. package/dist/types/auth.d.ts +38 -2
  88. package/dist/types/collections.d.ts +45 -8
  89. package/dist/types/datasource.d.ts +34 -20
  90. package/dist/types/entities.d.ts +6 -1
  91. package/dist/types/entity_actions.d.ts +14 -0
  92. package/dist/types/entity_callbacks.d.ts +2 -2
  93. package/dist/types/entity_overrides.d.ts +6 -0
  94. package/dist/types/fields.d.ts +36 -30
  95. package/dist/types/index.d.ts +2 -1
  96. package/dist/types/navigation.d.ts +15 -14
  97. package/dist/types/permissions.d.ts +5 -1
  98. package/dist/types/plugins.d.ts +31 -23
  99. package/dist/types/properties.d.ts +34 -21
  100. package/dist/types/property_config.d.ts +2 -2
  101. package/dist/types/roles.d.ts +31 -0
  102. package/dist/types/storage.d.ts +11 -3
  103. package/dist/types/user.d.ts +5 -0
  104. package/dist/util/collections.d.ts +9 -1
  105. package/dist/util/entities.d.ts +1 -1
  106. package/dist/util/icon_list.d.ts +5 -1
  107. package/dist/util/icon_synonyms.d.ts +1 -97
  108. package/dist/util/icons.d.ts +9 -3
  109. package/dist/util/index.d.ts +1 -0
  110. package/dist/util/navigation_utils.d.ts +2 -2
  111. package/dist/util/objects.d.ts +1 -1
  112. package/dist/util/permissions.d.ts +4 -4
  113. package/dist/util/plurals.d.ts +0 -2
  114. package/dist/util/references.d.ts +4 -2
  115. package/dist/util/resolutions.d.ts +15 -14
  116. package/dist/util/storage.d.ts +23 -2
  117. package/dist/util/useStorageUploadController.d.ts +1 -1
  118. package/dist/util/useTraceUpdate.d.ts +1 -0
  119. package/package.json +128 -119
  120. package/src/app/AppBar.tsx +18 -0
  121. package/src/app/Drawer.tsx +25 -0
  122. package/src/app/Scaffold.tsx +251 -0
  123. package/src/app/index.ts +4 -0
  124. package/src/app/useApp.tsx +32 -0
  125. package/src/components/ArrayContainer.tsx +1 -1
  126. package/src/components/CircularProgressCenter.tsx +1 -1
  127. package/src/components/ClearFilterSortButton.tsx +41 -0
  128. package/src/components/DeleteEntityDialog.tsx +4 -4
  129. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +11 -21
  130. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -279
  131. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
  132. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +49 -45
  133. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  134. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +20 -18
  135. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +17 -9
  136. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  137. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
  138. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
  139. package/src/components/EntityCollectionView/EntityCollectionView.tsx +95 -92
  140. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
  141. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  142. package/src/components/EntityCollectionView/useSelectionController.tsx +42 -0
  143. package/src/components/EntityPreview.tsx +210 -70
  144. package/src/components/EntityView.tsx +84 -0
  145. package/src/components/ErrorView.tsx +1 -1
  146. package/src/components/FieldCaption.tsx +14 -0
  147. package/src/components/HomePage/DefaultHomePage.tsx +37 -24
  148. package/src/components/HomePage/NavigationCard.tsx +69 -0
  149. package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
  150. package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
  151. package/src/components/HomePage/index.tsx +3 -1
  152. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  153. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +4 -4
  154. package/src/components/ReferenceWidget.tsx +26 -16
  155. package/src/components/SearchIconsView.tsx +9 -6
  156. package/src/components/SelectableTable/SelectableTable.tsx +7 -7
  157. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  158. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
  159. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +38 -24
  160. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  161. package/src/components/VirtualTable/VirtualTable.tsx +70 -37
  162. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
  163. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  164. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  165. package/src/components/VirtualTable/VirtualTableProps.tsx +19 -15
  166. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  167. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  168. package/src/components/VirtualTable/types.tsx +2 -3
  169. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +11 -7
  170. package/src/components/common/index.ts +1 -0
  171. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  172. package/src/components/common/types.tsx +4 -6
  173. package/src/components/common/useColumnsIds.tsx +23 -2
  174. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -1
  175. package/src/components/common/useTableSearchHelper.ts +52 -12
  176. package/src/components/index.tsx +6 -4
  177. package/src/contexts/AuthControllerContext.tsx +1 -1
  178. package/src/contexts/DialogsProvider.tsx +2 -2
  179. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +60 -37
  180. package/src/core/DefaultDrawer.tsx +177 -0
  181. package/src/core/DrawerNavigationItem.tsx +62 -0
  182. package/src/core/EntityEditView.tsx +1130 -0
  183. package/src/core/EntitySidePanel.tsx +3 -4
  184. package/src/core/FireCMS.tsx +55 -44
  185. package/src/core/NavigationRoutes.tsx +15 -8
  186. package/src/core/SideDialogs.tsx +1 -0
  187. package/src/core/field_configs.tsx +2 -3
  188. package/src/core/index.tsx +3 -6
  189. package/src/form/PropertiesForm.tsx +81 -0
  190. package/src/form/PropertyFieldBinding.tsx +38 -9
  191. package/src/form/components/FieldHelperText.tsx +3 -3
  192. package/src/form/components/StorageItemPreview.tsx +21 -10
  193. package/src/form/components/StorageUploadProgress.tsx +9 -8
  194. package/src/form/components/index.tsx +1 -0
  195. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +10 -8
  196. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +18 -18
  197. package/src/form/field_bindings/BlockFieldBinding.tsx +4 -5
  198. package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
  199. package/src/form/field_bindings/KeyValueFieldBinding.tsx +62 -57
  200. package/src/form/field_bindings/MapFieldBinding.tsx +28 -20
  201. package/src/form/field_bindings/MarkdownFieldBinding.tsx +3 -4
  202. package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
  203. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +4 -11
  204. package/src/form/field_bindings/ReferenceFieldBinding.tsx +21 -17
  205. package/src/form/field_bindings/RepeatFieldBinding.tsx +14 -11
  206. package/src/form/field_bindings/SelectFieldBinding.tsx +5 -6
  207. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +28 -40
  208. package/src/form/field_bindings/SwitchFieldBinding.tsx +3 -4
  209. package/src/form/field_bindings/TextFieldBinding.tsx +10 -9
  210. package/src/form/index.tsx +5 -4
  211. package/src/form/validation.ts +4 -21
  212. package/src/hooks/data/delete.ts +3 -3
  213. package/src/hooks/data/save.ts +4 -2
  214. package/src/hooks/data/useCollectionFetch.tsx +1 -1
  215. package/src/hooks/data/useDataSource.tsx +7 -2
  216. package/src/hooks/data/useEntityFetch.tsx +4 -4
  217. package/src/hooks/index.tsx +6 -1
  218. package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +8 -10
  219. package/src/{core → hooks}/useBuildModeController.tsx +12 -6
  220. package/src/hooks/useBuildNavigationController.tsx +208 -92
  221. package/src/hooks/useProjectLog.tsx +30 -9
  222. package/src/hooks/useReferenceDialog.tsx +2 -2
  223. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  224. package/src/hooks/useStorageSource.tsx +7 -2
  225. package/src/hooks/useValidateAuthenticator.tsx +115 -0
  226. package/src/index.ts +1 -0
  227. package/src/internal/useBuildDataSource.ts +56 -44
  228. package/src/internal/useBuildSideEntityController.tsx +88 -21
  229. package/src/preview/PropertyPreview.tsx +11 -18
  230. package/src/preview/PropertyPreviewProps.tsx +4 -8
  231. package/src/preview/components/BooleanPreview.tsx +19 -4
  232. package/src/preview/components/EnumValuesChip.tsx +2 -2
  233. package/src/preview/components/ImagePreview.tsx +21 -33
  234. package/src/preview/components/ReferencePreview.tsx +74 -166
  235. package/src/preview/components/StorageThumbnail.tsx +5 -1
  236. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  237. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  238. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  239. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  240. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  241. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  242. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  243. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  244. package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
  245. package/src/types/analytics.ts +1 -0
  246. package/src/types/auth.tsx +51 -2
  247. package/src/types/collections.ts +52 -8
  248. package/src/types/customization_controller.tsx +0 -1
  249. package/src/types/datasource.ts +41 -24
  250. package/src/types/entities.ts +13 -1
  251. package/src/types/entity_actions.tsx +17 -0
  252. package/src/types/entity_callbacks.ts +2 -2
  253. package/src/types/entity_overrides.tsx +7 -0
  254. package/src/types/fields.tsx +39 -33
  255. package/src/types/firecms.tsx +0 -1
  256. package/src/types/index.ts +2 -1
  257. package/src/types/navigation.ts +17 -17
  258. package/src/types/permissions.ts +6 -1
  259. package/src/types/plugins.tsx +38 -31
  260. package/src/types/properties.ts +40 -22
  261. package/src/types/property_config.tsx +2 -2
  262. package/src/types/roles.ts +41 -0
  263. package/src/types/side_entity_controller.tsx +1 -0
  264. package/src/types/storage.ts +12 -3
  265. package/src/types/user.ts +7 -0
  266. package/src/util/collections.ts +22 -0
  267. package/src/util/entities.ts +5 -4
  268. package/src/util/enums.ts +1 -1
  269. package/src/util/icon_list.ts +15 -10
  270. package/src/util/icon_synonyms.ts +3 -99
  271. package/src/util/icons.tsx +11 -3
  272. package/src/util/index.ts +1 -0
  273. package/src/util/navigation_utils.ts +6 -6
  274. package/src/util/objects.ts +25 -28
  275. package/src/util/permissions.ts +12 -8
  276. package/src/util/plurals.ts +0 -2
  277. package/src/util/references.ts +36 -5
  278. package/src/util/resolutions.ts +44 -39
  279. package/src/util/storage.ts +75 -21
  280. package/src/util/strings.ts +2 -2
  281. package/src/util/useStorageUploadController.tsx +21 -3
  282. package/src/util/useTraceUpdate.tsx +2 -1
  283. package/dist/components/VirtualTable/common.d.ts +0 -2
  284. package/dist/core/Drawer.d.ts +0 -23
  285. package/dist/core/Scaffold.d.ts +0 -55
  286. package/dist/form/EntityForm.d.ts +0 -77
  287. package/dist/internal/EntityView.d.ts +0 -22
  288. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  289. package/dist/internal/useLocaleConfig.d.ts +0 -1
  290. package/dist/types/appcheck.d.ts +0 -26
  291. package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
  292. package/src/core/Drawer.tsx +0 -164
  293. package/src/core/Scaffold.tsx +0 -281
  294. package/src/form/EntityForm.tsx +0 -720
  295. package/src/internal/EntityView.tsx +0 -578
  296. package/src/internal/useBuildCustomizationController.tsx +0 -5
  297. package/src/internal/useLocaleConfig.tsx +0 -18
  298. package/src/types/appcheck.ts +0 -29
  299. /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
  300. /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
  301. /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
@@ -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,3 +1,4 @@
1
+ import React from "react";
1
2
  import { EntityCollection } from "./collections";
2
3
  import { EntityReference } from "./entities";
3
4
  /**
@@ -5,7 +6,7 @@ import { EntityReference } from "./entities";
5
6
  * attributes.
6
7
  * @group Models
7
8
  */
8
- export type NavigationController = {
9
+ export type NavigationController<EC extends EntityCollection = EntityCollection<any>> = {
9
10
  /**
10
11
  * List of the mapped collections in the CMS.
11
12
  * Each entry relates to a collection in the root database.
@@ -18,6 +19,11 @@ export type NavigationController = {
18
19
  * navigation
19
20
  */
20
21
  views?: CMSView[];
22
+ /**
23
+ * Custom additional views created by the developer, added to the admin
24
+ * navigation
25
+ */
26
+ adminViews?: CMSView[];
21
27
  /**
22
28
  * Configuration for the views that should be displayed at the top
23
29
  * level of the navigation (e.g. in the home page or the navigation
@@ -41,15 +47,15 @@ export type NavigationController = {
41
47
  * Get the collection configuration for a given path.
42
48
  * The collection is resolved from the given path or alias.
43
49
  */
44
- getCollection: <EC extends EntityCollection = EntityCollection<any>>(pathOrAlias: string, entityId?: string, includeUserOverride?: boolean) => EC | undefined;
50
+ getCollection: (pathOrId: string, includeUserOverride?: boolean) => EC | undefined;
45
51
  /**
46
- * Get the collection configuration from its parent path segments.
52
+ * Get the collection configuration from its parent ids.
47
53
  */
48
- getCollectionFromIds: <EC extends EntityCollection = EntityCollection<any>>(ids: string[]) => EC | undefined;
54
+ getCollectionFromIds: (ids: string[]) => EC | undefined;
49
55
  /**
50
56
  * Get the collection configuration from its parent path segments.
51
57
  */
52
- getCollectionFromPaths: <EC extends EntityCollection = EntityCollection<any>>(pathSegments: string[]) => EC | undefined;
58
+ getCollectionFromPaths: (pathSegments: string[]) => EC | undefined;
53
59
  /**
54
60
  * Default path under the navigation routes of the CMS will be created
55
61
  */
@@ -95,12 +101,6 @@ export type NavigationController = {
95
101
  * @param pathWithAliases
96
102
  */
97
103
  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;
104
104
  /**
105
105
  * Call this method to recalculate the navigation
106
106
  */
@@ -159,6 +159,7 @@ export interface CMSView {
159
159
  /**
160
160
  * Optional field used to group top level navigation entries under a
161
161
  * navigation view.
162
+ * This prop is ignored for admin views.
162
163
  */
163
164
  group?: string;
164
165
  }
@@ -166,11 +167,11 @@ export interface TopNavigationEntry {
166
167
  url: string;
167
168
  name: string;
168
169
  path: string;
169
- type: "collection" | "view";
170
+ type: "collection" | "view" | "admin";
170
171
  collection?: EntityCollection;
171
- view: CMSView;
172
+ view?: CMSView;
172
173
  description?: string;
173
- group?: string;
174
+ group: string;
174
175
  }
175
176
  export type TopNavigationResult = {
176
177
  navigationEntries: TopNavigationEntry[];
@@ -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
  */
@@ -60,4 +64,4 @@ export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCol
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, UserType extends User = User, M extends object = InferCollectionType<EC>> = (({ pathSegments, user, collection, authController }: PermissionsBuilderProps<EC, UserType, 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.
@@ -161,8 +169,8 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
161
169
  property: Property<T> | ResolvedProperty<T>;
162
170
  Field: React.ComponentType<FieldProps<T, any, M>>;
163
171
  plugin: FireCMSPlugin;
164
- path: string;
165
- collection: EC;
172
+ path?: string;
173
+ collection?: EC;
166
174
  };
167
175
  export interface PluginGenericProps<UserType extends User = User> {
168
176
  context: FireCMSContext<UserType>;
@@ -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<CMSType> ? "array" : T extends Record<string, any> ? "map" : never;
12
12
  /**
13
13
  * @group Entity properties
14
14
  */
@@ -97,7 +97,7 @@ 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.
@@ -207,7 +207,7 @@ export type PropertyBuilderProps<M extends Record<string, any> = any> = {
207
207
  * current value of the property, as well as the path and entity ID.
208
208
  * @group Entity properties
209
209
  */
210
- export type PropertyBuilder<T extends CMSType = any, M extends Record<string, any> = any> = ({ values, previousValues, propertyValue, path, entityId }: PropertyBuilderProps<M>) => Property<T> | null;
210
+ 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
211
  /**
212
212
  * @group Entity properties
213
213
  */
@@ -474,6 +474,14 @@ export interface ReferenceProperty extends BaseProperty<EntityReference> {
474
474
  * specified values are considered.
475
475
  */
476
476
  previewProperties?: string[];
477
+ /**
478
+ * Should the reference include the ID of the entity. Defaults to `true`
479
+ */
480
+ includeId?: boolean;
481
+ /**
482
+ * Should the reference include a link to the entity (open the entity details). Defaults to `true`
483
+ */
484
+ includeEntityLink?: boolean;
477
485
  }
478
486
  /**
479
487
  * Rules to validate any property. Some properties have specific rules
@@ -552,7 +560,7 @@ export interface ArrayPropertyValidationSchema extends PropertyValidationSchema
552
560
  * Additional configuration related to Storage related fields
553
561
  * @group Entity properties
554
562
  */
555
- export interface StorageConfig {
563
+ export type StorageConfig = {
556
564
  /**
557
565
  * File MIME types that can be uploaded to this reference. Don't specify for
558
566
  * all.
@@ -575,13 +583,13 @@ export interface StorageConfig {
575
583
  * You can use this prop to customize the uploaded filename.
576
584
  * You can use a function as a callback or a string where you
577
585
  * 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
586
+ * - `{file}` - Full file name
587
+ * - `{file.name}` - Name of the file without extension
588
+ * - `{file.ext}` - Extension of the file
589
+ * - `{rand}` - Random value used to avoid name collisions
590
+ * - `{entityId}` - ID of the entity
591
+ * - `{propertyKey}` - ID of this property
592
+ * - `{path}` - Path of this entity
585
593
  *
586
594
  * @param context
587
595
  */
@@ -591,13 +599,13 @@ export interface StorageConfig {
591
599
  *
592
600
  * You can use a function as a callback or a string where you
593
601
  * 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
602
+ * - `{file}` - Full file name
603
+ * - `{file.name}` - Name of the file without extension
604
+ * - `{file.ext}` - Extension of the file
605
+ * - `{rand}` - Random value used to avoid name collisions
606
+ * - `{entityId}` - ID of the entity
607
+ * - `{propertyKey}` - ID of this property
608
+ * - `{path}` - Path of this entity
601
609
  */
602
610
  storagePath: string | ((context: UploadedFileContext) => string);
603
611
  /**
@@ -620,7 +628,12 @@ export interface StorageConfig {
620
628
  * after it has been resolved.
621
629
  */
622
630
  postProcess?: (pathOrUrl: string) => Promise<string>;
623
- }
631
+ /**
632
+ * You can use this prop in order to provide a custom preview URL.
633
+ * Useful when the file's path is different from the original field value
634
+ */
635
+ previewUrl?: (fileName: string) => string;
636
+ };
624
637
  /**
625
638
  * @group Entity properties
626
639
  */
@@ -644,7 +657,7 @@ export interface UploadedFileContext {
644
657
  /**
645
658
  * Entity path. E.g. `products/PID/locales`
646
659
  */
647
- path: string;
660
+ path?: string;
648
661
  /**
649
662
  * Values of the current entity
650
663
  */
@@ -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.
@@ -39,4 +39,4 @@ export type PropertyConfig<T extends CMSType = any> = {
39
39
  */
40
40
  description?: string;
41
41
  };
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";
42
+ 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
+ };
@@ -6,6 +6,7 @@ export interface UploadFileProps {
6
6
  fileName?: string;
7
7
  path?: string;
8
8
  metadata?: any;
9
+ bucket?: string;
9
10
  }
10
11
  /**
11
12
  * @group Models
@@ -15,6 +16,10 @@ export interface UploadFileResult {
15
16
  * Storage path including the file name where the file was uploaded.
16
17
  */
17
18
  path: string;
19
+ /**
20
+ * Bucket where the file was uploaded
21
+ */
22
+ bucket: string;
18
23
  }
19
24
  /**
20
25
  * @group Models
@@ -66,17 +71,20 @@ export interface StorageSource {
66
71
  * @param fileName
67
72
  * @param path
68
73
  * @param metadata
74
+ * @param bucket
69
75
  */
70
- uploadFile: ({ file, fileName, path, metadata }: UploadFileProps) => Promise<UploadFileResult>;
76
+ uploadFile: ({ file, fileName, path, metadata, bucket }: UploadFileProps) => Promise<UploadFileResult>;
71
77
  /**
72
78
  * Convert a storage path or URL into a download configuration
73
79
  * @param path
80
+ * @param bucket
74
81
  */
75
- getDownloadURL: (pathOrUrl: string) => Promise<DownloadConfig>;
82
+ getDownloadURL: (pathOrUrl: string, bucket?: string) => Promise<DownloadConfig>;
76
83
  /**
77
84
  * Get a file from a storage path.
78
85
  * It returns null if the file does not exist.
79
86
  * @param props
87
+ * @param bucket
80
88
  */
81
- getFile: (path: string) => Promise<File | null>;
89
+ getFile: (path: string, bucket?: string) => Promise<File | null>;
82
90
  }
@@ -1,3 +1,4 @@
1
+ import { Role } from "./roles";
1
2
  /**
2
3
  * This interface represents a user.
3
4
  * It has some of the same fields as a Firebase User.
@@ -33,4 +34,8 @@ export type User = {
33
34
  *
34
35
  */
35
36
  readonly isAnonymous: boolean;
37
+ /**
38
+ *
39
+ */
40
+ roles?: Role[];
36
41
  };
@@ -1,3 +1,11 @@
1
- import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, PropertiesOrBuilders } from "../types";
1
+ import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, EntityCollection, PermissionsBuilder, PropertiesOrBuilders } from "../types";
2
2
  export declare function sortProperties<M extends Record<string, any>>(properties: PropertiesOrBuilders<M>, propertiesOrder?: (keyof M)[]): PropertiesOrBuilders<M>;
3
3
  export declare function resolveDefaultSelectedView(defaultSelectedView: string | DefaultSelectedViewBuilder | undefined, params: DefaultSelectedViewParams): string | undefined;
4
+ /**
5
+ * If a collection is not applying permissions, we apply the given permissionsBuilder.
6
+ * This is used to apply the role permissions to the collections, unless they are already
7
+ * applying permissions.
8
+ * @param collections
9
+ * @param permissionsBuilder
10
+ */
11
+ export declare const applyPermissionsFunctionIfEmpty: (collections: EntityCollection[], permissionsBuilder?: PermissionsBuilder<any, any>) => EntityCollection[];
@@ -23,6 +23,6 @@ export declare function updateDateAutoValues<M extends Record<string, any>>({ in
23
23
  * @group Datasource
24
24
  */
25
25
  export declare function sanitizeData<M extends Record<string, any>>(values: EntityValues<M>, properties: ResolvedProperties<M>): any;
26
- export declare function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference<M>;
26
+ export declare function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference;
27
27
  export declare function traverseValuesProperties<M extends Record<string, any>>(inputValues: Partial<EntityValues<M>>, properties: ResolvedProperties<M>, operation: (value: any, property: Property) => any): EntityValues<M> | undefined;
28
28
  export declare function traverseValueProperty(inputValue: any, property: Property, operation: (value: any, property: Property) => any): any;
@@ -1 +1,5 @@
1
- export declare const iconsSearch: any;
1
+ import Fuse from "fuse.js";
2
+ export declare const iconsSearch: Fuse<{
3
+ key: string;
4
+ synonyms: any;
5
+ }>;