@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
|
@@ -44,7 +44,7 @@ export function EntityCollectionViewActions<M extends Record<string, any>>({
|
|
|
44
44
|
|
|
45
45
|
const selectedEntities = selectionController.selectedEntities;
|
|
46
46
|
|
|
47
|
-
const addButton = canCreateEntity(collection, authController,
|
|
47
|
+
const addButton = canCreateEntity(collection, authController, path, null) &&
|
|
48
48
|
onNewClick && (largeLayout
|
|
49
49
|
? <Button
|
|
50
50
|
id={`add_entity_${path}`}
|
|
@@ -57,14 +57,13 @@ export function EntityCollectionViewActions<M extends Record<string, any>>({
|
|
|
57
57
|
: <Button
|
|
58
58
|
id={`add_entity_${path}`}
|
|
59
59
|
onClick={onNewClick}
|
|
60
|
-
size="medium"
|
|
61
60
|
variant="filled"
|
|
62
61
|
color="primary"
|
|
63
62
|
>
|
|
64
63
|
<AddIcon/>
|
|
65
64
|
</Button>);
|
|
66
65
|
|
|
67
|
-
const multipleDeleteEnabled = canDeleteEntity(collection, authController,
|
|
66
|
+
const multipleDeleteEnabled = canDeleteEntity(collection, authController, path, null);
|
|
68
67
|
|
|
69
68
|
let multipleDeleteButton: React.ReactNode | undefined;
|
|
70
69
|
if (selectionEnabled) {
|
|
@@ -112,11 +111,11 @@ export function EntityCollectionViewActions<M extends Record<string, any>>({
|
|
|
112
111
|
|
|
113
112
|
if (plugins) {
|
|
114
113
|
plugins.forEach((plugin, i) => {
|
|
115
|
-
if (plugin.
|
|
116
|
-
actions.push(...toArray(plugin.
|
|
114
|
+
if (plugin.collectionView?.CollectionActions) {
|
|
115
|
+
actions.push(...toArray(plugin.collectionView?.CollectionActions)
|
|
117
116
|
.map((Action, j) => (
|
|
118
117
|
<ErrorBoundary key={`plugin_actions_${i}_${j}`}>
|
|
119
|
-
<Action {...actionProps} {...plugin.
|
|
118
|
+
<Action {...actionProps} {...plugin.collectionView?.collectionActionsProps}/>
|
|
120
119
|
</ErrorBoundary>
|
|
121
120
|
)));
|
|
122
121
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useCustomizationController, useFireCMSContext } from "../../hooks";
|
|
3
|
+
import { CollectionActionsProps, EntityCollection, EntityTableController, SelectionController } from "../../types";
|
|
4
|
+
import { toArray } from "../../util/arrays";
|
|
5
|
+
import { ErrorBoundary } from "../ErrorBoundary";
|
|
6
|
+
import { ClearFilterSortButton } from "../ClearFilterSortButton";
|
|
7
|
+
|
|
8
|
+
export type EntityCollectionViewStartActionsProps<M extends Record<string, any>> = {
|
|
9
|
+
collection: EntityCollection<M>;
|
|
10
|
+
path: string;
|
|
11
|
+
relativePath: string;
|
|
12
|
+
parentCollectionIds: string[];
|
|
13
|
+
selectionController: SelectionController<M>;
|
|
14
|
+
tableController: EntityTableController<M>;
|
|
15
|
+
collectionEntitiesCount: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function EntityCollectionViewStartActions<M extends Record<string, any>>({
|
|
19
|
+
collection,
|
|
20
|
+
relativePath,
|
|
21
|
+
parentCollectionIds,
|
|
22
|
+
path,
|
|
23
|
+
selectionController,
|
|
24
|
+
tableController,
|
|
25
|
+
collectionEntitiesCount
|
|
26
|
+
}: EntityCollectionViewStartActionsProps<M>) {
|
|
27
|
+
|
|
28
|
+
const context = useFireCMSContext();
|
|
29
|
+
|
|
30
|
+
const customizationController = useCustomizationController();
|
|
31
|
+
const plugins = customizationController.plugins ?? [];
|
|
32
|
+
|
|
33
|
+
const actionProps: CollectionActionsProps = {
|
|
34
|
+
path,
|
|
35
|
+
relativePath,
|
|
36
|
+
parentCollectionIds,
|
|
37
|
+
collection,
|
|
38
|
+
selectionController,
|
|
39
|
+
context,
|
|
40
|
+
tableController,
|
|
41
|
+
collectionEntitiesCount
|
|
42
|
+
};
|
|
43
|
+
const actions: React.ReactNode[] = [
|
|
44
|
+
<ClearFilterSortButton
|
|
45
|
+
key={"clear_filter"}
|
|
46
|
+
tableController={tableController}
|
|
47
|
+
enabled={!collection.forceFilter}/>
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
if (plugins) {
|
|
51
|
+
plugins.forEach((plugin, i) => {
|
|
52
|
+
if (plugin.collectionView?.CollectionActionsStart) {
|
|
53
|
+
actions.push(...toArray(plugin.collectionView?.CollectionActionsStart)
|
|
54
|
+
.map((Action, j) => (
|
|
55
|
+
<ErrorBoundary key={`plugin_actions_${i}_${j}`}>
|
|
56
|
+
<Action {...actionProps} {...plugin.collectionView?.collectionActionsStartProps}/>
|
|
57
|
+
</ErrorBoundary>
|
|
58
|
+
)));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
{actions}
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import { Entity, SelectionController } from "../../types";
|
|
3
|
+
|
|
4
|
+
export function useSelectionController<M extends Record<string, any> = any>(
|
|
5
|
+
onSelectionChange?: (entity: Entity<M>, selected: boolean) => void
|
|
6
|
+
): SelectionController<M> {
|
|
7
|
+
|
|
8
|
+
const [selectedEntities, setSelectedEntities] = useState<Entity<M>[]>([]);
|
|
9
|
+
|
|
10
|
+
const toggleEntitySelection = useCallback((entity: Entity<M>, newSelectedState?: boolean) => {
|
|
11
|
+
let newValue;
|
|
12
|
+
if (newSelectedState === undefined) {
|
|
13
|
+
if (selectedEntities.map(e => e.id).includes(entity.id)) {
|
|
14
|
+
onSelectionChange?.(entity, false);
|
|
15
|
+
newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
|
|
16
|
+
} else {
|
|
17
|
+
onSelectionChange?.(entity, true);
|
|
18
|
+
newValue = [...selectedEntities, entity];
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
if (newSelectedState) {
|
|
22
|
+
onSelectionChange?.(entity, true);
|
|
23
|
+
newValue = [...selectedEntities, entity];
|
|
24
|
+
} else {
|
|
25
|
+
onSelectionChange?.(entity, false);
|
|
26
|
+
newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
setSelectedEntities(newValue);
|
|
30
|
+
}, [selectedEntities]);
|
|
31
|
+
|
|
32
|
+
const isEntitySelected = useCallback((entity: Entity<M>) => {
|
|
33
|
+
return selectedEntities.map(e => e.id).includes(entity.id);
|
|
34
|
+
}, [selectedEntities]);
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
selectedEntities,
|
|
38
|
+
setSelectedEntities,
|
|
39
|
+
isEntitySelected,
|
|
40
|
+
toggleEntitySelection
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function addRecentId(collectionId: string, id: string) {
|
|
2
|
+
const recentIds = getRecentIds(collectionId);
|
|
3
|
+
const newRecentIds = [id, ...recentIds.filter(i => i !== id)];
|
|
4
|
+
if (newRecentIds.length > 5) {
|
|
5
|
+
newRecentIds.pop();
|
|
6
|
+
}
|
|
7
|
+
saveSearchedIdsLocally(collectionId, newRecentIds);
|
|
8
|
+
return newRecentIds;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function saveSearchedIdsLocally(collectionId: string, ids: string[]) {
|
|
12
|
+
localStorage.setItem("recent_id_searches::" + collectionId, JSON.stringify(ids));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getRecentIds(collectionId: string): string[] {
|
|
16
|
+
const stored = localStorage.getItem("recent_id_searches::" + collectionId);
|
|
17
|
+
if (!stored) return [];
|
|
18
|
+
return JSON.parse(stored);
|
|
19
|
+
}
|
|
@@ -1,85 +1,222 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
import { Entity, EntityCollection, ResolvedProperty } from "../types";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
getEntityImagePreviewPropertyKey,
|
|
8
|
+
getEntityPreviewKeys,
|
|
9
|
+
getEntityTitlePropertyKey,
|
|
10
|
+
getValueInPath,
|
|
11
|
+
IconForView,
|
|
12
|
+
resolveCollection
|
|
13
|
+
} from "../util";
|
|
14
|
+
import { cls, defaultBorderMixin, IconButton, KeyboardTabIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
|
|
15
|
+
import { PreviewSize, PropertyPreview, SkeletonPropertyComponent } from "../preview";
|
|
16
|
+
import { useCustomizationController, useNavigationController, useSideEntityController } from "../hooks";
|
|
17
|
+
import { useAnalyticsController } from "../hooks/useAnalyticsController";
|
|
18
|
+
|
|
19
|
+
export type EntityPreviewProps = {
|
|
20
|
+
size: PreviewSize,
|
|
21
|
+
actions?: React.ReactNode,
|
|
22
|
+
collection?: EntityCollection,
|
|
23
|
+
hover?: boolean;
|
|
24
|
+
previewProperties?: string[],
|
|
25
|
+
disabled?: boolean,
|
|
26
|
+
entity: Entity<any>,
|
|
27
|
+
includeId?: boolean,
|
|
28
|
+
includeEntityLink?: boolean,
|
|
29
|
+
onClick?: (e: React.SyntheticEvent) => void;
|
|
30
|
+
};
|
|
9
31
|
|
|
10
32
|
/**
|
|
11
|
-
*
|
|
33
|
+
* This view is used to display a preview of an entity.
|
|
34
|
+
* It is used by default in reference fields and whenever a reference is displayed.
|
|
12
35
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
export function EntityPreview({
|
|
37
|
+
actions,
|
|
38
|
+
disabled,
|
|
39
|
+
hover,
|
|
40
|
+
collection: collectionProp,
|
|
41
|
+
previewProperties,
|
|
42
|
+
onClick,
|
|
43
|
+
size,
|
|
44
|
+
includeId = true,
|
|
45
|
+
includeEntityLink = true,
|
|
46
|
+
entity
|
|
47
|
+
}: EntityPreviewProps) {
|
|
19
48
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
className
|
|
26
|
-
}: EntityPreviewProps<M>) {
|
|
49
|
+
const analyticsController = useAnalyticsController();
|
|
50
|
+
const sideEntityController = useSideEntityController();
|
|
51
|
+
const customizationController = useCustomizationController();
|
|
52
|
+
|
|
53
|
+
const navigationController = useNavigationController();
|
|
27
54
|
|
|
28
|
-
const
|
|
29
|
-
|
|
55
|
+
const collection = collectionProp ?? navigationController.getCollection(entity.path);
|
|
56
|
+
|
|
57
|
+
if (!collection) {
|
|
58
|
+
throw Error(`Couldn't find the corresponding collection view for the path: ${entity.path}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const resolvedCollection = React.useMemo(() => resolveCollection({
|
|
30
62
|
collection,
|
|
31
|
-
path,
|
|
32
|
-
entityId: entity.id,
|
|
63
|
+
path: entity.path,
|
|
33
64
|
values: entity.values,
|
|
34
65
|
fields: customizationController.propertyConfigs
|
|
35
|
-
}), [collection
|
|
66
|
+
}), [collection]);
|
|
36
67
|
|
|
37
|
-
const
|
|
68
|
+
const listProperties = useMemo(() => getEntityPreviewKeys(resolvedCollection, customizationController.propertyConfigs, previewProperties, size === "small" || size === "medium" ? 3 : 1),
|
|
69
|
+
[previewProperties, resolvedCollection, size]);
|
|
38
70
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
const titleProperty = getEntityTitlePropertyKey(resolvedCollection, customizationController.propertyConfigs);
|
|
72
|
+
const imagePropertyKey = getEntityImagePreviewPropertyKey(resolvedCollection);
|
|
73
|
+
const imageProperty = imagePropertyKey ? resolvedCollection.properties[imagePropertyKey] : undefined;
|
|
74
|
+
|
|
75
|
+
const restProperties = listProperties.filter(p => p !== titleProperty && p !== imagePropertyKey);
|
|
76
|
+
|
|
77
|
+
return <EntityPreviewContainer onClick={disabled ? undefined : onClick}
|
|
78
|
+
hover={disabled ? undefined : hover}
|
|
79
|
+
size={size}>
|
|
80
|
+
<div className={cls("flex w-10 h-10 mr-2 shrink-0", size === "smallest" ? "my-0.5" : "m-2 self-start")}>
|
|
81
|
+
{imageProperty && <PropertyPreview property={imageProperty}
|
|
82
|
+
propertyKey={imagePropertyKey as string}
|
|
83
|
+
size={"smallest"}
|
|
84
|
+
value={getValueInPath(entity.values, imagePropertyKey as string)}/>}
|
|
85
|
+
{!imageProperty && <IconForView collectionOrView={collection} size={size} className={"m-auto"}/>}
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<div className={"flex flex-col grow-1 w-full max-w-full m-1"}>
|
|
90
|
+
|
|
91
|
+
{size !== "smallest" && includeId && (
|
|
92
|
+
entity
|
|
93
|
+
? <div className={`${
|
|
94
|
+
size !== "medium"
|
|
95
|
+
? "block whitespace-nowrap overflow-hidden truncate"
|
|
96
|
+
: ""
|
|
97
|
+
}`}>
|
|
98
|
+
<Typography variant={"caption"}
|
|
99
|
+
color={"disabled"}
|
|
100
|
+
className={"font-mono"}>
|
|
101
|
+
{entity.id}
|
|
102
|
+
</Typography>
|
|
58
103
|
</div>
|
|
104
|
+
: <Skeleton/>)}
|
|
105
|
+
|
|
106
|
+
{titleProperty && (
|
|
107
|
+
<div className={"my-0.5 text-sm font-medium"}>
|
|
108
|
+
{
|
|
109
|
+
entity
|
|
110
|
+
? <PropertyPreview
|
|
111
|
+
propertyKey={titleProperty as string}
|
|
112
|
+
value={getValueInPath(entity.values, titleProperty)}
|
|
113
|
+
property={resolvedCollection.properties[titleProperty as string] as ResolvedProperty}
|
|
114
|
+
size={"medium"}/>
|
|
115
|
+
: <SkeletonPropertyComponent
|
|
116
|
+
property={resolvedCollection.properties[titleProperty as string] as ResolvedProperty}
|
|
117
|
+
size={"medium"}/>
|
|
118
|
+
}
|
|
59
119
|
</div>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
120
|
+
)}
|
|
121
|
+
|
|
122
|
+
{restProperties && restProperties.map((key) => {
|
|
123
|
+
const childProperty = resolvedCollection.properties[key as string];
|
|
124
|
+
if (!childProperty) return null;
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<div key={"ref_prev_" + key}
|
|
128
|
+
className={restProperties.length > 1 ? "my-0.5" : "my-0"}>
|
|
129
|
+
{
|
|
130
|
+
entity
|
|
131
|
+
? <PropertyPreview
|
|
132
|
+
propertyKey={key as string}
|
|
133
|
+
value={getValueInPath(entity.values, key)}
|
|
134
|
+
property={childProperty as ResolvedProperty}
|
|
135
|
+
size={"smallest"}/>
|
|
136
|
+
: <SkeletonPropertyComponent
|
|
137
|
+
property={childProperty as ResolvedProperty}
|
|
138
|
+
size={"smallest"}/>
|
|
139
|
+
}
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
})}
|
|
143
|
+
|
|
83
144
|
</div>
|
|
84
|
-
|
|
145
|
+
|
|
146
|
+
{entity && includeEntityLink &&
|
|
147
|
+
<Tooltip title={`See details for ${entity.id}`}>
|
|
148
|
+
<IconButton
|
|
149
|
+
color={"inherit"}
|
|
150
|
+
size={"small"}
|
|
151
|
+
className={size !== "smallest" ? "self-start" : ""}
|
|
152
|
+
onClick={(e) => {
|
|
153
|
+
e.stopPropagation();
|
|
154
|
+
analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
|
|
155
|
+
path: entity.path,
|
|
156
|
+
entityId: entity.id
|
|
157
|
+
});
|
|
158
|
+
sideEntityController.open({
|
|
159
|
+
entityId: entity.id,
|
|
160
|
+
path: entity.path,
|
|
161
|
+
collection,
|
|
162
|
+
updateUrl: true
|
|
163
|
+
});
|
|
164
|
+
}}>
|
|
165
|
+
<KeyboardTabIcon size={"small"}/>
|
|
166
|
+
</IconButton>
|
|
167
|
+
</Tooltip>}
|
|
168
|
+
|
|
169
|
+
{actions}
|
|
170
|
+
|
|
171
|
+
</EntityPreviewContainer>;
|
|
85
172
|
}
|
|
173
|
+
|
|
174
|
+
export type EntityPreviewContainerProps = {
|
|
175
|
+
children: React.ReactNode;
|
|
176
|
+
hover?: boolean;
|
|
177
|
+
fullwidth?: boolean;
|
|
178
|
+
size: PreviewSize;
|
|
179
|
+
className?: string;
|
|
180
|
+
style?: React.CSSProperties;
|
|
181
|
+
onClick?: (e: React.SyntheticEvent) => void;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({
|
|
186
|
+
children,
|
|
187
|
+
hover,
|
|
188
|
+
onClick,
|
|
189
|
+
size,
|
|
190
|
+
style,
|
|
191
|
+
className,
|
|
192
|
+
fullwidth = true,
|
|
193
|
+
...props
|
|
194
|
+
}, ref) => {
|
|
195
|
+
return <div
|
|
196
|
+
ref={ref}
|
|
197
|
+
style={{
|
|
198
|
+
...style,
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
tabindex: 0
|
|
201
|
+
}}
|
|
202
|
+
className={cls(
|
|
203
|
+
"bg-white dark:bg-gray-900",
|
|
204
|
+
"min-h-[42px]",
|
|
205
|
+
fullwidth ? "w-full" : "",
|
|
206
|
+
"items-center",
|
|
207
|
+
hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
|
|
208
|
+
size === "smallest" ? "p-1" : "px-2 py-1",
|
|
209
|
+
"flex border rounded-lg",
|
|
210
|
+
onClick ? "cursor-pointer" : "",
|
|
211
|
+
defaultBorderMixin,
|
|
212
|
+
className)}
|
|
213
|
+
onClick={(event) => {
|
|
214
|
+
if (onClick) {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
onClick(event);
|
|
217
|
+
}
|
|
218
|
+
}}
|
|
219
|
+
{...props}>
|
|
220
|
+
{children}
|
|
221
|
+
</div>;
|
|
222
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { PropertyPreview } from "../preview";
|
|
3
|
+
import { Entity, EntityCollection, ResolvedEntityCollection, ResolvedProperties } from "../types";
|
|
4
|
+
import { resolveCollection } from "../util";
|
|
5
|
+
import { cls, defaultBorderMixin, IconButton, OpenInNewIcon } from "@firecms/ui";
|
|
6
|
+
import { CustomizationController } from "../types/customization_controller";
|
|
7
|
+
import { useCustomizationController } from "../hooks/useCustomizationController";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @group Components
|
|
11
|
+
*/
|
|
12
|
+
export interface EntityViewProps<M extends Record<string, any>> {
|
|
13
|
+
entity: Entity<M>;
|
|
14
|
+
collection: EntityCollection<M>;
|
|
15
|
+
path: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function EntityView<M extends Record<string, any>>(
|
|
20
|
+
{
|
|
21
|
+
entity,
|
|
22
|
+
collection,
|
|
23
|
+
path,
|
|
24
|
+
className
|
|
25
|
+
}: EntityViewProps<M>) {
|
|
26
|
+
|
|
27
|
+
const customizationController: CustomizationController = useCustomizationController();
|
|
28
|
+
const resolvedCollection: ResolvedEntityCollection<M> = useMemo(() => resolveCollection<M>({
|
|
29
|
+
collection,
|
|
30
|
+
path,
|
|
31
|
+
entityId: entity.id,
|
|
32
|
+
values: entity.values,
|
|
33
|
+
fields: customizationController.propertyConfigs
|
|
34
|
+
}), [collection, path, entity, customizationController.propertyConfigs]);
|
|
35
|
+
|
|
36
|
+
const properties: ResolvedProperties = resolvedCollection.properties;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={"w-full " + className}>
|
|
40
|
+
<div className={"w-full mb-4"}>
|
|
41
|
+
<div className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
|
|
42
|
+
<div className="flex items-center w-1/4">
|
|
43
|
+
<span className="pl-2 text-sm text-gray-600">Id</span>
|
|
44
|
+
</div>
|
|
45
|
+
<div
|
|
46
|
+
className="flex-grow p-2 ml-2 w-3/4 text-gray-900 dark:text-white min-h-[56px] flex items-center">
|
|
47
|
+
<span className="flex-grow mr-2">{entity.id}</span>
|
|
48
|
+
{customizationController?.entityLinkBuilder &&
|
|
49
|
+
<a href={customizationController.entityLinkBuilder({ entity })}
|
|
50
|
+
rel="noopener noreferrer"
|
|
51
|
+
target="_blank">
|
|
52
|
+
<IconButton>
|
|
53
|
+
<OpenInNewIcon
|
|
54
|
+
size={"small"}/>
|
|
55
|
+
</IconButton>
|
|
56
|
+
</a>}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
{Object.entries(properties)
|
|
60
|
+
.map(([key, property]) => {
|
|
61
|
+
const value = entity.values?.[key];
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
key={`reference_previews_${key}`}
|
|
65
|
+
className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
|
|
66
|
+
<div className="flex items-center w-1/4">
|
|
67
|
+
<span className="pl-2 text-sm text-gray-600">{property.name}</span>
|
|
68
|
+
</div>
|
|
69
|
+
<div
|
|
70
|
+
className="flex-grow p-2 ml-2 w-3/4 text-gray-900 dark:text-white min-h-[56px] flex items-center">
|
|
71
|
+
<PropertyPreview
|
|
72
|
+
propertyKey={key}
|
|
73
|
+
value={value}
|
|
74
|
+
// entity={entity}
|
|
75
|
+
property={property}
|
|
76
|
+
size={"medium"}/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
80
|
+
})}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Typography } from "@firecms/ui";
|
|
3
|
+
|
|
4
|
+
export function FieldCaption({
|
|
5
|
+
error,
|
|
6
|
+
children
|
|
7
|
+
}: { error?: boolean, children?: React.ReactNode }) {
|
|
8
|
+
if (!children) return null;
|
|
9
|
+
return (
|
|
10
|
+
<Typography variant={"caption"} color={error ? "error" : "secondary"} className={"ml-3.5 mt-0.5"}>
|
|
11
|
+
{children}
|
|
12
|
+
</Typography>
|
|
13
|
+
);
|
|
14
|
+
}
|