@firecms/core 3.0.0-beta.7 → 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/VirtualTable/VirtualTableProps.d.ts +4 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +2 -7
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/EntityEditView.d.ts +17 -3
- package/dist/core/NavigationRoutes.d.ts +1 -1
- package/dist/core/index.d.ts +2 -2
- 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/index.d.ts +1 -0
- package/dist/index.es.js +5595 -5574
- 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/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 +14 -0
- package/dist/types/datasource.d.ts +18 -8
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/plugins.d.ts +11 -3
- package/dist/types/properties.d.ts +7 -2
- package/dist/util/icons.d.ts +2 -2
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/package.json +13 -22
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/{core → app}/Scaffold.tsx +61 -107
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +7 -9
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +2 -1
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +7 -4
- package/src/components/VirtualTable/VirtualTable.tsx +3 -1
- package/src/components/VirtualTable/VirtualTableProps.tsx +5 -0
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +26 -28
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/EntityEditView.tsx +669 -129
- package/src/core/EntitySidePanel.tsx +0 -1
- package/src/core/NavigationRoutes.tsx +3 -3
- package/src/core/index.tsx +2 -2
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +29 -5
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +19 -10
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +5 -4
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +40 -35
- package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +0 -7
- package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +6 -35
- 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/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +12 -0
- package/src/preview/PropertyPreview.tsx +5 -2
- package/src/preview/PropertyPreviewProps.tsx +6 -0
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +2 -1
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- package/src/types/auth.tsx +1 -1
- package/src/types/collections.ts +14 -0
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +20 -16
- package/src/types/fields.tsx +33 -33
- package/src/types/plugins.tsx +12 -3
- package/src/types/properties.ts +7 -2
- package/src/util/entities.ts +4 -3
- package/src/util/objects.ts +17 -7
- package/src/util/permissions.ts +1 -0
- package/src/util/storage.ts +75 -21
- package/src/util/useStorageUploadController.tsx +21 -3
- package/dist/core/Drawer.d.ts +0 -16
- package/dist/core/Scaffold.d.ts +0 -51
- package/dist/form/EntityForm.d.ts +0 -77
- package/src/core/Drawer.tsx +0 -139
- package/src/form/EntityForm.tsx +0 -736
|
@@ -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
|
}
|
|
@@ -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
|
@@ -402,8 +402,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
|
|
|
402
402
|
* @group Models
|
|
403
403
|
*/
|
|
404
404
|
export type EntityCustomView<M extends Record<string, any> = any> = {
|
|
405
|
+
/**
|
|
406
|
+
* Key of this custom view.
|
|
407
|
+
*/
|
|
405
408
|
key: string;
|
|
409
|
+
/**
|
|
410
|
+
* Name of this custom view.
|
|
411
|
+
*/
|
|
406
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
|
+
*/
|
|
407
421
|
Builder?: React.ComponentType<EntityCustomViewParams<M>>;
|
|
408
422
|
};
|
|
409
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
|
}
|
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
|
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.
|
|
@@ -628,6 +628,11 @@ export type StorageConfig = {
|
|
|
628
628
|
* after it has been resolved.
|
|
629
629
|
*/
|
|
630
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;
|
|
631
636
|
};
|
|
632
637
|
/**
|
|
633
638
|
* @group Entity properties
|
|
@@ -652,7 +657,7 @@ export interface UploadedFileContext {
|
|
|
652
657
|
/**
|
|
653
658
|
* Entity path. E.g. `products/PID/locales`
|
|
654
659
|
*/
|
|
655
|
-
path
|
|
660
|
+
path?: string;
|
|
656
661
|
/**
|
|
657
662
|
* Values of the current entity
|
|
658
663
|
*/
|
package/dist/util/icons.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export type IconViewProps = {
|
|
|
8
8
|
icon?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const IconForView: React.NamedExoticComponent<{
|
|
11
|
-
collectionOrView?: IconViewProps
|
|
12
|
-
className?: string
|
|
11
|
+
collectionOrView?: IconViewProps;
|
|
12
|
+
className?: string;
|
|
13
13
|
}>;
|
package/dist/util/storage.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
import { EntityValues, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig, UploadedFileContext } from "../types";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface ResolveFilenameStringParams<M extends object> {
|
|
3
|
+
input: string | ((context: UploadedFileContext) => (Promise<string> | string));
|
|
4
|
+
storage: StorageConfig;
|
|
5
|
+
values: EntityValues<M>;
|
|
6
|
+
entityId: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
property: ResolvedStringProperty | ResolvedArrayProperty<string[]>;
|
|
9
|
+
file: File;
|
|
10
|
+
propertyKey: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveFilenameString<M extends object>({ input, storage, values, entityId, path, property, file, propertyKey }: ResolveFilenameStringParams<M>): Promise<string>;
|
|
13
|
+
interface ResolveStoragePathStringParams<M extends object> {
|
|
14
|
+
input: string | ((context: UploadedFileContext) => string);
|
|
15
|
+
storage: StorageConfig;
|
|
16
|
+
values: EntityValues<M>;
|
|
17
|
+
entityId: string;
|
|
18
|
+
path?: string;
|
|
19
|
+
property: ResolvedStringProperty | ResolvedArrayProperty<string[]>;
|
|
20
|
+
file: File;
|
|
21
|
+
propertyKey: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function resolveStoragePathString<M extends object>({ input, storage, values, entityId, path, property, file, propertyKey }: ResolveStoragePathStringParams<M>): string;
|
|
24
|
+
export {};
|
|
@@ -18,7 +18,7 @@ export declare function useStorageUploadController<M extends object>({ entityId,
|
|
|
18
18
|
entityId: string;
|
|
19
19
|
entityValues: EntityValues<M>;
|
|
20
20
|
value: string | string[] | null;
|
|
21
|
-
path
|
|
21
|
+
path?: string;
|
|
22
22
|
propertyKey: string;
|
|
23
23
|
property: ResolvedStringProperty | ResolvedArrayProperty<string[]>;
|
|
24
24
|
storageSource: StorageSource;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.8",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/formex": "^3.0.0-beta.
|
|
50
|
-
"@firecms/ui": "^3.0.0-beta.
|
|
49
|
+
"@firecms/formex": "^3.0.0-beta.8",
|
|
50
|
+
"@firecms/ui": "^3.0.0-beta.8",
|
|
51
51
|
"@fontsource/jetbrains-mono": "^5.0.20",
|
|
52
52
|
"@hello-pangea/dnd": "^16.6.0",
|
|
53
|
-
"@radix-ui/react-portal": "^1.
|
|
53
|
+
"@radix-ui/react-portal": "^1.1.1",
|
|
54
54
|
"clsx": "^2.1.1",
|
|
55
55
|
"date-fns": "^3.6.0",
|
|
56
56
|
"history": "^5.3.0",
|
|
@@ -80,38 +80,29 @@
|
|
|
80
80
|
"@testing-library/react": "^15.0.7",
|
|
81
81
|
"@testing-library/user-event": "^14.5.2",
|
|
82
82
|
"@types/jest": "^29.5.12",
|
|
83
|
-
"@types/node": "^20.
|
|
83
|
+
"@types/node": "^20.14.9",
|
|
84
84
|
"@types/object-hash": "^3.0.6",
|
|
85
85
|
"@types/react": "^18.3.3",
|
|
86
86
|
"@types/react-dom": "^18.3.0",
|
|
87
87
|
"@types/react-measure": "^2.0.12",
|
|
88
|
-
"@
|
|
89
|
-
"@typescript-eslint/parser": "^7.11.0",
|
|
90
|
-
"@vitejs/plugin-react": "^4.3.0",
|
|
88
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
91
89
|
"cross-env": "^7.0.3",
|
|
92
|
-
"eslint": "^8.57.0",
|
|
93
|
-
"eslint-config-standard": "^17.1.0",
|
|
94
|
-
"eslint-plugin-import": "^2.29.1",
|
|
95
|
-
"eslint-plugin-n": "^16.6.2",
|
|
96
|
-
"eslint-plugin-promise": "^6.2.0",
|
|
97
|
-
"eslint-plugin-react": "^7.34.2",
|
|
98
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
99
90
|
"firebase": "^10.12.2",
|
|
100
91
|
"jest": "^29.7.0",
|
|
101
92
|
"npm-run-all": "^4.1.5",
|
|
102
|
-
"react-router": "^6.
|
|
103
|
-
"react-router-dom": "^6.
|
|
104
|
-
"ts-jest": "^29.1.
|
|
93
|
+
"react-router": "^6.24.0",
|
|
94
|
+
"react-router-dom": "^6.24.0",
|
|
95
|
+
"ts-jest": "^29.1.5",
|
|
105
96
|
"ts-node": "^10.9.2",
|
|
106
|
-
"tsd": "^0.31.
|
|
107
|
-
"typescript": "^5.
|
|
108
|
-
"vite": "^5.2
|
|
97
|
+
"tsd": "^0.31.1",
|
|
98
|
+
"typescript": "^5.5.3",
|
|
99
|
+
"vite": "^5.3.2"
|
|
109
100
|
},
|
|
110
101
|
"files": [
|
|
111
102
|
"dist",
|
|
112
103
|
"src"
|
|
113
104
|
],
|
|
114
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "4ef14d60f86cb2e581b908a1dc84ad6a87b14e2e",
|
|
115
106
|
"publishConfig": {
|
|
116
107
|
"access": "public"
|
|
117
108
|
},
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DefaultAppBar, DefaultAppBarProps } from "../core/DefaultAppBar";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This component renders the main app bar of FireCMS.
|
|
5
|
+
*/
|
|
6
|
+
export function AppBar({
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}: {
|
|
10
|
+
children?: React.ReactNode,
|
|
11
|
+
className?: string,
|
|
12
|
+
style?: React.CSSProperties
|
|
13
|
+
} & DefaultAppBarProps) {
|
|
14
|
+
const usedChildren = children ?? <DefaultAppBar {...props}/>;
|
|
15
|
+
return <>{usedChildren}</>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
AppBar.componentType = "AppBar";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DefaultDrawer } from "../core";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This component is in charge of rendering the drawer.
|
|
5
|
+
* If you add this component under your {@link Scaffold}, it will be rendered
|
|
6
|
+
* as a drawer, and the open and close functionality will be handled automatically.
|
|
7
|
+
* If you want to customise the drawer, you can create your own component and pass it as a child.
|
|
8
|
+
* For custom drawers, you can use the {@link useApp} to open and close the drawer.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
export function Drawer({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
style
|
|
16
|
+
}: {
|
|
17
|
+
children?: React.ReactNode,
|
|
18
|
+
className?: string,
|
|
19
|
+
style?: React.CSSProperties
|
|
20
|
+
}) {
|
|
21
|
+
const usedChildren = children ?? <DefaultDrawer className={className} style={style}/>;
|
|
22
|
+
return <>{usedChildren}</>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Drawer.componentType = "Drawer";
|