@firecms/core 3.0.0-canary.8 → 3.0.0-canary.81
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/README.md +1 -1
- package/dist/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +17 -0
- package/dist/app/Scaffold.d.ts +30 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app/useApp.d.ts +16 -0
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
- 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/CollectionTableToolbar.d.ts +1 -4
- 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/EntityCollectionView/EntityCollectionView.d.ts +11 -1
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityPreview.d.ts +5 -4
- package/dist/components/ReferenceWidget.d.ts +3 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +5 -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 +4 -6
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/contexts/AuthControllerContext.d.ts +1 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/EntityEditView.d.ts +17 -3
- package/dist/core/NavigationRoutes.d.ts +2 -2
- package/dist/core/index.d.ts +3 -4
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/StorageItemPreview.d.ts +4 -4
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
- package/dist/form/index.d.ts +0 -2
- package/dist/hooks/data/delete.d.ts +2 -2
- package/dist/hooks/data/save.d.ts +2 -3
- package/dist/hooks/data/useDataSource.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useBuildNavigationController.d.ts +1 -2
- package/dist/hooks/useProjectLog.d.ts +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +9816 -9546
- 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/internal/useBuildDataSource.d.ts +1 -16
- package/dist/internal/useRestoreScroll.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +6 -4
- package/dist/preview/components/ReferencePreview.d.ts +2 -1
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/auth.d.ts +31 -2
- package/dist/types/collections.d.ts +30 -5
- package/dist/types/datasource.d.ts +21 -14
- package/dist/types/entities.d.ts +5 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/entity_callbacks.d.ts +2 -2
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/index.d.ts +1 -1
- package/dist/types/navigation.d.ts +5 -5
- package/dist/types/plugins.d.ts +16 -6
- package/dist/types/properties.d.ts +17 -4
- package/dist/types/roles.d.ts +31 -0
- package/dist/types/storage.d.ts +11 -3
- package/dist/types/user.d.ts +5 -0
- package/dist/util/collections.d.ts +1 -1
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +2 -2
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/resolutions.d.ts +13 -13
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/dist/util/useTraceUpdate.d.ts +1 -0
- package/package.json +130 -119
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/app/Scaffold.tsx +249 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +8 -10
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +19 -18
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +38 -34
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +10 -2
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +54 -29
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityPreview.tsx +14 -9
- package/src/components/EntityView.tsx +5 -5
- package/src/components/HomePage/DefaultHomePage.tsx +2 -2
- package/src/components/HomePage/NavigationCard.tsx +3 -3
- 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 +22 -12
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +5 -3
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +23 -8
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
- package/src/components/VirtualTable/VirtualTable.tsx +38 -29
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +6 -6
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
- 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 +4 -6
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +2 -1
- package/src/contexts/AuthControllerContext.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -36
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +673 -134
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +38 -43
- package/src/core/NavigationRoutes.tsx +6 -7
- package/src/core/field_configs.tsx +2 -3
- package/src/core/index.tsx +3 -4
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +29 -7
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +20 -11
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
- package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +10 -39
- package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
- package/src/form/index.tsx +4 -4
- package/src/form/validation.ts +1 -17
- package/src/hooks/data/delete.ts +3 -3
- package/src/hooks/data/save.ts +4 -2
- package/src/hooks/data/useDataSource.tsx +1 -1
- package/src/hooks/data/useEntityFetch.tsx +3 -3
- package/src/hooks/index.tsx +3 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/hooks/useBuildModeController.tsx +11 -5
- package/src/hooks/useBuildNavigationController.tsx +137 -61
- package/src/hooks/useProjectLog.tsx +8 -6
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +115 -0
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +54 -47
- package/src/internal/useBuildSideEntityController.tsx +88 -21
- package/src/preview/PropertyPreview.tsx +9 -16
- package/src/preview/PropertyPreviewProps.tsx +4 -8
- package/src/preview/components/BooleanPreview.tsx +4 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +23 -23
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- 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/auth.tsx +41 -2
- package/src/types/collections.ts +35 -5
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +24 -17
- package/src/types/entities.ts +9 -1
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/fields.tsx +33 -33
- package/src/types/index.ts +1 -1
- package/src/types/navigation.ts +6 -7
- package/src/types/plugins.tsx +18 -8
- package/src/types/properties.ts +22 -6
- package/src/types/roles.ts +41 -0
- package/src/types/storage.ts +12 -3
- package/src/types/user.ts +7 -0
- package/src/util/collections.ts +1 -1
- package/src/util/entities.ts +5 -4
- 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/navigation_utils.ts +6 -6
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +1 -0
- package/src/util/resolutions.ts +32 -31
- package/src/util/storage.ts +75 -21
- package/src/util/strings.ts +2 -2
- package/src/util/useStorageUploadController.tsx +21 -3
- package/src/util/useTraceUpdate.tsx +2 -1
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/Drawer.d.ts +0 -23
- package/dist/core/Scaffold.d.ts +0 -55
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/form/EntityForm.d.ts +0 -77
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/dist/internal/useLocaleConfig.d.ts +0 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/src/core/Drawer.tsx +0 -191
- package/src/core/Scaffold.tsx +0 -281
- package/src/core/SideEntityView.tsx +0 -38
- package/src/form/EntityForm.tsx +0 -728
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
|
@@ -2,10 +2,9 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
|
|
2
2
|
|
|
3
3
|
import useMeasure from "react-use-measure";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { getRowHeight } from "../../VirtualTable/common";
|
|
7
|
-
import { cn, RemoveCircleIcon, Tooltip } from "@firecms/ui";
|
|
5
|
+
import { cls, RemoveCircleIcon, Tooltip } from "@firecms/ui";
|
|
8
6
|
import { ErrorBoundary } from "../../../components";
|
|
7
|
+
import { getRowHeight, TableSize } from "../../common/table_height";
|
|
9
8
|
|
|
10
9
|
interface EntityTableCellProps {
|
|
11
10
|
children: React.ReactNode;
|
|
@@ -19,7 +18,7 @@ interface EntityTableCellProps {
|
|
|
19
18
|
error?: Error;
|
|
20
19
|
allowScroll?: boolean;
|
|
21
20
|
align: "right" | "left" | "center";
|
|
22
|
-
size:
|
|
21
|
+
size: TableSize;
|
|
23
22
|
disabledTooltip?: string;
|
|
24
23
|
width: number;
|
|
25
24
|
showExpandIcon?: boolean;
|
|
@@ -47,7 +46,7 @@ const TableCellInner = ({
|
|
|
47
46
|
}: TableCellInnerProps) => {
|
|
48
47
|
return (
|
|
49
48
|
<div
|
|
50
|
-
className={
|
|
49
|
+
className={cls("flex flex-col max-h-full w-full",
|
|
51
50
|
{
|
|
52
51
|
"items-start": faded || scrollable
|
|
53
52
|
})}
|
|
@@ -96,7 +95,7 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
|
|
|
96
95
|
const [onHover, setOnHover] = useState(false);
|
|
97
96
|
const [internalSaved, setInternalSaved] = useState(saved);
|
|
98
97
|
|
|
99
|
-
const showError = !disabled && error;
|
|
98
|
+
const showError = !disabled && Boolean(error);
|
|
100
99
|
|
|
101
100
|
useEffect(() => {
|
|
102
101
|
if (saved) {
|
|
@@ -176,21 +175,26 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
|
|
|
176
175
|
const setOnHoverTrue = useCallback(() => setOnHover(true), []);
|
|
177
176
|
const setOnHoverFalse = useCallback(() => setOnHover(false), []);
|
|
178
177
|
|
|
178
|
+
const borderClass = showError
|
|
179
|
+
? "border-red-500"
|
|
180
|
+
: internalSaved
|
|
181
|
+
? "border-green-500"
|
|
182
|
+
: isSelected
|
|
183
|
+
? "border-primary"
|
|
184
|
+
: "border-transparent";
|
|
185
|
+
|
|
179
186
|
return (
|
|
180
187
|
<div
|
|
181
|
-
|
|
182
|
-
className={cn(
|
|
188
|
+
className={cls(
|
|
183
189
|
"transition-colors duration-100 ease-in-out",
|
|
184
190
|
`flex relative h-full rounded-md p-${p} border border-4 border-opacity-75`,
|
|
185
191
|
onHover && !disabled ? "bg-gray-50 dark:bg-gray-900" : "",
|
|
186
192
|
saved ? "bg-gray-100 bg-opacity-75 dark:bg-gray-800 dark:bg-opacity-75" : "",
|
|
187
|
-
!isSelected && !internalSaved && !showError ? "border-transparent" : "",
|
|
188
193
|
hideOverflow ? "overflow-hidden" : "",
|
|
189
194
|
isSelected ? "bg-gray-50 dark:bg-gray-900" : "",
|
|
190
|
-
|
|
191
|
-
internalSaved ? "border-green-500 " : "",
|
|
192
|
-
showError ? "border-red-500" : ""
|
|
195
|
+
borderClass
|
|
193
196
|
)}
|
|
197
|
+
ref={ref}
|
|
194
198
|
style={{
|
|
195
199
|
justifyContent,
|
|
196
200
|
alignItems: disabled || !isOverflowing ? "center" : undefined,
|
|
@@ -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();
|
|
@@ -266,7 +264,8 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
|
|
|
266
264
|
values,
|
|
267
265
|
path,
|
|
268
266
|
setFieldValue,
|
|
269
|
-
save: saveValue
|
|
267
|
+
save: saveValue,
|
|
268
|
+
formex
|
|
270
269
|
};
|
|
271
270
|
|
|
272
271
|
const property: ResolvedProperty<any> | undefined = propertyKey && getPropertyInPath(collection.properties, propertyKey as string);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
CollectionSize,
|
|
8
8
|
Entity,
|
|
9
9
|
EntityAction,
|
|
10
|
-
EntityCollection,
|
|
10
|
+
EntityCollection, EntityTableController,
|
|
11
11
|
FilterValues,
|
|
12
12
|
PartialEntityCollection,
|
|
13
13
|
PropertyOrBuilder,
|
|
@@ -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,14 +66,11 @@ 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";
|
|
73
|
+
import { EntityCollectionViewStartActions } from "./EntityCollectionViewStartActions";
|
|
76
74
|
|
|
77
75
|
const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
78
76
|
|
|
@@ -80,10 +78,22 @@ const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
|
80
78
|
* @group Components
|
|
81
79
|
*/
|
|
82
80
|
export type EntityCollectionViewProps<M extends Record<string, any>> = {
|
|
83
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Complete path where this collection is located.
|
|
83
|
+
* It defaults to the collection path if not provided.
|
|
84
|
+
*/
|
|
85
|
+
fullPath?: string;
|
|
86
|
+
/**
|
|
87
|
+
* If this is a subcollection, specify the parent collection ids.
|
|
88
|
+
*/
|
|
84
89
|
parentCollectionIds?: string[];
|
|
90
|
+
/**
|
|
91
|
+
* Whether this is a subcollection or not.
|
|
92
|
+
*/
|
|
85
93
|
isSubCollection?: boolean;
|
|
94
|
+
|
|
86
95
|
className?: string;
|
|
96
|
+
|
|
87
97
|
} & EntityCollection<M>;
|
|
88
98
|
|
|
89
99
|
/**
|
|
@@ -112,7 +122,7 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
|
|
|
112
122
|
*/
|
|
113
123
|
export const EntityCollectionView = React.memo(
|
|
114
124
|
function EntityCollectionView<M extends Record<string, any>>({
|
|
115
|
-
fullPath,
|
|
125
|
+
fullPath: fullPathProp,
|
|
116
126
|
parentCollectionIds,
|
|
117
127
|
isSubCollection,
|
|
118
128
|
className,
|
|
@@ -120,6 +130,8 @@ export const EntityCollectionView = React.memo(
|
|
|
120
130
|
}: EntityCollectionViewProps<M>
|
|
121
131
|
) {
|
|
122
132
|
|
|
133
|
+
const context = useFireCMSContext();
|
|
134
|
+
const fullPath = fullPathProp ?? collectionProp.path;
|
|
123
135
|
const dataSource = useDataSource(collectionProp);
|
|
124
136
|
const navigation = useNavigationController();
|
|
125
137
|
const sideEntityController = useSideEntityController();
|
|
@@ -128,7 +140,6 @@ export const EntityCollectionView = React.memo(
|
|
|
128
140
|
const analyticsController = useAnalyticsController();
|
|
129
141
|
const customizationController = useCustomizationController();
|
|
130
142
|
|
|
131
|
-
|
|
132
143
|
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
133
144
|
|
|
134
145
|
const collection = useMemo(() => {
|
|
@@ -175,7 +186,6 @@ export const EntityCollectionView = React.memo(
|
|
|
175
186
|
const usedSelectionController = collection.selectionController ?? selectionController;
|
|
176
187
|
const {
|
|
177
188
|
selectedEntities,
|
|
178
|
-
toggleEntitySelection,
|
|
179
189
|
isEntitySelected,
|
|
180
190
|
setSelectedEntities
|
|
181
191
|
} = usedSelectionController;
|
|
@@ -186,8 +196,7 @@ export const EntityCollectionView = React.memo(
|
|
|
186
196
|
|
|
187
197
|
const tableController = useDataSourceEntityCollectionTableController<M>({
|
|
188
198
|
fullPath,
|
|
189
|
-
collection
|
|
190
|
-
entitiesDisplayedFirst: [],
|
|
199
|
+
collection,
|
|
191
200
|
lastDeleteTimestamp
|
|
192
201
|
});
|
|
193
202
|
|
|
@@ -257,6 +266,7 @@ export const EntityCollectionView = React.memo(
|
|
|
257
266
|
fullPath: string,
|
|
258
267
|
parentCollectionIds: string[],
|
|
259
268
|
collection: EntityCollection;
|
|
269
|
+
tableController: EntityTableController;
|
|
260
270
|
}> | undefined
|
|
261
271
|
|
|
262
272
|
// we are only using the first plugin that implements this
|
|
@@ -301,13 +311,11 @@ export const EntityCollectionView = React.memo(
|
|
|
301
311
|
[fullPath]);
|
|
302
312
|
|
|
303
313
|
const onValueChange: OnCellValueChange<any, any> = ({
|
|
304
|
-
fullPath,
|
|
305
|
-
context,
|
|
306
314
|
value,
|
|
307
315
|
propertyKey,
|
|
308
316
|
onValueUpdated,
|
|
309
317
|
setError,
|
|
310
|
-
entity,
|
|
318
|
+
data: entity,
|
|
311
319
|
}) => {
|
|
312
320
|
|
|
313
321
|
const updatedValues = setIn({ ...entity.values }, propertyKey, value);
|
|
@@ -324,10 +332,12 @@ export const EntityCollectionView = React.memo(
|
|
|
324
332
|
return saveEntityWithCallbacks({
|
|
325
333
|
...saveProps,
|
|
326
334
|
collection,
|
|
327
|
-
callbacks: collection.callbacks,
|
|
328
335
|
dataSource,
|
|
329
336
|
context,
|
|
330
|
-
onSaveSuccess: () =>
|
|
337
|
+
onSaveSuccess: () => {
|
|
338
|
+
setError(undefined);
|
|
339
|
+
onValueUpdated();
|
|
340
|
+
},
|
|
331
341
|
onSaveFailure: (e: Error) => {
|
|
332
342
|
console.error("Save failure");
|
|
333
343
|
console.error(e);
|
|
@@ -346,7 +356,6 @@ export const EntityCollectionView = React.memo(
|
|
|
346
356
|
|
|
347
357
|
const getPropertyFor = useCallback(({
|
|
348
358
|
propertyKey,
|
|
349
|
-
propertyValue,
|
|
350
359
|
entity
|
|
351
360
|
}: GetPropertyForProps<M>) => {
|
|
352
361
|
let propertyOrBuilder: PropertyOrBuilder<any, M> | undefined = getPropertyInPath<M>(collection.properties, propertyKey);
|
|
@@ -360,13 +369,12 @@ export const EntityCollectionView = React.memo(
|
|
|
360
369
|
return resolveProperty({
|
|
361
370
|
propertyKey,
|
|
362
371
|
propertyOrBuilder,
|
|
363
|
-
path:
|
|
364
|
-
propertyValue,
|
|
372
|
+
path: entity.path,
|
|
365
373
|
values: entity.values,
|
|
366
374
|
entityId: entity.id,
|
|
367
375
|
fields: customizationController.propertyConfigs
|
|
368
376
|
});
|
|
369
|
-
}, [collection.properties, customizationController.propertyConfigs,
|
|
377
|
+
}, [collection.properties, customizationController.propertyConfigs, resolvedCollection.properties]);
|
|
370
378
|
|
|
371
379
|
const displayedColumnIds = useColumnIds(resolvedCollection, true);
|
|
372
380
|
|
|
@@ -406,7 +414,7 @@ export const EntityCollectionView = React.memo(
|
|
|
406
414
|
Builder: ({ entity }) => {
|
|
407
415
|
const collectionsWithPath = navigation.getParentReferencesFromPath(entity.path);
|
|
408
416
|
return (
|
|
409
|
-
|
|
417
|
+
<div className={"flex flex-col gap-2 w-full"}>
|
|
410
418
|
{collectionsWithPath.map((reference) => {
|
|
411
419
|
return (
|
|
412
420
|
<ReferencePreview
|
|
@@ -415,7 +423,7 @@ export const EntityCollectionView = React.memo(
|
|
|
415
423
|
size={"tiny"}/>
|
|
416
424
|
);
|
|
417
425
|
})}
|
|
418
|
-
|
|
426
|
+
</div>
|
|
419
427
|
);
|
|
420
428
|
}
|
|
421
429
|
}]
|
|
@@ -557,6 +565,7 @@ export const EntityCollectionView = React.memo(
|
|
|
557
565
|
property={property}
|
|
558
566
|
fullPath={fullPath}
|
|
559
567
|
collection={collection}
|
|
568
|
+
tableController={tableController}
|
|
560
569
|
parentCollectionIds={parentCollectionIds ?? []}/>;
|
|
561
570
|
})}
|
|
562
571
|
</>;
|
|
@@ -567,7 +576,8 @@ export const EntityCollectionView = React.memo(
|
|
|
567
576
|
if (typeof AddColumnComponent === "function")
|
|
568
577
|
return <AddColumnComponent fullPath={fullPath}
|
|
569
578
|
parentCollectionIds={parentCollectionIds ?? []}
|
|
570
|
-
collection={collection}
|
|
579
|
+
collection={collection}
|
|
580
|
+
tableController={tableController}/>;
|
|
571
581
|
return null;
|
|
572
582
|
}
|
|
573
583
|
: undefined;
|
|
@@ -584,12 +594,13 @@ export const EntityCollectionView = React.memo(
|
|
|
584
594
|
});
|
|
585
595
|
|
|
586
596
|
return (
|
|
587
|
-
<div className={
|
|
597
|
+
<div className={cls("overflow-hidden h-full w-full rounded-md", className)}
|
|
588
598
|
ref={containerRef}>
|
|
589
599
|
<EntityCollectionTable
|
|
590
600
|
key={`collection_table_${fullPath}`}
|
|
591
601
|
additionalFields={additionalFields}
|
|
592
602
|
tableController={tableController}
|
|
603
|
+
enablePopupIcon={true}
|
|
593
604
|
displayedColumnIds={displayedColumnIds}
|
|
594
605
|
onSizeChanged={onSizeChanged}
|
|
595
606
|
onEntityClick={onEntityClick}
|
|
@@ -606,6 +617,14 @@ export const EntityCollectionView = React.memo(
|
|
|
606
617
|
onTextSearchClick={textSearchInitialised ? undefined : onTextSearchClick}
|
|
607
618
|
textSearchLoading={textSearchLoading}
|
|
608
619
|
textSearchEnabled={textSearchEnabled}
|
|
620
|
+
actionsStart={<EntityCollectionViewStartActions
|
|
621
|
+
parentCollectionIds={parentCollectionIds ?? []}
|
|
622
|
+
collection={collection}
|
|
623
|
+
tableController={tableController}
|
|
624
|
+
path={fullPath}
|
|
625
|
+
relativePath={collection.path}
|
|
626
|
+
selectionController={usedSelectionController}
|
|
627
|
+
collectionEntitiesCount={docsCount}/>}
|
|
609
628
|
actions={<EntityCollectionViewActions
|
|
610
629
|
parentCollectionIds={parentCollectionIds ?? []}
|
|
611
630
|
collection={collection}
|
|
@@ -683,8 +702,11 @@ export const EntityCollectionView = React.memo(
|
|
|
683
702
|
equal(a.selectionController, b.selectionController) &&
|
|
684
703
|
equal(a.Actions, b.Actions) &&
|
|
685
704
|
equal(a.defaultSize, b.defaultSize) &&
|
|
705
|
+
equal(a.initialFilter, b.initialFilter) &&
|
|
706
|
+
equal(a.initialSort, b.initialSort) &&
|
|
686
707
|
equal(a.textSearchEnabled, b.textSearchEnabled) &&
|
|
687
708
|
equal(a.additionalFields, b.additionalFields) &&
|
|
709
|
+
equal(a.sideDialogWidth, b.sideDialogWidth) &&
|
|
688
710
|
equal(a.forceFilter, b.forceFilter);
|
|
689
711
|
}) as React.FunctionComponent<EntityCollectionViewProps<any>>
|
|
690
712
|
|
|
@@ -724,6 +746,7 @@ function EntitiesCount({
|
|
|
724
746
|
|
|
725
747
|
useEffect(() => {
|
|
726
748
|
if (onCountChange) {
|
|
749
|
+
setError(undefined);
|
|
727
750
|
onCountChange(count ?? 0);
|
|
728
751
|
}
|
|
729
752
|
}, [onCountChange, count]);
|
|
@@ -775,7 +798,7 @@ function EntityIdHeaderWidget({
|
|
|
775
798
|
if (!searchString) return;
|
|
776
799
|
setOpenPopup(false);
|
|
777
800
|
return sideEntityController.open({
|
|
778
|
-
entityId: searchString,
|
|
801
|
+
entityId: searchString.trim(),
|
|
779
802
|
path,
|
|
780
803
|
collection,
|
|
781
804
|
updateUrl: true,
|
|
@@ -788,11 +811,13 @@ function EntityIdHeaderWidget({
|
|
|
788
811
|
autoFocus={openPopup}
|
|
789
812
|
placeholder={"Find entity by ID"}
|
|
790
813
|
// size={"small"}
|
|
791
|
-
onChange={(e) =>
|
|
814
|
+
onChange={(e) => {
|
|
815
|
+
setSearchString(e.target.value);
|
|
816
|
+
}}
|
|
792
817
|
value={searchString}
|
|
793
818
|
className={"flex-grow bg-transparent outline-none p-1"}/>
|
|
794
819
|
<Button variant={"outlined"}
|
|
795
|
-
disabled={!searchString}
|
|
820
|
+
disabled={!(searchString.trim())}
|
|
796
821
|
type={"submit"}
|
|
797
822
|
>Go</Button>
|
|
798
823
|
</div>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useCustomizationController, useFireCMSContext } from "../../hooks";
|
|
3
|
+
import { CollectionActionsProps, EntityCollection, EntityTableController, SelectionController } from "../../types";
|
|
4
|
+
import { toArray } from "../../util/arrays";
|
|
5
|
+
import { ErrorBoundary } from "../ErrorBoundary";
|
|
6
|
+
import { ClearFilterSortButton } from "../ClearFilterSortButton";
|
|
7
|
+
|
|
8
|
+
export type EntityCollectionViewStartActionsProps<M extends Record<string, any>> = {
|
|
9
|
+
collection: EntityCollection<M>;
|
|
10
|
+
path: string;
|
|
11
|
+
relativePath: string;
|
|
12
|
+
parentCollectionIds: string[];
|
|
13
|
+
selectionController: SelectionController<M>;
|
|
14
|
+
tableController: EntityTableController<M>;
|
|
15
|
+
collectionEntitiesCount: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function EntityCollectionViewStartActions<M extends Record<string, any>>({
|
|
19
|
+
collection,
|
|
20
|
+
relativePath,
|
|
21
|
+
parentCollectionIds,
|
|
22
|
+
path,
|
|
23
|
+
selectionController,
|
|
24
|
+
tableController,
|
|
25
|
+
collectionEntitiesCount
|
|
26
|
+
}: EntityCollectionViewStartActionsProps<M>) {
|
|
27
|
+
|
|
28
|
+
const context = useFireCMSContext();
|
|
29
|
+
|
|
30
|
+
const customizationController = useCustomizationController();
|
|
31
|
+
const plugins = customizationController.plugins ?? [];
|
|
32
|
+
|
|
33
|
+
const actionProps: CollectionActionsProps = {
|
|
34
|
+
path,
|
|
35
|
+
relativePath,
|
|
36
|
+
parentCollectionIds,
|
|
37
|
+
collection,
|
|
38
|
+
selectionController,
|
|
39
|
+
context,
|
|
40
|
+
tableController,
|
|
41
|
+
collectionEntitiesCount
|
|
42
|
+
};
|
|
43
|
+
const actions: React.ReactNode[] = [
|
|
44
|
+
<ClearFilterSortButton
|
|
45
|
+
key={"clear_filter"}
|
|
46
|
+
tableController={tableController}
|
|
47
|
+
enabled={!collection.forceFilter}/>
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
if (plugins) {
|
|
51
|
+
plugins.forEach((plugin, i) => {
|
|
52
|
+
if (plugin.collectionView?.CollectionActionsStart) {
|
|
53
|
+
actions.push(...toArray(plugin.collectionView?.CollectionActionsStart)
|
|
54
|
+
.map((Action, j) => (
|
|
55
|
+
<ErrorBoundary key={`plugin_actions_${i}_${j}`}>
|
|
56
|
+
<Action {...actionProps} {...plugin.collectionView?.collectionActionsStartProps}/>
|
|
57
|
+
</ErrorBoundary>
|
|
58
|
+
)));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
{actions}
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -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
|
|
|
@@ -49,7 +51,7 @@ export function EntityPreview({
|
|
|
49
51
|
|
|
50
52
|
const navigationController = useNavigationController();
|
|
51
53
|
|
|
52
|
-
const collection = collectionProp ?? navigationController.getCollection
|
|
54
|
+
const collection = collectionProp ?? navigationController.getCollection(entity.path);
|
|
53
55
|
|
|
54
56
|
if (!collection) {
|
|
55
57
|
throw Error(`Couldn't find the corresponding collection view for the path: ${entity.path}`);
|
|
@@ -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
|
|
@@ -168,9 +170,10 @@ export function EntityPreview({
|
|
|
168
170
|
</EntityPreviewContainer>;
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
type EntityPreviewContainerProps = {
|
|
173
|
+
export type EntityPreviewContainerProps = {
|
|
172
174
|
children: React.ReactNode;
|
|
173
175
|
hover?: boolean;
|
|
176
|
+
fullwidth?: boolean;
|
|
174
177
|
size: PreviewSize;
|
|
175
178
|
className?: string;
|
|
176
179
|
style?: React.CSSProperties;
|
|
@@ -184,6 +187,7 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
|
|
|
184
187
|
size,
|
|
185
188
|
style,
|
|
186
189
|
className,
|
|
190
|
+
fullwidth = true,
|
|
187
191
|
...props
|
|
188
192
|
}, ref) => {
|
|
189
193
|
return <div
|
|
@@ -193,8 +197,9 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
|
|
|
193
197
|
// @ts-ignore
|
|
194
198
|
tabindex: 0
|
|
195
199
|
}}
|
|
196
|
-
className={
|
|
200
|
+
className={cls(
|
|
197
201
|
"bg-white dark:bg-gray-900",
|
|
202
|
+
fullwidth ? "w-full" : "",
|
|
198
203
|
"items-center",
|
|
199
204
|
hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
|
|
200
205
|
size === "tiny" ? "p-1" : "p-2",
|
|
@@ -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>
|
|
@@ -58,11 +58,11 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
58
58
|
</div>
|
|
59
59
|
{Object.entries(properties)
|
|
60
60
|
.map(([key, property]) => {
|
|
61
|
-
const value =
|
|
61
|
+
const value = entity.values?.[key];
|
|
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>
|
|
@@ -102,7 +102,7 @@ export function DefaultHomePage({
|
|
|
102
102
|
return (
|
|
103
103
|
<NavigationGroup
|
|
104
104
|
group={section.title}
|
|
105
|
-
key={`plugin_section_${plugin.
|
|
105
|
+
key={`plugin_section_${plugin.key}`}>
|
|
106
106
|
{section.children}
|
|
107
107
|
</NavigationGroup>
|
|
108
108
|
);
|
|
@@ -191,7 +191,7 @@ export function DefaultHomePage({
|
|
|
191
191
|
/>
|
|
192
192
|
</div>
|
|
193
193
|
))}
|
|
194
|
-
{AdditionalCards &&
|
|
194
|
+
{group?.toLowerCase() !== "admin" && AdditionalCards &&
|
|
195
195
|
AdditionalCards.map((AdditionalCard, i) => (
|
|
196
196
|
<div key={`nav_${group}_add_${i}`}>
|
|
197
197
|
<AdditionalCard {...actionProps} />
|
|
@@ -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
|
}}>
|
|
@@ -52,7 +52,7 @@ export function NavigationCard({
|
|
|
52
52
|
{description && <Typography variant="body2"
|
|
53
53
|
color="secondary"
|
|
54
54
|
component="div">
|
|
55
|
-
<Markdown source={description}/>
|
|
55
|
+
<Markdown source={description} size={"small"}/>
|
|
56
56
|
</Typography>}
|
|
57
57
|
</div>
|
|
58
58
|
|
|
@@ -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
|
}
|