@firecms/core 3.0.0-canary.9 → 3.0.0-canary.90
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/CircularProgressCenter.d.ts +1 -1
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
- 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 +12 -2
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityPreview.d.ts +5 -4
- package/dist/components/ErrorView.d.ts +1 -1
- package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -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 +15 -12
- 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} +6 -9
- 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/FireCMS.d.ts +1 -1
- package/dist/core/NavigationRoutes.d.ts +3 -3
- 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 +15552 -11933
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19643 -7
- 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 +26 -2
- package/dist/types/collections.d.ts +31 -7
- package/dist/types/datasource.d.ts +34 -20
- 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 +0 -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/storage.d.ts +11 -3
- 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/plurals.d.ts +0 -2
- 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/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +9 -18
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +21 -20
- 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 +11 -2
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +14 -6
- 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 +69 -45
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
- package/src/components/EntityPreview.tsx +15 -9
- package/src/components/EntityView.tsx +5 -5
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/HomePage/DefaultHomePage.tsx +3 -3
- package/src/components/HomePage/NavigationCard.tsx +3 -3
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- 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 +7 -7
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
- package/src/components/VirtualTable/VirtualTable.tsx +70 -37
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +18 -14
- 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} +52 -37
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +676 -133
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +39 -44
- package/src/core/NavigationRoutes.tsx +7 -8
- 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/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 +22 -43
- 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 +2 -2
- 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 +21 -8
- 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 +56 -49
- 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 +35 -2
- package/src/types/collections.ts +37 -8
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +41 -24
- 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 +0 -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/storage.ts +12 -3
- 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/plurals.ts +0 -2
- 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
|
@@ -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
|
}
|
|
@@ -79,7 +79,6 @@ export function EntitySidePanel(props: EntitySidePanelProps) {
|
|
|
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, Typography } 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";
|
|
@@ -30,12 +28,11 @@ import { useProjectLog } from "../hooks/useProjectLog";
|
|
|
30
28
|
*
|
|
31
29
|
* You only need to use this component if you are building a custom app.
|
|
32
30
|
*
|
|
33
|
-
|
|
31
|
+
|
|
34
32
|
* @group Core
|
|
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
|
-
const accessResponse = useProjectLog(authController);
|
|
85
|
+
const accessResponse = useProjectLog(authController, dataSourceDelegate, plugins);
|
|
89
86
|
|
|
90
87
|
if (navigationController.navigationLoadingError) {
|
|
91
88
|
return (
|
|
@@ -124,39 +121,37 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
124
121
|
}
|
|
125
122
|
|
|
126
123
|
return (
|
|
127
|
-
<
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
</AnalyticsContext.Provider>
|
|
159
|
-
</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>
|
|
160
155
|
);
|
|
161
156
|
|
|
162
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
|
|
|
@@ -25,14 +25,13 @@ export type NavigationRoutesProps = {
|
|
|
25
25
|
* or the home route) related to a {@link NavigationController}.
|
|
26
26
|
* This component needs a parent {@link FireCMS}
|
|
27
27
|
*
|
|
28
|
-
|
|
28
|
+
|
|
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();
|
|
@@ -93,7 +92,7 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
|
93
92
|
|
|
94
93
|
const homeRoute = (
|
|
95
94
|
<Route path={"/"}
|
|
96
|
-
element={
|
|
95
|
+
element={homePage}/>
|
|
97
96
|
);
|
|
98
97
|
|
|
99
98
|
const notFoundRoute = <Route path={"*"}
|
|
@@ -112,7 +111,7 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
|
112
111
|
|
|
113
112
|
{notFoundRoute}
|
|
114
113
|
|
|
115
|
-
{
|
|
114
|
+
{children}
|
|
116
115
|
|
|
117
116
|
</Routes>
|
|
118
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,39 +1,40 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ResolvedStringProperty } from "../../types";
|
|
4
4
|
import { PreviewSize, PropertyPreview } from "../../preview";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { cls, DescriptionIcon, 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;
|
|
17
|
-
|
|
16
|
+
placeholder?: boolean;
|
|
17
|
+
className?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function StorageItemPreview({
|
|
21
21
|
name,
|
|
22
22
|
property,
|
|
23
23
|
value,
|
|
24
|
-
entity,
|
|
25
24
|
onRemove,
|
|
26
25
|
disabled,
|
|
27
26
|
size,
|
|
28
|
-
|
|
27
|
+
placeholder,
|
|
28
|
+
className
|
|
29
29
|
}: StorageItemPreviewProps) {
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<div className={
|
|
32
|
+
<div className={cls(paperMixin,
|
|
33
33
|
"relative m-4 border-box flex items-center justify-center",
|
|
34
|
-
size === "medium" ? "min-w-[220px] min-h-[220px] max-w-[220px]" : "min-w-[118px] min-h-[118px] max-w-[118px]"
|
|
34
|
+
size === "medium" ? "min-w-[220px] min-h-[220px] max-w-[220px]" : "min-w-[118px] min-h-[118px] max-w-[118px]",
|
|
35
|
+
className)}>
|
|
35
36
|
|
|
36
|
-
{!disabled &&
|
|
37
|
+
{!placeholder && !disabled &&
|
|
37
38
|
<div
|
|
38
39
|
className="absolute rounded-full -top-2 -right-2 z-10 bg-white dark:bg-gray-900">
|
|
39
40
|
|
|
@@ -51,16 +52,24 @@ export function StorageItemPreview({
|
|
|
51
52
|
</div>
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
{value &&
|
|
55
|
+
{!placeholder && value &&
|
|
55
56
|
<ErrorBoundary>
|
|
56
57
|
<PropertyPreview propertyKey={name}
|
|
57
58
|
value={value}
|
|
58
59
|
property={property}
|
|
59
|
-
|
|
60
|
+
interactive={false}
|
|
60
61
|
size={size}/>
|
|
61
62
|
</ErrorBoundary>
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
{placeholder &&
|
|
66
|
+
<div
|
|
67
|
+
onClick={(e) => e.stopPropagation()}
|
|
68
|
+
className="flex flex-col items-center justify-center w-full h-full">
|
|
69
|
+
<DescriptionIcon className="text-gray-700 dark:text-gray-300"/>
|
|
70
|
+
</div>
|
|
71
|
+
}
|
|
72
|
+
|
|
64
73
|
|
|
65
74
|
</div>
|
|
66
75
|
);
|
|
@@ -3,7 +3,7 @@ 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
7
|
import { EntityCollection, StorageSource } from "../../types";
|
|
8
8
|
|
|
9
9
|
export interface StorageUploadItemProps {
|
|
@@ -49,7 +49,7 @@ export function StorageUploadProgress({
|
|
|
49
49
|
metadata
|
|
50
50
|
})
|
|
51
51
|
.then(async ({ path }) => {
|
|
52
|
-
console.debug("Upload successful");
|
|
52
|
+
console.debug("Upload successful", path);
|
|
53
53
|
await onFileUploadComplete(path, entry, metadata);
|
|
54
54
|
if (mounted.current)
|
|
55
55
|
setLoading(false);
|
|
@@ -88,7 +88,7 @@ export function StorageUploadProgress({
|
|
|
88
88
|
}
|
|
89
89
|
return (
|
|
90
90
|
|
|
91
|
-
<div className={
|
|
91
|
+
<div className={cls(paperMixin,
|
|
92
92
|
"relative m-4 border-box flex items-center justify-center",
|
|
93
93
|
`min-w-[${imageSize}px] min-h-[${imageSize}px]`)}>
|
|
94
94
|
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { FieldProps } from "../../types";
|
|
3
3
|
import { FieldHelperText, LabelWithIcon } from "../components";
|
|
4
4
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
5
|
-
import { ExpandablePanel } from "@firecms/ui";
|
|
5
|
+
import { ExpandablePanel, Typography } from "@firecms/ui";
|
|
6
6
|
import { getIconForProperty } from "../../util";
|
|
7
7
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
8
8
|
|
|
@@ -39,10 +39,13 @@ export function ArrayCustomShapedFieldBinding<T extends Array<any>>({
|
|
|
39
39
|
setValue
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
const title =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const title = (<>
|
|
43
|
+
<LabelWithIcon icon={getIconForProperty(property, "small")}
|
|
44
|
+
required={property.validation?.required}
|
|
45
|
+
title={property.name}
|
|
46
|
+
className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
|
|
47
|
+
{Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
|
|
48
|
+
</>);
|
|
46
49
|
|
|
47
50
|
const body = property.resolvedProperties.map((childProperty, index) => {
|
|
48
51
|
const fieldProps = {
|
|
@@ -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,
|
|
9
|
+
import { Button, cls, ExpandablePanel, fieldBackgroundMixin, Typography } from "@firecms/ui";
|
|
10
10
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
11
11
|
|
|
12
12
|
type ArrayOfReferencesFieldProps = FieldProps<EntityReference[]>;
|
|
@@ -88,16 +88,19 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
88
88
|
onClick={onEntryClick}
|
|
89
89
|
hover={!disabled}
|
|
90
90
|
reference={entryValue}
|
|
91
|
+
includeId={ofProperty.includeId}
|
|
92
|
+
includeEntityLink={ofProperty.includeEntityLink}
|
|
91
93
|
/>
|
|
92
94
|
);
|
|
93
95
|
}, [ofProperty.path, ofProperty.previewProperties, value]);
|
|
94
96
|
|
|
95
|
-
const title = (
|
|
97
|
+
const title = (<>
|
|
96
98
|
<LabelWithIcon icon={getIconForProperty(property, "small")}
|
|
97
99
|
required={property.validation?.required}
|
|
98
100
|
title={property.name}
|
|
99
|
-
className={"text-text-secondary dark:text-text-secondary-dark"}/>
|
|
100
|
-
|
|
101
|
+
className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
|
|
102
|
+
{Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
|
|
103
|
+
</>);
|
|
101
104
|
|
|
102
105
|
const body = <>
|
|
103
106
|
{!collection && <ErrorView
|
|
@@ -130,7 +133,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
130
133
|
{!tableMode &&
|
|
131
134
|
<ExpandablePanel
|
|
132
135
|
titleClassName={fieldBackgroundMixin}
|
|
133
|
-
className={
|
|
136
|
+
className={cls("px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2", fieldBackgroundMixin)}
|
|
134
137
|
initiallyExpanded={expanded}
|
|
135
138
|
title={title}>
|
|
136
139
|
{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}
|