@firecms/core 3.0.0-alpha.50 → 3.0.0-alpha.51
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/ErrorBoundary.d.ts +1 -1
- package/dist/{form/form_field_configs.d.ts → core/field_configs.d.ts} +2 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/form/index.d.ts +0 -1
- package/dist/index.es.js +5892 -5882
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/src/components/FieldConfigBadge.tsx +5 -2
- package/src/{form/form_field_configs.tsx → core/field_configs.tsx} +9 -1
- package/src/core/index.tsx +2 -0
- package/src/form/PropertyFieldBinding.tsx +1 -1
- package/src/form/index.tsx +0 -2
- package/src/util/property_utils.tsx +1 -1
- package/src/util/resolutions.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.51",
|
|
4
4
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
5
5
|
"funding": {
|
|
6
6
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@date-io/date-fns": "^2.17.0",
|
|
49
|
-
"@firecms/ui": "^3.0.0-alpha.
|
|
49
|
+
"@firecms/ui": "^3.0.0-alpha.51",
|
|
50
50
|
"@fontsource/ibm-plex-mono": "^5.0.8",
|
|
51
51
|
"@fontsource/roboto": "^5.0.8",
|
|
52
52
|
"@hello-pangea/dnd": "^16.5.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"dist",
|
|
117
117
|
"src"
|
|
118
118
|
],
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "d47d8dad9356b48398b65559b7a59926f3d50373",
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
|
122
122
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { getIconForWidget } from "../util";
|
|
2
2
|
import { PropertyConfig } from "../types";
|
|
3
|
+
import { getDefaultFieldConfig } from "../core";
|
|
3
4
|
|
|
4
5
|
export function FieldConfigBadge({ propertyConfig }: { propertyConfig: PropertyConfig | undefined }): React.ReactNode {
|
|
5
6
|
const classes = "h-8 w-8 p-1 rounded-full shadow text-white";
|
|
6
7
|
|
|
8
|
+
const defaultPropertyConfig = typeof propertyConfig?.property === "object" ? getDefaultFieldConfig(propertyConfig.property) : undefined;
|
|
9
|
+
|
|
7
10
|
return <div
|
|
8
11
|
className={classes}
|
|
9
12
|
style={{
|
|
10
|
-
background: propertyConfig?.color ?? "#888"
|
|
13
|
+
background: propertyConfig?.color ?? defaultPropertyConfig?.color ?? "#888"
|
|
11
14
|
}}>
|
|
12
|
-
{getIconForWidget(propertyConfig, "medium")}
|
|
15
|
+
{propertyConfig?.Icon ? getIconForWidget(propertyConfig, "medium") : getIconForWidget(defaultPropertyConfig, "medium")}
|
|
13
16
|
</div>
|
|
14
17
|
}
|
|
@@ -313,10 +313,18 @@ export const DEFAULT_FIELD_CONFIGS: Record<string, PropertyConfig<any>> = {
|
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
+
export function getDefaultFieldConfig(property: Property | ResolvedProperty): PropertyConfig | undefined {
|
|
317
|
+
const fieldId = getDefaultFieldId(property);
|
|
318
|
+
if (!fieldId) {
|
|
319
|
+
console.error("No field id found for property", property);
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
return DEFAULT_FIELD_CONFIGS[fieldId];
|
|
323
|
+
}
|
|
324
|
+
|
|
316
325
|
export function getFieldConfig(property: Property | ResolvedProperty, propertyConfigs: Record<string, PropertyConfig<any>>): PropertyConfig | undefined {
|
|
317
326
|
const fieldId = getFieldId(property);
|
|
318
327
|
const defaultFieldId = getDefaultFieldId(property);
|
|
319
|
-
// console.log("fieldId", { fieldId });
|
|
320
328
|
if (!defaultFieldId) {
|
|
321
329
|
console.error("No field id found for property", property);
|
|
322
330
|
return undefined;
|
package/src/core/index.tsx
CHANGED
|
@@ -6,6 +6,8 @@ export { Scaffold } from "./Scaffold";
|
|
|
6
6
|
export type { DrawerProps } from "./Drawer";
|
|
7
7
|
export { Drawer, DrawerNavigationItem } from "./Drawer";
|
|
8
8
|
|
|
9
|
+
export * from "./field_configs";
|
|
10
|
+
|
|
9
11
|
export * from "./SideDialogs";
|
|
10
12
|
export * from "./NavigationRoutes";
|
|
11
13
|
export * from "./useBuildModeController";
|
|
@@ -19,7 +19,7 @@ import { ReadOnlyFieldBinding } from "./field_bindings/ReadOnlyFieldBinding";
|
|
|
19
19
|
import { isHidden, isPropertyBuilder, isReadOnly, resolveProperty } from "../util";
|
|
20
20
|
import { useFireCMSContext } from "../hooks";
|
|
21
21
|
import { Typography } from "@firecms/ui";
|
|
22
|
-
import { getFieldConfig, getFieldId } from "../
|
|
22
|
+
import { getFieldConfig, getFieldId } from "../core";
|
|
23
23
|
import { ErrorBoundary } from "../components";
|
|
24
24
|
|
|
25
25
|
/**
|
package/src/form/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { EntityCollection, PropertiesOrBuilders, PropertyConfig, PropertyOrBuild
|
|
|
4
4
|
import { isPropertyBuilder } from "./entities";
|
|
5
5
|
import { resolveProperty } from "./resolutions";
|
|
6
6
|
import { CircleIcon, FunctionsIcon } from "@firecms/ui";
|
|
7
|
-
import { getFieldConfig } from "../
|
|
7
|
+
import { getFieldConfig } from "../core";
|
|
8
8
|
|
|
9
9
|
export function isReferenceProperty(propertyOrBuilder: PropertyOrBuilder,
|
|
10
10
|
fields: Record<string, PropertyConfig>) {
|
package/src/util/resolutions.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { getDefaultValuesFor, isPropertyBuilder } from "./entities";
|
|
|
26
26
|
import { DEFAULT_ONE_OF_TYPE } from "./common";
|
|
27
27
|
import { getIn } from "formik";
|
|
28
28
|
import { enumToObjectEntries } from "./enums";
|
|
29
|
-
import { isDefaultFieldConfigId } from "../
|
|
29
|
+
import { isDefaultFieldConfigId } from "../core";
|
|
30
30
|
|
|
31
31
|
export const resolveCollection = <M extends Record<string, any>, >
|
|
32
32
|
({
|