@firecms/core 3.0.0-beta.6 → 3.0.0-beta.7
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/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/EntityPreview.d.ts +3 -2
- package/dist/components/FireCMSAppBar.d.ts +4 -2
- package/dist/components/ReferenceWidget.d.ts +3 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +1 -6
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +3 -5
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/core/Drawer.d.ts +5 -12
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/NavigationRoutes.d.ts +1 -1
- package/dist/core/Scaffold.d.ts +8 -12
- package/dist/core/index.d.ts +3 -4
- package/dist/hooks/data/save.d.ts +1 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.es.js +9950 -9912
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +2 -1
- package/dist/types/collections.d.ts +8 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/properties.d.ts +8 -0
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/resolutions.d.ts +8 -8
- package/package.json +139 -122
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +2 -2
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +9 -7
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +22 -15
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +9 -1
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -6
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +2 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +19 -20
- package/src/components/EntityPreview.tsx +9 -7
- package/src/components/EntityView.tsx +4 -4
- package/src/components/FireCMSAppBar.tsx +32 -15
- package/src/components/HomePage/NavigationCard.tsx +2 -2
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/ReferenceWidget.tsx +21 -11
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +4 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +4 -1
- package/src/components/VirtualTable/VirtualTable.tsx +10 -11
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +1 -6
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
- package/src/components/common/index.ts +1 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/common/types.tsx +3 -5
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/index.tsx +1 -0
- package/src/core/Drawer.tsx +16 -68
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +7 -8
- package/src/core/EntitySidePanel.tsx +1 -1
- package/src/core/FireCMS.tsx +36 -40
- package/src/core/NavigationRoutes.tsx +3 -4
- package/src/core/Scaffold.tsx +80 -66
- package/src/core/field_configs.tsx +1 -1
- package/src/core/index.tsx +3 -4
- package/src/form/EntityForm.tsx +29 -21
- package/src/form/PropertyFieldBinding.tsx +0 -2
- package/src/form/components/StorageItemPreview.tsx +2 -2
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -2
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +4 -4
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +4 -4
- package/src/hooks/data/save.ts +2 -1
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +2 -3
- package/src/hooks/useBuildNavigationController.tsx +1 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +15 -15
- package/src/internal/useBuildSideEntityController.tsx +72 -11
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/preview/components/BooleanPreview.tsx +2 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +21 -22
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/types/collections.ts +14 -2
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/navigation.ts +1 -2
- package/src/types/properties.ts +10 -0
- package/src/types/storage.ts +1 -1
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/objects.ts +8 -21
- package/src/util/resolutions.ts +32 -31
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/src/core/SideEntityView.tsx +0 -38
- package/src/internal/useBuildCustomizationController.tsx +0 -5
|
@@ -41,7 +41,7 @@ interface PopupFormFieldProps<M extends Record<string, any>> {
|
|
|
41
41
|
* Callback when the value of a cell has been edited
|
|
42
42
|
* @param params
|
|
43
43
|
*/
|
|
44
|
-
onCellValueChange?: (params: OnCellValueChangeParams<any,
|
|
44
|
+
onCellValueChange?: (params: OnCellValueChangeParams<any, any>) => Promise<void> | void;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function PopupFormField<M extends Record<string, any>>(props: PopupFormFieldProps<M>) {
|
|
@@ -205,12 +205,10 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
|
|
|
205
205
|
return onCellValueChange({
|
|
206
206
|
value: values[propertyKey as string],
|
|
207
207
|
propertyKey: propertyKey as string,
|
|
208
|
-
entity,
|
|
208
|
+
data: entity,
|
|
209
209
|
setError: setSavingError,
|
|
210
210
|
onValueUpdated: () => {
|
|
211
211
|
},
|
|
212
|
-
fullPath: path,
|
|
213
|
-
context: fireCMSContext
|
|
214
212
|
});
|
|
215
213
|
}
|
|
216
214
|
return Promise.resolve();
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
useAuthController,
|
|
36
36
|
useCustomizationController,
|
|
37
37
|
useDataSource,
|
|
38
|
+
useFireCMSContext,
|
|
38
39
|
useLargeLayout,
|
|
39
40
|
useNavigationController,
|
|
40
41
|
useSideEntityController
|
|
@@ -44,7 +45,7 @@ import { EntityCollectionViewActions } from "./EntityCollectionViewActions";
|
|
|
44
45
|
import {
|
|
45
46
|
AddIcon,
|
|
46
47
|
Button,
|
|
47
|
-
|
|
48
|
+
cls,
|
|
48
49
|
IconButton,
|
|
49
50
|
KeyboardTabIcon,
|
|
50
51
|
Markdown,
|
|
@@ -65,11 +66,7 @@ import {
|
|
|
65
66
|
} from "../common";
|
|
66
67
|
import { PopupFormField } from "../EntityCollectionTable/internal/popup_field/PopupFormField";
|
|
67
68
|
import { GetPropertyForProps } from "../EntityCollectionTable/EntityCollectionTableProps";
|
|
68
|
-
import {
|
|
69
|
-
copyEntityAction,
|
|
70
|
-
deleteEntityAction,
|
|
71
|
-
editEntityAction
|
|
72
|
-
} from "../EntityCollectionTable/internal/default_entity_actions";
|
|
69
|
+
import { copyEntityAction, deleteEntityAction, editEntityAction } from "../common/default_entity_actions";
|
|
73
70
|
import { DeleteEntityDialog } from "../DeleteEntityDialog";
|
|
74
71
|
import { useAnalyticsController } from "../../hooks/useAnalyticsController";
|
|
75
72
|
import { useSelectionController } from "./useSelectionController";
|
|
@@ -94,7 +91,9 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
|
|
|
94
91
|
* Whether this is a subcollection or not.
|
|
95
92
|
*/
|
|
96
93
|
isSubCollection?: boolean;
|
|
94
|
+
|
|
97
95
|
className?: string;
|
|
96
|
+
|
|
98
97
|
} & EntityCollection<M>;
|
|
99
98
|
|
|
100
99
|
/**
|
|
@@ -131,6 +130,7 @@ export const EntityCollectionView = React.memo(
|
|
|
131
130
|
}: EntityCollectionViewProps<M>
|
|
132
131
|
) {
|
|
133
132
|
|
|
133
|
+
const context = useFireCMSContext();
|
|
134
134
|
const fullPath = fullPathProp ?? collectionProp.path;
|
|
135
135
|
const dataSource = useDataSource(collectionProp);
|
|
136
136
|
const navigation = useNavigationController();
|
|
@@ -196,8 +196,7 @@ export const EntityCollectionView = React.memo(
|
|
|
196
196
|
|
|
197
197
|
const tableController = useDataSourceEntityCollectionTableController<M>({
|
|
198
198
|
fullPath,
|
|
199
|
-
collection
|
|
200
|
-
entitiesDisplayedFirst: [],
|
|
199
|
+
collection,
|
|
201
200
|
lastDeleteTimestamp
|
|
202
201
|
});
|
|
203
202
|
|
|
@@ -311,13 +310,11 @@ export const EntityCollectionView = React.memo(
|
|
|
311
310
|
[fullPath]);
|
|
312
311
|
|
|
313
312
|
const onValueChange: OnCellValueChange<any, any> = ({
|
|
314
|
-
fullPath,
|
|
315
|
-
context,
|
|
316
313
|
value,
|
|
317
314
|
propertyKey,
|
|
318
315
|
onValueUpdated,
|
|
319
316
|
setError,
|
|
320
|
-
entity,
|
|
317
|
+
data: entity,
|
|
321
318
|
}) => {
|
|
322
319
|
|
|
323
320
|
const updatedValues = setIn({ ...entity.values }, propertyKey, value);
|
|
@@ -334,7 +331,6 @@ export const EntityCollectionView = React.memo(
|
|
|
334
331
|
return saveEntityWithCallbacks({
|
|
335
332
|
...saveProps,
|
|
336
333
|
collection,
|
|
337
|
-
callbacks: collection.callbacks,
|
|
338
334
|
dataSource,
|
|
339
335
|
context,
|
|
340
336
|
onSaveSuccess: () => {
|
|
@@ -359,7 +355,6 @@ export const EntityCollectionView = React.memo(
|
|
|
359
355
|
|
|
360
356
|
const getPropertyFor = useCallback(({
|
|
361
357
|
propertyKey,
|
|
362
|
-
propertyValue,
|
|
363
358
|
entity
|
|
364
359
|
}: GetPropertyForProps<M>) => {
|
|
365
360
|
let propertyOrBuilder: PropertyOrBuilder<any, M> | undefined = getPropertyInPath<M>(collection.properties, propertyKey);
|
|
@@ -374,7 +369,6 @@ export const EntityCollectionView = React.memo(
|
|
|
374
369
|
propertyKey,
|
|
375
370
|
propertyOrBuilder,
|
|
376
371
|
path: fullPath,
|
|
377
|
-
propertyValue,
|
|
378
372
|
values: entity.values,
|
|
379
373
|
entityId: entity.id,
|
|
380
374
|
fields: customizationController.propertyConfigs
|
|
@@ -419,7 +413,7 @@ export const EntityCollectionView = React.memo(
|
|
|
419
413
|
Builder: ({ entity }) => {
|
|
420
414
|
const collectionsWithPath = navigation.getParentReferencesFromPath(entity.path);
|
|
421
415
|
return (
|
|
422
|
-
|
|
416
|
+
<div className={"flex flex-col gap-2 w-full"}>
|
|
423
417
|
{collectionsWithPath.map((reference) => {
|
|
424
418
|
return (
|
|
425
419
|
<ReferencePreview
|
|
@@ -428,7 +422,7 @@ export const EntityCollectionView = React.memo(
|
|
|
428
422
|
size={"tiny"}/>
|
|
429
423
|
);
|
|
430
424
|
})}
|
|
431
|
-
|
|
425
|
+
</div>
|
|
432
426
|
);
|
|
433
427
|
}
|
|
434
428
|
}]
|
|
@@ -597,12 +591,13 @@ export const EntityCollectionView = React.memo(
|
|
|
597
591
|
});
|
|
598
592
|
|
|
599
593
|
return (
|
|
600
|
-
<div className={
|
|
594
|
+
<div className={cls("overflow-hidden h-full w-full rounded-md", className)}
|
|
601
595
|
ref={containerRef}>
|
|
602
596
|
<EntityCollectionTable
|
|
603
597
|
key={`collection_table_${fullPath}`}
|
|
604
598
|
additionalFields={additionalFields}
|
|
605
599
|
tableController={tableController}
|
|
600
|
+
enablePopupIcon={true}
|
|
606
601
|
displayedColumnIds={displayedColumnIds}
|
|
607
602
|
onSizeChanged={onSizeChanged}
|
|
608
603
|
onEntityClick={onEntityClick}
|
|
@@ -708,6 +703,7 @@ export const EntityCollectionView = React.memo(
|
|
|
708
703
|
equal(a.initialSort, b.initialSort) &&
|
|
709
704
|
equal(a.textSearchEnabled, b.textSearchEnabled) &&
|
|
710
705
|
equal(a.additionalFields, b.additionalFields) &&
|
|
706
|
+
equal(a.sideDialogWidth, b.sideDialogWidth) &&
|
|
711
707
|
equal(a.forceFilter, b.forceFilter);
|
|
712
708
|
}) as React.FunctionComponent<EntityCollectionViewProps<any>>
|
|
713
709
|
|
|
@@ -747,6 +743,7 @@ function EntitiesCount({
|
|
|
747
743
|
|
|
748
744
|
useEffect(() => {
|
|
749
745
|
if (onCountChange) {
|
|
746
|
+
setError(undefined);
|
|
750
747
|
onCountChange(count ?? 0);
|
|
751
748
|
}
|
|
752
749
|
}, [onCountChange, count]);
|
|
@@ -798,7 +795,7 @@ function EntityIdHeaderWidget({
|
|
|
798
795
|
if (!searchString) return;
|
|
799
796
|
setOpenPopup(false);
|
|
800
797
|
return sideEntityController.open({
|
|
801
|
-
entityId: searchString,
|
|
798
|
+
entityId: searchString.trim(),
|
|
802
799
|
path,
|
|
803
800
|
collection,
|
|
804
801
|
updateUrl: true,
|
|
@@ -811,11 +808,13 @@ function EntityIdHeaderWidget({
|
|
|
811
808
|
autoFocus={openPopup}
|
|
812
809
|
placeholder={"Find entity by ID"}
|
|
813
810
|
// size={"small"}
|
|
814
|
-
onChange={(e) =>
|
|
811
|
+
onChange={(e) => {
|
|
812
|
+
setSearchString(e.target.value);
|
|
813
|
+
}}
|
|
815
814
|
value={searchString}
|
|
816
815
|
className={"flex-grow bg-transparent outline-none p-1"}/>
|
|
817
816
|
<Button variant={"outlined"}
|
|
818
|
-
disabled={!searchString}
|
|
817
|
+
disabled={!(searchString.trim())}
|
|
819
818
|
type={"submit"}
|
|
820
819
|
>Go</Button>
|
|
821
820
|
</div>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getValueInPath,
|
|
11
11
|
resolveCollection
|
|
12
12
|
} from "../util";
|
|
13
|
-
import {
|
|
13
|
+
import { cls, defaultBorderMixin, IconButton, KeyboardTabIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
|
|
14
14
|
import { PreviewSize, PropertyPreview, SkeletonPropertyComponent } from "../preview";
|
|
15
15
|
import { useCustomizationController, useNavigationController, useSideEntityController } from "../hooks";
|
|
16
16
|
import { useAnalyticsController } from "../hooks/useAnalyticsController";
|
|
@@ -23,7 +23,8 @@ export type EntityPreviewProps = {
|
|
|
23
23
|
previewProperties?: string[],
|
|
24
24
|
disabled: undefined | boolean,
|
|
25
25
|
entity: Entity<any>,
|
|
26
|
-
|
|
26
|
+
includeId?: boolean,
|
|
27
|
+
includeEntityLink?: boolean,
|
|
27
28
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -39,7 +40,8 @@ export function EntityPreview({
|
|
|
39
40
|
previewProperties,
|
|
40
41
|
onClick,
|
|
41
42
|
size,
|
|
42
|
-
|
|
43
|
+
includeId = true,
|
|
44
|
+
includeEntityLink = true,
|
|
43
45
|
entity
|
|
44
46
|
}: EntityPreviewProps) {
|
|
45
47
|
|
|
@@ -75,7 +77,7 @@ export function EntityPreview({
|
|
|
75
77
|
hover={disabled ? undefined : hover}
|
|
76
78
|
size={size}>
|
|
77
79
|
{imageProperty && (
|
|
78
|
-
<div className={
|
|
80
|
+
<div className={cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "tiny" ? "my-0.5" : "m-2 self-start")}>
|
|
79
81
|
<PropertyPreview property={imageProperty}
|
|
80
82
|
propertyKey={imagePropertyKey as string}
|
|
81
83
|
size={"tiny"}
|
|
@@ -85,7 +87,7 @@ export function EntityPreview({
|
|
|
85
87
|
|
|
86
88
|
<div className={"flex flex-col flex-grow w-full m-1"}>
|
|
87
89
|
|
|
88
|
-
{size !== "tiny" && (
|
|
90
|
+
{size !== "tiny" && includeId && (
|
|
89
91
|
entity
|
|
90
92
|
? <div className={`${
|
|
91
93
|
size !== "medium"
|
|
@@ -140,7 +142,7 @@ export function EntityPreview({
|
|
|
140
142
|
|
|
141
143
|
</div>
|
|
142
144
|
|
|
143
|
-
{entity &&
|
|
145
|
+
{entity && includeEntityLink &&
|
|
144
146
|
<Tooltip title={`See details for ${entity.id}`}
|
|
145
147
|
className={size !== "tiny" ? "self-start" : ""}>
|
|
146
148
|
<IconButton
|
|
@@ -195,7 +197,7 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
|
|
|
195
197
|
// @ts-ignore
|
|
196
198
|
tabindex: 0
|
|
197
199
|
}}
|
|
198
|
-
className={
|
|
200
|
+
className={cls(
|
|
199
201
|
"bg-white dark:bg-gray-900",
|
|
200
202
|
fullwidth ? "w-full" : "",
|
|
201
203
|
"items-center",
|
|
@@ -2,7 +2,7 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { PropertyPreview } from "../preview";
|
|
3
3
|
import { Entity, EntityCollection, ResolvedEntityCollection, ResolvedProperties } from "../types";
|
|
4
4
|
import { resolveCollection } from "../util";
|
|
5
|
-
import {
|
|
5
|
+
import { cls, defaultBorderMixin, IconButton, OpenInNewIcon } from "@firecms/ui";
|
|
6
6
|
import { CustomizationController } from "../types/customization_controller";
|
|
7
7
|
import { useCustomizationController } from "../hooks/useCustomizationController";
|
|
8
8
|
|
|
@@ -31,14 +31,14 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
31
31
|
entityId: entity.id,
|
|
32
32
|
values: entity.values,
|
|
33
33
|
fields: customizationController.propertyConfigs
|
|
34
|
-
}), [collection, path, entity]);
|
|
34
|
+
}), [collection, path, entity, customizationController.propertyConfigs]);
|
|
35
35
|
|
|
36
36
|
const properties: ResolvedProperties = resolvedCollection.properties;
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<div className={"w-full " + className}>
|
|
40
40
|
<div className={"w-full mb-4"}>
|
|
41
|
-
<div className={
|
|
41
|
+
<div className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
|
|
42
42
|
<div className="flex items-center w-1/4">
|
|
43
43
|
<span className="pl-2 text-sm text-gray-600">Id</span>
|
|
44
44
|
</div>
|
|
@@ -62,7 +62,7 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
62
62
|
return (
|
|
63
63
|
<div
|
|
64
64
|
key={`reference_previews_${key}`}
|
|
65
|
-
className={
|
|
65
|
+
className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
|
|
66
66
|
<div className="flex items-center w-1/4">
|
|
67
67
|
<span className="pl-2 text-sm text-gray-600">{property.name}</span>
|
|
68
68
|
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { Link as ReactLink } from "react-router-dom";
|
|
4
|
-
import { ErrorBoundary } from "../components";
|
|
4
|
+
import { ErrorBoundary, FireCMSLogo } from "../components";
|
|
5
5
|
import {
|
|
6
6
|
Avatar,
|
|
7
|
-
|
|
7
|
+
cls,
|
|
8
8
|
DarkModeIcon,
|
|
9
9
|
IconButton,
|
|
10
10
|
LightModeIcon,
|
|
@@ -18,7 +18,8 @@ import { useAuthController, useLargeLayout, useModeController, useNavigationCont
|
|
|
18
18
|
import { User } from "../types";
|
|
19
19
|
|
|
20
20
|
export type FireCMSAppBarProps<ADDITIONAL_PROPS = object> = {
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
title?: React.ReactNode;
|
|
22
23
|
/**
|
|
23
24
|
* A component that gets rendered on the upper side of the main toolbar
|
|
24
25
|
*/
|
|
@@ -30,12 +31,16 @@ export type FireCMSAppBarProps<ADDITIONAL_PROPS = object> = {
|
|
|
30
31
|
|
|
31
32
|
includeDrawer?: boolean;
|
|
32
33
|
|
|
34
|
+
includeModeToggle?: boolean;
|
|
35
|
+
|
|
33
36
|
drawerOpen: boolean;
|
|
34
37
|
|
|
35
38
|
className?: string;
|
|
36
39
|
|
|
37
40
|
style?: React.CSSProperties;
|
|
38
41
|
|
|
42
|
+
logo?: string;
|
|
43
|
+
|
|
39
44
|
user?: User;
|
|
40
45
|
} & ADDITIONAL_PROPS;
|
|
41
46
|
|
|
@@ -55,8 +60,10 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
55
60
|
drawerOpen,
|
|
56
61
|
dropDownActions,
|
|
57
62
|
includeDrawer,
|
|
63
|
+
includeModeToggle = true,
|
|
58
64
|
className,
|
|
59
65
|
style,
|
|
66
|
+
logo,
|
|
60
67
|
user: userProp
|
|
61
68
|
}: FireCMSAppBarProps) {
|
|
62
69
|
const navigation = useNavigationController();
|
|
@@ -89,10 +96,10 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
89
96
|
return (
|
|
90
97
|
<div
|
|
91
98
|
style={style}
|
|
92
|
-
className={
|
|
99
|
+
className={cls("pr-2",
|
|
93
100
|
{
|
|
94
101
|
"ml-[17rem]": drawerOpen && largeLayout,
|
|
95
|
-
"ml-16": includeDrawer && !(drawerOpen && largeLayout)
|
|
102
|
+
"ml-16": includeDrawer && !(drawerOpen && largeLayout),
|
|
96
103
|
"h-16": true,
|
|
97
104
|
"z-10": largeLayout,
|
|
98
105
|
"transition-all": true,
|
|
@@ -102,27 +109,37 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
102
109
|
"w-[calc(100%-64px)]": includeDrawer && !(drawerOpen && largeLayout),
|
|
103
110
|
"w-[calc(100%-17rem)]": includeDrawer && (drawerOpen && largeLayout),
|
|
104
111
|
"duration-150": drawerOpen && largeLayout,
|
|
105
|
-
fixed: true
|
|
112
|
+
fixed: true
|
|
106
113
|
},
|
|
107
114
|
className)}>
|
|
108
115
|
|
|
109
116
|
<div className="flex flex-row gap-2 px-4 h-full items-center">
|
|
110
117
|
|
|
111
|
-
{startAdornment}
|
|
112
|
-
|
|
113
118
|
{navigation && <div className="mr-8 hidden lg:block">
|
|
114
119
|
<ReactLink
|
|
115
120
|
className="visited:text-inherit visited:dark:text-inherit"
|
|
116
121
|
to={navigation?.basePath ?? "/"}
|
|
117
122
|
>
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
<div className={"flex flex-row gap-4"}>
|
|
124
|
+
{!includeDrawer && (logo
|
|
125
|
+
? <img src={logo}
|
|
126
|
+
alt="Logo"
|
|
127
|
+
className={cls("w-[32px] h-[32px]")}/>
|
|
128
|
+
: <FireCMSLogo width={"32px"} height={"32px"}/>)}
|
|
129
|
+
|
|
130
|
+
{typeof title === "string"
|
|
131
|
+
? <Typography variant="subtitle1"
|
|
132
|
+
noWrap
|
|
133
|
+
className={"ml-2 !font-medium"}>
|
|
134
|
+
{title}
|
|
135
|
+
</Typography>
|
|
136
|
+
: title}
|
|
137
|
+
</div>
|
|
123
138
|
</ReactLink>
|
|
124
139
|
</div>}
|
|
125
140
|
|
|
141
|
+
{startAdornment}
|
|
142
|
+
|
|
126
143
|
<div className={"flex-grow"}/>
|
|
127
144
|
|
|
128
145
|
{endAdornment &&
|
|
@@ -130,7 +147,7 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
130
147
|
{endAdornment}
|
|
131
148
|
</ErrorBoundary>}
|
|
132
149
|
|
|
133
|
-
<IconButton
|
|
150
|
+
{includeModeToggle && <IconButton
|
|
134
151
|
color="inherit"
|
|
135
152
|
aria-label="Open drawer"
|
|
136
153
|
onClick={toggleMode}
|
|
@@ -138,7 +155,7 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
138
155
|
{mode === "dark"
|
|
139
156
|
? <DarkModeIcon/>
|
|
140
157
|
: <LightModeIcon/>}
|
|
141
|
-
</IconButton>
|
|
158
|
+
</IconButton>}
|
|
142
159
|
|
|
143
160
|
<Menu trigger={avatarComponent}>
|
|
144
161
|
{user && <div className={"px-4 py-2 mb-2"}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowForwardIcon, Card,
|
|
1
|
+
import { ArrowForwardIcon, Card, cls, Markdown, Typography, } from "@firecms/ui";
|
|
2
2
|
|
|
3
3
|
export type NavigationCardProps = {
|
|
4
4
|
name: string,
|
|
@@ -17,7 +17,7 @@ export function NavigationCard({
|
|
|
17
17
|
}: NavigationCardProps) {
|
|
18
18
|
|
|
19
19
|
return (<Card
|
|
20
|
-
className={
|
|
20
|
+
className={cls("h-full p-4 cursor-pointer min-h-[230px]")}
|
|
21
21
|
onClick={() => {
|
|
22
22
|
onClick?.();
|
|
23
23
|
}}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArrowForwardIcon, cardClickableMixin, cardMixin,
|
|
1
|
+
import { ArrowForwardIcon, cardClickableMixin, cardMixin, cls, focusedMixin, Typography, } from "@firecms/ui";
|
|
2
2
|
|
|
3
|
-
import { Link
|
|
3
|
+
import { Link } from "react-router-dom";
|
|
4
4
|
|
|
5
5
|
export type SmallNavigationCardProps = {
|
|
6
6
|
name: string,
|
|
@@ -17,9 +17,9 @@ export function SmallNavigationCard({
|
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
19
19
|
|
|
20
|
-
<
|
|
20
|
+
<Link
|
|
21
21
|
tabIndex={0}
|
|
22
|
-
className={
|
|
22
|
+
className={cls(cardMixin,
|
|
23
23
|
cardClickableMixin,
|
|
24
24
|
focusedMixin,
|
|
25
25
|
"cursor-pointer flex flex-row items-center px-4 py-2 text-inherit dark:text-inherit visited:text-inherit visited:dark:text-inherit hover:text-inherit hover:dark:text-inherit ")}
|
|
@@ -39,7 +39,7 @@ export function SmallNavigationCard({
|
|
|
39
39
|
<div className={"p-4"}>
|
|
40
40
|
<ArrowForwardIcon color="primary"/>
|
|
41
41
|
</div>
|
|
42
|
-
</
|
|
42
|
+
</Link>
|
|
43
43
|
|
|
44
44
|
</>);
|
|
45
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContentCopyIcon, IconButton, Typography } from "@firecms/ui";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
|
|
4
4
|
export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: string }) {
|
|
@@ -12,9 +12,8 @@ export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: strin
|
|
|
12
12
|
color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
|
|
13
13
|
<Typography variant={"caption"} className={"text-white"}><code>{propertyId}</code></Typography>
|
|
14
14
|
</div>
|
|
15
|
-
{/* Copy to clipboard button*/}
|
|
16
15
|
<IconButton size={"small"}>
|
|
17
|
-
<
|
|
16
|
+
<ContentCopyIcon size={"smallest"}
|
|
18
17
|
className={"text-white"}
|
|
19
18
|
onClick={useCallback(() => {
|
|
20
19
|
navigator.clipboard.writeText(propertyId);
|
|
@@ -291,6 +291,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
291
291
|
displayedColumnIds={displayedColumnIds}
|
|
292
292
|
onEntityClick={onEntityClick}
|
|
293
293
|
tableController={tableController}
|
|
294
|
+
enablePopupIcon={false}
|
|
294
295
|
tableRowActionsBuilder={tableRowActionsBuilder}
|
|
295
296
|
title={<Typography variant={"subtitle2"}>
|
|
296
297
|
{collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`}
|
|
@@ -4,7 +4,7 @@ import { Entity, EntityCollection, EntityReference, FilterValues } from "../type
|
|
|
4
4
|
import { getReferenceFrom } from "../util";
|
|
5
5
|
import { PreviewSize, ReferencePreview } from "../preview";
|
|
6
6
|
import { useNavigationController, useReferenceDialog } from "../hooks";
|
|
7
|
-
import { Button,
|
|
7
|
+
import { Button, cls } from "@firecms/ui";
|
|
8
8
|
|
|
9
9
|
export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
10
10
|
name?: string,
|
|
@@ -27,6 +27,8 @@ export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
|
27
27
|
forceFilter?: FilterValues<string>;
|
|
28
28
|
size: PreviewSize;
|
|
29
29
|
className?: string;
|
|
30
|
+
includeId?: boolean;
|
|
31
|
+
includeEntityLink?: boolean;
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
/**
|
|
@@ -43,7 +45,9 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
43
45
|
previewProperties,
|
|
44
46
|
forceFilter,
|
|
45
47
|
size,
|
|
46
|
-
className
|
|
48
|
+
className,
|
|
49
|
+
includeId,
|
|
50
|
+
includeEntityLink
|
|
47
51
|
}: ReferenceWidgetProps<M>) {
|
|
48
52
|
|
|
49
53
|
const navigationController = useNavigationController();
|
|
@@ -52,16 +56,15 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
52
56
|
return navigationController.getCollection(path);
|
|
53
57
|
}, [path, navigationController.getCollection]);
|
|
54
58
|
|
|
55
|
-
// if (!collection) {
|
|
56
|
-
// throw Error(`Couldn't find the corresponding collection for the path: ${path}`);
|
|
57
|
-
// }
|
|
58
|
-
|
|
59
59
|
const onSingleEntitySelected = useCallback((entity: Entity<M> | null) => {
|
|
60
60
|
if (disabled)
|
|
61
61
|
return;
|
|
62
62
|
if (onReferenceSelected) {
|
|
63
63
|
const reference = entity ? getReferenceFrom(entity) : null;
|
|
64
|
-
onReferenceSelected?.({
|
|
64
|
+
onReferenceSelected?.({
|
|
65
|
+
reference,
|
|
66
|
+
entity
|
|
67
|
+
});
|
|
65
68
|
}
|
|
66
69
|
}, [disabled, onReferenceSelected]);
|
|
67
70
|
|
|
@@ -70,7 +73,10 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
70
73
|
return;
|
|
71
74
|
if (onMultipleReferenceSelected) {
|
|
72
75
|
const references = entities ? entities.map(e => getReferenceFrom(e)) : null;
|
|
73
|
-
onMultipleReferenceSelected({
|
|
76
|
+
onMultipleReferenceSelected({
|
|
77
|
+
references,
|
|
78
|
+
entities
|
|
79
|
+
});
|
|
74
80
|
}
|
|
75
81
|
}, [disabled, onReferenceSelected]);
|
|
76
82
|
|
|
@@ -110,7 +116,9 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
110
116
|
reference={ref}
|
|
111
117
|
disabled={disabled}
|
|
112
118
|
previewProperties={previewProperties}
|
|
113
|
-
size={size}
|
|
119
|
+
size={size}
|
|
120
|
+
includeId={includeId}
|
|
121
|
+
includeEntityLink={includeEntityLink}/>
|
|
114
122
|
})}
|
|
115
123
|
</div>
|
|
116
124
|
} else if (value?.isEntityReference && value?.isEntityReference()) {
|
|
@@ -119,10 +127,12 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
119
127
|
onClick={onEntryClick}
|
|
120
128
|
disabled={disabled}
|
|
121
129
|
previewProperties={previewProperties}
|
|
122
|
-
size={size}
|
|
130
|
+
size={size}
|
|
131
|
+
includeId={includeId}
|
|
132
|
+
includeEntityLink={includeEntityLink}/>
|
|
123
133
|
|
|
124
134
|
}
|
|
125
|
-
return <div className={
|
|
135
|
+
return <div className={cls("text-sm font-medium",
|
|
126
136
|
"min-w-80 flex flex-col gap-4",
|
|
127
137
|
"relative transition-colors duration-200 ease-in rounded font-medium",
|
|
128
138
|
disabled ? "bg-opacity-50" : "hover:bg-opacity-75",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { coolIconKeys, debounce, Icon, IconButton, iconKeys, SearchBar, Tooltip } from "@firecms/ui";
|
|
4
|
-
import {
|
|
4
|
+
import { iconSynonyms, iconsSearch } from "../util";
|
|
5
5
|
|
|
6
6
|
const UPDATE_SEARCH_INDEX_WAIT_MS = 220;
|
|
7
7
|
|
|
8
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9
|
-
Object.keys(
|
|
8
|
+
if (iconSynonyms && process.env.NODE_ENV !== "production") {
|
|
9
|
+
Object.keys(iconSynonyms).forEach((icon: string) => {
|
|
10
10
|
if (!iconKeys.includes(icon)) {
|
|
11
|
-
console.warn(`The icon ${icon} no longer exists. Remove it from \`
|
|
11
|
+
console.warn(`The icon ${icon} no longer exists. Remove it from \`iconSynonyms\``);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -48,7 +48,7 @@ export function SearchIconsView({
|
|
|
48
48
|
return (
|
|
49
49
|
<>
|
|
50
50
|
<SearchBar
|
|
51
|
-
autoFocus
|
|
51
|
+
autoFocus={false}
|
|
52
52
|
innerClassName={"w-full sticky top-0 z-10"}
|
|
53
53
|
onTextSearch={(value?: string) => setQuery(value ?? "")}
|
|
54
54
|
placeholder="Search for more icons…"
|
|
@@ -18,6 +18,7 @@ import { BooleanFilterField } from "./filters/BooleanFilterField";
|
|
|
18
18
|
import { DateTimeFilterField } from "./filters/DateTimeFilterField";
|
|
19
19
|
import { useOutsideAlerter } from "@firecms/ui";
|
|
20
20
|
import { SelectableTableContext } from "./SelectableTableContext";
|
|
21
|
+
import { getRowHeight } from "../common/table_height";
|
|
21
22
|
|
|
22
23
|
export type SelectableTableProps<M extends Record<string, any>> = {
|
|
23
24
|
|
|
@@ -115,7 +116,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
115
116
|
onEntityClick,
|
|
116
117
|
onColumnResize,
|
|
117
118
|
hoverRow = true,
|
|
118
|
-
size,
|
|
119
|
+
size = "m",
|
|
119
120
|
inlineEditing = false,
|
|
120
121
|
tableController:
|
|
121
122
|
{
|
|
@@ -224,7 +225,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
224
225
|
error={dataLoadingError}
|
|
225
226
|
paginationEnabled={paginationEnabled}
|
|
226
227
|
onColumnResize={onColumnResize}
|
|
227
|
-
|
|
228
|
+
rowHeight={getRowHeight(size)}
|
|
228
229
|
loading={dataLoading}
|
|
229
230
|
filter={filterValues}
|
|
230
231
|
onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
|
|
@@ -280,6 +281,7 @@ function createFilterField({
|
|
|
280
281
|
isArray={isArray}
|
|
281
282
|
path={baseProperty.path}
|
|
282
283
|
title={resolvedProperty?.name}
|
|
284
|
+
includeId={baseProperty.includeId}
|
|
283
285
|
previewProperties={baseProperty?.previewProperties}
|
|
284
286
|
hidden={hidden}
|
|
285
287
|
setHidden={setHidden}/>;
|
|
@@ -13,6 +13,7 @@ interface ReferenceFilterFieldProps {
|
|
|
13
13
|
isArray?: boolean;
|
|
14
14
|
path?: string;
|
|
15
15
|
title?: string;
|
|
16
|
+
includeId?: boolean;
|
|
16
17
|
previewProperties?: string[];
|
|
17
18
|
hidden: boolean;
|
|
18
19
|
setHidden: (hidden: boolean) => void;
|
|
@@ -40,6 +41,7 @@ export function ReferenceFilterField({
|
|
|
40
41
|
isArray,
|
|
41
42
|
path,
|
|
42
43
|
title,
|
|
44
|
+
includeId = true,
|
|
43
45
|
previewProperties,
|
|
44
46
|
setHidden
|
|
45
47
|
}: ReferenceFilterFieldProps) {
|
|
@@ -134,7 +136,8 @@ export function ReferenceFilterField({
|
|
|
134
136
|
onClick={doOpenDialog}
|
|
135
137
|
reference={reference}
|
|
136
138
|
hover={true}
|
|
137
|
-
|
|
139
|
+
includeId={includeId}
|
|
140
|
+
includeEntityLink={false}
|
|
138
141
|
/>
|
|
139
142
|
);
|
|
140
143
|
};
|