@rebasepro/cms 0.24.0 → 0.24.1-canary.g56af4a4
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/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +4 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-CcFSXvkK.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +42 -59
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.js +95 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +211 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-DjQoRrIU.js → data_import/import/ImportCollectionAction.js} +53 -43
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +7 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3147
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +257 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +24 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +2 -1
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +208 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +4 -2
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +149 -3867
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +2 -1
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +93 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +4 -3
- package/dist/{util-D7ebttKT.js → preview/util.js} +8 -5
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +5 -0
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +44 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-p5-I-Apu.js +0 -3669
- package/dist/CollectionEditorDialog-p5-I-Apu.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-DDB_X-00.js +0 -3837
- package/dist/PropertyEditView-DDB_X-00.js.map +0 -1
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js +0 -212
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js.map +0 -1
- package/dist/SchemaChangeDialog-CcFSXvkK.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-DCHuPD1a.js +0 -520
- package/dist/export-DCHuPD1a.js.map +0 -1
- package/dist/history-CBd6SBRs.js +0 -314
- package/dist/history-CBd6SBRs.js.map +0 -1
- package/dist/import-DjQoRrIU.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-BRvKFMLa.js +0 -27773
- package/dist/util-BRvKFMLa.js.map +0 -1
- package/dist/util-D7ebttKT.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3867 +1,149 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
collection,
|
|
151
|
-
viewMode: resolveViewMode({
|
|
152
|
-
collection,
|
|
153
|
-
search: location.search,
|
|
154
|
-
savedViewMode: userConfigPersistence?.getCollectionConfig(collection.slug)?.defaultViewMode
|
|
155
|
-
})
|
|
156
|
-
}) : void 0;
|
|
157
|
-
if (collection && effectiveOpenMode === "split") {
|
|
158
|
-
let selectedTab;
|
|
159
|
-
if (navigationEntries.length === 3) {
|
|
160
|
-
const thirdEntry = navigationEntries[2];
|
|
161
|
-
if (thirdEntry.type === "collection") selectedTab = thirdEntry.collection.slug;
|
|
162
|
-
else if (thirdEntry.type === "custom_view") selectedTab = thirdEntry.view.key;
|
|
163
|
-
}
|
|
164
|
-
if (!selectedTab && navigationEntries.length === 2 && lastEntityEntry) {
|
|
165
|
-
const entityIdStr = String(lastEntityEntry.entityId);
|
|
166
|
-
const entityIdIdx = pathname.lastIndexOf(`/${entityIdStr}`);
|
|
167
|
-
if (entityIdIdx >= 0) {
|
|
168
|
-
const afterEntity = pathname.substring(entityIdIdx + 1 + entityIdStr.length);
|
|
169
|
-
const trailingSegment = afterEntity.startsWith("/") ? afterEntity.substring(1) : afterEntity;
|
|
170
|
-
if (trailingSegment.length > 0) selectedTab = trailingSegment;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return /* @__PURE__ */ jsx(ResolvedCollectionView, {
|
|
174
|
-
...collection,
|
|
175
|
-
parentCollectionSlugs: [],
|
|
176
|
-
parentEntityIds: [],
|
|
177
|
-
path: collection.slug,
|
|
178
|
-
updateUrl: true,
|
|
179
|
-
selectedEntityId: lastEntityEntry.entityId,
|
|
180
|
-
selectedTab,
|
|
181
|
-
Actions: toArray(collection.Actions)
|
|
182
|
-
}, `collection_view_${collection.slug}`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return /* @__PURE__ */ jsx(EntityFullScreenRoute, {
|
|
186
|
-
pathname,
|
|
187
|
-
navigationEntries,
|
|
188
|
-
isNew,
|
|
189
|
-
isCopy
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function getSelectedTabFromUrl(isNew, lastCustomView) {
|
|
193
|
-
if (isNew) return;
|
|
194
|
-
else if (lastCustomView) {
|
|
195
|
-
if (lastCustomView.type === "custom_view") return lastCustomView.view.key;
|
|
196
|
-
else if (lastCustomView.type === "collection") return lastCustomView.id ?? lastCustomView.slug;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function EntityFullScreenRoute({ pathname, navigationEntries, isNew, isCopy }) {
|
|
200
|
-
const collectionRegistry = useCollectionRegistryController();
|
|
201
|
-
const urlController = useUrlController();
|
|
202
|
-
const navigate = useNavigate();
|
|
203
|
-
const location = useLocation();
|
|
204
|
-
const userConfigPersistence = useUserConfigurationPersistence();
|
|
205
|
-
const defaultValues = location.state?.defaultValues;
|
|
206
|
-
const hash = location.hash;
|
|
207
|
-
const navigationPath = urlController.urlPathToDataPath(pathname);
|
|
208
|
-
const blocked = useRef(false);
|
|
209
|
-
const lastEntityEntry = [...navigationEntries].reverse().find((entry) => entry.type === "entity");
|
|
210
|
-
const lastCustomView = [...lastEntityEntry ? navigationEntries.slice(navigationEntries.indexOf(lastEntityEntry) + 1) : []].reverse().find((entry) => entry.type === "custom_view" || entry.type === "collection");
|
|
211
|
-
const entityId = lastEntityEntry && "entityId" in lastEntityEntry ? lastEntityEntry.entityId : void 0;
|
|
212
|
-
let urlTab = getSelectedTabFromUrl(isNew, lastCustomView);
|
|
213
|
-
if (!urlTab && entityId && !isNew) {
|
|
214
|
-
const entityIdStr = String(entityId);
|
|
215
|
-
const entityIdIdx = pathname.lastIndexOf(`/${entityIdStr}`);
|
|
216
|
-
if (entityIdIdx >= 0) {
|
|
217
|
-
const afterEntity = pathname.substring(entityIdIdx + 1 + entityIdStr.length);
|
|
218
|
-
const trailingSegment = afterEntity.startsWith("/") ? afterEntity.substring(1) : afterEntity;
|
|
219
|
-
if (trailingSegment.length > 0 && trailingSegment !== "edit") urlTab = trailingSegment;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
const [selectedTab, setSelectedTab] = useState(urlTab);
|
|
223
|
-
const parentCollectionSlugs = collectionRegistry.getParentCollectionSlugs(navigationPath);
|
|
224
|
-
const parentEntityIds = collectionRegistry.getParentEntityIds(navigationPath);
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
if (urlTab !== selectedTab) setSelectedTab(urlTab);
|
|
227
|
-
}, [urlTab]);
|
|
228
|
-
const basePath = !entityId || isNew ? pathname : pathname.substring(0, pathname.lastIndexOf(`/${entityId}`));
|
|
229
|
-
const entityPath = basePath + `/${entityId}`;
|
|
230
|
-
const blocker = useNavigationBlocker(useCallback(({ currentLocation, nextLocation }) => {
|
|
231
|
-
if (isPathWithinRecord(nextLocation.pathname, entityPath)) return false;
|
|
232
|
-
const nextHash = nextLocation.hash;
|
|
233
|
-
if (nextHash === "#side" || nextHash === "#new_side") return false;
|
|
234
|
-
const currentHash = currentLocation.hash;
|
|
235
|
-
if ((currentHash === "#side" || currentHash === "#new_side") && (nextLocation.pathname === basePath || isPathWithinRecord(nextLocation.pathname, entityPath))) return false;
|
|
236
|
-
return blocked.current;
|
|
237
|
-
}, [entityPath, basePath]));
|
|
238
|
-
const lastCollectionEntry = [...navigationEntries].reverse().find((entry) => entry.type === "collection");
|
|
239
|
-
if (isNew && !lastCollectionEntry) {
|
|
240
|
-
if (!collectionRegistry.initialised) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
241
|
-
throw new Error("INTERNAL: No collection found in the navigation");
|
|
242
|
-
}
|
|
243
|
-
if (!isNew && !lastEntityEntry) {
|
|
244
|
-
if (!collectionRegistry.initialised) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
245
|
-
return /* @__PURE__ */ jsx(NotFoundPage, {});
|
|
246
|
-
}
|
|
247
|
-
const rawCollection = isNew ? lastCollectionEntry && "collection" in lastCollectionEntry ? lastCollectionEntry.collection : void 0 : lastEntityEntry && "parentCollection" in lastEntityEntry ? lastEntityEntry.parentCollection : void 0;
|
|
248
|
-
const collection = collectionRegistry.getCollection(rawCollection.slug) || rawCollection;
|
|
249
|
-
const fullIdPath = isNew ? lastCollectionEntry.slug : lastEntityEntry.slug;
|
|
250
|
-
const collectionPath = urlController.resolveDatabasePathsFrom(fullIdPath);
|
|
251
|
-
const isEditRoute = pathname.endsWith("/edit") || pathname.split("/").pop() === "edit";
|
|
252
|
-
const isDetailMode = collection.defaultEntityAction === "view" && !isNew && !isCopy && entityId && !isEditRoute;
|
|
253
|
-
const showList = !isNew && !isCopy && entityId !== void 0 && navigationEntries[0]?.type === "collection" && (navigationEntries.length === 2 || navigationEntries.length === 3) && resolveOpenEntityMode({
|
|
254
|
-
collection,
|
|
255
|
-
viewMode: resolveViewMode({
|
|
256
|
-
collection,
|
|
257
|
-
search: location.search,
|
|
258
|
-
savedViewMode: userConfigPersistence?.getCollectionConfig(collection.slug)?.defaultViewMode
|
|
259
|
-
})
|
|
260
|
-
}) === "split" ? () => navigate({
|
|
261
|
-
pathname,
|
|
262
|
-
search: location.search,
|
|
263
|
-
hash: ""
|
|
264
|
-
}) : void 0;
|
|
265
|
-
if (isDetailMode) return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(DetailViewBinding, {
|
|
266
|
-
entityId,
|
|
267
|
-
collection,
|
|
268
|
-
layout: "full_screen",
|
|
269
|
-
path: collectionPath,
|
|
270
|
-
selectedTab: selectedTab ?? void 0,
|
|
271
|
-
onShowList: showList,
|
|
272
|
-
onEditClick: () => {
|
|
273
|
-
const editUrl = urlController.buildUrlCollectionPath(`${collectionPath}/${entityId}`) + "/edit";
|
|
274
|
-
navigate(editUrl + hash);
|
|
275
|
-
},
|
|
276
|
-
onTabChange: (params) => {
|
|
277
|
-
setSelectedTab(params.selectedTab);
|
|
278
|
-
const newSelectedTab = params.selectedTab;
|
|
279
|
-
if (newSelectedTab) navigate(`${basePath}/${entityId}/${newSelectedTab}${hash}`, { replace: true });
|
|
280
|
-
else navigate(`${basePath}/${entityId}${hash}`, { replace: true });
|
|
281
|
-
},
|
|
282
|
-
parentCollectionSlugs,
|
|
283
|
-
parentEntityIds
|
|
284
|
-
}, collection.slug + "_view_" + entityId) });
|
|
285
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(EditViewBinding, {
|
|
286
|
-
entityId: isNew ? void 0 : entityId,
|
|
287
|
-
collection,
|
|
288
|
-
layout: "full_screen",
|
|
289
|
-
path: collectionPath,
|
|
290
|
-
copy: isCopy,
|
|
291
|
-
selectedTab: selectedTab ?? void 0,
|
|
292
|
-
onShowList: showList,
|
|
293
|
-
defaultValues: isNew ? defaultValues : void 0,
|
|
294
|
-
onValuesModified: (modified) => blocked.current = modified,
|
|
295
|
-
navigateBack: () => {
|
|
296
|
-
const detailUrl = urlController.buildUrlCollectionPath(`${collectionPath}/${entityId}`);
|
|
297
|
-
navigate(detailUrl + hash);
|
|
298
|
-
},
|
|
299
|
-
onSaved: (params) => {
|
|
300
|
-
const newSelectedTab = params.selectedTab;
|
|
301
|
-
const newEntityId = params.entityId;
|
|
302
|
-
const savedHash = isNew ? "" : hash;
|
|
303
|
-
if (newSelectedTab) navigate(`${basePath}/${newEntityId}/${newSelectedTab}${savedHash}`, { replace: true });
|
|
304
|
-
else navigate(`${basePath}/${newEntityId}${savedHash}`, { replace: true });
|
|
305
|
-
},
|
|
306
|
-
onTabChange: (params) => {
|
|
307
|
-
setSelectedTab(params.selectedTab);
|
|
308
|
-
if (isNew) return;
|
|
309
|
-
const newSelectedTab = params.selectedTab;
|
|
310
|
-
if (newSelectedTab) navigate(`${basePath}/${entityId}/${newSelectedTab}${hash}`, { replace: true });
|
|
311
|
-
else navigate(`${basePath}/${entityId}${hash}`, { replace: true });
|
|
312
|
-
},
|
|
313
|
-
parentCollectionSlugs,
|
|
314
|
-
parentEntityIds
|
|
315
|
-
}, collection.slug + "_" + (isNew ? "new" : isCopy ? entityId + "_copy" : entityId)), /* @__PURE__ */ jsx(UnsavedChangesDialog, {
|
|
316
|
-
open: blocker?.state === "blocked",
|
|
317
|
-
handleOk: () => blocker?.proceed?.(),
|
|
318
|
-
handleCancel: () => blocker?.reset?.(),
|
|
319
|
-
body: "You have unsaved changes in this entity."
|
|
320
|
-
})] });
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Shown when a URL names a collection the registry cannot resolve.
|
|
324
|
-
*
|
|
325
|
-
* This used to be `return null`, which renders an empty pane inside the app
|
|
326
|
-
* chrome: the sidebar, the nav highlight and the breadcrumb all still work,
|
|
327
|
-
* because those read the collections array directly, while the view itself is
|
|
328
|
-
* blank. Nothing is thrown, and the only trace is a `console.debug` — so the
|
|
329
|
-
* panel looks like it lost its data rather than like it failed to find the
|
|
330
|
-
* collection, and there is no string to search for.
|
|
331
|
-
*
|
|
332
|
-
* A slug containing slashes went unresolvable this way and cost an afternoon to
|
|
333
|
-
* find. The lookup is fixed; this is the part that made it expensive.
|
|
334
|
-
*/
|
|
335
|
-
function UnresolvedCollectionView({ path }) {
|
|
336
|
-
useEffect(() => {
|
|
337
|
-
console.warn(`[rebase] No collection is registered for "${path}", so this route has nothing to render. Check that the collection is in the collections array and that its slug matches the URL.`);
|
|
338
|
-
}, [path]);
|
|
339
|
-
return /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsx(ErrorView, {
|
|
340
|
-
title: "Collection not found",
|
|
341
|
-
error: `Nothing is registered for "${path}".`,
|
|
342
|
-
tooltip: "The URL names a collection the panel does not know about. It may have been renamed or removed from the collections array, or the slug may not match the path."
|
|
343
|
-
}) });
|
|
344
|
-
}
|
|
345
|
-
//#endregion
|
|
346
|
-
//#region src/components/ReferenceWidget.tsx
|
|
347
|
-
/**
|
|
348
|
-
* This field allows selecting reference/s.
|
|
349
|
-
*/
|
|
350
|
-
function ReferenceWidget({ name, multiselect = false, path, disabled, value, onReferenceSelected, onMultipleReferenceSelected, previewProperties, fixedFilter, size, className, includeId, includeEntityLink }) {
|
|
351
|
-
const collectionRegistryController = useCollectionRegistryController();
|
|
352
|
-
const { toCollectionPath, referenceTo } = useReferencePaths();
|
|
353
|
-
const collectionPath = toCollectionPath(path);
|
|
354
|
-
const collection = useMemo(() => {
|
|
355
|
-
return collectionRegistryController.getCollection(collectionPath);
|
|
356
|
-
}, [collectionPath, collectionRegistryController.getCollection]);
|
|
357
|
-
const onSingleEntitySelected = useCallback((entity) => {
|
|
358
|
-
if (disabled) return;
|
|
359
|
-
if (onReferenceSelected) {
|
|
360
|
-
const reference = entity ? referenceTo(entity) : null;
|
|
361
|
-
onReferenceSelected?.({
|
|
362
|
-
reference,
|
|
363
|
-
entity
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
}, [
|
|
367
|
-
disabled,
|
|
368
|
-
onReferenceSelected,
|
|
369
|
-
referenceTo
|
|
370
|
-
]);
|
|
371
|
-
const onMultipleEntitiesSelected = useCallback((entities) => {
|
|
372
|
-
if (disabled) return;
|
|
373
|
-
if (onMultipleReferenceSelected) onMultipleReferenceSelected({
|
|
374
|
-
references: entities ? entities.map((e) => referenceTo(e)) : null,
|
|
375
|
-
entities
|
|
376
|
-
});
|
|
377
|
-
}, [
|
|
378
|
-
disabled,
|
|
379
|
-
onReferenceSelected,
|
|
380
|
-
referenceTo
|
|
381
|
-
]);
|
|
382
|
-
const referenceDialogController = useSelectionDialog({
|
|
383
|
-
multiselect,
|
|
384
|
-
path: collectionPath,
|
|
385
|
-
collection,
|
|
386
|
-
onSingleEntitySelected,
|
|
387
|
-
onMultipleEntitiesSelected,
|
|
388
|
-
fixedFilter
|
|
389
|
-
});
|
|
390
|
-
useCallback((e) => {
|
|
391
|
-
e.stopPropagation();
|
|
392
|
-
if (multiselect) onMultipleEntitiesSelected([]);
|
|
393
|
-
else onSingleEntitySelected(null);
|
|
394
|
-
}, [onReferenceSelected]);
|
|
395
|
-
let child;
|
|
396
|
-
const onEntryClick = () => {
|
|
397
|
-
if (disabled) return;
|
|
398
|
-
referenceDialogController.open();
|
|
399
|
-
};
|
|
400
|
-
if (Array.isArray(value)) child = /* @__PURE__ */ jsx("div", {
|
|
401
|
-
className: "flex flex-col gap-4",
|
|
402
|
-
children: value.map((ref, index) => {
|
|
403
|
-
return /* @__PURE__ */ jsx(ReferencePreview, {
|
|
404
|
-
onClick: onEntryClick,
|
|
405
|
-
reference: ref,
|
|
406
|
-
disabled,
|
|
407
|
-
previewProperties,
|
|
408
|
-
size,
|
|
409
|
-
includeId,
|
|
410
|
-
includeEntityLink
|
|
411
|
-
}, `reference_preview_${index}`);
|
|
412
|
-
})
|
|
413
|
-
});
|
|
414
|
-
else if (value?.isEntityReference && value?.isEntityReference()) child = /* @__PURE__ */ jsx(ReferencePreview, {
|
|
415
|
-
reference: value,
|
|
416
|
-
onClick: onEntryClick,
|
|
417
|
-
disabled,
|
|
418
|
-
previewProperties,
|
|
419
|
-
size,
|
|
420
|
-
includeId,
|
|
421
|
-
includeEntityLink
|
|
422
|
-
});
|
|
423
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
424
|
-
className: cls("text-sm font-medium", "min-w-80 flex flex-col gap-4", "relative transition-colors duration-200 ease-in rounded-xs font-medium", disabled ? "bg-opacity-50" : "hover:bg-opacity-75", "dark:text-white/50 text-text-primary/50 dark:text-text-primary-dark/50 dark:text-white/50", className),
|
|
425
|
-
children: [child, !value && /* @__PURE__ */ jsx("div", {
|
|
426
|
-
className: "justify-center text-left",
|
|
427
|
-
children: /* @__PURE__ */ jsxs(Button, {
|
|
428
|
-
disabled,
|
|
429
|
-
onClick: onEntryClick,
|
|
430
|
-
children: ["Edit ", name]
|
|
431
|
-
})
|
|
432
|
-
})]
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
//#endregion
|
|
436
|
-
//#region src/hooks/useBuildSideDialogsController.tsx
|
|
437
|
-
function useBuildSideDialogsController() {
|
|
438
|
-
const location = useLocation();
|
|
439
|
-
const navigate = useNavigate();
|
|
440
|
-
const locationRef = useRef(location);
|
|
441
|
-
locationRef.current = location;
|
|
442
|
-
const [sidePanels, setSidePanels] = useState([]);
|
|
443
|
-
const sidePanelsRef = useRef(sidePanels);
|
|
444
|
-
const routesStore = useRef({});
|
|
445
|
-
const routesCount = useRef(0);
|
|
446
|
-
const updateSidePanels = useCallback((newPanels) => {
|
|
447
|
-
sidePanelsRef.current = newPanels;
|
|
448
|
-
setSidePanels(newPanels);
|
|
449
|
-
}, []);
|
|
450
|
-
useEffect(() => {
|
|
451
|
-
const newPanels = (location.state?.panels ?? []).map((key) => routesStore.current[key]).filter((p) => Boolean(p));
|
|
452
|
-
if (!deepEqual(sidePanelsRef.current.map((p) => p.key), newPanels.map((p) => p.key))) {
|
|
453
|
-
updateSidePanels(newPanels);
|
|
454
|
-
if (newPanels.length === 0) routesCount.current = 0;
|
|
455
|
-
}
|
|
456
|
-
}, [location]);
|
|
457
|
-
const close = useCallback(() => {
|
|
458
|
-
const currentPanels = sidePanelsRef.current;
|
|
459
|
-
if (currentPanels.length === 0) return;
|
|
460
|
-
const lastSidePanel = currentPanels[currentPanels.length - 1];
|
|
461
|
-
const updatedPanels = [...currentPanels.slice(0, -1)];
|
|
462
|
-
updateSidePanels(updatedPanels);
|
|
463
|
-
if (routesCount.current > 0) {
|
|
464
|
-
if (lastSidePanel.urlPath) navigate(-1);
|
|
465
|
-
routesCount.current--;
|
|
466
|
-
} else if (lastSidePanel.parentUrlPath) {
|
|
467
|
-
const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
|
|
468
|
-
navigate(lastSidePanel.parentUrlPath, {
|
|
469
|
-
replace: true,
|
|
470
|
-
state: {
|
|
471
|
-
base_location: baseLocation,
|
|
472
|
-
panels: updatedPanels.map((p) => p.key)
|
|
473
|
-
}
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
}, [navigate]);
|
|
477
|
-
const open = useCallback((panelProps) => {
|
|
478
|
-
const newPanels = Array.isArray(panelProps) ? panelProps : [panelProps];
|
|
479
|
-
newPanels.forEach((panel) => {
|
|
480
|
-
routesStore.current[panel.key] = panel;
|
|
481
|
-
});
|
|
482
|
-
routesCount.current = routesCount.current + newPanels.length;
|
|
483
|
-
const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
|
|
484
|
-
const updatedPanels = [...sidePanelsRef.current, ...newPanels];
|
|
485
|
-
updateSidePanels(updatedPanels);
|
|
486
|
-
newPanels.forEach((panel) => {
|
|
487
|
-
if (panel.urlPath) navigate(panel.urlPath, { state: {
|
|
488
|
-
base_location: baseLocation,
|
|
489
|
-
panels: updatedPanels.map((p) => p.key)
|
|
490
|
-
} });
|
|
491
|
-
});
|
|
492
|
-
}, [navigate]);
|
|
493
|
-
const replace = useCallback((panelProps) => {
|
|
494
|
-
const newPanels = Array.isArray(panelProps) ? panelProps : [panelProps];
|
|
495
|
-
newPanels.forEach((panel) => {
|
|
496
|
-
routesStore.current[panel.key] = panel;
|
|
497
|
-
});
|
|
498
|
-
const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
|
|
499
|
-
const updatedPanels = [...sidePanelsRef.current.slice(0, -newPanels.length), ...newPanels];
|
|
500
|
-
updateSidePanels(updatedPanels);
|
|
501
|
-
newPanels.forEach((panel) => {
|
|
502
|
-
if (panel.urlPath) navigate(panel.urlPath, {
|
|
503
|
-
replace: true,
|
|
504
|
-
state: {
|
|
505
|
-
base_location: baseLocation,
|
|
506
|
-
panels: updatedPanels.map((p) => p.key)
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
});
|
|
510
|
-
}, [navigate]);
|
|
511
|
-
return useMemo(() => ({
|
|
512
|
-
sidePanels,
|
|
513
|
-
setSidePanels: updateSidePanels,
|
|
514
|
-
close,
|
|
515
|
-
open,
|
|
516
|
-
replace
|
|
517
|
-
}), [
|
|
518
|
-
sidePanels,
|
|
519
|
-
updateSidePanels,
|
|
520
|
-
close,
|
|
521
|
-
open,
|
|
522
|
-
replace
|
|
523
|
-
]);
|
|
524
|
-
}
|
|
525
|
-
//#endregion
|
|
526
|
-
//#region src/components/SidePanelProvider.tsx
|
|
527
|
-
/**
|
|
528
|
-
* Provider that builds the SidePanelController and makes it available
|
|
529
|
-
* via the SidePanelControllerContext from @rebasepro/app.
|
|
530
|
-
*
|
|
531
|
-
* After the admin extraction refactor, `useBuildSidePanel` lives
|
|
532
|
-
* in the admin package while the context it feeds into lives in core.
|
|
533
|
-
* This provider bridges the two: place it inside the `<Rebase>` tree and
|
|
534
|
-
* above any component that calls `useSidePanel()`.
|
|
535
|
-
*
|
|
536
|
-
* Also auto-registers the side entity controller and breadcrumbs into the
|
|
537
|
-
* self-assembling Studio bridge (when a StudioBridgeRegistryProvider is
|
|
538
|
-
* mounted above in the tree).
|
|
539
|
-
*
|
|
540
|
-
* @example
|
|
541
|
-
* ```tsx
|
|
542
|
-
* <Rebase ...>
|
|
543
|
-
* {({ loading }) => (
|
|
544
|
-
* <SidePanelProvider>
|
|
545
|
-
* <RebaseRoutes>
|
|
546
|
-
* ...
|
|
547
|
-
* </RebaseRoutes>
|
|
548
|
-
* </SidePanelProvider>
|
|
549
|
-
* )}
|
|
550
|
-
* </Rebase>
|
|
551
|
-
* ```
|
|
552
|
-
*
|
|
553
|
-
* @group Components
|
|
554
|
-
*/
|
|
555
|
-
function SidePanelProvider({ children }) {
|
|
556
|
-
const collectionRegistryController = useCollectionRegistryController();
|
|
557
|
-
const urlController = useUrlController();
|
|
558
|
-
const navigationStateController = useNavigationStateController();
|
|
559
|
-
const sideDialogsController = useBuildSideDialogsController();
|
|
560
|
-
const sidePanelController = useBuildSidePanel(collectionRegistryController, urlController, navigationStateController, sideDialogsController, useAuthController());
|
|
561
|
-
return /* @__PURE__ */ jsx(NavigationBlockerProvider, { children: /* @__PURE__ */ jsx(BreadcrumbsProvider, { children: /* @__PURE__ */ jsx(SideDialogsControllerContext.Provider, {
|
|
562
|
-
value: sideDialogsController,
|
|
563
|
-
children: /* @__PURE__ */ jsxs(SidePanelControllerContext.Provider, {
|
|
564
|
-
value: sidePanelController,
|
|
565
|
-
children: [/* @__PURE__ */ jsx(BridgeAutoRegistrar$1, { sidePanelController }), children]
|
|
566
|
-
})
|
|
567
|
-
}) }) });
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Internal component that auto-registers side entity and breadcrumbs
|
|
571
|
-
* into the Studio bridge. Must be a child of BreadcrumbsProvider.
|
|
572
|
-
*/
|
|
573
|
-
function BridgeAutoRegistrar$1({ sidePanelController }) {
|
|
574
|
-
const breadcrumbs = useBreadcrumbsController();
|
|
575
|
-
useBridgeRegistration("sidePanelController", sidePanelController);
|
|
576
|
-
useBridgeRegistration("breadcrumbs", breadcrumbs);
|
|
577
|
-
return null;
|
|
578
|
-
}
|
|
579
|
-
//#endregion
|
|
580
|
-
//#region src/components/AdminModeSyncer.tsx
|
|
581
|
-
/**
|
|
582
|
-
* A highly customizable utility component that observes react-router routes and
|
|
583
|
-
* actively shifts the internal Rebase `adminModeController` context to match
|
|
584
|
-
* the user's active window segment (e.g., Content vs Studio mode).
|
|
585
|
-
*
|
|
586
|
-
* Placing this anywhere safely inside the Rebase layout automatically triggers
|
|
587
|
-
* UI mode synchronization.
|
|
588
|
-
*/
|
|
589
|
-
function AdminModeSyncer({ devViews }) {
|
|
590
|
-
const location = useLocation();
|
|
591
|
-
const urlController = useUrlController();
|
|
592
|
-
const adminModeController = useAdminModeController();
|
|
593
|
-
const currentModeRef = React.useRef(adminModeController.mode);
|
|
594
|
-
currentModeRef.current = adminModeController.mode;
|
|
595
|
-
const setModeRef = React.useRef(adminModeController.setMode);
|
|
596
|
-
setModeRef.current = adminModeController.setMode;
|
|
597
|
-
useEffect(() => {
|
|
598
|
-
const path = location.pathname;
|
|
599
|
-
const isContentRoute = urlController.isUrlCollectionPath(path) || path === urlController.basePath;
|
|
600
|
-
const studioHomePath = urlController.basePath === "/" ? "/s" : `${urlController.basePath}/s`;
|
|
601
|
-
if ((path === studioHomePath || path.startsWith(studioHomePath + "/") || devViews?.some((view) => {
|
|
602
|
-
const viewPath = urlController.buildAppUrlPath(view.slug);
|
|
603
|
-
return path.startsWith(`${viewPath}/`) || path === viewPath;
|
|
604
|
-
})) && currentModeRef.current !== "studio") setModeRef.current("studio");
|
|
605
|
-
else if (isContentRoute && currentModeRef.current !== "cms") setModeRef.current("cms");
|
|
606
|
-
}, [
|
|
607
|
-
location.pathname,
|
|
608
|
-
urlController,
|
|
609
|
-
devViews
|
|
610
|
-
]);
|
|
611
|
-
return null;
|
|
612
|
-
}
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region src/components/app/useApp.tsx
|
|
615
|
-
var AppContext = React.createContext({
|
|
616
|
-
hasDrawer: false,
|
|
617
|
-
drawerHovered: false,
|
|
618
|
-
drawerOpen: false,
|
|
619
|
-
openDrawer: () => {
|
|
620
|
-
throw new Error("openDrawer not implemented");
|
|
621
|
-
},
|
|
622
|
-
closeDrawer: () => {
|
|
623
|
-
throw new Error("closeDrawer not implemented");
|
|
624
|
-
},
|
|
625
|
-
closeHover: () => {
|
|
626
|
-
throw new Error("closeHover not implemented");
|
|
627
|
-
},
|
|
628
|
-
autoOpenDrawer: false
|
|
629
|
-
});
|
|
630
|
-
function useApp() {
|
|
631
|
-
return React.useContext(AppContext);
|
|
632
|
-
}
|
|
633
|
-
//#endregion
|
|
634
|
-
//#region src/components/DefaultAppBar.tsx
|
|
635
|
-
/**
|
|
636
|
-
* This component renders the main app bar of Rebase.
|
|
637
|
-
* You will likely not need to use this component directly.
|
|
638
|
-
*
|
|
639
|
-
|
|
640
|
-
*/
|
|
641
|
-
var DefaultAppBar = function DefaultAppBar({ title, endAdornment, startAdornment, dropDownActions, includeModeToggle = true, includeLanguageToggle = true, includeUserMenu = true, className, style, user: userProp, logo: logoProp }) {
|
|
642
|
-
const { hasDrawer, drawerOpen, logo: appLogo } = useApp();
|
|
643
|
-
const logo = logoProp ?? appLogo;
|
|
644
|
-
const navigation = useUrlController();
|
|
645
|
-
const breadcrumbs = useBreadcrumbsController();
|
|
646
|
-
const authController = useAuthController();
|
|
647
|
-
useAdminModeController();
|
|
648
|
-
const { mode, setMode } = useModeController();
|
|
649
|
-
const navigate = useNavigate();
|
|
650
|
-
const largeLayout = useLargeLayout();
|
|
651
|
-
const user = userProp ?? authController.user;
|
|
652
|
-
const { t } = useTranslation();
|
|
653
|
-
const rebaseContext = useRebaseContext();
|
|
654
|
-
const slotProps = React.useMemo(() => ({ context: rebaseContext }), [rebaseContext]);
|
|
655
|
-
const globalSearch = useSlot("global.search", slotProps);
|
|
656
|
-
const shellToolbar = useSlot("shell.toolbar", slotProps);
|
|
657
|
-
let avatarComponent;
|
|
658
|
-
if (user) {
|
|
659
|
-
const initial = user?.displayName ? user.displayName[0].toUpperCase() : user?.email ? user.email[0].toUpperCase() : "A";
|
|
660
|
-
avatarComponent = /* @__PURE__ */ jsx(Avatar, {
|
|
661
|
-
src: user.photoURL ?? void 0,
|
|
662
|
-
children: initial
|
|
663
|
-
});
|
|
664
|
-
} else if (user === void 0 || authController.initialLoading) avatarComponent = /* @__PURE__ */ jsx("div", {
|
|
665
|
-
className: "p-1 flex justify-center",
|
|
666
|
-
children: /* @__PURE__ */ jsx(Skeleton, { className: "w-10 h-10 rounded-full" })
|
|
667
|
-
});
|
|
668
|
-
else avatarComponent = null;
|
|
669
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
670
|
-
style,
|
|
671
|
-
role: "banner",
|
|
672
|
-
className: cls("w-full h-14 transition-all ease-in duration-75 absolute top-0 max-w-full overflow-x-auto no-scrollbar", "flex flex-row gap-2 px-4 items-center", "backdrop-blur-sm bg-surface-frame/90", {
|
|
673
|
-
"pl-[19rem]": drawerOpen && largeLayout,
|
|
674
|
-
"pl-24": hasDrawer && !(drawerOpen && largeLayout),
|
|
675
|
-
"z-10": largeLayout,
|
|
676
|
-
"duration-100": drawerOpen && largeLayout
|
|
677
|
-
}, className),
|
|
678
|
-
children: [
|
|
679
|
-
navigation && (!hasDrawer || title) && /* @__PURE__ */ jsx("div", {
|
|
680
|
-
className: "mr-2 hidden lg:block",
|
|
681
|
-
children: /* @__PURE__ */ jsx(Link, {
|
|
682
|
-
className: "visited:text-inherit dark:visited:text-inherit block",
|
|
683
|
-
to: navigation?.basePath ?? "/",
|
|
684
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
685
|
-
className: "flex flex-row gap-4",
|
|
686
|
-
children: [!hasDrawer && (logo ? /* @__PURE__ */ jsx("img", {
|
|
687
|
-
src: logo,
|
|
688
|
-
alt: "Logo",
|
|
689
|
-
className: cls("w-[32px] h-[32px] object-contain")
|
|
690
|
-
}) : /* @__PURE__ */ jsx(RebaseLogo, {
|
|
691
|
-
width: "32px",
|
|
692
|
-
height: "32px"
|
|
693
|
-
})), typeof title === "string" ? /* @__PURE__ */ jsx(Typography, {
|
|
694
|
-
variant: "subtitle1",
|
|
695
|
-
noWrap: true,
|
|
696
|
-
children: title
|
|
697
|
-
}) : title]
|
|
698
|
-
})
|
|
699
|
-
})
|
|
700
|
-
}),
|
|
701
|
-
/* @__PURE__ */ jsx("div", {
|
|
702
|
-
className: "mr-8 hidden lg:block",
|
|
703
|
-
children: /* @__PURE__ */ jsx("nav", {
|
|
704
|
-
"aria-label": "Breadcrumb",
|
|
705
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
706
|
-
className: "flex flex-row gap-2 items-center",
|
|
707
|
-
children: breadcrumbs.breadcrumbs.map((breadcrumb, index) => {
|
|
708
|
-
return /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 && /* @__PURE__ */ jsx(Typography, {
|
|
709
|
-
variant: "caption",
|
|
710
|
-
color: "secondary",
|
|
711
|
-
children: "/"
|
|
712
|
-
}), /* @__PURE__ */ jsx(Link, {
|
|
713
|
-
className: "visited:text-inherit dark:visited:text-inherit block",
|
|
714
|
-
to: breadcrumb.url,
|
|
715
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
716
|
-
className: "flex flex-row items-center gap-2 whitespace-nowrap",
|
|
717
|
-
children: /* @__PURE__ */ jsx(Typography, {
|
|
718
|
-
variant: "body2",
|
|
719
|
-
children: breadcrumb.title
|
|
720
|
-
})
|
|
721
|
-
})
|
|
722
|
-
}, index)] }, breadcrumb.url + "_" + index);
|
|
723
|
-
})
|
|
724
|
-
})
|
|
725
|
-
})
|
|
726
|
-
}),
|
|
727
|
-
startAdornment,
|
|
728
|
-
globalSearch,
|
|
729
|
-
/* @__PURE__ */ jsx("div", { className: "grow" }),
|
|
730
|
-
endAdornment && /* @__PURE__ */ jsx(ErrorBoundary, { children: endAdornment }),
|
|
731
|
-
shellToolbar,
|
|
732
|
-
includeLanguageToggle && /* @__PURE__ */ jsx(LanguageToggle, {}),
|
|
733
|
-
includeModeToggle && /* @__PURE__ */ jsxs(Menu, {
|
|
734
|
-
trigger: /* @__PURE__ */ jsx(IconButton, {
|
|
735
|
-
"aria-label": "Toggle theme",
|
|
736
|
-
children: mode === "dark" ? /* @__PURE__ */ jsx(MoonIcon, { size: iconSize.small }) : /* @__PURE__ */ jsx(SunIcon, { size: iconSize.small })
|
|
737
|
-
}),
|
|
738
|
-
children: [
|
|
739
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
740
|
-
onClick: () => setMode("dark"),
|
|
741
|
-
children: [
|
|
742
|
-
/* @__PURE__ */ jsx(MoonIcon, { size: iconSize.smallest }),
|
|
743
|
-
" ",
|
|
744
|
-
t("dark_mode")
|
|
745
|
-
]
|
|
746
|
-
}),
|
|
747
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
748
|
-
onClick: () => setMode("light"),
|
|
749
|
-
children: [
|
|
750
|
-
/* @__PURE__ */ jsx(SunIcon, { size: iconSize.smallest }),
|
|
751
|
-
" ",
|
|
752
|
-
t("light_mode"),
|
|
753
|
-
" "
|
|
754
|
-
]
|
|
755
|
-
}),
|
|
756
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
757
|
-
onClick: () => setMode("system"),
|
|
758
|
-
children: [
|
|
759
|
-
" ",
|
|
760
|
-
/* @__PURE__ */ jsx(SunMoonIcon, { size: iconSize.smallest }),
|
|
761
|
-
t("system_mode")
|
|
762
|
-
]
|
|
763
|
-
})
|
|
764
|
-
]
|
|
765
|
-
}),
|
|
766
|
-
includeUserMenu && /* @__PURE__ */ jsxs(Menu, {
|
|
767
|
-
trigger: /* @__PURE__ */ jsx("div", {
|
|
768
|
-
"aria-label": "User menu",
|
|
769
|
-
role: "button",
|
|
770
|
-
children: avatarComponent
|
|
771
|
-
}),
|
|
772
|
-
children: [
|
|
773
|
-
user && /* @__PURE__ */ jsxs("div", {
|
|
774
|
-
className: "px-4 py-2 mb-2",
|
|
775
|
-
children: [user.displayName && /* @__PURE__ */ jsx(Typography, {
|
|
776
|
-
variant: "body1",
|
|
777
|
-
color: "secondary",
|
|
778
|
-
children: user.displayName
|
|
779
|
-
}), user.email && /* @__PURE__ */ jsx(Typography, {
|
|
780
|
-
variant: "body2",
|
|
781
|
-
color: "secondary",
|
|
782
|
-
children: user.email
|
|
783
|
-
})]
|
|
784
|
-
}),
|
|
785
|
-
dropDownActions,
|
|
786
|
-
!dropDownActions && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(MenuItem, {
|
|
787
|
-
onClick: () => navigate("/settings"),
|
|
788
|
-
children: [/* @__PURE__ */ jsx(SettingsIcon, {}), t("account_settings")]
|
|
789
|
-
}), /* @__PURE__ */ jsxs(MenuItem, {
|
|
790
|
-
onClick: async () => {
|
|
791
|
-
await authController.signOut();
|
|
792
|
-
navigate("/");
|
|
793
|
-
},
|
|
794
|
-
children: [/* @__PURE__ */ jsx(LogOutIcon, {}), t("log_out")]
|
|
795
|
-
})] })
|
|
796
|
-
]
|
|
797
|
-
})
|
|
798
|
-
]
|
|
799
|
-
});
|
|
800
|
-
};
|
|
801
|
-
//#endregion
|
|
802
|
-
//#region src/components/app/AppBar.tsx
|
|
803
|
-
/**
|
|
804
|
-
* This component renders the main app bar of Rebase.
|
|
805
|
-
*/
|
|
806
|
-
function AppBar({ children, ...props }) {
|
|
807
|
-
return /* @__PURE__ */ jsx(Fragment, { children: children ?? /* @__PURE__ */ jsx(DefaultAppBar, { ...props }) });
|
|
808
|
-
}
|
|
809
|
-
AppBar.componentType = "AppBar";
|
|
810
|
-
//#endregion
|
|
811
|
-
//#region src/components/DrawerNavigationItem.tsx
|
|
812
|
-
function DrawerNavigationItem({ name, icon, drawerOpen, url, onClick, indented = false }) {
|
|
813
|
-
const iconSlot = "w-[44px]";
|
|
814
|
-
const iconWrap = indented ? /* @__PURE__ */ jsx("div", {
|
|
815
|
-
className: cls("shrink-0 h-[30px]", iconSlot),
|
|
816
|
-
"aria-hidden": true
|
|
817
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
818
|
-
className: cls("shrink-0 flex items-center justify-center h-[30px] text-surface-500 dark:text-text-secondary-dark [&>svg]:size-4 group-hover/nav:text-primary transition-colors duration-150", iconSlot),
|
|
819
|
-
children: icon
|
|
820
|
-
});
|
|
821
|
-
const [wantsTooltip, setWantsTooltip] = React.useState(false);
|
|
822
|
-
if (drawerOpen && wantsTooltip) setWantsTooltip(false);
|
|
823
|
-
const listItem = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(NavLink, {
|
|
824
|
-
onClick,
|
|
825
|
-
"aria-label": name,
|
|
826
|
-
style: {
|
|
827
|
-
width: "100%",
|
|
828
|
-
transition: drawerOpen ? "width 150ms ease-in" : void 0
|
|
829
|
-
},
|
|
830
|
-
className: ({ isActive }) => cls("rounded-lg truncate group/nav", "hover:bg-surface-hover text-surface-700 dark:text-surface-300 hover:text-surface-900 dark:hover:text-white", "flex flex-row items-center", drawerOpen ? "pr-4 h-[30px]" : "h-[30px]", "font-medium text-[13px]", isActive ? "bg-primary/8 dark:bg-primary/10 text-primary dark:text-primary [&_div]:text-primary" : ""),
|
|
831
|
-
to: url,
|
|
832
|
-
children: [iconWrap, /* @__PURE__ */ jsx("div", {
|
|
833
|
-
className: cls("text-text-primary dark:text-surface-200", drawerOpen ? "opacity-100" : "opacity-0 hidden", "font-inherit truncate space-x-2"),
|
|
834
|
-
children: name
|
|
835
|
-
})]
|
|
836
|
-
}) });
|
|
837
|
-
return /* @__PURE__ */ jsx(Tooltip, {
|
|
838
|
-
open: !drawerOpen && wantsTooltip,
|
|
839
|
-
onOpenChange: setWantsTooltip,
|
|
840
|
-
side: "right",
|
|
841
|
-
title: name,
|
|
842
|
-
children: listItem
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
//#endregion
|
|
846
|
-
//#region src/components/DrawerNavigationGroup.tsx
|
|
847
|
-
/**
|
|
848
|
-
* Shared drawer navigation group component used by both DefaultDrawer and RebaseCloudDrawer.
|
|
849
|
-
* Renders a collapsible group with header and navigation items.
|
|
850
|
-
*/
|
|
851
|
-
function DrawerNavigationGroup({ group, entries, collapsed, onToggleCollapsed, drawerOpen, headerActions, onItemClick, hideHeader, icon }) {
|
|
852
|
-
const groupLabel = useNavigationGroupLabel();
|
|
853
|
-
const ResolvedDrawerNavigationItem = useComponentOverride("Shell.DrawerNavigationItem", DrawerNavigationItem);
|
|
854
|
-
const groupIcon = !hideHeader && drawerOpen ? getIcon(icon, void 0, void 0, "small") : void 0;
|
|
855
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
856
|
-
className: "my-2 mx-2 flex flex-col",
|
|
857
|
-
children: [!hideHeader && /* @__PURE__ */ jsxs("div", {
|
|
858
|
-
className: cls("pl-3 pr-2 py-0.5 flex flex-row items-center transition-colors", drawerOpen ? "cursor-pointer hover:bg-surface-hover rounded-lg" : "opacity-0 invisible pointer-events-none"),
|
|
859
|
-
onClick: drawerOpen ? onToggleCollapsed : void 0,
|
|
860
|
-
children: [
|
|
861
|
-
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
862
|
-
size: iconSize.small,
|
|
863
|
-
className: cls("text-surface-400 dark:text-surface-400 transition-transform duration-200 mr-1", collapsed ? "-rotate-90" : "rotate-0")
|
|
864
|
-
}),
|
|
865
|
-
groupIcon && /* @__PURE__ */ jsx("span", {
|
|
866
|
-
className: "shrink-0 mr-2 flex items-center text-surface-600 dark:text-surface-300 [&>svg]:size-4",
|
|
867
|
-
children: groupIcon
|
|
868
|
-
}),
|
|
869
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
870
|
-
variant: "caption",
|
|
871
|
-
color: "secondary",
|
|
872
|
-
className: "font-semibold text-[11px] uppercase tracking-wider flex-grow line-clamp-1 text-surface-400 dark:text-surface-400",
|
|
873
|
-
children: groupLabel(group || "Views")
|
|
874
|
-
}),
|
|
875
|
-
headerActions && /* @__PURE__ */ jsx("div", {
|
|
876
|
-
onClick: (e) => e.stopPropagation(),
|
|
877
|
-
children: headerActions
|
|
878
|
-
})
|
|
879
|
-
]
|
|
880
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
881
|
-
className: cls("transition-all duration-200 ease-in-out", "overflow-hidden", !hideHeader && "dark:bg-transparent", "rounded-lg", !hideHeader && collapsed ? "max-h-0 opacity-0" : "max-h-[2000px] opacity-100"),
|
|
882
|
-
children: entries.map((entry) => /* @__PURE__ */ jsx(ResolvedDrawerNavigationItem, {
|
|
883
|
-
icon: /* @__PURE__ */ jsx(IconForView, {
|
|
884
|
-
collectionOrView: entry.collection ?? entry.view,
|
|
885
|
-
size: "small"
|
|
886
|
-
}),
|
|
887
|
-
drawerOpen,
|
|
888
|
-
onClick: () => onItemClick?.(entry),
|
|
889
|
-
url: entry.url,
|
|
890
|
-
name: entry.name
|
|
891
|
-
}, entry.id))
|
|
892
|
-
})]
|
|
893
|
-
}, `drawer_group_${group}`);
|
|
894
|
-
}
|
|
895
|
-
//#endregion
|
|
896
|
-
//#region src/components/DefaultDrawer.tsx
|
|
897
|
-
/**
|
|
898
|
-
* Default drawer used in the admin.
|
|
899
|
-
*
|
|
900
|
-
* When no `children` are provided, renders the full admin navigation
|
|
901
|
-
* (collection groups, mode switch, plugin slots).
|
|
902
|
-
*
|
|
903
|
-
* When `children` **are** provided, renders the shared drawer shell
|
|
904
|
-
* (logo, scrollable area, footer actions, collapse toggle) with the
|
|
905
|
-
* custom content injected in the scrollable area. This lets consumers
|
|
906
|
-
* like the SaaS dashboard reuse the identical structural layout while
|
|
907
|
-
* supplying their own navigation items.
|
|
908
|
-
*
|
|
909
|
-
* @group Core
|
|
910
|
-
*/
|
|
911
|
-
function DefaultDrawer({ title, logo, logoDestination, children, footerActions, className, style }) {
|
|
912
|
-
const { drawerHovered, drawerOpen, openDrawer, closeDrawer, logo: appLogo } = useApp();
|
|
913
|
-
const resolvedLogo = logo ?? appLogo;
|
|
914
|
-
const scrollRef = React.useRef(null);
|
|
915
|
-
const [scrolled, setScrolled] = React.useState(false);
|
|
916
|
-
const handleScroll = () => {
|
|
917
|
-
if (scrollRef.current) setScrolled(scrollRef.current.scrollTop > 0);
|
|
918
|
-
};
|
|
919
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
920
|
-
role: "navigation",
|
|
921
|
-
"aria-label": "Main navigation",
|
|
922
|
-
className: cls("flex flex-col h-full relative grow w-full", className),
|
|
923
|
-
style,
|
|
924
|
-
children: [
|
|
925
|
-
/* @__PURE__ */ jsx(DrawerLogo, {
|
|
926
|
-
logo: resolvedLogo,
|
|
927
|
-
title,
|
|
928
|
-
logoDestination,
|
|
929
|
-
drawerOpen,
|
|
930
|
-
drawerHovered
|
|
931
|
-
}),
|
|
932
|
-
/* @__PURE__ */ jsx("div", {
|
|
933
|
-
ref: scrollRef,
|
|
934
|
-
onScroll: handleScroll,
|
|
935
|
-
className: "flex-grow min-h-0 overflow-y-auto overflow-x-hidden no-scrollbar px-2",
|
|
936
|
-
style: { maskImage: scrolled ? "linear-gradient(to bottom, transparent 0, black 20px, black calc(100% - 20px), transparent 100%)" : "linear-gradient(to bottom, black 0, black calc(100% - 20px), transparent 100%)" },
|
|
937
|
-
children: children ?? /* @__PURE__ */ jsx(AdminNavigationContent, {})
|
|
938
|
-
}),
|
|
939
|
-
footerActions !== null && (footerActions !== void 0 ? footerActions : /* @__PURE__ */ jsx(DrawerFooterActions, {
|
|
940
|
-
drawerOpen,
|
|
941
|
-
drawerHovered
|
|
942
|
-
})),
|
|
943
|
-
/* @__PURE__ */ jsx(DrawerToggle, {
|
|
944
|
-
drawerOpen,
|
|
945
|
-
drawerHovered,
|
|
946
|
-
openDrawer,
|
|
947
|
-
closeDrawer
|
|
948
|
-
})
|
|
949
|
-
]
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
/**
|
|
953
|
-
* Default admin navigation content — rendered inside DefaultDrawer when no
|
|
954
|
-
* custom `children` are provided. Contains the mode switch, navigation
|
|
955
|
-
* groups, and header / footer plugin slots.
|
|
956
|
-
*/
|
|
957
|
-
function AdminNavigationContent() {
|
|
958
|
-
const { drawerHovered, drawerOpen, closeDrawer, closeHover } = useApp();
|
|
959
|
-
const analyticsController = useAnalyticsController();
|
|
960
|
-
const navigationState = useNavigationStateController();
|
|
961
|
-
const context = useRebaseContext();
|
|
962
|
-
const largeLayout = useLargeLayout();
|
|
963
|
-
const adminModeController = useAdminModeController();
|
|
964
|
-
const registry = useRebaseRegistry();
|
|
965
|
-
const ResolvedDrawerNavigationGroup = useComponentOverride("Shell.DrawerNavigationGroup", DrawerNavigationGroup);
|
|
966
|
-
const allNavigationEntries = navigationState.topLevelNavigation?.navigationEntries ?? [];
|
|
967
|
-
const studioViewSlugs = useMemo(() => {
|
|
968
|
-
const slugs = /* @__PURE__ */ new Set();
|
|
969
|
-
(registry.studioConfig?.devViews ?? []).forEach((v) => slugs.add(v.slug));
|
|
970
|
-
if (registry.studioConfig && registry.cmsConfig?.collectionEditor) slugs.add("schema");
|
|
971
|
-
return slugs;
|
|
972
|
-
}, [registry.studioConfig, registry.cmsConfig?.collectionEditor]);
|
|
973
|
-
const filteredEntries = adminModeController.mode === "studio" ? allNavigationEntries.filter((e) => e.type === "view" && studioViewSlugs.has(e.slug) || e.type === "admin") : allNavigationEntries.filter((e) => e.type !== "view" || !studioViewSlugs.has(e.slug));
|
|
974
|
-
const entryGroups = new Set(filteredEntries.map((e) => e.group).filter(Boolean));
|
|
975
|
-
const orderedGroups = navigationState.topLevelNavigation?.groups ?? [];
|
|
976
|
-
const groupsToRender = [...orderedGroups.filter((g) => entryGroups.has(g)), ...[...entryGroups].filter((g) => !orderedGroups.includes(g))];
|
|
977
|
-
const groupIcons = useMemo(() => {
|
|
978
|
-
const icons = /* @__PURE__ */ new Map();
|
|
979
|
-
(registry.cmsConfig?.navigationGroupMappings ?? []).forEach((mapping) => {
|
|
980
|
-
if (mapping.icon) icons.set(mapping.name, mapping.icon);
|
|
981
|
-
});
|
|
982
|
-
return icons;
|
|
983
|
-
}, [registry.cmsConfig?.navigationGroupMappings]);
|
|
984
|
-
const { isGroupCollapsed, toggleGroupCollapsed } = useCollapsedGroups(groupsToRender, "drawer", useMemo(() => buildCollapsedDefaults(registry.cmsConfig?.navigationGroupMappings, "drawer"), [registry.cmsConfig?.navigationGroupMappings]));
|
|
985
|
-
const headerSlot = useSlot("navigation.header", {
|
|
986
|
-
drawerOpen,
|
|
987
|
-
drawerHovered,
|
|
988
|
-
context
|
|
989
|
-
});
|
|
990
|
-
const footerSlot = useSlot("navigation.footer", {
|
|
991
|
-
drawerOpen,
|
|
992
|
-
drawerHovered,
|
|
993
|
-
context
|
|
994
|
-
});
|
|
995
|
-
if (!navigationState.topLevelNavigation) return null;
|
|
996
|
-
const onItemClick = (view) => {
|
|
997
|
-
const eventName = view.type === "collection" ? "drawer_navigate_to_collection" : view.type === "view" ? "drawer_navigate_to_view" : "unmapped_event";
|
|
998
|
-
analyticsController.onAnalyticsEvent?.(eventName, { url: view.url });
|
|
999
|
-
if (!largeLayout) closeDrawer();
|
|
1000
|
-
else if (!drawerOpen) closeHover();
|
|
1001
|
-
};
|
|
1002
|
-
const drawerVisuallyOpen = drawerOpen || drawerHovered;
|
|
1003
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1004
|
-
registry.studioConfig && /* @__PURE__ */ jsx(DrawerModeSwitch, {
|
|
1005
|
-
drawerOpen,
|
|
1006
|
-
drawerHovered
|
|
1007
|
-
}),
|
|
1008
|
-
headerSlot,
|
|
1009
|
-
groupsToRender.map((group) => {
|
|
1010
|
-
const entriesInGroup = filteredEntries.filter((e) => e.group === group);
|
|
1011
|
-
return /* @__PURE__ */ jsx(ResolvedDrawerNavigationGroup, {
|
|
1012
|
-
group,
|
|
1013
|
-
entries: entriesInGroup,
|
|
1014
|
-
collapsed: isGroupCollapsed(group),
|
|
1015
|
-
onToggleCollapsed: () => toggleGroupCollapsed(group),
|
|
1016
|
-
drawerOpen: drawerVisuallyOpen,
|
|
1017
|
-
onItemClick,
|
|
1018
|
-
icon: groupIcons.get(group)
|
|
1019
|
-
}, `drawer_group_${group}`);
|
|
1020
|
-
}),
|
|
1021
|
-
footerSlot
|
|
1022
|
-
] });
|
|
1023
|
-
}
|
|
1024
|
-
function DrawerLogo({ logo, title, logoDestination = "/", drawerOpen, drawerHovered }) {
|
|
1025
|
-
const showFullContent = drawerOpen || drawerHovered;
|
|
1026
|
-
const { t } = useTranslation();
|
|
1027
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1028
|
-
className: "flex flex-row items-center shrink-0 pt-4 pb-0 px-2",
|
|
1029
|
-
children: [/* @__PURE__ */ jsx(Link, {
|
|
1030
|
-
className: "shrink-0 flex items-center justify-center w-[56px] h-[40px]",
|
|
1031
|
-
to: logoDestination,
|
|
1032
|
-
"aria-label": t("home", { defaultValue: "Home" }),
|
|
1033
|
-
children: logo ? /* @__PURE__ */ jsx("img", {
|
|
1034
|
-
src: logo,
|
|
1035
|
-
alt: "Logo",
|
|
1036
|
-
className: "w-[28px] h-[28px] object-contain"
|
|
1037
|
-
}) : /* @__PURE__ */ jsx(RebaseLogo, {
|
|
1038
|
-
width: "28px",
|
|
1039
|
-
height: "28px"
|
|
1040
|
-
})
|
|
1041
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1042
|
-
className: cls("flex flex-row items-center overflow-hidden transition-all duration-200 ease-in-out", showFullContent ? "opacity-100 w-full ml-1" : "opacity-0 w-0 ml-0"),
|
|
1043
|
-
children: title && /* @__PURE__ */ jsx(Link, {
|
|
1044
|
-
className: "visited:text-inherit dark:visited:text-inherit block truncate",
|
|
1045
|
-
to: logoDestination,
|
|
1046
|
-
children: typeof title === "string" ? /* @__PURE__ */ jsx(Typography, {
|
|
1047
|
-
variant: "subtitle1",
|
|
1048
|
-
noWrap: true,
|
|
1049
|
-
className: "truncate",
|
|
1050
|
-
children: title
|
|
1051
|
-
}) : title
|
|
1052
|
-
})
|
|
1053
|
-
})]
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
/**
|
|
1057
|
-
* Toggle button at the bottom of the drawer.
|
|
1058
|
-
* Uses double-chevron icons to indicate collapse/expand direction.
|
|
1059
|
-
*/
|
|
1060
|
-
function DrawerToggle({ drawerOpen, drawerHovered, openDrawer, closeDrawer }) {
|
|
1061
|
-
const isExpanded = drawerOpen;
|
|
1062
|
-
const showFullContent = isExpanded || drawerHovered && !drawerOpen;
|
|
1063
|
-
const [wantsTooltip, setWantsTooltip] = React.useState(false);
|
|
1064
|
-
if (showFullContent && wantsTooltip) setWantsTooltip(false);
|
|
1065
|
-
const { t } = useTranslation();
|
|
1066
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1067
|
-
className: "shrink-0 mt-auto px-4 pt-0.5 pb-2",
|
|
1068
|
-
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
1069
|
-
title: isExpanded ? t("collapse") : t("expand"),
|
|
1070
|
-
open: !showFullContent && wantsTooltip,
|
|
1071
|
-
onOpenChange: setWantsTooltip,
|
|
1072
|
-
side: "right",
|
|
1073
|
-
sideOffset: 12,
|
|
1074
|
-
asChild: true,
|
|
1075
|
-
children: /* @__PURE__ */ jsxs("button", {
|
|
1076
|
-
type: "button",
|
|
1077
|
-
className: cls("flex flex-row items-center rounded-lg cursor-pointer w-full", "hover:bg-surface-hover", "transition-colors duration-150", "py-2"),
|
|
1078
|
-
"aria-expanded": isExpanded,
|
|
1079
|
-
"aria-label": isExpanded ? t("collapse") : t("expand"),
|
|
1080
|
-
onClick: () => isExpanded ? closeDrawer() : openDrawer(),
|
|
1081
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1082
|
-
className: "shrink-0 flex items-center justify-center w-[44px] h-[24px] text-surface-500 dark:text-surface-400",
|
|
1083
|
-
children: isExpanded ? /* @__PURE__ */ jsx(ChevronsLeftIcon, { size: iconSize.small }) : /* @__PURE__ */ jsx(ChevronsRightIcon, { size: iconSize.small })
|
|
1084
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1085
|
-
className: cls("overflow-hidden transition-all duration-200 ease-in-out", showFullContent ? "opacity-100 w-auto" : "opacity-0 w-0"),
|
|
1086
|
-
children: /* @__PURE__ */ jsx(Typography, {
|
|
1087
|
-
variant: "body2",
|
|
1088
|
-
className: "text-surface-500 dark:text-surface-400 select-none whitespace-nowrap",
|
|
1089
|
-
children: isExpanded ? t("collapse") : t("expand")
|
|
1090
|
-
})
|
|
1091
|
-
})]
|
|
1092
|
-
})
|
|
1093
|
-
})
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
/**
|
|
1097
|
-
* Segmented Content / Studio switch rendered inside the drawer.
|
|
1098
|
-
* Animates in/out with the drawer open state via opacity + max-height.
|
|
1099
|
-
*/
|
|
1100
|
-
function DrawerModeSwitch({ drawerOpen, drawerHovered }) {
|
|
1101
|
-
const adminModeController = useAdminModeController();
|
|
1102
|
-
const urlController = useUrlController();
|
|
1103
|
-
const navigate = useNavigate();
|
|
1104
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1105
|
-
className: cls("shrink-0 overflow-hidden transition-all duration-200 ease-in-out px-3", drawerOpen || drawerHovered ? "opacity-100 h-7 mt-2 mb-0" : "opacity-0 pointer-events-none h-7 mt-2 mb-0"),
|
|
1106
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1107
|
-
role: "group",
|
|
1108
|
-
"aria-label": "Panel mode",
|
|
1109
|
-
className: "flex bg-surface-field rounded-lg p-0.5",
|
|
1110
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
1111
|
-
onClick: () => {
|
|
1112
|
-
adminModeController.setMode("cms");
|
|
1113
|
-
navigate(urlController.basePath ?? "/");
|
|
1114
|
-
},
|
|
1115
|
-
"aria-pressed": adminModeController.mode === "cms",
|
|
1116
|
-
className: cls("flex-1 px-3 py-0.5 text-xs font-medium rounded-md transition-all text-center", adminModeController.mode === "cms" ? "bg-surface-lifted shadow-sm text-text-primary dark:text-text-primary-dark" : "text-surface-500 hover:text-surface-900 dark:hover:text-white"),
|
|
1117
|
-
children: "CMS"
|
|
1118
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
1119
|
-
onClick: () => {
|
|
1120
|
-
adminModeController.setMode("studio");
|
|
1121
|
-
navigate(urlController.basePath === "/" ? "/s" : `${urlController.basePath ?? ""}/s`);
|
|
1122
|
-
},
|
|
1123
|
-
"aria-pressed": adminModeController.mode === "studio",
|
|
1124
|
-
className: cls("flex-1 px-3 py-0.5 text-xs font-medium rounded-md transition-all text-center", adminModeController.mode === "studio" ? "bg-surface-lifted shadow-sm text-text-primary dark:text-text-primary-dark" : "text-surface-500 hover:text-surface-900 dark:hover:text-white"),
|
|
1125
|
-
children: "Studio"
|
|
1126
|
-
})]
|
|
1127
|
-
})
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Footer actions rendered at the bottom of the drawer, above the collapse/expand toggle.
|
|
1132
|
-
* Replaces the app bar icons (language, theme, user avatar) with a drawer-native layout
|
|
1133
|
-
* that adapts between collapsed (icons only) and expanded (full labels + user bar) states.
|
|
1134
|
-
*
|
|
1135
|
-
* @group Core
|
|
1136
|
-
*/
|
|
1137
|
-
function DrawerFooterActions({ drawerOpen, drawerHovered, dropDownActions, user: userProp }) {
|
|
1138
|
-
const authController = useAuthController();
|
|
1139
|
-
const { mode, setMode } = useModeController();
|
|
1140
|
-
const navigate = useNavigate();
|
|
1141
|
-
const { t } = useTranslation();
|
|
1142
|
-
const user = userProp ?? authController.user;
|
|
1143
|
-
const showFullContent = drawerOpen || drawerHovered;
|
|
1144
|
-
const portalRef = React.useRef(null);
|
|
1145
|
-
let avatarComponent;
|
|
1146
|
-
if (user) {
|
|
1147
|
-
const initial = user?.displayName ? user.displayName[0].toUpperCase() : user?.email ? user.email[0].toUpperCase() : "A";
|
|
1148
|
-
avatarComponent = /* @__PURE__ */ jsx(Avatar, {
|
|
1149
|
-
src: user.photoURL ?? void 0,
|
|
1150
|
-
className: "w-8 h-8 text-xs",
|
|
1151
|
-
children: initial
|
|
1152
|
-
});
|
|
1153
|
-
} else if (user === void 0 || authController.initialLoading) avatarComponent = /* @__PURE__ */ jsx(Skeleton, { className: "w-8 h-8 rounded-full" });
|
|
1154
|
-
else avatarComponent = null;
|
|
1155
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1156
|
-
className: "shrink-0 pt-2 pb-0",
|
|
1157
|
-
ref: portalRef,
|
|
1158
|
-
children: avatarComponent && /* @__PURE__ */ jsxs("div", {
|
|
1159
|
-
className: "flex items-center px-[16px] py-1",
|
|
1160
|
-
children: [/* @__PURE__ */ jsxs(Menu, {
|
|
1161
|
-
trigger: /* @__PURE__ */ jsx("div", {
|
|
1162
|
-
className: cls("shrink-0 flex items-center justify-center w-[44px] cursor-pointer", "rounded-md py-1", "hover:bg-surface-hover", "transition-colors duration-150"),
|
|
1163
|
-
role: "button",
|
|
1164
|
-
tabIndex: 0,
|
|
1165
|
-
"aria-label": t("user_menu", { defaultValue: "User menu" }),
|
|
1166
|
-
children: avatarComponent
|
|
1167
|
-
}),
|
|
1168
|
-
side: "top",
|
|
1169
|
-
align: "start",
|
|
1170
|
-
children: [
|
|
1171
|
-
user && /* @__PURE__ */ jsxs("div", {
|
|
1172
|
-
className: "px-4 py-2 mb-1",
|
|
1173
|
-
children: [user.displayName && /* @__PURE__ */ jsx(Typography, {
|
|
1174
|
-
variant: "body1",
|
|
1175
|
-
color: "secondary",
|
|
1176
|
-
children: user.displayName
|
|
1177
|
-
}), user.email && /* @__PURE__ */ jsx(Typography, {
|
|
1178
|
-
variant: "body2",
|
|
1179
|
-
color: "secondary",
|
|
1180
|
-
children: user.email
|
|
1181
|
-
})]
|
|
1182
|
-
}),
|
|
1183
|
-
dropDownActions,
|
|
1184
|
-
!dropDownActions && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(MenuItem, {
|
|
1185
|
-
onClick: () => navigate("/settings"),
|
|
1186
|
-
children: [/* @__PURE__ */ jsx(SettingsIcon, {}), t("account_settings")]
|
|
1187
|
-
}), /* @__PURE__ */ jsxs(MenuItem, {
|
|
1188
|
-
onClick: async () => {
|
|
1189
|
-
await authController.signOut();
|
|
1190
|
-
navigate("/");
|
|
1191
|
-
},
|
|
1192
|
-
children: [/* @__PURE__ */ jsx(LogOutIcon, {}), t("log_out")]
|
|
1193
|
-
})] })
|
|
1194
|
-
]
|
|
1195
|
-
}), showFullContent && /* @__PURE__ */ jsxs("div", {
|
|
1196
|
-
className: "flex items-center gap-0",
|
|
1197
|
-
children: [/* @__PURE__ */ jsx(LanguageToggle, {}), /* @__PURE__ */ jsxs(Menu, {
|
|
1198
|
-
trigger: /* @__PURE__ */ jsx(IconButton, {
|
|
1199
|
-
"aria-label": t("toggle_theme", { defaultValue: "Toggle theme" }),
|
|
1200
|
-
className: "text-surface-500 dark:text-surface-400",
|
|
1201
|
-
children: mode === "dark" ? /* @__PURE__ */ jsx(MoonIcon, { size: iconSize.small }) : mode === "light" ? /* @__PURE__ */ jsx(SunIcon, { size: iconSize.small }) : /* @__PURE__ */ jsx(SunMoonIcon, { size: iconSize.small })
|
|
1202
|
-
}),
|
|
1203
|
-
portalContainer: portalRef.current,
|
|
1204
|
-
side: "top",
|
|
1205
|
-
children: [
|
|
1206
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
1207
|
-
onClick: () => setMode("dark"),
|
|
1208
|
-
children: [
|
|
1209
|
-
/* @__PURE__ */ jsx(MoonIcon, { size: iconSize.smallest }),
|
|
1210
|
-
" ",
|
|
1211
|
-
t("dark_mode")
|
|
1212
|
-
]
|
|
1213
|
-
}),
|
|
1214
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
1215
|
-
onClick: () => setMode("light"),
|
|
1216
|
-
children: [
|
|
1217
|
-
/* @__PURE__ */ jsx(SunIcon, { size: iconSize.smallest }),
|
|
1218
|
-
" ",
|
|
1219
|
-
t("light_mode")
|
|
1220
|
-
]
|
|
1221
|
-
}),
|
|
1222
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
1223
|
-
onClick: () => setMode("system"),
|
|
1224
|
-
children: [
|
|
1225
|
-
/* @__PURE__ */ jsx(SunMoonIcon, { size: iconSize.smallest }),
|
|
1226
|
-
" ",
|
|
1227
|
-
t("system_mode")
|
|
1228
|
-
]
|
|
1229
|
-
})
|
|
1230
|
-
]
|
|
1231
|
-
})]
|
|
1232
|
-
})]
|
|
1233
|
-
})
|
|
1234
|
-
});
|
|
1235
|
-
}
|
|
1236
|
-
//#endregion
|
|
1237
|
-
//#region src/components/app/Drawer.tsx
|
|
1238
|
-
/**
|
|
1239
|
-
* This component is in charge of rendering the drawer.
|
|
1240
|
-
* If you add this component under your {@link Scaffold}, it will be rendered
|
|
1241
|
-
* as a drawer, and the open and close functionality will be handled automatically.
|
|
1242
|
-
* If you want to customise the drawer, you can create your own component and pass it as a child.
|
|
1243
|
-
* For custom drawers, you can use the {@link useApp} to open and close the drawer.
|
|
1244
|
-
*
|
|
1245
|
-
*/
|
|
1246
|
-
function Drawer({ children, title, logo, logoDestination, footerActions, className, style }) {
|
|
1247
|
-
return /* @__PURE__ */ jsx(Fragment, { children: children ?? /* @__PURE__ */ jsx(DefaultDrawer, {
|
|
1248
|
-
title,
|
|
1249
|
-
logo,
|
|
1250
|
-
logoDestination,
|
|
1251
|
-
footerActions,
|
|
1252
|
-
className,
|
|
1253
|
-
style
|
|
1254
|
-
}) });
|
|
1255
|
-
}
|
|
1256
|
-
Drawer.componentType = "Drawer";
|
|
1257
|
-
/**
|
|
1258
|
-
* Namespaced by base path: two admins served from one origin are two different
|
|
1259
|
-
* navigations, and a single key would have them overwrite each other's drawer.
|
|
1260
|
-
*/
|
|
1261
|
-
function drawerOpenStorageKey(basePath) {
|
|
1262
|
-
return `rebase-drawer-open:${basePath || "/"}`;
|
|
1263
|
-
}
|
|
1264
|
-
/** `null` when the user has never toggled the drawer, or storage is unavailable. */
|
|
1265
|
-
function readStoredDrawerOpen(key) {
|
|
1266
|
-
if (typeof window === "undefined") return null;
|
|
1267
|
-
try {
|
|
1268
|
-
const stored = window.localStorage.getItem(key);
|
|
1269
|
-
return stored === null ? null : stored === "true";
|
|
1270
|
-
} catch (e) {
|
|
1271
|
-
return null;
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
function writeStoredDrawerOpen(key, open) {
|
|
1275
|
-
if (typeof window === "undefined") return;
|
|
1276
|
-
try {
|
|
1277
|
-
window.localStorage.setItem(key, String(open));
|
|
1278
|
-
} catch (e) {}
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* This view acts as a scaffold for Rebase.
|
|
1282
|
-
*
|
|
1283
|
-
* It is in charge of displaying the navigation drawer, top bar and main
|
|
1284
|
-
* collection views.
|
|
1285
|
-
* This component needs a parent {@link Rebase}
|
|
1286
|
-
*
|
|
1287
|
-
* @param props
|
|
1288
|
-
|
|
1289
|
-
* @group Core
|
|
1290
|
-
*/
|
|
1291
|
-
var Scaffold = React.memo(function Scaffold(props) {
|
|
1292
|
-
const { children, autoOpenDrawer = true, defaultDrawerOpen = false, logo, className, style, padding = true } = props;
|
|
1293
|
-
const slotOf = (child) => React.isValidElement(child) ? child.type?.componentType : void 0;
|
|
1294
|
-
const childArray = React.Children.toArray(children);
|
|
1295
|
-
const drawerChildren = childArray.filter((child) => slotOf(child) === "Drawer");
|
|
1296
|
-
if (drawerChildren.length > 1) throw Error("Only one Drawer component is allowed in Scaffold");
|
|
1297
|
-
const appBarChildren = childArray.filter((child) => slotOf(child) === "AppBar");
|
|
1298
|
-
if (appBarChildren.length > 1) throw Error("Only one AppBar component is allowed in Scaffold");
|
|
1299
|
-
const otherChildren = childArray.filter((child) => slotOf(child) !== "Drawer" && slotOf(child) !== "AppBar");
|
|
1300
|
-
const includeDrawer = drawerChildren.length > 0;
|
|
1301
|
-
const largeLayout = useLargeLayout();
|
|
1302
|
-
const storageKey = drawerOpenStorageKey(useUrlController().basePath);
|
|
1303
|
-
const [drawerOpen, setDrawerOpenState] = React.useState(defaultDrawerOpen && largeLayout);
|
|
1304
|
-
const [onHover, setOnHover] = React.useState(false);
|
|
1305
|
-
React.useLayoutEffect(() => {
|
|
1306
|
-
const stored = readStoredDrawerOpen(storageKey);
|
|
1307
|
-
if (stored === null) return;
|
|
1308
|
-
setDrawerOpenState(stored && largeLayout);
|
|
1309
|
-
}, [storageKey]);
|
|
1310
|
-
const wasLargeLayout = React.useRef(largeLayout);
|
|
1311
|
-
React.useEffect(() => {
|
|
1312
|
-
if (wasLargeLayout.current === largeLayout) return;
|
|
1313
|
-
wasLargeLayout.current = largeLayout;
|
|
1314
|
-
setDrawerOpenState(largeLayout ? readStoredDrawerOpen(storageKey) ?? defaultDrawerOpen : false);
|
|
1315
|
-
}, [
|
|
1316
|
-
largeLayout,
|
|
1317
|
-
defaultDrawerOpen,
|
|
1318
|
-
storageKey
|
|
1319
|
-
]);
|
|
1320
|
-
const setDrawerOpen = useCallback((open) => {
|
|
1321
|
-
setDrawerOpenState(open);
|
|
1322
|
-
if (!largeLayout) return;
|
|
1323
|
-
writeStoredDrawerOpen(storageKey, open);
|
|
1324
|
-
}, [largeLayout, storageKey]);
|
|
1325
|
-
const collapseWhenPopoverCloses = React.useRef(false);
|
|
1326
|
-
const setOnHoverTrue = useCallback(() => {
|
|
1327
|
-
if (!autoOpenDrawer) return;
|
|
1328
|
-
collapseWhenPopoverCloses.current = false;
|
|
1329
|
-
setOnHover(true);
|
|
1330
|
-
}, [autoOpenDrawer]);
|
|
1331
|
-
const setOnHoverFalse = useCallback(() => {
|
|
1332
|
-
if (document.querySelector("[data-radix-popper-content-wrapper]")) {
|
|
1333
|
-
collapseWhenPopoverCloses.current = true;
|
|
1334
|
-
return;
|
|
1335
|
-
}
|
|
1336
|
-
collapseWhenPopoverCloses.current = false;
|
|
1337
|
-
setOnHover(false);
|
|
1338
|
-
}, []);
|
|
1339
|
-
React.useEffect(() => {
|
|
1340
|
-
if (!onHover) return;
|
|
1341
|
-
const collapseIfOwed = () => {
|
|
1342
|
-
if (!collapseWhenPopoverCloses.current) return;
|
|
1343
|
-
if (document.querySelector("[data-radix-popper-content-wrapper]")) return;
|
|
1344
|
-
collapseWhenPopoverCloses.current = false;
|
|
1345
|
-
setOnHover(false);
|
|
1346
|
-
};
|
|
1347
|
-
const observer = new MutationObserver(collapseIfOwed);
|
|
1348
|
-
observer.observe(document.body, {
|
|
1349
|
-
childList: true,
|
|
1350
|
-
subtree: true
|
|
1351
|
-
});
|
|
1352
|
-
return () => observer.disconnect();
|
|
1353
|
-
}, [onHover]);
|
|
1354
|
-
const handleDrawerOpen = useCallback(() => {
|
|
1355
|
-
setDrawerOpen(true);
|
|
1356
|
-
}, [setDrawerOpen]);
|
|
1357
|
-
const handleDrawerClose = useCallback(() => {
|
|
1358
|
-
setDrawerOpen(false);
|
|
1359
|
-
}, [setDrawerOpen]);
|
|
1360
|
-
const computedDrawerOpen = drawerOpen;
|
|
1361
|
-
const computedDrawerHovered = Boolean(largeLayout && onHover);
|
|
1362
|
-
const hasAppBar = Boolean(appBarChildren.length > 0);
|
|
1363
|
-
const appContextValue = useMemo(() => ({
|
|
1364
|
-
hasDrawer: Boolean(includeDrawer),
|
|
1365
|
-
drawerOpen: computedDrawerOpen,
|
|
1366
|
-
drawerHovered: computedDrawerHovered,
|
|
1367
|
-
openDrawer: handleDrawerOpen,
|
|
1368
|
-
closeDrawer: handleDrawerClose,
|
|
1369
|
-
closeHover: setOnHoverFalse,
|
|
1370
|
-
logo
|
|
1371
|
-
}), [
|
|
1372
|
-
includeDrawer,
|
|
1373
|
-
computedDrawerOpen,
|
|
1374
|
-
computedDrawerHovered,
|
|
1375
|
-
handleDrawerOpen,
|
|
1376
|
-
handleDrawerClose,
|
|
1377
|
-
setOnHoverFalse,
|
|
1378
|
-
logo
|
|
1379
|
-
]);
|
|
1380
|
-
return /* @__PURE__ */ jsx(AppContext.Provider, {
|
|
1381
|
-
value: appContextValue,
|
|
1382
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1383
|
-
className: cls("flex h-screen w-screen overflow-hidden", "bg-surface-frame", "text-surface-900 dark:text-white", className),
|
|
1384
|
-
style: {
|
|
1385
|
-
paddingTop: "env(safe-area-inset-top)",
|
|
1386
|
-
paddingLeft: "env(safe-area-inset-left)",
|
|
1387
|
-
paddingRight: "env(safe-area-inset-right)",
|
|
1388
|
-
paddingBottom: "env(safe-area-inset-bottom)",
|
|
1389
|
-
height: "100dvh",
|
|
1390
|
-
...style
|
|
1391
|
-
},
|
|
1392
|
-
children: [
|
|
1393
|
-
appBarChildren,
|
|
1394
|
-
/* @__PURE__ */ jsx(DrawerWrapper, {
|
|
1395
|
-
displayed: includeDrawer,
|
|
1396
|
-
onMouseEnter: setOnHoverTrue,
|
|
1397
|
-
onMouseMove: setOnHoverTrue,
|
|
1398
|
-
onMouseLeave: setOnHoverFalse,
|
|
1399
|
-
open: drawerOpen,
|
|
1400
|
-
hovered: onHover,
|
|
1401
|
-
setDrawerOpen,
|
|
1402
|
-
children: includeDrawer && drawerChildren
|
|
1403
|
-
}),
|
|
1404
|
-
/* @__PURE__ */ jsxs("main", {
|
|
1405
|
-
className: "flex flex-col grow overflow-auto",
|
|
1406
|
-
children: [
|
|
1407
|
-
hasAppBar && /* @__PURE__ */ jsx(DrawerHeader, {}),
|
|
1408
|
-
/* @__PURE__ */ jsx(ConnectionLostBanner, { className: cls("px-2 pt-1", {
|
|
1409
|
-
"lg:pt-0 lg:pb-2": padding,
|
|
1410
|
-
"lg:pt-2": !hasAppBar && padding
|
|
1411
|
-
}) }),
|
|
1412
|
-
/* @__PURE__ */ jsx("div", {
|
|
1413
|
-
className: cls("bg-surface-sheet", "grow overflow-auto m-0", "lg:border lg:border-hairline", {
|
|
1414
|
-
"mt-1 lg:m-0 lg:mx-2 lg:mb-2 lg:rounded-xl": padding,
|
|
1415
|
-
"lg:mt-2": !hasAppBar && padding,
|
|
1416
|
-
"lg:mt-4": !hasAppBar && !padding
|
|
1417
|
-
}),
|
|
1418
|
-
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: otherChildren })
|
|
1419
|
-
})
|
|
1420
|
-
]
|
|
1421
|
-
})
|
|
1422
|
-
]
|
|
1423
|
-
})
|
|
1424
|
-
});
|
|
1425
|
-
}, deepEqual);
|
|
1426
|
-
var DrawerHeader = () => {
|
|
1427
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col min-h-14" });
|
|
1428
|
-
};
|
|
1429
|
-
function DrawerWrapper(props) {
|
|
1430
|
-
const layoutWidth = !props.displayed ? 0 : props.open ? 280 : 72;
|
|
1431
|
-
const visualWidth = !props.displayed ? 0 : props.open || props.hovered ? 280 : 72;
|
|
1432
|
-
const isFloating = props.hovered && !props.open;
|
|
1433
|
-
const { t } = useTranslation();
|
|
1434
|
-
const innerDrawer = /* @__PURE__ */ jsx("div", {
|
|
1435
|
-
className: cls("h-full overflow-hidden bg-surface-frame", defaultBorderMixin, isFloating ? "absolute top-0 left-0 bottom-0 z-50 shadow-lg border-r" : "relative"),
|
|
1436
|
-
style: {
|
|
1437
|
-
width: visualWidth,
|
|
1438
|
-
transition: "left 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, opacity 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, width 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms"
|
|
1439
|
-
},
|
|
1440
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
1441
|
-
className: "flex flex-col h-full",
|
|
1442
|
-
children: props.children
|
|
1443
|
-
})
|
|
1444
|
-
});
|
|
1445
|
-
if (!useLargeLayout()) {
|
|
1446
|
-
if (!props.displayed) return null;
|
|
1447
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
1448
|
-
"aria-label": t("open_menu"),
|
|
1449
|
-
onClick: () => props.setDrawerOpen(true),
|
|
1450
|
-
className: "absolute sm:top-2 sm:left-4 top-1 left-2",
|
|
1451
|
-
children: /* @__PURE__ */ jsx(MenuIcon, {})
|
|
1452
|
-
}), /* @__PURE__ */ jsx(Sheet, {
|
|
1453
|
-
side: "left",
|
|
1454
|
-
transparent: true,
|
|
1455
|
-
open: props.open,
|
|
1456
|
-
onOpenChange: props.setDrawerOpen,
|
|
1457
|
-
title: t("navigation_drawer"),
|
|
1458
|
-
overlayClassName: "bg-surface-scrim",
|
|
1459
|
-
children: innerDrawer
|
|
1460
|
-
})] });
|
|
1461
|
-
}
|
|
1462
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1463
|
-
className: "z-20 relative flex-shrink-0 overflow-visible",
|
|
1464
|
-
onMouseEnter: props.onMouseEnter,
|
|
1465
|
-
onMouseMove: props.onMouseMove,
|
|
1466
|
-
onMouseLeave: props.onMouseLeave,
|
|
1467
|
-
style: {
|
|
1468
|
-
width: layoutWidth,
|
|
1469
|
-
minWidth: layoutWidth,
|
|
1470
|
-
transition: "left 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, opacity 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms, width 75ms cubic-bezier(0.4, 0, 0.6, 1) 0ms"
|
|
1471
|
-
},
|
|
1472
|
-
children: innerDrawer
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
//#endregion
|
|
1476
|
-
//#region src/components/RebaseCMS.tsx
|
|
1477
|
-
/**
|
|
1478
|
-
* Declarative component to configure the admin in Rebase.
|
|
1479
|
-
* Renders nothing — purely registers config into the RebaseRegistry.
|
|
1480
|
-
*
|
|
1481
|
-
* When `collectionEditor` is provided, the built-in visual schema editor
|
|
1482
|
-
* is auto-wired as a native feature (slots, provider, Studio view) without
|
|
1483
|
-
* needing any external plugin.
|
|
1484
|
-
*/
|
|
1485
|
-
function RebaseCMS({ collections, views, homePage, entityViews, collectionViews, entityActions, collectionEditor, navigationGroupMappings, basePath }) {
|
|
1486
|
-
const dispatch = useRebaseRegistryDispatch();
|
|
1487
|
-
useLayoutEffect(() => {
|
|
1488
|
-
dispatch.registerAdmin({
|
|
1489
|
-
collections,
|
|
1490
|
-
views,
|
|
1491
|
-
homePage,
|
|
1492
|
-
entityViews,
|
|
1493
|
-
collectionViews,
|
|
1494
|
-
entityActions,
|
|
1495
|
-
collectionEditor,
|
|
1496
|
-
navigationGroupMappings,
|
|
1497
|
-
basePath
|
|
1498
|
-
});
|
|
1499
|
-
return () => dispatch.unregisterAdmin();
|
|
1500
|
-
}, [
|
|
1501
|
-
dispatch,
|
|
1502
|
-
collections,
|
|
1503
|
-
views,
|
|
1504
|
-
homePage,
|
|
1505
|
-
entityViews,
|
|
1506
|
-
collectionViews,
|
|
1507
|
-
entityActions,
|
|
1508
|
-
collectionEditor,
|
|
1509
|
-
navigationGroupMappings,
|
|
1510
|
-
basePath
|
|
1511
|
-
]);
|
|
1512
|
-
return null;
|
|
1513
|
-
}
|
|
1514
|
-
//#endregion
|
|
1515
|
-
//#region src/components/RebaseAuthGate.tsx
|
|
1516
|
-
/**
|
|
1517
|
-
* Auth gate component that handles the authentication flow.
|
|
1518
|
-
*
|
|
1519
|
-
* - Shows a loading spinner while `authController.initialLoading` is true.
|
|
1520
|
-
* - Shows the login view when no user is authenticated.
|
|
1521
|
-
* - Renders `children` when a user is authenticated.
|
|
1522
|
-
*
|
|
1523
|
-
* **Independently usable**: Use this alone when you want auth gating
|
|
1524
|
-
* without the full admin layout or navigation.
|
|
1525
|
-
*
|
|
1526
|
-
* @example
|
|
1527
|
-
* ```tsx
|
|
1528
|
-
* <RebaseAuthGate>
|
|
1529
|
-
* <MyCustomApp />
|
|
1530
|
-
* </RebaseAuthGate>
|
|
1531
|
-
* ```
|
|
1532
|
-
*/
|
|
1533
|
-
function RebaseAuthGate({ children }) {
|
|
1534
|
-
const registry = useRebaseRegistry();
|
|
1535
|
-
const authController = useAuthController();
|
|
1536
|
-
if (authController?.initialLoading) return /* @__PURE__ */ jsx(CircularProgressCenter, { size: "large" });
|
|
1537
|
-
const openedLink = typeof window !== "undefined" ? readEmailLinkAction(window.location)?.kind : void 0;
|
|
1538
|
-
const linkOpensOverSession = openedLink === "verify-email" || openedLink === "confirm-email-change" || openedLink === "magic-link";
|
|
1539
|
-
if (!authController?.user || linkOpensOverSession) return /* @__PURE__ */ jsx(Fragment, { children: registry.authConfig?.loginView ?? /* @__PURE__ */ jsx(LoginView, { authController }) });
|
|
1540
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1541
|
-
}
|
|
1542
|
-
//#endregion
|
|
1543
|
-
//#region src/collection_editor/useLiveSchemaEditing.tsx
|
|
1544
|
-
/**
|
|
1545
|
-
* The plan-then-confirm flow, as a hook.
|
|
1546
|
-
*
|
|
1547
|
-
* Owns three things that belong together and nothing else: whether the backend
|
|
1548
|
-
* can edit its schema, the plan for the change somebody is making, and the
|
|
1549
|
-
* dialog they confirm it in. The config controller calls `reviewChange` and
|
|
1550
|
-
* awaits it; everything about *how* the confirmation happens stays here.
|
|
1551
|
-
*
|
|
1552
|
-
* ## Why `reviewChange` returns a promise that can reject
|
|
1553
|
-
*
|
|
1554
|
-
* Because the editor needs to know. A save that was cancelled must not leave
|
|
1555
|
-
* the form thinking it succeeded — the collection on screen would then differ
|
|
1556
|
-
* from the one on disk, and the next save would be computed from the wrong
|
|
1557
|
-
* `before`. Rejecting with {@link SchemaChangeCancelled} is how "the person
|
|
1558
|
-
* said no" reaches the caller as an outcome rather than as silence.
|
|
1559
|
-
*/
|
|
1560
|
-
/**
|
|
1561
|
-
* Loaded when a change is actually being reviewed, not before.
|
|
1562
|
-
*
|
|
1563
|
-
* This hook is reached from the collections config controller, which is
|
|
1564
|
-
* constructed on every admin boot — so a static import would put the dialog and
|
|
1565
|
-
* the `@rebasepro/ui` surface it draws on into the **eager** bundle: everything
|
|
1566
|
-
* a browser downloads before the login screen paints. It cost 14 kB there, for
|
|
1567
|
-
* a dialog most sessions never open. The bundle budget caught it.
|
|
1568
|
-
*/
|
|
1569
|
-
var SchemaChangeDialog = lazyChunk(() => import("./SchemaChangeDialog-CcFSXvkK.js").then((n) => n.n).then((m) => ({ default: m.SchemaChangeDialog })));
|
|
1570
|
-
/** The answer when nobody asked. */
|
|
1571
|
-
var NOT_ASKED = {
|
|
1572
|
-
enabled: false,
|
|
1573
|
-
canPlan: false,
|
|
1574
|
-
canApply: false
|
|
1575
|
-
};
|
|
1576
|
-
function useLiveSchemaEditing(options) {
|
|
1577
|
-
const { baseUrl, authKey } = options;
|
|
1578
|
-
const asking = options.enabled !== false;
|
|
1579
|
-
const optionsRef = useRef(options);
|
|
1580
|
-
optionsRef.current = options;
|
|
1581
|
-
const client = useMemo(() => options.client ?? createLiveSchemaClient({
|
|
1582
|
-
baseUrl,
|
|
1583
|
-
getAuthToken: () => optionsRef.current.getAuthToken?.() ?? null
|
|
1584
|
-
}), [baseUrl, options.client]);
|
|
1585
|
-
const [status, setStatus] = useState();
|
|
1586
|
-
const [pending, setPending] = useState();
|
|
1587
|
-
const [plan, setPlan] = useState();
|
|
1588
|
-
const [planError, setPlanError] = useState();
|
|
1589
|
-
const [result, setResult] = useState();
|
|
1590
|
-
const [applying, setApplying] = useState(false);
|
|
1591
|
-
const [applyError, setApplyError] = useState();
|
|
1592
|
-
const probe = useRef(void 0);
|
|
1593
|
-
/** Which review a plan response belongs to. See `reviewChange`. */
|
|
1594
|
-
const reviewToken = useRef(0);
|
|
1595
|
-
const ready = useCallback(() => {
|
|
1596
|
-
if (!asking) return Promise.resolve(NOT_ASKED);
|
|
1597
|
-
const key = [client, authKey];
|
|
1598
|
-
const current = probe.current;
|
|
1599
|
-
if (!current || current.key[0] !== key[0] || current.key[1] !== key[1]) probe.current = {
|
|
1600
|
-
key,
|
|
1601
|
-
promise: client.status()
|
|
1602
|
-
};
|
|
1603
|
-
return probe.current.promise;
|
|
1604
|
-
}, [
|
|
1605
|
-
client,
|
|
1606
|
-
authKey,
|
|
1607
|
-
asking
|
|
1608
|
-
]);
|
|
1609
|
-
useEffect(() => {
|
|
1610
|
-
let cancelled = false;
|
|
1611
|
-
ready().then((answer) => {
|
|
1612
|
-
if (!cancelled) setStatus(answer);
|
|
1613
|
-
});
|
|
1614
|
-
return () => {
|
|
1615
|
-
cancelled = true;
|
|
1616
|
-
};
|
|
1617
|
-
}, [ready]);
|
|
1618
|
-
/**
|
|
1619
|
-
* Ask what the change would do, and ignore an answer that arrives late.
|
|
1620
|
-
*
|
|
1621
|
-
* Separate from `reviewChange` so it can be issued *again* without starting
|
|
1622
|
-
* a new review: a plan that failed on a dropped connection should cost a
|
|
1623
|
-
* click, not the whole wizard — the person has already filled in the form,
|
|
1624
|
-
* and making them do it twice for a transient failure is the kind of thing
|
|
1625
|
-
* that teaches people to distrust the preview.
|
|
1626
|
-
*/
|
|
1627
|
-
const requestPlan = useCallback(async (change) => {
|
|
1628
|
-
const token = ++reviewToken.current;
|
|
1629
|
-
try {
|
|
1630
|
-
const answer = await client.plan(change);
|
|
1631
|
-
if (token === reviewToken.current) setPlan(answer);
|
|
1632
|
-
} catch (err) {
|
|
1633
|
-
if (token !== reviewToken.current) return;
|
|
1634
|
-
setPlanError(err instanceof LiveSchemaError || err instanceof Error ? err.message : String(err));
|
|
1635
|
-
}
|
|
1636
|
-
}, [client]);
|
|
1637
|
-
const onRetry = useCallback(() => {
|
|
1638
|
-
if (!pending) return;
|
|
1639
|
-
setPlanError(void 0);
|
|
1640
|
-
setPlan(void 0);
|
|
1641
|
-
requestPlan(pending.change);
|
|
1642
|
-
}, [pending, requestPlan]);
|
|
1643
|
-
const clear = useCallback(() => {
|
|
1644
|
-
setPending(void 0);
|
|
1645
|
-
setPlan(void 0);
|
|
1646
|
-
setPlanError(void 0);
|
|
1647
|
-
setResult(void 0);
|
|
1648
|
-
setApplyError(void 0);
|
|
1649
|
-
setApplying(false);
|
|
1650
|
-
}, []);
|
|
1651
|
-
const reviewChange = useCallback((change) => {
|
|
1652
|
-
return new Promise((resolve, reject) => {
|
|
1653
|
-
setPending((previous) => {
|
|
1654
|
-
previous?.reject(new SchemaChangeCancelled());
|
|
1655
|
-
return {
|
|
1656
|
-
change,
|
|
1657
|
-
resolve,
|
|
1658
|
-
reject
|
|
1659
|
-
};
|
|
1660
|
-
});
|
|
1661
|
-
setPlan(void 0);
|
|
1662
|
-
setPlanError(void 0);
|
|
1663
|
-
setResult(void 0);
|
|
1664
|
-
setApplyError(void 0);
|
|
1665
|
-
setApplying(false);
|
|
1666
|
-
requestPlan(change);
|
|
1667
|
-
});
|
|
1668
|
-
}, [requestPlan]);
|
|
1669
|
-
const onConfirm = useCallback(() => {
|
|
1670
|
-
if (!pending) return;
|
|
1671
|
-
setApplying(true);
|
|
1672
|
-
setApplyError(void 0);
|
|
1673
|
-
client.apply(pending.change).then((answer) => {
|
|
1674
|
-
setResult(answer);
|
|
1675
|
-
setApplying(false);
|
|
1676
|
-
pending.resolve();
|
|
1677
|
-
setPending(void 0);
|
|
1678
|
-
}, (err) => {
|
|
1679
|
-
setApplying(false);
|
|
1680
|
-
setApplyError(err instanceof Error ? err.message : String(err));
|
|
1681
|
-
});
|
|
1682
|
-
}, [client, pending]);
|
|
1683
|
-
/**
|
|
1684
|
-
* "Edit source only": commit the collection, run nothing.
|
|
1685
|
-
*
|
|
1686
|
-
* Through the same door as an apply, so it is committed. It used to be a
|
|
1687
|
-
* write through the source-only editor that nobody committed, which every
|
|
1688
|
-
* later "Commit and apply" met as somebody else's work — 409, with the
|
|
1689
|
-
* dialog never saying why.
|
|
1690
|
-
*/
|
|
1691
|
-
const onSourceOnly = useCallback(() => {
|
|
1692
|
-
if (!pending) return;
|
|
1693
|
-
setApplying(true);
|
|
1694
|
-
setApplyError(void 0);
|
|
1695
|
-
const settle = pending;
|
|
1696
|
-
client.apply({
|
|
1697
|
-
...settle.change,
|
|
1698
|
-
sourceOnly: true
|
|
1699
|
-
}).then((answer) => {
|
|
1700
|
-
setResult(answer);
|
|
1701
|
-
setApplying(false);
|
|
1702
|
-
settle.resolve();
|
|
1703
|
-
setPending(void 0);
|
|
1704
|
-
}, (err) => {
|
|
1705
|
-
setApplying(false);
|
|
1706
|
-
setApplyError(err instanceof Error ? err.message : String(err));
|
|
1707
|
-
});
|
|
1708
|
-
}, [client, pending]);
|
|
1709
|
-
const sourceOnlyOffered = Boolean(plan && !plan.applicable && plan.changes.filter((change) => change.verdict !== "safe").every((change) => change.sourceOnly));
|
|
1710
|
-
const onClose = useCallback(() => {
|
|
1711
|
-
if (applying) return;
|
|
1712
|
-
const settle = pending;
|
|
1713
|
-
clear();
|
|
1714
|
-
if (settle && !result) settle.reject(new SchemaChangeCancelled());
|
|
1715
|
-
}, [
|
|
1716
|
-
applying,
|
|
1717
|
-
pending,
|
|
1718
|
-
result,
|
|
1719
|
-
clear
|
|
1720
|
-
]);
|
|
1721
|
-
const open = Boolean(pending) || Boolean(result);
|
|
1722
|
-
return {
|
|
1723
|
-
status,
|
|
1724
|
-
ready,
|
|
1725
|
-
reviewChange,
|
|
1726
|
-
dialog: open ? /* @__PURE__ */ jsx(Suspense, {
|
|
1727
|
-
fallback: null,
|
|
1728
|
-
children: /* @__PURE__ */ jsx(SchemaChangeDialog, {
|
|
1729
|
-
open,
|
|
1730
|
-
collectionId: pending?.change.collectionId ?? "",
|
|
1731
|
-
plan,
|
|
1732
|
-
planError,
|
|
1733
|
-
result,
|
|
1734
|
-
applying,
|
|
1735
|
-
applyError,
|
|
1736
|
-
onConfirm,
|
|
1737
|
-
onRetry: planError ? onRetry : void 0,
|
|
1738
|
-
onSourceOnly: sourceOnlyOffered ? onSourceOnly : void 0,
|
|
1739
|
-
onClose,
|
|
1740
|
-
applyRefusedBecause: status && !status.canApply ? status.applyRefusedBecause : void 0,
|
|
1741
|
-
target: status && {
|
|
1742
|
-
repository: status.repository,
|
|
1743
|
-
branch: status.branch
|
|
1744
|
-
}
|
|
1745
|
-
})
|
|
1746
|
-
}) : null
|
|
1747
|
-
};
|
|
1748
|
-
}
|
|
1749
|
-
//#endregion
|
|
1750
|
-
//#region src/collection_editor/useLocalCollectionsConfigController.tsx
|
|
1751
|
-
/**
|
|
1752
|
-
* The guess this hook used to make on its own.
|
|
1753
|
-
*
|
|
1754
|
-
* `process.env.NODE_ENV` here is the *frontend bundle's* build mode. Whether
|
|
1755
|
-
* the schema editor exists is decided by a different process entirely — the
|
|
1756
|
-
* server's own `NODE_ENV`, its `collectionsDir`, whether its collections were
|
|
1757
|
-
* introspected, whether `ts-morph` is installed. The two disagree in every
|
|
1758
|
-
* ordinary setup: a dev frontend against a deployed API, a `baas` project, a
|
|
1759
|
-
* hosted console. When they did, the editor offered itself and every save came
|
|
1760
|
-
* back `404 Not Found`. It is kept only as the answer for a backend too old to
|
|
1761
|
-
* be asked.
|
|
1762
|
-
*/
|
|
1763
|
-
var buildModeGuess = () => process.env.NODE_ENV === "production";
|
|
1764
|
-
function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [], options) {
|
|
1765
|
-
const parsedCollections = baseCollections;
|
|
1766
|
-
const optionsRef = useRef(options);
|
|
1767
|
-
optionsRef.current = options;
|
|
1768
|
-
const clientBaseUrl = typeof clientOrUrl === "string" ? clientOrUrl : clientOrUrl?.baseUrl ?? "";
|
|
1769
|
-
const clientApiPath = typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.apiPath || DEFAULT_API_PATH;
|
|
1770
|
-
const editorUrl = `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/schema-editor`;
|
|
1771
|
-
const resolveToken = async () => {
|
|
1772
|
-
let token = optionsRef.current?.getAuthToken ? await optionsRef.current.getAuthToken() : null;
|
|
1773
|
-
if (!token && typeof clientOrUrl === "object" && clientOrUrl !== null && clientOrUrl.resolveToken) token = await clientOrUrl.resolveToken();
|
|
1774
|
-
return token ?? null;
|
|
1775
|
-
};
|
|
1776
|
-
const request = async (endpoint, payload) => {
|
|
1777
|
-
try {
|
|
1778
|
-
const token = await resolveToken();
|
|
1779
|
-
const headers = { "Content-Type": "application/json" };
|
|
1780
|
-
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
1781
|
-
const response = await fetch(`${editorUrl}${endpoint}`, {
|
|
1782
|
-
method: "POST",
|
|
1783
|
-
headers,
|
|
1784
|
-
body: JSON.stringify(payload)
|
|
1785
|
-
});
|
|
1786
|
-
if (!response.ok) {
|
|
1787
|
-
const text = await response.text();
|
|
1788
|
-
let err = {};
|
|
1789
|
-
try {
|
|
1790
|
-
err = JSON.parse(text);
|
|
1791
|
-
} catch (e) {}
|
|
1792
|
-
if (Object.keys(err).length === 0) err = { message: text };
|
|
1793
|
-
console.error("dev server error payload:", err);
|
|
1794
|
-
const errObj = err.error;
|
|
1795
|
-
const errMessage = typeof errObj === "object" && errObj !== null ? errObj.message : typeof errObj === "string" ? errObj : err.message;
|
|
1796
|
-
throw new Error(errMessage || "Error communicating with local dev server");
|
|
1797
|
-
}
|
|
1798
|
-
} catch (e) {
|
|
1799
|
-
console.error("fetch request failed", e);
|
|
1800
|
-
throw e;
|
|
1801
|
-
}
|
|
1802
|
-
};
|
|
1803
|
-
const noSchemaAccess = options?.mayReadSchema === false;
|
|
1804
|
-
const forcedReadOnly = noSchemaAccess ? true : options?.readOnly;
|
|
1805
|
-
const authKey = options?.authKey ?? null;
|
|
1806
|
-
const [availability, setAvailability] = useState({ state: "unknown" });
|
|
1807
|
-
useEffect(() => {
|
|
1808
|
-
if (forcedReadOnly === true) return;
|
|
1809
|
-
let cancelled = false;
|
|
1810
|
-
(async () => {
|
|
1811
|
-
try {
|
|
1812
|
-
const token = await resolveToken();
|
|
1813
|
-
const response = await fetch(`${editorUrl}/status`, { headers: token ? { Authorization: `Bearer ${token}` } : {} });
|
|
1814
|
-
if (cancelled) return;
|
|
1815
|
-
if (response.status === 404) {
|
|
1816
|
-
setAvailability({ state: "unknown" });
|
|
1817
|
-
return;
|
|
1818
|
-
}
|
|
1819
|
-
const body = await response.json().catch(() => ({}));
|
|
1820
|
-
if (cancelled) return;
|
|
1821
|
-
if (response.ok) setAvailability({
|
|
1822
|
-
state: "known",
|
|
1823
|
-
enabled: body.enabled === true,
|
|
1824
|
-
reason: body.reason
|
|
1825
|
-
});
|
|
1826
|
-
else setAvailability({
|
|
1827
|
-
state: "known",
|
|
1828
|
-
enabled: false,
|
|
1829
|
-
reason: body.error?.message ?? `The backend refused to say whether collections are editable (HTTP ${response.status}).`
|
|
1830
|
-
});
|
|
1831
|
-
} catch {
|
|
1832
|
-
if (!cancelled) setAvailability({ state: "unknown" });
|
|
1833
|
-
}
|
|
1834
|
-
})();
|
|
1835
|
-
return () => {
|
|
1836
|
-
cancelled = true;
|
|
1837
|
-
};
|
|
1838
|
-
}, [
|
|
1839
|
-
editorUrl,
|
|
1840
|
-
forcedReadOnly,
|
|
1841
|
-
authKey
|
|
1842
|
-
]);
|
|
1843
|
-
const liveSchema = useLiveSchemaEditing({
|
|
1844
|
-
baseUrl: `${String(clientBaseUrl).replace(/\/$/, "")}${clientApiPath}/admin/schema`,
|
|
1845
|
-
getAuthToken: resolveToken,
|
|
1846
|
-
authKey,
|
|
1847
|
-
enabled: forcedReadOnly !== true
|
|
1848
|
-
});
|
|
1849
|
-
/**
|
|
1850
|
-
* Perform a write, through the live editor when there is one.
|
|
1851
|
-
*
|
|
1852
|
-
* `sourceOnly` is the write this controller has always done. It stays the
|
|
1853
|
-
* whole behaviour on a backend that cannot edit its schema — a bundle
|
|
1854
|
-
* deployment, a non-Postgres driver, a version too old to be asked — so
|
|
1855
|
-
* nothing about the editor depends on the feature being there.
|
|
1856
|
-
*/
|
|
1857
|
-
const write = async (collectionId, change) => {
|
|
1858
|
-
if ("patch" in change && change.patch.length === 0) return;
|
|
1859
|
-
const available = await liveSchema.ready();
|
|
1860
|
-
const proposed = {
|
|
1861
|
-
collectionId,
|
|
1862
|
-
...change
|
|
1863
|
-
};
|
|
1864
|
-
if (!available.enabled) {
|
|
1865
|
-
await request("/collection/save", "patch" in change ? {
|
|
1866
|
-
collectionId,
|
|
1867
|
-
patch: change.patch
|
|
1868
|
-
} : {
|
|
1869
|
-
collectionId,
|
|
1870
|
-
collectionData: change.collection
|
|
1871
|
-
});
|
|
1872
|
-
return;
|
|
1873
|
-
}
|
|
1874
|
-
await liveSchema.reviewChange(proposed);
|
|
1875
|
-
};
|
|
1876
|
-
const readOnly = forcedReadOnly ?? (availability.state === "known" ? !availability.enabled : buildModeGuess());
|
|
1877
|
-
const readOnlyReason = noSchemaAccess ? void 0 : availability.state === "known" && availability.reason ? availability.reason : "Collections can only be edited against a backend running the schema editor, which is off in production.";
|
|
1878
|
-
const findCollection = (id) => parsedCollections.find((c) => c.id === id || c.slug === id);
|
|
1879
|
-
/**
|
|
1880
|
-
* What to send for a collection that should end up as `saving`.
|
|
1881
|
-
*
|
|
1882
|
-
* For one that exists: the difference from `loaded` — what the person
|
|
1883
|
-
* changed — and nothing else. Both sides are the same view model, through
|
|
1884
|
-
* JSON, so whatever JSON cannot carry (a handler, a shared property, an
|
|
1885
|
-
* imported enum) is absent from both and never appears as a change; the
|
|
1886
|
-
* server writes only the keys the patch names. A collection this does not
|
|
1887
|
-
* recognise is a new one, and is sent whole.
|
|
1888
|
-
*/
|
|
1889
|
-
const changeFor = (id, saving, loaded) => {
|
|
1890
|
-
const current = loaded ?? findCollection(id);
|
|
1891
|
-
return current ? { patch: diffCollections(current, saving) } : { collection: saving };
|
|
1892
|
-
};
|
|
1893
|
-
/** `findCollection`, as the record a patch is computed from. */
|
|
1894
|
-
const currentOf = (id) => findCollection(id) ?? {};
|
|
1895
|
-
return useMemo(() => ({
|
|
1896
|
-
loading: false,
|
|
1897
|
-
readOnly,
|
|
1898
|
-
readOnlyReason,
|
|
1899
|
-
collections: parsedCollections,
|
|
1900
|
-
dialog: liveSchema.dialog,
|
|
1901
|
-
getCollection: (id) => {
|
|
1902
|
-
const found = findCollection(id);
|
|
1903
|
-
if (found) return found;
|
|
1904
|
-
throw Error(`Collection ${id} not found in local mode`);
|
|
1905
|
-
},
|
|
1906
|
-
saveCollection: async ({ id, collectionData, baseline }) => {
|
|
1907
|
-
await write(id, changeFor(id, collectionData, baseline));
|
|
1908
|
-
},
|
|
1909
|
-
updateCollection: async ({ id, collectionData }) => {
|
|
1910
|
-
const current = findCollection(id);
|
|
1911
|
-
await write(id, current ? { patch: diffCollections(current, {
|
|
1912
|
-
...current,
|
|
1913
|
-
...collectionData
|
|
1914
|
-
}) } : { collection: collectionData });
|
|
1915
|
-
},
|
|
1916
|
-
deleteCollection: async ({ id }) => {
|
|
1917
|
-
if (!(await liveSchema.ready()).enabled) {
|
|
1918
|
-
await request("/collection/delete", { collectionId: id });
|
|
1919
|
-
return;
|
|
1920
|
-
}
|
|
1921
|
-
await liveSchema.reviewChange({
|
|
1922
|
-
collectionId: id,
|
|
1923
|
-
remove: true
|
|
1924
|
-
});
|
|
1925
|
-
},
|
|
1926
|
-
saveProperty: async ({ path, propertyKey, property, newPropertiesOrder }) => {
|
|
1927
|
-
const current = currentOf(path);
|
|
1928
|
-
await write(path, { patch: diffCollections(current, {
|
|
1929
|
-
...current,
|
|
1930
|
-
properties: {
|
|
1931
|
-
...current.properties ?? {},
|
|
1932
|
-
[propertyKey]: property
|
|
1933
|
-
},
|
|
1934
|
-
...newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {}
|
|
1935
|
-
}) });
|
|
1936
|
-
},
|
|
1937
|
-
deleteProperty: async ({ path, propertyKey, newPropertiesOrder }) => {
|
|
1938
|
-
const current = currentOf(path);
|
|
1939
|
-
const { [propertyKey]: _removed, ...properties } = current.properties ?? {};
|
|
1940
|
-
await write(path, { patch: diffCollections(current, {
|
|
1941
|
-
...current,
|
|
1942
|
-
properties,
|
|
1943
|
-
...newPropertiesOrder ? { propertiesOrder: newPropertiesOrder } : {}
|
|
1944
|
-
}) });
|
|
1945
|
-
},
|
|
1946
|
-
updatePropertiesOrder: async ({ collection, fullPath, newPropertiesOrder }) => {
|
|
1947
|
-
const collectionId = collection.id || fullPath.split("/").pop() || "";
|
|
1948
|
-
const current = currentOf(collectionId);
|
|
1949
|
-
await write(collectionId, { patch: diffCollections(current, {
|
|
1950
|
-
...current,
|
|
1951
|
-
propertiesOrder: newPropertiesOrder
|
|
1952
|
-
}) });
|
|
1953
|
-
},
|
|
1954
|
-
updateKanbanColumnsOrder: async () => {},
|
|
1955
|
-
navigationEntries: [],
|
|
1956
|
-
saveNavigationEntries: async () => {}
|
|
1957
|
-
}), [
|
|
1958
|
-
clientOrUrl,
|
|
1959
|
-
parsedCollections,
|
|
1960
|
-
readOnly,
|
|
1961
|
-
readOnlyReason,
|
|
1962
|
-
options?.getAuthToken,
|
|
1963
|
-
liveSchema.dialog,
|
|
1964
|
-
liveSchema.status
|
|
1965
|
-
]);
|
|
1966
|
-
}
|
|
1967
|
-
//#endregion
|
|
1968
|
-
//#region src/components/RebaseNavigation.tsx
|
|
1969
|
-
var EMPTY_PLUGINS = [];
|
|
1970
|
-
var EMPTY_COLLECTIONS = [];
|
|
1971
|
-
var CollectionsStudioView = lazyChunk(() => import("./RouterCollectionsStudioView-SGBV4CMg.js").then((n) => n.n).then((m) => ({ default: m.RouterCollectionsStudioView })));
|
|
1972
|
-
/**
|
|
1973
|
-
* Navigation layer — builds and provides all admin navigation controllers:
|
|
1974
|
-
* collection registry, URL controller, navigation state, side entity,
|
|
1975
|
-
* and the self-assembling Studio bridge.
|
|
1976
|
-
*
|
|
1977
|
-
* Also handles the collection editor config controller when enabled.
|
|
1978
|
-
*
|
|
1979
|
-
* **Independently usable**: Use this when you need admin navigation
|
|
1980
|
-
* (entity tables, side panels) in a custom layout.
|
|
1981
|
-
*
|
|
1982
|
-
* @example
|
|
1983
|
-
* ```tsx
|
|
1984
|
-
* <RebaseNavigation>
|
|
1985
|
-
* <MyCustomLayout>
|
|
1986
|
-
* <CollectionViewBinding ... />
|
|
1987
|
-
* </MyCustomLayout>
|
|
1988
|
-
* </RebaseNavigation>
|
|
1989
|
-
* ```
|
|
1990
|
-
*/
|
|
1991
|
-
function RebaseNavigation({ children }) {
|
|
1992
|
-
const registry = useRebaseRegistry();
|
|
1993
|
-
const context = useRebaseContext();
|
|
1994
|
-
const adminModeController = useAdminModeController();
|
|
1995
|
-
const userConfigPersistence = useUserConfigurationPersistence();
|
|
1996
|
-
const collectionEditorConfig = registry.cmsConfig?.collectionEditor;
|
|
1997
|
-
const collectionEditorEnabled = Boolean(collectionEditorConfig) || Boolean(registry.studioConfig);
|
|
1998
|
-
const collectionEditorOptions = useMemo(() => {
|
|
1999
|
-
if (collectionEditorConfig === true || !collectionEditorConfig) return {};
|
|
2000
|
-
return collectionEditorConfig;
|
|
2001
|
-
}, [collectionEditorConfig]);
|
|
2002
|
-
const cmsCollections = registry.cmsConfig?.collections ?? EMPTY_COLLECTIONS;
|
|
2003
|
-
const collectionsBuilder = useMemo(() => Array.isArray(cmsCollections) ? () => [...cmsCollections] : cmsCollections, [cmsCollections]);
|
|
2004
|
-
const dataSources = useDataSources();
|
|
2005
|
-
const collectionRegistryController = useBuildCollectionRegistryController({
|
|
2006
|
-
userConfigPersistence,
|
|
2007
|
-
dataSources: dataSources.registry
|
|
2008
|
-
});
|
|
2009
|
-
const defaultData = useData();
|
|
2010
|
-
const getCollectionRef = useRef(collectionRegistryController.getCollection);
|
|
2011
|
-
getCollectionRef.current = collectionRegistryController.getCollection;
|
|
2012
|
-
useContext(CollectionResolverRegistrationContext)(useCallback((slug) => getCollectionRef.current(slug), []), collectionRegistryController.resolveDataPath);
|
|
2013
|
-
const routedData = useMemo(() => buildRoutedRebaseData({
|
|
2014
|
-
defaultData,
|
|
2015
|
-
sources: dataSources.sources,
|
|
2016
|
-
resolveKey: (slugOrPath) => resolveDataSource(getCollectionRef.current(slugOrPath), dataSources.registry).key
|
|
2017
|
-
}), [defaultData, dataSources]);
|
|
2018
|
-
const urlController = useBuildUrlController({
|
|
2019
|
-
basePath: useMemo(() => {
|
|
2020
|
-
const raw = registry.cmsConfig?.basePath;
|
|
2021
|
-
if (!raw || raw === "/") return "/";
|
|
2022
|
-
const trimmed = raw.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
2023
|
-
return trimmed ? `/${trimmed}` : "/";
|
|
2024
|
-
}, [registry.cmsConfig?.basePath]),
|
|
2025
|
-
baseCollectionPath: "/c",
|
|
2026
|
-
collectionRegistryController
|
|
2027
|
-
});
|
|
2028
|
-
const rebaseClient = useRebaseClient();
|
|
2029
|
-
const authController = useAuthController();
|
|
2030
|
-
const resolvedCollections = useMemo(() => Array.isArray(cmsCollections) ? cmsCollections : [], [cmsCollections]);
|
|
2031
|
-
useEffect(() => {
|
|
2032
|
-
if (process.env.NODE_ENV === "production") return;
|
|
2033
|
-
const { registry, sources } = dataSources;
|
|
2034
|
-
const missing = Object.values(registry).filter((d) => (d.transport === "direct" || d.transport === "custom") && !sources[d.key]).map((d) => d.key);
|
|
2035
|
-
if (missing.length > 0) console.warn(`[Rebase] These data source(s) declare a direct/custom transport but have no client-side driver and will fall back to the default data source: ${missing.map((k) => `"${k}"`).join(", ")}. Provide a \`driver\` for them in \`dataSources\` on <Rebase>.`);
|
|
2036
|
-
}, [dataSources]);
|
|
2037
|
-
const internalConfigController = useLocalCollectionsConfigController(rebaseClient, resolvedCollections, collectionEditorEnabled ? {
|
|
2038
|
-
readOnly: collectionEditorOptions?.readOnly,
|
|
2039
|
-
getAuthToken: collectionEditorOptions?.getAuthToken ?? authController?.getAuthToken,
|
|
2040
|
-
authKey: authController?.user?.uid ?? null,
|
|
2041
|
-
mayReadSchema: reportsScopes(authController) ? callerHoldsScope(authController, "schema:read") : void 0
|
|
2042
|
-
} : { readOnly: true });
|
|
2043
|
-
const schemaView = useMemo(() => {
|
|
2044
|
-
if (!collectionEditorEnabled) return void 0;
|
|
2045
|
-
const studioTools = registry.studioConfig?.tools ?? [
|
|
2046
|
-
"sql",
|
|
2047
|
-
"js",
|
|
2048
|
-
"rls",
|
|
2049
|
-
"schema",
|
|
2050
|
-
"storage"
|
|
2051
|
-
];
|
|
2052
|
-
if (!registry.studioConfig || !studioTools.includes("schema")) return void 0;
|
|
2053
|
-
return {
|
|
2054
|
-
slug: "schema",
|
|
2055
|
-
name: "Edit collections",
|
|
2056
|
-
group: "Database",
|
|
2057
|
-
icon: "LayoutList",
|
|
2058
|
-
nestedRoutes: true,
|
|
2059
|
-
view: /* @__PURE__ */ jsx(Suspense, {
|
|
2060
|
-
fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}),
|
|
2061
|
-
children: /* @__PURE__ */ jsx(CollectionsStudioViewFromContext, {})
|
|
2062
|
-
})
|
|
2063
|
-
};
|
|
2064
|
-
}, [collectionEditorEnabled, registry.studioConfig]);
|
|
2065
|
-
const devViews = useMemo(() => {
|
|
2066
|
-
const base = registry.studioConfig?.devViews ?? [];
|
|
2067
|
-
if (schemaView) return [...base, schemaView];
|
|
2068
|
-
return base;
|
|
2069
|
-
}, [registry.studioConfig?.devViews, schemaView]);
|
|
2070
|
-
const cmsViews = registry.cmsConfig?.views;
|
|
2071
|
-
const mergedViews = useMemo(() => {
|
|
2072
|
-
if (!cmsViews) return devViews;
|
|
2073
|
-
if (Array.isArray(cmsViews) && cmsViews.length === 0) return devViews;
|
|
2074
|
-
if (typeof cmsViews === "function") return async (params) => {
|
|
2075
|
-
return [...await cmsViews(params) ?? [], ...devViews];
|
|
2076
|
-
};
|
|
2077
|
-
return [...cmsViews, ...devViews];
|
|
2078
|
-
}, [cmsViews, devViews]);
|
|
2079
|
-
const parentCustomizationController = useCustomizationController();
|
|
2080
|
-
const navigationStateController = useBuildNavigationStateController({
|
|
2081
|
-
plugins: parentCustomizationController.plugins ?? EMPTY_PLUGINS,
|
|
2082
|
-
collections: collectionsBuilder,
|
|
2083
|
-
views: mergedViews,
|
|
2084
|
-
navigationGroupMappings: registry.cmsConfig?.navigationGroupMappings,
|
|
2085
|
-
authController: context.authController,
|
|
2086
|
-
data: routedData,
|
|
2087
|
-
collectionRegistryController,
|
|
2088
|
-
urlController,
|
|
2089
|
-
adminMode: adminModeController?.mode
|
|
2090
|
-
});
|
|
2091
|
-
const enrichedCustomizationController = useMemo(() => {
|
|
2092
|
-
const cmsEntityViews = registry.cmsConfig?.entityViews ?? [];
|
|
2093
|
-
const cmsEntityActions = registry.cmsConfig?.entityActions ?? [];
|
|
2094
|
-
const cmsCollectionViews = registry.cmsConfig?.collectionViews ?? [];
|
|
2095
|
-
if (cmsEntityViews.length === 0 && cmsEntityActions.length === 0 && cmsCollectionViews.length === 0) return parentCustomizationController;
|
|
2096
|
-
return {
|
|
2097
|
-
...parentCustomizationController,
|
|
2098
|
-
entityViews: [...parentCustomizationController.entityViews ?? [], ...cmsEntityViews.filter((v) => !(parentCustomizationController.entityViews ?? []).some((ev) => ev.key === v.key))],
|
|
2099
|
-
entityActions: [...parentCustomizationController.entityActions ?? [], ...cmsEntityActions.filter((a) => !(parentCustomizationController.entityActions ?? []).some((ea) => ea.key === a.key))],
|
|
2100
|
-
collectionViews: [...parentCustomizationController.collectionViews ?? [], ...cmsCollectionViews.filter((v) => !(parentCustomizationController.collectionViews ?? []).some((cv) => cv.key === v.key))]
|
|
2101
|
-
};
|
|
2102
|
-
}, [
|
|
2103
|
-
parentCustomizationController,
|
|
2104
|
-
registry.cmsConfig?.entityViews,
|
|
2105
|
-
registry.cmsConfig?.entityActions,
|
|
2106
|
-
registry.cmsConfig?.collectionViews
|
|
2107
|
-
]);
|
|
2108
|
-
const navigationContent = /* @__PURE__ */ jsx(RebaseDataContext.Provider, {
|
|
2109
|
-
value: routedData,
|
|
2110
|
-
children: /* @__PURE__ */ jsx(CustomizationControllerContext.Provider, {
|
|
2111
|
-
value: enrichedCustomizationController,
|
|
2112
|
-
children: /* @__PURE__ */ jsx(StudioBridgeRegistryProvider, { children: /* @__PURE__ */ jsx(CollectionRegistryContext.Provider, {
|
|
2113
|
-
value: collectionRegistryController,
|
|
2114
|
-
children: /* @__PURE__ */ jsx(UrlContext.Provider, {
|
|
2115
|
-
value: urlController,
|
|
2116
|
-
children: /* @__PURE__ */ jsx(NavigationStateContext.Provider, {
|
|
2117
|
-
value: navigationStateController,
|
|
2118
|
-
children: /* @__PURE__ */ jsxs(SidePanelProvider, { children: [/* @__PURE__ */ jsx(BridgeAutoRegistrar, {
|
|
2119
|
-
collectionRegistryController,
|
|
2120
|
-
urlController,
|
|
2121
|
-
navigationStateController,
|
|
2122
|
-
canWriteToCodebase: !internalConfigController.readOnly
|
|
2123
|
-
}), children] })
|
|
2124
|
-
})
|
|
2125
|
-
})
|
|
2126
|
-
}) })
|
|
2127
|
-
})
|
|
2128
|
-
});
|
|
2129
|
-
if (collectionEditorEnabled) return /* @__PURE__ */ jsx(ConfigControllerProvider, {
|
|
2130
|
-
collectionConfigController: internalConfigController,
|
|
2131
|
-
pathSuggestions: collectionEditorOptions?.pathSuggestions,
|
|
2132
|
-
children: navigationContent
|
|
2133
|
-
});
|
|
2134
|
-
return navigationContent;
|
|
2135
|
-
}
|
|
2136
|
-
/**
|
|
2137
|
-
* The injected "Edit collections" view, bound to the live config controller.
|
|
2138
|
-
*
|
|
2139
|
-
* Exists so the element stored in the navigation state does not close over a
|
|
2140
|
-
* controller instance — see the comment at its construction site.
|
|
2141
|
-
*/
|
|
2142
|
-
function CollectionsStudioViewFromContext() {
|
|
2143
|
-
return /* @__PURE__ */ jsx(CollectionsStudioView, { configController: useCollectionsConfigController() });
|
|
2144
|
-
}
|
|
2145
|
-
/**
|
|
2146
|
-
* Internal component that auto-registers admin controllers into the
|
|
2147
|
-
* self-assembling Studio bridge. Must be rendered inside both the
|
|
2148
|
-
* navigation contexts and the StudioBridgeRegistryProvider.
|
|
2149
|
-
*/
|
|
2150
|
-
function BridgeAutoRegistrar({ collectionRegistryController, urlController, navigationStateController, canWriteToCodebase }) {
|
|
2151
|
-
useBridgeRegistration("collectionRegistry", collectionRegistryController);
|
|
2152
|
-
useBridgeRegistration("urlController", urlController);
|
|
2153
|
-
useBridgeRegistration("navigationState", navigationStateController);
|
|
2154
|
-
useBridgeRegistration("capabilities", useMemo(() => ({ codebase: canWriteToCodebase }), [canWriteToCodebase]));
|
|
2155
|
-
return null;
|
|
2156
|
-
}
|
|
2157
|
-
//#endregion
|
|
2158
|
-
//#region src/components/RebaseLayout.tsx
|
|
2159
|
-
/**
|
|
2160
|
-
* Layout layer — provides the Scaffold, Drawer, and SideDialogs.
|
|
2161
|
-
*
|
|
2162
|
-
* Wraps the route outlet with the standard Rebase admin layout.
|
|
2163
|
-
* Override the drawer via props; pass `appBar` to add a top bar (there is
|
|
2164
|
-
* none by default — the drawer owns navigation and user actions).
|
|
2165
|
-
*
|
|
2166
|
-
* **Independently usable**: Use this when you want the Rebase layout
|
|
2167
|
-
* without its default route definitions.
|
|
2168
|
-
*
|
|
2169
|
-
* It takes no children: the routed view arrives through react-router's
|
|
2170
|
-
* `<Outlet/>`. This example used to pass `<Route>` elements, which is neither
|
|
2171
|
-
* what the component renders nor something `RebaseLayoutProps` accepts — a
|
|
2172
|
-
* reader following it wrote a type error whose message was about `children`,
|
|
2173
|
-
* not about routes.
|
|
2174
|
-
*
|
|
2175
|
-
* Hand it to `<RebaseRouteDefs layout>`, which renders the routes inside it:
|
|
2176
|
-
*
|
|
2177
|
-
* @example
|
|
2178
|
-
* ```tsx
|
|
2179
|
-
* <RebaseRouteDefs layout={<RebaseLayout title="My Admin" appBar={<AppBar/>}/>}>
|
|
2180
|
-
* <Route path="/custom" element={<CustomView/>}/>
|
|
2181
|
-
* </RebaseRouteDefs>
|
|
2182
|
-
* ```
|
|
2183
|
-
*/
|
|
2184
|
-
function RebaseLayout(props) {
|
|
2185
|
-
const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, devViews = [] } = props;
|
|
2186
|
-
const adminModeController = useAdminModeController();
|
|
2187
|
-
const ResolvedDrawer = useComponentOverride("Shell.Drawer", Drawer);
|
|
2188
|
-
const ActiveDrawer = drawer ?? /* @__PURE__ */ jsx(ResolvedDrawer, {
|
|
2189
|
-
title,
|
|
2190
|
-
logoDestination: adminModeController.mode === "studio" ? "/s" : "/"
|
|
2191
|
-
});
|
|
2192
|
-
return /* @__PURE__ */ jsxs(Scaffold, {
|
|
2193
|
-
autoOpenDrawer,
|
|
2194
|
-
defaultDrawerOpen,
|
|
2195
|
-
logo,
|
|
2196
|
-
children: [
|
|
2197
|
-
/* @__PURE__ */ jsx(AdminModeSyncer, { devViews }),
|
|
2198
|
-
appBar,
|
|
2199
|
-
ActiveDrawer,
|
|
2200
|
-
/* @__PURE__ */ jsx(Outlet, {}),
|
|
2201
|
-
/* @__PURE__ */ jsx(SideDialogs, {})
|
|
2202
|
-
]
|
|
2203
|
-
});
|
|
2204
|
-
}
|
|
2205
|
-
//#endregion
|
|
2206
|
-
//#region src/components/HomePage/FavouritesView.tsx
|
|
2207
|
-
function NavigationChip({ entry }) {
|
|
2208
|
-
const navigate = useNavigate();
|
|
2209
|
-
const userConfigurationPersistence = useUserConfigurationPersistence();
|
|
2210
|
-
if (!userConfigurationPersistence) return null;
|
|
2211
|
-
const favourite = userConfigurationPersistence.favouritePaths.includes(entry.slug);
|
|
2212
|
-
const onIconClick = (e) => {
|
|
2213
|
-
e.preventDefault();
|
|
2214
|
-
e.stopPropagation();
|
|
2215
|
-
if (favourite) userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== entry.slug));
|
|
2216
|
-
else userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, entry.slug]);
|
|
2217
|
-
};
|
|
2218
|
-
return /* @__PURE__ */ jsx(Chip, {
|
|
2219
|
-
onClick: () => navigate(entry.url),
|
|
2220
|
-
icon: /* @__PURE__ */ jsx(StarIcon, {
|
|
2221
|
-
onClick: onIconClick,
|
|
2222
|
-
size: iconSize.small,
|
|
2223
|
-
className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500"
|
|
2224
|
-
}),
|
|
2225
|
-
children: entry.name
|
|
2226
|
-
}, entry.slug);
|
|
2227
|
-
}
|
|
2228
|
-
function FavouritesView({ hidden }) {
|
|
2229
|
-
const navigationStateController = useNavigationStateController();
|
|
2230
|
-
const userConfigurationPersistence = useUserConfigurationPersistence();
|
|
2231
|
-
if (!userConfigurationPersistence) return null;
|
|
2232
|
-
const favouriteCollections = (userConfigurationPersistence?.favouritePaths ?? []).map((path) => navigationStateController.topLevelNavigation?.navigationEntries.find((entry) => entry.slug === path)).filter(Boolean);
|
|
2233
|
-
return /* @__PURE__ */ jsx(Collapse, {
|
|
2234
|
-
in: favouriteCollections.length > 0,
|
|
2235
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
2236
|
-
className: "flex flex-row flex-wrap gap-2 pb-2 min-h-[32px]",
|
|
2237
|
-
children: favouriteCollections.map((entry) => /* @__PURE__ */ jsx(NavigationChip, { entry }, entry.slug))
|
|
2238
|
-
})
|
|
2239
|
-
});
|
|
2240
|
-
}
|
|
2241
|
-
//#endregion
|
|
2242
|
-
//#region src/components/HomePage/NavigationGroup.tsx
|
|
2243
|
-
function NavigationGroup({ children, group, minimised, isPreview, isPotentialCardDropTarget, onEditGroup, dndDisabled, collapsed, onToggleCollapsed }) {
|
|
2244
|
-
const groupLabel = useNavigationGroupLabel();
|
|
2245
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
2246
|
-
/**
|
|
2247
|
-
* The group's *name*, which is an identifier — it is what `onEditGroup`
|
|
2248
|
-
* renames, what the card ordering compares, and what the drawer keys its
|
|
2249
|
-
* icons off. Never the translated heading.
|
|
2250
|
-
*/
|
|
2251
|
-
const currentGroupName = group ?? "Views";
|
|
2252
|
-
/**
|
|
2253
|
-
* What the heading reads.
|
|
2254
|
-
*
|
|
2255
|
-
* This used to translate only the default group (`t("views_group")`) and
|
|
2256
|
-
* render every other name raw, while the drawer used
|
|
2257
|
-
* `useNavigationGroupLabel` — so the same three groups had two sets of
|
|
2258
|
-
* labels on one screen: `VISTAS / DATABASE / SETTINGS` on the home page
|
|
2259
|
-
* against `VIEWS / BASE DE DATOS / SETTINGS` in the drawer beside it. One
|
|
2260
|
-
* lookup, in both places.
|
|
2261
|
-
*/
|
|
2262
|
-
const currentGroupLabel = groupLabel(currentGroupName);
|
|
2263
|
-
const showCaret = !isPreview && !!onToggleCollapsed;
|
|
2264
|
-
const TitleContent = /* @__PURE__ */ jsxs("div", {
|
|
2265
|
-
className: cls("flex items-center", isPreview ? "px-1 py-0.5" : ""),
|
|
2266
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
2267
|
-
variant: "micro",
|
|
2268
|
-
component: "h2",
|
|
2269
|
-
color: "secondary",
|
|
2270
|
-
className: cls("py-1 rounded", isPreview && "px-4"),
|
|
2271
|
-
children: currentGroupLabel
|
|
2272
|
-
}), !isPreview && onEditGroup && !dndDisabled && /* @__PURE__ */ jsx(IconButton, {
|
|
2273
|
-
size: "smallest",
|
|
2274
|
-
onClick: (e) => {
|
|
2275
|
-
e.stopPropagation();
|
|
2276
|
-
onEditGroup(currentGroupName);
|
|
2277
|
-
},
|
|
2278
|
-
className: cls("ml-2 ", isHovered ? "opacity-100" : "opacity-0", "transition-opacity duration-100"),
|
|
2279
|
-
children: /* @__PURE__ */ jsx(PencilIcon, { size: iconSize.smallest })
|
|
2280
|
-
})]
|
|
2281
|
-
});
|
|
2282
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2283
|
-
className: cls(!isPotentialCardDropTarget ? "my-10" : "my-6", "transition-all duration-200 ease-in-out"),
|
|
2284
|
-
children: [
|
|
2285
|
-
isPreview && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
2286
|
-
className: cls("flex items-center justify-between w-full", "p-4 py-2"),
|
|
2287
|
-
onMouseEnter: () => setIsHovered(true),
|
|
2288
|
-
onMouseLeave: () => setIsHovered(false),
|
|
2289
|
-
children: TitleContent
|
|
2290
|
-
}), children] }),
|
|
2291
|
-
!isPreview && showCaret && /* @__PURE__ */ jsx(ExpandablePanel, {
|
|
2292
|
-
invisible: true,
|
|
2293
|
-
expanded: !collapsed,
|
|
2294
|
-
onExpandedChange: (open) => {
|
|
2295
|
-
if (open !== !collapsed) onToggleCollapsed?.();
|
|
2296
|
-
},
|
|
2297
|
-
className: cls("mt-6"),
|
|
2298
|
-
titleClassName: cls("min-h-0 p-0 px-3 -mx-3 w-auto border-none", "rounded flex items-center justify-between w-full", "hover:bg-transparent", "cursor-pointer select-none", collapsed && "bg-surface-field"),
|
|
2299
|
-
innerClassName: cls("mt-4", !minimised ? "pt-0" : ""),
|
|
2300
|
-
title: /* @__PURE__ */ jsx("div", {
|
|
2301
|
-
onMouseEnter: () => setIsHovered(true),
|
|
2302
|
-
onMouseLeave: () => setIsHovered(false),
|
|
2303
|
-
className: "flex items-center",
|
|
2304
|
-
children: TitleContent
|
|
2305
|
-
}),
|
|
2306
|
-
children: minimised ? /* @__PURE__ */ jsx("div", {
|
|
2307
|
-
className: cls("mt-4 p-8 bg-surface-raised rounded-lg"),
|
|
2308
|
-
style: { minHeight: "50px" }
|
|
2309
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
2310
|
-
className: cls("mt-4", !minimised ? "pt-0" : ""),
|
|
2311
|
-
children
|
|
2312
|
-
})
|
|
2313
|
-
}),
|
|
2314
|
-
!isPreview && !showCaret && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
2315
|
-
className: cls("flex items-center justify-between w-full", "mt-6"),
|
|
2316
|
-
onMouseEnter: () => setIsHovered(true),
|
|
2317
|
-
onMouseLeave: () => setIsHovered(false),
|
|
2318
|
-
children: TitleContent
|
|
2319
|
-
}), !collapsed && (minimised ? /* @__PURE__ */ jsx("div", {
|
|
2320
|
-
className: cls("mt-4 p-8 bg-surface-raised rounded-lg"),
|
|
2321
|
-
style: { minHeight: "50px" }
|
|
2322
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
2323
|
-
className: cls("mt-4", !minimised ? "pt-0" : ""),
|
|
2324
|
-
children
|
|
2325
|
-
}))] })
|
|
2326
|
-
]
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2329
|
-
//#endregion
|
|
2330
|
-
//#region src/components/HomePage/NavigationCard.tsx
|
|
2331
|
-
var NavigationCard = React.memo(function NavigationCard({ name, description, icon, actions, additionalContent, onClick, shrink }) {
|
|
2332
|
-
return /* @__PURE__ */ jsx(Card, {
|
|
2333
|
-
className: cls("group h-full p-4 cursor-pointer transition-colors duration-150 ease-in-out", shrink && "w-full max-w-full min-h-0 scale-75"),
|
|
2334
|
-
onClick: () => {
|
|
2335
|
-
onClick?.();
|
|
2336
|
-
},
|
|
2337
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
2338
|
-
className: "flex flex-col h-full",
|
|
2339
|
-
children: [
|
|
2340
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2341
|
-
className: "flex items-center w-full justify-between mb-1",
|
|
2342
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
2343
|
-
className: "flex items-center gap-3",
|
|
2344
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
2345
|
-
className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 transition-colors duration-150 group-hover:text-primary dark:group-hover:text-primary",
|
|
2346
|
-
children: icon
|
|
2347
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
2348
|
-
variant: "subtitle1",
|
|
2349
|
-
component: "h2",
|
|
2350
|
-
children: name
|
|
2351
|
-
})]
|
|
2352
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
2353
|
-
className: "flex items-center gap-0.5",
|
|
2354
|
-
onClick: (event) => {
|
|
2355
|
-
event.preventDefault();
|
|
2356
|
-
event.stopPropagation();
|
|
2357
|
-
},
|
|
2358
|
-
children: actions
|
|
2359
|
-
})]
|
|
2360
|
-
}),
|
|
2361
|
-
/* @__PURE__ */ jsx("div", {
|
|
2362
|
-
className: "pl-8",
|
|
2363
|
-
children: description && /* @__PURE__ */ jsx(Typography, {
|
|
2364
|
-
variant: "caption",
|
|
2365
|
-
color: "secondary",
|
|
2366
|
-
component: "div",
|
|
2367
|
-
children: /* @__PURE__ */ jsx(Markdown, {
|
|
2368
|
-
source: description,
|
|
2369
|
-
size: "small"
|
|
2370
|
-
})
|
|
2371
|
-
})
|
|
2372
|
-
}),
|
|
2373
|
-
additionalContent && /* @__PURE__ */ jsx("div", {
|
|
2374
|
-
className: "pl-8 pointer-events-none",
|
|
2375
|
-
children: additionalContent
|
|
2376
|
-
}),
|
|
2377
|
-
/* @__PURE__ */ jsx("div", { className: "grow" })
|
|
2378
|
-
]
|
|
2379
|
-
})
|
|
2380
|
-
});
|
|
2381
|
-
});
|
|
2382
|
-
//#endregion
|
|
2383
|
-
//#region src/components/HomePage/NavigationCardBinding.tsx
|
|
2384
|
-
/**
|
|
2385
|
-
* This is the component used in the home page to render a card for each
|
|
2386
|
-
* collection or view.
|
|
2387
|
-
* @group Components
|
|
2388
|
-
* @param view
|
|
2389
|
-
* @param path
|
|
2390
|
-
* @param collection
|
|
2391
|
-
* @param url
|
|
2392
|
-
* @param name
|
|
2393
|
-
* @param description
|
|
2394
|
-
* @param onClick
|
|
2395
|
-
|
|
2396
|
-
*/
|
|
2397
|
-
function NavigationCardBinding({ slug, collection, view, url, name, description, onClick, type, shrink }) {
|
|
2398
|
-
const userConfigurationPersistence = useUserConfigurationPersistence();
|
|
2399
|
-
const collectionIcon = /* @__PURE__ */ jsx(IconForView, {
|
|
2400
|
-
collectionOrView: collection ?? view,
|
|
2401
|
-
size: "small"
|
|
2402
|
-
});
|
|
2403
|
-
const navigate = useNavigate();
|
|
2404
|
-
const context = useRebaseContext();
|
|
2405
|
-
const favourite = (userConfigurationPersistence?.favouritePaths ?? []).includes(slug);
|
|
2406
|
-
const actionsArray = userConfigurationPersistence ? [/* @__PURE__ */ jsx(IconButton, {
|
|
2407
|
-
size: "small",
|
|
2408
|
-
className: favourite ? void 0 : "opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100",
|
|
2409
|
-
onClick: (e) => {
|
|
2410
|
-
e.preventDefault();
|
|
2411
|
-
e.stopPropagation();
|
|
2412
|
-
if (favourite) userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== slug));
|
|
2413
|
-
else userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, slug]);
|
|
2414
|
-
},
|
|
2415
|
-
children: /* @__PURE__ */ jsx(StarIcon, { className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" })
|
|
2416
|
-
}, "favourite")] : [];
|
|
2417
|
-
const pluginCardActions = useSlot("home.collection.actions", {
|
|
2418
|
-
slug,
|
|
2419
|
-
collection,
|
|
2420
|
-
context
|
|
2421
|
-
});
|
|
2422
|
-
const pluginCardWidgets = useSlot("home.card.widget", {
|
|
2423
|
-
slug,
|
|
2424
|
-
collection,
|
|
2425
|
-
context
|
|
2426
|
-
});
|
|
2427
|
-
return /* @__PURE__ */ jsx(NavigationCard, {
|
|
2428
|
-
icon: collectionIcon,
|
|
2429
|
-
name,
|
|
2430
|
-
description,
|
|
2431
|
-
actions: /* @__PURE__ */ jsxs(Fragment, { children: [actionsArray, pluginCardActions] }),
|
|
2432
|
-
additionalContent: pluginCardWidgets.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: pluginCardWidgets }) : void 0,
|
|
2433
|
-
onClick: () => {
|
|
2434
|
-
onClick?.();
|
|
2435
|
-
navigate(url);
|
|
2436
|
-
if (userConfigurationPersistence) userConfigurationPersistence.setRecentlyVisitedPaths([slug, ...(userConfigurationPersistence.recentlyVisitedPaths ?? []).filter((p) => p !== slug)]);
|
|
2437
|
-
},
|
|
2438
|
-
shrink
|
|
2439
|
-
});
|
|
2440
|
-
}
|
|
2441
|
-
//#endregion
|
|
2442
|
-
//#region src/components/HomePage/HomePageDnD.tsx
|
|
2443
|
-
var animateLayoutChanges = (args) => defaultAnimateLayoutChanges({
|
|
2444
|
-
...args,
|
|
2445
|
-
wasDragging: true
|
|
2446
|
-
});
|
|
2447
|
-
var dropAnimationConfig = {};
|
|
2448
|
-
var cloneSerializableNavigationEntry = (entry) => {
|
|
2449
|
-
return {
|
|
2450
|
-
id: entry.id,
|
|
2451
|
-
slug: entry.slug,
|
|
2452
|
-
url: entry.url,
|
|
2453
|
-
name: entry.name,
|
|
2454
|
-
type: entry.type,
|
|
2455
|
-
collection: entry.collection ? { ...entry.collection } : void 0,
|
|
2456
|
-
view: entry.view ? { ...entry.view } : void 0,
|
|
2457
|
-
...entry.group && { group: entry.group },
|
|
2458
|
-
...entry.description && { description: entry.description }
|
|
2459
|
-
};
|
|
2460
|
-
};
|
|
2461
|
-
var cloneItemsForDnd = (items) => items.map((g) => ({
|
|
2462
|
-
name: g.name,
|
|
2463
|
-
entries: g.entries.map(cloneSerializableNavigationEntry)
|
|
2464
|
-
}));
|
|
2465
|
-
/**
|
|
2466
|
-
* dnd-kit's `attributes`, minus the `role` it assumes.
|
|
2467
|
-
*
|
|
2468
|
-
* The wrapper these land on contains a `<Link>` and the card's own action
|
|
2469
|
-
* buttons, and dnd-kit's `role: "button"` therefore declared a button
|
|
2470
|
-
* containing a link containing more buttons. Measured on a scaffold's home
|
|
2471
|
-
* page: 17 focusables for 5 destinations, 13 of the 17 `[role=button]` nested
|
|
2472
|
-
* inside another — which is what a screen reader has to read through before it
|
|
2473
|
-
* reaches the collection you wanted.
|
|
2474
|
-
*
|
|
2475
|
-
* The rest is kept, and it is the part that carries meaning:
|
|
2476
|
-
* `aria-roledescription="sortable"`, the instructions dnd-kit points
|
|
2477
|
-
* `aria-describedby` at, and the `tabIndex` its keyboard sensor needs — drag
|
|
2478
|
-
* still works from the keyboard.
|
|
2479
|
-
*
|
|
2480
|
-
* A dedicated drag handle is the better answer and the one dnd-kit documents;
|
|
2481
|
-
* it needs a control designed into the card, which is a visual change and not
|
|
2482
|
-
* this one.
|
|
2483
|
-
*/
|
|
2484
|
-
function draggableAttributes(attributes) {
|
|
2485
|
-
const { role: _role, ...rest } = attributes;
|
|
2486
|
-
return rest;
|
|
2487
|
-
}
|
|
2488
|
-
function SortableNavigationCard({ entry, onClick }) {
|
|
2489
|
-
const { setNodeRef, listeners, attributes, transform, transition, isDragging } = useSortable({
|
|
2490
|
-
id: entry.url,
|
|
2491
|
-
animateLayoutChanges
|
|
2492
|
-
});
|
|
2493
|
-
return /* @__PURE__ */ jsx("div", {
|
|
2494
|
-
ref: setNodeRef,
|
|
2495
|
-
style: {
|
|
2496
|
-
transform: transform ? CSS.Transform.toString(transform) : void 0,
|
|
2497
|
-
transition,
|
|
2498
|
-
opacity: isDragging ? 0 : 1
|
|
2499
|
-
},
|
|
2500
|
-
...draggableAttributes(attributes),
|
|
2501
|
-
...listeners,
|
|
2502
|
-
children: /* @__PURE__ */ jsx(NavigationCardBinding, {
|
|
2503
|
-
...entry,
|
|
2504
|
-
onClick
|
|
2505
|
-
})
|
|
2506
|
-
});
|
|
2507
|
-
}
|
|
2508
|
-
function NavigationGroupDroppable({ id, itemIds, children, isPotentialCardDropTarget = false }) {
|
|
2509
|
-
const { setNodeRef } = useDroppable({ id });
|
|
2510
|
-
return /* @__PURE__ */ jsx("div", {
|
|
2511
|
-
ref: setNodeRef,
|
|
2512
|
-
className: cls(isPotentialCardDropTarget ? "p-2 bg-surface-raised rounded-lg" : void 0, "transition-all duration-200 ease-in-out"),
|
|
2513
|
-
children: /* @__PURE__ */ jsx(SortableContext, {
|
|
2514
|
-
items: itemIds,
|
|
2515
|
-
strategy: rectSortingStrategy,
|
|
2516
|
-
children
|
|
2517
|
-
})
|
|
2518
|
-
});
|
|
2519
|
-
}
|
|
2520
|
-
function SortableNavigationGroup({ groupName, children, disabled }) {
|
|
2521
|
-
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
|
2522
|
-
id: groupName,
|
|
2523
|
-
animateLayoutChanges,
|
|
2524
|
-
disabled
|
|
2525
|
-
});
|
|
2526
|
-
return /* @__PURE__ */ jsx("div", {
|
|
2527
|
-
ref: setNodeRef,
|
|
2528
|
-
style: {
|
|
2529
|
-
transform: transform ? CSS.Transform.toString(transform) : void 0,
|
|
2530
|
-
transition,
|
|
2531
|
-
opacity: isDragging ? 0 : 1
|
|
2532
|
-
},
|
|
2533
|
-
...draggableAttributes(attributes),
|
|
2534
|
-
...listeners,
|
|
2535
|
-
children
|
|
2536
|
-
});
|
|
2537
|
-
}
|
|
2538
|
-
function useHomePageDnd({ items, setItems, disabled, onCardMovedBetweenGroups, onGroupMoved, onNewGroupDrop, onPersist }) {
|
|
2539
|
-
const dndItems = items;
|
|
2540
|
-
const setDndItems = setItems;
|
|
2541
|
-
const [activeId, setActiveId] = useState(null);
|
|
2542
|
-
const [activeIsGroup, setActiveIsGroup] = useState(false);
|
|
2543
|
-
const [currentDraggingGroupId, setCurrentDraggingGroupId] = useState(null);
|
|
2544
|
-
const [dndKitActiveNode, setDndKitActiveNode] = useState(null);
|
|
2545
|
-
const [isDraggingCardOnly, setIsDraggingCardOnly] = useState(false);
|
|
2546
|
-
const [dialogOpenForGroup, setDialogOpenForGroup] = useState(null);
|
|
2547
|
-
const [isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone] = useState(false);
|
|
2548
|
-
const [pendingNewGroupName, setPendingNewGroupName] = useState(null);
|
|
2549
|
-
const [stateBeforeNewGroup, setStateBeforeNewGroup] = useState(null);
|
|
2550
|
-
const preDragItemsRef = useRef(null);
|
|
2551
|
-
const interimItemsRef = useRef(null);
|
|
2552
|
-
useEffect(() => {
|
|
2553
|
-
interimItemsRef.current = dndItems;
|
|
2554
|
-
}, [dndItems]);
|
|
2555
|
-
const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 10 } }), useSensor(TouchSensor, { activationConstraint: {
|
|
2556
|
-
delay: 150,
|
|
2557
|
-
tolerance: 5
|
|
2558
|
-
} }), useSensor(KeyboardSensor));
|
|
2559
|
-
const dndContainers = dndItems.map((g) => g.name);
|
|
2560
|
-
const findDndContainer = useCallback((id) => {
|
|
2561
|
-
if (!id) return void 0;
|
|
2562
|
-
const group = dndItems.find((g) => g.name === id);
|
|
2563
|
-
if (group) return group.name;
|
|
2564
|
-
for (const g of dndItems) if (g.entries.some((e) => e.url === id)) return g.name;
|
|
2565
|
-
}, [dndItems]);
|
|
2566
|
-
const lastOverId = useRef(null);
|
|
2567
|
-
const recentlyMovedToNewContainer = useRef(false);
|
|
2568
|
-
const collisionDetection = useCallback((args) => {
|
|
2569
|
-
if (disabled || !activeId) return [];
|
|
2570
|
-
if (activeIsGroup) {
|
|
2571
|
-
const groups = args.droppableContainers.filter((c) => dndItems.some((g) => g.name === c.id));
|
|
2572
|
-
if (!groups.length) return [];
|
|
2573
|
-
return closestCenter({
|
|
2574
|
-
...args,
|
|
2575
|
-
droppableContainers: groups
|
|
2576
|
-
});
|
|
2577
|
-
}
|
|
2578
|
-
const pointer = pointerWithin(args);
|
|
2579
|
-
if (pointer.length) {
|
|
2580
|
-
const zone = pointer.find((c) => c.id === "new-group-drop-zone");
|
|
2581
|
-
if (zone) return [zone];
|
|
2582
|
-
const container = pointer.find((c) => dndItems.some((g) => g.name === c.id));
|
|
2583
|
-
if (container) {
|
|
2584
|
-
const itemsIn = dndItems.find((g) => g.name === container.id)?.entries;
|
|
2585
|
-
if (itemsIn?.length) {
|
|
2586
|
-
const closest = closestCorners({
|
|
2587
|
-
...args,
|
|
2588
|
-
droppableContainers: args.droppableContainers.filter((c) => itemsIn.some((e) => e.url === c.id))
|
|
2589
|
-
});
|
|
2590
|
-
if (closest.length) return closest;
|
|
2591
|
-
}
|
|
2592
|
-
return [container];
|
|
2593
|
-
}
|
|
2594
|
-
const first = getFirstCollision(pointer, "id");
|
|
2595
|
-
if (first) return [{ id: first }];
|
|
2596
|
-
}
|
|
2597
|
-
const rects = rectIntersection(args);
|
|
2598
|
-
const zoneRect = rects.find((c) => c.id === "new-group-drop-zone");
|
|
2599
|
-
if (zoneRect) return [zoneRect];
|
|
2600
|
-
let overId = getFirstCollision(rects, "id");
|
|
2601
|
-
if (overId != null) {
|
|
2602
|
-
if (dndItems.some((g) => g.name === overId)) {
|
|
2603
|
-
const itemsIn = dndItems.find((g) => g.name === overId)?.entries;
|
|
2604
|
-
if (itemsIn?.length) {
|
|
2605
|
-
const closestItem = closestCorners({
|
|
2606
|
-
...args,
|
|
2607
|
-
droppableContainers: args.droppableContainers.filter((c) => itemsIn.some((e) => e.url === c.id))
|
|
2608
|
-
})[0]?.id;
|
|
2609
|
-
if (closestItem) overId = closestItem;
|
|
2610
|
-
}
|
|
2611
|
-
}
|
|
2612
|
-
lastOverId.current = overId;
|
|
2613
|
-
return [{ id: overId }];
|
|
2614
|
-
}
|
|
2615
|
-
if (recentlyMovedToNewContainer.current && lastOverId.current && !activeIsGroup) return [{ id: lastOverId.current }];
|
|
2616
|
-
return [];
|
|
2617
|
-
}, [
|
|
2618
|
-
activeId,
|
|
2619
|
-
dndItems,
|
|
2620
|
-
disabled,
|
|
2621
|
-
activeIsGroup
|
|
2622
|
-
]);
|
|
2623
|
-
const handleDragStart = ({ active }) => {
|
|
2624
|
-
setDndKitActiveNode(active);
|
|
2625
|
-
if (disabled) return;
|
|
2626
|
-
preDragItemsRef.current = cloneItemsForDnd(dndItems);
|
|
2627
|
-
const isGroup = dndItems.some((g) => g.name === active.id);
|
|
2628
|
-
if (!active.data.current) active.data.current = {};
|
|
2629
|
-
active.data.current.type = isGroup ? "group" : "item";
|
|
2630
|
-
setActiveId(active.id);
|
|
2631
|
-
setActiveIsGroup(isGroup);
|
|
2632
|
-
setIsDraggingCardOnly(!isGroup);
|
|
2633
|
-
if (isGroup) setCurrentDraggingGroupId(active.id);
|
|
2634
|
-
recentlyMovedToNewContainer.current = false;
|
|
2635
|
-
};
|
|
2636
|
-
const handleDragOver = ({ active, over }) => {
|
|
2637
|
-
if (disabled || !over) return;
|
|
2638
|
-
const activeIdNow = active.id;
|
|
2639
|
-
const overIdNow = over.id;
|
|
2640
|
-
if (activeIdNow === overIdNow) return;
|
|
2641
|
-
if (activeIsGroup) return;
|
|
2642
|
-
const activeCont = findDndContainer(activeIdNow);
|
|
2643
|
-
const overCont = findDndContainer(overIdNow);
|
|
2644
|
-
if (!activeCont) return;
|
|
2645
|
-
if (overCont && activeCont !== overCont) {
|
|
2646
|
-
recentlyMovedToNewContainer.current = true;
|
|
2647
|
-
lastOverId.current = overIdNow;
|
|
2648
|
-
setDndItems((current) => {
|
|
2649
|
-
const newState = cloneItemsForDnd(current);
|
|
2650
|
-
const srcIdx = newState.findIndex((g) => g.name === activeCont);
|
|
2651
|
-
const tgtIdx = newState.findIndex((g) => g.name === overCont);
|
|
2652
|
-
if (srcIdx === -1 || tgtIdx === -1) return current;
|
|
2653
|
-
const src = newState[srcIdx];
|
|
2654
|
-
const tgt = newState[tgtIdx];
|
|
2655
|
-
const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);
|
|
2656
|
-
if (idxInSrc === -1) return current;
|
|
2657
|
-
const [moved] = src.entries.splice(idxInSrc, 1);
|
|
2658
|
-
if (overIdNow === overCont) tgt.entries.push(moved);
|
|
2659
|
-
else {
|
|
2660
|
-
const overIdx = tgt.entries.findIndex((e) => e.url === overIdNow);
|
|
2661
|
-
if (overIdx !== -1) tgt.entries.splice(overIdx, 0, moved);
|
|
2662
|
-
else tgt.entries.push(moved);
|
|
2663
|
-
}
|
|
2664
|
-
return newState;
|
|
2665
|
-
});
|
|
2666
|
-
} else if (activeCont === overCont) recentlyMovedToNewContainer.current = false;
|
|
2667
|
-
};
|
|
2668
|
-
const handleDragEnd = ({ active, over }) => {
|
|
2669
|
-
if (disabled || !over) {
|
|
2670
|
-
resetDragState();
|
|
2671
|
-
return;
|
|
2672
|
-
}
|
|
2673
|
-
const activeIdNow = active.id;
|
|
2674
|
-
const overIdNow = over.id;
|
|
2675
|
-
if (activeIsGroup) {
|
|
2676
|
-
if (activeIdNow !== overIdNow && dndItems.some((g) => g.name === overIdNow)) {
|
|
2677
|
-
const from = dndItems.findIndex((g) => g.name === activeIdNow);
|
|
2678
|
-
const to = dndItems.findIndex((g) => g.name === overIdNow);
|
|
2679
|
-
if (from !== -1 && to !== -1) {
|
|
2680
|
-
const newState = arrayMove(dndItems, from, to);
|
|
2681
|
-
setDndItems(newState);
|
|
2682
|
-
onPersist?.(newState);
|
|
2683
|
-
onGroupMoved?.(activeIdNow, from, to);
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
} else {
|
|
2687
|
-
const findContainerInState = (id, state) => {
|
|
2688
|
-
const group = state.find((g) => g.name === id);
|
|
2689
|
-
if (group) return group.name;
|
|
2690
|
-
for (const g of state) if (g.entries.some((e) => e.url === id)) return g.name;
|
|
2691
|
-
};
|
|
2692
|
-
const sourceState = preDragItemsRef.current || dndItems;
|
|
2693
|
-
const activeCont = findContainerInState(activeIdNow, sourceState);
|
|
2694
|
-
findDndContainer(overIdNow);
|
|
2695
|
-
if (overIdNow === "new-group-drop-zone") {
|
|
2696
|
-
if (activeCont) {
|
|
2697
|
-
setStateBeforeNewGroup(cloneItemsForDnd(dndItems));
|
|
2698
|
-
const newState = cloneItemsForDnd(dndItems);
|
|
2699
|
-
const srcIdx = newState.findIndex((g) => g.name === activeCont);
|
|
2700
|
-
if (srcIdx !== -1) {
|
|
2701
|
-
const src = newState[srcIdx];
|
|
2702
|
-
const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);
|
|
2703
|
-
if (idxInSrc !== -1) {
|
|
2704
|
-
const [dragged] = src.entries.splice(idxInSrc, 1);
|
|
2705
|
-
if (src.entries.length === 0) newState.splice(srcIdx, 1);
|
|
2706
|
-
let tentative = "New Group";
|
|
2707
|
-
let counter = 1;
|
|
2708
|
-
while (newState.some((g) => g.name === tentative)) tentative = `New Group ${counter++}`;
|
|
2709
|
-
newState.push({
|
|
2710
|
-
name: tentative,
|
|
2711
|
-
entries: [dragged]
|
|
2712
|
-
});
|
|
2713
|
-
setDndItems(newState);
|
|
2714
|
-
setPendingNewGroupName(tentative);
|
|
2715
|
-
setDialogOpenForGroup(tentative);
|
|
2716
|
-
onNewGroupDrop?.();
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
} else {
|
|
2721
|
-
const overCont = findDndContainer(overIdNow);
|
|
2722
|
-
if (activeCont === overCont) {
|
|
2723
|
-
const grpIdx = dndItems.findIndex((g) => g.name === activeCont);
|
|
2724
|
-
if (grpIdx !== -1) {
|
|
2725
|
-
const group = dndItems[grpIdx];
|
|
2726
|
-
const oldIdx = group.entries.findIndex((e) => e.url === activeIdNow);
|
|
2727
|
-
let newIdx = group.entries.findIndex((e) => e.url === overIdNow);
|
|
2728
|
-
if (newIdx === -1 && overIdNow === activeCont) newIdx = group.entries.length - 1;
|
|
2729
|
-
if (oldIdx !== -1 && newIdx !== -1 && oldIdx !== newIdx) {
|
|
2730
|
-
const reordered = arrayMove(group.entries, oldIdx, newIdx);
|
|
2731
|
-
const newState = [...dndItems];
|
|
2732
|
-
newState[grpIdx] = {
|
|
2733
|
-
...group,
|
|
2734
|
-
entries: reordered
|
|
2735
|
-
};
|
|
2736
|
-
setDndItems(newState);
|
|
2737
|
-
onPersist?.(newState);
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
} else if (overCont && activeCont !== overCont) {
|
|
2741
|
-
const finalState = cloneItemsForDnd(sourceState);
|
|
2742
|
-
const finalOverId = lastOverId.current || overIdNow;
|
|
2743
|
-
const cleanOverCont = findContainerInState(finalOverId, sourceState) || overCont;
|
|
2744
|
-
const srcIdx = finalState.findIndex((g) => g.name === activeCont);
|
|
2745
|
-
const tgtIdx = finalState.findIndex((g) => g.name === cleanOverCont);
|
|
2746
|
-
if (srcIdx !== -1 && tgtIdx !== -1) {
|
|
2747
|
-
const src = finalState[srcIdx];
|
|
2748
|
-
const tgt = finalState[tgtIdx];
|
|
2749
|
-
const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);
|
|
2750
|
-
if (idxInSrc !== -1) {
|
|
2751
|
-
const [moved] = src.entries.splice(idxInSrc, 1);
|
|
2752
|
-
if (finalOverId === cleanOverCont) tgt.entries.push(moved);
|
|
2753
|
-
else {
|
|
2754
|
-
const overIdx = tgt.entries.findIndex((e) => e.url === finalOverId);
|
|
2755
|
-
if (overIdx !== -1) tgt.entries.splice(overIdx, 0, moved);
|
|
2756
|
-
else tgt.entries.push(moved);
|
|
2757
|
-
}
|
|
2758
|
-
if (src.entries.length === 0) finalState.splice(srcIdx, 1);
|
|
2759
|
-
setDndItems(finalState);
|
|
2760
|
-
onPersist?.(finalState);
|
|
2761
|
-
onCardMovedBetweenGroups?.(moved);
|
|
2762
|
-
}
|
|
2763
|
-
}
|
|
2764
|
-
} else if (recentlyMovedToNewContainer.current) console.error("Move between containers detected but conditions not met", {
|
|
2765
|
-
activeCont,
|
|
2766
|
-
overCont,
|
|
2767
|
-
activeIdNow,
|
|
2768
|
-
overIdNow
|
|
2769
|
-
});
|
|
2770
|
-
}
|
|
2771
|
-
}
|
|
2772
|
-
resetDragState();
|
|
2773
|
-
};
|
|
2774
|
-
const resetDragState = () => {
|
|
2775
|
-
setDndKitActiveNode(null);
|
|
2776
|
-
setActiveId(null);
|
|
2777
|
-
setActiveIsGroup(false);
|
|
2778
|
-
setCurrentDraggingGroupId(null);
|
|
2779
|
-
setIsDraggingCardOnly(false);
|
|
2780
|
-
recentlyMovedToNewContainer.current = false;
|
|
2781
|
-
};
|
|
2782
|
-
const handleDragCancel = () => resetDragState();
|
|
2783
|
-
const handleRenameGroup = (oldName, newName) => {
|
|
2784
|
-
setDndItems((current) => {
|
|
2785
|
-
const idx = current.findIndex((g) => g.name === oldName);
|
|
2786
|
-
if (idx === -1) return current;
|
|
2787
|
-
if (current.some((g) => g.name === newName && g.name !== oldName)) return current;
|
|
2788
|
-
const updated = [...current];
|
|
2789
|
-
updated[idx] = {
|
|
2790
|
-
...updated[idx],
|
|
2791
|
-
name: newName
|
|
2792
|
-
};
|
|
2793
|
-
onPersist?.(updated);
|
|
2794
|
-
return updated;
|
|
2795
|
-
});
|
|
2796
|
-
setPendingNewGroupName(null);
|
|
2797
|
-
setStateBeforeNewGroup(null);
|
|
2798
|
-
setDialogOpenForGroup(null);
|
|
2799
|
-
};
|
|
2800
|
-
const handleDialogClose = () => {
|
|
2801
|
-
if (pendingNewGroupName && dialogOpenForGroup === pendingNewGroupName && stateBeforeNewGroup) setDndItems(stateBeforeNewGroup);
|
|
2802
|
-
setPendingNewGroupName(null);
|
|
2803
|
-
setStateBeforeNewGroup(null);
|
|
2804
|
-
setDialogOpenForGroup(null);
|
|
2805
|
-
};
|
|
2806
|
-
return {
|
|
2807
|
-
sensors,
|
|
2808
|
-
collisionDetection,
|
|
2809
|
-
onDragStart: handleDragStart,
|
|
2810
|
-
onDragOver: handleDragOver,
|
|
2811
|
-
onDragEnd: handleDragEnd,
|
|
2812
|
-
onDragCancel: handleDragCancel,
|
|
2813
|
-
dropAnimation: dropAnimationConfig,
|
|
2814
|
-
activeItemForOverlay: disabled || !activeId || activeIsGroup ? null : dndItems.flatMap((g) => g.entries).find((e) => e.url === activeId) || null,
|
|
2815
|
-
activeGroupData: disabled || !activeId || !activeIsGroup ? null : dndItems.find((g) => g.name === activeId) || null,
|
|
2816
|
-
draggingGroupId: currentDraggingGroupId,
|
|
2817
|
-
containers: dndContainers,
|
|
2818
|
-
dndKitActiveNode,
|
|
2819
|
-
isDraggingCardOnly,
|
|
2820
|
-
dialogOpenForGroup,
|
|
2821
|
-
setDialogOpenForGroup,
|
|
2822
|
-
handleRenameGroup,
|
|
2823
|
-
handleDialogClose,
|
|
2824
|
-
isHoveringNewGroupDropZone,
|
|
2825
|
-
setIsHoveringNewGroupDropZone
|
|
2826
|
-
};
|
|
2827
|
-
}
|
|
2828
|
-
function NewGroupDropZone({ disabled, setIsHovering }) {
|
|
2829
|
-
const { setNodeRef, isOver } = useDroppable({
|
|
2830
|
-
id: "new-group-drop-zone",
|
|
2831
|
-
disabled
|
|
2832
|
-
});
|
|
2833
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
2834
|
-
useDndMonitor({
|
|
2835
|
-
onDragStart({ active }) {
|
|
2836
|
-
if (disabled) return;
|
|
2837
|
-
const tp = active.data.current?.type;
|
|
2838
|
-
setIsVisible(tp === "item");
|
|
2839
|
-
},
|
|
2840
|
-
onDragEnd() {
|
|
2841
|
-
setIsVisible(false);
|
|
2842
|
-
},
|
|
2843
|
-
onDragCancel() {
|
|
2844
|
-
setIsVisible(false);
|
|
2845
|
-
}
|
|
2846
|
-
});
|
|
2847
|
-
useEffect(() => {
|
|
2848
|
-
setIsHovering(isOver && isVisible);
|
|
2849
|
-
}, [
|
|
2850
|
-
isOver,
|
|
2851
|
-
isVisible,
|
|
2852
|
-
setIsHovering
|
|
2853
|
-
]);
|
|
2854
|
-
if (!isVisible || disabled) return null;
|
|
2855
|
-
return /* @__PURE__ */ jsx("div", {
|
|
2856
|
-
ref: setNodeRef,
|
|
2857
|
-
className: cls("fixed right-8 top-1/2 -translate-y-1/2 w-[200px] h-[120px] border border-dashed rounded-lg flex items-center justify-center transition-all", isOver ? "bg-surface-raised border-hairline-strong" : "bg-surface-card border-hairline-strong"),
|
|
2858
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
2859
|
-
className: "text-center p-4",
|
|
2860
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
2861
|
-
className: "block font-medium text-sm",
|
|
2862
|
-
children: "Drop here to create a new group"
|
|
2863
|
-
})
|
|
2864
|
-
})
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
//#endregion
|
|
2868
|
-
//#region src/components/HomePage/RenameGroupDialog.tsx
|
|
2869
|
-
function RenameGroupDialog({ open, initialName, existingGroupNames, onClose, onRename }) {
|
|
2870
|
-
const { t } = useTranslation();
|
|
2871
|
-
const [name, setName] = useState(initialName);
|
|
2872
|
-
const [error, setError] = useState(null);
|
|
2873
|
-
const inputRef = useRef(null);
|
|
2874
|
-
useEffect(() => {
|
|
2875
|
-
if (open) {
|
|
2876
|
-
setName(initialName);
|
|
2877
|
-
setError(null);
|
|
2878
|
-
setTimeout(() => {
|
|
2879
|
-
if (inputRef.current) {
|
|
2880
|
-
inputRef.current.focus();
|
|
2881
|
-
inputRef.current.select();
|
|
2882
|
-
}
|
|
2883
|
-
}, 100);
|
|
2884
|
-
}
|
|
2885
|
-
}, [initialName, open]);
|
|
2886
|
-
const handleNameChange = (event) => {
|
|
2887
|
-
const newName = event.target.value;
|
|
2888
|
-
setName(newName);
|
|
2889
|
-
if (!newName.trim()) setError(t("group_name_empty_error"));
|
|
2890
|
-
else if (existingGroupNames.includes(newName.trim())) setError(t("group_name_exists_error"));
|
|
2891
|
-
else setError(null);
|
|
2892
|
-
};
|
|
2893
|
-
const handleSave = () => {
|
|
2894
|
-
const trimmedName = name.trim();
|
|
2895
|
-
if (!trimmedName) {
|
|
2896
|
-
setError(t("group_name_empty_error"));
|
|
2897
|
-
return;
|
|
2898
|
-
}
|
|
2899
|
-
if (existingGroupNames.includes(trimmedName)) {
|
|
2900
|
-
setError(t("group_name_exists_error"));
|
|
2901
|
-
return;
|
|
2902
|
-
}
|
|
2903
|
-
if (!error) {
|
|
2904
|
-
onRename(trimmedName);
|
|
2905
|
-
onClose();
|
|
2906
|
-
}
|
|
2907
|
-
};
|
|
2908
|
-
const handleKeyDown = (event) => {
|
|
2909
|
-
if (event.key === "Enter") {
|
|
2910
|
-
event.preventDefault();
|
|
2911
|
-
const trimmedName = name.trim();
|
|
2912
|
-
let currentError = null;
|
|
2913
|
-
if (!trimmedName) currentError = t("group_name_empty_error");
|
|
2914
|
-
else if (existingGroupNames.includes(trimmedName)) currentError = t("group_name_exists_error");
|
|
2915
|
-
if (!currentError && trimmedName) handleSave();
|
|
2916
|
-
else if (currentError) setError(currentError);
|
|
2917
|
-
}
|
|
2918
|
-
};
|
|
2919
|
-
if (!open) return null;
|
|
2920
|
-
return /* @__PURE__ */ jsxs(Dialog, {
|
|
2921
|
-
open,
|
|
2922
|
-
children: [
|
|
2923
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: t("rename_group") }),
|
|
2924
|
-
/* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsx(TextField, {
|
|
2925
|
-
inputRef,
|
|
2926
|
-
label: t("group_name_label"),
|
|
2927
|
-
value: name,
|
|
2928
|
-
onChange: handleNameChange,
|
|
2929
|
-
onKeyDown: handleKeyDown,
|
|
2930
|
-
error: !!error,
|
|
2931
|
-
"aria-describedby": error ? "group-name-error" : void 0
|
|
2932
|
-
}), error && /* @__PURE__ */ jsx("p", {
|
|
2933
|
-
id: "group-name-error",
|
|
2934
|
-
style: { display: "none" },
|
|
2935
|
-
children: error
|
|
2936
|
-
})] }),
|
|
2937
|
-
/* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
|
|
2938
|
-
onClick: onClose,
|
|
2939
|
-
variant: "text",
|
|
2940
|
-
children: t("cancel")
|
|
2941
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
2942
|
-
onClick: handleSave,
|
|
2943
|
-
disabled: !!error || !name.trim(),
|
|
2944
|
-
children: t("save")
|
|
2945
|
-
})] })
|
|
2946
|
-
]
|
|
2947
|
-
});
|
|
2948
|
-
}
|
|
2949
|
-
//#endregion
|
|
2950
|
-
//#region src/components/HomePage/ContentHomePage.tsx
|
|
2951
|
-
var DEFAULT_GROUP_NAME = "Views";
|
|
2952
|
-
var ADMIN_GROUP_NAME = "Admin";
|
|
2953
|
-
function ContentHomePage({ additionalActions, additionalChildrenStart, additionalChildrenEnd, sections, hiddenGroups }) {
|
|
2954
|
-
const context = useAdminContext();
|
|
2955
|
-
const { navigationStateController } = context;
|
|
2956
|
-
const customizationController = useCustomizationController();
|
|
2957
|
-
const adminModeController = useAdminModeController();
|
|
2958
|
-
const registry = useRebaseRegistry();
|
|
2959
|
-
const { resolvedSlots } = customizationController;
|
|
2960
|
-
const breadcrumbs = useBreadcrumbsController();
|
|
2961
|
-
const { t } = useTranslation();
|
|
2962
|
-
useEffect(() => {
|
|
2963
|
-
breadcrumbs.set({ breadcrumbs: [] });
|
|
2964
|
-
}, [breadcrumbs.set]);
|
|
2965
|
-
const { allowDragAndDrop = false, navigationEntries: unFilteredNavigationEntries = [], groups: unFilteredGroupOrder = [], onNavigationEntriesUpdate = () => {} } = navigationStateController.topLevelNavigation || {};
|
|
2966
|
-
const studioViewSlugs = useMemo(() => {
|
|
2967
|
-
const slugs = /* @__PURE__ */ new Set();
|
|
2968
|
-
(registry.studioConfig?.devViews ?? []).forEach((v) => slugs.add(v.slug));
|
|
2969
|
-
if (registry.studioConfig && registry.cmsConfig?.collectionEditor) slugs.add("schema");
|
|
2970
|
-
return slugs;
|
|
2971
|
-
}, [registry.studioConfig, registry.cmsConfig?.collectionEditor]);
|
|
2972
|
-
const rawNavigationEntries = useMemo(() => {
|
|
2973
|
-
if (adminModeController.mode === "studio") return unFilteredNavigationEntries.filter((e) => e.type === "view" && studioViewSlugs.has(e.slug) || e.type === "admin");
|
|
2974
|
-
return unFilteredNavigationEntries.filter((e) => e.type !== "view" || !studioViewSlugs.has(e.slug));
|
|
2975
|
-
}, [
|
|
2976
|
-
unFilteredNavigationEntries,
|
|
2977
|
-
adminModeController.mode,
|
|
2978
|
-
studioViewSlugs
|
|
2979
|
-
]);
|
|
2980
|
-
const groupOrderFromNavController = useMemo(() => {
|
|
2981
|
-
const entryGroups = new Set(rawNavigationEntries.map((e) => e.group).filter(Boolean));
|
|
2982
|
-
return unFilteredGroupOrder.filter((g) => entryGroups.has(g));
|
|
2983
|
-
}, [unFilteredGroupOrder, rawNavigationEntries]);
|
|
2984
|
-
const fuse = useRef(null);
|
|
2985
|
-
const [filteredUrls, setFilteredUrls] = useState(null);
|
|
2986
|
-
const performingSearch = Boolean(filteredUrls);
|
|
2987
|
-
const filteredNavigationEntries = useMemo(() => {
|
|
2988
|
-
return filteredUrls ? rawNavigationEntries.filter((e) => filteredUrls.includes(e.url)) : rawNavigationEntries;
|
|
2989
|
-
}, [filteredUrls, rawNavigationEntries]);
|
|
2990
|
-
useEffect(() => {
|
|
2991
|
-
fuse.current = new Fuse(rawNavigationEntries, { keys: [
|
|
2992
|
-
"name",
|
|
2993
|
-
"description",
|
|
2994
|
-
"group",
|
|
2995
|
-
"path"
|
|
2996
|
-
] });
|
|
2997
|
-
}, [rawNavigationEntries]);
|
|
2998
|
-
const updateSearch = useCallback((v) => {
|
|
2999
|
-
if (!v?.trim()) {
|
|
3000
|
-
setFilteredUrls(null);
|
|
3001
|
-
return;
|
|
3002
|
-
}
|
|
3003
|
-
const results = fuse.current?.search(v.trim());
|
|
3004
|
-
setFilteredUrls(results ? results.map((x) => x.item.url) : []);
|
|
3005
|
-
}, []);
|
|
3006
|
-
const [items, setItems] = useState([]);
|
|
3007
|
-
const [adminGroupData, setAdminGroupData] = useState(null);
|
|
3008
|
-
const isDndDirtyRef = useRef(false);
|
|
3009
|
-
const dndDirtyTimeoutRef = useRef(null);
|
|
3010
|
-
const processedGroups = useMemo(() => {
|
|
3011
|
-
const src = filteredNavigationEntries;
|
|
3012
|
-
const entriesByGroup = {};
|
|
3013
|
-
src.forEach((e) => {
|
|
3014
|
-
const g = e.type === "admin" ? ADMIN_GROUP_NAME : e.group ?? "Views";
|
|
3015
|
-
(entriesByGroup[g] ??= []).push(e);
|
|
3016
|
-
});
|
|
3017
|
-
const hasPluginAdditionalCards = customizationController.resolvedSlots.some((s) => s.slot === "home.cards");
|
|
3018
|
-
let allProcessed;
|
|
3019
|
-
if (performingSearch) allProcessed = [...new Set(src.map((e) => e.group ?? "Views"))].map((name) => ({
|
|
3020
|
-
name,
|
|
3021
|
-
entries: entriesByGroup[name] || []
|
|
3022
|
-
})).filter((g) => g.entries.length);
|
|
3023
|
-
else {
|
|
3024
|
-
allProcessed = groupOrderFromNavController.map((g) => ({
|
|
3025
|
-
name: g,
|
|
3026
|
-
entries: entriesByGroup[g] || []
|
|
3027
|
-
}));
|
|
3028
|
-
Object.keys(entriesByGroup).forEach((g) => {
|
|
3029
|
-
if (!groupOrderFromNavController.includes(g)) allProcessed.push({
|
|
3030
|
-
name: g,
|
|
3031
|
-
entries: entriesByGroup[g]
|
|
3032
|
-
});
|
|
3033
|
-
});
|
|
3034
|
-
if (hasPluginAdditionalCards && !allProcessed.some((g) => g.name === "Views")) allProcessed.push({
|
|
3035
|
-
name: DEFAULT_GROUP_NAME,
|
|
3036
|
-
entries: []
|
|
3037
|
-
});
|
|
3038
|
-
allProcessed = allProcessed.filter((g) => g.entries.length || g.name === "Views" && hasPluginAdditionalCards);
|
|
3039
|
-
}
|
|
3040
|
-
return {
|
|
3041
|
-
adminGroupData: allProcessed.find((g) => g.name === "Admin") || null,
|
|
3042
|
-
items: allProcessed.filter((g) => g.name !== "Admin" && !hiddenGroups?.includes(g.name))
|
|
3043
|
-
};
|
|
3044
|
-
}, [
|
|
3045
|
-
filteredNavigationEntries,
|
|
3046
|
-
performingSearch,
|
|
3047
|
-
groupOrderFromNavController,
|
|
3048
|
-
customizationController.resolvedSlots,
|
|
3049
|
-
hiddenGroups
|
|
3050
|
-
]);
|
|
3051
|
-
useEffect(() => {
|
|
3052
|
-
if (isDndDirtyRef.current) return;
|
|
3053
|
-
setAdminGroupData(processedGroups.adminGroupData);
|
|
3054
|
-
setItems(processedGroups.items);
|
|
3055
|
-
}, [processedGroups]);
|
|
3056
|
-
const updateItems = (updater) => {
|
|
3057
|
-
setItems(updater);
|
|
3058
|
-
};
|
|
3059
|
-
const persistNavigationGroups = (latest) => {
|
|
3060
|
-
isDndDirtyRef.current = true;
|
|
3061
|
-
if (dndDirtyTimeoutRef.current) clearTimeout(dndDirtyTimeoutRef.current);
|
|
3062
|
-
dndDirtyTimeoutRef.current = setTimeout(() => {
|
|
3063
|
-
isDndDirtyRef.current = false;
|
|
3064
|
-
}, 1e3);
|
|
3065
|
-
const draggable = latest.map((g) => ({
|
|
3066
|
-
name: g.name,
|
|
3067
|
-
entries: g.entries.map((e) => e.slug)
|
|
3068
|
-
}));
|
|
3069
|
-
const all = adminGroupData ? [...draggable, {
|
|
3070
|
-
name: adminGroupData.name,
|
|
3071
|
-
entries: adminGroupData.entries.map((e) => e.slug)
|
|
3072
|
-
}] : draggable;
|
|
3073
|
-
onNavigationEntriesUpdate(all);
|
|
3074
|
-
};
|
|
3075
|
-
const { isGroupCollapsed, toggleGroupCollapsed } = useCollapsedGroups(useMemo(() => [...items.map((item) => item.name), ...adminGroupData ? [adminGroupData.name] : []], [items, adminGroupData]), "home", useMemo(() => buildCollapsedDefaults(registry.cmsConfig?.navigationGroupMappings, "home"), [registry.cmsConfig?.navigationGroupMappings]));
|
|
3076
|
-
const { sensors, collisionDetection, onDragStart, onDragOver, onDragEnd, dropAnimation, activeItemForOverlay, activeGroupData, draggingGroupId, containers, dndKitActiveNode, onDragCancel, isDraggingCardOnly, dialogOpenForGroup, setDialogOpenForGroup, handleRenameGroup, handleDialogClose, isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone } = useHomePageDnd({
|
|
3077
|
-
items,
|
|
3078
|
-
setItems: updateItems,
|
|
3079
|
-
disabled: !allowDragAndDrop || performingSearch,
|
|
3080
|
-
onPersist: persistNavigationGroups,
|
|
3081
|
-
onGroupMoved: (g) => context.analyticsController?.onAnalyticsEvent?.("home_move_group", { name: g }),
|
|
3082
|
-
onCardMovedBetweenGroups: (card) => context.analyticsController?.onAnalyticsEvent?.("home_move_card", { id: card.id }),
|
|
3083
|
-
onNewGroupDrop: () => context.analyticsController?.onAnalyticsEvent?.("home_drop_new_group")
|
|
3084
|
-
});
|
|
3085
|
-
const { containerRef, direction } = useRestoreScroll();
|
|
3086
|
-
const dndDisabled = !allowDragAndDrop || performingSearch;
|
|
3087
|
-
const dndModifiers = dndKitActiveNode?.data.current?.type === "group" ? [restrictToVerticalAxis, restrictToWindowEdges] : [restrictToWindowEdges];
|
|
3088
|
-
const sectionProps = { context };
|
|
3089
|
-
const additionalPluginChildrenStart = useSlot("home.children.start", sectionProps);
|
|
3090
|
-
const additionalPluginChildrenEnd = useSlot("home.children.end", sectionProps);
|
|
3091
|
-
const additionalPluginActions = useSlot("home.actions", sectionProps);
|
|
3092
|
-
const homeCardContributions = useMemo(() => {
|
|
3093
|
-
return resolvedSlots.filter((s) => s.slot === "home.cards").sort((a, b) => (a.order ?? 50) - (b.order ?? 50));
|
|
3094
|
-
}, [resolvedSlots]);
|
|
3095
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
3096
|
-
ref: containerRef,
|
|
3097
|
-
className: "py-2 overflow-auto h-full w-full bg-surface-sheet",
|
|
3098
|
-
children: [/* @__PURE__ */ jsxs(Container, {
|
|
3099
|
-
maxWidth: "6xl",
|
|
3100
|
-
children: [
|
|
3101
|
-
/* @__PURE__ */ jsx("div", {
|
|
3102
|
-
className: "mb-4 flex flex-col gap-2",
|
|
3103
|
-
children: /* @__PURE__ */ jsx(SchemaDriftBanner, {})
|
|
3104
|
-
}),
|
|
3105
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3106
|
-
className: "w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4",
|
|
3107
|
-
style: { top: direction === "down" ? -84 : 0 },
|
|
3108
|
-
children: [
|
|
3109
|
-
/* @__PURE__ */ jsx(SearchBar, {
|
|
3110
|
-
onTextSearch: updateSearch,
|
|
3111
|
-
placeholder: t("search_collections"),
|
|
3112
|
-
autoFocus: true,
|
|
3113
|
-
size: "small",
|
|
3114
|
-
innerClassName: "w-full",
|
|
3115
|
-
className: "w-full grow"
|
|
3116
|
-
}),
|
|
3117
|
-
additionalActions,
|
|
3118
|
-
additionalPluginActions
|
|
3119
|
-
]
|
|
3120
|
-
}),
|
|
3121
|
-
navigationStateController.navigationLoadingError && /* @__PURE__ */ jsx("div", {
|
|
3122
|
-
className: "mb-4",
|
|
3123
|
-
children: /* @__PURE__ */ jsx(NavigationLoadingErrorView, {
|
|
3124
|
-
error: navigationStateController.navigationLoadingError,
|
|
3125
|
-
onRetry: navigationStateController.refreshNavigation
|
|
3126
|
-
})
|
|
3127
|
-
}),
|
|
3128
|
-
/* @__PURE__ */ jsx(FavouritesView, { hidden: performingSearch }),
|
|
3129
|
-
additionalChildrenStart,
|
|
3130
|
-
additionalPluginChildrenStart,
|
|
3131
|
-
/* @__PURE__ */ jsxs(DndContext, {
|
|
3132
|
-
sensors,
|
|
3133
|
-
collisionDetection,
|
|
3134
|
-
measuring: { droppable: {
|
|
3135
|
-
strategy: MeasuringStrategy.Always,
|
|
3136
|
-
frequency: 500
|
|
3137
|
-
} },
|
|
3138
|
-
onDragStart,
|
|
3139
|
-
onDragOver,
|
|
3140
|
-
onDragEnd,
|
|
3141
|
-
onDragCancel,
|
|
3142
|
-
modifiers: dndModifiers,
|
|
3143
|
-
children: [
|
|
3144
|
-
/* @__PURE__ */ jsx(SortableContext, {
|
|
3145
|
-
items: containers,
|
|
3146
|
-
strategy: verticalListSortingStrategy,
|
|
3147
|
-
children: items.map((groupData, groupIndex) => {
|
|
3148
|
-
const groupKey = groupData.name;
|
|
3149
|
-
const entriesInGroup = groupData.entries;
|
|
3150
|
-
const homeCardsProps = {
|
|
3151
|
-
group: groupKey === "Views" ? void 0 : groupKey,
|
|
3152
|
-
context
|
|
3153
|
-
};
|
|
3154
|
-
const additionalCards = homeCardContributions.map((s, i) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(s.Component, {
|
|
3155
|
-
...homeCardsProps,
|
|
3156
|
-
...s.props ?? {}
|
|
3157
|
-
}) }, `home_cards_${groupKey}_${i}`));
|
|
3158
|
-
if (entriesInGroup.length === 0 && (additionalCards.length === 0 || performingSearch)) return null;
|
|
3159
|
-
return /* @__PURE__ */ jsx(SortableNavigationGroup, {
|
|
3160
|
-
groupName: groupKey,
|
|
3161
|
-
disabled: dndDisabled,
|
|
3162
|
-
children: /* @__PURE__ */ jsx(NavigationGroup, {
|
|
3163
|
-
group: groupKey === "Views" ? void 0 : groupKey,
|
|
3164
|
-
minimised: draggingGroupId === groupKey && !isDraggingCardOnly,
|
|
3165
|
-
isPotentialCardDropTarget: isDraggingCardOnly,
|
|
3166
|
-
dndDisabled,
|
|
3167
|
-
onEditGroup: () => {
|
|
3168
|
-
if (dndDisabled) return;
|
|
3169
|
-
setDialogOpenForGroup(groupKey);
|
|
3170
|
-
},
|
|
3171
|
-
collapsed: isGroupCollapsed(groupKey),
|
|
3172
|
-
onToggleCollapsed: () => toggleGroupCollapsed(groupKey),
|
|
3173
|
-
children: /* @__PURE__ */ jsx(NavigationGroupDroppable, {
|
|
3174
|
-
id: groupKey,
|
|
3175
|
-
itemIds: entriesInGroup.map((e) => e.url),
|
|
3176
|
-
isPotentialCardDropTarget: isDraggingCardOnly,
|
|
3177
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
3178
|
-
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ",
|
|
3179
|
-
children: [entriesInGroup.map((entry) => /* @__PURE__ */ jsx(SortableNavigationCard, {
|
|
3180
|
-
entry,
|
|
3181
|
-
onClick: () => {
|
|
3182
|
-
let event = "unmapped_event";
|
|
3183
|
-
if (entry.type === "collection") event = "home_navigate_to_collection";
|
|
3184
|
-
else if (entry.type === "view") event = "home_navigate_to_view";
|
|
3185
|
-
else if (entry.type === "admin") event = "home_navigate_to_admin_view";
|
|
3186
|
-
context.analyticsController?.onAnalyticsEvent?.(event, { path: entry.slug });
|
|
3187
|
-
}
|
|
3188
|
-
}, entry.url)), !performingSearch && groupKey.toLowerCase() !== "Admin".toLowerCase() && additionalCards]
|
|
3189
|
-
})
|
|
3190
|
-
})
|
|
3191
|
-
})
|
|
3192
|
-
}, `group-${groupIndex}`);
|
|
3193
|
-
})
|
|
3194
|
-
}, containers.join(",")),
|
|
3195
|
-
/* @__PURE__ */ jsx(NewGroupDropZone, {
|
|
3196
|
-
disabled: dndDisabled,
|
|
3197
|
-
setIsHovering: setIsHoveringNewGroupDropZone
|
|
3198
|
-
}),
|
|
3199
|
-
/* @__PURE__ */ jsx(DragOverlay, {
|
|
3200
|
-
adjustScale: false,
|
|
3201
|
-
dropAnimation,
|
|
3202
|
-
children: activeGroupData && draggingGroupId === activeGroupData.name ? /* @__PURE__ */ jsx("div", {
|
|
3203
|
-
className: "rounded-lg bg-transparent",
|
|
3204
|
-
style: {
|
|
3205
|
-
padding: 0,
|
|
3206
|
-
margin: 0
|
|
3207
|
-
},
|
|
3208
|
-
children: /* @__PURE__ */ jsx(NavigationGroup, {
|
|
3209
|
-
group: activeGroupData.name === "Views" ? void 0 : activeGroupData.name,
|
|
3210
|
-
isPreview: false,
|
|
3211
|
-
minimised: true
|
|
3212
|
-
})
|
|
3213
|
-
}) : activeItemForOverlay ? /* @__PURE__ */ jsx(NavigationCardBinding, {
|
|
3214
|
-
...activeItemForOverlay,
|
|
3215
|
-
shrink: isHoveringNewGroupDropZone
|
|
3216
|
-
}) : null
|
|
3217
|
-
})
|
|
3218
|
-
]
|
|
3219
|
-
}),
|
|
3220
|
-
!performingSearch && adminGroupData && /* @__PURE__ */ jsx(NavigationGroup, {
|
|
3221
|
-
group: adminGroupData.name,
|
|
3222
|
-
collapsed: isGroupCollapsed(adminGroupData.name),
|
|
3223
|
-
onToggleCollapsed: () => toggleGroupCollapsed(adminGroupData.name),
|
|
3224
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
3225
|
-
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ",
|
|
3226
|
-
children: adminGroupData.entries.map((entry) => /* @__PURE__ */ jsx(NavigationCardBinding, {
|
|
3227
|
-
...entry,
|
|
3228
|
-
onClick: () => {
|
|
3229
|
-
let event = "unmapped_event";
|
|
3230
|
-
if (entry.type === "collection") event = "home_navigate_to_collection";
|
|
3231
|
-
else if (entry.type === "view") event = "home_navigate_to_view";
|
|
3232
|
-
else if (entry.type === "admin") event = "home_navigate_to_admin_view";
|
|
3233
|
-
context.analyticsController?.onAnalyticsEvent?.(event, { path: entry.slug });
|
|
3234
|
-
}
|
|
3235
|
-
}, entry.url))
|
|
3236
|
-
})
|
|
3237
|
-
}),
|
|
3238
|
-
sections && sections.map((section) => /* @__PURE__ */ jsx(NavigationGroup, {
|
|
3239
|
-
group: section.title,
|
|
3240
|
-
children: section.children
|
|
3241
|
-
}, section.key)),
|
|
3242
|
-
additionalPluginChildrenEnd,
|
|
3243
|
-
additionalChildrenEnd
|
|
3244
|
-
]
|
|
3245
|
-
}), dialogOpenForGroup && /* @__PURE__ */ jsx(RenameGroupDialog, {
|
|
3246
|
-
open: true,
|
|
3247
|
-
initialName: dialogOpenForGroup,
|
|
3248
|
-
existingGroupNames: items.map((g) => g.name).filter((n) => n !== dialogOpenForGroup),
|
|
3249
|
-
onClose: handleDialogClose,
|
|
3250
|
-
onRename: (newName) => {
|
|
3251
|
-
handleRenameGroup(dialogOpenForGroup, newName);
|
|
3252
|
-
}
|
|
3253
|
-
})]
|
|
3254
|
-
});
|
|
3255
|
-
}
|
|
3256
|
-
//#endregion
|
|
3257
|
-
//#region src/components/CollectionEditorDialogs.tsx
|
|
3258
|
-
var CollectionEditorDialog = lazyChunk(() => import("./CollectionEditorDialog-p5-I-Apu.js").then((n) => n.r).then((m) => ({ default: m.CollectionEditorDialog })));
|
|
3259
|
-
var PropertyFormDialog = lazyChunk(() => import("./PropertyEditView-DDB_X-00.js").then((n) => n.t).then((m) => ({ default: m.PropertyFormDialog })));
|
|
3260
|
-
/**
|
|
3261
|
-
* Renders the CollectionEditorDialog and PropertyFormDialog inside
|
|
3262
|
-
* the RebaseShell tree where admin-internal contexts
|
|
3263
|
-
* (CollectionRegistryContext, NavigationStateContext, UrlContext)
|
|
3264
|
-
* are available.
|
|
3265
|
-
*
|
|
3266
|
-
* Both dialog components are loaded dynamically via React.lazy so that
|
|
3267
|
-
* production admin bundles that never open the collection editor don't pay
|
|
3268
|
-
* the download/parse cost up-front.
|
|
3269
|
-
*
|
|
3270
|
-
* The dialog state (open/close, props) is managed by ConfigControllerProvider
|
|
3271
|
-
* (a root-scope plugin provider that wraps the shell) and exposed via
|
|
3272
|
-
* CollectionEditorDialogsContext.
|
|
3273
|
-
*/
|
|
3274
|
-
function CollectionEditorDialogs() {
|
|
3275
|
-
const state = useCollectionEditorDialogsState();
|
|
3276
|
-
if (!state) return null;
|
|
3277
|
-
const { collectionDialogProps, propertyDialogProps } = state;
|
|
3278
|
-
if (!(collectionDialogProps?.open || propertyDialogProps?.open)) return null;
|
|
3279
|
-
return /* @__PURE__ */ jsxs(Suspense, {
|
|
3280
|
-
fallback: null,
|
|
3281
|
-
children: [collectionDialogProps?.open && /* @__PURE__ */ jsx(CollectionEditorDialog, {
|
|
3282
|
-
open: false,
|
|
3283
|
-
isNewCollection: false,
|
|
3284
|
-
configController: void 0,
|
|
3285
|
-
handleClose: () => {},
|
|
3286
|
-
...collectionDialogProps
|
|
3287
|
-
}), propertyDialogProps?.open && /* @__PURE__ */ jsx(PropertyFormDialog, {
|
|
3288
|
-
open: false,
|
|
3289
|
-
existingProperty: false,
|
|
3290
|
-
autoOpenTypeSelect: false,
|
|
3291
|
-
inArray: false,
|
|
3292
|
-
allowDataInference: false,
|
|
3293
|
-
propertyConfigs: {},
|
|
3294
|
-
...propertyDialogProps
|
|
3295
|
-
})]
|
|
3296
|
-
});
|
|
3297
|
-
}
|
|
3298
|
-
//#endregion
|
|
3299
|
-
//#region src/components/RebaseRouteDefs.tsx
|
|
3300
|
-
function SettingsView() {
|
|
3301
|
-
const { t } = useTranslation();
|
|
3302
|
-
const breadcrumbs = useBreadcrumbsController();
|
|
3303
|
-
useEffect(() => {
|
|
3304
|
-
breadcrumbs.set({ breadcrumbs: [{
|
|
3305
|
-
title: t("account_settings"),
|
|
3306
|
-
url: "/settings"
|
|
3307
|
-
}] });
|
|
3308
|
-
}, []);
|
|
3309
|
-
return /* @__PURE__ */ jsx(UserSettingsView, {});
|
|
3310
|
-
}
|
|
3311
|
-
/**
|
|
3312
|
-
* Route definitions for the admin.
|
|
3313
|
-
*
|
|
3314
|
-
* Defines all standard routes: home, studio home, collection view,
|
|
3315
|
-
* settings, debug, custom views, and a catch-all 404.
|
|
3316
|
-
*
|
|
3317
|
-
* **Independently usable**: Use this when you want Rebase routes
|
|
3318
|
-
* inside your own layout/navigation setup.
|
|
3319
|
-
*
|
|
3320
|
-
* @example
|
|
3321
|
-
* ```tsx
|
|
3322
|
-
* <RebaseNavigation>
|
|
3323
|
-
* <RebaseRouteDefs layout={<MyCustomLayout />}>
|
|
3324
|
-
* <Route path="/my-custom" element={<MyView />} />
|
|
3325
|
-
* </RebaseRouteDefs>
|
|
3326
|
-
* </RebaseNavigation>
|
|
3327
|
-
* ```
|
|
3328
|
-
*/
|
|
3329
|
-
function RebaseRouteDefs({ children, layout }) {
|
|
3330
|
-
const registry = useRebaseRegistry();
|
|
3331
|
-
const navigationStateController = useNavigationStateController();
|
|
3332
|
-
const ResolvedHomePage = useComponentOverride("HomePage", ContentHomePage);
|
|
3333
|
-
const cmsHomePage = registry.cmsConfig?.homePage ?? /* @__PURE__ */ jsx(Suspense, {
|
|
3334
|
-
fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}),
|
|
3335
|
-
children: /* @__PURE__ */ jsx(ResolvedHomePage, {})
|
|
3336
|
-
});
|
|
3337
|
-
const studioHomePage = registry.studioConfig?.homePage;
|
|
3338
|
-
const combinedViews = useMemo(() => [...navigationStateController.views ?? [], ...navigationStateController.adminViews ?? []], [navigationStateController.views, navigationStateController.adminViews]);
|
|
3339
|
-
const routeContents = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3340
|
-
/* @__PURE__ */ jsx(Route, {
|
|
3341
|
-
path: "/",
|
|
3342
|
-
element: cmsHomePage
|
|
3343
|
-
}),
|
|
3344
|
-
registry.studioConfig && /* @__PURE__ */ jsx(Route, {
|
|
3345
|
-
path: "/s",
|
|
3346
|
-
element: studioHomePage
|
|
3347
|
-
}),
|
|
3348
|
-
/* @__PURE__ */ jsx(Route, {
|
|
3349
|
-
path: "/c/*",
|
|
3350
|
-
element: /* @__PURE__ */ jsx(RebaseRoute, {})
|
|
3351
|
-
}),
|
|
3352
|
-
/* @__PURE__ */ jsx(Route, {
|
|
3353
|
-
path: "/settings",
|
|
3354
|
-
element: /* @__PURE__ */ jsx(SettingsView, {})
|
|
3355
|
-
}),
|
|
3356
|
-
combinedViews.map((view) => {
|
|
3357
|
-
return (Array.isArray(view.slug) ? view.slug : [view.slug]).flatMap((slug) => {
|
|
3358
|
-
const routes = [/* @__PURE__ */ jsx(Route, {
|
|
3359
|
-
path: slug,
|
|
3360
|
-
element: /* @__PURE__ */ jsx(CustomViewRoute, { view })
|
|
3361
|
-
}, slug)];
|
|
3362
|
-
if (view.nestedRoutes) routes.push(/* @__PURE__ */ jsx(Route, {
|
|
3363
|
-
path: slug + "/*",
|
|
3364
|
-
element: /* @__PURE__ */ jsx(CustomViewRoute, { view })
|
|
3365
|
-
}, slug + "/*"));
|
|
3366
|
-
return routes;
|
|
3367
|
-
});
|
|
3368
|
-
}),
|
|
3369
|
-
children,
|
|
3370
|
-
/* @__PURE__ */ jsx(Route, {
|
|
3371
|
-
path: "*",
|
|
3372
|
-
element: navigationStateController.loading ? /* @__PURE__ */ jsx(CircularProgressCenter, {}) : /* @__PURE__ */ jsx(NotFoundPage, {})
|
|
3373
|
-
})
|
|
3374
|
-
] });
|
|
3375
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(RebaseRoutes, { children: layout ? /* @__PURE__ */ jsx(Route, {
|
|
3376
|
-
element: layout,
|
|
3377
|
-
children: routeContents
|
|
3378
|
-
}) : /* @__PURE__ */ jsx(Route, {
|
|
3379
|
-
element: /* @__PURE__ */ jsx(Fragment, { children: routeContents }),
|
|
3380
|
-
children: routeContents
|
|
3381
|
-
}) }), /* @__PURE__ */ jsx(CollectionEditorDialogs, {})] });
|
|
3382
|
-
}
|
|
3383
|
-
//#endregion
|
|
3384
|
-
//#region src/components/RebaseShell.tsx
|
|
3385
|
-
/**
|
|
3386
|
-
* Convenience component that composes all four admin layers:
|
|
3387
|
-
*
|
|
3388
|
-
* ```
|
|
3389
|
-
* <RebaseAuthGate>
|
|
3390
|
-
* <RebaseNavigation>
|
|
3391
|
-
* <RebaseRouteDefs layout={<RebaseLayout>}>
|
|
3392
|
-
* {children}
|
|
3393
|
-
* </RebaseRouteDefs>
|
|
3394
|
-
* </RebaseNavigation>
|
|
3395
|
-
* </RebaseAuthGate>
|
|
3396
|
-
* ```
|
|
3397
|
-
*
|
|
3398
|
-
* Each layer is independently usable — see their individual docs.
|
|
3399
|
-
* RebaseShell is sugar that composes them all with sensible defaults.
|
|
3400
|
-
*/
|
|
3401
|
-
function RebaseShell(props) {
|
|
3402
|
-
const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, children } = props;
|
|
3403
|
-
const registry = useRebaseRegistry();
|
|
3404
|
-
return /* @__PURE__ */ jsx(RebaseAuthGate, { children: /* @__PURE__ */ jsx(RebaseNavigation, { children: /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
3405
|
-
fullPage: true,
|
|
3406
|
-
children: /* @__PURE__ */ jsx(RebaseRouteDefs, {
|
|
3407
|
-
layout: /* @__PURE__ */ jsx(RebaseLayout, {
|
|
3408
|
-
title,
|
|
3409
|
-
appBar,
|
|
3410
|
-
drawer,
|
|
3411
|
-
autoOpenDrawer,
|
|
3412
|
-
defaultDrawerOpen,
|
|
3413
|
-
logo,
|
|
3414
|
-
devViews: useMemo(() => {
|
|
3415
|
-
return registry.studioConfig?.devViews ?? [];
|
|
3416
|
-
}, [registry.studioConfig?.devViews])
|
|
3417
|
-
}),
|
|
3418
|
-
children
|
|
3419
|
-
})
|
|
3420
|
-
}) }) });
|
|
3421
|
-
}
|
|
3422
|
-
//#endregion
|
|
3423
|
-
//#region src/components/CollectionPanel.tsx
|
|
3424
|
-
/**
|
|
3425
|
-
* A high-level, reusable wrapper for embedding a Rebase collection view
|
|
3426
|
-
* inside custom pages (dashboards, home pages, entity detail views, etc.).
|
|
3427
|
-
*
|
|
3428
|
-
* Usage:
|
|
3429
|
-
* ```tsx
|
|
3430
|
-
* import { CollectionPanel } from "@rebasepro/cms";
|
|
3431
|
-
*
|
|
3432
|
-
* function MyDashboard() {
|
|
3433
|
-
* return (
|
|
3434
|
-
* <div>
|
|
3435
|
-
* <CollectionPanel path="tasks" title="Pending Tasks" />
|
|
3436
|
-
* <CollectionPanel
|
|
3437
|
-
* path="clients"
|
|
3438
|
-
* viewMode="table"
|
|
3439
|
-
* collectionOverrides={{
|
|
3440
|
-
* defaultFilter: { status: ["!=", "completed"] }
|
|
3441
|
-
* }}
|
|
3442
|
-
* />
|
|
3443
|
-
* </div>
|
|
3444
|
-
* );
|
|
3445
|
-
* }
|
|
3446
|
-
* ```
|
|
3447
|
-
*
|
|
3448
|
-
* @group Components
|
|
3449
|
-
*/
|
|
3450
|
-
function CollectionPanelInner({ mergedCollection, path, title, updateUrl, className }) {
|
|
3451
|
-
const ResolvedCollectionView = useComponentOverride("Collection.View", CollectionViewBinding);
|
|
3452
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
3453
|
-
className,
|
|
3454
|
-
children: [title !== false && /* @__PURE__ */ jsx(Typography, {
|
|
3455
|
-
variant: "subtitle2",
|
|
3456
|
-
className: "font-semibold mb-2 text-surface-700 dark:text-surface-300",
|
|
3457
|
-
children: title ?? mergedCollection.name
|
|
3458
|
-
}), /* @__PURE__ */ jsx(ResolvedCollectionView, {
|
|
3459
|
-
...mergedCollection,
|
|
3460
|
-
path,
|
|
3461
|
-
updateUrl
|
|
3462
|
-
})]
|
|
3463
|
-
});
|
|
3464
|
-
}
|
|
3465
|
-
function CollectionPanel(props) {
|
|
3466
|
-
const { path, viewMode, sort, limit, openEntityMode, className, collectionOverrides } = props;
|
|
3467
|
-
const registeredCollection = useCollectionRegistryController().getCollection(path);
|
|
3468
|
-
const mergedCollection = useMemo(() => {
|
|
3469
|
-
if (!registeredCollection) return void 0;
|
|
3470
|
-
const propOverrides = {};
|
|
3471
|
-
if (viewMode) propOverrides.defaultViewMode = viewMode;
|
|
3472
|
-
if (sort) propOverrides.sort = sort;
|
|
3473
|
-
if (limit) propOverrides.pagination = limit;
|
|
3474
|
-
if (openEntityMode) propOverrides.openEntityMode = openEntityMode;
|
|
3475
|
-
return {
|
|
3476
|
-
...registeredCollection,
|
|
3477
|
-
...collectionOverrides ?? {},
|
|
3478
|
-
...propOverrides
|
|
3479
|
-
};
|
|
3480
|
-
}, [
|
|
3481
|
-
registeredCollection,
|
|
3482
|
-
collectionOverrides,
|
|
3483
|
-
viewMode,
|
|
3484
|
-
sort,
|
|
3485
|
-
limit,
|
|
3486
|
-
openEntityMode
|
|
3487
|
-
]);
|
|
3488
|
-
if (!mergedCollection) return /* @__PURE__ */ jsx("div", {
|
|
3489
|
-
className,
|
|
3490
|
-
children: /* @__PURE__ */ jsxs(Typography, {
|
|
3491
|
-
variant: "body2",
|
|
3492
|
-
color: "secondary",
|
|
3493
|
-
children: [
|
|
3494
|
-
"Collection \"",
|
|
3495
|
-
path,
|
|
3496
|
-
"\" not found."
|
|
3497
|
-
]
|
|
3498
|
-
})
|
|
3499
|
-
});
|
|
3500
|
-
return /* @__PURE__ */ jsx(CollectionScopeProvider, {
|
|
3501
|
-
collection: mergedCollection,
|
|
3502
|
-
children: /* @__PURE__ */ jsx(CollectionPanelInner, {
|
|
3503
|
-
...props,
|
|
3504
|
-
mergedCollection
|
|
3505
|
-
})
|
|
3506
|
-
});
|
|
3507
|
-
}
|
|
3508
|
-
//#endregion
|
|
3509
|
-
//#region src/util/propertyConfigMapper.ts
|
|
3510
|
-
/**
|
|
3511
|
-
* Map Rebase property types to headless-supported types.
|
|
3512
|
-
* `vector` and `binary` are not directly renderable, so we fall back to `string`.
|
|
3513
|
-
*/
|
|
3514
|
-
var TYPE_MAP = {
|
|
3515
|
-
string: "string",
|
|
3516
|
-
number: "number",
|
|
3517
|
-
boolean: "boolean",
|
|
3518
|
-
date: "date",
|
|
3519
|
-
geopoint: "geopoint",
|
|
3520
|
-
reference: "reference",
|
|
3521
|
-
relation: "relation",
|
|
3522
|
-
array: "array",
|
|
3523
|
-
map: "map",
|
|
3524
|
-
vector: "string",
|
|
3525
|
-
binary: "string"
|
|
3526
|
-
};
|
|
3527
|
-
/**
|
|
3528
|
-
* Convert a single Property to a CollectionPropertyConfig.
|
|
3529
|
-
*/
|
|
3530
|
-
function mapPropertyToConfig(property, key) {
|
|
3531
|
-
const base = {
|
|
3532
|
-
type: TYPE_MAP[property.type] ?? "string",
|
|
3533
|
-
name: property.name ?? (key ? prettifyIdentifier(key) : ""),
|
|
3534
|
-
description: property.description,
|
|
3535
|
-
columnWidth: property.admin?.columnWidth,
|
|
3536
|
-
hideFromCollection: property.admin?.hideFromCollection
|
|
3537
|
-
};
|
|
3538
|
-
if (property.type === "string") {
|
|
3539
|
-
if (property.enum) base.enum = mapEnumValues(property.enum);
|
|
3540
|
-
if (property.admin?.multiline) base.multiline = true;
|
|
3541
|
-
if (property.admin?.previewAsTag) base.previewAsTag = true;
|
|
3542
|
-
if (property.admin?.urlPreview) base.url = property.admin.urlPreview;
|
|
3543
|
-
if (property.admin?.markdown) base.markdown = true;
|
|
3544
|
-
if (property.storage) base.storage = true;
|
|
3545
|
-
if (property.email) base.email = true;
|
|
3546
|
-
}
|
|
3547
|
-
if (property.type === "number" && property.enum) base.enum = mapEnumValues(property.enum);
|
|
3548
|
-
if (property.type === "array" && property.of && !Array.isArray(property.of)) base.of = mapPropertyToConfig(property.of, key);
|
|
3549
|
-
if (property.type === "map" && property.properties) {
|
|
3550
|
-
base.properties = mapPropertiesToConfigs(property.properties);
|
|
3551
|
-
if (property.propertiesOrder) base.propertiesOrder = property.propertiesOrder;
|
|
3552
|
-
}
|
|
3553
|
-
if (property.type === "date" && property.mode) base.mode = property.mode;
|
|
3554
|
-
if (property.admin?.Preview) {}
|
|
3555
|
-
return base;
|
|
3556
|
-
}
|
|
3557
|
-
/**
|
|
3558
|
-
* Convert a Properties record to a CollectionPropertyConfig record.
|
|
3559
|
-
*/
|
|
3560
|
-
function mapPropertiesToConfigs(properties) {
|
|
3561
|
-
const result = {};
|
|
3562
|
-
for (const [key, property] of Object.entries(properties)) result[key] = mapPropertyToConfig(property, key);
|
|
3563
|
-
return result;
|
|
3564
|
-
}
|
|
3565
|
-
/**
|
|
3566
|
-
* Convert Rebase EnumValues to CollectionEnumValueConfig format.
|
|
3567
|
-
* Handles both array form (EnumValueConfig[]) and record form.
|
|
3568
|
-
*/
|
|
3569
|
-
function mapEnumValues(enumValues) {
|
|
3570
|
-
if (!enumValues) return void 0;
|
|
3571
|
-
if (Array.isArray(enumValues)) {
|
|
3572
|
-
const result = {};
|
|
3573
|
-
for (const item of enumValues) result[String(item.id)] = normalizeEnumValueConfig(item);
|
|
3574
|
-
return result;
|
|
3575
|
-
}
|
|
3576
|
-
const result = {};
|
|
3577
|
-
for (const [key, value] of Object.entries(enumValues)) result[key] = typeof value === "string" ? value : normalizeEnumValueConfig(value);
|
|
3578
|
-
return result;
|
|
3579
|
-
}
|
|
3580
|
-
function normalizeEnumValueConfig(config) {
|
|
3581
|
-
return {
|
|
3582
|
-
label: config.label,
|
|
3583
|
-
color: typeof config.color === "string" ? config.color : void 0,
|
|
3584
|
-
disabled: config.disabled
|
|
3585
|
-
};
|
|
3586
|
-
}
|
|
3587
|
-
//#endregion
|
|
3588
|
-
//#region src/util/dataControllerAdapter.ts
|
|
3589
|
-
/**
|
|
3590
|
-
* Adapts an `EntityTableController<M>` (from @rebasepro/types) to a
|
|
3591
|
-
* `CollectionDataController<T>` (from @rebasepro/ui), bridging the
|
|
3592
|
-
* entity-aware data layer to the headless collection view.
|
|
3593
|
-
*/
|
|
3594
|
-
/**
|
|
3595
|
-
* Unwrap `Entity<M>` objects to flat rows for the headless view.
|
|
3596
|
-
* The entity system uses `{ id, path, values: M }`; `values` is already the
|
|
3597
|
-
* flat row `M` carrying its real primary key, so unwrapping is just `.values` —
|
|
3598
|
-
* no `id`/`path` merge (those are view-model metadata, not row columns).
|
|
3599
|
-
*/
|
|
3600
|
-
function flattenEntities(entities) {
|
|
3601
|
-
return entities.map((entity) => entity.values);
|
|
3602
|
-
}
|
|
3603
|
-
/**
|
|
3604
|
-
* React hook that adapts a EntityTableController to a CollectionDataController.
|
|
3605
|
-
*
|
|
3606
|
-
* Usage:
|
|
3607
|
-
* ```tsx
|
|
3608
|
-
* const tableController = useDataTableController({ path, collection });
|
|
3609
|
-
* const dataController = useCollectionDataController(tableController);
|
|
3610
|
-
*
|
|
3611
|
-
* <CollectionView dataController={dataController} ... />
|
|
3612
|
-
* ```
|
|
3613
|
-
*/
|
|
3614
|
-
function useCollectionDataController(tableController) {
|
|
3615
|
-
const flatData = useMemo(() => flattenEntities(tableController.data), [tableController.data]);
|
|
3616
|
-
return useMemo(() => ({
|
|
3617
|
-
data: flatData,
|
|
3618
|
-
loading: tableController.dataLoading,
|
|
3619
|
-
noMoreToLoad: tableController.noMoreToLoad,
|
|
3620
|
-
error: tableController.dataLoadingError,
|
|
3621
|
-
filterValues: tableController.filterValues,
|
|
3622
|
-
setFilterValues: tableController.setFilterValues,
|
|
3623
|
-
sortBy: tableController.sortBy,
|
|
3624
|
-
setSortBy: tableController.setSortBy,
|
|
3625
|
-
searchString: tableController.searchString,
|
|
3626
|
-
setSearchString: tableController.setSearchString,
|
|
3627
|
-
clearFilter: tableController.clearFilter,
|
|
3628
|
-
initialScroll: tableController.initialScroll,
|
|
3629
|
-
onScroll: tableController.onScroll,
|
|
3630
|
-
paginationEnabled: tableController.paginationEnabled,
|
|
3631
|
-
pageSize: tableController.pageSize,
|
|
3632
|
-
itemCount: tableController.itemCount,
|
|
3633
|
-
setItemCount: tableController.setItemCount
|
|
3634
|
-
}), [flatData, tableController]);
|
|
3635
|
-
}
|
|
3636
|
-
/**
|
|
3637
|
-
* Non-hook version for cases where you already have the data
|
|
3638
|
-
* and just need to build a static controller.
|
|
3639
|
-
*/
|
|
3640
|
-
function createStaticDataController(data, options) {
|
|
3641
|
-
return {
|
|
3642
|
-
data,
|
|
3643
|
-
loading: options?.loading ?? false,
|
|
3644
|
-
noMoreToLoad: true,
|
|
3645
|
-
error: options?.error
|
|
3646
|
-
};
|
|
3647
|
-
}
|
|
3648
|
-
//#endregion
|
|
3649
|
-
//#region src/collection_editor/useJsonCollectionsConfigController.tsx
|
|
3650
|
-
/**
|
|
3651
|
-
* A `CollectionsConfigController` implementation that persists collection
|
|
3652
|
-
* configurations as JSON via a pluggable `JsonCollectionStore` adapter.
|
|
3653
|
-
*
|
|
3654
|
-
* Use this when you want to store collection schemas in a database, API,
|
|
3655
|
-
* localStorage, or any other JSON-compatible backend — as opposed to the
|
|
3656
|
-
* default code-based persistence.
|
|
3657
|
-
*
|
|
3658
|
-
* @example
|
|
3659
|
-
* ```tsx
|
|
3660
|
-
* const store: JsonCollectionStore = {
|
|
3661
|
-
* load: async () => { const res = await fetch('/api/schemas'); return res.json(); },
|
|
3662
|
-
* save: async (slug, data) => { await fetch(`/api/schemas/${slug}`, { method: 'PUT', body: JSON.stringify(data) }); },
|
|
3663
|
-
* delete: async (slug) => { await fetch(`/api/schemas/${slug}`, { method: 'DELETE' }); },
|
|
3664
|
-
* };
|
|
3665
|
-
*
|
|
3666
|
-
* const configController = useJsonCollectionsConfigController({ store });
|
|
3667
|
-
* ```
|
|
3668
|
-
*/
|
|
3669
|
-
function useJsonCollectionsConfigController({ store, readOnly = false, autoLoad = true }) {
|
|
3670
|
-
const [collections, setCollections] = useState([]);
|
|
3671
|
-
const [loading, setLoading] = useState(autoLoad);
|
|
3672
|
-
const [navigationEntries, setNavigationEntries] = useState([]);
|
|
3673
|
-
const storeRef = useRef(store);
|
|
3674
|
-
storeRef.current = store;
|
|
3675
|
-
/**
|
|
3676
|
-
* The current collections, readable outside a state updater.
|
|
3677
|
-
*
|
|
3678
|
-
* Three mutators used to compute their new value inside
|
|
3679
|
-
* `setCollections(prev => …)` and persist from in there, which cost them
|
|
3680
|
-
* both halves of a save: the promise they returned resolved before the
|
|
3681
|
-
* store had answered, so a failed write reached the caller as a success,
|
|
3682
|
-
* and a `setState` updater must be pure — under `StrictMode` React invokes
|
|
3683
|
-
* it twice, so every one of those saves wrote to the store twice in
|
|
3684
|
-
* development. Reading `prev` from a ref lets them do what
|
|
3685
|
-
* `updatePropertiesOrder` already did: compute, set, then await.
|
|
3686
|
-
*/
|
|
3687
|
-
const collectionsRef = useRef([]);
|
|
3688
|
-
const applyCollections = useCallback((next) => {
|
|
3689
|
-
collectionsRef.current = next;
|
|
3690
|
-
setCollections(next);
|
|
3691
|
-
}, []);
|
|
3692
|
-
useEffect(() => {
|
|
3693
|
-
if (!autoLoad) return;
|
|
3694
|
-
let cancelled = false;
|
|
3695
|
-
(async () => {
|
|
3696
|
-
try {
|
|
3697
|
-
const [serialized, navEntries] = await Promise.all([storeRef.current.load(), storeRef.current.loadNavigationEntries?.() ?? Promise.resolve([])]);
|
|
3698
|
-
if (cancelled) return;
|
|
3699
|
-
applyCollections(fromSerializableCollectionConfigs(serialized));
|
|
3700
|
-
setNavigationEntries(navEntries);
|
|
3701
|
-
} catch (e) {
|
|
3702
|
-
console.error("useJsonCollectionsConfigController: failed to load collections", e);
|
|
3703
|
-
} finally {
|
|
3704
|
-
if (!cancelled) setLoading(false);
|
|
3705
|
-
}
|
|
3706
|
-
})();
|
|
3707
|
-
return () => {
|
|
3708
|
-
cancelled = true;
|
|
3709
|
-
};
|
|
3710
|
-
}, [autoLoad, applyCollections]);
|
|
3711
|
-
/**
|
|
3712
|
-
* Update local state and persist a collection to the store.
|
|
3713
|
-
*/
|
|
3714
|
-
const persistCollection = useCallback(async (collection) => {
|
|
3715
|
-
const serializable = toSerializableCollectionConfig(collection);
|
|
3716
|
-
await storeRef.current.save(collection.slug, serializable);
|
|
3717
|
-
}, []);
|
|
3718
|
-
/**
|
|
3719
|
-
* Find collection by id (slug).
|
|
3720
|
-
*/
|
|
3721
|
-
const getCollection = useCallback((id) => {
|
|
3722
|
-
const found = collections.find((c) => c.slug === id);
|
|
3723
|
-
if (found) return found;
|
|
3724
|
-
throw new Error(`Collection "${id}" not found`);
|
|
3725
|
-
}, [collections]);
|
|
3726
|
-
const saveCollection = useCallback(async ({ id, collectionData }) => {
|
|
3727
|
-
const collection = collectionData;
|
|
3728
|
-
await persistCollection(collection);
|
|
3729
|
-
const prev = collectionsRef.current;
|
|
3730
|
-
const idx = prev.findIndex((c) => c.slug === id);
|
|
3731
|
-
if (idx >= 0) {
|
|
3732
|
-
const next = [...prev];
|
|
3733
|
-
next[idx] = collection;
|
|
3734
|
-
applyCollections(next);
|
|
3735
|
-
} else applyCollections([...prev, collection]);
|
|
3736
|
-
}, [persistCollection, applyCollections]);
|
|
3737
|
-
const updateCollection = useCallback(async ({ id, collectionData, previousId }) => {
|
|
3738
|
-
const prev = collectionsRef.current;
|
|
3739
|
-
const lookupId = previousId ?? id;
|
|
3740
|
-
const idx = prev.findIndex((c) => c.slug === lookupId);
|
|
3741
|
-
if (idx < 0) return;
|
|
3742
|
-
const merged = {
|
|
3743
|
-
...prev[idx],
|
|
3744
|
-
...collectionData
|
|
3745
|
-
};
|
|
3746
|
-
const next = [...prev];
|
|
3747
|
-
next[idx] = merged;
|
|
3748
|
-
applyCollections(next);
|
|
3749
|
-
await persistCollection(merged);
|
|
3750
|
-
if (previousId && previousId !== id) await storeRef.current.delete(previousId);
|
|
3751
|
-
}, [persistCollection, applyCollections]);
|
|
3752
|
-
const deleteCollection = useCallback(async ({ id }) => {
|
|
3753
|
-
await storeRef.current.delete(id);
|
|
3754
|
-
applyCollections(collectionsRef.current.filter((c) => c.slug !== id));
|
|
3755
|
-
}, [applyCollections]);
|
|
3756
|
-
const saveProperty = useCallback(async ({ path, propertyKey, property, newPropertiesOrder }) => {
|
|
3757
|
-
const prev = collectionsRef.current;
|
|
3758
|
-
const idx = prev.findIndex((c) => c.slug === path);
|
|
3759
|
-
if (idx < 0) return;
|
|
3760
|
-
const collection = { ...prev[idx] };
|
|
3761
|
-
collection.properties = {
|
|
3762
|
-
...collection.properties,
|
|
3763
|
-
[propertyKey]: property
|
|
3764
|
-
};
|
|
3765
|
-
if (newPropertiesOrder) collection.propertiesOrder = newPropertiesOrder;
|
|
3766
|
-
const next = [...prev];
|
|
3767
|
-
next[idx] = collection;
|
|
3768
|
-
applyCollections(next);
|
|
3769
|
-
await persistCollection(next[idx]);
|
|
3770
|
-
}, [persistCollection, applyCollections]);
|
|
3771
|
-
const deleteProperty = useCallback(async ({ path, propertyKey, newPropertiesOrder }) => {
|
|
3772
|
-
const prev = collectionsRef.current;
|
|
3773
|
-
const idx = prev.findIndex((c) => c.slug === path);
|
|
3774
|
-
if (idx < 0) return;
|
|
3775
|
-
const collection = { ...prev[idx] };
|
|
3776
|
-
const { [propertyKey]: _removed, ...remaining } = collection.properties;
|
|
3777
|
-
collection.properties = remaining;
|
|
3778
|
-
if (newPropertiesOrder) collection.propertiesOrder = newPropertiesOrder;
|
|
3779
|
-
const next = [...prev];
|
|
3780
|
-
next[idx] = collection;
|
|
3781
|
-
applyCollections(next);
|
|
3782
|
-
await persistCollection(next[idx]);
|
|
3783
|
-
}, [persistCollection, applyCollections]);
|
|
3784
|
-
const updatePropertiesOrder = useCallback(async ({ collection, newPropertiesOrder }) => {
|
|
3785
|
-
const updated = {
|
|
3786
|
-
...collection,
|
|
3787
|
-
propertiesOrder: newPropertiesOrder
|
|
3788
|
-
};
|
|
3789
|
-
const prev = collectionsRef.current;
|
|
3790
|
-
const idx = prev.findIndex((c) => c.slug === collection.slug);
|
|
3791
|
-
if (idx >= 0) {
|
|
3792
|
-
const next = [...prev];
|
|
3793
|
-
next[idx] = updated;
|
|
3794
|
-
applyCollections(next);
|
|
3795
|
-
}
|
|
3796
|
-
await persistCollection(updated);
|
|
3797
|
-
}, [persistCollection, applyCollections]);
|
|
3798
|
-
const updateKanbanColumnsOrder = useCallback(async ({ collection, kanbanColumnProperty, newColumnsOrder }) => {}, []);
|
|
3799
|
-
const saveNavigationEntriesHandler = useCallback(async (entries) => {
|
|
3800
|
-
setNavigationEntries(entries);
|
|
3801
|
-
if (storeRef.current.saveNavigationEntries) await storeRef.current.saveNavigationEntries(entries);
|
|
3802
|
-
}, []);
|
|
3803
|
-
return useMemo(() => ({
|
|
3804
|
-
loading,
|
|
3805
|
-
readOnly,
|
|
3806
|
-
readOnlyReason: readOnly ? "Configuration is read-only." : void 0,
|
|
3807
|
-
collections,
|
|
3808
|
-
getCollection,
|
|
3809
|
-
saveCollection,
|
|
3810
|
-
updateCollection,
|
|
3811
|
-
deleteCollection,
|
|
3812
|
-
saveProperty,
|
|
3813
|
-
deleteProperty,
|
|
3814
|
-
updatePropertiesOrder,
|
|
3815
|
-
updateKanbanColumnsOrder,
|
|
3816
|
-
navigationEntries,
|
|
3817
|
-
saveNavigationEntries: saveNavigationEntriesHandler
|
|
3818
|
-
}), [
|
|
3819
|
-
loading,
|
|
3820
|
-
readOnly,
|
|
3821
|
-
collections,
|
|
3822
|
-
getCollection,
|
|
3823
|
-
saveCollection,
|
|
3824
|
-
updateCollection,
|
|
3825
|
-
deleteCollection,
|
|
3826
|
-
saveProperty,
|
|
3827
|
-
deleteProperty,
|
|
3828
|
-
updatePropertiesOrder,
|
|
3829
|
-
updateKanbanColumnsOrder,
|
|
3830
|
-
navigationEntries,
|
|
3831
|
-
saveNavigationEntriesHandler
|
|
3832
|
-
]);
|
|
3833
|
-
}
|
|
3834
|
-
//#endregion
|
|
3835
|
-
//#region src/collection_editor/ui/MissingReferenceWidget.tsx
|
|
3836
|
-
function MissingReferenceWidget({ path: pathProp }) {
|
|
3837
|
-
const registry = useCollectionRegistryController();
|
|
3838
|
-
const path = getLastSegment$1(pathProp);
|
|
3839
|
-
const parentCollectionSlugs = registry.getParentCollectionSlugs(pathProp);
|
|
3840
|
-
const parentEntityIds = registry.getParentEntityIds(pathProp);
|
|
3841
|
-
const collectionEditor = useCollectionEditorController();
|
|
3842
|
-
const { t } = useTranslation();
|
|
3843
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
3844
|
-
className: "p-1 flex flex-col items-center",
|
|
3845
|
-
children: [/* @__PURE__ */ jsx(ErrorView, { error: t("studio_missing_reference_error", { path }) }), /* @__PURE__ */ jsx(Button, {
|
|
3846
|
-
className: "mx-2",
|
|
3847
|
-
size: "small",
|
|
3848
|
-
onClick: () => {
|
|
3849
|
-
collectionEditor.createCollection({
|
|
3850
|
-
initialValues: {
|
|
3851
|
-
path,
|
|
3852
|
-
name: prettifyIdentifier(path)
|
|
3853
|
-
},
|
|
3854
|
-
parentCollectionSlugs,
|
|
3855
|
-
parentEntityIds,
|
|
3856
|
-
redirect: false,
|
|
3857
|
-
sourceClick: "missing_reference"
|
|
3858
|
-
});
|
|
3859
|
-
},
|
|
3860
|
-
children: t("studio_missing_reference_create")
|
|
3861
|
-
})]
|
|
3862
|
-
});
|
|
3863
|
-
}
|
|
3864
|
-
//#endregion
|
|
3865
|
-
export { AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanPreview, CollectionCardViewBinding, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionTableBinding, CollectionViewActions, CollectionViewBinding, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DefaultDrawer, Drawer, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityPreviewBinding, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, flattenEntry, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getUserLabel, idToPropertiesPath, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, parseCsvRows, parseCsvToObjects, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
|
|
3866
|
-
|
|
3867
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { EditorAIControllerProvider, useProvidedEditorAIController } from "./contexts/EditorAIControllerContext.js";
|
|
2
|
+
import { getBracketNotation, getDefaultPropertiesOrder, getIconForProperty, getIconForWidget, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, isReferenceProperty, isRelationProperty } from "./util/property_utils.js";
|
|
3
|
+
import { PropertyKeyHint } from "./components/PropertyKeyHint.js";
|
|
4
|
+
import { FieldBlock, LABEL_ICON_SIZE, isSelfLabellingProperty, spanClass } from "./form/components/FieldBlock.js";
|
|
5
|
+
import { FormRail, RecordMeta } from "./form/components/FormRail.js";
|
|
6
|
+
import { FormSections } from "./form/components/FormSections.js";
|
|
7
|
+
import { EmptyValue } from "./preview/components/EmptyValue.js";
|
|
8
|
+
import { sanitizeUrl } from "./preview/util.js";
|
|
9
|
+
import { ImagePreview } from "./preview/components/ImagePreview.js";
|
|
10
|
+
import { UrlComponentPreview } from "./preview/components/UrlComponentPreview.js";
|
|
11
|
+
import { SkeletonPropertyComponent, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText } from "./preview/property_previews/SkeletonPropertyComponent.js";
|
|
12
|
+
import { StorageThumbnail, StorageThumbnailInternal } from "./preview/components/StorageThumbnail.js";
|
|
13
|
+
import { EnumValuesChip } from "./preview/components/EnumValuesChip.js";
|
|
14
|
+
import { StringPropertyPreview } from "./preview/property_previews/StringPropertyPreview.js";
|
|
15
|
+
import { ArrayPropertyPreview } from "./preview/property_previews/ArrayPropertyPreview.js";
|
|
16
|
+
import { getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity } from "./util/previews.js";
|
|
17
|
+
import { getUserLabel, useResolvedUser } from "./hooks/useResolvedUsers.js";
|
|
18
|
+
import { CollectionRegistryContext, useCollectionRegistryController } from "./hooks/navigation/contexts/CollectionRegistryContext.js";
|
|
19
|
+
import { SidePanelControllerContext, useSidePanel } from "./hooks/useSidePanel.js";
|
|
20
|
+
import { EntityPreviewBinding } from "./components/EntityPreviewBinding.js";
|
|
21
|
+
import { ReferencePreview } from "./preview/components/ReferencePreview.js";
|
|
22
|
+
import { InlineEntityListPreview } from "./preview/components/InlineEntityListPreview.js";
|
|
23
|
+
import { ArrayOfReferencesPreview } from "./preview/property_previews/ArrayOfReferencesPreview.js";
|
|
24
|
+
import { RelationPreview } from "./preview/components/RelationPreview.js";
|
|
25
|
+
import { ArrayOfStorageComponentsPreview } from "./preview/property_previews/ArrayOfStorageComponentsPreview.js";
|
|
26
|
+
import { ArrayEnumPreview } from "./preview/components/ArrayEnumPreview.js";
|
|
27
|
+
import { ArrayPropertyEnumPreview } from "./preview/property_previews/ArrayPropertyEnumPreview.js";
|
|
28
|
+
import { ArrayOfStringsPreview } from "./preview/property_previews/ArrayOfStringsPreview.js";
|
|
29
|
+
import { ArrayOneOfPreview } from "./preview/property_previews/ArrayOneOfPreview.js";
|
|
30
|
+
import { KeyValuePreview, MapPropertyPreview } from "./preview/property_previews/MapPropertyPreview.js";
|
|
31
|
+
import { DatePreview } from "./preview/components/DatePreview.js";
|
|
32
|
+
import { BooleanPreview } from "./preview/components/BooleanPreview.js";
|
|
33
|
+
import { NumberPropertyPreview } from "./preview/property_previews/NumberPropertyPreview.js";
|
|
34
|
+
import { UserPreview } from "./preview/components/UserPreview.js";
|
|
35
|
+
import { PropertyPreview } from "./preview/PropertyPreview.js";
|
|
36
|
+
import { ArrayOfMapsPreview } from "./preview/property_previews/ArrayOfMapsPreview.js";
|
|
37
|
+
import { FieldHelperText } from "./form/components/FieldHelperText.js";
|
|
38
|
+
import { LabelWithIcon } from "./form/components/LabelWithIcon.js";
|
|
39
|
+
import { ReadOnlyFieldBinding } from "./form/field_bindings/ReadOnlyFieldBinding.js";
|
|
40
|
+
import { useClearRestoreValue } from "./form/useClearRestoreValue.js";
|
|
41
|
+
import { ArrayCustomShapedFieldBinding } from "./form/field_bindings/ArrayCustomShapedFieldBinding.js";
|
|
42
|
+
import { SelectableTableContext } from "./components/SelectableTable/SelectableTableContext.js";
|
|
43
|
+
import { useSideDialogsController } from "./hooks/useSideDialogsController.js";
|
|
44
|
+
import { NavigationStateContext, useNavigationStateController } from "./hooks/navigation/contexts/NavigationStateContext.js";
|
|
45
|
+
import { UrlContext, useUrlController } from "./hooks/navigation/contexts/UrlContext.js";
|
|
46
|
+
import { useAdminContext } from "./hooks/useAdminContext.js";
|
|
47
|
+
import { mergeEntityActions } from "./util/entity_actions.js";
|
|
48
|
+
import { CollectionRowActions } from "./components/CollectionTableBinding/CollectionRowActions.js";
|
|
49
|
+
import { SelectableTable } from "./components/SelectableTable/SelectableTable.js";
|
|
50
|
+
import { CollectionTableBinding } from "./components/CollectionTableBinding/CollectionTableBinding.js";
|
|
51
|
+
import { VirtualTableInput } from "./components/CollectionTableBinding/index.js";
|
|
52
|
+
import { useSelectionController } from "./components/CollectionViewBinding/useSelectionController.js";
|
|
53
|
+
import { buildSidePanelsFromUrl, getEntityViewWidth, useBuildSidePanel } from "./hooks/useBuildSidePanel.js";
|
|
54
|
+
import { resolveNavigationFrom, useResolvedNavigationFrom } from "./hooks/useResolvedNavigationFrom.js";
|
|
55
|
+
import { useHistory } from "./hooks/useHistory.js";
|
|
56
|
+
import { useBuildCollectionRegistryController } from "./hooks/navigation/useBuildCollectionRegistryController.js";
|
|
57
|
+
import { addInitialSlash, getCollectionBySlugWithin, getCollectionPathsCombinations, getLastSegment, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, resolveCollectionPathIds } from "./util/navigation_utils.js";
|
|
58
|
+
import { CreationResultDialog } from "./components/admin/CreationResultDialog.js";
|
|
59
|
+
import { copyEntityAction, deleteEntityAction, editEntityAction, resetPasswordAction } from "./components/common/default_entity_actions.js";
|
|
60
|
+
import { useResolvedCollections } from "./hooks/navigation/useResolvedCollections.js";
|
|
61
|
+
import { useResolvedViews } from "./hooks/navigation/useResolvedViews.js";
|
|
62
|
+
import { useTopLevelNavigation } from "./hooks/navigation/useTopLevelNavigation.js";
|
|
63
|
+
import { useBuildNavigationStateController } from "./hooks/navigation/useBuildNavigationStateController.js";
|
|
64
|
+
import { useBuildUrlController } from "./hooks/navigation/useBuildUrlController.js";
|
|
65
|
+
import { useBreadcrumbsController } from "./hooks/useBreadcrumbsController.js";
|
|
66
|
+
import { SideDialogs } from "./components/SideDialogs.js";
|
|
67
|
+
import { SelectionTableBinding } from "./components/ReferenceTable/SelectionTableBinding.js";
|
|
68
|
+
import { useSelectionDialog } from "./hooks/useSelectionDialog.js";
|
|
69
|
+
import { ArrayContainer } from "./components/ArrayContainer.js";
|
|
70
|
+
import { ArrayOfReferencesFieldBinding } from "./form/field_bindings/ArrayOfReferencesFieldBinding.js";
|
|
71
|
+
import { BlockFieldBinding } from "./form/field_bindings/BlockFieldBinding.js";
|
|
72
|
+
import { DateTimeFieldBinding } from "./form/field_bindings/DateTimeFieldBinding.js";
|
|
73
|
+
import { KeyValueFieldBinding } from "./form/field_bindings/KeyValueFieldBinding.js";
|
|
74
|
+
import { MapFieldBinding } from "./form/field_bindings/MapFieldBinding.js";
|
|
75
|
+
import { MarkdownEditorFieldBinding } from "./form/field_bindings/MarkdownEditorFieldBinding.js";
|
|
76
|
+
import { MultiSelectFieldBinding } from "./form/field_bindings/MultiSelectFieldBinding.js";
|
|
77
|
+
import { ReferenceFieldBinding } from "./form/field_bindings/ReferenceFieldBinding.js";
|
|
78
|
+
import { RepeatFieldBinding } from "./form/field_bindings/RepeatFieldBinding.js";
|
|
79
|
+
import { SelectFieldBinding } from "./form/field_bindings/SelectFieldBinding.js";
|
|
80
|
+
import { StorageUploadFieldBinding } from "./form/field_bindings/StorageUploadFieldBinding.js";
|
|
81
|
+
import { SwitchFieldBinding } from "./form/field_bindings/SwitchFieldBinding.js";
|
|
82
|
+
import { TextFieldBinding } from "./form/field_bindings/TextFieldBinding.js";
|
|
83
|
+
import { VectorFieldBinding } from "./form/field_bindings/VectorFieldBinding.js";
|
|
84
|
+
import { getDefaultFieldId, getFieldId } from "./components/field_ids.js";
|
|
85
|
+
import { DEFAULT_FIELD_CONFIGS, getDefaultFieldConfig, getFieldConfig } from "./components/field_configs.js";
|
|
86
|
+
import { PropertyFieldBinding } from "./form/PropertyFieldBinding.js";
|
|
87
|
+
import { extractTouchedValues, getChanges, getInitialEntityValues, removeEmptyContainers, zodToFormErrors } from "./form/form_utils.js";
|
|
88
|
+
import { EntityForm } from "./form/EntityForm.js";
|
|
89
|
+
import { EntityFormBinding } from "./form/EntityFormBinding.js";
|
|
90
|
+
import { CustomViewRoute } from "./routes/CustomViewRoute.js";
|
|
91
|
+
import { resolveEntityAction, resolveEntityView } from "./util/resolutions.js";
|
|
92
|
+
import { RebaseRoute } from "./routes/RebaseRoute.js";
|
|
93
|
+
import { EntityViewBinding } from "./components/EntityViewBinding.js";
|
|
94
|
+
import { MAX_SELECTION_ROWS, SELECTION_PAGE_SIZE, resolveSelection, selectionQueryToFindParams, serializeSelectionQuery } from "./selection/resolve_selection.js";
|
|
95
|
+
import { SelectionMenu } from "./selection/SelectionMenu.js";
|
|
96
|
+
import { FieldCaption } from "./components/FieldCaption.js";
|
|
97
|
+
import { SearchIconsView } from "./components/SearchIconsView.js";
|
|
98
|
+
import { PropertyConfigBadge } from "./components/PropertyConfigBadge.js";
|
|
99
|
+
import { downloadBlob, downloadDataAsCsv, downloadEntitiesExport, entryToCSVRow, escapeCsvFormula, getEntityCSVExportableData, getEntityJsonExportableData, unescapeCsvFormula } from "./data_export/export/export.js";
|
|
100
|
+
import { detectCsvDelimiter, parseCsvRows, parseCsvToObjects } from "./data_import/utils/csv.js";
|
|
101
|
+
import { convertFileToJson } from "./data_import/utils/file_to_json.js";
|
|
102
|
+
import { ImportFileUpload } from "./data_import/components/ImportFileUpload.js";
|
|
103
|
+
import { IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, saveImportedEntities } from "./data_import/utils/save_entities.js";
|
|
104
|
+
import { ImportSaveInProgress } from "./data_import/components/ImportSaveInProgress.js";
|
|
105
|
+
import { useImportConfig } from "./data_import/hooks/useImportConfig.js";
|
|
106
|
+
import { getInferenceType } from "./data_import/utils/get_import_inference_type.js";
|
|
107
|
+
import { convertDataToEntity, convertImportData, flattenEntry, mappedColumnTarget, processValueMapping, slashDateOrdersByColumn } from "./data_import/utils/data.js";
|
|
108
|
+
import { ImportConversionProblems } from "./data_import/components/ImportConversionProblems.js";
|
|
109
|
+
import { DataNewPropertiesMapping } from "./data_import/components/DataNewPropertiesMapping.js";
|
|
110
|
+
import { ImportNewPropertyFieldPreview } from "./data_import/components/ImportNewPropertyFieldPreview.js";
|
|
111
|
+
import { useCollectionEditorController } from "./collection_editor/useCollectionEditorController.js";
|
|
112
|
+
import { CollectionViewActions } from "./components/CollectionViewBinding/CollectionViewActions.js";
|
|
113
|
+
import { EntityCardBinding } from "./components/CollectionViewBinding/EntityCardBinding.js";
|
|
114
|
+
import { CollectionCardViewBinding } from "./components/CollectionViewBinding/CollectionCardViewBinding.js";
|
|
115
|
+
import { CollectionViewBinding } from "./components/CollectionViewBinding/CollectionViewBinding.js";
|
|
116
|
+
import { ReferenceWidget } from "./components/ReferenceWidget.js";
|
|
117
|
+
import { SidePanelProvider } from "./components/SidePanelProvider.js";
|
|
118
|
+
import { AdminModeSyncer } from "./components/AdminModeSyncer.js";
|
|
119
|
+
import { useApp } from "./components/app/useApp.js";
|
|
120
|
+
import { AppBar } from "./components/app/AppBar.js";
|
|
121
|
+
import { DrawerNavigationItem } from "./components/DrawerNavigationItem.js";
|
|
122
|
+
import { DrawerNavigationGroup } from "./components/DrawerNavigationGroup.js";
|
|
123
|
+
import { DefaultDrawer, DrawerFooterActions } from "./components/DefaultDrawer.js";
|
|
124
|
+
import { Drawer } from "./components/app/Drawer.js";
|
|
125
|
+
import { Scaffold } from "./components/app/Scaffold.js";
|
|
126
|
+
import { RebaseCMS } from "./components/RebaseCMS.js";
|
|
127
|
+
import { RebaseAuthGate } from "./components/RebaseAuthGate.js";
|
|
128
|
+
import { LiveSchemaError, SchemaChangeCancelled, asUnavailable, createLiveSchemaClient, isSchemaChangeCancelled } from "./collection_editor/liveSchemaClient.js";
|
|
129
|
+
import { useLiveSchemaEditing } from "./collection_editor/useLiveSchemaEditing.js";
|
|
130
|
+
import { useLocalCollectionsConfigController } from "./collection_editor/useLocalCollectionsConfigController.js";
|
|
131
|
+
import { useCollectionsConfigController } from "./collection_editor/useCollectionsConfigController.js";
|
|
132
|
+
import { RebaseNavigation } from "./components/RebaseNavigation.js";
|
|
133
|
+
import { RebaseLayout } from "./components/RebaseLayout.js";
|
|
134
|
+
import { RebaseRouteDefs } from "./components/RebaseRouteDefs.js";
|
|
135
|
+
import { RebaseShell } from "./components/RebaseShell.js";
|
|
136
|
+
import { CollectionPanel } from "./components/CollectionPanel.js";
|
|
137
|
+
import { mapPropertiesToConfigs, mapPropertyToConfig } from "./util/propertyConfigMapper.js";
|
|
138
|
+
import { createStaticDataController, useCollectionDataController } from "./util/dataControllerAdapter.js";
|
|
139
|
+
import { ImportCollectionAction, ImportDataPreview, PropertySelectEntry } from "./data_import/import/ImportCollectionAction.js";
|
|
140
|
+
import { EXPORT_PAGE_SIZE, MAX_EXPORT_ROWS, fetchAllEntitiesForExport } from "./data_export/export/fetch_export_data.js";
|
|
141
|
+
import { BasicExportAction } from "./data_export/export/BasicExportAction.js";
|
|
142
|
+
import { ExportCollectionAction } from "./data_export/export/ExportCollectionAction.js";
|
|
143
|
+
import { fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty } from "./collection_editor/serializable_utils.js";
|
|
144
|
+
import { useJsonCollectionsConfigController } from "./collection_editor/useJsonCollectionsConfigController.js";
|
|
145
|
+
import { validateCollectionJson } from "./collection_editor/validateCollectionJson.js";
|
|
146
|
+
import { CollectionGenerationApiError, DEFAULT_COLLECTION_GENERATION_ENDPOINT, buildCollectionGenerationCallback } from "./collection_editor/api/generateCollectionApi.js";
|
|
147
|
+
import { MissingReferenceWidget } from "./collection_editor/ui/MissingReferenceWidget.js";
|
|
148
|
+
import { getFullId, getFullIdPath, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "./collection_editor/ui/collection_editor/util.js";
|
|
149
|
+
export { AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanPreview, CollectionCardViewBinding, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionTableBinding, CollectionViewActions, CollectionViewBinding, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DefaultDrawer, Drawer, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EditorAIControllerProvider, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityPreviewBinding, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MissingReferenceWidget, MultiSelectFieldBinding, NavigationStateContext, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferencePreview, ReferenceWidget, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringPropertyPreview, SwitchFieldBinding, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, flattenEntry, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getUserLabel, idToPropertiesPath, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, parseCsvRows, parseCsvToObjects, processValueMapping, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveEntityAction, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionsConfigController, useHistory, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useProvidedEditorAIController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSelectionController, useSelectionDialog, useSideDialogsController, useSidePanel, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
|