@firecms/core 3.0.0-alpha.32 → 3.0.0-alpha.33
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/index.es.js +6055 -6056
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +14 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +12 -1
- package/dist/types/firecms.d.ts +1 -1
- package/package.json +2 -2
- package/src/core/components/EntityCollectionTable/EntityCollectionTable.tsx +2 -3
- package/src/core/components/EntityCollectionView/EntityCollectionView.tsx +2 -2
- package/src/core/components/EntityCollectionView/useColumnsIds.tsx +2 -2
- package/src/core/util/property_utils.tsx +1 -1
- package/src/types/collections.ts +10 -1
- package/src/types/firecms.tsx +1 -1
|
@@ -324,7 +324,7 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
|
|
|
324
324
|
* ID of this column. You can use this id in the `properties` field of the
|
|
325
325
|
* collection in any order you want
|
|
326
326
|
*/
|
|
327
|
-
|
|
327
|
+
key: string;
|
|
328
328
|
/**
|
|
329
329
|
* Header of this column
|
|
330
330
|
*/
|
|
@@ -346,6 +346,17 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
|
|
|
346
346
|
* it will be updated in every render.
|
|
347
347
|
*/
|
|
348
348
|
dependencies?: Extract<keyof M, string>[];
|
|
349
|
+
/**
|
|
350
|
+
* Use this prop to define the value of the column as a string or number.
|
|
351
|
+
* This is the value that will be used for exporting the collection.
|
|
352
|
+
* If `Builder` is defined, this prop will be ignored in the collection
|
|
353
|
+
* view.
|
|
354
|
+
* @param entity
|
|
355
|
+
*/
|
|
356
|
+
value?: (props: {
|
|
357
|
+
entity: Entity<M>;
|
|
358
|
+
context: FireCMSContext;
|
|
359
|
+
}) => string | number | Promise<string | number> | undefined;
|
|
349
360
|
}
|
|
350
361
|
/**
|
|
351
362
|
* You can use this builder to render a custom panel in the entity detail view.
|
package/dist/types/firecms.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { CMSAnalyticsEvent } from "./analytics";
|
|
|
22
22
|
* APIs directly, or a REST API.
|
|
23
23
|
* @category Models
|
|
24
24
|
*/
|
|
25
|
-
export type EntityCollectionsBuilder<EC extends EntityCollection> = (params: {
|
|
25
|
+
export type EntityCollectionsBuilder<EC extends EntityCollection = EntityCollection> = (params: {
|
|
26
26
|
user: User | null;
|
|
27
27
|
authController: AuthController;
|
|
28
28
|
dataSource: DataSource;
|
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.33",
|
|
4
4
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
5
5
|
"funding": {
|
|
6
6
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"dist",
|
|
134
134
|
"src"
|
|
135
135
|
],
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "6d5339ab786c9e239ff98da651fde4e4f4879f21",
|
|
137
137
|
"publishConfig": {
|
|
138
138
|
"access": "public"
|
|
139
139
|
}
|
|
@@ -95,7 +95,6 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
|
|
|
95
95
|
setFilterValues,
|
|
96
96
|
sortBy,
|
|
97
97
|
setSortBy,
|
|
98
|
-
searchString,
|
|
99
98
|
setSearchString,
|
|
100
99
|
clearFilter,
|
|
101
100
|
itemCount,
|
|
@@ -159,7 +158,7 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
|
|
|
159
158
|
const additionalFieldsMap: Record<string, AdditionalFieldDelegate<M, UserType>> = useMemo(() => {
|
|
160
159
|
return (additionalFields
|
|
161
160
|
? additionalFields
|
|
162
|
-
.map((aC) => ({ [aC.
|
|
161
|
+
.map((aC) => ({ [aC.key]: aC as AdditionalFieldDelegate<M, any> }))
|
|
163
162
|
.reduce((a, b) => ({ ...a, ...b }), {})
|
|
164
163
|
: {}) as Record<string, AdditionalFieldDelegate<M, UserType>>;
|
|
165
164
|
}, [additionalFields]);
|
|
@@ -311,7 +310,7 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
|
|
|
311
310
|
const additionalTableColumns: VirtualTableColumn[] = additionalFields
|
|
312
311
|
? additionalFields.map((additionalField) =>
|
|
313
312
|
({
|
|
314
|
-
key: additionalField.
|
|
313
|
+
key: additionalField.key,
|
|
315
314
|
align: "left",
|
|
316
315
|
sortable: false,
|
|
317
316
|
title: additionalField.name,
|
|
@@ -353,7 +353,7 @@ export const EntityCollectionView = React.memo(
|
|
|
353
353
|
const additionalFields = useMemo(() => {
|
|
354
354
|
const subcollectionColumns: AdditionalFieldDelegate<M, any>[] = collection.subcollections?.map((subcollection) => {
|
|
355
355
|
return {
|
|
356
|
-
|
|
356
|
+
key: getSubcollectionColumnId(subcollection),
|
|
357
357
|
name: subcollection.name,
|
|
358
358
|
width: 200,
|
|
359
359
|
dependencies: [],
|
|
@@ -379,7 +379,7 @@ export const EntityCollectionView = React.memo(
|
|
|
379
379
|
|
|
380
380
|
const collectionGroupParentCollections: AdditionalFieldDelegate<M, any>[] = collection.collectionGroup
|
|
381
381
|
? [{
|
|
382
|
-
|
|
382
|
+
key: COLLECTION_GROUP_PARENT_ID,
|
|
383
383
|
name: "Parent entities",
|
|
384
384
|
width: 260,
|
|
385
385
|
dependencies: [],
|
|
@@ -31,7 +31,7 @@ function hideAndExpandKeys<M extends Record<string, any>>(collection: ResolvedEn
|
|
|
31
31
|
}];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const additionalField = collection.additionalFields?.find(field => field.
|
|
34
|
+
const additionalField = collection.additionalFields?.find(field => field.key === key);
|
|
35
35
|
if (additionalField) {
|
|
36
36
|
return [{
|
|
37
37
|
key,
|
|
@@ -68,7 +68,7 @@ function getDefaultColumnKeys<M extends Record<string, any> = any>(collection: R
|
|
|
68
68
|
|
|
69
69
|
const columnIds: string[] = [
|
|
70
70
|
...propertyKeys,
|
|
71
|
-
...additionalFields.map((field) => field.
|
|
71
|
+
...additionalFields.map((field) => field.key)
|
|
72
72
|
];
|
|
73
73
|
|
|
74
74
|
if (includeSubCollections) {
|
|
@@ -126,5 +126,5 @@ export function getPropertiesWithPropertiesOrder<M extends Record<string, any>>(
|
|
|
126
126
|
|
|
127
127
|
export function getDefaultPropertiesOrder(collection: EntityCollection<any>): string[] {
|
|
128
128
|
if (collection.propertiesOrder) return collection.propertiesOrder;
|
|
129
|
-
return [...Object.keys(collection.properties), ...(collection.additionalFields ?? []).map(field => field.
|
|
129
|
+
return [...Object.keys(collection.properties), ...(collection.additionalFields ?? []).map(field => field.key)];
|
|
130
130
|
}
|
package/src/types/collections.ts
CHANGED
|
@@ -387,7 +387,7 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
|
|
|
387
387
|
* ID of this column. You can use this id in the `properties` field of the
|
|
388
388
|
* collection in any order you want
|
|
389
389
|
*/
|
|
390
|
-
|
|
390
|
+
key: string;
|
|
391
391
|
|
|
392
392
|
/**
|
|
393
393
|
* Header of this column
|
|
@@ -413,6 +413,15 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
|
|
|
413
413
|
* it will be updated in every render.
|
|
414
414
|
*/
|
|
415
415
|
dependencies?: Extract<keyof M, string>[];
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Use this prop to define the value of the column as a string or number.
|
|
419
|
+
* This is the value that will be used for exporting the collection.
|
|
420
|
+
* If `Builder` is defined, this prop will be ignored in the collection
|
|
421
|
+
* view.
|
|
422
|
+
* @param entity
|
|
423
|
+
*/
|
|
424
|
+
value?: (props: { entity: Entity<M>, context: FireCMSContext }) => string | number | Promise<string | number> | undefined;
|
|
416
425
|
}
|
|
417
426
|
|
|
418
427
|
/**
|
package/src/types/firecms.tsx
CHANGED
|
@@ -23,7 +23,7 @@ import { CMSAnalyticsEvent } from "./analytics";
|
|
|
23
23
|
* APIs directly, or a REST API.
|
|
24
24
|
* @category Models
|
|
25
25
|
*/
|
|
26
|
-
export type EntityCollectionsBuilder<EC extends EntityCollection> = (params: {
|
|
26
|
+
export type EntityCollectionsBuilder<EC extends EntityCollection = EntityCollection> = (params: {
|
|
27
27
|
user: User | null,
|
|
28
28
|
authController: AuthController,
|
|
29
29
|
dataSource: DataSource
|