@rebasepro/admin 0.7.0 → 0.9.0
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/LICENSE +21 -0
- package/README.md +20 -20
- package/dist/{CollectionEditorDialog-iGgS4rLX.js → CollectionEditorDialog-B-7uW3iJ.js} +15 -15
- package/dist/CollectionEditorDialog-B-7uW3iJ.js.map +1 -0
- package/dist/{PropertyEditView-C9yhLyja.js → PropertyEditView-7KMTcrqi.js} +140 -106
- package/dist/PropertyEditView-7KMTcrqi.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-Dqx27GD8.js → RouterCollectionsStudioView-epqIbZrJ.js} +4 -4
- package/dist/{RouterCollectionsStudioView-Dqx27GD8.js.map → RouterCollectionsStudioView-epqIbZrJ.js.map} +1 -1
- package/dist/collection_editor/_cms_internals.d.ts +4 -4
- package/dist/collection_editor/api/generateCollectionApi.d.ts +7 -6
- 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 +12 -16
- 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 -5
- 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 +4 -4
- package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +3 -3
- 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/validateCollectionJson.d.ts +2 -2
- package/dist/collection_editor_ui.js +4 -4
- 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} +1 -1
- 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/common.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.d.ts +2 -2
- 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 +2 -2
- 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 +1 -1
- package/dist/components/RebaseNavigation.d.ts +1 -1
- package/dist/components/ReferenceTable/{EntitySelectionTable.d.ts → SelectionTableBinding.d.ts} +5 -5
- package/dist/components/SelectableTable/SelectableTable.d.ts +5 -5
- package/dist/components/SelectableTable/SelectableTableContext.d.ts +3 -3
- package/dist/components/SelectableTable/SelectionStore.d.ts +13 -22
- 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/field_configs.d.ts +1 -1
- package/dist/components/history/EntityHistoryEntry.d.ts +2 -2
- package/dist/components/history/LastEditedByIndicator.d.ts +2 -2
- package/dist/components/index.d.ts +14 -13
- 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/editor.d.ts +0 -6
- package/dist/editor.js +1 -3
- 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/StorageUploadProgress.d.ts +6 -1
- package/dist/form/form_utils.d.ts +2 -2
- package/dist/form/index.d.ts +0 -1
- package/dist/{history-ChHgyyvM.js → history-7X5bON_n.js} +4 -4
- package/dist/history-7X5bON_n.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 +3 -3
- package/dist/index.js +2 -2
- package/dist/preview/components/StorageThumbnail.d.ts +3 -1
- package/dist/{src-DOX2nOyh.js → src-sUZfe29F.js} +904 -1096
- package/dist/src-sUZfe29F.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/PropertyPreviewProps.d.ts +2 -1
- package/dist/types/fields.d.ts +6 -8
- 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 +18 -18
- package/src/collection_editor/ConfigControllerProvider.tsx +10 -10
- package/src/collection_editor/_cms_internals.ts +4 -4
- package/src/collection_editor/api/generateCollectionApi.ts +7 -6
- package/src/collection_editor/extensibility_types.ts +3 -3
- package/src/collection_editor/index.ts +3 -3
- package/src/collection_editor/pgColumnToProperty.ts +4 -4
- package/src/collection_editor/serializable_types.ts +22 -35
- package/src/collection_editor/serializable_utils.ts +40 -52
- 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 +2 -2
- package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +2 -2
- package/src/collection_editor/ui/EditorCollectionAction.tsx +2 -2
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +2 -2
- package/src/collection_editor/ui/EditorEntityAction.tsx +2 -2
- package/src/collection_editor/ui/KanbanSetupAction.tsx +2 -2
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +63 -46
- package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +8 -8
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +7 -16
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +45 -36
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +35 -1
- package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +3 -3
- 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/ui/collection_editor/utils/supported_fields.tsx +0 -1
- package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +7 -29
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +14 -14
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +4 -4
- package/src/collection_editor/validateCollectionJson.ts +3 -3
- package/src/components/CollectionPanel.tsx +14 -17
- package/src/components/{EntityCollectionTable/EntityCollectionRowActions.tsx → CollectionTableBinding/CollectionRowActions.tsx} +6 -6
- package/src/components/{EntityCollectionTable/EntityCollectionTable.tsx → CollectionTableBinding/CollectionTableBinding.tsx} +19 -17
- package/src/components/{EntityCollectionTable/EntityCollectionTableProps.tsx → CollectionTableBinding/CollectionTableBindingProps.tsx} +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.tsx +7 -6
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.tsx +10 -10
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.tsx +7 -6
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.tsx +23 -20
- package/src/components/CollectionTableBinding/index.tsx +14 -0
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.tsx +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.tsx +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.tsx +24 -44
- package/src/components/{EntityCollectionView/EntityBoardCard.tsx → CollectionViewBinding/BoardCardBinding.tsx} +15 -15
- package/src/components/{EntityCollectionView/EntityCollectionBoardView.tsx → CollectionViewBinding/CollectionBoardViewBinding.tsx} +15 -14
- package/src/components/{EntityCollectionView/EntityCollectionCardView.tsx → CollectionViewBinding/CollectionCardViewBinding.tsx} +8 -8
- package/src/components/{EntityCollectionView/EntityCollectionListView.tsx → CollectionViewBinding/CollectionListViewBinding.tsx} +24 -13
- package/src/components/{EntityCollectionView/EntityCollectionViewActions.tsx → CollectionViewBinding/CollectionViewActions.tsx} +5 -5
- package/src/components/{EntityCollectionView/EntityCollectionView.tsx → CollectionViewBinding/CollectionViewBinding.tsx} +112 -114
- package/src/components/{EntityCollectionView/EntityCollectionViewStartActions.tsx → CollectionViewBinding/CollectionViewStartActions.tsx} +5 -5
- package/src/components/{EntityCollectionView/EntityCard.tsx → CollectionViewBinding/EntityCardBinding.tsx} +9 -9
- package/src/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.tsx +31 -72
- package/src/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.tsx +9 -9
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.ts +6 -6
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.ts +4 -4
- package/src/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.tsx +28 -50
- package/src/components/{EntityCollectionView/useEntityPreviewSlots.ts → CollectionViewBinding/usePreviewSlots.ts} +11 -11
- package/src/components/DefaultDrawer.tsx +1 -1
- package/src/components/DeleteEntityDialog.tsx +6 -6
- package/src/components/{EntityDetailView.tsx → DetailViewBinding.tsx} +28 -31
- package/src/components/{EntityEditViewFormActions.tsx → EditFormActions.tsx} +15 -15
- package/src/components/{EntityEditView.tsx → EditViewBinding.tsx} +31 -34
- package/src/components/{EntityPreview.tsx → EntityPreviewBinding.tsx} +27 -27
- package/src/components/{EntityView.tsx → EntityViewBinding.tsx} +5 -5
- package/src/components/HomePage/ContentHomePage.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- package/src/components/{EntityJsonPreview.tsx → JsonPreviewBinding.tsx} +1 -1
- package/src/components/RebaseCMS.tsx +4 -4
- package/src/components/RebaseNavigation.tsx +20 -10
- package/src/components/ReferenceTable/{EntitySelectionTable.tsx → SelectionTableBinding.tsx} +22 -19
- package/src/components/ReferenceWidget.tsx +4 -4
- package/src/components/RelationSelector.tsx +16 -14
- package/src/components/SelectableTable/SelectableTable.tsx +44 -89
- package/src/components/SelectableTable/SelectableTableContext.tsx +3 -3
- package/src/components/SelectableTable/SelectionStore.ts +22 -52
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +9 -1
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +33 -12
- package/src/components/SelectableTable/filters/FilterFieldBinding.tsx +187 -0
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +21 -7
- package/src/components/SelectableTable/filters/RelationFilterField.tsx +17 -3
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +66 -12
- package/src/components/SideDialogs.tsx +3 -3
- package/src/components/{EntitySidePanel.tsx → SidePanelBinding.tsx} +19 -19
- package/src/components/{SideEntityProvider.tsx → SidePanelProvider.tsx} +16 -16
- package/src/components/common/default_entity_actions.tsx +24 -13
- package/src/components/field_configs.tsx +0 -14
- package/src/components/history/EntityHistoryEntry.tsx +2 -2
- package/src/components/history/EntityHistoryView.tsx +3 -3
- package/src/components/history/LastEditedByIndicator.tsx +2 -2
- package/src/components/index.ts +15 -14
- package/src/contexts/SidePanelControllerContext.tsx +5 -0
- package/src/data_export/export/ExportCollectionAction.tsx +4 -4
- package/src/data_import/components/ImportSaveInProgress.tsx +3 -3
- package/src/data_import/import/ImportCollectionAction.tsx +4 -4
- package/src/data_import/utils/data.ts +2 -2
- package/src/editor/editor.tsx +4 -7
- package/src/form/EntityForm.tsx +2 -2
- package/src/form/EntityFormActions.tsx +4 -4
- package/src/form/EntityFormBinding.tsx +7 -7
- package/src/form/PropertyFieldBinding.tsx +4 -4
- package/src/form/components/StorageUploadProgress.tsx +9 -2
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -4
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +19 -19
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +12 -1
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +6 -6
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -5
- package/src/form/field_bindings/RelationFieldBinding.tsx +8 -10
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +19 -15
- package/src/form/form_utils.ts +2 -2
- package/src/form/index.tsx +0 -1
- 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 +10 -10
- 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} +28 -28
- package/src/hooks/useCMSContext.tsx +6 -6
- package/src/hooks/{useEntityHistory.ts → useHistory.ts} +1 -1
- package/src/hooks/useResolvedNavigationFrom.tsx +8 -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 +13 -13
- package/src/preview/PropertyPreview.tsx +1 -16
- package/src/preview/components/ReferencePreview.tsx +10 -10
- package/src/preview/components/RelationPreview.tsx +13 -12
- package/src/preview/components/StorageThumbnail.tsx +24 -7
- package/src/routes/RebaseRoute.tsx +10 -10
- package/src/types/components/EntityFormActionsProps.tsx +2 -2
- package/src/types/components/EntityFormProps.tsx +3 -3
- package/src/types/components/PropertyPreviewProps.tsx +1 -1
- package/src/types/fields.tsx +4 -9
- package/src/util/dataControllerAdapter.ts +9 -15
- package/src/util/navigation_utils.ts +7 -7
- package/src/util/previews.ts +23 -3
- package/src/util/propertyConfigMapper.ts +3 -3
- package/src/util/property_utils.tsx +2 -3
- package/src/util/{entity_view_constants.ts → view_constants.ts} +1 -1
- package/dist/CollectionEditorDialog-iGgS4rLX.js.map +0 -1
- package/dist/PropertyEditView-C9yhLyja.js.map +0 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +0 -28
- package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +0 -12
- package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +0 -10
- package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +0 -9
- package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +0 -8
- 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/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +0 -11
- package/dist/history-ChHgyyvM.js.map +0 -1
- package/dist/hooks/useBuildSideEntityController.d.ts +0 -6
- package/dist/hooks/useSideEntityController.d.ts +0 -11
- package/dist/src-DOX2nOyh.js.map +0 -1
- package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +0 -39
- package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +0 -90
- package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +0 -83
- package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +0 -32
- package/src/components/EntityCollectionTable/index.tsx +0 -14
- package/src/contexts/SideEntityControllerContext.tsx +0 -5
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +0 -141
- 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/EntityTableCell.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/{EntityCollectionTable → CollectionTableBinding}/table_bindings.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}/PropertyTableCell.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.tsx +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/CollectionTableToolbar.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.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}/ViewModeToggle.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 {
|
|
@@ -59,7 +59,7 @@ export function applyPluginModifyCollection(resolvedCollections: EntityCollectio
|
|
|
59
59
|
*
|
|
60
60
|
* Skips injection if the collection already has the action/callback present.
|
|
61
61
|
*/
|
|
62
|
-
function injectAuthCollectionConfig(collections:
|
|
62
|
+
function injectAuthCollectionConfig(collections: CollectionConfig[]): CollectionConfig[] {
|
|
63
63
|
return collections.map((collection) => {
|
|
64
64
|
const authProp = collection.auth;
|
|
65
65
|
if (!authProp) return collection;
|
|
@@ -116,7 +116,7 @@ function injectAuthCollectionConfig(collections: EntityCollection[]): EntityColl
|
|
|
116
116
|
|
|
117
117
|
const creationResult: UserCreationResult = {
|
|
118
118
|
user: {
|
|
119
|
-
uid: String(props.
|
|
119
|
+
uid: String(props.id),
|
|
120
120
|
email: typeof values.email === "string" ? values.email : "",
|
|
121
121
|
displayName: typeof values.displayName === "string" ? values.displayName : "",
|
|
122
122
|
roles: Array.isArray(values.roles) ? values.roles as string[] : [],
|
|
@@ -150,12 +150,12 @@ function injectAuthCollectionConfig(collections: EntityCollection[]): EntityColl
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
export async function resolveCollections(
|
|
153
|
-
collections: undefined |
|
|
153
|
+
collections: undefined | CollectionConfig[] | CollectionConfigsBuilder,
|
|
154
154
|
authController: AuthController,
|
|
155
155
|
data: RebaseData,
|
|
156
156
|
plugins: RebasePlugin[] | undefined
|
|
157
|
-
): Promise<
|
|
158
|
-
let resolvedCollections:
|
|
157
|
+
): Promise<CollectionConfig[]> {
|
|
158
|
+
let resolvedCollections: CollectionConfig[] = [];
|
|
159
159
|
if (typeof collections === "function") {
|
|
160
160
|
resolvedCollections = await collections({
|
|
161
161
|
user: authController.user,
|
|
@@ -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";
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
} from "@rebasepro/common";
|
|
12
12
|
import { resolvedSelectedEntityView } from "../util/resolutions";
|
|
13
13
|
import { ADDITIONAL_TAB_WIDTH, CONTAINER_FULL_WIDTH, FORM_CONTAINER_WIDTH } from "@rebasepro/core";
|
|
14
|
-
import { useCustomizationController, useLargeLayout, useComponentOverride,
|
|
15
|
-
import { JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../components/
|
|
14
|
+
import { useCustomizationController, useLargeLayout, useComponentOverride, CollectionScopeProvider } from "@rebasepro/core";
|
|
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,
|
|
@@ -4,7 +4,7 @@ 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,
|
|
@@ -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,12 @@ 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.
|
|
88
90
|
return data.collection(entry.slug).findById(entry.entityId)
|
|
89
|
-
.then((
|
|
90
|
-
if (!
|
|
91
|
+
.then((row) => {
|
|
92
|
+
if (!row) return undefined;
|
|
93
|
+
const entity = { id: row.id, path: entry.slug, values: row };
|
|
91
94
|
return { ...entry,
|
|
92
95
|
entity };
|
|
93
96
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { SelectionProps, SelectionTableBinding } from "../components";
|
|
2
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
3
3
|
import { useCallback, useMemo } from "react";
|
|
4
4
|
import { useSideDialogsController } from "../index";
|
|
5
5
|
import { useCollectionRegistryController } from "../index";
|
|
@@ -14,7 +14,7 @@ import { useCollectionRegistryController } from "../index";
|
|
|
14
14
|
* This is the same hook used internally when a reference property is defined.
|
|
15
15
|
* @group Hooks and utilities
|
|
16
16
|
*/
|
|
17
|
-
export function
|
|
17
|
+
export function useSelectionDialog<M extends Record<string, unknown>>(referenceDialogProps: Omit<SelectionProps<M>, "path"> & {
|
|
18
18
|
path?: string | false;
|
|
19
19
|
onClose?: () => void;
|
|
20
20
|
}): { open: () => void; close: () => void } {
|
|
@@ -26,15 +26,15 @@ export function useEntitySelectionDialog<M extends Record<string, unknown>>(refe
|
|
|
26
26
|
if (referenceDialogProps.path) {
|
|
27
27
|
let usedCollection = referenceDialogProps.collection;
|
|
28
28
|
if (!usedCollection)
|
|
29
|
-
usedCollection = navigation.getCollection(referenceDialogProps.path) as
|
|
29
|
+
usedCollection = navigation.getCollection(referenceDialogProps.path) as CollectionConfig<M> | undefined;
|
|
30
30
|
if (!usedCollection)
|
|
31
|
-
throw Error("Not able to resolve the collection in
|
|
31
|
+
throw Error("Not able to resolve the collection in useSelectionDialog. Make sure a collection is registered in path " + referenceDialogProps.path);
|
|
32
32
|
sideDialogsController.open({
|
|
33
33
|
key: `reference_${referenceDialogProps.path}`,
|
|
34
34
|
component:
|
|
35
|
-
<
|
|
35
|
+
<SelectionTableBinding
|
|
36
36
|
collection={usedCollection}
|
|
37
|
-
{...referenceDialogProps as
|
|
37
|
+
{...referenceDialogProps as SelectionProps<M>}/>,
|
|
38
38
|
width: "90vw",
|
|
39
39
|
onClose: () => {
|
|
40
40
|
referenceDialogProps.onClose?.();
|
|
@@ -8,7 +8,7 @@ import { useContext } from "react";
|
|
|
8
8
|
* This hook allows you to open and close side dialogs. This is the mechanism
|
|
9
9
|
* used when open a side entity dialog, or when selecting a reference.
|
|
10
10
|
*
|
|
11
|
-
* If you want to open a side entity dialog, you can use the {@link
|
|
11
|
+
* If you want to open a side entity dialog, you can use the {@link useSidePanel}
|
|
12
12
|
* hook.
|
|
13
13
|
*
|
|
14
14
|
* If you want to select a reference, you can use the {@link useReferenceDialog}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SidePanelController } from "@rebasepro/types";
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
|
+
|
|
4
|
+
export const SidePanelControllerContext = React.createContext<SidePanelController>({} as SidePanelController);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Use this hook to retrieve a entity controller that allows you to open
|
|
8
|
+
* a side dialog to edit a entity.
|
|
9
|
+
*
|
|
10
|
+
* @see SidePanelController
|
|
11
|
+
* @group Hooks and utilities
|
|
12
|
+
*/
|
|
13
|
+
export const useSidePanel = (): SidePanelController => useContext(SidePanelControllerContext);
|