@firecms/core 3.0.0-canary.144 → 3.0.0-canary.145
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.
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +2 -2
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +1 -1
- package/dist/core/EntityEditView.d.ts +1 -1
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/hooks/data/delete.d.ts +4 -4
- package/dist/hooks/data/save.d.ts +3 -3
- package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/useAuthController.d.ts +1 -1
- package/dist/hooks/useBuildNavigationController.d.ts +3 -3
- package/dist/hooks/useFireCMSContext.d.ts +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
- package/dist/index.es.js +70 -67
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +70 -67
- package/dist/index.umd.js.map +1 -1
- package/dist/types/auth.d.ts +8 -6
- package/dist/types/collections.d.ts +12 -12
- package/dist/types/datasource.d.ts +0 -4
- package/dist/types/entity_actions.d.ts +4 -4
- package/dist/types/entity_callbacks.d.ts +16 -16
- package/dist/types/export_import.d.ts +4 -4
- package/dist/types/firecms.d.ts +2 -2
- package/dist/types/firecms_context.d.ts +1 -1
- package/dist/types/permissions.d.ts +4 -4
- package/dist/types/plugins.d.ts +8 -8
- package/dist/types/user.d.ts +1 -0
- package/dist/util/builders.d.ts +2 -2
- package/dist/util/permissions.d.ts +4 -4
- package/package.json +5 -5
- package/src/app/Scaffold.tsx +2 -2
- package/src/components/ArrayContainer.tsx +1 -1
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +5 -5
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +2 -2
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +4 -4
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -3
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +3 -3
- package/src/components/EntityPreview.tsx +2 -2
- package/src/components/EntityView.tsx +4 -4
- package/src/components/HomePage/FavouritesView.tsx +1 -1
- package/src/components/HomePage/NavigationCard.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/PropertyConfigBadge.tsx +1 -1
- package/src/components/PropertyIdCopyTooltip.tsx +1 -1
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -1
- package/src/components/SelectableTable/SelectableTable.tsx +2 -2
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +1 -1
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +1 -1
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +2 -2
- package/src/core/DefaultDrawer.tsx +2 -2
- package/src/core/DrawerNavigationItem.tsx +3 -3
- package/src/core/EntityEditView.tsx +4 -4
- package/src/core/FireCMS.tsx +1 -1
- package/src/core/SideDialogs.tsx +1 -1
- package/src/core/field_configs.tsx +1 -1
- package/src/form/components/StorageItemPreview.tsx +2 -2
- package/src/form/field_bindings/MapFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +3 -3
- package/src/hooks/data/delete.ts +4 -4
- package/src/hooks/data/save.ts +3 -3
- package/src/hooks/data/useCollectionFetch.tsx +2 -2
- package/src/hooks/data/useEntityFetch.tsx +5 -5
- package/src/hooks/useAuthController.tsx +1 -1
- package/src/hooks/useBuildNavigationController.tsx +7 -6
- package/src/hooks/useFireCMSContext.tsx +5 -5
- package/src/hooks/useResolvedNavigationFrom.tsx +5 -5
- package/src/hooks/useValidateAuthenticator.tsx +3 -3
- package/src/preview/components/EmptyValue.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +2 -2
- package/src/preview/components/UrlComponentPreview.tsx +1 -1
- package/src/types/auth.tsx +8 -8
- package/src/types/collections.ts +12 -12
- package/src/types/datasource.ts +0 -5
- package/src/types/entity_actions.tsx +4 -4
- package/src/types/entity_callbacks.ts +18 -18
- package/src/types/export_import.ts +4 -4
- package/src/types/firecms.tsx +2 -2
- package/src/types/firecms_context.tsx +1 -1
- package/src/types/permissions.ts +5 -5
- package/src/types/plugins.tsx +8 -8
- package/src/types/user.ts +2 -0
- package/src/util/builders.ts +6 -6
- package/src/util/permissions.ts +8 -8
package/src/types/plugins.tsx
CHANGED
|
@@ -166,7 +166,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
166
166
|
*
|
|
167
167
|
* @group Models
|
|
168
168
|
*/
|
|
169
|
-
export interface PluginHomePageActionsProps<EP extends object = object, M extends Record<string, any> = any,
|
|
169
|
+
export interface PluginHomePageActionsProps<EP extends object = object, M extends Record<string, any> = any, USER extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
|
|
170
170
|
/**
|
|
171
171
|
* Collection path of this entity. This is the full path, like
|
|
172
172
|
* `users/1234/addresses`
|
|
@@ -181,19 +181,19 @@ export interface PluginHomePageActionsProps<EP extends object = object, M extend
|
|
|
181
181
|
/**
|
|
182
182
|
* Context of the app status
|
|
183
183
|
*/
|
|
184
|
-
context: FireCMSContext<
|
|
184
|
+
context: FireCMSContext<USER>;
|
|
185
185
|
|
|
186
186
|
extraProps?: EP;
|
|
187
187
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
export interface PluginFormActionProps<
|
|
190
|
+
export interface PluginFormActionProps<USER extends User = User, EC extends EntityCollection = EntityCollection> {
|
|
191
191
|
entityId?: string;
|
|
192
192
|
path: string;
|
|
193
193
|
status: EntityStatus;
|
|
194
194
|
collection: EC;
|
|
195
195
|
formContext?: FormContext<any>;
|
|
196
|
-
context: FireCMSContext<
|
|
196
|
+
context: FireCMSContext<USER>;
|
|
197
197
|
currentEntityId?: string;
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -207,11 +207,11 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
|
|
|
207
207
|
collection?: EC;
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
export interface PluginGenericProps<
|
|
211
|
-
context: FireCMSContext<
|
|
210
|
+
export interface PluginGenericProps<USER extends User = User> {
|
|
211
|
+
context: FireCMSContext<USER>;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
export interface PluginHomePageAdditionalCardsProps<
|
|
214
|
+
export interface PluginHomePageAdditionalCardsProps<USER extends User = User> {
|
|
215
215
|
group?: string;
|
|
216
|
-
context: FireCMSContext<
|
|
216
|
+
context: FireCMSContext<USER>;
|
|
217
217
|
}
|
package/src/types/user.ts
CHANGED
package/src/util/builders.ts
CHANGED
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
* @group Builder
|
|
28
28
|
*/
|
|
29
29
|
export function buildCollection<M extends Record<string, any> = any,
|
|
30
|
-
|
|
31
|
-
collection: EntityCollection<M,
|
|
32
|
-
): EntityCollection<M,
|
|
30
|
+
USER extends User = User>(
|
|
31
|
+
collection: EntityCollection<M, USER>
|
|
32
|
+
): EntityCollection<M, USER> {
|
|
33
33
|
return collection;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -120,9 +120,9 @@ export function buildEntityCallbacks<M extends Record<string, any> = any>(
|
|
|
120
120
|
* @param additionalFieldDelegate
|
|
121
121
|
* @group Builder
|
|
122
122
|
*/
|
|
123
|
-
export function buildAdditionalFieldDelegate<M extends Record<string, any>,
|
|
124
|
-
additionalFieldDelegate: AdditionalFieldDelegate<M,
|
|
125
|
-
): AdditionalFieldDelegate<M,
|
|
123
|
+
export function buildAdditionalFieldDelegate<M extends Record<string, any>, USER extends User = User>(
|
|
124
|
+
additionalFieldDelegate: AdditionalFieldDelegate<M, USER>
|
|
125
|
+
): AdditionalFieldDelegate<M, USER> {
|
|
126
126
|
return additionalFieldDelegate;
|
|
127
127
|
}
|
|
128
128
|
|
package/src/util/permissions.ts
CHANGED
|
@@ -8,9 +8,9 @@ const DEFAULT_PERMISSIONS = {
|
|
|
8
8
|
delete: true
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export function resolvePermissions<M extends Record<string, any>,
|
|
11
|
+
export function resolvePermissions<M extends Record<string, any>, USER extends User>
|
|
12
12
|
(collection: EntityCollection<M>,
|
|
13
|
-
authController: AuthController<
|
|
13
|
+
authController: AuthController<USER>,
|
|
14
14
|
path: string,
|
|
15
15
|
entity: Entity<M> | null): Permissions | undefined {
|
|
16
16
|
|
|
@@ -34,29 +34,29 @@ export function resolvePermissions<M extends Record<string, any>, UserType exten
|
|
|
34
34
|
throw Error("New type of permission added and not mapped");
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export function canEditEntity<M extends Record<string, any>,
|
|
37
|
+
export function canEditEntity<M extends Record<string, any>, USER extends User>
|
|
38
38
|
(
|
|
39
39
|
collection: EntityCollection<M>,
|
|
40
|
-
authController: AuthController<
|
|
40
|
+
authController: AuthController<USER>,
|
|
41
41
|
path: string,
|
|
42
42
|
entity: Entity<M> | null): boolean {
|
|
43
43
|
return resolvePermissions(collection, authController, path, entity)?.edit ?? DEFAULT_PERMISSIONS.edit;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function canCreateEntity<M extends Record<string, any>,
|
|
46
|
+
export function canCreateEntity<M extends Record<string, any>, USER extends User>
|
|
47
47
|
(
|
|
48
48
|
collection: EntityCollection<M>,
|
|
49
|
-
authController: AuthController<
|
|
49
|
+
authController: AuthController<USER>,
|
|
50
50
|
path: string,
|
|
51
51
|
entity: Entity<M> | null): boolean {
|
|
52
52
|
if (collection.collectionGroup) return false;
|
|
53
53
|
return resolvePermissions(collection, authController, path, entity)?.create ?? DEFAULT_PERMISSIONS.create;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function canDeleteEntity<M extends Record<string, any>,
|
|
56
|
+
export function canDeleteEntity<M extends Record<string, any>, USER extends User>
|
|
57
57
|
(
|
|
58
58
|
collection: EntityCollection<M>,
|
|
59
|
-
authController: AuthController<
|
|
59
|
+
authController: AuthController<USER>,
|
|
60
60
|
path: string,
|
|
61
61
|
entity: Entity<M> | null): boolean {
|
|
62
62
|
return resolvePermissions(collection, authController, path, entity)?.delete ?? DEFAULT_PERMISSIONS.delete;
|