@firecms/core 3.0.0-canary.152 → 3.0.0-canary.154
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/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
- package/dist/index.es.js +10 -8
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -8
- package/dist/index.umd.js.map +1 -1
- package/dist/types/auth.d.ts +2 -0
- package/package.json +129 -125
- package/src/components/EntityPreview.tsx +6 -8
- package/src/contexts/SnackbarProvider.tsx +2 -0
- package/src/core/FireCMS.tsx +3 -0
- package/src/form/field_bindings/SwitchFieldBinding.tsx +25 -25
- package/src/types/auth.tsx +2 -0
package/dist/types/auth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { User } from "./user";
|
|
2
|
+
import { Role } from "./roles";
|
|
2
3
|
import { DataSourceDelegate } from "./datasource";
|
|
3
4
|
import { StorageSource } from "./storage";
|
|
4
5
|
/**
|
|
@@ -47,6 +48,7 @@ export type AuthController<USER extends User = any, ExtraData = any> = {
|
|
|
47
48
|
extra: ExtraData;
|
|
48
49
|
setExtra: (extra: ExtraData) => void;
|
|
49
50
|
setUser?: (user: USER | null) => void;
|
|
51
|
+
setUserRoles?: (roles: Role[]) => void;
|
|
50
52
|
};
|
|
51
53
|
/**
|
|
52
54
|
* Implement this function to allow access to specific users.
|
package/package.json
CHANGED
|
@@ -1,131 +1,135 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"name": "@firecms/core",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "3.0.0-canary.154",
|
|
5
|
+
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
|
+
"funding": {
|
|
7
|
+
"url": "https://github.com/sponsors/firecmsco"
|
|
8
|
+
},
|
|
9
|
+
"author": "FireCMS",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/firecmsco/firecms.git",
|
|
14
|
+
"directory": "packages/firecms_core"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.umd.js",
|
|
17
|
+
"module": "./dist/index.es.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"source": "src/index.ts",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=14"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"firebase",
|
|
25
|
+
"cms",
|
|
26
|
+
"admin",
|
|
27
|
+
"admin panel",
|
|
28
|
+
"firebase panel",
|
|
29
|
+
"firestore",
|
|
30
|
+
"headless",
|
|
31
|
+
"headless cms",
|
|
32
|
+
"content manager"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"watch": "vite build --watch",
|
|
36
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
37
|
+
"prepublishOnly": "run-s build",
|
|
38
|
+
"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",
|
|
39
|
+
"test:lint": "eslint \"src/**\" --quiet",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
|
|
42
|
+
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
43
|
+
},
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"import": "./dist/index.es.js",
|
|
47
|
+
"require": "./dist/index.umd.js",
|
|
48
|
+
"types": "./dist/index.d.ts"
|
|
8
49
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
50
|
+
"./package.json": "./package.json"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@firecms/editor": "^3.0.0-canary.154",
|
|
54
|
+
"@firecms/formex": "^3.0.0-canary.154",
|
|
55
|
+
"@firecms/ui": "^3.0.0-canary.154",
|
|
56
|
+
"@hello-pangea/dnd": "^17.0.0",
|
|
57
|
+
"@radix-ui/react-portal": "^1.1.2",
|
|
58
|
+
"clsx": "^2.1.1",
|
|
59
|
+
"date-fns": "^3.6.0",
|
|
60
|
+
"fuse.js": "^7.0.0",
|
|
61
|
+
"history": "^5.3.0",
|
|
62
|
+
"markdown-it": "^14.1.0",
|
|
63
|
+
"notistack": "^3.0.1",
|
|
64
|
+
"object-hash": "^3.0.0",
|
|
65
|
+
"react-dropzone": "^14.2.10",
|
|
66
|
+
"react-fast-compare": "^3.2.2",
|
|
67
|
+
"react-image-file-resizer": "^0.4.8",
|
|
68
|
+
"react-transition-group": "^4.4.5",
|
|
69
|
+
"react-use-measure": "^2.1.1",
|
|
70
|
+
"react-window": "^1.8.10",
|
|
71
|
+
"yup": "^0.32.11"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"firebase": "^10.5.2",
|
|
75
|
+
"react": "^18.3.1",
|
|
76
|
+
"react-dom": "^18.3.1",
|
|
77
|
+
"react-router": "^6.25.1",
|
|
78
|
+
"react-router-dom": "^6.25.1"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@jest/globals": "^29.7.0",
|
|
82
|
+
"@testing-library/react": "^16.0.1",
|
|
83
|
+
"@testing-library/user-event": "^14.5.2",
|
|
84
|
+
"@types/jest": "^29.5.14",
|
|
85
|
+
"@types/node": "^20.16.11",
|
|
86
|
+
"@types/object-hash": "^3.0.6",
|
|
87
|
+
"@types/react": "^18.3.12",
|
|
88
|
+
"@types/react-dom": "^18.3.1",
|
|
89
|
+
"@types/react-measure": "^2.0.12",
|
|
90
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
91
|
+
"cross-env": "^7.0.3",
|
|
92
|
+
"firebase": "^10.14.1",
|
|
93
|
+
"jest": "^29.7.0",
|
|
94
|
+
"npm-run-all": "^4.1.5",
|
|
95
|
+
"react-router": "^6.27.0",
|
|
96
|
+
"react-router-dom": "^6.27.0",
|
|
97
|
+
"ts-jest": "^29.2.5",
|
|
98
|
+
"ts-node": "^10.9.2",
|
|
99
|
+
"tsd": "^0.31.2",
|
|
100
|
+
"typescript": "^5.6.3",
|
|
101
|
+
"vite": "^5.4.10"
|
|
102
|
+
},
|
|
103
|
+
"files": [
|
|
104
|
+
"dist",
|
|
105
|
+
"src"
|
|
106
|
+
],
|
|
107
|
+
"gitHead": "52858cb15cdbbbb9c1b6ed8368e133304321cf49",
|
|
108
|
+
"publishConfig": {
|
|
109
|
+
"access": "public"
|
|
110
|
+
},
|
|
111
|
+
"eslintConfig": {
|
|
112
|
+
"extends": [
|
|
113
|
+
"react-app",
|
|
114
|
+
"react-app/jest"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"jest": {
|
|
118
|
+
"transform": {
|
|
119
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
18
120
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"headless cms",
|
|
28
|
-
"content manager"
|
|
121
|
+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
122
|
+
"moduleFileExtensions": [
|
|
123
|
+
"ts",
|
|
124
|
+
"tsx",
|
|
125
|
+
"js",
|
|
126
|
+
"jsx",
|
|
127
|
+
"json",
|
|
128
|
+
"node"
|
|
29
129
|
],
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
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/editor": "^3.0.0-canary.152",
|
|
50
|
-
"@firecms/formex": "^3.0.0-canary.152",
|
|
51
|
-
"@firecms/ui": "^3.0.0-canary.152",
|
|
52
|
-
"@hello-pangea/dnd": "^17.0.0",
|
|
53
|
-
"@radix-ui/react-portal": "^1.1.2",
|
|
54
|
-
"clsx": "^2.1.1",
|
|
55
|
-
"date-fns": "^3.6.0",
|
|
56
|
-
"fuse.js": "^7.0.0",
|
|
57
|
-
"history": "^5.3.0",
|
|
58
|
-
"markdown-it": "^14.1.0",
|
|
59
|
-
"notistack": "^3.0.1",
|
|
60
|
-
"object-hash": "^3.0.0",
|
|
61
|
-
"react-dropzone": "^14.2.10",
|
|
62
|
-
"react-fast-compare": "^3.2.2",
|
|
63
|
-
"react-image-file-resizer": "^0.4.8",
|
|
64
|
-
"react-transition-group": "^4.4.5",
|
|
65
|
-
"react-use-measure": "^2.1.1",
|
|
66
|
-
"react-window": "^1.8.10",
|
|
67
|
-
"yup": "^0.32.11"
|
|
68
|
-
},
|
|
69
|
-
"peerDependencies": {
|
|
70
|
-
"firebase": "^10.5.2",
|
|
71
|
-
"react": "^18.3.1",
|
|
72
|
-
"react-dom": "^18.3.1",
|
|
73
|
-
"react-router": "^6.25.1",
|
|
74
|
-
"react-router-dom": "^6.25.1"
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"@jest/globals": "^29.7.0",
|
|
78
|
-
"@testing-library/react": "^16.0.1",
|
|
79
|
-
"@testing-library/user-event": "^14.5.2",
|
|
80
|
-
"@types/jest": "^29.5.14",
|
|
81
|
-
"@types/node": "^20.16.11",
|
|
82
|
-
"@types/object-hash": "^3.0.6",
|
|
83
|
-
"@types/react": "^18.3.12",
|
|
84
|
-
"@types/react-dom": "^18.3.1",
|
|
85
|
-
"@types/react-measure": "^2.0.12",
|
|
86
|
-
"@vitejs/plugin-react": "^4.3.3",
|
|
87
|
-
"cross-env": "^7.0.3",
|
|
88
|
-
"firebase": "^10.14.1",
|
|
89
|
-
"jest": "^29.7.0",
|
|
90
|
-
"npm-run-all": "^4.1.5",
|
|
91
|
-
"react-router": "^6.27.0",
|
|
92
|
-
"react-router-dom": "^6.27.0",
|
|
93
|
-
"ts-jest": "^29.2.5",
|
|
94
|
-
"ts-node": "^10.9.2",
|
|
95
|
-
"tsd": "^0.31.2",
|
|
96
|
-
"typescript": "^5.6.3",
|
|
97
|
-
"vite": "^5.4.10"
|
|
98
|
-
},
|
|
99
|
-
"files": [
|
|
100
|
-
"dist",
|
|
101
|
-
"src"
|
|
102
|
-
],
|
|
103
|
-
"gitHead": "be8e639101ee20faccf85a5b0225a7ead151d2d9",
|
|
104
|
-
"publishConfig": {
|
|
105
|
-
"access": "public"
|
|
106
|
-
},
|
|
107
|
-
"eslintConfig": {
|
|
108
|
-
"extends": [
|
|
109
|
-
"react-app",
|
|
110
|
-
"react-app/jest"
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
"jest": {
|
|
114
|
-
"transform": {
|
|
115
|
-
"^.+\\.tsx?$": "ts-jest"
|
|
116
|
-
},
|
|
117
|
-
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
118
|
-
"moduleFileExtensions": [
|
|
119
|
-
"ts",
|
|
120
|
-
"tsx",
|
|
121
|
-
"js",
|
|
122
|
-
"jsx",
|
|
123
|
-
"json",
|
|
124
|
-
"node"
|
|
125
|
-
],
|
|
126
|
-
"testEnvironment": "node",
|
|
127
|
-
"moduleNameMapper": {
|
|
128
|
-
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js"
|
|
129
|
-
}
|
|
130
|
+
"testEnvironment": "node",
|
|
131
|
+
"moduleNameMapper": {
|
|
132
|
+
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js"
|
|
130
133
|
}
|
|
134
|
+
}
|
|
131
135
|
}
|
|
@@ -89,15 +89,13 @@ export function EntityPreview({
|
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
<div className={"flex flex-col grow-1 w-full
|
|
92
|
+
<div className={"flex flex-col grow-1 w-full m-1 shrink-1"} style={{
|
|
93
|
+
"maxWidth": "calc(100% - 96px)"
|
|
94
|
+
}}>
|
|
93
95
|
|
|
94
96
|
{size !== "small" && includeId && (
|
|
95
97
|
entity
|
|
96
|
-
? <div className={
|
|
97
|
-
size !== "large"
|
|
98
|
-
? "block whitespace-nowrap overflow-hidden truncate"
|
|
99
|
-
: ""
|
|
100
|
-
}`}>
|
|
98
|
+
? <div className={"block whitespace-nowrap overflow-hidden truncate"}>
|
|
101
99
|
<Typography variant={"caption"}
|
|
102
100
|
color={"disabled"}
|
|
103
101
|
className={"font-mono"}>
|
|
@@ -107,7 +105,7 @@ export function EntityPreview({
|
|
|
107
105
|
: <Skeleton/>)}
|
|
108
106
|
|
|
109
107
|
{titleProperty && (
|
|
110
|
-
<div className={"my-0.5 text-sm font-
|
|
108
|
+
<div className={"my-0.5 text-sm font-medium"}>
|
|
111
109
|
{
|
|
112
110
|
entity
|
|
113
111
|
? <PropertyPreview
|
|
@@ -147,7 +145,7 @@ export function EntityPreview({
|
|
|
147
145
|
</div>
|
|
148
146
|
|
|
149
147
|
{entity && includeEntityLink &&
|
|
150
|
-
<Tooltip title={`See details for ${entity.id}`}>
|
|
148
|
+
<Tooltip title={`See details for ${entity.id}`} className={"shrink-0"}>
|
|
151
149
|
<IconButton
|
|
152
150
|
color={"inherit"}
|
|
153
151
|
size={"medium"}
|
package/src/core/FireCMS.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import React, { useMemo } from "react";
|
|
2
4
|
import { CenteredView, Typography } from "@firecms/ui";
|
|
3
5
|
import { CustomizationController, EntityCollection, FireCMSContext, FireCMSPlugin, FireCMSProps, User } from "../types";
|
|
@@ -86,6 +88,7 @@ export function FireCMS<USER extends User, EC extends EntityCollection>(props: F
|
|
|
86
88
|
dataSourceDelegate,
|
|
87
89
|
plugins
|
|
88
90
|
});
|
|
91
|
+
|
|
89
92
|
if (accessResponse?.message) {
|
|
90
93
|
console.warn(accessResponse.message);
|
|
91
94
|
}
|
|
@@ -16,18 +16,18 @@ type SwitchFieldProps = FieldProps<boolean>;
|
|
|
16
16
|
* and tables to the specified properties.
|
|
17
17
|
* @group Form fields
|
|
18
18
|
*/
|
|
19
|
-
export const SwitchFieldBinding =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
export const SwitchFieldBinding = function SwitchFieldBinding({
|
|
20
|
+
propertyKey,
|
|
21
|
+
value,
|
|
22
|
+
setValue,
|
|
23
|
+
error,
|
|
24
|
+
showError,
|
|
25
|
+
autoFocus,
|
|
26
|
+
disabled,
|
|
27
|
+
size = "large",
|
|
28
|
+
property,
|
|
29
|
+
includeDescription
|
|
30
|
+
}: SwitchFieldProps) {
|
|
31
31
|
|
|
32
32
|
useClearRestoreValue({
|
|
33
33
|
property,
|
|
@@ -39,18 +39,18 @@ export const SwitchFieldBinding = React.forwardRef(function SwitchFieldBinding({
|
|
|
39
39
|
<>
|
|
40
40
|
|
|
41
41
|
<PropertyIdCopyTooltip propertyKey={propertyKey}>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
<BooleanSwitchWithLabel
|
|
43
|
+
value={value}
|
|
44
|
+
onValueChange={(v) => setValue(v)}
|
|
45
|
+
error={showError}
|
|
46
|
+
label={<LabelWithIcon
|
|
47
|
+
icon={getIconForProperty(property, "small")}
|
|
48
|
+
required={property.validation?.required}
|
|
49
|
+
title={property.name}/>}
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
autoFocus={autoFocus}
|
|
52
|
+
size={size}
|
|
53
|
+
/>
|
|
54
54
|
</PropertyIdCopyTooltip>
|
|
55
55
|
|
|
56
56
|
<FieldHelperText includeDescription={includeDescription}
|
|
@@ -61,4 +61,4 @@ export const SwitchFieldBinding = React.forwardRef(function SwitchFieldBinding({
|
|
|
61
61
|
</>
|
|
62
62
|
|
|
63
63
|
);
|
|
64
|
-
}
|
|
64
|
+
};
|