@rebasepro/cms 0.24.0 → 0.24.1-canary.gcb918fc
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/README.md +3 -1
- 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.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -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/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.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/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.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 +215 -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/index.d.ts +2 -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 +256 -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 +221 -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 +3 -2
- package/dist/index.js +151 -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 +45 -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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { deepEqual } from "fast-equals";
|
|
3
|
+
import { useLocation, useNavigate } from "react-router";
|
|
4
|
+
//#region src/hooks/useBuildSideDialogsController.tsx
|
|
5
|
+
function useBuildSideDialogsController() {
|
|
6
|
+
const location = useLocation();
|
|
7
|
+
const navigate = useNavigate();
|
|
8
|
+
const locationRef = useRef(location);
|
|
9
|
+
locationRef.current = location;
|
|
10
|
+
const [sidePanels, setSidePanels] = useState([]);
|
|
11
|
+
const sidePanelsRef = useRef(sidePanels);
|
|
12
|
+
const routesStore = useRef({});
|
|
13
|
+
const routesCount = useRef(0);
|
|
14
|
+
const updateSidePanels = useCallback((newPanels) => {
|
|
15
|
+
sidePanelsRef.current = newPanels;
|
|
16
|
+
setSidePanels(newPanels);
|
|
17
|
+
}, []);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const newPanels = (location.state?.panels ?? []).map((key) => routesStore.current[key]).filter((p) => Boolean(p));
|
|
20
|
+
if (!deepEqual(sidePanelsRef.current.map((p) => p.key), newPanels.map((p) => p.key))) {
|
|
21
|
+
updateSidePanels(newPanels);
|
|
22
|
+
if (newPanels.length === 0) routesCount.current = 0;
|
|
23
|
+
}
|
|
24
|
+
}, [location]);
|
|
25
|
+
const close = useCallback(() => {
|
|
26
|
+
const currentPanels = sidePanelsRef.current;
|
|
27
|
+
if (currentPanels.length === 0) return;
|
|
28
|
+
const lastSidePanel = currentPanels[currentPanels.length - 1];
|
|
29
|
+
const updatedPanels = [...currentPanels.slice(0, -1)];
|
|
30
|
+
updateSidePanels(updatedPanels);
|
|
31
|
+
if (routesCount.current > 0) {
|
|
32
|
+
if (lastSidePanel.urlPath) navigate(-1);
|
|
33
|
+
routesCount.current--;
|
|
34
|
+
} else if (lastSidePanel.parentUrlPath) {
|
|
35
|
+
const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
|
|
36
|
+
navigate(lastSidePanel.parentUrlPath, {
|
|
37
|
+
replace: true,
|
|
38
|
+
state: {
|
|
39
|
+
base_location: baseLocation,
|
|
40
|
+
panels: updatedPanels.map((p) => p.key)
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}, [navigate]);
|
|
45
|
+
const open = useCallback((panelProps) => {
|
|
46
|
+
const newPanels = Array.isArray(panelProps) ? panelProps : [panelProps];
|
|
47
|
+
newPanels.forEach((panel) => {
|
|
48
|
+
routesStore.current[panel.key] = panel;
|
|
49
|
+
});
|
|
50
|
+
routesCount.current = routesCount.current + newPanels.length;
|
|
51
|
+
const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
|
|
52
|
+
const updatedPanels = [...sidePanelsRef.current, ...newPanels];
|
|
53
|
+
updateSidePanels(updatedPanels);
|
|
54
|
+
newPanels.forEach((panel) => {
|
|
55
|
+
if (panel.urlPath) navigate(panel.urlPath, { state: {
|
|
56
|
+
base_location: baseLocation,
|
|
57
|
+
panels: updatedPanels.map((p) => p.key)
|
|
58
|
+
} });
|
|
59
|
+
});
|
|
60
|
+
}, [navigate]);
|
|
61
|
+
const replace = useCallback((panelProps) => {
|
|
62
|
+
const newPanels = Array.isArray(panelProps) ? panelProps : [panelProps];
|
|
63
|
+
newPanels.forEach((panel) => {
|
|
64
|
+
routesStore.current[panel.key] = panel;
|
|
65
|
+
});
|
|
66
|
+
const baseLocation = locationRef.current.state?.base_location ?? locationRef.current;
|
|
67
|
+
const updatedPanels = [...sidePanelsRef.current.slice(0, -newPanels.length), ...newPanels];
|
|
68
|
+
updateSidePanels(updatedPanels);
|
|
69
|
+
newPanels.forEach((panel) => {
|
|
70
|
+
if (panel.urlPath) navigate(panel.urlPath, {
|
|
71
|
+
replace: true,
|
|
72
|
+
state: {
|
|
73
|
+
base_location: baseLocation,
|
|
74
|
+
panels: updatedPanels.map((p) => p.key)
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}, [navigate]);
|
|
79
|
+
return useMemo(() => ({
|
|
80
|
+
sidePanels,
|
|
81
|
+
setSidePanels: updateSidePanels,
|
|
82
|
+
close,
|
|
83
|
+
open,
|
|
84
|
+
replace
|
|
85
|
+
}), [
|
|
86
|
+
sidePanels,
|
|
87
|
+
updateSidePanels,
|
|
88
|
+
close,
|
|
89
|
+
open,
|
|
90
|
+
replace
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { useBuildSideDialogsController };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=useBuildSideDialogsController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuildSideDialogsController.js","names":[],"sources":["../../src/hooks/useBuildSideDialogsController.tsx"],"sourcesContent":["import type { SideDialogPanelProps, SideDialogsController } from \"../hooks/useSideDialogsController\";\nimport { useCallback, useEffect, useRef, useState, useMemo } from \"react\";\nimport { useLocation, useNavigate } from \"react-router\";\n;\nimport { deepEqual as equal } from \"fast-equals\"\nimport { Location } from \"react-router\";\n\ninterface SideDialogLocationState {\n base_location?: Location;\n panels?: string[];\n}\n\nexport function useBuildSideDialogsController(): SideDialogsController {\n\n const location = useLocation();\n const navigate = useNavigate();\n\n const locationRef = useRef(location);\n locationRef.current = location;\n\n const [sidePanels, setSidePanels] = useState<SideDialogPanelProps[]>([]);\n const sidePanelsRef = useRef<SideDialogPanelProps[]>(sidePanels);\n\n const routesStore = useRef<Record<string, SideDialogPanelProps>>({});\n const routesCount = useRef<number>(0);\n\n const updateSidePanels = useCallback((newPanels: SideDialogPanelProps[]) => {\n sidePanelsRef.current = newPanels;\n setSidePanels(newPanels);\n }, []);\n\n useEffect(() => {\n const state = location.state as SideDialogLocationState | null;\n const panelKeys: string[] = state?.panels ?? [];\n const newPanels = panelKeys\n .map(key => routesStore.current[key])\n .filter(p => Boolean(p)) as SideDialogPanelProps[];\n if (!equal(sidePanelsRef.current.map(p => p.key), newPanels.map(p => p.key))) {\n updateSidePanels(newPanels);\n // If all panels were cleared via explicit navigation (full-screen expand),\n // reset routesCount so close() doesn't fire navigate(-1)\n if (newPanels.length === 0) {\n routesCount.current = 0;\n }\n }\n }, [location]);\n\n const close = useCallback(() => {\n\n const currentPanels = sidePanelsRef.current;\n if (currentPanels.length === 0)\n return;\n\n const lastSidePanel = currentPanels[currentPanels.length - 1];\n const updatedPanels = [...currentPanels.slice(0, -1)];\n updateSidePanels(updatedPanels);\n\n if (routesCount.current > 0) {\n if (lastSidePanel.urlPath) // if it has a url path, we need to navigate back, don't remove this code\n navigate(-1);\n routesCount.current--;\n } else if (lastSidePanel.parentUrlPath) {\n const baseLocation = (locationRef.current.state as SideDialogLocationState | null)?.base_location ?? locationRef.current;\n navigate(\n lastSidePanel.parentUrlPath,\n {\n replace: true,\n state: {\n base_location: baseLocation,\n panels: updatedPanels.map(p => p.key)\n }\n }\n );\n }\n }, [navigate]);\n\n const open = useCallback((panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => {\n\n const newPanels: SideDialogPanelProps[] = Array.isArray(panelProps) ? panelProps : [panelProps];\n\n newPanels.forEach((panel) => {\n routesStore.current[panel.key] = panel;\n });\n routesCount.current = routesCount.current + newPanels.length;\n\n const baseLocation = (locationRef.current.state as SideDialogLocationState | null)?.base_location ?? locationRef.current;\n\n const currentPanels = sidePanelsRef.current;\n const updatedPanels = [...currentPanels, ...newPanels];\n updateSidePanels(updatedPanels);\n\n newPanels.forEach((panel) => {\n if (panel.urlPath) {\n navigate(\n panel.urlPath,\n {\n state: {\n base_location: baseLocation,\n panels: updatedPanels.map(p => p.key)\n }\n }\n );\n }\n });\n\n }, [navigate]);\n\n const replace = useCallback((panelProps: SideDialogPanelProps | SideDialogPanelProps[]) => {\n\n const newPanels: SideDialogPanelProps[] = Array.isArray(panelProps) ? panelProps : [panelProps];\n newPanels.forEach((panel) => {\n routesStore.current[panel.key] = panel;\n });\n\n const baseLocation = (locationRef.current.state as SideDialogLocationState | null)?.base_location ?? locationRef.current;\n\n const currentPanels = sidePanelsRef.current;\n const updatedPanels = [...currentPanels.slice(0, -newPanels.length), ...newPanels];\n updateSidePanels(updatedPanels);\n\n newPanels.forEach((panel) => {\n if (panel.urlPath) {\n navigate(\n panel.urlPath,\n {\n replace: true,\n state: {\n base_location: baseLocation,\n panels: updatedPanels.map(p => p.key)\n }\n }\n );\n }\n });\n\n }, [navigate]);\n\n return useMemo(() => ({\n sidePanels,\n setSidePanels: updateSidePanels,\n close,\n open,\n replace\n }), [sidePanels, updateSidePanels, close, open, replace]);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { LazySidePanelBinding } from "../components/lazy_record_views.js";
|
|
2
|
+
import { Suspense, useCallback, useEffect, useMemo, useRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { CircularProgressCenter } from "@rebasepro/ui";
|
|
5
|
+
import { CONTAINER_FULL_WIDTH, CollectionScopeProvider, SIDE_PANEL_DEFAULT_WIDTH, getNavigationEntriesFromPath, removeInitialAndTrailingSlashes, removeTrailingSlash, resolveDefaultSelectedView, useComponentOverride, useCustomizationController, useLargeLayout } from "@rebasepro/app";
|
|
6
|
+
import { useLocation } from "react-router";
|
|
7
|
+
//#region src/hooks/useBuildSidePanel.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Thin wrapper that resolves the Entity.SidePanel component override.
|
|
10
|
+
* Because the JSX is created inside `propsToSidePanel` (a plain function,
|
|
11
|
+
* not a React component), we need this wrapper so the hook is called at the
|
|
12
|
+
* top level of a React component per the Rules of Hooks.
|
|
13
|
+
*/
|
|
14
|
+
function ResolvedSidePanelBindingInner(props) {
|
|
15
|
+
const Resolved = useComponentOverride("Entity.SidePanel", LazySidePanelBinding);
|
|
16
|
+
return /* @__PURE__ */ jsx(Suspense, {
|
|
17
|
+
fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}),
|
|
18
|
+
children: /* @__PURE__ */ jsx(Resolved, { ...props })
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function ResolvedSidePanelBinding(props) {
|
|
22
|
+
if (props.collection) return /* @__PURE__ */ jsx(CollectionScopeProvider, {
|
|
23
|
+
collection: props.collection,
|
|
24
|
+
children: /* @__PURE__ */ jsx(ResolvedSidePanelBindingInner, { ...props })
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx(ResolvedSidePanelBindingInner, { ...props });
|
|
27
|
+
}
|
|
28
|
+
var NEW_URL_HASH = "new_side";
|
|
29
|
+
var SIDE_URL_HASH = "side";
|
|
30
|
+
/**
|
|
31
|
+
* How wide the side panel opens.
|
|
32
|
+
*
|
|
33
|
+
* One width for the whole panel, whatever tab is showing. It used to depend on
|
|
34
|
+
* the selected tab — the form got one width and a subcollection or custom view
|
|
35
|
+
* got `calc(55vw + 768px)` — so the panel physically resized under the cursor
|
|
36
|
+
* every time you switched tabs. And the "form" width was derived from how
|
|
37
|
+
* deeply nested the collection's *properties* were, which is not a thing anyone
|
|
38
|
+
* can predict from looking at the panel.
|
|
39
|
+
*
|
|
40
|
+
* Now: `width` prop, then the collection's `sideDialogWidth`, then a default
|
|
41
|
+
* sized for the content the panel actually has to hold — the form column plus
|
|
42
|
+
* its metadata rail — capped so it never eats the whole window.
|
|
43
|
+
*/
|
|
44
|
+
function getEntityViewWidth(props, small, customizationController) {
|
|
45
|
+
if (small) return CONTAINER_FULL_WIDTH;
|
|
46
|
+
if (props.width) return typeof props.width === "number" ? `${props.width}px` : props.width;
|
|
47
|
+
if (props.collection?.sideDialogWidth) return typeof props.collection.sideDialogWidth === "number" ? `${props.collection.sideDialogWidth}px` : props.collection.sideDialogWidth;
|
|
48
|
+
return SIDE_PANEL_DEFAULT_WIDTH;
|
|
49
|
+
}
|
|
50
|
+
var useBuildSidePanel = (collectionRegistryController, urlController, navigationStateController, sideDialogsController, authController) => {
|
|
51
|
+
const location = useLocation();
|
|
52
|
+
const initialised = useRef(false);
|
|
53
|
+
const currentPanelKeysRef = useRef([]);
|
|
54
|
+
const customizationController = useCustomizationController();
|
|
55
|
+
const smallLayout = !useLargeLayout();
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const newFlag = location.hash === `#${NEW_URL_HASH}`;
|
|
58
|
+
const sideFlag = location.hash === `#${SIDE_URL_HASH}`;
|
|
59
|
+
if (!navigationStateController.loading) {
|
|
60
|
+
if ((newFlag || sideFlag) && urlController.isUrlCollectionPath(location.pathname)) {
|
|
61
|
+
const panelsFromUrl = buildSidePanelsFromUrl(urlController.urlPathToDataPath(location.pathname), collectionRegistryController.collections ?? [], newFlag);
|
|
62
|
+
for (let i = 0; i < panelsFromUrl.length; i++) {
|
|
63
|
+
const props = panelsFromUrl[i];
|
|
64
|
+
if (i === 0) sideDialogsController.replace(propsToSidePanel(props, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController));
|
|
65
|
+
else sideDialogsController.open(propsToSidePanel(props, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
initialised.current = true;
|
|
69
|
+
}
|
|
70
|
+
}, [navigationStateController.loading]);
|
|
71
|
+
currentPanelKeysRef.current = sideDialogsController.sidePanels.map((p) => p.key);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (initialised.current) {
|
|
74
|
+
if (location.hash === `#${SIDE_URL_HASH}`) {
|
|
75
|
+
const currentKeys = currentPanelKeysRef.current;
|
|
76
|
+
const panelsFromUrl = buildSidePanelsFromUrl(urlController.urlPathToDataPath(location.pathname), collectionRegistryController.collections ?? [], false);
|
|
77
|
+
if (panelsFromUrl.length <= currentKeys.length) return;
|
|
78
|
+
const lastPanel = panelsFromUrl[panelsFromUrl.length - 1];
|
|
79
|
+
const panelProps = propsToSidePanel(lastPanel, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController);
|
|
80
|
+
const lastCurrentPanel = currentKeys.length > 0 ? currentKeys[currentKeys.length - 1] : void 0;
|
|
81
|
+
if (!lastCurrentPanel || lastCurrentPanel !== panelProps.key) sideDialogsController.replace(panelProps);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [location.pathname, location.hash]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const updatedSidePanels = sideDialogsController.sidePanels.map((sidePanelProps) => {
|
|
87
|
+
if (sidePanelProps.additional) {
|
|
88
|
+
const entityProps = sidePanelProps.additional;
|
|
89
|
+
const newWidth = getEntityViewWidth(entityProps, smallLayout, customizationController);
|
|
90
|
+
if (sidePanelProps.width !== newWidth) return {
|
|
91
|
+
...sidePanelProps,
|
|
92
|
+
width: newWidth
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return sidePanelProps;
|
|
96
|
+
});
|
|
97
|
+
sideDialogsController.setSidePanels(updatedSidePanels);
|
|
98
|
+
}, [smallLayout]);
|
|
99
|
+
const close = useCallback(() => {
|
|
100
|
+
sideDialogsController.close();
|
|
101
|
+
}, [sideDialogsController]);
|
|
102
|
+
const routesMounted = urlController.routesMounted !== false;
|
|
103
|
+
const open = useCallback((propsIn) => {
|
|
104
|
+
const props = routesMounted ? propsIn : {
|
|
105
|
+
...propsIn,
|
|
106
|
+
updateUrl: false,
|
|
107
|
+
allowFullScreen: false
|
|
108
|
+
};
|
|
109
|
+
if (props.copy && !props.entityId) throw Error("If you want to copy a entity you need to provide a entityId");
|
|
110
|
+
const defaultSelectedView = resolveDefaultSelectedView(props.collection ? props.collection.defaultSelectedView : void 0, {
|
|
111
|
+
status: props.copy ? "copy" : props.entityId ? "existing" : "new",
|
|
112
|
+
entityId: props.entityId
|
|
113
|
+
});
|
|
114
|
+
sideDialogsController.open(propsToSidePanel({
|
|
115
|
+
...props,
|
|
116
|
+
selectedTab: props.selectedTab ?? defaultSelectedView
|
|
117
|
+
}, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController));
|
|
118
|
+
}, [
|
|
119
|
+
sideDialogsController,
|
|
120
|
+
urlController.buildUrlCollectionPath,
|
|
121
|
+
urlController.resolveDatabasePathsFrom,
|
|
122
|
+
smallLayout,
|
|
123
|
+
authController.user,
|
|
124
|
+
routesMounted
|
|
125
|
+
]);
|
|
126
|
+
const replace = useCallback((propsIn) => {
|
|
127
|
+
const props = routesMounted ? propsIn : {
|
|
128
|
+
...propsIn,
|
|
129
|
+
updateUrl: false,
|
|
130
|
+
allowFullScreen: false
|
|
131
|
+
};
|
|
132
|
+
if (props.copy && !props.entityId) throw Error("If you want to copy a entity you need to provide a entityId");
|
|
133
|
+
sideDialogsController.replace(propsToSidePanel(props, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController));
|
|
134
|
+
}, [
|
|
135
|
+
urlController.buildUrlCollectionPath,
|
|
136
|
+
urlController.resolveDatabasePathsFrom,
|
|
137
|
+
sideDialogsController,
|
|
138
|
+
smallLayout,
|
|
139
|
+
authController.user,
|
|
140
|
+
routesMounted
|
|
141
|
+
]);
|
|
142
|
+
return useMemo(() => ({
|
|
143
|
+
close,
|
|
144
|
+
open,
|
|
145
|
+
replace
|
|
146
|
+
}), [
|
|
147
|
+
close,
|
|
148
|
+
open,
|
|
149
|
+
replace
|
|
150
|
+
]);
|
|
151
|
+
};
|
|
152
|
+
function buildSidePanelsFromUrl(path, collections, newFlag) {
|
|
153
|
+
const navigationViewsForPath = getNavigationEntriesFromPath({
|
|
154
|
+
path,
|
|
155
|
+
collections
|
|
156
|
+
});
|
|
157
|
+
let sidePanel = void 0;
|
|
158
|
+
let lastCollectionPath = "";
|
|
159
|
+
for (let i = 0; i < navigationViewsForPath.length; i++) {
|
|
160
|
+
const navigationEntry = navigationViewsForPath[i];
|
|
161
|
+
if (navigationEntry.type === "collection") {
|
|
162
|
+
lastCollectionPath = navigationEntry.slug;
|
|
163
|
+
navigationEntry.collection.slug;
|
|
164
|
+
}
|
|
165
|
+
const previousEntry = navigationViewsForPath[i - 1];
|
|
166
|
+
if (navigationEntry.type === "entity") sidePanel = {
|
|
167
|
+
path: navigationEntry.slug,
|
|
168
|
+
entityId: navigationEntry.entityId,
|
|
169
|
+
copy: false,
|
|
170
|
+
collection: navigationEntry.parentCollection,
|
|
171
|
+
width: navigationEntry.parentCollection?.sideDialogWidth
|
|
172
|
+
};
|
|
173
|
+
else if (navigationEntry.type === "custom_view") {
|
|
174
|
+
if (previousEntry?.type === "entity") {
|
|
175
|
+
if (sidePanel) sidePanel.selectedTab = navigationEntry.view.key;
|
|
176
|
+
}
|
|
177
|
+
} else if (navigationEntry.type === "collection") {
|
|
178
|
+
if (previousEntry?.type === "entity") {
|
|
179
|
+
if (sidePanel) sidePanel.selectedTab = navigationEntry.collection.slug;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (sidePanel && !sidePanel.selectedTab && removeTrailingSlash(path).endsWith("/edit")) sidePanel.selectedTab = "edit";
|
|
184
|
+
if (sidePanel && !sidePanel.selectedTab && sidePanel.collection) {
|
|
185
|
+
const defaultView = resolveDefaultSelectedView(sidePanel.collection.defaultSelectedView, {
|
|
186
|
+
status: sidePanel.copy ? "copy" : sidePanel.entityId ? "existing" : "new",
|
|
187
|
+
entityId: sidePanel.entityId
|
|
188
|
+
});
|
|
189
|
+
if (defaultView) sidePanel.selectedTab = defaultView;
|
|
190
|
+
}
|
|
191
|
+
if (newFlag) sidePanel = {
|
|
192
|
+
path: lastCollectionPath,
|
|
193
|
+
copy: false
|
|
194
|
+
};
|
|
195
|
+
return sidePanel ? [sidePanel] : [];
|
|
196
|
+
}
|
|
197
|
+
var propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLayout, customizationController, authController) => {
|
|
198
|
+
const collectionPath = removeInitialAndTrailingSlashes(props.path);
|
|
199
|
+
const locationSearch = typeof window !== "undefined" ? window.location.search : "";
|
|
200
|
+
const shouldUpdateUrl = props.updateUrl !== false;
|
|
201
|
+
const urlPath = shouldUpdateUrl ? props.entityId ? buildUrlCollectionPath(`${collectionPath}/${props.entityId}${props.selectedTab ? "/" + props.selectedTab : ""}${locationSearch}#${SIDE_URL_HASH}`) : buildUrlCollectionPath(`${collectionPath}${locationSearch}#${NEW_URL_HASH}`) : void 0;
|
|
202
|
+
const parentUrlPath = shouldUpdateUrl ? buildUrlCollectionPath(collectionPath) : void 0;
|
|
203
|
+
const resolvedPanelProps = {
|
|
204
|
+
...props,
|
|
205
|
+
formProps: props.formProps
|
|
206
|
+
};
|
|
207
|
+
const entityViewWidth = getEntityViewWidth(props, smallLayout, customizationController);
|
|
208
|
+
return {
|
|
209
|
+
key: `${props.path}/${props.entityId}`,
|
|
210
|
+
component: /* @__PURE__ */ jsx(ResolvedSidePanelBinding, { ...resolvedPanelProps }),
|
|
211
|
+
urlPath,
|
|
212
|
+
parentUrlPath,
|
|
213
|
+
width: entityViewWidth,
|
|
214
|
+
onClose: props.onClose,
|
|
215
|
+
additional: resolvedPanelProps
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
//#endregion
|
|
219
|
+
export { buildSidePanelsFromUrl, getEntityViewWidth, useBuildSidePanel };
|
|
220
|
+
|
|
221
|
+
//# sourceMappingURL=useBuildSidePanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuildSidePanel.js","names":[],"sources":["../../src/hooks/useBuildSidePanel.tsx"],"sourcesContent":["\nimport type { Property } from \"@rebasepro/types\";\nimport type { CustomizationController, SidePanelBindingProps, SideDialogPanelProps, SideDialogsController, SidePanelController, UrlController, NavigationStateController, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useCallback, useEffect, useRef, useMemo } from \"react\";\nimport { CollectionRegistryController } from \"@rebasepro/types\";\nimport { AuthController } from \"@rebasepro/cms-types\";\nimport { useLocation } from \"react-router\";\nimport { NavigationViewInternal } from \"@rebasepro/app\";\nimport { getNavigationEntriesFromPath, removeInitialAndTrailingSlashes, removeTrailingSlash, resolveDefaultSelectedView } from \"@rebasepro/app\";\nimport { resolvedSelectedEntityView } from \"../util/resolutions\";\nimport { CONTAINER_FULL_WIDTH, SIDE_PANEL_DEFAULT_WIDTH } from \"@rebasepro/app\";\nimport { useCustomizationController, useLargeLayout, useComponentOverride, CollectionScopeProvider } from \"@rebasepro/app\";\nimport { JSON_TAB_VALUE, HISTORY_TAB_VALUE } from \"../util/view_constants\";\nimport React, { Suspense } from \"react\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\n// Lazy: this hook runs on every page (the side-panel provider is mounted by\n// RebaseNavigation), and the panel's form stack is not needed until one opens.\nimport { LazySidePanelBinding as SidePanelBinding } from \"../components/lazy_record_views\";\n\n/**\n * Thin wrapper that resolves the Entity.SidePanel component override.\n * Because the JSX is created inside `propsToSidePanel` (a plain function,\n * not a React component), we need this wrapper so the hook is called at the\n * top level of a React component per the Rules of Hooks.\n */\nfunction ResolvedSidePanelBindingInner(props: SidePanelBindingProps) {\n const Resolved = useComponentOverride<SidePanelBindingProps>(\"Entity.SidePanel\", SidePanelBinding);\n return <Suspense fallback={<CircularProgressCenter/>}>\n <Resolved {...props}/>\n </Suspense>;\n}\n\nfunction ResolvedSidePanelBinding(props: SidePanelBindingProps) {\n if (props.collection) {\n return (\n <CollectionScopeProvider collection={props.collection}>\n <ResolvedSidePanelBindingInner {...props}/>\n </CollectionScopeProvider>\n );\n }\n return <ResolvedSidePanelBindingInner {...props}/>;\n}\n\nconst NEW_URL_HASH = \"new_side\";\nconst SIDE_URL_HASH = \"side\";\n\n/**\n * How wide the side panel opens.\n *\n * One width for the whole panel, whatever tab is showing. It used to depend on\n * the selected tab — the form got one width and a subcollection or custom view\n * got `calc(55vw + 768px)` — so the panel physically resized under the cursor\n * every time you switched tabs. And the \"form\" width was derived from how\n * deeply nested the collection's *properties* were, which is not a thing anyone\n * can predict from looking at the panel.\n *\n * Now: `width` prop, then the collection's `sideDialogWidth`, then a default\n * sized for the content the panel actually has to hold — the form column plus\n * its metadata rail — capped so it never eats the whole window.\n */\nexport function getEntityViewWidth(props: SidePanelBindingProps<any>, small: boolean, customizationController: CustomizationController): string {\n if (small) return CONTAINER_FULL_WIDTH;\n\n if (props.width) {\n return typeof props.width === \"number\" ? `${props.width}px` : props.width;\n }\n if (props.collection?.sideDialogWidth) {\n return typeof props.collection.sideDialogWidth === \"number\"\n ? `${props.collection.sideDialogWidth}px`\n : props.collection.sideDialogWidth;\n }\n return SIDE_PANEL_DEFAULT_WIDTH;\n}\n\nexport const useBuildSidePanel = (collectionRegistryController: CollectionRegistryController,\n urlController: UrlController,\n navigationStateController: NavigationStateController,\n sideDialogsController: SideDialogsController,\n authController: AuthController\n): SidePanelController => {\n\n const location = useLocation();\n const initialised = useRef<boolean>(false);\n const currentPanelKeysRef = useRef<string[]>([]);\n const customizationController = useCustomizationController();\n\n const smallLayout = !useLargeLayout();\n\n useEffect(() => {\n\n const newFlag = location.hash === `#${NEW_URL_HASH}`;\n const sideFlag = location.hash === `#${SIDE_URL_HASH}`;\n\n if (!navigationStateController.loading) {\n if ((newFlag || sideFlag) && urlController.isUrlCollectionPath(location.pathname)) {\n const entityOrCollectionPath = urlController.urlPathToDataPath(location.pathname);\n const panelsFromUrl = buildSidePanelsFromUrl(entityOrCollectionPath, collectionRegistryController.collections ?? [], newFlag);\n for (let i = 0; i < panelsFromUrl.length; i++) {\n const props = panelsFromUrl[i];\n if (i === 0)\n sideDialogsController.replace(propsToSidePanel(props, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController));\n else\n sideDialogsController.open(propsToSidePanel(props, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController))\n }\n }\n initialised.current = true;\n }\n }, [navigationStateController.loading]);\n\n // sync panels if URL changes with #side\n // Use a ref for currentPanelKeys so this effect only fires on URL changes,\n // not on panel state changes. This prevents a race condition with React Router 7\n // where close() clears panels before the URL updates, causing the effect to\n // re-open the panel from the stale #side hash.\n currentPanelKeysRef.current = sideDialogsController.sidePanels.map(p => p.key);\n useEffect(() => {\n if (initialised.current) {\n const sideFlag = location.hash === `#${SIDE_URL_HASH}`;\n if (sideFlag) {\n const currentKeys = currentPanelKeysRef.current;\n const entityOrCollectionPath = urlController.urlPathToDataPath(location.pathname);\n const panelsFromUrl = buildSidePanelsFromUrl(entityOrCollectionPath, collectionRegistryController.collections ?? [], false);\n // if we have more panels than determined by the url, we ignore the url. We might have references open\n if (panelsFromUrl.length <= currentKeys.length) {\n return;\n }\n const lastPanel = panelsFromUrl[panelsFromUrl.length - 1];\n const panelProps = propsToSidePanel(lastPanel, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController);\n const lastCurrentPanel = currentKeys.length > 0 ? currentKeys[currentKeys.length - 1] : undefined;\n if (!lastCurrentPanel || lastCurrentPanel !== panelProps.key) {\n sideDialogsController.replace(panelProps);\n }\n }\n }\n }, [location.pathname, location.hash]);\n\n // update side panels to match browser size\n // Only update panel widths on layout change — don't recreate components.\n // Recreating components would unmount/remount SidePanelBinding, losing\n // scroll position, unsaved form state, and triggering unnecessary data fetches.\n useEffect(() => {\n const updatedSidePanels = sideDialogsController.sidePanels.map(sidePanelProps => {\n if (sidePanelProps.additional) {\n const entityProps = sidePanelProps.additional as SidePanelBindingProps;\n const newWidth = getEntityViewWidth(entityProps, smallLayout, customizationController);\n if (sidePanelProps.width !== newWidth) {\n return { ...sidePanelProps,\nwidth: newWidth };\n }\n }\n return sidePanelProps;\n });\n sideDialogsController.setSidePanels(updatedSidePanels);\n }, [smallLayout]);\n\n const close = useCallback(() => {\n sideDialogsController.close();\n }, [sideDialogsController]);\n\n // Where no CMS route serves the page, a panel is an overlay and nothing\n // more: it writes no URL (one would lead nowhere) and offers no way to a\n // full-screen route that does not exist.\n const routesMounted = urlController.routesMounted !== false;\n\n const open = useCallback((propsIn: SidePanelBindingProps<any>) => {\n const props = routesMounted ? propsIn : { ...propsIn, updateUrl: false, allowFullScreen: false };\n\n if (props.copy && !props.entityId) {\n throw Error(\"If you want to copy a entity you need to provide a entityId\");\n }\n\n const defaultSelectedView = resolveDefaultSelectedView(\n props.collection ? props.collection.defaultSelectedView : undefined,\n {\n status: props.copy ? \"copy\" : (props.entityId ? \"existing\" : \"new\"),\n entityId: props.entityId\n }\n );\n\n sideDialogsController.open(\n propsToSidePanel({\n ...props,\n selectedTab: props.selectedTab ?? defaultSelectedView\n },\n urlController.buildUrlCollectionPath,\n urlController.resolveDatabasePathsFrom,\n smallLayout,\n customizationController,\n authController\n ));\n\n }, [sideDialogsController, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, authController.user, routesMounted]);\n\n const replace = useCallback((propsIn: SidePanelBindingProps<any>) => {\n const props = routesMounted ? propsIn : { ...propsIn, updateUrl: false, allowFullScreen: false };\n\n if (props.copy && !props.entityId) {\n throw Error(\"If you want to copy a entity you need to provide a entityId\");\n }\n\n sideDialogsController.replace(propsToSidePanel(props, urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, smallLayout, customizationController, authController));\n\n }, [urlController.buildUrlCollectionPath, urlController.resolveDatabasePathsFrom, sideDialogsController, smallLayout, authController.user, routesMounted]);\n\n return useMemo(() => ({\n close,\n open,\n replace\n }), [close, open, replace]);\n};\n\nexport function buildSidePanelsFromUrl(path: string, collections: AdminCollection[], newFlag: boolean): SidePanelBindingProps<any>[] {\n\n const navigationViewsForPath: NavigationViewInternal<any>[] = getNavigationEntriesFromPath({\n path,\n collections\n });\n\n let sidePanel: SidePanelBindingProps<any> | undefined = undefined;\n let lastCollectionPath = \"\";\n let lastCollectionId: string | undefined = undefined;\n for (let i = 0; i < navigationViewsForPath.length; i++) {\n const navigationEntry = navigationViewsForPath[i];\n\n if (navigationEntry.type === \"collection\") {\n lastCollectionPath = navigationEntry.slug;\n lastCollectionId = navigationEntry.collection.slug;\n }\n\n const previousEntry = navigationViewsForPath[i - 1];\n if (navigationEntry.type === \"entity\") {\n sidePanel = {\n path: navigationEntry.slug,\n entityId: navigationEntry.entityId,\n copy: false,\n collection: navigationEntry.parentCollection,\n width: navigationEntry.parentCollection?.sideDialogWidth\n };\n } else if (navigationEntry.type === \"custom_view\") {\n if (previousEntry?.type === \"entity\") {\n if (sidePanel)\n sidePanel.selectedTab = navigationEntry.view.key;\n }\n } else if (navigationEntry.type === \"collection\") {\n if (previousEntry?.type === \"entity\") {\n if (sidePanel)\n sidePanel.selectedTab = navigationEntry.collection.slug;\n }\n }\n\n }\n\n // `edit` is not a registered view, so the navigation parser skips it. Pick it\n // up from the raw path so that reloading an edit URL reopens the edit form\n // rather than silently dropping the user back on the detail view.\n if (sidePanel && !sidePanel.selectedTab && removeTrailingSlash(path).endsWith(\"/edit\")) {\n sidePanel.selectedTab = \"edit\";\n }\n\n // When the URL doesn't contain a tab segment but the collection has a\n // defaultSelectedView, resolve it so the panel opens with the correct\n // width and the URL is updated on the next replace() cycle.\n if (sidePanel && !sidePanel.selectedTab && sidePanel.collection) {\n const defaultView = resolveDefaultSelectedView(\n sidePanel.collection.defaultSelectedView,\n {\n status: sidePanel.copy ? \"copy\" : (sidePanel.entityId ? \"existing\" : \"new\"),\n entityId: sidePanel.entityId\n }\n );\n if (defaultView) {\n sidePanel.selectedTab = defaultView;\n }\n }\n\n if (newFlag) {\n sidePanel = {\n path: lastCollectionPath,\n copy: false\n }\n }\n\n return sidePanel ? [sidePanel] : [];\n}\n\nconst propsToSidePanel = (props: SidePanelBindingProps,\n buildUrlCollectionPath: (path: string) => string,\n resolveIdsFrom: (pathWithAliases: string) => string,\n smallLayout: boolean,\n customizationController: CustomizationController,\n authController: AuthController\n): SideDialogPanelProps => {\n\n const collectionPath = removeInitialAndTrailingSlashes(props.path);\n\n // The list's state — search, filters, sort, view mode — read from the\n // address bar at the moment the panel opens. Not react-router's\n // `location.search`: the list writes its state with `replaceState`, which\n // the router does not observe, so that value is whatever the view mounted\n // with, and the list reads a panel URL built from it back as its state.\n const locationSearch = typeof window !== \"undefined\" ? window.location.search : \"\";\n\n // When updateUrl is explicitly false, don't generate URL paths — the dialog\n // opens as an overlay without affecting the browser URL / router.\n const shouldUpdateUrl = props.updateUrl !== false;\n\n const urlPath = shouldUpdateUrl\n ? (props.entityId\n ? buildUrlCollectionPath(`${collectionPath}/${props.entityId}${props.selectedTab ? \"/\" + props.selectedTab : \"\"}${locationSearch}#${SIDE_URL_HASH}`)\n : buildUrlCollectionPath(`${collectionPath}${locationSearch}#${NEW_URL_HASH}`))\n : undefined;\n\n const parentUrlPath = shouldUpdateUrl\n ? buildUrlCollectionPath(collectionPath)\n : undefined;\n\n const resolvedPanelProps: SidePanelBindingProps<any> = {\n ...props,\n formProps: props.formProps\n };\n\n const entityViewWidth = getEntityViewWidth(props, smallLayout, customizationController);\n return {\n key: `${props.path}/${props.entityId}`,\n component: <ResolvedSidePanelBinding {...resolvedPanelProps}/>,\n urlPath: urlPath,\n parentUrlPath: parentUrlPath,\n width: entityViewWidth,\n onClose: props.onClose,\n additional: resolvedPanelProps\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useCollectionRegistryController } from "./navigation/contexts/CollectionRegistryContext.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { getEntityChildViews } from "@rebasepro/common";
|
|
4
|
+
//#region src/hooks/useChildViewSource.ts
|
|
5
|
+
/**
|
|
6
|
+
* What kind of list a path addresses: a root collection, a contained
|
|
7
|
+
* subcollection, or a relation — and if a relation, whether the rows are owned
|
|
8
|
+
* by the parent or shared through a junction.
|
|
9
|
+
*
|
|
10
|
+
* Derived from the path rather than passed down, because the same question is
|
|
11
|
+
* asked from places a prop does not reach: the collection view's row actions,
|
|
12
|
+
* the entity form's own delete button, a deep link straight into a tab. All
|
|
13
|
+
* three have the path; only one of them was ever handed a descriptor.
|
|
14
|
+
*
|
|
15
|
+
* Returns `undefined` for a root collection path, and for any path whose parent
|
|
16
|
+
* or relation cannot be resolved — callers should read that as "an ordinary
|
|
17
|
+
* collection", which is the pre-existing behaviour.
|
|
18
|
+
*/
|
|
19
|
+
function useChildViewSource(path) {
|
|
20
|
+
const collectionRegistry = useCollectionRegistryController();
|
|
21
|
+
return useMemo(() => {
|
|
22
|
+
if (!path) return void 0;
|
|
23
|
+
const segments = path.split("/").filter((s) => s && s !== "undefined");
|
|
24
|
+
if (segments.length < 3) return void 0;
|
|
25
|
+
if (collectionRegistry.getParentCollectionSlugs(path).length === 0) return void 0;
|
|
26
|
+
const childKey = segments[segments.length - 1];
|
|
27
|
+
const parentPath = segments.slice(0, -2).join("/");
|
|
28
|
+
let parentCollection;
|
|
29
|
+
try {
|
|
30
|
+
parentCollection = collectionRegistry.getCollection(parentPath);
|
|
31
|
+
} catch {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!parentCollection) return void 0;
|
|
35
|
+
return getEntityChildViews(parentCollection).find((view) => view.key === childKey)?.source;
|
|
36
|
+
}, [path, collectionRegistry]);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { useChildViewSource };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=useChildViewSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChildViewSource.js","names":[],"sources":["../../src/hooks/useChildViewSource.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { ChildViewSource } from \"@rebasepro/types\";\nimport { getEntityChildViews } from \"@rebasepro/common\";\n\nimport { useCollectionRegistryController } from \"./navigation/contexts/CollectionRegistryContext\";\n\n/**\n * What kind of list a path addresses: a root collection, a contained\n * subcollection, or a relation — and if a relation, whether the rows are owned\n * by the parent or shared through a junction.\n *\n * Derived from the path rather than passed down, because the same question is\n * asked from places a prop does not reach: the collection view's row actions,\n * the entity form's own delete button, a deep link straight into a tab. All\n * three have the path; only one of them was ever handed a descriptor.\n *\n * Returns `undefined` for a root collection path, and for any path whose parent\n * or relation cannot be resolved — callers should read that as \"an ordinary\n * collection\", which is the pre-existing behaviour.\n */\nexport function useChildViewSource(path: string | undefined): ChildViewSource | undefined {\n const collectionRegistry = useCollectionRegistryController();\n\n return useMemo(() => {\n if (!path) return undefined;\n\n const segments = path.split(\"/\").filter(s => s && s !== \"undefined\");\n // `parent/id/child` is the shortest addressable child list.\n if (segments.length < 3) return undefined;\n // ...but three segments are not always a child list: a slug may contain\n // slashes, and `medico/v2.0.0/joints` is one root collection. Only the\n // registry knows where a slug ends, so ask it whether anything sits\n // above the collection this path addresses.\n if (collectionRegistry.getParentCollectionSlugs(path).length === 0) return undefined;\n\n const childKey = segments[segments.length - 1];\n // Drop the child segment and the parent's id: what remains addresses the\n // collection the child hangs off, however deeply nested it is.\n const parentPath = segments.slice(0, -2).join(\"/\");\n\n let parentCollection;\n try {\n parentCollection = collectionRegistry.getCollection(parentPath);\n } catch {\n return undefined;\n }\n if (!parentCollection) return undefined;\n\n return getEntityChildViews(parentCollection).find(view => view.key === childKey)?.source;\n }, [path, collectionRegistry]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,SAAgB,mBAAmB,MAAuD;CACtF,MAAM,qBAAqB,gCAAgC;CAE3D,OAAO,cAAc;EACjB,IAAI,CAAC,MAAM,OAAO,KAAA;EAElB,MAAM,WAAW,KAAK,MAAM,GAAG,CAAC,CAAC,QAAO,MAAK,KAAK,MAAM,WAAW;EAEnE,IAAI,SAAS,SAAS,GAAG,OAAO,KAAA;EAKhC,IAAI,mBAAmB,yBAAyB,IAAI,CAAC,CAAC,WAAW,GAAG,OAAO,KAAA;EAE3E,MAAM,WAAW,SAAS,SAAS,SAAS;EAG5C,MAAM,aAAa,SAAS,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG;EAEjD,IAAI;EACJ,IAAI;GACA,mBAAmB,mBAAmB,cAAc,UAAU;EAClE,QAAQ;GACJ;EACJ;EACA,IAAI,CAAC,kBAAkB,OAAO,KAAA;EAE9B,OAAO,oBAAoB,gBAAgB,CAAC,CAAC,MAAK,SAAQ,KAAK,QAAQ,QAAQ,CAAC,EAAE;CACtF,GAAG,CAAC,MAAM,kBAAkB,CAAC;AACjC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { getEntityTitlePropertyKeyForEntity, isUserSelectProperty, resolveTitleToString } from "../util/previews.js";
|
|
2
|
+
import { getUserLabel, useResolvedUser } from "./useResolvedUsers.js";
|
|
3
|
+
import { useEffect, useMemo, useSyncExternalStore } from "react";
|
|
4
|
+
import { entityDisplayKey, getDisplayPropertyKey, getDisplayResolver, getPropertyInPath, getSharedEntityDisplayCache, useRebaseContext } from "@rebasepro/app";
|
|
5
|
+
import { getValueInPath } from "@rebasepro/utils";
|
|
6
|
+
import "@rebasepro/cms-types";
|
|
7
|
+
//#region src/hooks/useEntityDisplay.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The store behind {@link useEntityDisplay}, for invalidating after a write.
|
|
10
|
+
*
|
|
11
|
+
* The app's one shared store, so every surface agrees on a record and resolves
|
|
12
|
+
* it once, and so it is emptied with the rest of the session's caches when the
|
|
13
|
+
* user signs out.
|
|
14
|
+
*/
|
|
15
|
+
function useEntityDisplayCache() {
|
|
16
|
+
return getSharedEntityDisplayCache();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* What fills one display role of one record.
|
|
20
|
+
*
|
|
21
|
+
* This is the only implementation. Before it there were seven for the title
|
|
22
|
+
* alone — the identity bar, the detail header, inline previews, reference cards,
|
|
23
|
+
* list slots, relation chips and the headless view — each re-deriving it from
|
|
24
|
+
* `collection.properties` and disagreeing about the answer.
|
|
25
|
+
*
|
|
26
|
+
* Resolution order, per role:
|
|
27
|
+
*
|
|
28
|
+
* 1. `admin.display[role]` as a **resolver** — awaited, cached per record and
|
|
29
|
+
* role, with the derived value showing meanwhile so nothing flickers empty.
|
|
30
|
+
* 2. `admin.display[role]` as a **property path** (or, for the title, the
|
|
31
|
+
* deprecated `titleProperty`).
|
|
32
|
+
* 3. The **derived** answer: for the title, the best-ranked property carrying a
|
|
33
|
+
* readable value; for the rest, today's per-role heuristics.
|
|
34
|
+
*
|
|
35
|
+
* A user-picker title resolves to the person behind the id, as it always did —
|
|
36
|
+
* that path is now here rather than in two of the seven.
|
|
37
|
+
*/
|
|
38
|
+
function useEntityDisplay(role, { collection, entity, values: valuesProp, enabled = true }) {
|
|
39
|
+
const context = useRebaseContext();
|
|
40
|
+
const cache = useEntityDisplayCache();
|
|
41
|
+
const values = valuesProp ?? entity?.values;
|
|
42
|
+
const declaredKey = collection ? getDisplayPropertyKey(collection, role) : void 0;
|
|
43
|
+
const propertyKey = collection && role === "title" && !declaredKey ? getEntityTitlePropertyKeyForEntity(collection, values, entity?.id) : declaredKey;
|
|
44
|
+
const rawValue = values && propertyKey ? getValueInPath(values, propertyKey) : void 0;
|
|
45
|
+
const titleUser = useResolvedUser(collection && role === "title" && isUserSelectProperty(collection, propertyKey) && typeof rawValue === "string" ? rawValue : void 0);
|
|
46
|
+
const derived = useMemo(() => {
|
|
47
|
+
if (titleUser) return getUserLabel(titleUser);
|
|
48
|
+
if (rawValue === void 0 || rawValue === null) return void 0;
|
|
49
|
+
if (role === "title" || role === "subtitle" || role === "status") return resolveTitleToString(rawValue) || void 0;
|
|
50
|
+
return rawValue;
|
|
51
|
+
}, [
|
|
52
|
+
titleUser,
|
|
53
|
+
rawValue,
|
|
54
|
+
role
|
|
55
|
+
]);
|
|
56
|
+
const resolver = collection ? getDisplayResolver(collection, role) : void 0;
|
|
57
|
+
const canResolve = Boolean(enabled && resolver && entity);
|
|
58
|
+
const key = entity ? entityDisplayKey(entity.path, entity.id, role) : void 0;
|
|
59
|
+
const resolved = useSyncExternalStore((cb) => cache.subscribe(cb), () => canResolve && key ? cache.peek(key) : void 0, () => void 0);
|
|
60
|
+
const loading = Boolean(canResolve && key && resolved === void 0);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!canResolve || !key || !resolver || !entity) return;
|
|
63
|
+
if (cache.peek(key) !== void 0) return;
|
|
64
|
+
cache.resolve(key, () => resolver({
|
|
65
|
+
entity,
|
|
66
|
+
context
|
|
67
|
+
})).catch(() => {});
|
|
68
|
+
}, [
|
|
69
|
+
cache,
|
|
70
|
+
canResolve,
|
|
71
|
+
key,
|
|
72
|
+
resolver,
|
|
73
|
+
entity,
|
|
74
|
+
context,
|
|
75
|
+
role
|
|
76
|
+
]);
|
|
77
|
+
const value = (canResolve && resolved !== null ? resolved : void 0) ?? derived;
|
|
78
|
+
return useMemo(() => ({
|
|
79
|
+
value,
|
|
80
|
+
loading,
|
|
81
|
+
source: collection && propertyKey && value === derived && derived !== void 0 ? {
|
|
82
|
+
key: propertyKey,
|
|
83
|
+
property: getPropertyInPath(collection.properties, propertyKey),
|
|
84
|
+
value: rawValue
|
|
85
|
+
} : void 0
|
|
86
|
+
}), [
|
|
87
|
+
value,
|
|
88
|
+
loading,
|
|
89
|
+
propertyKey,
|
|
90
|
+
derived,
|
|
91
|
+
collection,
|
|
92
|
+
rawValue
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Every display role of a record at once — what a list row, a card or a board
|
|
97
|
+
* card needs, in one call rather than six.
|
|
98
|
+
*
|
|
99
|
+
* The role list is iterated from {@link ENTITY_DISPLAY_ROLES} so the hook order
|
|
100
|
+
* is fixed and adding a role does not mean editing every caller.
|
|
101
|
+
*/
|
|
102
|
+
function useEntityDisplayValues(params) {
|
|
103
|
+
const title = useEntityDisplay("title", params);
|
|
104
|
+
const subtitle = useEntityDisplay("subtitle", params);
|
|
105
|
+
const image = useEntityDisplay("image", params);
|
|
106
|
+
const status = useEntityDisplay("status", params);
|
|
107
|
+
const date = useEntityDisplay("date", params);
|
|
108
|
+
const tags = useEntityDisplay("tags", params);
|
|
109
|
+
return useMemo(() => ({
|
|
110
|
+
title,
|
|
111
|
+
subtitle,
|
|
112
|
+
image,
|
|
113
|
+
status,
|
|
114
|
+
date,
|
|
115
|
+
tags,
|
|
116
|
+
loading: title.loading || subtitle.loading || image.loading || status.loading || date.loading || tags.loading
|
|
117
|
+
}), [
|
|
118
|
+
title,
|
|
119
|
+
subtitle,
|
|
120
|
+
image,
|
|
121
|
+
status,
|
|
122
|
+
date,
|
|
123
|
+
tags
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* What the record is called — the one role asked for often enough on its own to
|
|
128
|
+
* deserve a name.
|
|
129
|
+
*/
|
|
130
|
+
function useEntityTitle(params) {
|
|
131
|
+
return useEntityDisplay("title", params);
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { useEntityDisplay, useEntityDisplayCache, useEntityDisplayValues, useEntityTitle };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=useEntityDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityDisplay.js","names":[],"sources":["../../src/hooks/useEntityDisplay.tsx"],"sourcesContent":["import type { AdminCollection, EntityDisplayRole } from \"@rebasepro/cms-types\";\nimport type { Entity, Property } from \"@rebasepro/types\";\nimport { ENTITY_DISPLAY_ROLES } from \"@rebasepro/cms-types\";\nimport { useEffect, useMemo, useSyncExternalStore } from \"react\";\nimport {\n type EntityDisplayCache,\n entityDisplayKey,\n getSharedEntityDisplayCache,\n getDisplayPropertyKey,\n getDisplayResolver,\n getPropertyInPath,\n useRebaseContext\n} from \"@rebasepro/app\";\nimport { getValueInPath } from \"@rebasepro/utils\";\n\nimport { getEntityTitlePropertyKeyForEntity, isUserSelectProperty, resolveTitleToString } from \"../util/previews\";\nimport { getUserLabel, useResolvedUser } from \"./useResolvedUsers\";\n\n/**\n * What fills one display role for one record.\n *\n * `value` is `undefined` rather than a placeholder when nothing resolved,\n * because the substitute differs by surface and each one knows its own better\n * than this hook does: a page heading wants the singular collection name, a link\n * wants the id, a draft wants \"New customer\". A single baked-in fallback is\n * exactly what produced three different ones scattered across the consumers.\n */\nexport interface ResolvedDisplayValue<T = unknown> {\n /** What goes in the slot. `undefined` when the record has nothing for it. */\n value: T | undefined;\n /**\n * A resolver is in flight, and `value` currently holds the derived answer or\n * nothing. Surfaces that can show a skeleton may; none has to.\n */\n loading: boolean;\n /**\n * Set only when the value came from a property of this collection. Carries\n * what a rich renderer needs — a status shows as its enum's coloured chip,\n * an image as a storage thumbnail — which a bare resolved string cannot\n * describe.\n */\n source?: {\n key: string;\n property: Property | undefined;\n value: unknown;\n };\n}\n\n/**\n * The store behind {@link useEntityDisplay}, for invalidating after a write.\n *\n * The app's one shared store, so every surface agrees on a record and resolves\n * it once, and so it is emptied with the rest of the session's caches when the\n * user signs out.\n */\nexport function useEntityDisplayCache(): EntityDisplayCache {\n return getSharedEntityDisplayCache();\n}\n\nexport interface UseEntityDisplayParams<M extends Record<string, unknown>> {\n /**\n * Optional because several callers look the collection up in the registry by\n * path and may not find it — a relation into a collection the panel does not\n * register. A hook that could not be called until that succeeded would have\n * to sit below an early return, which is not where hooks go.\n */\n collection?: AdminCollection<M>;\n /**\n * The record. A resolver is handed the whole entity — its id and path are\n * how it reaches anything the record does not carry — so a computed value is\n * only available once there is an entity to compute it from.\n */\n entity?: Entity<M>;\n /**\n * Values to read a declared path from when they are newer than the entity:\n * the live form values while editing. Falls back to `entity.values`.\n */\n values?: Record<string, unknown>;\n /** Set false to skip resolver work entirely — a draft has nothing to show. */\n enabled?: boolean;\n}\n\n/**\n * What fills one display role of one record.\n *\n * This is the only implementation. Before it there were seven for the title\n * alone — the identity bar, the detail header, inline previews, reference cards,\n * list slots, relation chips and the headless view — each re-deriving it from\n * `collection.properties` and disagreeing about the answer.\n *\n * Resolution order, per role:\n *\n * 1. `admin.display[role]` as a **resolver** — awaited, cached per record and\n * role, with the derived value showing meanwhile so nothing flickers empty.\n * 2. `admin.display[role]` as a **property path** (or, for the title, the\n * deprecated `titleProperty`).\n * 3. The **derived** answer: for the title, the best-ranked property carrying a\n * readable value; for the rest, today's per-role heuristics.\n *\n * A user-picker title resolves to the person behind the id, as it always did —\n * that path is now here rather than in two of the seven.\n */\nexport function useEntityDisplay<T = unknown, M extends Record<string, unknown> = Record<string, unknown>>(\n role: EntityDisplayRole,\n {\n collection,\n entity,\n values: valuesProp,\n enabled = true\n }: UseEntityDisplayParams<M>\n): ResolvedDisplayValue<T> {\n\n const context = useRebaseContext();\n const cache = useEntityDisplayCache();\n\n const values = valuesProp ?? entity?.values;\n\n /* ---- the declared or derived key ------------------------------------- */\n\n // The title is the one role with a ranking behind it: several candidates,\n // best first, skipping the ones that hold nothing for *this* record. The\n // others are a single declared or derived key.\n const declaredKey = collection ? getDisplayPropertyKey(collection, role) : undefined;\n const propertyKey = collection && role === \"title\" && !declaredKey\n ? getEntityTitlePropertyKeyForEntity(collection, values, entity?.id)\n : declaredKey;\n\n const rawValue = values && propertyKey ? getValueInPath(values, propertyKey) : undefined;\n\n // A user picker stores an auth id and renders the person: resolved like a\n // relation, and hooked unconditionally so the hook order never changes.\n const titleUser = useResolvedUser(\n collection && role === \"title\" && isUserSelectProperty(collection, propertyKey) && typeof rawValue === \"string\"\n ? rawValue\n : undefined\n );\n\n const derived = useMemo<T | undefined>(() => {\n if (titleUser) return getUserLabel(titleUser) as T;\n if (rawValue === undefined || rawValue === null) return undefined;\n // Only text roles get flattened to a string; a date stays a date and an\n // image stays whatever the storage property holds, so the renderer can\n // still format them.\n if (role === \"title\" || role === \"subtitle\" || role === \"status\") {\n return (resolveTitleToString(rawValue) || undefined) as T | undefined;\n }\n return rawValue as T;\n }, [titleUser, rawValue, role]);\n\n /* ---- the computed answer --------------------------------------------- */\n\n const resolver = collection ? getDisplayResolver(collection, role) : undefined;\n const canResolve = Boolean(enabled && resolver && entity);\n const key = entity ? entityDisplayKey(entity.path, entity.id, role) : undefined;\n\n const resolved = useSyncExternalStore<unknown>(\n // Subscribing unconditionally keeps the hook order stable. The store\n // only notifies when an entry changes, so a collection with no resolver\n // never re-renders from it.\n cb => cache.subscribe(cb),\n () => (canResolve && key ? cache.peek(key) : undefined),\n // Server render: nothing is resolved, so every slot starts at its\n // fallback and hydration does not disagree with the markup.\n () => undefined\n );\n\n const loading = Boolean(canResolve && key && resolved === undefined);\n\n useEffect(() => {\n if (!canResolve || !key || !resolver || !entity) return;\n if (cache.peek(key) !== undefined) return;\n cache.resolve(key, () => resolver({\n entity,\n context\n })).catch(() => {\n // Unreachable, and kept only so it stays that way: `resolve` records a\n // failure as \"nothing\" and returns a RESOLVED promise, which is why\n // the warning that used to live here could never run — see the note on\n // `EntityDisplayCache.resolve`. The cache reports the failure itself\n // now, once per key. This exists so that if `resolve` ever starts\n // rejecting, it surfaces as a caught no-op rather than an unhandled\n // rejection during render.\n });\n }, [cache, canResolve, key, resolver, entity, context, role]);\n\n /* ---- the answer ------------------------------------------------------ */\n\n // A resolver that produced nothing falls back to the derived value rather\n // than to blank: it said this record has no computed answer for the role,\n // not that the role should be empty.\n const computed = canResolve && resolved !== null ? resolved as T | undefined : undefined;\n const value = computed ?? derived;\n\n return useMemo(() => ({\n value,\n loading,\n source: collection && propertyKey && value === derived && derived !== undefined\n ? {\n key: propertyKey,\n property: getPropertyInPath(collection.properties, propertyKey),\n value: rawValue\n }\n : undefined\n }), [value, loading, propertyKey, derived, collection, rawValue]);\n}\n\n/**\n * Every display role of a record at once — what a list row, a card or a board\n * card needs, in one call rather than six.\n *\n * The role list is iterated from {@link ENTITY_DISPLAY_ROLES} so the hook order\n * is fixed and adding a role does not mean editing every caller.\n */\nexport function useEntityDisplayValues<M extends Record<string, unknown>>(\n params: UseEntityDisplayParams<M>\n): Record<EntityDisplayRole, ResolvedDisplayValue> & { loading: boolean } {\n\n // Not a loop over `useEntityDisplay`: the number of hooks a component calls\n // has to be fixed at compile time, and a role added to the array later would\n // silently change it. Written out, it is checked by the return type.\n const title = useEntityDisplay<string, M>(\"title\", params);\n const subtitle = useEntityDisplay<string, M>(\"subtitle\", params);\n const image = useEntityDisplay<string, M>(\"image\", params);\n const status = useEntityDisplay<string, M>(\"status\", params);\n const date = useEntityDisplay<Date | string | number, M>(\"date\", params);\n const tags = useEntityDisplay<string[] | string, M>(\"tags\", params);\n\n return useMemo(() => ({\n title,\n subtitle,\n image,\n status,\n date,\n tags,\n loading: title.loading || subtitle.loading || image.loading\n || status.loading || date.loading || tags.loading\n }), [title, subtitle, image, status, date, tags]);\n}\n\n/**\n * What the record is called — the one role asked for often enough on its own to\n * deserve a name.\n */\nexport function useEntityTitle<M extends Record<string, unknown>>(\n params: UseEntityDisplayParams<M>\n): ResolvedDisplayValue<string> {\n return useEntityDisplay<string, M>(\"title\", params);\n}\n\n/** Re-exported so a caller can iterate roles without reaching into types. */\nexport { ENTITY_DISPLAY_ROLES };\n"],"mappings":";;;;;;;;;;;;;;AAuDA,SAAgB,wBAA4C;CACxD,OAAO,4BAA4B;AACvC;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,iBACZ,MACA,EACI,YACA,QACA,QAAQ,YACR,UAAU,QAES;CAEvB,MAAM,UAAU,iBAAiB;CACjC,MAAM,QAAQ,sBAAsB;CAEpC,MAAM,SAAS,cAAc,QAAQ;CAOrC,MAAM,cAAc,aAAa,sBAAsB,YAAY,IAAI,IAAI,KAAA;CAC3E,MAAM,cAAc,cAAc,SAAS,WAAW,CAAC,cACjD,mCAAmC,YAAY,QAAQ,QAAQ,EAAE,IACjE;CAEN,MAAM,WAAW,UAAU,cAAc,eAAe,QAAQ,WAAW,IAAI,KAAA;CAI/E,MAAM,YAAY,gBACd,cAAc,SAAS,WAAW,qBAAqB,YAAY,WAAW,KAAK,OAAO,aAAa,WACjG,WACA,KAAA,CACV;CAEA,MAAM,UAAU,cAA6B;EACzC,IAAI,WAAW,OAAO,aAAa,SAAS;EAC5C,IAAI,aAAa,KAAA,KAAa,aAAa,MAAM,OAAO,KAAA;EAIxD,IAAI,SAAS,WAAW,SAAS,cAAc,SAAS,UACpD,OAAQ,qBAAqB,QAAQ,KAAK,KAAA;EAE9C,OAAO;CACX,GAAG;EAAC;EAAW;EAAU;CAAI,CAAC;CAI9B,MAAM,WAAW,aAAa,mBAAmB,YAAY,IAAI,IAAI,KAAA;CACrE,MAAM,aAAa,QAAQ,WAAW,YAAY,MAAM;CACxD,MAAM,MAAM,SAAS,iBAAiB,OAAO,MAAM,OAAO,IAAI,IAAI,IAAI,KAAA;CAEtE,MAAM,WAAW,sBAIb,OAAM,MAAM,UAAU,EAAE,SACjB,cAAc,MAAM,MAAM,KAAK,GAAG,IAAI,KAAA,SAGvC,KAAA,CACV;CAEA,MAAM,UAAU,QAAQ,cAAc,OAAO,aAAa,KAAA,CAAS;CAEnE,gBAAgB;EACZ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ;EACjD,IAAI,MAAM,KAAK,GAAG,MAAM,KAAA,GAAW;EACnC,MAAM,QAAQ,WAAW,SAAS;GAC9B;GACA;EACJ,CAAC,CAAC,CAAC,CAAC,YAAY,CAQhB,CAAC;CACL,GAAG;EAAC;EAAO;EAAY;EAAK;EAAU;EAAQ;EAAS;CAAI,CAAC;CAQ5D,MAAM,SADW,cAAc,aAAa,OAAO,WAA4B,KAAA,MACrD;CAE1B,OAAO,eAAe;EAClB;EACA;EACA,QAAQ,cAAc,eAAe,UAAU,WAAW,YAAY,KAAA,IAChE;GACE,KAAK;GACL,UAAU,kBAAkB,WAAW,YAAY,WAAW;GAC9D,OAAO;EACX,IACE,KAAA;CACV,IAAI;EAAC;EAAO;EAAS;EAAa;EAAS;EAAY;CAAQ,CAAC;AACpE;;;;;;;;AASA,SAAgB,uBACZ,QACsE;CAKtE,MAAM,QAAQ,iBAA4B,SAAS,MAAM;CACzD,MAAM,WAAW,iBAA4B,YAAY,MAAM;CAC/D,MAAM,QAAQ,iBAA4B,SAAS,MAAM;CACzD,MAAM,SAAS,iBAA4B,UAAU,MAAM;CAC3D,MAAM,OAAO,iBAA4C,QAAQ,MAAM;CACvE,MAAM,OAAO,iBAAuC,QAAQ,MAAM;CAElE,OAAO,eAAe;EAClB;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,MAAM,WAAW,SAAS,WAAW,MAAM,WAC7C,OAAO,WAAW,KAAK,WAAW,KAAK;CAClD,IAAI;EAAC;EAAO;EAAU;EAAO;EAAQ;EAAM;CAAI,CAAC;AACpD;;;;;AAMA,SAAgB,eACZ,QAC4B;CAC5B,OAAO,iBAA4B,SAAS,MAAM;AACtD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useEntityTitle } from "./useEntityDisplay.js";
|
|
2
|
+
//#region src/hooks/useEntityDisplayTitle.tsx
|
|
3
|
+
/**
|
|
4
|
+
* The heading for a record: the identity bar and the breadcrumb.
|
|
5
|
+
*
|
|
6
|
+
* Everything about *what a record is called* lives in {@link useEntityTitle}.
|
|
7
|
+
* What is left here is the heading's own two rules, which are presentation, not
|
|
8
|
+
* identity:
|
|
9
|
+
*
|
|
10
|
+
* The guard on `status` is the first. The title resolver returns the first
|
|
11
|
+
* candidate carrying a value, and on a brand new entity the only values are the
|
|
12
|
+
* property defaults — so creating a blog post opened a page headed **draft**,
|
|
13
|
+
* the default of its `status` enum. A record that does not exist yet has no
|
|
14
|
+
* name; it has an intent.
|
|
15
|
+
*
|
|
16
|
+
* The fallback is the second. A page needs a heading even when the record has
|
|
17
|
+
* nothing readable in it, and the honest one is what kind of thing it is.
|
|
18
|
+
*/
|
|
19
|
+
function useEntityDisplayTitle({ collection, entity, values, status }) {
|
|
20
|
+
const isNew = status === "new";
|
|
21
|
+
const singular = collection.singularName ?? collection.name;
|
|
22
|
+
const { value: title } = useEntityTitle({
|
|
23
|
+
collection,
|
|
24
|
+
entity,
|
|
25
|
+
values,
|
|
26
|
+
enabled: !isNew
|
|
27
|
+
});
|
|
28
|
+
if (isNew) return `New ${singular.toLowerCase()}`;
|
|
29
|
+
return title ?? singular;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useEntityDisplayTitle };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=useEntityDisplayTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityDisplayTitle.js","names":[],"sources":["../../src/hooks/useEntityDisplayTitle.tsx"],"sourcesContent":["import type { AdminCollection } from \"@rebasepro/cms-types\";\nimport type { Entity, EntityStatus } from \"@rebasepro/types\";\nimport { useEntityTitle } from \"./useEntityDisplay\";\n\nexport interface UseEntityDisplayTitleParams<M extends Record<string, unknown>> {\n collection: AdminCollection<M>;\n /** The record. Needed for a computed title; see {@link useEntityTitle}. */\n entity?: Entity<M>;\n /** Live form values, when they are ahead of the entity. */\n values?: Record<string, unknown>;\n status: EntityStatus;\n}\n\n/**\n * The heading for a record: the identity bar and the breadcrumb.\n *\n * Everything about *what a record is called* lives in {@link useEntityTitle}.\n * What is left here is the heading's own two rules, which are presentation, not\n * identity:\n *\n * The guard on `status` is the first. The title resolver returns the first\n * candidate carrying a value, and on a brand new entity the only values are the\n * property defaults — so creating a blog post opened a page headed **draft**,\n * the default of its `status` enum. A record that does not exist yet has no\n * name; it has an intent.\n *\n * The fallback is the second. A page needs a heading even when the record has\n * nothing readable in it, and the honest one is what kind of thing it is.\n */\nexport function useEntityDisplayTitle<M extends Record<string, unknown>>({\n collection,\n entity,\n values,\n status\n}: UseEntityDisplayTitleParams<M>): string {\n\n const isNew = status === \"new\";\n const singular = collection.singularName ?? collection.name;\n\n const { value: title } = useEntityTitle<M>({\n collection,\n entity,\n values,\n enabled: !isNew\n });\n\n if (isNew) return `New ${singular.toLowerCase()}`;\n return title ?? singular;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,SAAgB,sBAAyD,EACrE,YACA,QACA,QACA,UACuC;CAEvC,MAAM,QAAQ,WAAW;CACzB,MAAM,WAAW,WAAW,gBAAgB,WAAW;CAEvD,MAAM,EAAE,OAAO,UAAU,eAAkB;EACvC;EACA;EACA;EACA,SAAS,CAAC;CACd,CAAC;CAED,IAAI,OAAO,OAAO,OAAO,SAAS,YAAY;CAC9C,OAAO,SAAS;AACpB"}
|