@rebasepro/cms 0.28.2 → 0.29.0-canary.g0e3a0e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/collection_editor/_cms_internals.d.ts +0 -1
- package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -2
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +2 -2
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -1
- package/dist/components/AdditionalFieldValue.d.ts +9 -3
- package/dist/components/AdditionalFieldValue.js +7 -4
- package/dist/components/AdditionalFieldValue.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +117 -18
- package/dist/components/CollectionPanel.js +115 -37
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +5 -5
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +16 -12
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +33 -8
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +8 -3
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +9 -1
- package/dist/components/CollectionTableBinding/column_utils.js +6 -3
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- 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.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +3 -2
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +9 -7
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +26 -2
- package/dist/components/CollectionTableBinding/internal/common.js +88 -4
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +4 -3
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +19 -14
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionAddButton.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js +50 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +11 -3
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -4
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +29 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js +112 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +58 -16
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.d.ts +57 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +22 -26
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +58 -22
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +81 -1089
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +152 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js +38 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.d.ts +13 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js +32 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.d.ts +14 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js +22 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +39 -67
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js +54 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.d.ts +24 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js +69 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +34 -23
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.d.ts +17 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +107 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +15 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js +49 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +35 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js +45 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/RowActions.d.ts +40 -0
- package/dist/components/CollectionViewBinding/RowActions.js +60 -0
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +7 -4
- package/dist/components/CollectionViewBinding/SplitListView.js +20 -21
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/builtin_action_props.d.ts +13 -0
- package/dist/components/CollectionViewBinding/fields.d.ts +22 -0
- package/dist/components/CollectionViewBinding/fields.js +47 -0
- package/dist/components/CollectionViewBinding/fields.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +6 -7
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.d.ts +19 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js +28 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js.map +1 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +125 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +844 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +20 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +23 -2
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +21 -3
- package/dist/components/CollectionViewBinding/useSelectionController.js +37 -6
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +3 -3
- package/dist/components/CollectionsProvider.js +4 -4
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/CollectionsScopeContext.d.ts +1 -1
- package/dist/components/CollectionsScopeContext.js +1 -1
- package/dist/components/CollectionsScopeContext.js.map +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +2 -2
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +32 -68
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js +5 -4
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -2
- package/dist/components/EditViewBinding.js +25 -15
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.js +8 -5
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +8 -1
- package/dist/components/EntityViewBinding.js +43 -14
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +40 -0
- package/dist/components/EntityViewBody.js +90 -0
- package/dist/components/EntityViewBody.js.map +1 -0
- package/dist/components/FieldValue.d.ts +50 -0
- package/dist/components/FieldValue.js +81 -0
- package/dist/components/FieldValue.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PanelNotFound.d.ts +5 -0
- package/dist/components/PanelNotFound.js +21 -0
- package/dist/components/PanelNotFound.js.map +1 -0
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/components/RebaseCMS.js +11 -3
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +9 -3
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RebaseShell.js +10 -5
- package/dist/components/RebaseShell.js.map +1 -1
- package/dist/components/RecordDetail.d.ts +61 -0
- package/dist/components/RecordDetail.js +123 -0
- package/dist/components/RecordDetail.js.map +1 -0
- package/dist/components/RecordForm.d.ts +126 -0
- package/dist/components/{EntityFormPanel.js → RecordForm.js} +64 -36
- package/dist/components/RecordForm.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +47 -17
- package/dist/components/ReferenceTable/SelectionTableBinding.js +89 -53
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +5 -3
- package/dist/components/ReferenceWidget.js +10 -7
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.js +4 -4
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +2 -3
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.js +1 -1
- package/dist/components/SelectableTable/SelectionStore.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/SidePanelBinding.js +13 -12
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/collection_prop.d.ts +18 -0
- package/dist/components/collection_prop.js +23 -0
- package/dist/components/collection_prop.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +54 -54
- package/dist/components/common/default_entity_actions.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +4 -1
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/components/history/LastEditedByFormAction.d.ts +1 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/data_export/export/ExportCollectionAction.d.ts +3 -2
- package/dist/data_export/export/ExportCollectionAction.js +4 -3
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +6 -3
- package/dist/data_export/export/additional_fields.js +8 -4
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.js +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/EntityForm.js +252 -150
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js +3 -2
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.d.ts +1 -1
- package/dist/form/EntityFormBinding.js +22 -11
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormField.d.ts +36 -0
- package/dist/form/FormField.js +41 -0
- package/dist/form/FormField.js.map +1 -0
- package/dist/form/FormFieldsContext.d.ts +69 -0
- package/dist/form/FormFieldsContext.js +143 -0
- package/dist/form/FormFieldsContext.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +4 -4
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/collection_showing.d.ts +8 -0
- package/dist/form/collection_showing.js +29 -0
- package/dist/form/collection_showing.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +2 -1
- package/dist/form/components/ErrorFocus.js.map +1 -1
- package/dist/form/components/FieldBlock.js +3 -1
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +5 -1
- package/dist/form/components/FormRail.js +5 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/FormSections.d.ts +5 -1
- package/dist/form/components/FormSections.js +11 -4
- package/dist/form/components/FormSections.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +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/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +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.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/form_dom_ids.d.ts +25 -0
- package/dist/form/form_dom_ids.js +42 -0
- package/dist/form/form_dom_ids.js.map +1 -0
- package/dist/form/index.d.ts +3 -1
- package/dist/form/resolve_cell_property.d.ts +5 -0
- package/dist/form/resolve_cell_property.js +22 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +2 -2
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.d.ts +3 -3
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/useResolvedCollections.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.js +9 -9
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useEntityDisplay.js +6 -4
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useRecordActions.js +2 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useSelectionDialog.d.ts +20 -7
- package/dist/hooks/useSelectionDialog.js +29 -8
- package/dist/hooks/useSelectionDialog.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +15 -9
- package/dist/mcp-view.d.ts +9 -0
- package/dist/mcp-view.js +2 -0
- package/dist/mcp_view/app_modules.d.ts +29 -0
- package/dist/mcp_view/app_modules.js +163 -0
- package/dist/mcp_view/app_modules.js.map +1 -0
- package/dist/mcp_view/bridge.d.ts +90 -0
- package/dist/mcp_view/bridge.js +205 -0
- package/dist/mcp_view/bridge.js.map +1 -0
- package/dist/mcp_view/code_app.d.ts +65 -0
- package/dist/mcp_view/code_app.js +139 -0
- package/dist/mcp_view/code_app.js.map +1 -0
- package/dist/mcp_view/index.d.ts +48 -0
- package/dist/mcp_view/index.js +235 -0
- package/dist/mcp_view/index.js.map +1 -0
- package/dist/mcp_view/payload.d.ts +78 -0
- package/dist/mcp_view/payload.js +155 -0
- package/dist/mcp_view/payload.js.map +1 -0
- package/dist/mcp_view/screen.d.ts +28 -0
- package/dist/mcp_view/screen.js +223 -0
- package/dist/mcp_view/screen.js.map +1 -0
- package/dist/mcp_view/storage_source.d.ts +14 -0
- package/dist/mcp_view/storage_source.js +29 -0
- package/dist/mcp_view/storage_source.js.map +1 -0
- package/dist/mcp_view/store.d.ts +9 -0
- package/dist/mcp_view/store.js +27 -0
- package/dist/mcp_view/store.js.map +1 -0
- package/dist/mcp_view/tool_driver.d.ts +135 -0
- package/dist/mcp_view/tool_driver.js +527 -0
- package/dist/mcp_view/tool_driver.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +34 -1
- package/dist/preview/components/DatePreview.js +72 -37
- package/dist/preview/components/DatePreview.js.map +1 -1
- package/dist/routes/RebaseRoute.js +1 -1
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +5 -3
- package/dist/selection/SelectionMenu.js +16 -9
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/index.d.ts +2 -1
- package/dist/selection/resolve_selection.d.ts +61 -7
- package/dist/selection/resolve_selection.js +93 -11
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/types/components/EntityFormProps.d.ts +60 -10
- package/dist/types/fields.d.ts +2 -65
- package/dist/util/dataControllerAdapter.d.ts +8 -0
- package/dist/util/dataControllerAdapter.js +11 -0
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/navigation_utils.d.ts +5 -4
- package/dist/util/navigation_utils.js +6 -6
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +8 -0
- package/dist/util/propertyConfigMapper.js +16 -2
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/package.json +15 -9
- package/recipes/README.md +79 -26
- package/recipes/approval-queue.tsx +79 -0
- package/recipes/bulk-set-status.tsx +23 -17
- package/recipes/calendar-view.tsx +28 -23
- package/recipes/master-detail.tsx +75 -0
- package/recipes/my-preferences.tsx +3 -3
- package/recipes/orders-dashboard.tsx +58 -84
- package/recipes/site-settings.tsx +4 -4
- package/dist/components/EntityFormPanel.d.ts +0 -63
- package/dist/components/EntityFormPanel.js.map +0 -1
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import { useCollectionRegistryController } from "./navigation/contexts/CollectionRegistryContext.js";
|
|
2
2
|
import { useSideDialogsController } from "./useSideDialogsController.js";
|
|
3
|
-
import {
|
|
3
|
+
import { EntitySelectionTable, entitySelectionPropsOf } from "../components/ReferenceTable/SelectionTableBinding.js";
|
|
4
4
|
import { useCallback, useMemo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/hooks/useSelectionDialog.tsx
|
|
7
7
|
/**
|
|
8
8
|
* This hook is used to open a side dialog that allows the selection
|
|
9
|
-
* of
|
|
10
|
-
* You can use it in custom views for selecting
|
|
9
|
+
* of rows under a given path.
|
|
10
|
+
* You can use it in custom views for selecting rows; the callbacks are handed
|
|
11
|
+
* them as the server sends them, and their ids beside them.
|
|
11
12
|
* You need to specify the path of the target collection at least.
|
|
12
13
|
* If your collection is not defined in your top collection configuration
|
|
13
14
|
* (in your `Rebase` component), you need to specify explicitly.
|
|
14
15
|
* This is the same hook used internally when a reference property is defined.
|
|
15
16
|
* @group Hooks and utilities
|
|
16
17
|
*/
|
|
17
|
-
function useSelectionDialog(
|
|
18
|
+
function useSelectionDialog(selectionProps) {
|
|
19
|
+
const { path, onClose, ...props } = selectionProps;
|
|
20
|
+
const navigation = useCollectionRegistryController();
|
|
21
|
+
const collection = props.collection ?? (path ? navigation.getCollection(path) : void 0);
|
|
22
|
+
return useEntitySelectionDialog({
|
|
23
|
+
...entitySelectionPropsOf({
|
|
24
|
+
...props,
|
|
25
|
+
collection,
|
|
26
|
+
path: path || ""
|
|
27
|
+
}),
|
|
28
|
+
path,
|
|
29
|
+
onClose
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* {@link useSelectionDialog} over the admin's `Entity` view model, for its own
|
|
34
|
+
* reference and relation fields.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
function useEntitySelectionDialog(referenceDialogProps) {
|
|
18
39
|
const navigation = useCollectionRegistryController();
|
|
19
40
|
const sideDialogsController = useSideDialogsController();
|
|
20
41
|
const open = useCallback(() => {
|
|
@@ -24,9 +45,9 @@ function useSelectionDialog(referenceDialogProps) {
|
|
|
24
45
|
if (!usedCollection) throw Error("Not able to resolve the collection in useSelectionDialog. Make sure a collection is registered in path " + referenceDialogProps.path);
|
|
25
46
|
sideDialogsController.open({
|
|
26
47
|
key: `reference_${referenceDialogProps.path}`,
|
|
27
|
-
component: /* @__PURE__ */ jsx(
|
|
28
|
-
|
|
29
|
-
|
|
48
|
+
component: /* @__PURE__ */ jsx(EntitySelectionTable, {
|
|
49
|
+
...referenceDialogProps,
|
|
50
|
+
collection: usedCollection
|
|
30
51
|
}),
|
|
31
52
|
width: "90vw",
|
|
32
53
|
onClose: () => {
|
|
@@ -48,6 +69,6 @@ function useSelectionDialog(referenceDialogProps) {
|
|
|
48
69
|
}), [open, close]);
|
|
49
70
|
}
|
|
50
71
|
//#endregion
|
|
51
|
-
export { useSelectionDialog };
|
|
72
|
+
export { useEntitySelectionDialog, useSelectionDialog };
|
|
52
73
|
|
|
53
74
|
//# sourceMappingURL=useSelectionDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectionDialog.js","names":[],"sources":["../../src/hooks/useSelectionDialog.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useSelectionDialog.js","names":[],"sources":["../../src/hooks/useSelectionDialog.tsx"],"sourcesContent":["import {\n EntitySelectionProps,\n EntitySelectionTable,\n entitySelectionPropsOf,\n SelectionProps\n} from \"../components/ReferenceTable/SelectionTableBinding\";\n\nimport { useCallback, useMemo } from \"react\";\nimport { useSideDialogsController } from \"./useSideDialogsController\";\nimport { useCollectionRegistryController } from \"./navigation/contexts/CollectionRegistryContext\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\ntype DialogOptions = {\n path?: string | false;\n onClose?: () => void;\n};\n\n/**\n * This hook is used to open a side dialog that allows the selection\n * of rows under a given path.\n * You can use it in custom views for selecting rows; the callbacks are handed\n * them as the server sends them, and their ids beside them.\n * You need to specify the path of the target collection at least.\n * If your collection is not defined in your top collection configuration\n * (in your `Rebase` component), you need to specify explicitly.\n * This is the same hook used internally when a reference property is defined.\n * @group Hooks and utilities\n */\nexport function useSelectionDialog<M extends Record<string, unknown>>(selectionProps: Omit<SelectionProps<M>, \"path\"> & DialogOptions): { open: () => void; close: () => void } {\n const { path, onClose, ...props } = selectionProps;\n const navigation = useCollectionRegistryController();\n // Resolved before the rows are made: a row is read by its collection, and\n // one registered under `path` is the one the dialog shows.\n const collection = props.collection\n ?? (path ? navigation.getCollection(path) as AdminCollection<M> | undefined : undefined);\n return useEntitySelectionDialog<M>({ ...entitySelectionPropsOf<M>({ ...props, collection, path: path || \"\" }), path, onClose });\n}\n\n/**\n * {@link useSelectionDialog} over the admin's `Entity` view model, for its own\n * reference and relation fields.\n *\n * @internal\n */\nexport function useEntitySelectionDialog<M extends Record<string, unknown>>(referenceDialogProps: Omit<EntitySelectionProps<M>, \"path\"> & DialogOptions): { open: () => void; close: () => void } {\n\n const navigation = useCollectionRegistryController();\n const sideDialogsController = useSideDialogsController();\n\n const open = useCallback(() => {\n if (referenceDialogProps.path) {\n let usedCollection = referenceDialogProps.collection;\n if (!usedCollection)\n usedCollection = navigation.getCollection(referenceDialogProps.path) as AdminCollection<M> | undefined;\n if (!usedCollection)\n throw Error(\"Not able to resolve the collection in useSelectionDialog. Make sure a collection is registered in path \" + referenceDialogProps.path);\n sideDialogsController.open({\n key: `reference_${referenceDialogProps.path}`,\n component:\n <EntitySelectionTable\n {...referenceDialogProps as EntitySelectionProps<M>}\n collection={usedCollection}/>,\n width: \"90vw\",\n onClose: () => {\n referenceDialogProps.onClose?.();\n }\n });\n } else {\n throw Error(\"useReferenceDialog: You are trying to open a reference dialog, but have not declared the `path`\")\n }\n }, [navigation, referenceDialogProps, sideDialogsController]);\n\n const close = useCallback(() => {\n sideDialogsController.close();\n }, [sideDialogsController]);\n\n return useMemo(() => ({\n open,\n close\n }), [open, close]);\n\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,SAAgB,mBAAsD,gBAA0G;CAC5K,MAAM,EAAE,MAAM,SAAS,GAAG,UAAU;CACpC,MAAM,aAAa,gCAAgC;CAGnD,MAAM,aAAa,MAAM,eACjB,OAAO,WAAW,cAAc,IAAI,IAAsC,KAAA;CAClF,OAAO,yBAA4B;EAAE,GAAG,uBAA0B;GAAE,GAAG;GAAO;GAAY,MAAM,QAAQ;EAAG,CAAC;EAAG;EAAM;CAAQ,CAAC;AAClI;;;;;;;AAQA,SAAgB,yBAA4D,sBAAsH;CAE9L,MAAM,aAAa,gCAAgC;CACnD,MAAM,wBAAwB,yBAAyB;CAEvD,MAAM,OAAO,kBAAkB;EAC3B,IAAI,qBAAqB,MAAM;GAC3B,IAAI,iBAAiB,qBAAqB;GAC1C,IAAI,CAAC,gBACD,iBAAiB,WAAW,cAAc,qBAAqB,IAAI;GACvE,IAAI,CAAC,gBACD,MAAM,MAAM,4GAA4G,qBAAqB,IAAI;GACrJ,sBAAsB,KAAK;IACvB,KAAK,aAAa,qBAAqB;IACvC,WACI,oBAAC,sBAAD;KACI,GAAI;KACJ,YAAY;IAAgB,CAAA;IACpC,OAAO;IACP,eAAe;KACX,qBAAqB,UAAU;IACnC;GACJ,CAAC;EACL,OACI,MAAM,MAAM,iGAAiG;CAErH,GAAG;EAAC;EAAY;EAAsB;CAAqB,CAAC;CAE5D,MAAM,QAAQ,kBAAkB;EAC5B,sBAAsB,MAAM;CAChC,GAAG,CAAC,qBAAqB,CAAC;CAE1B,OAAO,eAAe;EAClB;EACA;CACJ,IAAI,CAAC,MAAM,KAAK,CAAC;AAErB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { EditorAIControllerProvider, useProvidedEditorAIController } from "./con
|
|
|
4
4
|
export * from "./form/index.js";
|
|
5
5
|
export * from "./preview/index.js";
|
|
6
6
|
export * from "./routes/index.js";
|
|
7
|
-
export { EntityViewBinding, SelectionTableBinding, SelectableTable, SelectableTableContext, CollectionViewBinding, CollectionViewActions, CollectionCardViewBinding, EntityCardBinding, useSelectionController, PropertyConfigBadge, PropertyKeyHint, CollectionTableBinding, CollectionRowActions, VirtualTableInput, ArrayContainer, type ArrayEntryParams, ReferenceWidget, SearchIconsView, FieldCaption, EntityPreviewBinding, getFieldConfig, getFieldId, getDefaultFieldConfig, getDefaultFieldId, DEFAULT_FIELD_CONFIGS, editEntityAction, copyEntityAction, deleteEntityAction, resetPasswordAction, SidePanelProvider, Scaffold, AppBar, Drawer, DefaultDrawer, DrawerFooterActions, DrawerNavigationItem, DrawerNavigationGroup, AdminModeSyncer, RebaseCMS, RebaseShell, RebaseAuthGate, RebaseNavigation, RebaseLayout, RebaseRouteDefs, SideDialogs, useApp, CollectionPanel, CollectionsProvider, EntityFormPanel } from "./components/index.js";
|
|
8
|
-
export type { EntityViewBindingProps, SelectionProps, SelectableTableProps, CollectionPanelProps, CollectionPanelOptions, CollectionsProviderProps, EntityFormPanelProps, DrawerNavigationGroupProps, DrawerNavigationItemProps } from "./components/index.js";
|
|
7
|
+
export { EntityViewBinding, SelectionTableBinding, SelectableTable, SelectableTableContext, CollectionViewBinding, CollectionViewActions, CollectionCardViewBinding, EntityCardBinding, useSelectionController, PropertyConfigBadge, PropertyKeyHint, CollectionTableBinding, CollectionRowActions, VirtualTableInput, ArrayContainer, type ArrayEntryParams, ReferenceWidget, SearchIconsView, FieldCaption, EntityPreviewBinding, getFieldConfig, getFieldId, getDefaultFieldConfig, getDefaultFieldId, DEFAULT_FIELD_CONFIGS, editEntityAction, copyEntityAction, deleteEntityAction, resetPasswordAction, SidePanelProvider, Scaffold, AppBar, Drawer, DefaultDrawer, DrawerFooterActions, DrawerNavigationItem, DrawerNavigationGroup, AdminModeSyncer, RebaseCMS, RebaseShell, RebaseAuthGate, RebaseNavigation, RebaseLayout, RebaseRouteDefs, SideDialogs, useApp, CollectionPanel, CollectionsProvider, RecordForm, EntityFormPanel, RecordDetail, FieldValue } from "./components/index.js";
|
|
8
|
+
export type { EntityViewBindingProps, CollectionViewBindingProps, SelectionProps, SelectableTableProps, CollectionPanelProps, CollectionPanelOptions, CollectionsProviderProps, RecordFormProps, RecordFormOptions, EntityFormPanelProps, RecordDetailProps, RecordDetailOptions, RecordPanelCollection, FieldValueProps, DrawerNavigationGroupProps, DrawerNavigationItemProps } from "./components/index.js";
|
|
9
9
|
export * from "./hooks/index.js";
|
|
10
10
|
export { addInitialSlash, removeInitialSlash, removeTrailingSlash, removeInitialAndTrailingSlashes, getLastSegment, getCollectionBySlugWithin, getCollectionPathsCombinations, resolveCollectionPathIds, mergeEntityActions, resolveEntityAction, resolveEntityView, isReferenceProperty, isRelationProperty, getIconForWidget, getIconForProperty, getPropertyInPath, getResolvedPropertyInPath, getBracketNotation, getPropertiesWithPropertiesOrder, getDefaultPropertiesOrder, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity } from "./util/index.js";
|
|
11
11
|
export { mapPropertyToConfig, mapPropertiesToConfigs } from "./util/propertyConfigMapper.js";
|
|
@@ -32,6 +32,11 @@ export type { DrawerExpansion } from "./components/drawer_expansion.js";
|
|
|
32
32
|
export { NAVIGATION_DEFAULT_GROUP_NAME } from "./hooks/navigation/utils.js";
|
|
33
33
|
export { CollectionTableToolbar, useToolbarLabels } from "./components/CollectionTableBinding/internal/CollectionTableToolbar.js";
|
|
34
34
|
export type { CollectionTableToolbarProps } from "./components/CollectionTableBinding/internal/CollectionTableToolbar.js";
|
|
35
|
+
export { CollectionToolbar, CollectionSearchBar, CollectionFiltersButton, CollectionViewModeToggle } from "./components/CollectionViewBinding/CollectionToolbar.js";
|
|
36
|
+
export type { CollectionToolbarProps } from "./components/CollectionViewBinding/CollectionToolbar.js";
|
|
37
|
+
export { CollectionAddButton } from "./components/CollectionViewBinding/CollectionAddButton.js";
|
|
38
|
+
export type { CollectionAddButtonProps } from "./components/CollectionViewBinding/CollectionAddButton.js";
|
|
39
|
+
export { useCollectionLargeLayout } from "./components/CollectionViewBinding/useCollectionLargeLayout.js";
|
|
35
40
|
export { EditorCollectionAction } from "./collection_editor/ui/EditorCollectionAction.js";
|
|
36
41
|
export type { CollectionTableBindingProps } from "./components/CollectionTableBinding/CollectionTableBindingProps.js";
|
|
37
42
|
export { EntityTableCell } from "./components/CollectionTableBinding/internal/EntityTableCell.js";
|
|
@@ -43,7 +48,7 @@ export type { AdditionalFieldValueProps } from "./components/AdditionalFieldValu
|
|
|
43
48
|
export { propertiesToColumns } from "./components/CollectionTableBinding/column_utils.js";
|
|
44
49
|
export type { PropertiesToColumnsParams } from "./components/CollectionTableBinding/column_utils.js";
|
|
45
50
|
export type { CustomFieldValidator } from "./form/validation.js";
|
|
46
|
-
export { resolveCollectionSlotKeys, useCollectionSlotKeys, useEntitySlots } from "./components/CollectionViewBinding/usePreviewSlots.js";
|
|
51
|
+
export { resolveCollectionSlotKeys, useCollectionSlotKeys, useEntitySlots, useImagePlace } from "./components/CollectionViewBinding/usePreviewSlots.js";
|
|
47
52
|
export type { CollectionSlotKeys, EntityPreviewSlots, PreviewSlot, DatePreviewSlot, RelationChipSlot, RelationChipItem } from "./components/CollectionViewBinding/usePreviewSlots.js";
|
|
48
53
|
export { SlotValue, TagChips } from "./components/CollectionViewBinding/SlotValue.js";
|
|
49
54
|
export type { SlotValueProps } from "./components/CollectionViewBinding/SlotValue.js";
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { EditorAIControllerProvider, useProvidedEditorAIController } from "./contexts/EditorAIControllerContext.js";
|
|
2
|
+
import { AdditionalFieldValue } from "./components/AdditionalFieldValue.js";
|
|
2
3
|
import { getBracketNotation, getDefaultPropertiesOrder, getIconForProperty, getIconForWidget, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, isReferenceProperty, isRelationProperty } from "./util/property_utils.js";
|
|
3
4
|
import { PropertyKeyHint } from "./components/PropertyKeyHint.js";
|
|
4
5
|
import { FieldBlock, LABEL_ICON_SIZE, isSelfLabellingProperty, spanClass } from "./form/components/FieldBlock.js";
|
|
5
6
|
import { getDefaultFieldId, getFieldId } from "./components/field_ids.js";
|
|
6
|
-
import { AdditionalFieldValue } from "./components/AdditionalFieldValue.js";
|
|
7
|
-
import { FormRail, RecordMeta } from "./form/components/FormRail.js";
|
|
8
|
-
import { FormSections } from "./form/components/FormSections.js";
|
|
9
7
|
import { EmptyValue } from "./preview/components/EmptyValue.js";
|
|
10
8
|
import { getDatePropertyMode, getDatePropertyTimezone, isEmptyPreviewValue, sanitizeUrl } from "./preview/util.js";
|
|
11
9
|
import { ImagePreview } from "./preview/components/ImagePreview.js";
|
|
@@ -18,7 +16,7 @@ import { ArrayPropertyPreview } from "./preview/property_previews/ArrayPropertyP
|
|
|
18
16
|
import { getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity } from "./util/previews.js";
|
|
19
17
|
import { getUserLabel, useResolvedUser } from "./hooks/useResolvedUsers.js";
|
|
20
18
|
import { useEntityTitle } from "./hooks/useEntityDisplay.js";
|
|
21
|
-
import { resolveCollectionSlotKeys, useCollectionSlotKeys, useEntitySlots } from "./components/CollectionViewBinding/usePreviewSlots.js";
|
|
19
|
+
import { resolveCollectionSlotKeys, useCollectionSlotKeys, useEntitySlots, useImagePlace } from "./components/CollectionViewBinding/usePreviewSlots.js";
|
|
22
20
|
import { CollectionRegistryContext, useCollectionRegistryController } from "./hooks/navigation/contexts/CollectionRegistryContext.js";
|
|
23
21
|
import { SidePanelControllerContext, useSidePanel } from "./hooks/useSidePanel.js";
|
|
24
22
|
import { NestedEntityPreviewBoundary } from "./components/EntityPreviewNesting.js";
|
|
@@ -33,7 +31,7 @@ import { ArrayPropertyEnumPreview } from "./preview/property_previews/ArrayPrope
|
|
|
33
31
|
import { ArrayOfStringsPreview } from "./preview/property_previews/ArrayOfStringsPreview.js";
|
|
34
32
|
import { ArrayOneOfPreview } from "./preview/property_previews/ArrayOneOfPreview.js";
|
|
35
33
|
import { KeyValuePreview, MapPropertyPreview } from "./preview/property_previews/MapPropertyPreview.js";
|
|
36
|
-
import { DatePreview } from "./preview/components/DatePreview.js";
|
|
34
|
+
import { DatePreview, formatDatePreview, useDateFnsLocale } from "./preview/components/DatePreview.js";
|
|
37
35
|
import { BooleanPreview } from "./preview/components/BooleanPreview.js";
|
|
38
36
|
import { NumberPropertyPreview } from "./preview/property_previews/NumberPropertyPreview.js";
|
|
39
37
|
import { UserPreview } from "./preview/components/UserPreview.js";
|
|
@@ -47,6 +45,7 @@ import { ArrayCustomShapedFieldBinding } from "./form/field_bindings/ArrayCustom
|
|
|
47
45
|
import { EntityTableCell } from "./components/CollectionTableBinding/internal/EntityTableCell.js";
|
|
48
46
|
import { SelectableTableContext } from "./components/SelectableTable/SelectableTableContext.js";
|
|
49
47
|
import { PropertyTableCell } from "./components/CollectionTableBinding/PropertyTableCell.js";
|
|
48
|
+
import { useCollectionLargeLayout } from "./components/CollectionViewBinding/useCollectionLargeLayout.js";
|
|
50
49
|
import { useSideDialogsController } from "./hooks/useSideDialogsController.js";
|
|
51
50
|
import { NavigationStateContext, useNavigationStateController } from "./hooks/navigation/contexts/NavigationStateContext.js";
|
|
52
51
|
import { UrlContext, useUrlController } from "./hooks/navigation/contexts/UrlContext.js";
|
|
@@ -98,13 +97,18 @@ import { TextFieldBinding } from "./form/field_bindings/TextFieldBinding.js";
|
|
|
98
97
|
import { VectorFieldBinding } from "./form/field_bindings/VectorFieldBinding.js";
|
|
99
98
|
import { DEFAULT_FIELD_CONFIGS, getDefaultFieldConfig, getFieldConfig } from "./components/field_configs.js";
|
|
100
99
|
import { PropertyFieldBinding } from "./form/PropertyFieldBinding.js";
|
|
100
|
+
import { FormRail, RecordMeta } from "./form/components/FormRail.js";
|
|
101
|
+
import { FormSections } from "./form/components/FormSections.js";
|
|
101
102
|
import { extractTouchedValues, getChanges, getInitialEntityValues, getParentLinkValues, getTouchedPropertyValues, getUnappliedLocalChanges, overlayEdit, removeEmptyContainers, zodToFormErrors } from "./form/form_utils.js";
|
|
102
103
|
import { EntityForm } from "./form/EntityForm.js";
|
|
103
104
|
import { EntityFormBinding } from "./form/EntityFormBinding.js";
|
|
105
|
+
import { FormField } from "./form/FormField.js";
|
|
104
106
|
import { CustomViewRoute } from "./routes/CustomViewRoute.js";
|
|
105
107
|
import { resolveEntityAction, resolveEntityView } from "./util/resolutions.js";
|
|
106
108
|
import { RebaseRoute } from "./routes/RebaseRoute.js";
|
|
107
109
|
import { EntityViewBinding } from "./components/EntityViewBinding.js";
|
|
110
|
+
import { useChildViewSource } from "./hooks/useChildViewSource.js";
|
|
111
|
+
import { EditViewBinding } from "./components/EditViewBinding.js";
|
|
108
112
|
import { MAX_SELECTION_ROWS, SELECTION_PAGE_SIZE, resolveSelection, selectionQueryToFindParams, serializeSelectionQuery } from "./selection/resolve_selection.js";
|
|
109
113
|
import { SelectionMenu } from "./selection/SelectionMenu.js";
|
|
110
114
|
import { FieldCaption } from "./components/FieldCaption.js";
|
|
@@ -124,14 +128,14 @@ import { DataNewPropertiesMapping } from "./data_import/components/DataNewProper
|
|
|
124
128
|
import { ImportNewPropertyFieldPreview } from "./data_import/components/ImportNewPropertyFieldPreview.js";
|
|
125
129
|
import { useCollectionEditorController } from "./collection_editor/useCollectionEditorController.js";
|
|
126
130
|
import { EditorCollectionAction } from "./collection_editor/ui/EditorCollectionAction.js";
|
|
131
|
+
import { CollectionAddButton } from "./components/CollectionViewBinding/CollectionAddButton.js";
|
|
127
132
|
import { CollectionViewActions } from "./components/CollectionViewBinding/CollectionViewActions.js";
|
|
133
|
+
import { CollectionFiltersButton, CollectionSearchBar, CollectionToolbar, CollectionViewModeToggle } from "./components/CollectionViewBinding/CollectionToolbar.js";
|
|
128
134
|
import { Highlighted } from "./components/CollectionViewBinding/SearchHighlight.js";
|
|
129
135
|
import { MatchExplanation, fieldLabel, useSearchExplanation } from "./components/CollectionViewBinding/SearchExplanation.js";
|
|
130
136
|
import { SlotValue, TagChips } from "./components/CollectionViewBinding/SlotValue.js";
|
|
131
137
|
import { EntityCardBinding } from "./components/CollectionViewBinding/EntityCardBinding.js";
|
|
132
138
|
import { CollectionCardViewBinding } from "./components/CollectionViewBinding/CollectionCardViewBinding.js";
|
|
133
|
-
import { useChildViewSource } from "./hooks/useChildViewSource.js";
|
|
134
|
-
import { EditViewBinding } from "./components/EditViewBinding.js";
|
|
135
139
|
import { CollectionViewBinding } from "./components/CollectionViewBinding/CollectionViewBinding.js";
|
|
136
140
|
import { DetailViewBinding } from "./components/DetailViewBinding.js";
|
|
137
141
|
import { ReferenceWidget } from "./components/ReferenceWidget.js";
|
|
@@ -161,7 +165,9 @@ import { RebaseRouteDefs } from "./components/RebaseRouteDefs.js";
|
|
|
161
165
|
import { RebaseShell } from "./components/RebaseShell.js";
|
|
162
166
|
import { CollectionsProvider } from "./components/CollectionsProvider.js";
|
|
163
167
|
import { CollectionPanel } from "./components/CollectionPanel.js";
|
|
164
|
-
import { EntityFormPanel } from "./components/
|
|
168
|
+
import { EntityFormPanel, RecordForm } from "./components/RecordForm.js";
|
|
169
|
+
import { RecordDetail } from "./components/RecordDetail.js";
|
|
170
|
+
import { FieldValue } from "./components/FieldValue.js";
|
|
165
171
|
import { mapPropertiesToConfigs, mapPropertyToConfig } from "./util/propertyConfigMapper.js";
|
|
166
172
|
import { createStaticDataController, useCollectionDataController } from "./util/dataControllerAdapter.js";
|
|
167
173
|
import { ImportCollectionAction, ImportDataPreview, PropertySelectEntry } from "./data_import/import/ImportCollectionAction.js";
|
|
@@ -175,4 +181,4 @@ import { CollectionGenerationApiError, DEFAULT_COLLECTION_GENERATION_ENDPOINT, b
|
|
|
175
181
|
import { MissingReferenceWidget } from "./collection_editor/ui/MissingReferenceWidget.js";
|
|
176
182
|
import { getFullId, getFullIdPath, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "./collection_editor/ui/collection_editor/util.js";
|
|
177
183
|
import { SmallNavigationCard } from "./components/HomePage/SmallNavigationCard.js";
|
|
178
|
-
export { AdditionalFieldValue, AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanFilterField, BooleanPreview, CollectionCardViewBinding, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionTableBinding, CollectionTableToolbar, CollectionViewActions, CollectionViewBinding, CollectionsProvider, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DateTimeFilterField, DefaultDrawer, DetailViewBinding, Drawer, DrawerExpansionContext, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EditViewBinding, EditorAIControllerProvider, EditorCollectionAction, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityFormPanel, EntityPreviewBinding, EntityTableCell, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FavouritesView, FieldBlock, FieldCaption, FieldHelperText, FormRail, FormSections, Highlighted, IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MatchExplanation, MissingReferenceWidget, MultiSelectFieldBinding, NAVIGATION_DEFAULT_GROUP_NAME, NavigationCard, NavigationCardBinding, NavigationGroup, NavigationStateContext, NestedEntityPreviewBoundary, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, PropertyTableCell, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordMeta, ReferenceFieldBinding, ReferenceFilterField, ReferencePreview, ReferenceWidget, RelationFilterField, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, SlotValue, SmallNavigationCard, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringNumberFilterField, StringPropertyPreview, SwitchFieldBinding, TagChips, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entityActionName, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, fieldLabel, flattenEntry, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDatePropertyMode, getDatePropertyTimezone, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getParentLinkValues, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getTouchedPropertyValues, getUnappliedLocalChanges, getUserLabel, idToPropertiesPath, isEmptyPreviewValue, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, overlayEdit, parseCsvRows, parseCsvToObjects, processValueMapping, propertiesToColumns, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveCollectionSlotKeys, resolveEntityAction, resolveEntityActionState, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, unlinkEntityAction, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useChildViewSource, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionRegistryController, useCollectionSlotKeys, useCollectionsConfigController, useDrawerExpandedWhile, useDrawerExpansion, useEntitySlots, useEntityTitle, useHistory, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useProvidedEditorAIController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSearchExplanation, useSelectionController, useSelectionDialog, useSideDialogContext, useSideDialogsController, useSidePanel, useToolbarLabels, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
|
|
184
|
+
export { AdditionalFieldValue, AdminModeSyncer, AppBar, ArrayContainer, ArrayCustomShapedFieldBinding, ArrayEnumPreview, ArrayOfMapsPreview, ArrayOfReferencesFieldBinding, ArrayOfReferencesPreview, ArrayOfStorageComponentsPreview, ArrayOfStringsPreview, ArrayOneOfPreview, ArrayPropertyEnumPreview, ArrayPropertyPreview, BasicExportAction, BlockFieldBinding, BooleanFilterField, BooleanPreview, CollectionAddButton, CollectionCardViewBinding, CollectionFiltersButton, CollectionGenerationApiError, CollectionPanel, CollectionRegistryContext, CollectionRowActions, CollectionSearchBar, CollectionTableBinding, CollectionTableToolbar, CollectionToolbar, CollectionViewActions, CollectionViewBinding, CollectionViewModeToggle, CollectionsProvider, CreationResultDialog, CustomViewRoute, DEFAULT_COLLECTION_GENERATION_ENDPOINT, DEFAULT_FIELD_CONFIGS, DataNewPropertiesMapping, DatePreview, DateTimeFieldBinding, DateTimeFilterField, DefaultDrawer, DetailViewBinding, Drawer, DrawerExpansionContext, DrawerFooterActions, DrawerNavigationGroup, DrawerNavigationItem, EXPORT_PAGE_SIZE, EditViewBinding, EditorAIControllerProvider, EditorCollectionAction, EmptyValue, EntityCardBinding, EntityForm, EntityFormBinding, EntityFormPanel, EntityPreviewBinding, EntityTableCell, EntityViewBinding, EnumValuesChip, ExportCollectionAction, FavouritesView, FieldBlock, FieldCaption, FieldHelperText, FieldValue, FormField, FormRail, FormSections, Highlighted, IMPORT_BATCH_MAX_BYTES, IMPORT_BATCH_SIZE, ImagePreview, ImportCollectionAction, ImportConversionProblems, ImportDataPreview, ImportFileUpload, ImportNewPropertyFieldPreview, ImportSaveInProgress, InlineEntityListPreview, KeyValueFieldBinding, KeyValuePreview, LABEL_ICON_SIZE, LabelWithIcon, LiveSchemaError, MAX_EXPORT_ROWS, MAX_SELECTION_ROWS, MapFieldBinding, MapPropertyPreview, MarkdownEditorFieldBinding, MatchExplanation, MissingReferenceWidget, MultiSelectFieldBinding, NAVIGATION_DEFAULT_GROUP_NAME, NavigationCard, NavigationCardBinding, NavigationGroup, NavigationStateContext, NestedEntityPreviewBoundary, NumberPropertyPreview, PropertyConfigBadge, PropertyFieldBinding, PropertyKeyHint, PropertyPreview, PropertySelectEntry, PropertyTableCell, ReadOnlyFieldBinding, RebaseAuthGate, RebaseCMS, RebaseLayout, RebaseNavigation, RebaseRoute, RebaseRouteDefs, RebaseShell, RecordDetail, RecordForm, RecordMeta, ReferenceFieldBinding, ReferenceFilterField, ReferencePreview, ReferenceWidget, RelationFilterField, RelationPreview, RepeatFieldBinding, SELECTION_PAGE_SIZE, Scaffold, SchemaChangeCancelled, SearchIconsView, SelectFieldBinding, SelectableTable, SelectableTableContext, SelectionMenu, SelectionTableBinding, SideDialogs, SidePanelControllerContext, SidePanelProvider, SkeletonPropertyComponent, SlotValue, SmallNavigationCard, StorageThumbnail, StorageThumbnailInternal, StorageUploadFieldBinding, StringNumberFilterField, StringPropertyPreview, SwitchFieldBinding, TagChips, TextFieldBinding, UrlComponentPreview, UrlContext, UserPreview, VectorFieldBinding, VirtualTableInput, addInitialSlash, asUnavailable, buildCollectionGenerationCallback, buildSidePanelsFromUrl, convertDataToEntity, convertFileToJson, convertImportData, copyEntityAction, createLiveSchemaClient, createStaticDataController, deleteEntityAction, detectCsvDelimiter, downloadBlob, downloadDataAsCsv, downloadEntitiesExport, editEntityAction, entityActionName, entryToCSVRow, escapeCsvFormula, extractTouchedValues, fetchAllEntitiesForExport, fieldLabel, flattenEntry, formatDatePreview, fromSerializableCollectionConfig, fromSerializableCollectionConfigs, fromSerializableProperties, fromSerializableProperty, getBracketNotation, getChanges, getCollectionBySlugWithin, getCollectionPathsCombinations, getDatePropertyMode, getDatePropertyTimezone, getDefaultFieldConfig, getDefaultFieldId, getDefaultPropertiesOrder, getEntityCSVExportableData, getEntityJsonExportableData, getEntityPreviewKeys, getEntityTitlePropertyKey, getEntityTitlePropertyKeyForEntity, getEntityViewWidth, getFieldConfig, getFieldId, getFullId, getFullIdPath, getIconForProperty, getIconForWidget, getInferenceType, getInitialEntityValues, getLastSegment, getParentLinkValues, getPropertiesWithPropertiesOrder, getPropertyInPath, getResolvedPropertyInPath, getTouchedPropertyValues, getUnappliedLocalChanges, getUserLabel, idToPropertiesPath, isEmptyPreviewValue, isReferenceProperty, isRelationProperty, isSchemaChangeCancelled, isSelfLabellingProperty, mapPropertiesToConfigs, mapPropertyToConfig, mappedColumnTarget, mergeEntityActions, namespaceToPropertiesOrderPath, namespaceToPropertiesPath, overlayEdit, parseCsvRows, parseCsvToObjects, processValueMapping, propertiesToColumns, removeEmptyContainers, removeInitialAndTrailingSlashes, removeInitialSlash, removeTrailingSlash, renderSkeletonCaptionText, renderSkeletonIcon, renderSkeletonImageThumbnail, renderSkeletonText, resetPasswordAction, resolveCollectionPathIds, resolveCollectionSlotKeys, resolveEntityAction, resolveEntityActionState, resolveEntityView, resolveNavigationFrom, resolveSelection, sanitizeUrl, saveImportedEntities, selectionQueryToFindParams, serializeSelectionQuery, slashDateOrdersByColumn, spanClass, toSerializableCollectionConfig, toSerializableProperties, toSerializableProperty, unescapeCsvFormula, unlinkEntityAction, useAdminContext, useApp, useBreadcrumbsController, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildSidePanel, useBuildUrlController, useChildViewSource, useClearRestoreValue, useCollectionDataController, useCollectionEditorController, useCollectionLargeLayout, useCollectionRegistryController, useCollectionSlotKeys, useCollectionsConfigController, useDateFnsLocale, useDrawerExpandedWhile, useDrawerExpansion, useEntitySlots, useEntityTitle, useHistory, useImagePlace, useImportConfig, useJsonCollectionsConfigController, useLiveSchemaEditing, useLocalCollectionsConfigController, useNavigationStateController, useProvidedEditorAIController, useResolvedCollections, useResolvedNavigationFrom, useResolvedUser, useResolvedViews, useSearchExplanation, useSelectionController, useSelectionDialog, useSideDialogContext, useSideDialogsController, useSidePanel, useToolbarLabels, useTopLevelNavigation, useUrlController, validateCollectionJson, zodToFormErrors };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@rebasepro/cms/mcp-view`: what a project's build of its MCP App view
|
|
3
|
+
* imports (`rebaseMcpViewPlugin` generates that entry) — see
|
|
4
|
+
* `./mcp_view/index.tsx`. The runtime's other parts (the bridge, the tool
|
|
5
|
+
* driver, the payload) are its own; `@rebasepro/mcp-apps` builds from source
|
|
6
|
+
* and reaches them there.
|
|
7
|
+
*/
|
|
8
|
+
export { startMcpView } from "./mcp_view/index.js";
|
|
9
|
+
export type { McpViewOptions } from "./mcp_view/index.js";
|
package/dist/mcp-view.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an app the model wrote imports (show_app): the modules of
|
|
3
|
+
* `MCP_APP_MODULES`, each the package's own exports — `@rebasepro/cms`'s
|
|
4
|
+
* blocks, `@rebasepro/app`'s row hooks, the UI kit, React — so the code reads
|
|
5
|
+
* as Rebase code does anywhere, and the parts are the ones the admin panel is
|
|
6
|
+
* made of.
|
|
7
|
+
*
|
|
8
|
+
* One thing differs from the packages: an app was opened with a list of
|
|
9
|
+
* collections (show_app's `collections`), and every export that names one
|
|
10
|
+
* holds the app to it, with an error that says which it may use. The rows an
|
|
11
|
+
* app reads and writes go through the tool driver, as the person, under their
|
|
12
|
+
* RLS and their connection's scopes: that is what bounds an app, which can do
|
|
13
|
+
* nothing the model could not with the same tools. `useRowWrites` asks them
|
|
14
|
+
* before each write (`confirmingDriver` in `tool_driver.ts`), a courtesy
|
|
15
|
+
* against an app writing without a click; the admin's own controls in it — a
|
|
16
|
+
* form's Save, a delete — behave as on a show_collection screen. A form whose
|
|
17
|
+
* overrides make it save itself is not handed to an app: it would write on
|
|
18
|
+
* mount, unasked.
|
|
19
|
+
*/
|
|
20
|
+
import React from "react";
|
|
21
|
+
import * as jsxRuntime from "react/jsx-runtime";
|
|
22
|
+
import { type McpAppModule } from "@rebasepro/types";
|
|
23
|
+
/** Around an app's component: the collections its imports may name. */
|
|
24
|
+
export declare function AppCollections({ names, children }: {
|
|
25
|
+
names: readonly string[];
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}): jsxRuntime.JSX.Element;
|
|
28
|
+
/** Every module an app may import, by name. */
|
|
29
|
+
export declare const APP_MODULE_EXPORTS: Record<McpAppModule, object>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { useCollectionRegistryController } from "../hooks/navigation/contexts/CollectionRegistryContext.js";
|
|
2
|
+
import { useSidePanel } from "../hooks/useSidePanel.js";
|
|
3
|
+
import { FormField } from "../form/FormField.js";
|
|
4
|
+
import { CollectionAddButton } from "../components/CollectionViewBinding/CollectionAddButton.js";
|
|
5
|
+
import { CollectionFiltersButton, CollectionSearchBar, CollectionToolbar, CollectionViewModeToggle } from "../components/CollectionViewBinding/CollectionToolbar.js";
|
|
6
|
+
import { collectionPropOf } from "../components/collection_prop.js";
|
|
7
|
+
import { CollectionPanel } from "../components/CollectionPanel.js";
|
|
8
|
+
import { RecordForm } from "../components/RecordForm.js";
|
|
9
|
+
import { RecordDetail } from "../components/RecordDetail.js";
|
|
10
|
+
import { FieldValue } from "../components/FieldValue.js";
|
|
11
|
+
import React, { createContext, useCallback, useContext, useMemo } from "react";
|
|
12
|
+
import * as jsxRuntime from "react/jsx-runtime";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
import * as UI from "@rebasepro/ui";
|
|
15
|
+
import { useAggregate, useRow, useRowCount, useRowWrites, useRows } from "@rebasepro/app";
|
|
16
|
+
import { getCollectionDataPath } from "@rebasepro/types";
|
|
17
|
+
//#region src/mcp_view/app_modules.tsx
|
|
18
|
+
/**
|
|
19
|
+
* What an app the model wrote imports (show_app): the modules of
|
|
20
|
+
* `MCP_APP_MODULES`, each the package's own exports — `@rebasepro/cms`'s
|
|
21
|
+
* blocks, `@rebasepro/app`'s row hooks, the UI kit, React — so the code reads
|
|
22
|
+
* as Rebase code does anywhere, and the parts are the ones the admin panel is
|
|
23
|
+
* made of.
|
|
24
|
+
*
|
|
25
|
+
* One thing differs from the packages: an app was opened with a list of
|
|
26
|
+
* collections (show_app's `collections`), and every export that names one
|
|
27
|
+
* holds the app to it, with an error that says which it may use. The rows an
|
|
28
|
+
* app reads and writes go through the tool driver, as the person, under their
|
|
29
|
+
* RLS and their connection's scopes: that is what bounds an app, which can do
|
|
30
|
+
* nothing the model could not with the same tools. `useRowWrites` asks them
|
|
31
|
+
* before each write (`confirmingDriver` in `tool_driver.ts`), a courtesy
|
|
32
|
+
* against an app writing without a click; the admin's own controls in it — a
|
|
33
|
+
* form's Save, a delete — behave as on a show_collection screen. A form whose
|
|
34
|
+
* overrides make it save itself is not handed to an app: it would write on
|
|
35
|
+
* mount, unasked.
|
|
36
|
+
*/
|
|
37
|
+
/** The collections the app was opened with, by the names the model gave. */
|
|
38
|
+
var AppCollectionsContext = createContext(void 0);
|
|
39
|
+
/** Around an app's component: the collections its imports may name. */
|
|
40
|
+
function AppCollections({ names, children }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(AppCollectionsContext.Provider, {
|
|
42
|
+
value: names,
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Throws, for a collection the app was not opened with. A name counts by
|
|
48
|
+
* what the model listed, or by the collection it names — its slug or the
|
|
49
|
+
* name the tools take — so `orders` and the table it lives in are one.
|
|
50
|
+
*/
|
|
51
|
+
function useCollectionCheck() {
|
|
52
|
+
const allowed = useContext(AppCollectionsContext);
|
|
53
|
+
const registry = useCollectionRegistryController();
|
|
54
|
+
return useCallback((name) => {
|
|
55
|
+
if (allowed === void 0 || name === void 0 || allowed.includes(name)) return;
|
|
56
|
+
const collection = registry.getCollection(name);
|
|
57
|
+
if (collection && (allowed.includes(collection.slug) || allowed.includes(getCollectionDataPath(collection)))) return;
|
|
58
|
+
throw new Error(`"${name}" is not one of this app's collections (${allowed.join(", ")}). List it in show_app's \`collections\`.`);
|
|
59
|
+
}, [allowed, registry]);
|
|
60
|
+
}
|
|
61
|
+
function AppCollectionPanel(props) {
|
|
62
|
+
useCollectionCheck()(collectionPropOf(props.collection, props.path).path);
|
|
63
|
+
return /* @__PURE__ */ jsx(CollectionPanel, { ...props });
|
|
64
|
+
}
|
|
65
|
+
function AppRecordForm({ collectionOverrides, ...props }) {
|
|
66
|
+
useCollectionCheck()(collectionPropOf(props.collection, props.path).path);
|
|
67
|
+
const { formAutoSave: _formAutoSave, ...overrides } = collectionOverrides ?? {};
|
|
68
|
+
return /* @__PURE__ */ jsx(RecordForm, {
|
|
69
|
+
...props,
|
|
70
|
+
...collectionOverrides && { collectionOverrides: overrides }
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function AppRecordDetail(props) {
|
|
74
|
+
useCollectionCheck()(collectionPropOf(props.collection, props.path).path);
|
|
75
|
+
return /* @__PURE__ */ jsx(RecordDetail, { ...props });
|
|
76
|
+
}
|
|
77
|
+
function AppFieldValue(props) {
|
|
78
|
+
useCollectionCheck()(props.collection);
|
|
79
|
+
return /* @__PURE__ */ jsx(FieldValue, { ...props });
|
|
80
|
+
}
|
|
81
|
+
function useAppSidePanel() {
|
|
82
|
+
const check = useCollectionCheck();
|
|
83
|
+
const panel = useSidePanel();
|
|
84
|
+
return useMemo(() => {
|
|
85
|
+
const checked = (props) => {
|
|
86
|
+
check(props.path);
|
|
87
|
+
return props;
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
close: () => panel.close(),
|
|
91
|
+
open: (props) => panel.open(checked(props)),
|
|
92
|
+
replace: (props) => panel.replace(checked(props))
|
|
93
|
+
};
|
|
94
|
+
}, [panel, check]);
|
|
95
|
+
}
|
|
96
|
+
/** The row hooks, each held to the app's collections. */
|
|
97
|
+
var useAppRows = (collection, options) => {
|
|
98
|
+
useCollectionCheck()(collection);
|
|
99
|
+
return useRows(collection, options);
|
|
100
|
+
};
|
|
101
|
+
var useAppRow = (collection, id) => {
|
|
102
|
+
useCollectionCheck()(collection);
|
|
103
|
+
return useRow(collection, id);
|
|
104
|
+
};
|
|
105
|
+
var useAppRowCount = (collection, where) => {
|
|
106
|
+
useCollectionCheck()(collection);
|
|
107
|
+
return useRowCount(collection, where);
|
|
108
|
+
};
|
|
109
|
+
var useAppAggregate = (collection, params) => {
|
|
110
|
+
useCollectionCheck()(collection);
|
|
111
|
+
return useAggregate(collection, params);
|
|
112
|
+
};
|
|
113
|
+
/** Writes are checked when they are made: a refused one rejects, as a failed write does. */
|
|
114
|
+
function useAppRowWrites() {
|
|
115
|
+
const check = useCollectionCheck();
|
|
116
|
+
const writes = useRowWrites();
|
|
117
|
+
return useMemo(() => {
|
|
118
|
+
const checked = (collection, write) => {
|
|
119
|
+
try {
|
|
120
|
+
check(collection);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
return Promise.reject(error);
|
|
123
|
+
}
|
|
124
|
+
return write();
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
...writes,
|
|
128
|
+
create: (collection, values, id) => checked(collection, () => writes.create(collection, values, id)),
|
|
129
|
+
update: (collection, id, values) => checked(collection, () => writes.update(collection, id, values)),
|
|
130
|
+
remove: (collection, id) => checked(collection, () => writes.remove(collection, id))
|
|
131
|
+
};
|
|
132
|
+
}, [writes, check]);
|
|
133
|
+
}
|
|
134
|
+
/** Every module an app may import, by name. */
|
|
135
|
+
var APP_MODULE_EXPORTS = {
|
|
136
|
+
"react": React,
|
|
137
|
+
"react/jsx-runtime": jsxRuntime,
|
|
138
|
+
"@rebasepro/ui": UI,
|
|
139
|
+
"@rebasepro/app": {
|
|
140
|
+
useRows: useAppRows,
|
|
141
|
+
useRow: useAppRow,
|
|
142
|
+
useRowCount: useAppRowCount,
|
|
143
|
+
useAggregate: useAppAggregate,
|
|
144
|
+
useRowWrites: useAppRowWrites
|
|
145
|
+
},
|
|
146
|
+
"@rebasepro/cms": {
|
|
147
|
+
CollectionPanel: AppCollectionPanel,
|
|
148
|
+
CollectionToolbar,
|
|
149
|
+
CollectionSearchBar,
|
|
150
|
+
CollectionFiltersButton,
|
|
151
|
+
CollectionViewModeToggle,
|
|
152
|
+
CollectionAddButton,
|
|
153
|
+
RecordForm: AppRecordForm,
|
|
154
|
+
RecordDetail: AppRecordDetail,
|
|
155
|
+
FormField,
|
|
156
|
+
FieldValue: AppFieldValue,
|
|
157
|
+
useSidePanel: useAppSidePanel
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
//#endregion
|
|
161
|
+
export { APP_MODULE_EXPORTS, AppCollections };
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=app_modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app_modules.js","names":[],"sources":["../../src/mcp_view/app_modules.tsx"],"sourcesContent":["/**\n * What an app the model wrote imports (show_app): the modules of\n * `MCP_APP_MODULES`, each the package's own exports — `@rebasepro/cms`'s\n * blocks, `@rebasepro/app`'s row hooks, the UI kit, React — so the code reads\n * as Rebase code does anywhere, and the parts are the ones the admin panel is\n * made of.\n *\n * One thing differs from the packages: an app was opened with a list of\n * collections (show_app's `collections`), and every export that names one\n * holds the app to it, with an error that says which it may use. The rows an\n * app reads and writes go through the tool driver, as the person, under their\n * RLS and their connection's scopes: that is what bounds an app, which can do\n * nothing the model could not with the same tools. `useRowWrites` asks them\n * before each write (`confirmingDriver` in `tool_driver.ts`), a courtesy\n * against an app writing without a click; the admin's own controls in it — a\n * form's Save, a delete — behave as on a show_collection screen. A form whose\n * overrides make it save itself is not handed to an app: it would write on\n * mount, unasked.\n */\nimport React, { createContext, useCallback, useContext, useMemo } from \"react\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport * as UI from \"@rebasepro/ui\";\nimport { useAggregate, useRow, useRowCount, useRows, useRowWrites, type UseRowWritesResult } from \"@rebasepro/app\";\nimport type { SidePanelBindingProps, SidePanelController } from \"@rebasepro/cms-types\";\nimport {\n getCollectionDataPath,\n type McpAppModule,\n type McpAppModuleExport\n} from \"@rebasepro/types\";\nimport { CollectionPanel, type CollectionPanelProps } from \"../components/CollectionPanel\";\nimport { RecordForm, type RecordFormProps } from \"../components/RecordForm\";\nimport { RecordDetail, type RecordDetailProps } from \"../components/RecordDetail\";\nimport { FieldValue, type FieldValueProps } from \"../components/FieldValue\";\nimport {\n CollectionFiltersButton,\n CollectionSearchBar,\n CollectionToolbar,\n CollectionViewModeToggle\n} from \"../components/CollectionViewBinding/CollectionToolbar\";\nimport { CollectionAddButton } from \"../components/CollectionViewBinding/CollectionAddButton\";\nimport { FormField } from \"../form/FormField\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { collectionPropOf } from \"../components/collection_prop\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\n\n/** The collections the app was opened with, by the names the model gave. */\nconst AppCollectionsContext = createContext<readonly string[] | undefined>(undefined);\n\n/** Around an app's component: the collections its imports may name. */\nexport function AppCollections({ names, children }: { names: readonly string[]; children: React.ReactNode }) {\n return <AppCollectionsContext.Provider value={names}>{children}</AppCollectionsContext.Provider>;\n}\n\n/**\n * Throws, for a collection the app was not opened with. A name counts by\n * what the model listed, or by the collection it names — its slug or the\n * name the tools take — so `orders` and the table it lives in are one.\n */\nfunction useCollectionCheck(): (name: string | undefined) => void {\n const allowed = useContext(AppCollectionsContext);\n const registry = useCollectionRegistryController();\n return useCallback((name: string | undefined) => {\n if (allowed === undefined || name === undefined || allowed.includes(name)) return;\n const collection = registry.getCollection(name);\n if (collection && (allowed.includes(collection.slug)\n || allowed.includes(getCollectionDataPath(collection)))) return;\n throw new Error(`\"${name}\" is not one of this app's collections (${allowed.join(\", \")}). `\n + \"List it in show_app's `collections`.\");\n }, [allowed, registry]);\n}\n\nfunction AppCollectionPanel(props: CollectionPanelProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n return <CollectionPanel {...props}/>;\n}\n\nfunction AppRecordForm({ collectionOverrides, ...props }: RecordFormProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n // A form that saves itself writes the values it was seeded with on mount.\n const { formAutoSave: _formAutoSave, ...overrides } = collectionOverrides ?? {};\n return <RecordForm {...props} {...(collectionOverrides && { collectionOverrides: overrides })}/>;\n}\n\nfunction AppRecordDetail(props: RecordDetailProps) {\n useCollectionCheck()(collectionPropOf(props.collection, props.path).path);\n return <RecordDetail {...props}/>;\n}\n\nfunction AppFieldValue(props: FieldValueProps) {\n useCollectionCheck()(props.collection);\n return <FieldValue {...props}/>;\n}\n\nfunction useAppSidePanel(): SidePanelController {\n const check = useCollectionCheck();\n const panel = useSidePanel();\n return useMemo(() => {\n const checked = <M extends Record<string, unknown>>(props: SidePanelBindingProps<M>) => {\n check(props.path);\n return props;\n };\n return {\n close: () => panel.close(),\n open: props => panel.open(checked(props)),\n replace: props => panel.replace(checked(props))\n };\n }, [panel, check]);\n}\n\n/** The row hooks, each held to the app's collections. */\nconst useAppRows: typeof useRows = (collection, options) => {\n useCollectionCheck()(collection);\n return useRows(collection, options);\n};\n\nconst useAppRow: typeof useRow = (collection, id) => {\n useCollectionCheck()(collection);\n return useRow(collection, id);\n};\n\nconst useAppRowCount: typeof useRowCount = (collection, where) => {\n useCollectionCheck()(collection);\n return useRowCount(collection, where);\n};\n\nconst useAppAggregate: typeof useAggregate = (collection, params) => {\n useCollectionCheck()(collection);\n return useAggregate(collection, params);\n};\n\n/** Writes are checked when they are made: a refused one rejects, as a failed write does. */\nfunction useAppRowWrites(): UseRowWritesResult {\n const check = useCollectionCheck();\n const writes = useRowWrites();\n return useMemo(() => {\n const checked = <T, >(collection: string, write: () => Promise<T>): Promise<T> => {\n try {\n check(collection);\n } catch (error) {\n return Promise.reject(error);\n }\n return write();\n };\n return {\n ...writes,\n create: (collection, values, id) => checked(collection, () => writes.create(collection, values, id)),\n update: (collection, id, values) => checked(collection, () => writes.update(collection, id, values)),\n remove: (collection, id) => checked(collection, () => writes.remove(collection, id))\n };\n }, [writes, check]);\n}\n\n/** A module's served exports: exactly its names in `MCP_APP_MODULES`, no more, no fewer. */\ntype Served<M extends McpAppModule> = Record<McpAppModuleExport<M>, unknown>;\n\nconst APP_MODULE: Served<\"@rebasepro/app\"> = {\n useRows: useAppRows,\n useRow: useAppRow,\n useRowCount: useAppRowCount,\n useAggregate: useAppAggregate,\n useRowWrites: useAppRowWrites\n};\n\nconst CMS_MODULE: Served<\"@rebasepro/cms\"> = {\n CollectionPanel: AppCollectionPanel,\n CollectionToolbar,\n CollectionSearchBar,\n CollectionFiltersButton,\n CollectionViewModeToggle,\n CollectionAddButton,\n RecordForm: AppRecordForm,\n RecordDetail: AppRecordDetail,\n FormField,\n FieldValue: AppFieldValue,\n useSidePanel: useAppSidePanel\n};\n\n/** Every module an app may import, by name. */\nexport const APP_MODULE_EXPORTS: Record<McpAppModule, object> = {\n \"react\": React,\n \"react/jsx-runtime\": jsxRuntime,\n \"@rebasepro/ui\": UI,\n \"@rebasepro/app\": APP_MODULE,\n \"@rebasepro/cms\": CMS_MODULE\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAAM,wBAAwB,cAA6C,KAAA,CAAS;;AAGpF,SAAgB,eAAe,EAAE,OAAO,YAAqE;CACzG,OAAO,oBAAC,sBAAsB,UAAvB;EAAgC,OAAO;EAAQ;CAAyC,CAAA;AACnG;;;;;;AAOA,SAAS,qBAAyD;CAC9D,MAAM,UAAU,WAAW,qBAAqB;CAChD,MAAM,WAAW,gCAAgC;CACjD,OAAO,aAAa,SAA6B;EAC7C,IAAI,YAAY,KAAA,KAAa,SAAS,KAAA,KAAa,QAAQ,SAAS,IAAI,GAAG;EAC3E,MAAM,aAAa,SAAS,cAAc,IAAI;EAC9C,IAAI,eAAe,QAAQ,SAAS,WAAW,IAAI,KAC5C,QAAQ,SAAS,sBAAsB,UAAU,CAAC,IAAI;EAC7D,MAAM,IAAI,MAAM,IAAI,KAAK,0CAA0C,QAAQ,KAAK,IAAI,EAAE,0CAC1C;CAChD,GAAG,CAAC,SAAS,QAAQ,CAAC;AAC1B;AAEA,SAAS,mBAAmB,OAA6B;CACrD,mBAAmB,CAAC,CAAC,iBAAiB,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC,IAAI;CACxE,OAAO,oBAAC,iBAAD,EAAiB,GAAI,MAAO,CAAA;AACvC;AAEA,SAAS,cAAc,EAAE,qBAAqB,GAAG,SAA0B;CACvE,mBAAmB,CAAC,CAAC,iBAAiB,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC,IAAI;CAExE,MAAM,EAAE,cAAc,eAAe,GAAG,cAAc,uBAAuB,CAAC;CAC9E,OAAO,oBAAC,YAAD;EAAY,GAAI;EAAO,GAAK,uBAAuB,EAAE,qBAAqB,UAAU;CAAI,CAAA;AACnG;AAEA,SAAS,gBAAgB,OAA0B;CAC/C,mBAAmB,CAAC,CAAC,iBAAiB,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC,IAAI;CACxE,OAAO,oBAAC,cAAD,EAAc,GAAI,MAAO,CAAA;AACpC;AAEA,SAAS,cAAc,OAAwB;CAC3C,mBAAmB,CAAC,CAAC,MAAM,UAAU;CACrC,OAAO,oBAAC,YAAD,EAAY,GAAI,MAAO,CAAA;AAClC;AAEA,SAAS,kBAAuC;CAC5C,MAAM,QAAQ,mBAAmB;CACjC,MAAM,QAAQ,aAAa;CAC3B,OAAO,cAAc;EACjB,MAAM,WAA8C,UAAoC;GACpF,MAAM,MAAM,IAAI;GAChB,OAAO;EACX;EACA,OAAO;GACH,aAAa,MAAM,MAAM;GACzB,OAAM,UAAS,MAAM,KAAK,QAAQ,KAAK,CAAC;GACxC,UAAS,UAAS,MAAM,QAAQ,QAAQ,KAAK,CAAC;EAClD;CACJ,GAAG,CAAC,OAAO,KAAK,CAAC;AACrB;;AAGA,IAAM,cAA8B,YAAY,YAAY;CACxD,mBAAmB,CAAC,CAAC,UAAU;CAC/B,OAAO,QAAQ,YAAY,OAAO;AACtC;AAEA,IAAM,aAA4B,YAAY,OAAO;CACjD,mBAAmB,CAAC,CAAC,UAAU;CAC/B,OAAO,OAAO,YAAY,EAAE;AAChC;AAEA,IAAM,kBAAsC,YAAY,UAAU;CAC9D,mBAAmB,CAAC,CAAC,UAAU;CAC/B,OAAO,YAAY,YAAY,KAAK;AACxC;AAEA,IAAM,mBAAwC,YAAY,WAAW;CACjE,mBAAmB,CAAC,CAAC,UAAU;CAC/B,OAAO,aAAa,YAAY,MAAM;AAC1C;;AAGA,SAAS,kBAAsC;CAC3C,MAAM,QAAQ,mBAAmB;CACjC,MAAM,SAAS,aAAa;CAC5B,OAAO,cAAc;EACjB,MAAM,WAAgB,YAAoB,UAAwC;GAC9E,IAAI;IACA,MAAM,UAAU;GACpB,SAAS,OAAO;IACZ,OAAO,QAAQ,OAAO,KAAK;GAC/B;GACA,OAAO,MAAM;EACjB;EACA,OAAO;GACH,GAAG;GACH,SAAS,YAAY,QAAQ,OAAO,QAAQ,kBAAkB,OAAO,OAAO,YAAY,QAAQ,EAAE,CAAC;GACnG,SAAS,YAAY,IAAI,WAAW,QAAQ,kBAAkB,OAAO,OAAO,YAAY,IAAI,MAAM,CAAC;GACnG,SAAS,YAAY,OAAO,QAAQ,kBAAkB,OAAO,OAAO,YAAY,EAAE,CAAC;EACvF;CACJ,GAAG,CAAC,QAAQ,KAAK,CAAC;AACtB;;AA4BA,IAAa,qBAAmD;CAC5D,SAAS;CACT,qBAAqB;CACrB,iBAAiB;CACjB,kBAAkB;EA1BlB,SAAS;EACT,QAAQ;EACR,aAAa;EACb,cAAc;EACd,cAAc;CAsBI;CAClB,kBAAkB;EAnBlB,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ,cAAc;EACd;EACA,YAAY;EACZ,cAAc;CASI;AACtB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The view's side of the MCP Apps protocol (`io.modelcontextprotocol/ui`,
|
|
3
|
+
* revision 2026-01-26): JSON-RPC 2.0 over `postMessage` with the host window.
|
|
4
|
+
*
|
|
5
|
+
* Hand-written rather than taken from `@modelcontextprotocol/ext-apps`, whose
|
|
6
|
+
* `App` carries the MCP SDK and zod — half a megabyte, in a document a host
|
|
7
|
+
* downloads for every table it shows. A view needs a handful of messages:
|
|
8
|
+
*
|
|
9
|
+
* - `ui/initialize` → the host's context (theme, display mode), then
|
|
10
|
+
* `ui/notifications/initialized`;
|
|
11
|
+
* - the host's `ui/notifications/tool-input` and `…/tool-result`: the call
|
|
12
|
+
* that opened this view, and its answer;
|
|
13
|
+
* - `tools/call`, which the host relays to the MCP server with its own
|
|
14
|
+
* credential — the view holds none;
|
|
15
|
+
* - `ui/update-model-context`, to tell the model what the person did here;
|
|
16
|
+
* - `ui/notifications/size-changed`, so the host sizes the iframe to fit;
|
|
17
|
+
* - `ui/request-display-mode`, to open the view fullscreen where the host
|
|
18
|
+
* offers it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const APPS_PROTOCOL_VERSION = "2026-01-26";
|
|
21
|
+
export interface ToolResult {
|
|
22
|
+
content?: Array<{
|
|
23
|
+
type: string;
|
|
24
|
+
text?: string;
|
|
25
|
+
}>;
|
|
26
|
+
structuredContent?: unknown;
|
|
27
|
+
isError?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export type DisplayMode = "inline" | "fullscreen" | "pip";
|
|
30
|
+
export interface HostContext {
|
|
31
|
+
theme?: "light" | "dark";
|
|
32
|
+
displayMode?: DisplayMode;
|
|
33
|
+
/** The modes the host will show this view in; absent, only the one it is in. */
|
|
34
|
+
availableDisplayModes?: DisplayMode[];
|
|
35
|
+
locale?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The host end of the channel: the parent window, in a host. */
|
|
38
|
+
export interface HostWindow {
|
|
39
|
+
postMessage(message: unknown, targetOrigin: string): void;
|
|
40
|
+
}
|
|
41
|
+
export declare class McpAppBridge {
|
|
42
|
+
onhostcontext?: (context: HostContext) => void;
|
|
43
|
+
/** Everything the host has said about its context so far, each update merged in. */
|
|
44
|
+
hostContext: HostContext;
|
|
45
|
+
private readonly contextWatchers;
|
|
46
|
+
/** Called with the whole context now and on every change; returns the unsubscribe. */
|
|
47
|
+
watchHostContext(watcher: (context: HostContext) => void): () => void;
|
|
48
|
+
/**
|
|
49
|
+
* The call that opened this view, and its answer. Kept, because the host
|
|
50
|
+
* may send them before a handler is set — a React effect runs after the
|
|
51
|
+
* first paint — and it sends each once.
|
|
52
|
+
*/
|
|
53
|
+
toolInput?: Record<string, unknown>;
|
|
54
|
+
toolResult?: ToolResult;
|
|
55
|
+
private inputHandler?;
|
|
56
|
+
private resultHandler?;
|
|
57
|
+
set ontoolinput(handler: ((args: Record<string, unknown>) => void) | undefined);
|
|
58
|
+
set ontoolresult(handler: ((result: ToolResult) => void) | undefined);
|
|
59
|
+
private nextId;
|
|
60
|
+
private connected;
|
|
61
|
+
private height?;
|
|
62
|
+
private readonly pending;
|
|
63
|
+
private readonly host;
|
|
64
|
+
/** `events` is where the host's messages arrive: this view's window. */
|
|
65
|
+
constructor(host?: HostWindow, events?: EventTarget);
|
|
66
|
+
connect(appInfo: {
|
|
67
|
+
name: string;
|
|
68
|
+
version: string;
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
/** A tool on this view's MCP server, called through the host. */
|
|
71
|
+
callTool(name: string, args: Record<string, unknown>): Promise<ToolResult>;
|
|
72
|
+
/**
|
|
73
|
+
* What the model should know about this view, sent with the person's next
|
|
74
|
+
* message. Each call replaces the last.
|
|
75
|
+
*/
|
|
76
|
+
updateModelContext(text: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Ask the host to show this view in `mode`. The answer is the mode it is
|
|
79
|
+
* in now, which may not be the one asked for.
|
|
80
|
+
*/
|
|
81
|
+
requestDisplayMode(mode: DisplayMode): Promise<DisplayMode | undefined>;
|
|
82
|
+
/** The document's height, for the host to size the iframe to. Sent when it changes. */
|
|
83
|
+
sizeChanged(height: number): void;
|
|
84
|
+
private contextChanged;
|
|
85
|
+
private request;
|
|
86
|
+
private notify;
|
|
87
|
+
private respond;
|
|
88
|
+
private readonly receive;
|
|
89
|
+
}
|
|
90
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|