@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
|
@@ -3,7 +3,7 @@ import { EnumValuesChip } from "../../../preview";
|
|
|
3
3
|
import { VirtualTableWhereFilterOp } from "../../VirtualTable";
|
|
4
4
|
import {
|
|
5
5
|
Checkbox,
|
|
6
|
-
|
|
6
|
+
CloseIcon,
|
|
7
7
|
IconButton,
|
|
8
8
|
Label,
|
|
9
9
|
MultiSelect,
|
|
@@ -98,6 +98,7 @@ export function StringNumberFilterField({
|
|
|
98
98
|
<div className="flex w-[440px]">
|
|
99
99
|
<div className={"w-[80px]"}>
|
|
100
100
|
<Select value={operation}
|
|
101
|
+
fullWidth={true}
|
|
101
102
|
position={"item-aligned"}
|
|
102
103
|
onValueChange={(value) => {
|
|
103
104
|
updateFilter(value as VirtualTableWhereFilterOp, internalValue);
|
|
@@ -124,13 +125,14 @@ export function StringNumberFilterField({
|
|
|
124
125
|
}}
|
|
125
126
|
endAdornment={internalValue && <IconButton
|
|
126
127
|
onClick={(e) => updateFilter(operation, undefined)}>
|
|
127
|
-
<
|
|
128
|
+
<CloseIcon/>
|
|
128
129
|
</IconButton>}
|
|
129
130
|
/>}
|
|
130
131
|
|
|
131
132
|
{enumValues && !multiple &&
|
|
132
133
|
<Select
|
|
133
134
|
position={"item-aligned"}
|
|
135
|
+
fullWidth={true}
|
|
134
136
|
value={typeof internalValue === "string" ? internalValue : ""}
|
|
135
137
|
onValueChange={(value) => {
|
|
136
138
|
if (value !== "")
|
|
@@ -139,7 +141,7 @@ export function StringNumberFilterField({
|
|
|
139
141
|
endAdornment={internalValue && <IconButton
|
|
140
142
|
className="absolute right-2 top-3"
|
|
141
143
|
onClick={(e) => updateFilter(operation, undefined)}>
|
|
142
|
-
<
|
|
144
|
+
<CloseIcon/>
|
|
143
145
|
</IconButton>}
|
|
144
146
|
renderValue={(enumKey) => {
|
|
145
147
|
if (enumKey === null)
|
|
@@ -176,7 +178,7 @@ export function StringNumberFilterField({
|
|
|
176
178
|
endAdornment={internalValue && <IconButton
|
|
177
179
|
className="absolute right-2 top-3"
|
|
178
180
|
onClick={(e) => updateFilter(operation, undefined)}>
|
|
179
|
-
<
|
|
181
|
+
<CloseIcon/>
|
|
180
182
|
</IconButton>}
|
|
181
183
|
// renderValues={(enumKeys) => {
|
|
182
184
|
// console.log("renderValues", enumKeys);
|
|
@@ -203,7 +205,7 @@ export function StringNumberFilterField({
|
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
{!isArray && <Label
|
|
206
|
-
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-
|
|
208
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-surface-100 dark:[&:has(:checked)]:bg-surface-800"
|
|
207
209
|
htmlFor="null-filter"
|
|
208
210
|
>
|
|
209
211
|
<Checkbox id="null-filter"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from "@firecms/ui";
|
|
2
|
+
|
|
3
|
+
export interface UnsavedChangesDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
body?: React.ReactNode;
|
|
6
|
+
title?: string;
|
|
7
|
+
handleOk: () => void;
|
|
8
|
+
handleCancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function UnsavedChangesDialog({
|
|
12
|
+
open,
|
|
13
|
+
handleOk,
|
|
14
|
+
handleCancel,
|
|
15
|
+
body,
|
|
16
|
+
title
|
|
17
|
+
}: UnsavedChangesDialogProps) {
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Dialog
|
|
21
|
+
onEscapeKeyDown={() => {
|
|
22
|
+
handleCancel();
|
|
23
|
+
}}
|
|
24
|
+
open={open}
|
|
25
|
+
>
|
|
26
|
+
<DialogTitle variant={"h6"}>{title}</DialogTitle>
|
|
27
|
+
<DialogContent>
|
|
28
|
+
|
|
29
|
+
{body}
|
|
30
|
+
|
|
31
|
+
<Typography>
|
|
32
|
+
Are you sure you want to leave this page?
|
|
33
|
+
</Typography>
|
|
34
|
+
|
|
35
|
+
</DialogContent>
|
|
36
|
+
<DialogActions>
|
|
37
|
+
<Button variant="text" onClick={handleCancel} autoFocus> Cancel </Button>
|
|
38
|
+
<Button onClick={handleOk}> Ok </Button>
|
|
39
|
+
</DialogActions>
|
|
40
|
+
</Dialog>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -20,6 +20,7 @@ import { VirtualTableHeaderRow } from "./VirtualTableHeaderRow";
|
|
|
20
20
|
import { VirtualTableRow } from "./VirtualTableRow";
|
|
21
21
|
import { VirtualTableCell } from "./VirtualTableCell";
|
|
22
22
|
import { AssignmentIcon, CenteredView, cls, Typography } from "@firecms/ui";
|
|
23
|
+
import { useDebounceCallback } from "../common/useDebouncedCallback";
|
|
23
24
|
|
|
24
25
|
const VirtualListContext = createContext<VirtualTableContextProps<any>>({} as any);
|
|
25
26
|
VirtualListContext.displayName = "VirtualListContext";
|
|
@@ -103,6 +104,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
103
104
|
error,
|
|
104
105
|
emptyComponent,
|
|
105
106
|
onSortByUpdate,
|
|
107
|
+
onScroll: onScrollProp,
|
|
106
108
|
loading,
|
|
107
109
|
cellRenderer,
|
|
108
110
|
hoverRow,
|
|
@@ -112,6 +114,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
112
114
|
className,
|
|
113
115
|
endAdornment,
|
|
114
116
|
AddColumnComponent,
|
|
117
|
+
initialScroll = 0,
|
|
115
118
|
debug
|
|
116
119
|
}: VirtualTableProps<T>) {
|
|
117
120
|
|
|
@@ -123,6 +126,15 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
123
126
|
const tableRef = useRef<HTMLDivElement>(null);
|
|
124
127
|
const endReachCallbackThreshold = useRef<number>(0);
|
|
125
128
|
|
|
129
|
+
const debouncedScroll = useDebounceCallback(onScrollProp, 200);
|
|
130
|
+
|
|
131
|
+
// Set initial scroll position
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (tableRef.current && initialScroll) {
|
|
134
|
+
tableRef.current.scrollTo(0, initialScroll);
|
|
135
|
+
}
|
|
136
|
+
}, [tableRef, initialScroll]);
|
|
137
|
+
|
|
126
138
|
useEffect(() => {
|
|
127
139
|
setColumns(columnsProp);
|
|
128
140
|
}, [columnsProp]);
|
|
@@ -158,7 +170,6 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
158
170
|
console.log("scrollToTop");
|
|
159
171
|
endReachCallbackThreshold.current = 0;
|
|
160
172
|
if (tableRef.current) {
|
|
161
|
-
// scrollRef.current = [scrollRef.current[0], 0];
|
|
162
173
|
tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);
|
|
163
174
|
}
|
|
164
175
|
}, []);
|
|
@@ -222,6 +233,13 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
222
233
|
scrollOffset,
|
|
223
234
|
scrollUpdateWasRequested
|
|
224
235
|
});
|
|
236
|
+
if (onScrollProp) {
|
|
237
|
+
debouncedScroll({
|
|
238
|
+
scrollDirection,
|
|
239
|
+
scrollOffset,
|
|
240
|
+
scrollUpdateWasRequested
|
|
241
|
+
})
|
|
242
|
+
}
|
|
225
243
|
if (!scrollUpdateWasRequested && (scrollOffset >= maxScroll - endOffset))
|
|
226
244
|
onEndReachedInternal(scrollOffset);
|
|
227
245
|
}, [maxScroll, onEndReachedInternal]);
|
|
@@ -294,7 +312,6 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
294
312
|
if (debug)
|
|
295
313
|
console.log("VirtualTable render", virtualListController);
|
|
296
314
|
|
|
297
|
-
// useTraceUpdate(virtualListController);
|
|
298
315
|
return (
|
|
299
316
|
<div
|
|
300
317
|
ref={measureRef}
|
|
@@ -85,9 +85,9 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
85
85
|
return (
|
|
86
86
|
<ErrorBoundary>
|
|
87
87
|
<div
|
|
88
|
-
className={cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-
|
|
89
|
-
"text-
|
|
90
|
-
"hover:bg-
|
|
88
|
+
className={cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-surface-50 dark:bg-surface-900",
|
|
89
|
+
"text-text-secondary hover:text-text-primary dark:text-text-secondary-dark dark:hover:text-text-primary-dark",
|
|
90
|
+
"hover:bg-surface-100 dark:hover:bg-surface-800 hover:bg-opacity-50 dark:hover:bg-opacity-50",
|
|
91
91
|
column.frozen ? "sticky left-0 z-10" : "relative z-0"
|
|
92
92
|
)}
|
|
93
93
|
style={{
|
|
@@ -130,7 +130,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
130
130
|
invisible={!sort}>
|
|
131
131
|
<IconButton
|
|
132
132
|
size={"small"}
|
|
133
|
-
className={onHover || openFilter ? "bg-white dark:bg-
|
|
133
|
+
className={onHover || openFilter ? "bg-white dark:bg-surface-950" : undefined}
|
|
134
134
|
onClick={() => {
|
|
135
135
|
onColumnSort(column.key as Extract<keyof M, string>);
|
|
136
136
|
}}
|
|
@@ -157,7 +157,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
157
157
|
modal={true}
|
|
158
158
|
trigger={
|
|
159
159
|
<IconButton
|
|
160
|
-
className={onHover || openFilter ? "bg-white dark:bg-
|
|
160
|
+
className={onHover || openFilter ? "bg-white dark:bg-surface-950" : undefined}
|
|
161
161
|
size={"small"}
|
|
162
162
|
onClick={handleSettingsClick}>
|
|
163
163
|
<FilterListIcon size={"small"}/>
|
|
@@ -181,7 +181,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
181
181
|
ref={resizeHandleRef}
|
|
182
182
|
className={cls(
|
|
183
183
|
"absolute h-full w-[6px] top-0 right-0 cursor-col-resize",
|
|
184
|
-
hovered && "bg-
|
|
184
|
+
hovered && "bg-surface-300 dark:bg-surface-700"
|
|
185
185
|
)}
|
|
186
186
|
onMouseDown={onClickResizeColumn ? () => onClickResizeColumn(columnIndex, column) : undefined}
|
|
187
187
|
/>}
|
|
@@ -238,9 +238,9 @@ function FilterForm<M>({
|
|
|
238
238
|
e.preventDefault();
|
|
239
239
|
submit();
|
|
240
240
|
}}
|
|
241
|
-
className={"text-
|
|
241
|
+
className={"text-surface-900 dark:text-white"}>
|
|
242
242
|
<div
|
|
243
|
-
className={cls(defaultBorderMixin, "py-4 px-6
|
|
243
|
+
className={cls(defaultBorderMixin, "py-4 px-6 typography-label border-b")}>
|
|
244
244
|
{column.title ?? id}
|
|
245
245
|
</div>
|
|
246
246
|
{filterField && <div className="m-4">
|
|
@@ -100,7 +100,7 @@ export const VirtualTableHeaderRow = ({
|
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
102
|
<div
|
|
103
|
-
className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 h-12 border-b bg-
|
|
103
|
+
className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 h-12 border-b bg-surface-50 dark:bg-surface-900")}>
|
|
104
104
|
{columns.map((c, columnIndex) => {
|
|
105
105
|
const column = columns[columnIndex];
|
|
106
106
|
|
|
@@ -82,6 +82,16 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
82
82
|
*/
|
|
83
83
|
onFilterUpdate?: (filter?: VirtualTableFilterValues<any> | undefined) => void;
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Callback when the table is scrolled
|
|
87
|
+
* @param props
|
|
88
|
+
*/
|
|
89
|
+
onScroll?: (props: {
|
|
90
|
+
scrollDirection: "forward" | "backward",
|
|
91
|
+
scrollOffset: number,
|
|
92
|
+
scrollUpdateWasRequested: boolean
|
|
93
|
+
}) => void;
|
|
94
|
+
|
|
85
95
|
/**
|
|
86
96
|
* Default sort applied to this collection
|
|
87
97
|
*/
|
|
@@ -147,6 +157,11 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
147
157
|
*/
|
|
148
158
|
AddColumnComponent?: React.ComponentType;
|
|
149
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Initial scroll position
|
|
162
|
+
*/
|
|
163
|
+
initialScroll?: number;
|
|
164
|
+
|
|
150
165
|
/**
|
|
151
166
|
* Debug mode
|
|
152
167
|
*/
|
|
@@ -29,7 +29,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
29
29
|
return (
|
|
30
30
|
<div
|
|
31
31
|
className={cls(
|
|
32
|
-
"flex min-w-full text-sm border-b border-
|
|
32
|
+
"flex min-w-full text-sm border-b border-surface-200 dark:border-surface-800 border-opacity-40 dark:border-opacity-40",
|
|
33
33
|
rowClassName ? rowClassName(rowData) : "",
|
|
34
34
|
{
|
|
35
35
|
"hover:bg-opacity-95": hoverRow,
|
|
@@ -26,7 +26,7 @@ export function VirtualTableDateField(props: {
|
|
|
26
26
|
<DateTimeField
|
|
27
27
|
value={internalValue ?? undefined}
|
|
28
28
|
onChange={(dateValue) => updateValue(dateValue ?? null)}
|
|
29
|
-
size={"
|
|
29
|
+
size={"large"}
|
|
30
30
|
invisible={true}
|
|
31
31
|
inputClassName={cls("w-full h-full", focusedDisabled)}
|
|
32
32
|
className={cls("w-full h-full", focusedDisabled)}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeleteIcon, EditIcon, FileCopyIcon } from "@firecms/ui";
|
|
2
2
|
import { EntityAction } from "../../types";
|
|
3
3
|
import { DeleteEntityDialog } from "../DeleteEntityDialog";
|
|
4
4
|
import { addRecentId } from "../EntityCollectionView/utils";
|
|
5
|
+
import { navigateToEntity } from "../../util";
|
|
5
6
|
|
|
6
7
|
export const editEntityAction: EntityAction = {
|
|
7
8
|
icon: <EditIcon/>,
|
|
9
|
+
key: "edit",
|
|
8
10
|
name: "Edit",
|
|
9
11
|
collapsed: false,
|
|
10
12
|
onClick({
|
|
@@ -14,23 +16,31 @@ export const editEntityAction: EntityAction = {
|
|
|
14
16
|
context,
|
|
15
17
|
highlightEntity,
|
|
16
18
|
unhighlightEntity,
|
|
19
|
+
openEntityMode
|
|
17
20
|
}): Promise<void> {
|
|
21
|
+
|
|
18
22
|
highlightEntity?.(entity);
|
|
23
|
+
|
|
19
24
|
context.analyticsController?.onAnalyticsEvent?.("entity_click", {
|
|
20
25
|
path: entity.path,
|
|
21
26
|
entityId: entity.id
|
|
22
27
|
});
|
|
28
|
+
|
|
23
29
|
if (collection) {
|
|
24
30
|
addRecentId(collection.id, entity.id);
|
|
25
31
|
}
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
|
|
33
|
+
const path = collection?.collectionGroup ? entity.path : (fullPath ?? entity.path)
|
|
34
|
+
navigateToEntity({
|
|
35
|
+
openEntityMode,
|
|
36
|
+
collection,
|
|
28
37
|
entityId: entity.id,
|
|
29
38
|
path,
|
|
30
|
-
|
|
31
|
-
updateUrl: true,
|
|
39
|
+
sideEntityController: context.sideEntityController,
|
|
32
40
|
onClose: () => unhighlightEntity?.(entity),
|
|
41
|
+
navigation: context.navigation
|
|
33
42
|
});
|
|
43
|
+
|
|
34
44
|
return Promise.resolve(undefined);
|
|
35
45
|
}
|
|
36
46
|
}
|
|
@@ -38,55 +48,33 @@ export const editEntityAction: EntityAction = {
|
|
|
38
48
|
export const copyEntityAction: EntityAction = {
|
|
39
49
|
icon: <FileCopyIcon/>,
|
|
40
50
|
name: "Copy",
|
|
51
|
+
key: "copy",
|
|
41
52
|
onClick({
|
|
42
53
|
entity,
|
|
43
54
|
collection,
|
|
44
55
|
context,
|
|
56
|
+
fullPath,
|
|
45
57
|
highlightEntity,
|
|
46
58
|
unhighlightEntity,
|
|
59
|
+
openEntityMode
|
|
47
60
|
}): Promise<void> {
|
|
48
61
|
highlightEntity?.(entity);
|
|
49
62
|
context.analyticsController?.onAnalyticsEvent?.("copy_entity_click", {
|
|
50
63
|
path: entity.path,
|
|
51
64
|
entityId: entity.id
|
|
52
65
|
});
|
|
53
|
-
|
|
66
|
+
const path = collection?.collectionGroup ? entity.path : (fullPath ?? entity.path)
|
|
67
|
+
navigateToEntity({
|
|
68
|
+
openEntityMode,
|
|
69
|
+
collection,
|
|
54
70
|
entityId: entity.id,
|
|
55
|
-
path
|
|
71
|
+
path,
|
|
56
72
|
copy: true,
|
|
57
|
-
|
|
58
|
-
updateUrl: true,
|
|
73
|
+
sideEntityController: context.sideEntityController,
|
|
59
74
|
onClose: () => unhighlightEntity?.(entity),
|
|
75
|
+
navigation: context.navigation
|
|
60
76
|
});
|
|
61
|
-
return Promise.resolve(undefined);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const archiveEntityAction: EntityAction = {
|
|
66
|
-
icon: <ArchiveIcon/>,
|
|
67
|
-
name: "Archive",
|
|
68
|
-
onClick({
|
|
69
|
-
entity,
|
|
70
|
-
collection,
|
|
71
|
-
context: {
|
|
72
|
-
dataSource,
|
|
73
|
-
}
|
|
74
|
-
}): Promise<void> {
|
|
75
|
-
// Add your code here
|
|
76
|
-
return Promise.resolve(undefined);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
77
|
|
|
80
|
-
export const openWebsiteAction: EntityAction = {
|
|
81
|
-
icon: <OpenInNewIcon/>,
|
|
82
|
-
name: "See in website",
|
|
83
|
-
onClick({
|
|
84
|
-
entity,
|
|
85
|
-
collection,
|
|
86
|
-
context,
|
|
87
|
-
}): Promise<void> {
|
|
88
|
-
// open a new tab
|
|
89
|
-
window.open(`https://example.com/${entity.id}`, "_blank");
|
|
90
78
|
return Promise.resolve(undefined);
|
|
91
79
|
}
|
|
92
80
|
}
|
|
@@ -94,6 +82,7 @@ export const openWebsiteAction: EntityAction = {
|
|
|
94
82
|
export const deleteEntityAction: EntityAction = {
|
|
95
83
|
icon: <DeleteIcon/>,
|
|
96
84
|
name: "Delete",
|
|
85
|
+
key: "delete",
|
|
97
86
|
onClick({
|
|
98
87
|
entity,
|
|
99
88
|
fullPath,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
2
|
export * from "./useDebouncedData";
|
|
3
3
|
export * from "./useColumnsIds";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./useDataSourceTableController";
|
|
5
5
|
export * from "./useTableSearchHelper";
|
|
6
6
|
export * from "./default_entity_actions";
|
|
@@ -3,7 +3,7 @@ import { EntityCollection, ResolvedEntityCollection, ResolvedProperty } from "..
|
|
|
3
3
|
import { getSubcollectionColumnId } from "../EntityCollectionTable/internal/common";
|
|
4
4
|
import { PropertyColumnConfig } from "../EntityCollectionTable/EntityCollectionTableProps";
|
|
5
5
|
|
|
6
|
-
const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
6
|
+
export 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(() => {
|