@firecms/core 3.0.0-beta.5 → 3.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/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 +3 -2
- package/dist/components/FireCMSAppBar.d.ts +4 -2
- 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 +1 -6
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +4 -6
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/core/Drawer.d.ts +5 -12
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/NavigationRoutes.d.ts +1 -1
- package/dist/core/Scaffold.d.ts +8 -12
- package/dist/core/index.d.ts +3 -4
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/hooks/data/save.d.ts +1 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useValidateAuthenticator.d.ts +2 -6
- package/dist/index.es.js +10087 -9914
- 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/components/ReferencePreview.d.ts +2 -1
- package/dist/types/collections.d.ts +13 -2
- package/dist/types/datasource.d.ts +2 -5
- package/dist/types/entities.d.ts +5 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/plugins.d.ts +3 -1
- package/dist/types/properties.d.ts +10 -2
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- 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/package.json +139 -119
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +2 -2
- 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 +9 -1
- 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 +2 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +47 -25
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityPreview.tsx +9 -7
- package/src/components/EntityView.tsx +5 -5
- package/src/components/FireCMSAppBar.tsx +32 -15
- package/src/components/HomePage/DefaultHomePage.tsx +1 -1
- package/src/components/HomePage/NavigationCard.tsx +2 -2
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/ReferenceWidget.tsx +21 -11
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +5 -3
- 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 +36 -29
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +1 -6
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
- package/src/components/common/index.ts +1 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/common/types.tsx +4 -6
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/index.tsx +1 -0
- package/src/core/Drawer.tsx +16 -68
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +7 -8
- package/src/core/EntitySidePanel.tsx +1 -1
- package/src/core/FireCMS.tsx +37 -42
- package/src/core/NavigationRoutes.tsx +3 -4
- package/src/core/Scaffold.tsx +80 -66
- package/src/core/field_configs.tsx +2 -3
- package/src/core/index.tsx +3 -4
- package/src/form/EntityForm.tsx +29 -21
- package/src/form/PropertyFieldBinding.tsx +0 -2
- package/src/form/components/StorageItemPreview.tsx +2 -2
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -2
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +4 -4
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +4 -4
- package/src/hooks/data/save.ts +3 -1
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/hooks/useBuildModeController.tsx +11 -5
- package/src/hooks/useBuildNavigationController.tsx +77 -21
- package/src/hooks/useProjectLog.tsx +3 -3
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +17 -37
- package/src/internal/useBuildDataSource.ts +42 -47
- package/src/internal/useBuildSideEntityController.tsx +86 -22
- package/src/preview/PropertyPreview.tsx +4 -14
- package/src/preview/components/BooleanPreview.tsx +2 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +21 -22
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/types/collections.ts +19 -3
- package/src/types/datasource.ts +7 -4
- package/src/types/entities.ts +9 -1
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/index.ts +0 -1
- package/src/types/navigation.ts +2 -3
- package/src/types/plugins.tsx +4 -3
- package/src/types/properties.ts +15 -4
- package/src/types/storage.ts +1 -1
- package/src/util/entities.ts +1 -1
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +8 -21
- package/src/util/resolutions.ts +32 -31
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/dist/internal/useLocaleConfig.d.ts +0 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/src/core/SideEntityView.tsx +0 -38
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
|
@@ -69,7 +69,7 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
69
69
|
/**
|
|
70
70
|
* Size of the table
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
rowHeight?: number,
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* In case this table should have some filters set by default
|
|
@@ -232,11 +232,6 @@ export type OnVirtualTableColumnResizeParams = {
|
|
|
232
232
|
column: VirtualTableColumn
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
/**
|
|
236
|
-
* @see Table
|
|
237
|
-
* @group Components
|
|
238
|
-
*/
|
|
239
|
-
export type VirtualTableSize = "xs" | "s" | "m" | "l" | "xl";
|
|
240
235
|
|
|
241
236
|
/**
|
|
242
237
|
* @see Table
|
|
@@ -2,9 +2,8 @@ import React, { useCallback } from "react";
|
|
|
2
2
|
|
|
3
3
|
import equal from "react-fast-compare"
|
|
4
4
|
|
|
5
|
-
import { getRowHeight } from "./common";
|
|
6
5
|
import { VirtualTableRowProps } from "./types";
|
|
7
|
-
import {
|
|
6
|
+
import { cls } from "@firecms/ui";
|
|
8
7
|
|
|
9
8
|
export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
10
9
|
function VirtualTableRow<T>({
|
|
@@ -12,7 +11,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
12
11
|
rowIndex,
|
|
13
12
|
children,
|
|
14
13
|
onRowClick,
|
|
15
|
-
|
|
14
|
+
rowHeight,
|
|
16
15
|
style,
|
|
17
16
|
hoverRow,
|
|
18
17
|
rowClassName
|
|
@@ -29,7 +28,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
29
28
|
|
|
30
29
|
return (
|
|
31
30
|
<div
|
|
32
|
-
className={
|
|
31
|
+
className={cls(
|
|
33
32
|
"flex min-w-full text-sm border-b border-gray-200 dark:border-gray-800 border-opacity-40 dark:border-opacity-40",
|
|
34
33
|
rowClassName ? rowClassName(rowData) : "",
|
|
35
34
|
{
|
|
@@ -40,7 +39,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
40
39
|
onClick={onClick}
|
|
41
40
|
style={{
|
|
42
41
|
...(style),
|
|
43
|
-
height:
|
|
42
|
+
height: rowHeight,
|
|
44
43
|
width: "fit-content"
|
|
45
44
|
}}
|
|
46
45
|
>
|
|
@@ -5,14 +5,13 @@ import {
|
|
|
5
5
|
OnVirtualTableColumnResizeParams,
|
|
6
6
|
VirtualTableColumn,
|
|
7
7
|
VirtualTableFilterValues,
|
|
8
|
-
VirtualTableSize,
|
|
9
8
|
VirtualTableWhereFilterOp
|
|
10
9
|
} from "./VirtualTableProps";
|
|
11
10
|
import { FilterFormFieldProps } from "./VirtualTableHeader";
|
|
12
11
|
|
|
13
12
|
export type VirtualTableRowProps<T> = {
|
|
14
13
|
style: any,
|
|
15
|
-
|
|
14
|
+
rowHeight: number,
|
|
16
15
|
rowData: T;
|
|
17
16
|
rowIndex: number;
|
|
18
17
|
onRowClick?: (props: OnRowClickParams<any>) => void;
|
|
@@ -24,7 +23,7 @@ export type VirtualTableRowProps<T> = {
|
|
|
24
23
|
|
|
25
24
|
export type VirtualTableContextProps<T extends any> = {
|
|
26
25
|
data?: T[];
|
|
27
|
-
|
|
26
|
+
rowHeight?: number,
|
|
28
27
|
columns: VirtualTableColumn[];
|
|
29
28
|
cellRenderer: React.ComponentType<CellRendererParams<T>>;
|
|
30
29
|
currentSort: "asc" | "desc" | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityAction } from "../../../types";
|
|
2
1
|
import { ArchiveIcon, DeleteIcon, FileCopyIcon, KeyboardTabIcon, OpenInNewIcon } from "@firecms/ui";
|
|
3
|
-
import {
|
|
2
|
+
import { EntityAction } from "../../types";
|
|
3
|
+
import { DeleteEntityDialog } from "../DeleteEntityDialog";
|
|
4
4
|
|
|
5
5
|
export const editEntityAction: EntityAction = {
|
|
6
6
|
icon: <KeyboardTabIcon/>,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @group Components
|
|
3
|
+
*/
|
|
4
|
+
export type TableSize = "xs" | "s" | "m" | "l" | "xl";
|
|
2
5
|
|
|
3
|
-
export function getRowHeight(size:
|
|
6
|
+
export function getRowHeight(size: TableSize): number {
|
|
4
7
|
switch (size) {
|
|
5
8
|
case "xl":
|
|
6
9
|
return 400;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionSize,
|
|
1
|
+
import { CollectionSize, ResolvedProperty, SelectedCellProps } from "../../types";
|
|
2
2
|
|
|
3
3
|
export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
4
4
|
|
|
@@ -31,14 +31,12 @@ export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
|
31
31
|
* Props passed in a callback when the content of a cell in a table has been edited
|
|
32
32
|
* @group Collection components
|
|
33
33
|
*/
|
|
34
|
-
export interface OnCellValueChangeParams<T = any,
|
|
34
|
+
export interface OnCellValueChangeParams<T = any, D = any> {
|
|
35
35
|
value: T,
|
|
36
36
|
propertyKey: string,
|
|
37
|
-
|
|
37
|
+
data?: D,
|
|
38
38
|
onValueUpdated: () => void
|
|
39
|
-
setError: (e: Error) => void
|
|
40
|
-
fullPath: string
|
|
41
|
-
context: FireCMSContext
|
|
39
|
+
setError: (e: Error | undefined) => void
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/**
|
|
@@ -7,8 +7,16 @@ const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
|
7
7
|
|
|
8
8
|
export function useColumnIds<M extends Record<string, any>>(collection: ResolvedEntityCollection<M>, includeSubcollections: boolean): PropertyColumnConfig[] {
|
|
9
9
|
return useMemo(() => {
|
|
10
|
-
if (collection.propertiesOrder)
|
|
11
|
-
|
|
10
|
+
if (collection.propertiesOrder) {
|
|
11
|
+
const propertyColumnConfigs = hideAndExpandKeys(collection, collection.propertiesOrder);
|
|
12
|
+
if (collection.collectionGroup) {
|
|
13
|
+
propertyColumnConfigs.push({
|
|
14
|
+
key: COLLECTION_GROUP_PARENT_ID,
|
|
15
|
+
disabled: true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return propertyColumnConfigs;
|
|
19
|
+
}
|
|
12
20
|
return getDefaultColumnKeys(collection, includeSubcollections);
|
|
13
21
|
}, [collection, includeSubcollections]);
|
|
14
22
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
User
|
|
13
13
|
} from "../../types";
|
|
14
14
|
import { useDebouncedData } from "./useDebouncedData";
|
|
15
|
+
import equal from "react-fast-compare"
|
|
15
16
|
|
|
16
17
|
const DEFAULT_PAGE_SIZE = 50;
|
|
17
18
|
|
|
@@ -31,6 +32,10 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
|
|
|
31
32
|
entitiesDisplayedFirst?: Entity<M>[];
|
|
32
33
|
|
|
33
34
|
lastDeleteTimestamp?: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Force filter to be applied to the table.
|
|
38
|
+
*/
|
|
34
39
|
forceFilter?: FilterValues<string>;
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -83,6 +88,12 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
|
|
|
83
88
|
return initialSort;
|
|
84
89
|
}, [initialSort, forceFilter]);
|
|
85
90
|
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!equal(forceFilter, filterValues)) {
|
|
93
|
+
setFilterValues(forceFilter)
|
|
94
|
+
}
|
|
95
|
+
}, [forceFilter]);
|
|
96
|
+
|
|
86
97
|
const [filterValues, setFilterValues] = React.useState<FilterValues<Extract<keyof M, string>> | undefined>(forceFilter ?? initialFilter ?? undefined);
|
|
87
98
|
const [sortBy, setSortBy] = React.useState<[Extract<keyof M, string>, "asc" | "desc"] | undefined>(initialSortInternal);
|
|
88
99
|
|
package/src/components/index.tsx
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./common";
|
|
|
13
13
|
|
|
14
14
|
export * from "./HomePage";
|
|
15
15
|
export * from "./SelectableTable/SelectableTable";
|
|
16
|
+
export * from "./SelectableTable/SelectableTableContext";
|
|
16
17
|
export * from "./EntityCollectionView/EntityCollectionView";
|
|
17
18
|
export * from "./EntityCollectionView/EntityCollectionViewActions";
|
|
18
19
|
export * from "./EntityCollectionView/useSelectionController";
|
package/src/core/Drawer.tsx
CHANGED
|
@@ -2,31 +2,37 @@ import React, { useCallback } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { useLargeLayout, useNavigationController } from "../hooks";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useNavigate } from "react-router-dom";
|
|
6
6
|
import { CMSAnalyticsEvent, TopNavigationEntry, TopNavigationResult } from "../types";
|
|
7
7
|
import { IconForView } from "../util";
|
|
8
|
-
import {
|
|
8
|
+
import { cls, IconButton, Menu, MenuItem, MoreVertIcon, Tooltip, Typography } from "@firecms/ui";
|
|
9
9
|
import { useAnalyticsController } from "../hooks/useAnalyticsController";
|
|
10
|
+
import { useDrawer } from "./Scaffold";
|
|
11
|
+
import { DrawerNavigationItem } from "./DrawerNavigationItem";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Props used in case you need to override the default drawer
|
|
13
15
|
* @group Core
|
|
14
16
|
*/
|
|
15
|
-
export type DrawerProps
|
|
17
|
+
export type DrawerProps = {
|
|
16
18
|
hovered: boolean,
|
|
17
19
|
drawerOpen: boolean,
|
|
18
|
-
|
|
20
|
+
openDrawer: () => void,
|
|
21
|
+
closeDrawer: () => void,
|
|
22
|
+
autoOpenDrawer?: boolean
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Default drawer used in the CMS
|
|
23
27
|
* @group Core
|
|
24
28
|
*/
|
|
25
|
-
export function Drawer({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
export function Drawer() {
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
hovered,
|
|
33
|
+
drawerOpen,
|
|
34
|
+
closeDrawer,
|
|
35
|
+
} = useDrawer();
|
|
30
36
|
|
|
31
37
|
const analyticsController = useAnalyticsController();
|
|
32
38
|
const navigation = useNavigationController();
|
|
@@ -108,7 +114,7 @@ export function Drawer({
|
|
|
108
114
|
<MoreVertIcon/>
|
|
109
115
|
</Tooltip>
|
|
110
116
|
{drawerOpen && <div
|
|
111
|
-
className={
|
|
117
|
+
className={cls(
|
|
112
118
|
drawerOpen ? "opacity-100" : "opacity-0 hidden",
|
|
113
119
|
"mx-4 font-inherit text-inherit"
|
|
114
120
|
)}>
|
|
@@ -131,61 +137,3 @@ export function Drawer({
|
|
|
131
137
|
</>
|
|
132
138
|
);
|
|
133
139
|
}
|
|
134
|
-
|
|
135
|
-
export function DrawerNavigationItem({
|
|
136
|
-
name,
|
|
137
|
-
icon,
|
|
138
|
-
drawerOpen,
|
|
139
|
-
tooltipsOpen,
|
|
140
|
-
url,
|
|
141
|
-
onClick
|
|
142
|
-
}: {
|
|
143
|
-
icon: React.ReactElement,
|
|
144
|
-
name: string,
|
|
145
|
-
tooltipsOpen: boolean,
|
|
146
|
-
drawerOpen: boolean,
|
|
147
|
-
url: string,
|
|
148
|
-
onClick?: () => void,
|
|
149
|
-
}) {
|
|
150
|
-
|
|
151
|
-
const iconWrap = <div
|
|
152
|
-
className={"text-gray-600 dark:text-gray-500"}>
|
|
153
|
-
{icon}
|
|
154
|
-
</div>;
|
|
155
|
-
|
|
156
|
-
const listItem = <NavLink
|
|
157
|
-
onClick={onClick}
|
|
158
|
-
style={{
|
|
159
|
-
width: !drawerOpen ? "72px" : "280px",
|
|
160
|
-
transition: drawerOpen ? "width 150ms ease-in" : undefined
|
|
161
|
-
}}
|
|
162
|
-
className={({ isActive }: any) => cn("rounded-r-xl truncate",
|
|
163
|
-
"hover:bg-slate-300 hover:bg-opacity-75 dark:hover:bg-gray-700 dark:hover:bg-opacity-75 text-gray-800 dark:text-gray-200 hover:text-gray-900 hover:dark:text-white",
|
|
164
|
-
"flex flex-row items-center mr-8",
|
|
165
|
-
// "transition-all ease-in-out delay-100 duration-300",
|
|
166
|
-
// drawerOpen ? "w-full" : "w-18",
|
|
167
|
-
drawerOpen ? "pl-8 h-12" : "pl-6 h-11",
|
|
168
|
-
"font-medium text-sm",
|
|
169
|
-
isActive ? "bg-slate-200 bg-opacity-75 dark:bg-gray-800" : ""
|
|
170
|
-
)}
|
|
171
|
-
to={url}
|
|
172
|
-
>
|
|
173
|
-
|
|
174
|
-
{iconWrap}
|
|
175
|
-
|
|
176
|
-
<div
|
|
177
|
-
className={cn(
|
|
178
|
-
drawerOpen ? "opacity-100" : "opacity-0 hidden",
|
|
179
|
-
"ml-4 font-inherit text-inherit"
|
|
180
|
-
)}>
|
|
181
|
-
{name.toUpperCase()}
|
|
182
|
-
</div>
|
|
183
|
-
</NavLink>;
|
|
184
|
-
|
|
185
|
-
return <Tooltip
|
|
186
|
-
open={drawerOpen ? false : tooltipsOpen}
|
|
187
|
-
side="right"
|
|
188
|
-
title={name}>
|
|
189
|
-
{listItem}
|
|
190
|
-
</Tooltip>;
|
|
191
|
-
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { NavLink } from "react-router-dom";
|
|
4
|
+
import { cls, Tooltip } from "@firecms/ui";
|
|
5
|
+
|
|
6
|
+
export function DrawerNavigationItem({
|
|
7
|
+
name,
|
|
8
|
+
icon,
|
|
9
|
+
drawerOpen,
|
|
10
|
+
tooltipsOpen,
|
|
11
|
+
url,
|
|
12
|
+
onClick
|
|
13
|
+
}: {
|
|
14
|
+
icon: React.ReactElement,
|
|
15
|
+
name: string,
|
|
16
|
+
tooltipsOpen: boolean,
|
|
17
|
+
drawerOpen: boolean,
|
|
18
|
+
url: string,
|
|
19
|
+
onClick?: () => void,
|
|
20
|
+
}) {
|
|
21
|
+
|
|
22
|
+
const iconWrap = <div
|
|
23
|
+
className={"text-gray-600 dark:text-gray-500"}>
|
|
24
|
+
{icon}
|
|
25
|
+
</div>;
|
|
26
|
+
|
|
27
|
+
const listItem = <NavLink
|
|
28
|
+
onClick={onClick}
|
|
29
|
+
style={{
|
|
30
|
+
width: !drawerOpen ? "72px" : "280px",
|
|
31
|
+
transition: drawerOpen ? "width 150ms ease-in" : undefined
|
|
32
|
+
}}
|
|
33
|
+
className={({ isActive }: any) => cls("rounded-r-lg truncate",
|
|
34
|
+
"hover:bg-slate-300 hover:bg-opacity-75 dark:hover:bg-gray-700 dark:hover:bg-opacity-75 text-gray-800 dark:text-gray-200 hover:text-gray-900 hover:dark:text-white",
|
|
35
|
+
"flex flex-row items-center mr-8",
|
|
36
|
+
// "transition-all ease-in-out delay-100 duration-300",
|
|
37
|
+
// drawerOpen ? "w-full" : "w-18",
|
|
38
|
+
drawerOpen ? "pl-8 h-12" : "pl-6 h-11",
|
|
39
|
+
"font-medium text-sm",
|
|
40
|
+
isActive ? "bg-slate-200 bg-opacity-60 dark:bg-gray-800 dark:bg-opacity-30" : ""
|
|
41
|
+
)}
|
|
42
|
+
to={url}
|
|
43
|
+
>
|
|
44
|
+
|
|
45
|
+
{iconWrap}
|
|
46
|
+
|
|
47
|
+
<div
|
|
48
|
+
className={cls(
|
|
49
|
+
drawerOpen ? "opacity-100" : "opacity-0 hidden",
|
|
50
|
+
"ml-4 font-inherit text-inherit"
|
|
51
|
+
)}>
|
|
52
|
+
{name.toUpperCase()}
|
|
53
|
+
</div>
|
|
54
|
+
</NavLink>;
|
|
55
|
+
|
|
56
|
+
return <Tooltip
|
|
57
|
+
open={drawerOpen ? false : tooltipsOpen}
|
|
58
|
+
side="right"
|
|
59
|
+
title={name}>
|
|
60
|
+
{listItem}
|
|
61
|
+
</Tooltip>;
|
|
62
|
+
}
|
|
@@ -29,9 +29,8 @@ import {
|
|
|
29
29
|
useSnackbarController
|
|
30
30
|
} from "../hooks";
|
|
31
31
|
import { EntityForm } from "../form";
|
|
32
|
-
import { CircularProgress, CloseIcon,
|
|
32
|
+
import { CircularProgress, CloseIcon, cls, defaultBorderMixin, IconButton, Tab, Tabs, Typography } from "@firecms/ui";
|
|
33
33
|
import { EntityFormSaveParams } from "../form/EntityForm";
|
|
34
|
-
import { FORM_CONTAINER_WIDTH } from "../internal/common";
|
|
35
34
|
import { useSideDialogContext } from "./index";
|
|
36
35
|
|
|
37
36
|
const MAIN_TAB_VALUE = "main_##Q$SC^#S6";
|
|
@@ -91,8 +90,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
91
90
|
|
|
92
91
|
// const largeLayout = useLargeLayout();
|
|
93
92
|
// const largeLayoutTabSelected = useRef(!largeLayout);
|
|
94
|
-
|
|
95
|
-
const resolvedFormWidth: string = typeof formWidth === "number" ? `${formWidth}px` : formWidth ?? FORM_CONTAINER_WIDTH;
|
|
93
|
+
// const resolvedFormWidth: string = typeof formWidth === "number" ? `${formWidth}px` : formWidth ?? FORM_CONTAINER_WIDTH;
|
|
96
94
|
|
|
97
95
|
const dataSource = useDataSource(collection);
|
|
98
96
|
const sideDialogContext = useSideDialogContext();
|
|
@@ -195,6 +193,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
195
193
|
onUpdate({ entity: updatedEntity });
|
|
196
194
|
|
|
197
195
|
if (closeAfterSave) {
|
|
196
|
+
console.log("Closing side dialog")
|
|
198
197
|
sideDialogContext.setBlocked(false);
|
|
199
198
|
sideDialogContext.close(true);
|
|
200
199
|
onClose?.();
|
|
@@ -238,7 +237,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
238
237
|
closeAfterSave: boolean,
|
|
239
238
|
}) => {
|
|
240
239
|
setSaving(true);
|
|
241
|
-
saveEntityWithCallbacks({
|
|
240
|
+
return saveEntityWithCallbacks({
|
|
242
241
|
path,
|
|
243
242
|
entityId,
|
|
244
243
|
values,
|
|
@@ -269,7 +268,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
269
268
|
if (autoSave) {
|
|
270
269
|
setValuesToBeSaved(values);
|
|
271
270
|
} else {
|
|
272
|
-
saveEntity({
|
|
271
|
+
return saveEntity({
|
|
273
272
|
collection,
|
|
274
273
|
path,
|
|
275
274
|
entityId,
|
|
@@ -298,7 +297,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
298
297
|
return null;
|
|
299
298
|
}
|
|
300
299
|
return <div
|
|
301
|
-
className={
|
|
300
|
+
className={cls(defaultBorderMixin,
|
|
302
301
|
"relative flex-grow w-full h-full overflow-auto ")}
|
|
303
302
|
key={`custom_view_${customView.key}`}
|
|
304
303
|
role="tabpanel">
|
|
@@ -482,7 +481,7 @@ export function EntityEditView<M extends Record<string, any>, UserType extends U
|
|
|
482
481
|
<>
|
|
483
482
|
|
|
484
483
|
<div
|
|
485
|
-
className={
|
|
484
|
+
className={cls(defaultBorderMixin, "no-scrollbar border-b pl-2 pr-2 pt-1 flex items-end overflow-scroll bg-gray-50 dark:bg-gray-950")}>
|
|
486
485
|
|
|
487
486
|
<div
|
|
488
487
|
className="pb-1 self-center">
|
|
@@ -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
|
}
|
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";
|
|
@@ -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,7 +76,7 @@ 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
|
|
@@ -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,7 +13,7 @@ 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
|
customRoutes?: React.ReactNode[]
|
|
19
19
|
|
|
@@ -28,10 +28,9 @@ 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
|
-
|
|
33
|
+
homePage = <DefaultHomePage/>,
|
|
35
34
|
customRoutes
|
|
36
35
|
}: NavigationRoutesProps) {
|
|
37
36
|
|
|
@@ -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={"*"}
|