@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,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import type { DefaultFieldConfig } from "../types/fields";
|
|
3
|
-
import type { ArrayProperty, NumberProperty, Property,
|
|
3
|
+
import type { ArrayProperty, NumberProperty, Property, StringProperty, VectorProperty } from "@rebasepro/types";
|
|
4
|
+
import type { PropertyConfig } from "@rebasepro/admin-types";
|
|
4
5
|
import { ArrayCustomShapedFieldBinding } from "../form/field_bindings/ArrayCustomShapedFieldBinding";
|
|
5
6
|
import { ArrayOfReferencesFieldBinding } from "../form/field_bindings/ArrayOfReferencesFieldBinding";
|
|
6
7
|
import { BlockFieldBinding } from "../form/field_bindings/BlockFieldBinding";
|
|
@@ -68,7 +69,7 @@ export const DEFAULT_FIELD_CONFIGS: Record<DefaultFieldConfig, PropertyConfig> =
|
|
|
68
69
|
color: "#2d7ff9",
|
|
69
70
|
property: {
|
|
70
71
|
type: "string",
|
|
71
|
-
|
|
72
|
+
admin: { get Field() { return TextFieldBinding; } }
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
multiline: {
|
|
@@ -79,7 +80,7 @@ export const DEFAULT_FIELD_CONFIGS: Record<DefaultFieldConfig, PropertyConfig> =
|
|
|
79
80
|
color: "#2d7ff9",
|
|
80
81
|
property: {
|
|
81
82
|
type: "string",
|
|
82
|
-
|
|
83
|
+
admin: { multiline: true,
|
|
83
84
|
get Field() { return TextFieldBinding; } }
|
|
84
85
|
}
|
|
85
86
|
},
|
|
@@ -91,7 +92,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
91
92
|
color: "#2d7ff9",
|
|
92
93
|
property: {
|
|
93
94
|
type: "string",
|
|
94
|
-
|
|
95
|
+
admin: { markdown: true,
|
|
95
96
|
get Field() { return MarkdownEditorFieldBinding; } }
|
|
96
97
|
}
|
|
97
98
|
},
|
|
@@ -103,8 +104,8 @@ get Field() { return MarkdownEditorFieldBinding; } }
|
|
|
103
104
|
color: "#154fb3",
|
|
104
105
|
property: {
|
|
105
106
|
type: "string",
|
|
106
|
-
|
|
107
|
-
get Field() { return TextFieldBinding; } }
|
|
107
|
+
url: true,
|
|
108
|
+
admin: { get Field() { return TextFieldBinding; } }
|
|
108
109
|
}
|
|
109
110
|
},
|
|
110
111
|
email: {
|
|
@@ -116,7 +117,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
116
117
|
property: {
|
|
117
118
|
type: "string",
|
|
118
119
|
email: true,
|
|
119
|
-
|
|
120
|
+
admin: { get Field() { return TextFieldBinding; } }
|
|
120
121
|
}
|
|
121
122
|
},
|
|
122
123
|
switch: {
|
|
@@ -127,7 +128,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
127
128
|
color: "#20d9d2",
|
|
128
129
|
property: {
|
|
129
130
|
type: "boolean",
|
|
130
|
-
|
|
131
|
+
admin: { get Field() { return SwitchFieldBinding; } }
|
|
131
132
|
}
|
|
132
133
|
},
|
|
133
134
|
select: {
|
|
@@ -139,7 +140,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
139
140
|
property: {
|
|
140
141
|
type: "string",
|
|
141
142
|
enum: [],
|
|
142
|
-
|
|
143
|
+
admin: { get Field() { return SelectFieldBinding; } }
|
|
143
144
|
}
|
|
144
145
|
},
|
|
145
146
|
multi_select: {
|
|
@@ -154,7 +155,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
154
155
|
type: "string",
|
|
155
156
|
enum: []
|
|
156
157
|
},
|
|
157
|
-
|
|
158
|
+
admin: { get Field() { return MultiSelectFieldBinding; } }
|
|
158
159
|
}
|
|
159
160
|
},
|
|
160
161
|
user_select: {
|
|
@@ -164,7 +165,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
164
165
|
Icon: UserIcon,
|
|
165
166
|
property: {
|
|
166
167
|
type: "string",
|
|
167
|
-
|
|
168
|
+
admin: { get Field() { return UserSelectFieldBinding; } }
|
|
168
169
|
}
|
|
169
170
|
},
|
|
170
171
|
number_input: {
|
|
@@ -175,7 +176,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
175
176
|
color: "#bec920",
|
|
176
177
|
property: {
|
|
177
178
|
type: "number",
|
|
178
|
-
|
|
179
|
+
admin: { get Field() { return TextFieldBinding; } }
|
|
179
180
|
}
|
|
180
181
|
},
|
|
181
182
|
number_select: {
|
|
@@ -187,7 +188,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
187
188
|
property: {
|
|
188
189
|
type: "number",
|
|
189
190
|
enum: [],
|
|
190
|
-
|
|
191
|
+
admin: { get Field() { return SelectFieldBinding; } }
|
|
191
192
|
}
|
|
192
193
|
},
|
|
193
194
|
multi_number_select: {
|
|
@@ -202,7 +203,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
202
203
|
type: "number",
|
|
203
204
|
enum: []
|
|
204
205
|
},
|
|
205
|
-
|
|
206
|
+
admin: { get Field() { return MultiSelectFieldBinding; } }
|
|
206
207
|
}
|
|
207
208
|
},
|
|
208
209
|
file_upload: {
|
|
@@ -216,7 +217,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
216
217
|
storage: {
|
|
217
218
|
storagePath: "{path}"
|
|
218
219
|
},
|
|
219
|
-
|
|
220
|
+
admin: { get Field() { return StorageUploadFieldBinding; } }
|
|
220
221
|
}
|
|
221
222
|
},
|
|
222
223
|
multi_file_upload: {
|
|
@@ -233,7 +234,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
233
234
|
storagePath: "{path}"
|
|
234
235
|
}
|
|
235
236
|
},
|
|
236
|
-
|
|
237
|
+
admin: { get Field() { return StorageUploadFieldBinding; } }
|
|
237
238
|
}
|
|
238
239
|
},
|
|
239
240
|
reference: {
|
|
@@ -244,7 +245,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
244
245
|
color: "#ff0042",
|
|
245
246
|
property: {
|
|
246
247
|
type: "reference",
|
|
247
|
-
|
|
248
|
+
admin: { get Field() { return ReferenceFieldBinding; } }
|
|
248
249
|
}
|
|
249
250
|
},
|
|
250
251
|
multi_references: {
|
|
@@ -258,7 +259,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
258
259
|
of: {
|
|
259
260
|
type: "reference"
|
|
260
261
|
},
|
|
261
|
-
|
|
262
|
+
admin: { get Field() { return ArrayOfReferencesFieldBinding; } }
|
|
262
263
|
}
|
|
263
264
|
},
|
|
264
265
|
relation: {
|
|
@@ -270,7 +271,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
270
271
|
property: {
|
|
271
272
|
relationName: "",
|
|
272
273
|
type: "relation",
|
|
273
|
-
|
|
274
|
+
admin: { get Field() { return RelationFieldBinding; } }
|
|
274
275
|
}
|
|
275
276
|
},
|
|
276
277
|
date_time: {
|
|
@@ -281,7 +282,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
281
282
|
color: "#8b46ff",
|
|
282
283
|
property: {
|
|
283
284
|
type: "date",
|
|
284
|
-
|
|
285
|
+
admin: { get Field() { return DateTimeFieldBinding; } }
|
|
285
286
|
}
|
|
286
287
|
},
|
|
287
288
|
group: {
|
|
@@ -293,7 +294,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
293
294
|
property: {
|
|
294
295
|
type: "map",
|
|
295
296
|
properties: {},
|
|
296
|
-
|
|
297
|
+
admin: { get Field() { return MapFieldBinding; } }
|
|
297
298
|
}
|
|
298
299
|
},
|
|
299
300
|
key_value: {
|
|
@@ -305,7 +306,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
305
306
|
property: {
|
|
306
307
|
type: "map",
|
|
307
308
|
keyValue: true,
|
|
308
|
-
|
|
309
|
+
admin: { get Field() { return KeyValueFieldBinding; } }
|
|
309
310
|
}
|
|
310
311
|
},
|
|
311
312
|
repeat: {
|
|
@@ -319,7 +320,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
319
320
|
of: {
|
|
320
321
|
type: "string"
|
|
321
322
|
},
|
|
322
|
-
|
|
323
|
+
admin: { get Field() { return RepeatFieldBinding; } }
|
|
323
324
|
}
|
|
324
325
|
},
|
|
325
326
|
custom_array: {
|
|
@@ -330,7 +331,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
330
331
|
color: "#ff9408",
|
|
331
332
|
property: {
|
|
332
333
|
type: "array",
|
|
333
|
-
|
|
334
|
+
admin: { get Field() { return ArrayCustomShapedFieldBinding; } }
|
|
334
335
|
}
|
|
335
336
|
},
|
|
336
337
|
block: {
|
|
@@ -344,7 +345,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
344
345
|
oneOf: {
|
|
345
346
|
properties: {}
|
|
346
347
|
},
|
|
347
|
-
|
|
348
|
+
admin: { get Field() { return BlockFieldBinding; } }
|
|
348
349
|
}
|
|
349
350
|
},
|
|
350
351
|
vector_input: {
|
|
@@ -356,7 +357,7 @@ get Field() { return TextFieldBinding; } }
|
|
|
356
357
|
property: {
|
|
357
358
|
type: "vector",
|
|
358
359
|
dimensions: 1536,
|
|
359
|
-
|
|
360
|
+
admin: { get Field() { return VectorFieldBinding; } }
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
363
|
};
|
|
@@ -384,13 +385,13 @@ export function getFieldConfig(property: Property, propertyConfigs: Record<strin
|
|
|
384
385
|
|
|
385
386
|
export function getDefaultFieldId(property: Property) {
|
|
386
387
|
if (property.type === "string") {
|
|
387
|
-
if (property.
|
|
388
|
+
if (property.admin?.markdown) {
|
|
388
389
|
return "markdown";
|
|
389
|
-
} else if (property.
|
|
390
|
+
} else if (property.admin?.multiline) {
|
|
390
391
|
return "multiline";
|
|
391
392
|
} else if (property.storage) {
|
|
392
393
|
return "file_upload";
|
|
393
|
-
} else if (property.
|
|
394
|
+
} else if (property.admin?.urlPreview) {
|
|
394
395
|
return "url";
|
|
395
396
|
} else if (property.email) {
|
|
396
397
|
return "email";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import type { Property } from "@rebasepro/types";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
@@ -11,6 +11,7 @@ import { useAuthController } from "@rebasepro/app";
|
|
|
11
11
|
import { UserChip } from "./UserChip";
|
|
12
12
|
import { HistoryEntryData } from "../../hooks";
|
|
13
13
|
import { getValueInPath } from "@rebasepro/utils";
|
|
14
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Recursive deep equality for primitives, arrays and plain objects.
|
|
@@ -39,7 +40,7 @@ function deepEqual(a: unknown, b: unknown): boolean {
|
|
|
39
40
|
export type EntityHistoryEntryProps = {
|
|
40
41
|
size: PreviewSize;
|
|
41
42
|
actions?: React.ReactNode;
|
|
42
|
-
collection?:
|
|
43
|
+
collection?: AdminCollection;
|
|
43
44
|
hover?: boolean;
|
|
44
45
|
entry: HistoryEntryData;
|
|
45
46
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import type { EntityCustomViewParams } from "@rebasepro/types";
|
|
2
|
+
import type { EntityCustomViewParams } from "@rebasepro/admin-types";
|
|
3
3
|
import { useRef, useEffect } from "react";
|
|
4
4
|
import { cls, IconButton, Label, Tooltip, Typography } from "@rebasepro/ui";
|
|
5
5
|
import { ErrorBoundary, HistoryIcon } from "@rebasepro/ui";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import React, { useEffect, useState, useCallback } from "react";
|
|
3
3
|
;
|
|
4
4
|
import { useApiConfig } from "@rebasepro/app";
|
|
5
5
|
import { useAuthController } from "@rebasepro/app";
|
|
6
6
|
import { HistoryEntryData } from "../../hooks";
|
|
7
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
7
8
|
|
|
8
9
|
function getRelativeTimeString(date: Date): string {
|
|
9
10
|
const now = new Date();
|
|
@@ -31,7 +32,7 @@ export function LastEditedByIndicator({
|
|
|
31
32
|
}: {
|
|
32
33
|
path: string;
|
|
33
34
|
entityId: string;
|
|
34
|
-
collection:
|
|
35
|
+
collection: AdminCollection;
|
|
35
36
|
}) {
|
|
36
37
|
const apiConfig = useApiConfig();
|
|
37
38
|
const authController = useAuthController();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from "react";
|
|
2
|
-
import type { BreadcrumbEntry, BreadcrumbsController } from "@rebasepro/types";
|
|
2
|
+
import type { BreadcrumbEntry, BreadcrumbsController } from "@rebasepro/admin-types";
|
|
3
3
|
|
|
4
4
|
const DEFAULT_BREADCRUMBS_CONTROLLER: BreadcrumbsController = {
|
|
5
5
|
breadcrumbs: [],
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
useTranslation
|
|
9
9
|
} from "@rebasepro/app";
|
|
10
10
|
import { useCMSContext } from "../../hooks";
|
|
11
|
-
import {
|
|
11
|
+
import { Entity, User } from "@rebasepro/types";
|
|
12
|
+
import { CollectionActionsProps, ExportConfig, RebaseContext, AdminCollection } from "@rebasepro/admin-types";
|
|
12
13
|
import { getDefaultValuesFor } from "@rebasepro/common";
|
|
13
14
|
import {
|
|
14
15
|
Alert,
|
|
@@ -38,8 +39,8 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
|
|
|
38
39
|
onAnalyticsEvent,
|
|
39
40
|
exportAllowed,
|
|
40
41
|
notAllowedView
|
|
41
|
-
}: CollectionActionsProps<M, USER,
|
|
42
|
-
exportAllowed?: (props: { collectionEntitiesCount: number, path: string, collection:
|
|
42
|
+
}: CollectionActionsProps<M, USER, AdminCollection<M>> & {
|
|
43
|
+
exportAllowed?: (props: { collectionEntitiesCount: number, path: string, collection: AdminCollection }) => boolean;
|
|
43
44
|
notAllowedView?: React.ReactNode;
|
|
44
45
|
onAnalyticsEvent?: (event: string, params?: any) => void;
|
|
45
46
|
}) {
|
|
@@ -115,7 +116,7 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
|
|
|
115
116
|
return [...resolvedExportColumnsValues, ...resolvedColumnsValues];
|
|
116
117
|
}, [exportConfig?.additionalFields]);
|
|
117
118
|
|
|
118
|
-
const doDownload = useCallback(async (collection:
|
|
119
|
+
const doDownload = useCallback(async (collection: AdminCollection<M>,
|
|
119
120
|
exportConfig: ExportConfig<any> | undefined) => {
|
|
120
121
|
|
|
121
122
|
onAnalyticsEvent?.("export_collection", {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useData } from "@rebasepro/app";
|
|
2
|
-
import { Entity
|
|
2
|
+
import { Entity } from "@rebasepro/types";
|
|
3
3
|
import { RebaseData } from "@rebasepro/types";
|
|
4
4
|
import { Button, CenteredView, CircularProgress, Typography } from "@rebasepro/ui";
|
|
5
5
|
import { useEffect, useRef, useState } from "react";
|
|
6
6
|
import { ImportConfig } from "../types";
|
|
7
|
+
import type { AdminCollection } from "@rebasepro/admin-types";
|
|
7
8
|
|
|
8
|
-
export function ImportSaveInProgress<C extends
|
|
9
|
+
export function ImportSaveInProgress<C extends AdminCollection<any>>
|
|
9
10
|
({
|
|
10
11
|
path,
|
|
11
12
|
importConfig,
|
|
@@ -95,7 +96,7 @@ export function ImportSaveInProgress<C extends CollectionConfig<any>>
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
function saveDataBatch(dataClient: RebaseData,
|
|
98
|
-
collection:
|
|
99
|
+
collection: AdminCollection,
|
|
99
100
|
path: string,
|
|
100
101
|
data: Partial<Entity<any>>[],
|
|
101
102
|
offset = 0,
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
useSnackbarController
|
|
6
6
|
} from "@rebasepro/app";
|
|
7
7
|
import { getPropertiesWithPropertiesOrder, getPropertyInPath } from "../../util";
|
|
8
|
-
import {
|
|
8
|
+
import { Properties, Property, User } from "@rebasepro/types";
|
|
9
|
+
import { CollectionActionsProps, AdminCollection } from "@rebasepro/admin-types";
|
|
9
10
|
import { getFieldConfig } from "../../components/field_configs";
|
|
10
11
|
import { PropertyConfigBadge } from "../../components/PropertyConfigBadge";
|
|
11
12
|
import { useSelectionController } from "../../components/CollectionViewBinding/useSelectionController";
|
|
@@ -176,7 +177,7 @@ export function ImportCollectionAction<M extends Record<string, unknown>, USER e
|
|
|
176
177
|
|
|
177
178
|
{step === "import_data_saving" && importConfig &&
|
|
178
179
|
<ImportSaveInProgress importConfig={importConfig}
|
|
179
|
-
collection={collection as
|
|
180
|
+
collection={collection as AdminCollection}
|
|
180
181
|
path={path}
|
|
181
182
|
onImportSuccess={(importedCollection) => {
|
|
182
183
|
handleClose();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPropertyInPath } from "../../util";
|
|
2
|
-
import {
|
|
2
|
+
import { Entity, EntityReference, CollectionRegistryController, Properties, Property, Vector } from "@rebasepro/types";
|
|
3
|
+
import { AuthController, AdminCollection } from "@rebasepro/admin-types";
|
|
3
4
|
import { isPropertyBuilder } from "@rebasepro/common";
|
|
4
5
|
import { unflattenObject } from "./file_to_json";
|
|
5
6
|
import { getIn } from "@rebasepro/forms";
|
|
@@ -148,7 +149,7 @@ export function processValueMapping(authController: AuthController, value: any,
|
|
|
148
149
|
|
|
149
150
|
// If no explicit database was provided in the string, try to get it from the collection
|
|
150
151
|
if (databaseId === undefined) {
|
|
151
|
-
const targetCollection:
|
|
152
|
+
const targetCollection: AdminCollection<any> | undefined = navigation.getCollection(path);
|
|
152
153
|
databaseId = targetCollection?.databaseId;
|
|
153
154
|
}
|
|
154
155
|
|
package/src/form/EntityForm.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import type { EntityCustomViewParams, AdditionalFieldDelegateProps, AdminCollection } from "@rebasepro/admin-types";
|
|
2
3
|
import type { FormContext, PropertyFieldBindingProps } from "../types/fields";
|
|
3
|
-
import type { PropertyConfig } from "@rebasepro/types";
|
|
4
|
+
import type { PropertyConfig } from "@rebasepro/admin-types";
|
|
4
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
6
|
import { Entity, EntityStatus, EntityValues } from "@rebasepro/types";
|
|
6
7
|
import type { EntityFormProps, OnUpdateParams } from "../types/components/EntityFormProps";
|
|
@@ -8,7 +9,8 @@ import { deepEqual as equal } from "fast-equals";
|
|
|
8
9
|
|
|
9
10
|
import { ErrorBoundary } from "@rebasepro/ui";
|
|
10
11
|
import { AlignLeftIcon, CheckIcon, LoaderIcon, PencilIcon, useDebouncedCallback } from "@rebasepro/ui";
|
|
11
|
-
import { getDefaultValuesFor
|
|
12
|
+
import { getDefaultValuesFor } from "@rebasepro/common";
|
|
13
|
+
import { isHidden, isReadOnly } from "@rebasepro/app";
|
|
12
14
|
|
|
13
15
|
import { useCustomizationController } from "@rebasepro/app";
|
|
14
16
|
import { getFormFieldKeys } from "@rebasepro/app";
|
|
@@ -26,7 +28,8 @@ import { EntityFormActions } from "./EntityFormActions";
|
|
|
26
28
|
import type { EntityFormActionsProps } from "../types/components/EntityFormActionsProps";
|
|
27
29
|
import { LocalChangesMenu } from "./components/LocalChangesMenu";
|
|
28
30
|
|
|
29
|
-
import {
|
|
31
|
+
import { getEntityTitlePropertyKeyForEntity, isUserSelectProperty, resolveTitleToString } from "../util/previews";
|
|
32
|
+
import { getUserLabel, useResolvedUser } from "../hooks/useResolvedUsers";
|
|
30
33
|
import { getValueInPath, mergeDeep } from "@rebasepro/utils";
|
|
31
34
|
import {
|
|
32
35
|
getChanges,
|
|
@@ -313,11 +316,17 @@ export function EntityForm<M extends Record<string, unknown>>({
|
|
|
313
316
|
|
|
314
317
|
const actionsDisabled = disabled || formex.isSubmitting || (status === "existing" && !formex.dirty) || Boolean(disabledProp);
|
|
315
318
|
|
|
316
|
-
const titlePropertyKey =
|
|
319
|
+
const titlePropertyKey = getEntityTitlePropertyKeyForEntity(collection, formex.values as Record<string, unknown> | undefined, entityId);
|
|
317
320
|
const rawTitle = formex.values && titlePropertyKey ? getValueInPath(formex.values, titlePropertyKey) : undefined;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
+
// A user picker stores an id: resolve it to the person, like a relation.
|
|
322
|
+
const titleUser = useResolvedUser(isUserSelectProperty(collection, titlePropertyKey) && typeof rawTitle === "string"
|
|
323
|
+
? rawTitle
|
|
324
|
+
: undefined);
|
|
325
|
+
const title = titleUser
|
|
326
|
+
? getUserLabel(titleUser)
|
|
327
|
+
: (rawTitle !== undefined && rawTitle !== null
|
|
328
|
+
? resolveTitleToString(rawTitle)
|
|
329
|
+
: (collection.singularName ?? collection.name));
|
|
321
330
|
|
|
322
331
|
const modified = formex.dirty;
|
|
323
332
|
|
|
@@ -387,10 +396,10 @@ export function EntityForm<M extends Record<string, unknown>>({
|
|
|
387
396
|
const isNew = status === "new" || status === "copy";
|
|
388
397
|
const isStringOrNumber = property.type === "string" || property.type === "number";
|
|
389
398
|
const isIdAndAuto = isStringOrNumber && "isId" in property && typeof property.isId === "string" && property.isId !== "manual";
|
|
390
|
-
const disabled = disabledProp || (!autoSave && formex.isSubmitting) || isReadOnly(property) || Boolean(property.
|
|
399
|
+
const disabled = disabledProp || (!autoSave && formex.isSubmitting) || isReadOnly(property) || Boolean(property.admin?.disabled) || (!isNew && "isId" in property && Boolean(property.isId)) || (isNew && isIdAndAuto);
|
|
391
400
|
const hidden = isHidden(property);
|
|
392
401
|
if (hidden) return null;
|
|
393
|
-
const widthPercentage = property.
|
|
402
|
+
const widthPercentage = property.admin?.widthPercentage ?? 100;
|
|
394
403
|
|
|
395
404
|
const shouldAutoFocus = isNewEntity && !disabled && firstFocusableIndex === -1;
|
|
396
405
|
if (shouldAutoFocus) firstFocusableIndex = 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { getCollectionDataPath } from "@rebasepro/types";
|
|
3
3
|
import type { FormContext } from "../types/fields";
|
|
4
|
-
import type { EntityAction } from "@rebasepro/types";
|
|
4
|
+
import type { EntityAction, AdminCollection } from "@rebasepro/admin-types";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { Entity } from "@rebasepro/types";
|
|
7
7
|
import type { EntityFormActionsProps } from "../types/components/EntityFormActionsProps";
|
|
@@ -81,7 +81,7 @@ type ActionsViewProps<M extends Record<string, unknown>> = {
|
|
|
81
81
|
savingError: Error | undefined,
|
|
82
82
|
entity: Entity<M> | undefined,
|
|
83
83
|
formActions?: EntityAction[],
|
|
84
|
-
collection:
|
|
84
|
+
collection: AdminCollection,
|
|
85
85
|
disabled: boolean,
|
|
86
86
|
status: "new" | "existing" | "copy",
|
|
87
87
|
pluginActions?: React.ReactNode[],
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import type { PluginFormActionProps, AdminCollection } from "@rebasepro/admin-types";
|
|
2
3
|
import type { FormContext } from "../types/fields";
|
|
3
4
|
import React, { useCallback, useMemo, useState } from "react";
|
|
4
|
-
import {
|
|
5
|
+
import { Entity, EntityStatus, EntityValues } from "@rebasepro/types";
|
|
6
|
+
import { AnalyticsEvent } from "@rebasepro/admin-types";
|
|
5
7
|
import type { EntityFormProps, OnUpdateParams } from "../types/components/EntityFormProps";
|
|
6
8
|
import type { EntityFormActionsProps } from "../types/components/EntityFormActionsProps";
|
|
7
9
|
|
|
8
|
-
import { getLocalChangesBackup } from "@rebasepro/
|
|
10
|
+
import { getLocalChangesBackup } from "@rebasepro/app";
|
|
9
11
|
|
|
10
12
|
import {
|
|
11
13
|
saveEntityWithCallbacks,
|
|
@@ -278,7 +280,7 @@ export function EntityFormBinding<M extends Record<string, unknown>>({
|
|
|
278
280
|
parentEntityIds,
|
|
279
281
|
path,
|
|
280
282
|
status,
|
|
281
|
-
collection: collection as
|
|
283
|
+
collection: collection as AdminCollection,
|
|
282
284
|
context,
|
|
283
285
|
formContext: undefined as unknown as FormContext<Record<string, unknown>>,
|
|
284
286
|
openEntityMode,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import type { FieldProps as CoreFieldProps, AdminCollection } from "@rebasepro/admin-types";
|
|
2
3
|
import type { FieldProps, PropertyFieldBindingProps } from "../types/fields";
|
|
3
|
-
import type {
|
|
4
|
+
import type { Property } from "@rebasepro/types";
|
|
5
|
+
import type { RebasePlugin, PluginFieldBuilderParams } from "@rebasepro/admin-types";
|
|
4
6
|
import React, { ComponentType, ReactElement, Suspense, useCallback, useRef } from "react";
|
|
5
7
|
import { deepEqual as equal } from "fast-equals"
|
|
6
8
|
|
|
@@ -11,7 +13,8 @@ import { Field, FormexFieldProps, getIn } from "@rebasepro/forms";
|
|
|
11
13
|
;
|
|
12
14
|
import { ReadOnlyFieldBinding } from "./field_bindings/ReadOnlyFieldBinding";
|
|
13
15
|
|
|
14
|
-
import {
|
|
16
|
+
import { isPropertyBuilder, resolveProperty } from "@rebasepro/common";
|
|
17
|
+
import { isHidden, isReadOnly } from "@rebasepro/app";
|
|
15
18
|
import { useAuthController, useCustomizationController } from "@rebasepro/app";
|
|
16
19
|
import { Typography } from "@rebasepro/ui";
|
|
17
20
|
import { getFieldConfig, getFieldId } from "../components/field_configs";
|
|
@@ -29,7 +32,7 @@ import { ErrorBoundary } from "@rebasepro/ui";
|
|
|
29
32
|
*
|
|
30
33
|
* Please note that if you build a custom field in a component, the
|
|
31
34
|
* **validation** passed in the property will have no effect. You need to set
|
|
32
|
-
* the validation in the `
|
|
35
|
+
* the validation in the `AdminCollection` definition.
|
|
33
36
|
*
|
|
34
37
|
* @param propertyKey You can use nested names such as `address.street` or `friends[2]`
|
|
35
38
|
* @param property
|
|
@@ -109,14 +112,14 @@ function PropertyFieldBindingInternal<M extends Record<string, unknown> = Record
|
|
|
109
112
|
}) as Property | null;
|
|
110
113
|
|
|
111
114
|
const readOnly = resolvedProperty ? isReadOnly(resolvedProperty) : true;
|
|
112
|
-
const disabled = disabledProp || readOnly || Boolean(resolvedProperty?.
|
|
115
|
+
const disabled = disabledProp || readOnly || Boolean(resolvedProperty?.admin?.disabled) || context.disabled;
|
|
113
116
|
|
|
114
117
|
if (resolvedProperty === null || isHidden(resolvedProperty)) {
|
|
115
118
|
return <></>;
|
|
116
119
|
} else if (readOnly) {
|
|
117
120
|
Component = ReadOnlyFieldBinding;
|
|
118
|
-
} else if (resolvedProperty.
|
|
119
|
-
const resolved = resolveComponentRef(resolvedProperty.
|
|
121
|
+
} else if (resolvedProperty.admin?.Field) {
|
|
122
|
+
const resolved = resolveComponentRef(resolvedProperty.admin.Field);
|
|
120
123
|
if (resolved) {
|
|
121
124
|
Component = resolved as ComponentType<FieldProps<Property, any, any>>;
|
|
122
125
|
}
|
|
@@ -135,7 +138,7 @@ function PropertyFieldBindingInternal<M extends Record<string, unknown> = Record
|
|
|
135
138
|
index,
|
|
136
139
|
authController
|
|
137
140
|
}) as Property | null;
|
|
138
|
-
Component = resolveComponentRef(configProperty?.
|
|
141
|
+
Component = resolveComponentRef(configProperty?.admin?.Field) as ComponentType<FieldProps<Property, any, any>> | undefined;
|
|
139
142
|
}
|
|
140
143
|
if (!Component) {
|
|
141
144
|
console.warn(`No field component found for property ${propertyKey}`);
|
|
@@ -205,7 +208,7 @@ function FieldInternal<CustomProps, M extends Record<string, unknown>>
|
|
|
205
208
|
|
|
206
209
|
const { plugins } = useCustomizationController();
|
|
207
210
|
|
|
208
|
-
const customFieldProps: unknown = property.
|
|
211
|
+
const customFieldProps: unknown = property.admin?.customProps;
|
|
209
212
|
const value = formexFieldProps.field.value;
|
|
210
213
|
const error = getIn(formexFieldProps.form.errors, propertyKey) as string | string[] | undefined;
|
|
211
214
|
const touched = getIn(formexFieldProps.form.touched, propertyKey) as boolean | undefined;
|
|
@@ -282,7 +285,7 @@ const shouldPropertyReRender = (property: Property, plugins?: RebasePlugin[]): b
|
|
|
282
285
|
return true;
|
|
283
286
|
}
|
|
284
287
|
const defAProperty = property as Property;
|
|
285
|
-
const rerenderThisProperty = Boolean(defAProperty.
|
|
288
|
+
const rerenderThisProperty = Boolean(defAProperty.admin?.Field);
|
|
286
289
|
if (defAProperty.type === "map" && defAProperty.properties) {
|
|
287
290
|
return Boolean(rerenderThisProperty || Object.values(defAProperty.properties).some((childProperty) => shouldPropertyReRender(childProperty as Property, plugins)));
|
|
288
291
|
} else {
|
|
@@ -292,7 +295,7 @@ const shouldPropertyReRender = (property: Property, plugins?: RebasePlugin[]): b
|
|
|
292
295
|
|
|
293
296
|
interface UseWrappedComponentParams<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
294
297
|
path?: string,
|
|
295
|
-
collection?:
|
|
298
|
+
collection?: AdminCollection<M>,
|
|
296
299
|
propertyKey: string,
|
|
297
300
|
property: Property,
|
|
298
301
|
Component: ComponentType<FieldProps<Property, unknown, M>>,
|
|
@@ -323,7 +326,7 @@ function useWrappedComponent<T, M extends Record<string, unknown> = Record<strin
|
|
|
323
326
|
Field: Component as unknown as ComponentType<CoreFieldProps<Property, unknown, Record<string, unknown>>>,
|
|
324
327
|
plugin,
|
|
325
328
|
path,
|
|
326
|
-
collection: collection as
|
|
329
|
+
collection: collection as AdminCollection | undefined
|
|
327
330
|
};
|
|
328
331
|
const enabled = plugin.fieldBuilder.enabled?.(params);
|
|
329
332
|
if (enabled === undefined || enabled)
|
|
@@ -71,7 +71,7 @@ export function FieldHelperText<T>({
|
|
|
71
71
|
</Typography>
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const disabledTooltip: string | undefined = typeof property.
|
|
74
|
+
const disabledTooltip: string | undefined = typeof property.admin?.disabled === "object" ? property.admin?.disabled.disabledMessage : undefined;
|
|
75
75
|
|
|
76
76
|
return <div className={"flex ml-3.5 mt-1"}>
|
|
77
77
|
<Typography variant={"caption"}
|