@rebasepro/cms 0.28.2 → 0.29.0
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 +255 -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 +54 -0
- package/dist/mcp_view/index.js +262 -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 +30 -0
- package/dist/mcp_view/screen.js +245 -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 +160 -0
- package/dist/mcp_view/tool_driver.js +575 -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,12 +1,18 @@
|
|
|
1
1
|
import { useCollectionRegistryController } from "../hooks/navigation/contexts/CollectionRegistryContext.js";
|
|
2
2
|
import { useNavigationStateController } from "../hooks/navigation/contexts/NavigationStateContext.js";
|
|
3
3
|
import { useUrlController } from "../hooks/navigation/contexts/UrlContext.js";
|
|
4
|
+
import { CollectionAddButton } from "./CollectionViewBinding/CollectionAddButton.js";
|
|
5
|
+
import { CollectionSearchBar, CollectionToolbar, CollectionViewModeToggle } from "./CollectionViewBinding/CollectionToolbar.js";
|
|
6
|
+
import { ROW_ACTIONS_FIELD, RowActionsContext } from "./CollectionViewBinding/RowActions.js";
|
|
4
7
|
import { CollectionViewBinding } from "./CollectionViewBinding/CollectionViewBinding.js";
|
|
5
8
|
import { CollectionsScopeContext, isRegistered } from "./CollectionsScopeContext.js";
|
|
6
9
|
import { CollectionsProvider } from "./CollectionsProvider.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { collectionPropOf } from "./collection_prop.js";
|
|
11
|
+
import { useContext, useMemo, useRef } from "react";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { deepEqual } from "fast-equals";
|
|
14
|
+
import { CircularProgressCenter, Typography, cls } from "@rebasepro/ui";
|
|
15
|
+
import { warnDeprecated } from "@rebasepro/common";
|
|
10
16
|
import { CollectionScopeProvider, useComponentOverride } from "@rebasepro/app";
|
|
11
17
|
//#region src/components/CollectionPanel.tsx
|
|
12
18
|
/**
|
|
@@ -20,9 +26,9 @@ import { CollectionScopeProvider, useComponentOverride } from "@rebasepro/app";
|
|
|
20
26
|
* function MyDashboard() {
|
|
21
27
|
* return (
|
|
22
28
|
* <div>
|
|
23
|
-
* <CollectionPanel
|
|
29
|
+
* <CollectionPanel collection="tasks" title="Pending Tasks" />
|
|
24
30
|
* <CollectionPanel
|
|
25
|
-
*
|
|
31
|
+
* collection="clients"
|
|
26
32
|
* viewMode="table"
|
|
27
33
|
* collectionOverrides={{
|
|
28
34
|
* defaultFilter: { status: ["!=", "completed"] }
|
|
@@ -46,35 +52,69 @@ import { CollectionScopeProvider, useComponentOverride } from "@rebasepro/app";
|
|
|
46
52
|
*
|
|
47
53
|
* @group Components
|
|
48
54
|
*/
|
|
49
|
-
function CollectionPanelInner({ mergedCollection, path, title, updateUrl, className }) {
|
|
55
|
+
function CollectionPanelInner({ mergedCollection, overrides, path, title, viewMode, updateUrl, highlightedIds, fields, toolbar, onRowClick, rowActions, className }) {
|
|
50
56
|
const ResolvedCollectionView = useComponentOverride("Collection.View", CollectionViewBinding);
|
|
57
|
+
const toolbarNode = toolbarOf(toolbar);
|
|
58
|
+
const rowActionsScope = useMemo(() => rowActions ? {
|
|
59
|
+
path: path ?? mergedCollection.slug,
|
|
60
|
+
render: rowActions
|
|
61
|
+
} : null, [
|
|
62
|
+
path,
|
|
63
|
+
mergedCollection.slug,
|
|
64
|
+
rowActions
|
|
65
|
+
]);
|
|
51
66
|
return /* @__PURE__ */ jsxs("div", {
|
|
52
|
-
className,
|
|
67
|
+
className: cls("flex flex-col min-h-0", className),
|
|
53
68
|
children: [title !== false && /* @__PURE__ */ jsx(Typography, {
|
|
54
69
|
variant: "subtitle2",
|
|
55
70
|
className: "font-semibold mb-2 text-surface-700 dark:text-surface-300",
|
|
56
71
|
children: title ?? mergedCollection.name
|
|
57
|
-
}), /* @__PURE__ */ jsx(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
}), /* @__PURE__ */ jsx(RowActionsContext.Provider, {
|
|
73
|
+
value: rowActionsScope,
|
|
74
|
+
children: /* @__PURE__ */ jsx(ResolvedCollectionView, {
|
|
75
|
+
...mergedCollection,
|
|
76
|
+
collectionOverrides: overrides,
|
|
77
|
+
...highlightedIds !== void 0 && { highlightedIds },
|
|
78
|
+
...viewMode && { viewMode },
|
|
79
|
+
...fields && { fields },
|
|
80
|
+
...toolbarNode !== void 0 && { toolbar: toolbarNode },
|
|
81
|
+
...onRowClick && { onRowClick },
|
|
82
|
+
...title === false && { title },
|
|
83
|
+
path,
|
|
84
|
+
updateUrl
|
|
85
|
+
})
|
|
61
86
|
})]
|
|
62
87
|
});
|
|
63
88
|
}
|
|
64
|
-
function CollectionPanel(
|
|
89
|
+
function CollectionPanel(rawProps) {
|
|
65
90
|
const inScope = useContext(CollectionsScopeContext);
|
|
66
91
|
const collectionRegistry = useCollectionRegistryController();
|
|
67
92
|
const navigationState = useNavigationStateController();
|
|
68
|
-
const collection =
|
|
93
|
+
const { collection, path } = collectionPropOf(rawProps.collection, rawProps.path);
|
|
94
|
+
if (rawProps.collection === void 0) warnDeprecated("CollectionPanel.path", "`<CollectionPanel path=\"…\"/>` names its collection with `collection` now: `<CollectionPanel collection=\"…\"/>`.");
|
|
95
|
+
const props = {
|
|
96
|
+
...rawProps,
|
|
97
|
+
collection,
|
|
98
|
+
path
|
|
99
|
+
};
|
|
69
100
|
const ownCollections = useMemo(() => collection ? [collection] : [], [collection]);
|
|
70
|
-
|
|
101
|
+
const needsOwnScope = collection !== void 0 && (!inScope || !navigationState.loading && !isRegistered(collectionRegistry.collections, path));
|
|
102
|
+
if (!inScope && collection === void 0) return /* @__PURE__ */ jsx(CollectionNotFound, {
|
|
103
|
+
className: props.className,
|
|
104
|
+
path
|
|
105
|
+
});
|
|
106
|
+
if (needsOwnScope) return /* @__PURE__ */ jsx(CollectionsProvider, {
|
|
71
107
|
collections: ownCollections,
|
|
72
108
|
children: /* @__PURE__ */ jsx(CollectionPanelInScope, { ...props })
|
|
73
109
|
});
|
|
74
110
|
return /* @__PURE__ */ jsx(CollectionPanelInScope, { ...props });
|
|
75
111
|
}
|
|
76
112
|
function CollectionPanelInScope(props) {
|
|
77
|
-
const { viewMode, sort, limit, openEntityMode, className, collectionOverrides, collection: collectionProp } = props;
|
|
113
|
+
const { viewMode, sort, limit, openEntityMode, className, collectionOverrides, where, orderBy, rowActions, collection: collectionProp } = props;
|
|
114
|
+
if (sort !== void 0) warnDeprecated("CollectionPanel.sort", "`CollectionPanel`'s `sort` is `orderBy` now: `orderBy=\"field:desc\"`.");
|
|
115
|
+
const order = orderBy ? orderByTuple(orderBy) : sort;
|
|
116
|
+
const orderKey = order ? order.join(":") : void 0;
|
|
117
|
+
const hasRowActions = rowActions !== void 0;
|
|
78
118
|
const path = props.path ?? collectionProp?.slug ?? "";
|
|
79
119
|
const collectionRegistry = useCollectionRegistryController();
|
|
80
120
|
const navigationState = useNavigationStateController();
|
|
@@ -86,45 +126,51 @@ function CollectionPanelInScope(props) {
|
|
|
86
126
|
path
|
|
87
127
|
]);
|
|
88
128
|
const routesMounted = urlController.routesMounted !== false;
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (sort) propOverrides.sort = sort;
|
|
94
|
-
if (limit) propOverrides.pagination = limit;
|
|
95
|
-
if (openEntityMode) propOverrides.openEntityMode = openEntityMode;
|
|
129
|
+
const whereRef = useRef(where);
|
|
130
|
+
if (!deepEqual(whereRef.current, where)) whereRef.current = where;
|
|
131
|
+
const stableWhere = whereRef.current;
|
|
132
|
+
const overrides = useMemo(() => {
|
|
96
133
|
const merged = {
|
|
97
|
-
...baseCollection,
|
|
98
134
|
...collectionOverrides ?? {},
|
|
99
|
-
...
|
|
135
|
+
...viewMode && { defaultViewMode: viewMode },
|
|
136
|
+
...order && { sort: order },
|
|
137
|
+
...limit && { pagination: limit },
|
|
138
|
+
...openEntityMode && { openEntityMode },
|
|
139
|
+
...stableWhere && { fixedFilter: {
|
|
140
|
+
...baseCollection?.fixedFilter ?? {},
|
|
141
|
+
...collectionOverrides?.fixedFilter ?? {},
|
|
142
|
+
...stableWhere
|
|
143
|
+
} },
|
|
144
|
+
...hasRowActions && { additionalFields: [...collectionOverrides?.additionalFields ?? baseCollection?.additionalFields ?? [], ROW_ACTIONS_FIELD] }
|
|
145
|
+
};
|
|
146
|
+
if (!routesMounted && (merged.openEntityMode ?? baseCollection?.openEntityMode) !== "dialog") return {
|
|
147
|
+
...merged,
|
|
148
|
+
openEntityMode: "side_panel"
|
|
100
149
|
};
|
|
101
|
-
if (!routesMounted && merged.openEntityMode !== "dialog") merged.openEntityMode = "side_panel";
|
|
102
150
|
return merged;
|
|
103
151
|
}, [
|
|
104
152
|
baseCollection,
|
|
105
153
|
collectionOverrides,
|
|
106
154
|
viewMode,
|
|
107
|
-
|
|
155
|
+
orderKey,
|
|
108
156
|
limit,
|
|
109
157
|
openEntityMode,
|
|
158
|
+
stableWhere,
|
|
159
|
+
hasRowActions,
|
|
110
160
|
routesMounted
|
|
111
161
|
]);
|
|
162
|
+
const mergedCollection = useMemo(() => baseCollection ? {
|
|
163
|
+
...baseCollection,
|
|
164
|
+
...overrides
|
|
165
|
+
} : void 0, [baseCollection, overrides]);
|
|
112
166
|
if (!mergedCollection) {
|
|
113
167
|
if (navigationState.loading) return /* @__PURE__ */ jsx("div", {
|
|
114
168
|
className,
|
|
115
169
|
children: /* @__PURE__ */ jsx(CircularProgressCenter, {})
|
|
116
170
|
});
|
|
117
|
-
return /* @__PURE__ */ jsx(
|
|
171
|
+
return /* @__PURE__ */ jsx(CollectionNotFound, {
|
|
118
172
|
className,
|
|
119
|
-
|
|
120
|
-
variant: "body2",
|
|
121
|
-
color: "secondary",
|
|
122
|
-
children: [
|
|
123
|
-
"Collection \"",
|
|
124
|
-
path,
|
|
125
|
-
"\" not found."
|
|
126
|
-
]
|
|
127
|
-
})
|
|
173
|
+
path
|
|
128
174
|
});
|
|
129
175
|
}
|
|
130
176
|
return /* @__PURE__ */ jsx(CollectionScopeProvider, {
|
|
@@ -132,10 +178,42 @@ function CollectionPanelInScope(props) {
|
|
|
132
178
|
children: /* @__PURE__ */ jsx(CollectionPanelInner, {
|
|
133
179
|
...props,
|
|
134
180
|
path,
|
|
135
|
-
mergedCollection
|
|
181
|
+
mergedCollection,
|
|
182
|
+
overrides
|
|
136
183
|
})
|
|
137
184
|
});
|
|
138
185
|
}
|
|
186
|
+
function CollectionNotFound({ className, path }) {
|
|
187
|
+
return /* @__PURE__ */ jsx("div", {
|
|
188
|
+
className,
|
|
189
|
+
children: /* @__PURE__ */ jsxs(Typography, {
|
|
190
|
+
variant: "body2",
|
|
191
|
+
color: "secondary",
|
|
192
|
+
children: [
|
|
193
|
+
"Collection \"",
|
|
194
|
+
path,
|
|
195
|
+
"\" not found."
|
|
196
|
+
]
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/** `"field:desc"` or `["field", "desc"]`, as the collection's `sort` takes it. */
|
|
201
|
+
function orderByTuple(orderBy) {
|
|
202
|
+
if (typeof orderBy !== "string") return [orderBy[0], orderBy[1]];
|
|
203
|
+
const at = orderBy.lastIndexOf(":");
|
|
204
|
+
return [orderBy.slice(0, at), orderBy.slice(at + 1)];
|
|
205
|
+
}
|
|
206
|
+
/** The node a `toolbar` keyword stands for; a composed toolbar as it is. */
|
|
207
|
+
function toolbarOf(toolbar) {
|
|
208
|
+
if (toolbar === "full") return void 0;
|
|
209
|
+
if (toolbar === "none") return null;
|
|
210
|
+
if (toolbar === "compact") return COMPACT_TOOLBAR;
|
|
211
|
+
return toolbar;
|
|
212
|
+
}
|
|
213
|
+
var COMPACT_TOOLBAR = /* @__PURE__ */ jsx(CollectionToolbar, {
|
|
214
|
+
start: /* @__PURE__ */ jsx(CollectionViewModeToggle, {}),
|
|
215
|
+
end: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CollectionSearchBar, {}), /* @__PURE__ */ jsx(CollectionAddButton, {})] })
|
|
216
|
+
});
|
|
139
217
|
//#endregion
|
|
140
218
|
export { CollectionPanel };
|
|
141
219
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionPanel.js","names":[],"sources":["../../src/components/CollectionPanel.tsx"],"sourcesContent":["\nimport type { ViewMode, AdminCollection } from \"@rebasepro/cms-types\";\nimport React, { useContext, useMemo } from \"react\";\nimport { CollectionViewBinding } from \"./CollectionViewBinding/CollectionViewBinding\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useNavigationStateController } from \"../hooks/navigation/contexts/NavigationStateContext\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { CircularProgressCenter, Typography } from \"@rebasepro/ui\";\nimport { useComponentOverride, CollectionScopeProvider } from \"@rebasepro/app\";\nimport { CollectionsScopeContext, isRegistered } from \"./CollectionsScopeContext\";\nimport { CollectionsProvider } from \"./CollectionsProvider\";\n\n/**\n * Props for the {@link CollectionPanel} component.\n *\n * This is a high-level, consumer-friendly wrapper around {@link CollectionViewBinding}\n * designed for embedding collection views inside custom pages (home pages,\n * dashboards, entity detail views, etc.).\n *\n * Name the collection by `path` (one registered with `<RebaseCMS>`, or with a\n * {@link CollectionsProvider} above), or hand it over as a value with\n * `collection`. All other props are optional overrides that take precedence\n * over the collection's default configuration.\n *\n * @group Components\n */\nexport type CollectionPanelProps = CollectionPanelOptions & (\n | {\n /**\n * The collection slug / path to display (e.g. \"tasks\", \"clients\"),\n * registered with `<RebaseCMS>` or a {@link CollectionsProvider}.\n */\n path: string;\n /** The collection itself, when it is not registered. */\n collection?: AdminCollection;\n }\n | {\n /**\n * The collection to display, as a value — a `defineCollection` config\n * or a resolved collection. Where no CMS navigation is mounted above,\n * the panel brings its own {@link CollectionsProvider} for it, so it\n * works anywhere under `<Rebase>` and a router.\n */\n collection: AdminCollection;\n /** Defaults to `collection.slug`. */\n path?: string;\n }\n);\n\n/**\n * The display options of a {@link CollectionPanel}.\n *\n * @group Components\n */\nexport type CollectionPanelOptions = {\n\n /**\n * Optional title displayed above the collection.\n * Set to `false` to hide the title entirely.\n * Defaults to the collection's `name`.\n */\n title?: string | false;\n\n /**\n * Force a specific view mode, overriding the collection's default.\n */\n viewMode?: ViewMode;\n\n /**\n * Override the sort field.\n */\n sort?: [string, \"asc\" | \"desc\"];\n\n /**\n * Maximum number of entities to display.\n */\n limit?: number;\n\n /**\n * Whether to sync filter/sort state with URL query params.\n * Defaults to `false` (embedded panels shouldn't hijack the URL).\n */\n updateUrl?: boolean;\n\n /**\n * Override the entity open mode when clicking a entity.\n */\n openEntityMode?: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n\n /**\n * Additional CSS class name for the container.\n */\n className?: string;\n\n /**\n * Any additional collection-level overrides (e.g. `previewProperties`,\n * `enabledViews`, `entityActions`, `defaultFilter`, etc.).\n */\n collectionOverrides?: Partial<AdminCollection>;\n};\n\n/**\n * A high-level, reusable wrapper for embedding a Rebase collection view\n * inside custom pages (dashboards, home pages, entity detail views, etc.).\n *\n * Usage inside the CMS, by registered slug:\n * ```tsx\n * import { CollectionPanel } from \"@rebasepro/cms\";\n *\n * function MyDashboard() {\n * return (\n * <div>\n * <CollectionPanel path=\"tasks\" title=\"Pending Tasks\" />\n * <CollectionPanel\n * path=\"clients\"\n * viewMode=\"table\"\n * collectionOverrides={{\n * defaultFilter: { status: [\"!=\", \"completed\"] }\n * }}\n * />\n * </div>\n * );\n * }\n * ```\n *\n * Usage in a page of your own app, with the collection as a value — no\n * `<RebaseCMS>`, `<RebaseNavigation>` or `<RebaseShell>` needed, and any\n * React Router router will do. Records open in a side panel over the page:\n * ```tsx\n * <Rebase client={client} authController={authController}>\n * <BrowserRouter>\n * <CollectionPanel collection={postsCollection} />\n * </BrowserRouter>\n * </Rebase>\n * ```\n *\n * @group Components\n */\nfunction CollectionPanelInner({\n mergedCollection,\n path,\n title,\n updateUrl,\n className\n}: CollectionPanelProps & { mergedCollection: AdminCollection }) {\n const ResolvedCollectionView = useComponentOverride(\"Collection.View\", CollectionViewBinding);\n\n return (\n <div className={className}>\n {title !== false && (\n <Typography\n variant=\"subtitle2\"\n className=\"font-semibold mb-2 text-surface-700 dark:text-surface-300\"\n >\n {title ?? mergedCollection.name}\n </Typography>\n )}\n <ResolvedCollectionView\n {...mergedCollection}\n path={path}\n updateUrl={updateUrl}\n />\n </div>\n );\n}\n\nexport function CollectionPanel(props: CollectionPanelProps) {\n const inScope = useContext(CollectionsScopeContext);\n const collectionRegistry = useCollectionRegistryController();\n const navigationState = useNavigationStateController();\n const collection = props.collection;\n const ownCollections = useMemo(() => collection ? [collection] : [], [collection]);\n\n // A collection handed over as a value brings its own scope where there is\n // none above — or where the one above has settled without it, since a\n // collection the data layer does not know gives its rows no address.\n const needsOwnScope = collection !== undefined && (!inScope\n || (!navigationState.loading && !isRegistered(collectionRegistry.collections, props.path ?? collection.slug)));\n if (needsOwnScope) {\n return (\n <CollectionsProvider collections={ownCollections}>\n <CollectionPanelInScope {...props}/>\n </CollectionsProvider>\n );\n }\n return <CollectionPanelInScope {...props}/>;\n}\n\nfunction CollectionPanelInScope(props: CollectionPanelProps) {\n const {\n viewMode,\n sort,\n limit,\n openEntityMode,\n className,\n collectionOverrides,\n collection: collectionProp\n } = props;\n const path = props.path ?? collectionProp?.slug ?? \"\";\n const collectionRegistry = useCollectionRegistryController();\n const navigationState = useNavigationStateController();\n const urlController = useUrlController();\n // The registry's copy, also for a collection handed over as a value: it\n // carries the user's saved overrides and the plugins' changes. Not asked\n // before it has been filled.\n const lookUp = collectionRegistry.initialised || !navigationState.loading;\n const baseCollection = useMemo(\n () => lookUp ? collectionRegistry.getCollection(path) : undefined,\n [lookUp, collectionRegistry, path]);\n const routesMounted = urlController.routesMounted !== false;\n\n const mergedCollection = useMemo(() => {\n if (!baseCollection) return undefined;\n\n // Build overrides object from shorthand props + explicit overrides\n const propOverrides: Record<string, unknown> = {};\n if (viewMode) propOverrides.defaultViewMode = viewMode;\n if (sort) propOverrides.sort = sort;\n if (limit) propOverrides.pagination = limit;\n if (openEntityMode) propOverrides.openEntityMode = openEntityMode;\n\n const merged = {\n ...baseCollection,\n ...(collectionOverrides ?? {}),\n ...propOverrides\n } as AdminCollection;\n // Without CMS routes a record has no page of its own, nor a split\n // beside the list that a URL selects: it opens over the page.\n if (!routesMounted && merged.openEntityMode !== \"dialog\") {\n merged.openEntityMode = \"side_panel\";\n }\n return merged;\n }, [baseCollection, collectionOverrides, viewMode, sort, limit, openEntityMode, routesMounted]);\n\n if (!mergedCollection) {\n if (navigationState.loading) {\n return <div className={className}><CircularProgressCenter/></div>;\n }\n return (\n <div className={className}>\n <Typography variant=\"body2\" color=\"secondary\">\n Collection "{path}" not found.\n </Typography>\n </div>\n );\n }\n\n const content = (\n <CollectionPanelInner\n {...props}\n path={path}\n mergedCollection={mergedCollection}\n />\n );\n\n return (\n <CollectionScopeProvider collection={mergedCollection}>\n {content}\n </CollectionScopeProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0IA,SAAS,qBAAqB,EAC1B,kBACA,MACA,OACA,WACA,aAC6D;CAC7D,MAAM,yBAAyB,qBAAqB,mBAAmB,qBAAqB;CAE5F,OACI,qBAAC,OAAD;EAAgB;YAAhB,CACK,UAAU,SACP,oBAAC,YAAD;GACI,SAAQ;GACR,WAAU;aAET,SAAS,iBAAiB;EACnB,CAAA,GAEhB,oBAAC,wBAAD;GACI,GAAI;GACE;GACK;EACd,CAAA,CACA;;AAEb;AAEA,SAAgB,gBAAgB,OAA6B;CACzD,MAAM,UAAU,WAAW,uBAAuB;CAClD,MAAM,qBAAqB,gCAAgC;CAC3D,MAAM,kBAAkB,6BAA6B;CACrD,MAAM,aAAa,MAAM;CACzB,MAAM,iBAAiB,cAAc,aAAa,CAAC,UAAU,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;CAOjF,IAFsB,eAAe,KAAA,MAAc,CAAC,WAC5C,CAAC,gBAAgB,WAAW,CAAC,aAAa,mBAAmB,aAAa,MAAM,QAAQ,WAAW,IAAI,IAE3G,OACI,oBAAC,qBAAD;EAAqB,aAAa;YAC9B,oBAAC,wBAAD,EAAwB,GAAI,MAAO,CAAA;CAClB,CAAA;CAG7B,OAAO,oBAAC,wBAAD,EAAwB,GAAI,MAAO,CAAA;AAC9C;AAEA,SAAS,uBAAuB,OAA6B;CACzD,MAAM,EACF,UACA,MACA,OACA,gBACA,WACA,qBACA,YAAY,mBACZ;CACJ,MAAM,OAAO,MAAM,QAAQ,gBAAgB,QAAQ;CACnD,MAAM,qBAAqB,gCAAgC;CAC3D,MAAM,kBAAkB,6BAA6B;CACrD,MAAM,gBAAgB,iBAAiB;CAIvC,MAAM,SAAS,mBAAmB,eAAe,CAAC,gBAAgB;CAClE,MAAM,iBAAiB,cACb,SAAS,mBAAmB,cAAc,IAAI,IAAI,KAAA,GACxD;EAAC;EAAQ;EAAoB;CAAI,CAAC;CACtC,MAAM,gBAAgB,cAAc,kBAAkB;CAEtD,MAAM,mBAAmB,cAAc;EACnC,IAAI,CAAC,gBAAgB,OAAO,KAAA;EAG5B,MAAM,gBAAyC,CAAC;EAChD,IAAI,UAAU,cAAc,kBAAkB;EAC9C,IAAI,MAAM,cAAc,OAAO;EAC/B,IAAI,OAAO,cAAc,aAAa;EACtC,IAAI,gBAAgB,cAAc,iBAAiB;EAEnD,MAAM,SAAS;GACX,GAAG;GACH,GAAI,uBAAuB,CAAC;GAC5B,GAAG;EACP;EAGA,IAAI,CAAC,iBAAiB,OAAO,mBAAmB,UAC5C,OAAO,iBAAiB;EAE5B,OAAO;CACX,GAAG;EAAC;EAAgB;EAAqB;EAAU;EAAM;EAAO;EAAgB;CAAa,CAAC;CAE9F,IAAI,CAAC,kBAAkB;EACnB,IAAI,gBAAgB,SAChB,OAAO,oBAAC,OAAD;GAAgB;aAAW,oBAAC,wBAAD,CAAwB,CAAA;EAAM,CAAA;EAEpE,OACI,oBAAC,OAAD;GAAgB;aACZ,qBAAC,YAAD;IAAY,SAAQ;IAAQ,OAAM;cAAlC;KAA8C;KACxB;KAAK;IACf;;EACX,CAAA;CAEb;CAUA,OACI,oBAAC,yBAAD;EAAyB,YAAY;YARrC,oBAAC,sBAAD;GACI,GAAI;GACE;GACY;EACrB,CAKI;CACoB,CAAA;AAEjC"}
|
|
1
|
+
{"version":3,"file":"CollectionPanel.js","names":[],"sources":["../../src/components/CollectionPanel.tsx"],"sourcesContent":["\nimport type { ViewMode, AdminCollection } from \"@rebasepro/cms-types\";\nimport type { FilterValues } from \"@rebasepro/types\";\nimport React, { useContext, useMemo, useRef } from \"react\";\nimport { deepEqual } from \"fast-equals\";\nimport { CollectionViewBinding } from \"./CollectionViewBinding/CollectionViewBinding\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useNavigationStateController } from \"../hooks/navigation/contexts/NavigationStateContext\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { CircularProgressCenter, cls, Typography } from \"@rebasepro/ui\";\nimport { useComponentOverride, CollectionScopeProvider } from \"@rebasepro/app\";\nimport { CollectionsScopeContext, isRegistered } from \"./CollectionsScopeContext\";\nimport { CollectionsProvider } from \"./CollectionsProvider\";\nimport { collectionPropOf } from \"./collection_prop\";\nimport { warnDeprecated } from \"@rebasepro/common\";\nimport { ROW_ACTIONS_FIELD, RowActionsContext, type RowActionsRenderer } from \"./CollectionViewBinding/RowActions\";\nimport {\n CollectionSearchBar,\n CollectionToolbar,\n CollectionViewModeToggle\n} from \"./CollectionViewBinding/CollectionToolbar\";\nimport { CollectionAddButton } from \"./CollectionViewBinding/CollectionAddButton\";\n\n/**\n * Props for the {@link CollectionPanel} component.\n *\n * This is a high-level, consumer-friendly wrapper around {@link CollectionViewBinding}\n * designed for embedding collection views inside custom pages (home pages,\n * dashboards, entity detail views, etc.).\n *\n * Name the collection — `collection=\"orders\"`, one registered with\n * `<RebaseCMS>` or a {@link CollectionsProvider} above — or hand it over as a\n * value, `collection={ordersCollection}`. All other props are optional overrides that take precedence\n * over the collection's default configuration.\n *\n * @group Components\n */\nexport type CollectionPanelProps = CollectionPanelOptions & ({\n /**\n * The collection to display: its name (`\"orders\"`), registered with\n * `<RebaseCMS>` or a {@link CollectionsProvider} above, or the collection\n * as a value — a `defineCollection` config or a resolved collection.\n * Handed over as a value where no CMS navigation is mounted above, the\n * panel brings its own {@link CollectionsProvider} for it, so it works\n * anywhere under `<Rebase>` and a router.\n */\n collection: AdminCollection | string;\n /**\n * Where the rows live, where that is not the collection's name: a\n * subcollection's full path, `posts/p1/comments`.\n */\n path?: string;\n} | {\n /**\n * @deprecated Name the collection with `collection`:\n * `<CollectionPanel collection=\"orders\"/>`. It warns once.\n */\n path: string;\n collection?: undefined;\n});\n\n/**\n * The display options of a {@link CollectionPanel}.\n *\n * @group Components\n */\nexport type CollectionPanelOptions = {\n\n /**\n * Optional title displayed above the collection.\n * Set to `false` to hide the title entirely.\n * Defaults to the collection's `name`.\n */\n title?: string | false;\n\n /**\n * The view mode the panel opens in, over the collection's default, the\n * one in the URL and the one the person last picked. They can still\n * switch.\n */\n viewMode?: ViewMode;\n\n /**\n * @deprecated Use {@link orderBy}: `orderBy=\"field:desc\"`. It warns once.\n */\n sort?: [string, \"asc\" | \"desc\"];\n\n /**\n * The order the rows open in, as `\"field:desc\"` or `[\"field\", \"desc\"]`.\n * The person can still sort by another column.\n */\n orderBy?: `${string}:asc` | `${string}:desc` | readonly [string, \"asc\" | \"desc\"];\n\n /**\n * Your own JSX on every row, card and kanban card — an \"Approve\" button,\n * a \"Ship\" — handed the row as the server sends it and its id:\n *\n * ```tsx\n * <CollectionPanel collection=\"orders\" rowActions={(row, id) =>\n * <Button size=\"small\" onClick={() => update(\"orders\", id, { status: \"shipped\" })}>Ship</Button>}/>\n * ```\n *\n * In the table it is the last column; on a list row, a card and a kanban\n * card it sits beside the collection's own actions. A click on it does\n * not open the record.\n */\n rowActions?: RowActionsRenderer;\n\n /**\n * Maximum number of entities to display.\n */\n limit?: number;\n\n /**\n * Which rows the panel holds, as `useRows`' `where` takes it:\n * `{ status: [\"==\", \"pending\"] }`. The person's own filters on other\n * fields combine with it (AND); these fields cannot be changed or\n * cleared from the toolbar. It follows the prop, so a tab bar or a chart\n * click can drive it from state. Over the collection's `fixedFilter`,\n * field by field.\n */\n where?: FilterValues<string>;\n\n /**\n * Whether to sync filter/sort state with URL query params.\n * Defaults to `false` (embedded panels shouldn't hijack the URL).\n */\n updateUrl?: boolean;\n\n /**\n * Override the entity open mode when clicking a entity.\n */\n openEntityMode?: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n\n /**\n * The ids of the rows drawn as selected — the one a page shows beside\n * the list, say. `[]` draws none. Without it the panel highlights the\n * row last opened. Compared as strings, so an integer key's `5` and\n * `\"5\"` are one row.\n */\n highlightedIds?: (string | number)[];\n\n /**\n * Additional CSS class name for the container.\n */\n className?: string;\n\n /**\n * Any additional collection-level overrides (e.g. `previewProperties`,\n * `enabledViews`, `entityActions`, `defaultFilter`, etc.).\n */\n collectionOverrides?: Partial<AdminCollection>;\n\n /**\n * The properties the panel shows, in this order; the ones it leaves out\n * are not drawn.\n *\n * - Table: the columns.\n * - List, cards, kanban cards: what the row's or card's places — title,\n * image, subtitle, status, date, relation chips, the list's columns —\n * are filled from, earlier ones first. A place none of them fills\n * stays empty.\n *\n * For this panel it wins over `propertiesOrder`, the column order the\n * user saved, `listProperties` and what the cards infer. Column widths\n * the user drags still persist; the order is yours, so columns are not\n * dragged. A property hidden from collections stays hidden, and a\n * custom view is handed the whole collection.\n */\n fields?: string[];\n\n /**\n * The toolbar above the rows.\n *\n * - `\"full\"`, the default: the collection page's own toolbar.\n * - `\"compact\"`: the view-mode switch, search, and New where the person\n * may create.\n * - `\"none\"`: no toolbar.\n *\n * Or compose one from its pieces:\n *\n * ```tsx\n * <CollectionPanel collection=\"orders\" toolbar={\n * <CollectionToolbar\n * start={<CollectionFiltersButton/>}\n * end={<><CollectionSearchBar/><CollectionAddButton/></>}/>\n * }/>\n * ```\n */\n toolbar?: \"full\" | \"compact\" | \"none\" | React.ReactElement;\n\n /**\n * Called with the row and its id when one is clicked, instead of the\n * panel opening it. Without it the record opens as `openEntityMode` says.\n *\n * The row is the one the server sends — the shape `useRows`, `useRow`\n * and `FieldValue` take: ISO date strings (`YYYY-MM-DD` for a date-only\n * column), and a belongsTo relation as its foreign key, under that key's\n * own name. It is exactly the record's columns; the id is the string the\n * admin addresses the record by — its primary key, a composite one's\n * parts joined by `:::` — which `highlightedIds` and\n * `useSidePanel().open` take.\n *\n * ```tsx\n * const [selectedId, setSelectedId] = useState<string>();\n * <CollectionPanel collection=\"orders\"\n * onRowClick={(row, id) => setSelectedId(id)}\n * highlightedIds={selectedId ? [selectedId] : []}/>\n * ```\n */\n onRowClick?: (row: Record<string, unknown>, id: string) => void;\n};\n\n/**\n * A high-level, reusable wrapper for embedding a Rebase collection view\n * inside custom pages (dashboards, home pages, entity detail views, etc.).\n *\n * Usage inside the CMS, by registered slug:\n * ```tsx\n * import { CollectionPanel } from \"@rebasepro/cms\";\n *\n * function MyDashboard() {\n * return (\n * <div>\n * <CollectionPanel collection=\"tasks\" title=\"Pending Tasks\" />\n * <CollectionPanel\n * collection=\"clients\"\n * viewMode=\"table\"\n * collectionOverrides={{\n * defaultFilter: { status: [\"!=\", \"completed\"] }\n * }}\n * />\n * </div>\n * );\n * }\n * ```\n *\n * Usage in a page of your own app, with the collection as a value — no\n * `<RebaseCMS>`, `<RebaseNavigation>` or `<RebaseShell>` needed, and any\n * React Router router will do. Records open in a side panel over the page:\n * ```tsx\n * <Rebase client={client} authController={authController}>\n * <BrowserRouter>\n * <CollectionPanel collection={postsCollection} />\n * </BrowserRouter>\n * </Rebase>\n * ```\n *\n * @group Components\n */\nfunction CollectionPanelInner({\n mergedCollection,\n overrides,\n path,\n title,\n viewMode,\n updateUrl,\n highlightedIds,\n fields,\n toolbar,\n onRowClick,\n rowActions,\n className\n}: ScopedPanelProps & { mergedCollection: AdminCollection; overrides: Partial<AdminCollection> }) {\n const ResolvedCollectionView = useComponentOverride(\"Collection.View\", CollectionViewBinding);\n const toolbarNode = toolbarOf(toolbar);\n const rowActionsScope = useMemo(\n () => rowActions ? { path: path ?? mergedCollection.slug, render: rowActions } : null,\n [path, mergedCollection.slug, rowActions]);\n\n // A column, so a height or a max-height on the panel reaches the view:\n // it sizes to its rows up to that, then scrolls inside.\n return (\n <div className={cls(\"flex flex-col min-h-0\", className)}>\n {title !== false && (\n <Typography\n variant=\"subtitle2\"\n className=\"font-semibold mb-2 text-surface-700 dark:text-surface-300\"\n >\n {title ?? mergedCollection.name}\n </Typography>\n )}\n <RowActionsContext.Provider value={rowActionsScope}>\n <ResolvedCollectionView\n {...mergedCollection}\n collectionOverrides={overrides}\n {...(highlightedIds !== undefined && { highlightedIds })}\n {...(viewMode && { viewMode })}\n {...(fields && { fields })}\n {...(toolbarNode !== undefined && { toolbar: toolbarNode })}\n {...(onRowClick && { onRowClick })}\n {...(title === false && { title })}\n path={path}\n updateUrl={updateUrl}\n />\n </RowActionsContext.Provider>\n </div>\n );\n}\n\nexport function CollectionPanel(rawProps: CollectionPanelProps) {\n const inScope = useContext(CollectionsScopeContext);\n const collectionRegistry = useCollectionRegistryController();\n const navigationState = useNavigationStateController();\n const { collection, path } = collectionPropOf(rawProps.collection, rawProps.path);\n if (rawProps.collection === undefined) {\n warnDeprecated(\"CollectionPanel.path\", \"`<CollectionPanel path=\\\"…\\\"/>` names its collection with `collection` now: `<CollectionPanel collection=\\\"…\\\"/>`.\");\n }\n const props: ScopedPanelProps = { ...rawProps, collection, path };\n const ownCollections = useMemo(() => collection ? [collection] : [], [collection]);\n\n // A collection handed over as a value brings its own scope where there is\n // none above — or where the one above has settled without it, since a\n // collection the data layer does not know gives its rows no address.\n const needsOwnScope = collection !== undefined && (!inScope\n || (!navigationState.loading && !isRegistered(collectionRegistry.collections, path)));\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 <CollectionNotFound className={props.className} path={path}/>;\n if (needsOwnScope) {\n return (\n <CollectionsProvider collections={ownCollections}>\n <CollectionPanelInScope {...props}/>\n </CollectionsProvider>\n );\n }\n return <CollectionPanelInScope {...props}/>;\n}\n\n/** A panel's props once its `collection` is a value or absent, and its `path` known. */\ntype ScopedPanelProps = CollectionPanelOptions & { collection?: AdminCollection; path: string };\n\nfunction CollectionPanelInScope(props: ScopedPanelProps) {\n const {\n viewMode,\n sort,\n limit,\n openEntityMode,\n className,\n collectionOverrides,\n where,\n orderBy,\n rowActions,\n collection: collectionProp\n } = props;\n if (sort !== undefined) warnDeprecated(\"CollectionPanel.sort\", \"`CollectionPanel`'s `sort` is `orderBy` now: `orderBy=\\\"field:desc\\\"`.\");\n const order = orderBy ? orderByTuple(orderBy) : sort;\n const orderKey = order ? order.join(\":\") : undefined;\n // Whether, not which: the column reads the renderer through context, so a\n // new function each render leaves the collection alone.\n const hasRowActions = rowActions !== undefined;\n const path = props.path ?? collectionProp?.slug ?? \"\";\n const collectionRegistry = useCollectionRegistryController();\n const navigationState = useNavigationStateController();\n const urlController = useUrlController();\n // The registry's copy, also for a collection handed over as a value: it\n // carries the user's saved overrides and the plugins' changes. Not asked\n // before it has been filled.\n const lookUp = collectionRegistry.initialised || !navigationState.loading;\n const baseCollection = useMemo(\n () => lookUp ? collectionRegistry.getCollection(path) : undefined,\n [lookUp, collectionRegistry, path]);\n const routesMounted = urlController.routesMounted !== false;\n // Compared by value: it is an inline object at most call sites, and a new\n // one on every render would rebuild the overrides each time.\n const whereRef = useRef(where);\n if (!deepEqual(whereRef.current, where)) whereRef.current = where;\n const stableWhere = whereRef.current;\n\n // What this panel changes about the collection: the shorthand props over\n // the explicit overrides. Handed to the view as overrides, which it applies\n // over the registered collection it draws.\n const overrides = useMemo<Partial<AdminCollection>>(() => {\n const merged: Partial<AdminCollection> = {\n ...(collectionOverrides ?? {}),\n ...(viewMode && { defaultViewMode: viewMode }),\n ...(order && { sort: order }),\n ...(limit && { pagination: limit }),\n ...(openEntityMode && { openEntityMode }),\n ...(stableWhere && {\n fixedFilter: { ...(baseCollection?.fixedFilter ?? {}), ...(collectionOverrides?.fixedFilter ?? {}), ...stableWhere }\n }),\n ...(hasRowActions && {\n additionalFields: [...(collectionOverrides?.additionalFields ?? baseCollection?.additionalFields ?? []), ROW_ACTIONS_FIELD]\n })\n };\n // Without CMS routes a record has no page of its own, nor a split\n // beside the list that a URL selects: it opens over the page.\n if (!routesMounted && (merged.openEntityMode ?? baseCollection?.openEntityMode) !== \"dialog\") {\n return { ...merged, openEntityMode: \"side_panel\" };\n }\n return merged;\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `order` by its key: `orderBy` is an inline tuple at most call sites.\n }, [baseCollection, collectionOverrides, viewMode, orderKey, limit, openEntityMode, stableWhere, hasRowActions, routesMounted]);\n\n const mergedCollection = useMemo(\n () => baseCollection ? { ...baseCollection, ...overrides } as AdminCollection : undefined,\n [baseCollection, overrides]);\n\n if (!mergedCollection) {\n if (navigationState.loading) {\n return <div className={className}><CircularProgressCenter/></div>;\n }\n return <CollectionNotFound className={className} path={path}/>;\n }\n\n const content = (\n <CollectionPanelInner\n {...props}\n path={path}\n mergedCollection={mergedCollection}\n overrides={overrides}\n />\n );\n\n return (\n <CollectionScopeProvider collection={mergedCollection}>\n {content}\n </CollectionScopeProvider>\n );\n}\n\nfunction CollectionNotFound({ className, path }: { className?: string, path: string }) {\n return (\n <div className={className}>\n <Typography variant=\"body2\" color=\"secondary\">\n Collection "{path}" not found.\n </Typography>\n </div>\n );\n}\n\n/** `\"field:desc\"` or `[\"field\", \"desc\"]`, as the collection's `sort` takes it. */\nfunction orderByTuple(orderBy: NonNullable<CollectionPanelOptions[\"orderBy\"]>): [string, \"asc\" | \"desc\"] {\n if (typeof orderBy !== \"string\") return [orderBy[0], orderBy[1]];\n const at = orderBy.lastIndexOf(\":\");\n return [orderBy.slice(0, at), orderBy.slice(at + 1) as \"asc\" | \"desc\"];\n}\n\n/** The node a `toolbar` keyword stands for; a composed toolbar as it is. */\nfunction toolbarOf(toolbar: CollectionPanelOptions[\"toolbar\"]): React.ReactNode {\n if (toolbar === \"full\") return undefined;\n if (toolbar === \"none\") return null;\n if (toolbar === \"compact\") return COMPACT_TOOLBAR;\n return toolbar;\n}\n\nconst COMPACT_TOOLBAR = (\n <CollectionToolbar\n start={<CollectionViewModeToggle/>}\n end={<><CollectionSearchBar/><CollectionAddButton/></>}/>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0PA,SAAS,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KAAK,CAAC,CAAmB;AACzE;;AAGA,SAAS,UAAU,SAA6D;CAC5E,IAAI,YAAY,QAAQ,OAAO,KAAA;CAC/B,IAAI,YAAY,QAAQ,OAAO;CAC/B,IAAI,YAAY,WAAW,OAAO;CAClC,OAAO;AACX;AAEA,IAAM,kBACF,oBAAC,mBAAD;CACI,OAAO,oBAAC,0BAAD,CAA0B,CAAA;CACjC,KAAK,qBAAA,UAAA,EAAA,UAAA,CAAE,oBAAC,qBAAD,CAAqB,CAAA,GAAC,oBAAC,qBAAD,CAAqB,CAAA,CAAG,EAAA,CAAA;AAAG,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EntityAction, AdminCollection } from "@rebasepro/cms-types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Entity } from "@rebasepro/types";
|
|
4
|
-
import { CollectionSize,
|
|
4
|
+
import { CollectionSize, EntitySelectionController } from "@rebasepro/cms-types";
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* @param entity
|
|
@@ -15,7 +15,7 @@ import { CollectionSize, SelectionController } from "@rebasepro/cms-types";
|
|
|
15
15
|
*
|
|
16
16
|
* @group Collection components
|
|
17
17
|
*/
|
|
18
|
-
export declare const CollectionRowActions: ({ entity, collection, path, width, frozen, isSelected, selectionEnabled, size,
|
|
18
|
+
export declare const CollectionRowActions: ({ entity, collection, path, width, frozen, isSelected, selectionEnabled, size, highlightRow, onCollectionChange, unhighlightRow, actions, hideId, selectionController, openEntityMode, sortableNodeRef, sortableStyle, sortableAttributes, isDragging, isDraggable }: {
|
|
19
19
|
entity: Entity<any>;
|
|
20
20
|
collection?: AdminCollection<any>;
|
|
21
21
|
path?: string;
|
|
@@ -27,9 +27,9 @@ export declare const CollectionRowActions: ({ entity, collection, path, width, f
|
|
|
27
27
|
actions?: EntityAction[];
|
|
28
28
|
hideId?: boolean;
|
|
29
29
|
onCollectionChange?: () => void;
|
|
30
|
-
selectionController?:
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
selectionController?: EntitySelectionController;
|
|
31
|
+
highlightRow?: (id: string | number) => void;
|
|
32
|
+
unhighlightRow?: (id: string | number) => void;
|
|
33
33
|
openEntityMode: "side_panel" | "full_screen" | "split" | "dialog";
|
|
34
34
|
sortableNodeRef?: (node: HTMLElement | null) => void;
|
|
35
35
|
sortableStyle?: React.CSSProperties;
|
|
@@ -4,7 +4,7 @@ import { ActionMenuLabel } from "../common/ActionMenuLabel.js";
|
|
|
4
4
|
import React, { useCallback } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Badge, Checkbox, IconButton, Menu, MenuItem, MoreVerticalIcon, Separator, Skeleton, Tooltip, cls } from "@rebasepro/ui";
|
|
7
|
-
import { getEntityFromCache, getIcon, getLocalChangesBackup, useSlot, useTranslation } from "@rebasepro/app";
|
|
7
|
+
import { getEntityFromCache, getIcon, getLocalChangesBackup, rowOfEntity, selectionControllerOf, useSlot, useTranslation } from "@rebasepro/app";
|
|
8
8
|
//#region src/components/CollectionTableBinding/CollectionRowActions.tsx
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -19,22 +19,25 @@ import { getEntityFromCache, getIcon, getLocalChangesBackup, useSlot, useTransla
|
|
|
19
19
|
*
|
|
20
20
|
* @group Collection components
|
|
21
21
|
*/
|
|
22
|
-
var CollectionRowActions = function CollectionRowActions({ entity, collection, path, width, frozen, isSelected, selectionEnabled, size,
|
|
22
|
+
var CollectionRowActions = function CollectionRowActions({ entity, collection, path, width, frozen, isSelected, selectionEnabled, size, highlightRow, onCollectionChange, unhighlightRow, actions = [], hideId, selectionController, openEntityMode, sortableNodeRef, sortableStyle, sortableAttributes, isDragging, isDraggable }) {
|
|
23
23
|
const context = useAdminContext();
|
|
24
24
|
const sidePanelCtrl = context.sidePanelController;
|
|
25
25
|
const { t } = useTranslation();
|
|
26
|
+
const row = rowOfEntity(entity, collection);
|
|
27
|
+
const rowSelectionController = selectionController ? selectionControllerOf(selectionController, collection, path ?? entity.path) : void 0;
|
|
26
28
|
const slotActions = useSlot("entity.row.actions", React.useMemo(() => ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
row,
|
|
30
|
+
id: String(entity.id),
|
|
29
31
|
path,
|
|
30
32
|
collection,
|
|
31
|
-
selectionController,
|
|
33
|
+
selectionController: rowSelectionController,
|
|
32
34
|
context
|
|
33
35
|
}), [
|
|
34
|
-
|
|
36
|
+
row,
|
|
37
|
+
entity.id,
|
|
35
38
|
path,
|
|
36
39
|
collection,
|
|
37
|
-
|
|
40
|
+
rowSelectionController,
|
|
38
41
|
context
|
|
39
42
|
]));
|
|
40
43
|
const onCheckedChange = useCallback((checked) => {
|
|
@@ -53,14 +56,15 @@ var CollectionRowActions = function CollectionRowActions({ entity, collection, p
|
|
|
53
56
|
const iconSize = "small";
|
|
54
57
|
const clickProps = {
|
|
55
58
|
view: "collection",
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
row,
|
|
60
|
+
id: String(entity.id),
|
|
61
|
+
path: path ?? entity.path,
|
|
58
62
|
collection,
|
|
59
63
|
context,
|
|
60
64
|
sidePanelController: sidePanelCtrl,
|
|
61
|
-
selectionController,
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
selectionController: rowSelectionController,
|
|
66
|
+
highlightRow,
|
|
67
|
+
unhighlightRow,
|
|
64
68
|
onCollectionChange,
|
|
65
69
|
openEntityMode: openEntityMode ?? collection?.openEntityMode
|
|
66
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionRowActions.js","names":[],"sources":["../../../src/components/CollectionTableBinding/CollectionRowActions.tsx"],"sourcesContent":["\nimport type { EntityAction, EntityActionClickProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport React, { MouseEvent, useCallback } from \"react\";\n\nimport { Entity } from \"@rebasepro/types\";\nimport { CollectionSize, SelectionController } from \"@rebasepro/cms-types\";\nimport {\n Badge,\n Checkbox,\n cls,\n IconButton,\n Menu,\n MenuItem,\n MoreVerticalIcon,\n Separator,\n Skeleton,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { useTranslation, useSlot } from \"@rebasepro/app\";\nimport { getIcon } from \"@rebasepro/app\";\nimport { getEntityFromCache } from \"@rebasepro/app\";\nimport { getLocalChangesBackup } from \"@rebasepro/app\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { entityActionName, placeEntityActions, resolveEntityActionState } from \"../../util/entity_actions\";\nimport { ActionMenuLabel } from \"../common/ActionMenuLabel\";\n\n/**\n *\n * @param entity\n * @param width\n * @param frozen\n * @param isSelected\n * @param selectionEnabled\n * @param size\n * @param toggleEntitySelection\n * @param hideId\n *\n * @group Collection components\n */\nexport const CollectionRowActions = function CollectionRowActions({\n entity,\n collection,\n path,\n width,\n frozen,\n isSelected,\n selectionEnabled,\n size,\n highlightEntity,\n onCollectionChange,\n unhighlightEntity,\n actions = [],\n hideId,\n selectionController,\n openEntityMode,\n sortableNodeRef,\n sortableStyle,\n sortableAttributes,\n isDragging,\n isDraggable\n}:\n {\n entity: Entity<any>,\n collection?: AdminCollection<any>,\n path?: string,\n width: number,\n frozen?: boolean,\n size: CollectionSize,\n isSelected?: boolean,\n selectionEnabled?: boolean,\n actions?: EntityAction[],\n hideId?: boolean,\n onCollectionChange?: () => void,\n selectionController?: SelectionController;\n highlightEntity?: (entity: Entity<any>) => void;\n unhighlightEntity?: (entity: Entity<any>) => void;\n openEntityMode: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n // Sortable props for dnd-kit integration\n sortableNodeRef?: (node: HTMLElement | null) => void;\n sortableStyle?: React.CSSProperties;\n sortableAttributes?: Record<string, any>;\n isDragging?: boolean;\n isDraggable?: boolean;\n }) {\n\n const context = useAdminContext();\n const sidePanelCtrl = context.sidePanelController;\n const { t } = useTranslation();\n\n // Plugin row actions, rendered in the same hover overlay as the built-in\n // ones — beside `edit` and before the collapsed menu, which is where a\n // per-row action goes. `collection`, `path` and `selectionController` are\n // forwarded as they arrive: a relation picker renders rows with no\n // collection path, and a table can be shown with selection off.\n const rowSlotProps = React.useMemo(() => ({\n entity,\n entityId: entity.id,\n path,\n collection,\n selectionController,\n context\n }), [entity, path, collection, selectionController, context]);\n const slotActions = useSlot(\"entity.row.actions\", rowSlotProps);\n\n const onCheckedChange = useCallback((checked: boolean) => {\n selectionController?.toggleEntitySelection(entity, checked);\n }, [entity, selectionController?.toggleEntitySelection]);\n\n const hasActions = actions.length > 0 || slotActions.length > 0;\n\n // Placed as the record's own bar places them: icons for `collapsed: false`,\n // and a menu of the collection's actions, then Copy, then Delete apart.\n const placed = placeEntityActions(actions);\n const uncollapsedActions = placed.inline;\n const collapsedGroups = [placed.own, placed.generic, placed.destructive].filter(group => group.length > 0);\n const hasCollapsedActions = collapsedGroups.length > 0;\n const enableLocalChangesBackup = collection ? getLocalChangesBackup(collection) : false;\n const hasDraft = enableLocalChangesBackup ? getEntityFromCache(path + \"/\" + entity.id) : false;\n const iconSize = \"small\" as const;\n\n // What every action on this row is called with, and asked `isEnabled`\n // with — the same question the record's own action bar asks, so an action\n // its record does not allow is disabled here too.\n const clickProps: EntityActionClickProps<Record<string, unknown>> = {\n view: \"collection\",\n entity,\n path,\n collection,\n context,\n sidePanelController: sidePanelCtrl,\n selectionController,\n highlightEntity,\n unhighlightEntity,\n onCollectionChange,\n openEntityMode: openEntityMode ?? collection?.openEntityMode\n };\n const actionState = (action: EntityAction) => resolveEntityActionState(action, clickProps);\n\n const content = (\n <div\n className={cls(\n \"h-full flex items-center justify-center flex-col z-10\",\n isSelected\n ? \"bg-surface-raised\"\n : \"bg-surface-card group-hover:bg-surface-card-hover\",\n frozen ? \"sticky left-0\" : \"\"\n )}\n onClick={useCallback((event: React.MouseEvent) => {\n event.stopPropagation();\n }, [])}\n style={{\n width,\n position: frozen ? \"sticky\" : \"relative\",\n left: frozen ? 0 : \"initial\",\n contain: \"strict\"\n }}>\n\n {/* The row's resting content is its id. The actions (edit, menu,\n select) cover it while the row is hovered, focused or selected,\n so a 36px row carries one line and the tools still fit. */}\n {(hasActions || selectionEnabled) &&\n <div className={cls(\n \"absolute inset-0 flex items-center justify-center gap-0.5\",\n isSelected\n ? \"bg-surface-raised\"\n : \"bg-surface-card group-hover:bg-surface-card-hover opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity duration-100\"\n )}>\n\n {uncollapsedActions.map((action, index) => {\n const isEditAction = action.key === \"edit\";\n const { enabled, disabledReason } = actionState(action);\n const name = entityActionName(action, t);\n const tooltip = isEditAction && hasDraft\n ? t(\"unsaved_local_changes\")\n : disabledReason ? `${name}: ${disabledReason}` : name;\n\n let iconButton = <IconButton\n aria-label={name}\n disabled={!enabled}\n onClick={(event: MouseEvent) => {\n event.stopPropagation();\n action.onClick(clickProps);\n }}\n size={iconSize}>\n {getIcon(action.icon, undefined, undefined, \"smallest\")}\n </IconButton>;\n if (isEditAction && hasDraft) {\n iconButton = (\n <Badge color={\"warning\"}>\n {iconButton}\n </Badge>\n );\n }\n // A disabled icon takes no pointer events, so as the\n // trigger itself its tooltip — the one place it can\n // say why — never opened. Wrapped, the wrapper hovers.\n return (\n <Tooltip key={index}\n title={tooltip}\n asChild={enabled}>\n {iconButton}\n </Tooltip>\n );\n })}\n\n {slotActions}\n\n {hasCollapsedActions &&\n <Menu\n trigger={<IconButton aria-label={t(\"more_actions\")}\n size={iconSize}>\n <MoreVerticalIcon/>\n </IconButton>}>\n {collapsedGroups.map((group, groupIndex) => (\n <React.Fragment key={groupIndex}>\n {groupIndex > 0 && <Separator orientation={\"horizontal\"}/>}\n {group.map((action, index) => {\n const { enabled, disabledReason } = actionState(action);\n return <MenuItem\n key={action.key ?? index}\n disabled={!enabled}\n onClick={(e) => {\n e.stopPropagation();\n action.onClick(clickProps);\n }}>\n {getIcon(action.icon, undefined, undefined, \"smallest\")}\n <ActionMenuLabel name={entityActionName(action, t)} disabledReason={disabledReason}/>\n </MenuItem>;\n })}\n </React.Fragment>\n ))}\n </Menu>\n }\n\n {selectionEnabled &&\n <Tooltip title={t(\"select_row\", { id: String(entity.id) })}>\n <Checkbox\n aria-label={t(\"select_row\", { id: String(entity.id) })}\n size={\"smallest\"}\n checked={Boolean(isSelected)}\n onCheckedChange={onCheckedChange}\n />\n </Tooltip>}\n\n </div>}\n\n {!hideId && (\n <div\n className=\"w-[138px] overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2 align-center justify-center flex items-center gap-1\"\n onClick={(event) => {\n event.stopPropagation();\n }}>\n <span className=\"min-w-0 truncate text-center\">\n {entity\n ? entity.id\n : <Skeleton/>\n }\n </span>\n </div>\n )}\n\n </div>\n );\n\n // Wrap with sortable outer div when sortable props are provided\n // Remove tabIndex from attributes to avoid capturing focus before cell content\n if (sortableNodeRef) {\n const { tabIndex: _tabIndex, ...sortableAttrsWithoutTabIndex } = sortableAttributes ?? {};\n return (\n <div\n ref={sortableNodeRef}\n style={sortableStyle}\n className={cls(\n \"flex-shrink-0\",\n frozen && \"sticky left-0 z-10 bg-surface-card\"\n )}\n {...sortableAttrsWithoutTabIndex}\n >\n {content}\n </div>\n );\n }\n\n return content;\n\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,uBAAuB,SAAS,qBAAqB,EAC9D,QACA,YACA,MACA,OACA,QACA,YACA,kBACA,MACA,iBACA,oBACA,mBACA,UAAU,CAAC,GACX,QACA,qBACA,gBACA,iBACA,eACA,oBACA,YACA,eAwBG;CAEH,MAAM,UAAU,gBAAgB;CAChC,MAAM,gBAAgB,QAAQ;CAC9B,MAAM,EAAE,MAAM,eAAe;CAe7B,MAAM,cAAc,QAAQ,sBARP,MAAM,eAAe;EACtC;EACA,UAAU,OAAO;EACjB;EACA;EACA;EACA;CACJ,IAAI;EAAC;EAAQ;EAAM;EAAY;EAAqB;CAAO,CACT,CAAY;CAE9D,MAAM,kBAAkB,aAAa,YAAqB;EACtD,qBAAqB,sBAAsB,QAAQ,OAAO;CAC9D,GAAG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AChB,MAAM,gBAAgB;GAC1B;aACA,oBAAC,QAAD;IAAM,WAAU;cACX,SACK,OAAO,KACP,oBAAC,UAAD,CAAU,CAAA;GAEd,CAAA;EACL,CAAA,CAGR;;CAKT,IAAI,iBAAiB;EACjB,MAAM,EAAE,UAAU,WAAW,GAAG,iCAAiC,sBAAsB,CAAC;EACxF,OACI,oBAAC,OAAD;GACI,KAAK;GACL,OAAO;GACP,WAAW,IACP,iBACA,UAAU,oCACd;GACA,GAAI;aAEH;EACA,CAAA;CAEb;CAEA,OAAO;AAEX"}
|
|
1
|
+
{"version":3,"file":"CollectionRowActions.js","names":[],"sources":["../../../src/components/CollectionTableBinding/CollectionRowActions.tsx"],"sourcesContent":["\nimport type { EntityAction, EntityActionClickProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport React, { MouseEvent, useCallback } from \"react\";\n\nimport { Entity } from \"@rebasepro/types\";\nimport { CollectionSize, EntitySelectionController } from \"@rebasepro/cms-types\";\nimport {\n Badge,\n Checkbox,\n cls,\n IconButton,\n Menu,\n MenuItem,\n MoreVerticalIcon,\n Separator,\n Skeleton,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { useTranslation, useSlot } from \"@rebasepro/app\";\nimport { getIcon } from \"@rebasepro/app\";\nimport { getEntityFromCache } from \"@rebasepro/app\";\nimport { getLocalChangesBackup } from \"@rebasepro/app\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { entityActionName, placeEntityActions, resolveEntityActionState } from \"../../util/entity_actions\";\nimport { ActionMenuLabel } from \"../common/ActionMenuLabel\";\nimport { rowOfEntity, selectionControllerOf } from \"@rebasepro/app\";\n\n/**\n *\n * @param entity\n * @param width\n * @param frozen\n * @param isSelected\n * @param selectionEnabled\n * @param size\n * @param toggleEntitySelection\n * @param hideId\n *\n * @group Collection components\n */\nexport const CollectionRowActions = function CollectionRowActions({\n entity,\n collection,\n path,\n width,\n frozen,\n isSelected,\n selectionEnabled,\n size,\n highlightRow,\n onCollectionChange,\n unhighlightRow,\n actions = [],\n hideId,\n selectionController,\n openEntityMode,\n sortableNodeRef,\n sortableStyle,\n sortableAttributes,\n isDragging,\n isDraggable\n}:\n {\n entity: Entity<any>,\n collection?: AdminCollection<any>,\n path?: string,\n width: number,\n frozen?: boolean,\n size: CollectionSize,\n isSelected?: boolean,\n selectionEnabled?: boolean,\n actions?: EntityAction[],\n hideId?: boolean,\n onCollectionChange?: () => void,\n selectionController?: EntitySelectionController;\n highlightRow?: (id: string | number) => void;\n unhighlightRow?: (id: string | number) => void;\n openEntityMode: \"side_panel\" | \"full_screen\" | \"split\" | \"dialog\";\n // Sortable props for dnd-kit integration\n sortableNodeRef?: (node: HTMLElement | null) => void;\n sortableStyle?: React.CSSProperties;\n sortableAttributes?: Record<string, any>;\n isDragging?: boolean;\n isDraggable?: boolean;\n }) {\n\n const context = useAdminContext();\n const sidePanelCtrl = context.sidePanelController;\n const { t } = useTranslation();\n\n // Plugin row actions, rendered in the same hover overlay as the built-in\n // ones — beside `edit` and before the collapsed menu, which is where a\n // per-row action goes. `collection`, `path` and `selectionController` are\n // forwarded as they arrive: a relation picker renders rows with no\n // collection path, and a table can be shown with selection off.\n const row = rowOfEntity(entity, collection);\n // The selection as an app's code reads it: rows and ids.\n const rowSelectionController = selectionController\n ? selectionControllerOf(selectionController, collection, path ?? entity.path)\n : undefined;\n const rowSlotProps = React.useMemo(() => ({\n row,\n id: String(entity.id),\n path,\n collection,\n selectionController: rowSelectionController,\n context\n }), [row, entity.id, path, collection, rowSelectionController, context]);\n const slotActions = useSlot(\"entity.row.actions\", rowSlotProps);\n\n const onCheckedChange = useCallback((checked: boolean) => {\n selectionController?.toggleEntitySelection(entity, checked);\n }, [entity, selectionController?.toggleEntitySelection]);\n\n const hasActions = actions.length > 0 || slotActions.length > 0;\n\n // Placed as the record's own bar places them: icons for `collapsed: false`,\n // and a menu of the collection's actions, then Copy, then Delete apart.\n const placed = placeEntityActions(actions);\n const uncollapsedActions = placed.inline;\n const collapsedGroups = [placed.own, placed.generic, placed.destructive].filter(group => group.length > 0);\n const hasCollapsedActions = collapsedGroups.length > 0;\n const enableLocalChangesBackup = collection ? getLocalChangesBackup(collection) : false;\n const hasDraft = enableLocalChangesBackup ? getEntityFromCache(path + \"/\" + entity.id) : false;\n const iconSize = \"small\" as const;\n\n // What every action on this row is called with, and asked `isEnabled`\n // with — the same question the record's own action bar asks, so an action\n // its record does not allow is disabled here too.\n const clickProps: EntityActionClickProps<Record<string, unknown>> = {\n view: \"collection\",\n row,\n id: String(entity.id),\n // The record's own path where the table has none — a picker's rows\n // — so a subcollection record opens and copies where it lives.\n path: path ?? entity.path,\n collection,\n context,\n sidePanelController: sidePanelCtrl,\n selectionController: rowSelectionController,\n highlightRow,\n unhighlightRow,\n onCollectionChange,\n openEntityMode: openEntityMode ?? collection?.openEntityMode\n };\n const actionState = (action: EntityAction) => resolveEntityActionState(action, clickProps);\n\n const content = (\n <div\n className={cls(\n \"h-full flex items-center justify-center flex-col z-10\",\n isSelected\n ? \"bg-surface-raised\"\n : \"bg-surface-card group-hover:bg-surface-card-hover\",\n frozen ? \"sticky left-0\" : \"\"\n )}\n onClick={useCallback((event: React.MouseEvent) => {\n event.stopPropagation();\n }, [])}\n style={{\n width,\n position: frozen ? \"sticky\" : \"relative\",\n left: frozen ? 0 : \"initial\",\n contain: \"strict\"\n }}>\n\n {/* The row's resting content is its id. The actions (edit, menu,\n select) cover it while the row is hovered, focused or selected,\n so a 36px row carries one line and the tools still fit. */}\n {(hasActions || selectionEnabled) &&\n <div className={cls(\n \"absolute inset-0 flex items-center justify-center gap-0.5\",\n isSelected\n ? \"bg-surface-raised\"\n : \"bg-surface-card group-hover:bg-surface-card-hover opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity duration-100\"\n )}>\n\n {uncollapsedActions.map((action, index) => {\n const isEditAction = action.key === \"edit\";\n const { enabled, disabledReason } = actionState(action);\n const name = entityActionName(action, t);\n const tooltip = isEditAction && hasDraft\n ? t(\"unsaved_local_changes\")\n : disabledReason ? `${name}: ${disabledReason}` : name;\n\n let iconButton = <IconButton\n aria-label={name}\n disabled={!enabled}\n onClick={(event: MouseEvent) => {\n event.stopPropagation();\n action.onClick(clickProps);\n }}\n size={iconSize}>\n {getIcon(action.icon, undefined, undefined, \"smallest\")}\n </IconButton>;\n if (isEditAction && hasDraft) {\n iconButton = (\n <Badge color={\"warning\"}>\n {iconButton}\n </Badge>\n );\n }\n // A disabled icon takes no pointer events, so as the\n // trigger itself its tooltip — the one place it can\n // say why — never opened. Wrapped, the wrapper hovers.\n return (\n <Tooltip key={index}\n title={tooltip}\n asChild={enabled}>\n {iconButton}\n </Tooltip>\n );\n })}\n\n {slotActions}\n\n {hasCollapsedActions &&\n <Menu\n trigger={<IconButton aria-label={t(\"more_actions\")}\n size={iconSize}>\n <MoreVerticalIcon/>\n </IconButton>}>\n {collapsedGroups.map((group, groupIndex) => (\n <React.Fragment key={groupIndex}>\n {groupIndex > 0 && <Separator orientation={\"horizontal\"}/>}\n {group.map((action, index) => {\n const { enabled, disabledReason } = actionState(action);\n return <MenuItem\n key={action.key ?? index}\n disabled={!enabled}\n onClick={(e) => {\n e.stopPropagation();\n action.onClick(clickProps);\n }}>\n {getIcon(action.icon, undefined, undefined, \"smallest\")}\n <ActionMenuLabel name={entityActionName(action, t)} disabledReason={disabledReason}/>\n </MenuItem>;\n })}\n </React.Fragment>\n ))}\n </Menu>\n }\n\n {selectionEnabled &&\n <Tooltip title={t(\"select_row\", { id: String(entity.id) })}>\n <Checkbox\n aria-label={t(\"select_row\", { id: String(entity.id) })}\n size={\"smallest\"}\n checked={Boolean(isSelected)}\n onCheckedChange={onCheckedChange}\n />\n </Tooltip>}\n\n </div>}\n\n {!hideId && (\n <div\n className=\"w-[138px] overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2 align-center justify-center flex items-center gap-1\"\n onClick={(event) => {\n event.stopPropagation();\n }}>\n <span className=\"min-w-0 truncate text-center\">\n {entity\n ? entity.id\n : <Skeleton/>\n }\n </span>\n </div>\n )}\n\n </div>\n );\n\n // Wrap with sortable outer div when sortable props are provided\n // Remove tabIndex from attributes to avoid capturing focus before cell content\n if (sortableNodeRef) {\n const { tabIndex: _tabIndex, ...sortableAttrsWithoutTabIndex } = sortableAttributes ?? {};\n return (\n <div\n ref={sortableNodeRef}\n style={sortableStyle}\n className={cls(\n \"flex-shrink-0\",\n frozen && \"sticky left-0 z-10 bg-surface-card\"\n )}\n {...sortableAttrsWithoutTabIndex}\n >\n {content}\n </div>\n );\n }\n\n return content;\n\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,uBAAuB,SAAS,qBAAqB,EAC9D,QACA,YACA,MACA,OACA,QACA,YACA,kBACA,MACA,cACA,oBACA,gBACA,UAAU,CAAC,GACX,QACA,qBACA,gBACA,iBACA,eACA,oBACA,YACA,eAwBG;CAEH,MAAM,UAAU,gBAAgB;CAChC,MAAM,gBAAgB,QAAQ;CAC9B,MAAM,EAAE,MAAM,eAAe;CAO7B,MAAM,MAAM,YAAY,QAAQ,UAAU;CAE1C,MAAM,yBAAyB,sBACzB,sBAAsB,qBAAqB,YAAY,QAAQ,OAAO,IAAI,IAC1E,KAAA;CASN,MAAM,cAAc,QAAQ,sBARP,MAAM,eAAe;EACtC;EACA,IAAI,OAAO,OAAO,EAAE;EACpB;EACA;EACA,qBAAqB;EACrB;CACJ,IAAI;EAAC;EAAK,OAAO;EAAI;EAAM;EAAY;EAAwB;CAAO,CACpB,CAAY;CAE9D,MAAM,kBAAkB,aAAa,YAAqB;EACtD,qBAAqB,sBAAsB,QAAQ,OAAO;CAC9D,GAAG,CAAC,QAAQ,qBAAqB,qBAAqB,CAAC;CAEvD,MAAM,aAAa,QAAQ,SAAS,KAAK,YAAY,SAAS;CAI9D,MAAM,SAAS,mBAAmB,OAAO;CACzC,MAAM,qBAAqB,OAAO;CAClC,MAAM,kBAAkB;EAAC,OAAO;EAAK,OAAO;EAA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KT,IAAI,iBAAiB;EACjB,MAAM,EAAE,UAAU,WAAW,GAAG,iCAAiC,sBAAsB,CAAC;EACxF,OACI,oBAAC,OAAD;GACI,KAAK;GACL,OAAO;GACP,WAAW,IACP,iBACA,UAAU,oCACd;GACA,GAAI;aAEH;EACA,CAAA;CAEb;CAEA,OAAO;AAEX"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AdditionalFieldValue } from "../AdditionalFieldValue.js";
|
|
2
2
|
import { renderSkeletonText } from "../../preview/property_previews/SkeletonPropertyComponent.js";
|
|
3
|
+
import { useDateFnsLocale } from "../../preview/components/DatePreview.js";
|
|
3
4
|
import { EntityTableCell } from "./internal/EntityTableCell.js";
|
|
4
5
|
import { PropertyTableCell } from "./PropertyTableCell.js";
|
|
6
|
+
import { useCollectionLargeLayout } from "../CollectionViewBinding/useCollectionLargeLayout.js";
|
|
5
7
|
import { CollectionRowActions } from "./CollectionRowActions.js";
|
|
6
8
|
import { CollectionTableToolbar } from "./internal/CollectionTableToolbar.js";
|
|
7
9
|
import { propertiesToColumns } from "./column_utils.js";
|
|
@@ -10,7 +12,7 @@ import React, { useCallback, useContext, useMemo, useRef } from "react";
|
|
|
10
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
13
|
import { deepEqual } from "fast-equals";
|
|
12
14
|
import { ErrorBoundary, cls } from "@rebasepro/ui";
|
|
13
|
-
import { ErrorView, getRowHeight, isDisabled, useCollectionScope,
|
|
15
|
+
import { ErrorView, getRowHeight, isDisabled, rowOfEntity, useCollectionScope, useCustomizationController, useRebaseContext } from "@rebasepro/app";
|
|
14
16
|
import { getValueInPath } from "@rebasepro/utils";
|
|
15
17
|
//#region src/components/CollectionTableBinding/CollectionTableBinding.tsx
|
|
16
18
|
/**
|
|
@@ -39,7 +41,7 @@ import { getValueInPath } from "@rebasepro/utils";
|
|
|
39
41
|
*/
|
|
40
42
|
var CollectionTableBinding = function CollectionTableBinding({ className, style, fixedFilter, actionsStart, actions, viewModeToggle, title, tableRowActionsBuilder, uniqueFieldValidator, getPropertyFor, onValueChange, selectionController, highlightedEntities, onEntityClick, onColumnResize, initialScroll, onScroll, onSizeChanged, hoverRow = true, inlineEditing = false, additionalFields, displayedColumnIds, defaultSize, properties, tableController, filterable = true, sortable = true, endAdornment, AddColumnComponent, AdditionalHeaderWidget, additionalIDHeaderWidget, emptyComponent, getIdColumnWidth, enablePopupIcon, openEntityMode = "side_panel", onColumnsOrderChange, hideToolbar = false }) {
|
|
41
43
|
const ref = useRef(null);
|
|
42
|
-
const largeLayout =
|
|
44
|
+
const largeLayout = useCollectionLargeLayout();
|
|
43
45
|
const hasSelection = Boolean(selectionController?.hasSelection);
|
|
44
46
|
const isRowHighlighted = useCallback((entity) => {
|
|
45
47
|
if (hasSelection) return selectionController.isEntitySelected(entity);
|
|
@@ -116,6 +118,8 @@ var CollectionTableBinding = function CollectionTableBinding({ className, style,
|
|
|
116
118
|
enablePopupIcon,
|
|
117
119
|
size
|
|
118
120
|
]);
|
|
121
|
+
const scopedCollection = useCollectionScope();
|
|
122
|
+
const engine = scopedCollection?.engine;
|
|
119
123
|
const additionalCellRenderer = useCallback(({ column, rowData, width, sortableNodeRef, sortableStyle, sortableAttributes, isDragging, isDraggable, frozen }) => {
|
|
120
124
|
const entity = rowData;
|
|
121
125
|
if (!entity) return null;
|
|
@@ -126,6 +130,8 @@ var CollectionTableBinding = function CollectionTableBinding({ className, style,
|
|
|
126
130
|
}), {}) : entity;
|
|
127
131
|
const Builder = additionalField.Builder;
|
|
128
132
|
if (!Builder && !additionalField.value) throw new Error("When using additional fields you need to provide a Builder or a value");
|
|
133
|
+
const row = rowOfEntity(entity, scopedCollection);
|
|
134
|
+
const id = String(entity.id);
|
|
129
135
|
return /* @__PURE__ */ jsx(EntityTableCell, {
|
|
130
136
|
width,
|
|
131
137
|
size,
|
|
@@ -143,26 +149,43 @@ var CollectionTableBinding = function CollectionTableBinding({ className, style,
|
|
|
143
149
|
isDraggable,
|
|
144
150
|
frozen,
|
|
145
151
|
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: Builder ? /* @__PURE__ */ jsx(Builder, {
|
|
146
|
-
|
|
152
|
+
row,
|
|
153
|
+
id,
|
|
147
154
|
context
|
|
148
155
|
}) : /* @__PURE__ */ jsx(AdditionalFieldValue, {
|
|
149
156
|
field: additionalField,
|
|
150
|
-
|
|
157
|
+
row,
|
|
158
|
+
id,
|
|
151
159
|
context
|
|
152
160
|
}) })
|
|
153
161
|
}, `additional_table_cell_${entity.id}_${column.key}`);
|
|
154
162
|
}, [
|
|
155
163
|
size,
|
|
156
164
|
additionalFieldsMap,
|
|
157
|
-
context
|
|
165
|
+
context,
|
|
166
|
+
scopedCollection
|
|
167
|
+
]);
|
|
168
|
+
const customizationController = useCustomizationController();
|
|
169
|
+
const dateFnsLocale = useDateFnsLocale();
|
|
170
|
+
const locale = customizationController?.locale;
|
|
171
|
+
const dateTimeFormat = customizationController?.dateTimeFormat;
|
|
172
|
+
const dateFormatting = useMemo(() => ({
|
|
173
|
+
locale,
|
|
174
|
+
dateTimeFormat,
|
|
175
|
+
dateFnsLocale
|
|
176
|
+
}), [
|
|
177
|
+
locale,
|
|
178
|
+
dateTimeFormat,
|
|
179
|
+
dateFnsLocale
|
|
158
180
|
]);
|
|
159
|
-
const engine = useCollectionScope()?.engine;
|
|
160
181
|
const collectionColumns = useMemo(() => {
|
|
161
182
|
const columnsResult = propertiesToColumns({
|
|
162
183
|
properties,
|
|
163
184
|
sortable,
|
|
164
185
|
fixedFilter,
|
|
165
186
|
engine,
|
|
187
|
+
dateFormatting,
|
|
188
|
+
inlineEditing,
|
|
166
189
|
AdditionalHeaderWidget
|
|
167
190
|
});
|
|
168
191
|
const propertyColumnKeys = new Set(columnsResult.map((col) => col.key));
|
|
@@ -179,6 +202,8 @@ var CollectionTableBinding = function CollectionTableBinding({ className, style,
|
|
|
179
202
|
sortable,
|
|
180
203
|
fixedFilter,
|
|
181
204
|
engine,
|
|
205
|
+
dateFormatting,
|
|
206
|
+
inlineEditing,
|
|
182
207
|
AdditionalHeaderWidget,
|
|
183
208
|
additionalFields
|
|
184
209
|
]);
|
|
@@ -187,7 +212,7 @@ var CollectionTableBinding = function CollectionTableBinding({ className, style,
|
|
|
187
212
|
const stableIdHeaderWidget = idHeaderWidgetRef.current;
|
|
188
213
|
const idColumn = useMemo(() => ({
|
|
189
214
|
key: "id_ewcfedcswdf3",
|
|
190
|
-
width: getIdColumnWidth?.() ?? (largeLayout ? 140 : 120),
|
|
215
|
+
width: getIdColumnWidth?.(largeLayout) ?? (largeLayout ? 140 : 120),
|
|
191
216
|
title: "ID",
|
|
192
217
|
resizable: false,
|
|
193
218
|
frozen: largeLayout,
|
|
@@ -259,7 +284,7 @@ var CollectionTableBinding = function CollectionTableBinding({ className, style,
|
|
|
259
284
|
return /* @__PURE__ */ jsxs("div", {
|
|
260
285
|
ref,
|
|
261
286
|
style,
|
|
262
|
-
className: cls("h-full w-full flex flex-col bg-surface-card", className),
|
|
287
|
+
className: cls("h-full min-h-0 w-full flex flex-col bg-surface-card", className),
|
|
263
288
|
children: [!hideToolbar && /* @__PURE__ */ jsx(CollectionTableToolbar, {
|
|
264
289
|
onTextSearch,
|
|
265
290
|
title,
|