@rebasepro/cms 0.30.1 → 0.31.0-canary.g59cd6fd
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 +8 -8
- package/dist/collection_editor/ConfigControllerProvider.js +25 -22
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -1
- package/dist/collection_editor/firestore_callee.d.ts +10 -0
- package/dist/collection_editor/firestore_callee.js +15 -0
- package/dist/collection_editor/firestore_callee.js.map +1 -0
- package/dist/collection_editor/firestore_edit.d.ts +62 -0
- package/dist/collection_editor/firestore_edit.js +339 -0
- package/dist/collection_editor/firestore_edit.js.map +1 -0
- package/dist/collection_editor/index.d.ts +2 -3
- package/dist/collection_editor/liveSchemaClient.d.ts +44 -22
- package/dist/collection_editor/liveSchemaClient.js +9 -3
- package/dist/collection_editor/liveSchemaClient.js.map +1 -1
- package/dist/collection_editor/property_column.d.ts +86 -0
- package/dist/collection_editor/property_column.js +719 -0
- package/dist/collection_editor/property_column.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +2 -24
- package/dist/collection_editor/serializable_utils.d.ts +1 -1
- package/dist/collection_editor/serializable_utils.js +2 -1
- package/dist/collection_editor/serializable_utils.js.map +1 -1
- package/dist/collection_editor/split_edit.d.ts +106 -0
- package/dist/collection_editor/split_edit.js +564 -0
- package/dist/collection_editor/split_edit.js.map +1 -0
- package/dist/collection_editor/split_edit_error.d.ts +25 -0
- package/dist/collection_editor/split_edit_error.js +35 -0
- package/dist/collection_editor/split_edit_error.js.map +1 -0
- package/dist/collection_editor/types/collection_editor_controller.d.ts +1 -1
- package/dist/collection_editor/types/config_controller.d.ts +67 -1
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +6 -5
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +44 -12
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +18 -3
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +94 -55
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +3 -3
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +2 -3
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +7 -4
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +15 -5
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.d.ts +20 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js +74 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.d.ts +34 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js +50 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +1 -2
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -1
- package/dist/collection_editor/useDetachRulesConfirmation.d.ts +16 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js +48 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +2 -2
- package/dist/collection_editor/useLiveSchemaEditing.js +1 -1
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -1
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +54 -10
- package/dist/collection_editor/useLocalCollectionsConfigController.js +394 -122
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -1
- package/dist/collection_editor/validateCollectionJson.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +10 -9
- package/dist/components/CollectionPanel.js +5 -2
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +1 -2
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +3 -5
- package/dist/components/CollectionTableBinding/PropertyTableCell.d.ts +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +1 -1
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.d.ts +2 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.d.ts +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +1 -2
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +2 -2
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionTableBinding/table_bindings.d.ts +2 -2
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -5
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +2 -4
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +6 -6
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +1 -2
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntitiesCount.js +3 -3
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -1
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +1 -2
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/RowActions.d.ts +1 -2
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/SortButton.d.ts +1 -1
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +1 -2
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.d.ts +2 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.js +3 -3
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +2 -4
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +14 -19
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +1 -3
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +1 -2
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +23 -8
- package/dist/components/CollectionsProvider.js +23 -7
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/DefaultDrawer.js +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +1 -1
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +3 -3
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -1
- package/dist/components/EditViewBinding.js +6 -6
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.d.ts +1 -2
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityInspector.d.ts +1 -2
- package/dist/components/EntityInspector.js.map +1 -1
- package/dist/components/EntityPreviewBinding.d.ts +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +1 -1
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +1 -1
- package/dist/components/EntityViewBody.js +3 -4
- package/dist/components/EntityViewBody.js.map +1 -1
- package/dist/components/FieldValue.js +2 -2
- package/dist/components/FieldValue.js.map +1 -1
- package/dist/components/HomePage/ContentHomePage.js +12 -3
- package/dist/components/HomePage/ContentHomePage.js.map +1 -1
- package/dist/components/InlineEntityPreview.d.ts +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PropertyCollectionView.d.ts +2 -2
- package/dist/components/PropertyCollectionView.js.map +1 -1
- package/dist/components/PropertyConfigBadge.js.map +1 -1
- package/dist/components/RebaseCMS.d.ts +22 -3
- package/dist/components/RebaseCMS.js +32 -14
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +106 -31
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RecordDetail.js +4 -1
- package/dist/components/RecordDetail.js.map +1 -1
- package/dist/components/RecordForm.d.ts +5 -5
- package/dist/components/RecordForm.js +5 -2
- package/dist/components/RecordForm.js.map +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +2 -2
- package/dist/components/ReferenceTable/SelectionTableBinding.js +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +2 -1
- package/dist/components/ReferenceWidget.js +2 -2
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.d.ts +2 -1
- package/dist/components/RelationSelector.js +2 -3
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +2 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +3 -3
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/null_filter.d.ts +1 -3
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -1
- package/dist/components/SidePanelBinding.js +1 -1
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/field_configs.d.ts +1 -2
- package/dist/components/field_configs.js.map +1 -1
- package/dist/components/field_ids.d.ts +1 -1
- package/dist/components/field_ids.js +1 -1
- package/dist/components/field_ids.js.map +1 -1
- package/dist/components/history/EntityHistoryEntry.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +1 -2
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/data_export/export/BasicExportAction.d.ts +1 -1
- package/dist/data_export/export/BasicExportAction.js.map +1 -1
- package/dist/data_export/export/ExportCollectionAction.js +2 -2
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +1 -1
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_export/export/export.d.ts +1 -1
- package/dist/data_export/export/export.js +1 -1
- package/dist/data_export/export/export.js.map +1 -1
- package/dist/data_export/export/fetch_export_data.d.ts +3 -2
- package/dist/data_export/export/fetch_export_data.js.map +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -1
- package/dist/data_import/hooks/useImportConfig.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.d.ts +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/data_import/types/column_mapping.d.ts +1 -1
- package/dist/data_import/utils/data.d.ts +1 -2
- package/dist/data_import/utils/data.js +1 -2
- package/dist/data_import/utils/data.js.map +1 -1
- package/dist/data_import/utils/get_import_inference_type.d.ts +1 -1
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -1
- package/dist/data_import/utils/id_column.d.ts +1 -1
- package/dist/data_import/utils/id_column.js.map +1 -1
- package/dist/data_import/utils/import_columns.d.ts +1 -1
- package/dist/data_import/utils/import_columns.js.map +1 -1
- package/dist/data_import/utils/save_entities.d.ts +3 -3
- package/dist/data_import/utils/save_entities.js +1 -1
- package/dist/data_import/utils/save_entities.js.map +1 -1
- package/dist/form/EntityForm.js +2 -1
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.js +2 -2
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormFieldsContext.d.ts +1 -4
- package/dist/form/FormFieldsContext.js +1 -1
- package/dist/form/FormFieldsContext.js.map +1 -1
- package/dist/form/PropertyFieldBinding.js +6 -8
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/components/FieldBlock.d.ts +1 -2
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FieldHelperText.d.ts +1 -1
- package/dist/form/components/FieldHelperText.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +1 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/LocalChangesMenu.d.ts +1 -1
- package/dist/form/components/LocalChangesMenu.js.map +1 -1
- package/dist/form/components/StorageItemPreview.d.ts +1 -1
- package/dist/form/components/StorageItemPreview.js.map +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.js +1 -2
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -1
- package/dist/form/form_utils.d.ts +3 -3
- package/dist/form/form_utils.js +1 -2
- package/dist/form/form_utils.js.map +1 -1
- package/dist/form/label_placement.d.ts +1 -2
- package/dist/form/label_placement.js.map +1 -1
- package/dist/form/resolve_cell_property.d.ts +1 -2
- package/dist/form/resolve_cell_property.js +1 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/form/resolve_form_properties.d.ts +2 -2
- package/dist/form/resolve_form_properties.js +1 -1
- package/dist/form/resolve_form_properties.js.map +1 -1
- package/dist/form/useClearRestoreValue.d.ts +1 -1
- package/dist/form/useClearRestoreValue.js.map +1 -1
- package/dist/form/validation.d.ts +2 -2
- package/dist/form/validation.js +1 -1
- package/dist/form/validation.js.map +1 -1
- package/dist/hooks/navigation/compose_collections.d.ts +59 -0
- package/dist/hooks/navigation/compose_collections.js +48 -0
- package/dist/hooks/navigation/compose_collections.js.map +1 -0
- package/dist/hooks/navigation/compose_collections_input.d.ts +8 -0
- package/dist/hooks/navigation/compose_collections_input.js +17 -0
- package/dist/hooks/navigation/compose_collections_input.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -1
- package/dist/hooks/navigation/registered_collection.d.ts +15 -0
- package/dist/hooks/navigation/registered_collection.js +20 -0
- package/dist/hooks/navigation/registered_collection.js.map +1 -0
- package/dist/hooks/navigation/ui_preferences.d.ts +47 -0
- package/dist/hooks/navigation/ui_preferences.js +179 -0
- package/dist/hooks/navigation/ui_preferences.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.d.ts +8 -1
- package/dist/hooks/navigation/useAsyncResolver.js +9 -3
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -1
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +1 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +3 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +9 -5
- package/dist/hooks/navigation/useBuildNavigationStateController.js +2 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useBuildUrlController.d.ts +1 -1
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.js +1 -2
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/usePanelTables.d.ts +11 -0
- package/dist/hooks/navigation/usePanelTables.js +33 -0
- package/dist/hooks/navigation/usePanelTables.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.d.ts +8 -3
- package/dist/hooks/navigation/useResolvedCollections.js +3 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +1 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -2
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -1
- package/dist/hooks/navigation/user_preferences_overlay.d.ts +21 -0
- package/dist/hooks/navigation/user_preferences_overlay.js +101 -0
- package/dist/hooks/navigation/user_preferences_overlay.js.map +1 -0
- package/dist/hooks/navigation/utils.js +1 -1
- package/dist/hooks/navigation/utils.js.map +1 -1
- package/dist/hooks/useAdminContext.d.ts +1 -2
- package/dist/hooks/useAdminContext.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.d.ts +1 -2
- package/dist/hooks/useBuildSidePanel.js +2 -1
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useChildViewSource.d.ts +1 -1
- package/dist/hooks/useChildViewSource.js +1 -1
- package/dist/hooks/useChildViewSource.js.map +1 -1
- package/dist/hooks/useEntityDisplay.d.ts +1 -2
- package/dist/hooks/useEntityDisplay.js +1 -1
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useEntityDisplayTitle.d.ts +2 -2
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -1
- package/dist/hooks/useHistory.js +1 -1
- package/dist/hooks/useHistory.js.map +1 -1
- package/dist/hooks/useRecordActions.d.ts +1 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useReferencePaths.d.ts +21 -7
- package/dist/hooks/useReferencePaths.js +23 -6
- package/dist/hooks/useReferencePaths.js.map +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useResolvedNavigationFrom.js +1 -1
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -2
- package/dist/mcp_view/app_modules.d.ts +2 -2
- package/dist/mcp_view/app_modules.js +4 -4
- package/dist/mcp_view/app_modules.js.map +1 -1
- package/dist/mcp_view/index.d.ts +16 -19
- package/dist/mcp_view/index.js +43 -62
- package/dist/mcp_view/index.js.map +1 -1
- package/dist/mcp_view/payload.d.ts +54 -18
- package/dist/mcp_view/payload.js +49 -24
- package/dist/mcp_view/payload.js.map +1 -1
- package/dist/mcp_view/screen.js +11 -11
- package/dist/mcp_view/screen.js.map +1 -1
- package/dist/mcp_view/tool_driver.d.ts +5 -34
- package/dist/mcp_view/tool_driver.js +17 -16
- package/dist/mcp_view/tool_driver.js.map +1 -1
- package/dist/mcp_view/write_review.d.ts +1 -2
- package/dist/mcp_view/write_review.js +1 -1
- package/dist/mcp_view/write_review.js.map +1 -1
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreview.js +4 -3
- package/dist/preview/PropertyPreview.js.map +1 -1
- package/dist/preview/components/ArrayEnumPreview.d.ts +1 -1
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -1
- package/dist/preview/components/BooleanPreview.d.ts +1 -1
- package/dist/preview/components/BooleanPreview.js.map +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.js +1 -1
- package/dist/preview/components/EnumValuesChip.js.map +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.js.map +1 -1
- package/dist/preview/components/RelationPreview.d.ts +1 -1
- package/dist/preview/components/RelationPreview.js.map +1 -1
- package/dist/preview/components/StorageThumbnail.js +2 -1
- package/dist/preview/components/StorageThumbnail.js.map +1 -1
- package/dist/preview/components/UserPreview.d.ts +1 -1
- package/dist/preview/components/UserPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +2 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -1
- package/dist/preview/util.d.ts +1 -1
- package/dist/preview/util.js.map +1 -1
- package/dist/routes/RebaseRoute.js +2 -2
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/saved_apps/SavedAppsView.d.ts +1 -1
- package/dist/saved_apps/SavedAppsView.js +1 -1
- package/dist/saved_apps/SavedAppsView.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +1 -1
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/resolve_selection.d.ts +3 -3
- package/dist/selection/resolve_selection.js +3 -2
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/tables/apply_customization.d.ts +65 -0
- package/dist/tables/apply_customization.js +644 -0
- package/dist/tables/apply_customization.js.map +1 -0
- package/dist/tables/column_property.d.ts +64 -0
- package/dist/tables/column_property.js +549 -0
- package/dist/tables/column_property.js.map +1 -0
- package/dist/tables/customize_table.d.ts +39 -0
- package/dist/tables/customize_table.js +247 -0
- package/dist/tables/customize_table.js.map +1 -0
- package/dist/tables/index.d.ts +12 -0
- package/dist/tables/labels.d.ts +18 -0
- package/dist/tables/labels.js +18 -0
- package/dist/tables/labels.js.map +1 -0
- package/dist/tables/project_table.d.ts +79 -0
- package/dist/tables/project_table.js +148 -0
- package/dist/tables/project_table.js.map +1 -0
- package/dist/tables/relations.d.ts +47 -0
- package/dist/tables/relations.js +112 -0
- package/dist/tables/relations.js.map +1 -0
- package/dist/tables/rls.d.ts +39 -0
- package/dist/tables/rls.js +111 -0
- package/dist/tables/rls.js.map +1 -0
- package/dist/tables/update_record.d.ts +32 -0
- package/dist/tables/update_record.js +40 -0
- package/dist/tables/update_record.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/PropertyPreviewProps.d.ts +2 -2
- package/dist/types/fields.d.ts +2 -2
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/entity_pages.d.ts +2 -1
- package/dist/util/entity_pages.js.map +1 -1
- package/dist/util/find_entities_by_ids.d.ts +2 -2
- package/dist/util/find_entities_by_ids.js +1 -1
- package/dist/util/find_entities_by_ids.js.map +1 -1
- package/dist/util/format_collection_date.d.ts +1 -1
- package/dist/util/format_collection_date.js.map +1 -1
- package/dist/util/identity.d.ts +8 -0
- package/dist/util/identity.js +16 -0
- package/dist/util/identity.js.map +1 -0
- package/dist/util/navigation_utils.js +1 -1
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/previews.js +1 -1
- package/dist/util/previews.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +1 -1
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/dist/util/property_utils.d.ts +1 -3
- package/dist/util/property_utils.js +1 -1
- package/dist/util/property_utils.js.map +1 -1
- package/dist/util/relations.d.ts +18 -0
- package/dist/util/relations.js +32 -0
- package/dist/util/relations.js.map +1 -0
- package/package.json +12 -10
- package/recipes/README.md +4 -4
- package/recipes/my-preferences.tsx +34 -26
- package/recipes/site-settings.tsx +34 -27
- package/dist/collection_editor/collection_wire.d.ts +0 -13
- package/dist/collection_editor/collection_wire.js +0 -49
- package/dist/collection_editor/collection_wire.js.map +0 -1
- package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +0 -37
- package/dist/collection_editor/useJsonCollectionsConfigController.js +0 -191
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigationResolution.js","names":[],"sources":["../../../src/hooks/navigation/useNavigationResolution.ts"],"sourcesContent":["import type { AuthCollectionConfig, CollectionCallbacks } from \"@rebasepro/types\";\nimport type { AppView, AppViewsBuilder, EntityAction, CollectionConfigsBuilder, RebaseContext, RebasePlugin, UserCreationResult, AdminCollection } from \"@rebasepro/cms-types\";\nimport { type User, type RebaseSdkData } from \"@rebasepro/types\";\nimport { type AuthController, resolveAdminCollection } from \"@rebasepro/cms-types\";\nimport { canReadCollection } from \"@rebasepro/common\";\nimport { accountAccessAction, resetMfaAction, resetPasswordAction } from \"../../components/common/default_entity_actions\";\nimport { CreationResultDialog } from \"../../components/admin/CreationResultDialog\";\nimport React from \"react\";\n\n/**\n * Check whether a `RebaseCallContext` is actually the full frontend\n * `RebaseContext` (which carries `dialogsController`).\n */\nfunction isRebaseContext(ctx: unknown): ctx is RebaseContext {\n return typeof ctx === \"object\" && ctx !== null && \"dialogsController\" in ctx;\n}\n\nexport function filterOutNotAllowedCollections(resolvedCollections: AdminCollection[], authController: AuthController): AdminCollection[] {\n return resolvedCollections\n .filter((c) => canReadCollection(c, authController))\n .map((c) => {\n if (!c.childCollections) return c;\n return {\n ...c,\n childCollections: () => filterOutNotAllowedCollections(c.childCollections!() ?? [], authController)\n };\n });\n}\n\nexport function applyPluginModifyCollection(resolvedCollections: AdminCollection[], modifyCollection: (collection: AdminCollection) => AdminCollection): AdminCollection[] {\n return resolvedCollections.map((collection): AdminCollection => {\n const modifiedCollection = modifyCollection(collection);\n if (modifiedCollection.childCollections) {\n return {\n ...modifiedCollection,\n childCollections: () => applyPluginModifyCollection(modifiedCollection.childCollections!() ?? [], modifyCollection)\n };\n }\n return modifiedCollection;\n });\n}\n\n/**\n * Auto-inject auth-specific entity actions and callbacks for collections\n * with `auth: true` or `auth: { enabled: true }`.\n *\n * Injections:\n * 1. **resetPasswordAction** — adds the entity action unless explicitly disabled,\n * or unless the auth adapter reports no `adminPasswordReset` support. Custom\n * adapters mount their own admin routes and may not implement\n * `POST /admin/users/:userId/reset-password`; injecting the action anyway\n * would show a button that can only ever 404.\n * 2. **browserCallbacks.afterSave** — shows the `CreationResultDialog` when a\n * new user is created with `invitationSent` or `temporaryPassword` in the\n * response\n *\n * Skips injection if the collection already has the action/callback present.\n */\nfunction injectAuthCollectionConfig(\n collections: AdminCollection[],\n adminPasswordResetSupported: boolean\n): AdminCollection[] {\n return collections.map((collection) => {\n const authProp = collection.auth;\n if (!authProp) return collection;\n\n const isAuth = authProp === true || (typeof authProp === \"object\" && authProp.enabled === true);\n if (!isAuth) return collection;\n\n const authConfig: AuthCollectionConfig | undefined = typeof authProp === \"object\" ? authProp : undefined;\n\n let result = collection;\n\n // ─── Entity Action injection (resetPassword) ─────────────────────\n const resetPref = authConfig?.actions?.resetPassword;\n let actionToInject: EntityAction | undefined;\n\n if (resetPref === false) {\n actionToInject = undefined;\n } else if (typeof resetPref === \"object\") {\n // An explicitly supplied action is the collection author's own; they\n // own its backend, so the adapter capability doesn't apply.\n // `auth.actions.resetPassword`'s object form is an EntityAction; core\n // types it as `object` because a server never renders one.\n actionToInject = resetPref as EntityAction;\n } else if (!adminPasswordResetSupported) {\n actionToInject = undefined;\n } else {\n actionToInject = resetPasswordAction;\n }\n\n if (actionToInject) {\n const injectedAction = actionToInject;\n const existing = result.entityActions ?? [];\n // An entry is either the action or the key of an app-level one, and a\n // collection that names `\"reset_password\"` already has this action — so\n // the string form has to count here too, or the reset action is injected\n // a second time and the user gets two identical buttons.\n const alreadyHas = existing.some((a) =>\n typeof a === \"string\"\n ? a === injectedAction.key\n : a.key != null && a.key === injectedAction.key\n );\n if (!alreadyHas) {\n result = {\n ...result,\n entityActions: [...existing, injectedAction]\n };\n }\n }\n\n // ─── The other admin user actions ───────────────────────────────\n //\n // Resetting a user's second factors and switching an account off are\n // mounted by the same admin user routes as the password reset, so the\n // same capability says whether they exist. Each action is offered only\n // to a caller holding `users:write`, which is what the routes demand.\n if (adminPasswordResetSupported) {\n const present = result.entityActions ?? [];\n const missing = [resetMfaAction, accountAccessAction].filter((action) => !present.some((a) =>\n typeof a === \"string\" ? a === action.key : a.key != null && a.key === action.key));\n if (missing.length > 0) {\n result = { ...result, entityActions: [...present, ...missing] };\n }\n }\n\n // ─── afterSave callback (creation result dialog) ─────────────────\n //\n // `browserCallbacks`, not `callbacks`. This injection has always been a\n // panel behaviour — it opens a dialog — but it was installed on the\n // server's block, which nothing in the browser runs and which the Vite\n // plugin strips on the way into the bundle. So it never fired, and\n // creating a user through the panel never showed the temporary password\n // the server had just minted and will not repeat.\n const existingAfterSave = result.browserCallbacks?.afterSave;\n const injectedAfterSave = {\n ...result.browserCallbacks,\n afterSave: (async (props) => {\n await existingAfterSave?.(props);\n\n const { values, status, context } = props;\n if (status !== \"new\" && status !== \"copy\") return;\n\n const hasCreationInfo = values.invitationSent !== undefined || values.temporaryPassword !== undefined;\n if (!hasCreationInfo || !isRebaseContext(context) || !context.dialogsController) return;\n\n const { dialogsController } = context;\n\n const creationResult: UserCreationResult = {\n user: {\n uid: String(props.id),\n email: typeof values.email === \"string\" ? values.email : \"\",\n displayName: typeof values.displayName === \"string\" ? values.displayName : \"\",\n roles: Array.isArray(values.roles) ? values.roles as string[] : [],\n photoURL: typeof values.photoURL === \"string\"\n ? values.photoURL\n : typeof values.photoUrl === \"string\"\n ? values.photoUrl\n : null,\n providerId: \"password\",\n isAnonymous: false\n },\n invitationSent: !!values.invitationSent,\n temporaryPassword: typeof values.temporaryPassword === \"string\" ? values.temporaryPassword : undefined,\n emailDeliveryFailed: !!values.emailDeliveryFailed\n };\n\n const { closeDialog } = dialogsController.open({\n key: \"user_creation_result\",\n Component: () => (\n React.createElement(CreationResultDialog, {\n result: creationResult,\n onClose: () => closeDialog()\n })\n )\n });\n }) as NonNullable<CollectionCallbacks[\"afterSave\"]>\n };\n\n // Written to both the flat key and the block. This injection runs after\n // `resolveAdminCollection` has flattened `admin` onto the top level, and\n // that flattening spreads the block *over* the top level — so anything\n // put only up here is undone the next time a collection is re-resolved,\n // which the registry controller does on every lookup. Writing both keeps\n // re-flattening the no-op its callers already believe it is.\n result = {\n ...result,\n browserCallbacks: injectedAfterSave,\n admin: {\n ...result.admin,\n browserCallbacks: injectedAfterSave\n }\n };\n\n return result;\n });\n}\n\nexport async function resolveCollections(\n collections: undefined | AdminCollection[] | CollectionConfigsBuilder,\n authController: AuthController,\n data: RebaseSdkData,\n plugins: RebasePlugin[] | undefined\n): Promise<AdminCollection[]> {\n let resolvedCollections: AdminCollection[] = [];\n if (typeof collections === \"function\") {\n resolvedCollections = await collections({\n user: authController.user,\n authController,\n data\n });\n } else if (Array.isArray(collections)) {\n resolvedCollections = collections;\n }\n\n // Collections arrive in the authoring shape, with presentation nested under\n // `admin`. Everything downstream — plugins, navigation, the drawer — reads the\n // panel's flat view model, so `admin.group` or `admin.hideFromNavigation`\n // would otherwise be silently ignored.\n resolvedCollections = resolvedCollections.map(resolveAdminCollection);\n\n if (plugins) {\n for (const plugin of plugins) {\n if (plugin.hooks?.modifyCollection) {\n resolvedCollections = applyPluginModifyCollection(resolvedCollections, plugin.hooks.modifyCollection);\n }\n\n if (plugin.hooks?.injectCollections) {\n // A plugin may return collections in the authoring shape too; the\n // flattening is idempotent, so re-running it is safe.\n resolvedCollections = plugin.hooks.injectCollections(resolvedCollections).map(resolveAdminCollection);\n }\n }\n }\n\n // Auto-inject auth entity actions and callbacks (resetPassword, creation dialog, etc.)\n resolvedCollections = injectAuthCollectionConfig(\n resolvedCollections,\n authController.capabilities?.adminPasswordReset ?? true\n );\n\n resolvedCollections = filterOutNotAllowedCollections(resolvedCollections, authController);\n return resolvedCollections;\n}\n\nexport async function resolveAppViews(\n baseViews: AppView[] | AppViewsBuilder | undefined,\n authController: AuthController,\n data: RebaseSdkData,\n plugins?: RebasePlugin[]\n): Promise<AppView[]> {\n let resolvedViews: AppView[] = [];\n if (typeof baseViews === \"function\") {\n resolvedViews = await baseViews({\n user: authController.user,\n authController,\n data\n }) ?? [];\n } else if (Array.isArray(baseViews)) {\n resolvedViews = baseViews;\n }\n\n // Inject views from plugins\n if (plugins) {\n for (const plugin of plugins) {\n if (plugin.views && plugin.views.length > 0) {\n resolvedViews = [...resolvedViews, ...plugin.views];\n }\n }\n }\n\n // Detect duplicate view slugs (dev warning)\n if (process.env.NODE_ENV !== 'production') {\n const slugCounts = new Map<string, number>();\n resolvedViews.forEach(v => {\n slugCounts.set(v.slug, (slugCounts.get(v.slug) ?? 0) + 1);\n });\n slugCounts.forEach((count, slug) => {\n if (count > 1) {\n console.warn(\n `[Rebase] Duplicate view slug \"${slug}\" detected (${count} views). ` +\n `Last-write-wins. Ensure unique slugs across admin views and plugins.`\n );\n }\n });\n }\n\n // Filter by roles — applies to admin, plugin, and builder-returned views\n resolvedViews = filterViewsByRole(resolvedViews, authController);\n\n return resolvedViews;\n}\n\n/**\n * Filter views by the `roles` field on AppView.\n * When `roles` is set, the view is only included if the current user\n * has at least one of the listed roles. Views without `roles` (or with\n * an empty array) are always included.\n */\nfunction filterViewsByRole(views: AppView[], authController: AuthController): AppView[] {\n const userRoles = authController.user?.roles ?? [];\n return views.filter(view => {\n if (!view.roles || view.roles.length === 0) return true;\n return view.roles.some(role => userRoles.includes(role));\n });\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAS,gBAAgB,KAAoC;CACzD,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,uBAAuB;AAC7E;AAEA,SAAgB,+BAA+B,qBAAwC,gBAAmD;CACtI,OAAO,oBACF,QAAQ,MAAM,kBAAkB,GAAG,cAAc,CAAC,CAAC,CACnD,KAAK,MAAM;EACR,IAAI,CAAC,EAAE,kBAAkB,OAAO;EAChC,OAAO;GACH,GAAG;GACH,wBAAwB,+BAA+B,EAAE,iBAAkB,KAAK,CAAC,GAAG,cAAc;EACtG;CACJ,CAAC;AACT;AAEA,SAAgB,4BAA4B,qBAAwC,kBAAuF;CACvK,OAAO,oBAAoB,KAAK,eAAgC;EAC5D,MAAM,qBAAqB,iBAAiB,UAAU;EACtD,IAAI,mBAAmB,kBACnB,OAAO;GACH,GAAG;GACH,wBAAwB,4BAA4B,mBAAmB,iBAAkB,KAAK,CAAC,GAAG,gBAAgB;EACtH;EAEJ,OAAO;CACX,CAAC;AACL;;;;;;;;;;;;;;;;;AAkBA,SAAS,2BACL,aACA,6BACiB;CACjB,OAAO,YAAY,KAAK,eAAe;EACnC,MAAM,WAAW,WAAW;EAC5B,IAAI,CAAC,UAAU,OAAO;EAGtB,IAAI,EADW,aAAa,QAAS,OAAO,aAAa,YAAY,SA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AAe,cAAc,sBAAsB,IACvD;CAEA,sBAAsB,+BAA+B,qBAAqB,cAAc;CACxF,OAAO;AACX;AAEA,eAAsB,gBAClB,WACA,gBACA,MACA,SACkB;CAClB,IAAI,gBAA2B,CAAC;CAChC,IAAI,OAAO,cAAc,YACrB,gBAAgB,MAAM,UAAU;EAC5B,MAAM,eAAe;EACrB;EACA;CACJ,CAAC,KAAK,CAAC;MACJ,IAAI,MAAM,QAAQ,SAAS,GAC9B,gBAAgB;CAIpB,IAAI;OACK,MAAM,UAAU,SACjB,IAAI,OAAO,SAAS,OAAO,MAAM,SAAS,GACtC,gBAAgB,CAAC,GAAG,eAAe,GAAG,OAAO,KAAK;CAAA;CAM9D,IAAA,QAAA,IAAA,aAA6B,cAAc;EACvC,MAAM,6BAAa,IAAI,IAAoB;EAC3C,cAAc,SAAQ,MAAK;GACvB,WAAW,IAAI,EAAE,OAAO,WAAW,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC;EAC5D,CAAC;EACD,WAAW,SAAS,OAAO,SAAS;GAChC,IAAI,QAAQ,GACR,QAAQ,KACJ,iCAAiC,KAAK,cAAc,MAAM,8EAE9D;EAER,CAAC;CACL;CAGA,gBAAgB,kBAAkB,eAAe,cAAc;CAE/D,OAAO;AACX;;;;;;;AAQA,SAAS,kBAAkB,OAAkB,gBAA2C;CACpF,MAAM,YAAY,eAAe,MAAM,SAAS,CAAC;CACjD,OAAO,MAAM,QAAO,SAAQ;EACxB,IAAI,CAAC,KAAK,SAAS,KAAK,MAAM,WAAW,GAAG,OAAO;EACnD,OAAO,KAAK,MAAM,MAAK,SAAQ,UAAU,SAAS,IAAI,CAAC;CAC3D,CAAC;AACL"}
|
|
1
|
+
{"version":3,"file":"useNavigationResolution.js","names":[],"sources":["../../../src/hooks/navigation/useNavigationResolution.ts"],"sourcesContent":["import type { AppView, AppViewsBuilder, EntityAction, CollectionConfigsBuilder, RebaseContext, RebasePlugin, UserCreationResult, AdminCollection, AuthCollectionConfig, CollectionCallbacks } from \"@rebasepro/cms-types\";\nimport { type User, type RebaseSdkData } from \"@rebasepro/types\";\nimport { type AuthController, resolveAdminCollection, canReadCollection } from \"@rebasepro/cms-types\";\nimport { accountAccessAction, resetMfaAction, resetPasswordAction } from \"../../components/common/default_entity_actions\";\nimport { CreationResultDialog } from \"../../components/admin/CreationResultDialog\";\nimport React from \"react\";\n\n/**\n * Check whether a `RebaseCallContext` is actually the full frontend\n * `RebaseContext` (which carries `dialogsController`).\n */\nfunction isRebaseContext(ctx: unknown): ctx is RebaseContext {\n return typeof ctx === \"object\" && ctx !== null && \"dialogsController\" in ctx;\n}\n\nexport function filterOutNotAllowedCollections(resolvedCollections: AdminCollection[], authController: AuthController): AdminCollection[] {\n return resolvedCollections\n .filter((c) => canReadCollection(c, authController))\n .map((c) => {\n if (!c.childCollections) return c;\n return {\n ...c,\n childCollections: () => filterOutNotAllowedCollections(c.childCollections!() ?? [], authController)\n };\n });\n}\n\nexport function applyPluginModifyCollection(resolvedCollections: AdminCollection[], modifyCollection: (collection: AdminCollection) => AdminCollection): AdminCollection[] {\n return resolvedCollections.map((collection): AdminCollection => {\n const modifiedCollection = modifyCollection(collection);\n if (modifiedCollection.childCollections) {\n return {\n ...modifiedCollection,\n childCollections: () => applyPluginModifyCollection(modifiedCollection.childCollections!() ?? [], modifyCollection)\n };\n }\n return modifiedCollection;\n });\n}\n\n/**\n * Auto-inject auth-specific entity actions and callbacks for collections\n * with `auth: true` or `auth: { enabled: true }`.\n *\n * Injections:\n * 1. **resetPasswordAction** — adds the entity action unless explicitly disabled,\n * or unless the auth adapter reports no `adminPasswordReset` support. Custom\n * adapters mount their own admin routes and may not implement\n * `POST /admin/users/:userId/reset-password`; injecting the action anyway\n * would show a button that can only ever 404.\n * 2. **browserCallbacks.afterSave** — shows the `CreationResultDialog` when a\n * new user is created with `invitationSent` or `temporaryPassword` in the\n * response\n *\n * Skips injection if the collection already has the action/callback present.\n */\nfunction injectAuthCollectionConfig(\n collections: AdminCollection[],\n adminPasswordResetSupported: boolean\n): AdminCollection[] {\n return collections.map((collection) => {\n const authProp = collection.auth;\n if (!authProp) return collection;\n\n const isAuth = authProp === true || (typeof authProp === \"object\" && authProp.enabled === true);\n if (!isAuth) return collection;\n\n const authConfig: AuthCollectionConfig | undefined = typeof authProp === \"object\" ? authProp : undefined;\n\n let result = collection;\n\n // ─── Entity Action injection (resetPassword) ─────────────────────\n const resetPref = authConfig?.actions?.resetPassword;\n let actionToInject: EntityAction | undefined;\n\n if (resetPref === false) {\n actionToInject = undefined;\n } else if (typeof resetPref === \"object\") {\n // An explicitly supplied action is the collection author's own; they\n // own its backend, so the adapter capability doesn't apply.\n // `auth.actions.resetPassword`'s object form is an EntityAction; core\n // types it as `object` because a server never renders one.\n actionToInject = resetPref as EntityAction;\n } else if (!adminPasswordResetSupported) {\n actionToInject = undefined;\n } else {\n actionToInject = resetPasswordAction;\n }\n\n if (actionToInject) {\n const injectedAction = actionToInject;\n const existing = result.entityActions ?? [];\n // An entry is either the action or the key of an app-level one, and a\n // collection that names `\"reset_password\"` already has this action — so\n // the string form has to count here too, or the reset action is injected\n // a second time and the user gets two identical buttons.\n const alreadyHas = existing.some((a) =>\n typeof a === \"string\"\n ? a === injectedAction.key\n : a.key != null && a.key === injectedAction.key\n );\n if (!alreadyHas) {\n result = {\n ...result,\n entityActions: [...existing, injectedAction]\n };\n }\n }\n\n // ─── The other admin user actions ───────────────────────────────\n //\n // Resetting a user's second factors and switching an account off are\n // mounted by the same admin user routes as the password reset, so the\n // same capability says whether they exist. Each action is offered only\n // to a caller holding `users:write`, which is what the routes demand.\n if (adminPasswordResetSupported) {\n const present = result.entityActions ?? [];\n const missing = [resetMfaAction, accountAccessAction].filter((action) => !present.some((a) =>\n typeof a === \"string\" ? a === action.key : a.key != null && a.key === action.key));\n if (missing.length > 0) {\n result = { ...result, entityActions: [...present, ...missing] };\n }\n }\n\n // ─── afterSave callback (creation result dialog) ─────────────────\n //\n // `browserCallbacks`, not `callbacks`. This injection has always been a\n // panel behaviour — it opens a dialog — but it was installed on the\n // server's block, which nothing in the browser runs and which the Vite\n // plugin strips on the way into the bundle. So it never fired, and\n // creating a user through the panel never showed the temporary password\n // the server had just minted and will not repeat.\n const existingAfterSave = result.browserCallbacks?.afterSave;\n const injectedAfterSave = {\n ...result.browserCallbacks,\n afterSave: (async (props) => {\n await existingAfterSave?.(props);\n\n const { values, status, context } = props;\n if (status !== \"new\" && status !== \"copy\") return;\n\n const hasCreationInfo = values.invitationSent !== undefined || values.temporaryPassword !== undefined;\n if (!hasCreationInfo || !isRebaseContext(context) || !context.dialogsController) return;\n\n const { dialogsController } = context;\n\n const creationResult: UserCreationResult = {\n user: {\n uid: String(props.id),\n email: typeof values.email === \"string\" ? values.email : \"\",\n displayName: typeof values.displayName === \"string\" ? values.displayName : \"\",\n roles: Array.isArray(values.roles) ? values.roles as string[] : [],\n photoURL: typeof values.photoURL === \"string\"\n ? values.photoURL\n : typeof values.photoUrl === \"string\"\n ? values.photoUrl\n : null,\n providerId: \"password\",\n isAnonymous: false\n },\n invitationSent: !!values.invitationSent,\n temporaryPassword: typeof values.temporaryPassword === \"string\" ? values.temporaryPassword : undefined,\n emailDeliveryFailed: !!values.emailDeliveryFailed\n };\n\n const { closeDialog } = dialogsController.open({\n key: \"user_creation_result\",\n Component: () => (\n React.createElement(CreationResultDialog, {\n result: creationResult,\n onClose: () => closeDialog()\n })\n )\n });\n }) as NonNullable<CollectionCallbacks[\"afterSave\"]>\n };\n\n // Written to both the flat key and the block. This injection runs after\n // `resolveAdminCollection` has flattened `admin` onto the top level, and\n // that flattening spreads the block *over* the top level — so anything\n // put only up here is undone the next time a collection is re-resolved,\n // which the registry controller does on every lookup. Writing both keeps\n // re-flattening the no-op its callers already believe it is.\n result = {\n ...result,\n browserCallbacks: injectedAfterSave,\n admin: {\n ...result.admin,\n browserCallbacks: injectedAfterSave\n }\n };\n\n return result;\n });\n}\n\nexport async function resolveCollections(\n collections: undefined | AdminCollection[] | CollectionConfigsBuilder,\n authController: AuthController,\n data: RebaseSdkData,\n plugins: RebasePlugin[] | undefined\n): Promise<AdminCollection[]> {\n let resolvedCollections: AdminCollection[] = [];\n if (typeof collections === \"function\") {\n resolvedCollections = await collections({\n user: authController.user,\n authController,\n data\n });\n } else if (Array.isArray(collections)) {\n resolvedCollections = collections;\n }\n\n // Collections arrive in the authoring shape, with presentation nested under\n // `admin`. Everything downstream — plugins, navigation, the drawer — reads the\n // panel's flat view model, so `admin.group` or `admin.hideFromNavigation`\n // would otherwise be silently ignored.\n resolvedCollections = resolvedCollections.map(resolveAdminCollection);\n\n if (plugins) {\n for (const plugin of plugins) {\n if (plugin.hooks?.modifyCollection) {\n resolvedCollections = applyPluginModifyCollection(resolvedCollections, plugin.hooks.modifyCollection);\n }\n\n if (plugin.hooks?.injectCollections) {\n // A plugin may return collections in the authoring shape too; the\n // flattening is idempotent, so re-running it is safe.\n resolvedCollections = plugin.hooks.injectCollections(resolvedCollections).map(resolveAdminCollection);\n }\n }\n }\n\n // Auto-inject auth entity actions and callbacks (resetPassword, creation dialog, etc.)\n resolvedCollections = injectAuthCollectionConfig(\n resolvedCollections,\n authController.capabilities?.adminPasswordReset ?? true\n );\n\n resolvedCollections = filterOutNotAllowedCollections(resolvedCollections, authController);\n return resolvedCollections;\n}\n\nexport async function resolveAppViews(\n baseViews: AppView[] | AppViewsBuilder | undefined,\n authController: AuthController,\n data: RebaseSdkData,\n plugins?: RebasePlugin[]\n): Promise<AppView[]> {\n let resolvedViews: AppView[] = [];\n if (typeof baseViews === \"function\") {\n resolvedViews = await baseViews({\n user: authController.user,\n authController,\n data\n }) ?? [];\n } else if (Array.isArray(baseViews)) {\n resolvedViews = baseViews;\n }\n\n // Inject views from plugins\n if (plugins) {\n for (const plugin of plugins) {\n if (plugin.views && plugin.views.length > 0) {\n resolvedViews = [...resolvedViews, ...plugin.views];\n }\n }\n }\n\n // Detect duplicate view slugs (dev warning)\n if (process.env.NODE_ENV !== 'production') {\n const slugCounts = new Map<string, number>();\n resolvedViews.forEach(v => {\n slugCounts.set(v.slug, (slugCounts.get(v.slug) ?? 0) + 1);\n });\n slugCounts.forEach((count, slug) => {\n if (count > 1) {\n console.warn(\n `[Rebase] Duplicate view slug \"${slug}\" detected (${count} views). ` +\n `Last-write-wins. Ensure unique slugs across admin views and plugins.`\n );\n }\n });\n }\n\n // Filter by roles — applies to admin, plugin, and builder-returned views\n resolvedViews = filterViewsByRole(resolvedViews, authController);\n\n return resolvedViews;\n}\n\n/**\n * Filter views by the `roles` field on AppView.\n * When `roles` is set, the view is only included if the current user\n * has at least one of the listed roles. Views without `roles` (or with\n * an empty array) are always included.\n */\nfunction filterViewsByRole(views: AppView[], authController: AuthController): AppView[] {\n const userRoles = authController.user?.roles ?? [];\n return views.filter(view => {\n if (!view.roles || view.roles.length === 0) return true;\n return view.roles.some(role => userRoles.includes(role));\n });\n}\n"],"mappings":";;;;;;;;;AAWA,SAAS,gBAAgB,KAAoC;CACzD,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,uBAAuB;AAC7E;AAEA,SAAgB,+BAA+B,qBAAwC,gBAAmD;CACtI,OAAO,oBACF,QAAQ,MAAM,kBAAkB,GAAG,cAAc,CAAC,CAAC,CACnD,KAAK,MAAM;EACR,IAAI,CAAC,EAAE,kBAAkB,OAAO;EAChC,OAAO;GACH,GAAG;GACH,wBAAwB,+BAA+B,EAAE,iBAAkB,KAAK,CAAC,GAAG,cAAc;EACtG;CACJ,CAAC;AACT;AAEA,SAAgB,4BAA4B,qBAAwC,kBAAuF;CACvK,OAAO,oBAAoB,KAAK,eAAgC;EAC5D,MAAM,qBAAqB,iBAAiB,UAAU;EACtD,IAAI,mBAAmB,kBACnB,OAAO;GACH,GAAG;GACH,wBAAwB,4BAA4B,mBAAmB,iBAAkB,KAAK,CAAC,GAAG,gBAAgB;EACtH;EAEJ,OAAO;CACX,CAAC;AACL;;;;;;;;;;;;;;;;;AAkBA,SAAS,2BACL,aACA,6BACiB;CACjB,OAAO,YAAY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2
|
+
import type { TableDescriptor } from "@rebasepro/types";
|
|
3
|
+
/**
|
|
4
|
+
* The tables a panel scope renders: the ones handed to it (`tables` on
|
|
5
|
+
* `<RebaseCMS>` or `CollectionsProvider`, for embedding and tests), else in an
|
|
6
|
+
* embedding (an MCP App view) the ones its host received, or else the ones the
|
|
7
|
+
* server serves the signed-in caller.
|
|
8
|
+
*
|
|
9
|
+
* Given tables are ready at once and nothing is asked of the server.
|
|
10
|
+
*/
|
|
11
|
+
export declare function usePanelTables(handed: readonly TableDescriptor[] | undefined, enabled: boolean): TableDescriptorsState;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useRebaseEmbedHost, useTableDescriptors } from "@rebasepro/app";
|
|
3
|
+
//#region src/hooks/navigation/usePanelTables.ts
|
|
4
|
+
/**
|
|
5
|
+
* The tables a panel scope renders: the ones handed to it (`tables` on
|
|
6
|
+
* `<RebaseCMS>` or `CollectionsProvider`, for embedding and tests), else in an
|
|
7
|
+
* embedding (an MCP App view) the ones its host received, or else the ones the
|
|
8
|
+
* server serves the signed-in caller.
|
|
9
|
+
*
|
|
10
|
+
* Given tables are ready at once and nothing is asked of the server.
|
|
11
|
+
*/
|
|
12
|
+
function usePanelTables(handed, enabled) {
|
|
13
|
+
const embedded = useRebaseEmbedHost()?.tables;
|
|
14
|
+
const given = handed ?? embedded;
|
|
15
|
+
const served = useTableDescriptors({ enabled: enabled && given === void 0 });
|
|
16
|
+
const reload = served.reload;
|
|
17
|
+
return useMemo(() => given === void 0 ? served : {
|
|
18
|
+
tables: given,
|
|
19
|
+
status: "ready",
|
|
20
|
+
error: void 0,
|
|
21
|
+
unavailable: false,
|
|
22
|
+
unavailableReason: void 0,
|
|
23
|
+
reload
|
|
24
|
+
}, [
|
|
25
|
+
given,
|
|
26
|
+
served,
|
|
27
|
+
reload
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { usePanelTables };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=usePanelTables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelTables.js","names":[],"sources":["../../../src/hooks/navigation/usePanelTables.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useRebaseEmbedHost, useTableDescriptors, type TableDescriptorsState } from \"@rebasepro/app\";\nimport type { TableDescriptor } from \"@rebasepro/types\";\n\n/**\n * The tables a panel scope renders: the ones handed to it (`tables` on\n * `<RebaseCMS>` or `CollectionsProvider`, for embedding and tests), else in an\n * embedding (an MCP App view) the ones its host received, or else the ones the\n * server serves the signed-in caller.\n *\n * Given tables are ready at once and nothing is asked of the server.\n */\nexport function usePanelTables(handed: readonly TableDescriptor[] | undefined, enabled: boolean): TableDescriptorsState {\n const embedded = useRebaseEmbedHost()?.tables;\n const given = handed ?? embedded;\n const served = useTableDescriptors({ enabled: enabled && given === undefined });\n const reload = served.reload;\n return useMemo<TableDescriptorsState>(() => given === undefined ? served : {\n tables: given,\n status: \"ready\",\n error: undefined,\n unavailable: false,\n unavailableReason: undefined,\n reload\n }, [given, served, reload]);\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,eAAe,QAAgD,SAAyC;CACpH,MAAM,WAAW,mBAAmB,CAAC,EAAE;CACvC,MAAM,QAAQ,UAAU;CACxB,MAAM,SAAS,oBAAoB,EAAE,SAAS,WAAW,UAAU,KAAA,EAAU,CAAC;CAC9E,MAAM,SAAS,OAAO;CACtB,OAAO,cAAqC,UAAU,KAAA,IAAY,SAAS;EACvE,QAAQ;EACR,QAAQ;EACR,OAAO,KAAA;EACP,aAAa;EACb,mBAAmB,KAAA;EACnB;CACJ,GAAG;EAAC;EAAO;EAAQ;CAAM,CAAC;AAC9B"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import type { RebasePlugin, AdminCollection } from "@rebasepro/cms-types";
|
|
2
|
-
import {
|
|
3
|
-
import { AuthController } from "@rebasepro/cms-types";
|
|
2
|
+
import { RebaseSdkData, User } from "@rebasepro/types";
|
|
3
|
+
import { AuthController, CollectionRegistryController, CollectionRegistry } from "@rebasepro/cms-types";
|
|
4
4
|
import type { CollectionConfigsBuilder } from "@rebasepro/cms-types";
|
|
5
|
-
import { CollectionRegistry } from "@rebasepro/common";
|
|
6
5
|
export type UseResolvedCollectionsProps<EC extends AdminCollection, USER extends User> = {
|
|
7
6
|
authController: AuthController<USER>;
|
|
8
7
|
collections?: EC[] | CollectionConfigsBuilder<EC>;
|
|
9
8
|
data: RebaseSdkData;
|
|
10
9
|
plugins?: RebasePlugin[];
|
|
11
10
|
disabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* What the collections are built from is still being fetched (the tables
|
|
13
|
+
* the server serves): nothing is resolved meanwhile, and `loading` stays
|
|
14
|
+
* true until the collections built from what arrived are registered.
|
|
15
|
+
*/
|
|
16
|
+
pending?: boolean;
|
|
12
17
|
collectionRegistryController: CollectionRegistryController<EC> & {
|
|
13
18
|
collectionRegistryRef: React.MutableRefObject<CollectionRegistry>;
|
|
14
19
|
};
|
|
@@ -15,7 +15,7 @@ import { useMemo, useRef } from "react";
|
|
|
15
15
|
* plugins) to avoid re-triggering effects when their object identity changes.
|
|
16
16
|
*/
|
|
17
17
|
function useResolvedCollections(props) {
|
|
18
|
-
const { authController, collections: collectionsProp, data, plugins, disabled, collectionRegistryController } = props;
|
|
18
|
+
const { authController, collections: collectionsProp, data, plugins, disabled, pending, collectionRegistryController } = props;
|
|
19
19
|
const userIdentity = authController.user ? `${authController.user.uid}:${(authController.user.roles ?? []).sort().join(",")}` : null;
|
|
20
20
|
const dataRef = useRef(data);
|
|
21
21
|
dataRef.current = data;
|
|
@@ -36,7 +36,8 @@ function useResolvedCollections(props) {
|
|
|
36
36
|
userIdentity,
|
|
37
37
|
disabled
|
|
38
38
|
],
|
|
39
|
-
disabled: disabled || authController.initialLoading
|
|
39
|
+
disabled: disabled || authController.initialLoading,
|
|
40
|
+
pending
|
|
40
41
|
});
|
|
41
42
|
return useMemo(() => ({
|
|
42
43
|
collections,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolvedCollections.js","names":[],"sources":["../../../src/hooks/navigation/useResolvedCollections.ts"],"sourcesContent":["\nimport type { RebasePlugin, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useRef, useMemo } from \"react\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"useResolvedCollections.js","names":[],"sources":["../../../src/hooks/navigation/useResolvedCollections.ts"],"sourcesContent":["\nimport type { RebasePlugin, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useRef, useMemo } from \"react\";\n\nimport { RebaseSdkData, User } from \"@rebasepro/types\";\nimport { AuthController, CollectionRegistryController, CollectionRegistry } from \"@rebasepro/cms-types\";\nimport type { CollectionConfigsBuilder } from \"@rebasepro/cms-types\";\n\nimport { resolveCollections } from \"./useNavigationResolution\";\nimport { areCollectionListsEqual } from \"./utils\";\nimport { useAsyncResolver } from \"./useAsyncResolver\";\n\nexport type UseResolvedCollectionsProps<EC extends AdminCollection, USER extends User> = {\n authController: AuthController<USER>;\n collections?: EC[] | CollectionConfigsBuilder<EC>;\n data: RebaseSdkData;\n plugins?: RebasePlugin[];\n disabled?: boolean;\n /**\n * What the collections are built from is still being fetched (the tables\n * the server serves): nothing is resolved meanwhile, and `loading` stays\n * true until the collections built from what arrived are registered.\n */\n pending?: boolean;\n collectionRegistryController: CollectionRegistryController<EC> & { collectionRegistryRef: React.MutableRefObject<CollectionRegistry> };\n\n};\n\nexport type UseResolvedCollectionsResult = {\n collections: AdminCollection[];\n loading: boolean;\n error: Error | undefined;\n refresh: () => void;\n};\n\n/**\n * Hook that resolves collection props (which may be async builders or arrays)\n * into concrete AdminCollection[], and registers them with the CollectionRegistry.\n *\n * When userManagement is provided, the default users collection is always\n * prepended. Developer collections override via generic slug-based dedup\n * (Map keyed by slug, last-write-wins). No hardcoded string checks.\n *\n * Uses refs for potentially-unstable dependencies (driver, authController,\n * plugins) to avoid re-triggering effects when their object identity changes.\n */\nexport function useResolvedCollections<EC extends AdminCollection, USER extends User>(\n props: UseResolvedCollectionsProps<EC, USER>\n): UseResolvedCollectionsResult {\n\n const {\n authController,\n collections: collectionsProp,\n data,\n plugins,\n disabled,\n pending,\n collectionRegistryController\n } = props;\n\n // Stable identity string for the user — avoids re-triggering when the\n // authController object reference changes but uid/roles are the same.\n const userIdentity = authController.user\n ? `${authController.user.uid}:${(authController.user.roles ?? []).sort().join(',')}`\n : null;\n\n // Use refs for values that may be new objects each render but shouldn't\n // re-trigger the effect. The effect reads them at execution time.\n const dataRef = useRef(data);\n dataRef.current = data;\n const authControllerRef = useRef(authController);\n authControllerRef.current = authController;\n const pluginsRef = useRef(plugins);\n pluginsRef.current = plugins;\n\n const { data: collections, loading, error, refresh } = useAsyncResolver<AdminCollection[]>({\n resolver: async () => {\n const resolved = await resolveCollections(\n collectionsProp,\n authControllerRef.current,\n dataRef.current,\n pluginsRef.current\n );\n\n const deduped = [...resolved];\n\n // Register with the CollectionRegistry; returns true if changed\n const changed = collectionRegistryController.collectionRegistryRef.current.registerMultiple(deduped);\n\n if (changed) {\n console.debug(\"Collections have changed\", deduped);\n }\n\n return deduped;\n },\n initialValue: [],\n isEqual: areCollectionListsEqual,\n deps: [collectionsProp, userIdentity, disabled],\n disabled: disabled || authController.initialLoading,\n pending\n });\n\n return useMemo(() => ({\n collections,\n loading,\n error,\n refresh\n }), [collections, loading, error, refresh]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,SAAgB,uBACZ,OAC4B;CAE5B,MAAM,EACF,gBACA,aAAa,iBACb,MACA,SACA,UACA,SACA,iCACA;CAIJ,MAAM,eAAe,eAAe,OAC9B,GAAG,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,CAAC,EAAA,CAAG,KAAK,CAAC,CAAC,KAAK,GAAG,MAC/E;CAIN,MAAM,UAAU,OAAO,IAAI;CAC3B,QAAQ,UAAU;CAClB,MAAM,oBAAoB,OAAO,cAAc;CAC/C,kBAAkB,UAAU;CAC5B,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CAErB,MAAM,EAAE,MAAM,aAAa,SAAS,OAAO,YAAY,iBAAoC;EACvF,UAAU,YAAY;GAQlB,MAAM,UAAU,CAAC,GAAG,MAPG,mBACnB,iBACA,kBAAkB,SAClB,QAAQ,SACR,WAAW,OACf,CAE4B;GAK5B,IAFgB,6BAA6B,sBAAsB,QAAQ,iBAAiB,OAExF,GACA,QAAQ,MAAM,4BAA4B,OAAO;GAGrD,OAAO;EACX;EACA,cAAc,CAAC;EACf,SAAS;EACT,MAAM;GAAC;GAAiB;GAAc;EAAQ;EAC9C,UAAU,YAAY,eAAe;EACrC;CACJ,CAAC;CAED,OAAO,eAAe;EAClB;EACA;EACA;EACA;CACJ,IAAI;EAAC;EAAa;EAAS;EAAO;CAAO,CAAC;AAC9C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { EffectiveRoleController } from "@rebasepro/types";
|
|
2
1
|
import type { AppView, AppViewsBuilder, RebasePlugin } from "@rebasepro/cms-types";
|
|
3
2
|
import type { RebaseSdkData, User } from "@rebasepro/types";
|
|
4
|
-
import type { AuthController } from "@rebasepro/cms-types";
|
|
3
|
+
import type { AuthController, EffectiveRoleController } from "@rebasepro/cms-types";
|
|
5
4
|
export type UseResolvedViewsProps<USER extends User> = {
|
|
6
5
|
authController: AuthController<USER>;
|
|
7
6
|
views?: AppView[] | AppViewsBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolvedViews.js","names":[],"sources":["../../../src/hooks/navigation/useResolvedViews.tsx"],"sourcesContent":["\nimport type {
|
|
1
|
+
{"version":3,"file":"useResolvedViews.js","names":[],"sources":["../../../src/hooks/navigation/useResolvedViews.tsx"],"sourcesContent":["\nimport type { AppView, AppViewsBuilder, RebasePlugin } from \"@rebasepro/cms-types\";\nimport { useMemo, useRef } from \"react\";\n\n/**\n * Compare two view arrays by their slug identity.\n * Returns true when the sets of slugs are identical (same order, same values).\n * This avoids deepEqual on React elements, which have unstable internal refs.\n */\nfunction viewSlugsEqual(a: AppView[] | undefined, b: AppView[] | undefined): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i].slug !== b[i].slug) return false;\n }\n return true;\n}\n\nimport type { RebaseSdkData, User } from \"@rebasepro/types\";\nimport type { AuthController, EffectiveRoleController } from \"@rebasepro/cms-types\";\n\nimport { resolveAppViews } from \"./useNavigationResolution\";\nimport { useAsyncResolver } from \"./useAsyncResolver\";\n\nexport type UseResolvedViewsProps<USER extends User> = {\n authController: AuthController<USER>;\n views?: AppView[] | AppViewsBuilder;\n adminViews?: AppView[] | AppViewsBuilder;\n data: RebaseSdkData;\n plugins?: RebasePlugin[];\n adminMode?: \"cms\" | \"studio\";\n effectiveRoleController?: EffectiveRoleController;\n};\n\nexport type UseResolvedViewsResult = {\n views: AppView[] | undefined;\n adminViews: AppView[] | undefined;\n loading: boolean;\n error: Error | undefined;\n refresh: () => void;\n};\n\n/**\n * Combined result type for the async resolver — holds both views and\n * adminViews so they can be resolved together in a single async call.\n */\ntype ResolvedViewsData = {\n views: AppView[] | undefined;\n adminViews: AppView[] | undefined;\n};\n\n/**\n * Equality check for the combined views data.\n * Compares both views and adminViews by slug identity.\n */\nfunction areResolvedViewsEqual(a: ResolvedViewsData, b: ResolvedViewsData): boolean {\n return viewSlugsEqual(a.views, b.views) && viewSlugsEqual(a.adminViews, b.adminViews);\n}\n\n/**\n * Hook that resolves view and admin view props (which may be async builders or arrays)\n * into concrete AppView[].\n *\n * Uses refs for potentially-unstable dependencies (driver, authController,\n * plugins) to avoid re-triggering effects when their object identity changes.\n */\nexport function useResolvedViews<USER extends User>(\n props: UseResolvedViewsProps<USER>\n): UseResolvedViewsResult {\n\n const {\n authController,\n views: viewsProp,\n adminViews: adminViewsProp,\n data,\n plugins,\n adminMode = \"cms\",\n effectiveRoleController\n } = props;\n\n // Stable identity string for the user — avoids re-triggering when the\n // authController object reference changes but uid/roles are the same.\n const userIdentity = authController.user\n ? `${authController.user.uid}:${(authController.user.roles ?? []).sort().join(',')}`\n : null;\n\n // Use refs for values that may be new objects each render but shouldn't\n // re-trigger the effect. The effect reads them at execution time.\n const dataRef = useRef(data);\n dataRef.current = data;\n const authControllerRef = useRef(authController);\n authControllerRef.current = authController;\n const pluginsRef = useRef(plugins);\n pluginsRef.current = plugins;\n\n // Build the resolved auth controller (with effective role override for studio mode)\n const resolvedAuthController = useMemo(() => {\n if (adminMode === \"studio\" && effectiveRoleController?.effectiveRole && authController.user) {\n return {\n ...authController,\n user: {\n ...authController.user,\n roles: [effectiveRoleController.effectiveRole]\n }\n };\n }\n return authController;\n }, [adminMode, effectiveRoleController?.effectiveRole, authController]);\n\n // Store resolvedAuthController in a ref for effect access without re-triggering\n const resolvedAuthControllerRef = useRef(resolvedAuthController);\n resolvedAuthControllerRef.current = resolvedAuthController;\n\n const initialLoading = resolvedAuthController.initialLoading;\n\n const { data: resolvedData, loading, error, refresh } = useAsyncResolver<ResolvedViewsData>({\n resolver: async () => {\n const [newViews, newAdminViews] = await Promise.all([\n resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current),\n resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)\n ]);\n return { views: newViews, adminViews: newAdminViews };\n },\n initialValue: { views: undefined, adminViews: undefined },\n isEqual: areResolvedViewsEqual,\n deps: [viewsProp, adminViewsProp, adminMode, userIdentity],\n disabled: initialLoading,\n });\n\n return useMemo(() => ({\n views: resolvedData.views,\n adminViews: resolvedData.adminViews,\n loading,\n error,\n refresh\n }), [resolvedData, loading, error, refresh]);\n}\n"],"mappings":";;;;;;;;;AASA,SAAS,eAAe,GAA0B,GAAmC;CACjF,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO;CACrB,IAAI,E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,QAAQ,OAAO,CACtF,CAAC;GACD,OAAO;IAAE,OAAO;IAAU,YAAY;GAAc;EACxD;EACA,cAAc;GAAE,OAAO,KAAA;GAAW,YAAY,KAAA;EAAU;EACxD,SAAS;EACT,MAAM;GAAC;GAAW;GAAgB;GAAW;EAAY;EACzD,UAAU;CACd,CAAC;CAED,OAAO,eAAe;EAClB,OAAO,aAAa;EACpB,YAAY,aAAa;EACzB;EACA;EACA;CACJ,IAAI;EAAC;EAAc;EAAS;EAAO;CAAO,CAAC;AAC/C"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AppView, UrlController, RebasePlugin, NavigationGroupMapping, NavigationResult, AdminCollection } from "@rebasepro/cms-types";
|
|
2
|
-
import { CollectionRegistryController } from "@rebasepro/types";
|
|
3
|
-
import { CollectionRegistry } from "@rebasepro/common";
|
|
2
|
+
import { CollectionRegistryController, CollectionRegistry } from "@rebasepro/cms-types";
|
|
4
3
|
export type UseTopLevelNavigationProps = {
|
|
5
4
|
collections: AdminCollection[];
|
|
6
5
|
views: AppView[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTopLevelNavigation.js","names":[],"sources":["../../../src/hooks/navigation/useTopLevelNavigation.ts"],"sourcesContent":["\nimport type { AppView, UrlController, RebasePlugin, NavigationEntry, NavigationGroupMapping, NavigationResult, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nimport { CollectionRegistryController } from \"@rebasepro/types\";\nimport { CollectionRegistry } from \"@rebasepro/common\";\n\nimport { computeNavigationGroups, getGroup, isBottomPinnedGroupName, NAVIGATION_ADMIN_GROUP_NAME, NAVIGATION_DEFAULT_GROUP_NAME } from \"./utils\";\n\nexport type UseTopLevelNavigationProps = {\n collections: AdminCollection[];\n views: AppView[] | undefined;\n adminViews: AppView[] | undefined;\n plugins?: RebasePlugin[];\n navigationGroupMappings?: NavigationGroupMapping[];\n viewsOrder?: string[];\n urlController: UrlController;\n adminMode?: \"cms\" | \"studio\";\n collectionRegistryController: CollectionRegistryController & { collectionRegistryRef: React.MutableRefObject<CollectionRegistry> };\n};\n\nexport type UseTopLevelNavigationResult = {\n topLevelNavigation: NavigationResult | undefined;\n};\n\n/**\n * Hook that computes the top-level NavigationResult from resolved collections,\n * views, and admin views. Pure computation — no async, no effects.\n *\n * The `onNavigationEntriesUpdate` callback is embedded in the result for API\n * compatibility, but its reference is stable via useCallback.\n */\nexport function useTopLevelNavigation(\n props: UseTopLevelNavigationProps\n): UseTopLevelNavigationResult {\n\n const {\n collections,\n views,\n adminViews,\n plugins,\n navigationGroupMappings,\n viewsOrder,\n urlController,\n adminMode,\n collectionRegistryController\n } = props;\n\n const pluginGroups = useMemo(() => {\n const allPluginGroups = plugins?.flatMap(plugin => plugin.hooks?.navigationEntries ? plugin.hooks.navigationEntries.map(e => e.name) : []) ?? [];\n return [...new Set(allPluginGroups)];\n }, [plugins]);\n\n // Stable reference to the drag-and-drop update callback.\n // We use a ref-based approach internally so the callback identity doesn't\n // change when collections/views change (which would cause NavigationResult\n // equality to always fail).\n const onNavigationEntriesOrderUpdate = useCallback((entries: NavigationGroupMapping[]) => {\n if (!plugins) {\n return;\n }\n // remove all groups that have no entries\n const filteredEntries = entries.filter(entry => entry.entries.length > 0);\n\n // Persist to backend via plugins\n if (plugins.some((plugin: RebasePlugin) => plugin.hooks?.onNavigationEntriesUpdate)) {\n plugins.forEach((plugin: RebasePlugin) => {\n if (plugin.hooks?.onNavigationEntriesUpdate) {\n plugin.hooks.onNavigationEntriesUpdate(filteredEntries);\n }\n });\n }\n }, [plugins]);\n\n const topLevelNavigationRef = useRef<NavigationResult | undefined>(undefined);\n\n const topLevelNavigation = useMemo(() => {\n // Don't compute until we have collections and views resolved\n if (!views && !adminViews && collections.length === 0) {\n return undefined;\n }\n\n const finalNavigationGroupMappings: NavigationGroupMapping[] = computeNavigationGroups({\n navigationGroupMappings,\n collections,\n views: views,\n plugins\n });\n\n const allPluginNavigationEntries = finalNavigationGroupMappings.map((g) => g.entries).flat() ?? [];\n const navigationEntriesOrder = ([...new Set(allPluginNavigationEntries)]);\n\n let navigationEntries: NavigationEntry[] = [\n ...(collections ?? []).reduce((acc, collection) => {\n if (collection.hideFromNavigation) return acc;\n\n const pathKey = collection.slug;\n let groupName = getGroup(collection);\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n acc.push({\n id: `collection:${pathKey}`,\n url: urlController.buildUrlCollectionPath(pathKey),\n type: \"collection\",\n name: collection.name.trim(),\n slug: pathKey,\n collection,\n description: collection.description?.trim(),\n group: groupName ?? NAVIGATION_DEFAULT_GROUP_NAME\n });\n return acc;\n }, [] as NavigationEntry[]),\n\n ...(views ?? []).reduce((acc, view) => {\n if (view.hideFromNavigation) return acc;\n\n const pathKey = view.slug;\n let groupName = getGroup(view);\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n const basePathKey = Array.isArray(pathKey) ? pathKey[0] : pathKey;\n acc.push({\n id: `view:${pathKey}`,\n url: urlController.buildAppUrlPath(basePathKey),\n name: view.name.trim(),\n type: \"view\",\n slug: view.slug,\n view,\n description: view.description?.trim(),\n group: groupName ?? NAVIGATION_DEFAULT_GROUP_NAME\n });\n return acc;\n }, [] as NavigationEntry[]),\n\n ...(adminViews ?? []).reduce((acc, adminView) => {\n if (adminView.hideFromNavigation) return acc;\n\n const pathKey = adminView.slug;\n let groupName = adminView.group?.trim() || NAVIGATION_ADMIN_GROUP_NAME;\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n acc.push({\n id: `admin:${pathKey}`,\n url: urlController.buildAppUrlPath(pathKey),\n name: adminView.name.trim(),\n type: \"admin\",\n slug: adminView.slug,\n view: adminView,\n description: adminView.description?.trim(),\n group: groupName\n });\n return acc;\n }, [] as NavigationEntry[])\n ];\n\n // Groups that sink to the bottom. Two sources, because the string\n // comparison predates the flag and apps depend on it: the names in\n // `NAVIGATION_BOTTOM_GROUP_NAMES`, and any group holding a view that\n // asked for it — which is the only one of the two that survives the\n // group being renamed or translated.\n const pinnedGroups = new Set<string>();\n for (const view of [...(views ?? []), ...(adminViews ?? [])]) {\n if (view.pinToBottom) pinnedGroups.add(getGroup(view));\n }\n\n const groupOrderValue = (groupName?: string): number =>\n (isBottomPinnedGroupName(groupName) || (groupName !== undefined && pinnedGroups.has(groupName))) ? 1 : 0;\n\n const usedViewsOrder = viewsOrder ?? navigationEntriesOrder;\n navigationEntries = navigationEntries.sort((a, b) => {\n // Primary: group priority (admin/settings last)\n const groupDiff = groupOrderValue(a.group) - groupOrderValue(b.group);\n if (groupDiff !== 0) return groupDiff;\n\n // Secondary: explicit view order (if provided)\n if (usedViewsOrder) {\n const getSortPath = (navEntry: NavigationEntry) => typeof navEntry.slug === \"string\" ? navEntry.slug : navEntry.slug[0];\n const aIndex = usedViewsOrder.indexOf(getSortPath(a));\n const bIndex = usedViewsOrder.indexOf(getSortPath(b));\n if (aIndex !== -1 || bIndex !== -1) {\n if (aIndex === -1) return 1;\n if (bIndex === -1) return -1;\n return aIndex - bIndex;\n }\n }\n\n return 0;\n });\n\n const collectedGroupsFromEntries = navigationEntries\n .map(e => e.group)\n .filter(Boolean) as string[];\n\n const groupsFromMappings = finalNavigationGroupMappings.map(g => g.name);\n const additionalGroups = collectedGroupsFromEntries.filter(g => !groupsFromMappings.includes(g));\n\n const allDefinedGroups = [\n ...(pluginGroups ?? []),\n ...groupsFromMappings,\n ...additionalGroups\n ];\n\n const uniqueGroupsArray = [...new Set(allDefinedGroups)];\n // Same rule the entry sort uses — read through `groupOrderValue` rather\n // than repeated inline, so the drawer's group order and the entries\n // inside it cannot disagree about which groups are last.\n const lastGroups = uniqueGroupsArray.filter(g => groupOrderValue(g) === 1);\n const otherGroups = uniqueGroupsArray.filter(g => groupOrderValue(g) === 0);\n const uniqueGroups = [...otherGroups, ...lastGroups] as string[];\n\n const computedTopLevelNav = {\n allowDragAndDrop: plugins?.some((plugin: RebasePlugin) => plugin.hooks?.allowDragAndDrop) ?? false,\n navigationEntries,\n groups: uniqueGroups,\n onNavigationEntriesUpdate: onNavigationEntriesOrderUpdate\n };\n\n // Cache the newly computed navigation result and return the cached reference\n // if it is deeply equal to the previous one, to prevent reference churn.\n const isNavEqual = topLevelNavigationRef.current &&\n equal(topLevelNavigationRef.current.navigationEntries, computedTopLevelNav.navigationEntries) &&\n equal(topLevelNavigationRef.current.groups, computedTopLevelNav.groups) &&\n topLevelNavigationRef.current.allowDragAndDrop === computedTopLevelNav.allowDragAndDrop;\n\n if (isNavEqual) {\n return topLevelNavigationRef.current;\n }\n\n topLevelNavigationRef.current = computedTopLevelNav;\n return computedTopLevelNav;\n }, [\n collections,\n views,\n adminViews,\n navigationGroupMappings,\n urlController.buildAppUrlPath,\n urlController.buildUrlCollectionPath,\n pluginGroups,\n plugins,\n adminMode,\n viewsOrder,\n onNavigationEntriesOrderUpdate\n ]);\n\n return useMemo(() => ({\n topLevelNavigation\n }), [topLevelNavigation]);\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAgB,sBACZ,OAC2B;CAE3B,MAAM,EACF,aACA,OACA,YACA,SACA,yBACA,YACA,eACA,WACA,iCACA;CAEJ,MAAM,eAAe,cAAc;EAC/B,MAAM,kBAAkB,SAAS,SAAQ,WAAU,OAAO,OAAO,oBAAoB,OAAO,MAAM,kBAAkB,KAAI,MAAK,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC;EAC/I,OAAO,CAAC,GAAG,IAAI,IAAI,eAAe,CAAC;CACvC,GAAG,CA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AAM,KACtE,sBAAsB,QAAQ,qBAAqB,oBAAoB,kBAGvE,OAAO,sBAAsB;EAGjC,sBAAsB,UAAU;EAChC,OAAO;CACX,GAAG;EACC;EACA;EACA;EACA;EACA,cAAc;EACd,cAAc;EACd;EACA;EACA;EACA;EACA;CACJ,CAAC;CAED,OAAO,eAAe,EAClB,mBACJ,IAAI,CAAC,kBAAkB,CAAC;AAC5B"}
|
|
1
|
+
{"version":3,"file":"useTopLevelNavigation.js","names":[],"sources":["../../../src/hooks/navigation/useTopLevelNavigation.ts"],"sourcesContent":["\nimport type { AppView, UrlController, RebasePlugin, NavigationEntry, NavigationGroupMapping, NavigationResult, AdminCollection } from \"@rebasepro/cms-types\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nimport { CollectionRegistryController, CollectionRegistry } from \"@rebasepro/cms-types\";\n\nimport { computeNavigationGroups, getGroup, isBottomPinnedGroupName, NAVIGATION_ADMIN_GROUP_NAME, NAVIGATION_DEFAULT_GROUP_NAME } from \"./utils\";\n\nexport type UseTopLevelNavigationProps = {\n collections: AdminCollection[];\n views: AppView[] | undefined;\n adminViews: AppView[] | undefined;\n plugins?: RebasePlugin[];\n navigationGroupMappings?: NavigationGroupMapping[];\n viewsOrder?: string[];\n urlController: UrlController;\n adminMode?: \"cms\" | \"studio\";\n collectionRegistryController: CollectionRegistryController & { collectionRegistryRef: React.MutableRefObject<CollectionRegistry> };\n};\n\nexport type UseTopLevelNavigationResult = {\n topLevelNavigation: NavigationResult | undefined;\n};\n\n/**\n * Hook that computes the top-level NavigationResult from resolved collections,\n * views, and admin views. Pure computation — no async, no effects.\n *\n * The `onNavigationEntriesUpdate` callback is embedded in the result for API\n * compatibility, but its reference is stable via useCallback.\n */\nexport function useTopLevelNavigation(\n props: UseTopLevelNavigationProps\n): UseTopLevelNavigationResult {\n\n const {\n collections,\n views,\n adminViews,\n plugins,\n navigationGroupMappings,\n viewsOrder,\n urlController,\n adminMode,\n collectionRegistryController\n } = props;\n\n const pluginGroups = useMemo(() => {\n const allPluginGroups = plugins?.flatMap(plugin => plugin.hooks?.navigationEntries ? plugin.hooks.navigationEntries.map(e => e.name) : []) ?? [];\n return [...new Set(allPluginGroups)];\n }, [plugins]);\n\n // Stable reference to the drag-and-drop update callback.\n // We use a ref-based approach internally so the callback identity doesn't\n // change when collections/views change (which would cause NavigationResult\n // equality to always fail).\n const onNavigationEntriesOrderUpdate = useCallback((entries: NavigationGroupMapping[]) => {\n if (!plugins) {\n return;\n }\n // remove all groups that have no entries\n const filteredEntries = entries.filter(entry => entry.entries.length > 0);\n\n // Persist to backend via plugins\n if (plugins.some((plugin: RebasePlugin) => plugin.hooks?.onNavigationEntriesUpdate)) {\n plugins.forEach((plugin: RebasePlugin) => {\n if (plugin.hooks?.onNavigationEntriesUpdate) {\n plugin.hooks.onNavigationEntriesUpdate(filteredEntries);\n }\n });\n }\n }, [plugins]);\n\n const topLevelNavigationRef = useRef<NavigationResult | undefined>(undefined);\n\n const topLevelNavigation = useMemo(() => {\n // Don't compute until we have collections and views resolved\n if (!views && !adminViews && collections.length === 0) {\n return undefined;\n }\n\n const finalNavigationGroupMappings: NavigationGroupMapping[] = computeNavigationGroups({\n navigationGroupMappings,\n collections,\n views: views,\n plugins\n });\n\n const allPluginNavigationEntries = finalNavigationGroupMappings.map((g) => g.entries).flat() ?? [];\n const navigationEntriesOrder = ([...new Set(allPluginNavigationEntries)]);\n\n let navigationEntries: NavigationEntry[] = [\n ...(collections ?? []).reduce((acc, collection) => {\n if (collection.hideFromNavigation) return acc;\n\n const pathKey = collection.slug;\n let groupName = getGroup(collection);\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n acc.push({\n id: `collection:${pathKey}`,\n url: urlController.buildUrlCollectionPath(pathKey),\n type: \"collection\",\n name: collection.name.trim(),\n slug: pathKey,\n collection,\n description: collection.description?.trim(),\n group: groupName ?? NAVIGATION_DEFAULT_GROUP_NAME\n });\n return acc;\n }, [] as NavigationEntry[]),\n\n ...(views ?? []).reduce((acc, view) => {\n if (view.hideFromNavigation) return acc;\n\n const pathKey = view.slug;\n let groupName = getGroup(view);\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n const basePathKey = Array.isArray(pathKey) ? pathKey[0] : pathKey;\n acc.push({\n id: `view:${pathKey}`,\n url: urlController.buildAppUrlPath(basePathKey),\n name: view.name.trim(),\n type: \"view\",\n slug: view.slug,\n view,\n description: view.description?.trim(),\n group: groupName ?? NAVIGATION_DEFAULT_GROUP_NAME\n });\n return acc;\n }, [] as NavigationEntry[]),\n\n ...(adminViews ?? []).reduce((acc, adminView) => {\n if (adminView.hideFromNavigation) return acc;\n\n const pathKey = adminView.slug;\n let groupName = adminView.group?.trim() || NAVIGATION_ADMIN_GROUP_NAME;\n\n if (finalNavigationGroupMappings) {\n for (const pluginGroupDef of finalNavigationGroupMappings) {\n if (pluginGroupDef.entries.includes(pathKey)) {\n groupName = pluginGroupDef.name;\n break;\n }\n }\n }\n\n acc.push({\n id: `admin:${pathKey}`,\n url: urlController.buildAppUrlPath(pathKey),\n name: adminView.name.trim(),\n type: \"admin\",\n slug: adminView.slug,\n view: adminView,\n description: adminView.description?.trim(),\n group: groupName\n });\n return acc;\n }, [] as NavigationEntry[])\n ];\n\n // Groups that sink to the bottom. Two sources, because the string\n // comparison predates the flag and apps depend on it: the names in\n // `NAVIGATION_BOTTOM_GROUP_NAMES`, and any group holding a view that\n // asked for it — which is the only one of the two that survives the\n // group being renamed or translated.\n const pinnedGroups = new Set<string>();\n for (const view of [...(views ?? []), ...(adminViews ?? [])]) {\n if (view.pinToBottom) pinnedGroups.add(getGroup(view));\n }\n\n const groupOrderValue = (groupName?: string): number =>\n (isBottomPinnedGroupName(groupName) || (groupName !== undefined && pinnedGroups.has(groupName))) ? 1 : 0;\n\n const usedViewsOrder = viewsOrder ?? navigationEntriesOrder;\n navigationEntries = navigationEntries.sort((a, b) => {\n // Primary: group priority (admin/settings last)\n const groupDiff = groupOrderValue(a.group) - groupOrderValue(b.group);\n if (groupDiff !== 0) return groupDiff;\n\n // Secondary: explicit view order (if provided)\n if (usedViewsOrder) {\n const getSortPath = (navEntry: NavigationEntry) => typeof navEntry.slug === \"string\" ? navEntry.slug : navEntry.slug[0];\n const aIndex = usedViewsOrder.indexOf(getSortPath(a));\n const bIndex = usedViewsOrder.indexOf(getSortPath(b));\n if (aIndex !== -1 || bIndex !== -1) {\n if (aIndex === -1) return 1;\n if (bIndex === -1) return -1;\n return aIndex - bIndex;\n }\n }\n\n return 0;\n });\n\n const collectedGroupsFromEntries = navigationEntries\n .map(e => e.group)\n .filter(Boolean) as string[];\n\n const groupsFromMappings = finalNavigationGroupMappings.map(g => g.name);\n const additionalGroups = collectedGroupsFromEntries.filter(g => !groupsFromMappings.includes(g));\n\n const allDefinedGroups = [\n ...(pluginGroups ?? []),\n ...groupsFromMappings,\n ...additionalGroups\n ];\n\n const uniqueGroupsArray = [...new Set(allDefinedGroups)];\n // Same rule the entry sort uses — read through `groupOrderValue` rather\n // than repeated inline, so the drawer's group order and the entries\n // inside it cannot disagree about which groups are last.\n const lastGroups = uniqueGroupsArray.filter(g => groupOrderValue(g) === 1);\n const otherGroups = uniqueGroupsArray.filter(g => groupOrderValue(g) === 0);\n const uniqueGroups = [...otherGroups, ...lastGroups] as string[];\n\n const computedTopLevelNav = {\n allowDragAndDrop: plugins?.some((plugin: RebasePlugin) => plugin.hooks?.allowDragAndDrop) ?? false,\n navigationEntries,\n groups: uniqueGroups,\n onNavigationEntriesUpdate: onNavigationEntriesOrderUpdate\n };\n\n // Cache the newly computed navigation result and return the cached reference\n // if it is deeply equal to the previous one, to prevent reference churn.\n const isNavEqual = topLevelNavigationRef.current &&\n equal(topLevelNavigationRef.current.navigationEntries, computedTopLevelNav.navigationEntries) &&\n equal(topLevelNavigationRef.current.groups, computedTopLevelNav.groups) &&\n topLevelNavigationRef.current.allowDragAndDrop === computedTopLevelNav.allowDragAndDrop;\n\n if (isNavEqual) {\n return topLevelNavigationRef.current;\n }\n\n topLevelNavigationRef.current = computedTopLevelNav;\n return computedTopLevelNav;\n }, [\n collections,\n views,\n adminViews,\n navigationGroupMappings,\n urlController.buildAppUrlPath,\n urlController.buildUrlCollectionPath,\n pluginGroups,\n plugins,\n adminMode,\n viewsOrder,\n onNavigationEntriesOrderUpdate\n ]);\n\n return useMemo(() => ({\n topLevelNavigation\n }), [topLevelNavigation]);\n}\n"],"mappings":";;;;;;;;;;;AAgCA,SAAgB,sBACZ,OAC2B;CAE3B,MAAM,EACF,aACA,OACA,YACA,SACA,yBACA,YACA,eACA,WACA,iCACA;CAEJ,MAAM,eAAe,cAAc;EAC/B,MAAM,kBAAkB,SAAS,SAAQ,WAAU,OAAO,OAAO,oBAAoB,OAAO,MAAM,kBAAkB,KAAI,MAAK,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC;EAC/I,OAAO,CAAC,GAAG,IAAI,IAAI,eAAe,CAAC;CACvC,GAAG,CAAC,OAAO,CAAC;CAMZ,MAAM,iCAAiC,aAAa,YAAsC;EACtF,IAAI,CAAC,SACD;EAGJ,MAAM,kBAAkB,QAAQ,QAAO,UAAS,MAAM,QAAQ,SAAS,CAAC;EAGxE,IAAI,QAAQ,MAAM,WAAyB,OAAO,OAAO,yBAAyB,GAC9E,QAAQ,SAAS,WAAyB;GACtC,IAAI,OAAO,OAAO,2BACd,OAAO,MAAM,0BAA0B,eAAe;EAE9D,CAAC;CAET,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,wBAAwB,OAAqC,KAAA,CAAS;CAE5E,MAAM,qBAAqB,cAAc;EAErC,IAAI,CAAC,SAAS,CAAC,cAAc,YAAY,WAAW,GAChD;EAGJ,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O,SAAS;IACpB;GACJ;GAEA,OAAO;EACX,CAAC;EAED,MAAM,6BAA6B,kBAC9B,KAAI,MAAK,EAAE,KAAK,CAAC,CACjB,OAAO,OAAO;EAEnB,MAAM,qBAAqB,6BAA6B,KAAI,MAAK,EAAE,IAAI;EACvE,MAAM,mBAAmB,2BAA2B,QAAO,MAAK,CAAC,mBAAmB,SAAS,CAAC,CAAC;EAE/F,MAAM,mBAAmB;GACrB,GAAI,gBAAgB,CAAC;GACrB,GAAG;GACH,GAAG;EACP;EAEA,MAAM,oBAAoB,CAAC,GAAG,IAAI,IAAI,gBAAgB,CAAC;EAIvD,MAAM,aAAa,kBAAkB,QAAO,MAAK,gBAAgB,CAAC,MAAM,CAAC;EAEzE,MAAM,eAAe,CAAC,GADF,kBAAkB,QAAO,MAAK,gBAAgB,CAAC,MAAM,CAChD,GAAa,GAAG,UAAU;EAEnD,MAAM,sBAAsB;GACxB,kBAAkB,SAAS,MAAM,WAAyB,OAAO,OAAO,gBAAgB,KAAK;GAC7F;GACA,QAAQ;GACR,2BAA2B;EAC/B;EASA,IALmB,sBAAsB,WACrC,UAAM,sBAAsB,QAAQ,mBAAmB,oBAAoB,iBAAiB,KAC5F,UAAM,sBAAsB,QAAQ,QAAQ,oBAAoB,MAAM,KACtE,sBAAsB,QAAQ,qBAAqB,oBAAoB,kBAGvE,OAAO,sBAAsB;EAGjC,sBAAsB,UAAU;EAChC,OAAO;CACX,GAAG;EACC;EACA;EACA;EACA;EACA,cAAc;EACd,cAAc;EACd;EACA;EACA;EACA;EACA;CACJ,CAAC;CAED,OAAO,eAAe,EAClB,mBACJ,IAAI,CAAC,kBAAkB,CAAC;AAC5B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The signed-in user's preferences as an overlay on a resolved collection —
|
|
3
|
+
* the last layer of the composition (see `compose_collections.ts`).
|
|
4
|
+
*
|
|
5
|
+
* The registry resolves a collection synchronously, for any collection the
|
|
6
|
+
* panel holds — a served table or an external (Firestore) one — and merges
|
|
7
|
+
* this overlay into it. It is the views' own vocabulary translated back: a
|
|
8
|
+
* user's preferences are what the views write (column widths, order, view
|
|
9
|
+
* mode, the board's column, size) in `customizeTable`'s names, and this maps
|
|
10
|
+
* each to the key of the panel's view model it came from. Kept apart from the
|
|
11
|
+
* customization merge, which the eager bundle does not carry.
|
|
12
|
+
*/
|
|
13
|
+
import type { UiTablePreferences } from "@rebasepro/types";
|
|
14
|
+
/**
|
|
15
|
+
* A user's preferences for one collection as the partial view model the
|
|
16
|
+
* registry merges into it. Enum labels and registered views are workspace
|
|
17
|
+
* matters and not part of a user's layer. A field the collection does not have
|
|
18
|
+
* (`fields`, the collection's property keys) is left out: merged, it would be a
|
|
19
|
+
* property with no type.
|
|
20
|
+
*/
|
|
21
|
+
export declare function userPreferencesOverlay(preferences: UiTablePreferences | undefined, fields: ReadonlySet<string>): Record<string, unknown>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//#region src/hooks/navigation/user_preferences_overlay.ts
|
|
2
|
+
/** Table keys whose view-model key has the same name. */
|
|
3
|
+
var SAME_NAME = [
|
|
4
|
+
"name",
|
|
5
|
+
"singularName",
|
|
6
|
+
"icon",
|
|
7
|
+
"group",
|
|
8
|
+
"hideFromNavigation",
|
|
9
|
+
"hideFromEntityViews",
|
|
10
|
+
"defaultViewMode",
|
|
11
|
+
"enabledViews",
|
|
12
|
+
"defaultSize",
|
|
13
|
+
"hideIdFromCollection",
|
|
14
|
+
"pagination",
|
|
15
|
+
"inlineEditing",
|
|
16
|
+
"selectionEnabled",
|
|
17
|
+
"exportable",
|
|
18
|
+
"openEntityMode",
|
|
19
|
+
"defaultEntityAction",
|
|
20
|
+
"sideDialogWidth",
|
|
21
|
+
"defaultSelectedView",
|
|
22
|
+
"formAutoSave",
|
|
23
|
+
"alwaysApplyDefaultValues",
|
|
24
|
+
"includeJsonView",
|
|
25
|
+
"localChangesBackup",
|
|
26
|
+
"hideIdFromForm",
|
|
27
|
+
"disableDefaultActions",
|
|
28
|
+
"sort",
|
|
29
|
+
"defaultFilter"
|
|
30
|
+
];
|
|
31
|
+
/** Field keys that are `admin.*` options of the property under the same name. */
|
|
32
|
+
var ADMIN_SAME_NAME = [
|
|
33
|
+
"readOnly",
|
|
34
|
+
"columnWidth",
|
|
35
|
+
"span",
|
|
36
|
+
"multiline",
|
|
37
|
+
"markdown",
|
|
38
|
+
"previewAsTag",
|
|
39
|
+
"clearable",
|
|
40
|
+
"urlPreview",
|
|
41
|
+
"expanded",
|
|
42
|
+
"minimalistView",
|
|
43
|
+
"sortable",
|
|
44
|
+
"canAddElements",
|
|
45
|
+
"spreadChildren",
|
|
46
|
+
"widget",
|
|
47
|
+
"includeId",
|
|
48
|
+
"includeEntityLink"
|
|
49
|
+
];
|
|
50
|
+
function fieldOverlay(field) {
|
|
51
|
+
const out = {};
|
|
52
|
+
const admin = {};
|
|
53
|
+
if (field.name !== void 0) out.name = field.name;
|
|
54
|
+
if (field.mode !== void 0) out.mode = field.mode;
|
|
55
|
+
if (field.timezone !== void 0) out.timezone = field.timezone;
|
|
56
|
+
if (field.keyValue !== void 0) out.keyValue = field.keyValue;
|
|
57
|
+
if (field.fieldOrder !== void 0) out.propertiesOrder = [...field.fieldOrder];
|
|
58
|
+
for (const key of ADMIN_SAME_NAME) if (field[key] !== void 0) admin[key] = field[key];
|
|
59
|
+
if (field.hidden !== void 0) admin.hideFromCollection = field.hidden;
|
|
60
|
+
if (field.disabled !== void 0) admin.disabled = field.disabled;
|
|
61
|
+
if (field.hiddenInForm !== void 0) admin.disabled = { hidden: field.hiddenInForm };
|
|
62
|
+
if (field.previewFields !== void 0) admin.previewProperties = [...field.previewFields];
|
|
63
|
+
if (Object.keys(admin).length > 0) out.admin = admin;
|
|
64
|
+
if (field.fields) {
|
|
65
|
+
const properties = {};
|
|
66
|
+
for (const [key, nested] of Object.entries(field.fields)) properties[key] = fieldOverlay(nested);
|
|
67
|
+
out.properties = properties;
|
|
68
|
+
}
|
|
69
|
+
if (field.of) out.of = fieldOverlay(field.of);
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A user's preferences for one collection as the partial view model the
|
|
74
|
+
* registry merges into it. Enum labels and registered views are workspace
|
|
75
|
+
* matters and not part of a user's layer. A field the collection does not have
|
|
76
|
+
* (`fields`, the collection's property keys) is left out: merged, it would be a
|
|
77
|
+
* property with no type.
|
|
78
|
+
*/
|
|
79
|
+
function userPreferencesOverlay(preferences, fields) {
|
|
80
|
+
if (!preferences) return {};
|
|
81
|
+
const out = {};
|
|
82
|
+
for (const key of SAME_NAME) if (preferences[key] !== void 0) out[key] = preferences[key];
|
|
83
|
+
if (preferences.fieldOrder !== void 0) out.propertiesOrder = [...preferences.fieldOrder];
|
|
84
|
+
if (preferences.listFields !== void 0) out.listProperties = [...preferences.listFields];
|
|
85
|
+
if (preferences.previewFields !== void 0) out.previewProperties = [...preferences.previewFields];
|
|
86
|
+
if (preferences.kanban) {
|
|
87
|
+
out.kanban = { columnProperty: preferences.kanban.columnField };
|
|
88
|
+
if (preferences.kanban.orderField !== void 0) out.orderProperty = preferences.kanban.orderField;
|
|
89
|
+
}
|
|
90
|
+
if (preferences.display) out.display = { ...preferences.display };
|
|
91
|
+
if (preferences.fields) {
|
|
92
|
+
const properties = {};
|
|
93
|
+
for (const [key, field] of Object.entries(preferences.fields)) if (fields.has(key)) properties[key] = fieldOverlay(field);
|
|
94
|
+
if (Object.keys(properties).length > 0) out.properties = properties;
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { userPreferencesOverlay };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=user_preferences_overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user_preferences_overlay.js","names":[],"sources":["../../../src/hooks/navigation/user_preferences_overlay.ts"],"sourcesContent":["/**\n * The signed-in user's preferences as an overlay on a resolved collection —\n * the last layer of the composition (see `compose_collections.ts`).\n *\n * The registry resolves a collection synchronously, for any collection the\n * panel holds — a served table or an external (Firestore) one — and merges\n * this overlay into it. It is the views' own vocabulary translated back: a\n * user's preferences are what the views write (column widths, order, view\n * mode, the board's column, size) in `customizeTable`'s names, and this maps\n * each to the key of the panel's view model it came from. Kept apart from the\n * customization merge, which the eager bundle does not carry.\n */\nimport type { UiFieldPreferences, UiTablePreferences } from \"@rebasepro/types\";\n\n/** Table keys whose view-model key has the same name. */\nconst SAME_NAME = [\n \"name\", \"singularName\", \"icon\", \"group\", \"hideFromNavigation\", \"hideFromEntityViews\", \"defaultViewMode\", \"enabledViews\",\n \"defaultSize\", \"hideIdFromCollection\", \"pagination\", \"inlineEditing\", \"selectionEnabled\", \"exportable\", \"openEntityMode\",\n \"defaultEntityAction\", \"sideDialogWidth\", \"defaultSelectedView\", \"formAutoSave\", \"alwaysApplyDefaultValues\",\n \"includeJsonView\", \"localChangesBackup\", \"hideIdFromForm\", \"disableDefaultActions\", \"sort\", \"defaultFilter\"\n] as const satisfies readonly (keyof UiTablePreferences)[];\n\n/** Field keys that are `admin.*` options of the property under the same name. */\nconst ADMIN_SAME_NAME = [\n \"readOnly\", \"columnWidth\", \"span\", \"multiline\", \"markdown\", \"previewAsTag\", \"clearable\", \"urlPreview\", \"expanded\",\n \"minimalistView\", \"sortable\", \"canAddElements\", \"spreadChildren\", \"widget\", \"includeId\", \"includeEntityLink\"\n] as const satisfies readonly (keyof UiFieldPreferences)[];\n\nfunction fieldOverlay(field: UiFieldPreferences): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n const admin: Record<string, unknown> = {};\n if (field.name !== undefined) out.name = field.name;\n if (field.mode !== undefined) out.mode = field.mode;\n if (field.timezone !== undefined) out.timezone = field.timezone;\n if (field.keyValue !== undefined) out.keyValue = field.keyValue;\n if (field.fieldOrder !== undefined) out.propertiesOrder = [...field.fieldOrder];\n for (const key of ADMIN_SAME_NAME) if (field[key] !== undefined) admin[key] = field[key];\n if (field.hidden !== undefined) admin.hideFromCollection = field.hidden;\n if (field.disabled !== undefined) admin.disabled = field.disabled;\n if (field.hiddenInForm !== undefined) admin.disabled = { hidden: field.hiddenInForm };\n if (field.previewFields !== undefined) admin.previewProperties = [...field.previewFields];\n if (Object.keys(admin).length > 0) out.admin = admin;\n if (field.fields) {\n const properties: Record<string, unknown> = {};\n for (const [key, nested] of Object.entries(field.fields)) properties[key] = fieldOverlay(nested);\n out.properties = properties;\n }\n if (field.of) out.of = fieldOverlay(field.of);\n return out;\n}\n\n/**\n * A user's preferences for one collection as the partial view model the\n * registry merges into it. Enum labels and registered views are workspace\n * matters and not part of a user's layer. A field the collection does not have\n * (`fields`, the collection's property keys) is left out: merged, it would be a\n * property with no type.\n */\nexport function userPreferencesOverlay(preferences: UiTablePreferences | undefined, fields: ReadonlySet<string>): Record<string, unknown> {\n if (!preferences) return {};\n const out: Record<string, unknown> = {};\n for (const key of SAME_NAME) if (preferences[key] !== undefined) out[key] = preferences[key];\n if (preferences.fieldOrder !== undefined) out.propertiesOrder = [...preferences.fieldOrder];\n if (preferences.listFields !== undefined) out.listProperties = [...preferences.listFields];\n if (preferences.previewFields !== undefined) out.previewProperties = [...preferences.previewFields];\n if (preferences.kanban) {\n out.kanban = { columnProperty: preferences.kanban.columnField };\n if (preferences.kanban.orderField !== undefined) out.orderProperty = preferences.kanban.orderField;\n }\n if (preferences.display) out.display = { ...preferences.display };\n if (preferences.fields) {\n const properties: Record<string, unknown> = {};\n for (const [key, field] of Object.entries(preferences.fields)) {\n if (fields.has(key)) properties[key] = fieldOverlay(field);\n }\n if (Object.keys(properties).length > 0) out.properties = properties;\n }\n return out;\n}\n"],"mappings":";;AAeA,IAAM,YAAY;CACd;CAAQ;CAAgB;CAAQ;CAAS;CAAsB;CAAuB;CAAmB;CACzG;CAAe;CAAwB;CAAc;CAAiB;CAAoB;CAAc;CACxG;CAAuB;CAAmB;CAAuB;CAAgB;CACjF;CAAmB;CAAsB;CAAkB;CAAyB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a,OAAO,CAAC;CAC1B,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,OAAO,WAAW,IAAI,YAAY,SAAS,KAAA,GAAW,IAAI,OAAO,YAAY;CACxF,IAAI,YAAY,eAAe,KAAA,GAAW,IAAI,kBAAkB,CAAC,GAAG,YAAY,UAAU;CAC1F,IAAI,YAAY,eAAe,KAAA,GAAW,IAAI,iBAAiB,CAAC,GAAG,YAAY,UAAU;CACzF,IAAI,YAAY,kBAAkB,KAAA,GAAW,IAAI,oBAAoB,CAAC,GAAG,YAAY,aAAa;CAClG,IAAI,YAAY,QAAQ;EACpB,IAAI,SAAS,EAAE,gBAAgB,YAAY,OAAO,YAAY;EAC9D,IAAI,YAAY,OAAO,eAAe,KAAA,GAAW,IAAI,gBAAgB,YAAY,OAAO;CAC5F;CACA,IAAI,YAAY,SAAS,IAAI,UAAU,EAAE,GAAG,YAAY,QAAQ;CAChE,IAAI,YAAY,QAAQ;EACpB,MAAM,aAAsC,CAAC;EAC7C,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,YAAY,MAAM,GACxD,IAAI,OAAO,IAAI,GAAG,GAAG,WAAW,OAAO,aAAa,KAAK;EAE7D,IAAI,OAAO,KAAK,UAAU,CAAC,CAAC,SAAS,GAAG,IAAI,aAAa;CAC7D;CACA,OAAO;AACX"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { deepEqual } from "fast-equals";
|
|
2
|
-
import { getSubcollections } from "@rebasepro/
|
|
2
|
+
import { getSubcollections } from "@rebasepro/cms-types";
|
|
3
3
|
//#region src/hooks/navigation/utils.ts
|
|
4
4
|
var NAVIGATION_DEFAULT_GROUP_NAME = "Views";
|
|
5
5
|
var NAVIGATION_ADMIN_GROUP_NAME = "Admin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/hooks/navigation/utils.ts"],"sourcesContent":["\nimport type { AppView, RebasePlugin, NavigationGroupMapping, AdminCollection } from \"@rebasepro/cms-types\";\n\nimport { getSubcollections } from \"@rebasepro/common\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nexport const NAVIGATION_DEFAULT_GROUP_NAME = \"Views\";\nexport const NAVIGATION_ADMIN_GROUP_NAME = \"Admin\";\n\n/**\n * Group names that sink to the bottom of the drawer on their name alone.\n *\n * A magic string, and it stays one for compatibility: apps have been relying on\n * `group: \"Settings\"` landing last since before there was a flag, and taking it\n * away would silently reshuffle their navigation.\n *\n * It is a bad way to ask for the behaviour, though — it is invisible from the\n * `group?: string` type, and it is defeated by the most ordinary edit there is:\n * translating the label. `group: \"Ajustes\"` is the same group to a reader and a\n * different one to this comparison, so the ordering just quietly stops\n * happening. Set {@link AppView.pinToBottom} instead, which says so.\n */\nexport const NAVIGATION_BOTTOM_GROUP_NAMES = [\"Admin\", \"Settings\"] as const;\n\n/** Whether a group sinks to the bottom by virtue of its name. @see NAVIGATION_BOTTOM_GROUP_NAMES */\nexport function isBottomPinnedGroupName(groupName?: string): boolean {\n return groupName !== undefined && (NAVIGATION_BOTTOM_GROUP_NAMES as readonly string[]).includes(groupName);\n}\n\nexport function getGroup(collectionOrView: AdminCollection | AppView) {\n const trimmed = collectionOrView.group?.trim();\n if (!trimmed || trimmed === \"\") {\n return NAVIGATION_DEFAULT_GROUP_NAME;\n }\n return trimmed;\n}\n\nexport function computeNavigationGroups({\n navigationGroupMappings,\n collections,\n views,\n plugins\n}: {\n navigationGroupMappings?: NavigationGroupMapping[],\n collections?: AdminCollection[],\n views?: AppView[],\n plugins?: RebasePlugin[]\n}): NavigationGroupMapping[] {\n\n // Deep clone the input groups upfront to avoid mutating the caller's data\n let result = navigationGroupMappings\n ? navigationGroupMappings.map(g => ({\n name: g.name,\n entries: [...g.entries],\n ...(g.collapsedByDefault !== undefined && { collapsedByDefault: g.collapsedByDefault })\n }))\n : navigationGroupMappings;\n\n // Merge plugin navigation entries\n if (plugins) {\n result = plugins.reduce((acc, plugin) => {\n if (plugin.hooks?.navigationEntries) {\n plugin.hooks.navigationEntries.forEach((entry) => {\n const {\n name,\n entries\n } = entry;\n const existingGroup = acc.find(g => g.name === name);\n if (existingGroup) {\n existingGroup.entries.push(...entries);\n } else {\n acc.push({\n name,\n entries: [...entries]\n });\n }\n });\n\n }\n return acc;\n }, result ?? []);\n }\n\n // Track all entries that are already assigned to groups\n const assignedEntries = new Set<string>();\n if (result) {\n result.forEach(group => {\n group.entries.forEach(entry => assignedEntries.add(entry));\n });\n }\n\n // Find collections and views that are NOT in any persisted group\n const unassignedGroupMap: Record<string, string[]> = {};\n\n // Check collections\n (collections ?? []).forEach(collection => {\n if (collection.hideFromNavigation) return;\n const entry = collection.slug;\n if (!assignedEntries.has(entry)) {\n const groupName = getGroup(collection);\n if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];\n unassignedGroupMap[groupName].push(entry);\n }\n });\n\n // Check views\n (views ?? []).forEach(view => {\n if (view.hideFromNavigation) return;\n const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;\n if (!assignedEntries.has(entry)) {\n const groupName = getGroup(view);\n if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];\n unassignedGroupMap[groupName].push(entry);\n }\n });\n\n // Merge unassigned entries into existing groups or create new groups\n Object.entries(unassignedGroupMap).forEach(([groupName, entries]) => {\n if (result) {\n const existingGroup = result.find(g => g.name === groupName);\n if (existingGroup) {\n existingGroup.entries.push(...entries);\n } else {\n result.push({\n name: groupName,\n entries\n });\n }\n }\n });\n\n if (!result) {\n // No persisted data at all - create from scratch\n result = [];\n const groupMap: Record<string, string[]> = {};\n\n // Add collections\n (collections ?? []).forEach(collection => {\n if (collection.hideFromNavigation) return;\n const name = getGroup(collection);\n const entry = collection.slug;\n if (!groupMap[name]) groupMap[name] = [];\n groupMap[name].push(entry);\n });\n\n // Add views\n (views ?? []).forEach(view => {\n if (view.hideFromNavigation) return;\n const name = getGroup(view);\n const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;\n if (!groupMap[name]) groupMap[name] = [];\n groupMap[name].push(entry);\n });\n\n // Convert groupMap to result array\n result = Object.entries(groupMap).map(([name, entries]) => ({\n name,\n entries\n }));\n }\n\n // Remove duplicates in entries\n result.forEach(group => {\n group.entries = [...new Set(group.entries)];\n });\n\n return result;\n}\n\nexport function areCollectionListsEqual(a: AdminCollection[], b: AdminCollection[], visitedSlugs: string[] = []) {\n if (a.length !== b.length) {\n return false;\n }\n const aCopy = [...a];\n const bCopy = [...b];\n const aSorted = aCopy.sort((x, y) => x.slug.localeCompare(y.slug));\n const bSorted = bCopy.sort((x, y) => x.slug.localeCompare(y.slug));\n return aSorted.every((value, index) => areCollectionsEqual(value, bSorted[index], visitedSlugs));\n}\n\nexport function areCollectionsEqual(a: AdminCollection, b: AdminCollection, visitedSlugs: string[] = []) {\n if (a.slug !== b.slug) {\n return false;\n }\n if (visitedSlugs.includes(a.slug)) {\n return true;\n }\n const newVisited = [...visitedSlugs, a.slug];\n\n if (!areCollectionListsEqual(getSubcollections(a), getSubcollections(b), newVisited)) {\n return false;\n }\n const restAWithoutFunctions = Object.fromEntries(\n Object.entries(a).filter(([k, v]) => typeof v !== \"function\" && k !== \"subcollections\")\n );\n const restBWithoutFunctions = Object.fromEntries(\n Object.entries(b).filter(([k, v]) => typeof v !== \"function\" && k !== \"subcollections\")\n );\n return equal(restAWithoutFunctions, restBWithoutFunctions);\n}\n"],"mappings":";;;AAMA,IAAa,gCAAgC;AAC7C,IAAa,8BAA8B;;;;;;;;;;;;;;AAe3C,IAAa,gCAAgC,CAAC,SAAS,UAAU;;AAGjE,SAAgB,wBAAwB,WAA6B;CACjE,OAAO,cAAc,KAAA,KAAc,8BAAoD,SAAS,SAAS;AAC7G;AAEA,SAAgB,SAAS,kBAA6C;CAClE,MAAM,UAAU,iBAAiB,OAAO,KAAK;CAC7C,IAAI,CAAC,WAAW,YAAY,IACxB,OAAO;CAEX,OAAO;AACX;AAEA,SAAgB,wBAAwB,EACpC,yBACA,aACA,OACA,WAMy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W,EAAE,QACf,OAAO;CAEX,MAAM,QAAQ,CAAC,GAAG,CAAC;CACnB,MAAM,QAAQ,CAAC,GAAG,CAAC;CACnB,MAAM,UAAU,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;CACjE,MAAM,UAAU,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;CACjE,OAAO,QAAQ,OAAO,OAAO,UAAU,oBAAoB,OAAO,QAAQ,QAAQ,YAAY,CAAC;AACnG;AAEA,SAAgB,oBAAoB,GAAoB,GAAoB,eAAyB,CAAC,GAAG;CACrG,IAAI,EAAE,SAAS,EAAE,MACb,OAAO;CAEX,IAAI,aAAa,SAAS,EAAE,IAAI,GAC5B,OAAO;CAEX,MAAM,aAAa,CAAC,GAAG,cAAc,EAAE,IAAI;CAE3C,IAAI,CAAC,wBAAwB,kBAAkB,CAAC,GAAG,kBAAkB,CAAC,GAAG,UAAU,GAC/E,OAAO;CAQX,OAAO,UANuB,OAAO,YACjC,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,OAAO,MAAM,cAAc,MAAM,gBAAgB,CAK7E,GAHiB,OAAO,YACjC,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,OAAO,MAAM,cAAc,MAAM,gBAAgB,CAEtD,CAAqB;AAC7D"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/hooks/navigation/utils.ts"],"sourcesContent":["\nimport type { AppView, RebasePlugin, NavigationGroupMapping, AdminCollection } from \"@rebasepro/cms-types\";\n\nimport { getSubcollections } from \"@rebasepro/cms-types\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nexport const NAVIGATION_DEFAULT_GROUP_NAME = \"Views\";\nexport const NAVIGATION_ADMIN_GROUP_NAME = \"Admin\";\n\n/**\n * Group names that sink to the bottom of the drawer on their name alone.\n *\n * A magic string, and it stays one for compatibility: apps have been relying on\n * `group: \"Settings\"` landing last since before there was a flag, and taking it\n * away would silently reshuffle their navigation.\n *\n * It is a bad way to ask for the behaviour, though — it is invisible from the\n * `group?: string` type, and it is defeated by the most ordinary edit there is:\n * translating the label. `group: \"Ajustes\"` is the same group to a reader and a\n * different one to this comparison, so the ordering just quietly stops\n * happening. Set {@link AppView.pinToBottom} instead, which says so.\n */\nexport const NAVIGATION_BOTTOM_GROUP_NAMES = [\"Admin\", \"Settings\"] as const;\n\n/** Whether a group sinks to the bottom by virtue of its name. @see NAVIGATION_BOTTOM_GROUP_NAMES */\nexport function isBottomPinnedGroupName(groupName?: string): boolean {\n return groupName !== undefined && (NAVIGATION_BOTTOM_GROUP_NAMES as readonly string[]).includes(groupName);\n}\n\nexport function getGroup(collectionOrView: AdminCollection | AppView) {\n const trimmed = collectionOrView.group?.trim();\n if (!trimmed || trimmed === \"\") {\n return NAVIGATION_DEFAULT_GROUP_NAME;\n }\n return trimmed;\n}\n\nexport function computeNavigationGroups({\n navigationGroupMappings,\n collections,\n views,\n plugins\n}: {\n navigationGroupMappings?: NavigationGroupMapping[],\n collections?: AdminCollection[],\n views?: AppView[],\n plugins?: RebasePlugin[]\n}): NavigationGroupMapping[] {\n\n // Deep clone the input groups upfront to avoid mutating the caller's data\n let result = navigationGroupMappings\n ? navigationGroupMappings.map(g => ({\n name: g.name,\n entries: [...g.entries],\n ...(g.collapsedByDefault !== undefined && { collapsedByDefault: g.collapsedByDefault })\n }))\n : navigationGroupMappings;\n\n // Merge plugin navigation entries\n if (plugins) {\n result = plugins.reduce((acc, plugin) => {\n if (plugin.hooks?.navigationEntries) {\n plugin.hooks.navigationEntries.forEach((entry) => {\n const {\n name,\n entries\n } = entry;\n const existingGroup = acc.find(g => g.name === name);\n if (existingGroup) {\n existingGroup.entries.push(...entries);\n } else {\n acc.push({\n name,\n entries: [...entries]\n });\n }\n });\n\n }\n return acc;\n }, result ?? []);\n }\n\n // Track all entries that are already assigned to groups\n const assignedEntries = new Set<string>();\n if (result) {\n result.forEach(group => {\n group.entries.forEach(entry => assignedEntries.add(entry));\n });\n }\n\n // Find collections and views that are NOT in any persisted group\n const unassignedGroupMap: Record<string, string[]> = {};\n\n // Check collections\n (collections ?? []).forEach(collection => {\n if (collection.hideFromNavigation) return;\n const entry = collection.slug;\n if (!assignedEntries.has(entry)) {\n const groupName = getGroup(collection);\n if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];\n unassignedGroupMap[groupName].push(entry);\n }\n });\n\n // Check views\n (views ?? []).forEach(view => {\n if (view.hideFromNavigation) return;\n const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;\n if (!assignedEntries.has(entry)) {\n const groupName = getGroup(view);\n if (!unassignedGroupMap[groupName]) unassignedGroupMap[groupName] = [];\n unassignedGroupMap[groupName].push(entry);\n }\n });\n\n // Merge unassigned entries into existing groups or create new groups\n Object.entries(unassignedGroupMap).forEach(([groupName, entries]) => {\n if (result) {\n const existingGroup = result.find(g => g.name === groupName);\n if (existingGroup) {\n existingGroup.entries.push(...entries);\n } else {\n result.push({\n name: groupName,\n entries\n });\n }\n }\n });\n\n if (!result) {\n // No persisted data at all - create from scratch\n result = [];\n const groupMap: Record<string, string[]> = {};\n\n // Add collections\n (collections ?? []).forEach(collection => {\n if (collection.hideFromNavigation) return;\n const name = getGroup(collection);\n const entry = collection.slug;\n if (!groupMap[name]) groupMap[name] = [];\n groupMap[name].push(entry);\n });\n\n // Add views\n (views ?? []).forEach(view => {\n if (view.hideFromNavigation) return;\n const name = getGroup(view);\n const entry = Array.isArray(view.slug) ? view.slug[0] : view.slug;\n if (!groupMap[name]) groupMap[name] = [];\n groupMap[name].push(entry);\n });\n\n // Convert groupMap to result array\n result = Object.entries(groupMap).map(([name, entries]) => ({\n name,\n entries\n }));\n }\n\n // Remove duplicates in entries\n result.forEach(group => {\n group.entries = [...new Set(group.entries)];\n });\n\n return result;\n}\n\nexport function areCollectionListsEqual(a: AdminCollection[], b: AdminCollection[], visitedSlugs: string[] = []) {\n if (a.length !== b.length) {\n return false;\n }\n const aCopy = [...a];\n const bCopy = [...b];\n const aSorted = aCopy.sort((x, y) => x.slug.localeCompare(y.slug));\n const bSorted = bCopy.sort((x, y) => x.slug.localeCompare(y.slug));\n return aSorted.every((value, index) => areCollectionsEqual(value, bSorted[index], visitedSlugs));\n}\n\nexport function areCollectionsEqual(a: AdminCollection, b: AdminCollection, visitedSlugs: string[] = []) {\n if (a.slug !== b.slug) {\n return false;\n }\n if (visitedSlugs.includes(a.slug)) {\n return true;\n }\n const newVisited = [...visitedSlugs, a.slug];\n\n if (!areCollectionListsEqual(getSubcollections(a), getSubcollections(b), newVisited)) {\n return false;\n }\n const restAWithoutFunctions = Object.fromEntries(\n Object.entries(a).filter(([k, v]) => typeof v !== \"function\" && k !== \"subcollections\")\n );\n const restBWithoutFunctions = Object.fromEntries(\n Object.entries(b).filter(([k, v]) => typeof v !== \"function\" && k !== \"subcollections\")\n );\n return equal(restAWithoutFunctions, restBWithoutFunctions);\n}\n"],"mappings":";;;AAMA,IAAa,gCAAgC;AAC7C,IAAa,8BAA8B;;;;;;;;;;;;;;AAe3C,IAAa,gCAAgC,CAAC,SAAS,UAAU;;AAGjE,SAAgB,wBAAwB,WAA6B;CACjE,OAAO,cAAc,KAAA,KAAc,8BAAoD,SAAS,SAAS;AAC7G;AAEA,SAAgB,SAAS,kBAA6C;CAClE,MAAM,UAAU,iBAAiB,OAAO,KAAK;CAC7C,IAAI,CAAC,WAAW,YAAY,IACxB,OAAO;CAEX,OAAO;AACX;AAEA,SAAgB,wBAAwB,EACpC,yBACA,aACA,OACA,WAMyB;CAGzB,IAAI,SAAS,0BACP,wBAAwB,KAAI,OAAM;EAChC,MAAM,EAAE;EACR,SAAS,CAAC,GAAG,EAAE,OAAO;EACtB,GAAI,EAAE,uBAAuB,KAAA,KAAa,EAAE,oBAAoB,EAAE,mBAAmB;CACzF,EAAE,IACA;CAGN,IAAI,SACA,SAAS,QAAQ,QAAQ,KAAK,WAAW;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AE,IAAI,CAAC;CACjE,OAAO,QAAQ,OAAO,OAAO,UAAU,oBAAoB,OAAO,QAAQ,QAAQ,YAAY,CAAC;AACnG;AAEA,SAAgB,oBAAoB,GAAoB,GAAoB,eAAyB,CAAC,GAAG;CACrG,IAAI,EAAE,SAAS,EAAE,MACb,OAAO;CAEX,IAAI,aAAa,SAAS,EAAE,IAAI,GAC5B,OAAO;CAEX,MAAM,aAAa,CAAC,GAAG,cAAc,EAAE,IAAI;CAE3C,IAAI,CAAC,wBAAwB,kBAAkB,CAAC,GAAG,kBAAkB,CAAC,GAAG,UAAU,GAC/E,OAAO;CAQX,OAAO,UANuB,OAAO,YACjC,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,OAAO,MAAM,cAAc,MAAM,gBAAgB,CAK7E,GAHiB,OAAO,YACjC,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,OAAO,MAAM,cAAc,MAAM,gBAAgB,CAEtD,CAAqB;AAC7D"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { User } from "@rebasepro/types";
|
|
2
2
|
import type { AuthController, RebaseContext, SideDialogsController, SidePanelController } from "@rebasepro/cms-types";
|
|
3
|
-
import type { CollectionRegistryController } from "@rebasepro/types";
|
|
4
|
-
import type { NavigationStateController, UrlController } from "@rebasepro/cms-types";
|
|
3
|
+
import type { NavigationStateController, UrlController, CollectionRegistryController } from "@rebasepro/cms-types";
|
|
5
4
|
/**
|
|
6
5
|
* The admin context extends the core RebaseContext with admin-specific
|
|
7
6
|
* controllers that are only available inside the admin routing tree.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAdminContext.js","names":[],"sources":["../../src/hooks/useAdminContext.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useRebaseContext } from \"@rebasepro/app\";\nimport type {\n User\n} from \"@rebasepro/types\";\nimport type {\n AuthController,\n RebaseContext,\n SideDialogsController,\n SidePanelController\n} from \"@rebasepro/cms-types\";\nimport type {\n
|
|
1
|
+
{"version":3,"file":"useAdminContext.js","names":[],"sources":["../../src/hooks/useAdminContext.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useRebaseContext } from \"@rebasepro/app\";\nimport type {\n User\n} from \"@rebasepro/types\";\nimport type {\n AuthController,\n RebaseContext,\n SideDialogsController,\n SidePanelController\n} from \"@rebasepro/cms-types\";\nimport type {\n NavigationStateController,\n UrlController,\n CollectionRegistryController\n} from \"@rebasepro/cms-types\";\nimport { useSidePanel } from \"./useSidePanel\";\nimport { useSideDialogsController } from \"./useSideDialogsController\";\nimport {\n useUrlController,\n useNavigationStateController,\n useCollectionRegistryController\n} from \"./navigation/contexts\";\n\n/**\n * The admin context extends the core RebaseContext with admin-specific\n * controllers that are only available inside the admin routing tree.\n *\n * Use {@link useAdminContext} to obtain an instance.\n * @group Hooks and utilities\n */\nexport type AdminContext<\n DB = Record<string, unknown>,\n USER extends User = User,\n AuthControllerType extends AuthController<USER> = AuthController<USER>\n> = RebaseContext<USER, AuthControllerType> & {\n sidePanelController: SidePanelController;\n sideDialogsController: SideDialogsController;\n urlController: UrlController;\n navigationStateController: NavigationStateController;\n collectionRegistryController: CollectionRegistryController<DB>;\n};\n\n/**\n * Hook that builds a fully-populated admin context by combining the\n * core {@link RebaseContext} with admin-specific controllers.\n *\n * Use this instead of `useRebaseContext()` in admin components that\n * need to pass context to entity action callbacks, plugin slots,\n * or any consumer that expects admin controllers on the context object.\n *\n * @group Hooks and utilities\n */\nexport function useAdminContext<\n DB = Record<string, unknown>,\n USER extends User = User,\n AuthControllerType extends AuthController<USER> = AuthController<USER>\n>(): AdminContext<DB, USER, AuthControllerType> {\n const baseContext = useRebaseContext<USER, AuthControllerType>();\n const sidePanelController = useSidePanel();\n const sideDialogsController = useSideDialogsController();\n const urlController = useUrlController();\n const navigationStateController = useNavigationStateController();\n const collectionRegistryController = useCollectionRegistryController<DB>();\n\n return useMemo(() => ({\n ...baseContext,\n sidePanelController,\n sideDialogsController,\n urlController,\n navigationStateController,\n collectionRegistryController\n }), [\n baseContext,\n sidePanelController,\n sideDialogsController,\n urlController,\n navigationStateController,\n collectionRegistryController\n ]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqDA,SAAgB,kBAIgC;CAC5C,MAAM,cAAc,iBAA2C;CAC/D,MAAM,sBAAsB,aAAa;CACzC,MAAM,wBAAwB,yBAAyB;CACvD,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,4BAA4B,6BAA6B;CAC/D,MAAM,+BAA+B,gCAAoC;CAEzE,OAAO,eAAe;EAClB,GAAG;EACH;EACA;EACA;EACA;EACA;CACJ,IAAI;EACA;EACA;EACA;EACA;EACA;EACA;CACJ,CAAC;AACL"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CustomizationController, SidePanelBindingProps, SideDialogsController, SidePanelController, UrlController, NavigationStateController, AdminCollection } from "@rebasepro/cms-types";
|
|
2
|
-
import { CollectionRegistryController } from "@rebasepro/types";
|
|
3
|
-
import { AuthController } from "@rebasepro/cms-types";
|
|
2
|
+
import { AuthController, CollectionRegistryController } from "@rebasepro/cms-types";
|
|
4
3
|
/**
|
|
5
4
|
* How wide the side panel opens.
|
|
6
5
|
*
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { hasEntityId } from "../util/identity.js";
|
|
1
2
|
import { LazySidePanelBinding } from "../components/lazy_record_views.js";
|
|
2
3
|
import { Suspense, useCallback, useEffect, useMemo, useRef } from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
import { CircularProgressCenter } from "@rebasepro/ui";
|
|
5
|
-
import { hasEntityId, warnDeprecated } from "@rebasepro/common";
|
|
6
6
|
import { CONTAINER_FULL_WIDTH, CollectionScopeProvider, SIDE_PANEL_DEFAULT_WIDTH, getNavigationEntriesFromPath, removeInitialAndTrailingSlashes, removeTrailingSlash, resolveDefaultSelectedView, useComponentOverride, useCustomizationController, useLargeLayout } from "@rebasepro/app";
|
|
7
|
+
import { warnDeprecated } from "@rebasepro/common";
|
|
7
8
|
import { useLocation } from "react-router";
|
|
8
9
|
//#region src/hooks/useBuildSidePanel.tsx
|
|
9
10
|
/**
|