@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,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
import { Entity, EntityReference } from "@rebasepro/types";
|
|
@@ -9,8 +9,9 @@ import { ErrorBoundary } from "@rebasepro/ui";
|
|
|
9
9
|
import { ErrorView } from "@rebasepro/app";
|
|
10
10
|
import { EntityPreviewBinding, EntityPreviewContainer } from "../../components/EntityPreviewBinding";
|
|
11
11
|
import { useCollectionRegistryController } from "../../hooks/navigation/contexts/CollectionRegistryContext";
|
|
12
|
-
import {
|
|
12
|
+
import { getEntityTitlePropertyKeyForEntity } from "../../util/previews";
|
|
13
13
|
import { getValueInPath } from "@rebasepro/utils";
|
|
14
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
14
15
|
|
|
15
16
|
export type ReferencePreviewProps = {
|
|
16
17
|
disabled?: boolean;
|
|
@@ -59,7 +60,7 @@ function ReferencePreviewInternalInner({
|
|
|
59
60
|
includeId = true,
|
|
60
61
|
textOnly,
|
|
61
62
|
collection
|
|
62
|
-
}: ReferencePreviewProps & { collection?:
|
|
63
|
+
}: ReferencePreviewProps & { collection?: AdminCollection }) {
|
|
63
64
|
const ResolvedMissingReference = useComponentOverride("Entity.MissingReference", DefaultMissingReference);
|
|
64
65
|
|
|
65
66
|
if (!collection) {
|
|
@@ -124,7 +125,7 @@ function ReferencePreviewExisting<M extends Record<string, unknown> = Record<str
|
|
|
124
125
|
hover,
|
|
125
126
|
textOnly
|
|
126
127
|
}: ReferencePreviewProps & {
|
|
127
|
-
collection:
|
|
128
|
+
collection: AdminCollection<M>
|
|
128
129
|
}) {
|
|
129
130
|
|
|
130
131
|
const ResolvedEntityPreview = useComponentOverride("EntityPreview", EntityPreviewBinding);
|
|
@@ -196,7 +197,7 @@ function ReferencePreviewExisting<M extends Record<string, unknown> = Record<str
|
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
if (textOnly) {
|
|
199
|
-
const titleProperty =
|
|
200
|
+
const titleProperty = getEntityTitlePropertyKeyForEntity(collection, usedEntity.values, usedEntity.id);
|
|
200
201
|
const titleValue = titleProperty ? getValueInPath(usedEntity.values, titleProperty) : undefined;
|
|
201
202
|
const displayValue = titleValue !== undefined && titleValue !== null ? String(titleValue) : String(reference.id);
|
|
202
203
|
return <span className="truncate">{displayValue}</span>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
import { Entity, EntityRelation } from "@rebasepro/types";
|
|
@@ -7,8 +7,9 @@ import { useCustomizationController, useFetch, ErrorView, useComponentOverride,
|
|
|
7
7
|
import { Skeleton } from "@rebasepro/ui";
|
|
8
8
|
import { EntityPreviewBinding, EntityPreviewContainer } from "../../components/EntityPreviewBinding";
|
|
9
9
|
import { useCollectionRegistryController } from "../../hooks/navigation/contexts/CollectionRegistryContext";
|
|
10
|
-
import {
|
|
10
|
+
import { getEntityTitlePropertyKeyForEntity } from "../../util/previews";
|
|
11
11
|
import { getValueInPath } from "@rebasepro/utils";
|
|
12
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
12
13
|
|
|
13
14
|
export type RelationPreviewProps = {
|
|
14
15
|
disabled?: boolean;
|
|
@@ -92,7 +93,7 @@ function RelationPreviewInternalInner({
|
|
|
92
93
|
includeId = true,
|
|
93
94
|
textOnly,
|
|
94
95
|
collection
|
|
95
|
-
}: RelationPreviewProps & { collection?:
|
|
96
|
+
}: RelationPreviewProps & { collection?: AdminCollection }) {
|
|
96
97
|
const ResolvedMissingReference = useComponentOverride("Entity.MissingReference", DefaultMissingReference);
|
|
97
98
|
|
|
98
99
|
if (!collection) {
|
|
@@ -154,7 +155,7 @@ function RelationPreviewExisting<M extends Record<string, unknown> = Record<stri
|
|
|
154
155
|
hover,
|
|
155
156
|
textOnly
|
|
156
157
|
}: RelationPreviewProps & {
|
|
157
|
-
collection:
|
|
158
|
+
collection: AdminCollection<M>
|
|
158
159
|
}) {
|
|
159
160
|
|
|
160
161
|
// CMS wire format embeds relation data as { id, path, values }
|
|
@@ -228,7 +229,7 @@ function RelationPreviewExisting<M extends Record<string, unknown> = Record<stri
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
if (textOnly) {
|
|
231
|
-
const titleProperty =
|
|
232
|
+
const titleProperty = getEntityTitlePropertyKeyForEntity(collection, usedEntity.values, usedEntity.id);
|
|
232
233
|
const titleValue = titleProperty ? getValueInPath(usedEntity.values, titleProperty) : undefined;
|
|
233
234
|
const displayValue = titleValue !== undefined && titleValue !== null ? String(titleValue) : String(relation.id);
|
|
234
235
|
return <span className="truncate">{displayValue}</span>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { ImagePreview } from "./ImagePreview";
|
|
4
|
-
import { PreviewType } from "@rebasepro/types";
|
|
4
|
+
import { PreviewType } from "@rebasepro/admin-types";
|
|
5
5
|
import type { PreviewSize } from "../../types/components/PropertyPreviewProps";
|
|
6
6
|
import { cls, ExternalLinkIcon, FileTextIcon, Tooltip, Typography } from "@rebasepro/ui";
|
|
7
7
|
import { EmptyValue } from "./EmptyValue";
|
|
@@ -3,19 +3,28 @@ import type { StringProperty } from "@rebasepro/types";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { EmptyValue } from "./EmptyValue";
|
|
5
5
|
import { Typography } from "@rebasepro/ui";
|
|
6
|
+
import { getUserLabel, useResolvedUser } from "../../hooks/useResolvedUsers";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Preview component for displaying a user reference value.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* Resolves the stored auth user id to a name (or email) the same way a
|
|
12
|
+
* relation resolves its target, and falls back to the raw id only while the
|
|
13
|
+
* lookup is in flight or when the user cannot be resolved.
|
|
12
14
|
*
|
|
13
15
|
* @group Preview components
|
|
14
16
|
*/
|
|
15
17
|
export function UserPreview({ value }: PropertyPreviewProps<StringProperty>) {
|
|
16
|
-
|
|
18
|
+
const uid = typeof value === "string" && value ? value : undefined;
|
|
19
|
+
const user = useResolvedUser(uid);
|
|
20
|
+
|
|
21
|
+
if (!uid) {
|
|
17
22
|
return <EmptyValue/>;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
return <Typography variant={"caption"}
|
|
25
|
+
return <Typography variant={"caption"}
|
|
26
|
+
color={"secondary"}
|
|
27
|
+
className={"truncate"}>
|
|
28
|
+
{user ? getUserLabel(user) : uid}
|
|
29
|
+
</Typography>;
|
|
21
30
|
}
|
|
@@ -30,7 +30,7 @@ export function ArrayOfReferencesPreview({
|
|
|
30
30
|
key={`preview_array_ref_${propertyKey}_${index}`}>
|
|
31
31
|
<ReferencePreview
|
|
32
32
|
disabled={!ofProperty.path}
|
|
33
|
-
previewProperties={ofProperty.
|
|
33
|
+
previewProperties={ofProperty.admin?.previewProperties}
|
|
34
34
|
size={childSize}
|
|
35
35
|
reference={reference}
|
|
36
36
|
includeId={ofProperty.includeId}
|
|
@@ -36,7 +36,7 @@ export function ArrayOfRelationsPreview({
|
|
|
36
36
|
key={`preview_array_rel_${propertyKey}_${index}`}>
|
|
37
37
|
<RelationPreview
|
|
38
38
|
disabled={!ofProperty.relation}
|
|
39
|
-
previewProperties={ofProperty.
|
|
39
|
+
previewProperties={ofProperty.admin?.previewProperties}
|
|
40
40
|
size={"small"}
|
|
41
41
|
relation={entityRelation}
|
|
42
42
|
includeId={ofProperty.includeId}
|
|
@@ -26,7 +26,7 @@ export function SkeletonPropertyComponent({
|
|
|
26
26
|
let content: React.ReactNode | any;
|
|
27
27
|
if (property.type === "string") {
|
|
28
28
|
const stringProperty = property as StringProperty;
|
|
29
|
-
if (stringProperty.
|
|
29
|
+
if (stringProperty.admin?.urlPreview) {
|
|
30
30
|
content = renderUrlComponent(stringProperty, size);
|
|
31
31
|
} else if (stringProperty.storage) {
|
|
32
32
|
content = renderSkeletonImageThumbnail(size);
|
|
@@ -240,7 +240,7 @@ function renderReference() {
|
|
|
240
240
|
|
|
241
241
|
function renderUrlComponent(property: StringProperty, size: PreviewSize = "large") {
|
|
242
242
|
|
|
243
|
-
if (typeof property.
|
|
243
|
+
if (typeof property.admin?.urlPreview === "boolean") {
|
|
244
244
|
return <div style={{
|
|
245
245
|
display: "flex"
|
|
246
246
|
}}>
|
|
@@ -2,7 +2,7 @@ import type { StringProperty } from "@rebasepro/types";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
import { EnumValuesChip } from "../components/EnumValuesChip";
|
|
5
|
-
import { PreviewType } from "@rebasepro/types";
|
|
5
|
+
import { PreviewType } from "@rebasepro/admin-types";
|
|
6
6
|
import type { PropertyPreviewProps } from "../../types/components/PropertyPreviewProps";
|
|
7
7
|
import { UrlComponentPreview } from "../components/UrlComponentPreview";
|
|
8
8
|
import { ErrorBoundary } from "@rebasepro/ui";
|
|
@@ -15,7 +15,8 @@ export function StringPropertyPreview({
|
|
|
15
15
|
propertyKey,
|
|
16
16
|
value,
|
|
17
17
|
property,
|
|
18
|
-
size
|
|
18
|
+
size,
|
|
19
|
+
textOnly
|
|
19
20
|
}: PropertyPreviewProps<StringProperty>): React.ReactElement {
|
|
20
21
|
|
|
21
22
|
const strValue = value as string;
|
|
@@ -26,7 +27,7 @@ export function StringPropertyPreview({
|
|
|
26
27
|
enumKey={enumKey}
|
|
27
28
|
enumValues={property.enum}
|
|
28
29
|
size={size}/>;
|
|
29
|
-
} else if (property.
|
|
30
|
+
} else if (property.admin?.previewAsTag) {
|
|
30
31
|
const colorScheme = getColorSchemeForSeed(propertyKey ?? "");
|
|
31
32
|
return (
|
|
32
33
|
<ErrorBoundary>
|
|
@@ -36,22 +37,27 @@ export function StringPropertyPreview({
|
|
|
36
37
|
{strValue}
|
|
37
38
|
</Chip>
|
|
38
39
|
</ErrorBoundary>);
|
|
39
|
-
} else if (property.
|
|
40
|
+
} else if (property.admin?.urlPreview) {
|
|
40
41
|
return (
|
|
41
42
|
<UrlComponentPreview size={size}
|
|
42
43
|
url={strValue}
|
|
43
|
-
previewType={typeof property.
|
|
44
|
+
previewType={typeof property.admin?.urlPreview === "string" ? property.admin?.urlPreview as PreviewType : undefined}/>
|
|
44
45
|
);
|
|
45
46
|
} else {
|
|
46
47
|
if (!strValue) return <></>;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
// When used as a title/subtitle (textOnly), collapse newlines so the
|
|
49
|
+
// parent `truncate` can clamp it to a single line.
|
|
50
|
+
if (textOnly) {
|
|
51
|
+
const singleLine = strValue.replace(/\s*\n\s*/g, " ");
|
|
52
|
+
return size === "small"
|
|
53
|
+
? <span className={"text-sm"}>{singleLine}</span>
|
|
54
|
+
: <>{singleLine}</>;
|
|
55
|
+
}
|
|
56
|
+
return strValue.includes("\n")
|
|
57
|
+
? <div className={cls(
|
|
58
|
+
"whitespace-pre-line line-clamp-3 overflow-hidden",
|
|
59
|
+
size === "small" ? "text-sm" : "")}>
|
|
60
|
+
{strValue}
|
|
55
61
|
</div>
|
|
56
62
|
: (size === "small"
|
|
57
63
|
? <span className={"text-sm"}>{strValue}</span>
|
package/src/preview/util.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionSize } from "@rebasepro/types";
|
|
1
|
+
import { CollectionSize } from "@rebasepro/admin-types";
|
|
2
2
|
import type { PreviewSize } from "../types/components/PropertyPreviewProps";
|
|
3
3
|
export function sanitizeUrl(url: string | undefined): string {
|
|
4
4
|
if (!url) return "about:blank";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from "react";
|
|
2
|
-
import type { AppView } from "@rebasepro/types";
|
|
2
|
+
import type { AppView } from "@rebasepro/admin-types";
|
|
3
3
|
import { useBreadcrumbsController } from "../hooks/useBreadcrumbsController";
|
|
4
4
|
import { useUrlController } from "../hooks/navigation/contexts/UrlContext";
|
|
5
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import type { ViewMode, AdminCollection } from "@rebasepro/admin-types";
|
|
2
3
|
import { useLocation } from "react-router-dom";
|
|
3
4
|
import { EditViewBinding } from "../components/EditViewBinding";
|
|
4
5
|
import { DetailViewBinding } from "../components/DetailViewBinding";
|
|
@@ -9,7 +10,8 @@ import { NotFoundPage, useUserConfigurationPersistence, useComponentOverride, us
|
|
|
9
10
|
import { resolveOpenEntityMode, resolveViewMode } from "../util/view_mode";
|
|
10
11
|
import { UnsavedChangesDialog } from "@rebasepro/app";
|
|
11
12
|
import { CircularProgressCenter } from "@rebasepro/ui";
|
|
12
|
-
import {
|
|
13
|
+
import { NavigationViewCollectionInternal, NavigationViewEntityCustomInternal, NavigationViewInternal } from "@rebasepro/app";
|
|
14
|
+
import { getNavigationEntriesFromPath } from "@rebasepro/app";
|
|
13
15
|
import { toArray } from "@rebasepro/utils";
|
|
14
16
|
import { useCollectionRegistryController } from "../hooks/navigation/contexts/CollectionRegistryContext";
|
|
15
17
|
import { useUrlController } from "../hooks/navigation/contexts/UrlContext";
|
|
@@ -84,7 +86,7 @@ export function RebaseRoute() {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
if (navigationEntries.length === 1 && navigationEntries[0].type === "collection") {
|
|
87
|
-
let collection:
|
|
89
|
+
let collection: AdminCollection<any> | undefined;
|
|
88
90
|
collection = collectionRegistry.getCollection(navigationEntries[0].id);
|
|
89
91
|
if (!collection)
|
|
90
92
|
collection = collectionRegistry.getCollection(navigationEntries[0].slug);
|
|
@@ -106,7 +108,7 @@ export function RebaseRoute() {
|
|
|
106
108
|
if (isSidePanel) {
|
|
107
109
|
const lastCollectionEntry = [...navigationEntries].reverse().find((entry) => entry.type === "collection");
|
|
108
110
|
if (lastCollectionEntry) {
|
|
109
|
-
let collection:
|
|
111
|
+
let collection: AdminCollection<any> | undefined;
|
|
110
112
|
const firstEntry = navigationEntries[0] as NavigationViewCollectionInternal<any>;
|
|
111
113
|
collection = collectionRegistry.getCollection(firstEntry.id);
|
|
112
114
|
if (!collection)
|
|
@@ -142,7 +144,7 @@ export function RebaseRoute() {
|
|
|
142
144
|
lastEntityEntry?.type === "entity" &&
|
|
143
145
|
(navigationEntries.length === 2 || navigationEntries.length === 3)
|
|
144
146
|
) {
|
|
145
|
-
let collection:
|
|
147
|
+
let collection: AdminCollection<any> | undefined;
|
|
146
148
|
collection = collectionRegistry.getCollection(firstCollectionEntry.id);
|
|
147
149
|
if (!collection)
|
|
148
150
|
collection = collectionRegistry.getCollection(firstCollectionEntry.slug);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Entity } from "@rebasepro/types";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { FormContext } from "../fields";
|
|
4
4
|
import { FormexController } from "./formex";
|
|
5
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
5
6
|
|
|
6
7
|
export interface EntityFormActionsProps {
|
|
7
8
|
path: string;
|
|
8
|
-
collection:
|
|
9
|
+
collection: AdminCollection;
|
|
9
10
|
entity?: Entity;
|
|
10
11
|
layout: "bottom" | "side" | "responsive";
|
|
11
12
|
savingError?: Error;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Entity, EntityStatus } from "@rebasepro/types";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { EntityCustomViewParams, AdminCollection } from "@rebasepro/admin-types";
|
|
3
4
|
import { FormContext } from "../fields";
|
|
4
5
|
import { FormexController } from "./formex";
|
|
5
6
|
import { EntityFormActionsProps } from "./EntityFormActionsProps";
|
|
@@ -12,7 +13,7 @@ import { EntityFormActionsProps } from "./EntityFormActionsProps";
|
|
|
12
13
|
export type EntityFormProps<M extends Record<string, unknown>> = {
|
|
13
14
|
path: string;
|
|
14
15
|
fullIdPath?: string;
|
|
15
|
-
collection:
|
|
16
|
+
collection: AdminCollection<M>;
|
|
16
17
|
entityId?: string | number;
|
|
17
18
|
entity?: Entity<M>;
|
|
18
19
|
databaseId?: string;
|
|
@@ -120,5 +121,5 @@ export type OnUpdateParams = {
|
|
|
120
121
|
path: string,
|
|
121
122
|
entityId?: string | number;
|
|
122
123
|
selectedTab?: string;
|
|
123
|
-
collection:
|
|
124
|
+
collection: AdminCollection<Record<string, unknown>>
|
|
124
125
|
};
|
package/src/types/fields.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { InferPropertyType } from "@rebasepro/types";
|
|
2
2
|
import { Entity } from "@rebasepro/types";
|
|
3
3
|
import { FormexController } from "./components/formex";
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import { Property } from "@rebasepro/types";
|
|
6
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
6
7
|
|
|
7
8
|
export type DefaultFieldConfig =
|
|
8
9
|
| "text_field"
|
|
@@ -190,7 +191,7 @@ export interface FormContext<M extends Record<string, unknown> = Record<string,
|
|
|
190
191
|
/**
|
|
191
192
|
* Collection of the entity being modified
|
|
192
193
|
*/
|
|
193
|
-
collection?:
|
|
194
|
+
collection?: AdminCollection<M>;
|
|
194
195
|
|
|
195
196
|
/**
|
|
196
197
|
* Entity id, it can be undefined if it's a new entity
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { useMemo } from "react";
|
|
8
|
-
import type { Entity
|
|
8
|
+
import type { Entity } from "@rebasepro/types";
|
|
9
|
+
import type { EntityTableController } from "@rebasepro/admin-types";
|
|
9
10
|
import type { CollectionDataController } from "@rebasepro/ui";
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import type { UrlController, SidePanelController, NavigateOptions, AdminCollection } from "@rebasepro/admin-types";
|
|
2
3
|
import { withViewMode } from "./view_mode";
|
|
3
4
|
|
|
4
5
|
// Canonical path utilities — single source of truth in @rebasepro/common
|
|
5
|
-
export {
|
|
6
|
-
removeInitialAndTrailingSlashes,
|
|
7
|
-
removeInitialSlash,
|
|
8
|
-
removeTrailingSlash,
|
|
9
|
-
addInitialSlash,
|
|
10
|
-
getLastSegment,
|
|
11
|
-
resolveCollectionPathIds,
|
|
12
|
-
getCollectionBySlugWithin,
|
|
13
|
-
getCollectionPathsCombinations
|
|
14
|
-
} from "@rebasepro/common";
|
|
6
|
+
export { removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, addInitialSlash, getLastSegment, resolveCollectionPathIds, getCollectionBySlugWithin, getCollectionPathsCombinations } from "@rebasepro/app";
|
|
15
7
|
|
|
16
8
|
/**
|
|
17
9
|
* Navigate to a entity using either a side panel or full-screen mode.
|
|
@@ -33,7 +25,7 @@ export function navigateToEntity({
|
|
|
33
25
|
|
|
34
26
|
{
|
|
35
27
|
openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
|
|
36
|
-
collection?:
|
|
28
|
+
collection?: AdminCollection;
|
|
37
29
|
entityId?: string | number;
|
|
38
30
|
selectedTab?: string;
|
|
39
31
|
copy?: boolean;
|
|
@@ -55,7 +47,6 @@ export function navigateToEntity({
|
|
|
55
47
|
|
|
56
48
|
if (openEntityMode === "side_panel" || openEntityMode === "dialog") {
|
|
57
49
|
|
|
58
|
-
|
|
59
50
|
sidePanelController.open({
|
|
60
51
|
entityId,
|
|
61
52
|
path: path,
|
package/src/util/previews.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { Property } from "@rebasepro/types";
|
|
2
|
+
import type { PropertyConfig, AdminCollection } from "@rebasepro/admin-types";
|
|
3
|
+
import { AuthController } from "@rebasepro/admin-types";
|
|
3
4
|
import { isPropertyBuilder } from "@rebasepro/common";
|
|
5
|
+
import { getTitlePropertyKey, getTitlePropertyKeyForValues } from "@rebasepro/app";
|
|
4
6
|
import { isReferenceProperty, isRelationProperty } from "./property_utils";
|
|
5
7
|
|
|
6
8
|
function isHiddenProperty(property: Property | undefined): boolean {
|
|
7
9
|
if (!property) return false;
|
|
8
|
-
return Boolean(property.
|
|
10
|
+
return Boolean(property.admin?.hideFromCollection);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -18,18 +20,18 @@ function isStorageProperty(property: Property | undefined): boolean {
|
|
|
18
20
|
// Single string with storage config
|
|
19
21
|
if (property.type === "string" && property.storage) return true;
|
|
20
22
|
// String displayed as image URL
|
|
21
|
-
if (property.type === "string" && property.
|
|
23
|
+
if (property.type === "string" && property.admin?.urlPreview === "image") return true;
|
|
22
24
|
// Array whose inner element has storage config or image URL
|
|
23
25
|
if (property.type === "array" && property.of && !Array.isArray(property.of)) {
|
|
24
26
|
const inner = property.of;
|
|
25
|
-
if (inner.type === "string" && (inner.storage || inner.
|
|
27
|
+
if (inner.type === "string" && (inner.storage || inner.admin?.urlPreview === "image")) return true;
|
|
26
28
|
}
|
|
27
29
|
return false;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export function getEntityPreviewKeys(
|
|
31
33
|
authController: AuthController,
|
|
32
|
-
targetCollection:
|
|
34
|
+
targetCollection: AdminCollection<any>,
|
|
33
35
|
fields: Record<string, PropertyConfig>,
|
|
34
36
|
previewProperties?: string[],
|
|
35
37
|
limit = 3) {
|
|
@@ -58,54 +60,43 @@ export function getEntityPreviewKeys(
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (hasExplicitOrder) {
|
|
73
|
-
for (const key of orderToSearch) {
|
|
74
|
-
const property = collection.properties[key];
|
|
75
|
-
if (property && !isPropertyBuilder(property)) {
|
|
76
|
-
const prop = property as Property;
|
|
77
|
-
const isIdProp = prop && typeof prop === "object" && "isId" in prop && Boolean((prop as { isId?: boolean }).isId);
|
|
78
|
-
if (isIdProp || key === "id" || isHiddenProperty(prop)) {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (prop.type === "relation" || (prop.type === "string" && !isStorageProperty(prop))) {
|
|
82
|
-
return key;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
63
|
+
/**
|
|
64
|
+
* The property that fills the title slot for a collection.
|
|
65
|
+
*
|
|
66
|
+
* Ranking lives in `@rebasepro/common` so every surface (list rows, cards,
|
|
67
|
+
* board cards, detail header, relation chips) agrees on what an entity is
|
|
68
|
+
* called. Identifiers are excluded from the property *schema* — primary keys,
|
|
69
|
+
* foreign keys, UUID columns — not from the key name.
|
|
70
|
+
*/
|
|
71
|
+
export function getEntityTitlePropertyKey<M extends Record<string, unknown>>(collection: AdminCollection<M>, propertyConfigs: Record<string, PropertyConfig>): string | undefined {
|
|
72
|
+
return getTitlePropertyKey(collection);
|
|
73
|
+
}
|
|
87
74
|
|
|
88
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Same as {@link getEntityTitlePropertyKey}, but skips candidates that carry
|
|
77
|
+
* no readable value for this particular entity (empty, or an opaque id).
|
|
78
|
+
*/
|
|
79
|
+
export function getEntityTitlePropertyKeyForEntity<M extends Record<string, unknown>>(
|
|
80
|
+
collection: AdminCollection<M>,
|
|
81
|
+
values: Record<string, unknown> | undefined,
|
|
82
|
+
entityId?: string | number
|
|
83
|
+
): string | undefined {
|
|
84
|
+
return getTitlePropertyKeyForValues(collection, values, entityId);
|
|
85
|
+
}
|
|
89
86
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return key; // Immediate return if it's a strong title candidate
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return firstStringCandidate;
|
|
87
|
+
/**
|
|
88
|
+
* True when a property key points at a user picker, whose stored value is an
|
|
89
|
+
* auth user id that has to be resolved before it can be displayed.
|
|
90
|
+
*/
|
|
91
|
+
export function isUserSelectProperty<M extends Record<string, unknown>>(
|
|
92
|
+
collection: AdminCollection<M>,
|
|
93
|
+
propertyKey: string | undefined
|
|
94
|
+
): boolean {
|
|
95
|
+
if (!propertyKey) return false;
|
|
96
|
+
const property = collection.properties[propertyKey];
|
|
97
|
+
if (!property || isPropertyBuilder(property)) return false;
|
|
98
|
+
const prop = property as Property;
|
|
99
|
+
return prop.type === "string" && Boolean(prop.userSelect);
|
|
109
100
|
}
|
|
110
101
|
|
|
111
102
|
/**
|
|
@@ -183,4 +174,3 @@ export function resolveTitleToString(title: any): string {
|
|
|
183
174
|
}
|
|
184
175
|
}
|
|
185
176
|
|
|
186
|
-
|
|
@@ -35,8 +35,8 @@ export function mapPropertyToConfig(property: Property): CollectionPropertyConfi
|
|
|
35
35
|
type: TYPE_MAP[property.type] ?? "string",
|
|
36
36
|
name: property.name,
|
|
37
37
|
description: property.description,
|
|
38
|
-
columnWidth: property.
|
|
39
|
-
hideFromCollection: property.
|
|
38
|
+
columnWidth: property.admin?.columnWidth,
|
|
39
|
+
hideFromCollection: property.admin?.hideFromCollection,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
// String-specific
|
|
@@ -44,10 +44,10 @@ export function mapPropertyToConfig(property: Property): CollectionPropertyConfi
|
|
|
44
44
|
if (property.enum) {
|
|
45
45
|
base.enum = mapEnumValues(property.enum);
|
|
46
46
|
}
|
|
47
|
-
if (property.
|
|
48
|
-
if (property.
|
|
49
|
-
if (property.
|
|
50
|
-
if (property.
|
|
47
|
+
if (property.admin?.multiline) base.multiline = true;
|
|
48
|
+
if (property.admin?.previewAsTag) base.previewAsTag = true;
|
|
49
|
+
if (property.admin?.urlPreview) base.url = property.admin.urlPreview;
|
|
50
|
+
if (property.admin?.markdown) base.markdown = true;
|
|
51
51
|
if (property.storage) base.storage = true;
|
|
52
52
|
if (property.email) base.email = true;
|
|
53
53
|
}
|
|
@@ -76,7 +76,7 @@ export function mapPropertyToConfig(property: Property): CollectionPropertyConfi
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// Custom preview component
|
|
79
|
-
if (property.
|
|
79
|
+
if (property.admin?.Preview) {
|
|
80
80
|
// The connected wrapper will handle this by injecting via cellRenderer override
|
|
81
81
|
// We don't copy it here because Preview may reference entity-aware components
|
|
82
82
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import type { Properties } from "@rebasepro/types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { MapProperty, Property } from "@rebasepro/types";
|
|
4
|
+
import type { PropertyConfig, AdminCollection } from "@rebasepro/admin-types";
|
|
4
5
|
import React from "react";
|
|
5
6
|
|
|
6
7
|
import { isPropertyBuilder } from "@rebasepro/common";
|
|
@@ -72,9 +73,9 @@ function getDefaultIconForProperty(property: Property): LucideIcon {
|
|
|
72
73
|
switch (property.type) {
|
|
73
74
|
case "string": {
|
|
74
75
|
if (property.storage) return UploadIcon;
|
|
75
|
-
if (property.
|
|
76
|
+
if (property.admin?.urlPreview) return GlobeIcon;
|
|
76
77
|
if (property.email) return MailIcon;
|
|
77
|
-
if (property.
|
|
78
|
+
if (property.admin?.multiline || property.admin?.markdown) return AlignLeftIcon;
|
|
78
79
|
return TextIcon;
|
|
79
80
|
}
|
|
80
81
|
case "number":
|
|
@@ -224,7 +225,7 @@ export function getPropertiesWithPropertiesOrder(properties: Properties, propert
|
|
|
224
225
|
return result;
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
export function getDefaultPropertiesOrder(collection:
|
|
228
|
+
export function getDefaultPropertiesOrder(collection: AdminCollection): string[] {
|
|
228
229
|
if (collection.propertiesOrder) return collection.propertiesOrder;
|
|
229
230
|
return [...Object.keys(collection.properties), ...(collection.additionalFields ?? []).map(field => field.key)];
|
|
230
231
|
}
|
package/src/util/resolutions.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HistoryIcon } from "@rebasepro/ui";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import type { CustomizationController, EntityAction, EntityCustomView } from "@rebasepro/types";
|
|
3
|
+
import type { CustomizationController, EntityAction, EntityCustomView } from "@rebasepro/admin-types";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Built-in entity views that are resolved by token name.
|