@firecms/core 3.0.0-canary.44 → 3.0.0-canary.46
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 +1 -1
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/index.es.js +12390 -12384
- 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 +7 -0
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/util/icon_synonyms.d.ts +1 -4
- package/dist/util/resolutions.d.ts +3 -6
- package/package.json +139 -122
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +2 -4
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +4 -2
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +5 -5
- package/src/components/FireCMSAppBar.tsx +3 -4
- package/src/components/HomePage/SmallNavigationCard.tsx +3 -3
- package/src/components/SearchIconsView.tsx +4 -4
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/core/EntityEditView.tsx +2 -3
- package/src/form/EntityForm.tsx +25 -9
- package/src/form/PropertyFieldBinding.tsx +0 -2
- package/src/internal/useBuildSideEntityController.tsx +70 -10
- package/src/preview/PropertyPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +0 -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 +0 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +0 -1
- package/src/types/collections.ts +9 -0
- package/src/types/entity_actions.tsx +16 -3
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +1 -4
- package/src/util/objects.ts +0 -14
- package/src/util/resolutions.ts +4 -21
- package/dist/core/SideEntityView.d.ts +0 -7
- package/src/core/SideEntityView.tsx +0 -38
|
@@ -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.
|
|
@@ -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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const iconSynonyms: {
|
|
2
2
|
abc: string;
|
|
3
3
|
access_alarm: string;
|
|
4
4
|
access_alarms: string;
|
|
@@ -84,7 +84,6 @@ export declare const icon_synonyms: {
|
|
|
84
84
|
apartment: string;
|
|
85
85
|
api: string;
|
|
86
86
|
app_blocking: string;
|
|
87
|
-
apple: string;
|
|
88
87
|
app_registration: string;
|
|
89
88
|
approval: string;
|
|
90
89
|
apps: string;
|
|
@@ -527,7 +526,6 @@ export declare const icon_synonyms: {
|
|
|
527
526
|
egg_alt: string;
|
|
528
527
|
eighteen_mp: string;
|
|
529
528
|
eight_k: string;
|
|
530
|
-
eight_k_plus: string;
|
|
531
529
|
eight_mp: string;
|
|
532
530
|
eightteen_mp: string;
|
|
533
531
|
eject: string;
|
|
@@ -722,7 +720,6 @@ export declare const icon_synonyms: {
|
|
|
722
720
|
four_g_mobiledata: string;
|
|
723
721
|
four_g_plus_mobiledata: string;
|
|
724
722
|
four_k: string;
|
|
725
|
-
four_k_plus: string;
|
|
726
723
|
four_mp: string;
|
|
727
724
|
fourteen_mp: string;
|
|
728
725
|
free_breakfast: string;
|
|
@@ -14,10 +14,9 @@ export declare const resolveCollection: <M extends Record<string, any>>({ collec
|
|
|
14
14
|
* @param propertyValue
|
|
15
15
|
* @param values
|
|
16
16
|
*/
|
|
17
|
-
export declare function resolveProperty<T extends CMSType = CMSType, M extends Record<string, any> = any>({ propertyOrBuilder,
|
|
17
|
+
export declare function resolveProperty<T extends CMSType = CMSType, M extends Record<string, any> = any>({ propertyOrBuilder, fromBuilder, ...props }: {
|
|
18
18
|
propertyKey?: string;
|
|
19
19
|
propertyOrBuilder: PropertyOrBuilder<T, M> | ResolvedProperty<T>;
|
|
20
|
-
propertyValue?: unknown;
|
|
21
20
|
values?: Partial<M>;
|
|
22
21
|
previousValues?: Partial<M>;
|
|
23
22
|
path?: string;
|
|
@@ -26,10 +25,9 @@ export declare function resolveProperty<T extends CMSType = CMSType, M extends R
|
|
|
26
25
|
fromBuilder?: boolean;
|
|
27
26
|
fields?: Record<string, PropertyConfig<any>>;
|
|
28
27
|
}): ResolvedProperty<T> | null;
|
|
29
|
-
export declare function resolveArrayProperty<T extends any[], M>({ propertyKey, property,
|
|
28
|
+
export declare function resolveArrayProperty<T extends any[], M>({ propertyKey, property, ...props }: {
|
|
30
29
|
propertyKey?: string;
|
|
31
30
|
property: ArrayProperty<T> | ResolvedArrayProperty<T>;
|
|
32
|
-
propertyValue: any;
|
|
33
31
|
values?: Partial<M>;
|
|
34
32
|
previousValues?: Partial<M>;
|
|
35
33
|
path?: string;
|
|
@@ -43,9 +41,8 @@ export declare function resolveArrayProperty<T extends any[], M>({ propertyKey,
|
|
|
43
41
|
* @param properties
|
|
44
42
|
* @param value
|
|
45
43
|
*/
|
|
46
|
-
export declare function resolveProperties<M extends Record<string, any>>({ properties,
|
|
44
|
+
export declare function resolveProperties<M extends Record<string, any>>({ properties, ...props }: {
|
|
47
45
|
properties: PropertiesOrBuilders<M>;
|
|
48
|
-
propertyValue: unknown;
|
|
49
46
|
values?: Partial<M>;
|
|
50
47
|
previousValues?: Partial<M>;
|
|
51
48
|
path?: string;
|
package/package.json
CHANGED
|
@@ -1,125 +1,142 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
"keywords": [
|
|
20
|
-
"firebase",
|
|
21
|
-
"cms",
|
|
22
|
-
"admin",
|
|
23
|
-
"admin panel",
|
|
24
|
-
"firebase panel",
|
|
25
|
-
"firestore",
|
|
26
|
-
"headless",
|
|
27
|
-
"headless cms",
|
|
28
|
-
"content manager"
|
|
29
|
-
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"watch": "vite build --watch",
|
|
32
|
-
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
33
|
-
"prepublishOnly": "run-s build",
|
|
34
|
-
"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",
|
|
35
|
-
"test:lint": "eslint \"src/**\" --quiet",
|
|
36
|
-
"test": "jest",
|
|
37
|
-
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
|
|
38
|
-
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
39
|
-
},
|
|
40
|
-
"exports": {
|
|
41
|
-
".": {
|
|
42
|
-
"import": "./dist/index.es.js",
|
|
43
|
-
"require": "./dist/index.umd.js",
|
|
44
|
-
"types": "./dist/index.d.ts"
|
|
2
|
+
"name": "@firecms/core",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "3.0.0-canary.46",
|
|
5
|
+
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
|
+
"funding": {
|
|
7
|
+
"url": "https://github.com/sponsors/firecmsco"
|
|
45
8
|
},
|
|
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
|
-
|
|
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
|
+
"keywords": [
|
|
20
|
+
"firebase",
|
|
21
|
+
"cms",
|
|
22
|
+
"admin",
|
|
23
|
+
"admin panel",
|
|
24
|
+
"firebase panel",
|
|
25
|
+
"firestore",
|
|
26
|
+
"headless",
|
|
27
|
+
"headless cms",
|
|
28
|
+
"content manager"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"watch": "vite build --watch",
|
|
32
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
33
|
+
"prepublishOnly": "run-s build",
|
|
34
|
+
"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",
|
|
35
|
+
"test:lint": "eslint \"src/**\" --quiet",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
|
|
38
|
+
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
39
|
+
},
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"import": "./dist/index.es.js",
|
|
43
|
+
"require": "./dist/index.umd.js",
|
|
44
|
+
"types": "./dist/index.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@firecms/formex": "^3.0.0-canary.46",
|
|
50
|
+
"@firecms/ui": "^3.0.0-canary.46",
|
|
51
|
+
"@fontsource/jetbrains-mono": "^5.0.19",
|
|
52
|
+
"@hello-pangea/dnd": "^16.6.0",
|
|
53
|
+
"@radix-ui/react-portal": "^1.0.4",
|
|
54
|
+
"clsx": "^2.1.0",
|
|
55
|
+
"date-fns": "^3.6.0",
|
|
56
|
+
"history": "^5.3.0",
|
|
57
|
+
"js-search": "^2.0.1",
|
|
58
|
+
"markdown-it": "^14.1.0",
|
|
59
|
+
"notistack": "^3.0.1",
|
|
60
|
+
"object-hash": "^3.0.0",
|
|
61
|
+
"react-dropzone": "^14.2.3",
|
|
62
|
+
"react-fast-compare": "^3.2.2",
|
|
63
|
+
"react-image-file-resizer": "^0.4.8",
|
|
64
|
+
"react-markdown-editor-lite": "^1.3.4",
|
|
65
|
+
"react-transition-group": "^4.4.5",
|
|
66
|
+
"react-use-measure": "^2.1.1",
|
|
67
|
+
"react-window": "^1.8.10",
|
|
68
|
+
"typeface-rubik": "^1.1.13",
|
|
69
|
+
"yup": "^0.32.11"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"firebase": "^10.5.2",
|
|
73
|
+
"react": "^18.2.0",
|
|
74
|
+
"react-dom": "^18.2.0",
|
|
75
|
+
"react-router": "^6.22.0",
|
|
76
|
+
"react-router-dom": "^6.22.0"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@jest/globals": "^29.7.0",
|
|
80
|
+
"@testing-library/react": "^14.3.1",
|
|
81
|
+
"@testing-library/user-event": "^14.5.2",
|
|
82
|
+
"@types/jest": "^29.5.12",
|
|
83
|
+
"@types/node": "^20.12.7",
|
|
84
|
+
"@types/object-hash": "^3.0.6",
|
|
85
|
+
"@types/react": "^18.2.79",
|
|
86
|
+
"@types/react-dom": "^18.2.25",
|
|
87
|
+
"@types/react-measure": "^2.0.12",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
89
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
90
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
91
|
+
"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.1.1",
|
|
97
|
+
"eslint-plugin-react": "^7.34.1",
|
|
98
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
99
|
+
"firebase": "^10.11.0",
|
|
100
|
+
"jest": "^29.7.0",
|
|
101
|
+
"npm-run-all": "^4.1.5",
|
|
102
|
+
"react-router": "^6.22.3",
|
|
103
|
+
"react-router-dom": "^6.22.3",
|
|
104
|
+
"ts-jest": "^29.1.2",
|
|
105
|
+
"ts-node": "^10.9.2",
|
|
106
|
+
"tsd": "^0.31.0",
|
|
107
|
+
"typescript": "^5.4.5",
|
|
108
|
+
"vite": "^5.2.9"
|
|
109
|
+
},
|
|
110
|
+
"files": [
|
|
111
|
+
"dist",
|
|
112
|
+
"src"
|
|
113
|
+
],
|
|
114
|
+
"gitHead": "7af477c065bf21042e06cb957803665ee504a712",
|
|
115
|
+
"publishConfig": {
|
|
116
|
+
"access": "public"
|
|
117
|
+
},
|
|
118
|
+
"eslintConfig": {
|
|
119
|
+
"extends": [
|
|
120
|
+
"react-app",
|
|
121
|
+
"react-app/jest"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"jest": {
|
|
125
|
+
"transform": {
|
|
126
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
127
|
+
},
|
|
128
|
+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
129
|
+
"moduleFileExtensions": [
|
|
130
|
+
"ts",
|
|
131
|
+
"tsx",
|
|
132
|
+
"js",
|
|
133
|
+
"jsx",
|
|
134
|
+
"json",
|
|
135
|
+
"node"
|
|
136
|
+
],
|
|
137
|
+
"testEnvironment": "node",
|
|
138
|
+
"moduleNameMapper": {
|
|
139
|
+
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
125
142
|
}
|
|
@@ -44,6 +44,7 @@ import { cn } from "@firecms/ui";
|
|
|
44
44
|
export const EntityCollectionTable = function EntityCollectionTable<M extends Record<string, any>, UserType extends User>
|
|
45
45
|
({
|
|
46
46
|
className,
|
|
47
|
+
style,
|
|
47
48
|
forceFilter,
|
|
48
49
|
actionsStart,
|
|
49
50
|
actions,
|
|
@@ -81,7 +82,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
81
82
|
const ref = useRef<HTMLDivElement>(null);
|
|
82
83
|
|
|
83
84
|
const largeLayout = useLargeLayout();
|
|
84
|
-
const disabledFilterChange = Boolean(forceFilter);
|
|
85
85
|
const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
|
|
86
86
|
|
|
87
87
|
const context: FireCMSContext<UserType> = useFireCMSContext();
|
|
@@ -120,10 +120,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
120
120
|
const propertyKey = column.key;
|
|
121
121
|
|
|
122
122
|
let disabled = column.custom?.disabled;
|
|
123
|
-
const propertyValue = entity.values ? getValueInPath(entity.values, propertyKey) : undefined;
|
|
124
123
|
const property = getPropertyFor?.({
|
|
125
124
|
propertyKey,
|
|
126
|
-
propertyValue,
|
|
127
125
|
entity
|
|
128
126
|
}) ?? column.custom.resolvedProperty;
|
|
129
127
|
if (!property?.disabled) {
|
|
@@ -211,7 +209,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
211
209
|
properties,
|
|
212
210
|
sortable,
|
|
213
211
|
forceFilter,
|
|
214
|
-
disabledFilter: disabledFilterChange,
|
|
215
212
|
AdditionalHeaderWidget
|
|
216
213
|
});
|
|
217
214
|
|
|
@@ -294,6 +291,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
294
291
|
return (
|
|
295
292
|
|
|
296
293
|
<div ref={ref}
|
|
294
|
+
style={style}
|
|
297
295
|
className={cn("h-full w-full flex flex-col bg-white dark:bg-gray-950", className)}>
|
|
298
296
|
|
|
299
297
|
<CollectionTableToolbar
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
AdditionalFieldDelegate,
|
|
4
4
|
CollectionSize,
|
|
5
|
-
Entity,
|
|
5
|
+
Entity,
|
|
6
6
|
EntityTableController,
|
|
7
7
|
FilterValues,
|
|
8
8
|
ResolvedProperties,
|
|
@@ -19,6 +19,9 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
|
|
|
19
19
|
UserType extends User = User> = {
|
|
20
20
|
|
|
21
21
|
className?: string;
|
|
22
|
+
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
|
|
22
25
|
/**
|
|
23
26
|
* Display these entities as selected
|
|
24
27
|
*/
|
|
@@ -137,7 +140,6 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
|
|
|
137
140
|
|
|
138
141
|
export type GetPropertyForProps<M extends Record<string, any>> = {
|
|
139
142
|
propertyKey: string,
|
|
140
|
-
propertyValue: any,
|
|
141
143
|
entity: Entity<M>
|
|
142
144
|
};
|
|
143
145
|
|
|
@@ -21,7 +21,6 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
|
|
|
21
21
|
properties: ResolvedProperties<M>;
|
|
22
22
|
sortable?: boolean;
|
|
23
23
|
forceFilter?: FilterValues<keyof M extends string ? keyof M : never>;
|
|
24
|
-
disabledFilter?: boolean;
|
|
25
24
|
AdditionalHeaderWidget?: React.ComponentType<{
|
|
26
25
|
property: ResolvedProperty,
|
|
27
26
|
propertyKey: string,
|
|
@@ -29,7 +28,8 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
|
|
|
29
28
|
}>;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter,
|
|
31
|
+
export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter, AdditionalHeaderWidget }: PropertiesToColumnsParams<M>): VirtualTableColumn[] {
|
|
32
|
+
const disabledFilter = Boolean(forceFilter);
|
|
33
33
|
return Object.entries<ResolvedProperty>(properties)
|
|
34
34
|
.flatMap(([key, property]) => getColumnKeysForProperty(property, key))
|
|
35
35
|
.map(({
|
|
@@ -45,7 +45,7 @@ export function propertiesToColumns<M extends Record<string, any>>({ properties,
|
|
|
45
45
|
align: getTableCellAlignment(property),
|
|
46
46
|
icon: getIconForProperty(property, "small"),
|
|
47
47
|
title: property.name ?? key as string,
|
|
48
|
-
sortable: sortable
|
|
48
|
+
sortable: sortable,
|
|
49
49
|
filter: !disabledFilter && filterable,
|
|
50
50
|
width: getTablePropertyColumnWidth(property),
|
|
51
51
|
resizable: true,
|
|
@@ -34,7 +34,8 @@ import {
|
|
|
34
34
|
saveEntityWithCallbacks,
|
|
35
35
|
useAuthController,
|
|
36
36
|
useCustomizationController,
|
|
37
|
-
useDataSource,
|
|
37
|
+
useDataSource,
|
|
38
|
+
useFireCMSContext,
|
|
38
39
|
useLargeLayout,
|
|
39
40
|
useNavigationController,
|
|
40
41
|
useSideEntityController
|
|
@@ -199,8 +200,7 @@ export const EntityCollectionView = React.memo(
|
|
|
199
200
|
|
|
200
201
|
const tableController = useDataSourceEntityCollectionTableController<M>({
|
|
201
202
|
fullPath,
|
|
202
|
-
collection
|
|
203
|
-
entitiesDisplayedFirst: [],
|
|
203
|
+
collection,
|
|
204
204
|
lastDeleteTimestamp
|
|
205
205
|
});
|
|
206
206
|
|
|
@@ -359,7 +359,6 @@ export const EntityCollectionView = React.memo(
|
|
|
359
359
|
|
|
360
360
|
const getPropertyFor = useCallback(({
|
|
361
361
|
propertyKey,
|
|
362
|
-
propertyValue,
|
|
363
362
|
entity
|
|
364
363
|
}: GetPropertyForProps<M>) => {
|
|
365
364
|
let propertyOrBuilder: PropertyOrBuilder<any, M> | undefined = getPropertyInPath<M>(collection.properties, propertyKey);
|
|
@@ -374,7 +373,6 @@ export const EntityCollectionView = React.memo(
|
|
|
374
373
|
propertyKey,
|
|
375
374
|
propertyOrBuilder,
|
|
376
375
|
path: fullPath,
|
|
377
|
-
propertyValue,
|
|
378
376
|
values: entity.values,
|
|
379
377
|
entityId: entity.id,
|
|
380
378
|
fields: customizationController.propertyConfigs
|
|
@@ -709,6 +707,7 @@ export const EntityCollectionView = React.memo(
|
|
|
709
707
|
equal(a.initialSort, b.initialSort) &&
|
|
710
708
|
equal(a.textSearchEnabled, b.textSearchEnabled) &&
|
|
711
709
|
equal(a.additionalFields, b.additionalFields) &&
|
|
710
|
+
equal(a.sideDialogWidth, b.sideDialogWidth) &&
|
|
712
711
|
equal(a.forceFilter, b.forceFilter);
|
|
713
712
|
}) as React.FunctionComponent<EntityCollectionViewProps<any>>
|
|
714
713
|
|
|
@@ -748,6 +747,7 @@ function EntitiesCount({
|
|
|
748
747
|
|
|
749
748
|
useEffect(() => {
|
|
750
749
|
if (onCountChange) {
|
|
750
|
+
setError(undefined);
|
|
751
751
|
onCountChange(count ?? 0);
|
|
752
752
|
}
|
|
753
753
|
}, [onCountChange, count]);
|
|
@@ -96,7 +96,7 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
96
96
|
className={cn("pr-2",
|
|
97
97
|
{
|
|
98
98
|
"ml-[17rem]": drawerOpen && largeLayout,
|
|
99
|
-
"ml-16": includeDrawer && !(drawerOpen && largeLayout)
|
|
99
|
+
"ml-16": includeDrawer && !(drawerOpen && largeLayout),
|
|
100
100
|
"h-16": true,
|
|
101
101
|
"z-10": largeLayout,
|
|
102
102
|
"transition-all": true,
|
|
@@ -112,9 +112,6 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
112
112
|
|
|
113
113
|
<div className="flex flex-row gap-2 px-4 h-full items-center">
|
|
114
114
|
|
|
115
|
-
{startAdornment}
|
|
116
|
-
|
|
117
|
-
|
|
118
115
|
{navigation && <div className="mr-8 hidden lg:block">
|
|
119
116
|
<ReactLink
|
|
120
117
|
className="visited:text-inherit visited:dark:text-inherit"
|
|
@@ -138,6 +135,8 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
138
135
|
</ReactLink>
|
|
139
136
|
</div>}
|
|
140
137
|
|
|
138
|
+
{startAdornment}
|
|
139
|
+
|
|
141
140
|
<div className={"flex-grow"}/>
|
|
142
141
|
|
|
143
142
|
{endAdornment &&
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArrowForwardIcon, cardClickableMixin, cardMixin, cn, focusedMixin, Typography, } from "@firecms/ui";
|
|
2
2
|
|
|
3
|
-
import { Link
|
|
3
|
+
import { Link } from "react-router-dom";
|
|
4
4
|
|
|
5
5
|
export type SmallNavigationCardProps = {
|
|
6
6
|
name: string,
|
|
@@ -17,7 +17,7 @@ export function SmallNavigationCard({
|
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
19
19
|
|
|
20
|
-
<
|
|
20
|
+
<Link
|
|
21
21
|
tabIndex={0}
|
|
22
22
|
className={cn(cardMixin,
|
|
23
23
|
cardClickableMixin,
|
|
@@ -39,7 +39,7 @@ export function SmallNavigationCard({
|
|
|
39
39
|
<div className={"p-4"}>
|
|
40
40
|
<ArrowForwardIcon color="primary"/>
|
|
41
41
|
</div>
|
|
42
|
-
</
|
|
42
|
+
</Link>
|
|
43
43
|
|
|
44
44
|
</>);
|
|
45
45
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { coolIconKeys, debounce, Icon, IconButton, iconKeys, SearchBar, Tooltip } from "@firecms/ui";
|
|
4
|
-
import {
|
|
4
|
+
import { iconSynonyms, iconsSearch } from "../util";
|
|
5
5
|
|
|
6
6
|
const UPDATE_SEARCH_INDEX_WAIT_MS = 220;
|
|
7
7
|
|
|
8
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9
|
-
Object.keys(
|
|
8
|
+
if (iconSynonyms && process.env.NODE_ENV !== "production") {
|
|
9
|
+
Object.keys(iconSynonyms).forEach((icon: string) => {
|
|
10
10
|
if (!iconKeys.includes(icon)) {
|
|
11
|
-
console.warn(`The icon ${icon} no longer exists. Remove it from \`
|
|
11
|
+
console.warn(`The icon ${icon} no longer exists. Remove it from \`iconSynonyms\``);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
User
|
|
13
13
|
} from "../../types";
|
|
14
14
|
import { useDebouncedData } from "./useDebouncedData";
|
|
15
|
+
import equal from "react-fast-compare"
|
|
15
16
|
|
|
16
17
|
const DEFAULT_PAGE_SIZE = 50;
|
|
17
18
|
|
|
@@ -31,6 +32,10 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
|
|
|
31
32
|
entitiesDisplayedFirst?: Entity<M>[];
|
|
32
33
|
|
|
33
34
|
lastDeleteTimestamp?: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Force filter to be applied to the table.
|
|
38
|
+
*/
|
|
34
39
|
forceFilter?: FilterValues<string>;
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -83,6 +88,12 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
|
|
|
83
88
|
return initialSort;
|
|
84
89
|
}, [initialSort, forceFilter]);
|
|
85
90
|
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!equal(forceFilter, filterValues)) {
|
|
93
|
+
setFilterValues(forceFilter)
|
|
94
|
+
}
|
|
95
|
+
}, [forceFilter]);
|
|
96
|
+
|
|
86
97
|
const [filterValues, setFilterValues] = React.useState<FilterValues<Extract<keyof M, string>> | undefined>(forceFilter ?? initialFilter ?? undefined);
|
|
87
98
|
const [sortBy, setSortBy] = React.useState<[Extract<keyof M, string>, "asc" | "desc"] | undefined>(initialSortInternal);
|
|
88
99
|
|
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
import { EntityForm } from "../form";
|
|
32
32
|
import { CircularProgress, CloseIcon, cn, defaultBorderMixin, IconButton, Tab, Tabs, Typography } from "@firecms/ui";
|
|
33
33
|
import { EntityFormSaveParams } from "../form/EntityForm";
|
|
34
|
-
import { FORM_CONTAINER_WIDTH } from "../internal/common";
|
|
35
34
|
import { useSideDialogContext } from "./index";
|
|
36
35
|
|
|
37
36
|
const MAIN_TAB_VALUE = "main_##Q$SC^#S6";
|
|
@@ -91,8 +90,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
91
90
|
|
|
92
91
|
// const largeLayout = useLargeLayout();
|
|
93
92
|
// const largeLayoutTabSelected = useRef(!largeLayout);
|
|
94
|
-
|
|
95
|
-
const resolvedFormWidth: string = typeof formWidth === "number" ? `${formWidth}px` : formWidth ?? FORM_CONTAINER_WIDTH;
|
|
93
|
+
// const resolvedFormWidth: string = typeof formWidth === "number" ? `${formWidth}px` : formWidth ?? FORM_CONTAINER_WIDTH;
|
|
96
94
|
|
|
97
95
|
const dataSource = useDataSource(collection);
|
|
98
96
|
const sideDialogContext = useSideDialogContext();
|
|
@@ -395,6 +393,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
395
393
|
onValuesAreModified(dirty);
|
|
396
394
|
}
|
|
397
395
|
|
|
396
|
+
console.log("eeee", collection);
|
|
398
397
|
function buildForm() {
|
|
399
398
|
const plugins = customizationController.plugins;
|
|
400
399
|
let form = <EntityForm
|