@firecms/core 3.0.0-alpha.59 → 3.0.0-alpha.60
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/ReferenceWidget.d.ts +9 -8
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/entities.d.ts +1 -1
- package/dist/util/entities.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/ReferenceWidget.tsx +22 -20
- package/src/types/entities.ts +1 -1
- package/src/util/entities.ts +1 -1
package/dist/types/entities.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type EntityValues<M extends object> = M;
|
|
|
31
31
|
/**
|
|
32
32
|
* Class used to create a reference to an entity in a different path
|
|
33
33
|
*/
|
|
34
|
-
export declare class EntityReference {
|
|
34
|
+
export declare class EntityReference<M extends Record<string, any> = any> {
|
|
35
35
|
/**
|
|
36
36
|
* ID of the entity
|
|
37
37
|
*/
|
package/dist/util/entities.d.ts
CHANGED
|
@@ -23,6 +23,6 @@ export declare function updateDateAutoValues<M extends Record<string, any>>({ in
|
|
|
23
23
|
* @group Datasource
|
|
24
24
|
*/
|
|
25
25
|
export declare function sanitizeData<M extends Record<string, any>>(values: EntityValues<M>, properties: ResolvedProperties<M>): any;
|
|
26
|
-
export declare function getReferenceFrom(entity: Entity<
|
|
26
|
+
export declare function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference<M>;
|
|
27
27
|
export declare function traverseValuesProperties<M extends Record<string, any>>(inputValues: Partial<EntityValues<M>>, properties: ResolvedProperties<M>, operation: (value: any, property: Property) => any): EntityValues<M> | undefined;
|
|
28
28
|
export declare function traverseValueProperty(inputValue: any, property: Property, operation: (value: any, property: Property) => any): any;
|
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.60",
|
|
4
4
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
5
5
|
"funding": {
|
|
6
6
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@firecms/ui": "^3.0.0-alpha.
|
|
48
|
+
"@firecms/ui": "^3.0.0-alpha.60",
|
|
49
49
|
"@fontsource/ibm-plex-mono": "^5.0.8",
|
|
50
50
|
"@fontsource/roboto": "^5.0.8",
|
|
51
51
|
"@hello-pangea/dnd": "^16.5.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"dist",
|
|
117
117
|
"src"
|
|
118
118
|
],
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "04c920a874385714dd35f320256e6def346c2a9e",
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
|
122
122
|
}
|
|
@@ -6,31 +6,16 @@ import { PreviewSize, ReferencePreview } from "../preview";
|
|
|
6
6
|
import { useNavigationController, useReferenceDialog } from "../hooks";
|
|
7
7
|
import { Button, cn } from "@firecms/ui";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
* This field allows selecting reference/s.
|
|
11
|
-
*/
|
|
12
|
-
export function ReferenceWidget<M extends Record<string, any>>({
|
|
13
|
-
name,
|
|
14
|
-
multiselect = false,
|
|
15
|
-
path,
|
|
16
|
-
disabled,
|
|
17
|
-
value,
|
|
18
|
-
onReferenceSelected,
|
|
19
|
-
onMultipleReferenceSelected,
|
|
20
|
-
previewProperties,
|
|
21
|
-
forceFilter,
|
|
22
|
-
size,
|
|
23
|
-
className
|
|
24
|
-
}: {
|
|
9
|
+
export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
25
10
|
name?: string,
|
|
26
11
|
multiselect?: boolean,
|
|
27
|
-
value: EntityReference | EntityReference[] | null,
|
|
12
|
+
value: EntityReference<M> | EntityReference<M>[] | null,
|
|
28
13
|
onReferenceSelected?: (params: {
|
|
29
|
-
reference: EntityReference | null,
|
|
14
|
+
reference: EntityReference<M> | null,
|
|
30
15
|
entity: Entity<M> | null
|
|
31
16
|
}) => void,
|
|
32
17
|
onMultipleReferenceSelected?: (params: {
|
|
33
|
-
references: EntityReference[] | null,
|
|
18
|
+
references: EntityReference<M>[] | null,
|
|
34
19
|
entities: Entity<M>[] | null
|
|
35
20
|
}) => void,
|
|
36
21
|
path: string,
|
|
@@ -42,7 +27,24 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
42
27
|
forceFilter?: FilterValues<string>;
|
|
43
28
|
size: PreviewSize;
|
|
44
29
|
className?: string;
|
|
45
|
-
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This field allows selecting reference/s.
|
|
34
|
+
*/
|
|
35
|
+
export function ReferenceWidget<M extends Record<string, any>>({
|
|
36
|
+
name,
|
|
37
|
+
multiselect = false,
|
|
38
|
+
path,
|
|
39
|
+
disabled,
|
|
40
|
+
value,
|
|
41
|
+
onReferenceSelected,
|
|
42
|
+
onMultipleReferenceSelected,
|
|
43
|
+
previewProperties,
|
|
44
|
+
forceFilter,
|
|
45
|
+
size,
|
|
46
|
+
className
|
|
47
|
+
}: ReferenceWidgetProps<M>) {
|
|
46
48
|
|
|
47
49
|
const navigationController = useNavigationController();
|
|
48
50
|
|
package/src/types/entities.ts
CHANGED
|
@@ -37,7 +37,7 @@ export type EntityValues<M extends object> = M;
|
|
|
37
37
|
/**
|
|
38
38
|
* Class used to create a reference to an entity in a different path
|
|
39
39
|
*/
|
|
40
|
-
export class EntityReference {
|
|
40
|
+
export class EntityReference<M extends Record<string, any> = any> {
|
|
41
41
|
/**
|
|
42
42
|
* ID of the entity
|
|
43
43
|
*/
|
package/src/util/entities.ts
CHANGED
|
@@ -139,7 +139,7 @@ export function sanitizeData<M extends Record<string, any>>
|
|
|
139
139
|
return result;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export function getReferenceFrom(entity: Entity<
|
|
142
|
+
export function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference<M> {
|
|
143
143
|
return new EntityReference(entity.id, entity.path);
|
|
144
144
|
}
|
|
145
145
|
|