@firecms/core 3.0.0-canary.282 → 3.0.0-canary.283

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.
@@ -5,4 +5,4 @@ import { PropertyPreviewProps } from "../PropertyPreviewProps";
5
5
  *
6
6
  * @group Preview components
7
7
  */
8
- export declare function UserPreview({ value }: PropertyPreviewProps<string>): import("react/jsx-runtime").JSX.Element | null;
8
+ export declare function UserPreview({ value }: PropertyPreviewProps<string>): import("react/jsx-runtime").JSX.Element;
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.282",
4
+ "version": "3.0.0-canary.283",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -53,9 +53,9 @@
53
53
  "@dnd-kit/core": "^6.3.1",
54
54
  "@dnd-kit/modifiers": "^9.0.0",
55
55
  "@dnd-kit/sortable": "^10.0.0",
56
- "@firecms/editor": "^3.0.0-canary.282",
57
- "@firecms/formex": "^3.0.0-canary.282",
58
- "@firecms/ui": "^3.0.0-canary.282",
56
+ "@firecms/editor": "^3.0.0-canary.283",
57
+ "@firecms/formex": "^3.0.0-canary.283",
58
+ "@firecms/ui": "^3.0.0-canary.283",
59
59
  "@radix-ui/react-portal": "^1.1.9",
60
60
  "clsx": "^2.1.1",
61
61
  "date-fns": "^3.6.0",
@@ -108,7 +108,7 @@
108
108
  "dist",
109
109
  "src"
110
110
  ],
111
- "gitHead": "54f09d9dfe3736fe2fb1258dc40cbdfda6b26d29",
111
+ "gitHead": "521154e8ee22424451421052cbc22fa6ba5b4d4d",
112
112
  "publishConfig": {
113
113
  "access": "public"
114
114
  },
@@ -9,7 +9,7 @@ export function PropertyConfigBadge({
9
9
  propertyConfig: PropertyConfig | undefined,
10
10
  disabled?: boolean
11
11
  }): React.ReactNode {
12
- const classes = "h-8 w-8 p-1 rounded-full shadow text-white " + (disabled ? "bg-surface-400 dark:bg-surface-600" : "");
12
+ const classes = "h-8 w-8 flex items-center justify-center rounded-full shadow text-white " + (disabled ? "bg-surface-400 dark:bg-surface-600" : "");
13
13
 
14
14
  const defaultPropertyConfig = typeof propertyConfig?.property === "object" ? getDefaultFieldConfig(propertyConfig.property) : undefined;
15
15
 
@@ -18,6 +18,6 @@ export function PropertyConfigBadge({
18
18
  style={{
19
19
  background: !disabled ? (propertyConfig?.color ?? defaultPropertyConfig?.color ?? "#888") : undefined
20
20
  }}>
21
- {propertyConfig?.Icon ? getIconForWidget(propertyConfig, "medium") : getIconForWidget(defaultPropertyConfig, "medium")}
21
+ {propertyConfig?.Icon ? getIconForWidget(propertyConfig, "small") : getIconForWidget(defaultPropertyConfig, "small")}
22
22
  </div>
23
23
  }
@@ -1,5 +1,6 @@
1
1
  import { User } from "../types";
2
2
  import { AccountCircleIcon, cls, defaultBorderMixin } from "@firecms/ui";
3
+ import { EmptyValue } from "../preview";
3
4
 
4
5
  /**
5
6
  * Component to render a single user with name and email
@@ -8,7 +9,7 @@ export function UserDisplay({
8
9
  user,
9
10
  }: { user: User | null }) {
10
11
  if (!user) {
11
- return <span className="text-text-secondary dark:text-text-secondary-dark">Select a user</span>;
12
+ return <EmptyValue/>;
12
13
  }
13
14
 
14
15
  const avatarSizeClass = "w-6 h-6";
@@ -93,6 +93,10 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
93
93
  const authController = useAuthController();
94
94
  const customizationController = useCustomizationController();
95
95
 
96
+ if(propertyKey === "created_by"){
97
+ console.log("Rendering field for created_by", {propertyKey, property, context});
98
+ }
99
+
96
100
  return (
97
101
  <Field
98
102
  key={propertyKey}
@@ -457,8 +457,9 @@ export function useBuildNavigationController<EC extends EntityCollection, USER e
457
457
  [fullCollectionPath]);
458
458
 
459
459
  const urlPathToDataPath = useCallback((path: string): string => {
460
- if (path.startsWith(fullCollectionPath))
461
- return path.replace(fullCollectionPath, "");
460
+ const decodedPath = decodeURIComponent(path);
461
+ if (decodedPath.startsWith(fullCollectionPath))
462
+ return decodedPath.replace(fullCollectionPath, "");
462
463
  throw Error("Expected path starting with " + fullCollectionPath);
463
464
  }, [fullCollectionPath]);
464
465
 
@@ -2,6 +2,8 @@ import React from "react";
2
2
  import { PropertyPreviewProps } from "../PropertyPreviewProps";
3
3
  import { useInternalUserManagementController } from "../../hooks";
4
4
  import { UserDisplay } from "../../components/UserDisplay";
5
+ import { EmptyValue } from "./EmptyValue";
6
+ import { Typography } from "@firecms/ui";
5
7
 
6
8
  /**
7
9
  * Preview component for displaying user information.
@@ -13,10 +15,13 @@ export function UserPreview({ value }: PropertyPreviewProps<string>) {
13
15
  const { getUser } = useInternalUserManagementController();
14
16
 
15
17
  if (!value) {
16
- return null;
18
+ return <EmptyValue/>;
17
19
  }
18
20
 
19
21
  const user = getUser(value);
22
+ if (!user) {
23
+ return <Typography variant={"caption"} color={"secondary"}>User not found: {value}</Typography>;
24
+ }
20
25
 
21
- return <UserDisplay user={user} />;
26
+ return <UserDisplay user={user}/>;
22
27
  }
@@ -42,7 +42,7 @@ export function ArrayPropertyPreview({
42
42
  const childSize: PreviewSize = size === "medium" ? "medium" : "small";
43
43
 
44
44
  return (
45
- <div className="flex flex-col gap-2">
45
+ <div className="w-full flex flex-col gap-2">
46
46
  {values &&
47
47
  values.map((value, index) => {
48
48
  const of: ResolvedProperty = property.resolvedProperties[index] ??