@rebasepro/admin 0.10.0 → 0.10.1-canary.0a881d4
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/dist/{CollectionEditorDialog-BOlKGGg7.js → CollectionEditorDialog-DMztwJ5S.js} +12 -12
- package/dist/CollectionEditorDialog-DMztwJ5S.js.map +1 -0
- package/dist/{PropertyEditView-i51tFOfM.js → PropertyEditView-CjFCnftn.js} +18 -18
- package/dist/PropertyEditView-CjFCnftn.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-Dh4W53PU.js → RouterCollectionsStudioView-nDFQdKHA.js} +4 -4
- package/dist/RouterCollectionsStudioView-nDFQdKHA.js.map +1 -0
- package/dist/collection_editor/api/generateCollectionApi.d.ts +4 -4
- package/dist/collection_editor/pgColumnToProperty.d.ts +4 -3
- package/dist/collection_editor/serializable_types.d.ts +31 -30
- package/dist/collection_editor/serializable_utils.d.ts +6 -5
- package/dist/collection_editor/types/collection_editor_controller.d.ts +6 -5
- package/dist/collection_editor/types/collection_inference.d.ts +3 -2
- package/dist/collection_editor/types/config_controller.d.ts +8 -7
- package/dist/collection_editor/ui/AddKanbanColumnAction.d.ts +2 -2
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +3 -2
- package/dist/collection_editor/ui/EditorCollectionAction.d.ts +1 -1
- package/dist/collection_editor/ui/EditorCollectionActionStart.d.ts +1 -1
- package/dist/collection_editor/ui/EditorEntityAction.d.ts +1 -1
- package/dist/collection_editor/ui/HomePageEditorCollectionAction.d.ts +1 -1
- package/dist/collection_editor/ui/KanbanSetupAction.d.ts +2 -2
- package/dist/collection_editor/ui/NewCollectionCard.d.ts +1 -1
- 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 +5 -4
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +3 -2
- 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 +3 -2
- package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +4 -3
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +2 -1
- 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/AdminModeSyncer.d.ts +1 -1
- package/dist/components/ClearFilterSortButton.d.ts +1 -1
- package/dist/components/CollectionPanel.d.ts +2 -2
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +4 -4
- package/dist/components/CollectionTableBinding/CollectionTableBinding.d.ts +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +3 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.d.ts +3 -3
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.d.ts +3 -3
- package/dist/components/CollectionTableBinding/fields/TableRelationField.d.ts +3 -3
- package/dist/components/CollectionTableBinding/internal/common.d.ts +2 -2
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +2 -2
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +3 -3
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +3 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +3 -3
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +3 -3
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +2 -3
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +2 -3
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +3 -3
- package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +2 -1
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +3 -3
- package/dist/components/CollectionViewBinding/ViewModeToggle.d.ts +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.d.ts +3 -2
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +3 -2
- package/dist/components/CollectionViewBinding/useBoardDataController.d.ts +2 -2
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +9 -6
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +2 -1
- package/dist/components/DeleteEntityDialog.d.ts +2 -2
- package/dist/components/DetailViewBinding.d.ts +3 -3
- package/dist/components/DrawerNavigationGroup.d.ts +1 -1
- package/dist/components/EditViewBinding.d.ts +3 -3
- package/dist/components/EntityPreviewBinding.d.ts +3 -3
- package/dist/components/EntityViewBinding.d.ts +2 -2
- package/dist/components/HomePage/ContentHomePage.d.ts +1 -1
- package/dist/components/HomePage/HomePageDnD.d.ts +1 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
- package/dist/components/PropertyConfigBadge.d.ts +1 -1
- package/dist/components/RebaseAdmin.d.ts +1 -1
- package/dist/components/RebaseLayout.d.ts +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +2 -2
- package/dist/components/SelectableTable/SelectableTable.d.ts +3 -2
- package/dist/components/SelectableTable/SelectionStore.d.ts +1 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +2 -2
- package/dist/components/SidePanelBinding.d.ts +1 -1
- package/dist/components/admin/CreationResultDialog.d.ts +1 -1
- package/dist/components/common/default_entity_actions.d.ts +2 -1
- package/dist/components/field_configs.d.ts +3 -2
- package/dist/components/history/EntityHistoryEntry.d.ts +2 -2
- package/dist/components/history/EntityHistoryView.d.ts +1 -1
- package/dist/components/history/LastEditedByFormAction.d.ts +1 -1
- package/dist/components/history/LastEditedByIndicator.d.ts +2 -2
- package/dist/contexts/BreacrumbsContext.d.ts +1 -1
- package/dist/contexts/SideDialogsControllerContext.d.ts +1 -1
- package/dist/contexts/SidePanelControllerContext.d.ts +1 -1
- package/dist/data_export/export/ExportCollectionAction.d.ts +4 -3
- package/dist/data_import/components/ImportSaveInProgress.d.ts +2 -2
- package/dist/data_import/import/ImportCollectionAction.d.ts +2 -1
- package/dist/data_import/utils/data.d.ts +2 -1
- package/dist/{export-BM6HPujv.js → export-CavEbZVF.js} +2 -2
- package/dist/export-CavEbZVF.js.map +1 -0
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/form_utils.d.ts +4 -3
- package/dist/{history-CtIPJxvQ.js → history-B1lIsrkX.js} +2 -2
- package/dist/history-B1lIsrkX.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +2 -2
- package/dist/hooks/navigation/contexts/NavigationStateContext.d.ts +1 -1
- package/dist/hooks/navigation/contexts/UrlContext.d.ts +1 -1
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +2 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +7 -5
- package/dist/hooks/navigation/useBuildUrlController.d.ts +1 -1
- package/dist/hooks/navigation/useNavigationResolution.d.ts +6 -5
- package/dist/hooks/navigation/useResolvedCollections.d.ts +8 -7
- package/dist/hooks/navigation/useResolvedViews.d.ts +4 -2
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +2 -2
- package/dist/hooks/navigation/utils.d.ts +5 -5
- package/dist/hooks/useBreadcrumbsController.d.ts +1 -1
- package/dist/hooks/useBuildSidePanel.d.ts +4 -4
- package/dist/hooks/useCMSContext.d.ts +4 -2
- package/dist/hooks/useResolvedNavigationFrom.d.ts +5 -4
- package/dist/hooks/useResolvedUsers.d.ts +8 -0
- package/dist/hooks/useSideDialogsController.d.ts +1 -1
- package/dist/hooks/useSidePanel.d.ts +1 -1
- package/dist/{import-DzQnT03v.js → import-36UcGe71.js} +2 -2
- package/dist/import-36UcGe71.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +1 -1
- package/dist/preview/components/UserPreview.d.ts +3 -2
- package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
- package/dist/preview/util.d.ts +1 -1
- package/dist/routes/CustomViewRoute.d.ts +1 -1
- package/dist/types/components/EntityFormActionsProps.d.ts +2 -2
- package/dist/types/components/EntityFormProps.d.ts +3 -3
- package/dist/types/fields.d.ts +2 -2
- package/dist/util/dataControllerAdapter.d.ts +1 -1
- package/dist/util/entity_actions.d.ts +1 -1
- package/dist/util/navigation_utils.d.ts +3 -3
- package/dist/util/previews.d.ts +22 -4
- package/dist/util/property_utils.d.ts +3 -2
- package/dist/util/resolutions.d.ts +1 -1
- package/dist/util/view_mode.d.ts +3 -3
- package/dist/{util-XFwQ9FEc.js → util-CPgUM4M8.js} +353 -221
- package/dist/util-CPgUM4M8.js.map +1 -0
- package/package.json +11 -9
- package/src/collection_editor/ConfigControllerProvider.tsx +11 -12
- package/src/collection_editor/api/generateCollectionApi.ts +4 -4
- package/src/collection_editor/pgColumnToProperty.ts +4 -3
- package/src/collection_editor/serializable_types.ts +36 -34
- package/src/collection_editor/serializable_utils.ts +17 -32
- package/src/collection_editor/types/collection_editor_controller.tsx +6 -5
- package/src/collection_editor/types/collection_inference.ts +3 -2
- package/src/collection_editor/types/config_controller.tsx +8 -7
- package/src/collection_editor/ui/AddKanbanColumnAction.tsx +3 -2
- package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +3 -2
- package/src/collection_editor/ui/EditorCollectionAction.tsx +3 -2
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +3 -2
- package/src/collection_editor/ui/EditorEntityAction.tsx +3 -2
- package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +1 -1
- package/src/collection_editor/ui/KanbanSetupAction.tsx +3 -2
- package/src/collection_editor/ui/MissingReferenceWidget.tsx +1 -1
- package/src/collection_editor/ui/NewCollectionCard.tsx +1 -1
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +6 -5
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +5 -7
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +28 -38
- package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +4 -3
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +4 -3
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +4 -3
- package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +4 -3
- package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +5 -4
- package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +4 -3
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +2 -1
- package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +6 -5
- package/src/collection_editor/ui/collection_editor/ViewModeSwitch.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +2 -1
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +2 -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 +3 -3
- package/src/collection_editor/ui/collection_editor/templates/products_template.ts +4 -4
- package/src/collection_editor/ui/collection_editor/templates/users_template.ts +2 -2
- package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +10 -8
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +10 -9
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +5 -5
- package/src/collection_editor/validateCollectionJson.ts +4 -5
- package/src/components/AdminModeSyncer.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +1 -1
- package/src/components/CollectionPanel.tsx +5 -4
- package/src/components/CollectionTableBinding/CollectionRowActions.tsx +6 -6
- package/src/components/CollectionTableBinding/CollectionTableBinding.tsx +5 -4
- package/src/components/CollectionTableBinding/CollectionTableBindingProps.tsx +3 -2
- package/src/components/CollectionTableBinding/PropertyTableCell.tsx +5 -5
- package/src/components/CollectionTableBinding/fields/TableMultipleRelationField.tsx +4 -3
- package/src/components/CollectionTableBinding/fields/TableReferenceField.tsx +5 -4
- package/src/components/CollectionTableBinding/fields/TableRelationField.tsx +4 -3
- package/src/components/CollectionTableBinding/internal/common.tsx +8 -7
- package/src/components/CollectionTableBinding/internal/popup_field/PopupFormField.tsx +5 -4
- package/src/components/CollectionTableBinding/table_bindings.tsx +7 -7
- package/src/components/CollectionViewBinding/BoardCardBinding.tsx +6 -5
- package/src/components/CollectionViewBinding/CollectionBoardViewBinding.tsx +5 -6
- package/src/components/CollectionViewBinding/CollectionCardViewBinding.tsx +4 -3
- package/src/components/CollectionViewBinding/CollectionListViewBinding.tsx +10 -13
- package/src/components/CollectionViewBinding/CollectionViewActions.tsx +3 -3
- package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +17 -16
- package/src/components/CollectionViewBinding/CollectionViewStartActions.tsx +3 -3
- package/src/components/CollectionViewBinding/EntityCardBinding.tsx +6 -5
- package/src/components/CollectionViewBinding/FilterPresetsButton.tsx +2 -1
- package/src/components/CollectionViewBinding/FiltersDialog.tsx +2 -2
- package/src/components/CollectionViewBinding/SplitListView.tsx +6 -5
- package/src/components/CollectionViewBinding/ViewModeToggle.tsx +1 -1
- package/src/components/CollectionViewBinding/hooks/useCollectionInlineEditor.ts +3 -2
- package/src/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.ts +3 -2
- package/src/components/CollectionViewBinding/useBoardDataController.tsx +3 -2
- package/src/components/CollectionViewBinding/usePreviewSlots.ts +57 -25
- package/src/components/CollectionViewBinding/useSelectionController.tsx +2 -1
- package/src/components/DefaultDrawer.tsx +2 -2
- package/src/components/DeleteEntityDialog.tsx +3 -2
- package/src/components/DetailViewBinding.tsx +23 -18
- package/src/components/DrawerNavigationGroup.tsx +1 -1
- package/src/components/EditFormActions.tsx +5 -5
- package/src/components/EditViewBinding.tsx +11 -15
- package/src/components/EntityPreviewBinding.tsx +7 -6
- package/src/components/EntityViewBinding.tsx +3 -3
- package/src/components/HomePage/ContentHomePage.tsx +2 -2
- package/src/components/HomePage/FavouritesView.tsx +1 -1
- package/src/components/HomePage/HomePageDnD.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +2 -2
- package/src/components/PropertyConfigBadge.tsx +2 -1
- package/src/components/RebaseAdmin.tsx +1 -1
- package/src/components/RebaseAuthGate.tsx +1 -1
- package/src/components/RebaseLayout.tsx +1 -1
- package/src/components/RebaseNavigation.tsx +4 -3
- package/src/components/ReferenceTable/SelectionTableBinding.tsx +6 -5
- package/src/components/ReferenceWidget.tsx +3 -2
- package/src/components/SelectableTable/SelectableTable.tsx +3 -3
- package/src/components/SelectableTable/SelectionStore.ts +1 -1
- package/src/components/SelectableTable/filters/FilterFieldBinding.tsx +9 -6
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +3 -2
- package/src/components/SideDialogs.tsx +2 -2
- package/src/components/SidePanelBinding.tsx +5 -5
- package/src/components/SidePanelProvider.tsx +1 -1
- package/src/components/admin/CreationResultDialog.tsx +1 -1
- package/src/components/common/default_entity_actions.tsx +3 -2
- package/src/components/field_configs.tsx +30 -29
- package/src/components/history/EntityHistoryEntry.tsx +3 -2
- package/src/components/history/EntityHistoryView.tsx +1 -1
- package/src/components/history/LastEditedByFormAction.tsx +1 -1
- package/src/components/history/LastEditedByIndicator.tsx +3 -2
- package/src/contexts/BreacrumbsContext.tsx +1 -1
- package/src/contexts/SideDialogsControllerContext.tsx +1 -1
- package/src/contexts/SidePanelControllerContext.tsx +1 -1
- package/src/data_export/export/ExportCollectionAction.tsx +5 -4
- package/src/data_import/components/ImportSaveInProgress.tsx +4 -3
- package/src/data_import/import/ImportCollectionAction.tsx +3 -2
- package/src/data_import/utils/data.ts +3 -2
- package/src/form/EntityForm.tsx +19 -10
- package/src/form/EntityFormActions.tsx +3 -3
- package/src/form/EntityFormBinding.tsx +6 -4
- package/src/form/PropertyFieldBinding.tsx +15 -12
- package/src/form/components/FieldHelperText.tsx +1 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +5 -4
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +7 -6
- package/src/form/field_bindings/BlockFieldBinding.tsx +4 -4
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +1 -1
- package/src/form/field_bindings/MapFieldBinding.tsx +7 -7
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +1 -1
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +4 -3
- package/src/form/field_bindings/RelationFieldBinding.tsx +2 -2
- package/src/form/field_bindings/RepeatFieldBinding.tsx +5 -5
- package/src/form/field_bindings/SelectFieldBinding.tsx +1 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +2 -2
- package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
- package/src/form/field_bindings/TextFieldBinding.tsx +8 -8
- package/src/form/field_bindings/UserSelectFieldBinding.tsx +1 -1
- package/src/form/form_utils.ts +5 -3
- package/src/form/useClearRestoreValue.tsx +1 -1
- package/src/form/validation.ts +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +3 -2
- package/src/hooks/navigation/contexts/NavigationStateContext.tsx +1 -1
- package/src/hooks/navigation/contexts/UrlContext.tsx +1 -1
- package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +19 -15
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +8 -6
- package/src/hooks/navigation/useBuildUrlController.tsx +2 -2
- package/src/hooks/navigation/useNavigationResolution.ts +15 -21
- package/src/hooks/navigation/useResolvedCollections.ts +10 -9
- package/src/hooks/navigation/useResolvedViews.tsx +4 -2
- package/src/hooks/navigation/useTopLevelNavigation.ts +3 -2
- package/src/hooks/navigation/utils.ts +6 -5
- package/src/hooks/useBreadcrumbsController.tsx +1 -1
- package/src/hooks/useBuildSidePanel.tsx +9 -12
- package/src/hooks/useCMSContext.tsx +8 -4
- package/src/hooks/useResolvedNavigationFrom.tsx +7 -5
- package/src/hooks/useResolvedUsers.ts +143 -0
- package/src/hooks/useSelectionDialog.tsx +3 -2
- package/src/hooks/useSideDialogsController.tsx +1 -1
- package/src/hooks/useSidePanel.tsx +1 -1
- package/src/index.ts +2 -1
- package/src/preview/PropertyPreview.tsx +11 -11
- package/src/preview/components/ReferencePreview.tsx +6 -5
- package/src/preview/components/RelationPreview.tsx +6 -5
- package/src/preview/components/UrlComponentPreview.tsx +1 -1
- package/src/preview/components/UserPreview.tsx +13 -4
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +1 -1
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
- package/src/preview/property_previews/StringPropertyPreview.tsx +19 -13
- package/src/preview/util.ts +1 -1
- package/src/routes/CustomViewRoute.tsx +1 -1
- package/src/routes/RebaseRoute.tsx +7 -5
- package/src/types/components/EntityFormActionsProps.tsx +3 -2
- package/src/types/components/EntityFormProps.tsx +4 -3
- package/src/types/fields.tsx +3 -2
- package/src/util/dataControllerAdapter.ts +2 -1
- package/src/util/entity_actions.ts +1 -1
- package/src/util/navigation_utils.ts +4 -13
- package/src/util/previews.ts +43 -53
- package/src/util/propertyConfigMapper.ts +7 -7
- package/src/util/property_utils.tsx +5 -4
- package/src/util/resolutions.ts +1 -1
- package/src/util/view_mode.ts +4 -3
- package/dist/CollectionEditorDialog-BOlKGGg7.js.map +0 -1
- package/dist/PropertyEditView-i51tFOfM.js.map +0 -1
- package/dist/RouterCollectionsStudioView-Dh4W53PU.js.map +0 -1
- package/dist/export-BM6HPujv.js.map +0 -1
- package/dist/history-CtIPJxvQ.js.map +0 -1
- package/dist/import-DzQnT03v.js.map +0 -1
- package/dist/util-XFwQ9FEc.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useTranslation } from "@rebasepro/app";
|
|
2
|
-
import {
|
|
2
|
+
import { Property } from "@rebasepro/types";
|
|
3
|
+
import { EntityTableController, AdminCollection } from "@rebasepro/admin-types";
|
|
3
4
|
import { IconButton, SettingsIcon, Tooltip } from "@rebasepro/ui";
|
|
4
5
|
import React from "react";
|
|
5
6
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
@@ -18,7 +19,7 @@ export function CollectionViewHeaderAction({
|
|
|
18
19
|
onHover: boolean,
|
|
19
20
|
path: string,
|
|
20
21
|
parentCollectionSlugs: string[], parentEntityIds: string[],
|
|
21
|
-
collection:
|
|
22
|
+
collection: AdminCollection;
|
|
22
23
|
tableController: EntityTableController;
|
|
23
24
|
}) {
|
|
24
25
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCollectionRegistryController } from "../_cms_internals";
|
|
2
2
|
import { useAuthController, useTranslation } from "@rebasepro/app";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { CollectionActionsProps, AdminCollection } from "@rebasepro/admin-types";
|
|
4
5
|
import { IconButton, SettingsIcon, Tooltip } from "@rebasepro/ui";
|
|
5
6
|
|
|
6
7
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
@@ -38,7 +39,7 @@ export function EditorCollectionAction({
|
|
|
38
39
|
path,
|
|
39
40
|
parentCollectionSlugs,
|
|
40
41
|
parentEntityIds,
|
|
41
|
-
parentCollection: parentCollection as
|
|
42
|
+
parentCollection: parentCollection as AdminCollection,
|
|
42
43
|
existingEntities: tableController?.data ?? []
|
|
43
44
|
})
|
|
44
45
|
: undefined}>
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
useSnackbarController,
|
|
6
6
|
useTranslation
|
|
7
7
|
} from "@rebasepro/app";
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
import { CollectionActionsProps, AdminCollection } from "@rebasepro/admin-types";
|
|
9
10
|
import { Button, SaveIcon, Tooltip, UndoIcon } from "@rebasepro/ui";
|
|
10
11
|
|
|
11
12
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
@@ -42,7 +43,7 @@ export function EditorCollectionActionStart({
|
|
|
42
43
|
id: collection.slug,
|
|
43
44
|
parentCollectionSlugs,
|
|
44
45
|
parentEntityIds,
|
|
45
|
-
collectionData: mergeDeep(collection as
|
|
46
|
+
collectionData: mergeDeep(collection as AdminCollection,
|
|
46
47
|
{
|
|
47
48
|
defaultFilter: tableController.filterValues ?? null,
|
|
48
49
|
sort: tableController.sortBy ?? null
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCollectionRegistryController } from "../_cms_internals";
|
|
2
2
|
import { useAuthController, useTranslation } from "@rebasepro/app";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { PluginFormActionProps, AdminCollection } from "@rebasepro/admin-types";
|
|
4
5
|
import { IconButton, SettingsIcon, Tooltip } from "@rebasepro/ui";
|
|
5
6
|
|
|
6
7
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
@@ -35,7 +36,7 @@ export function EditorEntityAction({
|
|
|
35
36
|
path,
|
|
36
37
|
parentCollectionSlugs,
|
|
37
38
|
parentEntityIds,
|
|
38
|
-
parentCollection: parentCollection as
|
|
39
|
+
parentCollection: parentCollection as AdminCollection
|
|
39
40
|
})
|
|
40
41
|
: undefined}>
|
|
41
42
|
<SettingsIcon/>
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
useSnackbarController,
|
|
5
5
|
useTranslation
|
|
6
6
|
} from "@rebasepro/app";
|
|
7
|
-
import { PluginHomePageActionsProps } from "@rebasepro/types";
|
|
7
|
+
import { PluginHomePageActionsProps } from "@rebasepro/admin-types";
|
|
8
8
|
import { CopyIcon, IconButton, Menu, MenuItem, MoreVerticalIcon, SettingsIcon, Trash2Icon } from "@rebasepro/ui";
|
|
9
9
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
10
10
|
import { useState } from "react";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { useTranslation } from "@rebasepro/app";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { Button } from "@rebasepro/ui";
|
|
5
5
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
6
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Component rendered when Kanban view is missing orderProperty configuration.
|
|
@@ -14,7 +15,7 @@ export function KanbanSetupAction({
|
|
|
14
15
|
parentCollectionSlugs,
|
|
15
16
|
parentEntityIds
|
|
16
17
|
}: {
|
|
17
|
-
collection:
|
|
18
|
+
collection: AdminCollection;
|
|
18
19
|
fullPath: string;
|
|
19
20
|
parentCollectionSlugs: string[], parentEntityIds: string[];
|
|
20
21
|
}) {
|
|
@@ -3,7 +3,7 @@ import { ErrorView, useTranslation } from "@rebasepro/app";
|
|
|
3
3
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
4
4
|
import { Button } from "@rebasepro/ui";
|
|
5
5
|
import { prettifyIdentifier } from "@rebasepro/utils";
|
|
6
|
-
import { getLastSegment } from "@rebasepro/
|
|
6
|
+
import { getLastSegment } from "@rebasepro/app";
|
|
7
7
|
|
|
8
8
|
export function MissingReferenceWidget({ path: pathProp }: {
|
|
9
9
|
path: string
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
useAuthController,
|
|
3
3
|
useTranslation
|
|
4
4
|
} from "@rebasepro/app";
|
|
5
|
-
import { PluginHomePageAdditionalCardsProps } from "@rebasepro/types";
|
|
5
|
+
import { PluginHomePageAdditionalCardsProps } from "@rebasepro/admin-types";
|
|
6
6
|
import { Card, cls, PlusIcon, Typography } from "@rebasepro/ui";
|
|
7
7
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
8
8
|
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
useTranslation
|
|
4
4
|
} from "@rebasepro/app";
|
|
5
5
|
import { getDefaultPropertiesOrder } from "../_cms_internals";
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
import { EntityTableController, AdminCollection } from "@rebasepro/admin-types";
|
|
7
8
|
import { PlusIcon, Tooltip } from "@rebasepro/ui";
|
|
8
9
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
9
10
|
|
|
@@ -15,7 +16,7 @@ export function PropertyAddColumnComponent({
|
|
|
15
16
|
}: {
|
|
16
17
|
path: string,
|
|
17
18
|
parentCollectionSlugs: string[], parentEntityIds: string[],
|
|
18
|
-
collection:
|
|
19
|
+
collection: AdminCollection;
|
|
19
20
|
tableController: EntityTableController;
|
|
20
21
|
}) {
|
|
21
22
|
|
|
@@ -3,7 +3,7 @@ import { AIIcon } from "@rebasepro/app";
|
|
|
3
3
|
import { useCollectionRegistryController } from "../../_cms_internals";
|
|
4
4
|
import React, { useState } from "react";
|
|
5
5
|
import { useSafeSnackbarController } from "../../useSafeSnackbarController";
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import {
|
|
8
8
|
Button,
|
|
9
9
|
CircularProgress,
|
|
@@ -20,18 +20,19 @@ import {
|
|
|
20
20
|
CollectionOperation
|
|
21
21
|
} from "../../api/generateCollectionApi";
|
|
22
22
|
import { useCollectionsConfigController } from "../../useCollectionsConfigController";
|
|
23
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
23
24
|
|
|
24
25
|
export interface AICollectionGeneratorPopoverProps {
|
|
25
26
|
/**
|
|
26
27
|
* Current collection being edited (if modifying an existing collection)
|
|
27
28
|
*/
|
|
28
|
-
existingCollection?:
|
|
29
|
+
existingCollection?: AdminCollection<any>;
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Callback when a collection is generated or modified.
|
|
32
33
|
* Includes the collection and optionally the operations that were applied.
|
|
33
34
|
*/
|
|
34
|
-
onGenerated: (collection:
|
|
35
|
+
onGenerated: (collection: AdminCollection, operations?: CollectionOperation[]) => void;
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* Callback function for generating/modifying collections.
|
|
@@ -95,7 +96,7 @@ export function AICollectionGeneratorPopover({
|
|
|
95
96
|
name: c.name,
|
|
96
97
|
properties: c.properties,
|
|
97
98
|
propertiesOrder: c.propertiesOrder
|
|
98
|
-
} as Partial<
|
|
99
|
+
} as Partial<AdminCollection>));
|
|
99
100
|
|
|
100
101
|
const result = await generateCollection({
|
|
101
102
|
prompt: prompt.trim(),
|
|
@@ -106,7 +107,7 @@ export function AICollectionGeneratorPopover({
|
|
|
106
107
|
name: existingCollection.name,
|
|
107
108
|
properties: existingCollection.properties,
|
|
108
109
|
propertiesOrder: existingCollection.propertiesOrder
|
|
109
|
-
} as Partial<
|
|
110
|
+
} as Partial<AdminCollection>
|
|
110
111
|
})
|
|
111
112
|
});
|
|
112
113
|
|
|
@@ -4,7 +4,7 @@ import { FieldCaption } from "../../_cms_internals";
|
|
|
4
4
|
import React, { useMemo, useState } from "react";
|
|
5
5
|
import { useAuthController, useCustomizationController } from "@rebasepro/app";
|
|
6
6
|
import { getFieldConfig, PropertyConfigBadge, SearchIconsView } from "../../_cms_internals";
|
|
7
|
-
import {
|
|
7
|
+
import { Property } from "@rebasepro/types";
|
|
8
8
|
import {
|
|
9
9
|
BooleanSwitchWithLabel,
|
|
10
10
|
Button,
|
|
@@ -31,6 +31,7 @@ import { ViewModeSwitch } from "./ViewModeSwitch";
|
|
|
31
31
|
import { KanbanConfigSection } from "./KanbanConfigSection";
|
|
32
32
|
import { PropertyFormDialog } from "./PropertyEditView";
|
|
33
33
|
import { singular, toSnakeCase, unslugify } from "@rebasepro/utils";
|
|
34
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
34
35
|
|
|
35
36
|
export function CollectionDetailsForm({
|
|
36
37
|
isNewCollection,
|
|
@@ -42,12 +43,11 @@ export function CollectionDetailsForm({
|
|
|
42
43
|
isNewCollection: boolean,
|
|
43
44
|
existingPaths?: string[];
|
|
44
45
|
existingIds?: string[];
|
|
45
|
-
parentCollection?:
|
|
46
|
+
parentCollection?: AdminCollection;
|
|
46
47
|
parentCollectionSlugs?: string[], parentEntityIds?: string[];
|
|
47
48
|
expandKanban?: boolean;
|
|
48
49
|
}) {
|
|
49
50
|
|
|
50
|
-
|
|
51
51
|
const {
|
|
52
52
|
values,
|
|
53
53
|
setFieldValue,
|
|
@@ -57,7 +57,7 @@ export function CollectionDetailsForm({
|
|
|
57
57
|
setFieldTouched,
|
|
58
58
|
isSubmitting,
|
|
59
59
|
submitCount
|
|
60
|
-
} = useFormex<
|
|
60
|
+
} = useFormex<AdminCollection>();
|
|
61
61
|
|
|
62
62
|
const collectionEditor = useCollectionEditorController();
|
|
63
63
|
|
|
@@ -110,7 +110,6 @@ export function CollectionDetailsForm({
|
|
|
110
110
|
|
|
111
111
|
const collectionIcon = <IconForView collectionOrView={values}/>;
|
|
112
112
|
|
|
113
|
-
|
|
114
113
|
const isSubcollection = !!parentCollection;
|
|
115
114
|
|
|
116
115
|
const showErrors = submitCount > 0;
|
|
@@ -175,7 +174,6 @@ export function CollectionDetailsForm({
|
|
|
175
174
|
|
|
176
175
|
</div>
|
|
177
176
|
|
|
178
|
-
|
|
179
177
|
<LayoutModeSwitch
|
|
180
178
|
className={"col-span-12"}
|
|
181
179
|
value={values.openEntityMode ?? "side_panel"}
|
|
@@ -294,7 +292,7 @@ export function CollectionDetailsForm({
|
|
|
294
292
|
property={{
|
|
295
293
|
type: "string",
|
|
296
294
|
name: dialogPropertyName,
|
|
297
|
-
|
|
295
|
+
admin: { disabled: true,
|
|
298
296
|
hideFromCollection: true }
|
|
299
297
|
}}
|
|
300
298
|
propertyKey={dialogPropertyKey}
|
|
@@ -32,19 +32,10 @@ import {
|
|
|
32
32
|
Tab,
|
|
33
33
|
Tabs
|
|
34
34
|
} from "@rebasepro/ui";
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
getDataSourceCapabilities,
|
|
40
|
-
MapProperty,
|
|
41
|
-
Properties,
|
|
42
|
-
Property,
|
|
43
|
-
PropertyConfig,
|
|
44
|
-
TableMetadata,
|
|
45
|
-
User
|
|
46
|
-
} from "@rebasepro/types";
|
|
47
|
-
import { getSubcollections, getTableName, isPropertyBuilder, removeInitialAndTrailingSlashes } from "@rebasepro/common";
|
|
35
|
+
import { EngineProperties, Entity, getDataSourceCapabilities, MapProperty, Properties, Property, TableMetadata, User } from "@rebasepro/types";
|
|
36
|
+
import { PropertyConfig, AdminCollection } from "@rebasepro/admin-types";
|
|
37
|
+
import { getSubcollections, getTableName, isPropertyBuilder } from "@rebasepro/common";
|
|
38
|
+
import { removeInitialAndTrailingSlashes } from "@rebasepro/app";
|
|
48
39
|
import { CollectionEditorSchema } from "./CollectionYupValidation";
|
|
49
40
|
import { GeneralSettingsForm } from "./GeneralSettingsForm";
|
|
50
41
|
import { DisplaySettingsForm } from "./DisplaySettingsForm";
|
|
@@ -77,11 +68,11 @@ export interface CollectionEditorDialogProps extends CollectionEditorExtensionPr
|
|
|
77
68
|
* A collection to duplicate from. If provided, the new collection will be
|
|
78
69
|
* pre-populated with the same properties (but with empty name, path, and id).
|
|
79
70
|
*/
|
|
80
|
-
copyFrom?:
|
|
71
|
+
copyFrom?: AdminCollection;
|
|
81
72
|
editedCollectionId?: string;
|
|
82
73
|
path?: string; // full path of this particular collection, like `products/123/locales`
|
|
83
74
|
parentCollectionSlugs?: string[], parentEntityIds?: string[]; // path ids of the parent collection, like [`products`]
|
|
84
|
-
handleClose: (collection?:
|
|
75
|
+
handleClose: (collection?: AdminCollection) => void;
|
|
85
76
|
configController: CollectionsConfigController;
|
|
86
77
|
collectionInference?: CollectionInference;
|
|
87
78
|
extraView?: {
|
|
@@ -92,7 +83,7 @@ export interface CollectionEditorDialogProps extends CollectionEditorExtensionPr
|
|
|
92
83
|
};
|
|
93
84
|
getUser?: (uid: string) => User | null;
|
|
94
85
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
95
|
-
parentCollection?:
|
|
86
|
+
parentCollection?: AdminCollection;
|
|
96
87
|
existingEntities?: Entity<any>[];
|
|
97
88
|
/**
|
|
98
89
|
* Initial view to open when editing: "general", "display", or "properties".
|
|
@@ -213,7 +204,7 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
|
213
204
|
const collectionsInThisLevel = (props.parentCollection ? getSubcollections(props.parentCollection) : collections) ?? [];
|
|
214
205
|
const existingPaths = collectionsInThisLevel.map(col => getTableName(col)?.trim().toLowerCase()).filter(Boolean);
|
|
215
206
|
const existingIds = collectionsInThisLevel.map(col => col.slug?.trim().toLowerCase()).filter(Boolean) as string[];
|
|
216
|
-
const [collection, setCollection] = React.useState<
|
|
207
|
+
const [collection, setCollection] = React.useState<AdminCollection<any> | undefined>();
|
|
217
208
|
const [initialLoadingCompleted, setInitialLoadingCompleted] = React.useState(false);
|
|
218
209
|
|
|
219
210
|
useEffect(() => {
|
|
@@ -234,7 +225,7 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
|
234
225
|
|
|
235
226
|
const registryCol = getRawCollection ? getRawCollection(collectionPath) : undefined;
|
|
236
227
|
const configCol = props.configController?.collections?.find(c => c.slug === props.editedCollectionId);
|
|
237
|
-
setCollection((registryCol ?? configCol) as
|
|
228
|
+
setCollection((registryCol ?? configCol) as AdminCollection<any>);
|
|
238
229
|
} else {
|
|
239
230
|
setCollection(undefined);
|
|
240
231
|
}
|
|
@@ -245,7 +236,6 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
|
245
236
|
}
|
|
246
237
|
}, [props.editedCollectionId, props.parentCollectionSlugs, props.parentEntityIds, standalone, collectionRegistry.initialised, collectionRegistry.getRawCollection, props.configController.collections, props.configController.loading, collections]);
|
|
247
238
|
|
|
248
|
-
|
|
249
239
|
const initialIcon = React.useMemo(() => coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)], []);
|
|
250
240
|
const fallbackSlug = React.useMemo(() => randomString(16), []);
|
|
251
241
|
|
|
@@ -259,7 +249,7 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
|
259
249
|
}, [collection, fallbackSlug]);
|
|
260
250
|
|
|
261
251
|
// Build initial values - handle copyFrom for duplication
|
|
262
|
-
const initialValues = React.useMemo(():
|
|
252
|
+
const initialValues = React.useMemo((): AdminCollection<any> => {
|
|
263
253
|
return (initialCollection
|
|
264
254
|
? applyPropertyConfigs(initialCollection, propertyConfigs)
|
|
265
255
|
: copyFromProp
|
|
@@ -270,7 +260,7 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
|
270
260
|
...rest,
|
|
271
261
|
name: "",
|
|
272
262
|
ownerId: authController.user?.uid ?? ""
|
|
273
|
-
} as
|
|
263
|
+
} as AdminCollection<any>;
|
|
274
264
|
})()
|
|
275
265
|
: {
|
|
276
266
|
slug: initialValuesProp?.slug ?? fallbackSlug,
|
|
@@ -280,7 +270,7 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
|
280
270
|
propertiesOrder: [],
|
|
281
271
|
icon: initialIcon,
|
|
282
272
|
ownerId: authController.user?.uid ?? ""
|
|
283
|
-
}) as
|
|
273
|
+
}) as AdminCollection<any>;
|
|
284
274
|
}, [initialCollection, propertyConfigs, copyFromProp, initialValuesProp, fallbackSlug, initialIcon, authController.user?.uid]);
|
|
285
275
|
|
|
286
276
|
if (!initialLoadingCompleted) {
|
|
@@ -341,12 +331,12 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
341
331
|
}: CollectionEditorDialogProps & {
|
|
342
332
|
handleCancel: () => void,
|
|
343
333
|
setFormDirty: (dirty: boolean) => void,
|
|
344
|
-
initialValues:
|
|
334
|
+
initialValues: AdminCollection<M>,
|
|
345
335
|
existingPaths: string[],
|
|
346
336
|
existingIds: string[],
|
|
347
337
|
includeTemplates: boolean,
|
|
348
|
-
collection:
|
|
349
|
-
setCollection: (collection:
|
|
338
|
+
collection: AdminCollection<M> | undefined,
|
|
339
|
+
setCollection: (collection: AdminCollection<M>) => void,
|
|
350
340
|
propertyConfigs: Record<string, PropertyConfig>,
|
|
351
341
|
}
|
|
352
342
|
) {
|
|
@@ -395,7 +385,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
395
385
|
|
|
396
386
|
const [error, setError] = React.useState<Error | undefined>();
|
|
397
387
|
|
|
398
|
-
const saveCollection = (updatedCollection:
|
|
388
|
+
const saveCollection = (updatedCollection: AdminCollection<M>): Promise<boolean> => {
|
|
399
389
|
const id = updatedCollection.slug;
|
|
400
390
|
|
|
401
391
|
return configController.saveCollection({
|
|
@@ -442,7 +432,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
442
432
|
|
|
443
433
|
};
|
|
444
434
|
|
|
445
|
-
const doCollectionInference = collectionInference ? (collection:
|
|
435
|
+
const doCollectionInference = collectionInference ? (collection: AdminCollection<any>) => {
|
|
446
436
|
if (!collectionInference) return undefined;
|
|
447
437
|
return collectionInference?.(
|
|
448
438
|
collection.slug,
|
|
@@ -451,7 +441,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
451
441
|
);
|
|
452
442
|
} : undefined;
|
|
453
443
|
|
|
454
|
-
const inferCollectionFromData = async (newCollection:
|
|
444
|
+
const inferCollectionFromData = async (newCollection: AdminCollection<M>) => {
|
|
455
445
|
|
|
456
446
|
try {
|
|
457
447
|
if (!doCollectionInference) {
|
|
@@ -497,7 +487,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
497
487
|
}
|
|
498
488
|
};
|
|
499
489
|
|
|
500
|
-
const onSubmit = async (newCollectionState:
|
|
490
|
+
const onSubmit = async (newCollectionState: AdminCollection<M>, formexController: FormexController<AdminCollection<M>>) => {
|
|
501
491
|
console.debug("Submitting collection", newCollectionState);
|
|
502
492
|
try {
|
|
503
493
|
|
|
@@ -506,7 +496,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
506
496
|
if (success) {
|
|
507
497
|
aiModifiedPaths?.clearAllPaths();
|
|
508
498
|
formexController.resetForm({ values: newCollectionState });
|
|
509
|
-
handleClose(newCollectionState as
|
|
499
|
+
handleClose(newCollectionState as AdminCollection);
|
|
510
500
|
}
|
|
511
501
|
return;
|
|
512
502
|
}
|
|
@@ -544,7 +534,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
544
534
|
if (success) {
|
|
545
535
|
formexController.resetForm({ values: initialValues });
|
|
546
536
|
setNextMode();
|
|
547
|
-
handleClose(newCollectionState as
|
|
537
|
+
handleClose(newCollectionState as AdminCollection);
|
|
548
538
|
}
|
|
549
539
|
} else {
|
|
550
540
|
setNextMode();
|
|
@@ -560,7 +550,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
560
550
|
}
|
|
561
551
|
};
|
|
562
552
|
|
|
563
|
-
const validation = (col:
|
|
553
|
+
const validation = (col: AdminCollection<M>) => {
|
|
564
554
|
|
|
565
555
|
let errors: Record<string, string> = {};
|
|
566
556
|
const schema = (currentView === "properties" || currentView === "general") && CollectionEditorSchema;
|
|
@@ -595,7 +585,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
595
585
|
return errors;
|
|
596
586
|
};
|
|
597
587
|
|
|
598
|
-
const formController = useCreateFormex<
|
|
588
|
+
const formController = useCreateFormex<AdminCollection<M>>({
|
|
599
589
|
initialValues,
|
|
600
590
|
onSubmit,
|
|
601
591
|
validation,
|
|
@@ -689,8 +679,8 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
689
679
|
|
|
690
680
|
const aiModifiedPaths = useAIModifiedPaths();
|
|
691
681
|
|
|
692
|
-
const handleAIGenerated = (generatedCollection:
|
|
693
|
-
formController.setValues(generatedCollection as
|
|
682
|
+
const handleAIGenerated = (generatedCollection: AdminCollection, operations?: CollectionOperation[]) => {
|
|
683
|
+
formController.setValues(generatedCollection as AdminCollection<M>);
|
|
694
684
|
if (operations && aiModifiedPaths) {
|
|
695
685
|
aiModifiedPaths.addModifiedPaths(operations);
|
|
696
686
|
}
|
|
@@ -776,7 +766,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
776
766
|
formController.setValues({
|
|
777
767
|
...formController.values,
|
|
778
768
|
...collectionData
|
|
779
|
-
} as
|
|
769
|
+
} as AdminCollection<M>);
|
|
780
770
|
onWelcomeScreenContinue();
|
|
781
771
|
} catch (e: unknown) {
|
|
782
772
|
console.error("Error importing table:", e);
|
|
@@ -975,7 +965,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
|
|
|
975
965
|
|
|
976
966
|
}
|
|
977
967
|
|
|
978
|
-
function applyPropertyConfigs<M extends Record<string, unknown> = Record<string, unknown>>(collection:
|
|
968
|
+
function applyPropertyConfigs<M extends Record<string, unknown> = Record<string, unknown>>(collection: AdminCollection<M>, propertyConfigs: Record<string, PropertyConfig>): AdminCollection<M> {
|
|
979
969
|
const {
|
|
980
970
|
properties,
|
|
981
971
|
...rest
|
|
@@ -992,7 +982,7 @@ function applyPropertyConfigs<M extends Record<string, unknown> = Record<string,
|
|
|
992
982
|
return {
|
|
993
983
|
...rest,
|
|
994
984
|
properties: propertiesResult as EngineProperties
|
|
995
|
-
} as
|
|
985
|
+
} as AdminCollection<M>;
|
|
996
986
|
}
|
|
997
987
|
|
|
998
988
|
function applyPropertiesConfig(property: Property, propertyConfigs: Record<string, PropertyConfig>) {
|
|
@@ -2,7 +2,7 @@ import { AIIcon } from "@rebasepro/app";
|
|
|
2
2
|
;
|
|
3
3
|
import React, { useState } from "react";
|
|
4
4
|
;
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
8
8
|
Card,
|
|
@@ -31,6 +31,7 @@ import { useCollectionEditorController } from "../../useCollectionEditorControll
|
|
|
31
31
|
import { AICollectionGeneratorPopover } from "./AICollectionGeneratorPopover";
|
|
32
32
|
import { CollectionGenerationCallback } from "../../api/generateCollectionApi";
|
|
33
33
|
import { prettifyIdentifier } from "@rebasepro/utils";
|
|
34
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
34
35
|
|
|
35
36
|
export function CollectionEditorWelcomeView({
|
|
36
37
|
path,
|
|
@@ -43,7 +44,7 @@ export function CollectionEditorWelcomeView({
|
|
|
43
44
|
onImportFromTable
|
|
44
45
|
}: {
|
|
45
46
|
path: string;
|
|
46
|
-
parentCollection?:
|
|
47
|
+
parentCollection?: AdminCollection;
|
|
47
48
|
onContinue: (importData?: object[], propertiesOrder?: string[]) => void;
|
|
48
49
|
existingCollectionPaths?: string[];
|
|
49
50
|
generateCollection?: CollectionGenerationCallback;
|
|
@@ -61,7 +62,7 @@ export function CollectionEditorWelcomeView({
|
|
|
61
62
|
setFieldValue,
|
|
62
63
|
setValues,
|
|
63
64
|
submitCount
|
|
64
|
-
} = useFormex<
|
|
65
|
+
} = useFormex<AdminCollection>();
|
|
65
66
|
|
|
66
67
|
const [jsonImportOpen, setJsonImportOpen] = useState(false);
|
|
67
68
|
const [importingTable, setImportingTable] = useState<string | null>(null);
|
|
@@ -13,8 +13,9 @@ import {
|
|
|
13
13
|
TextField,
|
|
14
14
|
Typography
|
|
15
15
|
} from "@rebasepro/ui";
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
import { validateCollectionJson, CollectionValidationError } from "../../validateCollectionJson";
|
|
18
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
18
19
|
|
|
19
20
|
const EXAMPLE_JSON = `{
|
|
20
21
|
"id": "products",
|
|
@@ -41,7 +42,7 @@ const EXAMPLE_JSON = `{
|
|
|
41
42
|
export interface CollectionJsonImportDialogProps {
|
|
42
43
|
open: boolean;
|
|
43
44
|
onClose: () => void;
|
|
44
|
-
onImport: (collection:
|
|
45
|
+
onImport: (collection: AdminCollection) => void;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export function CollectionJsonImportDialog({
|
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
Tooltip,
|
|
22
22
|
Typography
|
|
23
23
|
} from "@rebasepro/ui";
|
|
24
|
-
import {
|
|
24
|
+
import { MapProperty, Properties, Property, User } from "@rebasepro/types";
|
|
25
|
+
import { PropertyConfig, AdminCollection } from "@rebasepro/admin-types";
|
|
25
26
|
import { isPropertyBuilder } from "@rebasepro/common";
|
|
26
27
|
|
|
27
28
|
import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from "./util";
|
|
@@ -44,7 +45,7 @@ type CollectionEditorFormProps = {
|
|
|
44
45
|
extraIcon: React.ReactNode;
|
|
45
46
|
getUser?: (uid: string) => User | null;
|
|
46
47
|
getData?: () => Promise<object[]>;
|
|
47
|
-
doCollectionInference?: (collection:
|
|
48
|
+
doCollectionInference?: (collection: AdminCollection) => Promise<Partial<AdminCollection> | null> | undefined;
|
|
48
49
|
propertyConfigs: Record<string, PropertyConfig>;
|
|
49
50
|
propertyTypePresets?: PropertyTypePreset[];
|
|
50
51
|
hiddenPropertyTypes?: PropertyType[];
|
|
@@ -82,7 +83,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
82
83
|
setFieldTouched,
|
|
83
84
|
errors,
|
|
84
85
|
dirty
|
|
85
|
-
} = useFormex<
|
|
86
|
+
} = useFormex<AdminCollection>();
|
|
86
87
|
|
|
87
88
|
const snackbarController = useSafeSnackbarController();
|
|
88
89
|
const configControllerFromContext = useCollectionsConfigController();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { SecurityRule as GeneratedSecurityRule } from "@rebasepro/types";
|
|
3
3
|
import { getPolicyNamesForRule, getPolicyNamesForRules } from "@rebasepro/utils";
|
|
4
4
|
import { getEffectiveSecurityRules } from "@rebasepro/common";
|
|
5
5
|
import React, { useState, useEffect, useMemo } from "react";
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
} from "@rebasepro/ui";
|
|
42
42
|
import { useFormex } from "@rebasepro/forms";
|
|
43
43
|
import { useRebaseContext } from "@rebasepro/app";
|
|
44
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
44
45
|
|
|
45
46
|
/** Postgres RLS policy shape — defined inline to avoid depending on @rebasepro/studio */
|
|
46
47
|
export interface PostgresPolicy {
|
|
@@ -63,7 +64,7 @@ interface SecurityRule {
|
|
|
63
64
|
roles?: string[];
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
type CollectionWithSecurity =
|
|
67
|
+
type CollectionWithSecurity = AdminCollection & {
|
|
67
68
|
securityRules?: SecurityRule[];
|
|
68
69
|
id?: string;
|
|
69
70
|
table?: string;
|
|
@@ -183,7 +184,7 @@ export function CollectionRLSTab() {
|
|
|
183
184
|
*/
|
|
184
185
|
const generatedPolicyNames = useMemo(() => {
|
|
185
186
|
if (!tableName) return new Set<string>();
|
|
186
|
-
const effectiveRules = getEffectiveSecurityRules(values as
|
|
187
|
+
const effectiveRules = getEffectiveSecurityRules(values as AdminCollection);
|
|
187
188
|
return getPolicyNamesForRules(
|
|
188
189
|
[...(rules as unknown as GeneratedSecurityRule[]), ...effectiveRules],
|
|
189
190
|
tableName
|
|
@@ -22,11 +22,12 @@ import {
|
|
|
22
22
|
Typography
|
|
23
23
|
} from "@rebasepro/ui";
|
|
24
24
|
import { useFormex } from "@rebasepro/forms";
|
|
25
|
-
import {
|
|
25
|
+
import { Relation } from "@rebasepro/types";
|
|
26
26
|
import { useCollectionsConfigController } from "../../useCollectionsConfigController";
|
|
27
|
+
import type { AdminPostgresCollection } from "@rebasepro/admin-types";
|
|
27
28
|
|
|
28
29
|
export function CollectionRelationsTab() {
|
|
29
|
-
const { values, setFieldValue } = useFormex<
|
|
30
|
+
const { values, setFieldValue } = useFormex<AdminPostgresCollection>();
|
|
30
31
|
const { collections } = useCollectionsConfigController();
|
|
31
32
|
const [editingRelationIndex, setEditingRelationIndex] = useState<number | null>(null);
|
|
32
33
|
const [editingRelationState, setEditingRelationState] = useState<Partial<Relation> | null>(null);
|
|
@@ -6,7 +6,7 @@ import { Button, PlusIcon, Typography } from "@rebasepro/ui";
|
|
|
6
6
|
import { CollectionEditorDialogProps } from "./CollectionEditorDialog";
|
|
7
7
|
import { AIModifiedPathsProvider } from "./AIModifiedPathsContext";
|
|
8
8
|
import { CollectionEditor } from "./CollectionEditorDialog";
|
|
9
|
-
import type {
|
|
9
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
10
10
|
|
|
11
11
|
export type CollectionStudioViewProps = Omit<CollectionEditorDialogProps, "open" | "isNewCollection" | "editedCollectionId" | "handleClose" | "handleCancel"> & {
|
|
12
12
|
collectionId?: string | "new";
|
|
@@ -16,7 +16,7 @@ export type CollectionStudioViewProps = Omit<CollectionEditorDialogProps, "open"
|
|
|
16
16
|
* Receives the saved collection (or undefined if dismissed without saving).
|
|
17
17
|
* When not provided, save completes silently.
|
|
18
18
|
*/
|
|
19
|
-
onSave?: (collection?:
|
|
19
|
+
onSave?: (collection?: AdminCollection) => void;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Called when the user cancels editing.
|
|
@@ -12,10 +12,11 @@ import {
|
|
|
12
12
|
Tooltip,
|
|
13
13
|
Typography
|
|
14
14
|
} from "@rebasepro/ui";
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
import { CollectionsConfigController } from "../../types/config_controller";
|
|
17
17
|
import { CollectionStudioView } from "./CollectionStudioView";
|
|
18
18
|
import type { CollectionEditorExtensionProps } from "../../extensibility_types";
|
|
19
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
19
20
|
|
|
20
21
|
export interface CollectionsStudioViewProps extends CollectionEditorExtensionProps {
|
|
21
22
|
configController: CollectionsConfigController;
|
|
@@ -25,7 +26,7 @@ export interface CollectionsStudioViewProps extends CollectionEditorExtensionPro
|
|
|
25
26
|
* When provided, overrides the collections from `configController`.
|
|
26
27
|
* Use this to control exactly which collections the editor displays.
|
|
27
28
|
*/
|
|
28
|
-
collections?:
|
|
29
|
+
collections?: AdminCollection[];
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Controlled active collection ID.
|