@firecms/core 3.0.0-alpha.70 → 3.0.0-alpha.71

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 (225) hide show
  1. package/package.json +3 -3
  2. package/src/components/ArrayContainer.d.ts +42 -0
  3. package/src/components/CircularProgressCenter.d.ts +11 -0
  4. package/src/components/DeleteConfirmationDialog.d.ts +9 -0
  5. package/src/components/EntityCollectionTable/EntityCollectionTable.d.ts +30 -0
  6. package/src/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +106 -0
  7. package/src/components/EntityCollectionTable/fields/TableReferenceField.d.ts +15 -0
  8. package/src/components/EntityCollectionTable/fields/TableStorageUpload.d.ts +33 -0
  9. package/src/components/EntityCollectionTable/filters/BooleanFilterField.d.ts +9 -0
  10. package/src/components/EntityCollectionTable/filters/DateTimeFilterField.d.ts +11 -0
  11. package/src/components/EntityCollectionTable/filters/ReferenceFilterField.d.ts +14 -0
  12. package/src/components/EntityCollectionTable/filters/StringNumberFilterField.d.ts +13 -0
  13. package/src/components/EntityCollectionTable/index.d.ts +4 -0
  14. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +18 -0
  15. package/src/components/EntityCollectionTable/internal/DeleteEntityDialog.d.ts +12 -0
  16. package/src/components/EntityCollectionTable/internal/EntityCollectionRowActions.d.ts +35 -0
  17. package/src/components/EntityCollectionTable/internal/EntityTableCell.d.ts +26 -0
  18. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.d.ts +9 -0
  19. package/src/components/EntityCollectionTable/internal/PropertyTableCell.d.ts +18 -0
  20. package/src/components/EntityCollectionTable/internal/common.d.ts +4 -0
  21. package/src/components/EntityCollectionTable/internal/default_entity_actions.d.ts +6 -0
  22. package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +5 -0
  23. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +23 -0
  24. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +13 -0
  25. package/src/components/EntityCollectionTable/internal/popup_field/useWindowSize.d.ts +6 -0
  26. package/src/components/EntityCollectionTable/types.d.ts +39 -0
  27. package/src/components/EntityCollectionTable/useDebouncedData.d.ts +9 -0
  28. package/src/components/EntityCollectionTable/useEntityCollectionTableController.d.ts +21 -0
  29. package/src/components/EntityCollectionView/EntityCollectionView.d.ts +37 -0
  30. package/src/components/EntityCollectionView/EntityCollectionViewActions.d.ts +14 -0
  31. package/src/components/EntityCollectionView/useColumnsIds.d.ts +4 -0
  32. package/src/components/EntityPreview.d.ts +11 -0
  33. package/src/components/ErrorBoundary.d.ts +11 -0
  34. package/src/components/ErrorTooltip.d.ts +2 -0
  35. package/src/components/ErrorView.d.ts +19 -0
  36. package/src/components/FieldConfigBadge.d.ts +4 -0
  37. package/src/components/FireCMSAppBar.d.ts +26 -0
  38. package/src/components/FireCMSLogo.d.ts +7 -0
  39. package/src/components/HomePage/DefaultHomePage.d.ts +21 -0
  40. package/src/components/HomePage/FavouritesView.d.ts +3 -0
  41. package/src/components/HomePage/NavigationCollectionCard.d.ts +17 -0
  42. package/src/components/HomePage/NavigationGroup.d.ts +4 -0
  43. package/src/components/HomePage/index.d.ts +3 -0
  44. package/src/components/LabelWithIcon.d.ts +14 -0
  45. package/src/components/NotFoundPage.d.ts +1 -0
  46. package/src/components/ReferenceSelectionInner.d.ts +58 -0
  47. package/src/components/ReferenceWidget.d.ts +28 -0
  48. package/src/components/VirtualTable/VirtualTable.d.ts +11 -0
  49. package/src/components/VirtualTable/VirtualTableCell.d.ts +14 -0
  50. package/src/components/VirtualTable/VirtualTableHeader.d.ts +27 -0
  51. package/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +2 -0
  52. package/src/components/VirtualTable/VirtualTableProps.d.ts +215 -0
  53. package/src/components/VirtualTable/VirtualTableRow.d.ts +3 -0
  54. package/src/components/VirtualTable/common.d.ts +2 -0
  55. package/src/components/VirtualTable/fields/VirtualTableDateField.d.ts +11 -0
  56. package/src/components/VirtualTable/fields/VirtualTableInput.d.ts +8 -0
  57. package/src/components/VirtualTable/fields/VirtualTableNumberInput.d.ts +8 -0
  58. package/src/components/VirtualTable/fields/VirtualTableSelect.d.ts +15 -0
  59. package/src/components/VirtualTable/fields/VirtualTableSwitch.d.ts +7 -0
  60. package/src/components/VirtualTable/index.d.ts +2 -0
  61. package/src/components/VirtualTable/types.d.ts +34 -0
  62. package/src/components/index.d.ts +20 -0
  63. package/src/contexts/AuthControllerContext.d.ts +3 -0
  64. package/src/contexts/DataSourceContext.d.ts +3 -0
  65. package/src/contexts/DialogsProvider.d.ts +4 -0
  66. package/src/contexts/ModeController.d.ts +4 -0
  67. package/src/contexts/NavigationContext.d.ts +3 -0
  68. package/src/contexts/SideDialogsControllerContext.d.ts +3 -0
  69. package/src/contexts/SideEntityControllerContext.d.ts +3 -0
  70. package/src/contexts/SnackbarProvider.d.ts +2 -0
  71. package/src/contexts/StorageSourceContext.d.ts +3 -0
  72. package/src/contexts/UserConfigurationPersistenceContext.d.ts +3 -0
  73. package/src/contexts/index.d.ts +3 -0
  74. package/src/core/Drawer.d.ts +23 -0
  75. package/src/core/EntitySidePanel.d.ts +10 -0
  76. package/src/core/FireCMS.d.ts +14 -0
  77. package/src/core/NavigationRoutes.d.ts +21 -0
  78. package/src/core/Scaffold.d.ts +52 -0
  79. package/src/core/SideDialogs.d.ts +23 -0
  80. package/src/core/field_configs.d.ts +7 -0
  81. package/src/core/index.d.ts +10 -0
  82. package/src/core/useBuildLocalConfigurationPersistence.d.ts +2 -0
  83. package/src/core/useBuildModeController.d.ts +6 -0
  84. package/src/form/EntityForm.d.ts +75 -0
  85. package/src/form/PropertyFieldBinding.d.ts +30 -0
  86. package/src/form/components/CustomIdField.d.ts +9 -0
  87. package/src/form/components/ErrorFocus.d.ts +4 -0
  88. package/src/form/components/FieldHelperText.d.ts +12 -0
  89. package/src/form/components/FormikArrayContainer.d.ts +18 -0
  90. package/src/form/components/StorageItemPreview.d.ts +13 -0
  91. package/src/form/components/StorageUploadProgress.d.ts +10 -0
  92. package/src/form/components/SwitchControl.d.ts +8 -0
  93. package/src/form/components/index.d.ts +3 -0
  94. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +9 -0
  95. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +11 -0
  96. package/src/form/field_bindings/BlockFieldBinding.d.ts +10 -0
  97. package/src/form/field_bindings/DateTimeFieldBinding.d.ts +11 -0
  98. package/src/form/field_bindings/KeyValueFieldBinding.d.ts +7 -0
  99. package/src/form/field_bindings/MapFieldBinding.d.ts +9 -0
  100. package/src/form/field_bindings/MarkdownFieldBinding.d.ts +9 -0
  101. package/src/form/field_bindings/MultiSelectBinding.d.ts +9 -0
  102. package/src/form/field_bindings/ReadOnlyFieldBinding.d.ts +10 -0
  103. package/src/form/field_bindings/ReferenceFieldBinding.d.ts +9 -0
  104. package/src/form/field_bindings/RepeatFieldBinding.d.ts +10 -0
  105. package/src/form/field_bindings/SelectFieldBinding.d.ts +12 -0
  106. package/src/form/field_bindings/StorageUploadFieldBinding.d.ts +28 -0
  107. package/src/form/field_bindings/SwitchFieldBinding.d.ts +12 -0
  108. package/src/form/field_bindings/TextFieldBinding.d.ts +12 -0
  109. package/src/form/index.d.ts +20 -0
  110. package/src/form/useClearRestoreValue.d.ts +13 -0
  111. package/src/form/validation.d.ts +25 -0
  112. package/src/hooks/data/delete.d.ts +37 -0
  113. package/src/hooks/data/save.d.ts +42 -0
  114. package/src/hooks/data/useCollectionFetch.d.ts +50 -0
  115. package/src/hooks/data/useDataOrder.d.ts +12 -0
  116. package/src/hooks/data/useDataSource.d.ts +6 -0
  117. package/src/hooks/data/useEntityFetch.d.ts +28 -0
  118. package/src/hooks/index.d.ts +19 -0
  119. package/src/hooks/useAuthController.d.ts +11 -0
  120. package/src/hooks/useBrowserTitleAndIcon.d.ts +6 -0
  121. package/src/hooks/useClipboard.d.ts +57 -0
  122. package/src/hooks/useDialogsController.d.ts +11 -0
  123. package/src/hooks/useFireCMSContext.d.ts +12 -0
  124. package/src/hooks/useLargeLayout.d.ts +1 -0
  125. package/src/hooks/useModeController.d.ts +20 -0
  126. package/src/hooks/useNavigationController.d.ts +9 -0
  127. package/src/hooks/useReferenceDialog.d.ts +18 -0
  128. package/src/hooks/useResolvedNavigationFrom.d.ts +72 -0
  129. package/src/hooks/useSideDialogsController.d.ts +18 -0
  130. package/src/hooks/useSideEntityController.d.ts +12 -0
  131. package/src/hooks/useSnackbarController.d.ts +41 -0
  132. package/src/hooks/useStorageSource.d.ts +6 -0
  133. package/src/hooks/useUserConfigurationPersistence.d.ts +8 -0
  134. package/src/index.d.ts +8 -0
  135. package/src/internal/EntityView.d.ts +22 -0
  136. package/src/internal/common.d.ts +3 -0
  137. package/src/internal/useBuildDataSource.d.ts +22 -0
  138. package/src/internal/useBuildNavigationController.d.ts +14 -0
  139. package/src/internal/useBuildSideDialogsController.d.ts +2 -0
  140. package/src/internal/useBuildSideEntityController.d.ts +4 -0
  141. package/src/internal/useLocaleConfig.d.ts +1 -0
  142. package/src/internal/useRestoreScroll.d.ts +6 -0
  143. package/src/internal/useUnsavedChangesDialog.d.ts +14 -0
  144. package/src/preview/PropertyPreview.d.ts +7 -0
  145. package/src/preview/PropertyPreviewProps.d.ts +43 -0
  146. package/src/preview/components/ArrayEnumPreview.d.ts +11 -0
  147. package/src/preview/components/AsyncPreviewComponent.d.ts +11 -0
  148. package/src/preview/components/BooleanPreview.d.ts +7 -0
  149. package/src/preview/components/DatePreview.d.ts +7 -0
  150. package/src/preview/components/EmptyValue.d.ts +4 -0
  151. package/src/preview/components/EnumValuesChip.d.ts +13 -0
  152. package/src/preview/components/ImagePreview.d.ts +12 -0
  153. package/src/preview/components/ReferencePreview.d.ts +22 -0
  154. package/src/preview/components/StorageThumbnail.d.ts +13 -0
  155. package/src/preview/components/UrlComponentPreview.d.ts +12 -0
  156. package/src/preview/index.d.ts +23 -0
  157. package/src/preview/property_previews/ArrayOfMapsPreview.d.ts +5 -0
  158. package/src/preview/property_previews/ArrayOfReferencesPreview.d.ts +5 -0
  159. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +5 -0
  160. package/src/preview/property_previews/ArrayOfStringsPreview.d.ts +5 -0
  161. package/src/preview/property_previews/ArrayOneOfPreview.d.ts +5 -0
  162. package/src/preview/property_previews/ArrayPropertyEnumPreview.d.ts +5 -0
  163. package/src/preview/property_previews/ArrayPropertyPreview.d.ts +5 -0
  164. package/src/preview/property_previews/MapPropertyPreview.d.ts +8 -0
  165. package/src/preview/property_previews/NumberPropertyPreview.d.ts +6 -0
  166. package/src/preview/property_previews/SkeletonPropertyComponent.d.ts +14 -0
  167. package/src/preview/property_previews/StringPropertyPreview.d.ts +6 -0
  168. package/src/preview/util.d.ts +7 -0
  169. package/src/types/analytics.d.ts +1 -0
  170. package/src/types/appcheck.d.ts +26 -0
  171. package/src/types/auth.d.ts +40 -0
  172. package/src/types/collections.d.ts +451 -0
  173. package/src/types/datasource.d.ts +262 -0
  174. package/src/types/dialogs_controller.d.ts +32 -0
  175. package/src/types/entities.d.ts +57 -0
  176. package/src/types/entity_actions.d.ts +35 -0
  177. package/src/types/entity_callbacks.d.ts +171 -0
  178. package/src/types/entity_link_builder.d.ts +7 -0
  179. package/src/types/export_import.d.ts +21 -0
  180. package/src/types/fields.d.ts +181 -0
  181. package/src/types/firecms.d.ts +151 -0
  182. package/src/types/firecms_context.d.ts +110 -0
  183. package/src/types/index.d.ts +26 -0
  184. package/src/types/local_config_persistence.d.ts +21 -0
  185. package/src/types/locales.d.ts +4 -0
  186. package/src/types/modify_collections.d.ts +5 -0
  187. package/src/types/navigation.d.ts +178 -0
  188. package/src/types/permissions.d.ts +63 -0
  189. package/src/types/plugins.d.ts +179 -0
  190. package/src/types/properties.d.ts +681 -0
  191. package/src/types/property_config.d.ts +42 -0
  192. package/src/types/resolved_entities.d.ts +98 -0
  193. package/src/types/side_dialogs_controller.d.ts +57 -0
  194. package/src/types/side_entity_controller.d.ts +83 -0
  195. package/src/types/storage.d.ts +82 -0
  196. package/src/types/user.d.ts +36 -0
  197. package/src/util/arrays.d.ts +1 -0
  198. package/src/util/builders.d.ts +64 -0
  199. package/src/util/chip_utils.d.ts +3 -0
  200. package/src/util/collections.d.ts +3 -0
  201. package/src/util/common.d.ts +2 -0
  202. package/src/util/dates.d.ts +1 -0
  203. package/src/util/entities.d.ts +28 -0
  204. package/src/util/enums.d.ts +7 -0
  205. package/src/util/flatten_object.d.ts +3 -0
  206. package/src/util/hash.d.ts +1 -0
  207. package/src/util/icons.d.ts +4 -0
  208. package/src/util/index.d.ts +20 -0
  209. package/src/util/join_collections.d.ts +9 -0
  210. package/src/util/make_properties_editable.d.ts +3 -0
  211. package/src/util/navigation_from_path.d.ts +24 -0
  212. package/src/util/navigation_utils.d.ts +20 -0
  213. package/src/util/objects.d.ts +10 -0
  214. package/src/util/parent_references_from_path.d.ts +6 -0
  215. package/src/util/paths.d.ts +14 -0
  216. package/src/util/permissions.d.ts +5 -0
  217. package/src/util/plurals.d.ts +18 -0
  218. package/src/util/property_utils.d.ts +23 -0
  219. package/src/util/references.d.ts +2 -0
  220. package/src/util/regexp.d.ts +7 -0
  221. package/src/util/resolutions.d.ts +64 -0
  222. package/src/util/storage.d.ts +3 -0
  223. package/src/util/strings.d.ts +6 -0
  224. package/src/util/useDebounce.d.ts +1 -0
  225. package/src/util/useStorageUploadController.d.ts +36 -0
@@ -0,0 +1,451 @@
1
+ import React, { Dispatch, SetStateAction } from "react";
2
+ import { Entity, EntityStatus, EntityValues } from "./entities";
3
+ import { User } from "./user";
4
+ import { FireCMSContext } from "./firecms_context";
5
+ import { EntityCallbacks } from "./entity_callbacks";
6
+ import { Permissions, PermissionsBuilder } from "./permissions";
7
+ import { EnumValues, PropertiesOrBuilders } from "./properties";
8
+ import { FormContext } from "./fields";
9
+ import { EntityAction } from "./entity_actions";
10
+ import { ExportConfig } from "./export_import";
11
+ /**
12
+ * This interface represents a view that includes a collection of entities.
13
+ * It can be in the root level of the configuration, defining the main
14
+ * menu navigation. You can also find it as a subcollection of a different one.
15
+ *
16
+ * @group Models
17
+ */
18
+ export interface EntityCollection<M extends Record<string, any> = any, UserType extends User = User> {
19
+ /**
20
+ * You can set an alias that will be used internally instead of the `path`.
21
+ * The `alias` value will be used to determine the URL of the collection,
22
+ * while `path` will still be used in the datasource.
23
+ * Note that you can use this value in reference properties too.
24
+ */
25
+ id: string;
26
+ /**
27
+ * Name of the collection, typically plural.
28
+ * E.g. `Products`, `Blog`
29
+ */
30
+ name: string;
31
+ /**
32
+ * Singular name of an entry in this collection
33
+ * E.g. `Product`, `Blog entry`
34
+ */
35
+ singularName?: string;
36
+ /**
37
+ * Optional description of this view. You can use Markdown.
38
+ */
39
+ description?: string;
40
+ /**
41
+ * Relative path of this view to its parent.
42
+ * If this view is in the root the path is equal to the absolute one.
43
+ * This path also determines the URL in FireCMS, unless an alias is specified
44
+ */
45
+ path: string;
46
+ /**
47
+ * If this collection is a top level navigation entry, you can set this
48
+ * property to `true` to indicate that this collection is a collection group.
49
+ */
50
+ collectionGroup?: boolean;
51
+ /**
52
+ * Icon key to use in this collection.
53
+ * You can use any of the icons in the Material specs:
54
+ * https://fonts.google.com/icons
55
+ * e.g. 'account_tree' or 'person'
56
+ */
57
+ icon?: string;
58
+ /**
59
+ * Optional field used to group top level navigation entries under a~
60
+ * navigation view. If you set this value in a subcollection it has no
61
+ * effect.
62
+ */
63
+ group?: string;
64
+ /**
65
+ * Set of properties that compose an entity
66
+ */
67
+ properties: PropertiesOrBuilders<M>;
68
+ /**
69
+ * Can this collection be edited by the end user.
70
+ * Defaults to `true`.
71
+ * Keep in mind that you can also set this prop to individual properties.
72
+ */
73
+ editable?: boolean;
74
+ /**
75
+ * Order in which the properties are displayed.
76
+ * If you are specifying your collection as code, the order is the same as the
77
+ * one you define in `properties`. Additional columns are added at the
78
+ * end of the list, if the order is not specified.
79
+ * You can use this prop to hide some properties from the table view.
80
+ * Note that if you set this prop, other ways to hide fields, like
81
+ * `hidden` in the property definition, will be ignored.
82
+ * `propertiesOrder` has precedence over `hidden`.
83
+ * - For properties use the property key.
84
+ * - For additional columns use the column id.
85
+ * - If you have subcollections, you get a column for each subcollection,
86
+ * with the path (or alias) as the subcollection, prefixed with
87
+ * `subcollection:`. e.g. `subcollection:orders`.
88
+ * - If you are using a collection group, you will also have an
89
+ * additional `collectionGroupParent` column.
90
+ */
91
+ propertiesOrder?: Extract<keyof M, string>[];
92
+ /**
93
+ * If enabled, content is loaded in batches. If `false` all entities in the
94
+ * collection are loaded.
95
+ * You can specify a number to specify the pagination size (50 by default)
96
+ * Defaults to `true`
97
+ */
98
+ pagination?: boolean | number;
99
+ /**
100
+ * Flag to indicate if a search bar should be displayed on top of
101
+ * the collection table.
102
+ */
103
+ textSearchEnabled?: boolean;
104
+ /**
105
+ * Permissions the logged-in user can perform on this collection.
106
+ * If not specified everything defaults to `true`.
107
+ */
108
+ permissions?: Permissions | PermissionsBuilder<EntityCollection, UserType, M>;
109
+ /**
110
+ * Are the entities in this collection selectable. Defaults to `true`
111
+ */
112
+ selectionEnabled?: boolean;
113
+ /**
114
+ * You can add subcollections to your entity in the same way you define the root
115
+ * collections. The collections added here will be displayed when opening
116
+ * the side dialog of an entity.
117
+ */
118
+ subcollections?: EntityCollection<any, any>[];
119
+ /**
120
+ * This interface defines all the callbacks that can be used when an entity
121
+ * is being created, updated or deleted.
122
+ * Useful for adding your own logic or blocking the execution of the operation.
123
+ */
124
+ callbacks?: EntityCallbacks<M>;
125
+ /**
126
+ * Builder for rendering additional components such as buttons in the
127
+ * collection toolbar
128
+ */
129
+ Actions?: React.ComponentType<CollectionActionsProps> | React.ComponentType<CollectionActionsProps>[];
130
+ /**
131
+ * You can define additional actions that can be performed on the entities
132
+ * in this collection. These actions can be displayed in the collection
133
+ * view or in the entity view.
134
+ *
135
+ * You can use the `onClick` method to implement your own logic.
136
+ * In the `context` prop you can access all the controllers of FireCMS.
137
+ *
138
+ * ```
139
+ * const archiveEntityAction: EntityAction = {
140
+ * icon: <ArchiveIcon/>,
141
+ * name: "Archive",
142
+ * onClick({
143
+ * entity,
144
+ * collection,
145
+ * context,
146
+ * }): Promise<void> {
147
+ * // Add your code here
148
+ * return Promise.resolve(undefined);
149
+ * }
150
+ * }
151
+ * ```
152
+ */
153
+ entityActions?: EntityAction<M, UserType>[];
154
+ /**
155
+ * Pass your own selection controller if you want to control selected
156
+ * entities externally.
157
+ * @see useSelectionController
158
+ */
159
+ selectionController?: SelectionController<M>;
160
+ /**
161
+ * If this property is not set, the property will be created by the
162
+ * datasource.
163
+ * You can set the value to true to allow the users to choose the ID.
164
+ * You can also pass a set of values (as an EnumValues object) to allow them
165
+ * to pick from only those.
166
+ */
167
+ customId?: boolean | EnumValues | "optional";
168
+ /**
169
+ * Force a filter in this view. If applied, the rest of the filters will
170
+ * be disabled. Filters applied with this prop cannot be changed.
171
+ * e.g. `forceFilter: { age: [">=", 18] }`
172
+ */
173
+ forceFilter?: FilterValues<Extract<keyof M, string>>;
174
+ /**
175
+ * Initial filters applied to the collection this collection is related to.
176
+ * Defaults to none. Filters applied with this prop can be changed.
177
+ * e.g. `initialFilter: { age: [">=", 18] }`
178
+ */
179
+ initialFilter?: FilterValues<Extract<keyof M, string>>;
180
+ /**
181
+ * Default sort applied to this collection.
182
+ * When setting this prop, entities will have a default order
183
+ * applied in the collection.
184
+ * e.g. `initialSort: ["order", "asc"]`
185
+ */
186
+ initialSort?: [Extract<keyof M, string>, "asc" | "desc"];
187
+ /**
188
+ * Array of builders for rendering additional panels in an entity view.
189
+ * Useful if you need to render custom views.
190
+ * You can either define the custom view inline or pass a reference to
191
+ * a custom view defined in the main configuration under `entityViews`
192
+ */
193
+ entityViews?: (string | EntityCustomView<M>)[];
194
+ /**
195
+ * You can add additional fields to the collection view by implementing
196
+ * an additional field delegate.
197
+ */
198
+ additionalFields?: AdditionalFieldDelegate<M, UserType>[];
199
+ /**
200
+ * Default size of the rendered collection
201
+ */
202
+ defaultSize?: CollectionSize;
203
+ /**
204
+ * Can the elements in this collection be edited inline in the collection
205
+ * view. If this flag is set to false but `permissions.edit` is `true`, entities
206
+ * can still be edited in the side panel
207
+ */
208
+ inlineEditing?: boolean;
209
+ /**
210
+ * Should this collection be hidden from the main navigation panel, if
211
+ * it is at the root level, or in the entity side panel if it's a
212
+ * subcollection.
213
+ * It will still be accessible if you reach the specified path.
214
+ * You can also use this collection as a reference target.
215
+ */
216
+ hideFromNavigation?: boolean;
217
+ /**
218
+ * If you want to open custom views or subcollections by default when opening the edit
219
+ * view of an entity, you can specify the path to the view here.
220
+ * The path is relative to the current collection. For example if you have a collection
221
+ * that has a custom view as well as a subcollection that refers to another entity, you can
222
+ * either specify the path to the custom view or the path to the subcollection.
223
+ */
224
+ defaultSelectedView?: string | DefaultSelectedViewBuilder;
225
+ /**
226
+ * Should the ID of this collection be hidden from the form view.
227
+ */
228
+ hideIdFromForm?: boolean;
229
+ /**
230
+ * Should the ID of this collection be hidden from the grid view.
231
+ */
232
+ hideIdFromCollection?: boolean;
233
+ /**
234
+ * If set to true, the form will be auto-saved when the user changes
235
+ * the value of a field.
236
+ * Defaults to false.
237
+ * You can't use this prop if you are using a `customId`
238
+ */
239
+ formAutoSave?: boolean;
240
+ /**
241
+ *
242
+ */
243
+ exportable?: boolean | ExportConfig<UserType>;
244
+ }
245
+ /**
246
+ * Parameter passed to the `Actions` prop in the collection configuration.
247
+ * The component will receive this prop when it is rendered in the collection
248
+ * toolbar.
249
+ *
250
+ * @group Models
251
+ */
252
+ export interface CollectionActionsProps<M extends Record<string, any> = any, UserType extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
253
+ /**
254
+ * Full collection path of this entity. This is the full path, like
255
+ * `users/1234/addresses`
256
+ */
257
+ path: string;
258
+ /**
259
+ * Path of the last collection, like `addresses`
260
+ */
261
+ relativePath: string;
262
+ /**
263
+ * Array of the parent path segments like `['users']`
264
+ */
265
+ parentCollectionIds: string[];
266
+ /**
267
+ * The collection configuration
268
+ */
269
+ collection: EC;
270
+ /**
271
+ * Use this controller to get the selected entities and to update the
272
+ * selected entities state.
273
+ */
274
+ selectionController: SelectionController<M>;
275
+ /**
276
+ * Use this controller to get the table controller and to update the
277
+ * table controller state.
278
+ */
279
+ tableController: TableController<M>;
280
+ /**
281
+ * Context of the app status
282
+ */
283
+ context: FireCMSContext<UserType>;
284
+ /**
285
+ * Count of the entities in this collection
286
+ */
287
+ collectionEntitiesCount: number;
288
+ }
289
+ /**
290
+ * Use this controller to retrieve the selected entities or modify them in
291
+ * an {@link EntityCollection}
292
+ * If you want to pass a `SelectionController` to
293
+ * @group Models
294
+ */
295
+ export type SelectionController<M extends Record<string, any> = any> = {
296
+ selectedEntities: Entity<M>[];
297
+ setSelectedEntities: Dispatch<SetStateAction<Entity<M>[]>>;
298
+ isEntitySelected: (entity: Entity<M>) => boolean;
299
+ toggleEntitySelection: (entity: Entity<M>) => void;
300
+ };
301
+ /**
302
+ * Filter conditions in a `Query.where()` clause are specified using the
303
+ * strings '<', '<=', '==', '>=', '>', 'array-contains', 'in', and 'array-contains-any'.
304
+ * @group Models
305
+ */
306
+ export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-contains" | "in" | "not-in" | "array-contains-any";
307
+ /**
308
+ * Used to define filters applied in collections
309
+ * @group Models
310
+ */
311
+ export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, any]>>;
312
+ /**
313
+ * Used to indicate valid filter combinations (e.g. created in Firestore)
314
+ * If the user selects a specific filter/sort combination, the CMS checks if it's
315
+ * valid, otherwise it reverts to the simpler valid case
316
+ * @group Models
317
+ */
318
+ export type FilterCombination<Key extends string> = Partial<Record<Key, "asc" | "desc">>;
319
+ /**
320
+ * Sizes in which a collection can be rendered
321
+ * @group Models
322
+ */
323
+ export type CollectionSize = "xs" | "s" | "m" | "l" | "xl";
324
+ export type AdditionalFieldDelegateProps<M extends Record<string, any> = any, UserType extends User = User> = {
325
+ entity: Entity<M>;
326
+ context: FireCMSContext<UserType>;
327
+ };
328
+ /**
329
+ * Use this interface for adding additional fields to entity collection views.
330
+ * If you need to do some async loading you can use {@link AsyncPreviewComponent}
331
+ * @group Models
332
+ */
333
+ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, UserType extends User = User> {
334
+ /**
335
+ * ID of this column. You can use this id in the `properties` field of the
336
+ * collection in any order you want
337
+ */
338
+ key: string;
339
+ /**
340
+ * Header of this column
341
+ */
342
+ name: string;
343
+ /**
344
+ * Width of the generated column in pixels
345
+ */
346
+ width?: number;
347
+ /**
348
+ * Builder for the content of the cell for this column
349
+ */
350
+ Builder?: React.ComponentType<AdditionalFieldDelegateProps<M, UserType>>;
351
+ /**
352
+ * If this column needs to update dynamically based on other properties,
353
+ * you can define an array of keys as strings with the
354
+ * `dependencies` prop.
355
+ * e.g. ["name", "surname"]
356
+ * This is a performance optimization, if you don't define dependencies
357
+ * it will be updated in every render.
358
+ */
359
+ dependencies?: Extract<keyof M, string>[];
360
+ /**
361
+ * Use this prop to define the value of the column as a string or number.
362
+ * This is the value that will be used for exporting the collection.
363
+ * If `Builder` is defined, this prop will be ignored in the collection
364
+ * view.
365
+ * @param entity
366
+ */
367
+ value?: (props: {
368
+ entity: Entity<M>;
369
+ context: FireCMSContext;
370
+ }) => string | number | Promise<string | number> | undefined;
371
+ }
372
+ /**
373
+ * You can use this builder to render a custom panel in the entity detail view.
374
+ * It gets rendered as a tab.
375
+ * @group Models
376
+ */
377
+ export type EntityCustomView<M extends Record<string, any> = any> = {
378
+ key: string;
379
+ name: string;
380
+ Builder?: React.ComponentType<EntityCustomViewParams<M>>;
381
+ };
382
+ /**
383
+ * Parameters passed to the builder in charge of rendering a custom panel for
384
+ * an entity view.
385
+ * @group Models
386
+ */
387
+ export interface EntityCustomViewParams<M extends Record<string, any> = any> {
388
+ /**
389
+ * collection used by this entity
390
+ */
391
+ collection: EntityCollection<M>;
392
+ /**
393
+ * Entity that this view refers to. It can be undefined if the entity is new
394
+ */
395
+ entity?: Entity<M>;
396
+ /**
397
+ * Modified values in the form that have not been saved yet.
398
+ * If the entity is not new and the values are not modified, these values
399
+ * are the same as in `entity`
400
+ */
401
+ modifiedValues?: EntityValues<M>;
402
+ /**
403
+ * Use the form context to access the form state and methods
404
+ */
405
+ formContext: FormContext;
406
+ }
407
+ export type InferCollectionType<S extends EntityCollection> = S extends EntityCollection<infer M> ? M : never;
408
+ /**
409
+ * Used in the {@link EntityCollection#defaultSelectedView} to define the default
410
+ * @group Models
411
+ */
412
+ export type DefaultSelectedViewBuilder = (params: DefaultSelectedViewParams) => string | undefined;
413
+ /**
414
+ * Used in the {@link EntityCollection#defaultSelectedView} to define the default
415
+ * @group Models
416
+ */
417
+ export type DefaultSelectedViewParams = {
418
+ status?: EntityStatus;
419
+ entityId?: string;
420
+ };
421
+ /**
422
+ * You can use this controller to control the table view of a collection.
423
+ */
424
+ export type TableController<M extends Record<string, any> = any> = {
425
+ data: Entity<M>[];
426
+ dataLoading: boolean;
427
+ noMoreToLoad: boolean;
428
+ dataLoadingError?: Error;
429
+ filterValues?: FilterValues<Extract<keyof M, string>>;
430
+ setFilterValues?: (filterValues: FilterValues<Extract<keyof M, string>>) => void;
431
+ sortBy?: [Extract<keyof M, string>, "asc" | "desc"];
432
+ setSortBy?: (sortBy: [Extract<keyof M, string>, "asc" | "desc"]) => void;
433
+ searchString?: string;
434
+ setSearchString?: (searchString?: string) => void;
435
+ clearFilter?: () => void;
436
+ itemCount?: number;
437
+ setItemCount?: (itemCount: number) => void;
438
+ paginationEnabled?: boolean;
439
+ pageSize?: number;
440
+ checkFilterCombination?: (filterValues: FilterValues<any>, sortBy?: [string, "asc" | "desc"]) => boolean;
441
+ popupCell?: SelectedCellProps<M>;
442
+ setPopupCell?: (popupCell?: SelectedCellProps<M>) => void;
443
+ onAddColumn?: (column: string) => void;
444
+ };
445
+ export type SelectedCellProps<M extends Record<string, any>> = {
446
+ propertyKey: Extract<keyof M, string>;
447
+ cellRect: DOMRect;
448
+ width: number;
449
+ height: number;
450
+ entity: Entity<M>;
451
+ };