@firecms/core 3.0.0-beta.6 → 3.0.0-beta.8
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/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +17 -0
- package/dist/app/Scaffold.d.ts +30 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app/useApp.d.ts +16 -0
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/EntityPreview.d.ts +3 -2
- package/dist/components/ReferenceWidget.d.ts +3 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +5 -6
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +3 -5
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/EntityEditView.d.ts +17 -3
- package/dist/core/NavigationRoutes.d.ts +2 -2
- package/dist/core/index.d.ts +3 -4
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/StorageItemPreview.d.ts +4 -4
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
- package/dist/form/index.d.ts +0 -2
- package/dist/hooks/data/save.d.ts +1 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +10199 -10140
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +5 -0
- package/dist/preview/components/ReferencePreview.d.ts +2 -1
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/collections.d.ts +22 -1
- package/dist/types/datasource.d.ts +18 -8
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/plugins.d.ts +11 -3
- package/dist/types/properties.d.ts +15 -2
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/resolutions.d.ts +8 -8
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/package.json +130 -122
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/app/Scaffold.tsx +249 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +8 -10
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +9 -7
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +22 -15
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +9 -1
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -6
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +26 -24
- package/src/components/EntityPreview.tsx +9 -7
- package/src/components/EntityView.tsx +4 -4
- package/src/components/HomePage/NavigationCard.tsx +2 -2
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/ReferenceWidget.tsx +21 -11
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +4 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +4 -1
- package/src/components/VirtualTable/VirtualTable.tsx +13 -12
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +6 -6
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
- package/src/components/common/index.ts +1 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/common/types.tsx +3 -5
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +2 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -36
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +673 -134
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +36 -40
- package/src/core/NavigationRoutes.tsx +6 -7
- package/src/core/field_configs.tsx +1 -1
- package/src/core/index.tsx +3 -4
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +29 -7
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +20 -11
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
- package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +10 -39
- package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
- package/src/form/index.tsx +4 -4
- package/src/form/validation.ts +1 -17
- package/src/hooks/data/save.ts +2 -1
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +2 -3
- package/src/hooks/useBuildNavigationController.tsx +1 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +15 -15
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +12 -0
- package/src/internal/useBuildSideEntityController.tsx +72 -11
- package/src/preview/PropertyPreview.tsx +7 -4
- package/src/preview/PropertyPreviewProps.tsx +6 -0
- package/src/preview/components/BooleanPreview.tsx +2 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +22 -22
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/types/auth.tsx +1 -1
- package/src/types/collections.ts +28 -2
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +20 -16
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/fields.tsx +33 -33
- package/src/types/navigation.ts +1 -2
- package/src/types/plugins.tsx +12 -3
- package/src/types/properties.ts +17 -2
- package/src/types/storage.ts +1 -1
- package/src/util/entities.ts +4 -3
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +1 -0
- package/src/util/resolutions.ts +32 -31
- package/src/util/storage.ts +75 -21
- package/src/util/useStorageUploadController.tsx +21 -3
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/Drawer.d.ts +0 -23
- package/dist/core/Scaffold.d.ts +0 -55
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/form/EntityForm.d.ts +0 -77
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/src/core/Drawer.tsx +0 -191
- package/src/core/Scaffold.tsx +0 -281
- package/src/core/SideEntityView.tsx +0 -38
- package/src/form/EntityForm.tsx +0 -728
- package/src/internal/useBuildCustomizationController.tsx +0 -5
|
@@ -37,4 +37,9 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
|
37
37
|
* Additional properties set by the developer
|
|
38
38
|
*/
|
|
39
39
|
customProps?: CustomProps;
|
|
40
|
+
/**
|
|
41
|
+
* If the preview should be interactive or not.
|
|
42
|
+
* This applies only to videos.
|
|
43
|
+
*/
|
|
44
|
+
interactive?: boolean;
|
|
40
45
|
}
|
|
@@ -8,7 +8,8 @@ export type ReferencePreviewProps = {
|
|
|
8
8
|
previewProperties?: string[];
|
|
9
9
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
10
10
|
hover?: boolean;
|
|
11
|
-
|
|
11
|
+
includeEntityLink?: boolean;
|
|
12
|
+
includeId?: boolean;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* @group Preview components
|
|
@@ -4,10 +4,11 @@ type StorageThumbnailProps = {
|
|
|
4
4
|
storagePathOrDownloadUrl: string;
|
|
5
5
|
storeUrl: boolean;
|
|
6
6
|
size: PreviewSize;
|
|
7
|
+
interactive?: boolean;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* @group Preview components
|
|
10
11
|
*/
|
|
11
12
|
export declare const StorageThumbnail: React.FunctionComponent<StorageThumbnailProps>;
|
|
12
|
-
export declare function StorageThumbnailInternal({ storeUrl, storagePathOrDownloadUrl, size }: StorageThumbnailProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export declare function StorageThumbnailInternal({ storeUrl, interactive, storagePathOrDownloadUrl, size }: StorageThumbnailProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
14
|
export {};
|
|
@@ -4,9 +4,10 @@ import { PreviewSize } from "../PropertyPreviewProps";
|
|
|
4
4
|
/**
|
|
5
5
|
* @group Preview components
|
|
6
6
|
*/
|
|
7
|
-
export declare function UrlComponentPreview({ url, previewType, size, hint }: {
|
|
7
|
+
export declare function UrlComponentPreview({ url, previewType, size, hint, interactive }: {
|
|
8
8
|
url: string;
|
|
9
9
|
previewType?: PreviewType;
|
|
10
10
|
size: PreviewSize;
|
|
11
11
|
hint?: string;
|
|
12
|
+
interactive?: boolean;
|
|
12
13
|
}): React.ReactElement;
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
99
99
|
* `hidden` in the property definition,will be ignored.
|
|
100
100
|
* `propertiesOrder` has precedence over `hidden`.
|
|
101
101
|
*/
|
|
102
|
-
propertiesOrder?: Extract<keyof M, string>[];
|
|
102
|
+
propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
|
|
103
103
|
/**
|
|
104
104
|
* If enabled, content is loaded in batches. If `false` all entities in the
|
|
105
105
|
* collection are loaded.
|
|
@@ -257,7 +257,14 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
257
257
|
* are writing custom code
|
|
258
258
|
*/
|
|
259
259
|
ownerId?: string;
|
|
260
|
+
/**
|
|
261
|
+
* Overrides for the entity view, like the data source or the storage source.
|
|
262
|
+
*/
|
|
260
263
|
overrides?: EntityOverrides;
|
|
264
|
+
/**
|
|
265
|
+
* Width of the side dialog (in pixels) when opening an entity in this collection.
|
|
266
|
+
*/
|
|
267
|
+
sideDialogWidth?: number | string;
|
|
261
268
|
}
|
|
262
269
|
/**
|
|
263
270
|
* Parameter passed to the `Actions` prop in the collection configuration.
|
|
@@ -395,8 +402,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
|
|
|
395
402
|
* @group Models
|
|
396
403
|
*/
|
|
397
404
|
export type EntityCustomView<M extends Record<string, any> = any> = {
|
|
405
|
+
/**
|
|
406
|
+
* Key of this custom view.
|
|
407
|
+
*/
|
|
398
408
|
key: string;
|
|
409
|
+
/**
|
|
410
|
+
* Name of this custom view.
|
|
411
|
+
*/
|
|
399
412
|
name: string;
|
|
413
|
+
/**
|
|
414
|
+
* If set to true, the actions of the entity will be included in the
|
|
415
|
+
* bottom of the panel (save buttons, delete buttons, etc.)
|
|
416
|
+
*/
|
|
417
|
+
includeActions?: boolean;
|
|
418
|
+
/**
|
|
419
|
+
* Builder for rendering the custom view
|
|
420
|
+
*/
|
|
400
421
|
Builder?: React.ComponentType<EntityCustomViewParams<M>>;
|
|
401
422
|
};
|
|
402
423
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Entity, EntityStatus, EntityValues } from "./entities";
|
|
2
2
|
import { EntityCollection, FilterValues } from "./collections";
|
|
3
3
|
import { ResolvedEntityCollection } from "./resolved_entities";
|
|
4
|
+
import { FireCMSContext } from "./firecms_context";
|
|
4
5
|
/**
|
|
5
6
|
* @group Datasource
|
|
6
7
|
*/
|
|
@@ -145,6 +146,17 @@ export interface DataSource {
|
|
|
145
146
|
* @param props
|
|
146
147
|
*/
|
|
147
148
|
isFilterCombinationValid?(props: FilterCombinationValidProps): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Called when the user clicks on the search bar in a collection view.
|
|
151
|
+
* Useful for initializing a text search index.
|
|
152
|
+
* @param props
|
|
153
|
+
*/
|
|
154
|
+
initTextSearch?: (props: {
|
|
155
|
+
context: FireCMSContext;
|
|
156
|
+
path: string;
|
|
157
|
+
collection: EntityCollection;
|
|
158
|
+
parentCollectionIds?: string[];
|
|
159
|
+
}) => Promise<boolean>;
|
|
148
160
|
}
|
|
149
161
|
export type FilterCombinationValidProps = {
|
|
150
162
|
path: string;
|
|
@@ -241,14 +253,6 @@ export interface DataSourceDelegate {
|
|
|
241
253
|
* @param props
|
|
242
254
|
*/
|
|
243
255
|
isFilterCombinationValid?(props: Omit<FilterCombinationValidProps, "collection">): boolean;
|
|
244
|
-
/**
|
|
245
|
-
* Convert a FireCMS reference to a reference that can be used by the datasource
|
|
246
|
-
* @param reference
|
|
247
|
-
*/
|
|
248
|
-
/**
|
|
249
|
-
* Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
|
|
250
|
-
* @param geoPoint
|
|
251
|
-
*/
|
|
252
256
|
/**
|
|
253
257
|
* Get the object to generate the current time in the datasource
|
|
254
258
|
*/
|
|
@@ -256,4 +260,10 @@ export interface DataSourceDelegate {
|
|
|
256
260
|
delegateToCMSModel: (data: any) => any;
|
|
257
261
|
cmsToDelegateModel: (data: any) => any;
|
|
258
262
|
setDateToMidnight: (input?: any) => any;
|
|
263
|
+
initTextSearch?: (props: {
|
|
264
|
+
context: FireCMSContext;
|
|
265
|
+
path: string;
|
|
266
|
+
collection: EntityCollection;
|
|
267
|
+
parentCollectionIds?: string[];
|
|
268
|
+
}) => Promise<boolean>;
|
|
259
269
|
}
|
|
@@ -4,9 +4,23 @@ import { Entity } from "./entities";
|
|
|
4
4
|
import { EntityCollection, SelectionController } from "./collections";
|
|
5
5
|
import { User } from "./user";
|
|
6
6
|
import { SideEntityController } from "./side_entity_controller";
|
|
7
|
+
/**
|
|
8
|
+
* An entity action is a custom action that can be performed on an entity.
|
|
9
|
+
* They are displayed in the entity view and in the collection view.
|
|
10
|
+
*/
|
|
7
11
|
export type EntityAction<M extends object = any, UserType extends User = User> = {
|
|
12
|
+
/**
|
|
13
|
+
* Title of the action
|
|
14
|
+
*/
|
|
8
15
|
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Icon of the action
|
|
18
|
+
*/
|
|
9
19
|
icon?: React.ReactElement;
|
|
20
|
+
/**
|
|
21
|
+
* Callback when the action is clicked
|
|
22
|
+
* @param props
|
|
23
|
+
*/
|
|
10
24
|
onClick: (props: EntityActionClickProps<M, UserType>) => Promise<void> | void;
|
|
11
25
|
/**
|
|
12
26
|
* Show this action collapsed in the menu of the collection view.
|
package/dist/types/fields.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityValues } from "./entities";
|
|
2
1
|
import { CMSType, PropertyOrBuilder } from "./properties";
|
|
3
2
|
import { ResolvedEntityCollection, ResolvedProperty } from "./resolved_entities";
|
|
3
|
+
import { FormexController } from "@firecms/formex";
|
|
4
4
|
/**
|
|
5
5
|
* When building a custom field you need to create a React component that takes
|
|
6
6
|
* this interface as props.
|
|
@@ -17,9 +17,6 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
17
17
|
* Current value of this field
|
|
18
18
|
*/
|
|
19
19
|
value: T;
|
|
20
|
-
/**
|
|
21
|
-
* Initial value of this field
|
|
22
|
-
*/
|
|
23
20
|
/**
|
|
24
21
|
* Set value of field directly
|
|
25
22
|
*/
|
|
@@ -34,24 +31,24 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
34
31
|
/**
|
|
35
32
|
* Is the form currently submitting
|
|
36
33
|
*/
|
|
37
|
-
isSubmitting
|
|
34
|
+
isSubmitting?: boolean;
|
|
38
35
|
/**
|
|
39
36
|
* Should this field show the error indicator.
|
|
40
37
|
* Note that there might be an error (like an empty field that should be
|
|
41
38
|
* filled) but we don't want to show the error until the user has tried
|
|
42
39
|
* saving.
|
|
43
40
|
*/
|
|
44
|
-
showError
|
|
41
|
+
showError?: boolean;
|
|
45
42
|
/**
|
|
46
43
|
* Is there an error in this field. The error field has the same shape as
|
|
47
44
|
* the field, replacing values with a string containing the error.
|
|
48
45
|
* It takes the value `null` if there is no error
|
|
49
46
|
*/
|
|
50
|
-
error
|
|
47
|
+
error?: any | null;
|
|
51
48
|
/**
|
|
52
49
|
* Has this field been touched
|
|
53
50
|
*/
|
|
54
|
-
touched
|
|
51
|
+
touched?: boolean;
|
|
55
52
|
/**
|
|
56
53
|
* Property related to this field
|
|
57
54
|
*/
|
|
@@ -59,32 +56,32 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
59
56
|
/**
|
|
60
57
|
* Should this field include a description
|
|
61
58
|
*/
|
|
62
|
-
includeDescription
|
|
59
|
+
includeDescription?: boolean;
|
|
63
60
|
/**
|
|
64
61
|
* Flag to indicate that the underlying value has been updated in the
|
|
65
62
|
* datasource
|
|
66
63
|
*/
|
|
67
|
-
underlyingValueHasChanged
|
|
64
|
+
underlyingValueHasChanged?: boolean;
|
|
68
65
|
/**
|
|
69
66
|
* Is this field part of an array
|
|
70
67
|
*/
|
|
71
|
-
partOfArray
|
|
68
|
+
partOfArray?: boolean;
|
|
72
69
|
/**
|
|
73
70
|
* Is this field part of a block (oneOf array)
|
|
74
71
|
*/
|
|
75
|
-
partOfBlock
|
|
72
|
+
partOfBlock?: boolean;
|
|
76
73
|
/**
|
|
77
74
|
* Is this field being rendered in the entity table popup
|
|
78
75
|
*/
|
|
79
|
-
tableMode
|
|
76
|
+
tableMode?: boolean;
|
|
80
77
|
/**
|
|
81
78
|
* Should this field autofocus on mount
|
|
82
79
|
*/
|
|
83
|
-
autoFocus
|
|
80
|
+
autoFocus?: boolean;
|
|
84
81
|
/**
|
|
85
82
|
* Additional properties set by the developer
|
|
86
83
|
*/
|
|
87
|
-
customProps
|
|
84
|
+
customProps?: CustomProps;
|
|
88
85
|
/**
|
|
89
86
|
* Additional values related to the state of the form or the entity
|
|
90
87
|
*/
|
|
@@ -92,7 +89,7 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
92
89
|
/**
|
|
93
90
|
* Flag to indicate if this field should be disabled
|
|
94
91
|
*/
|
|
95
|
-
disabled
|
|
92
|
+
disabled?: boolean;
|
|
96
93
|
}
|
|
97
94
|
/**
|
|
98
95
|
* Context passed to custom fields
|
|
@@ -100,13 +97,24 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
100
97
|
*/
|
|
101
98
|
export interface FormContext<M extends Record<string, any> = any> {
|
|
102
99
|
/**
|
|
103
|
-
*
|
|
100
|
+
* Current values of the entity
|
|
104
101
|
*/
|
|
105
|
-
|
|
102
|
+
values: M;
|
|
106
103
|
/**
|
|
107
|
-
*
|
|
104
|
+
* Update the value of a field
|
|
105
|
+
* @param key
|
|
106
|
+
* @param value
|
|
107
|
+
* @param shouldValidate
|
|
108
|
+
*/
|
|
109
|
+
setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Save the entity.
|
|
112
|
+
*/
|
|
113
|
+
save: (values: M) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Collection of the entity being modified
|
|
108
116
|
*/
|
|
109
|
-
|
|
117
|
+
collection?: ResolvedEntityCollection<M>;
|
|
110
118
|
/**
|
|
111
119
|
* Entity id, it can be null if it's a new entity
|
|
112
120
|
*/
|
|
@@ -114,18 +122,11 @@ export interface FormContext<M extends Record<string, any> = any> {
|
|
|
114
122
|
/**
|
|
115
123
|
* Path this entity is located at
|
|
116
124
|
*/
|
|
117
|
-
path
|
|
118
|
-
/**
|
|
119
|
-
* Update the value of a field
|
|
120
|
-
* @param key
|
|
121
|
-
* @param value
|
|
122
|
-
* @param shouldValidate
|
|
123
|
-
*/
|
|
124
|
-
setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
|
|
125
|
+
path?: string;
|
|
125
126
|
/**
|
|
126
|
-
*
|
|
127
|
+
* This is the underlying formex controller that powers the form
|
|
127
128
|
*/
|
|
128
|
-
|
|
129
|
+
formex: FormexController<M>;
|
|
129
130
|
}
|
|
130
131
|
/**
|
|
131
132
|
* In case you need to render a field bound to a Property inside your
|
|
@@ -47,9 +47,9 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
|
|
|
47
47
|
* Get the collection configuration for a given path.
|
|
48
48
|
* The collection is resolved from the given path or alias.
|
|
49
49
|
*/
|
|
50
|
-
getCollection: (pathOrId: string,
|
|
50
|
+
getCollection: (pathOrId: string, includeUserOverride?: boolean) => EC | undefined;
|
|
51
51
|
/**
|
|
52
|
-
* Get the collection configuration from its parent
|
|
52
|
+
* Get the collection configuration from its parent ids.
|
|
53
53
|
*/
|
|
54
54
|
getCollectionFromIds: (ids: string[]) => EC | undefined;
|
|
55
55
|
/**
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -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";
|
|
@@ -80,6 +80,12 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
80
80
|
collectionActionsProps?: COL_ACTIONS_PROPS;
|
|
81
81
|
CollectionActionsStart?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS>[];
|
|
82
82
|
collectionActionsStartProps?: COL_ACTIONS_START__PROPS;
|
|
83
|
+
blockSearch?: (props: {
|
|
84
|
+
context: FireCMSContext;
|
|
85
|
+
path: string;
|
|
86
|
+
collection: EC;
|
|
87
|
+
parentCollectionIds?: string[];
|
|
88
|
+
}) => boolean;
|
|
83
89
|
showTextSearchBar?: (props: {
|
|
84
90
|
context: FireCMSContext;
|
|
85
91
|
path: string;
|
|
@@ -103,6 +109,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
103
109
|
parentCollectionIds: string[];
|
|
104
110
|
onHover: boolean;
|
|
105
111
|
collection: EC;
|
|
112
|
+
tableController: EntityTableController;
|
|
106
113
|
}>;
|
|
107
114
|
/**
|
|
108
115
|
* If you add this callback to your plugin, an add button will be added to the collection table.
|
|
@@ -112,6 +119,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
112
119
|
fullPath: string;
|
|
113
120
|
parentCollectionIds: string[];
|
|
114
121
|
collection: EC;
|
|
122
|
+
tableController: EntityTableController;
|
|
115
123
|
}>;
|
|
116
124
|
};
|
|
117
125
|
form?: {
|
|
@@ -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
|
|
165
|
-
collection
|
|
172
|
+
path?: string;
|
|
173
|
+
collection?: EC;
|
|
166
174
|
};
|
|
167
175
|
export interface PluginGenericProps<UserType extends User = User> {
|
|
168
176
|
context: FireCMSContext<UserType>;
|
|
@@ -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.
|
|
@@ -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
|
|
@@ -620,6 +628,11 @@ export type StorageConfig = {
|
|
|
620
628
|
* after it has been resolved.
|
|
621
629
|
*/
|
|
622
630
|
postProcess?: (pathOrUrl: string) => Promise<string>;
|
|
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;
|
|
623
636
|
};
|
|
624
637
|
/**
|
|
625
638
|
* @group Entity properties
|
|
@@ -644,7 +657,7 @@ export interface UploadedFileContext {
|
|
|
644
657
|
/**
|
|
645
658
|
* Entity path. E.g. `products/PID/locales`
|
|
646
659
|
*/
|
|
647
|
-
path
|
|
660
|
+
path?: string;
|
|
648
661
|
/**
|
|
649
662
|
* Values of the current entity
|
|
650
663
|
*/
|