@firecms/core 3.0.0-beta.1 → 3.0.0-beta.11
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 +19 -8
- 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 +9 -15
- 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 +8 -5
- 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 +5 -2
- 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 +2 -2
- 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/{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 -2
- 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/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 +3 -4
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
- 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 +4 -4
- package/dist/hooks/data/save.d.ts +4 -5
- package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
- 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/hooks/useAuthController.d.ts +1 -1
- package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
- package/dist/hooks/useBuildNavigationController.d.ts +23 -0
- package/dist/hooks/useFireCMSContext.d.ts +1 -1
- package/dist/hooks/useProjectLog.d.ts +14 -0
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- 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 +20246 -13863
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +22772 -588
- 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/preview/util.d.ts +3 -3
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +37 -3
- package/dist/types/collections.d.ts +68 -20
- package/dist/types/datasource.d.ts +55 -39
- package/dist/types/entities.d.ts +7 -1
- package/dist/types/entity_actions.d.ts +18 -4
- package/dist/types/entity_callbacks.d.ts +17 -17
- package/dist/types/entity_overrides.d.ts +6 -0
- package/dist/types/export_import.d.ts +4 -4
- package/dist/types/fields.d.ts +63 -42
- package/dist/types/firecms.d.ts +10 -25
- package/dist/types/firecms_context.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/navigation.d.ts +18 -16
- package/dist/types/permissions.d.ts +8 -4
- package/dist/types/plugins.d.ts +39 -39
- package/dist/types/properties.d.ts +36 -23
- package/dist/types/property_config.d.ts +2 -4
- 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 +6 -0
- package/dist/util/builders.d.ts +2 -2
- package/dist/util/collections.d.ts +9 -1
- package/dist/util/entities.d.ts +3 -3
- package/dist/util/icon_list.d.ts +5 -1
- package/dist/util/icon_synonyms.d.ts +1 -98
- package/dist/util/icons.d.ts +13 -4
- package/dist/util/index.d.ts +3 -1
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +2 -1
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/property_utils.d.ts +3 -3
- package/dist/util/references.d.ts +4 -2
- package/dist/util/resolutions.d.ts +31 -17
- 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 +70 -47
- 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 +122 -90
- package/src/components/CircularProgressCenter.tsx +2 -2
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/{DeleteConfirmationDialog.tsx → ConfirmationDialog.tsx} +3 -3
- package/src/components/DeleteEntityDialog.tsx +13 -22
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +51 -59
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +258 -453
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +13 -14
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +60 -52
- package/src/components/EntityCollectionTable/column_utils.tsx +4 -4
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +40 -33
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +22 -20
- package/src/components/EntityCollectionTable/index.tsx +1 -9
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +44 -46
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +36 -34
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +20 -8
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +191 -178
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +187 -175
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +43 -0
- package/src/components/EntityCollectionView/utils.ts +19 -0
- package/src/components/EntityPreview.tsx +218 -72
- package/src/components/EntityView.tsx +84 -0
- package/src/components/ErrorView.tsx +4 -4
- package/src/components/FieldCaption.tsx +14 -0
- package/src/components/HomePage/DefaultHomePage.tsx +39 -28
- package/src/components/HomePage/FavouritesView.tsx +6 -11
- package/src/components/HomePage/NavigationCard.tsx +69 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +111 -0
- package/src/components/HomePage/NavigationGroup.tsx +2 -2
- 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} +38 -24
- 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 +25 -8
- package/src/components/{EntityCollectionTable → SelectableTable}/filters/ReferenceFilterField.tsx +40 -24
- package/src/components/{EntityCollectionTable → SelectableTable}/filters/StringNumberFilterField.tsx +92 -24
- package/src/components/VirtualTable/VirtualTable.tsx +77 -46
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -9
- package/src/components/VirtualTable/VirtualTableHeader.tsx +19 -13
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +19 -15
- package/src/components/VirtualTable/VirtualTableRow.tsx +5 -6
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +5 -5
- 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 +16 -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 +27 -16
- 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/contexts/SnackbarProvider.tsx +2 -0
- package/src/core/DefaultAppBar.tsx +177 -0
- package/src/core/DefaultDrawer.tsx +185 -0
- package/src/core/DrawerNavigationItem.tsx +66 -0
- package/src/core/EntityEditView.tsx +1125 -0
- package/src/core/EntitySidePanel.tsx +9 -8
- package/src/core/FireCMS.tsx +71 -63
- package/src/core/NavigationRoutes.tsx +25 -17
- package/src/core/SideDialogs.tsx +2 -1
- package/src/core/field_configs.tsx +22 -23
- package/src/core/index.tsx +3 -6
- package/src/form/PropertyFieldBinding.tsx +79 -45
- package/src/form/components/CustomIdField.tsx +53 -36
- package/src/form/components/ErrorFocus.tsx +3 -3
- package/src/form/components/FieldHelperText.tsx +4 -4
- package/src/form/components/LabelWithIcon.tsx +41 -0
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/StorageItemPreview.tsx +23 -11
- package/src/form/components/StorageUploadProgress.tsx +8 -8
- package/src/form/components/index.tsx +2 -2
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +30 -19
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +52 -46
- package/src/form/field_bindings/BlockFieldBinding.tsx +67 -47
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +20 -17
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +76 -67
- package/src/form/field_bindings/MapFieldBinding.tsx +81 -60
- 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 +46 -34
- package/src/form/field_bindings/RepeatFieldBinding.tsx +55 -35
- package/src/form/field_bindings/SelectFieldBinding.tsx +24 -17
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +42 -43
- package/src/form/field_bindings/SwitchFieldBinding.tsx +30 -27
- 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 +7 -6
- package/src/hooks/data/save.ts +12 -8
- package/src/hooks/data/useCollectionFetch.tsx +3 -3
- package/src/hooks/data/useDataSource.tsx +15 -2
- package/src/hooks/data/useEntityFetch.tsx +6 -6
- package/src/hooks/index.tsx +7 -1
- package/src/hooks/useAuthController.tsx +1 -1
- package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/{core → hooks}/useBuildModeController.tsx +12 -6
- package/src/{internal → hooks}/useBuildNavigationController.tsx +245 -101
- package/src/hooks/useFireCMSContext.tsx +53 -5
- 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 +6 -6
- 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 +80 -85
- package/src/internal/useBuildSideDialogsController.tsx +1 -0
- package/src/internal/useBuildSideEntityController.tsx +103 -23
- package/src/internal/useUnsavedChangesDialog.tsx +5 -3
- package/src/preview/PropertyPreview.tsx +15 -22
- package/src/preview/PropertyPreviewProps.tsx +6 -10
- package/src/preview/components/BooleanPreview.tsx +19 -4
- package/src/preview/components/EmptyValue.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +2 -2
- package/src/preview/components/ImagePreview.tsx +25 -36
- 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 +2 -3
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +4 -3
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -2
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +4 -5
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +4 -5
- package/src/preview/property_previews/MapPropertyPreview.tsx +9 -9
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +12 -12
- package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
- package/src/preview/util.ts +10 -10
- package/src/types/analytics.ts +1 -0
- package/src/types/auth.tsx +48 -3
- package/src/types/collections.ts +77 -20
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +64 -47
- package/src/types/entities.ts +15 -1
- package/src/types/entity_actions.tsx +21 -4
- package/src/types/entity_callbacks.ts +20 -19
- package/src/types/entity_overrides.tsx +7 -0
- package/src/types/export_import.ts +4 -4
- package/src/types/fields.tsx +69 -45
- package/src/types/firecms.tsx +11 -28
- package/src/types/firecms_context.tsx +1 -1
- package/src/types/index.ts +2 -1
- package/src/types/navigation.ts +20 -19
- package/src/types/permissions.ts +10 -5
- package/src/types/plugins.tsx +46 -48
- package/src/types/properties.ts +42 -24
- package/src/types/property_config.tsx +2 -4
- 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 +9 -0
- package/src/util/builders.ts +6 -6
- package/src/util/collections.ts +22 -0
- package/src/util/entities.ts +9 -6
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +16 -10
- package/src/util/icon_synonyms.ts +3 -100
- package/src/util/icons.tsx +26 -8
- 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 +45 -28
- package/src/util/permissions.ts +20 -16
- package/src/util/plurals.ts +0 -2
- package/src/util/property_utils.tsx +11 -4
- package/src/util/references.ts +45 -5
- package/src/util/resolutions.ts +80 -47
- 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 +34 -8
- 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/FormikArrayContainer.d.ts +0 -18
- 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/FormikArrayContainer.tsx +0 -44
- 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
|
@@ -31,11 +31,6 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
31
31
|
*/
|
|
32
32
|
cellRenderer: React.ComponentType<CellRendererParams<T>>;
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* If enabled, content is loaded in batch
|
|
36
|
-
*/
|
|
37
|
-
paginationEnabled?: boolean;
|
|
38
|
-
|
|
39
34
|
/**
|
|
40
35
|
* Set this callback if you want to support some combinations
|
|
41
36
|
* of filter combinations only.
|
|
@@ -50,6 +45,11 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
50
45
|
*/
|
|
51
46
|
onEndReached?: () => void;
|
|
52
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Offset in pixels where the onEndReached callback is triggered
|
|
50
|
+
*/
|
|
51
|
+
endOffset?: number;
|
|
52
|
+
|
|
53
53
|
/**
|
|
54
54
|
* When the pagination should be reset. E.g. the filters or sorting
|
|
55
55
|
* has been reset.
|
|
@@ -69,7 +69,7 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
69
69
|
/**
|
|
70
70
|
* Size of the table
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
rowHeight?: number,
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* In case this table should have some filters set by default
|
|
@@ -131,6 +131,11 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
131
131
|
*/
|
|
132
132
|
className?: string;
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Style applied to the table
|
|
136
|
+
*/
|
|
137
|
+
style?: React.CSSProperties;
|
|
138
|
+
|
|
134
139
|
/**
|
|
135
140
|
* Component rendered at the end of the table, after scroll
|
|
136
141
|
*/
|
|
@@ -142,9 +147,14 @@ export interface VirtualTableProps<T extends Record<string, any>> {
|
|
|
142
147
|
*/
|
|
143
148
|
AddColumnComponent?: React.ComponentType;
|
|
144
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Debug mode
|
|
152
|
+
*/
|
|
153
|
+
debug?: boolean;
|
|
154
|
+
|
|
145
155
|
}
|
|
146
156
|
|
|
147
|
-
export type CellRendererParams<T
|
|
157
|
+
export type CellRendererParams<T = any> = {
|
|
148
158
|
column: VirtualTableColumn;
|
|
149
159
|
columns: VirtualTableColumn[];
|
|
150
160
|
columnIndex: number;
|
|
@@ -158,7 +168,7 @@ export type CellRendererParams<T extends any = any> = {
|
|
|
158
168
|
* @see Table
|
|
159
169
|
* @group Components
|
|
160
170
|
*/
|
|
161
|
-
export interface VirtualTableColumn<CustomProps
|
|
171
|
+
export interface VirtualTableColumn<CustomProps = any> {
|
|
162
172
|
|
|
163
173
|
/**
|
|
164
174
|
* Data key for the cell value, could be "a.b.c"
|
|
@@ -232,12 +242,6 @@ export type OnVirtualTableColumnResizeParams = {
|
|
|
232
242
|
column: VirtualTableColumn
|
|
233
243
|
};
|
|
234
244
|
|
|
235
|
-
/**
|
|
236
|
-
* @see Table
|
|
237
|
-
* @group Components
|
|
238
|
-
*/
|
|
239
|
-
export type VirtualTableSize = "xs" | "s" | "m" | "l" | "xl";
|
|
240
|
-
|
|
241
245
|
/**
|
|
242
246
|
* @see Table
|
|
243
247
|
* @group Components
|
|
@@ -252,7 +256,7 @@ export type VirtualTableFilterValues<Key extends string> = Partial<Record<Key, [
|
|
|
252
256
|
|
|
253
257
|
/**
|
|
254
258
|
* Filter conditions in a `Query.where()` clause are specified using the
|
|
255
|
-
* strings
|
|
259
|
+
* strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
|
|
256
260
|
* @see Table
|
|
257
261
|
* @group Models
|
|
258
262
|
*/
|
|
@@ -2,9 +2,8 @@ import React, { useCallback } from "react";
|
|
|
2
2
|
|
|
3
3
|
import equal from "react-fast-compare"
|
|
4
4
|
|
|
5
|
-
import { getRowHeight } from "./common";
|
|
6
5
|
import { VirtualTableRowProps } from "./types";
|
|
7
|
-
import {
|
|
6
|
+
import { cls } from "@firecms/ui";
|
|
8
7
|
|
|
9
8
|
export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
10
9
|
function VirtualTableRow<T>({
|
|
@@ -12,7 +11,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
12
11
|
rowIndex,
|
|
13
12
|
children,
|
|
14
13
|
onRowClick,
|
|
15
|
-
|
|
14
|
+
rowHeight,
|
|
16
15
|
style,
|
|
17
16
|
hoverRow,
|
|
18
17
|
rowClassName
|
|
@@ -29,8 +28,8 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
29
28
|
|
|
30
29
|
return (
|
|
31
30
|
<div
|
|
32
|
-
className={
|
|
33
|
-
"flex min-w-full text-sm border-b border-
|
|
31
|
+
className={cls(
|
|
32
|
+
"flex min-w-full text-sm border-b border-surface-200 dark:border-surface-800 border-opacity-40 dark:border-opacity-40",
|
|
34
33
|
rowClassName ? rowClassName(rowData) : "",
|
|
35
34
|
{
|
|
36
35
|
"hover:bg-opacity-95": hoverRow,
|
|
@@ -40,7 +39,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
40
39
|
onClick={onClick}
|
|
41
40
|
style={{
|
|
42
41
|
...(style),
|
|
43
|
-
height:
|
|
42
|
+
height: rowHeight,
|
|
44
43
|
width: "fit-content"
|
|
45
44
|
}}
|
|
46
45
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DateTimeField } from "@firecms/ui";
|
|
2
|
+
import { cls, DateTimeField, focusedDisabled } from "@firecms/ui";
|
|
3
3
|
import { useCustomizationController } from "../../../hooks";
|
|
4
4
|
|
|
5
5
|
export function VirtualTableDateField(props: {
|
|
@@ -25,11 +25,11 @@ export function VirtualTableDateField(props: {
|
|
|
25
25
|
return (
|
|
26
26
|
<DateTimeField
|
|
27
27
|
value={internalValue ?? undefined}
|
|
28
|
-
onChange={(dateValue) => updateValue(dateValue)}
|
|
29
|
-
size={"
|
|
28
|
+
onChange={(dateValue) => updateValue(dateValue ?? null)}
|
|
29
|
+
size={"large"}
|
|
30
30
|
invisible={true}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
inputClassName={cls("w-full h-full", focusedDisabled)}
|
|
32
|
+
className={cls("w-full h-full", focusedDisabled)}
|
|
33
33
|
mode={mode}
|
|
34
34
|
locale={locale}
|
|
35
35
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { TextareaAutosize } from "@firecms/ui";
|
|
3
|
+
import { useDebouncedCallback } from "../../../util";
|
|
4
|
+
import { focusedDisabled, TextareaAutosize } from "@firecms/ui";
|
|
5
5
|
|
|
6
6
|
export function VirtualTableInput(props: {
|
|
7
7
|
error: Error | undefined;
|
|
@@ -43,7 +43,7 @@ export function VirtualTableInput(props: {
|
|
|
43
43
|
}
|
|
44
44
|
}, [internalValue, updateValue, value]);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
useDebouncedCallback(internalValue, doUpdate, !focused, 2000);
|
|
47
47
|
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
if (ref.current && focused && !focusedState.current) {
|
|
@@ -58,6 +58,7 @@ export function VirtualTableInput(props: {
|
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<TextareaAutosize
|
|
61
|
+
className={focusedDisabled}
|
|
61
62
|
ref={ref}
|
|
62
63
|
style={{
|
|
63
64
|
padding: 0,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useDebouncedCallback } from "../../../util";
|
|
3
|
+
import { cls, focusedDisabled } from "@firecms/ui";
|
|
3
4
|
|
|
4
5
|
export function VirtualTableNumberInput(props: {
|
|
5
6
|
error: Error | undefined;
|
|
@@ -42,7 +43,7 @@ export function VirtualTableNumberInput(props: {
|
|
|
42
43
|
|
|
43
44
|
}, [internalValue, value]);
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
useDebouncedCallback(internalValue, doUpdate, !focused, 2000);
|
|
46
47
|
|
|
47
48
|
useEffect(
|
|
48
49
|
() => {
|
|
@@ -65,7 +66,7 @@ export function VirtualTableNumberInput(props: {
|
|
|
65
66
|
return (
|
|
66
67
|
<input
|
|
67
68
|
ref={ref}
|
|
68
|
-
className="w-full text-right p-0 m-0 bg-transparent border-none resize-none outline-none font-normal leading-normal text-unset"
|
|
69
|
+
className={cls("w-full text-right p-0 m-0 bg-transparent border-none resize-none outline-none font-normal leading-normal text-unset", focusedDisabled)}
|
|
69
70
|
style={{
|
|
70
71
|
textAlign: align
|
|
71
72
|
}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnumValueConfig } from "../../../types";
|
|
2
|
-
import {
|
|
2
|
+
import { EnumValuesChip } from "../../../preview";
|
|
3
3
|
import React, { useCallback, useEffect } from "react";
|
|
4
4
|
import { MultiSelect, MultiSelectItem, Select, SelectItem } from "@firecms/ui";
|
|
5
5
|
|
|
@@ -18,9 +18,7 @@ export function VirtualTableSelect(props: {
|
|
|
18
18
|
}) {
|
|
19
19
|
|
|
20
20
|
const {
|
|
21
|
-
name,
|
|
22
21
|
enumValues,
|
|
23
|
-
error,
|
|
24
22
|
internalValue,
|
|
25
23
|
disabled,
|
|
26
24
|
small,
|
|
@@ -41,6 +39,7 @@ export function VirtualTableSelect(props: {
|
|
|
41
39
|
}, [focused, ref]);
|
|
42
40
|
|
|
43
41
|
const onChange = useCallback((updatedValue: string | string[]) => {
|
|
42
|
+
console.trace("onChange");
|
|
44
43
|
if (valueType === "number") {
|
|
45
44
|
if (multiple) {
|
|
46
45
|
const newValue = (updatedValue as string[]).map((v) => parseFloat(v));
|
|
@@ -58,37 +57,27 @@ export function VirtualTableSelect(props: {
|
|
|
58
57
|
}
|
|
59
58
|
}, [multiple, updateValue, valueType]);
|
|
60
59
|
|
|
61
|
-
const renderValue = (enumKey
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
enumValues={enumValues}
|
|
68
|
-
size={small ? "small" : "medium"}/>;
|
|
69
|
-
} else {
|
|
70
|
-
return <EnumValuesChip
|
|
71
|
-
key={`${enumKey}-${index}`}
|
|
72
|
-
enumKey={enumKey}
|
|
73
|
-
enumValues={enumValues}
|
|
74
|
-
size={small ? "small" : "medium"}/>;
|
|
75
|
-
}
|
|
60
|
+
const renderValue = (enumKey?: string | number) => {
|
|
61
|
+
return <EnumValuesChip
|
|
62
|
+
key={`${enumKey}`}
|
|
63
|
+
enumKey={String(enumKey)}
|
|
64
|
+
enumValues={enumValues}
|
|
65
|
+
size={small ? "small" : "medium"}/>;
|
|
76
66
|
};
|
|
67
|
+
|
|
77
68
|
return (
|
|
78
69
|
multiple
|
|
79
70
|
? <MultiSelect
|
|
80
71
|
inputRef={ref}
|
|
81
|
-
containerClassName="w-full h-full"
|
|
82
72
|
className="w-full h-full p-0 bg-transparent"
|
|
83
73
|
position={"item-aligned"}
|
|
84
74
|
disabled={disabled}
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
includeClear={false}
|
|
76
|
+
useChips={false}
|
|
87
77
|
value={validValue
|
|
88
78
|
? ((internalValue as any[]).map(v => v.toString()))
|
|
89
79
|
: ([])}
|
|
90
|
-
|
|
91
|
-
renderValue={renderValue}>
|
|
80
|
+
onValueChange={onChange}>
|
|
92
81
|
{enumValues?.map((enumConfig) => (
|
|
93
82
|
<MultiSelectItem
|
|
94
83
|
key={enumConfig.id}
|
|
@@ -102,17 +91,16 @@ export function VirtualTableSelect(props: {
|
|
|
102
91
|
</MultiSelect>
|
|
103
92
|
: <Select
|
|
104
93
|
inputRef={ref}
|
|
94
|
+
size={"large"}
|
|
95
|
+
fullWidth={true}
|
|
105
96
|
className="w-full h-full p-0 bg-transparent"
|
|
106
97
|
position={"item-aligned"}
|
|
107
98
|
disabled={disabled}
|
|
108
|
-
multiple={multiple}
|
|
109
99
|
padding={false}
|
|
110
|
-
includeFocusOutline={false}
|
|
111
100
|
value={validValue
|
|
112
|
-
?
|
|
113
|
-
:
|
|
101
|
+
? internalValue?.toString()
|
|
102
|
+
: ""}
|
|
114
103
|
onValueChange={onChange}
|
|
115
|
-
onMultiValueChange={onChange}
|
|
116
104
|
renderValue={renderValue}>
|
|
117
105
|
{enumValues?.map((enumConfig) => (
|
|
118
106
|
<SelectItem
|
|
@@ -5,14 +5,13 @@ import {
|
|
|
5
5
|
OnVirtualTableColumnResizeParams,
|
|
6
6
|
VirtualTableColumn,
|
|
7
7
|
VirtualTableFilterValues,
|
|
8
|
-
VirtualTableSize,
|
|
9
8
|
VirtualTableWhereFilterOp
|
|
10
9
|
} from "./VirtualTableProps";
|
|
11
10
|
import { FilterFormFieldProps } from "./VirtualTableHeader";
|
|
12
11
|
|
|
13
12
|
export type VirtualTableRowProps<T> = {
|
|
14
13
|
style: any,
|
|
15
|
-
|
|
14
|
+
rowHeight: number,
|
|
16
15
|
rowData: T;
|
|
17
16
|
rowIndex: number;
|
|
18
17
|
onRowClick?: (props: OnRowClickParams<any>) => void;
|
|
@@ -24,7 +23,7 @@ export type VirtualTableRowProps<T> = {
|
|
|
24
23
|
|
|
25
24
|
export type VirtualTableContextProps<T extends any> = {
|
|
26
25
|
data?: T[];
|
|
27
|
-
|
|
26
|
+
rowHeight?: number,
|
|
28
27
|
columns: VirtualTableColumn[];
|
|
29
28
|
cellRenderer: React.ComponentType<CellRendererParams<T>>;
|
|
30
29
|
currentSort: "asc" | "desc" | undefined;
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DeleteEntityDialog } from "
|
|
1
|
+
import { ArchiveIcon, DeleteIcon, EditIcon, FileCopyIcon, OpenInNewIcon } from "@firecms/ui";
|
|
2
|
+
import { EntityAction } from "../../types";
|
|
3
|
+
import { DeleteEntityDialog } from "../DeleteEntityDialog";
|
|
4
|
+
import { addRecentId } from "../EntityCollectionView/utils";
|
|
4
5
|
|
|
5
6
|
export const editEntityAction: EntityAction = {
|
|
6
|
-
icon: <
|
|
7
|
+
icon: <EditIcon/>,
|
|
7
8
|
name: "Edit",
|
|
8
9
|
collapsed: false,
|
|
9
10
|
onClick({
|
|
10
11
|
entity,
|
|
11
12
|
collection,
|
|
13
|
+
fullPath,
|
|
12
14
|
context,
|
|
13
15
|
highlightEntity,
|
|
14
|
-
unhighlightEntity
|
|
16
|
+
unhighlightEntity,
|
|
15
17
|
}): Promise<void> {
|
|
16
18
|
highlightEntity?.(entity);
|
|
17
19
|
context.analyticsController?.onAnalyticsEvent?.("entity_click", {
|
|
18
20
|
path: entity.path,
|
|
19
21
|
entityId: entity.id
|
|
20
22
|
});
|
|
23
|
+
if (collection) {
|
|
24
|
+
addRecentId(collection.id, entity.id);
|
|
25
|
+
}
|
|
26
|
+
const path = collection?.collectionGroup ? entity.path : (fullPath ?? entity.path);
|
|
21
27
|
context.sideEntityController.open({
|
|
22
28
|
entityId: entity.id,
|
|
23
|
-
path
|
|
29
|
+
path,
|
|
24
30
|
collection,
|
|
25
31
|
updateUrl: true,
|
|
26
|
-
onClose: () => unhighlightEntity?.(entity)
|
|
32
|
+
onClose: () => unhighlightEntity?.(entity),
|
|
27
33
|
});
|
|
28
34
|
return Promise.resolve(undefined);
|
|
29
35
|
}
|
|
@@ -37,7 +43,7 @@ export const copyEntityAction: EntityAction = {
|
|
|
37
43
|
collection,
|
|
38
44
|
context,
|
|
39
45
|
highlightEntity,
|
|
40
|
-
unhighlightEntity
|
|
46
|
+
unhighlightEntity,
|
|
41
47
|
}): Promise<void> {
|
|
42
48
|
highlightEntity?.(entity);
|
|
43
49
|
context.analyticsController?.onAnalyticsEvent?.("copy_entity_click", {
|
|
@@ -50,11 +56,12 @@ export const copyEntityAction: EntityAction = {
|
|
|
50
56
|
copy: true,
|
|
51
57
|
collection,
|
|
52
58
|
updateUrl: true,
|
|
53
|
-
onClose: () => unhighlightEntity?.(entity)
|
|
59
|
+
onClose: () => unhighlightEntity?.(entity),
|
|
54
60
|
});
|
|
55
61
|
return Promise.resolve(undefined);
|
|
56
62
|
}
|
|
57
63
|
}
|
|
64
|
+
|
|
58
65
|
export const archiveEntityAction: EntityAction = {
|
|
59
66
|
icon: <ArchiveIcon/>,
|
|
60
67
|
name: "Archive",
|
|
@@ -69,6 +76,7 @@ export const archiveEntityAction: EntityAction = {
|
|
|
69
76
|
return Promise.resolve(undefined);
|
|
70
77
|
}
|
|
71
78
|
}
|
|
79
|
+
|
|
72
80
|
export const openWebsiteAction: EntityAction = {
|
|
73
81
|
icon: <OpenInNewIcon/>,
|
|
74
82
|
name: "See in website",
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @group Components
|
|
3
|
+
*/
|
|
4
|
+
export type TableSize = "xs" | "s" | "m" | "l" | "xl";
|
|
2
5
|
|
|
3
|
-
export function getRowHeight(size:
|
|
6
|
+
export function getRowHeight(size: TableSize): number {
|
|
4
7
|
switch (size) {
|
|
5
8
|
case "xl":
|
|
6
9
|
return 400;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionSize,
|
|
1
|
+
import { CollectionSize, ResolvedProperty, SelectedCellProps } from "../../types";
|
|
2
2
|
|
|
3
3
|
export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
4
4
|
|
|
@@ -31,14 +31,12 @@ export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
|
31
31
|
* Props passed in a callback when the content of a cell in a table has been edited
|
|
32
32
|
* @group Collection components
|
|
33
33
|
*/
|
|
34
|
-
export interface OnCellValueChangeParams<T = any,
|
|
34
|
+
export interface OnCellValueChangeParams<T = any, D = any> {
|
|
35
35
|
value: T,
|
|
36
36
|
propertyKey: string,
|
|
37
|
-
|
|
37
|
+
data?: D,
|
|
38
38
|
onValueUpdated: () => void
|
|
39
|
-
setError: (e: Error) => void
|
|
40
|
-
fullPath: string
|
|
41
|
-
context: FireCMSContext
|
|
39
|
+
setError: (e: Error | undefined) => void
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/**
|
|
@@ -56,3 +54,8 @@ export type UniqueFieldValidator = (props: {
|
|
|
56
54
|
* @group Collection components
|
|
57
55
|
*/
|
|
58
56
|
export type OnCellValueChange<T, M extends Record<string, any>> = (params: OnCellValueChangeParams<T, M>) => Promise<void> | void;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @group Collection components
|
|
60
|
+
*/
|
|
61
|
+
export type OnColumnResizeParams = { width: number, key: string };
|
|
@@ -7,8 +7,16 @@ const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
|
|
|
7
7
|
|
|
8
8
|
export function useColumnIds<M extends Record<string, any>>(collection: ResolvedEntityCollection<M>, includeSubcollections: boolean): PropertyColumnConfig[] {
|
|
9
9
|
return useMemo(() => {
|
|
10
|
-
if (collection.propertiesOrder)
|
|
11
|
-
|
|
10
|
+
if (collection.propertiesOrder) {
|
|
11
|
+
const propertyColumnConfigs = hideAndExpandKeys(collection, collection.propertiesOrder);
|
|
12
|
+
if (collection.collectionGroup) {
|
|
13
|
+
propertyColumnConfigs.push({
|
|
14
|
+
key: COLLECTION_GROUP_PARENT_ID,
|
|
15
|
+
disabled: true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return propertyColumnConfigs;
|
|
19
|
+
}
|
|
12
20
|
return getDefaultColumnKeys(collection, includeSubcollections);
|
|
13
21
|
}, [collection, includeSubcollections]);
|
|
14
22
|
}
|
|
@@ -98,3 +106,16 @@ export function getColumnKeysForProperty(property: ResolvedProperty, key: string
|
|
|
98
106
|
disabled: disabled || Boolean(property.disabled) || Boolean(property.readOnly)
|
|
99
107
|
}];
|
|
100
108
|
}
|
|
109
|
+
|
|
110
|
+
export function getFormFieldKeys(collection: EntityCollection): string[] {
|
|
111
|
+
const propertyKeys = Object.keys(collection.properties);
|
|
112
|
+
const additionalFields = collection.additionalFields ?? [];
|
|
113
|
+
const allKeys = [
|
|
114
|
+
...propertyKeys,
|
|
115
|
+
...additionalFields.map((field) => field.key)
|
|
116
|
+
];
|
|
117
|
+
if (collection.propertiesOrder) {
|
|
118
|
+
return collection.propertiesOrder.filter(key => allKeys.includes(key));
|
|
119
|
+
}
|
|
120
|
+
return allKeys;
|
|
121
|
+
}
|
|
@@ -5,13 +5,14 @@ import { useDataOrder } from "../../hooks/data/useDataOrder";
|
|
|
5
5
|
import {
|
|
6
6
|
Entity,
|
|
7
7
|
EntityCollection,
|
|
8
|
+
EntityTableController,
|
|
8
9
|
FilterValues,
|
|
9
10
|
FireCMSContext,
|
|
10
11
|
SelectedCellProps,
|
|
11
|
-
EntityTableController,
|
|
12
12
|
User
|
|
13
13
|
} from "../../types";
|
|
14
14
|
import { useDebouncedData } from "./useDebouncedData";
|
|
15
|
+
import equal from "react-fast-compare"
|
|
15
16
|
|
|
16
17
|
const DEFAULT_PAGE_SIZE = 50;
|
|
17
18
|
|
|
@@ -31,6 +32,10 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
|
|
|
31
32
|
entitiesDisplayedFirst?: Entity<M>[];
|
|
32
33
|
|
|
33
34
|
lastDeleteTimestamp?: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Force filter to be applied to the table.
|
|
38
|
+
*/
|
|
34
39
|
forceFilter?: FilterValues<string>;
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -47,7 +52,7 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
|
|
|
47
52
|
* @param lastDeleteTimestamp
|
|
48
53
|
* @param forceFilterFromProps
|
|
49
54
|
*/
|
|
50
|
-
export function useDataSourceEntityCollectionTableController<M extends Record<string, any> = any,
|
|
55
|
+
export function useDataSourceEntityCollectionTableController<M extends Record<string, any> = any, USER extends User = User>(
|
|
51
56
|
{
|
|
52
57
|
fullPath,
|
|
53
58
|
collection,
|
|
@@ -65,7 +70,7 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
|
|
|
65
70
|
|
|
66
71
|
const [popupCell, setPopupCell] = React.useState<SelectedCellProps<M> | undefined>(undefined);
|
|
67
72
|
const navigation = useNavigationController();
|
|
68
|
-
const dataSource = useDataSource();
|
|
73
|
+
const dataSource = useDataSource(collection);
|
|
69
74
|
const resolvedPath = useMemo(() => navigation.resolveAliasesFrom(fullPath), [fullPath, navigation.resolveAliasesFrom]);
|
|
70
75
|
|
|
71
76
|
const forceFilter = forceFilterFromProps ?? forceFilterFromCollection;
|
|
@@ -75,6 +80,18 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
|
|
|
75
80
|
const [searchString, setSearchString] = React.useState<string | undefined>();
|
|
76
81
|
const [itemCount, setItemCount] = React.useState<number | undefined>(paginationEnabled ? pageSize : undefined);
|
|
77
82
|
|
|
83
|
+
const checkFilterCombination = useCallback((filterValues: FilterValues<any>,
|
|
84
|
+
sortBy?: [string, "asc" | "desc"]) => {
|
|
85
|
+
if (!dataSource.isFilterCombinationValid)
|
|
86
|
+
return true;
|
|
87
|
+
return dataSource.isFilterCombinationValid({
|
|
88
|
+
path: resolvedPath,
|
|
89
|
+
collection,
|
|
90
|
+
filterValues,
|
|
91
|
+
sortBy
|
|
92
|
+
})
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
78
95
|
const initialSortInternal = useMemo(() => {
|
|
79
96
|
if (initialSort && forceFilter && !checkFilterCombination(forceFilter, initialSort)) {
|
|
80
97
|
console.warn("Initial sort is not compatible with the force filter. Ignoring initial sort");
|
|
@@ -83,13 +100,19 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
|
|
|
83
100
|
return initialSort;
|
|
84
101
|
}, [initialSort, forceFilter]);
|
|
85
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!equal(forceFilter, filterValues)) {
|
|
105
|
+
setFilterValues(forceFilter)
|
|
106
|
+
}
|
|
107
|
+
}, [forceFilter]);
|
|
108
|
+
|
|
86
109
|
const [filterValues, setFilterValues] = React.useState<FilterValues<Extract<keyof M, string>> | undefined>(forceFilter ?? initialFilter ?? undefined);
|
|
87
110
|
const [sortBy, setSortBy] = React.useState<[Extract<keyof M, string>, "asc" | "desc"] | undefined>(initialSortInternal);
|
|
88
111
|
|
|
89
112
|
const sortByProperty = sortBy ? sortBy[0] : undefined;
|
|
90
113
|
const currentSort = sortBy ? sortBy[1] : undefined;
|
|
91
114
|
|
|
92
|
-
const context: FireCMSContext<
|
|
115
|
+
const context: FireCMSContext<USER> = useFireCMSContext();
|
|
93
116
|
|
|
94
117
|
const [rawData, setRawData] = useState<Entity<M>[]>([]);
|
|
95
118
|
|
|
@@ -97,18 +120,6 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
|
|
|
97
120
|
const [dataLoadingError, setDataLoadingError] = useState<Error | undefined>();
|
|
98
121
|
const [noMoreToLoad, setNoMoreToLoad] = useState<boolean>(false);
|
|
99
122
|
|
|
100
|
-
const checkFilterCombination = useCallback((filterValues: FilterValues<any>,
|
|
101
|
-
sortBy?: [string, "asc" | "desc"]) => {
|
|
102
|
-
if (!dataSource.isFilterCombinationValid)
|
|
103
|
-
return true;
|
|
104
|
-
return dataSource.isFilterCombinationValid({
|
|
105
|
-
path: resolvedPath,
|
|
106
|
-
collection,
|
|
107
|
-
filterValues,
|
|
108
|
-
sortBy
|
|
109
|
-
})
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
112
123
|
const clearFilter = useCallback(() => setFilterValues(forceFilter ?? undefined), [forceFilter]);
|
|
113
124
|
|
|
114
125
|
const updateFilterValues = useCallback((updatedFilter: FilterValues<Extract<keyof M, string>> | undefined) => {
|