@rebasepro/cms 0.28.2 → 0.29.0-canary.g0e3a0e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/collection_editor/_cms_internals.d.ts +0 -1
- package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -2
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +2 -2
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -1
- package/dist/components/AdditionalFieldValue.d.ts +9 -3
- package/dist/components/AdditionalFieldValue.js +7 -4
- package/dist/components/AdditionalFieldValue.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +117 -18
- package/dist/components/CollectionPanel.js +115 -37
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +5 -5
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +16 -12
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +33 -8
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +8 -3
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +9 -1
- package/dist/components/CollectionTableBinding/column_utils.js +6 -3
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +3 -2
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +9 -7
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +26 -2
- package/dist/components/CollectionTableBinding/internal/common.js +88 -4
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +4 -3
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +19 -14
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionAddButton.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js +50 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +11 -3
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -4
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +29 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js +112 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +58 -16
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.d.ts +57 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +22 -26
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +58 -22
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +81 -1089
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +152 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js +38 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.d.ts +13 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js +32 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.d.ts +14 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js +22 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +39 -67
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js +54 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.d.ts +24 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js +69 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +34 -23
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.d.ts +17 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +107 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +15 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js +49 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +35 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js +45 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/RowActions.d.ts +40 -0
- package/dist/components/CollectionViewBinding/RowActions.js +60 -0
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +7 -4
- package/dist/components/CollectionViewBinding/SplitListView.js +20 -21
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/builtin_action_props.d.ts +13 -0
- package/dist/components/CollectionViewBinding/fields.d.ts +22 -0
- package/dist/components/CollectionViewBinding/fields.js +47 -0
- package/dist/components/CollectionViewBinding/fields.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +6 -7
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.d.ts +19 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js +28 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js.map +1 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +125 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +844 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +20 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +23 -2
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +21 -3
- package/dist/components/CollectionViewBinding/useSelectionController.js +37 -6
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +3 -3
- package/dist/components/CollectionsProvider.js +4 -4
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/CollectionsScopeContext.d.ts +1 -1
- package/dist/components/CollectionsScopeContext.js +1 -1
- package/dist/components/CollectionsScopeContext.js.map +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +2 -2
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +32 -68
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js +5 -4
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -2
- package/dist/components/EditViewBinding.js +25 -15
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.js +8 -5
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +8 -1
- package/dist/components/EntityViewBinding.js +43 -14
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +40 -0
- package/dist/components/EntityViewBody.js +90 -0
- package/dist/components/EntityViewBody.js.map +1 -0
- package/dist/components/FieldValue.d.ts +50 -0
- package/dist/components/FieldValue.js +81 -0
- package/dist/components/FieldValue.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PanelNotFound.d.ts +5 -0
- package/dist/components/PanelNotFound.js +21 -0
- package/dist/components/PanelNotFound.js.map +1 -0
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/components/RebaseCMS.js +11 -3
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +9 -3
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RebaseShell.js +10 -5
- package/dist/components/RebaseShell.js.map +1 -1
- package/dist/components/RecordDetail.d.ts +61 -0
- package/dist/components/RecordDetail.js +123 -0
- package/dist/components/RecordDetail.js.map +1 -0
- package/dist/components/RecordForm.d.ts +126 -0
- package/dist/components/{EntityFormPanel.js → RecordForm.js} +64 -36
- package/dist/components/RecordForm.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +47 -17
- package/dist/components/ReferenceTable/SelectionTableBinding.js +89 -53
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +5 -3
- package/dist/components/ReferenceWidget.js +10 -7
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.js +4 -4
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +2 -3
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.js +1 -1
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
- package/dist/components/SidePanelBinding.js +13 -12
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/collection_prop.d.ts +18 -0
- package/dist/components/collection_prop.js +23 -0
- package/dist/components/collection_prop.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +54 -54
- package/dist/components/common/default_entity_actions.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +4 -1
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/components/history/LastEditedByFormAction.d.ts +1 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/data_export/export/ExportCollectionAction.d.ts +3 -2
- package/dist/data_export/export/ExportCollectionAction.js +4 -3
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +6 -3
- package/dist/data_export/export/additional_fields.js +8 -4
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.js +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/EntityForm.js +252 -150
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js +3 -2
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.d.ts +1 -1
- package/dist/form/EntityFormBinding.js +22 -11
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormField.d.ts +36 -0
- package/dist/form/FormField.js +41 -0
- package/dist/form/FormField.js.map +1 -0
- package/dist/form/FormFieldsContext.d.ts +69 -0
- package/dist/form/FormFieldsContext.js +143 -0
- package/dist/form/FormFieldsContext.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +4 -4
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/collection_showing.d.ts +8 -0
- package/dist/form/collection_showing.js +29 -0
- package/dist/form/collection_showing.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +2 -1
- package/dist/form/components/ErrorFocus.js.map +1 -1
- package/dist/form/components/FieldBlock.js +3 -1
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +5 -1
- package/dist/form/components/FormRail.js +5 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/FormSections.d.ts +5 -1
- package/dist/form/components/FormSections.js +11 -4
- package/dist/form/components/FormSections.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/form_dom_ids.d.ts +25 -0
- package/dist/form/form_dom_ids.js +42 -0
- package/dist/form/form_dom_ids.js.map +1 -0
- package/dist/form/index.d.ts +3 -1
- package/dist/form/resolve_cell_property.d.ts +5 -0
- package/dist/form/resolve_cell_property.js +22 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +2 -2
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.d.ts +3 -3
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/useResolvedCollections.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.js +9 -9
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useEntityDisplay.js +6 -4
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useRecordActions.js +2 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useSelectionDialog.d.ts +20 -7
- package/dist/hooks/useSelectionDialog.js +29 -8
- package/dist/hooks/useSelectionDialog.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +15 -9
- package/dist/mcp-view.d.ts +9 -0
- package/dist/mcp-view.js +2 -0
- package/dist/mcp_view/app_modules.d.ts +29 -0
- package/dist/mcp_view/app_modules.js +163 -0
- package/dist/mcp_view/app_modules.js.map +1 -0
- package/dist/mcp_view/bridge.d.ts +90 -0
- package/dist/mcp_view/bridge.js +205 -0
- package/dist/mcp_view/bridge.js.map +1 -0
- package/dist/mcp_view/code_app.d.ts +65 -0
- package/dist/mcp_view/code_app.js +139 -0
- package/dist/mcp_view/code_app.js.map +1 -0
- package/dist/mcp_view/index.d.ts +48 -0
- package/dist/mcp_view/index.js +235 -0
- package/dist/mcp_view/index.js.map +1 -0
- package/dist/mcp_view/payload.d.ts +78 -0
- package/dist/mcp_view/payload.js +155 -0
- package/dist/mcp_view/payload.js.map +1 -0
- package/dist/mcp_view/screen.d.ts +28 -0
- package/dist/mcp_view/screen.js +223 -0
- package/dist/mcp_view/screen.js.map +1 -0
- package/dist/mcp_view/storage_source.d.ts +14 -0
- package/dist/mcp_view/storage_source.js +29 -0
- package/dist/mcp_view/storage_source.js.map +1 -0
- package/dist/mcp_view/store.d.ts +9 -0
- package/dist/mcp_view/store.js +27 -0
- package/dist/mcp_view/store.js.map +1 -0
- package/dist/mcp_view/tool_driver.d.ts +135 -0
- package/dist/mcp_view/tool_driver.js +527 -0
- package/dist/mcp_view/tool_driver.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +34 -1
- package/dist/preview/components/DatePreview.js +72 -37
- package/dist/preview/components/DatePreview.js.map +1 -1
- package/dist/routes/RebaseRoute.js +1 -1
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +5 -3
- package/dist/selection/SelectionMenu.js +16 -9
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/index.d.ts +2 -1
- package/dist/selection/resolve_selection.d.ts +61 -7
- package/dist/selection/resolve_selection.js +93 -11
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/types/components/EntityFormProps.d.ts +60 -10
- package/dist/types/fields.d.ts +2 -65
- package/dist/util/dataControllerAdapter.d.ts +8 -0
- package/dist/util/dataControllerAdapter.js +11 -0
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/navigation_utils.d.ts +5 -4
- package/dist/util/navigation_utils.js +6 -6
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +8 -0
- package/dist/util/propertyConfigMapper.js +16 -2
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/package.json +15 -9
- package/recipes/README.md +79 -26
- package/recipes/approval-queue.tsx +79 -0
- package/recipes/bulk-set-status.tsx +23 -17
- package/recipes/calendar-view.tsx +28 -23
- package/recipes/master-detail.tsx +75 -0
- package/recipes/my-preferences.tsx +3 -3
- package/recipes/orders-dashboard.tsx +58 -84
- package/recipes/site-settings.tsx +4 -4
- package/dist/components/EntityFormPanel.d.ts +0 -63
- package/dist/components/EntityFormPanel.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionViewBinding.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewBinding.tsx"],"sourcesContent":["import type { OrderByTuple, Property } from \"@rebasepro/types\";\nimport { serializeOrderBy } from \"@rebasepro/common\";\nimport type { AdditionalFieldDelegate, EntityAction, AdminCollection, SlotContribution } from \"@rebasepro/cms-types\";\nimport {\n Entity,\n EntityReference,\n FilterValues,\n getCollectionDataPath\n} from \"@rebasepro/types\";\nimport {\n CollectionCustomViewParams,\n CollectionSize,\n EntitySelection,\n EntityTableController,\n PartialCollectionConfig,\n SelectionQuery,\n ViewMode\n} from \"@rebasepro/cms-types\";\nimport { serializeSelectionQuery } from \"../../selection\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useSearchParams } from \"react-router\";\n\nimport { deepEqual as equal, shallowEqual } from \"fast-equals\"\nimport { CollectionRowActions, CollectionTableBinding } from \"../CollectionTableBinding\";\nimport { CollectionTableToolbar } from \"../CollectionTableBinding/internal/CollectionTableToolbar\";\nimport { getEntityChildViews } from \"@rebasepro/common\";\nimport { useCollectionInlineEditor } from \"./hooks/useCollectionInlineEditor\";\nimport { navigateToEntity } from \"../../util/navigation_utils\";\nimport { mergeEntityActions } from \"../../util/entity_actions\";\nimport { resolveCollectionViews, resolveEntityAction } from \"../../util/resolutions\";\nimport { getPropertyInPath } from \"../../util/property_utils\";\nimport { ReferencePreview } from \"../../preview\";\nimport {\n CollectionScopeProvider,\n OnColumnResizeParams,\n getRedundantChildViewColumnIds,\n useAnalyticsController,\n useAuthController,\n useColumnIds,\n useComponentOverride,\n useCustomizationController,\n useData,\n useDataTableController,\n useLargeLayout,\n populateFetchCache,\n usePermissions,\n useScrollRestoration,\n useSlot,\n useTranslation,\n useUserConfigurationPersistence\n} from \"@rebasepro/app\";\nimport { CollectionViewActions } from \"./CollectionViewActions\";\nimport { CollectionCardViewBinding } from \"./CollectionCardViewBinding\";\nimport { CollectionListViewBinding } from \"./CollectionListViewBinding\";\nimport { SplitListView } from \"./SplitListView\";\nimport { CollectionBoardViewBinding } from \"./CollectionBoardViewBinding\";\nimport { KanbanPropertyOption, ViewModeToggle } from \"./ViewModeToggle\";\nimport { DefaultCollectionEmptyState } from \"./DefaultCollectionEmptyState\";\nimport {\n Alert,\n ArrowRightToLineIcon,\n Button,\n cls,\n ErrorBoundary,\n focusedDisabled,\n IconButton,\n iconSize,\n PlusIcon,\n Popover,\n SearchIcon,\n TextField,\n Tooltip,\n Typography,\n VirtualTableColumn\n} from \"@rebasepro/ui\";\nimport { getSubcollectionColumnId } from \"../CollectionTableBinding/internal/common\";\nimport { copyEntityAction, deleteEntityAction, editEntityAction, unlinkEntityAction } from \"../common/default_entity_actions\";\nimport { PopupFormField } from \"../CollectionTableBinding/internal/popup_field/PopupFormField\";\nimport { GetPropertyForProps } from \"../CollectionTableBinding/CollectionTableBindingProps\";\nimport { resolveCellProperty } from \"../../form/resolve_cell_property\";\nimport { DeleteEntityDialog } from \"../DeleteEntityDialog\";\nimport { useSelectionController } from \"./useSelectionController\";\nimport { CollectionViewStartActions } from \"./CollectionViewStartActions\";\nimport { addRecentId, getRecentIds } from \"./utils\";\nimport { isViewMode, OpenEntityMode, resolveOpenEntityMode, VIEW_MODE_PARAM, VIEW_MODES } from \"../../util/view_mode\";\nimport { mergeDeep } from \"@rebasepro/utils\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { useCollectionRegistryController } from \"../../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useSidePanel } from \"../../hooks/useSidePanel\";\nimport { useUrlController } from \"../../hooks/navigation/contexts/UrlContext\";\nimport { useChildViewSource } from \"../../hooks/useChildViewSource\";\nimport { useSelectionDialog } from \"../../hooks/useSelectionDialog\";\nimport { resolveComponentRef, saveEntityWithCallbacks } from \"@rebasepro/app\";\n\nconst EMPTY_ARRAY: never[] = [];\n\n/** What the plugins contributed to the table's add-column slot, for {@link PluginAddColumnComponents}. */\nconst PluginAddColumnsContext = React.createContext<React.ReactNode[]>(EMPTY_ARRAY);\n\nfunction PluginAddColumnComponents() {\n const components = React.useContext(PluginAddColumnsContext);\n return (\n <div className=\"flex flex-row items-center gap-2\">\n {components}\n </div>\n );\n}\n\n/**\n * What the plugins' column-header actions are handed besides their column:\n * this render's collection and table controller. `null` when no plugin\n * contributes one.\n */\ntype HeaderActionsScope = {\n contributions: SlotContribution<\"collection.header.action\">[],\n path: string,\n collection: AdminCollection,\n tableController: EntityTableController,\n parentCollectionSlugs: string[],\n parentEntityIds: string[]\n};\nconst PluginHeaderActionsContext = React.createContext<HeaderActionsScope | null>(null);\n\n/**\n * The `collection.header.action` contributions for one column. One component\n * type for the life of the view, like {@link PluginAddColumnComponents}: the\n * table's columns are built once, and their headers re-render only when their\n * own props change, so what the actions are handed reaches them through\n * context. It was closed over when the header was built — the table controller\n * of the first render (a search, filter or sort typed since never reached a\n * header action) and the collection of the render before.\n */\nfunction PluginHeaderActions({\n property,\n propertyKey,\n onHover\n}: {\n property: Property,\n propertyKey: string,\n onHover: boolean\n}) {\n const scope = React.useContext(PluginHeaderActionsContext);\n if (!scope) return null;\n const headerSlotProps = {\n property,\n propertyKey,\n onHover,\n path: scope.path,\n collection: scope.collection,\n tableController: scope.tableController,\n parentCollectionSlugs: scope.parentCollectionSlugs,\n parentEntityIds: scope.parentEntityIds\n };\n return <>{scope.contributions.map((s, i) => (\n <ErrorBoundary key={`header_action_${propertyKey}_${i}`}>\n <s.Component {...headerSlotProps} {...(s.props ?? {})}/>\n </ErrorBoundary>\n ))}</>;\n}\n\n/**\n * @group Components\n */\nexport type CollectionViewBindingProps<M extends Record<string, unknown>> = {\n /**\n * The path the collection is addressed by: its slug, or for a\n * subcollection `parentSlug/{id}/slug`. Defaults to the collection's slug.\n * Not the `path` a Firestore or MongoDB collection declares for its store:\n * the data layer translates to that one, and another collection's slug may\n * be spelled the same.\n */\n path?: string;\n /**\n * Full path using navigation ids.\n */\n idPath?: string;\n /**\n * If this is a subcollection, specify the parent collection ids.\n */\n parentCollectionSlugs?: string[], parentEntityIds?: string[];\n /**\n * Whether this is a subcollection or not.\n */\n isSubCollection?: boolean;\n\n className?: string;\n\n /**\n * If true, this view will store its filter and sorting status in the url params\n */\n updateUrl?: boolean;\n\n /**\n * When provided, the split view will render this entity's detail panel.\n * Used by the router to pass the entity ID from the URL path.\n */\n selectedEntityId?: string | number;\n\n /**\n * When provided, the split view will open this tab (e.g. a subcollection slug)\n * in the entity detail panel. Used by the router to pass the subcollection from the URL.\n */\n selectedTab?: string;\n\n} & AdminCollection<M>;\n\n/**\n * Props a caller commonly rebuilds on every render — a parent path array, a\n * properties object, an `Actions` list made with `toArray` — compared by value,\n * so a re-render that builds the same ones again does not redraw the view.\n */\nconst PROPS_COMPARED_BY_VALUE = new Set<string>([\n \"path\", \"parentCollectionSlugs\", \"parentEntityIds\", \"isSubCollection\", \"className\",\n \"properties\", \"propertiesOrder\", \"hideIdFromCollection\", \"inlineEditing\", \"selectionEnabled\",\n \"selectionController\", \"Actions\", \"defaultSize\", \"includeJsonView\", \"additionalFields\",\n \"sideDialogWidth\", \"openEntityMode\", \"exportable\", \"history\", \"fixedFilter\",\n \"selectedEntityId\", \"selectedTab\"\n]);\n\n/**\n * Whether the view would draw the same thing with these props.\n *\n * Every prop counts: the listed ones by value, every other one — the name, the\n * entity actions, the custom views, the callbacks, anything a collection\n * carries — by reference. It used to compare the listed ones only, so a\n * collection passed as props (one not in the registry, where the view reads it\n * from) that changed anything else was never redrawn. A caller spreading a\n * registry collection hands over the same references each render.\n */\nfunction collectionViewPropsEqual(a: CollectionViewBindingProps<any>, b: CollectionViewBindingProps<any>): boolean {\n const previous = a as Record<string, unknown>;\n const next = b as Record<string, unknown>;\n const keys = new Set([...Object.keys(previous), ...Object.keys(next)]);\n for (const key of keys) {\n if (previous[key] === next[key]) continue;\n if (PROPS_COMPARED_BY_VALUE.has(key) && equal(previous[key], next[key])) continue;\n return false;\n }\n return true;\n}\n\n/**\n * This component is in charge of binding a driver path with an {@link AdminCollection}\n * where it's configuration is defined. It includes an infinite scrolling table\n * and a 'Add' new entities button,\n *\n * This component is the default one used for displaying entity collections\n * and is in charge of generating all the specific actions and customization\n * of the lower level {@link CollectionTableBinding}\n *\n * Please **note** that you only need to use this component if you are building\n * a custom view. If you just need to create a default view you can do it\n * exclusively with config options.\n *\n * If you need a lower level implementation with more granular options, you\n * can use {@link CollectionTableBinding}.\n *\n * If you need a generic table that is not bound to the driver or entities and\n * properties at all, you can check {@link VirtualTable}\n *\n * @param path\n * @param collection\n\n * @group Components\n */\nconst CollectionViewBindingInner = React.memo(\n function CollectionViewBindingInner<M extends Record<string, unknown>>({\n path: pathProp,\n\n parentCollectionSlugs, parentEntityIds,\n isSubCollection,\n className,\n updateUrl,\n selectedEntityId: selectedEntityIdProp,\n selectedTab: selectedTabProp,\n ...collectionProp\n }: CollectionViewBindingProps<M>\n ) {\n\n const { t } = useTranslation();\n const context = useAdminContext();\n const collectionRegistry = useCollectionRegistryController();\n const urlController = useUrlController();\n const path = pathProp ?? collectionProp.slug;\n const dataClient = useData();\n const sidePanelController = useSidePanel();\n const authController = useAuthController();\n const userConfigPersistence = useUserConfigurationPersistence();\n const analyticsController = useAnalyticsController();\n const customizationController = useCustomizationController();\n const { canCreate, canEdit, canDelete } = usePermissions();\n\n\n /**\n * Rows shared with other parents through a junction. The parent owns\n * the link, not the row — so the destructive action is a removal from\n * this record, which is what the server performs for such a path.\n */\n const childViewSource = useChildViewSource(path);\n const isLinkedChildView = childViewSource?.kind === \"relation\" && childViewSource.mode === \"linked\";\n const linkedTargetSlug = isLinkedChildView && childViewSource.kind === \"relation\"\n ? childViewSource.targetSlug\n : undefined;\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n\n const scrollRestoration = useScrollRestoration();\n\n // `collectionProp` is a rest object: a new value on every render of this\n // component, even when nothing in it changed. Everything below derives\n // from it — the merged collection, its properties, the table's columns —\n // so an identity-only change rebuilt all of them each render, and\n // `mergeDeep` handed back a fresh `propertiesOrder` array every time,\n // which the sync effect below read as a change and set state for: a\n // render loop, and a table that threw away the column width the user\n // had just dragged. Hold the last rest object that actually differs.\n //\n // Shallow is enough, and is the comparison that fits: a re-render this\n // component causes itself re-spreads the same props, so every value in\n // the new object is the same reference. A render caused from above has\n // already been through this component's own props comparator, which is\n // where a deep difference is decided.\n const collectionPropRef = React.useRef(collectionProp);\n if (!shallowEqual(collectionPropRef.current, collectionProp)) {\n collectionPropRef.current = collectionProp;\n }\n const stableCollectionProp = collectionPropRef.current;\n\n const collection = useMemo(() => {\n const registryCollection = collectionRegistry.getCollection(path) || stableCollectionProp;\n const userOverride = userConfigPersistence?.getCollectionConfig<M>(path);\n return (userOverride ? mergeDeep(registryCollection, userOverride) : registryCollection) as AdminCollection<M>;\n }, [stableCollectionProp, path, userConfigPersistence, collectionRegistry]);\n\n const collectionRef = React.useRef(collection);\n useEffect(() => {\n collectionRef.current = collection;\n }, [collection]);\n\n const canCreateEntities = canCreate(collection, path);\n const [highlightedEntity, setHighlightedEntity] = useState<Entity<M> | undefined>(undefined);\n const [deleteEntityClicked, setDeleteEntityClicked] = React.useState<Entity<M> | EntitySelection<M> | undefined>(undefined);\n\n const [lastDeleteTimestamp, setLastDeleteTimestamp] = React.useState<number>(0);\n\n // Track recently deleted entities for optimistic Kanban count updates\n const [deletedEntities, setDeletedEntities] = React.useState<Entity<M>[]>([]);\n\n // number of entities in the collection (undefined = loading)\n const [docsCount, setDocsCount] = useState<number | null | undefined>(null);\n\n // Optimistic state for column order to prevent UI flickering during persistence\n const [localPropertiesOrder, setLocalPropertiesOrder] = useState<string[] | undefined>(collection.propertiesOrder);\n\n // Sync local state with collection's propertiesOrder when it changes from\n // external sources. By value, not by identity: the merged collection is\n // rebuilt whenever the user config changes, and an array with the same\n // keys in it is not an external change to follow.\n useEffect(() => {\n setLocalPropertiesOrder(previous => equal(previous, collection.propertiesOrder) ? previous : collection.propertiesOrder);\n }, [collection.propertiesOrder]);\n\n const unselectNavigatedEntity = useCallback(() => {\n const currentSelection = highlightedEntity;\n setTimeout(() => {\n if (currentSelection === highlightedEntity)\n setHighlightedEntity(undefined);\n }, 2400);\n }, [highlightedEntity]);\n\n // From this render's collection. It was read from `collectionRef`,\n // which an effect updates after the render that reads it, so a change\n // to `inlineEditing` (or to what the user may edit) reached the table\n // one render late — or never, if nothing rendered again.\n const inlineEditingEnabled = canEdit(collection, path, null) &&\n (collection.inlineEditing === undefined || collection.inlineEditing);\n\n const selectionEnabled = collection.selectionEnabled === undefined || collection.selectionEnabled;\n const hoverRow = !inlineEditingEnabled;\n\n const [popOverOpen, setPopOverOpen] = useState(false);\n\n // Custom view modes this collection can render: the ones declared\n // inline plus the ones it names by key from the app-level registry.\n // Anything unresolvable is dropped here, once, so every consumer below\n // — the switcher, `enabledViews`, the URL and saved-config checks —\n // agrees on what exists.\n const resolvedCustomViews = useMemo(\n () => resolveCollectionViews(collection.customViews, customizationController.collectionViews),\n [collection.customViews, customizationController]\n );\n\n const customViewKeys = useMemo(\n () => resolvedCustomViews.map((v) => v.key),\n [resolvedCustomViews]\n );\n\n // View mode priority: URL > saved user config > collection.defaultViewMode\n const defaultViewMode = isViewMode(collection.defaultViewMode, customViewKeys)\n ? collection.defaultViewMode\n // Covers a `defaultViewMode` naming a custom view that has since\n // been removed from config; without this the collection would open\n // on a mode nothing renders.\n : \"list\";\n const [searchParams, setSearchParams] = useSearchParams();\n\n // Read view from React Router's searchParams (reactive on back/forward)\n const urlView = useMemo((): ViewMode | null => {\n const v = searchParams.get(VIEW_MODE_PARAM);\n return isViewMode(v, customViewKeys) ? v : null;\n }, [searchParams, customViewKeys]);\n\n // Get saved view from local persistence.\n //\n // Validated rather than cast: what is stored is whatever the user last\n // picked, and a custom view removed from config since then would come\n // back as a mode nothing renders — a blank panel with a working\n // toolbar above it. An unrecognised value reads as \"nothing saved\",\n // which falls through to the collection default.\n const getSavedView = useCallback((): ViewMode | null => {\n const saved = userConfigPersistence?.getCollectionConfig<M>(path)?.defaultViewMode;\n return isViewMode(saved, customViewKeys) ? saved : null;\n }, [userConfigPersistence, path, customViewKeys]);\n\n const [viewMode, setViewModeState] = useState<ViewMode>(() => {\n // Priority: URL > saved config > collection default\n if (urlView) return urlView;\n const savedView = getSavedView();\n if (savedView) return savedView;\n return defaultViewMode;\n });\n\n const activeCustomView = useMemo(\n () => resolvedCustomViews.find((v) => v.key === viewMode),\n [resolvedCustomViews, viewMode]\n );\n\n const openEntityMode = resolveOpenEntityMode({\n collection,\n viewMode,\n customView: activeCustomView\n });\n\n // Sync URL with current view on init (if view came from saved config)\n useEffect(() => {\n if (!urlView && viewMode !== defaultViewMode) {\n // View came from saved config but URL doesn't have it - update URL without push\n // Built from `window.location.search`, not React Router's\n // `prev`. The table controller writes the filter, sort and\n // search params with `history.replaceState`, which React Router\n // never observes — so `prev` is a stale snapshot, and merging\n // into it silently dropped whatever it had not seen. Switching\n // view mode after typing a search wiped `search=` from the URL,\n // and the next reload came back unfiltered.\n setSearchParams(() => {\n const next = new URLSearchParams(window.location.search);\n next.set(VIEW_MODE_PARAM, viewMode);\n return next;\n }, { replace: true });\n }\n }, []); // Only on mount\n\n // Update URL when view mode changes (user action)\n const setViewMode = useCallback((newMode: ViewMode) => {\n setViewModeState(newMode);\n\n // Update URL with __view param via React Router\n setSearchParams(() => {\n // See the note above: the live URL is the only writer both\n // this and the table controller agree on.\n const next = new URLSearchParams(window.location.search);\n if (newMode === defaultViewMode) {\n next.delete(VIEW_MODE_PARAM);\n } else {\n next.set(VIEW_MODE_PARAM, newMode);\n }\n return next;\n });\n }, [defaultViewMode, setSearchParams]);\n\n // Sync viewMode state when URL changes via back/forward navigation\n useEffect(() => {\n if (urlView) {\n setViewModeState(urlView);\n } else {\n const savedView = getSavedView();\n setViewModeState(savedView ?? defaultViewMode);\n }\n }, [urlView, getSavedView, defaultViewMode]);\n\n // List view size state - controls row height and info density\n const [listSize, setListSize] = useState<CollectionSize>(collection.defaultSize ?? \"m\");\n\n // Card view size state - controls the grid column count\n const [cardSize, setCardSize] = useState<CollectionSize>(collection.defaultSize ?? \"m\");\n\n // Table view size state - controls row height\n const [tableSize, setTableSize] = useState<CollectionSize>(collection.defaultSize ?? \"m\");\n\n // Size for custom views that opted in with `sizeable`. One piece of\n // state for all of them: only the active view reads it, and switching\n // between two sizeable custom views keeping the same density is the\n // less surprising behaviour.\n const [customViewSize, setCustomViewSize] = useState<CollectionSize>(collection.defaultSize ?? \"m\");\n\n const selectionController = useSelectionController<M>();\n const usedSelectionController = collection.selectionController ?? selectionController;\n const {\n selection,\n clearSelection,\n toggleEntitySelection\n } = usedSelectionController;\n\n const tableController = useDataTableController<M>({\n path,\n collection,\n lastDeleteTimestamp,\n scrollRestoration,\n updateUrl,\n // The board reads only the search and filters from it; each of its\n // columns runs its own window. A live first page here would be one\n // more subscription nothing draws.\n enabled: viewMode !== \"kanban\"\n });\n\n const tableKey = React.useRef<string>(Math.random().toString(36));\n const popupCell = tableController.popupCell as {\n entityId: string | number;\n propertyKey: Extract<keyof M, string>;\n cellRect?: DOMRect;\n } | undefined;\n\n const onPopupClose = useCallback(() => {\n tableController.setPopupCell?.(undefined);\n }, [tableController.setPopupCell]);\n\n const onEntityClick = useCallback((clickedEntity: Entity<M>) => {\n const collection = collectionRef.current;\n setHighlightedEntity(clickedEntity);\n analyticsController.onAnalyticsEvent?.(\"edit_entity_clicked\", {\n path: clickedEntity.path,\n entityId: clickedEntity.id\n });\n\n if (collection) {\n addRecentId(collection.slug, clickedEntity.id);\n }\n\n const entityPath = path ?? clickedEntity.path;\n // The row on screen is what the record opens with, while its own\n // read catches up — the one row clicked, not every row held.\n populateFetchCache(entityPath, [clickedEntity]);\n navigateToEntity({\n navigation: urlController,\n path: entityPath,\n sidePanelController,\n openEntityMode,\n collection,\n entityId: clickedEntity.id,\n replace: openEntityMode === \"split\" && selectedEntityIdProp !== undefined\n });\n\n }, [sidePanelController, openEntityMode, selectedEntityIdProp, path, urlController, analyticsController]);\n\n // A record created in the side panel or a dialog leaves this view\n // mounted, so it says so the way a delete does: the toolbar counts\n // again, and a table without realtime reads its rows again.\n const onCreatedInPanel = useCallback(() => {\n setLastDeleteTimestamp(Date.now());\n }, []);\n\n /**\n * Attach rows that already exist to this parent.\n *\n * Writing to the row's own address under this parent — `PUT\n * posts/1/tags/5` — is what asserts membership; the backend writes the\n * junction row idempotently. Sending no values keeps it a pure link:\n * the target's own fields are none of this tab's business.\n */\n const linkExistingEntities = useCallback(async (entities: Entity<M>[]) => {\n const alreadyLinked = new Set(tableController.data.map(e => String(e.id)));\n const toLink = entities.filter(e => !alreadyLinked.has(String(e.id)));\n if (toLink.length === 0) return;\n\n try {\n await Promise.all(toLink.map(entity =>\n saveEntityWithCallbacks<M>({\n path,\n entityId: entity.id,\n values: {} as Partial<M>,\n status: \"existing\",\n collection,\n data: dataClient,\n context\n })\n ));\n setLastDeleteTimestamp(Date.now());\n } catch (e) {\n context.snackbarController?.open({\n type: \"error\",\n message: e instanceof Error ? e.message : String(e)\n });\n }\n }, [dataClient, path, tableController.data, collection, context]);\n\n const selectionDialog = useSelectionDialog<M>({\n // The whole target collection, not this parent's slice of it —\n // otherwise the picker could only ever show rows already linked.\n path: linkedTargetSlug ?? false,\n multiselect: true,\n // On Done, not on every tick: linking is a write, and a row ticked\n // and then unticked must not end up linked.\n onSelectionDone: linkExistingEntities\n });\n\n const openNewDocument = useCallback((defaultValues?: Record<string, unknown>) => {\n const collection = collectionRef.current;\n analyticsController.onAnalyticsEvent?.(\"new_entity_click\", {\n path: path\n });\n navigateToEntity({\n openEntityMode,\n collection,\n entityId: undefined,\n defaultValues,\n path: path,\n sidePanelController,\n navigation: urlController,\n onClose: unselectNavigatedEntity,\n onUpdate: onCreatedInPanel\n });\n }, [path, sidePanelController, openEntityMode, urlController, unselectNavigatedEntity, onCreatedInPanel]);\n\n // The toolbar's \"new\" and a board column's \"add\" open the same form,\n // one of them with values filled in.\n const onNewClick = useCallback(() => openNewDocument(), [openNewDocument]);\n\n const onMultipleDeleteClick = () => {\n analyticsController.onAnalyticsEvent?.(\"multiple_delete_dialog_open\", {\n path: path\n });\n // The selection itself, not rows: in query mode there are no rows to\n // hand over yet. The dialog confirms against the count and reads\n // them only once the user has said yes.\n setDeleteEntityClicked(selection);\n };\n\n const internalOnEntityDelete = (_path: string, entity: Entity<M>) => {\n analyticsController.onAnalyticsEvent?.(\"single_entity_deleted\", {\n path: path\n });\n // Untick rather than filter a list: in query mode the list does not\n // exist, and \"the ones I selected, minus this one\" is precisely an\n // exclusion.\n toggleEntitySelection(entity, false);\n setDeletedEntities(prev => [...prev, entity]);\n setLastDeleteTimestamp(Date.now());\n };\n\n const internalOnMultipleEntitiesDelete = (_path: string, entities: Entity<M>[]) => {\n analyticsController.onAnalyticsEvent?.(\"multiple_entities_deleted\", {\n path: path\n });\n clearSelection();\n setDeleteEntityClicked(undefined);\n setDeletedEntities(prev => [...prev, ...entities]);\n setLastDeleteTimestamp(Date.now());\n };\n\n const pluginAddColumnComponents = useSlot(\"collection.add-column\", {\n path,\n parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,\nparentEntityIds: parentEntityIds ?? EMPTY_ARRAY,\n collection,\n tableController\n });\n\n const pluginToolbarWidgets = useSlot(\"collection.toolbar\", {\n path,\n parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,\nparentEntityIds: parentEntityIds ?? EMPTY_ARRAY,\n collection: collection,\n tableController: tableController,\n selectionController: usedSelectionController\n });\n\n const pluginEmptyStates = useSlot(\"collection.empty-state\", {\n path,\n parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,\nparentEntityIds: parentEntityIds ?? EMPTY_ARRAY,\n collection,\n canCreate: canCreateEntities,\n onNewClick\n });\n\n const pluginWidgets = useSlot(\"collection.widgets\", {\n path,\n parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,\nparentEntityIds: parentEntityIds ?? EMPTY_ARRAY,\n collection\n });\n\n const onCollectionModifiedForUser = useCallback((path: string, partialCollection: PartialCollectionConfig<M>) => {\n if (userConfigPersistence) {\n const currentStoredConfig = userConfigPersistence.getCollectionConfig(path);\n const updatedConfig = mergeDeep(currentStoredConfig, partialCollection);\n userConfigPersistence.onCollectionModified(path, updatedConfig);\n }\n }, [userConfigPersistence]);\n\n const onColumnResize = useCallback(({\n width,\n key\n }: OnColumnResizeParams) => {\n\n const collection = collectionRef.current;\n // Only for property columns\n if (!getPropertyInPath(collection.properties, key)) return;\n const localCollection = buildPropertyWidthOverwrite(key, width) as PartialCollectionConfig<M>;\n onCollectionModifiedForUser(path, localCollection);\n }, [onCollectionModifiedForUser, path]);\n\n const onListSizeChanged = useCallback((size: CollectionSize) => {\n setListSize(size);\n if (userConfigPersistence)\n onCollectionModifiedForUser(path, { defaultSize: size })\n }, [onCollectionModifiedForUser, path, userConfigPersistence]);\n\n const onTableSizeChanged = useCallback((size: CollectionSize) => {\n setTableSize(size);\n if (userConfigPersistence)\n onCollectionModifiedForUser(path, { defaultSize: size })\n }, [onCollectionModifiedForUser, path, userConfigPersistence]);\n\n // View mode change: update URL + save to local persistence\n const onViewModeChange = useCallback((mode: ViewMode) => {\n analyticsController.onAnalyticsEvent?.(\"view_mode_changed\", {\n path: path,\n from: viewMode,\n to: mode\n });\n setViewMode(mode);\n // Save to local persistence for next visit\n if (userConfigPersistence) {\n onCollectionModifiedForUser(path, { defaultViewMode: mode } as PartialCollectionConfig<M>);\n }\n }, [setViewMode, userConfigPersistence, onCollectionModifiedForUser, path, analyticsController, viewMode]);\n\n const createEnabled = canCreate(collection, path);\n\n const { onValueChange, uniqueFieldValidator } = useCollectionInlineEditor({\n path,\n collection,\n dataClient,\n context\n });\n\n // In v4, collections are already resolved, so we use collection directly\n const resolvedCollection = collection;\n\n // Check if Kanban view is available (needs kanban.columnProperty with enum)\n const kanbanEnabled = useMemo(() => {\n if (!collection.kanban?.columnProperty) return false;\n const property = getPropertyInPath(resolvedCollection.properties, collection.kanban.columnProperty);\n if (!property || property.type !== \"string\") return false;\n return Boolean(\"enum\" in property && property.enum);\n }, [collection.kanban?.columnProperty, resolvedCollection.properties]);\n\n // Compute the effective enabled views:\n // - Start from collection.enabledViews (defaults to every built-in\n // plus every custom view the collection declared)\n // - Drop anything that resolves to nothing renderable\n // - Filter out kanban if no enum properties exist\n const hasEnumProperty = useMemo(() => {\n return Object.values(resolvedCollection.properties).some((p: Property) => p.type === \"string\" && \"enum\" in p && p.enum);\n }, [resolvedCollection.properties]);\n\n const enabledViews: ViewMode[] = useMemo(() => {\n // Declaring a custom view is enough to offer it — a collection\n // should not have to restate the built-ins in `enabledViews` just\n // to add one. Setting `enabledViews` explicitly still wins.\n const configured = collection.enabledViews\n ?? [...VIEW_MODES, ...customViewKeys];\n const renderable = configured.filter(v => isViewMode(v, customViewKeys));\n if (!hasEnumProperty) {\n return renderable.filter(v => v !== \"kanban\");\n }\n return renderable;\n }, [collection.enabledViews, hasEnumProperty, customViewKeys]);\n\n // Compute available enum properties for kanban column selection\n const kanbanPropertyOptions: KanbanPropertyOption[] = useMemo(() => {\n const options: KanbanPropertyOption[] = [];\n const properties = resolvedCollection.properties;\n\n for (const [key, property] of Object.entries(properties)) {\n const prop = property;\n if (prop && prop.type === \"string\" && \"enum\" in prop && prop.enum) {\n options.push({\n key,\n label: prop.name || key\n });\n }\n }\n\n return options;\n }, [resolvedCollection.properties]);\n\n // Get saved kanban property from user config\n const getSavedKanbanProperty = useCallback((): string | undefined => {\n const saved = userConfigPersistence?.getCollectionConfig<M>(path);\n return (saved as Record<string, unknown>)?.kanbanColumnProperty as string | undefined;\n }, [userConfigPersistence, path]);\n\n // Selected kanban property state - priority: saved config > collection default > first available\n const [selectedKanbanProperty, setSelectedKanbanProperty] = useState<string>(() => {\n const saved = getSavedKanbanProperty();\n if (saved && kanbanPropertyOptions.some(o => o.key === saved)) return saved;\n if (collection.kanban?.columnProperty) return collection.kanban.columnProperty;\n return kanbanPropertyOptions[0]?.key ?? \"\";\n });\n\n // Update selected property if options change and current selection is no longer valid\n useEffect(() => {\n if (kanbanPropertyOptions.length > 0 && !kanbanPropertyOptions.some(o => o.key === selectedKanbanProperty)) {\n const saved = getSavedKanbanProperty();\n if (saved && kanbanPropertyOptions.some(o => o.key === saved)) {\n setSelectedKanbanProperty(saved);\n } else if (collection.kanban?.columnProperty && kanbanPropertyOptions.some(o => o.key === collection.kanban?.columnProperty)) {\n setSelectedKanbanProperty(collection.kanban.columnProperty);\n } else {\n setSelectedKanbanProperty(kanbanPropertyOptions[0]?.key ?? \"\");\n }\n }\n }, [kanbanPropertyOptions, selectedKanbanProperty, getSavedKanbanProperty, collection.kanban?.columnProperty]);\n\n // Handle kanban property change\n const onKanbanPropertyChange = useCallback((property: string) => {\n analyticsController.onAnalyticsEvent?.(\"kanban_property_changed\", {\n path: path,\n property\n });\n setSelectedKanbanProperty(property);\n // Save to local persistence\n if (userConfigPersistence) {\n onCollectionModifiedForUser(path, { kanbanColumnProperty: property } as PartialCollectionConfig<M>);\n }\n }, [userConfigPersistence, onCollectionModifiedForUser, path, analyticsController]);\n\n const getPropertyFor = useCallback(({\n propertyKey,\n entity\n }: GetPropertyForProps<M>) => {\n let property: Property | undefined = getPropertyInPath(collection.properties, propertyKey);\n\n // we might not find the property in the collection if combining property builders and map spread\n if (!property) {\n // these 2 properties are coming from the resolved collection with default values\n property = getPropertyInPath(resolvedCollection.properties, propertyKey);\n }\n\n if (!property) return null;\n // A `conditions` rule or a `dynamicProps` result depends on the\n // row, and the inline editor is judged by it as the form is.\n return resolveCellProperty(property, propertyKey, entity as Entity<Record<string, unknown>>, {\n path,\n authController,\n propertyConfigs: customizationController.propertyConfigs\n });\n }, [collection.properties, resolvedCollection.properties, path, authController, customizationController.propertyConfigs]);\n\n // Use a collection with local propertiesOrder for optimistic UI updates\n const collectionWithLocalOrder = useMemo(() => {\n if (localPropertiesOrder && localPropertiesOrder !== resolvedCollection.propertiesOrder) {\n return {\n ...resolvedCollection,\n // Runtime column order, not authored config: these ids come\n // from the user dragging columns and include additional-field\n // and `subcollection:` ids minted below. `propertiesOrder` is\n // typed against the collection's properties for *authoring*,\n // so widening back to that type is the intent here.\n propertiesOrder: localPropertiesOrder as typeof resolvedCollection.propertiesOrder\n };\n }\n return resolvedCollection;\n }, [resolvedCollection, localPropertiesOrder]);\n\n const displayedColumnIds = useColumnIds(collectionWithLocalOrder, true);\n\n const additionalFields = useMemo(() => {\n // Each child view gets a column that jumps to its tab. Keyed by the\n // view's collection slug, which is the relation key — two relations\n // to the same target used to collapse onto one column id here.\n //\n // Except where the relation was declared as a property and so already\n // has a column showing the child rows: the button then repeated that\n // column's heading verbatim. Filtered here as well as in\n // `useColumnIds` so no id is displayed without a delegate to build it,\n // and so the column picker does not offer the one back.\n const redundant = getRedundantChildViewColumnIds(collectionWithLocalOrder);\n const subcollectionsList = getEntityChildViews(collection)\n .map(v => v.collection as AdminCollection)\n .filter(child => !redundant.has(getSubcollectionColumnId(child)));\n const subcollectionColumns: AdditionalFieldDelegate<M, any>[] = subcollectionsList.map((subcollection: AdminCollection) => {\n return {\n key: getSubcollectionColumnId(subcollection),\n name: subcollection.name,\n width: 200,\n dependencies: [],\n Builder: ({ entity }: { entity: Entity }) => (\n <Button\n className={\"max-w-full truncate justify-start\"}\n startIcon={<ArrowRightToLineIcon size={iconSize.small}/>}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n navigateToEntity({\n openEntityMode,\n collection,\n entityId: entity.id,\n selectedTab: subcollection.slug,\n path: path,\n navigation: urlController,\n sidePanelController\n })\n }}>\n {subcollection.name}\n </Button>\n )\n };\n }) ?? EMPTY_ARRAY;\n\n return [\n ...(collection.additionalFields ?? EMPTY_ARRAY),\n ...subcollectionColumns\n ];\n }, [collection, collectionWithLocalOrder, path, sidePanelController, openEntityMode, urlController]);\n\n const updateLastDeleteTimestamp = useCallback(() => {\n setLastDeleteTimestamp(Date.now());\n }, []);\n\n const largeLayout = useLargeLayout();\n\n const isSplitLayout = openEntityMode === \"split\";\n const isCompact = isSplitLayout && selectedEntityIdProp !== undefined;\n const activeSelectionEnabled = !isCompact && selectionEnabled;\n\n const getActionsForEntity = useCallback(({\n entity,\n customEntityActions\n }: {\n entity?: Entity<M>,\n customEntityActions?: EntityAction[]\n }): EntityAction[] => {\n const deleteEnabled = entity ? canDelete(collection, path, entity) : true;\n const disableActions = collection.disableDefaultActions ?? [];\n const actions: EntityAction[] = [];\n if (!disableActions.includes(\"edit\")) {\n actions.push(editEntityAction);\n }\n if (createEnabled && !disableActions.includes(\"copy\"))\n actions.push(copyEntityAction);\n if (deleteEnabled && !disableActions.includes(\"delete\")) {\n // On a junction-backed tab the server removes the link, not the\n // row. Same request either way — this is the button telling the\n // truth about what it will do.\n actions.push(isLinkedChildView ? unlinkEntityAction : deleteEntityAction);\n }\n if (customEntityActions)\n return mergeEntityActions(actions, customEntityActions);\n return actions;\n }, [canDelete, collection, path, createEnabled, isLinkedChildView]);\n\n const getIdColumnWidth = useCallback(() => {\n const entityActions = getActionsForEntity({});\n const collapsedActions = entityActions.filter(a => a.collapsed !== false);\n const uncollapsedActions = entityActions.filter(a => a.collapsed === false);\n const actionsWidth = uncollapsedActions.length * (largeLayout ? 40 : 30);\n return (largeLayout ? (80 + actionsWidth) : (70 + actionsWidth)) + (collapsedActions.length > 0 ? (largeLayout ? 40 : 30) : 0);\n }, [getActionsForEntity, largeLayout]);\n\n const customEntityActions = useMemo(() => (collection.entityActions ?? EMPTY_ARRAY)\n .map(action => resolveEntityAction(action, customizationController.entityActions))\n .filter(Boolean) as EntityAction<M>[], [collection.entityActions, customizationController.entityActions]);\n\n const tableRowActionsBuilder = useCallback(({\n entity,\n size,\n width,\n frozen\n }: {\n entity: Entity<any>,\n size: CollectionSize,\n width: number,\n frozen?: boolean\n }) => {\n\n const isSelected = usedSelectionController.isEntitySelected(entity);\n\n const actions = getActionsForEntity({\n entity,\n customEntityActions\n });\n\n return (\n <CollectionRowActions\n entity={entity}\n width={width}\n frozen={frozen}\n isSelected={isSelected}\n selectionEnabled={activeSelectionEnabled}\n size={size}\n highlightEntity={setHighlightedEntity}\n unhighlightEntity={unselectNavigatedEntity}\n collection={collection}\n path={path}\n actions={actions}\n hideId={collection?.hideIdFromCollection}\n onCollectionChange={updateLastDeleteTimestamp}\n selectionController={usedSelectionController}\n openEntityMode={openEntityMode}\n />\n );\n\n // Everything it reads. It listed two of them, so the row actions\n // kept the first collection, actions, open mode and\n // `selectionEnabled` they were built with.\n }, [updateLastDeleteTimestamp, usedSelectionController, customEntityActions, getActionsForEntity,\n activeSelectionEnabled, unselectNavigatedEntity, collection, path, openEntityMode]);\n\n // Built once per change rather than once per render: each of these is a\n // prop of the table (and of the other views), and a new array or a new\n // element on every render of this component re-rendered every row of the\n // table — twice, the second time for the columns the id header widget\n // rebuilt — on each window emit, count arrival and popover toggle.\n const highlightedEntities = useMemo(\n () => highlightedEntity ? [highlightedEntity] : EMPTY_ARRAY,\n [highlightedEntity]);\n const idHeaderWidget = useMemo(() => <EntityIdHeaderWidget\n path={path}\n idPath={path}\n collection={collection}\n openEntityMode={openEntityMode}/>, [path, collection, openEntityMode]);\n\n // EntitiesCount fetches the count and reports it — the toolbar renders it\n const countFetcher = <EntitiesCount\n path={path}\n collection={collection}\n filter={tableController.filterValues}\n sortBy={tableController.sortBy}\n searchString={tableController.searchString}\n onCountChange={setDocsCount}\n refreshKey={lastDeleteTimestamp}\n />;\n\n // What \"select all matching\" would stand for right now. `docsCount` is\n // the count for exactly this query — the same one the toolbar shows —\n // so the number offered and the number selected cannot disagree.\n const liveSelectionQuery: SelectionQuery<M> = useMemo(() => ({\n path,\n filterValues: tableController.filterValues,\n searchString: tableController.searchString,\n sortBy: tableController.sortBy\n }), [path, tableController.filterValues, tableController.searchString, tableController.sortBy]);\n\n // A query selection is a promise about a *specific* query, and the\n // filter bar stays live while one is held. Letting it follow the filter\n // would mean the rows about to be deleted are not the rows that were\n // counted and agreed to; keeping the stale query would show rows the\n // selection does not cover as ticked. So the selection is dropped, the\n // way a search does in Gmail, and the banner disappears with it.\n const selectionQueryKey = selection.type === \"query\" ? serializeSelectionQuery(selection.query) : undefined;\n const liveQueryKey = serializeSelectionQuery(liveSelectionQuery);\n useEffect(() => {\n if (selectionQueryKey !== undefined && selectionQueryKey !== liveQueryKey)\n clearSelection();\n }, [selectionQueryKey, liveQueryKey, clearSelection]);\n\n const { resolvedSlots } = customizationController;\n\n // Pre-compute header action slot contributions (avoid useSlot inside callback)\n const headerActionContributions = useMemo(() => resolvedSlots\n .filter(s => s.slot === \"collection.header.action\")\n .sort((a, b) => (a.order ?? 50) - (b.order ?? 50)), [resolvedSlots]);\n\n // This render's values, for PluginHeaderActions. Null when no plugin\n // contributes a header action, so the headers have nothing to follow.\n const headerActionsScope = useMemo<HeaderActionsScope | null>(() => headerActionContributions.length > 0\n ? {\n contributions: headerActionContributions,\n path,\n collection: collection as AdminCollection,\n tableController: tableController as EntityTableController,\n parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,\n parentEntityIds: parentEntityIds ?? EMPTY_ARRAY\n }\n : null, [headerActionContributions, path, collection, tableController, parentCollectionSlugs, parentEntityIds]);\n\n // One component type for the life of the view: the plugins' controls\n // reach it through context. A function declared here was a new\n // component type on every render — the table's columns changed with\n // it, and the header remounted whatever the plugins had drawn, closing\n // anything they had open, on every row update.\n const addColumnComponentInternal = pluginAddColumnComponents.length > 0\n ? PluginAddColumnComponents\n : undefined;\n\n const onColumnsOrderChange = useCallback((newColumns: VirtualTableColumn[]) => {\n // Extract property keys from the new column order\n // Filter to only include actual property columns (not frozen columns, not additional fields, etc.)\n // Deduplicate to clean up any previously duplicated keys\n const seenKeys = new Set<string>();\n const newPropertiesOrder = newColumns\n .filter(col => !col.frozen && getPropertyInPath(collection.properties, col.key))\n .map(col => col.key)\n .filter(key => {\n if (seenKeys.has(key)) return false;\n seenKeys.add(key);\n return true;\n });\n\n // Optimistically update local state to prevent UI flickering\n setLocalPropertiesOrder(newPropertiesOrder);\n\n // Call each plugin's onColumnsReorder callback\n if (customizationController?.plugins) {\n customizationController.plugins\n .filter(plugin => plugin.hooks?.onColumnsReorder)\n .forEach(plugin => {\n plugin.hooks!.onColumnsReorder!({\n fullPath: path,\n parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,\n parentEntityIds: parentEntityIds ?? EMPTY_ARRAY,\n collection,\n newPropertiesOrder\n });\n });\n }\n\n // Save to user configuration persistence (local storage)\n if (userConfigPersistence) {\n onCollectionModifiedForUser(path, { propertiesOrder: newPropertiesOrder } as PartialCollectionConfig<M>);\n }\n }, [collection, setLocalPropertiesOrder, customizationController, path, parentCollectionSlugs, parentEntityIds, userConfigPersistence, onCollectionModifiedForUser]);\n\n // Popover open state managed at parent level to prevent closing when view changes\n const [viewModePopoverOpen, setViewModePopoverOpen] = useState(false);\n\n // Create ViewModeToggle once to prevent remounting when view changes\n const viewModeToggleElement = (\n <ViewModeToggle\n viewMode={viewMode}\n onViewModeChange={onViewModeChange}\n enabledViews={enabledViews}\n customViews={resolvedCustomViews}\n size={activeCustomView ? (activeCustomView.sizeable ? customViewSize : undefined) : viewMode === \"list\" ? listSize : viewMode === \"table\" ? tableSize : viewMode === \"cards\" ? cardSize : undefined}\n onSizeChanged={activeCustomView ? (activeCustomView.sizeable ? setCustomViewSize : undefined) : viewMode === \"list\" ? onListSizeChanged : viewMode === \"table\" ? onTableSizeChanged : viewMode === \"cards\" ? setCardSize : undefined}\n open={viewModePopoverOpen}\n onOpenChange={setViewModePopoverOpen}\n kanbanPropertyOptions={kanbanPropertyOptions}\n selectedKanbanProperty={selectedKanbanProperty}\n onKanbanPropertyChange={onKanbanPropertyChange}\n />\n );\n\n // Compute plugin-provided error view for collection loading errors\n const pluginErrorViews = useSlot(\"collection.error\", {\n path,\n collection,\n parentCollectionSlugs,\nparentEntityIds,\n error: tableController.dataLoadingError as Error\n });\n const pluginErrorView = tableController.dataLoadingError && pluginErrorViews.length > 0\n ? pluginErrorViews[0]\n : null;\n\n // Shared empty state — plugin slot takes priority, then override, then default\n // \"No results\" is only true of a view the user narrowed: a search, or\n // a filter they can clear. The collection's `fixedFilter` is its\n // scope, not a filter, and a sort never empties a set — counting the\n // declared default `sort` hid \"Create your first entry\" from every\n // empty collection that declares one.\n const isSearching = !!tableController.searchString;\n const fixedFilter = collection.fixedFilter;\n const isFiltered = isSearching || Object.keys(tableController.filterValues ?? {})\n .some(key => !fixedFilter || !(key in fixedFilter));\n const ResolvedEmptyState = useComponentOverride(\"Collection.EmptyState\", DefaultCollectionEmptyState);\n const ResolvedCollectionActions = useComponentOverride(\"Collection.Actions\", CollectionViewActions);\n const ResolvedCollectionTable = useComponentOverride(\"Collection.Table\", CollectionTableBinding) as typeof CollectionTableBinding;\n const emptyComponent = pluginEmptyStates.length > 0\n ? <>{pluginEmptyStates}</>\n : <ResolvedEmptyState\n canCreate={canCreateEntities && !isFiltered}\n onNewClick={onNewClick}\n isSearching={isSearching}\n isFiltered={isFiltered}\n searchString={tableController.searchString ?? \"\"}\n />;\n\n const toolbarNode = (\n <CollectionTableToolbar\n compact={isCompact}\n loading={tableController.dataLoading}\n onTextSearch={tableController.setSearchString}\n initialSearchText={tableController.searchString}\n viewModeToggle={viewModeToggleElement}\n actionsStart={<CollectionViewStartActions\n parentCollectionSlugs={parentCollectionSlugs ?? EMPTY_ARRAY} parentEntityIds={parentEntityIds ?? EMPTY_ARRAY}\n collection={collection}\n tableController={tableController}\n path={path}\n relativePath={getCollectionDataPath(collection)}\n selectionController={usedSelectionController}\n collectionEntitiesCount={docsCount ?? undefined}\n resolvedProperties={resolvedCollection.properties}\n viewMode={viewMode}\n selectionEnabled={activeSelectionEnabled}\n selectionQuery={liveSelectionQuery}\n entitiesCount={docsCount}\n openNewDocument={openNewDocument}\n compact={isCompact}/>}\n actions={\n <ResolvedCollectionActions\n parentCollectionSlugs={parentCollectionSlugs ?? EMPTY_ARRAY} parentEntityIds={parentEntityIds ?? EMPTY_ARRAY}\n collection={collection}\n tableController={tableController}\n onMultipleDeleteClick={onMultipleDeleteClick}\n removeUnlinks={isLinkedChildView}\n onNewClick={onNewClick}\n onAddExistingClick={linkedTargetSlug ? selectionDialog.open : undefined}\n openNewDocument={openNewDocument}\n path={path}\n relativePath={getCollectionDataPath(collection)}\n selectionController={usedSelectionController}\n selectionEnabled={activeSelectionEnabled}\n collectionEntitiesCount={docsCount ?? undefined}\n compact={isCompact}\n >\n {pluginToolbarWidgets}\n </ResolvedCollectionActions>\n }\n />\n );\n\n // A custom view wins over the built-in chain, but only after the\n // built-in keys have been ruled out — `resolveCollectionViews` refuses\n // a view keyed \"table\", so this cannot shadow one.\n const CustomViewBuilder = activeCustomView\n ? resolveComponentRef<CollectionCustomViewParams<M>>(activeCustomView.Builder)\n : undefined;\n\n const innerView = CustomViewBuilder ? (\n <ErrorBoundary>\n <CustomViewBuilder\n key={`custom-view-${activeCustomView!.key}-${path}`}\n collection={collection}\n tableController={tableController}\n path={path}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n onEntityClick={onEntityClick}\n onNewClick={canCreateEntities ? onNewClick : undefined}\n canCreate={canCreateEntities}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n deletedEntities={deletedEntities}\n emptyComponent={emptyComponent}\n size={activeCustomView!.sizeable ? customViewSize : undefined}\n viewMode={viewMode}\n />\n </ErrorBoundary>\n ) : viewMode === \"kanban\" ? (\n <CollectionBoardViewBinding\n key={`kanban-view-${path}-${selectedKanbanProperty}`}\n collection={collection}\n tableController={tableController}\n fullPath={path}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n columnProperty={selectedKanbanProperty}\n onEntityClick={onEntityClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n deletedEntities={deletedEntities}\n emptyComponent={emptyComponent}\n />\n ) : viewMode === \"cards\" ? (\n <CollectionCardViewBinding\n key={`cards-view-${path}`}\n collection={collection}\n tableController={tableController}\n onEntityClick={onEntityClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n onScroll={tableController.onScroll}\n initialScroll={tableController.initialScroll}\n size={cardSize}\n emptyComponent={emptyComponent}\n />\n ) : viewMode === \"list\" ? (\n <CollectionListViewBinding\n key={`list-view-${path}`}\n collection={collection}\n tableController={tableController}\n onEntityClick={onEntityClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n size={listSize}\n emptyComponent={emptyComponent}\n selectedEntityId={selectedEntityIdProp}\n getActionsForEntity={getActionsForEntity}\n path={path}\n openEntityMode={openEntityMode}\n />\n ) : (\n <PluginAddColumnsContext.Provider value={pluginAddColumnComponents}>\n <PluginHeaderActionsContext.Provider value={headerActionsScope}>\n <ResolvedCollectionTable\n key={`collection_table_${path}`}\n hideToolbar={true}\n additionalFields={additionalFields}\n tableController={tableController}\n fixedFilter={collection.fixedFilter}\n enablePopupIcon={true}\n displayedColumnIds={displayedColumnIds}\n onSizeChanged={onTableSizeChanged}\n onEntityClick={onEntityClick}\n onColumnResize={onColumnResize}\n onValueChange={onValueChange}\n tableRowActionsBuilder={tableRowActionsBuilder}\n uniqueFieldValidator={uniqueFieldValidator}\n selectionController={usedSelectionController}\n highlightedEntities={highlightedEntities}\n defaultSize={tableSize}\n properties={resolvedCollection.properties}\n getPropertyFor={getPropertyFor}\n onScroll={tableController.onScroll}\n initialScroll={tableController.initialScroll}\n emptyComponent={emptyComponent}\n hoverRow={hoverRow}\n inlineEditing={inlineEditingEnabled}\n AdditionalHeaderWidget={PluginHeaderActions}\n AddColumnComponent={addColumnComponentInternal}\n getIdColumnWidth={getIdColumnWidth}\n additionalIDHeaderWidget={idHeaderWidget}\n openEntityMode={openEntityMode}\n onColumnsOrderChange={onColumnsOrderChange}\n />\n </PluginHeaderActionsContext.Provider>\n </PluginAddColumnsContext.Provider>\n );\n\n const detailOpen = selectedEntityIdProp !== undefined;\n\n // List view gets a centered, titled reading surface. Opening a detail\n // panel collapses the title and drops the centering so the list can\n // shrink into the master column.\n const collectionSurface = viewMode === \"list\"\n ? (\n <div\n className={cls(\n \"flex flex-col w-full\",\n detailOpen ? \"\" : \"max-w-6xl mx-auto px-3 md:px-4 lg:px-6 py-4\"\n )}\n >\n {/* Collapsible title — grid-rows for smooth height, transform for GPU */}\n <div\n className={cls(\n \"grid transition-[grid-template-rows,transform,margin] duration-150 ease-out\",\n detailOpen\n ? \"grid-rows-[0fr] -translate-y-2 mt-0 mb-0\"\n : \"grid-rows-[1fr] translate-y-0 mt-12 mb-6\"\n )}\n >\n <div className=\"overflow-hidden flex items-center gap-4\">\n <Typography gutterBottom variant=\"h4\" className=\"grow mb-0\" component=\"h4\">\n {collection.name}\n </Typography>\n </div>\n </div>\n {pluginWidgets.length > 0 && (\n <div\n className={cls(\n \"grid transition-[grid-template-rows] duration-150 ease-out\",\n detailOpen ? \"grid-rows-[0fr]\" : \"grid-rows-[1fr]\"\n )}\n >\n <div className=\"overflow-hidden flex-shrink-0\">\n {pluginWidgets}\n </div>\n </div>\n )}\n {innerView}\n </div>\n )\n : innerView;\n\n const mainContent = (\n <div className={cls(\"overflow-hidden h-full w-full rounded-md flex flex-col bg-surface-sheet\", className)}\n ref={containerRef}>\n\n {countFetcher}\n\n {/* A plugin's error view takes priority over the built-in\n banner, the same precedence the empty state uses. This was\n computed above and then rendered nowhere, so `collection.error`\n — a declared, documented slot with its own props interface —\n did nothing at all, and a plugin author had no way to tell. */}\n {pluginErrorView ?? (tableController.dataLoadingError && tableController.data.length > 0 && (\n <div className=\"px-4 pt-2 flex-shrink-0\">\n <Alert color=\"error\" size=\"small\">\n <strong>{t(\"error_loading_data\")}</strong>\n {tableController.dataLoadingError.message ? <>: {tableController.dataLoadingError.message}</> : null}\n </Alert>\n </div>\n ))}\n\n {/* When isSplitLayout, SplitListView is ALWAYS mounted — regardless\n of viewMode. The toolbar + current view live in the left panel;\n the right panel (entity detail) shows/hides based on selection.\n This keeps the toolbar's React tree position stable across view\n mode switches, preventing the ViewModeToggle popover from flashing. */}\n {isSplitLayout ? (\n <SplitListView\n key={`split-list-view-${path}`}\n collection={collection}\n tableController={tableController}\n onEntityClick={onEntityClick}\n onNewClick={onNewClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n onScroll={tableController.onScroll}\n initialScroll={tableController.initialScroll}\n size={listSize}\n emptyComponent={emptyComponent}\n path={path}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n selectedEntityId={selectedEntityIdProp}\n selectedTab={selectedTabProp}\n toolbar={toolbarNode}\n >\n {/* The left panel keeps rendering whichever view mode is\n active. Swapping it to a list on selection would make\n a board or card grid vanish on every click. */}\n {collectionSurface}\n </SplitListView>\n ) : (\n <div className=\"flex flex-col w-full h-full\">\n {toolbarNode}\n {/* `min-h-0` is what lets the board scroll its columns.\n A flex item defaults to `min-height: auto`, so this\n one grew to the board's full content height — 1230px\n in a 883px area — and the ancestor's `overflow-hidden`\n simply cut the rest off, with each column's own\n scroller never reaching its limit. */}\n <div className={cls(\n \"flex-1 min-h-0 flex flex-col\",\n (viewMode === \"list\" || viewMode === \"cards\") && \"overflow-y-auto\"\n )}>\n {collectionSurface}\n </div>\n </div>\n )}\n\n {popupCell && <PopupFormField\n key={`popup_form_${popupCell?.propertyKey}_${popupCell?.entityId}`}\n open={Boolean(popupCell)}\n onClose={onPopupClose}\n cellRect={popupCell?.cellRect}\n propertyKey={popupCell?.propertyKey}\n collection={collection}\n entityId={popupCell.entityId}\n tableKey={tableKey.current}\n customFieldValidator={uniqueFieldValidator}\n path={path}\n onCellValueChange={onValueChange}\n container={containerRef.current}/>}\n\n {deleteEntityClicked &&\n <DeleteEntityDialog\n target={deleteEntityClicked}\n path={path}\n collection={collection}\n // A linked tab's rows are shared through a junction:\n // the server removes them from this record and deletes\n // nothing, so the dialog must not say \"delete\".\n variant={isLinkedChildView ? \"unlink\" : \"delete\"}\n open={Boolean(deleteEntityClicked)}\n onEntityDelete={internalOnEntityDelete}\n onMultipleEntitiesDelete={internalOnMultipleEntitiesDelete}\n onClose={() => setDeleteEntityClicked(undefined)}/>}\n\n </div>\n );\n\n return mainContent;\n }, collectionViewPropsEqual) as React.FunctionComponent<CollectionViewBindingProps<any>>;\n\nexport const CollectionViewBinding = React.memo(\n function CollectionViewBinding<M extends Record<string, unknown>>(props: CollectionViewBindingProps<M>) {\n const collectionRegistry = useCollectionRegistryController();\n const path = props.path ?? props.slug;\n const collection = collectionRegistry.getCollection(path) ?? props;\n\n const content = <CollectionViewBindingInner {...props} />;\n\n if (collection) {\n return (\n <CollectionScopeProvider collection={collection as AdminCollection}>\n {content}\n </CollectionScopeProvider>\n );\n }\n return content;\n }\n) as React.FunctionComponent<CollectionViewBindingProps<any>>;\n\n/**\n * Inflight count request deduplication map.\n * Keyed by `path|filterKey|sort|search` so that concurrent\n * callers (e.g. React StrictMode double-mount) share the same promise.\n */\nconst inflightCountRequests = new Map<string, Promise<number>>();\n\nexport function EntitiesCount({\n path,\n collection,\n filter,\n sortBy,\n searchString,\n onCountChange,\n refreshKey\n}: {\n path: string,\n collection: AdminCollection,\n filter?: FilterValues<any>,\n sortBy?: OrderByTuple[],\n /**\n * Required, not optional. The term sits in the same scope as the element\n * that mounts this and is passed to the toolbar and the empty state beside\n * it — it was simply not passed here, so a searched list showed the count\n * of the unsearched collection. A required prop is what stops the next\n * caller doing the same; there is no useful \"count without the search\".\n */\n searchString: string | undefined,\n onCountChange?: (count: number | null | undefined) => void,\n /**\n * Counts again whenever this changes. The count is one read, not a\n * subscription: after a delete the toolbar kept the old total, and \"select\n * all matching\" offered it over the rows that were left.\n */\n refreshKey?: number,\n}) {\n\n const dataClient = useData();\n\n // The whole sort as one string: it keys the dedup cache and drives the\n // effect, and a `sortBy` array is a new reference on every render.\n const sortKey = React.useMemo(() => sortBy ? serializeOrderBy(sortBy) ?? \"\" : \"\", [sortBy]);\n\n // Use refs for values that should NOT trigger re-fetches\n const dataClientRef = React.useRef(dataClient);\n dataClientRef.current = dataClient;\n const onCountChangeRef = React.useRef(onCountChange);\n onCountChangeRef.current = onCountChange;\n\n // Serialize filter to a stable string to avoid re-fetches on object identity changes\n const filterKey = React.useMemo(() => filter ? JSON.stringify(filter) : \"\", [filter]);\n\n useEffect(() => {\n const accessor = dataClientRef.current.collection(path);\n if (!accessor.count && !accessor.listenCount) {\n onCountChangeRef.current?.(undefined);\n return;\n }\n\n let cancelled = false;\n\n // filterValues is already FilterValues — pass directly\n const whereParams = filter && Object.keys(filter).length > 0 ? filter : undefined;\n const orderByParams = sortBy && sortBy.length > 0\n ? sortBy.map(([field, direction]) => [String(field), direction] as OrderByTuple)\n : undefined;\n\n // Live where the data source can subscribe: the total then follows the\n // rows other people add and remove, not only this view's own deletes,\n // and so does the \"select all N\" offer built on it.\n if (accessor.listenCount) {\n return accessor.listenCount(\n { where: whereParams, searchString },\n (total) => onCountChangeRef.current?.(total),\n (error) => {\n console.warn(\"Error counting\", error);\n onCountChangeRef.current?.(undefined);\n }\n );\n }\n\n // Deduplicate inflight count requests (e.g. React StrictMode double-mount)\n // The search term is part of the query, so it is part of the key. The\n // cache is module-level and outlives an unmount, so a key that omits it\n // does not merely lose precision — it answers one search with a\n // different search's total.\n // The refresh key too: a count still in flight from before a delete\n // must not answer the one asked after it.\n const cacheKey = `${path}|${filterKey}|${sortKey}|${searchString ?? \"\"}|${refreshKey ?? \"\"}`;\n let countPromise = inflightCountRequests.get(cacheKey);\n if (!countPromise) {\n countPromise = accessor.count!({\n where: whereParams,\n orderBy: orderByParams,\n searchString\n });\n inflightCountRequests.set(cacheKey, countPromise);\n // Clean up the inflight entry once resolved/rejected\n countPromise.finally(() => inflightCountRequests.delete(cacheKey));\n }\n\n countPromise.then((c) => {\n if (!cancelled) onCountChangeRef.current?.(c);\n }).catch((e) => {\n console.warn(\"Error fetching count\", e);\n if (!cancelled) onCountChangeRef.current?.(undefined);\n });\n\n return () => { cancelled = true; };\n // `filterKey` and `sortKey` ARE `filter` and `sortBy` — the memoized\n // serializations a few lines up, and the only stable identity either\n // has. Both arrive as freshly built objects on every render, so\n // depending on them directly would re-run this effect each time and\n // fire a count request per render. The keys change exactly when the\n // values do, which is the condition this effect actually wants.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [path, filterKey, sortKey, searchString, refreshKey]);\n\n // The toolbar renders the count; this component only fetches and reports it\n return null;\n}\n\nfunction buildPropertyWidthOverwrite(key: string, width: number): PartialCollectionConfig {\n if (key.includes(\".\")) {\n const [parentKey, ...childKey] = key.split(\".\");\n return { properties: { [parentKey]: buildPropertyWidthOverwrite(childKey.join(\".\"), width) } } as PartialCollectionConfig;\n }\n return { properties: { [key]: { admin: { columnWidth: width } } } } as PartialCollectionConfig;\n}\n\nfunction EntityIdHeaderWidget({\n collection,\n path,\n idPath,\n openEntityMode\n}: {\n collection: AdminCollection,\n path: string,\n idPath: string,\n /**\n * Resolved by the parent so that finding an entity by id lands it in the\n * same surface a row click would — not a different one.\n */\n openEntityMode: OpenEntityMode\n}) {\n\n const { t } = useTranslation();\n const urlController = useUrlController();\n const [openPopup, setOpenPopup] = React.useState(false);\n const [searchString, setSearchString] = React.useState(\"\");\n const [recentIds, setRecentIds] = React.useState<string[]>(getRecentIds(collection.slug).map(String));\n const sidePanelController = useSidePanel();\n\n return (\n <Tooltip title={!openPopup ? t(\"find_by_id\") : undefined} asChild={false}>\n <Popover\n open={openPopup}\n onOpenChange={setOpenPopup}\n sideOffset={0}\n align={\"start\"}\n alignOffset={-117}\n trigger={\n <IconButton aria-label={t(\"search\")} size={\"small\"}>\n <SearchIcon size={iconSize.small}/>\n </IconButton>\n }>\n <div\n className={cls(\"my-2 rounded-lg bg-surface-sheet text-surface-900 dark:text-white\")}>\n <form noValidate={true}\n onSubmit={(e) => {\n e.preventDefault();\n if (!searchString) return;\n setOpenPopup(false);\n const entityId = searchString.trim();\n setRecentIds(addRecentId(collection.slug, entityId).map(String));\n navigateToEntity({\n openEntityMode,\n collection,\n entityId,\n path,\n\n sidePanelController,\n navigation: urlController\n })\n }}\n className={\"w-96 max-w-full\"}>\n\n <div className=\"flex p-2 w-full gap-2\">\n <TextField\n autoFocus={openPopup}\n aria-label={t(\"find_entity_by_id\")}\n placeholder={t(\"find_entity_by_id\")}\n size=\"small\"\n onChange={(e) => {\n setSearchString(e.target.value);\n }}\n value={searchString}\n className=\"flex-grow\"\n inputClassName={cls(\"rounded-lg bg-surface-card\", focusedDisabled)}\n />\n <Button variant={\"text\"}\n disabled={!(searchString.trim())}\n type={\"submit\"}\n ><ArrowRightToLineIcon/></Button>\n </div>\n </form>\n {recentIds && recentIds.length > 0 && <div className=\"flex flex-col gap-2 p-2\">\n {recentIds.map(id => (\n <ReferencePreview reference={new EntityReference({ id,\npath })}\n key={id}\n hover={true}\n onClick={() => {\n setOpenPopup(false);\n navigateToEntity({\n openEntityMode,\n collection,\n entityId: id,\n path,\n\n sidePanelController,\n navigation: urlController\n })\n }}\n includeEntityLink={false}\n size={\"small\"}/>\n ))}\n </div>}\n </div>\n </Popover>\n\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,IAAM,cAAuB,CAAC;;AAG9B,IAAM,0BAA0B,MAAM,cAAiC,WAAW;AAElF,SAAS,4BAA4B;CAEjC,OACI,oBAAC,OAAD;EAAK,WAAU;YAFA,MAAM,WAAW,uBAG3B;CACA,CAAA;AAEb;AAeA,IAAM,6BAA6B,MAAM,cAAyC,IAAI;;;;;;;;;;AAWtF,SAAS,oBAAoB,EACzB,UACA,aACA,WAKD;CACC,MAAM,QAAQ,MAAM,WAAW,0BAA0B;CACzD,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,kBAAkB;EACpB;EACA;EACA;EACA,MAAM,MAAM;EACZ,YAAY,MAAM;EAClB,iBAAiB,MAAM;EACvB,uBAAuB,MAAM;EAC7B,iBAAiB,MAAM;CAC3B;CACA,OAAO,oBAAA,UAAA,EAAA,UAAG,MAAM,cAAc,KAAK,GAAG,MAClC,oBAAC,eAAD,EAAA,UACI,oBAAC,EAAE,WAAH;EAAa,GAAI;EAAiB,GAAK,EAAE,SAAS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AO;OACP,WAAU;OACV,gBAAgB,IAAI,8BAA8B,eAAe;MACpE,CAAA,GACD,oBAAC,QAAD;OAAQ,SAAS;OACb,UAAU,CAAE,aAAa,KAAK;OAC9B,MAAM;iBACT,oBAAC,sBAAD,CAAsB,CAAA;MAAS,CAAA,CAC/B;;IACH,CAAA,GACL,aAAa,UAAU,SAAS,KAAK,oBAAC,OAAD;KAAK,WAAU;eAChD,UAAU,KAAI,OACX,oBAAC,kBAAD;MAAkB,WAAW,IAAI,gBAAgB;OAAE;OAC/E;MAAK,CAAC;MAE0B,OAAO;MACP,eAAe;OACX,aAAa,KAAK;OAClB,iBAAiB;QACb;QACA;QACA,UAAU;QACV;QAEA;QACA,YAAY;OAChB,CAAC;MACL;MACA,mBAAmB;MACnB,MAAM;KAAS,GAfV,EAeU,CACtB;IACA,CAAA,CACJ;;EACA,CAAA;CAEJ,CAAA;AAEjB"}
|
|
1
|
+
{"version":3,"file":"CollectionViewBinding.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewBinding.tsx"],"sourcesContent":["import type { AdminCollection, ViewMode } from \"@rebasepro/cms-types\";\nimport React, { useCallback, useRef } from \"react\";\n\nimport { deepEqual as equal } from \"fast-equals\"\nimport { CollectionScopeProvider } from \"@rebasepro/app\";\nimport { Alert, cls } from \"@rebasepro/ui\";\nimport { SplitListView } from \"./SplitListView\";\nimport { useCollectionRegistryController } from \"../../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useCollectionViewState } from \"./useCollectionViewState\";\nimport { CollectionViewScopeContext } from \"./CollectionViewScope\";\nimport { CollectionToolbarSlot, CollectionToolbarSlotContext, DEFAULT_TOOLBAR } from \"./CollectionToolbar\";\nimport { CollectionViewContent } from \"./CollectionViewContent\";\nimport { CollectionViewDialogs } from \"./CollectionViewDialogs\";\nimport { CollectionViewFrame } from \"./CollectionViewFrame\";\nimport { EntitiesCount } from \"./EntitiesCount\";\n\nexport { EntitiesCount } from \"./EntitiesCount\";\n\n/**\n * @group Components\n */\nexport type CollectionViewBindingProps<M extends Record<string, unknown>> = {\n /**\n * The path the collection is addressed by: its slug, or for a\n * subcollection `parentSlug/{id}/slug`. Defaults to the collection's slug.\n * Not the `path` a Firestore or MongoDB collection declares for its store:\n * the data layer translates to that one, and another collection's slug may\n * be spelled the same.\n */\n path?: string;\n /**\n * Full path using navigation ids.\n */\n idPath?: string;\n /**\n * If this is a subcollection, specify the parent collection ids.\n */\n parentCollectionSlugs?: string[], parentEntityIds?: string[];\n /**\n * Whether this is a subcollection or not.\n */\n isSubCollection?: boolean;\n\n className?: string;\n\n /**\n * If true, this view will store its filter and sorting status in the url params\n */\n updateUrl?: boolean;\n\n /**\n * When provided, the split view will render this entity's detail panel.\n * Used by the router to pass the entity ID from the URL path.\n */\n selectedEntityId?: string | number;\n\n /**\n * When provided, the split view will open this tab (e.g. a subcollection slug)\n * in the entity detail panel. Used by the router to pass the subcollection from the URL.\n */\n selectedTab?: string;\n\n /**\n * What this view changes about the collection it draws — a fixed filter,\n * a default view mode, a sort — applied over the registered collection.\n *\n * The collection's own props are not that: where the path is registered\n * the view draws the registry's copy, which carries the user's saved\n * overrides and the plugins' changes, and the props are only its fallback.\n * `CollectionPanel`'s `viewMode`, `sort`, `limit` and `collectionOverrides`\n * arrive here; spread onto the props, they were dropped for every\n * registered collection.\n */\n collectionOverrides?: Partial<AdminCollection<M>>;\n\n /**\n * The ids of the rows drawn as selected, where the caller decides which\n * they are — a page that shows the opened row beside the list. `[]`\n * draws none. Without it the view highlights the row last opened, by\n * itself.\n */\n highlightedIds?: (string | number)[];\n\n /**\n * The properties this view shows, in this order; the ones it leaves out\n * are not drawn. In the table they are the columns. In the list, on a card\n * and on a kanban card they are what the row's or card's places — title,\n * image, subtitle, status, date, relation chips, the list's columns — are\n * filled from, earlier ones first; a place none of them fills stays empty.\n *\n * Over `propertiesOrder`, the order the user saved, `listProperties` and\n * what the cards infer, for this view only. Column widths the user drags\n * still persist; the column order is the caller's, so columns are not\n * dragged. A property hidden from collections stays hidden, and a custom\n * view is handed the whole collection.\n */\n fields?: string[];\n\n /**\n * The mode this view opens in, over the one in the URL and the one the\n * person last picked. They can still switch.\n */\n viewMode?: ViewMode;\n\n /**\n * The title the list view draws above its rows; `false` draws none.\n * Defaults to the collection's name.\n */\n title?: string | false;\n\n /**\n * The toolbar drawn above the rows. Defaults to the full toolbar —\n * `<CollectionToolbar/>`; `null` draws none. Compose a smaller one from\n * its pieces: `CollectionSearchBar`, `CollectionFiltersButton`,\n * `CollectionViewModeToggle`, `CollectionAddButton`.\n */\n toolbar?: React.ReactNode;\n\n /**\n * Called with the row and its id when one is clicked, instead of the\n * view opening it. Without it the record opens as the collection's\n * `openEntityMode` says. The row is the server's, as `useRows` returns\n * it; the id is the string `highlightedIds` and `useSidePanel().open`\n * take.\n */\n onRowClick?: (row: Record<string, unknown>, id: string) => void;\n\n} & AdminCollection<M>;\n\n/**\n * Props a caller commonly rebuilds on every render — a parent path array, a\n * properties object, an `Actions` list made with `toArray` — compared by value,\n * so a re-render that builds the same ones again does not redraw the view.\n */\nconst PROPS_COMPARED_BY_VALUE = new Set<string>([\n \"path\", \"parentCollectionSlugs\", \"parentEntityIds\", \"isSubCollection\", \"className\",\n \"properties\", \"propertiesOrder\", \"hideIdFromCollection\", \"inlineEditing\", \"selectionEnabled\",\n \"selectionController\", \"Actions\", \"defaultSize\", \"includeJsonView\", \"additionalFields\",\n \"sideDialogWidth\", \"openEntityMode\", \"exportable\", \"history\", \"fixedFilter\",\n \"selectedEntityId\", \"selectedTab\", \"collectionOverrides\", \"highlightedIds\", \"fields\"\n]);\n\n/**\n * Whether the view would draw the same thing with these props.\n *\n * Every prop counts: the listed ones by value, every other one — the name, the\n * entity actions, the custom views, the callbacks, anything a collection\n * carries — by reference. It used to compare the listed ones only, so a\n * collection passed as props (one not in the registry, where the view reads it\n * from) that changed anything else was never redrawn. A caller spreading a\n * registry collection hands over the same references each render.\n */\nfunction collectionViewPropsEqual(a: CollectionViewBindingProps<any>, b: CollectionViewBindingProps<any>): boolean {\n const previous = a as Record<string, unknown>;\n const next = b as Record<string, unknown>;\n const keys = new Set([...Object.keys(previous), ...Object.keys(next)]);\n for (const key of keys) {\n if (previous[key] === next[key]) continue;\n if (PROPS_COMPARED_BY_VALUE.has(key) && equal(previous[key], next[key])) continue;\n return false;\n }\n return true;\n}\n\n/**\n * This component is in charge of binding a driver path with an {@link AdminCollection}\n * where it's configuration is defined. It includes an infinite scrolling table\n * and a 'Add' new entities button,\n *\n * This component is the default one used for displaying entity collections\n * and is in charge of generating all the specific actions and customization\n * of the lower level {@link CollectionTableBinding}\n *\n * Please **note** that you only need to use this component if you are building\n * a custom view. If you just need to create a default view you can do it\n * exclusively with config options.\n *\n * If you need a lower level implementation with more granular options, you\n * can use {@link CollectionTableBinding}.\n *\n * If you need a generic table that is not bound to the driver or entities and\n * properties at all, you can check {@link VirtualTable}\n *\n * @param path\n * @param collection\n\n * @group Components\n */\nconst CollectionViewBindingInner = React.memo(\n function CollectionViewBindingInner(props: CollectionViewBindingProps<Record<string, unknown>>) {\n\n const state = useCollectionViewState(props);\n const {\n t,\n containerRef,\n path,\n parentCollectionSlugs,\n parentEntityIds,\n selectedEntityId,\n selectedTab,\n collection,\n tableController,\n lastDeleteTimestamp,\n setDocsCount,\n pluginErrorView,\n isSplitLayout,\n viewMode,\n onEntityClick,\n onNewClick,\n usedSelectionController,\n selectionEnabled,\n highlightedEntities,\n listSize,\n emptyComponent\n } = state;\n\n const toolbarNode = <CollectionToolbarSlot/>;\n const collectionSurface = <CollectionViewContent state={state}/>;\n\n return (\n <CollectionViewScopeContext.Provider value={state}>\n <CollectionViewFrame className={props.className} containerRef={containerRef}>\n\n {/* Fetches the count and reports it — the toolbar renders it. */}\n <EntitiesCount\n path={path}\n collection={collection}\n filter={tableController.filterValues}\n sortBy={tableController.sortBy}\n searchString={tableController.searchString}\n onCountChange={setDocsCount}\n refreshKey={lastDeleteTimestamp}\n />\n\n {/* A plugin's error view takes priority over the built-in\n banner, the same precedence the empty state uses. This was\n computed above and then rendered nowhere, so `collection.error`\n — a declared, documented slot with its own props interface —\n did nothing at all, and a plugin author had no way to tell. */}\n {pluginErrorView ?? (tableController.dataLoadingError && tableController.data.length > 0 && (\n <div className=\"px-4 pt-2 flex-shrink-0\">\n <Alert color=\"error\" size=\"small\">\n <strong>{t(\"error_loading_data\")}</strong>\n {tableController.dataLoadingError.message ? <>: {tableController.dataLoadingError.message}</> : null}\n </Alert>\n </div>\n ))}\n\n {/* When isSplitLayout, SplitListView is ALWAYS mounted — regardless\n of viewMode. The toolbar + current view live in the left panel;\n the right panel (entity detail) shows/hides based on selection.\n This keeps the toolbar's React tree position stable across view\n mode switches, preventing the ViewModeToggle popover from flashing. */}\n {isSplitLayout ? (\n <SplitListView\n key={`split-list-view-${path}`}\n collection={collection}\n tableController={tableController}\n onEntityClick={onEntityClick}\n onNewClick={onNewClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n onScroll={tableController.onScroll}\n initialScroll={tableController.initialScroll}\n size={listSize}\n emptyComponent={emptyComponent}\n path={path}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n selectedEntityId={selectedEntityId}\n selectedTab={selectedTab}\n toolbar={toolbarNode}\n >\n {/* The left panel keeps rendering whichever view mode is\n active. Swapping it to a list on selection would make\n a board or card grid vanish on every click. */}\n {collectionSurface}\n </SplitListView>\n ) : (\n <div className=\"flex flex-col w-full h-full min-h-0\">\n {toolbarNode}\n {/* `min-h-0` is what lets the board scroll its columns.\n A flex item defaults to `min-height: auto`, so this\n one grew to the board's full content height — 1230px\n in a 883px area — and the ancestor's `overflow-hidden`\n simply cut the rest off, with each column's own\n scroller never reaching its limit. */}\n {/* `max-h-dvh` for a view whose parent gives it no\n height: it draws its rows, up to the window's\n height, and scrolls inside that — rather than\n growing with every page it loads. */}\n <div className={cls(\n \"flex-1 min-h-0 max-h-dvh flex flex-col\",\n (viewMode === \"list\" || viewMode === \"cards\") && \"overflow-y-auto\"\n )}>\n {collectionSurface}\n </div>\n </div>\n )}\n\n <CollectionViewDialogs state={state}/>\n\n </CollectionViewFrame>\n </CollectionViewScopeContext.Provider>\n );\n }, collectionViewPropsEqual) as React.FunctionComponent<CollectionViewBindingProps<any>>;\n\nexport const CollectionViewBinding = React.memo(\n function CollectionViewBinding<M extends Record<string, unknown>>({\n toolbar,\n onRowClick,\n ...props\n }: CollectionViewBindingProps<M>) {\n const collectionRegistry = useCollectionRegistryController();\n const path = props.path ?? props.slug;\n const collection = collectionRegistry.getCollection(path) ?? props;\n\n // Both are commonly written inline, a new value on every render of\n // the caller. Neither reaches the memoised view as a prop: the\n // handler is called through a ref, and the toolbar is read from\n // context by the one element that draws it, so a caller's re-render\n // redraws the toolbar and nothing else.\n const onRowClickRef = useRef(onRowClick);\n onRowClickRef.current = onRowClick;\n const callRowClick = useCallback((row: Record<string, unknown>, id: string) => onRowClickRef.current?.(row, id), []);\n\n const content = (\n <CollectionToolbarSlotContext.Provider value={toolbar === undefined ? DEFAULT_TOOLBAR : toolbar}>\n <CollectionViewBindingInner {...props} onRowClick={onRowClick ? callRowClick : undefined}/>\n </CollectionToolbarSlotContext.Provider>\n );\n\n if (collection) {\n return (\n <CollectionScopeProvider collection={collection as AdminCollection}>\n {content}\n </CollectionScopeProvider>\n );\n }\n return content;\n }\n) as React.FunctionComponent<CollectionViewBindingProps<any>>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsIA,IAAM,0CAA0B,IAAI,IAAY;CAC5C;CAAQ;CAAyB;CAAmB;CAAmB;CACvE;CAAc;CAAmB;CAAwB;CAAiB;CAC1E;CAAuB;CAAW;CAAe;CAAmB;CACpE;CAAmB;CAAkB;CAAc;CAAW;CAC9D;CAAoB;CAAe;CAAuB;CAAkB;AAChF,CAAC;;;;;;;;;;;AAYD,SAAS,yBAAyB,GAAoC,GAA6C;CAC/G,MAAM,WAAW;CACjB,MAAM,OAAO;CACb,MAAM,uBAAO,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ACrB,UAAU,gBAAgB;KAC1B,eAAe,gBAAgB;KAC/B,MAAM;KACU;KACV;KACiB;KAAwC;KAC7C;KACL;KACb,SAAS;eAKR;IACU,GAtBN,mBAAmB,MAsBb,IAEf,qBAAC,OAAD;KAAK,WAAU;eAAf,CACK,aAWD,oBAAC,OAAD;MAAK,WAAW,IACZ,2CACC,aAAa,UAAU,aAAa,YAAY,iBACrD;gBACK;KACA,CAAA,CACJ;;IAGT,oBAAC,uBAAD,EAA8B,MAAO,CAAA;GAEpB;;CACgB,CAAA;AAE7C,GAAG,wBAAwB;AAE/B,IAAa,wBAAwB,MAAM,KACvC,SAAS,sBAAyD,EAC9D,SACA,YACA,GAAG,SAC2B;CAC9B,MAAM,qBAAqB,gCAAgC;CAC3D,MAAM,OAAO,MAAM,QAAQ,MAAM;CACjC,MAAM,aAAa,mBAAmB,cAAc,IAAI,KAAK;CAO7D,MAAM,gBAAgB,OAAO,UAAU;CACvC,cAAc,UAAU;CACxB,MAAM,eAAe,aAAa,KAA8B,OAAe,cAAc,UAAU,KAAK,EAAE,GAAG,CAAC,CAAC;CAEnH,MAAM,UACF,oBAAC,6BAA6B,UAA9B;EAAuC,OAAO,YAAY,KAAA,IAAY,kBAAkB;YACpF,oBAAC,4BAAD;GAA4B,GAAI;GAAO,YAAY,aAAa,eAAe,KAAA;EAAW,CAAA;CACvD,CAAA;CAG3C,IAAI,YACA,OACI,oBAAC,yBAAD;EAAqC;YAChC;CACoB,CAAA;CAGjC,OAAO;AACX,CACJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CollectionViewState } from "./useCollectionViewState.js";
|
|
3
|
+
/**
|
|
4
|
+
* The view the collection is drawn in: a custom view, the board, the cards,
|
|
5
|
+
* the list or the table — and, for the list, its titled reading surface.
|
|
6
|
+
*/
|
|
7
|
+
export declare function CollectionViewContent({ state }: {
|
|
8
|
+
state: CollectionViewState;
|
|
9
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { EmptyImagePlaceContext } from "./usePreviewSlots.js";
|
|
2
|
+
import { PluginAddColumnsContext, PluginHeaderActions, PluginHeaderActionsContext } from "./PluginColumnSlots.js";
|
|
3
|
+
import { CollectionCardViewBinding } from "./CollectionCardViewBinding.js";
|
|
4
|
+
import { CollectionListViewBinding } from "./CollectionListViewBinding.js";
|
|
5
|
+
import { CollectionBoardViewBinding } from "./CollectionBoardViewBinding.js";
|
|
6
|
+
import { EntityActionsScopeContext, renderCollectionEntityActions } from "./CollectionEntityActions.js";
|
|
7
|
+
import { CustomViewHost } from "./CustomViewHost.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { ErrorBoundary, Typography, cls } from "@rebasepro/ui";
|
|
11
|
+
import { resolveComponentRef } from "@rebasepro/app";
|
|
12
|
+
//#region src/components/CollectionViewBinding/CollectionViewContent.tsx
|
|
13
|
+
/**
|
|
14
|
+
* The view the collection is drawn in: a custom view, the board, the cards,
|
|
15
|
+
* the list or the table — and, for the list, its titled reading surface.
|
|
16
|
+
*/
|
|
17
|
+
function CollectionViewContent({ state }) {
|
|
18
|
+
const { path, parentCollectionSlugs, parentEntityIds, collection, resolvedCollection, tableController, activeCustomView, viewMode, onEntityClick, onNewClick, canCreateEntities, usedSelectionController, selectionEnabled, highlightedEntities, deletedEntities, emptyComponent, customViewSize, selectedKanbanProperty, cardSize, listSize, tableSize, selectedEntityId, getActionsForEntity, openEntityMode, pluginAddColumnComponents, headerActionsScope, ResolvedCollectionTable, additionalFields, displayedColumnIds, onTableSizeChanged, onColumnResize, onValueChange, tableRowActionsBuilder, uniqueFieldValidator, getPropertyFor, hoverRow, inlineEditingEnabled, addColumnComponentInternal, getIdColumnWidth, idHeaderWidget, onColumnsOrderChange, pluginWidgets, viewCollection, entityActionsScope, title } = state;
|
|
19
|
+
const CustomViewBuilder = activeCustomView ? resolveComponentRef(activeCustomView.Builder) : void 0;
|
|
20
|
+
const innerView = CustomViewBuilder ? /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(CustomViewHost, {
|
|
21
|
+
Builder: CustomViewBuilder,
|
|
22
|
+
collection,
|
|
23
|
+
tableController,
|
|
24
|
+
path,
|
|
25
|
+
parentCollectionSlugs,
|
|
26
|
+
parentEntityIds,
|
|
27
|
+
onEntityClick,
|
|
28
|
+
onNewClick: canCreateEntities ? onNewClick : void 0,
|
|
29
|
+
canCreate: canCreateEntities,
|
|
30
|
+
selectionController: usedSelectionController,
|
|
31
|
+
selectionEnabled,
|
|
32
|
+
highlightedEntities,
|
|
33
|
+
deletedEntities,
|
|
34
|
+
emptyComponent,
|
|
35
|
+
size: activeCustomView.sizeable ? customViewSize : void 0,
|
|
36
|
+
viewMode
|
|
37
|
+
}, `custom-view-${activeCustomView.key}-${path}`) }) : viewMode === "kanban" ? /* @__PURE__ */ jsx(CollectionBoardViewBinding, {
|
|
38
|
+
collection,
|
|
39
|
+
cardCollection: viewCollection !== collection ? viewCollection : void 0,
|
|
40
|
+
renderActions: renderCollectionEntityActions,
|
|
41
|
+
tableController,
|
|
42
|
+
fullPath: path,
|
|
43
|
+
parentCollectionSlugs,
|
|
44
|
+
parentEntityIds,
|
|
45
|
+
columnProperty: selectedKanbanProperty,
|
|
46
|
+
onEntityClick,
|
|
47
|
+
selectionController: usedSelectionController,
|
|
48
|
+
selectionEnabled,
|
|
49
|
+
highlightedEntities,
|
|
50
|
+
deletedEntities,
|
|
51
|
+
emptyComponent
|
|
52
|
+
}, `kanban-view-${path}-${selectedKanbanProperty}`) : viewMode === "cards" ? /* @__PURE__ */ jsx(CollectionCardViewBinding, {
|
|
53
|
+
collection: viewCollection,
|
|
54
|
+
renderActions: renderCollectionEntityActions,
|
|
55
|
+
tableController,
|
|
56
|
+
onEntityClick,
|
|
57
|
+
selectionController: usedSelectionController,
|
|
58
|
+
selectionEnabled,
|
|
59
|
+
highlightedEntities,
|
|
60
|
+
onScroll: tableController.onScroll,
|
|
61
|
+
initialScroll: tableController.initialScroll,
|
|
62
|
+
size: cardSize,
|
|
63
|
+
emptyComponent
|
|
64
|
+
}, `cards-view-${path}`) : viewMode === "list" ? /* @__PURE__ */ jsx(CollectionListViewBinding, {
|
|
65
|
+
collection: viewCollection,
|
|
66
|
+
tableController,
|
|
67
|
+
onEntityClick,
|
|
68
|
+
selectionController: usedSelectionController,
|
|
69
|
+
selectionEnabled,
|
|
70
|
+
highlightedEntities,
|
|
71
|
+
size: listSize,
|
|
72
|
+
emptyComponent,
|
|
73
|
+
selectedEntityId,
|
|
74
|
+
getActionsForEntity,
|
|
75
|
+
path,
|
|
76
|
+
openEntityMode
|
|
77
|
+
}, `list-view-${path}`) : /* @__PURE__ */ jsx(PluginAddColumnsContext.Provider, {
|
|
78
|
+
value: pluginAddColumnComponents,
|
|
79
|
+
children: /* @__PURE__ */ jsx(PluginHeaderActionsContext.Provider, {
|
|
80
|
+
value: headerActionsScope,
|
|
81
|
+
children: /* @__PURE__ */ jsx(ResolvedCollectionTable, {
|
|
82
|
+
hideToolbar: true,
|
|
83
|
+
additionalFields,
|
|
84
|
+
tableController,
|
|
85
|
+
fixedFilter: collection.fixedFilter,
|
|
86
|
+
enablePopupIcon: true,
|
|
87
|
+
displayedColumnIds,
|
|
88
|
+
onSizeChanged: onTableSizeChanged,
|
|
89
|
+
onEntityClick,
|
|
90
|
+
onColumnResize,
|
|
91
|
+
onValueChange,
|
|
92
|
+
tableRowActionsBuilder,
|
|
93
|
+
uniqueFieldValidator,
|
|
94
|
+
selectionController: usedSelectionController,
|
|
95
|
+
highlightedEntities,
|
|
96
|
+
defaultSize: tableSize,
|
|
97
|
+
properties: resolvedCollection.properties,
|
|
98
|
+
getPropertyFor,
|
|
99
|
+
onScroll: tableController.onScroll,
|
|
100
|
+
initialScroll: tableController.initialScroll,
|
|
101
|
+
emptyComponent,
|
|
102
|
+
hoverRow,
|
|
103
|
+
inlineEditing: inlineEditingEnabled,
|
|
104
|
+
AdditionalHeaderWidget: PluginHeaderActions,
|
|
105
|
+
AddColumnComponent: addColumnComponentInternal,
|
|
106
|
+
getIdColumnWidth,
|
|
107
|
+
additionalIDHeaderWidget: idHeaderWidget,
|
|
108
|
+
openEntityMode,
|
|
109
|
+
onColumnsOrderChange
|
|
110
|
+
}, `collection_table_${path}`)
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
const withActions = /* @__PURE__ */ jsx(EntityActionsScopeContext.Provider, {
|
|
114
|
+
value: entityActionsScope,
|
|
115
|
+
children: /* @__PURE__ */ jsx(EmptyImagePlaceContext.Provider, {
|
|
116
|
+
value: viewCollection === collection,
|
|
117
|
+
children: innerView
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
if (viewMode !== "list") return withActions;
|
|
121
|
+
const detailOpen = selectedEntityId !== void 0;
|
|
122
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
123
|
+
className: cls("flex flex-col w-full", detailOpen ? "" : "max-w-6xl mx-auto px-3 @3xl/collection:px-4 @5xl/collection:px-6 py-4"),
|
|
124
|
+
children: [
|
|
125
|
+
title !== false && /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: cls("grid transition-[grid-template-rows,transform,margin] duration-150 ease-out", detailOpen ? "grid-rows-[0fr] -translate-y-2 mt-0 mb-0" : "grid-rows-[1fr] translate-y-0 mt-12 mb-6"),
|
|
127
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
128
|
+
className: "overflow-hidden flex items-center gap-4",
|
|
129
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
130
|
+
gutterBottom: true,
|
|
131
|
+
variant: "h4",
|
|
132
|
+
className: "grow mb-0",
|
|
133
|
+
component: "h4",
|
|
134
|
+
children: title ?? collection.name
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
}),
|
|
138
|
+
pluginWidgets.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
139
|
+
className: cls("grid transition-[grid-template-rows] duration-150 ease-out", detailOpen ? "grid-rows-[0fr]" : "grid-rows-[1fr]"),
|
|
140
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
141
|
+
className: "overflow-hidden flex-shrink-0",
|
|
142
|
+
children: pluginWidgets
|
|
143
|
+
})
|
|
144
|
+
}),
|
|
145
|
+
withActions
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { CollectionViewContent };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=CollectionViewContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionViewContent.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewContent.tsx"],"sourcesContent":["import React from \"react\";\nimport type { CollectionCustomViewParams } from \"@rebasepro/cms-types\";\nimport { resolveComponentRef } from \"@rebasepro/app\";\nimport { cls, ErrorBoundary, Typography } from \"@rebasepro/ui\";\nimport { CollectionCardViewBinding } from \"./CollectionCardViewBinding\";\nimport { CollectionListViewBinding } from \"./CollectionListViewBinding\";\nimport { CollectionBoardViewBinding } from \"./CollectionBoardViewBinding\";\nimport { PluginAddColumnsContext, PluginHeaderActions, PluginHeaderActionsContext } from \"./PluginColumnSlots\";\nimport type { CollectionViewState } from \"./useCollectionViewState\";\nimport { EntityActionsScopeContext, renderCollectionEntityActions } from \"./CollectionEntityActions\";\nimport { EmptyImagePlaceContext } from \"./usePreviewSlots\";\nimport { CustomViewHost } from \"./CustomViewHost\";\n\n/**\n * The view the collection is drawn in: a custom view, the board, the cards,\n * the list or the table — and, for the list, its titled reading surface.\n */\nexport function CollectionViewContent({ state }: { state: CollectionViewState }) {\n const {\n path,\n parentCollectionSlugs,\n parentEntityIds,\n collection,\n resolvedCollection,\n tableController,\n activeCustomView,\n viewMode,\n onEntityClick,\n onNewClick,\n canCreateEntities,\n usedSelectionController,\n selectionEnabled,\n highlightedEntities,\n deletedEntities,\n emptyComponent,\n customViewSize,\n selectedKanbanProperty,\n cardSize,\n listSize,\n tableSize,\n selectedEntityId,\n getActionsForEntity,\n openEntityMode,\n pluginAddColumnComponents,\n headerActionsScope,\n ResolvedCollectionTable,\n additionalFields,\n displayedColumnIds,\n onTableSizeChanged,\n onColumnResize,\n onValueChange,\n tableRowActionsBuilder,\n uniqueFieldValidator,\n getPropertyFor,\n hoverRow,\n inlineEditingEnabled,\n addColumnComponentInternal,\n getIdColumnWidth,\n idHeaderWidget,\n onColumnsOrderChange,\n pluginWidgets,\n viewCollection,\n entityActionsScope,\n title\n } = state;\n\n // A custom view wins over the built-in chain, but only after the\n // built-in keys have been ruled out — `resolveCollectionViews` refuses\n // a view keyed \"table\", so this cannot shadow one.\n const CustomViewBuilder = activeCustomView\n ? resolveComponentRef<CollectionCustomViewParams>(activeCustomView.Builder)\n : undefined;\n\n const innerView = CustomViewBuilder ? (\n <ErrorBoundary>\n <CustomViewHost\n key={`custom-view-${activeCustomView!.key}-${path}`}\n Builder={CustomViewBuilder}\n collection={collection}\n tableController={tableController}\n path={path}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n onEntityClick={onEntityClick}\n onNewClick={canCreateEntities ? onNewClick : undefined}\n canCreate={canCreateEntities}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n deletedEntities={deletedEntities}\n emptyComponent={emptyComponent}\n size={activeCustomView!.sizeable ? customViewSize : undefined}\n viewMode={viewMode}\n />\n </ErrorBoundary>\n ) : viewMode === \"kanban\" ? (\n <CollectionBoardViewBinding\n key={`kanban-view-${path}-${selectedKanbanProperty}`}\n collection={collection}\n cardCollection={viewCollection !== collection ? viewCollection : undefined}\n renderActions={renderCollectionEntityActions}\n tableController={tableController}\n fullPath={path}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n columnProperty={selectedKanbanProperty}\n onEntityClick={onEntityClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n deletedEntities={deletedEntities}\n emptyComponent={emptyComponent}\n />\n ) : viewMode === \"cards\" ? (\n <CollectionCardViewBinding\n key={`cards-view-${path}`}\n collection={viewCollection}\n renderActions={renderCollectionEntityActions}\n tableController={tableController}\n onEntityClick={onEntityClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n onScroll={tableController.onScroll}\n initialScroll={tableController.initialScroll}\n size={cardSize}\n emptyComponent={emptyComponent}\n />\n ) : viewMode === \"list\" ? (\n <CollectionListViewBinding\n key={`list-view-${path}`}\n collection={viewCollection}\n tableController={tableController}\n onEntityClick={onEntityClick}\n selectionController={usedSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedEntities={highlightedEntities}\n size={listSize}\n emptyComponent={emptyComponent}\n selectedEntityId={selectedEntityId}\n getActionsForEntity={getActionsForEntity}\n path={path}\n openEntityMode={openEntityMode}\n />\n ) : (\n <PluginAddColumnsContext.Provider value={pluginAddColumnComponents}>\n <PluginHeaderActionsContext.Provider value={headerActionsScope}>\n <ResolvedCollectionTable\n key={`collection_table_${path}`}\n hideToolbar={true}\n additionalFields={additionalFields}\n tableController={tableController}\n fixedFilter={collection.fixedFilter}\n enablePopupIcon={true}\n displayedColumnIds={displayedColumnIds}\n onSizeChanged={onTableSizeChanged}\n onEntityClick={onEntityClick}\n onColumnResize={onColumnResize}\n onValueChange={onValueChange}\n tableRowActionsBuilder={tableRowActionsBuilder}\n uniqueFieldValidator={uniqueFieldValidator}\n selectionController={usedSelectionController}\n highlightedEntities={highlightedEntities}\n defaultSize={tableSize}\n properties={resolvedCollection.properties}\n getPropertyFor={getPropertyFor}\n onScroll={tableController.onScroll}\n initialScroll={tableController.initialScroll}\n emptyComponent={emptyComponent}\n hoverRow={hoverRow}\n inlineEditing={inlineEditingEnabled}\n AdditionalHeaderWidget={PluginHeaderActions}\n AddColumnComponent={addColumnComponentInternal}\n getIdColumnWidth={getIdColumnWidth}\n additionalIDHeaderWidget={idHeaderWidget}\n openEntityMode={openEntityMode}\n onColumnsOrderChange={onColumnsOrderChange}\n />\n </PluginHeaderActionsContext.Provider>\n </PluginAddColumnsContext.Provider>\n );\n\n // Given `fields`, the rows draw only the places those fill.\n const withActions = (\n <EntityActionsScopeContext.Provider value={entityActionsScope}>\n <EmptyImagePlaceContext.Provider value={viewCollection === collection}>\n {innerView}\n </EmptyImagePlaceContext.Provider>\n </EntityActionsScopeContext.Provider>\n );\n\n if (viewMode !== \"list\") return withActions;\n\n const detailOpen = selectedEntityId !== undefined;\n\n // List view gets a centered, titled reading surface. Opening a detail\n // panel collapses the title and drops the centering so the list can\n // shrink into the master column.\n return (\n <div\n className={cls(\n \"flex flex-col w-full\",\n detailOpen ? \"\" : \"max-w-6xl mx-auto px-3 @3xl/collection:px-4 @5xl/collection:px-6 py-4\"\n )}\n >\n {/* Collapsible title — grid-rows for smooth height, transform for GPU */}\n {title !== false && <div\n className={cls(\n \"grid transition-[grid-template-rows,transform,margin] duration-150 ease-out\",\n detailOpen\n ? \"grid-rows-[0fr] -translate-y-2 mt-0 mb-0\"\n : \"grid-rows-[1fr] translate-y-0 mt-12 mb-6\"\n )}\n >\n <div className=\"overflow-hidden flex items-center gap-4\">\n <Typography gutterBottom variant=\"h4\" className=\"grow mb-0\" component=\"h4\">\n {title ?? collection.name}\n </Typography>\n </div>\n </div>}\n {pluginWidgets.length > 0 && (\n <div\n className={cls(\n \"grid transition-[grid-template-rows] duration-150 ease-out\",\n detailOpen ? \"grid-rows-[0fr]\" : \"grid-rows-[1fr]\"\n )}\n >\n <div className=\"overflow-hidden flex-shrink-0\">\n {pluginWidgets}\n </div>\n </div>\n )}\n {withActions}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAAgB,sBAAsB,EAAE,SAAyC;CAC7E,MAAM,EACF,MACA,uBACA,iBACA,YACA,oBACA,iBACA,kBACA,UACA,eACA,YACA,mBACA,yBACA,kBACA,qBACA,iBACA,gBACA,gBACA,wB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F;IACtB,qBAAqB;IACA;IACrB,aAAa;IACb,YAAY,mBAAmB;IACf;IAChB,UAAU,gBAAgB;IAC1B,eAAe,gBAAgB;IACf;IACN;IACV,eAAe;IACf,wBAAwB;IACxB,oBAAoB;IACF;IAClB,0BAA0B;IACV;IACM;GACzB,GA7BQ,oBAAoB,MA6B5B;EACgC,CAAA;CACP,CAAA;CAItC,MAAM,cACF,oBAAC,0BAA0B,UAA3B;EAAoC,OAAO;YACvC,oBAAC,uBAAuB,UAAxB;GAAiC,OAAO,mBAAmB;aACtD;EAC4B,CAAA;CACD,CAAA;CAGxC,IAAI,aAAa,QAAQ,OAAO;CAEhC,MAAM,aAAa,qBAAqB,KAAA;CAKxC,OACI,qBAAC,OAAD;EACI,WAAW,IACP,wBACA,aAAa,KAAK,uEACtB;YAJJ;GAOK,UAAU,SAAS,oBAAC,OAAD;IAChB,WAAW,IACP,+EACA,aACM,6CACA,0CACV;cAEA,oBAAC,OAAD;KAAK,WAAU;eACX,oBAAC,YAAD;MAAY,cAAA;MAAa,SAAQ;MAAK,WAAU;MAAY,WAAU;gBACjE,SAAS,WAAW;KACb,CAAA;IACX,CAAA;GACJ,CAAA;GACJ,cAAc,SAAS,KACpB,oBAAC,OAAD;IACI,WAAW,IACP,8DACA,aAAa,oBAAoB,iBACrC;cAEA,oBAAC,OAAD;KAAK,WAAU;eACV;IACA,CAAA;GACJ,CAAA;GAER;EACA;;AAEb"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CollectionViewState } from "./useCollectionViewState.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a collection view opens over itself: the table's cell editor popup
|
|
5
|
+
* and the delete (or, on a linked tab, remove) confirmation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function CollectionViewDialogs({ state }: {
|
|
8
|
+
state: CollectionViewState;
|
|
9
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PopupFormField } from "../CollectionTableBinding/internal/popup_field/PopupFormField.js";
|
|
2
|
+
import { DeleteEntityDialog } from "../DeleteEntityDialog.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/CollectionViewBinding/CollectionViewDialogs.tsx
|
|
6
|
+
/**
|
|
7
|
+
* What a collection view opens over itself: the table's cell editor popup
|
|
8
|
+
* and the delete (or, on a linked tab, remove) confirmation.
|
|
9
|
+
*/
|
|
10
|
+
function CollectionViewDialogs({ state }) {
|
|
11
|
+
const { path, collection, popupCell, onPopupClose, tableKey, uniqueFieldValidator, onValueChange, containerRef, deleteEntityClicked, setDeleteEntityClicked, isLinkedChildView, internalOnEntityDelete, internalOnMultipleEntitiesDelete } = state;
|
|
12
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [popupCell && /* @__PURE__ */ jsx(PopupFormField, {
|
|
13
|
+
open: Boolean(popupCell),
|
|
14
|
+
onClose: onPopupClose,
|
|
15
|
+
cellRect: popupCell?.cellRect,
|
|
16
|
+
propertyKey: popupCell?.propertyKey,
|
|
17
|
+
collection,
|
|
18
|
+
entityId: popupCell.id,
|
|
19
|
+
tableKey: tableKey.current,
|
|
20
|
+
customFieldValidator: uniqueFieldValidator,
|
|
21
|
+
path,
|
|
22
|
+
onCellValueChange: onValueChange,
|
|
23
|
+
container: containerRef.current
|
|
24
|
+
}, `popup_form_${popupCell?.propertyKey}_${popupCell?.id}`), deleteEntityClicked && /* @__PURE__ */ jsx(DeleteEntityDialog, {
|
|
25
|
+
target: deleteEntityClicked,
|
|
26
|
+
path,
|
|
27
|
+
collection,
|
|
28
|
+
variant: isLinkedChildView ? "unlink" : "delete",
|
|
29
|
+
open: Boolean(deleteEntityClicked),
|
|
30
|
+
onEntityDelete: internalOnEntityDelete,
|
|
31
|
+
onMultipleEntitiesDelete: internalOnMultipleEntitiesDelete,
|
|
32
|
+
onClose: () => setDeleteEntityClicked(void 0)
|
|
33
|
+
})] });
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { CollectionViewDialogs };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=CollectionViewDialogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionViewDialogs.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewDialogs.tsx"],"sourcesContent":["import React from \"react\";\nimport { PopupFormField } from \"../CollectionTableBinding/internal/popup_field/PopupFormField\";\nimport { DeleteEntityDialog } from \"../DeleteEntityDialog\";\nimport type { CollectionViewState } from \"./useCollectionViewState\";\n\n/**\n * What a collection view opens over itself: the table's cell editor popup\n * and the delete (or, on a linked tab, remove) confirmation.\n */\nexport function CollectionViewDialogs({ state }: { state: CollectionViewState }) {\n const {\n path,\n collection,\n popupCell,\n onPopupClose,\n tableKey,\n uniqueFieldValidator,\n onValueChange,\n containerRef,\n deleteEntityClicked,\n setDeleteEntityClicked,\n isLinkedChildView,\n internalOnEntityDelete,\n internalOnMultipleEntitiesDelete\n } = state;\n\n return (\n <>\n {popupCell && <PopupFormField\n key={`popup_form_${popupCell?.propertyKey}_${popupCell?.id}`}\n open={Boolean(popupCell)}\n onClose={onPopupClose}\n cellRect={popupCell?.cellRect}\n propertyKey={popupCell?.propertyKey}\n collection={collection}\n entityId={popupCell.id}\n tableKey={tableKey.current}\n customFieldValidator={uniqueFieldValidator}\n path={path}\n onCellValueChange={onValueChange}\n container={containerRef.current}/>}\n\n {deleteEntityClicked &&\n <DeleteEntityDialog\n target={deleteEntityClicked}\n path={path}\n collection={collection}\n // A linked tab's rows are shared through a junction:\n // the server removes them from this record and deletes\n // nothing, so the dialog must not say \"delete\".\n variant={isLinkedChildView ? \"unlink\" : \"delete\"}\n open={Boolean(deleteEntityClicked)}\n onEntityDelete={internalOnEntityDelete}\n onMultipleEntitiesDelete={internalOnMultipleEntitiesDelete}\n onClose={() => setDeleteEntityClicked(undefined)}/>}\n </>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,sBAAsB,EAAE,SAAyC;CAC7E,MAAM,EACF,MACA,YACA,WACA,cACA,UACA,sBACA,eACA,cACA,qBACA,wBACA,mBACA,wBACA,qCACA;CAEJ,OACI,qBAAA,UAAA,EAAA,UAAA,CACK,aAAa,oBAAC,gBAAD;EAEV,MAAM,QAAQ,SAAS;EACvB,SAAS;EACT,UAAU,WAAW;EACrB,aAAa,WAAW;EACZ;EACZ,UAAU,UAAU;EACpB,UAAU,SAAS;EACnB,sBAAsB;EAChB;EACN,mBAAmB;EACnB,WAAW,aAAa;CAAS,GAX5B,cAAc,WAAW,YAAY,GAAG,WAAW,IAWvB,GAEpC,uBACG,oBAAC,oBAAD;EACI,QAAQ;EACF;EACM;EAIZ,SAAS,oBAAoB,WAAW;EACxC,MAAM,QAAQ,mBAAmB;EACjC,gBAAgB;EAChB,0BAA0B;EAC1B,eAAe,uBAAuB,KAAA,CAAS;CAAG,CAAA,CAC5D,EAAA,CAAA;AAEV"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The collection view's own box: the container its `@container` classes and
|
|
4
|
+
* `useCollectionLargeLayout` measure.
|
|
5
|
+
*
|
|
6
|
+
* Its own component, so a resize redraws this box and the parts whose layout
|
|
7
|
+
* flips at the breakpoint — not the whole view on every pixel.
|
|
8
|
+
*/
|
|
9
|
+
export declare function CollectionViewFrame({ className, containerRef, children }: {
|
|
10
|
+
className?: string;
|
|
11
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CollectionViewLayoutContext, LARGE_COLLECTION_WIDTH } from "./useCollectionLargeLayout.js";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cls, useElementWidth } from "@rebasepro/ui";
|
|
5
|
+
//#region src/components/CollectionViewBinding/CollectionViewFrame.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The collection view's own box: the container its `@container` classes and
|
|
8
|
+
* `useCollectionLargeLayout` measure.
|
|
9
|
+
*
|
|
10
|
+
* Its own component, so a resize redraws this box and the parts whose layout
|
|
11
|
+
* flips at the breakpoint — not the whole view on every pixel.
|
|
12
|
+
*/
|
|
13
|
+
function CollectionViewFrame({ className, containerRef, children }) {
|
|
14
|
+
const [measureRef, width] = useElementWidth();
|
|
15
|
+
const ref = useCallback((element) => {
|
|
16
|
+
containerRef.current = element;
|
|
17
|
+
measureRef(element);
|
|
18
|
+
}, [containerRef, measureRef]);
|
|
19
|
+
const large = width > 0 ? width >= LARGE_COLLECTION_WIDTH : void 0;
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: cls("@container/collection overflow-hidden h-full w-full rounded-md flex flex-col bg-surface-sheet", className),
|
|
22
|
+
ref,
|
|
23
|
+
children: /* @__PURE__ */ jsx(CollectionViewLayoutContext.Provider, {
|
|
24
|
+
value: large,
|
|
25
|
+
children
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { CollectionViewFrame };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=CollectionViewFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionViewFrame.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewFrame.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { cls, useElementWidth } from \"@rebasepro/ui\";\nimport { CollectionViewLayoutContext, LARGE_COLLECTION_WIDTH } from \"./useCollectionLargeLayout\";\n\n/**\n * The collection view's own box: the container its `@container` classes and\n * `useCollectionLargeLayout` measure.\n *\n * Its own component, so a resize redraws this box and the parts whose layout\n * flips at the breakpoint — not the whole view on every pixel.\n */\nexport function CollectionViewFrame({\n className,\n containerRef,\n children\n}: {\n className?: string;\n containerRef: React.RefObject<HTMLDivElement | null>;\n children: React.ReactNode;\n}) {\n const [measureRef, width] = useElementWidth<HTMLDivElement>();\n const ref = useCallback((element: HTMLDivElement | null) => {\n containerRef.current = element;\n measureRef(element);\n }, [containerRef, measureRef]);\n // Unmeasured — not laid out, or no ResizeObserver — is not \"narrow\".\n const large = width > 0 ? width >= LARGE_COLLECTION_WIDTH : undefined;\n\n return (\n <div className={cls(\"@container/collection overflow-hidden h-full w-full rounded-md flex flex-col bg-surface-sheet\", className)}\n ref={ref}>\n <CollectionViewLayoutContext.Provider value={large}>\n {children}\n </CollectionViewLayoutContext.Provider>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,oBAAoB,EAChC,WACA,cACA,YAKD;CACC,MAAM,CAAC,YAAY,SAAS,gBAAgC;CAC5D,MAAM,MAAM,aAAa,YAAmC;EACxD,aAAa,UAAU;EACvB,WAAW,OAAO;CACtB,GAAG,CAAC,cAAc,UAAU,CAAC;CAE7B,MAAM,QAAQ,QAAQ,IAAI,SAAS,yBAAyB,KAAA;CAE5D,OACI,oBAAC,OAAD;EAAK,WAAW,IAAI,iGAAiG,SAAS;EACrH;YACL,oBAAC,4BAA4B,UAA7B;GAAsC,OAAO;GACxC;EACiC,CAAA;CACrC,CAAA;AAEb"}
|