@firecms/core 3.1.0-canary.9e89e98 → 3.1.0
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/internal/popup_field/useDraggable.d.ts +2 -2
- package/dist/components/ErrorBoundary.d.ts +1 -1
- package/dist/components/VirtualTable/VirtualTableHeader.d.ts +1 -1
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/index.es.js +118 -54
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +118 -54
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useRestoreScroll.d.ts +1 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/plugins.d.ts +16 -0
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/resolutions.d.ts +2 -2
- package/package.json +9 -9
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +11 -11
- package/src/components/EntityCollectionView/EntityBoardCard.tsx +1 -1
- package/src/components/EntityCollectionView/EntityCard.tsx +4 -0
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +23 -3
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +32 -3
- package/src/components/VirtualTable/VirtualTable.tsx +116 -113
- package/src/components/VirtualTable/VirtualTableHeader.tsx +42 -42
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +3 -3
- package/src/core/DefaultAppBar.tsx +1 -1
- package/src/core/EntitySidePanel.tsx +28 -26
- package/src/core/field_configs.tsx +14 -9
- package/src/form/EntityForm.tsx +69 -60
- package/src/form/PropertyFieldBinding.tsx +3 -3
- package/src/form/components/ErrorFocus.tsx +3 -3
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +1 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +83 -83
- package/src/hooks/useBuildNavigationController.tsx +4 -4
- package/src/hooks/useValidateAuthenticator.tsx +1 -1
- package/src/internal/useBuildDataSource.ts +1 -2
- package/src/preview/PropertyPreview.tsx +1 -0
- package/src/types/analytics.ts +10 -0
- package/src/types/plugins.tsx +18 -0
- package/src/util/entities.ts +1 -1
- package/src/util/join_collections.ts +10 -8
- package/src/util/previews.ts +2 -2
- package/src/util/property_utils.tsx +1 -1
- package/src/util/resolutions.ts +5 -3
|
@@ -11,8 +11,8 @@ import { sortProperties } from "./collections";
|
|
|
11
11
|
import { isPropertyBuilder } from "./entities";
|
|
12
12
|
|
|
13
13
|
function applyModifyFunction(modifyCollection: ((props: ModifyCollectionProps) => (EntityCollection | void)) | undefined,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
collection: EntityCollection,
|
|
15
|
+
parentPaths: string[]) {
|
|
16
16
|
if (modifyCollection) {
|
|
17
17
|
const modified = modifyCollection({
|
|
18
18
|
collection,
|
|
@@ -34,9 +34,9 @@ function applyModifyFunction(modifyCollection: ((props: ModifyCollectionProps) =
|
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
36
|
export function joinCollectionLists(targetCollections: EntityCollection[],
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
sourceCollections: EntityCollection[] | undefined,
|
|
38
|
+
parentPaths: string[] = [],
|
|
39
|
+
modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void): EntityCollection[] {
|
|
40
40
|
|
|
41
41
|
// merge collections that are in both lists
|
|
42
42
|
const updatedCollections = (sourceCollections ?? [])
|
|
@@ -73,9 +73,9 @@ export function joinCollectionLists(targetCollections: EntityCollection[],
|
|
|
73
73
|
*
|
|
74
74
|
*/
|
|
75
75
|
export function mergeCollection(target: EntityCollection,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
source: EntityCollection,
|
|
77
|
+
parentPaths: string[] = [],
|
|
78
|
+
modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void
|
|
79
79
|
): EntityCollection {
|
|
80
80
|
|
|
81
81
|
const subcollectionsMerged = joinCollectionLists(
|
|
@@ -125,6 +125,8 @@ export function mergeCollection(target: EntityCollection,
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
function mergePropertyOrBuilder(target: PropertyOrBuilder, source: PropertyOrBuilder): PropertyOrBuilder {
|
|
128
|
+
if (!source) return target;
|
|
129
|
+
if (!target) return source;
|
|
128
130
|
if (isPropertyBuilder(source)) {
|
|
129
131
|
return source;
|
|
130
132
|
} else if (isPropertyBuilder(target)) {
|
package/src/util/previews.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthController, EntityCollection, PropertyConfig, ResolvedEntityCollection } from "../types";
|
|
1
|
+
import { AuthController, EntityCollection, Property, PropertyConfig, ResolvedEntityCollection } from "../types";
|
|
2
2
|
import { isReferenceProperty } from "./property_utils";
|
|
3
3
|
import { isPropertyBuilder } from "./entities";
|
|
4
4
|
import { getFieldConfig } from "../core";
|
|
@@ -33,7 +33,7 @@ export function getEntityTitlePropertyKey<M extends Record<string, any>>(collect
|
|
|
33
33
|
for (const key in collection.properties) {
|
|
34
34
|
const property = collection.properties[key];
|
|
35
35
|
if (!isPropertyBuilder(property)) {
|
|
36
|
-
const field = getFieldConfig(property, propertyConfigs);
|
|
36
|
+
const field = getFieldConfig(property as Property, propertyConfigs);
|
|
37
37
|
if (field?.key === "text_field") {
|
|
38
38
|
return key;
|
|
39
39
|
}
|
|
@@ -18,7 +18,7 @@ export function isReferenceProperty(
|
|
|
18
18
|
authController: AuthController,
|
|
19
19
|
propertyOrBuilder: PropertyOrBuilder,
|
|
20
20
|
fields: Record<string, PropertyConfig>) {
|
|
21
|
-
const resolvedProperty = resolveProperty({
|
|
21
|
+
const resolvedProperty: ResolvedProperty<any> | null = resolveProperty({
|
|
22
22
|
propertyKey: "ignore", // TODO
|
|
23
23
|
propertyOrBuilder,
|
|
24
24
|
propertyConfigs: fields,
|
package/src/util/resolutions.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Properties,
|
|
14
14
|
PropertiesOrBuilders,
|
|
15
15
|
Property,
|
|
16
|
+
PropertyBuilder,
|
|
16
17
|
PropertyConfig,
|
|
17
18
|
PropertyOrBuilder,
|
|
18
19
|
ResolvedArrayProperty,
|
|
@@ -62,6 +63,7 @@ export const resolveCollection = <M extends Record<string, any>,>
|
|
|
62
63
|
const usedPreviousValues = previousValues ?? values ?? defaultValues;
|
|
63
64
|
|
|
64
65
|
const resolvedProperties = Object.entries(collection.properties)
|
|
66
|
+
.filter(([, propertyOrBuilder]) => propertyOrBuilder != null)
|
|
65
67
|
.map(([key, propertyOrBuilder]) => {
|
|
66
68
|
const childResolvedProperty = resolveProperty({
|
|
67
69
|
propertyKey: key,
|
|
@@ -108,7 +110,7 @@ export function resolveProperty<T extends CMSType = CMSType, M extends Record<st
|
|
|
108
110
|
...props
|
|
109
111
|
}: {
|
|
110
112
|
propertyKey?: string,
|
|
111
|
-
propertyOrBuilder: PropertyOrBuilder<T, M> | ResolvedProperty<T
|
|
113
|
+
propertyOrBuilder: PropertyOrBuilder<T, M> | ResolvedProperty<T> | PropertyOrBuilder | Property | ResolvedProperty | undefined,
|
|
112
114
|
values?: Partial<M>,
|
|
113
115
|
previousValues?: Partial<M>,
|
|
114
116
|
path?: string,
|
|
@@ -120,7 +122,7 @@ export function resolveProperty<T extends CMSType = CMSType, M extends Record<st
|
|
|
120
122
|
authController: AuthController;
|
|
121
123
|
}): ResolvedProperty<T> | null {
|
|
122
124
|
|
|
123
|
-
if (typeof propertyOrBuilder === "object" && "resolved" in propertyOrBuilder) {
|
|
125
|
+
if (propertyOrBuilder !== null && typeof propertyOrBuilder === "object" && "resolved" in propertyOrBuilder) {
|
|
124
126
|
return propertyOrBuilder as ResolvedProperty<T>;
|
|
125
127
|
}
|
|
126
128
|
|
|
@@ -134,7 +136,7 @@ export function resolveProperty<T extends CMSType = CMSType, M extends Record<st
|
|
|
134
136
|
throw Error("Trying to resolve a property builder without specifying the entity path");
|
|
135
137
|
|
|
136
138
|
const usedPropertyValue = props.propertyKey ? getIn(props.values, props.propertyKey) : undefined;
|
|
137
|
-
const result: Property<T> | null = propertyOrBuilder({
|
|
139
|
+
const result: Property<T> | null = (propertyOrBuilder as PropertyBuilder<T, M>)({
|
|
138
140
|
...props,
|
|
139
141
|
path,
|
|
140
142
|
propertyValue: usedPropertyValue,
|