@firecms/core 3.0.0-canary.66 → 3.0.0-canary.68
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/core/EntityEditView.d.ts +17 -3
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/StorageItemPreview.d.ts +2 -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.es.js +4271 -4322
- 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/types/collections.d.ts +14 -0
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/plugins.d.ts +2 -2
- package/dist/types/properties.d.ts +1 -1
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/package.json +4 -4
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +2 -1
- package/src/core/EntityEditView.tsx +662 -120
- package/src/core/EntitySidePanel.tsx +0 -1
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +28 -5
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +0 -4
- package/src/form/field_bindings/MapFieldBinding.tsx +10 -3
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +0 -7
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +3 -26
- package/src/form/index.tsx +4 -4
- package/src/form/validation.ts +1 -17
- package/src/types/collections.ts +14 -0
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/fields.tsx +33 -33
- package/src/types/plugins.tsx +2 -2
- package/src/types/properties.ts +1 -1
- package/src/util/entities.ts +1 -0
- package/src/util/permissions.ts +1 -0
- package/src/util/storage.ts +75 -21
- package/src/util/useStorageUploadController.tsx +21 -3
- package/dist/form/EntityForm.d.ts +0 -77
- package/src/form/EntityForm.tsx +0 -735
|
@@ -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
|
/**
|
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
|
@@ -161,8 +161,8 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
|
|
|
161
161
|
property: Property<T> | ResolvedProperty<T>;
|
|
162
162
|
Field: React.ComponentType<FieldProps<T, any, M>>;
|
|
163
163
|
plugin: FireCMSPlugin;
|
|
164
|
-
path
|
|
165
|
-
collection
|
|
164
|
+
path?: string;
|
|
165
|
+
collection?: EC;
|
|
166
166
|
};
|
|
167
167
|
export interface PluginGenericProps<UserType extends User = User> {
|
|
168
168
|
context: FireCMSContext<UserType>;
|
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-canary.
|
|
4
|
+
"version": "3.0.0-canary.68",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
50
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
49
|
+
"@firecms/formex": "^3.0.0-canary.68",
|
|
50
|
+
"@firecms/ui": "^3.0.0-canary.68",
|
|
51
51
|
"@fontsource/jetbrains-mono": "^5.0.20",
|
|
52
52
|
"@hello-pangea/dnd": "^16.6.0",
|
|
53
53
|
"@radix-ui/react-portal": "^1.0.4",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"dist",
|
|
112
112
|
"src"
|
|
113
113
|
],
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "bfabbd17ea406b898443e03febe4a353c8af5eb4",
|
|
115
115
|
"publishConfig": {
|
|
116
116
|
"access": "public"
|
|
117
117
|
},
|
|
@@ -264,7 +264,8 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
|
|
|
264
264
|
values,
|
|
265
265
|
path,
|
|
266
266
|
setFieldValue,
|
|
267
|
-
save: saveValue
|
|
267
|
+
save: saveValue,
|
|
268
|
+
formex
|
|
268
269
|
};
|
|
269
270
|
|
|
270
271
|
const property: ResolvedProperty<any> | undefined = propertyKey && getPropertyInPath(collection.properties, propertyKey as string);
|