@firecms/core 3.0.0-canary.7 → 3.0.0-canary.70
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 +2 -2
- 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 +2 -2
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
- 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 +12 -3
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
- package/dist/components/EntityPreview.d.ts +26 -7
- package/dist/components/EntityView.d.ts +11 -0
- package/dist/components/FieldCaption.d.ts +5 -0
- package/dist/components/HomePage/NavigationCard.d.ts +8 -0
- package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +2 -2
- package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
- package/dist/components/HomePage/index.d.ts +3 -1
- 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 +6 -7
- 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 +6 -3
- 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 +36 -0
- 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 +2 -3
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
- package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
- package/dist/form/index.d.ts +0 -2
- package/dist/form/validation.d.ts +1 -1
- 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 +2 -2
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useBuildNavigationController.d.ts +6 -4
- package/dist/hooks/useProjectLog.d.ts +6 -2
- package/dist/hooks/useStorageSource.d.ts +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +10512 -9997
- 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/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +1 -4
- package/dist/preview/components/BooleanPreview.d.ts +5 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +3 -8
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +37 -1
- package/dist/types/collections.d.ts +44 -6
- 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/entity_overrides.d.ts +6 -0
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/index.d.ts +2 -1
- package/dist/types/navigation.d.ts +15 -14
- package/dist/types/permissions.d.ts +5 -1
- package/dist/types/plugins.d.ts +22 -22
- package/dist/types/properties.d.ts +13 -5
- package/dist/types/property_config.d.ts +2 -2
- 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 +9 -1
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +8 -2
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/references.d.ts +4 -2
- package/dist/util/resolutions.d.ts +14 -14
- 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 +139 -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/DeleteEntityDialog.tsx +4 -4
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +4 -4
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -279
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +48 -45
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +18 -17
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -5
- 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 +73 -72
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +30 -0
- package/src/components/EntityPreview.tsx +209 -70
- package/src/components/EntityView.tsx +84 -0
- package/src/components/FieldCaption.tsx +14 -0
- package/src/components/HomePage/DefaultHomePage.tsx +15 -11
- package/src/components/HomePage/NavigationCard.tsx +69 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
- package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
- package/src/components/HomePage/index.tsx +3 -1
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +4 -4
- 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 +38 -24
- 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 +7 -7
- 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 +11 -7
- 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 +12 -1
- package/src/components/common/useTableSearchHelper.ts +39 -9
- package/src/components/index.tsx +6 -3
- package/src/contexts/AuthControllerContext.tsx +1 -1
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -34
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +1101 -0
- package/src/core/EntitySidePanel.tsx +3 -4
- package/src/core/FireCMS.tsx +54 -43
- package/src/core/NavigationRoutes.tsx +14 -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 +5 -7
- package/src/form/components/StorageUploadProgress.tsx +9 -8
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +10 -12
- 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 +19 -19
- package/src/form/field_bindings/MapFieldBinding.tsx +25 -17
- 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 +16 -13
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +14 -35
- package/src/form/field_bindings/TextFieldBinding.tsx +7 -5
- package/src/form/index.tsx +4 -4
- package/src/form/validation.ts +4 -21
- package/src/hooks/data/delete.ts +3 -3
- package/src/hooks/data/save.ts +4 -2
- package/src/hooks/data/useCollectionFetch.tsx +1 -1
- package/src/hooks/data/useDataSource.tsx +8 -3
- package/src/hooks/data/useEntityFetch.tsx +4 -4
- 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 +200 -83
- package/src/hooks/useProjectLog.tsx +17 -7
- package/src/hooks/useReferenceDialog.tsx +2 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useStorageSource.tsx +7 -2
- 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 +5 -15
- package/src/preview/PropertyPreviewProps.tsx +1 -11
- package/src/preview/components/BooleanPreview.tsx +19 -4
- package/src/preview/components/EnumValuesChip.tsx +2 -2
- package/src/preview/components/ReferencePreview.tsx +72 -165
- 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 +8 -7
- package/src/types/analytics.ts +1 -0
- package/src/types/auth.tsx +50 -1
- package/src/types/collections.ts +51 -6
- 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 +17 -0
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/entity_overrides.tsx +7 -0
- package/src/types/fields.tsx +33 -33
- package/src/types/firecms.tsx +0 -1
- package/src/types/index.ts +2 -1
- package/src/types/navigation.ts +17 -17
- package/src/types/permissions.ts +6 -1
- package/src/types/plugins.tsx +28 -30
- package/src/types/properties.ts +19 -7
- package/src/types/property_config.tsx +2 -2
- package/src/types/roles.ts +41 -0
- package/src/types/side_entity_controller.tsx +1 -0
- package/src/types/storage.ts +12 -3
- package/src/types/user.ts +7 -0
- package/src/util/collections.ts +22 -0
- package/src/util/entities.ts +2 -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/icons.tsx +11 -3
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +8 -21
- package/src/util/permissions.ts +12 -8
- package/src/util/references.ts +36 -5
- 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/EntityView.d.ts +0 -22
- 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/components/HomePage/NavigationCollectionCard.tsx +0 -146
- package/src/core/Drawer.tsx +0 -164
- package/src/core/EntityView.tsx +0 -578
- package/src/core/Scaffold.tsx +0 -281
- package/src/core/SideEntityView.tsx +0 -38
- package/src/form/EntityForm.tsx +0 -720
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
|
@@ -4,7 +4,7 @@ import { EntitySidePanelProps } from "../types";
|
|
|
4
4
|
import { useNavigationController } from "../hooks";
|
|
5
5
|
|
|
6
6
|
import { ErrorBoundary } from "../components";
|
|
7
|
-
import {
|
|
7
|
+
import { EntityEditView } from "./EntityEditView";
|
|
8
8
|
import { useSideDialogContext } from "./SideDialogs";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -33,7 +33,7 @@ export function EntitySidePanel(props: EntitySidePanelProps) {
|
|
|
33
33
|
if (!props) return undefined;
|
|
34
34
|
let usedCollection = props.collection;
|
|
35
35
|
|
|
36
|
-
const registryCollection = navigationController.getCollection(props.path
|
|
36
|
+
const registryCollection = navigationController.getCollection(props.path);
|
|
37
37
|
if (registryCollection) {
|
|
38
38
|
usedCollection = registryCollection;
|
|
39
39
|
}
|
|
@@ -77,9 +77,8 @@ export function EntitySidePanel(props: EntitySidePanelProps) {
|
|
|
77
77
|
return (
|
|
78
78
|
<>
|
|
79
79
|
<ErrorBoundary>
|
|
80
|
-
<
|
|
80
|
+
<EntityEditView
|
|
81
81
|
{...props}
|
|
82
|
-
formWidth={props.width}
|
|
83
82
|
collection={collection}
|
|
84
83
|
parentCollectionIds={parentCollectionIds}
|
|
85
84
|
onValuesAreModified={onValuesAreModified}
|
package/src/core/FireCMS.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
|
|
3
|
-
import { EntityCollection, FireCMSContext, FireCMSPlugin, FireCMSProps, User } from "../types";
|
|
4
|
-
import { AuthControllerContext
|
|
3
|
+
import { CustomizationController, EntityCollection, FireCMSContext, FireCMSPlugin, FireCMSProps, User } from "../types";
|
|
4
|
+
import { AuthControllerContext } from "../contexts";
|
|
5
5
|
import { useBuildSideEntityController } from "../internal/useBuildSideEntityController";
|
|
6
|
-
import { useCustomizationController, useFireCMSContext
|
|
6
|
+
import { useCustomizationController, useFireCMSContext } from "../hooks";
|
|
7
7
|
import { useBuildSideDialogsController } from "../internal/useBuildSideDialogsController";
|
|
8
8
|
import { ErrorView } from "../components";
|
|
9
9
|
import { StorageSourceContext } from "../contexts/StorageSourceContext";
|
|
@@ -12,11 +12,9 @@ import { DataSourceContext } from "../contexts/DataSourceContext";
|
|
|
12
12
|
import { SideEntityControllerContext } from "../contexts/SideEntityControllerContext";
|
|
13
13
|
import { NavigationContext } from "../contexts/NavigationContext";
|
|
14
14
|
import { SideDialogsControllerContext } from "../contexts/SideDialogsControllerContext";
|
|
15
|
-
import { useLocaleConfig } from "
|
|
16
|
-
import { CenteredView } from "@firecms/ui";
|
|
15
|
+
import { CenteredView, Typography, useLocaleConfig } from "@firecms/ui";
|
|
17
16
|
import { DialogsProvider } from "../contexts/DialogsProvider";
|
|
18
17
|
import { useBuildDataSource } from "../internal/useBuildDataSource";
|
|
19
|
-
import { useBuildCustomizationController } from "../internal/useBuildCustomizationController";
|
|
20
18
|
import { CustomizationControllerContext } from "../contexts/CustomizationControllerContext";
|
|
21
19
|
import { AnalyticsContext } from "../contexts/AnalyticsContext";
|
|
22
20
|
import { useProjectLog } from "../hooks/useProjectLog";
|
|
@@ -35,7 +33,6 @@ import { useProjectLog } from "../hooks/useProjectLog";
|
|
|
35
33
|
*/
|
|
36
34
|
export function FireCMS<UserType extends User, EC extends EntityCollection>(props: FireCMSProps<UserType, EC>) {
|
|
37
35
|
|
|
38
|
-
const modeController = useModeController();
|
|
39
36
|
const {
|
|
40
37
|
children,
|
|
41
38
|
entityLinkBuilder,
|
|
@@ -71,7 +68,7 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
71
68
|
|
|
72
69
|
const loading = authController.initialLoading || navigationController.loading || pluginsLoading;
|
|
73
70
|
|
|
74
|
-
const customizationController =
|
|
71
|
+
const customizationController: CustomizationController = {
|
|
75
72
|
dateTimeFormat,
|
|
76
73
|
locale,
|
|
77
74
|
entityLinkBuilder,
|
|
@@ -79,13 +76,13 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
79
76
|
entityViews: entityViews ?? [],
|
|
80
77
|
propertyConfigs: propertyConfigs ?? {},
|
|
81
78
|
components
|
|
82
|
-
}
|
|
79
|
+
};
|
|
83
80
|
|
|
84
81
|
const analyticsController = useMemo(() => ({
|
|
85
82
|
onAnalyticsEvent
|
|
86
83
|
}), []);
|
|
87
84
|
|
|
88
|
-
useProjectLog(authController);
|
|
85
|
+
const accessResponse = useProjectLog(authController, plugins);
|
|
89
86
|
|
|
90
87
|
if (navigationController.navigationLoadingError) {
|
|
91
88
|
return (
|
|
@@ -107,40 +104,54 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
107
104
|
);
|
|
108
105
|
}
|
|
109
106
|
|
|
107
|
+
if (accessResponse?.blocked) {
|
|
108
|
+
return (
|
|
109
|
+
<CenteredView maxWidth={"md"} fullScreen={true}>
|
|
110
|
+
<Typography variant={"h4"}>
|
|
111
|
+
Access blocked
|
|
112
|
+
</Typography>
|
|
113
|
+
<Typography>
|
|
114
|
+
This app has been blocked. Please reach out at <a
|
|
115
|
+
href={"mailto:hello@firecms.co"}>hello@firecms.co</a> for more information.
|
|
116
|
+
</Typography>
|
|
117
|
+
{accessResponse?.message &&
|
|
118
|
+
<Typography>Response from the server: {accessResponse?.message}</Typography>}
|
|
119
|
+
</CenteredView>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
110
123
|
return (
|
|
111
|
-
<
|
|
112
|
-
<
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
</AnalyticsContext.Provider>
|
|
143
|
-
</ModeControllerContext.Provider>
|
|
124
|
+
<AnalyticsContext.Provider value={analyticsController}>
|
|
125
|
+
<CustomizationControllerContext.Provider value={customizationController}>
|
|
126
|
+
<UserConfigurationPersistenceContext.Provider
|
|
127
|
+
value={userConfigPersistence}>
|
|
128
|
+
<StorageSourceContext.Provider
|
|
129
|
+
value={storageSource}>
|
|
130
|
+
<DataSourceContext.Provider
|
|
131
|
+
value={dataSource}>
|
|
132
|
+
<AuthControllerContext.Provider
|
|
133
|
+
value={authController}>
|
|
134
|
+
<SideDialogsControllerContext.Provider
|
|
135
|
+
value={sideDialogsController}>
|
|
136
|
+
<SideEntityControllerContext.Provider
|
|
137
|
+
value={sideEntityController}>
|
|
138
|
+
<NavigationContext.Provider
|
|
139
|
+
value={navigationController}>
|
|
140
|
+
<DialogsProvider>
|
|
141
|
+
<FireCMSInternal
|
|
142
|
+
loading={loading}>
|
|
143
|
+
{children}
|
|
144
|
+
</FireCMSInternal>
|
|
145
|
+
</DialogsProvider>
|
|
146
|
+
</NavigationContext.Provider>
|
|
147
|
+
</SideEntityControllerContext.Provider>
|
|
148
|
+
</SideDialogsControllerContext.Provider>
|
|
149
|
+
</AuthControllerContext.Provider>
|
|
150
|
+
</DataSourceContext.Provider>
|
|
151
|
+
</StorageSourceContext.Provider>
|
|
152
|
+
</UserConfigurationPersistenceContext.Provider>
|
|
153
|
+
</CustomizationControllerContext.Provider>
|
|
154
|
+
</AnalyticsContext.Provider>
|
|
144
155
|
);
|
|
145
156
|
|
|
146
157
|
}
|
|
@@ -13,9 +13,9 @@ export type NavigationRoutesProps = {
|
|
|
13
13
|
/**
|
|
14
14
|
* In case you need to override the home page
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
homePage?: React.ReactNode;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
children?: React.ReactNode | React.ReactNode[]
|
|
19
19
|
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -28,11 +28,10 @@ export type NavigationRoutesProps = {
|
|
|
28
28
|
* @constructor
|
|
29
29
|
* @group Components
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
31
|
export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
33
32
|
function NavigationRoutes({
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
homePage = <DefaultHomePage/>,
|
|
34
|
+
children
|
|
36
35
|
}: NavigationRoutesProps) {
|
|
37
36
|
|
|
38
37
|
const location = useLocation();
|
|
@@ -59,6 +58,14 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
|
59
58
|
cmsViews.push(buildCMSViewRoute(cmsView.path, cmsView));
|
|
60
59
|
});
|
|
61
60
|
}
|
|
61
|
+
if (navigation.adminViews) {
|
|
62
|
+
navigation.adminViews.forEach((cmsView) => {
|
|
63
|
+
if (Array.isArray(cmsView.path))
|
|
64
|
+
cmsViews.push(...cmsView.path.map(path => buildCMSViewRoute(path, cmsView)));
|
|
65
|
+
else
|
|
66
|
+
cmsViews.push(buildCMSViewRoute(cmsView.path, cmsView));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
62
69
|
|
|
63
70
|
// we reorder collections so that nested paths are included first
|
|
64
71
|
const sortedCollections = [...(navigation.collections ?? [])]
|
|
@@ -85,7 +92,7 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
|
85
92
|
|
|
86
93
|
const homeRoute = (
|
|
87
94
|
<Route path={"/"}
|
|
88
|
-
element={
|
|
95
|
+
element={homePage}/>
|
|
89
96
|
);
|
|
90
97
|
|
|
91
98
|
const notFoundRoute = <Route path={"*"}
|
|
@@ -104,7 +111,7 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
|
104
111
|
|
|
105
112
|
{notFoundRoute}
|
|
106
113
|
|
|
107
|
-
{
|
|
114
|
+
{children}
|
|
108
115
|
|
|
109
116
|
</Routes>
|
|
110
117
|
);
|
|
@@ -331,7 +331,7 @@ export function getFieldConfig(property: Property | ResolvedProperty, propertyCo
|
|
|
331
331
|
}
|
|
332
332
|
const defaultFieldConfig = DEFAULT_FIELD_CONFIGS[defaultFieldId];
|
|
333
333
|
const customField = fieldId ? propertyConfigs[fieldId] : undefined;
|
|
334
|
-
return mergeDeep(defaultFieldConfig ?? {}, customField ?? {});
|
|
334
|
+
return mergeDeep(defaultFieldConfig ?? {}, customField ?? {} as PropertyConfig);
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
export function getDefaultFieldId(property: Property | ResolvedProperty) {
|
|
@@ -359,8 +359,7 @@ export function getDefaultFieldId(property: Property | ResolvedProperty) {
|
|
|
359
359
|
} else if (property.dataType === "map") {
|
|
360
360
|
if (property.keyValue)
|
|
361
361
|
return "key_value";
|
|
362
|
-
|
|
363
|
-
return "group";
|
|
362
|
+
return "group";
|
|
364
363
|
} else if (property.dataType === "array") {
|
|
365
364
|
const of = (property as ArrayProperty).of;
|
|
366
365
|
const oneOf = (property as ArrayProperty).oneOf;
|
package/src/core/index.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from "./FireCMS";
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
export { Scaffold } from "./Scaffold";
|
|
3
|
+
export * from "../app/Scaffold";
|
|
5
4
|
|
|
6
|
-
export
|
|
7
|
-
export
|
|
5
|
+
export * from "./DefaultDrawer";
|
|
6
|
+
export * from "./DrawerNavigationItem";
|
|
8
7
|
|
|
9
8
|
export * from "./field_configs";
|
|
10
9
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { FormContext, PropertiesOrBuilders, PropertyFieldBindingProps } from "../types";
|
|
2
|
+
import { Tooltip } from "@firecms/ui";
|
|
3
|
+
import { PropertyIdCopyTooltipContent } from "../components/PropertyIdCopyTooltipContent";
|
|
4
|
+
import { PropertyFieldBinding } from "./PropertyFieldBinding";
|
|
5
|
+
import { ErrorBoundary } from "../components";
|
|
6
|
+
import { isHidden, isReadOnly, resolveProperties } from "../util";
|
|
7
|
+
import { FormexController } from "@firecms/formex";
|
|
8
|
+
|
|
9
|
+
export type PropertiesFormProps<M extends Record<string, any> = Record<string, any>> = {
|
|
10
|
+
properties: PropertiesOrBuilders<M>;
|
|
11
|
+
propertiesOrder?: string[];
|
|
12
|
+
formex: FormexController<M>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function PropertiesForm<M extends Record<string, any> = Record<string, any>>({
|
|
16
|
+
properties,
|
|
17
|
+
propertiesOrder,
|
|
18
|
+
formex
|
|
19
|
+
}: PropertiesFormProps<M>) {
|
|
20
|
+
|
|
21
|
+
const resolvedProperties = resolveProperties({ properties });
|
|
22
|
+
|
|
23
|
+
const formContext: FormContext<M> = {
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
setFieldValue: useCallback(formex.setFieldValue, []),
|
|
26
|
+
values: formex.values ?? {},
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
save: useCallback(() => {
|
|
29
|
+
throw new Error("Not implemented. You currently can't call save from a custom field, within a PropertiesForm (it works in standard Entity forms)");
|
|
30
|
+
}, []),
|
|
31
|
+
formex
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const formFields = (
|
|
35
|
+
<div className={"flex flex-col gap-8"}>
|
|
36
|
+
{(propertiesOrder ?? Object.keys(resolvedProperties))
|
|
37
|
+
.map((key) => {
|
|
38
|
+
|
|
39
|
+
const property = resolvedProperties[key];
|
|
40
|
+
if (!property) {
|
|
41
|
+
console.warn(`Property ${key} not found in collection PropertiesForm`);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const disabled = formex.isSubmitting || isReadOnly(property) || Boolean(property.disabled);
|
|
46
|
+
const hidden = isHidden(property);
|
|
47
|
+
if (hidden) return null;
|
|
48
|
+
const cmsFormFieldProps: PropertyFieldBindingProps<any, M> = {
|
|
49
|
+
propertyKey: key,
|
|
50
|
+
disabled,
|
|
51
|
+
property,
|
|
52
|
+
includeDescription: property.description || property.longDescription,
|
|
53
|
+
context: formContext,
|
|
54
|
+
tableMode: false,
|
|
55
|
+
partOfArray: false,
|
|
56
|
+
partOfBlock: false,
|
|
57
|
+
autoFocus: false
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div id={`form_field_${key}`}
|
|
62
|
+
key={`field_${key}`}>
|
|
63
|
+
<ErrorBoundary>
|
|
64
|
+
<Tooltip title={<PropertyIdCopyTooltipContent propertyId={key}/>}
|
|
65
|
+
delayDuration={800}
|
|
66
|
+
side={"left"}
|
|
67
|
+
align={"start"}
|
|
68
|
+
sideOffset={16}>
|
|
69
|
+
<PropertyFieldBinding {...cmsFormFieldProps}/>
|
|
70
|
+
</Tooltip>
|
|
71
|
+
</ErrorBoundary>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
})
|
|
75
|
+
.filter(Boolean)}
|
|
76
|
+
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return <div></div>
|
|
81
|
+
}
|
|
@@ -85,6 +85,7 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
|
|
|
85
85
|
|
|
86
86
|
return (
|
|
87
87
|
<Field
|
|
88
|
+
key={propertyKey}
|
|
88
89
|
name={propertyKey}
|
|
89
90
|
>
|
|
90
91
|
{(fieldProps) => {
|
|
@@ -92,7 +93,6 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
|
|
|
92
93
|
let Component: ComponentType<FieldProps<T>> | undefined;
|
|
93
94
|
const resolvedProperty: ResolvedProperty<T> | null = resolveProperty({
|
|
94
95
|
propertyKey,
|
|
95
|
-
propertyValue: fieldProps.field.value,
|
|
96
96
|
propertyOrBuilder: property,
|
|
97
97
|
values: fieldProps.form.values,
|
|
98
98
|
path: context.path,
|
|
@@ -111,12 +111,16 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
|
|
|
111
111
|
} else {
|
|
112
112
|
const propertyConfig = getFieldConfig(resolvedProperty, customizationController.propertyConfigs);
|
|
113
113
|
if (!propertyConfig) {
|
|
114
|
-
console.log("INTERNAL: Could not find field config for property", {
|
|
114
|
+
console.log("INTERNAL: Could not find field config for property", {
|
|
115
|
+
propertyKey,
|
|
116
|
+
resolvedProperty,
|
|
117
|
+
fields: customizationController.propertyConfigs,
|
|
118
|
+
propertyConfig
|
|
119
|
+
});
|
|
115
120
|
throw new Error(`INTERNAL: Could not find field config for property ${propertyKey}`);
|
|
116
121
|
}
|
|
117
122
|
const configProperty = resolveProperty({
|
|
118
123
|
propertyOrBuilder: propertyConfig.property,
|
|
119
|
-
propertyValue: fieldProps.field.value,
|
|
120
124
|
values: fieldProps.form.values,
|
|
121
125
|
path: context.path,
|
|
122
126
|
entityId: context.entityId,
|
|
@@ -196,7 +200,14 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
|
|
|
196
200
|
(fieldProps.form.submitCount > 0 || property.validation?.unique) &&
|
|
197
201
|
(!Array.isArray(error) || !!error.filter((e: any) => !!e).length);
|
|
198
202
|
|
|
199
|
-
const WrappedComponent: ComponentType<FieldProps<T, any, M>> | null = useWrappedComponent(
|
|
203
|
+
const WrappedComponent: ComponentType<FieldProps<T, any, M>> | null = useWrappedComponent({
|
|
204
|
+
path: context.path,
|
|
205
|
+
collection: context.collection,
|
|
206
|
+
propertyKey: propertyKey,
|
|
207
|
+
property: property,
|
|
208
|
+
Component: Component,
|
|
209
|
+
plugins: plugins
|
|
210
|
+
});
|
|
200
211
|
const UsedComponent: ComponentType<FieldProps<T>> = WrappedComponent ?? Component;
|
|
201
212
|
|
|
202
213
|
const isSubmitting = fieldProps.form.isSubmitting;
|
|
@@ -266,13 +277,24 @@ const shouldPropertyReRender = (property: PropertyOrBuilder | ResolvedProperty,
|
|
|
266
277
|
}
|
|
267
278
|
}
|
|
268
279
|
|
|
269
|
-
|
|
270
|
-
path
|
|
271
|
-
collection
|
|
280
|
+
interface UseWrappedComponentParams<T extends CMSType = CMSType, M extends Record<string, any> = any> {
|
|
281
|
+
path?: string,
|
|
282
|
+
collection?: EntityCollection<M>,
|
|
272
283
|
propertyKey: string,
|
|
273
284
|
property: ResolvedProperty<T>,
|
|
274
285
|
Component: ComponentType<FieldProps<T, any, M>>,
|
|
275
286
|
plugins?: FireCMSPlugin[]
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function useWrappedComponent<T extends CMSType = CMSType, M extends Record<string, any> = any>(
|
|
290
|
+
{
|
|
291
|
+
path,
|
|
292
|
+
collection,
|
|
293
|
+
propertyKey,
|
|
294
|
+
property,
|
|
295
|
+
Component,
|
|
296
|
+
plugins
|
|
297
|
+
}: UseWrappedComponentParams<T, M>
|
|
276
298
|
): ComponentType<FieldProps<T, any, M>> | null {
|
|
277
299
|
|
|
278
300
|
const wrapperRef = useRef<ComponentType<FieldProps<T, any, M>> | null>((() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedProperty } from "../../types";
|
|
1
|
+
import { Property, ResolvedProperty } from "../../types";
|
|
2
2
|
import { IconButton, InfoIcon, Tooltip, Typography } from "@firecms/ui";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -13,8 +13,8 @@ export function FieldHelperText({
|
|
|
13
13
|
disabled
|
|
14
14
|
}: {
|
|
15
15
|
error?: string,
|
|
16
|
-
showError
|
|
17
|
-
property: ResolvedProperty,
|
|
16
|
+
showError?: boolean,
|
|
17
|
+
property: ResolvedProperty | Property,
|
|
18
18
|
includeDescription?: boolean,
|
|
19
19
|
disabled?: boolean,
|
|
20
20
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { Entity, ResolvedStringProperty } from "../../types";
|
|
3
|
+
import { Entity, EntityCollection, ResolvedStringProperty } from "../../types";
|
|
4
4
|
import { PreviewSize, PropertyPreview } from "../../preview";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { cls, IconButton, paperMixin, RemoveIcon, Tooltip } from "@firecms/ui";
|
|
7
7
|
import { ErrorBoundary } from "../../components";
|
|
8
8
|
|
|
9
9
|
interface StorageItemPreviewProps {
|
|
10
10
|
name: string;
|
|
11
11
|
property: ResolvedStringProperty;
|
|
12
12
|
value: string,
|
|
13
|
-
entity: Entity<any>,
|
|
14
13
|
onRemove: (value: string) => void;
|
|
15
14
|
size: PreviewSize;
|
|
16
15
|
disabled: boolean;
|
|
@@ -20,14 +19,13 @@ export function StorageItemPreview({
|
|
|
20
19
|
name,
|
|
21
20
|
property,
|
|
22
21
|
value,
|
|
23
|
-
entity,
|
|
24
22
|
onRemove,
|
|
25
23
|
disabled,
|
|
26
|
-
size
|
|
24
|
+
size,
|
|
27
25
|
}: StorageItemPreviewProps) {
|
|
28
26
|
|
|
29
27
|
return (
|
|
30
|
-
<div className={
|
|
28
|
+
<div className={cls(paperMixin,
|
|
31
29
|
"relative m-4 border-box flex items-center justify-center",
|
|
32
30
|
size === "medium" ? "min-w-[220px] min-h-[220px] max-w-[220px]" : "min-w-[118px] min-h-[118px] max-w-[118px]")}>
|
|
33
31
|
|
|
@@ -54,7 +52,7 @@ export function StorageItemPreview({
|
|
|
54
52
|
<PropertyPreview propertyKey={name}
|
|
55
53
|
value={value}
|
|
56
54
|
property={property}
|
|
57
|
-
|
|
55
|
+
// entity={entity}
|
|
58
56
|
size={size}/>
|
|
59
57
|
</ErrorBoundary>
|
|
60
58
|
}
|
|
@@ -3,7 +3,8 @@ import React, { useCallback } from "react";
|
|
|
3
3
|
import { useSnackbarController, useStorageSource } from "../../hooks";
|
|
4
4
|
import { StorageFieldItem } from "../../util/useStorageUploadController";
|
|
5
5
|
import { ErrorView } from "../../components";
|
|
6
|
-
import {
|
|
6
|
+
import { cls, paperMixin, Skeleton } from "@firecms/ui";
|
|
7
|
+
import { EntityCollection, StorageSource } from "../../types";
|
|
7
8
|
|
|
8
9
|
export interface StorageUploadItemProps {
|
|
9
10
|
storagePath: string;
|
|
@@ -22,10 +23,10 @@ export function StorageUploadProgress({
|
|
|
22
23
|
metadata,
|
|
23
24
|
onFileUploadComplete,
|
|
24
25
|
imageSize,
|
|
25
|
-
simple
|
|
26
|
+
simple,
|
|
26
27
|
}: StorageUploadItemProps) {
|
|
27
28
|
|
|
28
|
-
const
|
|
29
|
+
const storageSource = useStorageSource();
|
|
29
30
|
|
|
30
31
|
const snackbarController = useSnackbarController();
|
|
31
32
|
|
|
@@ -41,14 +42,14 @@ export function StorageUploadProgress({
|
|
|
41
42
|
setError(undefined);
|
|
42
43
|
setLoading(true);
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
storageSource.uploadFile({
|
|
45
46
|
file,
|
|
46
47
|
fileName,
|
|
47
48
|
path: storagePath,
|
|
48
49
|
metadata
|
|
49
50
|
})
|
|
50
51
|
.then(async ({ path }) => {
|
|
51
|
-
console.debug("Upload successful");
|
|
52
|
+
console.debug("Upload successful", path);
|
|
52
53
|
await onFileUploadComplete(path, entry, metadata);
|
|
53
54
|
if (mounted.current)
|
|
54
55
|
setLoading(false);
|
|
@@ -67,7 +68,7 @@ export function StorageUploadProgress({
|
|
|
67
68
|
.finally(() => {
|
|
68
69
|
uploading.current = false;
|
|
69
70
|
});
|
|
70
|
-
}, [entry, metadata, onFileUploadComplete,
|
|
71
|
+
}, [entry, metadata, onFileUploadComplete, storageSource, storagePath]);
|
|
71
72
|
|
|
72
73
|
React.useEffect(() => {
|
|
73
74
|
mounted.current = true;
|
|
@@ -87,9 +88,9 @@ export function StorageUploadProgress({
|
|
|
87
88
|
}
|
|
88
89
|
return (
|
|
89
90
|
|
|
90
|
-
<div className={
|
|
91
|
+
<div className={cls(paperMixin,
|
|
91
92
|
"relative m-4 border-box flex items-center justify-center",
|
|
92
|
-
|
|
93
|
+
`min-w-[${imageSize}px] min-h-[${imageSize}px]`)}>
|
|
93
94
|
|
|
94
95
|
{loading &&
|
|
95
96
|
<Skeleton className="w-full h-full"/>}
|
|
@@ -6,7 +6,7 @@ import { ErrorView } from "../../components";
|
|
|
6
6
|
import { getIconForProperty, getReferenceFrom } from "../../util";
|
|
7
7
|
|
|
8
8
|
import { useNavigationController, useReferenceDialog } from "../../hooks";
|
|
9
|
-
import { Button, ExpandablePanel } from "@firecms/ui";
|
|
9
|
+
import { Button, cls, ExpandablePanel, fieldBackgroundMixin } from "@firecms/ui";
|
|
10
10
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
11
11
|
|
|
12
12
|
type ArrayOfReferencesFieldProps = FieldProps<EntityReference[]>;
|
|
@@ -38,7 +38,6 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const expanded = property.expanded === undefined ? true : property.expanded;
|
|
41
|
-
const [onHover, setOnHover] = React.useState(false);
|
|
42
41
|
const selectedEntityIds = value && Array.isArray(value) ? value.map((ref) => ref.id) : [];
|
|
43
42
|
|
|
44
43
|
useClearRestoreValue({
|
|
@@ -81,21 +80,19 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
81
80
|
if (!entryValue)
|
|
82
81
|
return <div>Internal ERROR</div>;
|
|
83
82
|
return (
|
|
84
|
-
<div
|
|
85
|
-
onMouseEnter={() => setOnHover(true)}
|
|
86
|
-
onMouseMove={() => setOnHover(true)}
|
|
87
|
-
onMouseLeave={() => setOnHover(false)}>
|
|
88
83
|
<ReferencePreview
|
|
84
|
+
key={internalId}
|
|
89
85
|
disabled={!ofProperty.path}
|
|
90
86
|
previewProperties={ofProperty.previewProperties}
|
|
91
87
|
size={"medium"}
|
|
92
88
|
onClick={onEntryClick}
|
|
89
|
+
hover={!disabled}
|
|
93
90
|
reference={entryValue}
|
|
94
|
-
|
|
91
|
+
includeId={ofProperty.includeId}
|
|
92
|
+
includeEntityLink={ofProperty.includeEntityLink}
|
|
95
93
|
/>
|
|
96
|
-
</div>
|
|
97
94
|
);
|
|
98
|
-
}, [ofProperty.path, ofProperty.previewProperties,
|
|
95
|
+
}, [ofProperty.path, ofProperty.previewProperties, value]);
|
|
99
96
|
|
|
100
97
|
const title = (
|
|
101
98
|
<LabelWithIcon icon={getIconForProperty(property, "small")}
|
|
@@ -108,7 +105,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
108
105
|
{!collection && <ErrorView
|
|
109
106
|
error={"The specified collection does not exist. Check console"}/>}
|
|
110
107
|
|
|
111
|
-
{collection &&
|
|
108
|
+
{collection && <div className={"group"}>
|
|
112
109
|
|
|
113
110
|
<FormikArrayContainer value={value}
|
|
114
111
|
addLabel={property.name ? "Add reference to " + property.name : "Add reference"}
|
|
@@ -126,7 +123,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
126
123
|
onClick={onEntryClick}>
|
|
127
124
|
Edit {property.name}
|
|
128
125
|
</Button>
|
|
129
|
-
|
|
126
|
+
</div>}
|
|
130
127
|
</>;
|
|
131
128
|
|
|
132
129
|
return (
|
|
@@ -134,7 +131,8 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
134
131
|
|
|
135
132
|
{!tableMode &&
|
|
136
133
|
<ExpandablePanel
|
|
137
|
-
|
|
134
|
+
titleClassName={fieldBackgroundMixin}
|
|
135
|
+
className={cls("px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2", fieldBackgroundMixin)}
|
|
138
136
|
initiallyExpanded={expanded}
|
|
139
137
|
title={title}>
|
|
140
138
|
{body}
|
|
@@ -8,7 +8,7 @@ import { EnumValuesChip } from "../../preview";
|
|
|
8
8
|
import { FieldProps, FormContext, PropertyFieldBindingProps, PropertyOrBuilder } from "../../types";
|
|
9
9
|
import { getDefaultValueFor, getIconForProperty, } from "../../util";
|
|
10
10
|
import { DEFAULT_ONE_OF_TYPE, DEFAULT_ONE_OF_VALUE } from "../../util/common";
|
|
11
|
-
import {
|
|
11
|
+
import { cls, ExpandablePanel, paperMixin, Select, SelectItem, Typography } from "@firecms/ui";
|
|
12
12
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -193,7 +193,7 @@ function BlockEntry({
|
|
|
193
193
|
};
|
|
194
194
|
|
|
195
195
|
return (
|
|
196
|
-
<div className={
|
|
196
|
+
<div className={cls(paperMixin, "bg-transparent p-4 my-4 py-8")}>
|
|
197
197
|
|
|
198
198
|
<Field
|
|
199
199
|
name={typeFieldName}
|
|
@@ -43,7 +43,7 @@ export function DateTimeFieldBinding({
|
|
|
43
43
|
<>
|
|
44
44
|
<DateTimeField
|
|
45
45
|
value={internalValue}
|
|
46
|
-
onChange={(dateValue) => setValue(dateValue)}
|
|
46
|
+
onChange={(dateValue) => setValue(dateValue ?? null)}
|
|
47
47
|
size={"medium"}
|
|
48
48
|
mode={property.mode}
|
|
49
49
|
clearable={property.clearable}
|