@firecms/core 3.0.0-beta.10 → 3.0.0-beta.12
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/ArrayContainer.d.ts +22 -6
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +2 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +17 -3
- package/dist/components/EntityCollectionTable/index.d.ts +1 -1
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +6 -3
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +4 -0
- package/dist/components/PropertyIdCopyTooltip.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +12 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +1 -1
- package/dist/components/UnsavedChangesDialog.d.ts +8 -0
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +13 -0
- package/dist/components/common/default_entity_actions.d.ts +0 -2
- package/dist/components/common/index.d.ts +1 -1
- package/dist/components/common/useColumnsIds.d.ts +1 -0
- package/dist/components/common/{useDataSourceEntityCollectionTableController.d.ts → useDataSourceTableController.d.ts} +10 -2
- package/dist/components/common/useDebouncedCallback.d.ts +1 -0
- package/dist/components/common/useScrollRestoration.d.ts +14 -0
- package/dist/contexts/BreacrumbsContext.d.ts +8 -0
- package/dist/core/EntityEditView.d.ts +30 -22
- package/dist/core/EntityEditViewFormActions.d.ts +2 -0
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/core/FireCMSRouter.d.ts +4 -0
- package/dist/core/NavigationRoutes.d.ts +0 -1
- package/dist/core/SideDialogs.d.ts +4 -2
- package/dist/core/index.d.ts +2 -1
- package/dist/form/EntityForm.d.ts +45 -0
- package/dist/form/EntityFormActions.d.ts +17 -0
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/FormEntry.d.ts +6 -0
- package/dist/form/components/FormLayout.d.ts +5 -0
- package/dist/form/components/index.d.ts +2 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
- package/dist/form/index.d.ts +16 -16
- package/dist/hooks/data/delete.d.ts +4 -4
- package/dist/hooks/data/save.d.ts +3 -3
- package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +4 -3
- package/dist/hooks/useAuthController.d.ts +1 -1
- package/dist/hooks/useBreadcrumbsController.d.ts +26 -0
- package/dist/hooks/useBuildNavigationController.d.ts +7 -4
- package/dist/hooks/useFireCMSContext.d.ts +1 -1
- package/dist/hooks/useModeController.d.ts +1 -2
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
- package/dist/index.es.js +17032 -12909
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +17019 -12898
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildSideEntityController.d.ts +2 -2
- package/dist/internal/useUnsavedChangesDialog.d.ts +7 -9
- package/dist/preview/PropertyPreviewProps.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/util.d.ts +3 -3
- package/dist/routes/CustomCMSRoute.d.ts +4 -0
- package/dist/routes/FireCMSRoute.d.ts +1 -0
- package/dist/routes/HomePageRoute.d.ts +3 -0
- package/dist/types/auth.d.ts +7 -9
- package/dist/types/collections.d.ts +44 -23
- package/dist/types/datasource.d.ts +2 -6
- package/dist/types/dialogs_controller.d.ts +7 -3
- package/dist/types/entities.d.ts +1 -1
- package/dist/types/entity_actions.d.ts +14 -4
- package/dist/types/entity_callbacks.d.ts +16 -16
- package/dist/types/export_import.d.ts +4 -4
- package/dist/types/fields.d.ts +27 -4
- package/dist/types/firecms.d.ts +2 -2
- package/dist/types/firecms_context.d.ts +1 -1
- package/dist/types/navigation.d.ts +29 -12
- package/dist/types/permissions.d.ts +4 -4
- package/dist/types/plugins.d.ts +9 -8
- package/dist/types/properties.d.ts +18 -3
- package/dist/types/property_config.d.ts +0 -2
- package/dist/types/side_entity_controller.d.ts +6 -1
- package/dist/types/user.d.ts +1 -0
- package/dist/util/builders.d.ts +3 -3
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/entity_actions.d.ts +2 -0
- package/dist/util/entity_cache.d.ts +23 -0
- package/dist/util/icon_synonyms.d.ts +0 -1
- package/dist/util/icons.d.ts +3 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/navigation_from_path.d.ts +6 -1
- package/dist/util/navigation_utils.d.ts +12 -1
- package/dist/util/objects.d.ts +1 -0
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/property_utils.d.ts +2 -2
- package/dist/util/resolutions.d.ts +12 -7
- package/package.json +129 -125
- package/src/app/Scaffold.tsx +4 -4
- package/src/components/ArrayContainer.tsx +115 -34
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ConfirmationDialog.tsx +2 -2
- package/src/components/DeleteEntityDialog.tsx +10 -19
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +44 -20
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +23 -17
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +20 -3
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +6 -4
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +8 -9
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -11
- package/src/components/EntityCollectionTable/index.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +3 -3
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -5
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +77 -73
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +90 -49
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +4 -2
- package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
- package/src/components/EntityPreview.tsx +39 -30
- package/src/components/EntityView.tsx +5 -5
- package/src/components/ErrorView.tsx +3 -3
- package/src/components/HomePage/DefaultHomePage.tsx +1 -0
- package/src/components/HomePage/FavouritesView.tsx +6 -11
- package/src/components/HomePage/NavigationCard.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +4 -9
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/NotFoundPage.tsx +2 -2
- package/src/components/PropertyConfigBadge.tsx +1 -1
- package/src/components/PropertyIdCopyTooltip.tsx +3 -4
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +13 -8
- package/src/components/SelectableTable/SelectableTable.tsx +20 -5
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +4 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +10 -8
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +7 -5
- package/src/components/UnsavedChangesDialog.tsx +42 -0
- package/src/components/VirtualTable/VirtualTable.tsx +19 -2
- package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableProps.tsx +15 -0
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +2 -0
- package/src/components/common/default_entity_actions.tsx +26 -37
- package/src/components/common/index.ts +1 -1
- package/src/components/common/useColumnsIds.tsx +1 -1
- package/src/components/common/useDataSourceTableController.tsx +420 -0
- package/src/components/common/useDebouncedCallback.tsx +20 -0
- package/src/components/common/useScrollRestoration.tsx +68 -0
- package/src/contexts/BreacrumbsContext.tsx +38 -0
- package/src/contexts/DialogsProvider.tsx +3 -2
- package/src/contexts/ModeController.tsx +1 -3
- package/src/contexts/SnackbarProvider.tsx +2 -0
- package/src/core/DefaultAppBar.tsx +56 -25
- package/src/core/DefaultDrawer.tsx +11 -9
- package/src/core/DrawerNavigationItem.tsx +4 -4
- package/src/core/EntityEditView.tsx +282 -1006
- package/src/core/EntityEditViewFormActions.tsx +199 -0
- package/src/core/EntitySidePanel.tsx +85 -15
- package/src/core/FireCMS.tsx +12 -9
- package/src/core/FireCMSRouter.tsx +17 -0
- package/src/core/NavigationRoutes.tsx +23 -32
- package/src/core/SideDialogs.tsx +21 -12
- package/src/core/field_configs.tsx +4 -4
- package/src/core/index.tsx +4 -2
- package/src/form/EntityForm.tsx +774 -0
- package/src/form/EntityFormActions.tsx +169 -0
- package/src/form/PropertyFieldBinding.tsx +39 -30
- package/src/form/components/CustomIdField.tsx +2 -0
- package/src/form/components/FormEntry.tsx +22 -0
- package/src/form/components/FormLayout.tsx +16 -0
- package/src/form/components/LabelWithIcon.tsx +6 -3
- package/src/form/components/StorageItemPreview.tsx +3 -3
- package/src/form/components/StorageUploadProgress.tsx +1 -1
- package/src/form/components/index.tsx +2 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +7 -6
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +20 -12
- package/src/form/field_bindings/BlockFieldBinding.tsx +45 -25
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +10 -7
- package/src/form/field_bindings/MapFieldBinding.tsx +69 -52
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +9 -6
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -5
- package/src/form/field_bindings/RepeatFieldBinding.tsx +30 -22
- package/src/form/field_bindings/SelectFieldBinding.tsx +6 -5
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +7 -5
- package/src/form/field_bindings/SwitchFieldBinding.tsx +26 -25
- package/src/form/field_bindings/TextFieldBinding.tsx +4 -3
- package/src/form/index.tsx +16 -32
- package/src/form/validation.ts +12 -6
- package/src/hooks/data/delete.ts +4 -4
- package/src/hooks/data/save.ts +8 -9
- package/src/hooks/data/useCollectionFetch.tsx +3 -3
- package/src/hooks/data/useEntityFetch.tsx +10 -6
- package/src/hooks/useAuthController.tsx +1 -1
- package/src/hooks/useBreadcrumbsController.tsx +31 -0
- package/src/hooks/useBuildModeController.tsx +15 -28
- package/src/hooks/useBuildNavigationController.tsx +74 -29
- package/src/hooks/useFireCMSContext.tsx +5 -5
- package/src/hooks/useLargeLayout.tsx +0 -35
- package/src/hooks/useModeController.tsx +1 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +9 -11
- package/src/hooks/useValidateAuthenticator.tsx +3 -3
- package/src/internal/useBuildDataSource.ts +1 -1
- package/src/internal/useBuildSideDialogsController.tsx +3 -2
- package/src/internal/useBuildSideEntityController.tsx +124 -83
- package/src/internal/useUnsavedChangesDialog.tsx +127 -93
- package/src/preview/PropertyPreview.tsx +11 -11
- package/src/preview/PropertyPreviewProps.tsx +1 -1
- package/src/preview/components/BooleanPreview.tsx +1 -1
- package/src/preview/components/EmptyValue.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +5 -6
- package/src/preview/components/UrlComponentPreview.tsx +20 -21
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -2
- package/src/preview/property_previews/MapPropertyPreview.tsx +7 -6
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +12 -12
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/preview/util.ts +10 -10
- package/src/routes/CustomCMSRoute.tsx +21 -0
- package/src/routes/FireCMSRoute.tsx +235 -0
- package/src/routes/HomePageRoute.tsx +17 -0
- package/src/types/auth.tsx +8 -12
- package/src/types/collections.ts +52 -26
- package/src/types/datasource.ts +2 -6
- package/src/types/dialogs_controller.tsx +7 -3
- package/src/types/entities.ts +1 -1
- package/src/types/entity_actions.tsx +16 -4
- package/src/types/entity_callbacks.ts +18 -18
- package/src/types/export_import.ts +4 -4
- package/src/types/fields.tsx +33 -4
- package/src/types/firecms.tsx +2 -2
- package/src/types/firecms_context.tsx +1 -1
- package/src/types/navigation.ts +36 -16
- package/src/types/permissions.ts +5 -5
- package/src/types/plugins.tsx +9 -8
- package/src/types/properties.ts +21 -3
- package/src/types/property_config.tsx +0 -2
- package/src/types/side_dialogs_controller.tsx +2 -0
- package/src/types/side_entity_controller.tsx +6 -1
- package/src/types/user.ts +2 -0
- package/src/util/builders.ts +10 -8
- package/src/util/entities.ts +3 -1
- package/src/util/entity_actions.ts +28 -0
- package/src/util/entity_cache.ts +204 -0
- package/src/util/icon_list.ts +1 -0
- package/src/util/icon_synonyms.ts +0 -1
- package/src/util/icons.tsx +12 -8
- package/src/util/index.ts +1 -0
- package/src/util/join_collections.ts +3 -0
- package/src/util/navigation_from_path.ts +13 -6
- package/src/util/navigation_utils.ts +53 -1
- package/src/util/objects.ts +24 -1
- package/src/util/parent_references_from_path.ts +3 -3
- package/src/util/permissions.ts +8 -8
- package/src/util/property_utils.tsx +10 -3
- package/src/util/references.ts +8 -2
- package/src/util/resolutions.ts +34 -13
- package/src/util/useStorageUploadController.tsx +40 -22
- package/dist/form/components/FormikArrayContainer.d.ts +0 -19
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +0 -236
- package/src/form/components/FormikArrayContainer.tsx +0 -47
- /package/src/util/{common.tsx → common.ts} +0 -0
|
@@ -10,9 +10,10 @@ export function useSelectionController<M extends Record<string, any> = any>(
|
|
|
10
10
|
const toggleEntitySelection = useCallback((entity: Entity<M>, newSelectedState?: boolean) => {
|
|
11
11
|
let newValue;
|
|
12
12
|
if (newSelectedState === undefined) {
|
|
13
|
-
|
|
13
|
+
const isSelected = Boolean(selectedEntities.find(e => e.id === entity.id && e.path === entity.path));
|
|
14
|
+
if (isSelected) {
|
|
14
15
|
onSelectionChange?.(entity, false);
|
|
15
|
-
newValue = selectedEntities.filter((item: Entity<M>) => item.id
|
|
16
|
+
newValue = selectedEntities.filter((item: Entity<M>) => !(item.id === entity.id && item.path === entity.path));
|
|
16
17
|
} else {
|
|
17
18
|
onSelectionChange?.(entity, true);
|
|
18
19
|
newValue = [...selectedEntities, entity];
|
|
@@ -23,14 +24,14 @@ export function useSelectionController<M extends Record<string, any> = any>(
|
|
|
23
24
|
newValue = [...selectedEntities, entity];
|
|
24
25
|
} else {
|
|
25
26
|
onSelectionChange?.(entity, false);
|
|
26
|
-
newValue = selectedEntities.filter((item: Entity<M>) => item.id
|
|
27
|
+
newValue = selectedEntities.filter((item: Entity<M>) => !(item.id === entity.id && item.path === entity.path));
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
setSelectedEntities(newValue);
|
|
30
31
|
}, [selectedEntities]);
|
|
31
32
|
|
|
32
33
|
const isEntitySelected = useCallback((entity: Entity<M>) => {
|
|
33
|
-
return selectedEntities.
|
|
34
|
+
return Boolean(selectedEntities.find(e => e.id === entity.id && e.path === entity.path));
|
|
34
35
|
}, [selectedEntities]);
|
|
35
36
|
|
|
36
37
|
return {
|
|
@@ -62,39 +62,47 @@ export function EntityPreview({
|
|
|
62
62
|
collection,
|
|
63
63
|
path: entity.path,
|
|
64
64
|
values: entity.values,
|
|
65
|
-
|
|
65
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
66
66
|
}), [collection]);
|
|
67
67
|
|
|
68
|
-
const listProperties = useMemo(() => getEntityPreviewKeys(resolvedCollection, customizationController.propertyConfigs, previewProperties, size === "
|
|
68
|
+
const listProperties = useMemo(() => getEntityPreviewKeys(resolvedCollection, customizationController.propertyConfigs, previewProperties, size === "medium" || size === "large" ? 3 : 1),
|
|
69
69
|
[previewProperties, resolvedCollection, size]);
|
|
70
70
|
|
|
71
71
|
const titleProperty = getEntityTitlePropertyKey(resolvedCollection, customizationController.propertyConfigs);
|
|
72
72
|
const imagePropertyKey = getEntityImagePreviewPropertyKey(resolvedCollection);
|
|
73
73
|
const imageProperty = imagePropertyKey ? resolvedCollection.properties[imagePropertyKey] : undefined;
|
|
74
|
-
|
|
74
|
+
const usedImageProperty = imageProperty && "of" in imageProperty ? imageProperty.of : imageProperty;
|
|
75
75
|
const restProperties = listProperties.filter(p => p !== titleProperty && p !== imagePropertyKey);
|
|
76
76
|
|
|
77
|
+
const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : undefined;
|
|
78
|
+
const usedImageValue = imageProperty !== undefined ? ("of" in imageProperty
|
|
79
|
+
? ((imageValue ?? []).length > 0
|
|
80
|
+
? imageValue[0] : undefined)
|
|
81
|
+
: imageValue)
|
|
82
|
+
: undefined;
|
|
83
|
+
|
|
77
84
|
return <EntityPreviewContainer onClick={disabled ? undefined : onClick}
|
|
78
85
|
hover={disabled ? undefined : hover}
|
|
79
86
|
size={size}>
|
|
80
|
-
<div className={cls("flex w-10 h-10 mr-2 shrink-0", size === "
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{!
|
|
87
|
+
<div className={cls("flex w-10 h-10 ml-1 mr-2 shrink-0", size === "small" ? "my-0.5" : "m-2 self-start")}>
|
|
88
|
+
{usedImageProperty && usedImageValue && <PropertyPreview property={usedImageProperty}
|
|
89
|
+
propertyKey={imagePropertyKey as string}
|
|
90
|
+
size={"small"}
|
|
91
|
+
value={usedImageValue}/>}
|
|
92
|
+
{(!usedImageProperty || !usedImageValue) && <IconForView collectionOrView={collection}
|
|
93
|
+
color={"primary"}
|
|
94
|
+
size={size}
|
|
95
|
+
className={"m-auto p-1"}/>}
|
|
86
96
|
</div>
|
|
87
97
|
|
|
88
98
|
|
|
89
|
-
<div className={"flex flex-col grow-1 w-full
|
|
99
|
+
<div className={"flex flex-col grow-1 w-full m-1 shrink-1"} style={{
|
|
100
|
+
"maxWidth": "calc(100% - 96px)"
|
|
101
|
+
}}>
|
|
90
102
|
|
|
91
|
-
{size !== "
|
|
103
|
+
{size !== "small" && includeId && (
|
|
92
104
|
entity
|
|
93
|
-
? <div className={
|
|
94
|
-
size !== "medium"
|
|
95
|
-
? "block whitespace-nowrap overflow-hidden truncate"
|
|
96
|
-
: ""
|
|
97
|
-
}`}>
|
|
105
|
+
? <div className={"block whitespace-nowrap overflow-hidden truncate"}>
|
|
98
106
|
<Typography variant={"caption"}
|
|
99
107
|
color={"disabled"}
|
|
100
108
|
className={"font-mono"}>
|
|
@@ -104,17 +112,17 @@ export function EntityPreview({
|
|
|
104
112
|
: <Skeleton/>)}
|
|
105
113
|
|
|
106
114
|
{titleProperty && (
|
|
107
|
-
<div className={"my-0.5 text-sm font-medium"}>
|
|
115
|
+
<div className={"truncate my-0.5 text-sm font-medium"}>
|
|
108
116
|
{
|
|
109
117
|
entity
|
|
110
118
|
? <PropertyPreview
|
|
111
119
|
propertyKey={titleProperty as string}
|
|
112
120
|
value={getValueInPath(entity.values, titleProperty)}
|
|
113
121
|
property={resolvedCollection.properties[titleProperty as string] as ResolvedProperty}
|
|
114
|
-
size={"
|
|
122
|
+
size={"large"}/>
|
|
115
123
|
: <SkeletonPropertyComponent
|
|
116
124
|
property={resolvedCollection.properties[titleProperty as string] as ResolvedProperty}
|
|
117
|
-
size={"
|
|
125
|
+
size={"large"}/>
|
|
118
126
|
}
|
|
119
127
|
</div>
|
|
120
128
|
)}
|
|
@@ -125,17 +133,17 @@ export function EntityPreview({
|
|
|
125
133
|
|
|
126
134
|
return (
|
|
127
135
|
<div key={"ref_prev_" + key}
|
|
128
|
-
className={restProperties.length > 1 ? "my-0.5" : "my-0"}>
|
|
136
|
+
className={cls("truncate", restProperties.length > 1 ? "my-0.5" : "my-0")}>
|
|
129
137
|
{
|
|
130
138
|
entity
|
|
131
139
|
? <PropertyPreview
|
|
132
140
|
propertyKey={key as string}
|
|
133
141
|
value={getValueInPath(entity.values, key)}
|
|
134
142
|
property={childProperty as ResolvedProperty}
|
|
135
|
-
size={"
|
|
143
|
+
size={"small"}/>
|
|
136
144
|
: <SkeletonPropertyComponent
|
|
137
145
|
property={childProperty as ResolvedProperty}
|
|
138
|
-
size={"
|
|
146
|
+
size={"small"}/>
|
|
139
147
|
}
|
|
140
148
|
</div>
|
|
141
149
|
);
|
|
@@ -144,11 +152,11 @@ export function EntityPreview({
|
|
|
144
152
|
</div>
|
|
145
153
|
|
|
146
154
|
{entity && includeEntityLink &&
|
|
147
|
-
<Tooltip title={`See details for ${entity.id}`}>
|
|
155
|
+
<Tooltip title={`See details for ${entity.id}`} className={"shrink-0"}>
|
|
148
156
|
<IconButton
|
|
149
157
|
color={"inherit"}
|
|
150
|
-
size={"
|
|
151
|
-
className={size !== "
|
|
158
|
+
size={"medium"}
|
|
159
|
+
className={size !== "small" ? "self-start" : ""}
|
|
152
160
|
onClick={(e) => {
|
|
153
161
|
e.stopPropagation();
|
|
154
162
|
analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
|
|
@@ -162,7 +170,7 @@ export function EntityPreview({
|
|
|
162
170
|
updateUrl: true
|
|
163
171
|
});
|
|
164
172
|
}}>
|
|
165
|
-
<KeyboardTabIcon size={"
|
|
173
|
+
<KeyboardTabIcon size={"medium"}/>
|
|
166
174
|
</IconButton>
|
|
167
175
|
</Tooltip>}
|
|
168
176
|
|
|
@@ -181,7 +189,6 @@ export type EntityPreviewContainerProps = {
|
|
|
181
189
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
182
190
|
};
|
|
183
191
|
|
|
184
|
-
|
|
185
192
|
export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({
|
|
186
193
|
children,
|
|
187
194
|
hover,
|
|
@@ -200,12 +207,12 @@ export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPre
|
|
|
200
207
|
tabindex: 0
|
|
201
208
|
}}
|
|
202
209
|
className={cls(
|
|
203
|
-
"bg-white dark:bg-
|
|
210
|
+
"bg-white dark:bg-surface-900",
|
|
204
211
|
"min-h-[42px]",
|
|
205
212
|
fullwidth ? "w-full" : "",
|
|
206
213
|
"items-center",
|
|
207
|
-
hover ? "hover:bg-
|
|
208
|
-
size === "
|
|
214
|
+
hover ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 group-hover:bg-surface-accent-50 dark:group-hover:bg-surface-800" : "",
|
|
215
|
+
size === "small" ? "p-1" : "px-2 py-1",
|
|
209
216
|
"flex border rounded-lg",
|
|
210
217
|
onClick ? "cursor-pointer" : "",
|
|
211
218
|
defaultBorderMixin,
|
|
@@ -220,3 +227,5 @@ export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPre
|
|
|
220
227
|
{children}
|
|
221
228
|
</div>;
|
|
222
229
|
});
|
|
230
|
+
|
|
231
|
+
EntityPreviewContainer.displayName = "EntityPreviewContainer";
|
|
@@ -30,7 +30,7 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
30
30
|
path,
|
|
31
31
|
entityId: entity.id,
|
|
32
32
|
values: entity.values,
|
|
33
|
-
|
|
33
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
34
34
|
}), [collection, path, entity, customizationController.propertyConfigs]);
|
|
35
35
|
|
|
36
36
|
const properties: ResolvedProperties = resolvedCollection.properties;
|
|
@@ -40,10 +40,10 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
40
40
|
<div className={"w-full mb-4"}>
|
|
41
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
|
-
<span className="pl-2 text-sm text-
|
|
43
|
+
<span className="pl-2 text-sm text-surface-600">Id</span>
|
|
44
44
|
</div>
|
|
45
45
|
<div
|
|
46
|
-
className="flex-grow p-2 ml-2 w-3/4 text-
|
|
46
|
+
className="flex-grow p-2 ml-2 w-3/4 text-surface-900 dark:text-white min-h-[56px] flex items-center">
|
|
47
47
|
<span className="flex-grow mr-2">{entity.id}</span>
|
|
48
48
|
{customizationController?.entityLinkBuilder &&
|
|
49
49
|
<a href={customizationController.entityLinkBuilder({ entity })}
|
|
@@ -64,10 +64,10 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
64
64
|
key={`reference_previews_${key}`}
|
|
65
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
|
-
<span className="pl-2 text-sm text-
|
|
67
|
+
<span className="pl-2 text-sm text-surface-600">{property.name}</span>
|
|
68
68
|
</div>
|
|
69
69
|
<div
|
|
70
|
-
className="flex-grow p-2 ml-2 w-3/4 text-
|
|
70
|
+
className="flex-grow p-2 ml-2 w-3/4 text-surface-900 dark:text-white min-h-[56px] flex items-center">
|
|
71
71
|
<PropertyPreview
|
|
72
72
|
propertyKey={key}
|
|
73
73
|
value={value}
|
|
@@ -26,13 +26,13 @@ export function ErrorView({
|
|
|
26
26
|
tooltip
|
|
27
27
|
}: ErrorViewProps): React.ReactElement {
|
|
28
28
|
const component = error instanceof Error ? error.message : error;
|
|
29
|
-
console.
|
|
29
|
+
console.warn("ErrorView", error)
|
|
30
30
|
|
|
31
31
|
const body = (
|
|
32
32
|
<div
|
|
33
33
|
className="flex items-center m-2">
|
|
34
|
-
<ErrorIcon size={"small"} color={"error"}/>
|
|
35
|
-
<div className="pl-
|
|
34
|
+
<ErrorIcon className={"mx-2"} size={"small"} color={"error"}/>
|
|
35
|
+
<div className="pl-4">
|
|
36
36
|
{title && <Typography
|
|
37
37
|
variant={"body2"}
|
|
38
38
|
className="font-medium">{title}</Typography>}
|
|
@@ -2,7 +2,7 @@ import { useNavigate } from "react-router-dom";
|
|
|
2
2
|
import { useNavigationController } from "../../hooks";
|
|
3
3
|
import { useUserConfigurationPersistence } from "../../hooks/useUserConfigurationPersistence";
|
|
4
4
|
import { TopNavigationEntry } from "../../types";
|
|
5
|
-
import { Chip, Collapse,
|
|
5
|
+
import { Chip, Collapse, StarIcon } from "@firecms/ui";
|
|
6
6
|
|
|
7
7
|
function NavigationChip({ entry }: { entry: TopNavigationEntry }) {
|
|
8
8
|
|
|
@@ -29,16 +29,11 @@ function NavigationChip({ entry }: { entry: TopNavigationEntry }) {
|
|
|
29
29
|
return <Chip
|
|
30
30
|
key={entry.path}
|
|
31
31
|
onClick={() => navigate(entry.url)}
|
|
32
|
-
icon={
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className={"text-secondary"}/>
|
|
38
|
-
: <StarBorderIcon
|
|
39
|
-
onClick={onIconClick}
|
|
40
|
-
size={18}
|
|
41
|
-
className={"text-gray-400 dark:text-gray-500"}/>}>
|
|
32
|
+
icon={<StarIcon
|
|
33
|
+
onClick={onIconClick}
|
|
34
|
+
size={18}
|
|
35
|
+
className={favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500"}/>
|
|
36
|
+
}>
|
|
42
37
|
{entry.name}
|
|
43
38
|
</Chip>;
|
|
44
39
|
}
|
|
@@ -27,7 +27,7 @@ export function NavigationCard({
|
|
|
27
27
|
className="flex-grow w-full">
|
|
28
28
|
|
|
29
29
|
<div
|
|
30
|
-
className="h-10 flex items-center w-full justify-between text-
|
|
30
|
+
className="h-10 flex items-center w-full justify-between text-surface-300 dark:text-surface-600">
|
|
31
31
|
|
|
32
32
|
{icon}
|
|
33
33
|
|
|
@@ -4,7 +4,7 @@ import { useCustomizationController, useFireCMSContext } from "../../hooks";
|
|
|
4
4
|
import { PluginHomePageActionsProps, TopNavigationEntry } from "../../types";
|
|
5
5
|
import { IconForView } from "../../util";
|
|
6
6
|
import { useUserConfigurationPersistence } from "../../hooks/useUserConfigurationPersistence";
|
|
7
|
-
import { IconButton,
|
|
7
|
+
import { IconButton, StarIcon } from "@firecms/ui";
|
|
8
8
|
import { NavigationCard } from "./NavigationCard";
|
|
9
9
|
import { SmallNavigationCard } from "./SmallNavigationCard";
|
|
10
10
|
|
|
@@ -60,14 +60,9 @@ export function NavigationCardBinding({
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
}}>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
size={18}
|
|
67
|
-
className={"text-secondary"}/>
|
|
68
|
-
: <StarBorderIcon
|
|
69
|
-
size={18}
|
|
70
|
-
className={"text-gray-400 dark:text-gray-500"}/>}
|
|
63
|
+
<StarIcon
|
|
64
|
+
size={18}
|
|
65
|
+
className={favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500"}/>
|
|
71
66
|
</IconButton>
|
|
72
67
|
]
|
|
73
68
|
: [];
|
|
@@ -12,7 +12,7 @@ export function NavigationGroup({
|
|
|
12
12
|
return (
|
|
13
13
|
<ExpandablePanel
|
|
14
14
|
invisible={true}
|
|
15
|
-
titleClassName={"font-medium text-sm text-
|
|
15
|
+
titleClassName={"font-medium text-sm text-surface-600 dark:text-surface-400"}
|
|
16
16
|
innerClassName={"py-4"}
|
|
17
17
|
initiallyExpanded={!(userConfigurationPersistence?.collapsedGroups ?? []).includes(group ?? "ungrouped")}
|
|
18
18
|
onExpandedChange={expanded => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Link
|
|
2
|
+
import { Link } from "react-router-dom";
|
|
3
3
|
import { Button, Typography } from "@firecms/ui";
|
|
4
4
|
|
|
5
5
|
export function NotFoundPage() {
|
|
@@ -17,7 +17,7 @@ export function NotFoundPage() {
|
|
|
17
17
|
</Typography>
|
|
18
18
|
<Button
|
|
19
19
|
variant={"text"}
|
|
20
|
-
component={
|
|
20
|
+
component={Link}
|
|
21
21
|
to={"/"}>Back to home</Button>
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
@@ -9,7 +9,7 @@ export function PropertyConfigBadge({
|
|
|
9
9
|
propertyConfig: PropertyConfig | undefined,
|
|
10
10
|
disabled?: boolean
|
|
11
11
|
}): React.ReactNode {
|
|
12
|
-
const classes = "h-8 w-8 p-1 rounded-full shadow text-white " + (disabled ? "bg-
|
|
12
|
+
const classes = "h-8 w-8 p-1 rounded-full shadow text-white " + (disabled ? "bg-surface-400 dark:bg-surface-600" : "");
|
|
13
13
|
|
|
14
14
|
const defaultPropertyConfig = typeof propertyConfig?.property === "object" ? getDefaultFieldConfig(propertyConfig.property) : undefined;
|
|
15
15
|
|
|
@@ -4,7 +4,7 @@ import { useCallback, useState } from "react";
|
|
|
4
4
|
export function PropertyIdCopyTooltip({
|
|
5
5
|
propertyKey,
|
|
6
6
|
className,
|
|
7
|
-
children
|
|
7
|
+
children,
|
|
8
8
|
}: {
|
|
9
9
|
propertyKey: string,
|
|
10
10
|
className?: string,
|
|
@@ -13,11 +13,10 @@ export function PropertyIdCopyTooltip({
|
|
|
13
13
|
return <Tooltip title={<PropertyIdCopyTooltipContent propertyKey={propertyKey}/>}
|
|
14
14
|
delayDuration={800}
|
|
15
15
|
side={"top"}
|
|
16
|
-
asChild={false}
|
|
17
16
|
align={"start"}
|
|
18
17
|
sideOffset={8}
|
|
19
18
|
className={className}>
|
|
20
|
-
|
|
19
|
+
{children}
|
|
21
20
|
</Tooltip>
|
|
22
21
|
|
|
23
22
|
}
|
|
@@ -29,7 +28,7 @@ export function PropertyIdCopyTooltipContent({ propertyKey }: { propertyKey: str
|
|
|
29
28
|
return (
|
|
30
29
|
<div className={"flex flex-row gap-2 items-center justify-center text-white"}>
|
|
31
30
|
<div>
|
|
32
|
-
<Typography variant={"caption"} className={"min-w-20 text-
|
|
31
|
+
<Typography variant={"caption"} className={"min-w-20 text-surface-accent-400"}
|
|
33
32
|
color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
|
|
34
33
|
<Typography variant={"caption"} className={"text-white"}><code>{propertyKey}</code></Typography>
|
|
35
34
|
</div>
|
|
@@ -4,7 +4,7 @@ import { CollectionSize, Entity, EntityCollection, FilterValues } from "../../ty
|
|
|
4
4
|
import {
|
|
5
5
|
EntityCollectionRowActions,
|
|
6
6
|
EntityCollectionTable,
|
|
7
|
-
|
|
7
|
+
useDataSourceTableController
|
|
8
8
|
} from "../EntityCollectionTable";
|
|
9
9
|
import {
|
|
10
10
|
useAuthController,
|
|
@@ -107,7 +107,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
107
107
|
const analyticsController = useAnalyticsController();
|
|
108
108
|
const customizationController = useCustomizationController();
|
|
109
109
|
|
|
110
|
-
const fullPath = navigation.
|
|
110
|
+
const fullPath = navigation.resolveIdsFrom(pathInput);
|
|
111
111
|
|
|
112
112
|
const dataSource = useDataSource(collection);
|
|
113
113
|
|
|
@@ -233,7 +233,9 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
233
233
|
selectionEnabled={multiselect}
|
|
234
234
|
hideId={collection?.hideIdFromCollection}
|
|
235
235
|
fullPath={fullPath}
|
|
236
|
-
selectionController={selectionController}
|
|
236
|
+
selectionController={selectionController}
|
|
237
|
+
openEntityMode={"side_panel"}
|
|
238
|
+
/>;
|
|
237
239
|
|
|
238
240
|
};
|
|
239
241
|
|
|
@@ -251,16 +253,17 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
251
253
|
collection: collection,
|
|
252
254
|
path: fullPath,
|
|
253
255
|
values: {},
|
|
254
|
-
|
|
256
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
255
257
|
}), [collection, customizationController.propertyConfigs, fullPath]);
|
|
256
258
|
|
|
257
259
|
const displayedColumnIds = useColumnIds(resolvedCollection, false);
|
|
258
260
|
|
|
259
|
-
const tableController =
|
|
261
|
+
const tableController = useDataSourceTableController<M>({
|
|
260
262
|
fullPath,
|
|
261
263
|
collection,
|
|
262
264
|
entitiesDisplayedFirst,
|
|
263
|
-
forceFilter
|
|
265
|
+
forceFilter,
|
|
266
|
+
updateUrl: false,
|
|
264
267
|
});
|
|
265
268
|
|
|
266
269
|
const {
|
|
@@ -289,12 +292,14 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
289
292
|
tableController={tableController}
|
|
290
293
|
enablePopupIcon={false}
|
|
291
294
|
tableRowActionsBuilder={tableRowActionsBuilder}
|
|
295
|
+
openEntityMode={"side_panel"}
|
|
292
296
|
title={<Typography variant={"subtitle2"} className={"flex flex-row gap-2"}>
|
|
293
297
|
<IconForView
|
|
294
298
|
size={"small"}
|
|
295
299
|
collectionOrView={collection}
|
|
296
|
-
className={"text-
|
|
297
|
-
{collection.singularName ? `Select ${collection.singularName}` : `Select
|
|
300
|
+
className={"text-surface-300 dark:text-surface-600"}/>
|
|
301
|
+
{collection.singularName ? `Select ${collection.singularName}` : `Select
|
|
302
|
+
from ${collection.name}`}
|
|
298
303
|
</Typography>}
|
|
299
304
|
defaultSize={collection.defaultSize}
|
|
300
305
|
properties={resolvedCollection.properties}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import equal from "react-fast-compare";
|
|
3
2
|
import {
|
|
4
3
|
CollectionSize,
|
|
5
4
|
Entity,
|
|
@@ -60,7 +59,7 @@ export type SelectableTableProps<M extends Record<string, any>> = {
|
|
|
60
59
|
|
|
61
60
|
/**
|
|
62
61
|
* Controller holding the logic for the table
|
|
63
|
-
* {@link
|
|
62
|
+
* {@link useDataSourceTableController}
|
|
64
63
|
* {@link EntityTableController}
|
|
65
64
|
*/
|
|
66
65
|
tableController: EntityTableController<M>;
|
|
@@ -77,6 +76,18 @@ export type SelectableTableProps<M extends Record<string, any>> = {
|
|
|
77
76
|
|
|
78
77
|
size?: CollectionSize;
|
|
79
78
|
|
|
79
|
+
initialScroll?: number;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Callback when the table is scrolled
|
|
83
|
+
* @param props
|
|
84
|
+
*/
|
|
85
|
+
onScroll?: (props: {
|
|
86
|
+
scrollDirection: "forward" | "backward",
|
|
87
|
+
scrollOffset: number,
|
|
88
|
+
scrollUpdateWasRequested: boolean
|
|
89
|
+
}) => void;
|
|
90
|
+
|
|
80
91
|
emptyComponent?: React.ReactNode;
|
|
81
92
|
|
|
82
93
|
endAdornment?: React.ReactNode;
|
|
@@ -101,7 +112,7 @@ export type SelectableTableProps<M extends Record<string, any>> = {
|
|
|
101
112
|
*
|
|
102
113
|
* The data displayed in the table is managed by a {@link EntityTableController}.
|
|
103
114
|
* You can build the default, bound to a path in the datasource, by using the hook
|
|
104
|
-
* {@link
|
|
115
|
+
* {@link useDataSourceTableController}
|
|
105
116
|
*
|
|
106
117
|
* @see EntityCollectionTableProps
|
|
107
118
|
* @see EntityCollectionView
|
|
@@ -136,6 +147,8 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
136
147
|
setPopupCell
|
|
137
148
|
},
|
|
138
149
|
filterable = true,
|
|
150
|
+
onScroll,
|
|
151
|
+
initialScroll,
|
|
139
152
|
emptyComponent,
|
|
140
153
|
columns,
|
|
141
154
|
forceFilter,
|
|
@@ -210,7 +223,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
210
223
|
selectedCell,
|
|
211
224
|
}}
|
|
212
225
|
>
|
|
213
|
-
<div className="h-full w-full flex flex-col bg-white dark:bg-
|
|
226
|
+
<div className="h-full w-full flex flex-col bg-white dark:bg-surface-950"
|
|
214
227
|
ref={ref}>
|
|
215
228
|
|
|
216
229
|
<VirtualTable
|
|
@@ -229,10 +242,12 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
229
242
|
sortBy={sortBy}
|
|
230
243
|
onSortByUpdate={setSortBy as ((sortBy?: [string, "asc" | "desc"]) => void)}
|
|
231
244
|
hoverRow={hoverRow}
|
|
245
|
+
initialScroll={initialScroll}
|
|
246
|
+
onScroll={onScroll}
|
|
232
247
|
checkFilterCombination={checkFilterCombination}
|
|
233
248
|
createFilterField={filterable ? createFilterField : undefined}
|
|
234
249
|
rowClassName={useCallback((entity: Entity<M>) => {
|
|
235
|
-
return highlightedRow?.(entity) ? "bg-
|
|
250
|
+
return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
|
|
236
251
|
}, [highlightedRow])}
|
|
237
252
|
className="flex-grow"
|
|
238
253
|
emptyComponent={emptyComponent}
|
|
@@ -76,6 +76,8 @@ export function DateTimeFilterField({
|
|
|
76
76
|
<div className="flex w-[440px]">
|
|
77
77
|
<div className="w-[80px]">
|
|
78
78
|
<Select value={operation}
|
|
79
|
+
size={"large"}
|
|
80
|
+
fullWidth={true}
|
|
79
81
|
onValueChange={(value) => {
|
|
80
82
|
updateFilter(value as VirtualTableWhereFilterOp, internalValue);
|
|
81
83
|
}}
|
|
@@ -92,7 +94,7 @@ export function DateTimeFilterField({
|
|
|
92
94
|
|
|
93
95
|
<DateTimeField
|
|
94
96
|
mode={mode}
|
|
95
|
-
size={"
|
|
97
|
+
size={"large"}
|
|
96
98
|
locale={locale}
|
|
97
99
|
value={internalValue ?? undefined}
|
|
98
100
|
onChange={(dateValue: Date | null) => {
|
|
@@ -102,7 +104,7 @@ export function DateTimeFilterField({
|
|
|
102
104
|
/>
|
|
103
105
|
|
|
104
106
|
<Label
|
|
105
|
-
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-
|
|
107
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-surface-100 dark:[&:has(:checked)]:bg-surface-800"
|
|
106
108
|
htmlFor="null-filter"
|
|
107
109
|
>
|
|
108
110
|
<Checkbox id="null-filter"
|
|
@@ -35,12 +35,10 @@ const operationLabels = {
|
|
|
35
35
|
const multipleSelectOperations = ["array-contains-any", "in", "not-in"];
|
|
36
36
|
|
|
37
37
|
export function ReferenceFilterField({
|
|
38
|
-
name,
|
|
39
38
|
value,
|
|
40
39
|
setValue,
|
|
41
40
|
isArray,
|
|
42
41
|
path,
|
|
43
|
-
title,
|
|
44
42
|
includeId = true,
|
|
45
43
|
previewProperties,
|
|
46
44
|
setHidden
|
|
@@ -50,9 +48,11 @@ export function ReferenceFilterField({
|
|
|
50
48
|
? ["array-contains"]
|
|
51
49
|
: ["==", "!=", ">", "<", ">=", "<="];
|
|
52
50
|
|
|
53
|
-
isArray
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
if (isArray) {
|
|
52
|
+
possibleOperations.push("array-contains-any");
|
|
53
|
+
} else {
|
|
54
|
+
possibleOperations.push("in", "not-in");
|
|
55
|
+
}
|
|
56
56
|
|
|
57
57
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
58
58
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
@@ -144,9 +144,11 @@ export function ReferenceFilterField({
|
|
|
144
144
|
|
|
145
145
|
return (
|
|
146
146
|
|
|
147
|
-
<div className="flex w-[
|
|
147
|
+
<div className="flex w-[480px] flex-row">
|
|
148
148
|
<div className="w-[140px]">
|
|
149
149
|
<Select value={operation}
|
|
150
|
+
size={"large"}
|
|
151
|
+
fullWidth={true}
|
|
150
152
|
onValueChange={(value) => {
|
|
151
153
|
updateFilter(value as VirtualTableWhereFilterOp, internalValue);
|
|
152
154
|
}}
|
|
@@ -159,7 +161,7 @@ export function ReferenceFilterField({
|
|
|
159
161
|
</Select>
|
|
160
162
|
</div>
|
|
161
163
|
|
|
162
|
-
<div className="flex-grow ml-2 h-full gap-2 flex flex-col">
|
|
164
|
+
<div className="flex-grow ml-2 h-full gap-2 flex flex-col w-[340px]">
|
|
163
165
|
|
|
164
166
|
{internalValue && Array.isArray(internalValue) && <div>
|
|
165
167
|
{internalValue.map((ref, index) => buildEntry(ref))}
|
|
@@ -179,7 +181,7 @@ export function ReferenceFilterField({
|
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
{!isArray && <Label
|
|
182
|
-
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-
|
|
184
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-surface-100 dark:[&:has(:checked)]:bg-surface-800"
|
|
183
185
|
htmlFor="null-filter"
|
|
184
186
|
>
|
|
185
187
|
<Checkbox id="null-filter"
|