@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,11 +1,11 @@
|
|
|
1
|
-
import type { ComponentRef,
|
|
1
|
+
import type { ComponentRef, CollectionConfig, EntityCustomViewParams, FormViewConfig } from "@rebasepro/types";
|
|
2
2
|
import type { FormContext } from "../types/fields";
|
|
3
3
|
import type { PluginFormActionProps } from "@rebasepro/types";
|
|
4
4
|
import React, { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { Entity, EntityStatus, Property } from "@rebasepro/types";
|
|
6
|
-
import { PluginProviderStack, resolveComponentRef, useComponentOverride,
|
|
5
|
+
import { Entity, EntityStatus, getCollectionDataPath, Property } from "@rebasepro/types";
|
|
6
|
+
import { PluginProviderStack, resolveComponentRef, useComponentOverride, CollectionScopeProvider } from "@rebasepro/core";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { CollectionViewBinding, EntityViewBinding } from "../components";
|
|
9
9
|
import { CircularProgressCenter, iconSize } from "@rebasepro/ui";
|
|
10
10
|
import {
|
|
11
11
|
Alert,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
import { resolvedSelectedEntityView } from "../util/resolutions";
|
|
35
35
|
import {
|
|
36
36
|
useCustomizationController,
|
|
37
|
-
|
|
37
|
+
useFetch,
|
|
38
38
|
useRebaseContext,
|
|
39
39
|
useLargeLayout,
|
|
40
40
|
useSlot
|
|
@@ -43,11 +43,11 @@ import { useUrlController, useCollectionRegistryController } from "../index";
|
|
|
43
43
|
import { useNavigate } from "react-router-dom";
|
|
44
44
|
import { getValueInPath } from "@rebasepro/utils";
|
|
45
45
|
import { getEntityTitlePropertyKey, resolveTitleToString } from "../util/previews";
|
|
46
|
-
import {
|
|
46
|
+
import { JsonPreviewBinding } from "../components/JsonPreviewBinding";
|
|
47
47
|
|
|
48
48
|
const EntityHistoryView = lazy(() => import("../components/history").then(m => ({ default: m.EntityHistoryView })));
|
|
49
49
|
|
|
50
|
-
import { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../util/
|
|
50
|
+
import { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../util/view_constants";
|
|
51
51
|
|
|
52
52
|
export type BarActionsParams = {
|
|
53
53
|
values: object,
|
|
@@ -60,12 +60,12 @@ export type OnTabChangeParams<M extends Record<string, unknown>> = {
|
|
|
60
60
|
path: string;
|
|
61
61
|
entityId?: string | number;
|
|
62
62
|
selectedTab?: string;
|
|
63
|
-
collection:
|
|
63
|
+
collection: CollectionConfig<M>;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export interface
|
|
66
|
+
export interface DetailViewBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
67
67
|
path: string;
|
|
68
|
-
collection:
|
|
68
|
+
collection: CollectionConfig<M>;
|
|
69
69
|
entityId: string | number;
|
|
70
70
|
selectedTab?: string;
|
|
71
71
|
parentCollectionSlugs: string[];
|
|
@@ -76,16 +76,16 @@ export interface EntityDetailViewProps<M extends Record<string, unknown> = Recor
|
|
|
76
76
|
barActions?: (params: BarActionsParams) => React.ReactNode;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export function
|
|
79
|
+
export function DetailViewBinding<M extends Record<string, unknown>>({
|
|
80
80
|
entityId,
|
|
81
81
|
...props
|
|
82
|
-
}:
|
|
82
|
+
}: DetailViewBindingProps<M>) {
|
|
83
83
|
|
|
84
84
|
const {
|
|
85
85
|
entity,
|
|
86
86
|
dataLoading,
|
|
87
87
|
dataLoadingError
|
|
88
|
-
} =
|
|
88
|
+
} = useFetch<M>({
|
|
89
89
|
path: props.path,
|
|
90
90
|
entityId: entityId,
|
|
91
91
|
collection: props.collection,
|
|
@@ -105,7 +105,7 @@ export function EntityDetailView<M extends Record<string, unknown>>({
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const content = (
|
|
108
|
-
<
|
|
108
|
+
<DetailViewBindingInner<M>
|
|
109
109
|
{...props}
|
|
110
110
|
entityId={entityId}
|
|
111
111
|
entity={entity}
|
|
@@ -113,17 +113,14 @@ export function EntityDetailView<M extends Record<string, unknown>>({
|
|
|
113
113
|
/>
|
|
114
114
|
);
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
return content;
|
|
116
|
+
return (
|
|
117
|
+
<CollectionScopeProvider collection={props.collection}>
|
|
118
|
+
{content}
|
|
119
|
+
</CollectionScopeProvider>
|
|
120
|
+
);
|
|
124
121
|
}
|
|
125
122
|
|
|
126
|
-
function
|
|
123
|
+
function DetailViewBindingInner<M extends Record<string, unknown>>({
|
|
127
124
|
path,
|
|
128
125
|
entityId,
|
|
129
126
|
selectedTab: selectedTabProp,
|
|
@@ -136,11 +133,11 @@ function EntityDetailViewInner<M extends Record<string, unknown>>({
|
|
|
136
133
|
dataLoading,
|
|
137
134
|
layout = "full_screen",
|
|
138
135
|
barActions
|
|
139
|
-
}:
|
|
136
|
+
}: DetailViewBindingProps<M> & {
|
|
140
137
|
entity?: Entity<M>,
|
|
141
138
|
dataLoading: boolean,
|
|
142
139
|
}) {
|
|
143
|
-
const ResolvedCollectionView = useComponentOverride("Collection.View",
|
|
140
|
+
const ResolvedCollectionView = useComponentOverride("Collection.View", CollectionViewBinding);
|
|
144
141
|
const { t } = useTranslation();
|
|
145
142
|
const context = useRebaseContext();
|
|
146
143
|
const urlController = useUrlController();
|
|
@@ -166,7 +163,7 @@ entityId }
|
|
|
166
163
|
), [collection, entityId]);
|
|
167
164
|
|
|
168
165
|
// Track whether the user has explicitly clicked a tab in this component
|
|
169
|
-
// instance. See
|
|
166
|
+
// instance. See EditViewBindingInner for full explanation.
|
|
170
167
|
const userHasChangedTab = useRef(false);
|
|
171
168
|
|
|
172
169
|
const [selectedTab, setSelectedTab] = useState<string>(() => {
|
|
@@ -264,7 +261,7 @@ entityId }
|
|
|
264
261
|
const pluginActionsTop = useSlot("form.actions.top", formActionTopProps);
|
|
265
262
|
|
|
266
263
|
// Resolve formView.Builder if provided
|
|
267
|
-
const formViewConfig = (collection as
|
|
264
|
+
const formViewConfig = (collection as CollectionConfig<M> & { formView?: FormViewConfig<M> }).formView;
|
|
268
265
|
const FormViewBuilder = formViewConfig?.Builder ? resolveComponentRef<EntityCustomViewParams>(formViewConfig.Builder as ComponentRef<EntityCustomViewParams>) : null;
|
|
269
266
|
|
|
270
267
|
// Title resolution
|
|
@@ -323,7 +320,7 @@ entityId }
|
|
|
323
320
|
key={"json_view"}
|
|
324
321
|
role="tabpanel">
|
|
325
322
|
<ErrorBoundary>
|
|
326
|
-
<
|
|
323
|
+
<JsonPreviewBinding values={usedEntity?.values ?? {}} />
|
|
327
324
|
</ErrorBoundary>
|
|
328
325
|
</div> : null;
|
|
329
326
|
|
|
@@ -347,7 +344,7 @@ entityId }
|
|
|
347
344
|
// Subcollection views
|
|
348
345
|
const subCollectionsViews = subcollections && subcollections.map((subcollection) => {
|
|
349
346
|
const subcollectionId = subcollection.slug;
|
|
350
|
-
const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection
|
|
347
|
+
const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(getCollectionDataPath(subcollection))}` : undefined;
|
|
351
348
|
|
|
352
349
|
if (activeTab !== subcollectionId) return null;
|
|
353
350
|
return (
|
|
@@ -405,7 +402,7 @@ entityId }
|
|
|
405
402
|
|
|
406
403
|
return (
|
|
407
404
|
<>
|
|
408
|
-
{usedEntity && <
|
|
405
|
+
{usedEntity && <EntityViewBinding
|
|
409
406
|
entity={usedEntity}
|
|
410
407
|
collection={collection}
|
|
411
408
|
path={path}
|
|
@@ -639,7 +636,7 @@ entityId }
|
|
|
639
636
|
return result;
|
|
640
637
|
}
|
|
641
638
|
|
|
642
|
-
function DetailViewSkeleton({ collection }: { collection:
|
|
639
|
+
function DetailViewSkeleton({ collection }: { collection: CollectionConfig<Record<string, unknown>> }) {
|
|
643
640
|
return (
|
|
644
641
|
<div className="flex-1 flex flex-row w-full overflow-y-auto justify-center">
|
|
645
642
|
<div className="relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit">
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import type {
|
|
2
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
3
3
|
import type { FormContext } from "../types/fields";
|
|
4
|
-
import type { EntityAction, EntityActionClickProps,
|
|
4
|
+
import type { EntityAction, EntityActionClickProps, SidePanelController } from "@rebasepro/types";
|
|
5
5
|
import React, { useMemo } from "react";
|
|
6
|
-
import { Entity, RebaseContext } from "@rebasepro/types";
|
|
6
|
+
import { Entity, getCollectionDataPath, RebaseContext } from "@rebasepro/types";
|
|
7
7
|
import type { EntityFormActionsProps } from "../types/components/EntityFormActionsProps";
|
|
8
8
|
import { copyEntityAction, deleteEntityAction } from "../components";
|
|
9
9
|
import { mergeEntityActions } from "../util/entity_actions";
|
|
@@ -21,7 +21,7 @@ import { ErrorTooltip } from "@rebasepro/core";
|
|
|
21
21
|
import { usePermissions } from "@rebasepro/core";
|
|
22
22
|
import { useCMSContext } from "../index";
|
|
23
23
|
|
|
24
|
-
export function
|
|
24
|
+
export function EditFormActions({
|
|
25
25
|
collection,
|
|
26
26
|
path,
|
|
27
27
|
entity,
|
|
@@ -39,7 +39,7 @@ export function EntityEditViewFormActions({
|
|
|
39
39
|
|
|
40
40
|
const { canCreate, canDelete } = usePermissions();
|
|
41
41
|
const context = useCMSContext();
|
|
42
|
-
const
|
|
42
|
+
const sidePanelController = context.sidePanelController;
|
|
43
43
|
const sideDialogContext = useSideDialogContext();
|
|
44
44
|
const customizationController = useCustomizationController();
|
|
45
45
|
const { t } = useTranslation();
|
|
@@ -70,7 +70,7 @@ export function EntityEditViewFormActions({
|
|
|
70
70
|
formActions,
|
|
71
71
|
collection,
|
|
72
72
|
context,
|
|
73
|
-
|
|
73
|
+
sidePanelController,
|
|
74
74
|
disabled,
|
|
75
75
|
status,
|
|
76
76
|
sideDialogContext,
|
|
@@ -89,7 +89,7 @@ export function EntityEditViewFormActions({
|
|
|
89
89
|
formActions,
|
|
90
90
|
collection,
|
|
91
91
|
context,
|
|
92
|
-
|
|
92
|
+
sidePanelController,
|
|
93
93
|
sideDialogContext,
|
|
94
94
|
disabled,
|
|
95
95
|
status,
|
|
@@ -116,9 +116,9 @@ type ActionsViewProps<M extends Record<string, unknown>> = {
|
|
|
116
116
|
savingError: Error | undefined,
|
|
117
117
|
entity: Entity<M> | undefined,
|
|
118
118
|
formActions: EntityAction[],
|
|
119
|
-
collection:
|
|
119
|
+
collection: CollectionConfig,
|
|
120
120
|
context: RebaseContext,
|
|
121
|
-
|
|
121
|
+
sidePanelController: SidePanelController,
|
|
122
122
|
disabled: boolean,
|
|
123
123
|
status: "new" | "existing" | "copy",
|
|
124
124
|
sideDialogContext: SideDialogController,
|
|
@@ -137,7 +137,7 @@ function buildBottomActions<M extends Record<string, unknown>>({
|
|
|
137
137
|
formActions,
|
|
138
138
|
collection,
|
|
139
139
|
context,
|
|
140
|
-
|
|
140
|
+
sidePanelController,
|
|
141
141
|
disabled,
|
|
142
142
|
status,
|
|
143
143
|
sideDialogContext,
|
|
@@ -168,10 +168,10 @@ function buildBottomActions<M extends Record<string, unknown>>({
|
|
|
168
168
|
const props = {
|
|
169
169
|
view: "form",
|
|
170
170
|
entity,
|
|
171
|
-
path: collection
|
|
171
|
+
path: getCollectionDataPath(collection),
|
|
172
172
|
collection: collection,
|
|
173
173
|
context,
|
|
174
|
-
|
|
174
|
+
sidePanelController,
|
|
175
175
|
openEntityMode,
|
|
176
176
|
navigateBack,
|
|
177
177
|
formContext
|
|
@@ -243,7 +243,7 @@ function buildSideActions<M extends Record<string, unknown>>({
|
|
|
243
243
|
formActions,
|
|
244
244
|
collection,
|
|
245
245
|
context,
|
|
246
|
-
|
|
246
|
+
sidePanelController,
|
|
247
247
|
disabled,
|
|
248
248
|
status,
|
|
249
249
|
sideDialogContext,
|
|
@@ -292,10 +292,10 @@ function buildSideActions<M extends Record<string, unknown>>({
|
|
|
292
292
|
const props = {
|
|
293
293
|
view: "form",
|
|
294
294
|
entity,
|
|
295
|
-
path: collection
|
|
295
|
+
path: getCollectionDataPath(collection),
|
|
296
296
|
collection: collection,
|
|
297
297
|
context,
|
|
298
|
-
|
|
298
|
+
sidePanelController,
|
|
299
299
|
openEntityMode,
|
|
300
300
|
navigateBack,
|
|
301
301
|
formContext
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ComponentRef,
|
|
1
|
+
import type { ComponentRef, CollectionConfig, EntityCustomViewParams, FormViewConfig } from "@rebasepro/types";
|
|
2
2
|
import type { FormContext } from "../types/fields";
|
|
3
3
|
import type { PluginFormActionProps } from "@rebasepro/types";
|
|
4
4
|
import React, { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { Entity, EntityStatus } from "@rebasepro/types";
|
|
6
|
-
import { PluginProviderStack, resolveComponentRef, useComponentOverride,
|
|
5
|
+
import { Entity, EntityStatus, getCollectionDataPath } from "@rebasepro/types";
|
|
6
|
+
import { PluginProviderStack, resolveComponentRef, useComponentOverride, CollectionScopeProvider } from "@rebasepro/core";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { CollectionViewBinding, EntityViewBinding } from "../components";
|
|
9
9
|
import { CircularProgressCenter, iconSize } from "@rebasepro/ui";
|
|
10
10
|
import {
|
|
11
11
|
CenteredView,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import { resolvedSelectedEntityView } from "../util/resolutions";
|
|
33
33
|
import {
|
|
34
34
|
useCustomizationController,
|
|
35
|
-
|
|
35
|
+
useFetch,
|
|
36
36
|
useRebaseContext,
|
|
37
37
|
useLargeLayout,
|
|
38
38
|
useSlot,
|
|
@@ -42,8 +42,8 @@ import { getEntityFromMemoryCache } from "@rebasepro/core";
|
|
|
42
42
|
import { EntityFormBinding } from "../form";
|
|
43
43
|
import type { EntityFormBindingProps } from "../form";
|
|
44
44
|
import type { OnUpdateParams } from "../types/components/EntityFormProps";
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
45
|
+
import { EditFormActions } from "./EditFormActions";
|
|
46
|
+
import { JsonPreviewBinding } from "../components/JsonPreviewBinding";
|
|
47
47
|
// Lazy-load history view — only loaded when user clicks the HistoryIcon tab
|
|
48
48
|
const EntityHistoryView = lazy(() => import("../components/history").then(m => ({ default: m.EntityHistoryView })));
|
|
49
49
|
import { createFormexStub, getEntityFromCache } from "@rebasepro/core";
|
|
@@ -51,7 +51,7 @@ import { usePermissions } from "@rebasepro/core";
|
|
|
51
51
|
import { useUrlController } from "../index";
|
|
52
52
|
import { useNavigate } from "react-router-dom";
|
|
53
53
|
|
|
54
|
-
import { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../util/
|
|
54
|
+
import { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE } from "../util/view_constants";
|
|
55
55
|
export { MAIN_TAB_VALUE, JSON_TAB_VALUE, HISTORY_TAB_VALUE };
|
|
56
56
|
|
|
57
57
|
export type BarActionsParams = {
|
|
@@ -65,16 +65,16 @@ export type OnTabChangeParams<M extends Record<string, unknown>> = {
|
|
|
65
65
|
path: string;
|
|
66
66
|
entityId?: string | number;
|
|
67
67
|
selectedTab?: string;
|
|
68
|
-
collection:
|
|
68
|
+
collection: CollectionConfig<M>;
|
|
69
69
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
export interface
|
|
72
|
+
export interface EditViewBindingProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
73
73
|
/**
|
|
74
74
|
* The CMS path of the entity, e.g. "users" or "products".
|
|
75
75
|
*/
|
|
76
76
|
path: string;
|
|
77
|
-
collection:
|
|
77
|
+
collection: CollectionConfig<M>;
|
|
78
78
|
entityId?: string | number;
|
|
79
79
|
databaseId?: string;
|
|
80
80
|
copy?: boolean;
|
|
@@ -90,26 +90,26 @@ export interface EntityEditViewProps<M extends Record<string, unknown> = Record<
|
|
|
90
90
|
/**
|
|
91
91
|
* Pre-populate the form with these values when creating a new entity.
|
|
92
92
|
* Only applied when the form is in "new" mode (no entityId).
|
|
93
|
-
* Sourced from
|
|
93
|
+
* Sourced from SidePanelBindingProps (side panel) or location.state (full screen).
|
|
94
94
|
*/
|
|
95
95
|
defaultValues?: Partial<M>;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* This is the default view that is used as the content of a side panel when
|
|
100
|
-
*
|
|
100
|
+
* a record is opened.
|
|
101
101
|
*/
|
|
102
|
-
export function
|
|
102
|
+
export function EditViewBinding<M extends Record<string, unknown>>({
|
|
103
103
|
entityId,
|
|
104
104
|
...props
|
|
105
|
-
}:
|
|
105
|
+
}: EditViewBindingProps<M>) {
|
|
106
106
|
|
|
107
107
|
const {
|
|
108
108
|
entity,
|
|
109
109
|
dataLoading,
|
|
110
110
|
|
|
111
111
|
dataLoadingError
|
|
112
|
-
} =
|
|
112
|
+
} = useFetch<M>({
|
|
113
113
|
path: props.path,
|
|
114
114
|
entityId: entityId,
|
|
115
115
|
collection: props.collection,
|
|
@@ -148,7 +148,7 @@ export function EntityEditView<M extends Record<string, unknown>>({
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
const content = (
|
|
151
|
-
<
|
|
151
|
+
<EditViewBindingInner<M> {...props}
|
|
152
152
|
entityId={entityId}
|
|
153
153
|
entity={entity}
|
|
154
154
|
initialDirtyValues={initialDirtyValues as Partial<M>}
|
|
@@ -159,17 +159,14 @@ export function EntityEditView<M extends Record<string, unknown>>({
|
|
|
159
159
|
/>
|
|
160
160
|
);
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
return content;
|
|
162
|
+
return (
|
|
163
|
+
<CollectionScopeProvider collection={props.collection}>
|
|
164
|
+
{content}
|
|
165
|
+
</CollectionScopeProvider>
|
|
166
|
+
);
|
|
170
167
|
}
|
|
171
168
|
|
|
172
|
-
export function
|
|
169
|
+
export function EditViewBindingInner<M extends Record<string, unknown>>({
|
|
173
170
|
path,
|
|
174
171
|
entityId,
|
|
175
172
|
selectedTab: selectedTabProp,
|
|
@@ -188,7 +185,7 @@ export function EntityEditViewInner<M extends Record<string, unknown>>({
|
|
|
188
185
|
setStatus,
|
|
189
186
|
formProps,
|
|
190
187
|
canEdit
|
|
191
|
-
}:
|
|
188
|
+
}: EditViewBindingProps<M> & {
|
|
192
189
|
entity?: Entity<M>,
|
|
193
190
|
initialDirtyValues?: Partial<M>, // dirty cached entity in memory
|
|
194
191
|
dataLoading: boolean,
|
|
@@ -197,9 +194,9 @@ export function EntityEditViewInner<M extends Record<string, unknown>>({
|
|
|
197
194
|
canEdit?: boolean,
|
|
198
195
|
}) {
|
|
199
196
|
|
|
200
|
-
const ResolvedFormActions = useComponentOverride("
|
|
197
|
+
const ResolvedFormActions = useComponentOverride("EditView.FormActions", EditFormActions);
|
|
201
198
|
const ResolvedEntityForm = useComponentOverride("Entity.Form", EntityFormBinding) as typeof EntityFormBinding;
|
|
202
|
-
const ResolvedCollectionView = useComponentOverride("Collection.View",
|
|
199
|
+
const ResolvedCollectionView = useComponentOverride("Collection.View", CollectionViewBinding);
|
|
203
200
|
|
|
204
201
|
const context = useRebaseContext();
|
|
205
202
|
const urlController = useUrlController();
|
|
@@ -392,7 +389,7 @@ parentEntityIds,
|
|
|
392
389
|
key={"json_view"}
|
|
393
390
|
role="tabpanel">
|
|
394
391
|
<ErrorBoundary>
|
|
395
|
-
<
|
|
392
|
+
<JsonPreviewBinding
|
|
396
393
|
values={formContext?.values ?? entity?.values ?? {}} />
|
|
397
394
|
</ErrorBoundary>
|
|
398
395
|
</div> : null;
|
|
@@ -416,7 +413,7 @@ parentEntityIds,
|
|
|
416
413
|
|
|
417
414
|
const subCollectionsViews = subcollections && subcollections.map((subcollection) => {
|
|
418
415
|
const subcollectionId = subcollection.slug;
|
|
419
|
-
const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection
|
|
416
|
+
const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(getCollectionDataPath(subcollection))}` : undefined;
|
|
420
417
|
|
|
421
418
|
if (activeTab !== subcollectionId) return null;
|
|
422
419
|
return (
|
|
@@ -462,7 +459,7 @@ parentEntityIds,
|
|
|
462
459
|
}, [status, onTabChange, path, entityId, collection]);
|
|
463
460
|
|
|
464
461
|
// Resolve formView.Builder if provided
|
|
465
|
-
const formViewConfig = (collection as
|
|
462
|
+
const formViewConfig = (collection as CollectionConfig<M> & { formView?: FormViewConfig<M> }).formView;
|
|
466
463
|
const FormViewBuilder = formViewConfig?.Builder ? resolveComponentRef<EntityCustomViewParams>(formViewConfig.Builder as ComponentRef<EntityCustomViewParams>) : null;
|
|
467
464
|
const formViewIncludeActions = formViewConfig?.includeActions !== false;
|
|
468
465
|
|
|
@@ -486,7 +483,7 @@ parentEntityIds,
|
|
|
486
483
|
</Suspense>
|
|
487
484
|
</ErrorBoundary>
|
|
488
485
|
) : (
|
|
489
|
-
<
|
|
486
|
+
<EntityViewBinding
|
|
490
487
|
className={"px-8 h-full overflow-auto"}
|
|
491
488
|
entity={entity}
|
|
492
489
|
path={path}
|
|
@@ -718,7 +715,7 @@ parentEntityIds,
|
|
|
718
715
|
return result;
|
|
719
716
|
}
|
|
720
717
|
|
|
721
|
-
function EntityFormSkeleton({ collection }: { collection:
|
|
718
|
+
function EntityFormSkeleton({ collection }: { collection: CollectionConfig }) {
|
|
722
719
|
return (
|
|
723
720
|
<div className="flex-1 flex flex-row w-full overflow-y-auto justify-center">
|
|
724
721
|
<div className="relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
2
2
|
import type { Property } from "@rebasepro/types";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { useEffect, useMemo } from "react";
|
|
@@ -27,12 +27,12 @@ import { IconForView } from "@rebasepro/core";
|
|
|
27
27
|
import { getPropertyInPath } from "../util/property_utils";
|
|
28
28
|
import { getEntityPreviewKeys, getEntityTitlePropertyKey } from "../util/previews";
|
|
29
29
|
import { getValueInPath } from "@rebasepro/utils";
|
|
30
|
-
import { useCollectionRegistryController,
|
|
30
|
+
import { useCollectionRegistryController, useSidePanel } from "../index";
|
|
31
31
|
|
|
32
|
-
export type
|
|
32
|
+
export type EntityPreviewBindingProps = {
|
|
33
33
|
size?: PreviewSize,
|
|
34
34
|
actions?: React.ReactNode,
|
|
35
|
-
collection?:
|
|
35
|
+
collection?: CollectionConfig,
|
|
36
36
|
hover?: boolean;
|
|
37
37
|
previewKeys?: string[],
|
|
38
38
|
disabled?: boolean,
|
|
@@ -42,16 +42,16 @@ export type EntityPreviewProps = {
|
|
|
42
42
|
includeEntityLink?: boolean,
|
|
43
43
|
includeImage?: boolean,
|
|
44
44
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
45
|
-
|
|
45
|
+
onSidePanelClick?: (entity: Entity) => void,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export type
|
|
48
|
+
export type EntityPreviewBindingDataProps = {
|
|
49
49
|
size?: "smallest" | "small" | "medium" | "large",
|
|
50
50
|
actions?: React.ReactNode,
|
|
51
|
-
collection?:
|
|
51
|
+
collection?: CollectionConfig,
|
|
52
52
|
previewKeys?: string[],
|
|
53
53
|
entity: Entity<any>,
|
|
54
|
-
|
|
54
|
+
onSidePanelClick?: (entity: Entity) => void,
|
|
55
55
|
includeId?: boolean,
|
|
56
56
|
includeTitle?: boolean,
|
|
57
57
|
includeEntityLink?: boolean,
|
|
@@ -59,25 +59,25 @@ export type EntityPreviewDataProps = {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* This component contains the main logic and content for displaying
|
|
63
|
-
* without any container wrapper. Used internally by
|
|
62
|
+
* This component contains the main logic and content for displaying a entity preview,
|
|
63
|
+
* without any container wrapper. Used internally by EntityPreviewBinding.
|
|
64
64
|
*/
|
|
65
|
-
export function
|
|
65
|
+
export function EntityPreviewBindingData({
|
|
66
66
|
actions,
|
|
67
67
|
collection: collectionProp,
|
|
68
68
|
previewKeys,
|
|
69
69
|
size = "medium",
|
|
70
70
|
includeId = true,
|
|
71
|
-
|
|
71
|
+
onSidePanelClick,
|
|
72
72
|
includeTitle = true,
|
|
73
73
|
includeEntityLink = true,
|
|
74
74
|
includeImage = true,
|
|
75
75
|
entity
|
|
76
|
-
}:
|
|
76
|
+
}: EntityPreviewBindingDataProps) {
|
|
77
77
|
|
|
78
78
|
const authController = useAuthController();
|
|
79
79
|
const analyticsController = useAnalyticsController();
|
|
80
|
-
const
|
|
80
|
+
const sidePanelController = useSidePanel();
|
|
81
81
|
const customizationController = useCustomizationController();
|
|
82
82
|
|
|
83
83
|
const collectionRegistryController = useCollectionRegistryController();
|
|
@@ -194,12 +194,12 @@ export function EntityPreviewData({
|
|
|
194
194
|
onClick={(e) => {
|
|
195
195
|
e.stopPropagation();
|
|
196
196
|
e.preventDefault();
|
|
197
|
-
|
|
197
|
+
onSidePanelClick?.(entity);
|
|
198
198
|
analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
|
|
199
199
|
path: entity.path,
|
|
200
200
|
entityId: entity.id
|
|
201
201
|
});
|
|
202
|
-
|
|
202
|
+
sidePanelController.open({
|
|
203
203
|
entityId: entity.id,
|
|
204
204
|
path: entity.path,
|
|
205
205
|
collection,
|
|
@@ -216,11 +216,11 @@ export function EntityPreviewData({
|
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
export function
|
|
219
|
+
export function EntityPreviewBindingWithId({
|
|
220
220
|
entityId,
|
|
221
221
|
path,
|
|
222
222
|
...props
|
|
223
|
-
}: Omit<
|
|
223
|
+
}: Omit<EntityPreviewBindingProps, "entity"> & {
|
|
224
224
|
entityId: string | number;
|
|
225
225
|
path: string;
|
|
226
226
|
databaseId?: string;
|
|
@@ -236,7 +236,7 @@ export function EntityPreviewWithId({
|
|
|
236
236
|
setEntity(undefined);
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
const
|
|
239
|
+
const fetchOne = async () => {
|
|
240
240
|
setDataLoading(true);
|
|
241
241
|
try {
|
|
242
242
|
const fetchedEntity = await dataClient.collection(path).findById(entityId);
|
|
@@ -255,7 +255,7 @@ export function EntityPreviewWithId({
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
fetchOne();
|
|
259
259
|
|
|
260
260
|
return () => {
|
|
261
261
|
isMounted = false;
|
|
@@ -284,16 +284,16 @@ export function EntityPreviewWithId({
|
|
|
284
284
|
);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
return <
|
|
287
|
+
return <EntityPreviewBindingData
|
|
288
288
|
{...props}
|
|
289
289
|
entity={entity}/>;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
-
* This view is used to display a preview of
|
|
293
|
+
* This view is used to display a preview of a entity.
|
|
294
294
|
* It is used by default in reference fields and whenever a reference is displayed.
|
|
295
295
|
*/
|
|
296
|
-
export function
|
|
296
|
+
export function EntityPreviewBinding({
|
|
297
297
|
actions,
|
|
298
298
|
disabled,
|
|
299
299
|
hover,
|
|
@@ -305,16 +305,16 @@ export function EntityPreview({
|
|
|
305
305
|
includeTitle = true,
|
|
306
306
|
includeEntityLink = true,
|
|
307
307
|
includeImage = true,
|
|
308
|
-
|
|
308
|
+
onSidePanelClick,
|
|
309
309
|
entity
|
|
310
|
-
}:
|
|
310
|
+
}: EntityPreviewBindingProps) {
|
|
311
311
|
|
|
312
312
|
return (
|
|
313
313
|
<EntityPreviewContainer
|
|
314
314
|
onClick={disabled ? undefined : onClick}
|
|
315
315
|
hover={disabled ? undefined : hover}
|
|
316
316
|
size={size}>
|
|
317
|
-
<
|
|
317
|
+
<EntityPreviewBindingData
|
|
318
318
|
actions={actions}
|
|
319
319
|
collection={collection}
|
|
320
320
|
previewKeys={previewKeys}
|
|
@@ -323,7 +323,7 @@ export function EntityPreview({
|
|
|
323
323
|
includeTitle={includeTitle}
|
|
324
324
|
includeEntityLink={includeEntityLink}
|
|
325
325
|
includeImage={includeImage}
|
|
326
|
-
|
|
326
|
+
onSidePanelClick={onSidePanelClick}
|
|
327
327
|
entity={entity}
|
|
328
328
|
/>
|
|
329
329
|
</EntityPreviewContainer>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Properties } from "@rebasepro/types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
3
3
|
import type { CustomizationController } from "@rebasepro/types";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { Entity } from "@rebasepro/types";
|
|
@@ -12,20 +12,20 @@ import { PropertyCollectionView } from "./PropertyCollectionView";
|
|
|
12
12
|
/**
|
|
13
13
|
* @group Components
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface EntityViewBindingProps<M extends Record<string, unknown>> {
|
|
16
16
|
entity: Entity<M>;
|
|
17
|
-
collection:
|
|
17
|
+
collection: CollectionConfig<M>;
|
|
18
18
|
path: string;
|
|
19
19
|
className?: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function
|
|
22
|
+
export function EntityViewBinding<M extends Record<string, unknown>>(
|
|
23
23
|
{
|
|
24
24
|
entity,
|
|
25
25
|
collection,
|
|
26
26
|
path,
|
|
27
27
|
className
|
|
28
|
-
}:
|
|
28
|
+
}: EntityViewBindingProps<M>) {
|
|
29
29
|
|
|
30
30
|
const customizationController: CustomizationController = useCustomizationController();
|
|
31
31
|
|