@firecms/core 3.0.0-alpha.35 → 3.0.0-alpha.37
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/FireCMS.d.ts +0 -1
- package/dist/form/form_field_configs.d.ts +1 -1
- package/dist/hooks/useBuildDataSource.d.ts +2 -4
- package/dist/index.es.js +5884 -5825
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +14 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/types/firecms.d.ts +1 -1
- package/dist/types/firecms_context.d.ts +1 -1
- package/dist/types/plugins.d.ts +1 -0
- package/dist/util/builders.d.ts +64 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/objects.d.ts +1 -0
- package/package.json +138 -138
- package/src/components/EntityCollectionTable/internal/DeleteEntityDialog.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/PropertyTableCell.tsx +2 -1
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +1 -1
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +5 -4
- package/src/components/EntityPreview.tsx +1 -1
- package/src/components/ErrorView.tsx +1 -0
- package/src/components/FireCMSAppBar.tsx +0 -1
- package/src/components/HomePage/DefaultHomePage.tsx +10 -0
- package/src/components/ReferenceSelectionInner.tsx +2 -2
- package/src/core/FireCMS.tsx +6 -5
- package/src/form/EntityForm.tsx +3 -3
- package/src/form/PropertyFieldBinding.tsx +4 -4
- package/src/form/components/ReferenceWidget.tsx +1 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +2 -2
- package/src/form/form_field_configs.tsx +2 -2
- package/src/hooks/data/save.ts +3 -3
- package/src/hooks/useBuildDataSource.ts +3 -5
- package/src/preview/PropertyPreview.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
- package/src/types/firecms.tsx +1 -1
- package/src/types/firecms_context.tsx +2 -1
- package/src/types/plugins.tsx +1 -0
- package/src/ui/Select.tsx +5 -9
- package/src/util/builders.ts +138 -0
- package/src/util/index.ts +1 -0
- package/src/util/objects.ts +23 -0
- package/src/util/resolutions.ts +6 -3
package/dist/types/firecms.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export type FireCMSProps<UserType extends User, EC extends EntityCollection> = {
|
|
|
79
79
|
* You can use the key to reference the custom field in
|
|
80
80
|
* the `propertyConfig` prop of a property in a collection.
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
83
83
|
/**
|
|
84
84
|
* List of additional custom views for entities.
|
|
85
85
|
* You can use the key to reference the custom view in
|
|
@@ -90,7 +90,7 @@ export type FireCMSContext<UserType extends User = User, AuthControllerType exte
|
|
|
90
90
|
* You can use the key to reference the custom field in
|
|
91
91
|
* the `propertyConfig` prop of a property in a collection.
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
propertyConfigs: Record<string, PropertyConfig>;
|
|
94
94
|
/**
|
|
95
95
|
* List of additional custom views for entities.
|
|
96
96
|
* You can use the key to reference the custom view in
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
62
62
|
};
|
|
63
63
|
homePage?: {
|
|
64
64
|
additionalChildrenStart?: React.ReactNode;
|
|
65
|
+
additionalChildrenEnd?: React.ReactNode;
|
|
65
66
|
/**
|
|
66
67
|
* Use this component to add custom actions to the navigation card
|
|
67
68
|
* in the home page.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AdditionalFieldDelegate, ArrayProperty, BooleanProperty, CMSType, DateProperty, EntityCallbacks, EntityCollection, EnumValueConfig, EnumValues, GeopointProperty, MapProperty, NumberProperty, PropertiesOrBuilders, PropertyBuilder, PropertyConfig, PropertyOrBuilder, ReferenceProperty, StringProperty, User } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Identity function we use to defeat the type system of Typescript and build
|
|
4
|
+
* collection views with all its properties
|
|
5
|
+
* @param collection
|
|
6
|
+
* @group Builder
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildCollection<M extends Record<string, any> = any, UserType extends User = User>(collection: EntityCollection<M, UserType>): EntityCollection<M, UserType>;
|
|
9
|
+
/**
|
|
10
|
+
* Identity function we use to defeat the type system of Typescript and preserve
|
|
11
|
+
* the property keys.
|
|
12
|
+
* @param property
|
|
13
|
+
* @group Builder
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildProperty<T extends CMSType = CMSType, P extends PropertyOrBuilder<T> = PropertyOrBuilder<T>, M extends Record<string, any> = Record<string, any>>(property: P): P extends StringProperty ? StringProperty : P extends NumberProperty ? NumberProperty : P extends BooleanProperty ? BooleanProperty : P extends DateProperty ? DateProperty : P extends GeopointProperty ? GeopointProperty : P extends ReferenceProperty ? ReferenceProperty : P extends ArrayProperty ? ArrayProperty : P extends MapProperty ? MapProperty : P extends PropertyBuilder<T, M> ? PropertyBuilder<T, M> : never;
|
|
16
|
+
/**
|
|
17
|
+
* Identity function we use to defeat the type system of Typescript and preserve
|
|
18
|
+
* the properties keys.
|
|
19
|
+
* @param properties
|
|
20
|
+
* @group Builder
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildProperties<M extends Record<string, any>>(properties: PropertiesOrBuilders<M>): PropertiesOrBuilders<M>;
|
|
23
|
+
/**
|
|
24
|
+
* Identity function we use to defeat the type system of Typescript and preserve
|
|
25
|
+
* the properties keys.
|
|
26
|
+
* @param propertiesOrBuilder
|
|
27
|
+
* @group Builder
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildPropertiesOrBuilder<M extends Record<string, any>>(propertiesOrBuilder: PropertiesOrBuilders<M>): PropertiesOrBuilders<M>;
|
|
30
|
+
/**
|
|
31
|
+
* Identity function we use to defeat the type system of Typescript and preserve
|
|
32
|
+
* the properties keys.
|
|
33
|
+
* @param enumValues
|
|
34
|
+
* @group Builder
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildEnumValues(enumValues: EnumValues): EnumValues;
|
|
37
|
+
/**
|
|
38
|
+
* Identity function we use to defeat the type system of Typescript and preserve
|
|
39
|
+
* the properties keys.
|
|
40
|
+
* @param enumValueConfig
|
|
41
|
+
* @group Builder
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildEnumValueConfig(enumValueConfig: EnumValueConfig): EnumValueConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Identity function we use to defeat the type system of Typescript and preserve
|
|
46
|
+
* the properties keys.
|
|
47
|
+
* @param callbacks
|
|
48
|
+
* @group Builder
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildEntityCallbacks<M extends Record<string, any> = any>(callbacks: EntityCallbacks<M>): EntityCallbacks<M>;
|
|
51
|
+
/**
|
|
52
|
+
* Identity function we use to defeat the type system of Typescript and build
|
|
53
|
+
* additional field delegates views with all its properties
|
|
54
|
+
* @param additionalFieldDelegate
|
|
55
|
+
* @group Builder
|
|
56
|
+
*/
|
|
57
|
+
export declare function buildAdditionalFieldDelegate<M extends Record<string, any>, UserType extends User = User>(additionalFieldDelegate: AdditionalFieldDelegate<M, UserType>): AdditionalFieldDelegate<M, UserType>;
|
|
58
|
+
/**
|
|
59
|
+
* Identity function we use to defeat the type system of Typescript and build
|
|
60
|
+
* additional field delegates views with all its properties
|
|
61
|
+
* @param propertyConfig
|
|
62
|
+
* @group Builder
|
|
63
|
+
*/
|
|
64
|
+
export declare function buildFieldConfig<T extends CMSType = CMSType>(propertyConfig: PropertyConfig<T>): PropertyConfig<T>;
|
package/dist/util/index.d.ts
CHANGED
package/dist/util/objects.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export declare function removeFunctions(o: object | undefined): any;
|
|
|
7
7
|
export declare function getHashValue<T>(v: T): any;
|
|
8
8
|
export declare function removeUndefined(value: any, removeEmptyStrings?: boolean): any;
|
|
9
9
|
export declare function isEmptyObject(obj: object): boolean;
|
|
10
|
+
export declare function removePropsIfExisting(source: any, comparison: any): any;
|
package/package.json
CHANGED
|
@@ -1,141 +1,141 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"url": "https://github.com/sponsors/firecmsco"
|
|
8
|
-
},
|
|
9
|
-
"author": "FireCMS",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"repository": "git@github.com:FireCMSco/firecms.git",
|
|
12
|
-
"main": "./dist/index.umd.js",
|
|
13
|
-
"module": "./dist/index.es.js",
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"source": "src/index.ts",
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=14"
|
|
18
|
-
},
|
|
19
|
-
"exports": {
|
|
20
|
-
".": {
|
|
21
|
-
"import": "./dist/index.es.js",
|
|
22
|
-
"require": "./dist/index.umd.js",
|
|
23
|
-
"types": "./dist/index.d.ts"
|
|
2
|
+
"name": "@firecms/core",
|
|
3
|
+
"version": "3.0.0-alpha.37",
|
|
4
|
+
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
5
|
+
"funding": {
|
|
6
|
+
"url": "https://github.com/sponsors/firecmsco"
|
|
24
7
|
},
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
8
|
+
"author": "FireCMS",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": "git@github.com:FireCMSco/firecms.git",
|
|
11
|
+
"main": "./dist/index.umd.js",
|
|
12
|
+
"module": "./dist/index.es.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"source": "src/index.ts",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=14"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.es.js",
|
|
21
|
+
"require": "./dist/index.umd.js",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"firebase",
|
|
28
|
+
"cms",
|
|
29
|
+
"admin",
|
|
30
|
+
"admin panel",
|
|
31
|
+
"firebase panel",
|
|
32
|
+
"firestore",
|
|
33
|
+
"headless",
|
|
34
|
+
"headless cms",
|
|
35
|
+
"content manager"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"watch": "vite build --watch",
|
|
39
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
40
|
+
"prepublishOnly": "run-s build",
|
|
41
|
+
"createTag": "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags",
|
|
42
|
+
"test:lint": "eslint \"src/**\" --quiet",
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
|
|
45
|
+
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@date-io/date-fns": "^2.17.0",
|
|
49
|
+
"@fontsource/ibm-plex-mono": "^5.0.8",
|
|
50
|
+
"@fontsource/roboto": "^5.0.8",
|
|
51
|
+
"@hello-pangea/dnd": "^16.3.0",
|
|
52
|
+
"@material-design-icons/font": "^0.14.13",
|
|
53
|
+
"@radix-ui/react-checkbox": "^1.0.4",
|
|
54
|
+
"@radix-ui/react-collapsible": "^1.0.3",
|
|
55
|
+
"@radix-ui/react-dialog": "^1.0.5",
|
|
56
|
+
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
|
57
|
+
"@radix-ui/react-popover": "^1.0.7",
|
|
58
|
+
"@radix-ui/react-portal": "^1.0.4",
|
|
59
|
+
"@radix-ui/react-scroll-area": "^1.0.5",
|
|
60
|
+
"@radix-ui/react-select": "^1.2.2",
|
|
61
|
+
"@radix-ui/react-switch": "^1.0.3",
|
|
62
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
63
|
+
"@radix-ui/react-tooltip": "^1.0.7",
|
|
64
|
+
"cmdk": "^0.2.0",
|
|
65
|
+
"date-fns": "^2.30.0",
|
|
66
|
+
"formik": "^2.4.5",
|
|
67
|
+
"history": "^5.3.0",
|
|
68
|
+
"js-search": "^2.0.1",
|
|
69
|
+
"markdown-it": "^13.0.2",
|
|
70
|
+
"notistack": "^3.0.1",
|
|
71
|
+
"object-hash": "^3.0.0",
|
|
72
|
+
"react-datepicker": "^4.21.0",
|
|
73
|
+
"react-dropzone": "^14.2.3",
|
|
74
|
+
"react-fast-compare": "^3.2.2",
|
|
75
|
+
"react-image-file-resizer": "^0.4.8",
|
|
76
|
+
"react-markdown-editor-lite": "^1.3.4",
|
|
77
|
+
"react-remove-scroll": "^2.5.6",
|
|
78
|
+
"react-transition-group": "^4.4.5",
|
|
79
|
+
"react-use-measure": "^2.1.1",
|
|
80
|
+
"react-window": "^1.8.9",
|
|
81
|
+
"tailwind-merge": "^1.14.0",
|
|
82
|
+
"typeface-rubik": "^1.1.13",
|
|
83
|
+
"yup": "^0.32.11"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"algoliasearch": "^4.13.0",
|
|
87
|
+
"firebase": "^10.5.2",
|
|
88
|
+
"react": "^18.2.0",
|
|
89
|
+
"react-dom": "^18.2.0",
|
|
90
|
+
"react-router": "^6.2.0",
|
|
91
|
+
"react-router-dom": "^6.2.0"
|
|
92
|
+
},
|
|
93
|
+
"eslintConfig": {
|
|
94
|
+
"extends": [
|
|
95
|
+
"react-app",
|
|
96
|
+
"react-app/jest"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"devDependencies": {
|
|
100
|
+
"@jest/globals": "^29.7.0",
|
|
101
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
102
|
+
"@testing-library/react": "^14.0.0",
|
|
103
|
+
"@testing-library/user-event": "^14.5.1",
|
|
104
|
+
"@types/jest": "^29.5.6",
|
|
105
|
+
"@types/node": "^20.8.9",
|
|
106
|
+
"@types/object-hash": "^3.0.5",
|
|
107
|
+
"@types/react": "^18.2.33",
|
|
108
|
+
"@types/react-dom": "^18.2.14",
|
|
109
|
+
"@types/react-measure": "^2.0.10",
|
|
110
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
111
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
112
|
+
"@vitejs/plugin-react": "^4.1.0",
|
|
113
|
+
"algoliasearch": "^4.20.0",
|
|
114
|
+
"cross-env": "^7.0.3",
|
|
115
|
+
"eslint": "^8.52.0",
|
|
116
|
+
"eslint-config-standard": "^17.1.0",
|
|
117
|
+
"eslint-plugin-import": "^2.29.0",
|
|
118
|
+
"eslint-plugin-n": "^15.7.0",
|
|
119
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
120
|
+
"eslint-plugin-react": "^7.33.2",
|
|
121
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
122
|
+
"firebase": "^10.5.2",
|
|
123
|
+
"jest": "^29.7.0",
|
|
124
|
+
"npm-run-all": "^4.1.5",
|
|
125
|
+
"react-router": "^6.17.0",
|
|
126
|
+
"react-router-dom": "^6.17.0",
|
|
127
|
+
"ts-jest": "^29.1.1",
|
|
128
|
+
"ts-node": "^10.9.1",
|
|
129
|
+
"tsd": "^0.28.1",
|
|
130
|
+
"typescript": "^5.3.0",
|
|
131
|
+
"vite": "^4.5.0"
|
|
132
|
+
},
|
|
133
|
+
"files": [
|
|
134
|
+
"dist",
|
|
135
|
+
"src"
|
|
136
|
+
],
|
|
137
|
+
"gitHead": "bfe341a3a8e3d2b33d4dc3f48fabc350eccace1b",
|
|
138
|
+
"publishConfig": {
|
|
139
|
+
"access": "public"
|
|
140
|
+
}
|
|
141
141
|
}
|
|
@@ -51,7 +51,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
51
51
|
const resolvedCollection = useMemo(() => resolveCollection<M>({
|
|
52
52
|
collection,
|
|
53
53
|
path,
|
|
54
|
-
fields: context.
|
|
54
|
+
fields: context.propertyConfigs
|
|
55
55
|
}), [collection, path]);
|
|
56
56
|
|
|
57
57
|
const handleCancel = useCallback(() => {
|
|
@@ -160,7 +160,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
160
160
|
.catch((e) => {
|
|
161
161
|
setError(e);
|
|
162
162
|
});
|
|
163
|
-
}, [internalValue, validation]);
|
|
163
|
+
}, [internalValue, validation, propertyKey, property, entity]);
|
|
164
164
|
|
|
165
165
|
const updateValue = (newValue: any | null) => {
|
|
166
166
|
|
|
@@ -454,6 +454,7 @@ function areEqual(prevProps: PropertyTableCellProps<any, any>, nextProps: Proper
|
|
|
454
454
|
prevProps.width === nextProps.width &&
|
|
455
455
|
equal(prevProps.property, nextProps.property) &&
|
|
456
456
|
equal(prevProps.value, nextProps.value) &&
|
|
457
|
+
equal(prevProps.entity.id, nextProps.entity.id) &&
|
|
457
458
|
equal(prevProps.entity.values, nextProps.entity.values)
|
|
458
459
|
;
|
|
459
460
|
}
|
|
@@ -52,7 +52,7 @@ import { Button, cn, IconButton, Markdown, Popover, TextField, Tooltip, Typograp
|
|
|
52
52
|
import { Skeleton } from "../../ui/Skeleton";
|
|
53
53
|
import { setIn } from "formik";
|
|
54
54
|
import { getSubcollectionColumnId } from "../EntityCollectionTable/internal/common";
|
|
55
|
-
import { KeyboardTabIcon, SearchIcon } from "../../icons";
|
|
55
|
+
import { AddIcon, KeyboardTabIcon, SearchIcon } from "../../icons";
|
|
56
56
|
import { useColumnIds } from "./useColumnsIds";
|
|
57
57
|
import { PopupFormField } from "../EntityCollectionTable/internal/popup_field/PopupFormField";
|
|
58
58
|
import { GetPropertyForProps } from "../EntityCollectionTable/EntityCollectionTableProps";
|
|
@@ -321,7 +321,7 @@ export const EntityCollectionView = React.memo(
|
|
|
321
321
|
const resolvedCollection = useMemo(() => resolveCollection<M>({
|
|
322
322
|
collection,
|
|
323
323
|
path: fullPath,
|
|
324
|
-
fields: context.
|
|
324
|
+
fields: context.propertyConfigs
|
|
325
325
|
}), [collection, fullPath]);
|
|
326
326
|
|
|
327
327
|
const getPropertyFor = useCallback(({
|
|
@@ -344,9 +344,9 @@ export const EntityCollectionView = React.memo(
|
|
|
344
344
|
propertyValue,
|
|
345
345
|
values: entity.values,
|
|
346
346
|
entityId: entity.id,
|
|
347
|
-
fields: context.
|
|
347
|
+
fields: context.propertyConfigs
|
|
348
348
|
});
|
|
349
|
-
}, [collection.properties, context.
|
|
349
|
+
}, [collection.properties, context.propertyConfigs, fullPath, resolvedCollection.properties]);
|
|
350
350
|
|
|
351
351
|
const displayedColumnIds = useColumnIds(resolvedCollection, true);
|
|
352
352
|
|
|
@@ -584,6 +584,7 @@ export const EntityCollectionView = React.memo(
|
|
|
584
584
|
onClick={onNewClick}
|
|
585
585
|
className="mt-4"
|
|
586
586
|
>
|
|
587
|
+
<AddIcon/>
|
|
587
588
|
Create your first entity
|
|
588
589
|
</Button>
|
|
589
590
|
</div>
|
|
@@ -32,7 +32,7 @@ export function EntityPreview<M extends Record<string, any>>(
|
|
|
32
32
|
path,
|
|
33
33
|
entityId: entity.id,
|
|
34
34
|
values: entity.values,
|
|
35
|
-
fields: context.
|
|
35
|
+
fields: context.propertyConfigs
|
|
36
36
|
}), [collection, path, entity]);
|
|
37
37
|
|
|
38
38
|
const appConfig: FireCMSContext | undefined = useFireCMSContext();
|
|
@@ -77,6 +77,7 @@ export function DefaultHomePage({
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
let additionalPluginChildrenStart: React.ReactNode | undefined;
|
|
80
|
+
let additionalPluginChildrenEnd: React.ReactNode | undefined;
|
|
80
81
|
let additionalPluginSections: React.ReactNode | undefined;
|
|
81
82
|
if (context.plugins) {
|
|
82
83
|
const sectionProps: PluginGenericProps = {
|
|
@@ -101,6 +102,13 @@ export function DefaultHomePage({
|
|
|
101
102
|
return <div key={`plugin_children_start_${i}`}>{plugin.homePage!.additionalChildrenStart}</div>;
|
|
102
103
|
})}
|
|
103
104
|
</div>;
|
|
105
|
+
|
|
106
|
+
additionalPluginChildrenEnd = <div className={"flex flex-col gap-2"}>
|
|
107
|
+
{context.plugins.filter(plugin => plugin.homePage?.additionalChildrenEnd)
|
|
108
|
+
.map((plugin, i) => {
|
|
109
|
+
return <div key={`plugin_children_start_${i}`}>{plugin.homePage!.additionalChildrenEnd}</div>;
|
|
110
|
+
})}
|
|
111
|
+
</div>;
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
return (
|
|
@@ -178,6 +186,8 @@ export function DefaultHomePage({
|
|
|
178
186
|
|
|
179
187
|
{additionalPluginSections}
|
|
180
188
|
|
|
189
|
+
{additionalPluginChildrenEnd}
|
|
190
|
+
|
|
181
191
|
{additionalChildrenEnd}
|
|
182
192
|
|
|
183
193
|
</Container>
|
|
@@ -251,8 +251,8 @@ export function ReferenceSelectionInner<M extends Record<string, any>>(
|
|
|
251
251
|
collection: collection,
|
|
252
252
|
path: fullPath,
|
|
253
253
|
values: {},
|
|
254
|
-
fields: context.
|
|
255
|
-
}), [collection, context.
|
|
254
|
+
fields: context.propertyConfigs
|
|
255
|
+
}), [collection, context.propertyConfigs, fullPath]);
|
|
256
256
|
|
|
257
257
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
258
258
|
const displayedColumnIds = useColumnIds(resolvedCollection, false);
|
package/src/core/FireCMS.tsx
CHANGED
|
@@ -30,7 +30,6 @@ const DEFAULT_COLLECTION_PATH = "/c";
|
|
|
30
30
|
* internal contexts and hooks.
|
|
31
31
|
*
|
|
32
32
|
* You only need to use this component if you are building a custom app.
|
|
33
|
-
* In most cases you can just use the {@link FirebaseCMSApp} component.
|
|
34
33
|
*
|
|
35
34
|
* @constructor
|
|
36
35
|
* @group Core
|
|
@@ -53,7 +52,7 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
53
52
|
baseCollectionPath = DEFAULT_COLLECTION_PATH,
|
|
54
53
|
plugins,
|
|
55
54
|
onAnalyticsEvent,
|
|
56
|
-
|
|
55
|
+
propertyConfigs,
|
|
57
56
|
entityViews,
|
|
58
57
|
components
|
|
59
58
|
} = props;
|
|
@@ -74,7 +73,9 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
74
73
|
const sideDialogsController = useBuildSideDialogsController();
|
|
75
74
|
const sideEntityController = useBuildSideEntityController(navigation, sideDialogsController);
|
|
76
75
|
|
|
77
|
-
const
|
|
76
|
+
const pluginsLoading = plugins?.some(p => p.loading) ?? false;
|
|
77
|
+
|
|
78
|
+
const loading = authController.initialLoading || navigation.loading || pluginsLoading;
|
|
78
79
|
|
|
79
80
|
const context: Partial<FireCMSContext> = useMemo(() => ({
|
|
80
81
|
entityLinkBuilder,
|
|
@@ -83,9 +84,9 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
83
84
|
plugins,
|
|
84
85
|
onAnalyticsEvent,
|
|
85
86
|
entityViews: entityViews ?? [],
|
|
86
|
-
|
|
87
|
+
propertyConfigs: propertyConfigs ?? {},
|
|
87
88
|
components
|
|
88
|
-
}), [dateTimeFormat, locale, plugins, entityViews,
|
|
89
|
+
}), [dateTimeFormat, locale, plugins, entityViews, propertyConfigs, components]);
|
|
89
90
|
|
|
90
91
|
if (navigation.navigationLoadingError) {
|
|
91
92
|
return (
|
package/src/form/EntityForm.tsx
CHANGED
|
@@ -157,7 +157,7 @@ function EntityFormInternal<M extends Record<string, any>>({
|
|
|
157
157
|
collection: inputCollection,
|
|
158
158
|
path,
|
|
159
159
|
values: entity?.values,
|
|
160
|
-
fields: context.
|
|
160
|
+
fields: context.propertyConfigs
|
|
161
161
|
}), [entity?.values, path]);
|
|
162
162
|
|
|
163
163
|
const mustSetCustomId: boolean = (status === "new" || status === "copy") &&
|
|
@@ -220,7 +220,7 @@ function EntityFormInternal<M extends Record<string, any>>({
|
|
|
220
220
|
entityId,
|
|
221
221
|
values: internalValues,
|
|
222
222
|
previousValues: initialValues,
|
|
223
|
-
fields: context.
|
|
223
|
+
fields: context.propertyConfigs
|
|
224
224
|
});
|
|
225
225
|
|
|
226
226
|
const onIdUpdate = collection.callbacks?.onIdUpdate;
|
|
@@ -373,7 +373,7 @@ function EntityFormInternal<M extends Record<string, any>>({
|
|
|
373
373
|
collection: resolveCollection({
|
|
374
374
|
collection,
|
|
375
375
|
path,
|
|
376
|
-
fields: context.
|
|
376
|
+
fields: context.propertyConfigs
|
|
377
377
|
}),
|
|
378
378
|
entityId,
|
|
379
379
|
path,
|