@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
|
@@ -3,11 +3,15 @@ import { useNavigationStateController } from "../hooks/navigation/contexts/Navig
|
|
|
3
3
|
import { EntityFormBinding } from "../form/EntityFormBinding.js";
|
|
4
4
|
import { CollectionsScopeContext, isRegistered } from "./CollectionsScopeContext.js";
|
|
5
5
|
import { CollectionsProvider } from "./CollectionsProvider.js";
|
|
6
|
+
import { collectionPropOf } from "./collection_prop.js";
|
|
7
|
+
import { PanelNotFound } from "./PanelNotFound.js";
|
|
6
8
|
import { createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
10
|
+
import { deepEqual } from "fast-equals";
|
|
11
|
+
import { Alert, Button, CenteredView, CircularProgressCenter } from "@rebasepro/ui";
|
|
12
|
+
import { warnDeprecated } from "@rebasepro/common";
|
|
13
|
+
import { CollectionScopeProvider, ErrorView, entityOfRow, rowOfEntity, useFetch, usePermissions, useTranslation } from "@rebasepro/app";
|
|
14
|
+
//#region src/components/RecordForm.tsx
|
|
11
15
|
/**
|
|
12
16
|
* One record's form — loaded by id, saved through `<Rebase>`'s data layer —
|
|
13
17
|
* to drop into a page of your own app.
|
|
@@ -21,39 +25,55 @@ import { CollectionScopeProvider, ErrorView, useFetch, usePermissions, useTransl
|
|
|
21
25
|
* ```tsx
|
|
22
26
|
* <Rebase client={client} authController={authController}>
|
|
23
27
|
* <BrowserRouter>
|
|
24
|
-
* <
|
|
25
|
-
* onSaved={({
|
|
28
|
+
* <RecordForm collection={postsCollection} id="123"
|
|
29
|
+
* onSaved={({ id }) => toast(`Saved ${id}`)}/>
|
|
26
30
|
* </BrowserRouter>
|
|
27
31
|
* </Rebase>
|
|
28
32
|
* ```
|
|
29
33
|
*
|
|
30
34
|
* @group Components
|
|
31
35
|
*/
|
|
32
|
-
function
|
|
36
|
+
function RecordForm(rawProps) {
|
|
33
37
|
const inScope = useContext(CollectionsScopeContext);
|
|
34
38
|
const collectionRegistry = useCollectionRegistryController();
|
|
35
39
|
const navigationState = useNavigationStateController();
|
|
36
|
-
const { collection } =
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
const { collection, path } = collectionPropOf(rawProps.collection, rawProps.path);
|
|
41
|
+
const props = {
|
|
42
|
+
...rawProps,
|
|
43
|
+
collection,
|
|
44
|
+
path
|
|
45
|
+
};
|
|
46
|
+
const ownCollections = useMemo(() => collection ? [collection] : [], [collection]);
|
|
47
|
+
const needsOwnScope = collection !== void 0 && (!inScope || !navigationState.loading && !isRegistered(collectionRegistry.collections, path));
|
|
48
|
+
const recordKey = `${path}/${props.id ?? "new"}`;
|
|
49
|
+
if (!inScope && collection === void 0) return /* @__PURE__ */ jsx(PanelNotFound, { className: props.className });
|
|
40
50
|
if (needsOwnScope) return /* @__PURE__ */ jsx(CollectionsProvider, {
|
|
41
51
|
collections: ownCollections,
|
|
42
|
-
children: /* @__PURE__ */ jsx(
|
|
52
|
+
children: /* @__PURE__ */ jsx(RecordFormInScope, { ...props }, recordKey)
|
|
43
53
|
});
|
|
44
|
-
return /* @__PURE__ */ jsx(
|
|
54
|
+
return /* @__PURE__ */ jsx(RecordFormInScope, { ...props }, recordKey);
|
|
45
55
|
}
|
|
46
|
-
function
|
|
56
|
+
function RecordFormInScope({ collection: collectionProp, id: entityId, path: pathProp, onSaved, onClose, defaultValues, className, fields, children, compact, collectionOverrides, formProps }) {
|
|
47
57
|
const { t } = useTranslation();
|
|
48
|
-
const path = pathProp
|
|
58
|
+
const path = pathProp;
|
|
49
59
|
const collectionRegistry = useCollectionRegistryController();
|
|
50
60
|
const navigationState = useNavigationStateController();
|
|
51
61
|
const { canCreate, canEdit } = usePermissions();
|
|
62
|
+
const overridesRef = useRef(collectionOverrides);
|
|
63
|
+
if (!deepEqual(overridesRef.current, collectionOverrides)) overridesRef.current = collectionOverrides;
|
|
64
|
+
const stableOverrides = overridesRef.current;
|
|
52
65
|
const lookUp = collectionRegistry.initialised || !navigationState.loading;
|
|
53
|
-
const collection = useMemo(() =>
|
|
66
|
+
const collection = useMemo(() => {
|
|
67
|
+
const registered = lookUp ? collectionRegistry.getCollection(path) : void 0;
|
|
68
|
+
return registered && stableOverrides ? {
|
|
69
|
+
...registered,
|
|
70
|
+
...stableOverrides
|
|
71
|
+
} : registered;
|
|
72
|
+
}, [
|
|
54
73
|
lookUp,
|
|
55
74
|
collectionRegistry,
|
|
56
|
-
path
|
|
75
|
+
path,
|
|
76
|
+
stableOverrides
|
|
57
77
|
]);
|
|
58
78
|
const { entity, dataLoading, dataLoadingError } = useFetch({
|
|
59
79
|
path,
|
|
@@ -81,14 +101,7 @@ function EntityFormPanelInScope({ collection: collectionProp, entityId, path: pa
|
|
|
81
101
|
}, [lastSeenEntity]);
|
|
82
102
|
if (!collection) {
|
|
83
103
|
if (navigationState.loading) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
84
|
-
return /* @__PURE__ */ jsx(
|
|
85
|
-
className,
|
|
86
|
-
children: /* @__PURE__ */ jsx(Typography, {
|
|
87
|
-
variant: "body2",
|
|
88
|
-
color: "secondary",
|
|
89
|
-
children: t("entity_not_found")
|
|
90
|
-
})
|
|
91
|
-
});
|
|
104
|
+
return /* @__PURE__ */ jsx(PanelNotFound, { className });
|
|
92
105
|
}
|
|
93
106
|
if (asNew) return /* @__PURE__ */ jsx(CollectionScopeProvider, {
|
|
94
107
|
collection,
|
|
@@ -98,16 +111,20 @@ function EntityFormPanelInScope({ collection: collectionProp, entityId, path: pa
|
|
|
98
111
|
className: className ?? formProps?.className,
|
|
99
112
|
path,
|
|
100
113
|
collection,
|
|
101
|
-
|
|
114
|
+
row: asNew.saved ? rowOfEntity(asNew.saved, collection) : void 0,
|
|
102
115
|
initialStatus: "new",
|
|
103
116
|
initialDirtyValues: asNew.values,
|
|
117
|
+
fields,
|
|
118
|
+
layout: children,
|
|
119
|
+
compact,
|
|
104
120
|
disabled: !canCreate(collection, path) || formProps?.disabled,
|
|
105
|
-
|
|
121
|
+
onRowChange: (changed) => {
|
|
122
|
+
const saved = entityOfRow(changed.row, changed.id, path, collection);
|
|
106
123
|
setAsNew((current) => current && {
|
|
107
124
|
...current,
|
|
108
|
-
saved
|
|
125
|
+
saved
|
|
109
126
|
});
|
|
110
|
-
formProps?.
|
|
127
|
+
formProps?.onRowChange?.(changed);
|
|
111
128
|
},
|
|
112
129
|
onSaved: (params) => {
|
|
113
130
|
formProps?.onSaved?.(params);
|
|
@@ -122,7 +139,7 @@ function EntityFormPanelInScope({ collection: collectionProp, entityId, path: pa
|
|
|
122
139
|
});
|
|
123
140
|
if (entityId !== void 0 && !shownEntity && dataLoading) return /* @__PURE__ */ jsx(CircularProgressCenter, {});
|
|
124
141
|
const creating = shownEntity === void 0;
|
|
125
|
-
const editable = creating ? canCreate(collection, path) : canEdit(collection, path, shownEntity);
|
|
142
|
+
const editable = creating ? canCreate(collection, path) : canEdit(collection, path, shownEntity?.values ?? null);
|
|
126
143
|
return /* @__PURE__ */ jsx(CollectionScopeProvider, {
|
|
127
144
|
collection,
|
|
128
145
|
children: /* @__PURE__ */ jsxs(EntityFormBinding, {
|
|
@@ -130,14 +147,17 @@ function EntityFormPanelInScope({ collection: collectionProp, entityId, path: pa
|
|
|
130
147
|
className: className ?? formProps?.className,
|
|
131
148
|
path,
|
|
132
149
|
collection,
|
|
133
|
-
entityId,
|
|
134
|
-
|
|
150
|
+
id: entityId,
|
|
151
|
+
row: shownEntity ? rowOfEntity(shownEntity, collection) : void 0,
|
|
135
152
|
initialStatus: creating ? "new" : "existing",
|
|
136
153
|
initialDirtyValues: creating ? defaultValues : formProps?.initialDirtyValues,
|
|
154
|
+
fields,
|
|
155
|
+
layout: children,
|
|
156
|
+
compact,
|
|
137
157
|
disabled: !editable || formProps?.disabled,
|
|
138
|
-
|
|
139
|
-
setSavedEntity(changed);
|
|
140
|
-
formProps?.
|
|
158
|
+
onRowChange: (changed) => {
|
|
159
|
+
setSavedEntity(entityOfRow(changed.row, changed.id, path, collection));
|
|
160
|
+
formProps?.onRowChange?.(changed);
|
|
141
161
|
},
|
|
142
162
|
onValuesModified: (modified, values) => {
|
|
143
163
|
typedValues.current = values;
|
|
@@ -163,7 +183,15 @@ function EntityFormPanelInScope({ collection: collectionProp, entityId, path: pa
|
|
|
163
183
|
})
|
|
164
184
|
});
|
|
165
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Renamed {@link RecordForm}, with the same props. It warns once.
|
|
188
|
+
* @group Components
|
|
189
|
+
*/
|
|
190
|
+
function EntityFormPanel(props) {
|
|
191
|
+
warnDeprecated("EntityFormPanel", "`EntityFormPanel` is now `RecordForm`, with the same props.");
|
|
192
|
+
return /* @__PURE__ */ jsx(RecordForm, { ...props });
|
|
193
|
+
}
|
|
166
194
|
//#endregion
|
|
167
|
-
export { EntityFormPanel };
|
|
195
|
+
export { EntityFormPanel, RecordForm };
|
|
168
196
|
|
|
169
|
-
//# sourceMappingURL=
|
|
197
|
+
//# sourceMappingURL=RecordForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordForm.js","names":[],"sources":["../../src/components/RecordForm.tsx"],"sourcesContent":["import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\";\nimport { warnDeprecated } from \"@rebasepro/common\";\nimport type { Entity } from \"@rebasepro/types\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport { Alert, Button, CenteredView, CircularProgressCenter } from \"@rebasepro/ui\";\nimport { CollectionScopeProvider, entityOfRow, ErrorView, rowOfEntity, useFetch, usePermissions, useTranslation } from \"@rebasepro/app\";\n\nimport { EntityFormBinding } from \"../form/EntityFormBinding\";\nimport type { EntityFormBindingProps } from \"../form/EntityFormBinding\";\nimport type { OnSavedParams } from \"../types/components/EntityFormProps\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useNavigationStateController } from \"../hooks/navigation/contexts/NavigationStateContext\";\nimport { CollectionsScopeContext, isRegistered } from \"./CollectionsScopeContext\";\nimport { CollectionsProvider } from \"./CollectionsProvider\";\nimport { PanelNotFound } from \"./PanelNotFound\";\nimport { collectionPropOf, type ScopedRecordPanelProps } from \"./collection_prop\";\n\n/**\n * Props for {@link RecordForm}.\n *\n * @group Components\n */\nexport type RecordFormProps<M extends Record<string, unknown> = Record<string, unknown>> =\n RecordFormOptions<M> & RecordPanelCollection<M>;\n\n/**\n * Which collection a record panel's record belongs to: named, the way\n * {@link CollectionPanel} names it, or handed over as a value.\n *\n * @group Components\n */\nexport type RecordPanelCollection<M extends Record<string, unknown> = Record<string, unknown>> = {\n /**\n * The collection the record belongs to: its name (`\"orders\"`), registered\n * with `<RebaseCMS>` or a {@link CollectionsProvider} above, or the\n * collection as a value — a `defineCollection` config or a resolved\n * collection. Handed over as a value where no CMS navigation is mounted\n * above, the panel brings its own {@link CollectionsProvider} for it.\n */\n collection: AdminCollection<M> | string;\n /**\n * Where the record lives, where that is not the collection's name: a\n * subcollection's full path, `posts/p1/comments`.\n */\n path?: string;\n};\n\n/**\n * The options of an {@link RecordForm}, beside its collection.\n *\n * @group Components\n */\nexport type RecordFormOptions<M extends Record<string, unknown> = Record<string, unknown>> = {\n /**\n * The record to edit. When no record has this id yet, the form creates\n * it under this id — so a record kept at a known key (a settings record,\n * a profile keyed by its user's id) needs no seeding. Omit it to create a\n * new record under an id the data source assigns.\n */\n id?: string | number;\n\n /** Called after every successful save, with the saved record. */\n onSaved?: (params: OnSavedParams) => void;\n\n /**\n * Called when the form asks to be left — after its record is deleted, or\n * by an action that closes it. The form is your page's, so where that\n * leads is yours to say; without it, nothing happens.\n */\n onClose?: () => void;\n\n /** Values a new record starts with — one created without an id, or under an id no record has yet. */\n defaultValues?: Partial<M>;\n\n className?: string;\n\n /**\n * The fields the form shows, in this order; any other property is left\n * out. Sections and the rail keep their grouping, each holding only these\n * fields. The form validates only what it shows, and, creating a record,\n * refuses with an error naming them when a required field it leaves out\n * has no default value and is not filled by the server or the database.\n */\n fields?: string[];\n\n /**\n * A denser form, for a side card or a narrow panel: no rail beside the\n * fields, no record metadata, medium-height controls and tighter padding.\n */\n compact?: boolean;\n\n /**\n * Your own arrangement of the fields, in place of the generated ones:\n * `<FormField name=\"…\"/>`s inside any JSX. Validation covers the fields\n * its `<FormField>`s render, with the same create-time check as\n * {@link fields}. Wins over the collection's `formView.Builder`.\n *\n * ```tsx\n * <RecordForm collection=\"orders\" id={id}>\n * <div className=\"grid grid-cols-2 gap-3\">\n * <FormField name=\"status\"/>\n * <FormField name=\"tracking_number\"/>\n * </div>\n * <FormField name=\"notes\"/>\n * </RecordForm>\n * ```\n */\n children?: React.ReactNode;\n\n /**\n * Collection settings for this form only, applied over the registered\n * collection the way `CollectionPanel` applies its own: a shallow merge,\n * so `properties` given here replaces the collection's whole map.\n */\n collectionOverrides?: Partial<AdminCollection>;\n\n /** Anything else {@link EntityFormBinding} takes. */\n formProps?: Partial<Omit<EntityFormBindingProps<M>, \"path\" | \"collection\" | \"id\" | \"row\" | \"initialStatus\" | \"fields\" | \"layout\" | \"compact\">>;\n};\n\n/**\n * One record's form — loaded by id, saved through `<Rebase>`'s data layer —\n * to drop into a page of your own app.\n *\n * Needs `<Rebase>` and a React Router router above it (any router, any path).\n * Where no CMS navigation is mounted above, it brings its own\n * {@link CollectionsProvider}, so `<RebaseCMS>`, `<RebaseNavigation>` and\n * `<RebaseShell>` are not needed.\n *\n * @example\n * ```tsx\n * <Rebase client={client} authController={authController}>\n * <BrowserRouter>\n * <RecordForm collection={postsCollection} id=\"123\"\n * onSaved={({ id }) => toast(`Saved ${id}`)}/>\n * </BrowserRouter>\n * </Rebase>\n * ```\n *\n * @group Components\n */\nexport function RecordForm<M extends Record<string, unknown> = Record<string, unknown>>(rawProps: RecordFormProps<M>) {\n const inScope = useContext(CollectionsScopeContext);\n const collectionRegistry = useCollectionRegistryController();\n const navigationState = useNavigationStateController();\n const { collection, path } = collectionPropOf<AdminCollection<M>>(rawProps.collection, rawProps.path);\n const props: ScopedRecordPanelProps<RecordFormOptions<M>, M> = { ...rawProps, collection, path };\n const ownCollections = useMemo(() => collection ? [collection] : [], [collection]);\n\n // As `CollectionPanel`: a collection handed over as a value brings its own\n // scope where none is above, or where the one above has settled without\n // it. One named by path is looked up in the scope above.\n const needsOwnScope = collection !== undefined && (!inScope\n || (!navigationState.loading && !isRegistered(collectionRegistry.collections, path)));\n // One form per record: the binding keeps the id and status it mounted\n // with, so a page that hands over another id (a route `/posts/:id` going\n // from p1 to p2) gets a fresh form instead of one that shows p2 and saves\n // into p1. Keyed on the prop, so the id a create assigns keeps the form.\n const recordKey = `${path}/${props.id ?? \"new\"}`;\n // Named by path with no scope above to look it up in: nothing will ever\n // register it, so it is not found rather than loading.\n if (!inScope && collection === undefined) return <PanelNotFound className={props.className}/>;\n if (needsOwnScope) {\n return (\n <CollectionsProvider collections={ownCollections}>\n <RecordFormInScope key={recordKey} {...props}/>\n </CollectionsProvider>\n );\n }\n return <RecordFormInScope key={recordKey} {...props}/>;\n}\n\nfunction RecordFormInScope<M extends Record<string, unknown>>({\n collection: collectionProp,\n id: entityId,\n path: pathProp,\n onSaved,\n onClose,\n defaultValues,\n className,\n fields,\n children,\n compact,\n collectionOverrides,\n formProps\n}: ScopedRecordPanelProps<RecordFormOptions<M>, M>) {\n const { t } = useTranslation();\n const path = pathProp;\n const collectionRegistry = useCollectionRegistryController<Record<string, unknown>, AdminCollection<M>>();\n const navigationState = useNavigationStateController();\n const { canCreate, canEdit } = usePermissions();\n\n // The registry's copy: it carries the plugins' changes and the user's\n // saved overrides.\n // Looked up once per registry: each lookup builds a new object, and the\n // record's subscription is keyed on the collection it was opened with.\n // The overrides are compared by value for the same reason: they are an\n // inline object at most call sites, a new one on every render.\n const overridesRef = useRef(collectionOverrides);\n if (!equal(overridesRef.current, collectionOverrides)) overridesRef.current = collectionOverrides;\n const stableOverrides = overridesRef.current;\n const lookUp = collectionRegistry.initialised || !navigationState.loading;\n const collection = useMemo(() => {\n const registered = lookUp ? collectionRegistry.getCollection(path) : undefined;\n return registered && stableOverrides\n ? { ...registered, ...stableOverrides } as AdminCollection<M>\n : registered;\n }, [lookUp, collectionRegistry, path, stableOverrides]);\n\n const { entity, dataLoading, dataLoadingError } = useFetch<M>({\n path,\n entityId,\n collection: collection ?? collectionProp,\n relations: true,\n useCache: false\n });\n\n // The record as the form last saved it. A record created here has no id\n // to read it back by from the outside, and the form, existing from then\n // on, needs it.\n const [savedEntity, setSavedEntity] = useState<Entity<M> | undefined>(undefined);\n\n // The record as it was last delivered. A live read that stops delivering\n // it — someone deleted it — is not a record that was never there: as in\n // the CMS's own edit view, the form keeps showing it, with what was typed,\n // and says so. Without this the form lost its record mid-edit and threw.\n const [lastSeenEntity, setLastSeenEntity] = useState<Entity<M> | undefined>(undefined);\n useEffect(() => {\n if (entity) setLastSeenEntity(entity);\n }, [entity]);\n // \"Save as new\": the same values, in a form that creates a record. Counted,\n // so that each one is a fresh form.\n const [asNew, setAsNew] = useState<{ values: Partial<M>, n: number, saved?: Entity<M> } | null>(null);\n const typedValues = useRef<Partial<M> | undefined>(undefined);\n const deletedElsewhere = !asNew && entityId !== undefined && !dataLoading && !entity\n && lastSeenEntity !== undefined && String(lastSeenEntity.id) === String(entityId);\n const shownEntity = deletedElsewhere ? lastSeenEntity : (entity ?? savedEntity);\n\n const navigateBack = useCallback(() => onClose?.(), [onClose]);\n const saveAsNew = useCallback(() => {\n const values: Partial<M> = typedValues.current ?? lastSeenEntity?.values ?? {};\n setAsNew(previous => ({ values, n: (previous?.n ?? 0) + 1 }));\n }, [lastSeenEntity]);\n\n if (!collection) {\n if (navigationState.loading) return <CircularProgressCenter/>;\n return <PanelNotFound className={className}/>;\n }\n\n if (asNew) {\n return (\n <CollectionScopeProvider collection={collection}>\n <EntityFormBinding<M>\n {...formProps}\n key={`as-new-${asNew.n}`}\n className={className ?? formProps?.className}\n path={path}\n collection={collection}\n row={asNew.saved ? rowOfEntity(asNew.saved, collection) : undefined}\n initialStatus={\"new\"}\n initialDirtyValues={asNew.values}\n fields={fields}\n layout={children}\n compact={compact}\n disabled={!canCreate(collection, path) || formProps?.disabled}\n onRowChange={(changed) => {\n // The record it created, which it edits from then on.\n const saved = entityOfRow(changed.row, changed.id, path, collection) as Entity<M>;\n setAsNew(current => current && { ...current, saved });\n formProps?.onRowChange?.(changed);\n }}\n onSaved={(params) => {\n formProps?.onSaved?.(params);\n onSaved?.(params);\n }}\n navigateBack={navigateBack}\n />\n </CollectionScopeProvider>\n );\n }\n\n if (entityId !== undefined && dataLoadingError) {\n return <CenteredView className={className}><ErrorView error={dataLoadingError}/></CenteredView>;\n }\n if (entityId !== undefined && !shownEntity && dataLoading) return <CircularProgressCenter/>;\n\n // An id no record has yet is a record to create under that id. The form\n // keeps the status it opened with, so once it creates the record it edits\n // it from then on.\n const creating = shownEntity === undefined;\n // As the CMS's own New button and save actions: a record to create needs\n // canCreate (false while access is simulated), an existing one canEdit.\n const editable = creating ? canCreate(collection, path) : canEdit(collection, path, shownEntity?.values ?? null);\n\n return (\n <CollectionScopeProvider collection={collection}>\n <EntityFormBinding<M>\n {...formProps}\n className={className ?? formProps?.className}\n path={path}\n collection={collection}\n id={entityId}\n row={shownEntity ? rowOfEntity(shownEntity, collection) : undefined}\n initialStatus={creating ? \"new\" : \"existing\"}\n initialDirtyValues={creating ? defaultValues : formProps?.initialDirtyValues}\n fields={fields}\n layout={children}\n compact={compact}\n disabled={!editable || formProps?.disabled}\n onRowChange={(changed) => {\n setSavedEntity(entityOfRow(changed.row, changed.id, path, collection) as Entity<M>);\n formProps?.onRowChange?.(changed);\n }}\n onValuesModified={(modified, values) => {\n typedValues.current = values;\n formProps?.onValuesModified?.(modified, values);\n }}\n onSaved={(params) => {\n formProps?.onSaved?.(params);\n onSaved?.(params);\n }}\n navigateBack={navigateBack}\n >\n {deletedElsewhere &&\n <Alert color={\"warning\"} size={\"small\"} outerClassName={\"w-full mb-4\"}\n action={<Button size={\"small\"} variant={\"text\"} onClick={saveAsNew}>{t(\"save_as_new\")}</Button>}>\n {t(\"entity_deleted_elsewhere\")}\n </Alert>}\n {formProps?.children}\n </EntityFormBinding>\n </CollectionScopeProvider>\n );\n}\n\n/**\n * @deprecated Renamed {@link RecordForm}, with the same props. It warns once.\n * @group Components\n */\nexport type EntityFormPanelProps<M extends Record<string, unknown> = Record<string, unknown>> = RecordFormProps<M>;\n\n/**\n * @deprecated Renamed {@link RecordForm}, with the same props. It warns once.\n * @group Components\n */\nexport function EntityFormPanel<M extends Record<string, unknown> = Record<string, unknown>>(props: RecordFormProps<M>) {\n warnDeprecated(\"EntityFormPanel\", \"`EntityFormPanel` is now `RecordForm`, with the same props.\");\n return <RecordForm<M> {...props}/>;\n}\n"],"mappings":"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"}
|
|
@@ -2,6 +2,12 @@ import React from "react";
|
|
|
2
2
|
import { Entity, FilterValues } from "@rebasepro/types";
|
|
3
3
|
import { AdminCollection } from "@rebasepro/cms-types";
|
|
4
4
|
/**
|
|
5
|
+
* What {@link useSelectionDialog} and {@link SelectionTableBinding} take: a
|
|
6
|
+
* collection to pick rows from, and what to do with the rows picked. The rows
|
|
7
|
+
* are the server's, as `useRows` returns them, and each callback is handed
|
|
8
|
+
* their ids beside them — the strings `selectedIds` and `useSidePanel().open`
|
|
9
|
+
* take.
|
|
10
|
+
*
|
|
5
11
|
* @group Components
|
|
6
12
|
*/
|
|
7
13
|
export interface SelectionProps<M extends Record<string, unknown>> {
|
|
@@ -20,36 +26,33 @@ export interface SelectionProps<M extends Record<string, unknown>> {
|
|
|
20
26
|
*/
|
|
21
27
|
path: string;
|
|
22
28
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
29
|
+
* The ids of the rows to show as selected, and first, when the dialog
|
|
30
|
+
* opens.
|
|
25
31
|
*/
|
|
26
|
-
|
|
32
|
+
selectedIds?: (string | number)[];
|
|
27
33
|
/**
|
|
28
|
-
* If `multiselect` is
|
|
29
|
-
*
|
|
30
|
-
* @param entity
|
|
34
|
+
* If `multiselect` is `false`: the row picked and its id, or `null` when
|
|
35
|
+
* the selection is cleared.
|
|
31
36
|
* @callback
|
|
32
37
|
*/
|
|
33
|
-
|
|
38
|
+
onSingleRowSelected?(row: Record<string, unknown> | null, id: string | null): void;
|
|
34
39
|
/**
|
|
35
|
-
* If `multiselect` is
|
|
36
|
-
* in this callback.
|
|
37
|
-
* @param entities
|
|
40
|
+
* If `multiselect` is `true`: the rows selected and their ids, on every tick.
|
|
38
41
|
* @callback
|
|
39
42
|
*/
|
|
40
|
-
|
|
43
|
+
onMultipleRowsSelected?(rows: Record<string, unknown>[], ids: string[]): void;
|
|
41
44
|
/**
|
|
42
|
-
* Called once, with the
|
|
45
|
+
* Called once, with the rows finally selected and their ids, when the
|
|
46
|
+
* user presses Done.
|
|
43
47
|
*
|
|
44
|
-
* `
|
|
48
|
+
* `onMultipleRowsSelected` reports every tick as it happens, which is
|
|
45
49
|
* right when the selection *is* the value (a reference field). Use this
|
|
46
50
|
* one instead when acting on the selection writes something — linking
|
|
47
51
|
* rows, say — so a row ticked and then unticked, or a selection cleared,
|
|
48
52
|
* is never acted on.
|
|
49
|
-
* @param entities
|
|
50
53
|
* @callback
|
|
51
54
|
*/
|
|
52
|
-
onSelectionDone?(
|
|
55
|
+
onSelectionDone?(rows: Record<string, unknown>[], ids: string[]): void;
|
|
53
56
|
/**
|
|
54
57
|
* Allow selection of entities that pass the given filter only.
|
|
55
58
|
*/
|
|
@@ -64,8 +67,35 @@ export interface SelectionProps<M extends Record<string, unknown>> {
|
|
|
64
67
|
maxSelection?: number;
|
|
65
68
|
}
|
|
66
69
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
70
|
+
* The admin's own picker props: {@link SelectionProps} over its `Entity` view
|
|
71
|
+
* model, for the reference and relation fields, which build their values from
|
|
72
|
+
* the records picked.
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
export interface EntitySelectionProps<M extends Record<string, unknown>> extends Omit<SelectionProps<M>, "selectedIds" | "onSingleRowSelected" | "onMultipleRowsSelected" | "onSelectionDone"> {
|
|
77
|
+
selectedEntityIds?: (string | number)[];
|
|
78
|
+
onSingleEntitySelected?(entity: Entity<any> | null): void;
|
|
79
|
+
onMultipleEntitiesSelected?(entities: Entity<any>[]): void;
|
|
80
|
+
onSelectionDone?(entities: Entity<M>[]): void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Pick rows from a collection, in a table. You probably want to open it as a
|
|
84
|
+
* side dialog with {@link useSelectionDialog}.
|
|
85
|
+
*
|
|
69
86
|
* @group Components
|
|
70
87
|
*/
|
|
71
88
|
export declare function SelectionTableBinding<M extends Record<string, unknown>>(props: SelectionProps<M>): React.JSX.Element;
|
|
89
|
+
/**
|
|
90
|
+
* {@link SelectionProps} as the admin's own picker takes them: each callback
|
|
91
|
+
* handed the rows of the records picked.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
export declare function entitySelectionPropsOf<M extends Record<string, unknown>>({ selectedIds, onSingleRowSelected, onMultipleRowsSelected, onSelectionDone, ...props }: SelectionProps<M>): EntitySelectionProps<M>;
|
|
96
|
+
/**
|
|
97
|
+
* The admin's own picker, over its `Entity` view model.
|
|
98
|
+
*
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export declare function EntitySelectionTable<M extends Record<string, unknown>>(props: EntitySelectionProps<M>): React.JSX.Element;
|
|
@@ -1,23 +1,52 @@
|
|
|
1
1
|
import { useSidePanel } from "../../hooks/useSidePanel.js";
|
|
2
2
|
import { findEntitiesByIds } from "../../util/find_entities_by_ids.js";
|
|
3
|
+
import { CollectionViewLayoutContext, LARGE_COLLECTION_WIDTH, useCollectionLargeLayout } from "../CollectionViewBinding/useCollectionLargeLayout.js";
|
|
3
4
|
import { useUrlController } from "../../hooks/navigation/contexts/UrlContext.js";
|
|
4
5
|
import { CollectionRowActions } from "../CollectionTableBinding/CollectionRowActions.js";
|
|
5
6
|
import { CollectionTableBinding } from "../CollectionTableBinding/CollectionTableBinding.js";
|
|
6
|
-
import {
|
|
7
|
+
import { useEntitySelectionController } from "../CollectionViewBinding/useSelectionController.js";
|
|
7
8
|
import { useSideDialogContext } from "../SideDialogs.js";
|
|
8
9
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
9
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { Button, DialogActions, PlusIcon, Typography } from "@rebasepro/ui";
|
|
11
|
-
import { CollectionScopeProvider, ErrorView, IconForView, useAnalyticsController, useColumnIds, useData, useDataTableController,
|
|
11
|
+
import { Button, DialogActions, PlusIcon, Typography, useElementWidth } from "@rebasepro/ui";
|
|
12
|
+
import { CollectionScopeProvider, ErrorView, IconForView, entityOfRow, rowOfEntity, useAnalyticsController, useColumnIds, useData, useDataTableController, usePermissions, useTranslation } from "@rebasepro/app";
|
|
12
13
|
//#region src/components/ReferenceTable/SelectionTableBinding.tsx
|
|
13
14
|
/** Stable identity, so the effect that propagates the picks does not re-fire. */
|
|
14
15
|
var EMPTY_ENTITIES = [];
|
|
16
|
+
function idsOf(entities) {
|
|
17
|
+
return entities.map((entity) => String(entity.id));
|
|
18
|
+
}
|
|
15
19
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
20
|
+
* Pick rows from a collection, in a table. You probably want to open it as a
|
|
21
|
+
* side dialog with {@link useSelectionDialog}.
|
|
22
|
+
*
|
|
18
23
|
* @group Components
|
|
19
24
|
*/
|
|
20
25
|
function SelectionTableBinding(props) {
|
|
26
|
+
return /* @__PURE__ */ jsx(EntitySelectionTable, { ...entitySelectionPropsOf(props) });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* {@link SelectionProps} as the admin's own picker takes them: each callback
|
|
30
|
+
* handed the rows of the records picked.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
function entitySelectionPropsOf({ selectedIds, onSingleRowSelected, onMultipleRowsSelected, onSelectionDone, ...props }) {
|
|
35
|
+
const collection = props.collection;
|
|
36
|
+
return {
|
|
37
|
+
...props,
|
|
38
|
+
selectedEntityIds: selectedIds,
|
|
39
|
+
onSingleEntitySelected: onSingleRowSelected && ((entity) => onSingleRowSelected(entity ? rowOfEntity(entity, collection) : null, entity ? String(entity.id) : null)),
|
|
40
|
+
onMultipleEntitiesSelected: onMultipleRowsSelected && ((entities) => onMultipleRowsSelected(entities.map((entity) => rowOfEntity(entity, collection)), idsOf(entities))),
|
|
41
|
+
onSelectionDone: onSelectionDone && ((entities) => onSelectionDone(entities.map((entity) => rowOfEntity(entity, collection)), idsOf(entities)))
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The admin's own picker, over its `Entity` view model.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
function EntitySelectionTable(props) {
|
|
21
50
|
if (!props.collection) return /* @__PURE__ */ jsx(ErrorView, { error: "Could not find collection" });
|
|
22
51
|
return /* @__PURE__ */ jsx(SelectionTableBindingInternal, {
|
|
23
52
|
...props,
|
|
@@ -33,7 +62,7 @@ function SelectionTableBindingInternal({ onSingleEntitySelected, onMultipleEntit
|
|
|
33
62
|
const path = urlController.resolveDatabasePathsFrom(pathInput);
|
|
34
63
|
const dataClient = useData();
|
|
35
64
|
const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = useState([]);
|
|
36
|
-
const selectionController =
|
|
65
|
+
const selectionController = useEntitySelectionController();
|
|
37
66
|
const selectedEntities = selectionController.selection.type === "entities" ? selectionController.selection.entities : EMPTY_ENTITIES;
|
|
38
67
|
const selectionInitializedRef = useRef(false);
|
|
39
68
|
useEffect(() => {
|
|
@@ -87,7 +116,7 @@ function SelectionTableBindingInternal({ onSingleEntitySelected, onMultipleEntit
|
|
|
87
116
|
path,
|
|
88
117
|
entityId: entity.id
|
|
89
118
|
});
|
|
90
|
-
if (selectedEntities.
|
|
119
|
+
if (selectedEntities.some((e) => String(e.id) === String(entity.id))) selectionController.setSelectedEntities(selectedEntities.filter((item) => String(item.id) !== String(entity.id)));
|
|
91
120
|
else {
|
|
92
121
|
if (maxSelection && selectedEntities.length >= maxSelection) return;
|
|
93
122
|
selectionController.setSelectedEntities([...selectedEntities, entity]);
|
|
@@ -109,7 +138,8 @@ function SelectionTableBindingInternal({ onSingleEntitySelected, onMultipleEntit
|
|
|
109
138
|
path,
|
|
110
139
|
collection,
|
|
111
140
|
updateUrl: false,
|
|
112
|
-
|
|
141
|
+
onSaved: ({ row, id }) => {
|
|
142
|
+
const entity = entityOfRow(row, id, path, collection);
|
|
113
143
|
setEntitiesDisplayedFirst([entity, ...entitiesDisplayedFirst]);
|
|
114
144
|
onEntityClick(entity);
|
|
115
145
|
},
|
|
@@ -147,59 +177,65 @@ function SelectionTableBindingInternal({ onSingleEntitySelected, onMultipleEntit
|
|
|
147
177
|
fixedFilter,
|
|
148
178
|
updateUrl: false
|
|
149
179
|
});
|
|
180
|
+
const [measureRef, width] = useElementWidth();
|
|
181
|
+
const large = width > 0 ? width >= LARGE_COLLECTION_WIDTH : void 0;
|
|
150
182
|
return /* @__PURE__ */ jsx(CollectionScopeProvider, {
|
|
151
183
|
collection,
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
children:
|
|
155
|
-
className: "
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
184
|
+
children: /* @__PURE__ */ jsx(CollectionViewLayoutContext.Provider, {
|
|
185
|
+
value: large,
|
|
186
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
187
|
+
className: "@container/collection flex flex-col h-full",
|
|
188
|
+
ref: measureRef,
|
|
189
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
190
|
+
className: "grow",
|
|
191
|
+
children: entitiesDisplayedFirst && /* @__PURE__ */ jsx(CollectionTableBinding, {
|
|
192
|
+
additionalFields: collection.additionalFields,
|
|
193
|
+
displayedColumnIds,
|
|
194
|
+
onEntityClick,
|
|
195
|
+
tableController,
|
|
196
|
+
enablePopupIcon: false,
|
|
197
|
+
tableRowActionsBuilder,
|
|
198
|
+
openEntityMode: "side_panel",
|
|
199
|
+
title: /* @__PURE__ */ jsxs(Typography, {
|
|
200
|
+
variant: "subtitle2",
|
|
201
|
+
className: "flex flex-row gap-2",
|
|
202
|
+
children: [/* @__PURE__ */ jsx(IconForView, {
|
|
203
|
+
size: "small",
|
|
204
|
+
collectionOrView: collection,
|
|
205
|
+
className: "text-surface-300 dark:text-surface-600"
|
|
206
|
+
}), collection.singularName ? t("select_specific", { name: collection.singularName }) : t("select_from", { name: collection.name })]
|
|
207
|
+
}),
|
|
208
|
+
defaultSize: collection.defaultSize,
|
|
209
|
+
properties: collection.properties,
|
|
210
|
+
fixedFilter,
|
|
211
|
+
inlineEditing: false,
|
|
212
|
+
selectionController,
|
|
213
|
+
actions: /* @__PURE__ */ jsx(EntitySelectionDialogActions, {
|
|
214
|
+
collection,
|
|
215
|
+
path,
|
|
216
|
+
onNewClick,
|
|
217
|
+
onClear
|
|
218
|
+
})
|
|
183
219
|
})
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
220
|
+
}), /* @__PURE__ */ jsxs(DialogActions, {
|
|
221
|
+
translucent: false,
|
|
222
|
+
children: [description && /* @__PURE__ */ jsx(Typography, {
|
|
223
|
+
variant: "body2",
|
|
224
|
+
className: "grow text-left",
|
|
225
|
+
children: description
|
|
226
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
227
|
+
onClick: onDone,
|
|
228
|
+
variant: "filled",
|
|
229
|
+
children: t("done")
|
|
230
|
+
})]
|
|
195
231
|
})]
|
|
196
|
-
})
|
|
232
|
+
})
|
|
197
233
|
})
|
|
198
234
|
});
|
|
199
235
|
}
|
|
200
236
|
function EntitySelectionDialogActions({ collection, path, onClear, onNewClick }) {
|
|
201
237
|
const { canCreate } = usePermissions();
|
|
202
|
-
const largeLayout =
|
|
238
|
+
const largeLayout = useCollectionLargeLayout();
|
|
203
239
|
const { t } = useTranslation();
|
|
204
240
|
const onClick = onNewClick ? (e) => {
|
|
205
241
|
e.preventDefault();
|
|
@@ -220,6 +256,6 @@ function EntitySelectionDialogActions({ collection, path, onClear, onNewClick })
|
|
|
220
256
|
}), addButton] });
|
|
221
257
|
}
|
|
222
258
|
//#endregion
|
|
223
|
-
export { SelectionTableBinding };
|
|
259
|
+
export { EntitySelectionTable, SelectionTableBinding, entitySelectionPropsOf };
|
|
224
260
|
|
|
225
261
|
//# sourceMappingURL=SelectionTableBinding.js.map
|