@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,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CollectionViewState } from "./useCollectionViewState.js";
|
|
3
|
+
/**
|
|
4
|
+
* The state of the collection view a part is drawn in, for the parts that
|
|
5
|
+
* are placed rather than wired: the toolbar and its pieces, and the actions on
|
|
6
|
+
* a card. They read it here so a caller can put them anywhere in the view
|
|
7
|
+
* without passing the view's controllers along.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CollectionViewScopeContext: React.Context<CollectionViewState | null>;
|
|
10
|
+
/**
|
|
11
|
+
* The enclosing collection view's state. Throws outside one, naming the part:
|
|
12
|
+
* a toolbar piece placed anywhere else has nothing to search, filter or add to.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useCollectionViewScope(part: string): CollectionViewState;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
//#region src/components/CollectionViewBinding/CollectionViewScope.tsx
|
|
3
|
+
/**
|
|
4
|
+
* The state of the collection view a part is drawn in, for the parts that
|
|
5
|
+
* are placed rather than wired: the toolbar and its pieces, and the actions on
|
|
6
|
+
* a card. They read it here so a caller can put them anywhere in the view
|
|
7
|
+
* without passing the view's controllers along.
|
|
8
|
+
*/
|
|
9
|
+
var CollectionViewScopeContext = React.createContext(null);
|
|
10
|
+
/**
|
|
11
|
+
* The enclosing collection view's state. Throws outside one, naming the part:
|
|
12
|
+
* a toolbar piece placed anywhere else has nothing to search, filter or add to.
|
|
13
|
+
*/
|
|
14
|
+
function useCollectionViewScope(part) {
|
|
15
|
+
const scope = useContext(CollectionViewScopeContext);
|
|
16
|
+
if (!scope) throw new Error(`${part} must be drawn inside a collection view — in the \`toolbar\` of a CollectionPanel, say.`);
|
|
17
|
+
return scope;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { CollectionViewScopeContext, useCollectionViewScope };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=CollectionViewScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionViewScope.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewScope.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport type { CollectionViewState } from \"./useCollectionViewState\";\n\n/**\n * The state of the collection view a part is drawn in, for the parts that\n * are placed rather than wired: the toolbar and its pieces, and the actions on\n * a card. They read it here so a caller can put them anywhere in the view\n * without passing the view's controllers along.\n */\nexport const CollectionViewScopeContext = React.createContext<CollectionViewState | null>(null);\n\n/**\n * The enclosing collection view's state. Throws outside one, naming the part:\n * a toolbar piece placed anywhere else has nothing to search, filter or add to.\n */\nexport function useCollectionViewScope(part: string): CollectionViewState {\n const scope = useContext(CollectionViewScopeContext);\n if (!scope) {\n throw new Error(`${part} must be drawn inside a collection view — in the \\`toolbar\\` of a CollectionPanel, say.`);\n }\n return scope;\n}\n"],"mappings":";;;;;;;;AASA,IAAa,6BAA6B,MAAM,cAA0C,IAAI;;;;;AAM9F,SAAgB,uBAAuB,MAAmC;CACtE,MAAM,QAAQ,WAAW,0BAA0B;CACnD,IAAI,CAAC,OACD,MAAM,IAAI,MAAM,GAAG,KAAK,wFAAwF;CAEpH,OAAO;AACX"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Properties } from "@rebasepro/types";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { EntityTableController,
|
|
3
|
+
import { EntityTableController, EntitySelectionController, SelectionQuery, AdminCollection, ViewMode } from "@rebasepro/cms-types";
|
|
4
4
|
export type CollectionViewStartActionsProps<M extends Record<string, unknown>> = {
|
|
5
5
|
collection: AdminCollection<M>;
|
|
6
6
|
path: string;
|
|
7
7
|
relativePath: string;
|
|
8
8
|
parentCollectionSlugs: string[];
|
|
9
9
|
parentEntityIds: string[];
|
|
10
|
-
selectionController:
|
|
10
|
+
selectionController: EntitySelectionController<M>;
|
|
11
11
|
tableController: EntityTableController<M>;
|
|
12
12
|
collectionEntitiesCount?: number;
|
|
13
13
|
/**
|
|
@@ -2,39 +2,36 @@ import { useUrlController } from "../../hooks/navigation/contexts/UrlContext.js"
|
|
|
2
2
|
import { useAdminContext } from "../../hooks/useAdminContext.js";
|
|
3
3
|
import { useToolbarLabels } from "../CollectionTableBinding/internal/CollectionTableToolbar.js";
|
|
4
4
|
import { withListState } from "../../util/view_mode.js";
|
|
5
|
-
import { SelectionMenu } from "../../selection/SelectionMenu.js";
|
|
6
5
|
import { useSplitView } from "./SplitViewContext.js";
|
|
6
|
+
import { SelectionMenu } from "../../selection/SelectionMenu.js";
|
|
7
|
+
import { FiltersButton } from "./FiltersButton.js";
|
|
7
8
|
import { ClearFilterSortButton } from "../ClearFilterSortButton.js";
|
|
8
|
-
import { FiltersDialog } from "./FiltersDialog.js";
|
|
9
9
|
import { FilterPresetsButton } from "./FilterPresetsButton.js";
|
|
10
10
|
import { SortButton } from "./SortButton.js";
|
|
11
|
-
import { useCallback
|
|
11
|
+
import { useCallback } from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { IconButton, Skeleton, Tooltip, XIcon, iconSize } from "@rebasepro/ui";
|
|
14
|
+
import { selectionControllerOf, tableControllerOf, useSlot, useTranslation } from "@rebasepro/app";
|
|
15
15
|
import { useNavigate } from "react-router";
|
|
16
16
|
//#region src/components/CollectionViewBinding/CollectionViewStartActions.tsx
|
|
17
17
|
function CollectionViewStartActions({ collection, relativePath, parentCollectionSlugs, parentEntityIds, path, selectionController, tableController, collectionEntitiesCount, entitiesCount, resolvedProperties, viewMode, selectionEnabled, selectionQuery, compact, openNewDocument }) {
|
|
18
18
|
const context = useAdminContext();
|
|
19
|
-
const largeLayout = useLargeLayout();
|
|
20
19
|
const toolbarLabels = useToolbarLabels();
|
|
21
20
|
const { t } = useTranslation();
|
|
22
21
|
const navigate = useNavigate();
|
|
23
22
|
const urlController = useUrlController();
|
|
24
23
|
const splitView = useSplitView();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const fixedFilter = collection.fixedFilter;
|
|
28
|
-
const activeFilterCount = filterValues ? Object.keys(filterValues).filter((key) => !fixedFilter || !(key in fixedFilter)).length : 0;
|
|
24
|
+
const rowSelectionController = selectionControllerOf(selectionController, collection, path);
|
|
25
|
+
const rowTableController = tableControllerOf(tableController, collection);
|
|
29
26
|
const actionProps = {
|
|
30
27
|
path,
|
|
31
28
|
relativePath,
|
|
32
29
|
parentCollectionSlugs,
|
|
33
30
|
parentEntityIds,
|
|
34
31
|
collection,
|
|
35
|
-
selectionController,
|
|
32
|
+
selectionController: rowSelectionController,
|
|
36
33
|
context,
|
|
37
|
-
tableController,
|
|
34
|
+
tableController: rowTableController,
|
|
38
35
|
collectionEntitiesCount,
|
|
39
36
|
openNewDocument
|
|
40
37
|
};
|
|
@@ -55,27 +52,12 @@ function CollectionViewStartActions({ collection, relativePath, parentCollection
|
|
|
55
52
|
children: /* @__PURE__ */ jsx(XIcon, { size: iconSize.smallest })
|
|
56
53
|
})
|
|
57
54
|
}, "close_tooltip");
|
|
58
|
-
const iconOnlyToolbar =
|
|
59
|
-
const filtersButton = resolvedProperties &&
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
children: !iconOnlyToolbar ? /* @__PURE__ */ jsx(Button, {
|
|
65
|
-
variant: "text",
|
|
66
|
-
size: "small",
|
|
67
|
-
onClick: () => setFiltersDialogOpen(true),
|
|
68
|
-
startIcon: /* @__PURE__ */ jsx(FilterIcon, { size: iconSize.small }),
|
|
69
|
-
className: cls(activeFilterCount > 0 && "text-primary"),
|
|
70
|
-
children: activeFilterCount > 0 ? `(${activeFilterCount})` : t("filters")
|
|
71
|
-
}) : /* @__PURE__ */ jsx(IconButton, {
|
|
72
|
-
"aria-label": t("filters"),
|
|
73
|
-
size: "small",
|
|
74
|
-
onClick: () => setFiltersDialogOpen(true),
|
|
75
|
-
className: cls(activeFilterCount > 0 && "text-primary"),
|
|
76
|
-
children: /* @__PURE__ */ jsx(FilterIcon, { size: iconSize.smallest })
|
|
77
|
-
})
|
|
78
|
-
})
|
|
55
|
+
const iconOnlyToolbar = Boolean(compact) || !toolbarLabels;
|
|
56
|
+
const filtersButton = resolvedProperties && /* @__PURE__ */ jsx(FiltersButton, {
|
|
57
|
+
tableController,
|
|
58
|
+
properties: resolvedProperties,
|
|
59
|
+
fixedFilter: collection.fixedFilter,
|
|
60
|
+
iconOnly: iconOnlyToolbar
|
|
79
61
|
}, "filters_tooltip");
|
|
80
62
|
const sortButton = resolvedProperties && viewMode !== "kanban" && /* @__PURE__ */ jsx(SortButton, {
|
|
81
63
|
tableController,
|
|
@@ -94,40 +76,30 @@ function CollectionViewStartActions({ collection, relativePath, parentCollection
|
|
|
94
76
|
children: entitiesCount.toLocaleString()
|
|
95
77
|
})
|
|
96
78
|
}, "entities_count") : null;
|
|
97
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
useSlot("collection.actions.start", actionProps),
|
|
122
|
-
resolvedProperties && tableController.setFilterValues && /* @__PURE__ */ jsx(FiltersDialog, {
|
|
123
|
-
open: filtersDialogOpen,
|
|
124
|
-
onOpenChange: setFiltersDialogOpen,
|
|
125
|
-
properties: resolvedProperties,
|
|
126
|
-
filterValues: tableController.filterValues,
|
|
127
|
-
setFilterValues: (filterValues) => tableController.setFilterValues?.(filterValues ?? {}),
|
|
128
|
-
fixedFilter: collection.fixedFilter
|
|
129
|
-
})
|
|
130
|
-
] });
|
|
79
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [[
|
|
80
|
+
backButton,
|
|
81
|
+
selectionEnabled && selectionQuery ? /* @__PURE__ */ jsx("div", {
|
|
82
|
+
className: "mr-1 flex items-center",
|
|
83
|
+
children: /* @__PURE__ */ jsx(SelectionMenu, {
|
|
84
|
+
selectionController: rowSelectionController,
|
|
85
|
+
loadedRows: rowTableController.rows,
|
|
86
|
+
collection,
|
|
87
|
+
query: selectionQuery,
|
|
88
|
+
collectionEntitiesCount,
|
|
89
|
+
collectionName: collection.name
|
|
90
|
+
})
|
|
91
|
+
}, "select_all") : null,
|
|
92
|
+
filtersButton,
|
|
93
|
+
sortButton,
|
|
94
|
+
/* @__PURE__ */ jsx(ClearFilterSortButton, {
|
|
95
|
+
tableController,
|
|
96
|
+
compact: iconOnlyToolbar,
|
|
97
|
+
fixedFilter: collection.fixedFilter,
|
|
98
|
+
enabled: true
|
|
99
|
+
}, "clear_filter"),
|
|
100
|
+
filterPresetsButton,
|
|
101
|
+
countBadge
|
|
102
|
+
], useSlot("collection.actions.start", actionProps)] });
|
|
131
103
|
}
|
|
132
104
|
//#endregion
|
|
133
105
|
export { CollectionViewStartActions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionViewStartActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewStartActions.tsx"],"sourcesContent":["import type { Properties } from \"@rebasepro/types\";\n\nimport React, { useState, useCallback } from \"react\";\nimport { useAuthController, useLargeLayout, useTranslation, useSlot } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, SelectionController, SelectionQuery, AdminCollection, ViewMode } from \"@rebasepro/cms-types\";\nimport { ErrorBoundary, iconSize } from \"@rebasepro/ui\";\nimport { Badge, Button, cls, FilterIcon, IconButton, Skeleton, Tooltip, XIcon } from \"@rebasepro/ui\";\nimport { ClearFilterSortButton } from \"../ClearFilterSortButton\";\nimport { FiltersDialog } from \"./FiltersDialog\";\nimport { FilterPresetsButton } from \"./FilterPresetsButton\";\nimport { SortButton } from \"./SortButton\";\nimport { toArray } from \"@rebasepro/utils\";\nimport { useNavigate } from \"react-router\";\nimport { useUrlController } from \"../../hooks/navigation/contexts/UrlContext\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { withListState } from \"../../util/view_mode\";\nimport { useSplitView } from \"./SplitViewContext\";\nimport { SelectionMenu } from \"../../selection\";\nimport { useToolbarLabels } from \"../CollectionTableBinding/internal/CollectionTableToolbar\";\n\nexport type CollectionViewStartActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionController: SelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n /**\n * Number of records the current filters and search resolve to, rendered at\n * the end of this group.\n * - `undefined`: not applicable\n * - `null`: still counting\n * - number: the count\n */\n entitiesCount?: number | null;\n /**\n * Resolved properties from the collection for the filters dialog\n */\n resolvedProperties?: Properties;\n /**\n * Which view is being displayed. Decides whether the sort control is\n * offered — see `sortButton`.\n */\n viewMode?: ViewMode;\n /** Whether rows can be selected at all in this mount. */\n selectionEnabled?: boolean;\n /** The view's live query — what the menu's \"all matching\" item stands for. */\n selectionQuery?: SelectionQuery<M>;\n compact?: boolean;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewStartActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n entitiesCount,\n resolvedProperties,\n viewMode,\n selectionEnabled,\n selectionQuery,\n compact,\n openNewDocument\n}: CollectionViewStartActionsProps<M>) {\n\n const context = useAdminContext();\n const largeLayout = useLargeLayout();\n const toolbarLabels = useToolbarLabels();\n const { t } = useTranslation();\n\n const navigate = useNavigate();\n const urlController = useUrlController();\n const splitView = useSplitView();\n\n // Filters dialog state\n const [filtersDialogOpen, setFiltersDialogOpen] = useState(false);\n\n // Count active filters (excluding force filters)\n const filterValues = tableController.filterValues;\n const fixedFilter = collection.fixedFilter;\n const activeFilterCount = filterValues\n ? Object.keys(filterValues).filter(key => !fixedFilter || !(key in fixedFilter)).length\n : 0;\n\n const actionProps: CollectionActionsProps<M> = {\n path,\n relativePath,\n parentCollectionSlugs,\nparentEntityIds,\n collection,\n selectionController,\n context,\n tableController,\n collectionEntitiesCount,\n openNewDocument\n };\n\n const handleBackClick = useCallback(() => {\n navigate(withListState(urlController.buildUrlCollectionPath(path)));\n }, [navigate, urlController, path]);\n\n // In a split view the control that closes the list lives at the leading\n // edge of the record's app bar (`SplitListCloseButton`), not here.\n //\n // Outside one — a compact list with no record open beside it — the only\n // thing this can mean is \"leave the record behind\".\n const backButton = compact && !splitView?.detailOpen && (\n <Tooltip title={t(\"close\")} key={\"close_tooltip\"}>\n <IconButton\n size=\"small\"\n onClick={handleBackClick}\n aria-label={t(\"close\")}\n className=\"mr-1\"\n >\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n );\n\n // Whether the toolbar is showing icon-only controls. The filters button\n // drops its label — and its icon a size with it — on a narrow layout as\n // well as in the split view, and the sort and clear controls beside it\n // follow: keyed on `compact` alone they stayed 20px next to a 16px filter\n // icon at every width below `largeLayout`. A toolbar too narrow for its\n // labels (`useToolbarLabels`) is a narrow layout too, whatever the window.\n const iconOnlyToolbar = !largeLayout || Boolean(compact) || !toolbarLabels;\n\n const filtersButton = resolvedProperties && tableController.setFilterValues && (\n <Tooltip title={t(\"filters\")}\n key={\"filters_tooltip\"}>\n <Badge\n color=\"primary\"\n invisible={activeFilterCount === 0}\n >\n {!iconOnlyToolbar ? (\n <Button\n variant=\"text\"\n size=\"small\"\n onClick={() => setFiltersDialogOpen(true)}\n startIcon={<FilterIcon size={iconSize.small}/>}\n className={cls(activeFilterCount > 0 && \"text-primary\")}\n >\n {activeFilterCount > 0 ? `(${activeFilterCount})` : t(\"filters\")}\n </Button>\n ) : (\n <IconButton aria-label={t(\"filters\")}\n size={\"small\"}\n onClick={() => setFiltersDialogOpen(true)}\n className={cls(activeFilterCount > 0 && \"text-primary\")}\n >\n <FilterIcon size={iconSize.smallest}/>\n </IconButton>\n )}\n </Badge>\n </Tooltip>\n );\n\n // Everywhere a `sortBy` means something — which is every view but the\n // board, whose columns are ordered by their own order key and which ignores\n // `sortBy` entirely, so the control would appear to do nothing.\n //\n // Including the table, whose headers were once thought to cover it. They\n // build a multi-key sort (shift-click) and they show its ranks, but they\n // cannot *re-rank* it: promoting the third key above the first means\n // clearing the sort and shift-clicking all three back in the new order.\n // Nor can they remove a middle key without cycling it through descending\n // first. This popover is the only place either is one click, and a table\n // with a three-key sort needs it more than a card grid does, not less.\n const sortButton = resolvedProperties && viewMode !== \"kanban\" && (\n <SortButton\n key={\"sort_button\"}\n tableController={tableController}\n properties={resolvedProperties}\n compact={iconOnlyToolbar}\n />\n );\n\n // Not in the split view. The toolbar there is a strip a few hundred pixels\n // wide above the list, and a row of preset chips crowded out the controls\n // that act on what you are looking at. The presets are still one click away\n // inside the filters dialog.\n const filterPresetsButton = !compact && collection.filterPresets?.length ? (\n <FilterPresetsButton\n key={\"filter_presets\"}\n filterPresets={collection.filterPresets}\n tableController={tableController}\n compact={compact}\n />\n ) : null;\n\n // The count closes the group the filter, sort and preset controls open: it\n // is what they resolve to. It used to live in the breadcrumb trail, which\n // the app bar owns — and a collection rendered without an app bar has no\n // breadcrumbs, so the number simply disappeared.\n //\n // Hidden on the same layouts the trail was (`hidden lg:block` there) and in\n // the split view, where this toolbar is a few hundred pixels wide and\n // scrolls: a passive readout is the first thing that should give up its\n // room to the controls.\n const countBadge = !iconOnlyToolbar && entitiesCount !== undefined ? (\n <Tooltip title={t(\"records_in_view\")} key={\"entities_count\"}>\n {entitiesCount === null\n ? <Skeleton className={\"w-8 h-4 rounded-md mx-1\"}/>\n : <span\n className={\"mx-1 text-xs font-mono tabular-nums text-text-secondary dark:text-text-secondary-dark\"}>\n {entitiesCount.toLocaleString()}\n </span>}\n </Tooltip>\n ) : null;\n\n // One control, in one place, for every view — the leading edge of the\n // toolbar, which in a table sits directly above the checkbox column anyway.\n // The table used to carry its own in the ID column header, which meant two\n // controls that did different amounts.\n const selectionMenu = selectionEnabled && selectionQuery ? (\n <div key={\"select_all\"} className={\"mr-1 flex items-center\"}>\n <SelectionMenu\n selectionController={selectionController}\n loadedEntities={tableController.data}\n query={selectionQuery}\n collectionEntitiesCount={collectionEntitiesCount}\n collectionName={collection.name}/>\n </div>\n ) : null;\n\n const actions: React.ReactNode[] = [\n backButton,\n selectionMenu,\n filtersButton,\n sortButton,\n <ClearFilterSortButton\n key={\"clear_filter\"}\n tableController={tableController}\n compact={iconOnlyToolbar}\n fixedFilter={collection.fixedFilter}\n enabled={true}/>,\n filterPresetsButton,\n countBadge\n ];\n\n const pluginActionsStart = useSlot(\"collection.actions.start\", actionProps);\n\n return (\n <>\n {actions}\n {pluginActionsStart}\n\n {/* Filters Dialog */}\n {resolvedProperties && tableController.setFilterValues && (\n <FiltersDialog\n open={filtersDialogOpen}\n onOpenChange={setFiltersDialogOpen}\n properties={resolvedProperties}\n filterValues={tableController.filterValues}\n setFilterValues={(filterValues) => tableController.setFilterValues?.(filterValues ?? {})}\n fixedFilter={collection.fixedFilter}\n />\n )}\n </>\n );\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;AAqDA,SAAgB,2BAA8D,EAC1E,YACA,cACA,uBAAuB,iBACvB,MACA,qBACA,iBACA,yBACA,eACA,oBACA,UACA,kBACA,gBACA,SACA,mBACmC;CAEnC,MAAM,UAAU,gBAAgB;CAChC,MAAM,cAAc,eAAe;CACnC,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,WAAW,YAAY;CAC7B,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,YAAY,aAAa;CAG/B,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,KAAK;CAGhE,MAAM,eAAe,gBAAgB;CACrC,MAAM,cAAc,WAAW;CAC/B,MAAM,oBAAoB,eACpB,OAAO,KAAK,YAAY,CAAC,CAAC,QAAO,QAAO,CAAC,eAAe,EAAE,OAAO,YAAY,CAAC,CAAC,SAC/E;CAEN,MAAM,cAAyC;EAC3C;EACA;EACA;EACR;EACQ;EACA;EACA;EACA;EACA;EACA;CACJ;CAEA,MAAM,kBAAkB,kBAAkB;EACtC,SAAS,cAAc,cAAc,uBAAuB,IAAI,CAAC,CAAC;CACtE,GAAG;EAAC;EAAU;EAAe;CAAI,CAAC;CAOlC,MAAM,aAAa,WAAW,CAAC,WAAW,cACtC,oBAAC,SAAD;EAAS,OAAO,EAAE,OAAO;YACrB,oBAAC,YAAD;GACI,MAAK;GACL,SAAS;GACT,cAAY,EAAE,OAAO;GACrB,WAAU;aAEV,oBAAC,OAAD,EAAO,MAAM,SAAS,SAAU,CAAA;EACxB,CAAA;CACP,GATwB,eASxB;CASb,MAAM,kBAAkB,CAAC,eAAe,QAAQ,OAAO,KAAK,CAAC;CAE7D,MAAM,gBAAgB,sBAAsB,gBAAgB,mBACxD,oBAAC,SAAD;EAAS,OAAO,EAAE,SAAS;YAEvB,oBAAC,OAAD;GACI,OAAM;GACN,WAAW,sBAAsB;aAEhC,CAAC,kBACE,oBAAC,QAAD;IACI,SAAQ;IACR,MAAK;IACL,eAAe,qBAAqB,IAAI;IACxC,WAAW,oBAAC,YAAD,EAAY,MAAM,SAAS,MAAO,CAAA;IAC7C,WAAW,IAAI,oBAAoB,KAAK,cAAc;cAErD,oBAAoB,IAAI,IAAI,kBAAkB,KAAK,EAAE,SAAS;GAC3D,CAAA,IAER,oBAAC,YAAD;IAAY,cAAY,EAAE,SAAS;IAC/B,MAAM;IACN,eAAe,qBAAqB,IAAI;IACxC,WAAW,IAAI,oBAAoB,KAAK,cAAc;cAEtD,oBAAC,YAAD,EAAY,MAAM,SAAS,SAAU,CAAA;GAC7B,CAAA;EAEb,CAAA;CACF,GAzBA,iBAyBA;CAcb,MAAM,aAAa,sBAAsB,aAAa,YAClD,oBAAC,YAAD;EAEqB;EACjB,YAAY;EACZ,SAAS;CACZ,GAJQ,aAIR;CAOL,MAAM,sBAAsB,CAAC,WAAW,WAAW,eAAe,SAC9D,oBAAC,qBAAD;EAEI,eAAe,WAAW;EACT;EACR;CACZ,GAJQ,gBAIR,IACD;CAWJ,MAAM,aAAa,CAAC,mBAAmB,kBAAkB,KAAA,IACrD,oBAAC,SAAD;EAAS,OAAO,EAAE,iBAAiB;YAC9B,kBAAkB,OACb,oBAAC,UAAD,EAAU,WAAW,0BAA2B,CAAA,IAChD,oBAAC,QAAD;GACE,WAAW;aACV,cAAc,eAAe;EAC5B,CAAA;CACL,GAPkC,gBAOlC,IACT;CAkCJ,OACI,qBAAA,UAAA,EAAA,UAAA;EACK;GAlBL;GAZkB,oBAAoB,iBACtC,oBAAC,OAAD;IAAwB,WAAW;cAC/B,oBAAC,eAAD;KACyB;KACrB,gBAAgB,gBAAgB;KAChC,OAAO;KACkB;KACzB,gBAAgB,WAAW;IAAM,CAAA;GACpC,GAPK,YAOL,IACL;GAKA;GACA;GACA,oBAAC,uBAAD;IAEqB;IACjB,SAAS;IACT,aAAa,WAAW;IACxB,SAAS;GAAM,GAJV,cAIU;GACnB;GACA;EAOK;EAJkB,QAAQ,4BAA4B,WAKtD;EAGA,sBAAsB,gBAAgB,mBACnC,oBAAC,eAAD;GACI,MAAM;GACN,cAAc;GACd,YAAY;GACZ,cAAc,gBAAgB;GAC9B,kBAAkB,iBAAiB,gBAAgB,kBAAkB,gBAAgB,CAAC,CAAC;GACvF,aAAa,WAAW;EAC3B,CAAA;CAEP,EAAA,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"CollectionViewStartActions.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CollectionViewStartActions.tsx"],"sourcesContent":["import type { Properties } from \"@rebasepro/types\";\n\nimport React, { useCallback } from \"react\";\nimport { useAuthController, useTranslation, useSlot } from \"@rebasepro/app\";\nimport { CollectionActionsProps, EntityTableController, EntitySelectionController, SelectionQuery, AdminCollection, ViewMode } from \"@rebasepro/cms-types\";\nimport { ErrorBoundary, iconSize } from \"@rebasepro/ui\";\nimport { IconButton, Skeleton, Tooltip, XIcon } from \"@rebasepro/ui\";\nimport { ClearFilterSortButton } from \"../ClearFilterSortButton\";\nimport { FiltersButton } from \"./FiltersButton\";\nimport { FilterPresetsButton } from \"./FilterPresetsButton\";\nimport { SortButton } from \"./SortButton\";\nimport { toArray } from \"@rebasepro/utils\";\nimport { useNavigate } from \"react-router\";\nimport { useUrlController } from \"../../hooks/navigation/contexts/UrlContext\";\nimport { useAdminContext } from \"../../hooks/useAdminContext\";\nimport { withListState } from \"../../util/view_mode\";\nimport { useSplitView } from \"./SplitViewContext\";\nimport { SelectionMenu } from \"../../selection\";\nimport { selectionControllerOf, tableControllerOf } from \"@rebasepro/app\";\nimport { useToolbarLabels } from \"../CollectionTableBinding/internal/CollectionTableToolbar\";\n\nexport type CollectionViewStartActionsProps<M extends Record<string, unknown>> = {\n collection: AdminCollection<M>;\n path: string;\n relativePath: string;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n selectionController: EntitySelectionController<M>;\n tableController: EntityTableController<M>;\n collectionEntitiesCount?: number;\n /**\n * Number of records the current filters and search resolve to, rendered at\n * the end of this group.\n * - `undefined`: not applicable\n * - `null`: still counting\n * - number: the count\n */\n entitiesCount?: number | null;\n /**\n * Resolved properties from the collection for the filters dialog\n */\n resolvedProperties?: Properties;\n /**\n * Which view is being displayed. Decides whether the sort control is\n * offered — see `sortButton`.\n */\n viewMode?: ViewMode;\n /** Whether rows can be selected at all in this mount. */\n selectionEnabled?: boolean;\n /** The view's live query — what the menu's \"all matching\" item stands for. */\n selectionQuery?: SelectionQuery<M>;\n compact?: boolean;\n openNewDocument: (defaultValues?: Record<string, unknown>) => void;\n}\n\nexport function CollectionViewStartActions<M extends Record<string, unknown>>({\n collection,\n relativePath,\n parentCollectionSlugs, parentEntityIds,\n path,\n selectionController,\n tableController,\n collectionEntitiesCount,\n entitiesCount,\n resolvedProperties,\n viewMode,\n selectionEnabled,\n selectionQuery,\n compact,\n openNewDocument\n}: CollectionViewStartActionsProps<M>) {\n\n const context = useAdminContext();\n const toolbarLabels = useToolbarLabels();\n const { t } = useTranslation();\n\n const navigate = useNavigate();\n const urlController = useUrlController();\n const splitView = useSplitView();\n\n // What an app's actions are handed: the rows, not the admin's records.\n const rowSelectionController = selectionControllerOf(selectionController, collection, path);\n const rowTableController = tableControllerOf(tableController, collection);\n const actionProps: CollectionActionsProps<M> = {\n path,\n relativePath,\n parentCollectionSlugs,\n parentEntityIds,\n collection,\n selectionController: rowSelectionController,\n context,\n tableController: rowTableController,\n collectionEntitiesCount,\n openNewDocument\n };\n\n const handleBackClick = useCallback(() => {\n navigate(withListState(urlController.buildUrlCollectionPath(path)));\n }, [navigate, urlController, path]);\n\n // In a split view the control that closes the list lives at the leading\n // edge of the record's app bar (`SplitListCloseButton`), not here.\n //\n // Outside one — a compact list with no record open beside it — the only\n // thing this can mean is \"leave the record behind\".\n const backButton = compact && !splitView?.detailOpen && (\n <Tooltip title={t(\"close\")} key={\"close_tooltip\"}>\n <IconButton\n size=\"small\"\n onClick={handleBackClick}\n aria-label={t(\"close\")}\n className=\"mr-1\"\n >\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n );\n\n // Whether the toolbar is showing icon-only controls. The filters button\n // drops its label — and its icon a size with it — on a narrow layout as\n // well as in the split view, and the sort and clear controls beside it\n // follow: keyed on `compact` alone they stayed 20px next to a 16px filter\n // icon at every width below `largeLayout`. A toolbar too narrow for its\n // labels (`useToolbarLabels`) is a narrow layout too, whatever the window.\n const iconOnlyToolbar = Boolean(compact) || !toolbarLabels;\n\n const filtersButton = resolvedProperties && (\n <FiltersButton\n key={\"filters_tooltip\"}\n tableController={tableController}\n properties={resolvedProperties}\n fixedFilter={collection.fixedFilter}\n iconOnly={iconOnlyToolbar}/>\n );\n\n // Everywhere a `sortBy` means something — which is every view but the\n // board, whose columns are ordered by their own order key and which ignores\n // `sortBy` entirely, so the control would appear to do nothing.\n //\n // Including the table, whose headers were once thought to cover it. They\n // build a multi-key sort (shift-click) and they show its ranks, but they\n // cannot *re-rank* it: promoting the third key above the first means\n // clearing the sort and shift-clicking all three back in the new order.\n // Nor can they remove a middle key without cycling it through descending\n // first. This popover is the only place either is one click, and a table\n // with a three-key sort needs it more than a card grid does, not less.\n const sortButton = resolvedProperties && viewMode !== \"kanban\" && (\n <SortButton\n key={\"sort_button\"}\n tableController={tableController}\n properties={resolvedProperties}\n compact={iconOnlyToolbar}\n />\n );\n\n // Not in the split view. The toolbar there is a strip a few hundred pixels\n // wide above the list, and a row of preset chips crowded out the controls\n // that act on what you are looking at. The presets are still one click away\n // inside the filters dialog.\n const filterPresetsButton = !compact && collection.filterPresets?.length ? (\n <FilterPresetsButton\n key={\"filter_presets\"}\n filterPresets={collection.filterPresets}\n tableController={tableController}\n compact={compact}\n />\n ) : null;\n\n // The count closes the group the filter, sort and preset controls open: it\n // is what they resolve to. It used to live in the breadcrumb trail, which\n // the app bar owns — and a collection rendered without an app bar has no\n // breadcrumbs, so the number simply disappeared.\n //\n // Hidden on the same layouts the trail was (`hidden lg:block` there) and in\n // the split view, where this toolbar is a few hundred pixels wide and\n // scrolls: a passive readout is the first thing that should give up its\n // room to the controls.\n const countBadge = !iconOnlyToolbar && entitiesCount !== undefined ? (\n <Tooltip title={t(\"records_in_view\")} key={\"entities_count\"}>\n {entitiesCount === null\n ? <Skeleton className={\"w-8 h-4 rounded-md mx-1\"}/>\n : <span\n className={\"mx-1 text-xs font-mono tabular-nums text-text-secondary dark:text-text-secondary-dark\"}>\n {entitiesCount.toLocaleString()}\n </span>}\n </Tooltip>\n ) : null;\n\n // One control, in one place, for every view — the leading edge of the\n // toolbar, which in a table sits directly above the checkbox column anyway.\n // The table used to carry its own in the ID column header, which meant two\n // controls that did different amounts.\n const selectionMenu = selectionEnabled && selectionQuery ? (\n <div key={\"select_all\"} className={\"mr-1 flex items-center\"}>\n <SelectionMenu\n selectionController={rowSelectionController}\n loadedRows={rowTableController.rows}\n collection={collection}\n query={selectionQuery}\n collectionEntitiesCount={collectionEntitiesCount}\n collectionName={collection.name}/>\n </div>\n ) : null;\n\n const actions: React.ReactNode[] = [\n backButton,\n selectionMenu,\n filtersButton,\n sortButton,\n <ClearFilterSortButton\n key={\"clear_filter\"}\n tableController={tableController}\n compact={iconOnlyToolbar}\n fixedFilter={collection.fixedFilter}\n enabled={true}/>,\n filterPresetsButton,\n countBadge\n ];\n\n const pluginActionsStart = useSlot(\"collection.actions.start\", actionProps);\n\n return (\n <>\n {actions}\n {pluginActionsStart}\n </>\n );\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,SAAgB,2BAA8D,EAC1E,YACA,cACA,uBAAuB,iBACvB,MACA,qBACA,iBACA,yBACA,eACA,oBACA,UACA,kBACA,gBACA,SACA,mBACmC;CAEnC,MAAM,UAAU,gBAAgB;CAChC,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,WAAW,YAAY;CAC7B,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,YAAY,aAAa;CAG/B,MAAM,yBAAyB,sBAAsB,qBAAqB,YAAY,IAAI;CAC1F,MAAM,qBAAqB,kBAAkB,iBAAiB,UAAU;CACxE,MAAM,cAAyC;EAC3C;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA,iBAAiB;EACjB;EACA;CACJ;CAEA,MAAM,kBAAkB,kBAAkB;EACtC,SAAS,cAAc,cAAc,uBAAuB,IAAI,CAAC,CAAC;CACtE,GAAG;EAAC;EAAU;EAAe;CAAI,CAAC;CAOlC,MAAM,aAAa,WAAW,CAAC,WAAW,cACtC,oBAAC,SAAD;EAAS,OAAO,EAAE,OAAO;YACrB,oBAAC,YAAD;GACI,MAAK;GACL,SAAS;GACT,cAAY,EAAE,OAAO;GACrB,WAAU;aAEV,oBAAC,OAAD,EAAO,MAAM,SAAS,SAAU,CAAA;EACxB,CAAA;CACP,GATwB,eASxB;CASb,MAAM,kBAAkB,QAAQ,OAAO,KAAK,CAAC;CAE7C,MAAM,gBAAgB,sBAClB,oBAAC,eAAD;EAEqB;EACjB,YAAY;EACZ,aAAa,WAAW;EACxB,UAAU;CAAiB,GAJtB,iBAIsB;CAcnC,MAAM,aAAa,sBAAsB,aAAa,YAClD,oBAAC,YAAD;EAEqB;EACjB,YAAY;EACZ,SAAS;CACZ,GAJQ,aAIR;CAOL,MAAM,sBAAsB,CAAC,WAAW,WAAW,eAAe,SAC9D,oBAAC,qBAAD;EAEI,eAAe,WAAW;EACT;EACR;CACZ,GAJQ,gBAIR,IACD;CAWJ,MAAM,aAAa,CAAC,mBAAmB,kBAAkB,KAAA,IACrD,oBAAC,SAAD;EAAS,OAAO,EAAE,iBAAiB;YAC9B,kBAAkB,OACb,oBAAC,UAAD,EAAU,WAAW,0BAA2B,CAAA,IAChD,oBAAC,QAAD;GACE,WAAW;aACV,cAAc,eAAe;EAC5B,CAAA;CACL,GAPkC,gBAOlC,IACT;CAmCJ,OACI,qBAAA,UAAA,EAAA,UAAA,CACK;EAlBL;EAbkB,oBAAoB,iBACtC,oBAAC,OAAD;GAAwB,WAAW;aAC/B,oBAAC,eAAD;IACI,qBAAqB;IACrB,YAAY,mBAAmB;IACnB;IACZ,OAAO;IACkB;IACzB,gBAAgB,WAAW;GAAM,CAAA;EACpC,GARK,YAQL,IACL;EAKA;EACA;EACA,oBAAC,uBAAD;GAEqB;GACjB,SAAS;GACT,aAAa,WAAW;GACxB,SAAS;EAAM,GAJV,cAIU;EACnB;EACA;CAOK,GAJkB,QAAQ,4BAA4B,WAKtD,CACH,EAAA,CAAA;AAEV"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Entity } from "@rebasepro/types";
|
|
3
|
+
import type { AdminCollection, CollectionCustomViewParams, CollectionSize, EntitySelectionController, EntityTableController, ViewMode } from "@rebasepro/cms-types";
|
|
4
|
+
/** What the view holds, in its own view model, for a custom view to be drawn from. */
|
|
5
|
+
export interface CustomViewHostProps<M extends Record<string, unknown>> {
|
|
6
|
+
Builder: React.ComponentType<CollectionCustomViewParams<M>>;
|
|
7
|
+
collection: AdminCollection<M>;
|
|
8
|
+
tableController: EntityTableController<M>;
|
|
9
|
+
path: string;
|
|
10
|
+
parentCollectionSlugs?: string[];
|
|
11
|
+
parentEntityIds?: string[];
|
|
12
|
+
onEntityClick?: (entity: Entity<M>) => void;
|
|
13
|
+
onNewClick?: () => void;
|
|
14
|
+
canCreate?: boolean;
|
|
15
|
+
selectionController?: EntitySelectionController<M>;
|
|
16
|
+
selectionEnabled?: boolean;
|
|
17
|
+
highlightedEntities?: Entity<M>[];
|
|
18
|
+
deletedEntities?: Entity<M>[];
|
|
19
|
+
emptyComponent?: React.ReactNode;
|
|
20
|
+
size?: CollectionSize;
|
|
21
|
+
viewMode?: ViewMode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A custom view's `Builder`, handed what the view holds as an app's code
|
|
25
|
+
* reads it: the rows as the server sends them, ids for what is highlighted
|
|
26
|
+
* and deleted, and a click that takes a row.
|
|
27
|
+
*/
|
|
28
|
+
export declare function CustomViewHost<M extends Record<string, unknown>>({ Builder, collection, tableController, path, parentCollectionSlugs, parentEntityIds, onEntityClick, onNewClick, canCreate, selectionController, selectionEnabled, highlightedEntities, deletedEntities, emptyComponent, size, viewMode }: CustomViewHostProps<M>): React.JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { entityOfRow, idOfRow, selectionControllerOf, tableControllerOf } from "@rebasepro/app";
|
|
4
|
+
//#region src/components/CollectionViewBinding/CustomViewHost.tsx
|
|
5
|
+
var NO_IDS = [];
|
|
6
|
+
/**
|
|
7
|
+
* A custom view's `Builder`, handed what the view holds as an app's code
|
|
8
|
+
* reads it: the rows as the server sends them, ids for what is highlighted
|
|
9
|
+
* and deleted, and a click that takes a row.
|
|
10
|
+
*/
|
|
11
|
+
function CustomViewHost({ Builder, collection, tableController, path, parentCollectionSlugs, parentEntityIds, onEntityClick, onNewClick, canCreate, selectionController, selectionEnabled, highlightedEntities, deletedEntities, emptyComponent, size, viewMode }) {
|
|
12
|
+
const rowTableController = tableControllerOf(tableController, collection);
|
|
13
|
+
const rowSelectionController = selectionController ? selectionControllerOf(selectionController, collection, path) : void 0;
|
|
14
|
+
const highlightedIds = useMemo(() => highlightedEntities?.length ? highlightedEntities.map((entity) => String(entity.id)) : NO_IDS, [highlightedEntities]);
|
|
15
|
+
const deletedIds = useMemo(() => deletedEntities?.length ? deletedEntities.map((entity) => String(entity.id)) : NO_IDS, [deletedEntities]);
|
|
16
|
+
const latest = useRef({
|
|
17
|
+
onEntityClick,
|
|
18
|
+
collection,
|
|
19
|
+
path
|
|
20
|
+
});
|
|
21
|
+
latest.current = {
|
|
22
|
+
onEntityClick,
|
|
23
|
+
collection,
|
|
24
|
+
path
|
|
25
|
+
};
|
|
26
|
+
const hasClick = onEntityClick !== void 0;
|
|
27
|
+
const onRowClick = useCallback((row) => {
|
|
28
|
+
const { onEntityClick, collection, path } = latest.current;
|
|
29
|
+
const id = idOfRow(row, collection);
|
|
30
|
+
if (id === void 0) return;
|
|
31
|
+
onEntityClick?.(entityOfRow(row, id, path, collection));
|
|
32
|
+
}, []);
|
|
33
|
+
return /* @__PURE__ */ jsx(Builder, {
|
|
34
|
+
collection,
|
|
35
|
+
tableController: rowTableController,
|
|
36
|
+
path,
|
|
37
|
+
parentCollectionSlugs,
|
|
38
|
+
parentEntityIds,
|
|
39
|
+
onRowClick: hasClick ? onRowClick : void 0,
|
|
40
|
+
onNewClick,
|
|
41
|
+
canCreate,
|
|
42
|
+
selectionController: rowSelectionController,
|
|
43
|
+
selectionEnabled,
|
|
44
|
+
highlightedIds,
|
|
45
|
+
deletedIds,
|
|
46
|
+
emptyComponent,
|
|
47
|
+
size,
|
|
48
|
+
viewMode
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { CustomViewHost };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=CustomViewHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomViewHost.js","names":[],"sources":["../../../src/components/CollectionViewBinding/CustomViewHost.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useRef } from \"react\";\nimport type { Entity } from \"@rebasepro/types\";\nimport type {\n AdminCollection,\n CollectionCustomViewParams,\n CollectionSize,\n EntitySelectionController,\n EntityTableController,\n ViewMode\n} from \"@rebasepro/cms-types\";\nimport { entityOfRow, idOfRow, selectionControllerOf, tableControllerOf } from \"@rebasepro/app\";\n\nconst NO_IDS: string[] = [];\n\n/** What the view holds, in its own view model, for a custom view to be drawn from. */\nexport interface CustomViewHostProps<M extends Record<string, unknown>> {\n Builder: React.ComponentType<CollectionCustomViewParams<M>>;\n collection: AdminCollection<M>;\n tableController: EntityTableController<M>;\n path: string;\n parentCollectionSlugs?: string[];\n parentEntityIds?: string[];\n onEntityClick?: (entity: Entity<M>) => void;\n onNewClick?: () => void;\n canCreate?: boolean;\n selectionController?: EntitySelectionController<M>;\n selectionEnabled?: boolean;\n highlightedEntities?: Entity<M>[];\n deletedEntities?: Entity<M>[];\n emptyComponent?: React.ReactNode;\n size?: CollectionSize;\n viewMode?: ViewMode;\n}\n\n/**\n * A custom view's `Builder`, handed what the view holds as an app's code\n * reads it: the rows as the server sends them, ids for what is highlighted\n * and deleted, and a click that takes a row.\n */\nexport function CustomViewHost<M extends Record<string, unknown>>({\n Builder,\n collection,\n tableController,\n path,\n parentCollectionSlugs,\n parentEntityIds,\n onEntityClick,\n onNewClick,\n canCreate,\n selectionController,\n selectionEnabled,\n highlightedEntities,\n deletedEntities,\n emptyComponent,\n size,\n viewMode\n}: CustomViewHostProps<M>) {\n const rowTableController = tableControllerOf(tableController, collection);\n const rowSelectionController = selectionController\n ? selectionControllerOf(selectionController, collection, path)\n : undefined;\n const highlightedIds = useMemo(\n () => highlightedEntities?.length ? highlightedEntities.map((entity) => String(entity.id)) : NO_IDS,\n [highlightedEntities]);\n const deletedIds = useMemo(\n () => deletedEntities?.length ? deletedEntities.map((entity) => String(entity.id)) : NO_IDS,\n [deletedEntities]);\n\n // Through a ref, so the view is not redrawn when the handler is.\n const latest = useRef({ onEntityClick, collection, path });\n latest.current = { onEntityClick, collection, path };\n const hasClick = onEntityClick !== undefined;\n const onRowClick = useCallback((row: Record<string, unknown>) => {\n const { onEntityClick, collection, path } = latest.current;\n const id = idOfRow(row, collection);\n if (id === undefined) return;\n onEntityClick?.(entityOfRow(row, id, path, collection) as Entity<M>);\n }, []);\n\n return (\n <Builder\n collection={collection}\n tableController={rowTableController}\n path={path}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n onRowClick={hasClick ? onRowClick : undefined}\n onNewClick={onNewClick}\n canCreate={canCreate}\n selectionController={rowSelectionController}\n selectionEnabled={selectionEnabled}\n highlightedIds={highlightedIds}\n deletedIds={deletedIds}\n emptyComponent={emptyComponent}\n size={size}\n viewMode={viewMode}\n />\n );\n}\n"],"mappings":";;;;AAYA,IAAM,SAAmB,CAAC;;;;;;AA2B1B,SAAgB,eAAkD,EAC9D,SACA,YACA,iBACA,MACA,uBACA,iBACA,eACA,YACA,WACA,qBACA,kBACA,qBACA,iBACA,gBACA,MACA,YACuB;CACvB,MAAM,qBAAqB,kBAAkB,iBAAiB,UAAU;CACxE,MAAM,yBAAyB,sBACzB,sBAAsB,qBAAqB,YAAY,IAAI,IAC3D,KAAA;CACN,MAAM,iBAAiB,cACb,qBAAqB,SAAS,oBAAoB,KAAK,WAAW,OAAO,OAAO,EAAE,CAAC,IAAI,QAC7F,CAAC,mBAAmB,CAAC;CACzB,MAAM,aAAa,cACT,iBAAiB,SAAS,gBAAgB,KAAK,WAAW,OAAO,OAAO,EAAE,CAAC,IAAI,QACrF,CAAC,eAAe,CAAC;CAGrB,MAAM,SAAS,OAAO;EAAE;EAAe;EAAY;CAAK,CAAC;CACzD,OAAO,UAAU;EAAE;EAAe;EAAY;CAAK;CACnD,MAAM,WAAW,kBAAkB,KAAA;CACnC,MAAM,aAAa,aAAa,QAAiC;EAC7D,MAAM,EAAE,eAAe,YAAY,SAAS,OAAO;EACnD,MAAM,KAAK,QAAQ,KAAK,UAAU;EAClC,IAAI,OAAO,KAAA,GAAW;EACtB,gBAAgB,YAAY,KAAK,IAAI,MAAM,UAAU,CAAc;CACvE,GAAG,CAAC,CAAC;CAEL,OACI,oBAAC,SAAD;EACgB;EACZ,iBAAiB;EACX;EACiB;EACN;EACjB,YAAY,WAAW,aAAa,KAAA;EACxB;EACD;EACX,qBAAqB;EACH;EACF;EACJ;EACI;EACV;EACI;CACb,CAAA;AAET"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { OrderByTuple } from "@rebasepro/types";
|
|
2
|
+
import { FilterValues } from "@rebasepro/types";
|
|
3
|
+
import type { AdminCollection } from "@rebasepro/cms-types";
|
|
4
|
+
export declare function EntitiesCount({ path, collection, filter, sortBy, searchString, onCountChange, refreshKey }: {
|
|
5
|
+
path: string;
|
|
6
|
+
collection: AdminCollection;
|
|
7
|
+
filter?: FilterValues<any>;
|
|
8
|
+
sortBy?: OrderByTuple[];
|
|
9
|
+
/**
|
|
10
|
+
* Required, not optional. The term sits in the same scope as the element
|
|
11
|
+
* that mounts this and is passed to the toolbar and the empty state beside
|
|
12
|
+
* it — it was simply not passed here, so a searched list showed the count
|
|
13
|
+
* of the unsearched collection. A required prop is what stops the next
|
|
14
|
+
* caller doing the same; there is no useful "count without the search".
|
|
15
|
+
*/
|
|
16
|
+
searchString: string | undefined;
|
|
17
|
+
onCountChange?: (count: number | null | undefined) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Counts again whenever this changes. The count is one read, not a
|
|
20
|
+
* subscription: after a delete the toolbar kept the old total, and "select
|
|
21
|
+
* all matching" offered it over the rows that were left.
|
|
22
|
+
*/
|
|
23
|
+
refreshKey?: number;
|
|
24
|
+
}): null;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { serializeOrderBy } from "@rebasepro/common";
|
|
3
|
+
import { useData, useDataChangeVersion } from "@rebasepro/app";
|
|
4
|
+
//#region src/components/CollectionViewBinding/EntitiesCount.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Inflight count request deduplication map.
|
|
7
|
+
* Keyed by `path|filterKey|sort|search` so that concurrent
|
|
8
|
+
* callers (e.g. React StrictMode double-mount) share the same promise.
|
|
9
|
+
*/
|
|
10
|
+
var inflightCountRequests = /* @__PURE__ */ new Map();
|
|
11
|
+
function EntitiesCount({ path, collection, filter, sortBy, searchString, onCountChange, refreshKey }) {
|
|
12
|
+
const dataClient = useData();
|
|
13
|
+
const changeVersion = useDataChangeVersion(path, !dataClient.collection(path).listenCount);
|
|
14
|
+
const sortKey = React.useMemo(() => sortBy ? serializeOrderBy(sortBy) ?? "" : "", [sortBy]);
|
|
15
|
+
const dataClientRef = React.useRef(dataClient);
|
|
16
|
+
dataClientRef.current = dataClient;
|
|
17
|
+
const onCountChangeRef = React.useRef(onCountChange);
|
|
18
|
+
onCountChangeRef.current = onCountChange;
|
|
19
|
+
const filterKey = React.useMemo(() => filter ? JSON.stringify(filter) : "", [filter]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const accessor = dataClientRef.current.collection(path);
|
|
22
|
+
if (!accessor.count && !accessor.listenCount) {
|
|
23
|
+
onCountChangeRef.current?.(void 0);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
let cancelled = false;
|
|
27
|
+
const whereParams = filter && Object.keys(filter).length > 0 ? filter : void 0;
|
|
28
|
+
const orderByParams = sortBy && sortBy.length > 0 ? sortBy.map(([field, direction]) => [String(field), direction]) : void 0;
|
|
29
|
+
if (accessor.listenCount) return accessor.listenCount({
|
|
30
|
+
where: whereParams,
|
|
31
|
+
searchString
|
|
32
|
+
}, (total) => onCountChangeRef.current?.(total), (error) => {
|
|
33
|
+
console.warn("Error counting", error);
|
|
34
|
+
onCountChangeRef.current?.(void 0);
|
|
35
|
+
});
|
|
36
|
+
const cacheKey = `${path}|${filterKey}|${sortKey}|${searchString ?? ""}|${refreshKey ?? ""}|${changeVersion}`;
|
|
37
|
+
let countPromise = inflightCountRequests.get(cacheKey);
|
|
38
|
+
if (!countPromise) {
|
|
39
|
+
countPromise = accessor.count({
|
|
40
|
+
where: whereParams,
|
|
41
|
+
orderBy: orderByParams,
|
|
42
|
+
searchString
|
|
43
|
+
});
|
|
44
|
+
inflightCountRequests.set(cacheKey, countPromise);
|
|
45
|
+
countPromise.finally(() => inflightCountRequests.delete(cacheKey));
|
|
46
|
+
}
|
|
47
|
+
countPromise.then((c) => {
|
|
48
|
+
if (!cancelled) onCountChangeRef.current?.(c);
|
|
49
|
+
}).catch((e) => {
|
|
50
|
+
console.warn("Error fetching count", e);
|
|
51
|
+
if (!cancelled) onCountChangeRef.current?.(void 0);
|
|
52
|
+
});
|
|
53
|
+
return () => {
|
|
54
|
+
cancelled = true;
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
path,
|
|
58
|
+
filterKey,
|
|
59
|
+
sortKey,
|
|
60
|
+
searchString,
|
|
61
|
+
refreshKey,
|
|
62
|
+
changeVersion
|
|
63
|
+
]);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { EntitiesCount };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=EntitiesCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntitiesCount.js","names":[],"sources":["../../../src/components/CollectionViewBinding/EntitiesCount.tsx"],"sourcesContent":["import type { OrderByTuple } from \"@rebasepro/types\";\nimport { FilterValues } from \"@rebasepro/types\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport { serializeOrderBy } from \"@rebasepro/common\";\nimport React, { useEffect } from \"react\";\nimport { useData, useDataChangeVersion } from \"@rebasepro/app\";\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 // A count is one read where the source cannot count live: it is read\n // again on every write to the collection in this `<Rebase>`.\n const changeVersion = useDataChangeVersion(path, !dataClient.collection(path).listenCount);\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 ?? \"\"}|${changeVersion}`;\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 -- `filterKey` and `sortKey` are `filter` and `sortBy`, serialized\n }, [path, filterKey, sortKey, searchString, refreshKey, changeVersion]);\n\n // The toolbar renders the count; this component only fetches and reports it\n return null;\n}\n"],"mappings":";;;;;;;;;AAYA,IAAM,wCAAwB,IAAI,IAA6B;AAE/D,SAAgB,cAAc,EAC1B,MACA,YACA,QACA,QACA,cACA,eACA,cAqBD;CAEC,MAAM,aAAa,QAAQ;CAG3B,MAAM,gBAAgB,qBAAqB,MAAM,CAAC,WAAW,WAAW,IAAI,CAAC,CAAC,WAAW;CAIzF,MAAM,UAAU,MAAM,cAAc,SAAS,iBAAiB,MAAM,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC;CAG1F,MAAM,gBAAgB,MAAM,OAAO,UAAU;CAC7C,cAAc,UAAU;CACxB,MAAM,mBAAmB,MAAM,OAAO,aAAa;CACnD,iBAAiB,UAAU;CAG3B,MAAM,YAAY,MAAM,cAAc,SAAS,KAAK,UAAU,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;CAEpF,gBAAgB;EACZ,MAAM,WAAW,cAAc,QAAQ,WAAW,IAAI;EACtD,IAAI,CAAC,SAAS,SAAS,CAAC,SAAS,aAAa;GAC1C,iBAAiB,UAAU,KAAA,CAAS;GACpC;EACJ;EAEA,IAAI,YAAY;EAGhB,MAAM,cAAc,UAAU,OAAO,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,SAAS,KAAA;EACxE,MAAM,gBAAgB,UAAU,OAAO,SAAS,IAC1C,OAAO,KAAK,CAAC,OAAO,eAAe,CAAC,OAAO,KAAK,GAAG,SAAS,CAAiB,IAC7E,KAAA;EAKN,IAAI,SAAS,aACT,OAAO,SAAS,YACZ;GAAE,OAAO;GAAa;EAAa,IAClC,UAAU,iBAAiB,UAAU,KAAK,IAC1C,UAAU;GACP,QAAQ,KAAK,kBAAkB,KAAK;GACpC,iBAAiB,UAAU,KAAA,CAAS;EACxC,CACJ;EAUJ,MAAM,WAAW,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,gBAAgB,GAAG,GAAG,cAAc,GAAG,GAAG;EAC9F,IAAI,eAAe,sBAAsB,IAAI,QAAQ;EACrD,IAAI,CAAC,cAAc;GACf,eAAe,SAAS,MAAO;IAC3B,OAAO;IACP,SAAS;IACT;GACJ,CAAC;GACD,sBAAsB,IAAI,UAAU,YAAY;GAEhD,aAAa,cAAc,sBAAsB,OAAO,QAAQ,CAAC;EACrE;EAEA,aAAa,MAAM,MAAM;GACrB,IAAI,CAAC,WAAW,iBAAiB,UAAU,CAAC;EAChD,CAAC,CAAC,CAAC,OAAO,MAAM;GACZ,QAAQ,KAAK,wBAAwB,CAAC;GACtC,IAAI,CAAC,WAAW,iBAAiB,UAAU,KAAA,CAAS;EACxD,CAAC;EAED,aAAa;GAAE,YAAY;EAAM;CAQrC,GAAG;EAAC;EAAM;EAAW;EAAS;EAAc;EAAY;CAAa,CAAC;CAGtE,OAAO;AACX"}
|
|
@@ -25,9 +25,15 @@ export type EntityCardBindingProps<M extends Record<string, unknown> = Record<st
|
|
|
25
25
|
* Size of the card - affects checkbox styling
|
|
26
26
|
*/
|
|
27
27
|
size?: CollectionSize;
|
|
28
|
+
/**
|
|
29
|
+
* Draws the record's actions — the collection's `entityActions` with
|
|
30
|
+
* Copy and Delete, placed as a table row places them. The card puts them
|
|
31
|
+
* beside its title; a copy of this card calls it where it wants them.
|
|
32
|
+
*/
|
|
33
|
+
renderActions?: (entity: Entity<M>) => React.ReactNode;
|
|
28
34
|
};
|
|
29
35
|
/**
|
|
30
36
|
* Card component for displaying a entity in a grid view.
|
|
31
37
|
* Shows thumbnail, title, and preview properties via the shared slot system.
|
|
32
38
|
*/
|
|
33
|
-
export declare function EntityCardBinding<M extends Record<string, unknown> = Record<string, unknown>>({ entity, collection, onClick, selected, highlighted, onSelectionChange, selectionEnabled, size, searchString }: EntityCardBindingProps<M>): React.JSX.Element;
|
|
39
|
+
export declare function EntityCardBinding<M extends Record<string, unknown> = Record<string, unknown>>({ entity, collection, onClick, selected, highlighted, onSelectionChange, selectionEnabled, size, searchString, renderActions }: EntityCardBindingProps<M>): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCollectionSlotKeys, useEntitySlots } from "./usePreviewSlots.js";
|
|
1
|
+
import { useCollectionSlotKeys, useEntitySlots, useImagePlace } from "./usePreviewSlots.js";
|
|
2
2
|
import { Highlighted } from "./SearchHighlight.js";
|
|
3
3
|
import { MatchExplanation, fieldLabel, useSearchExplanation } from "./SearchExplanation.js";
|
|
4
4
|
import { SlotValue, TagChips } from "./SlotValue.js";
|
|
@@ -11,12 +11,13 @@ import { IconForView, useAnalyticsController, useAuthController, useCustomizatio
|
|
|
11
11
|
* Card component for displaying a entity in a grid view.
|
|
12
12
|
* Shows thumbnail, title, and preview properties via the shared slot system.
|
|
13
13
|
*/
|
|
14
|
-
function EntityCardBinding({ entity, collection, onClick, selected, highlighted, onSelectionChange, selectionEnabled, size = "m", searchString }) {
|
|
14
|
+
function EntityCardBinding({ entity, collection, onClick, selected, highlighted, onSelectionChange, selectionEnabled, size = "m", searchString, renderActions }) {
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const authController = useAuthController();
|
|
17
17
|
const analyticsController = useAnalyticsController();
|
|
18
18
|
const slotKeys = useCollectionSlotKeys(collection, authController, useCustomizationController().propertyConfigs);
|
|
19
19
|
const slots = useEntitySlots(entity, collection, slotKeys);
|
|
20
|
+
const imagePlace = useImagePlace(slotKeys.imageKey);
|
|
20
21
|
const { terms, offSlot } = useSearchExplanation(entity, collection.properties, [slotKeys.titleKey, slotKeys.subtitleKey], searchString);
|
|
21
22
|
const handleClick = (e) => {
|
|
22
23
|
if (e && (e.metaKey || e.ctrlKey) && selectionEnabled) {
|
|
@@ -38,10 +39,19 @@ function EntityCardBinding({ entity, collection, onClick, selected, highlighted,
|
|
|
38
39
|
const handleSelectionChange = (checked) => {
|
|
39
40
|
onSelectionChange?.(entity, checked);
|
|
40
41
|
};
|
|
42
|
+
const checkbox = /* @__PURE__ */ jsx("div", {
|
|
43
|
+
onClick: handleCheckboxClick,
|
|
44
|
+
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
45
|
+
"aria-label": t("select_row", { id: String(entity.id) }),
|
|
46
|
+
checked: selected ?? false,
|
|
47
|
+
onCheckedChange: handleSelectionChange,
|
|
48
|
+
size: size === "xs" ? "smallest" : "small"
|
|
49
|
+
})
|
|
50
|
+
});
|
|
41
51
|
return /* @__PURE__ */ jsxs(Card, {
|
|
42
52
|
className: cls("cursor-pointer overflow-hidden group relative", "transition-all duration-200", "hover:shadow-lg hover:-translate-y-0.5", selected && "ring-2 ring-primary bg-surface-raised", highlighted && !selected && "ring-2 ring-primary/50 bg-surface-card-hover"),
|
|
43
53
|
onClick: handleClick,
|
|
44
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
54
|
+
children: [imagePlace && /* @__PURE__ */ jsxs("div", {
|
|
45
55
|
className: "aspect-[4/3] relative overflow-hidden bg-surface-raised",
|
|
46
56
|
children: [
|
|
47
57
|
slots.image ? /* @__PURE__ */ jsx("div", {
|
|
@@ -61,31 +71,32 @@ function EntityCardBinding({ entity, collection, onClick, selected, highlighted,
|
|
|
61
71
|
/* @__PURE__ */ jsx("div", { className: cls("absolute inset-0 bg-white/0 group-hover:bg-white/[0.06]", "transition-colors duration-200") }),
|
|
62
72
|
selectionEnabled && /* @__PURE__ */ jsx("div", {
|
|
63
73
|
className: cls("absolute", size === "xs" || size === "s" ? "top-1 left-1" : "top-2 left-2"),
|
|
64
|
-
|
|
65
|
-
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
66
|
-
"aria-label": t("select_row", { id: String(entity.id) }),
|
|
67
|
-
checked: selected ?? false,
|
|
68
|
-
onCheckedChange: handleSelectionChange,
|
|
69
|
-
size: size === "xs" ? "smallest" : "small"
|
|
70
|
-
})
|
|
74
|
+
children: checkbox
|
|
71
75
|
})
|
|
72
76
|
]
|
|
73
77
|
}), /* @__PURE__ */ jsxs("div", {
|
|
74
78
|
className: "p-3",
|
|
75
79
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
className: "
|
|
78
|
-
children:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
/* @__PURE__ */ jsxs("div", {
|
|
81
|
+
className: "flex items-start gap-1",
|
|
82
|
+
children: [
|
|
83
|
+
selectionEnabled && !imagePlace && checkbox,
|
|
84
|
+
/* @__PURE__ */ jsx("div", {
|
|
85
|
+
className: "flex-1 min-w-0 truncate my-1 text-sm font-medium min-h-[20px]",
|
|
86
|
+
children: slots.title ? terms.length > 0 && typeof slots.title.value === "string" ? /* @__PURE__ */ jsx(Highlighted, {
|
|
87
|
+
text: slots.title.value,
|
|
88
|
+
terms
|
|
89
|
+
}) : /* @__PURE__ */ jsx(SlotValue, {
|
|
90
|
+
slot: slots.title,
|
|
91
|
+
size: "small"
|
|
92
|
+
}) : /* @__PURE__ */ jsx(Typography, {
|
|
93
|
+
variant: "body2",
|
|
94
|
+
className: "text-surface-500",
|
|
95
|
+
children: entity.id
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
renderActions?.(entity)
|
|
99
|
+
]
|
|
89
100
|
}),
|
|
90
101
|
offSlot ? /* @__PURE__ */ jsx(MatchExplanation, {
|
|
91
102
|
match: offSlot,
|