@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
|
@@ -7,19 +7,31 @@ export function useSelectionController<M extends Record<string, any> = any>(
|
|
|
7
7
|
|
|
8
8
|
const [selectedEntities, setSelectedEntities] = useState<Entity<M>[]>([]);
|
|
9
9
|
|
|
10
|
-
const toggleEntitySelection = useCallback((entity: Entity<M
|
|
10
|
+
const toggleEntitySelection = useCallback((entity: Entity<M>, newSelectedState?: boolean) => {
|
|
11
11
|
let newValue;
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (newSelectedState === undefined) {
|
|
13
|
+
if (selectedEntities.map(e => e.id).includes(entity.id)) {
|
|
14
|
+
onSelectionChange?.(entity, false);
|
|
15
|
+
newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
|
|
16
|
+
} else {
|
|
17
|
+
onSelectionChange?.(entity, true);
|
|
18
|
+
newValue = [...selectedEntities, entity];
|
|
19
|
+
}
|
|
15
20
|
} else {
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
if (newSelectedState) {
|
|
22
|
+
onSelectionChange?.(entity, true);
|
|
23
|
+
newValue = [...selectedEntities, entity];
|
|
24
|
+
} else {
|
|
25
|
+
onSelectionChange?.(entity, false);
|
|
26
|
+
newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
|
|
27
|
+
}
|
|
18
28
|
}
|
|
19
29
|
setSelectedEntities(newValue);
|
|
20
30
|
}, [selectedEntities]);
|
|
21
31
|
|
|
22
|
-
const isEntitySelected = useCallback((entity: Entity<M>) =>
|
|
32
|
+
const isEntitySelected = useCallback((entity: Entity<M>) => {
|
|
33
|
+
return selectedEntities.map(e => e.id).includes(entity.id);
|
|
34
|
+
}, [selectedEntities]);
|
|
23
35
|
|
|
24
36
|
return {
|
|
25
37
|
selectedEntities,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getValueInPath,
|
|
11
11
|
resolveCollection
|
|
12
12
|
} from "../util";
|
|
13
|
-
import {
|
|
13
|
+
import { cls, defaultBorderMixin, IconButton, KeyboardTabIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
|
|
14
14
|
import { PreviewSize, PropertyPreview, SkeletonPropertyComponent } from "../preview";
|
|
15
15
|
import { useCustomizationController, useNavigationController, useSideEntityController } from "../hooks";
|
|
16
16
|
import { useAnalyticsController } from "../hooks/useAnalyticsController";
|
|
@@ -23,7 +23,8 @@ export type EntityPreviewProps = {
|
|
|
23
23
|
previewProperties?: string[],
|
|
24
24
|
disabled: undefined | boolean,
|
|
25
25
|
entity: Entity<any>,
|
|
26
|
-
|
|
26
|
+
includeId?: boolean,
|
|
27
|
+
includeEntityLink?: boolean,
|
|
27
28
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -39,7 +40,8 @@ export function EntityPreview({
|
|
|
39
40
|
previewProperties,
|
|
40
41
|
onClick,
|
|
41
42
|
size,
|
|
42
|
-
|
|
43
|
+
includeId = true,
|
|
44
|
+
includeEntityLink = true,
|
|
43
45
|
entity
|
|
44
46
|
}: EntityPreviewProps) {
|
|
45
47
|
|
|
@@ -49,7 +51,7 @@ export function EntityPreview({
|
|
|
49
51
|
|
|
50
52
|
const navigationController = useNavigationController();
|
|
51
53
|
|
|
52
|
-
const collection = collectionProp ?? navigationController.getCollection
|
|
54
|
+
const collection = collectionProp ?? navigationController.getCollection(entity.path);
|
|
53
55
|
|
|
54
56
|
if (!collection) {
|
|
55
57
|
throw Error(`Couldn't find the corresponding collection view for the path: ${entity.path}`);
|
|
@@ -75,7 +77,7 @@ export function EntityPreview({
|
|
|
75
77
|
hover={disabled ? undefined : hover}
|
|
76
78
|
size={size}>
|
|
77
79
|
{imageProperty && (
|
|
78
|
-
<div className={
|
|
80
|
+
<div className={cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "tiny" ? "my-0.5" : "m-2 self-start")}>
|
|
79
81
|
<PropertyPreview property={imageProperty}
|
|
80
82
|
propertyKey={imagePropertyKey as string}
|
|
81
83
|
size={"tiny"}
|
|
@@ -85,7 +87,7 @@ export function EntityPreview({
|
|
|
85
87
|
|
|
86
88
|
<div className={"flex flex-col flex-grow w-full m-1"}>
|
|
87
89
|
|
|
88
|
-
{size !== "tiny" && (
|
|
90
|
+
{size !== "tiny" && includeId && (
|
|
89
91
|
entity
|
|
90
92
|
? <div className={`${
|
|
91
93
|
size !== "medium"
|
|
@@ -140,7 +142,7 @@ export function EntityPreview({
|
|
|
140
142
|
|
|
141
143
|
</div>
|
|
142
144
|
|
|
143
|
-
{entity &&
|
|
145
|
+
{entity && includeEntityLink &&
|
|
144
146
|
<Tooltip title={`See details for ${entity.id}`}
|
|
145
147
|
className={size !== "tiny" ? "self-start" : ""}>
|
|
146
148
|
<IconButton
|
|
@@ -168,9 +170,10 @@ export function EntityPreview({
|
|
|
168
170
|
</EntityPreviewContainer>;
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
type EntityPreviewContainerProps = {
|
|
173
|
+
export type EntityPreviewContainerProps = {
|
|
172
174
|
children: React.ReactNode;
|
|
173
175
|
hover?: boolean;
|
|
176
|
+
fullwidth?: boolean;
|
|
174
177
|
size: PreviewSize;
|
|
175
178
|
className?: string;
|
|
176
179
|
style?: React.CSSProperties;
|
|
@@ -184,6 +187,7 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
|
|
|
184
187
|
size,
|
|
185
188
|
style,
|
|
186
189
|
className,
|
|
190
|
+
fullwidth = true,
|
|
187
191
|
...props
|
|
188
192
|
}, ref) => {
|
|
189
193
|
return <div
|
|
@@ -193,8 +197,10 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
|
|
|
193
197
|
// @ts-ignore
|
|
194
198
|
tabindex: 0
|
|
195
199
|
}}
|
|
196
|
-
className={
|
|
200
|
+
className={cls(
|
|
197
201
|
"bg-white dark:bg-gray-900",
|
|
202
|
+
"min-h-[42px]",
|
|
203
|
+
fullwidth ? "w-full" : "",
|
|
198
204
|
"items-center",
|
|
199
205
|
hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
|
|
200
206
|
size === "tiny" ? "p-1" : "p-2",
|
|
@@ -2,7 +2,7 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { PropertyPreview } from "../preview";
|
|
3
3
|
import { Entity, EntityCollection, ResolvedEntityCollection, ResolvedProperties } from "../types";
|
|
4
4
|
import { resolveCollection } from "../util";
|
|
5
|
-
import {
|
|
5
|
+
import { cls, defaultBorderMixin, IconButton, OpenInNewIcon } from "@firecms/ui";
|
|
6
6
|
import { CustomizationController } from "../types/customization_controller";
|
|
7
7
|
import { useCustomizationController } from "../hooks/useCustomizationController";
|
|
8
8
|
|
|
@@ -31,14 +31,14 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
31
31
|
entityId: entity.id,
|
|
32
32
|
values: entity.values,
|
|
33
33
|
fields: customizationController.propertyConfigs
|
|
34
|
-
}), [collection, path, entity]);
|
|
34
|
+
}), [collection, path, entity, customizationController.propertyConfigs]);
|
|
35
35
|
|
|
36
36
|
const properties: ResolvedProperties = resolvedCollection.properties;
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<div className={"w-full " + className}>
|
|
40
40
|
<div className={"w-full mb-4"}>
|
|
41
|
-
<div className={
|
|
41
|
+
<div className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
|
|
42
42
|
<div className="flex items-center w-1/4">
|
|
43
43
|
<span className="pl-2 text-sm text-gray-600">Id</span>
|
|
44
44
|
</div>
|
|
@@ -58,11 +58,11 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
58
58
|
</div>
|
|
59
59
|
{Object.entries(properties)
|
|
60
60
|
.map(([key, property]) => {
|
|
61
|
-
const value =
|
|
61
|
+
const value = entity.values?.[key];
|
|
62
62
|
return (
|
|
63
63
|
<div
|
|
64
64
|
key={`reference_previews_${key}`}
|
|
65
|
-
className={
|
|
65
|
+
className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
|
|
66
66
|
<div className="flex items-center w-1/4">
|
|
67
67
|
<span className="pl-2 text-sm text-gray-600">{property.name}</span>
|
|
68
68
|
</div>
|
|
@@ -23,7 +23,7 @@ search.addIndex("path");
|
|
|
23
23
|
/**
|
|
24
24
|
* Default entry view for the CMS. This component renders navigation cards
|
|
25
25
|
* for each collection defined in the navigation.
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
* @group Components
|
|
28
28
|
*/
|
|
29
29
|
export function DefaultHomePage({
|
|
@@ -102,7 +102,7 @@ export function DefaultHomePage({
|
|
|
102
102
|
return (
|
|
103
103
|
<NavigationGroup
|
|
104
104
|
group={section.title}
|
|
105
|
-
key={`plugin_section_${plugin.
|
|
105
|
+
key={`plugin_section_${plugin.key}`}>
|
|
106
106
|
{section.children}
|
|
107
107
|
</NavigationGroup>
|
|
108
108
|
);
|
|
@@ -191,7 +191,7 @@ export function DefaultHomePage({
|
|
|
191
191
|
/>
|
|
192
192
|
</div>
|
|
193
193
|
))}
|
|
194
|
-
{AdditionalCards &&
|
|
194
|
+
{group?.toLowerCase() !== "admin" && AdditionalCards &&
|
|
195
195
|
AdditionalCards.map((AdditionalCard, i) => (
|
|
196
196
|
<div key={`nav_${group}_add_${i}`}>
|
|
197
197
|
<AdditionalCard {...actionProps} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowForwardIcon, Card,
|
|
1
|
+
import { ArrowForwardIcon, Card, cls, Markdown, Typography, } from "@firecms/ui";
|
|
2
2
|
|
|
3
3
|
export type NavigationCardProps = {
|
|
4
4
|
name: string,
|
|
@@ -17,7 +17,7 @@ export function NavigationCard({
|
|
|
17
17
|
}: NavigationCardProps) {
|
|
18
18
|
|
|
19
19
|
return (<Card
|
|
20
|
-
className={
|
|
20
|
+
className={cls("h-full p-4 cursor-pointer min-h-[230px]")}
|
|
21
21
|
onClick={() => {
|
|
22
22
|
onClick?.();
|
|
23
23
|
}}>
|
|
@@ -52,7 +52,7 @@ export function NavigationCard({
|
|
|
52
52
|
{description && <Typography variant="body2"
|
|
53
53
|
color="secondary"
|
|
54
54
|
component="div">
|
|
55
|
-
<Markdown source={description}/>
|
|
55
|
+
<Markdown source={description} size={"small"}/>
|
|
56
56
|
</Typography>}
|
|
57
57
|
</div>
|
|
58
58
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArrowForwardIcon, cardClickableMixin, cardMixin,
|
|
1
|
+
import { ArrowForwardIcon, cardClickableMixin, cardMixin, cls, focusedMixin, Typography, } from "@firecms/ui";
|
|
2
2
|
|
|
3
|
-
import { Link
|
|
3
|
+
import { Link } from "react-router-dom";
|
|
4
4
|
|
|
5
5
|
export type SmallNavigationCardProps = {
|
|
6
6
|
name: string,
|
|
@@ -17,9 +17,9 @@ export function SmallNavigationCard({
|
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
19
19
|
|
|
20
|
-
<
|
|
20
|
+
<Link
|
|
21
21
|
tabIndex={0}
|
|
22
|
-
className={
|
|
22
|
+
className={cls(cardMixin,
|
|
23
23
|
cardClickableMixin,
|
|
24
24
|
focusedMixin,
|
|
25
25
|
"cursor-pointer flex flex-row items-center px-4 py-2 text-inherit dark:text-inherit visited:text-inherit visited:dark:text-inherit hover:text-inherit hover:dark:text-inherit ")}
|
|
@@ -39,7 +39,7 @@ export function SmallNavigationCard({
|
|
|
39
39
|
<div className={"p-4"}>
|
|
40
40
|
<ArrowForwardIcon color="primary"/>
|
|
41
41
|
</div>
|
|
42
|
-
</
|
|
42
|
+
</Link>
|
|
43
43
|
|
|
44
44
|
</>);
|
|
45
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContentCopyIcon, IconButton, Typography } from "@firecms/ui";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
|
|
4
4
|
export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: string }) {
|
|
@@ -12,9 +12,8 @@ export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: strin
|
|
|
12
12
|
color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
|
|
13
13
|
<Typography variant={"caption"} className={"text-white"}><code>{propertyId}</code></Typography>
|
|
14
14
|
</div>
|
|
15
|
-
{/* Copy to clipboard button*/}
|
|
16
15
|
<IconButton size={"small"}>
|
|
17
|
-
<
|
|
16
|
+
<ContentCopyIcon size={"smallest"}
|
|
18
17
|
className={"text-white"}
|
|
19
18
|
onClick={useCallback(() => {
|
|
20
19
|
navigator.clipboard.writeText(propertyId);
|
|
@@ -291,6 +291,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
291
291
|
displayedColumnIds={displayedColumnIds}
|
|
292
292
|
onEntityClick={onEntityClick}
|
|
293
293
|
tableController={tableController}
|
|
294
|
+
enablePopupIcon={false}
|
|
294
295
|
tableRowActionsBuilder={tableRowActionsBuilder}
|
|
295
296
|
title={<Typography variant={"subtitle2"}>
|
|
296
297
|
{collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`}
|
|
@@ -4,7 +4,7 @@ import { Entity, EntityCollection, EntityReference, FilterValues } from "../type
|
|
|
4
4
|
import { getReferenceFrom } from "../util";
|
|
5
5
|
import { PreviewSize, ReferencePreview } from "../preview";
|
|
6
6
|
import { useNavigationController, useReferenceDialog } from "../hooks";
|
|
7
|
-
import { Button,
|
|
7
|
+
import { Button, cls } from "@firecms/ui";
|
|
8
8
|
|
|
9
9
|
export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
10
10
|
name?: string,
|
|
@@ -27,6 +27,8 @@ export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
|
27
27
|
forceFilter?: FilterValues<string>;
|
|
28
28
|
size: PreviewSize;
|
|
29
29
|
className?: string;
|
|
30
|
+
includeId?: boolean;
|
|
31
|
+
includeEntityLink?: boolean;
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
/**
|
|
@@ -43,25 +45,26 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
43
45
|
previewProperties,
|
|
44
46
|
forceFilter,
|
|
45
47
|
size,
|
|
46
|
-
className
|
|
48
|
+
className,
|
|
49
|
+
includeId,
|
|
50
|
+
includeEntityLink
|
|
47
51
|
}: ReferenceWidgetProps<M>) {
|
|
48
52
|
|
|
49
53
|
const navigationController = useNavigationController();
|
|
50
54
|
|
|
51
55
|
const collection: EntityCollection | undefined = useMemo(() => {
|
|
52
56
|
return navigationController.getCollection(path);
|
|
53
|
-
}, [path, navigationController]);
|
|
54
|
-
|
|
55
|
-
// if (!collection) {
|
|
56
|
-
// throw Error(`Couldn't find the corresponding collection for the path: ${path}`);
|
|
57
|
-
// }
|
|
57
|
+
}, [path, navigationController.getCollection]);
|
|
58
58
|
|
|
59
59
|
const onSingleEntitySelected = useCallback((entity: Entity<M> | null) => {
|
|
60
60
|
if (disabled)
|
|
61
61
|
return;
|
|
62
62
|
if (onReferenceSelected) {
|
|
63
63
|
const reference = entity ? getReferenceFrom(entity) : null;
|
|
64
|
-
onReferenceSelected?.({
|
|
64
|
+
onReferenceSelected?.({
|
|
65
|
+
reference,
|
|
66
|
+
entity
|
|
67
|
+
});
|
|
65
68
|
}
|
|
66
69
|
}, [disabled, onReferenceSelected]);
|
|
67
70
|
|
|
@@ -70,7 +73,10 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
70
73
|
return;
|
|
71
74
|
if (onMultipleReferenceSelected) {
|
|
72
75
|
const references = entities ? entities.map(e => getReferenceFrom(e)) : null;
|
|
73
|
-
onMultipleReferenceSelected({
|
|
76
|
+
onMultipleReferenceSelected({
|
|
77
|
+
references,
|
|
78
|
+
entities
|
|
79
|
+
});
|
|
74
80
|
}
|
|
75
81
|
}, [disabled, onReferenceSelected]);
|
|
76
82
|
|
|
@@ -110,7 +116,9 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
110
116
|
reference={ref}
|
|
111
117
|
disabled={disabled}
|
|
112
118
|
previewProperties={previewProperties}
|
|
113
|
-
size={size}
|
|
119
|
+
size={size}
|
|
120
|
+
includeId={includeId}
|
|
121
|
+
includeEntityLink={includeEntityLink}/>
|
|
114
122
|
})}
|
|
115
123
|
</div>
|
|
116
124
|
} else if (value?.isEntityReference && value?.isEntityReference()) {
|
|
@@ -119,10 +127,12 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
119
127
|
onClick={onEntryClick}
|
|
120
128
|
disabled={disabled}
|
|
121
129
|
previewProperties={previewProperties}
|
|
122
|
-
size={size}
|
|
130
|
+
size={size}
|
|
131
|
+
includeId={includeId}
|
|
132
|
+
includeEntityLink={includeEntityLink}/>
|
|
123
133
|
|
|
124
134
|
}
|
|
125
|
-
return <div className={
|
|
135
|
+
return <div className={cls("text-sm font-medium",
|
|
126
136
|
"min-w-80 flex flex-col gap-4",
|
|
127
137
|
"relative transition-colors duration-200 ease-in rounded font-medium",
|
|
128
138
|
disabled ? "bg-opacity-50" : "hover:bg-opacity-75",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { coolIconKeys, debounce, Icon, IconButton, iconKeys, SearchBar, Tooltip } from "@firecms/ui";
|
|
4
|
-
import {
|
|
4
|
+
import { iconSynonyms, iconsSearch } from "../util";
|
|
5
5
|
|
|
6
6
|
const UPDATE_SEARCH_INDEX_WAIT_MS = 220;
|
|
7
7
|
|
|
8
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9
|
-
Object.keys(
|
|
8
|
+
if (iconSynonyms && process.env.NODE_ENV !== "production") {
|
|
9
|
+
Object.keys(iconSynonyms).forEach((icon: string) => {
|
|
10
10
|
if (!iconKeys.includes(icon)) {
|
|
11
|
-
console.warn(`The icon ${icon} no longer exists. Remove it from \`
|
|
11
|
+
console.warn(`The icon ${icon} no longer exists. Remove it from \`iconSynonyms\``);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -48,7 +48,7 @@ export function SearchIconsView({
|
|
|
48
48
|
return (
|
|
49
49
|
<>
|
|
50
50
|
<SearchBar
|
|
51
|
-
autoFocus
|
|
51
|
+
autoFocus={false}
|
|
52
52
|
innerClassName={"w-full sticky top-0 z-10"}
|
|
53
53
|
onTextSearch={(value?: string) => setQuery(value ?? "")}
|
|
54
54
|
placeholder="Search for more icons…"
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "../../types";
|
|
11
11
|
import { CellRendererParams, VirtualTable, VirtualTableColumn } from "../VirtualTable";
|
|
12
12
|
import { enumToObjectEntries } from "../../util";
|
|
13
|
-
import { OnCellValueChange, OnColumnResizeParams } from "../common
|
|
13
|
+
import { OnCellValueChange, OnColumnResizeParams } from "../common";
|
|
14
14
|
import { FilterFormFieldProps } from "../VirtualTable/VirtualTableHeader";
|
|
15
15
|
import { ReferenceFilterField } from "./filters/ReferenceFilterField";
|
|
16
16
|
import { StringNumberFilterField } from "./filters/StringNumberFilterField";
|
|
@@ -18,6 +18,7 @@ import { BooleanFilterField } from "./filters/BooleanFilterField";
|
|
|
18
18
|
import { DateTimeFilterField } from "./filters/DateTimeFilterField";
|
|
19
19
|
import { useOutsideAlerter } from "@firecms/ui";
|
|
20
20
|
import { SelectableTableContext } from "./SelectableTableContext";
|
|
21
|
+
import { getRowHeight } from "../common/table_height";
|
|
21
22
|
|
|
22
23
|
export type SelectableTableProps<M extends Record<string, any>> = {
|
|
23
24
|
|
|
@@ -115,7 +116,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
115
116
|
onEntityClick,
|
|
116
117
|
onColumnResize,
|
|
117
118
|
hoverRow = true,
|
|
118
|
-
size,
|
|
119
|
+
size = "m",
|
|
119
120
|
inlineEditing = false,
|
|
120
121
|
tableController:
|
|
121
122
|
{
|
|
@@ -127,8 +128,6 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
127
128
|
setFilterValues,
|
|
128
129
|
sortBy,
|
|
129
130
|
setSortBy,
|
|
130
|
-
setSearchString,
|
|
131
|
-
clearFilter,
|
|
132
131
|
itemCount,
|
|
133
132
|
setItemCount,
|
|
134
133
|
pageSize = 50,
|
|
@@ -222,9 +221,8 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
222
221
|
onEndReached={loadNextPage}
|
|
223
222
|
onResetPagination={resetPagination}
|
|
224
223
|
error={dataLoadingError}
|
|
225
|
-
paginationEnabled={paginationEnabled}
|
|
226
224
|
onColumnResize={onColumnResize}
|
|
227
|
-
|
|
225
|
+
rowHeight={getRowHeight(size)}
|
|
228
226
|
loading={dataLoading}
|
|
229
227
|
filter={filterValues}
|
|
230
228
|
onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
|
|
@@ -247,7 +245,8 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
247
245
|
);
|
|
248
246
|
|
|
249
247
|
},
|
|
250
|
-
|
|
248
|
+
() => false,
|
|
249
|
+
// equal
|
|
251
250
|
);
|
|
252
251
|
|
|
253
252
|
function createFilterField({
|
|
@@ -280,6 +279,7 @@ function createFilterField({
|
|
|
280
279
|
isArray={isArray}
|
|
281
280
|
path={baseProperty.path}
|
|
282
281
|
title={resolvedProperty?.name}
|
|
282
|
+
includeId={baseProperty.includeId}
|
|
283
283
|
previewProperties={baseProperty?.previewProperties}
|
|
284
284
|
hidden={hidden}
|
|
285
285
|
setHidden={setHidden}/>;
|
|
@@ -32,7 +32,7 @@ export function BooleanFilterField({
|
|
|
32
32
|
const valueSet = !!value;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<div className="w-[
|
|
35
|
+
<div className="w-[300px]">
|
|
36
36
|
<BooleanSwitchWithLabel
|
|
37
37
|
value={valueSetToTrue}
|
|
38
38
|
allowIndeterminate={true}
|
|
@@ -44,6 +44,5 @@ export function BooleanFilterField({
|
|
|
44
44
|
: `${title} is false`}
|
|
45
45
|
/>
|
|
46
46
|
</div>
|
|
47
|
-
)
|
|
48
|
-
;
|
|
47
|
+
);
|
|
49
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { VirtualTableWhereFilterOp } from "../../VirtualTable";
|
|
3
|
-
import { DateTimeField, Select, SelectItem } from "@firecms/ui";
|
|
3
|
+
import { Checkbox, DateTimeField, Label, Select, SelectItem } from "@firecms/ui";
|
|
4
4
|
import { useCustomizationController } from "../../../hooks";
|
|
5
5
|
|
|
6
6
|
interface DateTimeFilterFieldProps {
|
|
@@ -43,10 +43,10 @@ export function DateTimeFilterField({
|
|
|
43
43
|
|
|
44
44
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
45
45
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
46
|
-
const [internalValue, setInternalValue] = useState<Date | undefined>(fieldValue);
|
|
46
|
+
const [internalValue, setInternalValue] = useState<Date | null | undefined>(fieldValue);
|
|
47
47
|
|
|
48
|
-
function updateFilter(op: VirtualTableWhereFilterOp, val: Date | undefined) {
|
|
49
|
-
let newValue: Date | undefined = val;
|
|
48
|
+
function updateFilter(op: VirtualTableWhereFilterOp, val: Date | undefined | null) {
|
|
49
|
+
let newValue: Date | null | undefined = val;
|
|
50
50
|
const prevOpIsArray = multipleSelectOperations.includes(operation);
|
|
51
51
|
const newOpIsArray = multipleSelectOperations.includes(op);
|
|
52
52
|
if (prevOpIsArray !== newOpIsArray) {
|
|
@@ -73,7 +73,7 @@ export function DateTimeFilterField({
|
|
|
73
73
|
|
|
74
74
|
return (
|
|
75
75
|
|
|
76
|
-
<div className="flex w-[440px]
|
|
76
|
+
<div className="flex w-[440px]">
|
|
77
77
|
<div className="w-[80px]">
|
|
78
78
|
<Select value={operation}
|
|
79
79
|
onValueChange={(value) => {
|
|
@@ -88,19 +88,34 @@ export function DateTimeFilterField({
|
|
|
88
88
|
</Select>
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
|
-
<div className="flex-grow ml-2">
|
|
91
|
+
<div className="flex-grow ml-2 flex flex-col gap-2">
|
|
92
92
|
|
|
93
93
|
<DateTimeField
|
|
94
94
|
mode={mode}
|
|
95
95
|
size={"medium"}
|
|
96
96
|
locale={locale}
|
|
97
|
-
value={internalValue}
|
|
97
|
+
value={internalValue ?? undefined}
|
|
98
98
|
onChange={(dateValue: Date | null) => {
|
|
99
99
|
updateFilter(operation, dateValue === null ? undefined : dateValue);
|
|
100
100
|
}}
|
|
101
101
|
clearable={true}
|
|
102
102
|
/>
|
|
103
103
|
|
|
104
|
+
<Label
|
|
105
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
|
|
106
|
+
htmlFor="null-filter"
|
|
107
|
+
>
|
|
108
|
+
<Checkbox id="null-filter"
|
|
109
|
+
checked={internalValue === null}
|
|
110
|
+
size={"small"}
|
|
111
|
+
onCheckedChange={(checked) => {
|
|
112
|
+
if (internalValue !== null)
|
|
113
|
+
updateFilter(operation, null);
|
|
114
|
+
else updateFilter(operation, undefined);
|
|
115
|
+
}}/>
|
|
116
|
+
Filter for null values
|
|
117
|
+
</Label>
|
|
118
|
+
|
|
104
119
|
</div>
|
|
105
120
|
|
|
106
121
|
</div>
|