@firecms/core 3.0.0-canary.99 → 3.0.0-rc.2
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 +2 -2
- package/dist/app/Drawer.d.ts +0 -1
- package/dist/app/Scaffold.d.ts +4 -0
- package/dist/components/ArrayContainer.d.ts +31 -12
- package/dist/components/{DeleteConfirmationDialog.d.ts → ConfirmationDialog.d.ts} +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +3 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +17 -3
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +1 -1
- 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 +8 -0
- package/dist/components/EntityCollectionView/utils.d.ts +3 -0
- package/dist/components/EntityJsonPreview.d.ts +3 -0
- package/dist/components/EntityPreview.d.ts +8 -6
- package/dist/components/HomePage/DefaultHomePage.d.ts +2 -15
- package/dist/components/HomePage/HomePageDnD.d.ts +76 -0
- package/dist/components/HomePage/NavigationCard.d.ts +3 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +3 -2
- package/dist/components/HomePage/NavigationGroup.d.ts +8 -1
- package/dist/components/HomePage/RenameGroupDialog.d.ts +9 -0
- package/dist/components/PropertyConfigBadge.d.ts +2 -1
- package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +13 -3
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +1 -1
- package/dist/components/UnsavedChangesDialog.d.ts +8 -0
- package/dist/components/UserDisplay.d.ts +7 -0
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +11 -2
- package/dist/components/VirtualTable/fields/VirtualTableUserSelect.d.ts +12 -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/components/index.d.ts +3 -1
- package/dist/contexts/BreacrumbsContext.d.ts +8 -0
- package/dist/contexts/InternalUserManagementContext.d.ts +3 -0
- package/dist/core/DefaultAppBar.d.ts +8 -2
- package/dist/core/DrawerNavigationItem.d.ts +2 -1
- package/dist/core/EntityEditView.d.ts +40 -22
- package/dist/core/EntityEditViewFormActions.d.ts +2 -0
- package/dist/core/FireCMS.d.ts +2 -3
- 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/field_configs.d.ts +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/form/EntityForm.d.ts +50 -0
- package/dist/form/EntityFormActions.d.ts +21 -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/LabelWithIcon.d.ts +1 -1
- package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
- package/dist/form/components/index.d.ts +3 -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/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
- package/dist/form/field_bindings/{MultiSelectBinding.d.ts → MultiSelectFieldBinding.d.ts} +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +9 -0
- 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/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +4 -10
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +12 -0
- package/dist/form/index.d.ts +17 -16
- package/dist/form/useClearRestoreValue.d.ts +2 -2
- 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/index.d.ts +2 -0
- package/dist/hooks/useAuthController.d.ts +1 -1
- package/dist/hooks/useBreadcrumbsController.d.ts +26 -0
- package/dist/hooks/useBuildNavigationController.d.ts +57 -12
- package/dist/hooks/useCollapsedGroups.d.ts +9 -0
- package/dist/hooks/useFireCMSContext.d.ts +1 -1
- package/dist/hooks/useInternalUserManagementController.d.ts +12 -0
- package/dist/hooks/useModeController.d.ts +1 -2
- package/dist/hooks/useProjectLog.d.ts +7 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
- package/dist/index.es.js +20480 -14434
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +20250 -14209
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +3 -2
- package/dist/internal/useBuildSideEntityController.d.ts +3 -3
- 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/components/ReferencePreview.d.ts +2 -2
- package/dist/preview/components/UserPreview.d.ts +8 -0
- package/dist/preview/index.d.ts +1 -0
- 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/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +7 -9
- package/dist/types/collections.d.ts +88 -25
- package/dist/types/customization_controller.d.ts +8 -0
- package/dist/types/datasource.d.ts +19 -17
- package/dist/types/dialogs_controller.d.ts +7 -3
- package/dist/types/entities.d.ts +7 -2
- package/dist/types/entity_actions.d.ts +58 -8
- package/dist/types/entity_callbacks.d.ts +16 -16
- package/dist/types/entity_overrides.d.ts +2 -2
- package/dist/types/export_import.d.ts +4 -4
- package/dist/types/fields.d.ts +43 -17
- package/dist/types/firecms.d.ts +31 -3
- package/dist/types/firecms_context.d.ts +17 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/internal_user_management.d.ts +20 -0
- package/dist/types/navigation.d.ts +60 -17
- package/dist/types/permissions.d.ts +4 -4
- package/dist/types/plugins.d.ts +44 -9
- package/dist/types/properties.d.ts +74 -22
- package/dist/types/property_config.d.ts +1 -3
- package/dist/types/roles.d.ts +3 -0
- package/dist/types/side_dialogs_controller.d.ts +10 -0
- package/dist/types/side_entity_controller.d.ts +14 -1
- package/dist/types/storage.d.ts +75 -0
- package/dist/types/user.d.ts +2 -1
- package/dist/util/builders.d.ts +3 -3
- package/dist/util/callbacks.d.ts +2 -0
- package/dist/util/createFormexStub.d.ts +2 -0
- package/dist/util/entities.d.ts +2 -2
- 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 +5 -2
- package/dist/util/index.d.ts +3 -0
- package/dist/util/navigation_from_path.d.ts +10 -1
- package/dist/util/navigation_utils.d.ts +13 -1
- package/dist/util/objects.d.ts +2 -1
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/property_utils.d.ts +4 -4
- package/dist/util/references.d.ts +2 -2
- package/dist/util/resolutions.d.ts +30 -6
- package/dist/util/storage.d.ts +1 -1
- package/dist/util/useStorageUploadController.d.ts +2 -2
- package/package.json +133 -125
- package/src/app/Drawer.tsx +0 -1
- package/src/app/Scaffold.tsx +33 -29
- package/src/components/ArrayContainer.tsx +447 -229
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +1 -1
- package/src/components/{DeleteConfirmationDialog.tsx → ConfirmationDialog.tsx} +12 -11
- package/src/components/DeleteEntityDialog.tsx +13 -20
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +59 -25
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +23 -17
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +20 -3
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +47 -9
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +21 -16
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +6 -12
- package/src/components/EntityCollectionTable/index.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +6 -6
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +35 -26
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +20 -8
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +132 -101
- package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +9 -9
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +178 -85
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +7 -4
- package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
- package/src/components/EntityCollectionView/utils.ts +19 -0
- package/src/components/EntityJsonPreview.tsx +66 -0
- package/src/components/EntityPreview.tsx +75 -57
- package/src/components/EntityView.tsx +8 -5
- package/src/components/ErrorView.tsx +3 -3
- package/src/components/FireCMSLogo.tsx +7 -51
- package/src/components/HomePage/DefaultHomePage.tsx +506 -161
- package/src/components/HomePage/FavouritesView.tsx +9 -14
- package/src/components/HomePage/HomePageDnD.tsx +600 -0
- package/src/components/HomePage/NavigationCard.tsx +47 -38
- package/src/components/HomePage/NavigationCardBinding.tsx +16 -15
- package/src/components/HomePage/NavigationGroup.tsx +144 -30
- package/src/components/HomePage/RenameGroupDialog.tsx +123 -0
- package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
- package/src/components/NotFoundPage.tsx +2 -2
- package/src/components/PropertyConfigBadge.tsx +10 -4
- package/src/components/PropertyIdCopyTooltip.tsx +47 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +22 -13
- package/src/components/SearchIconsView.tsx +2 -2
- package/src/components/SelectableTable/SelectableTable.tsx +154 -142
- 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 +60 -11
- package/src/components/UnsavedChangesDialog.tsx +46 -0
- package/src/components/UserDisplay.tsx +55 -0
- package/src/components/VirtualTable/VirtualTable.tsx +65 -44
- package/src/components/VirtualTable/VirtualTableCell.tsx +0 -8
- package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableProps.tsx +12 -2
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +4 -4
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -2
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +16 -28
- package/src/components/VirtualTable/fields/VirtualTableUserSelect.tsx +99 -0
- package/src/components/common/default_entity_actions.tsx +62 -42
- package/src/components/common/index.ts +1 -1
- package/src/components/common/useColumnsIds.tsx +2 -9
- 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/components/common/useTableSearchHelper.ts +1 -0
- package/src/components/index.tsx +4 -1
- package/src/contexts/BreacrumbsContext.tsx +38 -0
- package/src/contexts/DialogsProvider.tsx +3 -2
- package/src/contexts/InternalUserManagementContext.tsx +4 -0
- package/src/contexts/ModeController.tsx +1 -3
- package/src/contexts/SnackbarProvider.tsx +2 -0
- package/src/core/DefaultAppBar.tsx +124 -85
- package/src/core/DefaultDrawer.tsx +30 -22
- package/src/core/DrawerNavigationItem.tsx +32 -28
- package/src/core/EntityEditView.tsx +388 -995
- package/src/core/EntityEditViewFormActions.tsx +329 -0
- package/src/core/EntitySidePanel.tsx +88 -20
- package/src/core/FireCMS.tsx +58 -28
- package/src/core/FireCMSRouter.tsx +17 -0
- package/src/core/NavigationRoutes.tsx +23 -32
- package/src/core/SideDialogs.tsx +22 -12
- package/src/core/field_configs.tsx +39 -11
- package/src/core/index.tsx +4 -2
- package/src/form/EntityForm.tsx +814 -0
- package/src/form/EntityFormActions.tsx +211 -0
- package/src/form/PropertyFieldBinding.tsx +59 -41
- package/src/form/components/CustomIdField.tsx +9 -3
- package/src/form/components/FieldHelperText.tsx +1 -1
- package/src/form/components/FormEntry.tsx +22 -0
- package/src/form/components/FormLayout.tsx +16 -0
- package/src/form/components/LabelWithIcon.tsx +30 -19
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/StorageItemPreview.tsx +5 -4
- package/src/form/components/StorageUploadProgress.tsx +2 -3
- package/src/form/components/index.tsx +3 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +30 -18
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +47 -36
- package/src/form/field_bindings/BlockFieldBinding.tsx +55 -33
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +18 -14
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +19 -15
- package/src/form/field_bindings/MapFieldBinding.tsx +72 -62
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +159 -0
- package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +26 -21
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +10 -8
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +135 -0
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +28 -19
- package/src/form/field_bindings/RepeatFieldBinding.tsx +56 -32
- package/src/form/field_bindings/SelectFieldBinding.tsx +22 -13
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +247 -168
- package/src/form/field_bindings/SwitchFieldBinding.tsx +29 -24
- package/src/form/field_bindings/TextFieldBinding.tsx +28 -24
- package/src/form/field_bindings/UserSelectFieldBinding.tsx +94 -0
- package/src/form/index.tsx +17 -37
- package/src/form/useClearRestoreValue.tsx +2 -2
- package/src/form/validation.ts +12 -6
- package/src/hooks/data/delete.ts +6 -5
- package/src/hooks/data/save.ts +26 -35
- package/src/hooks/data/useCollectionFetch.tsx +3 -3
- package/src/hooks/data/useDataSource.tsx +10 -2
- package/src/hooks/data/useEntityFetch.tsx +10 -6
- package/src/hooks/index.tsx +3 -0
- package/src/hooks/useAuthController.tsx +1 -1
- package/src/hooks/useBreadcrumbsController.tsx +31 -0
- package/src/hooks/useBrowserTitleAndIcon.tsx +1 -1
- package/src/hooks/useBuildModeController.tsx +15 -28
- package/src/hooks/useBuildNavigationController.tsx +386 -124
- package/src/hooks/useCollapsedGroups.ts +64 -0
- package/src/hooks/useFireCMSContext.tsx +9 -35
- package/src/hooks/useInternalUserManagementController.tsx +16 -0
- package/src/hooks/useLargeLayout.tsx +0 -35
- package/src/hooks/useModeController.tsx +1 -2
- package/src/hooks/useProjectLog.tsx +16 -5
- package/src/hooks/useResolvedNavigationFrom.tsx +9 -11
- package/src/hooks/useValidateAuthenticator.tsx +3 -3
- package/src/internal/useBuildDataSource.ts +67 -80
- package/src/internal/useBuildSideDialogsController.tsx +4 -2
- package/src/internal/useBuildSideEntityController.tsx +149 -86
- package/src/internal/useUnsavedChangesDialog.tsx +127 -91
- package/src/preview/PropertyPreview.tsx +36 -12
- 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 +10 -9
- package/src/preview/components/ReferencePreview.tsx +10 -18
- package/src/preview/components/UrlComponentPreview.tsx +20 -21
- package/src/preview/components/UserPreview.tsx +27 -0
- package/src/preview/index.ts +1 -0
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +6 -5
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +5 -4
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +5 -3
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +4 -3
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +6 -4
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +6 -4
- package/src/preview/property_previews/MapPropertyPreview.tsx +7 -6
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +13 -13
- 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 +246 -0
- package/src/routes/HomePageRoute.tsx +17 -0
- package/src/types/analytics.ts +3 -0
- package/src/types/auth.tsx +8 -12
- package/src/types/collections.ts +103 -28
- package/src/types/customization_controller.tsx +9 -0
- package/src/types/datasource.ts +21 -20
- package/src/types/dialogs_controller.tsx +7 -3
- package/src/types/entities.ts +10 -2
- package/src/types/entity_actions.tsx +71 -8
- package/src/types/entity_callbacks.ts +18 -18
- package/src/types/entity_overrides.tsx +2 -2
- package/src/types/export_import.ts +4 -4
- package/src/types/fields.tsx +52 -19
- package/src/types/firecms.tsx +34 -4
- package/src/types/firecms_context.tsx +18 -1
- package/src/types/index.ts +1 -0
- package/src/types/internal_user_management.ts +24 -0
- package/src/types/navigation.ts +76 -22
- package/src/types/permissions.ts +5 -5
- package/src/types/plugins.tsx +53 -9
- package/src/types/properties.ts +84 -22
- package/src/types/property_config.tsx +2 -2
- package/src/types/roles.ts +3 -0
- package/src/types/side_dialogs_controller.tsx +15 -0
- package/src/types/side_entity_controller.tsx +16 -1
- package/src/types/storage.ts +82 -0
- package/src/types/user.ts +3 -1
- package/src/util/builders.ts +10 -8
- package/src/util/callbacks.ts +119 -0
- package/src/util/createFormexStub.tsx +62 -0
- package/src/util/entities.ts +6 -4
- package/src/util/entity_actions.ts +28 -0
- package/src/util/entity_cache.ts +204 -0
- package/src/util/icon_list.ts +1 -1
- package/src/util/icon_synonyms.ts +0 -1
- package/src/util/icons.tsx +36 -11
- package/src/util/index.ts +3 -0
- package/src/util/join_collections.ts +9 -2
- package/src/util/make_properties_editable.ts +13 -5
- package/src/util/navigation_from_path.ts +33 -12
- package/src/util/navigation_utils.ts +135 -19
- package/src/util/objects.ts +74 -14
- package/src/util/parent_references_from_path.ts +3 -3
- package/src/util/permissions.ts +8 -8
- package/src/util/property_utils.tsx +17 -6
- package/src/util/references.ts +19 -8
- package/src/util/resolutions.ts +93 -24
- package/src/util/storage.ts +6 -2
- package/src/util/useStorageUploadController.tsx +74 -29
- package/dist/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +0 -5
- package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
- package/dist/form/PropertiesForm.d.ts +0 -8
- package/dist/form/components/FormikArrayContainer.d.ts +0 -18
- package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
- package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.tsx +0 -59
- package/src/components/PropertyIdCopyTooltipContent.tsx +0 -27
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +0 -236
- package/src/form/PropertiesForm.tsx +0 -81
- package/src/form/components/FormikArrayContainer.tsx +0 -44
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
- /package/src/util/{common.tsx → common.ts} +0 -0
|
@@ -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,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "../../hooks";
|
|
17
17
|
import { ErrorView } from "../ErrorView";
|
|
18
18
|
import { AddIcon, Button, DialogActions, Typography } from "@firecms/ui";
|
|
19
|
-
import { canCreateEntity,
|
|
19
|
+
import { canCreateEntity, IconForView, resolveCollection } from "../../util";
|
|
20
20
|
import { useSelectionController } from "../EntityCollectionView/useSelectionController";
|
|
21
21
|
import { useColumnIds, useTableSearchHelper } from "../common";
|
|
22
22
|
import { useSideDialogContext } from "../../core";
|
|
@@ -101,13 +101,14 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
101
101
|
maxSelection,
|
|
102
102
|
}: ReferenceSelectionInnerProps<M>) {
|
|
103
103
|
|
|
104
|
+
const authController = useAuthController();
|
|
104
105
|
const sideDialogContext = useSideDialogContext();
|
|
105
106
|
const sideEntityController = useSideEntityController();
|
|
106
107
|
const navigation = useNavigationController();
|
|
107
108
|
const analyticsController = useAnalyticsController();
|
|
108
109
|
const customizationController = useCustomizationController();
|
|
109
110
|
|
|
110
|
-
const fullPath = navigation.
|
|
111
|
+
const fullPath = navigation.resolveIdsFrom(pathInput);
|
|
111
112
|
|
|
112
113
|
const dataSource = useDataSource(collection);
|
|
113
114
|
|
|
@@ -233,7 +234,9 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
233
234
|
selectionEnabled={multiselect}
|
|
234
235
|
hideId={collection?.hideIdFromCollection}
|
|
235
236
|
fullPath={fullPath}
|
|
236
|
-
selectionController={selectionController}
|
|
237
|
+
selectionController={selectionController}
|
|
238
|
+
openEntityMode={"side_panel"}
|
|
239
|
+
/>;
|
|
237
240
|
|
|
238
241
|
};
|
|
239
242
|
|
|
@@ -247,23 +250,22 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
247
250
|
error={"Could not find collection with id " + collection}/>
|
|
248
251
|
}
|
|
249
252
|
|
|
250
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
251
253
|
const resolvedCollection = useMemo(() => resolveCollection({
|
|
252
254
|
collection: collection,
|
|
253
255
|
path: fullPath,
|
|
254
256
|
values: {},
|
|
255
|
-
|
|
257
|
+
propertyConfigs: customizationController.propertyConfigs,
|
|
258
|
+
authController
|
|
256
259
|
}), [collection, customizationController.propertyConfigs, fullPath]);
|
|
257
260
|
|
|
258
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
259
261
|
const displayedColumnIds = useColumnIds(resolvedCollection, false);
|
|
260
262
|
|
|
261
|
-
|
|
262
|
-
const tableController = useDataSourceEntityCollectionTableController<M>({
|
|
263
|
+
const tableController = useDataSourceTableController<M>({
|
|
263
264
|
fullPath,
|
|
264
265
|
collection,
|
|
265
266
|
entitiesDisplayedFirst,
|
|
266
|
-
forceFilter
|
|
267
|
+
forceFilter,
|
|
268
|
+
updateUrl: false,
|
|
267
269
|
});
|
|
268
270
|
|
|
269
271
|
const {
|
|
@@ -272,7 +274,6 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
272
274
|
onTextSearchClick,
|
|
273
275
|
textSearchEnabled
|
|
274
276
|
} =
|
|
275
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
276
277
|
useTableSearchHelper({
|
|
277
278
|
collection,
|
|
278
279
|
fullPath,
|
|
@@ -288,13 +289,21 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
288
289
|
textSearchLoading={textSearchLoading}
|
|
289
290
|
onTextSearchClick={textSearchInitialised ? undefined : onTextSearchClick}
|
|
290
291
|
textSearchEnabled={textSearchEnabled}
|
|
292
|
+
additionalFields={collection.additionalFields}
|
|
291
293
|
displayedColumnIds={displayedColumnIds}
|
|
292
294
|
onEntityClick={onEntityClick}
|
|
293
295
|
tableController={tableController}
|
|
294
296
|
enablePopupIcon={false}
|
|
295
297
|
tableRowActionsBuilder={tableRowActionsBuilder}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
+
openEntityMode={"side_panel"}
|
|
299
|
+
title={<Typography variant={"subtitle2"} className={"flex flex-row gap-2"}>
|
|
300
|
+
<IconForView
|
|
301
|
+
size={"small"}
|
|
302
|
+
collectionOrView={collection}
|
|
303
|
+
className={"text-surface-300 dark:text-surface-600"}/>
|
|
304
|
+
{collection.singularName
|
|
305
|
+
? `Select ${collection.singularName}`
|
|
306
|
+
: `Select from ${collection.name}`}
|
|
298
307
|
</Typography>}
|
|
299
308
|
defaultSize={collection.defaultSize}
|
|
300
309
|
properties={resolvedCollection.properties}
|
|
@@ -46,7 +46,6 @@ export function SearchIconsView({
|
|
|
46
46
|
}, [query, updateSearchResults]);
|
|
47
47
|
|
|
48
48
|
const icons = keys === null ? coolIconKeys : keys;
|
|
49
|
-
console.log("Icons", icons);
|
|
50
49
|
|
|
51
50
|
return (
|
|
52
51
|
<>
|
|
@@ -60,7 +59,8 @@ export function SearchIconsView({
|
|
|
60
59
|
<div className={"flex max-w-full flex-wrap mt-4"}>
|
|
61
60
|
{icons.map((icon: string) => {
|
|
62
61
|
return (
|
|
63
|
-
<Tooltip title={icon} key={icon}
|
|
62
|
+
<Tooltip title={icon} key={icon}
|
|
63
|
+
asChild={true}>
|
|
64
64
|
<IconButton
|
|
65
65
|
shape={"square"}
|
|
66
66
|
toggled={selectedIcon === icon}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import equal from "react-fast-compare";
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
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,153 +112,154 @@ 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
|
|
108
119
|
* @see VirtualTable
|
|
109
120
|
* @group Components
|
|
110
121
|
*/
|
|
111
|
-
export const SelectableTable =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
122
|
+
export const SelectableTable = function SelectableTable<M extends Record<string, any>>
|
|
123
|
+
({
|
|
124
|
+
onValueChange,
|
|
125
|
+
cellRenderer,
|
|
126
|
+
onEntityClick,
|
|
127
|
+
onColumnResize,
|
|
128
|
+
hoverRow = true,
|
|
129
|
+
size = "m",
|
|
130
|
+
inlineEditing = false,
|
|
131
|
+
tableController:
|
|
132
|
+
{
|
|
133
|
+
data,
|
|
134
|
+
dataLoading,
|
|
135
|
+
noMoreToLoad,
|
|
136
|
+
dataLoadingError,
|
|
137
|
+
filterValues,
|
|
138
|
+
setFilterValues,
|
|
139
|
+
sortBy,
|
|
140
|
+
setSortBy,
|
|
141
|
+
itemCount,
|
|
142
|
+
setItemCount,
|
|
143
|
+
pageSize = 50,
|
|
144
|
+
paginationEnabled,
|
|
145
|
+
checkFilterCombination,
|
|
146
|
+
setPopupCell
|
|
147
|
+
},
|
|
148
|
+
filterable = true,
|
|
149
|
+
onScroll,
|
|
150
|
+
initialScroll,
|
|
151
|
+
emptyComponent,
|
|
152
|
+
columns,
|
|
153
|
+
forceFilter,
|
|
154
|
+
highlightedRow,
|
|
155
|
+
endAdornment,
|
|
156
|
+
AddColumnComponent
|
|
157
|
+
}: SelectableTableProps<M>) {
|
|
158
|
+
|
|
159
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
160
|
+
|
|
161
|
+
const [selectedCell, setSelectedCell] = React.useState<SelectedCellProps<M> | undefined>(undefined);
|
|
162
|
+
|
|
163
|
+
const loadNextPage = () => {
|
|
164
|
+
if (!paginationEnabled || dataLoading || noMoreToLoad)
|
|
165
|
+
return;
|
|
166
|
+
if (itemCount !== undefined)
|
|
167
|
+
setItemCount?.(itemCount + pageSize);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const resetPagination = useCallback(() => {
|
|
171
|
+
setItemCount?.(pageSize);
|
|
172
|
+
}, [pageSize]);
|
|
173
|
+
|
|
174
|
+
const onRowClick = useCallback(({ rowData }: {
|
|
175
|
+
rowData: Entity<M>
|
|
176
|
+
}) => {
|
|
177
|
+
if (inlineEditing)
|
|
178
|
+
return;
|
|
179
|
+
return onEntityClick && onEntityClick(rowData);
|
|
180
|
+
}, [onEntityClick, inlineEditing]);
|
|
181
|
+
|
|
182
|
+
useOutsideAlerter(ref,
|
|
183
|
+
() => {
|
|
184
|
+
if (selectedCell) {
|
|
185
|
+
unselect();
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
Boolean(selectedCell));
|
|
189
|
+
|
|
190
|
+
const select = useCallback((cell?: SelectedCellProps<M>) => {
|
|
191
|
+
setSelectedCell(cell);
|
|
192
|
+
}, []);
|
|
193
|
+
|
|
194
|
+
const unselect = useCallback(() => {
|
|
195
|
+
setSelectedCell(undefined);
|
|
196
|
+
}, []);
|
|
197
|
+
|
|
198
|
+
// on ESC key press
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
const escFunction = (event: any) => {
|
|
201
|
+
if (event.keyCode === 27) {
|
|
202
|
+
unselect();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
document.addEventListener("keydown", escFunction, false);
|
|
206
|
+
return () => {
|
|
207
|
+
document.removeEventListener("keydown", escFunction, false);
|
|
156
208
|
};
|
|
209
|
+
}, [unselect]);
|
|
210
|
+
|
|
211
|
+
const onFilterUpdate = useCallback((updatedFilterValues?: FilterValues<any>) => {
|
|
212
|
+
setFilterValues?.({ ...updatedFilterValues, ...forceFilter } as FilterValues<any>);
|
|
213
|
+
}, [forceFilter]);
|
|
214
|
+
|
|
215
|
+
const contextValue = useMemo(() => ({
|
|
216
|
+
setPopupCell: setPopupCell as ((cell?: SelectedCellProps<M>) => void),
|
|
217
|
+
select,
|
|
218
|
+
onValueChange,
|
|
219
|
+
size: size ?? "m",
|
|
220
|
+
selectedCell
|
|
221
|
+
}), [setPopupCell, select, onValueChange, size, selectedCell]);
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<SelectableTableContext.Provider
|
|
225
|
+
value={contextValue}>
|
|
226
|
+
<div className="h-full w-full flex flex-col bg-white dark:bg-surface-950"
|
|
227
|
+
ref={ref}>
|
|
228
|
+
|
|
229
|
+
<VirtualTable
|
|
230
|
+
data={data}
|
|
231
|
+
columns={columns}
|
|
232
|
+
cellRenderer={cellRenderer}
|
|
233
|
+
onRowClick={inlineEditing ? undefined : (onEntityClick ? onRowClick : undefined)}
|
|
234
|
+
onEndReached={loadNextPage}
|
|
235
|
+
onResetPagination={resetPagination}
|
|
236
|
+
error={dataLoadingError}
|
|
237
|
+
onColumnResize={onColumnResize}
|
|
238
|
+
rowHeight={getRowHeight(size)}
|
|
239
|
+
loading={dataLoading}
|
|
240
|
+
filter={filterValues}
|
|
241
|
+
onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
|
|
242
|
+
sortBy={sortBy}
|
|
243
|
+
onSortByUpdate={setSortBy as ((sortBy?: [string, "asc" | "desc"]) => void)}
|
|
244
|
+
hoverRow={hoverRow}
|
|
245
|
+
initialScroll={initialScroll}
|
|
246
|
+
onScroll={onScroll}
|
|
247
|
+
checkFilterCombination={checkFilterCombination}
|
|
248
|
+
createFilterField={filterable ? createFilterField : undefined}
|
|
249
|
+
rowClassName={useCallback((entity: Entity<M>) => {
|
|
250
|
+
return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
|
|
251
|
+
}, [highlightedRow])}
|
|
252
|
+
className="flex-grow"
|
|
253
|
+
emptyComponent={emptyComponent}
|
|
254
|
+
endAdornment={endAdornment}
|
|
255
|
+
AddColumnComponent={AddColumnComponent}
|
|
256
|
+
/>
|
|
257
|
+
|
|
258
|
+
</div>
|
|
259
|
+
</SelectableTableContext.Provider>
|
|
260
|
+
);
|
|
157
261
|
|
|
158
|
-
|
|
159
|
-
setItemCount?.(pageSize);
|
|
160
|
-
}, [pageSize]);
|
|
161
|
-
|
|
162
|
-
const onRowClick = useCallback(({ rowData }: {
|
|
163
|
-
rowData: Entity<M>
|
|
164
|
-
}) => {
|
|
165
|
-
if (inlineEditing)
|
|
166
|
-
return;
|
|
167
|
-
return onEntityClick && onEntityClick(rowData);
|
|
168
|
-
}, [onEntityClick, inlineEditing]);
|
|
169
|
-
|
|
170
|
-
useOutsideAlerter(ref,
|
|
171
|
-
() => {
|
|
172
|
-
if (selectedCell) {
|
|
173
|
-
unselect();
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
Boolean(selectedCell));
|
|
177
|
-
|
|
178
|
-
// on ESC key press
|
|
179
|
-
useEffect(() => {
|
|
180
|
-
const escFunction = (event: any) => {
|
|
181
|
-
if (event.keyCode === 27) {
|
|
182
|
-
unselect();
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
document.addEventListener("keydown", escFunction, false);
|
|
186
|
-
return () => {
|
|
187
|
-
document.removeEventListener("keydown", escFunction, false);
|
|
188
|
-
};
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
const select = useCallback((cell?: SelectedCellProps<M>) => {
|
|
192
|
-
setSelectedCell(cell);
|
|
193
|
-
}, []);
|
|
194
|
-
|
|
195
|
-
const unselect = useCallback(() => {
|
|
196
|
-
setSelectedCell(undefined);
|
|
197
|
-
}, []);
|
|
198
|
-
|
|
199
|
-
const onFilterUpdate = useCallback((updatedFilterValues?: FilterValues<any>) => {
|
|
200
|
-
setFilterValues?.({ ...updatedFilterValues, ...forceFilter } as FilterValues<any>);
|
|
201
|
-
}, [forceFilter]);
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<SelectableTableContext.Provider
|
|
205
|
-
value={{
|
|
206
|
-
setPopupCell: setPopupCell as ((cell?: SelectedCellProps<M>) => void),
|
|
207
|
-
select,
|
|
208
|
-
onValueChange,
|
|
209
|
-
size: size ?? "m",
|
|
210
|
-
selectedCell,
|
|
211
|
-
}}
|
|
212
|
-
>
|
|
213
|
-
<div className="h-full w-full flex flex-col bg-white dark:bg-gray-950"
|
|
214
|
-
ref={ref}>
|
|
215
|
-
|
|
216
|
-
<VirtualTable
|
|
217
|
-
data={data}
|
|
218
|
-
columns={columns}
|
|
219
|
-
cellRenderer={cellRenderer}
|
|
220
|
-
onRowClick={inlineEditing ? undefined : (onEntityClick ? onRowClick : undefined)}
|
|
221
|
-
onEndReached={loadNextPage}
|
|
222
|
-
onResetPagination={resetPagination}
|
|
223
|
-
error={dataLoadingError}
|
|
224
|
-
onColumnResize={onColumnResize}
|
|
225
|
-
rowHeight={getRowHeight(size)}
|
|
226
|
-
loading={dataLoading}
|
|
227
|
-
filter={filterValues}
|
|
228
|
-
onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
|
|
229
|
-
sortBy={sortBy}
|
|
230
|
-
onSortByUpdate={setSortBy as ((sortBy?: [string, "asc" | "desc"]) => void)}
|
|
231
|
-
hoverRow={hoverRow}
|
|
232
|
-
checkFilterCombination={checkFilterCombination}
|
|
233
|
-
createFilterField={filterable ? createFilterField : undefined}
|
|
234
|
-
rowClassName={useCallback((entity: Entity<M>) => {
|
|
235
|
-
return highlightedRow?.(entity) ? "bg-gray-100 bg-opacity-75 dark:bg-gray-800 dark:bg-opacity-75" : "";
|
|
236
|
-
}, [highlightedRow])}
|
|
237
|
-
className="flex-grow"
|
|
238
|
-
emptyComponent={emptyComponent}
|
|
239
|
-
endAdornment={endAdornment}
|
|
240
|
-
AddColumnComponent={AddColumnComponent}
|
|
241
|
-
/>
|
|
242
|
-
|
|
243
|
-
</div>
|
|
244
|
-
</SelectableTableContext.Provider>
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
},
|
|
248
|
-
() => false,
|
|
249
|
-
// equal
|
|
250
|
-
);
|
|
262
|
+
};
|
|
251
263
|
|
|
252
264
|
function createFilterField({
|
|
253
265
|
id,
|
|
@@ -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"
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { EnumValuesChip } from "../../../preview";
|
|
3
3
|
import { VirtualTableWhereFilterOp } from "../../VirtualTable";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Checkbox,
|
|
6
|
+
CloseIcon,
|
|
7
|
+
IconButton,
|
|
8
|
+
Label,
|
|
9
|
+
MultiSelect,
|
|
10
|
+
MultiSelectItem,
|
|
11
|
+
Select,
|
|
12
|
+
SelectItem,
|
|
13
|
+
TextField
|
|
14
|
+
} from "@firecms/ui";
|
|
5
15
|
import { EnumValueConfig } from "../../../types";
|
|
6
16
|
|
|
7
17
|
interface StringNumberFilterFieldProps {
|
|
@@ -82,11 +92,13 @@ export function StringNumberFilterField({
|
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
const multiple = multipleSelectOperations.includes(operation);
|
|
95
|
+
|
|
85
96
|
return (
|
|
86
97
|
|
|
87
98
|
<div className="flex w-[440px]">
|
|
88
99
|
<div className={"w-[80px]"}>
|
|
89
100
|
<Select value={operation}
|
|
101
|
+
fullWidth={true}
|
|
90
102
|
position={"item-aligned"}
|
|
91
103
|
onValueChange={(value) => {
|
|
92
104
|
updateFilter(value as VirtualTableWhereFilterOp, internalValue);
|
|
@@ -111,31 +123,31 @@ export function StringNumberFilterField({
|
|
|
111
123
|
: evt.target.value;
|
|
112
124
|
updateFilter(operation, val);
|
|
113
125
|
}}
|
|
114
|
-
endAdornment={internalValue && <IconButton
|
|
126
|
+
endAdornment={internalValue !== undefined && internalValue != null && <IconButton
|
|
115
127
|
onClick={(e) => updateFilter(operation, undefined)}>
|
|
116
|
-
<
|
|
128
|
+
<CloseIcon/>
|
|
117
129
|
</IconButton>}
|
|
118
130
|
/>}
|
|
119
131
|
|
|
120
|
-
{enumValues &&
|
|
132
|
+
{enumValues && !multiple &&
|
|
121
133
|
<Select
|
|
122
134
|
position={"item-aligned"}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
: isArray ? [] : ""}
|
|
135
|
+
fullWidth={true}
|
|
136
|
+
value={typeof internalValue === "string" ? internalValue : ""}
|
|
126
137
|
onValueChange={(value) => {
|
|
127
138
|
if (value !== "")
|
|
128
139
|
updateFilter(operation, dataType === "number" ? parseInt(value as string) : value as string)
|
|
129
140
|
}}
|
|
130
|
-
multiple={multiple}
|
|
131
141
|
endAdornment={internalValue && <IconButton
|
|
132
142
|
className="absolute right-2 top-3"
|
|
133
143
|
onClick={(e) => updateFilter(operation, undefined)}>
|
|
134
|
-
<
|
|
144
|
+
<CloseIcon/>
|
|
135
145
|
</IconButton>}
|
|
136
146
|
renderValue={(enumKey) => {
|
|
137
147
|
if (enumKey === null)
|
|
138
148
|
return "Filter for null values";
|
|
149
|
+
if (enumKey === undefined)
|
|
150
|
+
return null;
|
|
139
151
|
|
|
140
152
|
return <EnumValuesChip
|
|
141
153
|
key={`select_value_${name}_${enumKey}`}
|
|
@@ -144,7 +156,7 @@ export function StringNumberFilterField({
|
|
|
144
156
|
size={"small"}/>;
|
|
145
157
|
}}>
|
|
146
158
|
{enumValues.map((enumConfig) => (
|
|
147
|
-
<SelectItem key={`
|
|
159
|
+
<SelectItem key={`select_item_${name}_${enumConfig.id}`}
|
|
148
160
|
value={String(enumConfig.id)}>
|
|
149
161
|
<EnumValuesChip
|
|
150
162
|
enumKey={String(enumConfig.id)}
|
|
@@ -155,8 +167,45 @@ export function StringNumberFilterField({
|
|
|
155
167
|
</Select>
|
|
156
168
|
}
|
|
157
169
|
|
|
170
|
+
{enumValues && multiple &&
|
|
171
|
+
<MultiSelect
|
|
172
|
+
position={"item-aligned"}
|
|
173
|
+
value={Array.isArray(internalValue) ? internalValue.map(e => String(e)) : []}
|
|
174
|
+
onValueChange={(value) => {
|
|
175
|
+
updateFilter(operation, dataType === "number" ? value.map(v => parseInt(v)) : value)
|
|
176
|
+
}}
|
|
177
|
+
multiple={multiple}
|
|
178
|
+
endAdornment={internalValue && <IconButton
|
|
179
|
+
className="absolute right-2 top-3"
|
|
180
|
+
onClick={(e) => updateFilter(operation, undefined)}>
|
|
181
|
+
<CloseIcon/>
|
|
182
|
+
</IconButton>}
|
|
183
|
+
// renderValues={(enumKeys) => {
|
|
184
|
+
// console.log("renderValues", enumKeys);
|
|
185
|
+
// if (enumKeys === null)
|
|
186
|
+
// return "Filter for null values";
|
|
187
|
+
//
|
|
188
|
+
// return enumKeys.map(key => <EnumValuesChip
|
|
189
|
+
// key={`select_value_${name}_${enumKeys}`}
|
|
190
|
+
// enumKey={key}
|
|
191
|
+
// enumValues={enumValues}
|
|
192
|
+
// size={"small"}/>);
|
|
193
|
+
// }}
|
|
194
|
+
>
|
|
195
|
+
{enumValues.map((enumConfig) => (
|
|
196
|
+
<MultiSelectItem key={`select_value_${name}_${enumConfig.id}`}
|
|
197
|
+
value={String(enumConfig.id)}>
|
|
198
|
+
<EnumValuesChip
|
|
199
|
+
enumKey={String(enumConfig.id)}
|
|
200
|
+
enumValues={enumValues}
|
|
201
|
+
size={"small"}/>
|
|
202
|
+
</MultiSelectItem>
|
|
203
|
+
))}
|
|
204
|
+
</MultiSelect>
|
|
205
|
+
}
|
|
206
|
+
|
|
158
207
|
{!isArray && <Label
|
|
159
|
-
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"
|
|
160
209
|
htmlFor="null-filter"
|
|
161
210
|
>
|
|
162
211
|
<Checkbox id="null-filter"
|