@firecms/core 3.0.0-alpha.84 → 3.0.0-beta.10
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 +6 -7
- package/dist/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +16 -0
- package/dist/app/Scaffold.d.ts +30 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app/useApp.d.ts +16 -0
- package/dist/components/ArrayContainer.d.ts +3 -4
- package/dist/components/CircularProgressCenter.d.ts +1 -1
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/{DeleteConfirmationDialog.d.ts → ConfirmationDialog.d.ts} +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +13 -18
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -5
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +7 -13
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +3 -1
- package/dist/components/EntityCollectionTable/index.d.ts +2 -4
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +3 -3
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +13 -4
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
- package/dist/components/EntityCollectionView/utils.d.ts +3 -0
- package/dist/components/EntityPreview.d.ts +26 -7
- package/dist/components/EntityView.d.ts +11 -0
- package/dist/components/ErrorView.d.ts +1 -1
- package/dist/components/FieldCaption.d.ts +5 -0
- package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
- package/dist/components/HomePage/NavigationCard.d.ts +8 -0
- package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +3 -3
- package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
- package/dist/components/HomePage/index.d.ts +3 -1
- package/dist/components/{FieldConfigBadge.d.ts → PropertyConfigBadge.d.ts} +2 -1
- package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
- package/dist/components/{ReferenceSelectionInner.d.ts → ReferenceTable/ReferenceSelectionTable.d.ts} +2 -2
- package/dist/components/ReferenceWidget.d.ts +6 -4
- package/dist/components/{EntityCollectionTable/SimpleEntityCollectionTable.d.ts → SelectableTable/SelectableTable.d.ts} +8 -28
- package/dist/components/SelectableTable/SelectableTableContext.d.ts +4 -0
- package/dist/components/{EntityCollectionTable → SelectableTable}/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +16 -13
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +6 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/{EntityCollectionTable → common}/types.d.ts +11 -6
- package/dist/components/{EntityCollectionView → common}/useColumnsIds.d.ts +2 -1
- package/dist/components/{EntityCollectionTable → common}/useDataSourceEntityCollectionTableController.d.ts +4 -1
- package/dist/components/common/useTableSearchHelper.d.ts +12 -0
- package/dist/components/index.d.ts +14 -8
- package/dist/contexts/AuthControllerContext.d.ts +1 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +10 -0
- package/dist/core/EntityEditView.d.ts +36 -0
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/core/NavigationRoutes.d.ts +3 -3
- package/dist/core/index.d.ts +3 -6
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/CustomIdField.d.ts +2 -1
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/FormikArrayContainer.d.ts +2 -1
- package/dist/{components → form/components}/LabelWithIcon.d.ts +1 -1
- package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
- package/dist/form/components/StorageItemPreview.d.ts +4 -3
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- 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/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/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
- package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
- package/dist/form/index.d.ts +4 -5
- package/dist/form/useClearRestoreValue.d.ts +2 -2
- package/dist/form/validation.d.ts +1 -1
- package/dist/hooks/data/delete.d.ts +2 -2
- package/dist/hooks/data/save.d.ts +2 -3
- package/dist/hooks/data/useDataSource.d.ts +2 -2
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/index.d.ts +5 -1
- package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
- package/dist/hooks/useBuildNavigationController.d.ts +23 -0
- package/dist/hooks/useProjectLog.d.ts +14 -0
- package/dist/hooks/useSnackbarController.d.ts +1 -0
- package/dist/hooks/useStorageSource.d.ts +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +16297 -12643
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +20043 -587
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +1 -12
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +7 -5
- package/dist/preview/components/BooleanPreview.d.ts +5 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +4 -9
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +38 -2
- package/dist/types/collections.d.ts +56 -9
- package/dist/types/datasource.d.ts +59 -39
- package/dist/types/entities.d.ts +7 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/entity_callbacks.d.ts +3 -3
- package/dist/types/entity_overrides.d.ts +6 -0
- package/dist/types/fields.d.ts +47 -42
- package/dist/types/firecms.d.ts +8 -23
- package/dist/types/index.d.ts +2 -1
- package/dist/types/navigation.d.ts +18 -16
- package/dist/types/permissions.d.ts +5 -1
- package/dist/types/plugins.d.ts +31 -31
- package/dist/types/properties.d.ts +36 -23
- package/dist/types/property_config.d.ts +2 -2
- package/dist/types/roles.d.ts +31 -0
- package/dist/types/side_dialogs_controller.d.ts +10 -0
- package/dist/types/storage.d.ts +86 -3
- package/dist/types/user.d.ts +5 -0
- package/dist/util/collections.d.ts +9 -1
- package/dist/util/entities.d.ts +2 -2
- package/dist/util/icon_list.d.ts +5 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +10 -3
- package/dist/util/index.d.ts +3 -1
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/property_utils.d.ts +1 -1
- package/dist/util/references.d.ts +4 -2
- package/dist/util/resolutions.d.ts +28 -14
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/strings.d.ts +1 -1
- package/dist/util/useDebouncedCallback.d.ts +1 -0
- package/dist/util/useStorageUploadController.d.ts +3 -3
- package/dist/util/useTraceUpdate.d.ts +1 -0
- package/package.json +129 -112
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +24 -0
- package/src/app/Scaffold.tsx +243 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/ArrayContainer.tsx +45 -75
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/{DeleteConfirmationDialog.tsx → ConfirmationDialog.tsx} +1 -1
- package/src/components/DeleteEntityDialog.tsx +4 -4
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +47 -58
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +253 -448
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +11 -12
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +54 -48
- package/src/components/EntityCollectionTable/column_utils.tsx +4 -4
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +40 -32
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +17 -9
- package/src/components/EntityCollectionTable/index.tsx +1 -9
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +44 -46
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +32 -30
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +145 -142
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +184 -171
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +42 -0
- package/src/components/EntityCollectionView/utils.ts +19 -0
- package/src/components/EntityPreview.tsx +208 -71
- package/src/components/EntityView.tsx +84 -0
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/FieldCaption.tsx +14 -0
- package/src/components/HomePage/DefaultHomePage.tsx +38 -28
- package/src/components/HomePage/NavigationCard.tsx +69 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/HomePage/SmallNavigationCard.tsx +44 -0
- package/src/components/HomePage/index.tsx +3 -1
- package/src/components/PropertyConfigBadge.tsx +23 -0
- package/src/components/PropertyIdCopyTooltip.tsx +48 -0
- package/src/components/{ReferenceSelectionInner.tsx → ReferenceTable/ReferenceSelectionTable.tsx} +37 -23
- package/src/components/ReferenceWidget.tsx +26 -16
- package/src/components/SearchIconsView.tsx +10 -7
- package/src/components/{EntityCollectionTable/SimpleEntityCollectionTable.tsx → SelectableTable/SelectableTable.tsx} +46 -84
- package/src/components/SelectableTable/SelectableTableContext.tsx +6 -0
- package/src/components/{EntityCollectionTable → SelectableTable}/filters/BooleanFilterField.tsx +2 -3
- package/src/components/{EntityCollectionTable → SelectableTable}/filters/DateTimeFilterField.tsx +22 -7
- package/src/components/{EntityCollectionTable → SelectableTable}/filters/ReferenceFilterField.tsx +38 -24
- package/src/components/{EntityCollectionTable → SelectableTable}/filters/StringNumberFilterField.tsx +88 -22
- package/src/components/VirtualTable/VirtualTable.tsx +77 -46
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -9
- package/src/components/VirtualTable/VirtualTableHeader.tsx +14 -8
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +19 -15
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +4 -4
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +4 -3
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +4 -3
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +14 -28
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +17 -9
- package/src/components/common/index.ts +6 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/{EntityCollectionTable → common}/types.tsx +9 -6
- package/src/components/{EntityCollectionView → common}/useColumnsIds.tsx +23 -2
- package/src/components/{EntityCollectionTable → common}/useDataSourceEntityCollectionTableController.tsx +25 -14
- package/src/components/common/useTableSearchHelper.ts +88 -0
- package/src/components/index.tsx +15 -8
- package/src/contexts/AuthControllerContext.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/core/DefaultAppBar.tsx +176 -0
- package/src/core/DefaultDrawer.tsx +183 -0
- package/src/core/DrawerNavigationItem.tsx +66 -0
- package/src/core/EntityEditView.tsx +1127 -0
- package/src/core/EntitySidePanel.tsx +9 -8
- package/src/core/FireCMS.tsx +67 -59
- package/src/core/NavigationRoutes.tsx +25 -17
- package/src/core/SideDialogs.tsx +1 -0
- package/src/core/field_configs.tsx +18 -19
- package/src/core/index.tsx +3 -6
- package/src/form/PropertyFieldBinding.tsx +60 -33
- package/src/form/components/CustomIdField.tsx +51 -36
- package/src/form/components/ErrorFocus.tsx +3 -3
- package/src/form/components/FieldHelperText.tsx +4 -4
- package/src/form/components/FormikArrayContainer.tsx +4 -1
- package/src/form/components/LabelWithIcon.tsx +41 -0
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/StorageItemPreview.tsx +22 -10
- package/src/form/components/StorageUploadProgress.tsx +8 -8
- package/src/form/components/index.tsx +2 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +28 -18
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +37 -37
- package/src/form/field_bindings/BlockFieldBinding.tsx +29 -27
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +20 -17
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +66 -60
- package/src/form/field_bindings/MapFieldBinding.tsx +35 -33
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +150 -0
- package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +26 -22
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +12 -18
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +45 -33
- package/src/form/field_bindings/RepeatFieldBinding.tsx +36 -21
- package/src/form/field_bindings/SelectFieldBinding.tsx +22 -16
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +41 -42
- package/src/form/field_bindings/SwitchFieldBinding.tsx +11 -8
- package/src/form/field_bindings/TextFieldBinding.tsx +34 -30
- package/src/form/index.tsx +5 -9
- package/src/form/useClearRestoreValue.tsx +2 -2
- package/src/form/validation.ts +4 -21
- package/src/hooks/data/delete.ts +5 -4
- package/src/hooks/data/save.ts +7 -2
- package/src/hooks/data/useCollectionFetch.tsx +1 -1
- package/src/hooks/data/useDataSource.tsx +15 -2
- package/src/hooks/data/useEntityFetch.tsx +4 -4
- package/src/hooks/index.tsx +7 -1
- package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/{core → hooks}/useBuildModeController.tsx +12 -6
- package/src/{internal → hooks}/useBuildNavigationController.tsx +244 -99
- package/src/hooks/useFireCMSContext.tsx +51 -3
- package/src/hooks/useLargeLayout.tsx +10 -7
- package/src/hooks/useProjectLog.tsx +63 -0
- package/src/hooks/useReferenceDialog.tsx +3 -3
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useSnackbarController.tsx +1 -2
- package/src/hooks/useStorageSource.tsx +7 -2
- package/src/hooks/useValidateAuthenticator.tsx +115 -0
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +79 -84
- package/src/internal/useBuildSideDialogsController.tsx +1 -0
- package/src/internal/useBuildSideEntityController.tsx +103 -23
- package/src/internal/useUnsavedChangesDialog.tsx +3 -1
- package/src/preview/PropertyPreview.tsx +12 -19
- package/src/preview/PropertyPreviewProps.tsx +6 -10
- package/src/preview/components/BooleanPreview.tsx +19 -4
- package/src/preview/components/EnumValuesChip.tsx +2 -2
- package/src/preview/components/ImagePreview.tsx +24 -34
- package/src/preview/components/ReferencePreview.tsx +73 -176
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -2
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +3 -2
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -2
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +3 -4
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +3 -4
- package/src/preview/property_previews/MapPropertyPreview.tsx +6 -6
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
- package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
- package/src/preview/util.ts +2 -2
- package/src/types/analytics.ts +1 -0
- package/src/types/auth.tsx +51 -2
- package/src/types/collections.ts +65 -9
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +69 -47
- package/src/types/entities.ts +15 -1
- package/src/types/entity_actions.tsx +17 -0
- package/src/types/entity_callbacks.ts +4 -3
- package/src/types/entity_overrides.tsx +7 -0
- package/src/types/fields.tsx +51 -45
- package/src/types/firecms.tsx +9 -26
- package/src/types/index.ts +2 -1
- package/src/types/navigation.ts +20 -19
- package/src/types/permissions.ts +6 -1
- package/src/types/plugins.tsx +38 -40
- package/src/types/properties.ts +42 -24
- package/src/types/property_config.tsx +2 -2
- package/src/types/roles.ts +41 -0
- package/src/types/side_dialogs_controller.tsx +13 -0
- package/src/types/side_entity_controller.tsx +1 -0
- package/src/types/storage.ts +94 -3
- package/src/types/user.ts +7 -0
- package/src/util/collections.ts +22 -0
- package/src/util/entities.ts +6 -5
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +15 -10
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/icons.tsx +18 -4
- package/src/util/index.ts +3 -1
- package/src/util/make_properties_editable.ts +13 -5
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +12 -8
- package/src/util/plurals.ts +0 -2
- package/src/util/property_utils.tsx +1 -1
- package/src/util/references.ts +39 -5
- package/src/util/resolutions.ts +75 -42
- package/src/util/storage.ts +79 -21
- package/src/util/strings.ts +4 -3
- package/src/util/{useDebounce.ts → useDebouncedCallback.ts} +1 -1
- package/src/util/useStorageUploadController.tsx +33 -7
- package/src/util/useTraceUpdate.tsx +2 -1
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/Drawer.d.ts +0 -23
- package/dist/core/Scaffold.d.ts +0 -52
- package/dist/form/EntityForm.d.ts +0 -75
- package/dist/form/components/SubmitListener.d.ts +0 -1
- package/dist/form/components/SwitchControl.d.ts +0 -8
- package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
- package/dist/hooks/useVerifyLicense.d.ts +0 -0
- package/dist/internal/EntityView.d.ts +0 -22
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/dist/internal/useBuildNavigationController.d.ts +0 -14
- package/dist/internal/useLocaleConfig.d.ts +0 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/dist/util/useDebounce.d.ts +0 -1
- package/src/components/FieldConfigBadge.tsx +0 -17
- package/src/components/FireCMSAppBar.tsx +0 -157
- package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
- package/src/components/LabelWithIcon.tsx +0 -33
- package/src/core/Drawer.tsx +0 -162
- package/src/core/Scaffold.tsx +0 -278
- package/src/form/EntityForm.tsx +0 -657
- package/src/form/components/SubmitListener.tsx +0 -32
- package/src/form/components/SwitchControl.tsx +0 -39
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -696
- package/src/hooks/useVerifyLicense.tsx +0 -1
- package/src/internal/EntityView.tsx +0 -578
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
- /package/dist/components/{EntityCollectionTable → SelectableTable}/filters/BooleanFilterField.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → SelectableTable}/filters/DateTimeFilterField.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → SelectableTable}/filters/StringNumberFilterField.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → common}/useDebouncedData.d.ts +0 -0
- /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
- /package/src/components/{EntityCollectionTable → common}/useDebouncedData.ts +0 -0
|
@@ -4,18 +4,18 @@ import { Entity, EntityCollection, EntityReference, FilterValues } from "../type
|
|
|
4
4
|
import { getReferenceFrom } from "../util";
|
|
5
5
|
import { PreviewSize, ReferencePreview } from "../preview";
|
|
6
6
|
import { useNavigationController, useReferenceDialog } from "../hooks";
|
|
7
|
-
import { Button,
|
|
7
|
+
import { Button, cls } from "@firecms/ui";
|
|
8
8
|
|
|
9
9
|
export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
10
10
|
name?: string,
|
|
11
11
|
multiselect?: boolean,
|
|
12
|
-
value: EntityReference
|
|
12
|
+
value: EntityReference | EntityReference[] | null,
|
|
13
13
|
onReferenceSelected?: (params: {
|
|
14
|
-
reference: EntityReference
|
|
14
|
+
reference: EntityReference | null,
|
|
15
15
|
entity: Entity<M> | null
|
|
16
16
|
}) => void,
|
|
17
17
|
onMultipleReferenceSelected?: (params: {
|
|
18
|
-
references: EntityReference
|
|
18
|
+
references: EntityReference[] | null,
|
|
19
19
|
entities: Entity<M>[] | null
|
|
20
20
|
}) => void,
|
|
21
21
|
path: string,
|
|
@@ -27,6 +27,8 @@ export type ReferenceWidgetProps<M extends Record<string, any>> = {
|
|
|
27
27
|
forceFilter?: FilterValues<string>;
|
|
28
28
|
size: PreviewSize;
|
|
29
29
|
className?: string;
|
|
30
|
+
includeId?: boolean;
|
|
31
|
+
includeEntityLink?: boolean;
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
/**
|
|
@@ -43,25 +45,26 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
43
45
|
previewProperties,
|
|
44
46
|
forceFilter,
|
|
45
47
|
size,
|
|
46
|
-
className
|
|
48
|
+
className,
|
|
49
|
+
includeId,
|
|
50
|
+
includeEntityLink
|
|
47
51
|
}: ReferenceWidgetProps<M>) {
|
|
48
52
|
|
|
49
53
|
const navigationController = useNavigationController();
|
|
50
54
|
|
|
51
55
|
const collection: EntityCollection | undefined = useMemo(() => {
|
|
52
56
|
return navigationController.getCollection(path);
|
|
53
|
-
}, [path, navigationController]);
|
|
54
|
-
|
|
55
|
-
if (!collection) {
|
|
56
|
-
throw Error(`Couldn't find the corresponding collection for the path: ${path}`);
|
|
57
|
-
}
|
|
57
|
+
}, [path, navigationController.getCollection]);
|
|
58
58
|
|
|
59
59
|
const onSingleEntitySelected = useCallback((entity: Entity<M> | null) => {
|
|
60
60
|
if (disabled)
|
|
61
61
|
return;
|
|
62
62
|
if (onReferenceSelected) {
|
|
63
63
|
const reference = entity ? getReferenceFrom(entity) : null;
|
|
64
|
-
onReferenceSelected?.({
|
|
64
|
+
onReferenceSelected?.({
|
|
65
|
+
reference,
|
|
66
|
+
entity
|
|
67
|
+
});
|
|
65
68
|
}
|
|
66
69
|
}, [disabled, onReferenceSelected]);
|
|
67
70
|
|
|
@@ -70,7 +73,10 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
70
73
|
return;
|
|
71
74
|
if (onMultipleReferenceSelected) {
|
|
72
75
|
const references = entities ? entities.map(e => getReferenceFrom(e)) : null;
|
|
73
|
-
onMultipleReferenceSelected({
|
|
76
|
+
onMultipleReferenceSelected({
|
|
77
|
+
references,
|
|
78
|
+
entities
|
|
79
|
+
});
|
|
74
80
|
}
|
|
75
81
|
}, [disabled, onReferenceSelected]);
|
|
76
82
|
|
|
@@ -110,19 +116,23 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
110
116
|
reference={ref}
|
|
111
117
|
disabled={disabled}
|
|
112
118
|
previewProperties={previewProperties}
|
|
113
|
-
size={size}
|
|
119
|
+
size={size}
|
|
120
|
+
includeId={includeId}
|
|
121
|
+
includeEntityLink={includeEntityLink}/>
|
|
114
122
|
})}
|
|
115
123
|
</div>
|
|
116
|
-
} else if (value
|
|
124
|
+
} else if (value?.isEntityReference && value?.isEntityReference()) {
|
|
117
125
|
child = <ReferencePreview
|
|
118
126
|
reference={value}
|
|
119
127
|
onClick={onEntryClick}
|
|
120
128
|
disabled={disabled}
|
|
121
129
|
previewProperties={previewProperties}
|
|
122
|
-
size={size}
|
|
130
|
+
size={size}
|
|
131
|
+
includeId={includeId}
|
|
132
|
+
includeEntityLink={includeEntityLink}/>
|
|
123
133
|
|
|
124
134
|
}
|
|
125
|
-
return <div className={
|
|
135
|
+
return <div className={cls("text-sm font-medium",
|
|
126
136
|
"min-w-80 flex flex-col gap-4",
|
|
127
137
|
"relative transition-colors duration-200 ease-in rounded font-medium",
|
|
128
138
|
disabled ? "bg-opacity-50" : "hover:bg-opacity-75",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { coolIconKeys, debounce, Icon, IconButton, iconKeys, SearchBar, Tooltip } from "@firecms/ui";
|
|
4
|
-
import {
|
|
4
|
+
import { iconSynonyms, iconsSearch } from "../util";
|
|
5
5
|
|
|
6
6
|
const UPDATE_SEARCH_INDEX_WAIT_MS = 220;
|
|
7
7
|
|
|
8
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9
|
-
Object.keys(
|
|
8
|
+
if (iconSynonyms && process.env.NODE_ENV !== "production") {
|
|
9
|
+
Object.keys(iconSynonyms).forEach((icon: string) => {
|
|
10
10
|
if (!iconKeys.includes(icon)) {
|
|
11
|
-
console.warn(`The icon ${icon} no longer exists. Remove it from \`
|
|
11
|
+
console.warn(`The icon ${icon} no longer exists. Remove it from \`iconSynonyms\``);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -31,7 +31,9 @@ export function SearchIconsView({
|
|
|
31
31
|
setKeys(null);
|
|
32
32
|
} else {
|
|
33
33
|
const searchResult = iconsSearch.search(value);
|
|
34
|
-
|
|
34
|
+
const limit = 50;
|
|
35
|
+
const limited = searchResult.slice(0, limit);
|
|
36
|
+
setKeys(limited.map((e) => e.item.key));
|
|
35
37
|
}
|
|
36
38
|
}, UPDATE_SEARCH_INDEX_WAIT_MS), []
|
|
37
39
|
);
|
|
@@ -48,7 +50,7 @@ export function SearchIconsView({
|
|
|
48
50
|
return (
|
|
49
51
|
<>
|
|
50
52
|
<SearchBar
|
|
51
|
-
autoFocus
|
|
53
|
+
autoFocus={false}
|
|
52
54
|
innerClassName={"w-full sticky top-0 z-10"}
|
|
53
55
|
onTextSearch={(value?: string) => setQuery(value ?? "")}
|
|
54
56
|
placeholder="Search for more icons…"
|
|
@@ -57,7 +59,8 @@ export function SearchIconsView({
|
|
|
57
59
|
<div className={"flex max-w-full flex-wrap mt-4"}>
|
|
58
60
|
{icons.map((icon: string) => {
|
|
59
61
|
return (
|
|
60
|
-
<Tooltip title={icon} key={icon}
|
|
62
|
+
<Tooltip title={icon} key={icon}
|
|
63
|
+
asChild={true}>
|
|
61
64
|
<IconButton
|
|
62
65
|
shape={"square"}
|
|
63
66
|
toggled={selectedIcon === icon}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
2
2
|
import equal from "react-fast-compare";
|
|
3
3
|
import {
|
|
4
4
|
CollectionSize,
|
|
@@ -6,33 +6,21 @@ import {
|
|
|
6
6
|
EntityTableController,
|
|
7
7
|
FilterValues,
|
|
8
8
|
ResolvedProperty,
|
|
9
|
-
SelectedCellProps
|
|
10
|
-
User
|
|
9
|
+
SelectedCellProps
|
|
11
10
|
} from "../../types";
|
|
12
|
-
import { useLargeLayout } from "../../hooks";
|
|
13
11
|
import { CellRendererParams, VirtualTable, VirtualTableColumn } from "../VirtualTable";
|
|
14
12
|
import { enumToObjectEntries } from "../../util";
|
|
15
|
-
import { OnCellValueChange } from "
|
|
16
|
-
import { CollectionTableToolbar } from "./internal/CollectionTableToolbar";
|
|
17
|
-
import { EntityCollectionTableProps, OnColumnResizeParams } from "./EntityCollectionTableProps";
|
|
13
|
+
import { OnCellValueChange, OnColumnResizeParams } from "../common";
|
|
18
14
|
import { FilterFormFieldProps } from "../VirtualTable/VirtualTableHeader";
|
|
19
15
|
import { ReferenceFilterField } from "./filters/ReferenceFilterField";
|
|
20
16
|
import { StringNumberFilterField } from "./filters/StringNumberFilterField";
|
|
21
17
|
import { BooleanFilterField } from "./filters/BooleanFilterField";
|
|
22
18
|
import { DateTimeFilterField } from "./filters/DateTimeFilterField";
|
|
23
|
-
import {
|
|
19
|
+
import { useOutsideAlerter } from "@firecms/ui";
|
|
20
|
+
import { SelectableTableContext } from "./SelectableTableContext";
|
|
21
|
+
import { getRowHeight } from "../common/table_height";
|
|
24
22
|
|
|
25
|
-
export type
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* List of entities that will be displayed as selected;
|
|
29
|
-
*/
|
|
30
|
-
highlightedEntities?: Entity<M>[];
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Override the title in the toolbar
|
|
34
|
-
*/
|
|
35
|
-
title?: React.ReactNode;
|
|
23
|
+
export type SelectableTableProps<M extends Record<string, any>> = {
|
|
36
24
|
|
|
37
25
|
/**
|
|
38
26
|
* Callback when a cell value changes.
|
|
@@ -65,28 +53,11 @@ export type SimpleEntityCollectionTableProps<M extends Record<string, any>> = {
|
|
|
65
53
|
*/
|
|
66
54
|
onColumnResize?(params: OnColumnResizeParams): void;
|
|
67
55
|
|
|
68
|
-
/**
|
|
69
|
-
* Callback when the selected size of the table is changed
|
|
70
|
-
*/
|
|
71
|
-
onSizeChanged?(size: CollectionSize): void;
|
|
72
|
-
|
|
73
56
|
/**
|
|
74
57
|
* Should apply a different style to a row when hovering
|
|
75
58
|
*/
|
|
76
59
|
hoverRow?: boolean;
|
|
77
60
|
|
|
78
|
-
/**
|
|
79
|
-
* Additional component that renders actions such as buttons in the
|
|
80
|
-
* collection toolbar, displayed on the left side
|
|
81
|
-
*/
|
|
82
|
-
actionsStart?: React.ReactNode;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Additional component that renders actions such as buttons in the
|
|
86
|
-
* collection toolbar, displayed on the right side
|
|
87
|
-
*/
|
|
88
|
-
actions?: React.ReactNode;
|
|
89
|
-
|
|
90
61
|
/**
|
|
91
62
|
* Controller holding the logic for the table
|
|
92
63
|
* {@link useDataSourceEntityCollectionTableController}
|
|
@@ -100,14 +71,18 @@ export type SimpleEntityCollectionTableProps<M extends Record<string, any>> = {
|
|
|
100
71
|
|
|
101
72
|
inlineEditing?: boolean;
|
|
102
73
|
|
|
103
|
-
|
|
74
|
+
forceFilter?: FilterValues<keyof M extends string ? keyof M : never>;
|
|
104
75
|
|
|
105
|
-
|
|
76
|
+
highlightedRow?: (data: Entity<M>) => boolean;
|
|
106
77
|
|
|
107
|
-
|
|
108
|
-
}
|
|
78
|
+
size?: CollectionSize;
|
|
109
79
|
|
|
80
|
+
emptyComponent?: React.ReactNode;
|
|
81
|
+
|
|
82
|
+
endAdornment?: React.ReactNode;
|
|
110
83
|
|
|
84
|
+
AddColumnComponent?: React.ComponentType;
|
|
85
|
+
}
|
|
111
86
|
|
|
112
87
|
/**
|
|
113
88
|
* This component is in charge of rendering a collection table with a high
|
|
@@ -133,19 +108,15 @@ export type SimpleEntityCollectionTableProps<M extends Record<string, any>> = {
|
|
|
133
108
|
* @see VirtualTable
|
|
134
109
|
* @group Components
|
|
135
110
|
*/
|
|
136
|
-
export const
|
|
137
|
-
function
|
|
111
|
+
export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
112
|
+
function SelectableTable<M extends Record<string, any>>
|
|
138
113
|
({
|
|
139
|
-
actionsStart,
|
|
140
|
-
actions,
|
|
141
|
-
title,
|
|
142
114
|
onValueChange,
|
|
143
115
|
cellRenderer,
|
|
144
|
-
highlightedEntities,
|
|
145
116
|
onEntityClick,
|
|
146
117
|
onColumnResize,
|
|
147
|
-
onSizeChanged,
|
|
148
118
|
hoverRow = true,
|
|
119
|
+
size = "m",
|
|
149
120
|
inlineEditing = false,
|
|
150
121
|
tableController:
|
|
151
122
|
{
|
|
@@ -157,8 +128,6 @@ export const SimpleEntityCollectionTable = React.memo<SimpleEntityCollectionTabl
|
|
|
157
128
|
setFilterValues,
|
|
158
129
|
sortBy,
|
|
159
130
|
setSortBy,
|
|
160
|
-
setSearchString,
|
|
161
|
-
clearFilter,
|
|
162
131
|
itemCount,
|
|
163
132
|
setItemCount,
|
|
164
133
|
pageSize = 50,
|
|
@@ -167,21 +136,18 @@ export const SimpleEntityCollectionTable = React.memo<SimpleEntityCollectionTabl
|
|
|
167
136
|
setPopupCell
|
|
168
137
|
},
|
|
169
138
|
filterable = true,
|
|
170
|
-
sortable = true,
|
|
171
139
|
emptyComponent,
|
|
172
|
-
textSearchEnabled,
|
|
173
140
|
columns,
|
|
174
|
-
forceFilter
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
141
|
+
forceFilter,
|
|
142
|
+
highlightedRow,
|
|
143
|
+
endAdornment,
|
|
144
|
+
AddColumnComponent
|
|
145
|
+
}: SelectableTableProps<M>) {
|
|
178
146
|
|
|
179
|
-
const
|
|
147
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
180
148
|
|
|
181
149
|
const [selectedCell, setSelectedCell] = React.useState<SelectedCellProps<M> | undefined>(undefined);
|
|
182
150
|
|
|
183
|
-
const filterIsSet = !!filterValues && Object.keys(filterValues).length > 0;
|
|
184
|
-
|
|
185
151
|
const loadNextPage = () => {
|
|
186
152
|
if (!paginationEnabled || dataLoading || noMoreToLoad)
|
|
187
153
|
return;
|
|
@@ -201,13 +167,13 @@ export const SimpleEntityCollectionTable = React.memo<SimpleEntityCollectionTabl
|
|
|
201
167
|
return onEntityClick && onEntityClick(rowData);
|
|
202
168
|
}, [onEntityClick, inlineEditing]);
|
|
203
169
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
170
|
+
useOutsideAlerter(ref,
|
|
171
|
+
() => {
|
|
172
|
+
if (selectedCell) {
|
|
173
|
+
unselect();
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
Boolean(selectedCell));
|
|
211
177
|
|
|
212
178
|
// on ESC key press
|
|
213
179
|
useEffect(() => {
|
|
@@ -235,27 +201,17 @@ export const SimpleEntityCollectionTable = React.memo<SimpleEntityCollectionTabl
|
|
|
235
201
|
}, [forceFilter]);
|
|
236
202
|
|
|
237
203
|
return (
|
|
238
|
-
<
|
|
204
|
+
<SelectableTableContext.Provider
|
|
239
205
|
value={{
|
|
240
206
|
setPopupCell: setPopupCell as ((cell?: SelectedCellProps<M>) => void),
|
|
241
207
|
select,
|
|
242
208
|
onValueChange,
|
|
243
|
-
size,
|
|
209
|
+
size: size ?? "m",
|
|
244
210
|
selectedCell,
|
|
245
211
|
}}
|
|
246
212
|
>
|
|
247
|
-
<div className="h-full w-full flex flex-col bg-white dark:bg-gray-950"
|
|
248
|
-
|
|
249
|
-
<CollectionTableToolbar
|
|
250
|
-
filterIsSet={filterIsSet}
|
|
251
|
-
onTextSearch={textSearchEnabled ? onTextSearch : undefined}
|
|
252
|
-
clearFilter={clearFilter}
|
|
253
|
-
size={size}
|
|
254
|
-
onSizeChanged={updateSize}
|
|
255
|
-
title={title}
|
|
256
|
-
actionsStart={actionsStart}
|
|
257
|
-
actions={actions}
|
|
258
|
-
loading={dataLoading}/>
|
|
213
|
+
<div className="h-full w-full flex flex-col bg-white dark:bg-gray-950"
|
|
214
|
+
ref={ref}>
|
|
259
215
|
|
|
260
216
|
<VirtualTable
|
|
261
217
|
data={data}
|
|
@@ -265,27 +221,32 @@ export const SimpleEntityCollectionTable = React.memo<SimpleEntityCollectionTabl
|
|
|
265
221
|
onEndReached={loadNextPage}
|
|
266
222
|
onResetPagination={resetPagination}
|
|
267
223
|
error={dataLoadingError}
|
|
268
|
-
paginationEnabled={paginationEnabled}
|
|
269
224
|
onColumnResize={onColumnResize}
|
|
270
|
-
|
|
225
|
+
rowHeight={getRowHeight(size)}
|
|
271
226
|
loading={dataLoading}
|
|
272
227
|
filter={filterValues}
|
|
273
228
|
onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
|
|
274
229
|
sortBy={sortBy}
|
|
275
230
|
onSortByUpdate={setSortBy as ((sortBy?: [string, "asc" | "desc"]) => void)}
|
|
276
231
|
hoverRow={hoverRow}
|
|
277
|
-
emptyComponent={emptyComponent}
|
|
278
232
|
checkFilterCombination={checkFilterCombination}
|
|
279
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])}
|
|
280
237
|
className="flex-grow"
|
|
238
|
+
emptyComponent={emptyComponent}
|
|
239
|
+
endAdornment={endAdornment}
|
|
240
|
+
AddColumnComponent={AddColumnComponent}
|
|
281
241
|
/>
|
|
282
242
|
|
|
283
243
|
</div>
|
|
284
|
-
</
|
|
244
|
+
</SelectableTableContext.Provider>
|
|
285
245
|
);
|
|
286
246
|
|
|
287
247
|
},
|
|
288
|
-
|
|
248
|
+
() => false,
|
|
249
|
+
// equal
|
|
289
250
|
);
|
|
290
251
|
|
|
291
252
|
function createFilterField({
|
|
@@ -318,6 +279,7 @@ function createFilterField({
|
|
|
318
279
|
isArray={isArray}
|
|
319
280
|
path={baseProperty.path}
|
|
320
281
|
title={resolvedProperty?.name}
|
|
282
|
+
includeId={baseProperty.includeId}
|
|
321
283
|
previewProperties={baseProperty?.previewProperties}
|
|
322
284
|
hidden={hidden}
|
|
323
285
|
setHidden={setHidden}/>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { EntityCollectionTableController } from "../common/types";
|
|
3
|
+
|
|
4
|
+
export const SelectableTableContext = React.createContext<EntityCollectionTableController<any>>({} as any);
|
|
5
|
+
|
|
6
|
+
export const useSelectableTableController = () => useContext<EntityCollectionTableController<any>>(SelectableTableContext);
|
package/src/components/{EntityCollectionTable → SelectableTable}/filters/BooleanFilterField.tsx
RENAMED
|
@@ -32,7 +32,7 @@ export function BooleanFilterField({
|
|
|
32
32
|
const valueSet = !!value;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<div className="w-[
|
|
35
|
+
<div className="w-[300px]">
|
|
36
36
|
<BooleanSwitchWithLabel
|
|
37
37
|
value={valueSetToTrue}
|
|
38
38
|
allowIndeterminate={true}
|
|
@@ -44,6 +44,5 @@ export function BooleanFilterField({
|
|
|
44
44
|
: `${title} is false`}
|
|
45
45
|
/>
|
|
46
46
|
</div>
|
|
47
|
-
)
|
|
48
|
-
;
|
|
47
|
+
);
|
|
49
48
|
}
|
package/src/components/{EntityCollectionTable → SelectableTable}/filters/DateTimeFilterField.tsx
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { VirtualTableWhereFilterOp } from "../../VirtualTable";
|
|
3
|
-
import { DateTimeField, Select, SelectItem } from "@firecms/ui";
|
|
3
|
+
import { Checkbox, DateTimeField, Label, Select, SelectItem } from "@firecms/ui";
|
|
4
4
|
import { useCustomizationController } from "../../../hooks";
|
|
5
5
|
|
|
6
6
|
interface DateTimeFilterFieldProps {
|
|
@@ -43,10 +43,10 @@ export function DateTimeFilterField({
|
|
|
43
43
|
|
|
44
44
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
45
45
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
46
|
-
const [internalValue, setInternalValue] = useState<Date | undefined>(fieldValue);
|
|
46
|
+
const [internalValue, setInternalValue] = useState<Date | null | undefined>(fieldValue);
|
|
47
47
|
|
|
48
|
-
function updateFilter(op: VirtualTableWhereFilterOp, val: Date | undefined) {
|
|
49
|
-
let newValue: Date | undefined = val;
|
|
48
|
+
function updateFilter(op: VirtualTableWhereFilterOp, val: Date | undefined | null) {
|
|
49
|
+
let newValue: Date | null | undefined = val;
|
|
50
50
|
const prevOpIsArray = multipleSelectOperations.includes(operation);
|
|
51
51
|
const newOpIsArray = multipleSelectOperations.includes(op);
|
|
52
52
|
if (prevOpIsArray !== newOpIsArray) {
|
|
@@ -73,7 +73,7 @@ export function DateTimeFilterField({
|
|
|
73
73
|
|
|
74
74
|
return (
|
|
75
75
|
|
|
76
|
-
<div className="flex w-[440px]
|
|
76
|
+
<div className="flex w-[440px]">
|
|
77
77
|
<div className="w-[80px]">
|
|
78
78
|
<Select value={operation}
|
|
79
79
|
onValueChange={(value) => {
|
|
@@ -88,19 +88,34 @@ export function DateTimeFilterField({
|
|
|
88
88
|
</Select>
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
|
-
<div className="flex-grow ml-2">
|
|
91
|
+
<div className="flex-grow ml-2 flex flex-col gap-2">
|
|
92
92
|
|
|
93
93
|
<DateTimeField
|
|
94
94
|
mode={mode}
|
|
95
95
|
size={"medium"}
|
|
96
96
|
locale={locale}
|
|
97
|
-
value={internalValue}
|
|
97
|
+
value={internalValue ?? undefined}
|
|
98
98
|
onChange={(dateValue: Date | null) => {
|
|
99
99
|
updateFilter(operation, dateValue === null ? undefined : dateValue);
|
|
100
100
|
}}
|
|
101
101
|
clearable={true}
|
|
102
102
|
/>
|
|
103
103
|
|
|
104
|
+
<Label
|
|
105
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
|
|
106
|
+
htmlFor="null-filter"
|
|
107
|
+
>
|
|
108
|
+
<Checkbox id="null-filter"
|
|
109
|
+
checked={internalValue === null}
|
|
110
|
+
size={"small"}
|
|
111
|
+
onCheckedChange={(checked) => {
|
|
112
|
+
if (internalValue !== null)
|
|
113
|
+
updateFilter(operation, null);
|
|
114
|
+
else updateFilter(operation, undefined);
|
|
115
|
+
}}/>
|
|
116
|
+
Filter for null values
|
|
117
|
+
</Label>
|
|
118
|
+
|
|
104
119
|
</div>
|
|
105
120
|
|
|
106
121
|
</div>
|
package/src/components/{EntityCollectionTable → SelectableTable}/filters/ReferenceFilterField.tsx
RENAMED
|
@@ -4,7 +4,7 @@ import { Entity, EntityCollection, EntityReference } from "../../../types";
|
|
|
4
4
|
import { ReferencePreview } from "../../../preview";
|
|
5
5
|
import { getReferenceFrom } from "../../../util";
|
|
6
6
|
import { useNavigationController, useReferenceDialog } from "../../../hooks";
|
|
7
|
-
import { Button, Select, SelectItem } from "@firecms/ui";
|
|
7
|
+
import { Button, Checkbox, Label, Select, SelectItem } from "@firecms/ui";
|
|
8
8
|
|
|
9
9
|
interface ReferenceFilterFieldProps {
|
|
10
10
|
name: string,
|
|
@@ -13,6 +13,7 @@ interface ReferenceFilterFieldProps {
|
|
|
13
13
|
isArray?: boolean;
|
|
14
14
|
path?: string;
|
|
15
15
|
title?: string;
|
|
16
|
+
includeId?: boolean;
|
|
16
17
|
previewProperties?: string[];
|
|
17
18
|
hidden: boolean;
|
|
18
19
|
setHidden: (hidden: boolean) => void;
|
|
@@ -40,6 +41,7 @@ export function ReferenceFilterField({
|
|
|
40
41
|
isArray,
|
|
41
42
|
path,
|
|
42
43
|
title,
|
|
44
|
+
includeId = true,
|
|
43
45
|
previewProperties,
|
|
44
46
|
setHidden
|
|
45
47
|
}: ReferenceFilterFieldProps) {
|
|
@@ -48,33 +50,31 @@ export function ReferenceFilterField({
|
|
|
48
50
|
? ["array-contains"]
|
|
49
51
|
: ["==", "!=", ">", "<", ">=", "<="];
|
|
50
52
|
|
|
51
|
-
const [onHover, setOnHover] = React.useState(false);
|
|
52
|
-
|
|
53
53
|
isArray
|
|
54
54
|
? possibleOperations.push("array-contains-any")
|
|
55
55
|
: possibleOperations.push("in", "not-in");
|
|
56
56
|
|
|
57
57
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
58
58
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
59
|
-
const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined>(fieldValue);
|
|
59
|
+
const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined | null>(fieldValue);
|
|
60
60
|
|
|
61
61
|
const selectedEntityIds = internalValue
|
|
62
62
|
? (Array.isArray(internalValue) ? internalValue.map((ref) => {
|
|
63
|
-
if (!(ref
|
|
63
|
+
if (!(ref?.isEntityReference && ref?.isEntityReference())) {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
return ref.id;
|
|
67
67
|
}).filter(Boolean) as string[] : [internalValue.id])
|
|
68
68
|
: [];
|
|
69
69
|
|
|
70
|
-
function updateFilter(op: VirtualTableWhereFilterOp, val?: EntityReference | EntityReference[]) {
|
|
70
|
+
function updateFilter(op: VirtualTableWhereFilterOp, val?: EntityReference | EntityReference[] | null) {
|
|
71
71
|
|
|
72
72
|
const prevOpIsArray = multipleSelectOperations.includes(operation);
|
|
73
73
|
const newOpIsArray = multipleSelectOperations.includes(op);
|
|
74
74
|
let newValue = val;
|
|
75
75
|
if (prevOpIsArray !== newOpIsArray) {
|
|
76
76
|
// @ts-ignore
|
|
77
|
-
newValue = newOpIsArray ? (newValue
|
|
77
|
+
newValue = newOpIsArray ? (newValue?.isEntityReference && newValue?.isEntityReference() ? [newValue] : []) : undefined
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
setOperation(op);
|
|
@@ -129,28 +129,23 @@ export function ReferenceFilterField({
|
|
|
129
129
|
|
|
130
130
|
const buildEntry = (reference: EntityReference) => {
|
|
131
131
|
return (
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
reference={reference}
|
|
143
|
-
onHover={onHover}
|
|
144
|
-
allowEntityNavigation={false}
|
|
145
|
-
/>
|
|
146
|
-
</div>
|
|
132
|
+
<ReferencePreview
|
|
133
|
+
disabled={!path}
|
|
134
|
+
previewProperties={previewProperties}
|
|
135
|
+
size={"medium"}
|
|
136
|
+
onClick={doOpenDialog}
|
|
137
|
+
reference={reference}
|
|
138
|
+
hover={true}
|
|
139
|
+
includeId={includeId}
|
|
140
|
+
includeEntityLink={false}
|
|
141
|
+
/>
|
|
147
142
|
);
|
|
148
143
|
};
|
|
149
144
|
|
|
150
145
|
return (
|
|
151
146
|
|
|
152
147
|
<div className="flex w-[440px] flex-row">
|
|
153
|
-
<div className="w-[
|
|
148
|
+
<div className="w-[140px]">
|
|
154
149
|
<Select value={operation}
|
|
155
150
|
onValueChange={(value) => {
|
|
156
151
|
updateFilter(value as VirtualTableWhereFilterOp, internalValue);
|
|
@@ -164,21 +159,40 @@ export function ReferenceFilterField({
|
|
|
164
159
|
</Select>
|
|
165
160
|
</div>
|
|
166
161
|
|
|
167
|
-
<div className="flex-grow ml-2 h-full">
|
|
162
|
+
<div className="flex-grow ml-2 h-full gap-2 flex flex-col">
|
|
168
163
|
|
|
169
164
|
{internalValue && Array.isArray(internalValue) && <div>
|
|
170
165
|
{internalValue.map((ref, index) => buildEntry(ref))}
|
|
171
166
|
</div>}
|
|
167
|
+
|
|
172
168
|
{internalValue && !Array.isArray(internalValue) && <div>
|
|
173
169
|
{buildEntry(internalValue)}
|
|
174
170
|
</div>}
|
|
171
|
+
|
|
175
172
|
{(!internalValue || (Array.isArray(internalValue) && internalValue.length === 0)) &&
|
|
176
173
|
<Button onClick={doOpenDialog}
|
|
177
174
|
variant={"outlined"}
|
|
175
|
+
size={"large"}
|
|
178
176
|
className="h-full w-full">
|
|
179
177
|
{multiple ? "Select references" : "Select reference"}
|
|
180
178
|
</Button>
|
|
181
179
|
}
|
|
180
|
+
|
|
181
|
+
{!isArray && <Label
|
|
182
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
|
|
183
|
+
htmlFor="null-filter"
|
|
184
|
+
>
|
|
185
|
+
<Checkbox id="null-filter"
|
|
186
|
+
checked={internalValue === null}
|
|
187
|
+
size={"small"}
|
|
188
|
+
onCheckedChange={(checked) => {
|
|
189
|
+
if (internalValue !== null)
|
|
190
|
+
updateFilter(operation, null);
|
|
191
|
+
else updateFilter(operation, undefined);
|
|
192
|
+
}}/>
|
|
193
|
+
Filter for null values
|
|
194
|
+
</Label>}
|
|
195
|
+
|
|
182
196
|
</div>
|
|
183
197
|
|
|
184
198
|
</div>
|