@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
|
@@ -6,7 +6,8 @@ import { FieldHelperText } from "../components/FieldHelperText";
|
|
|
6
6
|
import { LabelWithIconAndTooltip } from "../components/LabelWithIconAndTooltip";
|
|
7
7
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
8
8
|
import { ExpandablePanel, Typography } from "@rebasepro/ui";
|
|
9
|
-
import { getArrayResolvedProperties
|
|
9
|
+
import { getArrayResolvedProperties } from "@rebasepro/common";
|
|
10
|
+
import { isReadOnly } from "@rebasepro/app";
|
|
10
11
|
import { getIconForProperty } from "../../util/property_utils";
|
|
11
12
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
12
13
|
import { useAuthController } from "@rebasepro/app";
|
|
@@ -35,7 +36,7 @@ export function ArrayCustomShapedFieldBinding({
|
|
|
35
36
|
}: FieldProps<ArrayProperty | ArrayProperty>) {
|
|
36
37
|
|
|
37
38
|
const authController = useAuthController();
|
|
38
|
-
const minimalistView = minimalistViewProp || property.
|
|
39
|
+
const minimalistView = minimalistViewProp || property.admin?.minimalistView;
|
|
39
40
|
|
|
40
41
|
const resolvedProperties: Property[] | undefined = getArrayResolvedProperties({
|
|
41
42
|
propertyValue: value,
|
|
@@ -45,7 +46,7 @@ export function ArrayCustomShapedFieldBinding({
|
|
|
45
46
|
authController
|
|
46
47
|
})
|
|
47
48
|
|
|
48
|
-
const expanded = property.
|
|
49
|
+
const expanded = property.admin?.expanded === undefined ? true : property.admin?.expanded;
|
|
49
50
|
|
|
50
51
|
useClearRestoreValue({
|
|
51
52
|
property,
|
|
@@ -64,7 +65,7 @@ export function ArrayCustomShapedFieldBinding({
|
|
|
64
65
|
</>);
|
|
65
66
|
|
|
66
67
|
const body = (resolvedProperties ?? []).map((childProperty, index) => {
|
|
67
|
-
const thisDisabled = isReadOnly(childProperty) || Boolean(childProperty.
|
|
68
|
+
const thisDisabled = isReadOnly(childProperty) || Boolean(childProperty.admin?.disabled);
|
|
68
69
|
const fieldProps = {
|
|
69
70
|
propertyKey: `${propertyKey}[${index}]`,
|
|
70
71
|
disabled: disabled || thisDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSelectionDialog } from "../../hooks/useSelectionDialog";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import type { FieldProps } from "../../types/fields";
|
|
4
4
|
import type { ArrayProperty, Property } from "@rebasepro/types";
|
|
5
5
|
import React, { useCallback, useMemo } from "react";
|
|
@@ -15,6 +15,7 @@ import { useTranslation, ErrorView } from "@rebasepro/app";
|
|
|
15
15
|
import { Button, cls, ExpandablePanel, fieldBackgroundMixin, PencilIcon, Typography } from "@rebasepro/ui";
|
|
16
16
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
17
17
|
import { useCollectionRegistryController } from "../../hooks/navigation/contexts/CollectionRegistryContext";
|
|
18
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
18
19
|
|
|
19
20
|
type ArrayOfReferencesFieldProps = FieldProps<ArrayProperty, EntityReference[]>;
|
|
20
21
|
|
|
@@ -39,7 +40,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
39
40
|
setFieldValue
|
|
40
41
|
}: ArrayOfReferencesFieldProps) {
|
|
41
42
|
|
|
42
|
-
const minimalistView = minimalistViewProp || property.
|
|
43
|
+
const minimalistView = minimalistViewProp || property.admin?.minimalistView;
|
|
43
44
|
const { t } = useTranslation();
|
|
44
45
|
|
|
45
46
|
const ofProperty = property.of as Property;
|
|
@@ -47,7 +48,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
47
48
|
throw Error("ArrayOfReferencesField expected a property containing references");
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
const expanded = property.
|
|
51
|
+
const expanded = property.admin?.expanded === undefined ? true : property.admin?.expanded;
|
|
51
52
|
const selectedEntityIds = value && Array.isArray(value) ? value.map((ref) => ref.id) : [];
|
|
52
53
|
|
|
53
54
|
useClearRestoreValue({
|
|
@@ -57,7 +58,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
const collectionRegistryController = useCollectionRegistryController();
|
|
60
|
-
const collection:
|
|
61
|
+
const collection: AdminCollection | undefined = useMemo(() => {
|
|
61
62
|
return ofProperty.path ? collectionRegistryController.getCollection(ofProperty.path) : undefined;
|
|
62
63
|
}, [ofProperty.path]);
|
|
63
64
|
|
|
@@ -98,7 +99,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
98
99
|
<ReferencePreview
|
|
99
100
|
key={internalId}
|
|
100
101
|
disabled={!ofProperty.path}
|
|
101
|
-
previewProperties={ofProperty.
|
|
102
|
+
previewProperties={ofProperty.admin?.previewProperties}
|
|
102
103
|
size={"medium"}
|
|
103
104
|
onClick={onEntryClick}
|
|
104
105
|
hover={!disabled}
|
|
@@ -107,7 +108,7 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
107
108
|
includeEntityLink={ofProperty.includeEntityLink}
|
|
108
109
|
/>
|
|
109
110
|
);
|
|
110
|
-
}, [ofProperty.path, ofProperty.
|
|
111
|
+
}, [ofProperty.path, ofProperty.admin?.previewProperties, value]);
|
|
111
112
|
|
|
112
113
|
const title = (<>
|
|
113
114
|
<LabelWithIconAndTooltip
|
|
@@ -42,13 +42,13 @@ export function BlockFieldBinding({
|
|
|
42
42
|
disabled
|
|
43
43
|
}: FieldProps<ArrayProperty>) {
|
|
44
44
|
|
|
45
|
-
const minimalistView = minimalistViewProp || property.
|
|
45
|
+
const minimalistView = minimalistViewProp || property.admin?.minimalistView;
|
|
46
46
|
const { t } = useTranslation();
|
|
47
47
|
|
|
48
48
|
if (!property.oneOf)
|
|
49
49
|
throw Error("ArrayOneOfField misconfiguration. Property `oneOf` not set");
|
|
50
50
|
|
|
51
|
-
const expanded = property.
|
|
51
|
+
const expanded = property.admin?.expanded === undefined ? true : property.admin?.expanded;
|
|
52
52
|
useClearRestoreValue({
|
|
53
53
|
property,
|
|
54
54
|
value,
|
|
@@ -94,8 +94,8 @@ export function BlockFieldBinding({
|
|
|
94
94
|
addLabel={property.name ? t("add_to_field", { fieldName: property.name }) : t("add_entry")}
|
|
95
95
|
buildEntry={buildEntry}
|
|
96
96
|
onInternalIdAdded={setLastAddedId}
|
|
97
|
-
disabled={isSubmitting || Boolean(property.
|
|
98
|
-
canAddElements={!property.
|
|
97
|
+
disabled={isSubmitting || Boolean(property.admin?.disabled)}
|
|
98
|
+
canAddElements={!property.admin?.disabled}
|
|
99
99
|
onValueChange={(value) => setFieldValue(propertyKey, value)}
|
|
100
100
|
newDefaultEntry={{
|
|
101
101
|
[property.oneOf!.typeField ?? DEFAULT_ONE_OF_TYPE]: firstOneOfKey,
|
|
@@ -50,7 +50,7 @@ export function DateTimeFieldBinding({
|
|
|
50
50
|
value={internalValue}
|
|
51
51
|
onChange={(dateValue) => setValue(dateValue)}
|
|
52
52
|
mode={property.mode}
|
|
53
|
-
clearable={property.
|
|
53
|
+
clearable={property.admin?.clearable}
|
|
54
54
|
locale={locale}
|
|
55
55
|
error={showError}
|
|
56
56
|
disabled={disabled}
|
|
@@ -53,7 +53,7 @@ export function KeyValueFieldBinding({
|
|
|
53
53
|
context
|
|
54
54
|
}: FieldProps<MapProperty>) {
|
|
55
55
|
|
|
56
|
-
const expanded = (property.
|
|
56
|
+
const expanded = (property.admin?.expanded === undefined ? true : property.admin?.expanded) || autoFocus;
|
|
57
57
|
|
|
58
58
|
if (!property.keyValue) {
|
|
59
59
|
throw Error(`Your property ${propertyKey} needs to have the 'keyValue' prop in order to use this field binding`);
|
|
@@ -6,7 +6,7 @@ import { useTranslation } from "@rebasepro/app";
|
|
|
6
6
|
|
|
7
7
|
import { ErrorBoundary } from "@rebasepro/ui";
|
|
8
8
|
import { getIconForProperty } from "../../util/property_utils";
|
|
9
|
-
import { isHidden, isReadOnly } from "@rebasepro/
|
|
9
|
+
import { isHidden, isReadOnly } from "@rebasepro/app";
|
|
10
10
|
import { FieldHelperText } from "../components/FieldHelperText";
|
|
11
11
|
import { LabelWithIconAndTooltip } from "../components/LabelWithIconAndTooltip";
|
|
12
12
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
@@ -34,8 +34,8 @@ export function MapFieldBinding({
|
|
|
34
34
|
onPropertyChange
|
|
35
35
|
}: FieldProps<MapProperty>) {
|
|
36
36
|
|
|
37
|
-
const expanded = property.
|
|
38
|
-
const minimalistView = minimalistViewProp || property.
|
|
37
|
+
const expanded = property.admin?.expanded === undefined ? true : property.admin?.expanded;
|
|
38
|
+
const minimalistView = minimalistViewProp || property.admin?.minimalistView;
|
|
39
39
|
const { t } = useTranslation();
|
|
40
40
|
|
|
41
41
|
if (!property.properties) {
|
|
@@ -46,11 +46,11 @@ export function MapFieldBinding({
|
|
|
46
46
|
|
|
47
47
|
const mapFormView = <>
|
|
48
48
|
<div
|
|
49
|
-
className={cls("py-1 flex flex-col space-y-2", minimalistView && property.
|
|
49
|
+
className={cls("py-1 flex flex-col space-y-2", minimalistView && property.admin?.widthPercentage !== undefined ? "mt-8" : undefined)}>
|
|
50
50
|
{Object.entries(mapProperties)
|
|
51
51
|
.filter(([_, property]) => !isHidden(property))
|
|
52
52
|
.map(([entryKey, childProperty], index) => {
|
|
53
|
-
const thisDisabled = isReadOnly(childProperty) || Boolean(childProperty.
|
|
53
|
+
const thisDisabled = isReadOnly(childProperty) || Boolean(childProperty.admin?.disabled);
|
|
54
54
|
const fieldBindingProps: PropertyFieldBindingProps<Record<string, unknown>> = {
|
|
55
55
|
propertyKey: `${propertyKey}.${entryKey}`,
|
|
56
56
|
disabled: disabled || thisDisabled,
|
|
@@ -92,11 +92,11 @@ export function MapFieldBinding({
|
|
|
92
92
|
{!minimalistView && <ExpandablePanel initiallyExpanded={expanded}
|
|
93
93
|
onExpandedChange={(expanded: boolean) => {
|
|
94
94
|
onPropertyChange?.({
|
|
95
|
-
|
|
95
|
+
admin: { ...property.admin,
|
|
96
96
|
expanded }
|
|
97
97
|
});
|
|
98
98
|
}}
|
|
99
|
-
className={property.
|
|
99
|
+
className={property.admin?.widthPercentage !== undefined ? "mt-8" : undefined}
|
|
100
100
|
innerClassName={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2 bg-white dark:bg-surface-900"}
|
|
101
101
|
title={<LabelWithIconAndTooltip
|
|
102
102
|
propertyKey={propertyKey}
|
|
@@ -223,7 +223,7 @@ export function MarkdownEditorFieldBinding({
|
|
|
223
223
|
title={property.name ?? propertyKey}
|
|
224
224
|
className={"h-8 text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
|
|
225
225
|
<div className="flex-grow"/>
|
|
226
|
-
{property.
|
|
226
|
+
{property.admin?.clearable && !disabled && (
|
|
227
227
|
<IconButton
|
|
228
228
|
size="small"
|
|
229
229
|
onClick={(e) => {
|
|
@@ -87,7 +87,7 @@ export function MultipleRelationFieldBinding({
|
|
|
87
87
|
return (
|
|
88
88
|
<RelationPreview
|
|
89
89
|
key={internalId}
|
|
90
|
-
previewProperties={property.
|
|
90
|
+
previewProperties={property.admin?.previewProperties}
|
|
91
91
|
size={"medium"}
|
|
92
92
|
onClick={onEntryClick}
|
|
93
93
|
hover={!disabled}
|
|
@@ -96,7 +96,7 @@ export function MultipleRelationFieldBinding({
|
|
|
96
96
|
includeEntityLink={property.includeEntityLink}
|
|
97
97
|
/>
|
|
98
98
|
);
|
|
99
|
-
}, [relation, property.
|
|
99
|
+
}, [relation, property.admin?.previewProperties, value]);
|
|
100
100
|
|
|
101
101
|
const title = (<>
|
|
102
102
|
<LabelWithIconAndTooltip
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSelectionDialog } from "../../hooks/useSelectionDialog";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import type { FieldProps } from "../../types/fields";
|
|
4
4
|
import type { Property, ReferenceProperty } from "@rebasepro/types";
|
|
5
5
|
import React, { useCallback, useMemo } from "react";
|
|
@@ -17,6 +17,7 @@ import { getReferenceFrom } from "@rebasepro/common";
|
|
|
17
17
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
18
18
|
import { cls } from "@rebasepro/ui";
|
|
19
19
|
import { useCollectionRegistryController } from "../../hooks/navigation/contexts/CollectionRegistryContext";
|
|
20
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Field that opens a reference selection dialog.
|
|
@@ -65,7 +66,7 @@ function ReferenceFieldBindingInternal({
|
|
|
65
66
|
const validValue = refValue && typeof refValue === "object" && "isEntityReference" in refValue && refValue.isEntityReference();
|
|
66
67
|
|
|
67
68
|
const collectionRegistryController = useCollectionRegistryController();
|
|
68
|
-
const collection:
|
|
69
|
+
const collection: AdminCollection | undefined = useMemo(() => {
|
|
69
70
|
return property.path ? collectionRegistryController.getCollection(property.path) : undefined;
|
|
70
71
|
}, [property.path]);
|
|
71
72
|
|
|
@@ -109,7 +110,7 @@ function ReferenceFieldBindingInternal({
|
|
|
109
110
|
|
|
110
111
|
{refValue && <ReferencePreview
|
|
111
112
|
disabled={!property.path}
|
|
112
|
-
previewProperties={property.
|
|
113
|
+
previewProperties={property.admin?.previewProperties}
|
|
113
114
|
hover={!disabled}
|
|
114
115
|
size={size}
|
|
115
116
|
onClick={disabled || isSubmitting ? undefined : onEntryClick}
|
|
@@ -29,7 +29,7 @@ export function RelationFieldBinding(props: FieldProps<RelationProperty>) {
|
|
|
29
29
|
const relation = resolvedProperty.relation;
|
|
30
30
|
|
|
31
31
|
const manyRelation = relation?.cardinality === "many";
|
|
32
|
-
const widget = property.
|
|
32
|
+
const widget = property.admin?.widget ?? "select";
|
|
33
33
|
|
|
34
34
|
if (widget === "select" && relation) {
|
|
35
35
|
return <RelationSelectorBinding {...props} relation={relation} manyRelation={manyRelation} />;
|
|
@@ -153,7 +153,7 @@ function SingleRelationFieldBinding({
|
|
|
153
153
|
|
|
154
154
|
{usedRelation && <RelationPreview
|
|
155
155
|
disabled={!usedRelation}
|
|
156
|
-
previewProperties={property.
|
|
156
|
+
previewProperties={property.admin?.previewProperties}
|
|
157
157
|
hover={!disabled}
|
|
158
158
|
size={size}
|
|
159
159
|
onClick={disabled || isSubmitting ? undefined : onEntryClick}
|
|
@@ -44,7 +44,7 @@ export function RepeatFieldBinding({
|
|
|
44
44
|
throw Error("RepeatFieldBinding misconfiguration. Property `type` is not `array`");
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const minimalistView = minimalistViewProp || property.
|
|
47
|
+
const minimalistView = minimalistViewProp || property.admin?.minimalistView;
|
|
48
48
|
|
|
49
49
|
if (!property.of)
|
|
50
50
|
throw Error("RepeatFieldBinding misconfiguration. Property `of` not set");
|
|
@@ -57,7 +57,7 @@ export function RepeatFieldBinding({
|
|
|
57
57
|
authController
|
|
58
58
|
})
|
|
59
59
|
|
|
60
|
-
const expanded = property.
|
|
60
|
+
const expanded = property.admin?.expanded === undefined ? true : property.admin?.expanded;
|
|
61
61
|
const ofProperty = property.of;
|
|
62
62
|
|
|
63
63
|
const [lastAddedId, setLastAddedId] = useState<number | undefined>();
|
|
@@ -92,19 +92,19 @@ export function RepeatFieldBinding({
|
|
|
92
92
|
</ErrorBoundary>;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
const canAddElements = !property.
|
|
95
|
+
const canAddElements = !property.admin?.disabled && !isSubmitting && !disabled && (property.canAddElements || property.canAddElements === undefined);
|
|
96
96
|
const sortable = property.sortable === undefined ? true : property.sortable;
|
|
97
97
|
const arrayContainer = <ArrayContainer droppableId={propertyKey}
|
|
98
98
|
addLabel={property.name ? t("add_to_field", { fieldName: property.name }) : t("add_entry")}
|
|
99
99
|
value={(value as unknown[]) ?? []}
|
|
100
100
|
buildEntry={buildEntry}
|
|
101
101
|
onInternalIdAdded={setLastAddedId}
|
|
102
|
-
disabled={isSubmitting || Boolean(property.
|
|
102
|
+
disabled={isSubmitting || Boolean(property.admin?.disabled)}
|
|
103
103
|
canAddElements={canAddElements}
|
|
104
104
|
sortable={sortable}
|
|
105
105
|
newDefaultEntry={getDefaultValueFor(property.of)}
|
|
106
106
|
onValueChange={(value) => setFieldValue(propertyKey, value)}
|
|
107
|
-
className={property.
|
|
107
|
+
className={property.admin?.widthPercentage !== undefined ? "mt-8" : undefined}
|
|
108
108
|
/>;
|
|
109
109
|
|
|
110
110
|
const title = (<>
|
|
@@ -8,7 +8,7 @@ import { useDropzone } from "react-dropzone";
|
|
|
8
8
|
import { FieldHelperText } from "../components/FieldHelperText";
|
|
9
9
|
import { LabelWithIconAndTooltip } from "../components/LabelWithIconAndTooltip";
|
|
10
10
|
|
|
11
|
-
import { isReadOnly } from "@rebasepro/
|
|
11
|
+
import { isReadOnly } from "@rebasepro/app";
|
|
12
12
|
import { getIconForProperty } from "../../util/property_utils";
|
|
13
13
|
import { useAuthController, useSnackbarController, useStorageSource, useTranslation } from "@rebasepro/app";
|
|
14
14
|
import { StorageSourceContext } from "@rebasepro/app";
|
|
@@ -65,7 +65,7 @@ export function StorageUploadFieldBinding({
|
|
|
65
65
|
const authController = useAuthController();
|
|
66
66
|
|
|
67
67
|
const storageSource = useStorageSource();
|
|
68
|
-
const disabled = isReadOnly(property) || !!property.
|
|
68
|
+
const disabled = isReadOnly(property) || !!property.admin?.disabled || isSubmitting || context.disabled;
|
|
69
69
|
|
|
70
70
|
const {
|
|
71
71
|
internalValue,
|
|
@@ -44,7 +44,7 @@ export const SwitchFieldBinding = function SwitchFieldBinding({
|
|
|
44
44
|
value={value as boolean | null}
|
|
45
45
|
onValueChange={(v) => setValue(v)}
|
|
46
46
|
error={showError}
|
|
47
|
-
className={property.
|
|
47
|
+
className={property.admin?.widthPercentage !== undefined ? "mt-8" : undefined}
|
|
48
48
|
label={<LabelWithIcon
|
|
49
49
|
icon={getIconForProperty(property, "small")}
|
|
50
50
|
required={property.validation?.required}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
TextField,
|
|
13
13
|
XIcon
|
|
14
14
|
} from "@rebasepro/ui";
|
|
15
|
-
import { PreviewType } from "@rebasepro/types";
|
|
15
|
+
import { PreviewType } from "@rebasepro/admin-types";
|
|
16
16
|
import { FieldHelperText } from "../components/FieldHelperText";
|
|
17
17
|
import { LabelWithIcon } from "../components/LabelWithIcon";
|
|
18
18
|
import { PropertyPreview } from "../../preview";
|
|
@@ -42,8 +42,8 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
42
42
|
let multiline: boolean | undefined;
|
|
43
43
|
let url: boolean | PreviewType | undefined;
|
|
44
44
|
if (property.type === "string") {
|
|
45
|
-
multiline = property.
|
|
46
|
-
url = property.
|
|
45
|
+
multiline = property.admin?.multiline;
|
|
46
|
+
url = property.admin?.urlPreview;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
useClearRestoreValue({
|
|
@@ -82,7 +82,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
82
82
|
inputType = "number";
|
|
83
83
|
} else if (property.type === "string") {
|
|
84
84
|
if (property.email) inputType = "email";
|
|
85
|
-
else if (property.
|
|
85
|
+
else if (property.admin?.urlPreview) inputType = "url";
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
const label = (
|
|
@@ -99,7 +99,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
99
99
|
fieldBackgroundMixin,
|
|
100
100
|
fieldBackgroundHoverMixin,
|
|
101
101
|
showError && error ? "border border-red-500 dark:border-red-600" : "",
|
|
102
|
-
property.
|
|
102
|
+
property.admin?.widthPercentage !== undefined ? "mt-8" : undefined
|
|
103
103
|
)}>
|
|
104
104
|
<div
|
|
105
105
|
className="pointer-events-none absolute top-1 text-xs font-medium px-3 text-text-secondary dark:text-text-secondary-dark">
|
|
@@ -116,7 +116,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
116
116
|
showError && error ? "text-red-500 dark:text-red-600" : ""
|
|
117
117
|
)}
|
|
118
118
|
/>
|
|
119
|
-
{property.
|
|
119
|
+
{property.admin?.clearable && (
|
|
120
120
|
<div
|
|
121
121
|
className="flex flex-row justify-center items-center absolute h-full right-0 top-0 mr-4">
|
|
122
122
|
<IconButton onClick={handleClearClick}>
|
|
@@ -131,7 +131,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
131
131
|
value={displayValue}
|
|
132
132
|
onChange={onChange}
|
|
133
133
|
autoFocus={autoFocus}
|
|
134
|
-
className={property.
|
|
134
|
+
className={property.admin?.widthPercentage !== undefined ? "mt-8" : undefined}
|
|
135
135
|
label={<LabelWithIcon
|
|
136
136
|
icon={getIconForProperty(property, "small")}
|
|
137
137
|
required={property.validation?.required || property.isId === true}
|
|
@@ -139,7 +139,7 @@ export function TextFieldBinding<T extends string | number>({
|
|
|
139
139
|
type={inputType}
|
|
140
140
|
disabled={disabled}
|
|
141
141
|
endAdornment={
|
|
142
|
-
property.
|
|
142
|
+
property.admin?.clearable && <IconButton
|
|
143
143
|
onClick={handleClearClick}>
|
|
144
144
|
<XIcon/>
|
|
145
145
|
</IconButton>
|
package/src/form/form_utils.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
|
|
2
|
+
import type { PropertyConfig, AdminCollection } from "@rebasepro/admin-types";
|
|
3
|
+
import type { Entity, EntityStatus, EntityValues } from "@rebasepro/types";
|
|
4
|
+
import type { AuthController } from "@rebasepro/admin-types";
|
|
3
5
|
import { deepEqual as equal } from "fast-equals";
|
|
4
6
|
import { getIn, setIn } from "@rebasepro/forms";
|
|
5
7
|
import { getDefaultValuesFor } from "@rebasepro/common";
|
|
@@ -114,7 +116,7 @@ export function getChanges<T extends object>(source: Partial<T>, comparison: Par
|
|
|
114
116
|
|
|
115
117
|
export function getInitialEntityValues<M extends Record<string, unknown>>(
|
|
116
118
|
authController: AuthController,
|
|
117
|
-
collection:
|
|
119
|
+
collection: AdminCollection,
|
|
118
120
|
path: string,
|
|
119
121
|
status: "new" | "existing" | "copy",
|
|
120
122
|
entity: Entity<M> | undefined,
|
|
@@ -22,7 +22,7 @@ export function useClearRestoreValue<T>({
|
|
|
22
22
|
|
|
23
23
|
const clearedValueRef = useRef<T | null>(null);
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
const shouldClearValueIfDisabled = typeof property.
|
|
25
|
+
const shouldClearValueIfDisabled = typeof property.admin?.disabled === "object" && Boolean(property.admin?.disabled.clearOnDisabled);
|
|
26
26
|
if (shouldClearValueIfDisabled) {
|
|
27
27
|
if (value != null) {
|
|
28
28
|
clearedValueRef.current = value;
|
package/src/form/validation.ts
CHANGED
|
@@ -191,7 +191,7 @@ function getZodStringSchema({
|
|
|
191
191
|
(value: unknown) => value == null || (typeof value === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)),
|
|
192
192
|
{ message: `${property.name} must be an email` }
|
|
193
193
|
);
|
|
194
|
-
if (property.
|
|
194
|
+
if (property.url) {
|
|
195
195
|
if (!property.storage || property.storage?.storeUrl) {
|
|
196
196
|
schema = schema.refine(
|
|
197
197
|
(value: unknown) => {
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./useSidePanel";
|
|
|
2
2
|
export * from "./useSelectionDialog";
|
|
3
3
|
export * from "./useBuildSidePanel";
|
|
4
4
|
export * from "./useResolvedNavigationFrom";
|
|
5
|
+
export * from "./useResolvedUsers";
|
|
5
6
|
export * from "./useHistory";
|
|
6
7
|
export * from "./navigation/contexts";
|
|
7
8
|
export * from "./navigation/useBuildCollectionRegistryController";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import React, { createContext } from "react";
|
|
3
3
|
import { CollectionRegistryController } from "@rebasepro/types";
|
|
4
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
4
5
|
|
|
5
6
|
export const CollectionRegistryContext = createContext<CollectionRegistryController>({
|
|
6
7
|
getCollection: () => undefined,
|
|
@@ -12,7 +13,7 @@ export const CollectionRegistryContext = createContext<CollectionRegistryControl
|
|
|
12
13
|
initialised: false
|
|
13
14
|
});
|
|
14
15
|
|
|
15
|
-
export function useCollectionRegistryController<DB = Record<string, unknown>, EC extends
|
|
16
|
+
export function useCollectionRegistryController<DB = Record<string, unknown>, EC extends AdminCollection = AdminCollection>(): CollectionRegistryController<DB, EC> {
|
|
16
17
|
const context = React.useContext(CollectionRegistryContext);
|
|
17
18
|
if (context === undefined) {
|
|
18
19
|
throw new Error("useCollectionRegistryController must be used within a CollectionRegistryContext.Provider");
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataSourceDefinition } from "@rebasepro/types";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState, useMemo } from "react";
|
|
3
|
-
import { CollectionRegistry,
|
|
4
|
-
import {
|
|
3
|
+
import { CollectionRegistry, getSubcollections } from "@rebasepro/common";
|
|
4
|
+
import { getParentReferencesFromPath as commonGetParentReferencesFromPath, removeInitialAndTrailingSlashes } from "@rebasepro/app";
|
|
5
|
+
import { EntityReference, CollectionRegistryController } from "@rebasepro/types";
|
|
6
|
+
import { UserConfigurationPersistence, resolveAdminCollection, AdminCollection } from "@rebasepro/admin-types";
|
|
5
7
|
import { mergeDeep } from "@rebasepro/utils";
|
|
6
8
|
|
|
7
9
|
export function useBuildCollectionRegistryController(props: {
|
|
@@ -21,7 +23,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
21
23
|
const getCollection = useCallback((
|
|
22
24
|
slugOrPath: string,
|
|
23
25
|
includeUserOverride = false
|
|
24
|
-
):
|
|
26
|
+
): AdminCollection | undefined => {
|
|
25
27
|
|
|
26
28
|
const registry = collectionRegistryRef.current;
|
|
27
29
|
|
|
@@ -38,7 +40,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
38
40
|
|
|
39
41
|
if (!collectionPath) return undefined;
|
|
40
42
|
|
|
41
|
-
let collection:
|
|
43
|
+
let collection: AdminCollection | undefined;
|
|
42
44
|
try {
|
|
43
45
|
collection = registry.resolvePathToCollections(collectionPath).finalCollection;
|
|
44
46
|
} catch (e) {
|
|
@@ -50,13 +52,12 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
50
52
|
return undefined;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
|
|
54
55
|
const userOverride = includeUserOverride ? userConfigPersistence?.getCollectionConfig(slugOrPath) : undefined;
|
|
55
56
|
const overriddenCollection = collection ? mergeDeep(collection, userOverride ?? {}) : undefined;
|
|
56
57
|
|
|
57
58
|
if (!overriddenCollection) return undefined;
|
|
58
59
|
|
|
59
|
-
let result: Partial<
|
|
60
|
+
let result: Partial<AdminCollection> | undefined = overriddenCollection;
|
|
60
61
|
const subcollections = "subcollections" in overriddenCollection ? overriddenCollection.subcollections : undefined;
|
|
61
62
|
const callbacks = overriddenCollection.callbacks;
|
|
62
63
|
result = {
|
|
@@ -68,12 +69,15 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
68
69
|
(result as Record<string, unknown>).subcollections = (result as Record<string, unknown>).subcollections ?? subcollections;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
// Flatten the admin block: everything downstream of here is the panel's
|
|
73
|
+
// view model, not the authoring shape. Applied after the user-override
|
|
74
|
+
// merge so an override of a presentation field still wins.
|
|
75
|
+
return resolveAdminCollection({ ...overriddenCollection,
|
|
76
|
+
...result } as AdminCollection);
|
|
73
77
|
|
|
74
78
|
}, [userConfigPersistence]);
|
|
75
79
|
|
|
76
|
-
const getRawCollection = useCallback((slugOrPath: string):
|
|
80
|
+
const getRawCollection = useCallback((slugOrPath: string): AdminCollection | undefined => {
|
|
77
81
|
const registry = collectionRegistryRef.current;
|
|
78
82
|
if (registry === undefined) return undefined;
|
|
79
83
|
|
|
@@ -82,7 +86,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
82
86
|
|
|
83
87
|
const pathSegments = cleanedPath.split("/");
|
|
84
88
|
|
|
85
|
-
return registry.getRaw(pathSegments.join("/")) as
|
|
89
|
+
return registry.getRaw(pathSegments.join("/")) as AdminCollection | undefined;
|
|
86
90
|
}, []);
|
|
87
91
|
|
|
88
92
|
const getParentReferencesFromPath = useCallback((path: string): EntityReference[] => {
|
|
@@ -115,7 +119,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
115
119
|
result.push(oddPathSegments.slice(0, i));
|
|
116
120
|
}
|
|
117
121
|
|
|
118
|
-
const getCollectionFromPaths = (pathSegments: string[]):
|
|
122
|
+
const getCollectionFromPaths = (pathSegments: string[]): AdminCollection | undefined => {
|
|
119
123
|
if (!pathSegments?.length) return undefined;
|
|
120
124
|
const testPath = pathSegments.reduce((acc, segment, idx) => {
|
|
121
125
|
if (idx === 0) return segment;
|
|
@@ -144,11 +148,11 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
144
148
|
const convertIdsToPaths = useCallback((ids: string[]): string[] => {
|
|
145
149
|
const registry = collectionRegistryRef.current;
|
|
146
150
|
if (!registry) return [];
|
|
147
|
-
let currentCollections:
|
|
151
|
+
let currentCollections: AdminCollection[] = registry.getCollections();
|
|
148
152
|
const paths: string[] = [];
|
|
149
153
|
for (let i = 0; i < ids.length; i++) {
|
|
150
154
|
const id = ids[i];
|
|
151
|
-
const collection:
|
|
155
|
+
const collection: AdminCollection | undefined = currentCollections.find(c => c.slug === id);
|
|
152
156
|
if (!collection)
|
|
153
157
|
throw Error(`Collection with id ${id} not found`);
|
|
154
158
|
paths.push(collection.slug);
|
|
@@ -157,7 +161,7 @@ export function useBuildCollectionRegistryController(props: {
|
|
|
157
161
|
return paths;
|
|
158
162
|
}, []);
|
|
159
163
|
|
|
160
|
-
const collections = collectionRegistryRef.current.getCollections();
|
|
164
|
+
const collections = collectionRegistryRef.current.getCollections().map(resolveAdminCollection);
|
|
161
165
|
|
|
162
166
|
// Determine initialised automatically based on whether collections exist,
|
|
163
167
|
// though the NavigationStateController also plays a role in overall init
|