@rebasepro/cms 0.28.1 → 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
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
import { getPropertyInPath as getPropertyInPath$1 } from "../../util/property_utils.js";
|
|
2
|
+
import { useCollectionRegistryController } from "../../hooks/navigation/contexts/CollectionRegistryContext.js";
|
|
3
|
+
import { useSidePanel } from "../../hooks/useSidePanel.js";
|
|
4
|
+
import { useUrlController } from "../../hooks/navigation/contexts/UrlContext.js";
|
|
5
|
+
import { useAdminContext } from "../../hooks/useAdminContext.js";
|
|
6
|
+
import { mergeEntityActions } from "../../util/entity_actions.js";
|
|
7
|
+
import { CollectionRowActions } from "../CollectionTableBinding/CollectionRowActions.js";
|
|
8
|
+
import { getSubcollectionColumnId } from "../CollectionTableBinding/internal/common.js";
|
|
9
|
+
import { CollectionTableBinding } from "../CollectionTableBinding/CollectionTableBinding.js";
|
|
10
|
+
import { useEntitySelectionController } from "./useSelectionController.js";
|
|
11
|
+
import { addRecentId } from "./utils.js";
|
|
12
|
+
import { VIEW_MODES, VIEW_MODE_PARAM, isViewMode, resolveOpenEntityMode } from "../../util/view_mode.js";
|
|
13
|
+
import { navigateToEntity } from "../../util/navigation_utils.js";
|
|
14
|
+
import { copyEntityAction, deleteEntityAction, editEntityAction, unlinkEntityAction } from "../common/default_entity_actions.js";
|
|
15
|
+
import { useSelectionDialog } from "../../hooks/useSelectionDialog.js";
|
|
16
|
+
import { resolveCellProperty } from "../../form/resolve_cell_property.js";
|
|
17
|
+
import { resolveCollectionViews, resolveEntityAction } from "../../util/resolutions.js";
|
|
18
|
+
import { useChildViewSource } from "../../hooks/useChildViewSource.js";
|
|
19
|
+
import { serializeSelectionQuery } from "../../selection/resolve_selection.js";
|
|
20
|
+
import { useCollectionInlineEditor } from "./hooks/useCollectionInlineEditor.js";
|
|
21
|
+
import { CollectionViewActions } from "./CollectionViewActions.js";
|
|
22
|
+
import { DefaultCollectionEmptyState } from "./DefaultCollectionEmptyState.js";
|
|
23
|
+
import { EntityIdHeaderWidget } from "./EntityIdHeaderWidget.js";
|
|
24
|
+
import { EMPTY_ARRAY, PluginAddColumnComponents } from "./PluginColumnSlots.js";
|
|
25
|
+
import { columnsForFields, restrictCollectionToFields } from "./fields.js";
|
|
26
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
27
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
28
|
+
import { deepEqual, shallowEqual } from "fast-equals";
|
|
29
|
+
import { ArrowRightToLineIcon, Button, iconSize } from "@rebasepro/ui";
|
|
30
|
+
import { getEntityChildViews } from "@rebasepro/common";
|
|
31
|
+
import { entityOfRow, entitySelectionControllerOf, getRedundantChildViewColumnIds, populateFetchCache, rowOfEntity, saveEntityWithCallbacks, selectionControllerOf, tableControllerOf, useAnalyticsController, useAuthController, useColumnIds, useComponentOverride, useCustomizationController, useData, useDataTableController, usePermissions, useScrollRestoration, useSlot, useTranslation, useUserConfigurationPersistence } from "@rebasepro/app";
|
|
32
|
+
import { mergeDeep } from "@rebasepro/utils";
|
|
33
|
+
import { useSearchParams } from "react-router";
|
|
34
|
+
//#region src/components/CollectionViewBinding/useCollectionViewState.tsx
|
|
35
|
+
/** The collections already warned about a foreign `admin.selectionController`: the warning is said once, not on every render. */
|
|
36
|
+
var warnedForeignSelection = /* @__PURE__ */ new Set();
|
|
37
|
+
/**
|
|
38
|
+
* Everything a collection view holds and decides: the collection it draws
|
|
39
|
+
* (the registry's copy, the user's saved config and the caller's overrides,
|
|
40
|
+
* in that order), its data and selection controllers, the view mode and
|
|
41
|
+
* sizes, and the handlers its toolbar, views and dialogs call.
|
|
42
|
+
*
|
|
43
|
+
* One hook, so the toolbar, the view switch and the dialogs read the same
|
|
44
|
+
* render's values: they were one component, and each part relies on a
|
|
45
|
+
* decision another part made in the same render.
|
|
46
|
+
*/
|
|
47
|
+
function useCollectionViewState({ path: pathProp, parentCollectionSlugs, parentEntityIds, isSubCollection: _isSubCollection, className: _className, updateUrl, selectedEntityId: selectedEntityIdProp, selectedTab, collectionOverrides, highlightedIds, fields, viewMode: viewModeProp, title, onRowClick: onRowClickProp, toolbar: _toolbar, ...collectionProp }) {
|
|
48
|
+
const { t } = useTranslation();
|
|
49
|
+
const context = useAdminContext();
|
|
50
|
+
const collectionRegistry = useCollectionRegistryController();
|
|
51
|
+
const urlController = useUrlController();
|
|
52
|
+
const path = pathProp ?? collectionProp.slug;
|
|
53
|
+
const dataClient = useData();
|
|
54
|
+
const sidePanelController = useSidePanel();
|
|
55
|
+
const authController = useAuthController();
|
|
56
|
+
const userConfigPersistence = useUserConfigurationPersistence();
|
|
57
|
+
const analyticsController = useAnalyticsController();
|
|
58
|
+
const customizationController = useCustomizationController();
|
|
59
|
+
const { canCreate, canEdit, canDelete } = usePermissions();
|
|
60
|
+
/**
|
|
61
|
+
* Rows shared with other parents through a junction. The parent owns
|
|
62
|
+
* the link, not the row — so the destructive action is a removal from
|
|
63
|
+
* this record, which is what the server performs for such a path.
|
|
64
|
+
*/
|
|
65
|
+
const childViewSource = useChildViewSource(path);
|
|
66
|
+
const isLinkedChildView = childViewSource?.kind === "relation" && childViewSource.mode === "linked";
|
|
67
|
+
const linkedTargetSlug = isLinkedChildView && childViewSource.kind === "relation" ? childViewSource.targetSlug : void 0;
|
|
68
|
+
const containerRef = React.useRef(null);
|
|
69
|
+
const scrollRestoration = useScrollRestoration();
|
|
70
|
+
const collectionPropRef = React.useRef(collectionProp);
|
|
71
|
+
if (!shallowEqual(collectionPropRef.current, collectionProp)) collectionPropRef.current = collectionProp;
|
|
72
|
+
const stableCollectionProp = collectionPropRef.current;
|
|
73
|
+
const fieldsRef = React.useRef(fields);
|
|
74
|
+
if (!deepEqual(fieldsRef.current, fields)) fieldsRef.current = fields;
|
|
75
|
+
const stableFields = fieldsRef.current;
|
|
76
|
+
const overridesRef = React.useRef(collectionOverrides);
|
|
77
|
+
if (!deepEqual(overridesRef.current, collectionOverrides)) overridesRef.current = collectionOverrides;
|
|
78
|
+
const stableOverrides = overridesRef.current;
|
|
79
|
+
const collection = useMemo(() => {
|
|
80
|
+
const registryCollection = collectionRegistry.getCollection(path) || stableCollectionProp;
|
|
81
|
+
const userOverride = userConfigPersistence?.getCollectionConfig(path);
|
|
82
|
+
const drawn = userOverride ? mergeDeep(registryCollection, userOverride) : registryCollection;
|
|
83
|
+
return stableOverrides ? {
|
|
84
|
+
...drawn,
|
|
85
|
+
...stableOverrides
|
|
86
|
+
} : drawn;
|
|
87
|
+
}, [
|
|
88
|
+
stableCollectionProp,
|
|
89
|
+
path,
|
|
90
|
+
userConfigPersistence,
|
|
91
|
+
collectionRegistry,
|
|
92
|
+
stableOverrides
|
|
93
|
+
]);
|
|
94
|
+
const collectionRef = React.useRef(collection);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
collectionRef.current = collection;
|
|
97
|
+
}, [collection]);
|
|
98
|
+
const canCreateEntities = canCreate(collection, path);
|
|
99
|
+
const [highlightedId, setHighlightedId] = useState(void 0);
|
|
100
|
+
const [deleteEntityClicked, setDeleteEntityClicked] = React.useState(void 0);
|
|
101
|
+
const [lastDeleteTimestamp, setLastDeleteTimestamp] = React.useState(0);
|
|
102
|
+
const [deletedEntities, setDeletedEntities] = React.useState([]);
|
|
103
|
+
const [docsCount, setDocsCount] = useState(null);
|
|
104
|
+
const [localPropertiesOrder, setLocalPropertiesOrder] = useState(collection.propertiesOrder);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
setLocalPropertiesOrder((previous) => deepEqual(previous, collection.propertiesOrder) ? previous : collection.propertiesOrder);
|
|
107
|
+
}, [collection.propertiesOrder]);
|
|
108
|
+
const unselectNavigatedEntity = useCallback(() => {
|
|
109
|
+
const currentSelection = highlightedId;
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
if (currentSelection === highlightedId) setHighlightedId(void 0);
|
|
112
|
+
}, 2400);
|
|
113
|
+
}, [highlightedId]);
|
|
114
|
+
const inlineEditingEnabled = canEdit(collection, path, null) && (collection.inlineEditing === void 0 || collection.inlineEditing);
|
|
115
|
+
const selectionEnabled = collection.selectionEnabled === void 0 || collection.selectionEnabled;
|
|
116
|
+
const hoverRow = !inlineEditingEnabled;
|
|
117
|
+
const resolvedCustomViews = useMemo(() => resolveCollectionViews(collection.customViews, customizationController.collectionViews), [collection.customViews, customizationController]);
|
|
118
|
+
const customViewKeys = useMemo(() => resolvedCustomViews.map((v) => v.key), [resolvedCustomViews]);
|
|
119
|
+
const defaultViewMode = isViewMode(collection.defaultViewMode, customViewKeys) ? collection.defaultViewMode : "list";
|
|
120
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
121
|
+
const urlView = useMemo(() => {
|
|
122
|
+
if (!updateUrl) return null;
|
|
123
|
+
const v = searchParams.get(VIEW_MODE_PARAM);
|
|
124
|
+
return isViewMode(v, customViewKeys) ? v : null;
|
|
125
|
+
}, [
|
|
126
|
+
updateUrl,
|
|
127
|
+
searchParams,
|
|
128
|
+
customViewKeys
|
|
129
|
+
]);
|
|
130
|
+
const callerViewMode = isViewMode(viewModeProp, customViewKeys) ? viewModeProp : void 0;
|
|
131
|
+
const pickedViewModeRef = React.useRef(false);
|
|
132
|
+
const getSavedView = useCallback(() => {
|
|
133
|
+
const saved = userConfigPersistence?.getCollectionConfig(path)?.defaultViewMode;
|
|
134
|
+
return isViewMode(saved, customViewKeys) ? saved : null;
|
|
135
|
+
}, [
|
|
136
|
+
userConfigPersistence,
|
|
137
|
+
path,
|
|
138
|
+
customViewKeys
|
|
139
|
+
]);
|
|
140
|
+
const [viewMode, setViewModeState] = useState(() => {
|
|
141
|
+
if (callerViewMode) return callerViewMode;
|
|
142
|
+
if (urlView) return urlView;
|
|
143
|
+
const savedView = getSavedView();
|
|
144
|
+
if (savedView) return savedView;
|
|
145
|
+
return defaultViewMode;
|
|
146
|
+
});
|
|
147
|
+
const activeCustomView = useMemo(() => resolvedCustomViews.find((v) => v.key === viewMode), [resolvedCustomViews, viewMode]);
|
|
148
|
+
const openEntityMode = resolveOpenEntityMode({
|
|
149
|
+
collection,
|
|
150
|
+
viewMode,
|
|
151
|
+
customView: activeCustomView
|
|
152
|
+
});
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (updateUrl && !urlView && viewMode !== defaultViewMode) setSearchParams(() => {
|
|
155
|
+
const next = new URLSearchParams(window.location.search);
|
|
156
|
+
next.set(VIEW_MODE_PARAM, viewMode);
|
|
157
|
+
return next;
|
|
158
|
+
}, { replace: true });
|
|
159
|
+
}, []);
|
|
160
|
+
const setViewMode = useCallback((newMode) => {
|
|
161
|
+
setViewModeState(newMode);
|
|
162
|
+
if (!updateUrl) return;
|
|
163
|
+
setSearchParams(() => {
|
|
164
|
+
const next = new URLSearchParams(window.location.search);
|
|
165
|
+
if (newMode === defaultViewMode) next.delete(VIEW_MODE_PARAM);
|
|
166
|
+
else next.set(VIEW_MODE_PARAM, newMode);
|
|
167
|
+
return next;
|
|
168
|
+
});
|
|
169
|
+
}, [
|
|
170
|
+
defaultViewMode,
|
|
171
|
+
setSearchParams,
|
|
172
|
+
updateUrl
|
|
173
|
+
]);
|
|
174
|
+
const previousUrlViewRef = React.useRef(urlView);
|
|
175
|
+
const previousCallerViewModeRef = React.useRef(callerViewMode);
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
const urlChanged = urlView !== previousUrlViewRef.current;
|
|
178
|
+
previousUrlViewRef.current = urlView;
|
|
179
|
+
if (callerViewMode !== previousCallerViewModeRef.current) {
|
|
180
|
+
previousCallerViewModeRef.current = callerViewMode;
|
|
181
|
+
pickedViewModeRef.current = false;
|
|
182
|
+
}
|
|
183
|
+
const callerDecides = callerViewMode !== void 0 && !pickedViewModeRef.current;
|
|
184
|
+
if (urlView && (urlChanged || !callerDecides)) setViewModeState(urlView);
|
|
185
|
+
else if (callerDecides) setViewModeState(callerViewMode);
|
|
186
|
+
else {
|
|
187
|
+
const savedView = getSavedView();
|
|
188
|
+
setViewModeState(urlView ?? savedView ?? defaultViewMode);
|
|
189
|
+
}
|
|
190
|
+
}, [
|
|
191
|
+
urlView,
|
|
192
|
+
getSavedView,
|
|
193
|
+
defaultViewMode,
|
|
194
|
+
callerViewMode
|
|
195
|
+
]);
|
|
196
|
+
const [listSize, setListSize] = useState(collection.defaultSize ?? "m");
|
|
197
|
+
const [cardSize, setCardSize] = useState(collection.defaultSize ?? "m");
|
|
198
|
+
const [tableSize, setTableSize] = useState(collection.defaultSize ?? "m");
|
|
199
|
+
const [customViewSize, setCustomViewSize] = useState(collection.defaultSize ?? "m");
|
|
200
|
+
const selectionController = useEntitySelectionController();
|
|
201
|
+
const callerSelectionController = collection.selectionController ? entitySelectionControllerOf(collection.selectionController) : void 0;
|
|
202
|
+
if (collection.selectionController && !callerSelectionController && !warnedForeignSelection.has(collection.slug)) {
|
|
203
|
+
warnedForeignSelection.add(collection.slug);
|
|
204
|
+
console.warn(`admin.selectionController of "${collection.slug}" was not made by useSelectionController(), so the view keeps its own selection.`);
|
|
205
|
+
}
|
|
206
|
+
const usedSelectionController = callerSelectionController ?? selectionController;
|
|
207
|
+
const { selection, clearSelection, toggleEntitySelection } = usedSelectionController;
|
|
208
|
+
const tableController = useDataTableController({
|
|
209
|
+
path,
|
|
210
|
+
collection,
|
|
211
|
+
lastDeleteTimestamp,
|
|
212
|
+
scrollRestoration,
|
|
213
|
+
updateUrl,
|
|
214
|
+
enabled: viewMode !== "kanban"
|
|
215
|
+
});
|
|
216
|
+
const tableKey = React.useRef(Math.random().toString(36));
|
|
217
|
+
const popupCell = tableController.popupCell;
|
|
218
|
+
const onPopupClose = useCallback(() => {
|
|
219
|
+
tableController.setPopupCell?.(void 0);
|
|
220
|
+
}, [tableController.setPopupCell]);
|
|
221
|
+
const onEntityClick = useCallback((clickedEntity) => {
|
|
222
|
+
const collection = collectionRef.current;
|
|
223
|
+
setHighlightedId(clickedEntity.id);
|
|
224
|
+
if (onRowClickProp) {
|
|
225
|
+
onRowClickProp(rowOfEntity(clickedEntity, collection), String(clickedEntity.id));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
analyticsController.onAnalyticsEvent?.("edit_entity_clicked", {
|
|
229
|
+
path: clickedEntity.path,
|
|
230
|
+
entityId: clickedEntity.id
|
|
231
|
+
});
|
|
232
|
+
if (collection) addRecentId(collection.slug, clickedEntity.id);
|
|
233
|
+
const entityPath = path ?? clickedEntity.path;
|
|
234
|
+
populateFetchCache(entityPath, [clickedEntity]);
|
|
235
|
+
navigateToEntity({
|
|
236
|
+
navigation: urlController,
|
|
237
|
+
path: entityPath,
|
|
238
|
+
sidePanelController,
|
|
239
|
+
openEntityMode,
|
|
240
|
+
collection,
|
|
241
|
+
id: clickedEntity.id,
|
|
242
|
+
replace: openEntityMode === "split" && selectedEntityIdProp !== void 0
|
|
243
|
+
});
|
|
244
|
+
}, [
|
|
245
|
+
sidePanelController,
|
|
246
|
+
openEntityMode,
|
|
247
|
+
selectedEntityIdProp,
|
|
248
|
+
path,
|
|
249
|
+
urlController,
|
|
250
|
+
analyticsController,
|
|
251
|
+
onRowClickProp
|
|
252
|
+
]);
|
|
253
|
+
const onCreatedInPanel = useCallback(() => {
|
|
254
|
+
setLastDeleteTimestamp(Date.now());
|
|
255
|
+
}, []);
|
|
256
|
+
/**
|
|
257
|
+
* Attach rows that already exist to this parent.
|
|
258
|
+
*
|
|
259
|
+
* Writing to the row's own address under this parent — `PUT
|
|
260
|
+
* posts/1/tags/5` — is what asserts membership; the backend writes the
|
|
261
|
+
* junction row idempotently. Sending no values keeps it a pure link:
|
|
262
|
+
* the target's own fields are none of this tab's business.
|
|
263
|
+
*/
|
|
264
|
+
const linkExistingEntities = useCallback(async (_rows, ids) => {
|
|
265
|
+
const alreadyLinked = new Set(tableController.data.map((e) => String(e.id)));
|
|
266
|
+
const toLink = ids.filter((id) => !alreadyLinked.has(id));
|
|
267
|
+
if (toLink.length === 0) return;
|
|
268
|
+
try {
|
|
269
|
+
await Promise.all(toLink.map((id) => saveEntityWithCallbacks({
|
|
270
|
+
path,
|
|
271
|
+
entityId: id,
|
|
272
|
+
values: {},
|
|
273
|
+
status: "existing",
|
|
274
|
+
collection,
|
|
275
|
+
data: dataClient,
|
|
276
|
+
context
|
|
277
|
+
})));
|
|
278
|
+
setLastDeleteTimestamp(Date.now());
|
|
279
|
+
} catch (e) {
|
|
280
|
+
context.snackbarController?.open({
|
|
281
|
+
type: "error",
|
|
282
|
+
message: e instanceof Error ? e.message : String(e)
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}, [
|
|
286
|
+
dataClient,
|
|
287
|
+
path,
|
|
288
|
+
tableController.data,
|
|
289
|
+
collection,
|
|
290
|
+
context
|
|
291
|
+
]);
|
|
292
|
+
const selectionDialog = useSelectionDialog({
|
|
293
|
+
path: linkedTargetSlug ?? false,
|
|
294
|
+
multiselect: true,
|
|
295
|
+
onSelectionDone: linkExistingEntities
|
|
296
|
+
});
|
|
297
|
+
const openNewDocument = useCallback((defaultValues) => {
|
|
298
|
+
const collection = collectionRef.current;
|
|
299
|
+
analyticsController.onAnalyticsEvent?.("new_entity_click", { path });
|
|
300
|
+
navigateToEntity({
|
|
301
|
+
openEntityMode,
|
|
302
|
+
collection,
|
|
303
|
+
id: void 0,
|
|
304
|
+
defaultValues,
|
|
305
|
+
path,
|
|
306
|
+
sidePanelController,
|
|
307
|
+
navigation: urlController,
|
|
308
|
+
onClose: unselectNavigatedEntity,
|
|
309
|
+
onSaved: onCreatedInPanel
|
|
310
|
+
});
|
|
311
|
+
}, [
|
|
312
|
+
path,
|
|
313
|
+
sidePanelController,
|
|
314
|
+
openEntityMode,
|
|
315
|
+
urlController,
|
|
316
|
+
unselectNavigatedEntity,
|
|
317
|
+
onCreatedInPanel
|
|
318
|
+
]);
|
|
319
|
+
const onNewClick = useCallback(() => openNewDocument(), [openNewDocument]);
|
|
320
|
+
const onMultipleDeleteClick = () => {
|
|
321
|
+
analyticsController.onAnalyticsEvent?.("multiple_delete_dialog_open", { path });
|
|
322
|
+
setDeleteEntityClicked(selection);
|
|
323
|
+
};
|
|
324
|
+
const internalOnEntityDelete = (_path, entity) => {
|
|
325
|
+
analyticsController.onAnalyticsEvent?.("single_entity_deleted", { path });
|
|
326
|
+
toggleEntitySelection(entity, false);
|
|
327
|
+
setDeletedEntities((prev) => [...prev, entity]);
|
|
328
|
+
setLastDeleteTimestamp(Date.now());
|
|
329
|
+
};
|
|
330
|
+
const internalOnMultipleEntitiesDelete = (_path, entities) => {
|
|
331
|
+
analyticsController.onAnalyticsEvent?.("multiple_entities_deleted", { path });
|
|
332
|
+
clearSelection();
|
|
333
|
+
setDeleteEntityClicked(void 0);
|
|
334
|
+
setDeletedEntities((prev) => [...prev, ...entities]);
|
|
335
|
+
setLastDeleteTimestamp(Date.now());
|
|
336
|
+
};
|
|
337
|
+
const rowTableController = tableControllerOf(tableController, collection);
|
|
338
|
+
const rowSelectionController = selectionControllerOf(usedSelectionController, collection, path);
|
|
339
|
+
const pluginAddColumnComponents = useSlot("collection.add-column", {
|
|
340
|
+
path,
|
|
341
|
+
parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,
|
|
342
|
+
parentEntityIds: parentEntityIds ?? EMPTY_ARRAY,
|
|
343
|
+
collection,
|
|
344
|
+
tableController: rowTableController
|
|
345
|
+
});
|
|
346
|
+
const pluginToolbarWidgets = useSlot("collection.toolbar", {
|
|
347
|
+
path,
|
|
348
|
+
parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,
|
|
349
|
+
parentEntityIds: parentEntityIds ?? EMPTY_ARRAY,
|
|
350
|
+
collection,
|
|
351
|
+
tableController: rowTableController,
|
|
352
|
+
selectionController: rowSelectionController
|
|
353
|
+
});
|
|
354
|
+
const pluginEmptyStates = useSlot("collection.empty-state", {
|
|
355
|
+
path,
|
|
356
|
+
parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,
|
|
357
|
+
parentEntityIds: parentEntityIds ?? EMPTY_ARRAY,
|
|
358
|
+
collection,
|
|
359
|
+
canCreate: canCreateEntities,
|
|
360
|
+
onNewClick
|
|
361
|
+
});
|
|
362
|
+
const pluginWidgets = useSlot("collection.widgets", {
|
|
363
|
+
path,
|
|
364
|
+
parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,
|
|
365
|
+
parentEntityIds: parentEntityIds ?? EMPTY_ARRAY,
|
|
366
|
+
collection
|
|
367
|
+
});
|
|
368
|
+
const onCollectionModifiedForUser = useCallback((path, partialCollection) => {
|
|
369
|
+
if (userConfigPersistence) {
|
|
370
|
+
const updatedConfig = mergeDeep(userConfigPersistence.getCollectionConfig(path), partialCollection);
|
|
371
|
+
userConfigPersistence.onCollectionModified(path, updatedConfig);
|
|
372
|
+
}
|
|
373
|
+
}, [userConfigPersistence]);
|
|
374
|
+
const onColumnResize = useCallback(({ width, key }) => {
|
|
375
|
+
const collection = collectionRef.current;
|
|
376
|
+
if (!getPropertyInPath$1(collection.properties, key)) return;
|
|
377
|
+
const localCollection = buildPropertyWidthOverwrite(key, width);
|
|
378
|
+
onCollectionModifiedForUser(path, localCollection);
|
|
379
|
+
}, [onCollectionModifiedForUser, path]);
|
|
380
|
+
const onListSizeChanged = useCallback((size) => {
|
|
381
|
+
setListSize(size);
|
|
382
|
+
if (userConfigPersistence) onCollectionModifiedForUser(path, { defaultSize: size });
|
|
383
|
+
}, [
|
|
384
|
+
onCollectionModifiedForUser,
|
|
385
|
+
path,
|
|
386
|
+
userConfigPersistence
|
|
387
|
+
]);
|
|
388
|
+
const onTableSizeChanged = useCallback((size) => {
|
|
389
|
+
setTableSize(size);
|
|
390
|
+
if (userConfigPersistence) onCollectionModifiedForUser(path, { defaultSize: size });
|
|
391
|
+
}, [
|
|
392
|
+
onCollectionModifiedForUser,
|
|
393
|
+
path,
|
|
394
|
+
userConfigPersistence
|
|
395
|
+
]);
|
|
396
|
+
const onViewModeChange = useCallback((mode) => {
|
|
397
|
+
analyticsController.onAnalyticsEvent?.("view_mode_changed", {
|
|
398
|
+
path,
|
|
399
|
+
from: viewMode,
|
|
400
|
+
to: mode
|
|
401
|
+
});
|
|
402
|
+
pickedViewModeRef.current = true;
|
|
403
|
+
setViewMode(mode);
|
|
404
|
+
if (userConfigPersistence) onCollectionModifiedForUser(path, { defaultViewMode: mode });
|
|
405
|
+
}, [
|
|
406
|
+
setViewMode,
|
|
407
|
+
userConfigPersistence,
|
|
408
|
+
onCollectionModifiedForUser,
|
|
409
|
+
path,
|
|
410
|
+
analyticsController,
|
|
411
|
+
viewMode
|
|
412
|
+
]);
|
|
413
|
+
const createEnabled = canCreate(collection, path);
|
|
414
|
+
const { onValueChange, uniqueFieldValidator } = useCollectionInlineEditor({
|
|
415
|
+
path,
|
|
416
|
+
collection,
|
|
417
|
+
dataClient,
|
|
418
|
+
context
|
|
419
|
+
});
|
|
420
|
+
const resolvedCollection = collection;
|
|
421
|
+
const hasEnumProperty = useMemo(() => {
|
|
422
|
+
return Object.values(resolvedCollection.properties).some((p) => p.type === "string" && "enum" in p && p.enum);
|
|
423
|
+
}, [resolvedCollection.properties]);
|
|
424
|
+
const enabledViews = useMemo(() => {
|
|
425
|
+
const renderable = (collection.enabledViews ?? [...VIEW_MODES, ...customViewKeys]).filter((v) => isViewMode(v, customViewKeys));
|
|
426
|
+
if (!hasEnumProperty) return renderable.filter((v) => v !== "kanban");
|
|
427
|
+
return renderable;
|
|
428
|
+
}, [
|
|
429
|
+
collection.enabledViews,
|
|
430
|
+
hasEnumProperty,
|
|
431
|
+
customViewKeys
|
|
432
|
+
]);
|
|
433
|
+
const kanbanPropertyOptions = useMemo(() => {
|
|
434
|
+
const options = [];
|
|
435
|
+
const properties = resolvedCollection.properties;
|
|
436
|
+
for (const [key, property] of Object.entries(properties)) {
|
|
437
|
+
const prop = property;
|
|
438
|
+
if (prop && prop.type === "string" && "enum" in prop && prop.enum) options.push({
|
|
439
|
+
key,
|
|
440
|
+
label: prop.name || key
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
return options;
|
|
444
|
+
}, [resolvedCollection.properties]);
|
|
445
|
+
const getSavedKanbanProperty = useCallback(() => {
|
|
446
|
+
return (userConfigPersistence?.getCollectionConfig(path))?.kanbanColumnProperty;
|
|
447
|
+
}, [userConfigPersistence, path]);
|
|
448
|
+
const [selectedKanbanProperty, setSelectedKanbanProperty] = useState(() => {
|
|
449
|
+
const saved = getSavedKanbanProperty();
|
|
450
|
+
if (saved && kanbanPropertyOptions.some((o) => o.key === saved)) return saved;
|
|
451
|
+
if (collection.kanban?.columnProperty) return collection.kanban.columnProperty;
|
|
452
|
+
return kanbanPropertyOptions[0]?.key ?? "";
|
|
453
|
+
});
|
|
454
|
+
useEffect(() => {
|
|
455
|
+
if (kanbanPropertyOptions.length > 0 && !kanbanPropertyOptions.some((o) => o.key === selectedKanbanProperty)) {
|
|
456
|
+
const saved = getSavedKanbanProperty();
|
|
457
|
+
if (saved && kanbanPropertyOptions.some((o) => o.key === saved)) setSelectedKanbanProperty(saved);
|
|
458
|
+
else if (collection.kanban?.columnProperty && kanbanPropertyOptions.some((o) => o.key === collection.kanban?.columnProperty)) setSelectedKanbanProperty(collection.kanban.columnProperty);
|
|
459
|
+
else setSelectedKanbanProperty(kanbanPropertyOptions[0]?.key ?? "");
|
|
460
|
+
}
|
|
461
|
+
}, [
|
|
462
|
+
kanbanPropertyOptions,
|
|
463
|
+
selectedKanbanProperty,
|
|
464
|
+
getSavedKanbanProperty,
|
|
465
|
+
collection.kanban?.columnProperty
|
|
466
|
+
]);
|
|
467
|
+
const onKanbanPropertyChange = useCallback((property) => {
|
|
468
|
+
analyticsController.onAnalyticsEvent?.("kanban_property_changed", {
|
|
469
|
+
path,
|
|
470
|
+
property
|
|
471
|
+
});
|
|
472
|
+
setSelectedKanbanProperty(property);
|
|
473
|
+
if (userConfigPersistence) onCollectionModifiedForUser(path, { kanbanColumnProperty: property });
|
|
474
|
+
}, [
|
|
475
|
+
userConfigPersistence,
|
|
476
|
+
onCollectionModifiedForUser,
|
|
477
|
+
path,
|
|
478
|
+
analyticsController
|
|
479
|
+
]);
|
|
480
|
+
const getPropertyFor = useCallback(({ propertyKey, entity }) => {
|
|
481
|
+
let property = getPropertyInPath$1(collection.properties, propertyKey);
|
|
482
|
+
if (!property) property = getPropertyInPath$1(resolvedCollection.properties, propertyKey);
|
|
483
|
+
if (!property) return null;
|
|
484
|
+
return resolveCellProperty(property, propertyKey, entity, {
|
|
485
|
+
path,
|
|
486
|
+
authController,
|
|
487
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
488
|
+
});
|
|
489
|
+
}, [
|
|
490
|
+
collection.properties,
|
|
491
|
+
resolvedCollection.properties,
|
|
492
|
+
path,
|
|
493
|
+
authController,
|
|
494
|
+
customizationController.propertyConfigs
|
|
495
|
+
]);
|
|
496
|
+
const collectionWithLocalOrder = useMemo(() => {
|
|
497
|
+
if (localPropertiesOrder && localPropertiesOrder !== resolvedCollection.propertiesOrder) return {
|
|
498
|
+
...resolvedCollection,
|
|
499
|
+
propertiesOrder: localPropertiesOrder
|
|
500
|
+
};
|
|
501
|
+
return resolvedCollection;
|
|
502
|
+
}, [resolvedCollection, localPropertiesOrder]);
|
|
503
|
+
const laidOutColumnIds = useColumnIds(useMemo(() => stableFields ? {
|
|
504
|
+
...collectionWithLocalOrder,
|
|
505
|
+
propertiesOrder: stableFields
|
|
506
|
+
} : collectionWithLocalOrder, [collectionWithLocalOrder, stableFields]), true);
|
|
507
|
+
const displayedColumnIds = useMemo(() => stableFields ? columnsForFields(laidOutColumnIds, stableFields) : laidOutColumnIds, [laidOutColumnIds, stableFields]);
|
|
508
|
+
const viewCollection = useMemo(() => stableFields ? restrictCollectionToFields(collection, stableFields) : collection, [collection, stableFields]);
|
|
509
|
+
const additionalFields = useMemo(() => {
|
|
510
|
+
const redundant = getRedundantChildViewColumnIds(collectionWithLocalOrder);
|
|
511
|
+
const subcollectionColumns = getEntityChildViews(collection).map((v) => v.collection).filter((child) => !redundant.has(getSubcollectionColumnId(child))).map((subcollection) => {
|
|
512
|
+
return {
|
|
513
|
+
key: getSubcollectionColumnId(subcollection),
|
|
514
|
+
name: subcollection.name,
|
|
515
|
+
width: 200,
|
|
516
|
+
dependencies: [],
|
|
517
|
+
Builder: ({ id }) => /* @__PURE__ */ jsx(Button, {
|
|
518
|
+
className: "max-w-full truncate justify-start",
|
|
519
|
+
startIcon: /* @__PURE__ */ jsx(ArrowRightToLineIcon, { size: iconSize.small }),
|
|
520
|
+
onClick: (event) => {
|
|
521
|
+
event.stopPropagation();
|
|
522
|
+
navigateToEntity({
|
|
523
|
+
openEntityMode,
|
|
524
|
+
collection,
|
|
525
|
+
id,
|
|
526
|
+
selectedTab: subcollection.slug,
|
|
527
|
+
path,
|
|
528
|
+
navigation: urlController,
|
|
529
|
+
sidePanelController
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
children: subcollection.name
|
|
533
|
+
})
|
|
534
|
+
};
|
|
535
|
+
}) ?? EMPTY_ARRAY;
|
|
536
|
+
return [...collection.additionalFields ?? EMPTY_ARRAY, ...subcollectionColumns];
|
|
537
|
+
}, [
|
|
538
|
+
collection,
|
|
539
|
+
collectionWithLocalOrder,
|
|
540
|
+
path,
|
|
541
|
+
sidePanelController,
|
|
542
|
+
openEntityMode,
|
|
543
|
+
urlController
|
|
544
|
+
]);
|
|
545
|
+
const updateLastDeleteTimestamp = useCallback(() => {
|
|
546
|
+
setLastDeleteTimestamp(Date.now());
|
|
547
|
+
}, []);
|
|
548
|
+
const isSplitLayout = openEntityMode === "split";
|
|
549
|
+
const isCompact = isSplitLayout && selectedEntityIdProp !== void 0;
|
|
550
|
+
const activeSelectionEnabled = !isCompact && selectionEnabled;
|
|
551
|
+
const editAction = useMemo(() => onRowClickProp ? {
|
|
552
|
+
...editEntityAction,
|
|
553
|
+
onClick: ({ row, id, path: rowPath }) => {
|
|
554
|
+
if (row && id !== void 0) onEntityClick(entityOfRow(row, id, rowPath ?? path, collection));
|
|
555
|
+
}
|
|
556
|
+
} : editEntityAction, [
|
|
557
|
+
onRowClickProp,
|
|
558
|
+
onEntityClick,
|
|
559
|
+
path,
|
|
560
|
+
collection
|
|
561
|
+
]);
|
|
562
|
+
const getActionsForEntity = useCallback(({ entity, customEntityActions }) => {
|
|
563
|
+
const deleteEnabled = entity ? canDelete(collection, path, entity.values) : true;
|
|
564
|
+
const disableActions = collection.disableDefaultActions ?? [];
|
|
565
|
+
const actions = [];
|
|
566
|
+
if (!disableActions.includes("edit")) actions.push(editAction);
|
|
567
|
+
if (createEnabled && !disableActions.includes("copy")) actions.push(copyEntityAction);
|
|
568
|
+
if (deleteEnabled && !disableActions.includes("delete")) actions.push(isLinkedChildView ? unlinkEntityAction : deleteEntityAction);
|
|
569
|
+
if (customEntityActions) return mergeEntityActions(actions, customEntityActions);
|
|
570
|
+
return actions;
|
|
571
|
+
}, [
|
|
572
|
+
canDelete,
|
|
573
|
+
collection,
|
|
574
|
+
path,
|
|
575
|
+
createEnabled,
|
|
576
|
+
isLinkedChildView,
|
|
577
|
+
editAction
|
|
578
|
+
]);
|
|
579
|
+
const getIdColumnWidth = useCallback((largeLayout) => {
|
|
580
|
+
const entityActions = getActionsForEntity({});
|
|
581
|
+
const collapsedActions = entityActions.filter((a) => a.collapsed !== false);
|
|
582
|
+
const actionsWidth = entityActions.filter((a) => a.collapsed === false).length * (largeLayout ? 40 : 30);
|
|
583
|
+
return (largeLayout ? 80 + actionsWidth : 70 + actionsWidth) + (collapsedActions.length > 0 ? largeLayout ? 40 : 30 : 0);
|
|
584
|
+
}, [getActionsForEntity]);
|
|
585
|
+
const customEntityActions = useMemo(() => (collection.entityActions ?? EMPTY_ARRAY).map((action) => resolveEntityAction(action, customizationController.entityActions)).filter(Boolean), [collection.entityActions, customizationController.entityActions]);
|
|
586
|
+
const tableRowActionsBuilder = useCallback(({ entity, size, width, frozen }) => {
|
|
587
|
+
const isSelected = usedSelectionController.isEntitySelected(entity);
|
|
588
|
+
const actions = getActionsForEntity({
|
|
589
|
+
entity,
|
|
590
|
+
customEntityActions
|
|
591
|
+
});
|
|
592
|
+
return /* @__PURE__ */ jsx(CollectionRowActions, {
|
|
593
|
+
entity,
|
|
594
|
+
width,
|
|
595
|
+
frozen,
|
|
596
|
+
isSelected,
|
|
597
|
+
selectionEnabled: activeSelectionEnabled,
|
|
598
|
+
size,
|
|
599
|
+
highlightRow: setHighlightedId,
|
|
600
|
+
unhighlightRow: unselectNavigatedEntity,
|
|
601
|
+
collection,
|
|
602
|
+
path,
|
|
603
|
+
actions,
|
|
604
|
+
hideId: collection?.hideIdFromCollection,
|
|
605
|
+
onCollectionChange: updateLastDeleteTimestamp,
|
|
606
|
+
selectionController: usedSelectionController,
|
|
607
|
+
openEntityMode
|
|
608
|
+
});
|
|
609
|
+
}, [
|
|
610
|
+
updateLastDeleteTimestamp,
|
|
611
|
+
usedSelectionController,
|
|
612
|
+
customEntityActions,
|
|
613
|
+
getActionsForEntity,
|
|
614
|
+
activeSelectionEnabled,
|
|
615
|
+
unselectNavigatedEntity,
|
|
616
|
+
collection,
|
|
617
|
+
path,
|
|
618
|
+
openEntityMode
|
|
619
|
+
]);
|
|
620
|
+
const getCardActions = useCallback((entity) => getActionsForEntity({
|
|
621
|
+
entity,
|
|
622
|
+
customEntityActions
|
|
623
|
+
}), [getActionsForEntity, customEntityActions]);
|
|
624
|
+
const entityActionsScope = useMemo(() => ({
|
|
625
|
+
getActions: getCardActions,
|
|
626
|
+
collection,
|
|
627
|
+
path,
|
|
628
|
+
openEntityMode,
|
|
629
|
+
selectionController: usedSelectionController,
|
|
630
|
+
onCollectionChange: updateLastDeleteTimestamp,
|
|
631
|
+
highlightRow: setHighlightedId,
|
|
632
|
+
unhighlightRow: unselectNavigatedEntity
|
|
633
|
+
}), [
|
|
634
|
+
getCardActions,
|
|
635
|
+
collection,
|
|
636
|
+
path,
|
|
637
|
+
openEntityMode,
|
|
638
|
+
usedSelectionController,
|
|
639
|
+
updateLastDeleteTimestamp,
|
|
640
|
+
unselectNavigatedEntity
|
|
641
|
+
]);
|
|
642
|
+
const shownIds = highlightedIds ?? (highlightedId === void 0 ? EMPTY_ARRAY : [highlightedId]);
|
|
643
|
+
const highlightedEntities = useMemo(() => {
|
|
644
|
+
if (shownIds.length === 0) return EMPTY_ARRAY;
|
|
645
|
+
const wanted = new Set(shownIds.map(String));
|
|
646
|
+
const found = tableController.data.filter((entity) => wanted.has(String(entity.id)));
|
|
647
|
+
return found.length > 0 ? found : EMPTY_ARRAY;
|
|
648
|
+
}, [shownIds.map(String).join("\0"), tableController.data]);
|
|
649
|
+
const idHeaderWidget = useMemo(() => /* @__PURE__ */ jsx(EntityIdHeaderWidget, {
|
|
650
|
+
path,
|
|
651
|
+
idPath: path,
|
|
652
|
+
collection,
|
|
653
|
+
openEntityMode
|
|
654
|
+
}), [
|
|
655
|
+
path,
|
|
656
|
+
collection,
|
|
657
|
+
openEntityMode
|
|
658
|
+
]);
|
|
659
|
+
const liveSelectionQuery = useMemo(() => ({
|
|
660
|
+
path,
|
|
661
|
+
filterValues: tableController.filterValues,
|
|
662
|
+
searchString: tableController.searchString,
|
|
663
|
+
sortBy: tableController.sortBy
|
|
664
|
+
}), [
|
|
665
|
+
path,
|
|
666
|
+
tableController.filterValues,
|
|
667
|
+
tableController.searchString,
|
|
668
|
+
tableController.sortBy
|
|
669
|
+
]);
|
|
670
|
+
const selectionQueryKey = selection.type === "query" ? serializeSelectionQuery(selection.query) : void 0;
|
|
671
|
+
const liveQueryKey = serializeSelectionQuery(liveSelectionQuery);
|
|
672
|
+
useEffect(() => {
|
|
673
|
+
if (selectionQueryKey !== void 0 && selectionQueryKey !== liveQueryKey) clearSelection();
|
|
674
|
+
}, [
|
|
675
|
+
selectionQueryKey,
|
|
676
|
+
liveQueryKey,
|
|
677
|
+
clearSelection
|
|
678
|
+
]);
|
|
679
|
+
const { resolvedSlots } = customizationController;
|
|
680
|
+
const headerActionContributions = useMemo(() => resolvedSlots.filter((s) => s.slot === "collection.header.action").sort((a, b) => (a.order ?? 50) - (b.order ?? 50)), [resolvedSlots]);
|
|
681
|
+
const headerActionsScope = useMemo(() => headerActionContributions.length > 0 ? {
|
|
682
|
+
contributions: headerActionContributions,
|
|
683
|
+
path,
|
|
684
|
+
collection,
|
|
685
|
+
tableController: rowTableController,
|
|
686
|
+
parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,
|
|
687
|
+
parentEntityIds: parentEntityIds ?? EMPTY_ARRAY
|
|
688
|
+
} : null, [
|
|
689
|
+
headerActionContributions,
|
|
690
|
+
path,
|
|
691
|
+
collection,
|
|
692
|
+
rowTableController,
|
|
693
|
+
parentCollectionSlugs,
|
|
694
|
+
parentEntityIds
|
|
695
|
+
]);
|
|
696
|
+
const addColumnComponentInternal = pluginAddColumnComponents.length > 0 ? PluginAddColumnComponents : void 0;
|
|
697
|
+
const onColumnsOrderChange = useCallback((newColumns) => {
|
|
698
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
699
|
+
const newPropertiesOrder = newColumns.filter((col) => !col.frozen && getPropertyInPath$1(collection.properties, col.key)).map((col) => col.key).filter((key) => {
|
|
700
|
+
if (seenKeys.has(key)) return false;
|
|
701
|
+
seenKeys.add(key);
|
|
702
|
+
return true;
|
|
703
|
+
});
|
|
704
|
+
setLocalPropertiesOrder(newPropertiesOrder);
|
|
705
|
+
if (customizationController?.plugins) customizationController.plugins.filter((plugin) => plugin.hooks?.onColumnsReorder).forEach((plugin) => {
|
|
706
|
+
plugin.hooks.onColumnsReorder({
|
|
707
|
+
fullPath: path,
|
|
708
|
+
parentCollectionSlugs: parentCollectionSlugs ?? EMPTY_ARRAY,
|
|
709
|
+
parentEntityIds: parentEntityIds ?? EMPTY_ARRAY,
|
|
710
|
+
collection,
|
|
711
|
+
newPropertiesOrder
|
|
712
|
+
});
|
|
713
|
+
});
|
|
714
|
+
if (userConfigPersistence) onCollectionModifiedForUser(path, { propertiesOrder: newPropertiesOrder });
|
|
715
|
+
}, [
|
|
716
|
+
collection,
|
|
717
|
+
setLocalPropertiesOrder,
|
|
718
|
+
customizationController,
|
|
719
|
+
path,
|
|
720
|
+
parentCollectionSlugs,
|
|
721
|
+
parentEntityIds,
|
|
722
|
+
userConfigPersistence,
|
|
723
|
+
onCollectionModifiedForUser
|
|
724
|
+
]);
|
|
725
|
+
const [viewModePopoverOpen, setViewModePopoverOpen] = useState(false);
|
|
726
|
+
const pluginErrorViews = useSlot("collection.error", {
|
|
727
|
+
path,
|
|
728
|
+
collection,
|
|
729
|
+
parentCollectionSlugs,
|
|
730
|
+
parentEntityIds,
|
|
731
|
+
error: tableController.dataLoadingError
|
|
732
|
+
});
|
|
733
|
+
const pluginErrorView = tableController.dataLoadingError && pluginErrorViews.length > 0 ? pluginErrorViews[0] : null;
|
|
734
|
+
const isSearching = !!tableController.searchString;
|
|
735
|
+
const fixedFilter = collection.fixedFilter;
|
|
736
|
+
const isFiltered = isSearching || Object.keys(tableController.filterValues ?? {}).some((key) => !fixedFilter || !(key in fixedFilter));
|
|
737
|
+
const ResolvedEmptyState = useComponentOverride("Collection.EmptyState", DefaultCollectionEmptyState);
|
|
738
|
+
const ResolvedCollectionActions = useComponentOverride("Collection.Actions", CollectionViewActions);
|
|
739
|
+
const ResolvedCollectionTable = useComponentOverride("Collection.Table", CollectionTableBinding);
|
|
740
|
+
const emptyComponent = pluginEmptyStates.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: pluginEmptyStates }) : /* @__PURE__ */ jsx(ResolvedEmptyState, {
|
|
741
|
+
canCreate: canCreateEntities && !isFiltered,
|
|
742
|
+
onNewClick,
|
|
743
|
+
isSearching,
|
|
744
|
+
isFiltered,
|
|
745
|
+
searchString: tableController.searchString ?? ""
|
|
746
|
+
});
|
|
747
|
+
return {
|
|
748
|
+
t,
|
|
749
|
+
containerRef,
|
|
750
|
+
path,
|
|
751
|
+
parentCollectionSlugs,
|
|
752
|
+
parentEntityIds,
|
|
753
|
+
selectedEntityId: selectedEntityIdProp,
|
|
754
|
+
selectedTab,
|
|
755
|
+
collection,
|
|
756
|
+
collectionRef,
|
|
757
|
+
resolvedCollection,
|
|
758
|
+
canCreateEntities,
|
|
759
|
+
highlightedId,
|
|
760
|
+
setHighlightedId,
|
|
761
|
+
deleteEntityClicked,
|
|
762
|
+
setDeleteEntityClicked,
|
|
763
|
+
lastDeleteTimestamp,
|
|
764
|
+
deletedEntities,
|
|
765
|
+
docsCount,
|
|
766
|
+
setDocsCount,
|
|
767
|
+
inlineEditingEnabled,
|
|
768
|
+
selectionEnabled,
|
|
769
|
+
hoverRow,
|
|
770
|
+
resolvedCustomViews,
|
|
771
|
+
viewMode,
|
|
772
|
+
activeCustomView,
|
|
773
|
+
openEntityMode,
|
|
774
|
+
onViewModeChange,
|
|
775
|
+
listSize,
|
|
776
|
+
cardSize,
|
|
777
|
+
setCardSize,
|
|
778
|
+
tableSize,
|
|
779
|
+
customViewSize,
|
|
780
|
+
setCustomViewSize,
|
|
781
|
+
onListSizeChanged,
|
|
782
|
+
onTableSizeChanged,
|
|
783
|
+
usedSelectionController,
|
|
784
|
+
tableController,
|
|
785
|
+
tableKey,
|
|
786
|
+
popupCell,
|
|
787
|
+
onPopupClose,
|
|
788
|
+
onEntityClick,
|
|
789
|
+
onNewClick,
|
|
790
|
+
openNewDocument,
|
|
791
|
+
linkedTargetSlug,
|
|
792
|
+
isLinkedChildView,
|
|
793
|
+
selectionDialog,
|
|
794
|
+
onMultipleDeleteClick,
|
|
795
|
+
internalOnEntityDelete,
|
|
796
|
+
internalOnMultipleEntitiesDelete,
|
|
797
|
+
pluginAddColumnComponents,
|
|
798
|
+
pluginToolbarWidgets,
|
|
799
|
+
pluginWidgets,
|
|
800
|
+
onColumnResize,
|
|
801
|
+
onValueChange,
|
|
802
|
+
uniqueFieldValidator,
|
|
803
|
+
enabledViews,
|
|
804
|
+
kanbanPropertyOptions,
|
|
805
|
+
selectedKanbanProperty,
|
|
806
|
+
onKanbanPropertyChange,
|
|
807
|
+
getPropertyFor,
|
|
808
|
+
displayedColumnIds,
|
|
809
|
+
additionalFields,
|
|
810
|
+
isSplitLayout,
|
|
811
|
+
isCompact,
|
|
812
|
+
activeSelectionEnabled,
|
|
813
|
+
getActionsForEntity,
|
|
814
|
+
getIdColumnWidth,
|
|
815
|
+
customEntityActions,
|
|
816
|
+
tableRowActionsBuilder,
|
|
817
|
+
highlightedEntities,
|
|
818
|
+
idHeaderWidget,
|
|
819
|
+
liveSelectionQuery,
|
|
820
|
+
headerActionsScope,
|
|
821
|
+
addColumnComponentInternal,
|
|
822
|
+
onColumnsOrderChange: stableFields ? void 0 : onColumnsOrderChange,
|
|
823
|
+
viewCollection,
|
|
824
|
+
entityActionsScope,
|
|
825
|
+
title,
|
|
826
|
+
viewModePopoverOpen,
|
|
827
|
+
setViewModePopoverOpen,
|
|
828
|
+
pluginErrorView,
|
|
829
|
+
emptyComponent,
|
|
830
|
+
ResolvedCollectionActions,
|
|
831
|
+
ResolvedCollectionTable
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
function buildPropertyWidthOverwrite(key, width) {
|
|
835
|
+
if (key.includes(".")) {
|
|
836
|
+
const [parentKey, ...childKey] = key.split(".");
|
|
837
|
+
return { properties: { [parentKey]: buildPropertyWidthOverwrite(childKey.join("."), width) } };
|
|
838
|
+
}
|
|
839
|
+
return { properties: { [key]: { admin: { columnWidth: width } } } };
|
|
840
|
+
}
|
|
841
|
+
//#endregion
|
|
842
|
+
export { useCollectionViewState };
|
|
843
|
+
|
|
844
|
+
//# sourceMappingURL=useCollectionViewState.js.map
|