@rebasepro/admin 0.8.0 → 0.9.1-canary.09aaf62
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 +26 -26
- package/dist/{CollectionEditorDialog-BO_aQ-Z4.js → CollectionEditorDialog-DbPpDDwb.js} +40 -18
- package/dist/CollectionEditorDialog-DbPpDDwb.js.map +1 -0
- package/dist/{PropertyEditView-DKzOpMjR.js → PropertyEditView-DfJbZ67t.js} +81 -73
- package/dist/PropertyEditView-DfJbZ67t.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-BQTIExjA.js → RouterCollectionsStudioView-C6XQ7Il5.js} +5 -5
- package/dist/RouterCollectionsStudioView-C6XQ7Il5.js.map +1 -0
- package/dist/collection_editor/_cms_internals.d.ts +3 -3
- package/dist/collection_editor/api/generateCollectionApi.d.ts +8 -8
- package/dist/collection_editor/extensibility_types.d.ts +3 -3
- package/dist/collection_editor/index.d.ts +2 -2
- package/dist/collection_editor/pgColumnToProperty.d.ts +3 -3
- package/dist/collection_editor/serializable_types.d.ts +7 -7
- package/dist/collection_editor/serializable_utils.d.ts +8 -8
- package/dist/collection_editor/types/collection_editor_controller.d.ts +5 -5
- package/dist/collection_editor/types/collection_inference.d.ts +2 -2
- package/dist/collection_editor/types/config_controller.d.ts +7 -7
- package/dist/collection_editor/ui/AddKanbanColumnAction.d.ts +2 -2
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +2 -2
- package/dist/collection_editor/ui/KanbanSetupAction.d.ts +2 -2
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.d.ts +3 -3
- package/dist/collection_editor/ui/collection_editor/CollectionDetailsForm.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +4 -4
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +4 -4
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/EntityActionsEditTab.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +5 -5
- package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +3 -3
- package/dist/collection_editor/ui/collection_editor/SwitchControl.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +2 -2
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +2 -2
- package/dist/collection_editor/useSafeSnackbarController.d.ts +1 -1
- package/dist/collection_editor/validateCollectionJson.d.ts +2 -2
- package/dist/collection_editor_ui.js +5 -5
- package/dist/collection_editor_ui.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +4 -4
- package/dist/components/{EntityCollectionTable/EntityCollectionRowActions.d.ts → CollectionTableBinding/CollectionRowActions.d.ts} +3 -3
- package/dist/components/CollectionTableBinding/CollectionTableBinding.d.ts +28 -0
- package/dist/components/{EntityCollectionTable/EntityCollectionTableProps.d.ts → CollectionTableBinding/CollectionTableBindingProps.d.ts} +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/index.d.ts +6 -0
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.d.ts +1 -1
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.d.ts +3 -3
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.d.ts +1 -1
- package/dist/components/{EntityCollectionView/EntityBoardCard.d.ts → CollectionViewBinding/BoardCardBinding.d.ts} +8 -8
- package/dist/components/{EntityCollectionView/EntityCollectionBoardView.d.ts → CollectionViewBinding/CollectionBoardViewBinding.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionCardView.d.ts → CollectionViewBinding/CollectionCardViewBinding.d.ts} +5 -5
- package/dist/components/{EntityCollectionView/EntityCollectionListView.d.ts → CollectionViewBinding/CollectionListViewBinding.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionViewActions.d.ts → CollectionViewBinding/CollectionViewActions.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionView.d.ts → CollectionViewBinding/CollectionViewBinding.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionViewStartActions.d.ts → CollectionViewBinding/CollectionViewStartActions.d.ts} +4 -4
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +21 -0
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.d.ts +3 -3
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.d.ts +3 -3
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.d.ts +2 -2
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.d.ts +2 -2
- package/dist/components/{EntityCollectionView/useEntityPreviewSlots.d.ts → CollectionViewBinding/usePreviewSlots.d.ts} +5 -5
- package/dist/components/DeleteEntityDialog.d.ts +4 -4
- package/dist/components/{EntityDetailView.d.ts → DetailViewBinding.d.ts} +5 -5
- package/dist/components/EditFormActions.d.ts +3 -0
- package/dist/components/{EntityEditView.d.ts → EditViewBinding.d.ts} +9 -9
- package/dist/components/{EntityPreview.d.ts → EntityPreviewBinding.d.ts} +13 -13
- package/dist/components/EntityViewBinding.d.ts +13 -0
- package/dist/components/{EntityJsonPreview.d.ts → JsonPreviewBinding.d.ts} +1 -1
- package/dist/components/{RebaseCMS.d.ts → RebaseAdmin.d.ts} +2 -2
- package/dist/components/RebaseLayout.d.ts +5 -4
- package/dist/components/RebaseNavigation.d.ts +1 -1
- package/dist/components/RebaseShell.d.ts +1 -0
- package/dist/components/ReferenceTable/{EntitySelectionTable.d.ts → SelectionTableBinding.d.ts} +5 -5
- package/dist/components/SelectableTable/SelectableTable.d.ts +6 -6
- package/dist/components/SelectableTable/SelectableTableContext.d.ts +3 -3
- package/dist/components/SelectableTable/SelectionStore.d.ts +2 -2
- package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +6 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +7 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +40 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +7 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +7 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +7 -1
- package/dist/components/SideDialogs.d.ts +1 -1
- package/dist/components/SidePanelBinding.d.ts +11 -0
- package/dist/components/{SideEntityProvider.d.ts → SidePanelProvider.d.ts} +7 -7
- package/dist/components/history/EntityHistoryEntry.d.ts +2 -2
- package/dist/components/history/LastEditedByIndicator.d.ts +2 -2
- package/dist/components/index.d.ts +15 -14
- package/dist/contexts/SidePanelControllerContext.d.ts +3 -0
- package/dist/data_export/export/ExportCollectionAction.d.ts +3 -3
- package/dist/data_import/components/ImportSaveInProgress.d.ts +2 -2
- package/dist/editor.js +1 -1
- package/dist/editor.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/LocalChangesMenu.d.ts +1 -1
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
- package/dist/form/form_utils.d.ts +2 -2
- package/dist/{history-B3cqBzEV.js → history-GSa4BgDt.js} +7 -7
- package/dist/history-GSa4BgDt.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +2 -2
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +5 -5
- package/dist/hooks/navigation/useNavigationResolution.d.ts +4 -4
- package/dist/hooks/navigation/useResolvedCollections.d.ts +7 -7
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +2 -2
- package/dist/hooks/navigation/utils.d.ts +5 -5
- package/dist/hooks/useBuildSidePanel.d.ts +6 -0
- package/dist/hooks/useCMSContext.d.ts +2 -2
- package/dist/hooks/{useEntityHistory.d.ts → useHistory.d.ts} +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/{useEntitySelectionDialog.d.ts → useSelectionDialog.d.ts} +2 -2
- package/dist/hooks/useSideDialogsController.d.ts +1 -1
- package/dist/hooks/useSidePanel.d.ts +11 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{src-cxV1ODRG.js → src-B8WuGSPZ.js} +886 -692
- package/dist/src-B8WuGSPZ.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +2 -2
- package/dist/types/components/EntityFormProps.d.ts +3 -3
- package/dist/types/components/formex.d.ts +1 -1
- package/dist/types/fields.d.ts +2 -2
- package/dist/util/dataControllerAdapter.d.ts +2 -5
- package/dist/util/navigation_utils.d.ts +6 -6
- package/dist/util/previews.d.ts +3 -3
- package/dist/util/property_utils.d.ts +2 -2
- package/dist/util/{entity_view_constants.d.ts → view_constants.d.ts} +1 -1
- package/package.json +12 -17
- package/src/collection_editor/ConfigControllerProvider.tsx +11 -11
- package/src/collection_editor/_cms_internals.ts +3 -3
- package/src/collection_editor/api/generateCollectionApi.ts +8 -8
- package/src/collection_editor/extensibility_types.ts +3 -3
- package/src/collection_editor/index.ts +3 -3
- package/src/collection_editor/pgColumnToProperty.ts +3 -3
- package/src/collection_editor/serializable_types.ts +8 -8
- package/src/collection_editor/serializable_utils.ts +17 -17
- package/src/collection_editor/types/collection_editor_controller.tsx +5 -5
- package/src/collection_editor/types/collection_inference.ts +2 -2
- package/src/collection_editor/types/config_controller.tsx +7 -7
- package/src/collection_editor/ui/AddKanbanColumnAction.tsx +3 -3
- package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +3 -3
- package/src/collection_editor/ui/EditorCollectionAction.tsx +3 -3
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +3 -3
- package/src/collection_editor/ui/EditorEntityAction.tsx +3 -3
- package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +1 -1
- package/src/collection_editor/ui/KanbanSetupAction.tsx +3 -3
- package/src/collection_editor/ui/MissingReferenceWidget.tsx +1 -1
- package/src/collection_editor/ui/NewCollectionButton.tsx +1 -1
- package/src/collection_editor/ui/NewCollectionCard.tsx +1 -1
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +6 -6
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +6 -6
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +29 -29
- package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +10 -10
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +38 -7
- package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/EntityActionsSelectDialog.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/EnumForm.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +7 -7
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +9 -9
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +46 -37
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +7 -7
- package/src/collection_editor/ui/collection_editor/SwitchControl.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/BooleanPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +2 -2
- package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +2 -2
- package/src/collection_editor/ui/collection_editor/templates/products_template.ts +2 -2
- package/src/collection_editor/ui/collection_editor/templates/users_template.ts +2 -2
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +13 -13
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +4 -4
- package/src/collection_editor/useSafeSnackbarController.ts +1 -1
- package/src/collection_editor/validateCollectionJson.ts +3 -3
- package/src/components/AdminModeSyncer.tsx +1 -1
- package/src/components/ArrayContainer.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +1 -1
- package/src/components/CollectionPanel.tsx +14 -17
- package/src/components/{EntityCollectionTable/EntityCollectionRowActions.tsx → CollectionTableBinding/CollectionRowActions.tsx} +8 -8
- package/src/components/{EntityCollectionTable/EntityCollectionTable.tsx → CollectionTableBinding/CollectionTableBinding.tsx} +13 -13
- package/src/components/{EntityCollectionTable/EntityCollectionTableProps.tsx → CollectionTableBinding/CollectionTableBindingProps.tsx} +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/PropertyTableCell.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.tsx +7 -7
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.tsx +10 -10
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.tsx +7 -7
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.tsx +1 -1
- package/src/components/CollectionTableBinding/index.tsx +14 -0
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/CollectionTableToolbar.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.tsx +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.tsx +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.tsx +6 -6
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.tsx +1 -1
- package/src/components/{EntityCollectionView/EntityBoardCard.tsx → CollectionViewBinding/BoardCardBinding.tsx} +17 -17
- package/src/components/{EntityCollectionView/EntityCollectionBoardView.tsx → CollectionViewBinding/CollectionBoardViewBinding.tsx} +17 -16
- package/src/components/{EntityCollectionView/EntityCollectionCardView.tsx → CollectionViewBinding/CollectionCardViewBinding.tsx} +9 -9
- package/src/components/{EntityCollectionView/EntityCollectionListView.tsx → CollectionViewBinding/CollectionListViewBinding.tsx} +15 -15
- package/src/components/{EntityCollectionView/EntityCollectionViewActions.tsx → CollectionViewBinding/CollectionViewActions.tsx} +7 -7
- package/src/components/{EntityCollectionView/EntityCollectionView.tsx → CollectionViewBinding/CollectionViewBinding.tsx} +107 -92
- package/src/components/{EntityCollectionView/EntityCollectionViewStartActions.tsx → CollectionViewBinding/CollectionViewStartActions.tsx} +6 -6
- package/src/components/{EntityCollectionView/EntityCard.tsx → CollectionViewBinding/EntityCardBinding.tsx} +12 -12
- package/src/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.tsx +49 -72
- package/src/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.tsx +10 -10
- package/src/components/{EntityCollectionView → CollectionViewBinding}/ViewModeToggle.tsx +1 -1
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.ts +6 -6
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.ts +5 -5
- package/src/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.tsx +25 -13
- package/src/components/{EntityCollectionView/useEntityPreviewSlots.ts → CollectionViewBinding/usePreviewSlots.ts} +9 -9
- package/src/components/DefaultAppBar.tsx +3 -3
- package/src/components/DefaultDrawer.tsx +3 -3
- package/src/components/DeleteEntityDialog.tsx +7 -7
- package/src/components/{EntityDetailView.tsx → DetailViewBinding.tsx} +28 -31
- package/src/components/DrawerNavigationGroup.tsx +2 -2
- package/src/components/{EntityEditViewFormActions.tsx → EditFormActions.tsx} +16 -16
- package/src/components/{EntityEditView.tsx → EditViewBinding.tsx} +34 -37
- package/src/components/{EntityPreview.tsx → EntityPreviewBinding.tsx} +30 -30
- package/src/components/{EntityView.tsx → EntityViewBinding.tsx} +7 -7
- package/src/components/HomePage/ContentHomePage.tsx +4 -4
- package/src/components/HomePage/FavouritesView.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +4 -4
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/HomePage/RenameGroupDialog.tsx +1 -1
- package/src/components/{EntityJsonPreview.tsx → JsonPreviewBinding.tsx} +2 -2
- package/src/components/{RebaseCMS.tsx → RebaseAdmin.tsx} +6 -5
- package/src/components/RebaseAuthGate.tsx +2 -2
- package/src/components/RebaseLayout.tsx +7 -13
- package/src/components/RebaseNavigation.tsx +35 -11
- package/src/components/RebaseRouteDefs.tsx +2 -2
- package/src/components/RebaseShell.tsx +2 -1
- package/src/components/ReferenceTable/{EntitySelectionTable.tsx → SelectionTableBinding.tsx} +27 -24
- package/src/components/ReferenceWidget.tsx +4 -4
- package/src/components/RelationSelector.tsx +15 -13
- package/src/components/SearchIconsView.tsx +2 -2
- package/src/components/SelectableTable/SelectableTable.tsx +35 -88
- package/src/components/SelectableTable/SelectableTableContext.tsx +3 -3
- package/src/components/SelectableTable/SelectionStore.ts +4 -4
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +10 -2
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +34 -13
- package/src/components/SelectableTable/filters/FilterFieldBinding.tsx +187 -0
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +22 -8
- package/src/components/SelectableTable/filters/RelationFilterField.tsx +17 -3
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +67 -13
- package/src/components/SideDialogs.tsx +4 -4
- package/src/components/{EntitySidePanel.tsx → SidePanelBinding.tsx} +20 -20
- package/src/components/{SideEntityProvider.tsx → SidePanelProvider.tsx} +17 -17
- package/src/components/UserSelector.tsx +1 -1
- package/src/components/admin/CreationResultDialog.tsx +6 -3
- package/src/components/app/Scaffold.tsx +6 -2
- package/src/components/common/default_entity_actions.tsx +132 -34
- package/src/components/field_configs.tsx +1 -1
- package/src/components/history/EntityHistoryEntry.tsx +3 -3
- package/src/components/history/EntityHistoryView.tsx +7 -7
- package/src/components/history/LastEditedByIndicator.tsx +4 -4
- package/src/components/index.ts +16 -15
- package/src/contexts/SidePanelControllerContext.tsx +5 -0
- package/src/data_export/export/BasicExportAction.tsx +1 -1
- package/src/data_export/export/ExportCollectionAction.tsx +5 -5
- package/src/data_import/components/DataNewPropertiesMapping.tsx +1 -1
- package/src/data_import/components/ImportFileUpload.tsx +1 -1
- package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +1 -1
- package/src/data_import/components/ImportSaveInProgress.tsx +4 -4
- package/src/data_import/import/ImportCollectionAction.tsx +6 -6
- package/src/data_import/utils/data.ts +4 -4
- package/src/data_import/utils/get_properties_mapping.ts +1 -1
- package/src/editor/components/image-bubble.tsx +1 -1
- package/src/editor/components/table-bubble.tsx +1 -1
- package/src/editor/editor.tsx +1 -1
- package/src/editor/selectors/link-selector.tsx +1 -1
- package/src/editor/selectors/node-selector.tsx +1 -1
- package/src/form/EntityForm.tsx +6 -6
- package/src/form/EntityFormActions.tsx +4 -4
- package/src/form/EntityFormBinding.tsx +10 -10
- package/src/form/PropertyFieldBinding.tsx +7 -7
- package/src/form/components/ErrorFocus.tsx +1 -1
- package/src/form/components/LocalChangesMenu.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +1 -1
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +5 -5
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +21 -21
- package/src/form/field_bindings/MapFieldBinding.tsx +1 -1
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +2 -2
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +3 -3
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +7 -7
- package/src/form/field_bindings/RelationFieldBinding.tsx +4 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +3 -3
- package/src/form/form_utils.ts +3 -3
- package/src/hooks/index.ts +4 -4
- package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +2 -2
- package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +11 -11
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +5 -5
- package/src/hooks/navigation/useNavigationResolution.ts +28 -13
- package/src/hooks/navigation/useResolvedCollections.ts +8 -8
- package/src/hooks/navigation/useTopLevelNavigation.ts +2 -2
- package/src/hooks/navigation/utils.ts +5 -5
- package/src/hooks/{useBuildSideEntityController.tsx → useBuildSidePanel.tsx} +29 -29
- package/src/hooks/useCMSContext.tsx +7 -7
- package/src/hooks/{useEntityHistory.ts → useHistory.ts} +2 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +10 -5
- package/src/hooks/{useEntitySelectionDialog.tsx → useSelectionDialog.tsx} +7 -7
- package/src/hooks/useSideDialogsController.tsx +1 -1
- package/src/hooks/useSidePanel.tsx +13 -0
- package/src/index.ts +15 -15
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/preview/components/DatePreview.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +11 -11
- package/src/preview/components/RelationPreview.tsx +13 -12
- package/src/preview/components/StorageThumbnail.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
- package/src/routes/RebaseRoute.tsx +12 -12
- package/src/types/components/EntityFormActionsProps.tsx +2 -2
- package/src/types/components/EntityFormProps.tsx +3 -3
- package/src/types/components/formex.tsx +1 -1
- package/src/types/fields.tsx +2 -2
- package/src/util/dataControllerAdapter.ts +9 -15
- package/src/util/navigation_utils.ts +7 -7
- package/src/util/previews.ts +7 -5
- package/src/util/property_utils.tsx +2 -2
- package/src/util/{entity_view_constants.ts → view_constants.ts} +1 -1
- package/dist/CollectionEditorDialog-BO_aQ-Z4.js.map +0 -1
- package/dist/PropertyEditView-DKzOpMjR.js.map +0 -1
- package/dist/RouterCollectionsStudioView-BQTIExjA.js.map +0 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +0 -28
- package/dist/components/EntityCollectionTable/index.d.ts +0 -6
- package/dist/components/EntityCollectionView/EntityCard.d.ts +0 -21
- package/dist/components/EntityEditViewFormActions.d.ts +0 -3
- package/dist/components/EntitySidePanel.d.ts +0 -11
- package/dist/components/EntityView.d.ts +0 -13
- package/dist/contexts/SideEntityControllerContext.d.ts +0 -3
- package/dist/history-B3cqBzEV.js.map +0 -1
- package/dist/hooks/useBuildSideEntityController.d.ts +0 -6
- package/dist/hooks/useSideEntityController.d.ts +0 -11
- package/dist/src-cxV1ODRG.js.map +0 -1
- package/src/components/EntityCollectionTable/index.tsx +0 -14
- package/src/contexts/SideEntityControllerContext.tsx +0 -5
- package/src/hooks/useSideEntityController.tsx +0 -13
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/PropertyTableCell.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationSelectorField.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableSelect.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableUserSelect.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/CollectionTableToolbar.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useDraggable.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useWindowSize.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/FilterPresetsButton.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/ViewModeToggle.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/useSelectionController.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/utils.d.ts +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationSelectorField.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableSelect.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableUserSelect.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useDraggable.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useWindowSize.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/FilterPresetsButton.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/useSelectionController.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/utils.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionConfig, DataSourceDefinition } from "@rebasepro/types";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState, useMemo } from "react";
|
|
3
3
|
import { CollectionRegistry, getParentReferencesFromPath as commonGetParentReferencesFromPath, removeInitialAndTrailingSlashes, getSubcollections } from "@rebasepro/common";
|
|
4
4
|
import { EntityReference, UserConfigurationPersistence, CollectionRegistryController } from "@rebasepro/types";
|
|
@@ -21,7 +21,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
21
21
|
const getCollection = useCallback((
|
|
22
22
|
slugOrPath: string,
|
|
23
23
|
includeUserOverride = false
|
|
24
|
-
):
|
|
24
|
+
): CollectionConfig | undefined => {
|
|
25
25
|
|
|
26
26
|
const registry = collectionRegistryRef.current;
|
|
27
27
|
|
|
@@ -31,14 +31,14 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
31
31
|
const pathSegments = cleanedPath.split("/");
|
|
32
32
|
|
|
33
33
|
let collectionPath = pathSegments.join("/");
|
|
34
|
-
// If the path has an even number of segments, it points to
|
|
34
|
+
// If the path has an even number of segments, it points to a entity, so we get the parent collection
|
|
35
35
|
if (pathSegments.length > 0 && pathSegments.length % 2 === 0) {
|
|
36
36
|
collectionPath = pathSegments.slice(0, -1).join("/");
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (!collectionPath) return undefined;
|
|
40
40
|
|
|
41
|
-
let collection:
|
|
41
|
+
let collection: CollectionConfig | undefined;
|
|
42
42
|
try {
|
|
43
43
|
collection = registry.resolvePathToCollections(collectionPath).finalCollection;
|
|
44
44
|
} catch (e) {
|
|
@@ -56,7 +56,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
56
56
|
|
|
57
57
|
if (!overriddenCollection) return undefined;
|
|
58
58
|
|
|
59
|
-
let result: Partial<
|
|
59
|
+
let result: Partial<CollectionConfig> | undefined = overriddenCollection;
|
|
60
60
|
const subcollections = "subcollections" in overriddenCollection ? overriddenCollection.subcollections : undefined;
|
|
61
61
|
const callbacks = overriddenCollection.callbacks;
|
|
62
62
|
result = {
|
|
@@ -69,11 +69,11 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
return { ...overriddenCollection,
|
|
72
|
-
...result } as
|
|
72
|
+
...result } as CollectionConfig;
|
|
73
73
|
|
|
74
74
|
}, [userConfigPersistence]);
|
|
75
75
|
|
|
76
|
-
const getRawCollection = useCallback((slugOrPath: string):
|
|
76
|
+
const getRawCollection = useCallback((slugOrPath: string): CollectionConfig | undefined => {
|
|
77
77
|
const registry = collectionRegistryRef.current;
|
|
78
78
|
if (registry === undefined) return undefined;
|
|
79
79
|
|
|
@@ -82,7 +82,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
82
82
|
|
|
83
83
|
const pathSegments = cleanedPath.split("/");
|
|
84
84
|
|
|
85
|
-
return registry.getRaw(pathSegments.join("/")) as
|
|
85
|
+
return registry.getRaw(pathSegments.join("/")) as CollectionConfig | undefined;
|
|
86
86
|
}, []);
|
|
87
87
|
|
|
88
88
|
const getParentReferencesFromPath = useCallback((path: string): EntityReference[] => {
|
|
@@ -115,7 +115,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
115
115
|
result.push(oddPathSegments.slice(0, i));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
const getCollectionFromPaths = (pathSegments: string[]):
|
|
118
|
+
const getCollectionFromPaths = (pathSegments: string[]): CollectionConfig | undefined => {
|
|
119
119
|
if (!pathSegments?.length) return undefined;
|
|
120
120
|
const testPath = pathSegments.reduce((acc, segment, idx) => {
|
|
121
121
|
if (idx === 0) return segment;
|
|
@@ -144,11 +144,11 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
144
144
|
const convertIdsToPaths = useCallback((ids: string[]): string[] => {
|
|
145
145
|
const registry = collectionRegistryRef.current;
|
|
146
146
|
if (!registry) return [];
|
|
147
|
-
let currentCollections:
|
|
147
|
+
let currentCollections: CollectionConfig[] = registry.getCollections();
|
|
148
148
|
const paths: string[] = [];
|
|
149
149
|
for (let i = 0; i < ids.length; i++) {
|
|
150
150
|
const id = ids[i];
|
|
151
|
-
const collection:
|
|
151
|
+
const collection: CollectionConfig | undefined = currentCollections.find(c => c.slug === id);
|
|
152
152
|
if (!collection)
|
|
153
153
|
throw Error(`Collection with id ${id} not found`);
|
|
154
154
|
paths.push(collection.slug);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AppView,
|
|
1
|
+
import type { AppView, CollectionConfig, NavigationResult, RebasePlugin, NavigationStateController, UrlController, NavigationGroupMapping } from "@rebasepro/types";
|
|
2
2
|
import { useCallback, useMemo, useRef } from "react";
|
|
3
3
|
|
|
4
4
|
import { AuthController, RebaseData, CollectionRegistryController, User } from "@rebasepro/types";
|
|
5
|
-
import type {
|
|
5
|
+
import type { CollectionConfigsBuilder, AppViewsBuilder, EffectiveRoleController } from "@rebasepro/types";
|
|
6
6
|
import { CollectionRegistry } from "@rebasepro/common";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,9 +10,9 @@ import { useResolvedCollections } from "./useResolvedCollections";
|
|
|
10
10
|
import { useResolvedViews } from "./useResolvedViews";
|
|
11
11
|
import { useTopLevelNavigation } from "./useTopLevelNavigation";
|
|
12
12
|
|
|
13
|
-
export type BuildNavigationStateProps<EC extends
|
|
13
|
+
export type BuildNavigationStateProps<EC extends CollectionConfig, USER extends User> = {
|
|
14
14
|
authController: AuthController<USER>;
|
|
15
|
-
collections?: EC[] |
|
|
15
|
+
collections?: EC[] | CollectionConfigsBuilder<EC>;
|
|
16
16
|
views?: AppView[] | AppViewsBuilder;
|
|
17
17
|
adminViews?: AppView[] | AppViewsBuilder;
|
|
18
18
|
data: RebaseData;
|
|
@@ -37,7 +37,7 @@ export type BuildNavigationStateProps<EC extends EntityCollection, USER extends
|
|
|
37
37
|
*
|
|
38
38
|
* The NavigationStateController type is preserved as a public API.
|
|
39
39
|
*/
|
|
40
|
-
export function useBuildNavigationStateController<EC extends
|
|
40
|
+
export function useBuildNavigationStateController<EC extends CollectionConfig, USER extends User>(
|
|
41
41
|
props: BuildNavigationStateProps<EC, USER>
|
|
42
42
|
): NavigationStateController {
|
|
43
43
|
|
|
@@ -3,8 +3,8 @@ import type {
|
|
|
3
3
|
AppViewsBuilder,
|
|
4
4
|
AuthCollectionConfig,
|
|
5
5
|
EntityAction,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
CollectionConfig,
|
|
7
|
+
CollectionConfigsBuilder,
|
|
8
8
|
RebaseContext,
|
|
9
9
|
RebasePlugin,
|
|
10
10
|
UserCreationResult
|
|
@@ -23,7 +23,7 @@ function isRebaseContext(ctx: unknown): ctx is RebaseContext {
|
|
|
23
23
|
return typeof ctx === "object" && ctx !== null && "dialogsController" in ctx;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export function filterOutNotAllowedCollections(resolvedCollections:
|
|
26
|
+
export function filterOutNotAllowedCollections(resolvedCollections: CollectionConfig[], authController: AuthController): CollectionConfig[] {
|
|
27
27
|
return resolvedCollections
|
|
28
28
|
.filter((c) => canReadCollection(c, authController))
|
|
29
29
|
.map((c) => {
|
|
@@ -35,8 +35,8 @@ export function filterOutNotAllowedCollections(resolvedCollections: EntityCollec
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export function applyPluginModifyCollection(resolvedCollections:
|
|
39
|
-
return resolvedCollections.map((collection):
|
|
38
|
+
export function applyPluginModifyCollection(resolvedCollections: CollectionConfig[], modifyCollection: (collection: CollectionConfig) => CollectionConfig): CollectionConfig[] {
|
|
39
|
+
return resolvedCollections.map((collection): CollectionConfig => {
|
|
40
40
|
const modifiedCollection = modifyCollection(collection);
|
|
41
41
|
if (modifiedCollection.childCollections) {
|
|
42
42
|
return {
|
|
@@ -53,13 +53,20 @@ export function applyPluginModifyCollection(resolvedCollections: EntityCollectio
|
|
|
53
53
|
* with `auth: true` or `auth: { enabled: true }`.
|
|
54
54
|
*
|
|
55
55
|
* Injections:
|
|
56
|
-
* 1. **resetPasswordAction** — adds the entity action unless explicitly disabled
|
|
56
|
+
* 1. **resetPasswordAction** — adds the entity action unless explicitly disabled,
|
|
57
|
+
* or unless the auth adapter reports no `adminPasswordReset` support. Custom
|
|
58
|
+
* adapters mount their own admin routes and may not implement
|
|
59
|
+
* `POST /admin/users/:userId/reset-password`; injecting the action anyway
|
|
60
|
+
* would show a button that can only ever 404.
|
|
57
61
|
* 2. **afterSave callback** — shows the `CreationResultDialog` when a new user
|
|
58
62
|
* is created with `invitationSent` or `temporaryPassword` in the response
|
|
59
63
|
*
|
|
60
64
|
* Skips injection if the collection already has the action/callback present.
|
|
61
65
|
*/
|
|
62
|
-
function injectAuthCollectionConfig(
|
|
66
|
+
function injectAuthCollectionConfig(
|
|
67
|
+
collections: CollectionConfig[],
|
|
68
|
+
adminPasswordResetSupported: boolean
|
|
69
|
+
): CollectionConfig[] {
|
|
63
70
|
return collections.map((collection) => {
|
|
64
71
|
const authProp = collection.auth;
|
|
65
72
|
if (!authProp) return collection;
|
|
@@ -78,7 +85,11 @@ function injectAuthCollectionConfig(collections: EntityCollection[]): EntityColl
|
|
|
78
85
|
if (resetPref === false) {
|
|
79
86
|
actionToInject = undefined;
|
|
80
87
|
} else if (typeof resetPref === "object") {
|
|
88
|
+
// An explicitly supplied action is the collection author's own; they
|
|
89
|
+
// own its backend, so the adapter capability doesn't apply.
|
|
81
90
|
actionToInject = resetPref;
|
|
91
|
+
} else if (!adminPasswordResetSupported) {
|
|
92
|
+
actionToInject = undefined;
|
|
82
93
|
} else {
|
|
83
94
|
actionToInject = resetPasswordAction;
|
|
84
95
|
}
|
|
@@ -116,7 +127,7 @@ function injectAuthCollectionConfig(collections: EntityCollection[]): EntityColl
|
|
|
116
127
|
|
|
117
128
|
const creationResult: UserCreationResult = {
|
|
118
129
|
user: {
|
|
119
|
-
uid: String(props.
|
|
130
|
+
uid: String(props.id),
|
|
120
131
|
email: typeof values.email === "string" ? values.email : "",
|
|
121
132
|
displayName: typeof values.displayName === "string" ? values.displayName : "",
|
|
122
133
|
roles: Array.isArray(values.roles) ? values.roles as string[] : [],
|
|
@@ -129,7 +140,8 @@ function injectAuthCollectionConfig(collections: EntityCollection[]): EntityColl
|
|
|
129
140
|
isAnonymous: false
|
|
130
141
|
},
|
|
131
142
|
invitationSent: !!values.invitationSent,
|
|
132
|
-
temporaryPassword: typeof values.temporaryPassword === "string" ? values.temporaryPassword : undefined
|
|
143
|
+
temporaryPassword: typeof values.temporaryPassword === "string" ? values.temporaryPassword : undefined,
|
|
144
|
+
emailDeliveryFailed: !!values.emailDeliveryFailed
|
|
133
145
|
};
|
|
134
146
|
|
|
135
147
|
const { closeDialog } = dialogsController.open({
|
|
@@ -150,12 +162,12 @@ function injectAuthCollectionConfig(collections: EntityCollection[]): EntityColl
|
|
|
150
162
|
}
|
|
151
163
|
|
|
152
164
|
export async function resolveCollections(
|
|
153
|
-
collections: undefined |
|
|
165
|
+
collections: undefined | CollectionConfig[] | CollectionConfigsBuilder,
|
|
154
166
|
authController: AuthController,
|
|
155
167
|
data: RebaseData,
|
|
156
168
|
plugins: RebasePlugin[] | undefined
|
|
157
|
-
): Promise<
|
|
158
|
-
let resolvedCollections:
|
|
169
|
+
): Promise<CollectionConfig[]> {
|
|
170
|
+
let resolvedCollections: CollectionConfig[] = [];
|
|
159
171
|
if (typeof collections === "function") {
|
|
160
172
|
resolvedCollections = await collections({
|
|
161
173
|
user: authController.user,
|
|
@@ -179,7 +191,10 @@ export async function resolveCollections(
|
|
|
179
191
|
}
|
|
180
192
|
|
|
181
193
|
// Auto-inject auth entity actions and callbacks (resetPassword, creation dialog, etc.)
|
|
182
|
-
resolvedCollections = injectAuthCollectionConfig(
|
|
194
|
+
resolvedCollections = injectAuthCollectionConfig(
|
|
195
|
+
resolvedCollections,
|
|
196
|
+
authController.capabilities?.adminPasswordReset ?? true
|
|
197
|
+
);
|
|
183
198
|
|
|
184
199
|
resolvedCollections = filterOutNotAllowedCollections(resolvedCollections, authController);
|
|
185
200
|
return resolvedCollections;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionConfig, RebasePlugin } from "@rebasepro/types";
|
|
2
2
|
import { useRef, useMemo } from "react";
|
|
3
3
|
|
|
4
4
|
import { AuthController, CollectionRegistryController, RebaseData, User } from "@rebasepro/types";
|
|
5
|
-
import type {
|
|
5
|
+
import type { CollectionConfigsBuilder } from "@rebasepro/types";
|
|
6
6
|
import { CollectionRegistry } from "@rebasepro/common";
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,9 +10,9 @@ import { resolveCollections } from "./useNavigationResolution";
|
|
|
10
10
|
import { areCollectionListsEqual } from "./utils";
|
|
11
11
|
import { useAsyncResolver } from "./useAsyncResolver";
|
|
12
12
|
|
|
13
|
-
export type UseResolvedCollectionsProps<EC extends
|
|
13
|
+
export type UseResolvedCollectionsProps<EC extends CollectionConfig, USER extends User> = {
|
|
14
14
|
authController: AuthController<USER>;
|
|
15
|
-
collections?: EC[] |
|
|
15
|
+
collections?: EC[] | CollectionConfigsBuilder<EC>;
|
|
16
16
|
data: RebaseData;
|
|
17
17
|
plugins?: RebasePlugin[];
|
|
18
18
|
disabled?: boolean;
|
|
@@ -21,7 +21,7 @@ export type UseResolvedCollectionsProps<EC extends EntityCollection, USER extend
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export type UseResolvedCollectionsResult = {
|
|
24
|
-
collections:
|
|
24
|
+
collections: CollectionConfig[];
|
|
25
25
|
loading: boolean;
|
|
26
26
|
error: Error | undefined;
|
|
27
27
|
refresh: () => void;
|
|
@@ -29,7 +29,7 @@ export type UseResolvedCollectionsResult = {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Hook that resolves collection props (which may be async builders or arrays)
|
|
32
|
-
* into concrete
|
|
32
|
+
* into concrete CollectionConfig[], and registers them with the CollectionRegistry.
|
|
33
33
|
*
|
|
34
34
|
* When userManagement is provided, the default users collection is always
|
|
35
35
|
* prepended. Developer collections override via generic slug-based dedup
|
|
@@ -38,7 +38,7 @@ export type UseResolvedCollectionsResult = {
|
|
|
38
38
|
* Uses refs for potentially-unstable dependencies (driver, authController,
|
|
39
39
|
* plugins) to avoid re-triggering effects when their object identity changes.
|
|
40
40
|
*/
|
|
41
|
-
export function useResolvedCollections<EC extends
|
|
41
|
+
export function useResolvedCollections<EC extends CollectionConfig, USER extends User>(
|
|
42
42
|
props: UseResolvedCollectionsProps<EC, USER>
|
|
43
43
|
): UseResolvedCollectionsResult {
|
|
44
44
|
|
|
@@ -66,7 +66,7 @@ export function useResolvedCollections<EC extends EntityCollection, USER extends
|
|
|
66
66
|
const pluginsRef = useRef(plugins);
|
|
67
67
|
pluginsRef.current = plugins;
|
|
68
68
|
|
|
69
|
-
const { data: collections, loading, error, refresh } = useAsyncResolver<
|
|
69
|
+
const { data: collections, loading, error, refresh } = useAsyncResolver<CollectionConfig[]>({
|
|
70
70
|
resolver: async () => {
|
|
71
71
|
const resolved = await resolveCollections(
|
|
72
72
|
collectionsProp,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppView, UrlController,
|
|
1
|
+
import type { AppView, UrlController, CollectionConfig, RebasePlugin, NavigationEntry, NavigationGroupMapping, NavigationResult } from "@rebasepro/types";
|
|
2
2
|
import { useCallback, useMemo, useRef } from "react";
|
|
3
3
|
import { deepEqual as equal } from "fast-equals";
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ import { CollectionRegistry } from "@rebasepro/common";
|
|
|
8
8
|
import { computeNavigationGroups, getGroup, NAVIGATION_ADMIN_GROUP_NAME, NAVIGATION_DEFAULT_GROUP_NAME } from "./utils";
|
|
9
9
|
|
|
10
10
|
export type UseTopLevelNavigationProps = {
|
|
11
|
-
collections:
|
|
11
|
+
collections: CollectionConfig[];
|
|
12
12
|
views: AppView[] | undefined;
|
|
13
13
|
adminViews: AppView[] | undefined;
|
|
14
14
|
plugins?: RebasePlugin[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppView,
|
|
1
|
+
import type { AppView, CollectionConfig, RebasePlugin, NavigationGroupMapping } from "@rebasepro/types";
|
|
2
2
|
|
|
3
3
|
import { getSubcollections } from "@rebasepro/common";
|
|
4
4
|
import { deepEqual as equal } from "fast-equals";
|
|
@@ -6,7 +6,7 @@ import { deepEqual as equal } from "fast-equals";
|
|
|
6
6
|
export const NAVIGATION_DEFAULT_GROUP_NAME = "Views";
|
|
7
7
|
export const NAVIGATION_ADMIN_GROUP_NAME = "Admin";
|
|
8
8
|
|
|
9
|
-
export function getGroup(collectionOrView:
|
|
9
|
+
export function getGroup(collectionOrView: CollectionConfig | AppView) {
|
|
10
10
|
const trimmed = collectionOrView.group?.trim();
|
|
11
11
|
if (!trimmed || trimmed === "") {
|
|
12
12
|
return NAVIGATION_DEFAULT_GROUP_NAME;
|
|
@@ -21,7 +21,7 @@ export function computeNavigationGroups({
|
|
|
21
21
|
plugins
|
|
22
22
|
}: {
|
|
23
23
|
navigationGroupMappings?: NavigationGroupMapping[],
|
|
24
|
-
collections?:
|
|
24
|
+
collections?: CollectionConfig[],
|
|
25
25
|
views?: AppView[],
|
|
26
26
|
plugins?: RebasePlugin[]
|
|
27
27
|
}): NavigationGroupMapping[] {
|
|
@@ -146,7 +146,7 @@ export function computeNavigationGroups({
|
|
|
146
146
|
return result;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export function areCollectionListsEqual(a:
|
|
149
|
+
export function areCollectionListsEqual(a: CollectionConfig[], b: CollectionConfig[], visitedSlugs: string[] = []) {
|
|
150
150
|
if (a.length !== b.length) {
|
|
151
151
|
return false;
|
|
152
152
|
}
|
|
@@ -157,7 +157,7 @@ export function areCollectionListsEqual(a: EntityCollection[], b: EntityCollecti
|
|
|
157
157
|
return aSorted.every((value, index) => areCollectionsEqual(value, bSorted[index], visitedSlugs));
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
export function areCollectionsEqual(a:
|
|
160
|
+
export function areCollectionsEqual(a: CollectionConfig, b: CollectionConfig, visitedSlugs: string[] = []) {
|
|
161
161
|
if (a.slug !== b.slug) {
|
|
162
162
|
return false;
|
|
163
163
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CustomizationController,
|
|
1
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
2
|
+
import type { CustomizationController, SidePanelBindingProps, SideDialogPanelProps, SideDialogsController, SidePanelController, UrlController, NavigationStateController, Property } from "@rebasepro/types";
|
|
3
3
|
import { useCallback, useEffect, useRef, useMemo } from "react";
|
|
4
4
|
import { AuthController, CollectionRegistryController } from "@rebasepro/types";
|
|
5
5
|
import { useLocation } from "react-router-dom";
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
resolveDefaultSelectedView
|
|
11
11
|
} from "@rebasepro/common";
|
|
12
12
|
import { resolvedSelectedEntityView } from "../util/resolutions";
|
|
13
|
-
import { ADDITIONAL_TAB_WIDTH, CONTAINER_FULL_WIDTH, FORM_CONTAINER_WIDTH } from "@rebasepro/
|
|
14
|
-
import { useCustomizationController, useLargeLayout, useComponentOverride,
|
|
15
|
-
import { JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../components/
|
|
13
|
+
import { ADDITIONAL_TAB_WIDTH, CONTAINER_FULL_WIDTH, FORM_CONTAINER_WIDTH } from "@rebasepro/app";
|
|
14
|
+
import { useCustomizationController, useLargeLayout, useComponentOverride, CollectionScopeProvider } from "@rebasepro/app";
|
|
15
|
+
import { JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../components/EditViewBinding";
|
|
16
16
|
import React from "react";
|
|
17
|
-
import {
|
|
17
|
+
import { SidePanelBinding } from "../components/SidePanelBinding";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Thin wrapper that resolves the Entity.SidePanel component override.
|
|
@@ -22,26 +22,26 @@ import { EntitySidePanel } from "../components/EntitySidePanel";
|
|
|
22
22
|
* not a React component), we need this wrapper so the hook is called at the
|
|
23
23
|
* top level of a React component per the Rules of Hooks.
|
|
24
24
|
*/
|
|
25
|
-
function
|
|
26
|
-
const Resolved = useComponentOverride("Entity.SidePanel",
|
|
25
|
+
function ResolvedSidePanelBindingInner(props: SidePanelBindingProps) {
|
|
26
|
+
const Resolved = useComponentOverride("Entity.SidePanel", SidePanelBinding);
|
|
27
27
|
return <Resolved {...props}/>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function
|
|
31
|
-
if (props.collection
|
|
30
|
+
function ResolvedSidePanelBinding(props: SidePanelBindingProps) {
|
|
31
|
+
if (props.collection) {
|
|
32
32
|
return (
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
</
|
|
33
|
+
<CollectionScopeProvider collection={props.collection}>
|
|
34
|
+
<ResolvedSidePanelBindingInner {...props}/>
|
|
35
|
+
</CollectionScopeProvider>
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
return <
|
|
38
|
+
return <ResolvedSidePanelBindingInner {...props}/>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const NEW_URL_HASH = "new_side";
|
|
42
42
|
const SIDE_URL_HASH = "side";
|
|
43
43
|
|
|
44
|
-
export function getEntityViewWidth(props:
|
|
44
|
+
export function getEntityViewWidth(props: SidePanelBindingProps<any>, small: boolean, customizationController: CustomizationController): string {
|
|
45
45
|
if (small) return CONTAINER_FULL_WIDTH;
|
|
46
46
|
|
|
47
47
|
const {
|
|
@@ -72,7 +72,7 @@ export function getEntityViewWidth(props: EntitySidePanelProps<any>, small: bool
|
|
|
72
72
|
|
|
73
73
|
const collectionViewWidthCache: { [key: string]: string } = {};
|
|
74
74
|
|
|
75
|
-
function calculateCollectionDesiredWidth(collection:
|
|
75
|
+
function calculateCollectionDesiredWidth(collection: CollectionConfig<any>): string {
|
|
76
76
|
if (collectionViewWidthCache[collection.slug]) {
|
|
77
77
|
return collectionViewWidthCache[collection.slug];
|
|
78
78
|
}
|
|
@@ -108,12 +108,12 @@ function getNestedPropertiesDepth(property: Property, accumulator = 0): number {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
export const
|
|
111
|
+
export const useBuildSidePanel = (collectionRegistryController: CollectionRegistryController,
|
|
112
112
|
urlController: UrlController,
|
|
113
113
|
navigationStateController: NavigationStateController,
|
|
114
114
|
sideDialogsController: SideDialogsController,
|
|
115
115
|
authController: AuthController
|
|
116
|
-
):
|
|
116
|
+
): SidePanelController => {
|
|
117
117
|
|
|
118
118
|
const location = useLocation();
|
|
119
119
|
const initialised = useRef<boolean>(false);
|
|
@@ -172,12 +172,12 @@ export const useBuildSideEntityController = (collectionRegistryController: Colle
|
|
|
172
172
|
|
|
173
173
|
// update side panels to match browser size
|
|
174
174
|
// Only update panel widths on layout change — don't recreate components.
|
|
175
|
-
// Recreating components would unmount/remount
|
|
175
|
+
// Recreating components would unmount/remount SidePanelBinding, losing
|
|
176
176
|
// scroll position, unsaved form state, and triggering unnecessary data fetches.
|
|
177
177
|
useEffect(() => {
|
|
178
178
|
const updatedSidePanels = sideDialogsController.sidePanels.map(sidePanelProps => {
|
|
179
179
|
if (sidePanelProps.additional) {
|
|
180
|
-
const entityProps = sidePanelProps.additional as
|
|
180
|
+
const entityProps = sidePanelProps.additional as SidePanelBindingProps;
|
|
181
181
|
const newWidth = getEntityViewWidth(entityProps, smallLayout, customizationController);
|
|
182
182
|
if (sidePanelProps.width !== newWidth) {
|
|
183
183
|
return { ...sidePanelProps,
|
|
@@ -193,10 +193,10 @@ width: newWidth };
|
|
|
193
193
|
sideDialogsController.close();
|
|
194
194
|
}, [sideDialogsController]);
|
|
195
195
|
|
|
196
|
-
const open = useCallback((props:
|
|
196
|
+
const open = useCallback((props: SidePanelBindingProps<any>) => {
|
|
197
197
|
|
|
198
198
|
if (props.copy && !props.entityId) {
|
|
199
|
-
throw Error("If you want to copy
|
|
199
|
+
throw Error("If you want to copy a entity you need to provide a entityId");
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
const defaultSelectedView = resolveDefaultSelectedView(
|
|
@@ -222,10 +222,10 @@ width: newWidth };
|
|
|
222
222
|
|
|
223
223
|
}, [sideDialogsController, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, authController.user, location.search]);
|
|
224
224
|
|
|
225
|
-
const replace = useCallback((props:
|
|
225
|
+
const replace = useCallback((props: SidePanelBindingProps<any>) => {
|
|
226
226
|
|
|
227
227
|
if (props.copy && !props.entityId) {
|
|
228
|
-
throw Error("If you want to copy
|
|
228
|
+
throw Error("If you want to copy a entity you need to provide a entityId");
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
sideDialogsController.replace(propsToSidePanel(props, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController, location.search));
|
|
@@ -239,14 +239,14 @@ width: newWidth };
|
|
|
239
239
|
}), [close, open, replace]);
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
-
export function buildSidePanelsFromUrl(path: string, collections:
|
|
242
|
+
export function buildSidePanelsFromUrl(path: string, collections: CollectionConfig[], newFlag: boolean): SidePanelBindingProps<any>[] {
|
|
243
243
|
|
|
244
244
|
const navigationViewsForPath: NavigationViewInternal<any>[] = getNavigationEntriesFromPath({
|
|
245
245
|
path,
|
|
246
246
|
collections
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
-
let sidePanel:
|
|
249
|
+
let sidePanel: SidePanelBindingProps<any> | undefined = undefined;
|
|
250
250
|
let lastCollectionPath = "";
|
|
251
251
|
let lastCollectionId: string | undefined = undefined;
|
|
252
252
|
for (let i = 0; i < navigationViewsForPath.length; i++) {
|
|
@@ -306,7 +306,7 @@ export function buildSidePanelsFromUrl(path: string, collections: EntityCollecti
|
|
|
306
306
|
return sidePanel ? [sidePanel] : [];
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
const propsToSidePanel = (props:
|
|
309
|
+
const propsToSidePanel = (props: SidePanelBindingProps,
|
|
310
310
|
buildUrlCollectionPath: (path: string) => string,
|
|
311
311
|
resolveIdsFrom: (pathWithAliases: string) => string,
|
|
312
312
|
smallLayout: boolean,
|
|
@@ -331,7 +331,7 @@ const propsToSidePanel = (props: EntitySidePanelProps,
|
|
|
331
331
|
? buildUrlCollectionPath(collectionPath)
|
|
332
332
|
: undefined;
|
|
333
333
|
|
|
334
|
-
const resolvedPanelProps:
|
|
334
|
+
const resolvedPanelProps: SidePanelBindingProps<any> = {
|
|
335
335
|
...props,
|
|
336
336
|
formProps: props.formProps
|
|
337
337
|
};
|
|
@@ -339,7 +339,7 @@ const propsToSidePanel = (props: EntitySidePanelProps,
|
|
|
339
339
|
const entityViewWidth = getEntityViewWidth(props, smallLayout, customizationController);
|
|
340
340
|
return {
|
|
341
341
|
key: `${props.path}/${props.entityId}`,
|
|
342
|
-
component: <
|
|
342
|
+
component: <ResolvedSidePanelBinding {...resolvedPanelProps}/>,
|
|
343
343
|
urlPath: urlPath,
|
|
344
344
|
parentUrlPath: parentUrlPath,
|
|
345
345
|
width: entityViewWidth,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import { useRebaseContext } from "@rebasepro/
|
|
2
|
+
import { useRebaseContext } from "@rebasepro/app";
|
|
3
3
|
import type {
|
|
4
4
|
AuthController,
|
|
5
5
|
RebaseContext,
|
|
6
6
|
SideDialogsController,
|
|
7
|
-
|
|
7
|
+
SidePanelController,
|
|
8
8
|
User
|
|
9
9
|
} from "@rebasepro/types";
|
|
10
10
|
import type {
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
NavigationStateController,
|
|
13
13
|
UrlController
|
|
14
14
|
} from "@rebasepro/types";
|
|
15
|
-
import {
|
|
15
|
+
import { useSidePanel } from "./useSidePanel";
|
|
16
16
|
import { useSideDialogsController } from "./useSideDialogsController";
|
|
17
17
|
import {
|
|
18
18
|
useUrlController,
|
|
@@ -32,7 +32,7 @@ export type CMSContext<
|
|
|
32
32
|
USER extends User = User,
|
|
33
33
|
AuthControllerType extends AuthController<USER> = AuthController<USER>
|
|
34
34
|
> = RebaseContext<USER, AuthControllerType> & {
|
|
35
|
-
|
|
35
|
+
sidePanelController: SidePanelController;
|
|
36
36
|
sideDialogsController: SideDialogsController;
|
|
37
37
|
urlController: UrlController;
|
|
38
38
|
navigationStateController: NavigationStateController;
|
|
@@ -55,7 +55,7 @@ export function useCMSContext<
|
|
|
55
55
|
AuthControllerType extends AuthController<USER> = AuthController<USER>
|
|
56
56
|
>(): CMSContext<DB, USER, AuthControllerType> {
|
|
57
57
|
const baseContext = useRebaseContext<USER, AuthControllerType>();
|
|
58
|
-
const
|
|
58
|
+
const sidePanelController = useSidePanel();
|
|
59
59
|
const sideDialogsController = useSideDialogsController();
|
|
60
60
|
const urlController = useUrlController();
|
|
61
61
|
const navigationStateController = useNavigationStateController();
|
|
@@ -63,14 +63,14 @@ export function useCMSContext<
|
|
|
63
63
|
|
|
64
64
|
return useMemo(() => ({
|
|
65
65
|
...baseContext,
|
|
66
|
-
|
|
66
|
+
sidePanelController,
|
|
67
67
|
sideDialogsController,
|
|
68
68
|
urlController,
|
|
69
69
|
navigationStateController,
|
|
70
70
|
collectionRegistryController
|
|
71
71
|
}), [
|
|
72
72
|
baseContext,
|
|
73
|
-
|
|
73
|
+
sidePanelController,
|
|
74
74
|
sideDialogsController,
|
|
75
75
|
urlController,
|
|
76
76
|
navigationStateController,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState, useMemo } from "react";
|
|
2
|
-
import { useApiConfig } from "@rebasepro/
|
|
2
|
+
import { useApiConfig } from "@rebasepro/app";
|
|
3
3
|
|
|
4
4
|
export interface HistoryEntryData {
|
|
5
5
|
id: string;
|
|
@@ -27,7 +27,7 @@ export interface UseEntityHistoryResult {
|
|
|
27
27
|
* Hook to fetch entity history from the backend REST API.
|
|
28
28
|
* Replaces the old subcollection-based approach with a proper API call.
|
|
29
29
|
*/
|
|
30
|
-
export function
|
|
30
|
+
export function useHistory(params: {
|
|
31
31
|
slug: string;
|
|
32
32
|
entityId: string | number | undefined;
|
|
33
33
|
enabled?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionConfig, EntityCustomView } from "@rebasepro/types";
|
|
2
2
|
import { Entity, RebaseContext, User } from "@rebasepro/types";
|
|
3
3
|
import { useEffect, useState, useMemo } from "react";
|
|
4
4
|
import { getNavigationEntriesFromPath } from "@rebasepro/common";
|
|
@@ -22,7 +22,7 @@ export interface ResolvedNavigationEntity<M extends Record<string, unknown>> {
|
|
|
22
22
|
entity: Entity<M>;
|
|
23
23
|
entityId: string | number;
|
|
24
24
|
path: string;
|
|
25
|
-
parentCollection:
|
|
25
|
+
parentCollection: CollectionConfig<M>;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -32,7 +32,7 @@ export interface ResolvedNavigationEntity<M extends Record<string, unknown>> {
|
|
|
32
32
|
export interface ResolvedNavigationCollection<M extends Record<string, unknown>> {
|
|
33
33
|
type: "collection";
|
|
34
34
|
path: string;
|
|
35
|
-
collection:
|
|
35
|
+
collection: CollectionConfig<M>;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -85,9 +85,14 @@ export function resolveNavigationFrom<M extends Record<string, unknown>, USER ex
|
|
|
85
85
|
if (!collection) {
|
|
86
86
|
throw Error(`No collection defined in the navigation for the entity with path ${entry.slug}`);
|
|
87
87
|
}
|
|
88
|
+
// `context.data` is the flat SDK layer; re-wrap the row into the
|
|
89
|
+
// Entity view-model the navigation entry expects. The address is
|
|
90
|
+
// the one we just fetched by — reading it back off the row would
|
|
91
|
+
// find nothing, since a row is only its columns.
|
|
88
92
|
return data.collection(entry.slug).findById(entry.entityId)
|
|
89
|
-
.then((
|
|
90
|
-
if (!
|
|
93
|
+
.then((row) => {
|
|
94
|
+
if (!row) return undefined;
|
|
95
|
+
const entity = { id: entry.entityId, path: entry.slug, values: row };
|
|
91
96
|
return { ...entry,
|
|
92
97
|
entity };
|
|
93
98
|
});
|