@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
|
@@ -76,7 +76,7 @@ export function ContentHomePage({
|
|
|
76
76
|
// Content mode shows collections, CMS custom views, and admin entries — but not Studio dev views.
|
|
77
77
|
const rawNavigationEntries = useMemo(() => {
|
|
78
78
|
if (adminModeController.mode === "studio") {
|
|
79
|
-
return unFilteredNavigationEntries.filter(e => e.type === "view" || e.type === "admin");
|
|
79
|
+
return unFilteredNavigationEntries.filter(e => (e.type === "view" && studioViewSlugs.has(e.slug)) || e.type === "admin");
|
|
80
80
|
}
|
|
81
81
|
return unFilteredNavigationEntries.filter(e => e.type !== "view" || !studioViewSlugs.has(e.slug));
|
|
82
82
|
}, [unFilteredNavigationEntries, adminModeController.mode, studioViewSlugs]);
|
|
@@ -2,7 +2,7 @@ import React, { useRef } from "react";
|
|
|
2
2
|
import { Highlight, themes } from "prism-react-renderer";
|
|
3
3
|
import { useModeController } from "@rebasepro/core";
|
|
4
4
|
|
|
5
|
-
export function
|
|
5
|
+
export function JsonPreviewBinding({ values }: { values: object }) {
|
|
6
6
|
const code = JSON.stringify(values, null, "\t");
|
|
7
7
|
const { mode } = useModeController();
|
|
8
8
|
const preRef = useRef<HTMLPreElement>(null);
|
|
@@ -10,7 +10,7 @@ import type { RebaseCMSConfig } from "@rebasepro/types";
|
|
|
10
10
|
* is auto-wired as a native feature (slots, provider, Studio view) without
|
|
11
11
|
* needing any external plugin.
|
|
12
12
|
*/
|
|
13
|
-
export function RebaseCMS({ collections, views, homePage, entityViews, entityActions,
|
|
13
|
+
export function RebaseCMS({ collections, views, homePage, entityViews, entityActions, collectionEditor, navigationGroupMappings, basePath }: RebaseCMSConfig) {
|
|
14
14
|
const dispatch = useRebaseRegistryDispatch();
|
|
15
15
|
|
|
16
16
|
useLayoutEffect(() => {
|
|
@@ -19,11 +19,11 @@ views,
|
|
|
19
19
|
homePage,
|
|
20
20
|
entityViews,
|
|
21
21
|
entityActions,
|
|
22
|
-
plugins,
|
|
23
22
|
collectionEditor,
|
|
24
|
-
navigationGroupMappings
|
|
23
|
+
navigationGroupMappings,
|
|
24
|
+
basePath });
|
|
25
25
|
return () => dispatch.unregisterCMS();
|
|
26
|
-
}, [dispatch, collections, views, homePage, entityViews, entityActions,
|
|
26
|
+
}, [dispatch, collections, views, homePage, entityViews, entityActions, collectionEditor, navigationGroupMappings, basePath]);
|
|
27
27
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
} from "@rebasepro/core";
|
|
17
17
|
import { buildRoutedRebaseData, resolveDataSource } from "@rebasepro/common";
|
|
18
18
|
import { CircularProgressCenter } from "@rebasepro/ui";
|
|
19
|
-
import type { AppView, CollectionEditorOptions, EntityCustomView, EntityAction,
|
|
19
|
+
import type { AppView, CollectionEditorOptions, EntityCustomView, EntityAction, CollectionConfig, RebasePlugin } from "@rebasepro/types";
|
|
20
20
|
import type { CollectionRegistryController } from "@rebasepro/types";
|
|
21
21
|
import type { UrlController, NavigationStateController } from "@rebasepro/types";
|
|
22
22
|
|
|
23
23
|
const EMPTY_PLUGINS: RebasePlugin[] = [];
|
|
24
|
-
const EMPTY_COLLECTIONS:
|
|
24
|
+
const EMPTY_COLLECTIONS: CollectionConfig[] = [];
|
|
25
25
|
|
|
26
26
|
import { useBuildNavigationStateController } from "../hooks/navigation/useBuildNavigationStateController";
|
|
27
27
|
import { useBuildUrlController } from "../hooks/navigation/useBuildUrlController";
|
|
@@ -31,7 +31,7 @@ import { CollectionRegistryContext } from "../hooks/navigation/contexts/Collecti
|
|
|
31
31
|
import { UrlContext } from "../hooks/navigation/contexts/UrlContext";
|
|
32
32
|
import { NavigationStateContext } from "../hooks/navigation/contexts/NavigationStateContext";
|
|
33
33
|
|
|
34
|
-
import {
|
|
34
|
+
import { SidePanelProvider } from "./SidePanelProvider";
|
|
35
35
|
|
|
36
36
|
// Collection editor internals — used when collectionEditor is enabled
|
|
37
37
|
import { useLocalCollectionsConfigController } from "../collection_editor/useLocalCollectionsConfigController";
|
|
@@ -61,7 +61,7 @@ export interface RebaseNavigationProps {
|
|
|
61
61
|
* ```tsx
|
|
62
62
|
* <RebaseNavigation>
|
|
63
63
|
* <MyCustomLayout>
|
|
64
|
-
* <
|
|
64
|
+
* <CollectionViewBinding ... />
|
|
65
65
|
* </MyCustomLayout>
|
|
66
66
|
* </RebaseNavigation>
|
|
67
67
|
* ```
|
|
@@ -109,8 +109,17 @@ export function RebaseNavigation({ children }: RebaseNavigationProps) {
|
|
|
109
109
|
resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key
|
|
110
110
|
}), [defaultData, dataSources]);
|
|
111
111
|
|
|
112
|
+
// Normalize the configured mount prefix to a leading-slash, no-trailing-slash
|
|
113
|
+
// form (e.g. "admin" or "/admin/" -> "/admin"); empty/"/" stays "/".
|
|
114
|
+
const basePath = useMemo(() => {
|
|
115
|
+
const raw = registry.cmsConfig?.basePath;
|
|
116
|
+
if (!raw || raw === "/") return "/";
|
|
117
|
+
const trimmed = raw.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
118
|
+
return trimmed ? `/${trimmed}` : "/";
|
|
119
|
+
}, [registry.cmsConfig?.basePath]);
|
|
120
|
+
|
|
112
121
|
const urlController = useBuildUrlController({
|
|
113
|
-
basePath
|
|
122
|
+
basePath,
|
|
114
123
|
baseCollectionPath: "/c",
|
|
115
124
|
collectionRegistryController
|
|
116
125
|
});
|
|
@@ -195,8 +204,10 @@ export function RebaseNavigation({ children }: RebaseNavigationProps) {
|
|
|
195
204
|
return [...cmsViews, ...devViews];
|
|
196
205
|
}, [cmsViews, devViews]);
|
|
197
206
|
|
|
207
|
+
const parentCustomizationController = useCustomizationController();
|
|
208
|
+
|
|
198
209
|
const navigationStateController = useBuildNavigationStateController({
|
|
199
|
-
plugins:
|
|
210
|
+
plugins: parentCustomizationController.plugins ?? EMPTY_PLUGINS,
|
|
200
211
|
collections: collectionsBuilder,
|
|
201
212
|
views: mergedViews,
|
|
202
213
|
navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,
|
|
@@ -211,9 +222,8 @@ export function RebaseNavigation({ children }: RebaseNavigationProps) {
|
|
|
211
222
|
// The <Rebase> component builds the customizationController from its own props,
|
|
212
223
|
// but entity views passed to <RebaseCMS> are stored in the registry and not
|
|
213
224
|
// automatically merged. We re-provide an enriched controller here so that
|
|
214
|
-
// downstream consumers (
|
|
225
|
+
// downstream consumers (EditViewBinding, side panels, etc.) can resolve
|
|
215
226
|
// string-keyed entity views like "blog_preview".
|
|
216
|
-
const parentCustomizationController = useCustomizationController();
|
|
217
227
|
const enrichedCustomizationController = useMemo(() => {
|
|
218
228
|
const cmsEntityViews = (registry.cmsConfig?.entityViews ?? []) as EntityCustomView[];
|
|
219
229
|
const cmsEntityActions = (registry.cmsConfig?.entityActions ?? []) as EntityAction[];
|
|
@@ -244,14 +254,14 @@ export function RebaseNavigation({ children }: RebaseNavigationProps) {
|
|
|
244
254
|
<CollectionRegistryContext.Provider value={collectionRegistryController}>
|
|
245
255
|
<UrlContext.Provider value={urlController}>
|
|
246
256
|
<NavigationStateContext.Provider value={navigationStateController}>
|
|
247
|
-
<
|
|
257
|
+
<SidePanelProvider>
|
|
248
258
|
<BridgeAutoRegistrar
|
|
249
259
|
collectionRegistryController={collectionRegistryController}
|
|
250
260
|
urlController={urlController}
|
|
251
261
|
navigationStateController={navigationStateController}
|
|
252
262
|
/>
|
|
253
263
|
{children}
|
|
254
|
-
</
|
|
264
|
+
</SidePanelProvider>
|
|
255
265
|
</NavigationStateContext.Provider>
|
|
256
266
|
</UrlContext.Provider>
|
|
257
267
|
</CollectionRegistryContext.Provider>
|
package/src/components/ReferenceTable/{EntitySelectionTable.tsx → SelectionTableBinding.tsx}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
2
2
|
import React, { MouseEventHandler, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { CollectionSize, Entity, FilterValues } from "@rebasepro/types";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "../
|
|
6
|
+
CollectionRowActions,
|
|
7
|
+
CollectionTableBinding
|
|
8
|
+
} from "../CollectionTableBinding";
|
|
9
9
|
import {
|
|
10
|
+
CollectionScopeProvider,
|
|
10
11
|
useAuthController,
|
|
11
12
|
useCustomizationController,
|
|
12
13
|
useData,
|
|
@@ -17,17 +18,17 @@ import {
|
|
|
17
18
|
import { ErrorView } from "@rebasepro/core";
|
|
18
19
|
import { Button, DialogActions, PlusIcon, Typography } from "@rebasepro/ui";
|
|
19
20
|
import { IconForView } from "@rebasepro/core";
|
|
20
|
-
import { useSelectionController } from "../
|
|
21
|
+
import { useSelectionController } from "../CollectionViewBinding/useSelectionController";
|
|
21
22
|
|
|
22
23
|
import { useColumnIds } from "@rebasepro/core";
|
|
23
24
|
import { useSideDialogContext } from "../SideDialogs";
|
|
24
25
|
import { useAnalyticsController } from "@rebasepro/core";
|
|
25
|
-
import { useUrlController,
|
|
26
|
+
import { useUrlController, useSidePanel } from "../../index";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* @group Components
|
|
29
30
|
*/
|
|
30
|
-
export interface
|
|
31
|
+
export interface SelectionProps<M extends Record<string, unknown>> {
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* Allow multiple selection of values
|
|
@@ -37,7 +38,7 @@ export interface EntitySelectionProps<M extends Record<string, unknown>> {
|
|
|
37
38
|
/**
|
|
38
39
|
* Entity collection config
|
|
39
40
|
*/
|
|
40
|
-
collection?:
|
|
41
|
+
collection?: CollectionConfig<M>;
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* Absolute path of the collection.
|
|
@@ -87,20 +88,20 @@ export interface EntitySelectionProps<M extends Record<string, unknown>> {
|
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* This component allows to select entities from a given collection.
|
|
90
|
-
* You probably want to open this dialog as a side view using {@link
|
|
91
|
+
* You probably want to open this dialog as a side view using {@link useSelectionTableBinding}
|
|
91
92
|
* @group Components
|
|
92
93
|
*/
|
|
93
|
-
export function
|
|
94
|
-
props:
|
|
94
|
+
export function SelectionTableBinding<M extends Record<string, unknown>>(
|
|
95
|
+
props: SelectionProps<M>
|
|
95
96
|
) {
|
|
96
97
|
if (!props.collection) {
|
|
97
98
|
return <ErrorView
|
|
98
99
|
error={"Could not find collection"}/>
|
|
99
100
|
}
|
|
100
|
-
return <
|
|
101
|
+
return <SelectionTableBindingInternal {...props} collection={props.collection} />;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
function
|
|
104
|
+
function SelectionTableBindingInternal<M extends Record<string, unknown>>(
|
|
104
105
|
{
|
|
105
106
|
onSingleEntitySelected,
|
|
106
107
|
onMultipleEntitiesSelected,
|
|
@@ -111,10 +112,10 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
111
112
|
description,
|
|
112
113
|
fixedFilter,
|
|
113
114
|
maxSelection
|
|
114
|
-
}:
|
|
115
|
+
}: SelectionProps<M> & { collection: CollectionConfig<M> }) {
|
|
115
116
|
|
|
116
117
|
const sideDialogContext = useSideDialogContext();
|
|
117
|
-
const
|
|
118
|
+
const sidePanelController = useSidePanel();
|
|
118
119
|
const urlController = useUrlController();
|
|
119
120
|
const analyticsController = useAnalyticsController();
|
|
120
121
|
|
|
@@ -212,7 +213,7 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
212
213
|
analyticsController.onAnalyticsEvent?.("reference_selection_new_entity", {
|
|
213
214
|
path
|
|
214
215
|
});
|
|
215
|
-
|
|
216
|
+
sidePanelController.open({
|
|
216
217
|
path: path,
|
|
217
218
|
collection,
|
|
218
219
|
updateUrl: true,
|
|
@@ -237,7 +238,7 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
237
238
|
}) => {
|
|
238
239
|
const selectedEntities = selectionController.selectedEntities;
|
|
239
240
|
const isSelected = selectedEntities && selectedEntities.map(e => e.id).indexOf(entity.id) > -1;
|
|
240
|
-
return <
|
|
241
|
+
return <CollectionRowActions
|
|
241
242
|
width={width}
|
|
242
243
|
frozen={frozen}
|
|
243
244
|
entity={entity}
|
|
@@ -269,11 +270,12 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
269
270
|
|
|
270
271
|
return (
|
|
271
272
|
|
|
273
|
+
<CollectionScopeProvider collection={collection}>
|
|
272
274
|
<div className="flex flex-col h-full">
|
|
273
275
|
|
|
274
276
|
<div className="grow">
|
|
275
277
|
{entitiesDisplayedFirst &&
|
|
276
|
-
<
|
|
278
|
+
<CollectionTableBinding
|
|
277
279
|
additionalFields={collection.additionalFields}
|
|
278
280
|
displayedColumnIds={displayedColumnIds}
|
|
279
281
|
onEntityClick={onEntityClick}
|
|
@@ -316,6 +318,7 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
316
318
|
</Button>
|
|
317
319
|
</DialogActions>
|
|
318
320
|
</div>
|
|
321
|
+
</CollectionScopeProvider>
|
|
319
322
|
|
|
320
323
|
);
|
|
321
324
|
|
|
@@ -327,7 +330,7 @@ function EntitySelectionDialogActions({
|
|
|
327
330
|
onClear,
|
|
328
331
|
onNewClick
|
|
329
332
|
}: {
|
|
330
|
-
collection:
|
|
333
|
+
collection: CollectionConfig<any>,
|
|
331
334
|
path: string,
|
|
332
335
|
onClear: () => void,
|
|
333
336
|
onNewClick: () => void
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { useSelectionDialog } from "../hooks/useSelectionDialog";
|
|
2
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
3
3
|
import React, { useCallback, useMemo } from "react";
|
|
4
4
|
|
|
5
5
|
import { Entity, EntityReference, FilterValues } from "@rebasepro/types";
|
|
@@ -55,7 +55,7 @@ export function ReferenceWidget<M extends Record<string, unknown>>({
|
|
|
55
55
|
|
|
56
56
|
const collectionRegistryController = useCollectionRegistryController();
|
|
57
57
|
|
|
58
|
-
const collection:
|
|
58
|
+
const collection: CollectionConfig | undefined = useMemo(() => {
|
|
59
59
|
return collectionRegistryController.getCollection(path);
|
|
60
60
|
}, [path, collectionRegistryController.getCollection]);
|
|
61
61
|
|
|
@@ -83,7 +83,7 @@ export function ReferenceWidget<M extends Record<string, unknown>>({
|
|
|
83
83
|
}
|
|
84
84
|
}, [disabled, onReferenceSelected]);
|
|
85
85
|
|
|
86
|
-
const referenceDialogController =
|
|
86
|
+
const referenceDialogController = useSelectionDialog({
|
|
87
87
|
multiselect,
|
|
88
88
|
path,
|
|
89
89
|
collection,
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
import * as React from "react";
|
|
25
25
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
26
26
|
import { Command as CommandPrimitive } from "cmdk";
|
|
27
|
-
import { Entity, EntityRelation, FilterValues, Relation } from "@rebasepro/types";
|
|
28
|
-
import {
|
|
27
|
+
import { Entity, EntityRelation, FilterValues, Relation, getCollectionDataPath } from "@rebasepro/types";
|
|
28
|
+
import { EntityPreviewBindingData } from "./EntityPreviewBinding";
|
|
29
29
|
import { useData, useRelationSelector } from "@rebasepro/core";
|
|
30
|
-
import {
|
|
30
|
+
import { useSidePanel } from "../hooks/useSidePanel";
|
|
31
31
|
import { normalizeToEntityRelation } from "@rebasepro/common";
|
|
32
32
|
import { EmptyValue } from "../preview";
|
|
33
33
|
|
|
@@ -91,7 +91,7 @@ export const RelationSelector = React.forwardRef<
|
|
|
91
91
|
|
|
92
92
|
const collection = relation.target();
|
|
93
93
|
const dataClient = useData();
|
|
94
|
-
const
|
|
94
|
+
const sidePanelController = useSidePanel();
|
|
95
95
|
const multiple = relation.cardinality === "many";
|
|
96
96
|
|
|
97
97
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -102,7 +102,7 @@ export const RelationSelector = React.forwardRef<
|
|
|
102
102
|
// Track IDs that were set via local user interaction (onItemClick / handleClear / handleRemoveItem).
|
|
103
103
|
// When an incoming value change matches these IDs exactly, we skip async re-resolution.
|
|
104
104
|
const localSelectionIdsRef = useRef<string | null>(null);
|
|
105
|
-
//
|
|
105
|
+
// Entity of selected IDs captured when the popover opens.
|
|
106
106
|
// Used to sort the dropdown list so selected items appear at the top.
|
|
107
107
|
// Stays stable for the entire popover session so items don't jump around.
|
|
108
108
|
const pinnedIdsRef = useRef<Set<string> | null>(null);
|
|
@@ -115,7 +115,7 @@ export const RelationSelector = React.forwardRef<
|
|
|
115
115
|
loadMore,
|
|
116
116
|
entityToRelationItem
|
|
117
117
|
} = useRelationSelector({
|
|
118
|
-
path: collection
|
|
118
|
+
path: getCollectionDataPath(collection),
|
|
119
119
|
collection,
|
|
120
120
|
fixedFilter,
|
|
121
121
|
pageSize
|
|
@@ -213,7 +213,8 @@ export const RelationSelector = React.forwardRef<
|
|
|
213
213
|
|
|
214
214
|
if (hasEmbeddedData) {
|
|
215
215
|
const r = rel as EntityRelation;
|
|
216
|
-
|
|
216
|
+
// CMS wire format embeds relation data as { id, path, values }
|
|
217
|
+
newResolvedItems.push(toRelationItem(r.data as unknown as Entity, r));
|
|
217
218
|
} else if (currentSelectedMap.has(relId)) {
|
|
218
219
|
// We already have it in currentSelected
|
|
219
220
|
const existingItem = currentSelectedMap.get(relId)!;
|
|
@@ -248,7 +249,8 @@ export const RelationSelector = React.forwardRef<
|
|
|
248
249
|
const relation = isPrimitive ? new EntityRelation(relId, path) : rel as EntityRelation;
|
|
249
250
|
|
|
250
251
|
if (!isPrimitive && (rel as EntityRelation).data) {
|
|
251
|
-
|
|
252
|
+
// CMS wire format embeds relation data as { id, path, values }
|
|
253
|
+
return toRelationItem((rel as EntityRelation).data as unknown as Entity, relation);
|
|
252
254
|
}
|
|
253
255
|
if (currentSelectedMap.has(String(relId))) {
|
|
254
256
|
return currentSelectedMap.get(String(relId))!;
|
|
@@ -485,11 +487,11 @@ relation } as RelationItem;
|
|
|
485
487
|
<div key={String(item.id)}
|
|
486
488
|
className="flex flex-row items-center gap-1 truncate">
|
|
487
489
|
{item.data ? (
|
|
488
|
-
<
|
|
490
|
+
<EntityPreviewBindingData size={"medium"}
|
|
489
491
|
entity={item.data}
|
|
490
492
|
includeEntityLink={false}
|
|
491
493
|
includeId={false}
|
|
492
|
-
|
|
494
|
+
onSidePanelClick={closePopover}
|
|
493
495
|
/>
|
|
494
496
|
) : (
|
|
495
497
|
<span className="text-sm truncate">{item.label}</span>
|
|
@@ -504,7 +506,7 @@ relation } as RelationItem;
|
|
|
504
506
|
className={cls("flex flex-row items-center gap-1 truncate")}
|
|
505
507
|
>
|
|
506
508
|
{item.data ? (
|
|
507
|
-
<
|
|
509
|
+
<EntityPreviewBindingData size={"smallest"} entity={item.data}
|
|
508
510
|
includeEntityLink={false}
|
|
509
511
|
includeId={false}/>
|
|
510
512
|
) : (
|
|
@@ -541,7 +543,7 @@ relation } as RelationItem;
|
|
|
541
543
|
e.preventDefault();
|
|
542
544
|
const entity = selectedItems[0].data!;
|
|
543
545
|
setIsPopoverOpen(false);
|
|
544
|
-
|
|
546
|
+
sidePanelController.open({
|
|
545
547
|
entityId: entity.id,
|
|
546
548
|
path: entity.path,
|
|
547
549
|
collection,
|
|
@@ -634,7 +636,7 @@ relation } as RelationItem;
|
|
|
634
636
|
<CommandPrimitive.Group>
|
|
635
637
|
{(() => {
|
|
636
638
|
// Sort items so that initially-selected (pinned) items appear first.
|
|
637
|
-
// We use the
|
|
639
|
+
// We use the entity taken when the popover opened so items don't
|
|
638
640
|
// jump around as the user checks/unchecks.
|
|
639
641
|
const pinned = pinnedIdsRef.current;
|
|
640
642
|
const sortedItems = pinned && pinned.size > 0
|
|
@@ -666,7 +668,7 @@ relation } as RelationItem;
|
|
|
666
668
|
{item.data ? (
|
|
667
669
|
<div
|
|
668
670
|
className="flex flex-row items-center gap-2 min-w-0 w-full">
|
|
669
|
-
<
|
|
671
|
+
<EntityPreviewBindingData
|
|
670
672
|
size={multiple ? "smallest" : "medium"}
|
|
671
673
|
entity={item.data}
|
|
672
674
|
includeId={false}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { createSelectionStore } from "./SelectionStore";
|
|
2
|
-
import type { Property } from "@rebasepro/types";
|
|
1
|
+
import { createSelectionStore, AdminSelectedCell } from "./SelectionStore";
|
|
2
|
+
import type { Property, WhereFilterOp } from "@rebasepro/types";
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
4
|
-
import { CollectionSize, Entity,
|
|
5
|
-
import { CellRendererParams, TableView, VirtualTableColumn, VirtualTableFilterValues, OnRowClickParams
|
|
6
|
-
import {
|
|
7
|
-
import { DEFAULT_PAGE_SIZE, EntityCollectionTableController, OnCellValueChange, OnColumnResizeParams } from "@rebasepro/core";
|
|
4
|
+
import { CollectionSize, Entity, EntityTableController, FilterValues, SelectedCellProps } from "@rebasepro/types";
|
|
5
|
+
import { CellRendererParams, TableView, VirtualTableColumn, VirtualTableFilterValues, OnRowClickParams } from "@rebasepro/ui";
|
|
6
|
+
import { DEFAULT_PAGE_SIZE, DataCollectionTableController, OnCellValueChange, OnColumnResizeParams } from "@rebasepro/core";
|
|
8
7
|
import { FilterFormFieldProps } from "@rebasepro/ui";
|
|
9
|
-
import { ReferenceFilterField } from "./filters/ReferenceFilterField";
|
|
10
|
-
import { StringNumberFilterField } from "./filters/StringNumberFilterField";
|
|
11
|
-
import { BooleanFilterField } from "./filters/BooleanFilterField";
|
|
12
|
-
import { DateTimeFilterField } from "./filters/DateTimeFilterField";
|
|
13
8
|
import { useOutsideAlerter } from "@rebasepro/ui";
|
|
14
9
|
import { SelectableTableContext } from "./SelectableTableContext";
|
|
15
10
|
import { getRowHeight } from "@rebasepro/core";
|
|
16
|
-
import {
|
|
11
|
+
import { FilterFieldBinding } from "./filters/FilterFieldBinding";
|
|
17
12
|
|
|
18
13
|
export type SelectableTableProps<M extends Record<string, unknown>> = {
|
|
19
14
|
|
|
@@ -107,23 +102,23 @@ export type SelectableTableProps<M extends Record<string, unknown>> = {
|
|
|
107
102
|
* This component is in charge of rendering a collection table with a high
|
|
108
103
|
* degree of customization.
|
|
109
104
|
*
|
|
110
|
-
* This component is used internally by {@link
|
|
105
|
+
* This component is used internally by {@link CollectionViewBinding} and
|
|
111
106
|
* {@link useReferenceDialog}
|
|
112
107
|
*
|
|
113
108
|
* Please note that you only need to use this component if you are building
|
|
114
109
|
* a custom view. If you just need to create a default view you can do it
|
|
115
110
|
* exclusively with config options.
|
|
116
111
|
*
|
|
117
|
-
* If you want to bind a {@link
|
|
112
|
+
* If you want to bind a {@link CollectionConfig} to a table with the default
|
|
118
113
|
* options you see in collections in the top level navigation, you can
|
|
119
|
-
* check {@link
|
|
114
|
+
* check {@link CollectionViewBinding}.
|
|
120
115
|
*
|
|
121
116
|
* The data displayed in the table is managed by a {@link EntityTableController}.
|
|
122
117
|
* You can build the default, bound to a path in the driver, by using the hook
|
|
123
118
|
* {@link useDataTableController}
|
|
124
119
|
*
|
|
125
|
-
* @see
|
|
126
|
-
* @see
|
|
120
|
+
* @see CollectionTableBindingProps
|
|
121
|
+
* @see CollectionViewBinding
|
|
127
122
|
* @see VirtualTable
|
|
128
123
|
* @group Components
|
|
129
124
|
*/
|
|
@@ -192,7 +187,15 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
192
187
|
|
|
193
188
|
const select = useCallback((cell?: SelectedCellProps<M>) => {
|
|
194
189
|
setLocalSelectedCell(cell);
|
|
195
|
-
|
|
190
|
+
if (cell) {
|
|
191
|
+
selectionStore.select({
|
|
192
|
+
...cell,
|
|
193
|
+
columnKey: cell.propertyKey,
|
|
194
|
+
id: cell.entityId
|
|
195
|
+
} as AdminSelectedCell);
|
|
196
|
+
} else {
|
|
197
|
+
selectionStore.select(undefined);
|
|
198
|
+
}
|
|
196
199
|
}, [selectionStore]);
|
|
197
200
|
|
|
198
201
|
const unselect = useCallback(() => {
|
|
@@ -236,7 +239,29 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
236
239
|
size: size ?? "m",
|
|
237
240
|
selectionStore,
|
|
238
241
|
setPopupCell
|
|
239
|
-
} as unknown as
|
|
242
|
+
} as unknown as DataCollectionTableController<Record<string, unknown>>), [setPopupCell, select, onValueChange, size, selectionStore]);
|
|
243
|
+
|
|
244
|
+
const createFilterField = useCallback(({
|
|
245
|
+
id,
|
|
246
|
+
filterValue,
|
|
247
|
+
setFilterValue,
|
|
248
|
+
column,
|
|
249
|
+
hidden,
|
|
250
|
+
setHidden
|
|
251
|
+
}: FilterFormFieldProps<unknown>): React.ReactNode => {
|
|
252
|
+
if (!column.custom) return null;
|
|
253
|
+
const { resolvedProperty } = column.custom as { resolvedProperty?: Property };
|
|
254
|
+
if (!resolvedProperty) return null;
|
|
255
|
+
// Engine-aware operator resolution happens inside FilterFieldBinding,
|
|
256
|
+
// which reads the collection from the surrounding CollectionScopeProvider.
|
|
257
|
+
return <FilterFieldBinding
|
|
258
|
+
propertyKey={id as string}
|
|
259
|
+
property={resolvedProperty}
|
|
260
|
+
value={filterValue as [WhereFilterOp, unknown] | undefined}
|
|
261
|
+
setValue={setFilterValue as (value?: [WhereFilterOp, unknown]) => void}
|
|
262
|
+
hidden={hidden}
|
|
263
|
+
setHidden={setHidden}/>;
|
|
264
|
+
}, []);
|
|
240
265
|
|
|
241
266
|
return (
|
|
242
267
|
<SelectableTableContext.Provider
|
|
@@ -255,7 +280,7 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
255
280
|
onColumnResize={onColumnResize}
|
|
256
281
|
rowHeight={getRowHeight(size)}
|
|
257
282
|
loading={dataLoading}
|
|
258
|
-
filter={filterValues}
|
|
283
|
+
filter={filterValues as any}
|
|
259
284
|
onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
|
|
260
285
|
sortBy={sortBy}
|
|
261
286
|
onSortByUpdate={setSortBy as ((sortBy?: [string, "asc" | "desc"]) => void)}
|
|
@@ -281,74 +306,4 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
281
306
|
|
|
282
307
|
};
|
|
283
308
|
|
|
284
|
-
function createFilterField({
|
|
285
|
-
id,
|
|
286
|
-
filterValue,
|
|
287
|
-
setFilterValue,
|
|
288
|
-
column,
|
|
289
|
-
hidden,
|
|
290
|
-
setHidden
|
|
291
|
-
}: FilterFormFieldProps<unknown>): React.ReactNode {
|
|
292
|
-
|
|
293
|
-
if (!column.custom) {
|
|
294
|
-
return null;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const { resolvedProperty } = column.custom as { resolvedProperty?: Property };
|
|
298
|
-
|
|
299
|
-
const isArray = resolvedProperty?.type === "array";
|
|
300
|
-
const ofVal = isArray && resolvedProperty ? resolvedProperty.of : undefined;
|
|
301
|
-
const baseProperty: Property | undefined = isArray ? (Array.isArray(ofVal) ? ofVal[0] : ofVal) : resolvedProperty;
|
|
302
|
-
if (!baseProperty) {
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
if (baseProperty.type === "reference") {
|
|
306
|
-
return <ReferenceFilterField value={filterValue}
|
|
307
|
-
setValue={setFilterValue}
|
|
308
|
-
name={id as string}
|
|
309
|
-
isArray={isArray}
|
|
310
|
-
path={baseProperty.path}
|
|
311
|
-
title={resolvedProperty?.name}
|
|
312
|
-
includeId={baseProperty.includeId}
|
|
313
|
-
previewProperties={baseProperty?.ui?.previewProperties}
|
|
314
|
-
hidden={hidden}
|
|
315
|
-
setHidden={setHidden}/>;
|
|
316
|
-
} else if (baseProperty.type === "relation" && baseProperty.relation) {
|
|
317
|
-
return <RelationFilterField value={filterValue as [VirtualTableWhereFilterOp, EntityRelation | EntityRelation[] | null]}
|
|
318
|
-
setValue={setFilterValue}
|
|
319
|
-
name={id as string}
|
|
320
|
-
relation={baseProperty.relation}
|
|
321
|
-
hidden={hidden}
|
|
322
|
-
setHidden={setHidden}/>;
|
|
323
|
-
} else if (baseProperty.type === "number" || baseProperty.type === "string") {
|
|
324
|
-
const name = baseProperty.name;
|
|
325
|
-
const enumValues = baseProperty.enum ? enumToObjectEntries(baseProperty.enum) : undefined;
|
|
326
|
-
return <StringNumberFilterField value={filterValue}
|
|
327
|
-
setValue={setFilterValue}
|
|
328
|
-
name={id as string}
|
|
329
|
-
type={baseProperty.type}
|
|
330
|
-
isArray={isArray}
|
|
331
|
-
enumValues={enumValues}
|
|
332
|
-
title={name}/>;
|
|
333
|
-
} else if (baseProperty.type === "boolean") {
|
|
334
|
-
const name = baseProperty.name;
|
|
335
|
-
return <BooleanFilterField value={filterValue}
|
|
336
|
-
setValue={setFilterValue}
|
|
337
|
-
name={id as string}
|
|
338
|
-
title={name}/>;
|
|
339
|
-
|
|
340
|
-
} else if (baseProperty.type === "date") {
|
|
341
|
-
const title = baseProperty.name;
|
|
342
|
-
return <DateTimeFilterField value={filterValue}
|
|
343
|
-
setValue={setFilterValue}
|
|
344
|
-
name={id as string}
|
|
345
|
-
mode={baseProperty.mode}
|
|
346
|
-
isArray={isArray}
|
|
347
|
-
title={title}/>;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return (
|
|
351
|
-
<div>{`Currently the filter field ${resolvedProperty?.type} is not supported`}</div>
|
|
352
|
-
);
|
|
353
|
-
}
|
|
354
309
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { DataCollectionTableController } from "@rebasepro/core";
|
|
3
3
|
|
|
4
|
-
export const SelectableTableContext = React.createContext<
|
|
4
|
+
export const SelectableTableContext = React.createContext<DataCollectionTableController<Record<string, unknown>>>(null! as DataCollectionTableController<Record<string, unknown>>);
|
|
5
5
|
|
|
6
6
|
export const useSelectableTableController = <M extends Record<string, unknown> = Record<string, unknown>>() =>
|
|
7
|
-
useContext(SelectableTableContext) as unknown as
|
|
7
|
+
useContext(SelectableTableContext) as unknown as DataCollectionTableController<M>;
|