@rebasepro/cms 0.28.2 → 0.29.0-canary.g0e3a0e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/collection_editor/_cms_internals.d.ts +0 -1
- package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -2
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +2 -2
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -1
- package/dist/components/AdditionalFieldValue.d.ts +9 -3
- package/dist/components/AdditionalFieldValue.js +7 -4
- package/dist/components/AdditionalFieldValue.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +117 -18
- package/dist/components/CollectionPanel.js +115 -37
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +5 -5
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +16 -12
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +33 -8
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +8 -3
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +9 -1
- package/dist/components/CollectionTableBinding/column_utils.js +6 -3
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +3 -2
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +9 -7
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +26 -2
- package/dist/components/CollectionTableBinding/internal/common.js +88 -4
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +4 -3
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +19 -14
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionAddButton.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js +50 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +11 -3
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -4
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +29 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js +112 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +58 -16
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.d.ts +57 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +22 -26
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +58 -22
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +81 -1089
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +152 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js +38 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.d.ts +13 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js +32 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.d.ts +14 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js +22 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +39 -67
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js +54 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.d.ts +24 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js +69 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +34 -23
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.d.ts +17 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +107 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +15 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js +49 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +35 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js +45 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/RowActions.d.ts +40 -0
- package/dist/components/CollectionViewBinding/RowActions.js +60 -0
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +7 -4
- package/dist/components/CollectionViewBinding/SplitListView.js +20 -21
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/builtin_action_props.d.ts +13 -0
- package/dist/components/CollectionViewBinding/fields.d.ts +22 -0
- package/dist/components/CollectionViewBinding/fields.js +47 -0
- package/dist/components/CollectionViewBinding/fields.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +6 -7
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.d.ts +19 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js +28 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js.map +1 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +125 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +844 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +20 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +23 -2
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +21 -3
- package/dist/components/CollectionViewBinding/useSelectionController.js +37 -6
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +3 -3
- package/dist/components/CollectionsProvider.js +4 -4
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/CollectionsScopeContext.d.ts +1 -1
- package/dist/components/CollectionsScopeContext.js +1 -1
- package/dist/components/CollectionsScopeContext.js.map +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +2 -2
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +32 -68
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js +5 -4
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -2
- package/dist/components/EditViewBinding.js +25 -15
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.js +8 -5
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +8 -1
- package/dist/components/EntityViewBinding.js +43 -14
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +40 -0
- package/dist/components/EntityViewBody.js +90 -0
- package/dist/components/EntityViewBody.js.map +1 -0
- package/dist/components/FieldValue.d.ts +50 -0
- package/dist/components/FieldValue.js +81 -0
- package/dist/components/FieldValue.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PanelNotFound.d.ts +5 -0
- package/dist/components/PanelNotFound.js +21 -0
- package/dist/components/PanelNotFound.js.map +1 -0
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/components/RebaseCMS.js +11 -3
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +9 -3
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RebaseShell.js +10 -5
- package/dist/components/RebaseShell.js.map +1 -1
- package/dist/components/RecordDetail.d.ts +61 -0
- package/dist/components/RecordDetail.js +123 -0
- package/dist/components/RecordDetail.js.map +1 -0
- package/dist/components/RecordForm.d.ts +126 -0
- package/dist/components/{EntityFormPanel.js → RecordForm.js} +64 -36
- package/dist/components/RecordForm.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +47 -17
- package/dist/components/ReferenceTable/SelectionTableBinding.js +89 -53
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +5 -3
- package/dist/components/ReferenceWidget.js +10 -7
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.js +4 -4
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +2 -3
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.js +1 -1
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
- package/dist/components/SidePanelBinding.js +13 -12
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/collection_prop.d.ts +18 -0
- package/dist/components/collection_prop.js +23 -0
- package/dist/components/collection_prop.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +54 -54
- package/dist/components/common/default_entity_actions.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +4 -1
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/components/history/LastEditedByFormAction.d.ts +1 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/data_export/export/ExportCollectionAction.d.ts +3 -2
- package/dist/data_export/export/ExportCollectionAction.js +4 -3
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +6 -3
- package/dist/data_export/export/additional_fields.js +8 -4
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.js +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/EntityForm.js +252 -150
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js +3 -2
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.d.ts +1 -1
- package/dist/form/EntityFormBinding.js +22 -11
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormField.d.ts +36 -0
- package/dist/form/FormField.js +41 -0
- package/dist/form/FormField.js.map +1 -0
- package/dist/form/FormFieldsContext.d.ts +69 -0
- package/dist/form/FormFieldsContext.js +143 -0
- package/dist/form/FormFieldsContext.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +4 -4
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/collection_showing.d.ts +8 -0
- package/dist/form/collection_showing.js +29 -0
- package/dist/form/collection_showing.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +2 -1
- package/dist/form/components/ErrorFocus.js.map +1 -1
- package/dist/form/components/FieldBlock.js +3 -1
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +5 -1
- package/dist/form/components/FormRail.js +5 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/FormSections.d.ts +5 -1
- package/dist/form/components/FormSections.js +11 -4
- package/dist/form/components/FormSections.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/form_dom_ids.d.ts +25 -0
- package/dist/form/form_dom_ids.js +42 -0
- package/dist/form/form_dom_ids.js.map +1 -0
- package/dist/form/index.d.ts +3 -1
- package/dist/form/resolve_cell_property.d.ts +5 -0
- package/dist/form/resolve_cell_property.js +22 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +2 -2
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.d.ts +3 -3
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/useResolvedCollections.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.js +9 -9
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useEntityDisplay.js +6 -4
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useRecordActions.js +2 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useSelectionDialog.d.ts +20 -7
- package/dist/hooks/useSelectionDialog.js +29 -8
- package/dist/hooks/useSelectionDialog.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +15 -9
- package/dist/mcp-view.d.ts +9 -0
- package/dist/mcp-view.js +2 -0
- package/dist/mcp_view/app_modules.d.ts +29 -0
- package/dist/mcp_view/app_modules.js +163 -0
- package/dist/mcp_view/app_modules.js.map +1 -0
- package/dist/mcp_view/bridge.d.ts +90 -0
- package/dist/mcp_view/bridge.js +205 -0
- package/dist/mcp_view/bridge.js.map +1 -0
- package/dist/mcp_view/code_app.d.ts +65 -0
- package/dist/mcp_view/code_app.js +139 -0
- package/dist/mcp_view/code_app.js.map +1 -0
- package/dist/mcp_view/index.d.ts +48 -0
- package/dist/mcp_view/index.js +235 -0
- package/dist/mcp_view/index.js.map +1 -0
- package/dist/mcp_view/payload.d.ts +78 -0
- package/dist/mcp_view/payload.js +155 -0
- package/dist/mcp_view/payload.js.map +1 -0
- package/dist/mcp_view/screen.d.ts +28 -0
- package/dist/mcp_view/screen.js +223 -0
- package/dist/mcp_view/screen.js.map +1 -0
- package/dist/mcp_view/storage_source.d.ts +14 -0
- package/dist/mcp_view/storage_source.js +29 -0
- package/dist/mcp_view/storage_source.js.map +1 -0
- package/dist/mcp_view/store.d.ts +9 -0
- package/dist/mcp_view/store.js +27 -0
- package/dist/mcp_view/store.js.map +1 -0
- package/dist/mcp_view/tool_driver.d.ts +135 -0
- package/dist/mcp_view/tool_driver.js +527 -0
- package/dist/mcp_view/tool_driver.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +34 -1
- package/dist/preview/components/DatePreview.js +72 -37
- package/dist/preview/components/DatePreview.js.map +1 -1
- package/dist/routes/RebaseRoute.js +1 -1
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +5 -3
- package/dist/selection/SelectionMenu.js +16 -9
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/index.d.ts +2 -1
- package/dist/selection/resolve_selection.d.ts +61 -7
- package/dist/selection/resolve_selection.js +93 -11
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/types/components/EntityFormProps.d.ts +60 -10
- package/dist/types/fields.d.ts +2 -65
- package/dist/util/dataControllerAdapter.d.ts +8 -0
- package/dist/util/dataControllerAdapter.js +11 -0
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/navigation_utils.d.ts +5 -4
- package/dist/util/navigation_utils.js +6 -6
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +8 -0
- package/dist/util/propertyConfigMapper.js +16 -2
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/package.json +15 -9
- package/recipes/README.md +79 -26
- package/recipes/approval-queue.tsx +79 -0
- package/recipes/bulk-set-status.tsx +23 -17
- package/recipes/calendar-view.tsx +28 -23
- package/recipes/master-detail.tsx +75 -0
- package/recipes/my-preferences.tsx +3 -3
- package/recipes/orders-dashboard.tsx +58 -84
- package/recipes/site-settings.tsx +4 -4
- package/dist/components/EntityFormPanel.d.ts +0 -63
- package/dist/components/EntityFormPanel.js.map +0 -1
|
@@ -56,8 +56,7 @@ var SelectableTable = function SelectableTable({ onValueChange, cellRenderer, on
|
|
|
56
56
|
setLocalSelectedCell(cell);
|
|
57
57
|
if (cell) selectionStore.select({
|
|
58
58
|
...cell,
|
|
59
|
-
columnKey: cell.propertyKey
|
|
60
|
-
id: cell.entityId
|
|
59
|
+
columnKey: cell.propertyKey
|
|
61
60
|
});
|
|
62
61
|
else selectionStore.select(void 0);
|
|
63
62
|
}, [selectionStore]);
|
|
@@ -116,7 +115,7 @@ var SelectableTable = function SelectableTable({ onValueChange, cellRenderer, on
|
|
|
116
115
|
return /* @__PURE__ */ jsx(SelectableTableContext.Provider, {
|
|
117
116
|
value: contextValue,
|
|
118
117
|
children: /* @__PURE__ */ jsx("div", {
|
|
119
|
-
className: "h-full w-full flex flex-col bg-surface-card",
|
|
118
|
+
className: "h-full min-h-0 w-full flex flex-col bg-surface-card",
|
|
120
119
|
ref,
|
|
121
120
|
children: /* @__PURE__ */ jsx(VirtualTable, {
|
|
122
121
|
data: sparseData ?? data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableTable.js","names":[],"sources":["../../../src/components/SelectableTable/SelectableTable.tsx"],"sourcesContent":["import { createSelectionStore, AdminSelectedCell } from \"./SelectionStore\";\nimport type { Property, WhereFilterOp } from \"@rebasepro/types\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { Entity, FilterValues } from \"@rebasepro/types\";\nimport { CollectionSize, EntityTableController, SelectedCellProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport { CellRendererParams, VirtualTable, VirtualTableColumn, VirtualTableFilterValues, VirtualTableSortKey, OnRowClickParams } from \"@rebasepro/ui\";\nimport { DEFAULT_PAGE_SIZE, DataCollectionTableController, OnCellValueChange, OnColumnResizeParams } from \"@rebasepro/app\";\nimport { FilterFormFieldProps } from \"@rebasepro/ui\";\nimport { isKeyHandled, useOutsideAlerter } from \"@rebasepro/ui\";\nimport { SelectableTableContext } from \"./SelectableTableContext\";\nimport { getRowHeight } from \"@rebasepro/app\";\nimport { FilterFieldBinding } from \"./filters/FilterFieldBinding\";\n\nexport type SelectableTableProps<M extends Record<string, unknown>> = {\n\n /**\n * Callback when a cell value changes.\n */\n onValueChange?: OnCellValueChange<unknown, M>;\n\n columns: VirtualTableColumn[];\n\n cellRenderer: (props: CellRendererParams<Entity<M>>) => React.ReactNode;\n\n /**\n * Builder for creating the buttons in each row\n * @param entity\n * @param size\n */\n tableRowActionsBuilder?: (params: {\n entity: Entity<M>,\n size: CollectionSize,\n width: number,\n frozen?: boolean\n }) => React.ReactNode;\n\n /**\n * Callback when anywhere on the table is clicked\n */\n onEntityClick?(entity: Entity<M>): void;\n\n /**\n * Callback when a column is resized\n */\n onColumnResize?(params: OnColumnResizeParams): void;\n\n /**\n * Should apply a different style to a row when hovering\n */\n hoverRow?: boolean;\n\n /**\n * Controller holding the logic for the table\n * {@link useDataTableController}\n * {@link EntityTableController}\n */\n tableController: EntityTableController<M>;\n\n filterable?: boolean;\n\n sortable?: boolean;\n\n inlineEditing?: boolean;\n\n fixedFilter?: FilterValues<keyof M extends string ? keyof M : never>;\n\n highlightedRow?: (data: Entity<M>) => boolean;\n\n size?: CollectionSize;\n\n initialScroll?: number;\n\n /**\n * Callback when the table is scrolled\n * @param props\n */\n onScroll?: (props: {\n scrollDirection: \"forward\" | \"backward\",\n scrollOffset: number,\n scrollUpdateWasRequested: boolean\n }) => void;\n\n emptyComponent?: React.ReactNode;\n\n endAdornment?: React.ReactNode;\n\n AddColumnComponent?: React.ComponentType;\n\n /**\n * Callback when columns are reordered via drag-and-drop\n */\n onColumnsOrderChange?: (columns: VirtualTableColumn[]) => void;\n\n /**\n * Extra data passed to VirtualTable cells. Changes to this object\n * bust the cell memo comparator, triggering re-render of cells\n * even when rowData hasn't changed.\n */\n extraData?: unknown;\n}\n\n/**\n * This component is in charge of rendering a collection table with a high\n * degree of customization.\n *\n * This component is used internally by {@link CollectionViewBinding} and\n * {@link useReferenceDialog}\n *\n * Please note that you only need to use this component if you are building\n * a custom view. If you just need to create a default view you can do it\n * exclusively with config options.\n *\n * If you want to bind a {@link AdminCollection} to a table with the default\n * options you see in collections in the top level navigation, you can\n * check {@link CollectionViewBinding}.\n *\n * The data displayed in the table is managed by a {@link EntityTableController}.\n * You can build the default, bound to a path in the driver, by using the hook\n * {@link useDataTableController}\n *\n * @see CollectionTableBindingProps\n * @see CollectionViewBinding\n * @see VirtualTable\n * @group Components\n */\nexport const SelectableTable = function SelectableTable<M extends Record<string, unknown>>\n ({\n onValueChange,\n cellRenderer,\n onEntityClick,\n onColumnResize,\n hoverRow = true,\n size = \"m\",\n inlineEditing = false,\n tableController:\n {\n data,\n sparseData,\n onRowsRendered,\n dataLoading,\n noMoreToLoad,\n dataLoadingError,\n filterValues,\n setFilterValues,\n sortBy,\n setSortBy,\n itemCount,\n setItemCount,\n pageSize = DEFAULT_PAGE_SIZE,\n paginationEnabled,\n checkFilterCombination,\n setPopupCell\n },\n filterable = true,\n onScroll,\n initialScroll,\n emptyComponent,\n columns,\n fixedFilter,\n highlightedRow,\n endAdornment,\n AddColumnComponent,\n onColumnsOrderChange,\n extraData\n }: SelectableTableProps<M>) {\n\n const ref = useRef<HTMLDivElement>(null);\n\n // Create the selection store once\n const selectionStore = useMemo(() => createSelectionStore(), []);\n // We still keep local state for side-effects like outside-alerter, but we don't put it in context\n const [localSelectedCell, setLocalSelectedCell] = React.useState<SelectedCellProps<M> | undefined>(undefined);\n\n const loadNextPage = useCallback(() => {\n if (!paginationEnabled || dataLoading || noMoreToLoad)\n return;\n if (itemCount !== undefined)\n setItemCount?.(itemCount + pageSize);\n }, [paginationEnabled, dataLoading, noMoreToLoad, itemCount, pageSize, setItemCount]);\n\n const resetPagination = useCallback(() => {\n setItemCount?.(pageSize);\n }, [pageSize]);\n\n const onRowClick = useCallback(({ rowData }: OnRowClickParams<Entity<M>>) => {\n if (inlineEditing)\n return;\n return onEntityClick && onEntityClick(rowData);\n }, [onEntityClick, inlineEditing]);\n\n const select = useCallback((cell?: SelectedCellProps<M>) => {\n setLocalSelectedCell(cell);\n if (cell) {\n selectionStore.select({\n ...cell,\n columnKey: cell.propertyKey,\n id: cell.entityId\n } as AdminSelectedCell);\n } else {\n selectionStore.select(undefined);\n }\n }, [selectionStore]);\n\n const unselect = useCallback(() => {\n setLocalSelectedCell(undefined);\n selectionStore.select(undefined);\n }, [selectionStore]);\n\n useOutsideAlerter(ref,\n () => {\n if (localSelectedCell) {\n unselect();\n }\n },\n Boolean(localSelectedCell));\n\n // on ESC key press\n useEffect(() => {\n const escFunction = (event: KeyboardEvent) => {\n // A layer above the table already acted on this Escape (kit rule:\n // it called preventDefault) — closing it is the whole of the key.\n if (event.key !== \"Escape\" || isKeyHandled(event)) return;\n // A key pressed inside something the table opened — a cell's\n // dropdown, portaled out of the table — is that layer's Escape: it\n // closes the list and leaves the cell selected. The next one, from\n // the cell itself, clears the selection.\n const target = event.target;\n if (target instanceof Node && target !== document.body && ref.current && !ref.current.contains(target))\n return;\n unselect();\n };\n document.addEventListener(\"keydown\", escFunction, false);\n return () => {\n document.removeEventListener(\"keydown\", escFunction, false);\n };\n }, [unselect]);\n\n // The table stops drawing rows when it goes (another view takes over):\n // say so, so the controller keeps every row held current again.\n useEffect(() => () => onRowsRendered?.(undefined), [onRowsRendered]);\n\n const onFilterUpdate = useCallback((updatedFilterValues?: VirtualTableFilterValues<string>) => {\n if (setFilterValues) {\n setFilterValues({\n ...updatedFilterValues,\n ...fixedFilter\n } as FilterValues<Extract<keyof M, string> | (string & {})>);\n }\n }, [fixedFilter, setFilterValues]);\n\n const contextValue = useMemo(() => ({\n select,\n onValueChange,\n size: size ?? \"m\",\n selectionStore,\n setPopupCell\n } as DataCollectionTableController<Record<string, unknown>>), [setPopupCell, select, onValueChange, size, selectionStore]);\n\n const createFilterField = useCallback(({\n id,\n filterValue,\n setFilterValue,\n column,\n hidden,\n setHidden\n }: FilterFormFieldProps<unknown>): React.ReactNode => {\n if (!column.custom) return null;\n const { resolvedProperty } = column.custom as { resolvedProperty?: Property };\n if (!resolvedProperty) return null;\n // Engine-aware operator resolution happens inside FilterFieldBinding,\n // which reads the collection from the surrounding CollectionScopeProvider.\n return <FilterFieldBinding\n propertyKey={id as string}\n property={resolvedProperty}\n value={filterValue as [WhereFilterOp, unknown] | undefined}\n setValue={setFilterValue as (value?: [WhereFilterOp, unknown]) => void}\n hidden={hidden}\n setHidden={setHidden}/>;\n }, []);\n\n return (\n <SelectableTableContext.Provider\n value={contextValue}>\n <div className=\"h-full w-full flex flex-col bg-surface-card\"\n ref={ref}>\n\n <VirtualTable\n data={sparseData ?? data}\n onRowsRendered={onRowsRendered}\n columns={columns}\n cellRenderer={cellRenderer}\n onRowClick={inlineEditing ? undefined : (onEntityClick ? onRowClick : undefined)}\n onEndReached={loadNextPage}\n onResetPagination={resetPagination}\n error={dataLoadingError}\n onColumnResize={onColumnResize}\n rowHeight={getRowHeight(size)}\n loading={dataLoading}\n filter={filterValues}\n onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}\n sortBy={sortBy}\n onSortByUpdate={setSortBy as ((sortBy?: VirtualTableSortKey[]) => void)}\n hoverRow={hoverRow}\n initialScroll={initialScroll}\n onScroll={onScroll}\n checkFilterCombination={checkFilterCombination}\n createFilterField={filterable ? createFilterField : undefined}\n rowClassName={useCallback((entity: Entity<M>) => {\n return highlightedRow?.(entity) ? \"!bg-surface-raised\" : \"\";\n }, [highlightedRow])}\n className=\"grow\"\n emptyComponent={emptyComponent}\n endAdornment={endAdornment}\n AddColumnComponent={AddColumnComponent}\n onColumnsOrderChange={onColumnsOrderChange}\n extraData={extraData}\n />\n\n </div>\n </SelectableTableContext.Provider>\n );\n\n};\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,IAAa,kBAAkB,SAAS,gBACnC,EACG,eACA,cACA,eACA,gBACA,WAAW,MACX,OAAO,KACP,gBAAgB,OAChB,iBACA,EACI,MACA,YACA,gBACA,aACA,cACA,kBACA,cACA,iBACA,QACA,WACA,WACA,cACA,WAAW,mBACX,mBACA,wBACA,gBAEJ,aAAa,MACb,UACA,eACA,gBACA,SACA,aACA,gBACA,cACA,oB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
|
|
1
|
+
{"version":3,"file":"SelectableTable.js","names":[],"sources":["../../../src/components/SelectableTable/SelectableTable.tsx"],"sourcesContent":["import { createSelectionStore, AdminSelectedCell } from \"./SelectionStore\";\nimport type { Property, WhereFilterOp } from \"@rebasepro/types\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { Entity, FilterValues } from \"@rebasepro/types\";\nimport { CollectionSize, EntityTableController, SelectedCellProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport { CellRendererParams, VirtualTable, VirtualTableColumn, VirtualTableFilterValues, VirtualTableSortKey, OnRowClickParams } from \"@rebasepro/ui\";\nimport { DEFAULT_PAGE_SIZE, DataCollectionTableController, OnCellValueChange, OnColumnResizeParams } from \"@rebasepro/app\";\nimport { FilterFormFieldProps } from \"@rebasepro/ui\";\nimport { isKeyHandled, useOutsideAlerter } from \"@rebasepro/ui\";\nimport { SelectableTableContext } from \"./SelectableTableContext\";\nimport { getRowHeight } from \"@rebasepro/app\";\nimport { FilterFieldBinding } from \"./filters/FilterFieldBinding\";\n\nexport type SelectableTableProps<M extends Record<string, unknown>> = {\n\n /**\n * Callback when a cell value changes.\n */\n onValueChange?: OnCellValueChange<unknown, M>;\n\n columns: VirtualTableColumn[];\n\n cellRenderer: (props: CellRendererParams<Entity<M>>) => React.ReactNode;\n\n /**\n * Builder for creating the buttons in each row\n * @param entity\n * @param size\n */\n tableRowActionsBuilder?: (params: {\n entity: Entity<M>,\n size: CollectionSize,\n width: number,\n frozen?: boolean\n }) => React.ReactNode;\n\n /**\n * Callback when anywhere on the table is clicked\n */\n onEntityClick?(entity: Entity<M>): void;\n\n /**\n * Callback when a column is resized\n */\n onColumnResize?(params: OnColumnResizeParams): void;\n\n /**\n * Should apply a different style to a row when hovering\n */\n hoverRow?: boolean;\n\n /**\n * Controller holding the logic for the table\n * {@link useDataTableController}\n * {@link EntityTableController}\n */\n tableController: EntityTableController<M>;\n\n filterable?: boolean;\n\n sortable?: boolean;\n\n inlineEditing?: boolean;\n\n fixedFilter?: FilterValues<keyof M extends string ? keyof M : never>;\n\n highlightedRow?: (data: Entity<M>) => boolean;\n\n size?: CollectionSize;\n\n initialScroll?: number;\n\n /**\n * Callback when the table is scrolled\n * @param props\n */\n onScroll?: (props: {\n scrollDirection: \"forward\" | \"backward\",\n scrollOffset: number,\n scrollUpdateWasRequested: boolean\n }) => void;\n\n emptyComponent?: React.ReactNode;\n\n endAdornment?: React.ReactNode;\n\n AddColumnComponent?: React.ComponentType;\n\n /**\n * Callback when columns are reordered via drag-and-drop\n */\n onColumnsOrderChange?: (columns: VirtualTableColumn[]) => void;\n\n /**\n * Extra data passed to VirtualTable cells. Changes to this object\n * bust the cell memo comparator, triggering re-render of cells\n * even when rowData hasn't changed.\n */\n extraData?: unknown;\n}\n\n/**\n * This component is in charge of rendering a collection table with a high\n * degree of customization.\n *\n * This component is used internally by {@link CollectionViewBinding} and\n * {@link useReferenceDialog}\n *\n * Please note that you only need to use this component if you are building\n * a custom view. If you just need to create a default view you can do it\n * exclusively with config options.\n *\n * If you want to bind a {@link AdminCollection} to a table with the default\n * options you see in collections in the top level navigation, you can\n * check {@link CollectionViewBinding}.\n *\n * The data displayed in the table is managed by a {@link EntityTableController}.\n * You can build the default, bound to a path in the driver, by using the hook\n * {@link useDataTableController}\n *\n * @see CollectionTableBindingProps\n * @see CollectionViewBinding\n * @see VirtualTable\n * @group Components\n */\nexport const SelectableTable = function SelectableTable<M extends Record<string, unknown>>\n ({\n onValueChange,\n cellRenderer,\n onEntityClick,\n onColumnResize,\n hoverRow = true,\n size = \"m\",\n inlineEditing = false,\n tableController:\n {\n data,\n sparseData,\n onRowsRendered,\n dataLoading,\n noMoreToLoad,\n dataLoadingError,\n filterValues,\n setFilterValues,\n sortBy,\n setSortBy,\n itemCount,\n setItemCount,\n pageSize = DEFAULT_PAGE_SIZE,\n paginationEnabled,\n checkFilterCombination,\n setPopupCell\n },\n filterable = true,\n onScroll,\n initialScroll,\n emptyComponent,\n columns,\n fixedFilter,\n highlightedRow,\n endAdornment,\n AddColumnComponent,\n onColumnsOrderChange,\n extraData\n }: SelectableTableProps<M>) {\n\n const ref = useRef<HTMLDivElement>(null);\n\n // Create the selection store once\n const selectionStore = useMemo(() => createSelectionStore(), []);\n // We still keep local state for side-effects like outside-alerter, but we don't put it in context\n const [localSelectedCell, setLocalSelectedCell] = React.useState<SelectedCellProps<M> | undefined>(undefined);\n\n const loadNextPage = useCallback(() => {\n if (!paginationEnabled || dataLoading || noMoreToLoad)\n return;\n if (itemCount !== undefined)\n setItemCount?.(itemCount + pageSize);\n }, [paginationEnabled, dataLoading, noMoreToLoad, itemCount, pageSize, setItemCount]);\n\n const resetPagination = useCallback(() => {\n setItemCount?.(pageSize);\n }, [pageSize]);\n\n const onRowClick = useCallback(({ rowData }: OnRowClickParams<Entity<M>>) => {\n if (inlineEditing)\n return;\n return onEntityClick && onEntityClick(rowData);\n }, [onEntityClick, inlineEditing]);\n\n const select = useCallback((cell?: SelectedCellProps<M>) => {\n setLocalSelectedCell(cell);\n if (cell) {\n selectionStore.select({\n ...cell,\n columnKey: cell.propertyKey\n } as AdminSelectedCell);\n } else {\n selectionStore.select(undefined);\n }\n }, [selectionStore]);\n\n const unselect = useCallback(() => {\n setLocalSelectedCell(undefined);\n selectionStore.select(undefined);\n }, [selectionStore]);\n\n useOutsideAlerter(ref,\n () => {\n if (localSelectedCell) {\n unselect();\n }\n },\n Boolean(localSelectedCell));\n\n // on ESC key press\n useEffect(() => {\n const escFunction = (event: KeyboardEvent) => {\n // A layer above the table already acted on this Escape (kit rule:\n // it called preventDefault) — closing it is the whole of the key.\n if (event.key !== \"Escape\" || isKeyHandled(event)) return;\n // A key pressed inside something the table opened — a cell's\n // dropdown, portaled out of the table — is that layer's Escape: it\n // closes the list and leaves the cell selected. The next one, from\n // the cell itself, clears the selection.\n const target = event.target;\n if (target instanceof Node && target !== document.body && ref.current && !ref.current.contains(target))\n return;\n unselect();\n };\n document.addEventListener(\"keydown\", escFunction, false);\n return () => {\n document.removeEventListener(\"keydown\", escFunction, false);\n };\n }, [unselect]);\n\n // The table stops drawing rows when it goes (another view takes over):\n // say so, so the controller keeps every row held current again.\n useEffect(() => () => onRowsRendered?.(undefined), [onRowsRendered]);\n\n const onFilterUpdate = useCallback((updatedFilterValues?: VirtualTableFilterValues<string>) => {\n if (setFilterValues) {\n setFilterValues({\n ...updatedFilterValues,\n ...fixedFilter\n } as FilterValues<Extract<keyof M, string> | (string & {})>);\n }\n }, [fixedFilter, setFilterValues]);\n\n const contextValue = useMemo(() => ({\n select,\n onValueChange,\n size: size ?? \"m\",\n selectionStore,\n setPopupCell\n } as DataCollectionTableController<Record<string, unknown>>), [setPopupCell, select, onValueChange, size, selectionStore]);\n\n const createFilterField = useCallback(({\n id,\n filterValue,\n setFilterValue,\n column,\n hidden,\n setHidden\n }: FilterFormFieldProps<unknown>): React.ReactNode => {\n if (!column.custom) return null;\n const { resolvedProperty } = column.custom as { resolvedProperty?: Property };\n if (!resolvedProperty) return null;\n // Engine-aware operator resolution happens inside FilterFieldBinding,\n // which reads the collection from the surrounding CollectionScopeProvider.\n return <FilterFieldBinding\n propertyKey={id as string}\n property={resolvedProperty}\n value={filterValue as [WhereFilterOp, unknown] | undefined}\n setValue={setFilterValue as (value?: [WhereFilterOp, unknown]) => void}\n hidden={hidden}\n setHidden={setHidden}/>;\n }, []);\n\n return (\n <SelectableTableContext.Provider\n value={contextValue}>\n <div className=\"h-full min-h-0 w-full flex flex-col bg-surface-card\"\n ref={ref}>\n\n <VirtualTable\n data={sparseData ?? data}\n onRowsRendered={onRowsRendered}\n columns={columns}\n cellRenderer={cellRenderer}\n onRowClick={inlineEditing ? undefined : (onEntityClick ? onRowClick : undefined)}\n onEndReached={loadNextPage}\n onResetPagination={resetPagination}\n error={dataLoadingError}\n onColumnResize={onColumnResize}\n rowHeight={getRowHeight(size)}\n loading={dataLoading}\n filter={filterValues}\n onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}\n sortBy={sortBy}\n onSortByUpdate={setSortBy as ((sortBy?: VirtualTableSortKey[]) => void)}\n hoverRow={hoverRow}\n initialScroll={initialScroll}\n onScroll={onScroll}\n checkFilterCombination={checkFilterCombination}\n createFilterField={filterable ? createFilterField : undefined}\n rowClassName={useCallback((entity: Entity<M>) => {\n return highlightedRow?.(entity) ? \"!bg-surface-raised\" : \"\";\n }, [highlightedRow])}\n className=\"grow\"\n emptyComponent={emptyComponent}\n endAdornment={endAdornment}\n AddColumnComponent={AddColumnComponent}\n onColumnsOrderChange={onColumnsOrderChange}\n extraData={extraData}\n />\n\n </div>\n </SelectableTableContext.Provider>\n );\n\n};\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,IAAa,kBAAkB,SAAS,gBACnC,EACG,eACA,cACA,eACA,gBACA,WAAW,MACX,OAAO,KACP,gBAAgB,OAChB,iBACA,EACI,MACA,YACA,gBACA,aACA,cACA,kBACA,cACA,iBACA,QACA,WACA,WACA,cACA,WAAW,mBACX,mBACA,wBACA,gBAEJ,aAAa,MACb,UACA,eACA,gBACA,SACA,aACA,gBACA,cACA,oBACA,sBACA,aACwB;CAE5B,MAAM,MAAM,OAAuB,IAAI;CAGvC,MAAM,iBAAiB,cAAc,qBAAqB,GAAG,CAAC,CAAC;CAE/D,MAAM,CAAC,mBAAmB,wBAAwB,MAAM,SAA2C,KAAA,CAAS;CAE5G,MAAM,eAAe,kBAAkB;EACnC,IAAI,CAAC,qBAAqB,eAAe,cACrC;EACJ,IAAI,cAAc,KAAA,GACd,eAAe,YAAY,QAAQ;CAC3C,GAAG;EAAC;EAAmB;EAAa;EAAc;EAAW;EAAU;CAAY,CAAC;CAEpF,MAAM,kBAAkB,kBAAkB;EACtC,eAAe,QAAQ;CAC3B,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,aAAa,aAAa,EAAE,cAA2C;EACzE,IAAI,eACA;EACJ,OAAO,iBAAiB,cAAc,OAAO;CACjD,GAAG,CAAC,eAAe,aAAa,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,OAAO,oBAAC,oBAAD;GACH,aAAa;GACb,UAAU;GACV,OAAO;GACP,UAAU;GACF;GACG;EAAW,CAAA;CAC9B,GAAG,CAAC,CAAC;CAEL,OACI,oBAAC,uBAAuB,UAAxB;EACI,OAAO;YACP,oBAAC,OAAD;GAAK,WAAU;GACN;aAEJ,oBAAC,cAAD;IACG,MAAM,cAAc;IACJ;IACP;IACK;IACd,YAAY,gBAAgB,KAAA,IAAa,gBAAgB,aAAa,KAAA;IACtE,cAAc;IACd,mBAAmB;IACnB,OAAO;IACS;IAChB,WAAW,aAAa,IAAI;IAC5B,SAAS;IACT,QAAQ;IACR,gBAAgB,kBAAkB,iBAAiB,KAAA;IAC3C;IACR,gBAAgB;IACN;IACK;IACL;IACc;IACxB,mBAAmB,aAAa,oBAAoB,KAAA;IACpD,cAAc,aAAa,WAAsB;KAC7C,OAAO,iBAAiB,MAAM,IAAI,uBAAuB;IAC7D,GAAG,CAAC,cAAc,CAAC;IACnB,WAAU;IACM;IACF;IACM;IACE;IACX;GACd,CAAA;EAEA,CAAA;CACwB,CAAA;AAGzC"}
|
|
@@ -2,7 +2,7 @@ import { SelectedCellProps } from "@rebasepro/cms-types";
|
|
|
2
2
|
import { VirtualTableSelectionStore, SelectedCell } from "@rebasepro/ui";
|
|
3
3
|
export interface AdminSelectedCell extends SelectedCell {
|
|
4
4
|
entityPath: string;
|
|
5
|
-
|
|
5
|
+
id: string;
|
|
6
6
|
propertyKey: string;
|
|
7
7
|
cellRect: DOMRect;
|
|
8
8
|
width: number;
|
|
@@ -19,7 +19,7 @@ function useCellSelected(store, propertyKey, entityPath, entityId) {
|
|
|
19
19
|
const cell = store.getEntity();
|
|
20
20
|
if (!cell) return false;
|
|
21
21
|
const s = selectorRef.current;
|
|
22
|
-
return cell.propertyKey === s.propertyKey && cell.entityPath === s.entityPath && cell.
|
|
22
|
+
return cell.propertyKey === s.propertyKey && cell.entityPath === s.entityPath && cell.id === String(s.entityId);
|
|
23
23
|
}, [store]);
|
|
24
24
|
return useSyncExternalStore(store.subscribe, getEntity, getEntity);
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionStore.js","names":[],"sources":["../../../src/components/SelectableTable/SelectionStore.ts"],"sourcesContent":["import { useSyncExternalStore, useCallback, useRef } from \"react\";\nimport { SelectedCellProps } from \"@rebasepro/cms-types\";\nimport {\n createVirtualTableSelectionStore,\n VirtualTableSelectionStore,\n SelectedCell\n} from \"@rebasepro/ui\";\n\nexport interface AdminSelectedCell extends SelectedCell {\n entityPath: string;\n
|
|
1
|
+
{"version":3,"file":"SelectionStore.js","names":[],"sources":["../../../src/components/SelectableTable/SelectionStore.ts"],"sourcesContent":["import { useSyncExternalStore, useCallback, useRef } from \"react\";\nimport { SelectedCellProps } from \"@rebasepro/cms-types\";\nimport {\n createVirtualTableSelectionStore,\n VirtualTableSelectionStore,\n SelectedCell\n} from \"@rebasepro/ui\";\n\nexport interface AdminSelectedCell extends SelectedCell {\n entityPath: string;\n id: string;\n propertyKey: string;\n cellRect: DOMRect;\n width: number;\n height: number;\n}\n\nexport function createSelectionStore() {\n return createVirtualTableSelectionStore<AdminSelectedCell>();\n}\n\nexport type SelectionStore = VirtualTableSelectionStore<AdminSelectedCell>;\n\nexport function useCellSelected(\n store: { getEntity: () => SelectedCellProps | undefined; subscribe: (listener: () => void) => () => void },\n propertyKey: string,\n entityPath: string,\n entityId: string | number\n): boolean {\n const selectorRef = useRef({ propertyKey, entityPath, entityId });\n selectorRef.current = { propertyKey, entityPath, entityId };\n\n const getEntity = useCallback(() => {\n const cell = store.getEntity();\n if (!cell) return false;\n const s = selectorRef.current;\n return cell.propertyKey === s.propertyKey &&\n cell.entityPath === s.entityPath &&\n cell.id === String(s.entityId);\n }, [store]);\n\n return useSyncExternalStore(store.subscribe, getEntity, getEntity);\n}\n"],"mappings":";;;AAiBA,SAAgB,uBAAuB;CACnC,OAAO,iCAAoD;AAC/D;AAIA,SAAgB,gBACZ,OACA,aACA,YACA,UACO;CACP,MAAM,cAAc,OAAO;EAAE;EAAa;EAAY;CAAS,CAAC;CAChE,YAAY,UAAU;EAAE;EAAa;EAAY;CAAS;CAE1D,MAAM,YAAY,kBAAkB;EAChC,MAAM,OAAO,MAAM,UAAU;EAC7B,IAAI,CAAC,MAAM,OAAO;EAClB,MAAM,IAAI,YAAY;EACtB,OAAO,KAAK,gBAAgB,EAAE,eAC1B,KAAK,eAAe,EAAE,cACtB,KAAK,OAAO,OAAO,EAAE,QAAQ;CACrC,GAAG,CAAC,KAAK,CAAC;CAEV,OAAO,qBAAqB,MAAM,WAAW,WAAW,SAAS;AACrE"}
|
|
@@ -2,7 +2,7 @@ import { useCollectionRegistryController } from "../../../hooks/navigation/conte
|
|
|
2
2
|
import { useReferencePaths } from "../../../hooks/useReferencePaths.js";
|
|
3
3
|
import { ReferencePreview } from "../../../preview/components/ReferencePreview.js";
|
|
4
4
|
import { isNullFilterOperator, nullFilterOperatorFor, valueOperatorFor } from "./null_filter.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useEntitySelectionDialog } from "../../../hooks/useSelectionDialog.js";
|
|
6
6
|
import { useId, useMemo, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Button, Checkbox, Label, Select, SelectItem } from "@rebasepro/ui";
|
|
@@ -78,7 +78,7 @@ function ReferenceFilterField({ value, setValue, isArray, path, includeId = true
|
|
|
78
78
|
const multiple = multipleSelectOperations.includes(operation);
|
|
79
79
|
const nullFiltered = isNullFilterOperator(operation);
|
|
80
80
|
const nullFilterId = useId();
|
|
81
|
-
const referenceDialogController =
|
|
81
|
+
const referenceDialogController = useEntitySelectionDialog({
|
|
82
82
|
multiselect: multiple,
|
|
83
83
|
path: collectionPath,
|
|
84
84
|
collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferenceFilterField.js","names":[],"sources":["../../../../src/components/SelectableTable/filters/ReferenceFilterField.tsx"],"sourcesContent":["import { useSelectionDialog } from \"../../../hooks/useSelectionDialog\";\n\nimport React, { useId, useMemo, useState } from \"react\";\nimport { VirtualTableWhereFilterOp } from \"@rebasepro/ui\";\nimport { Entity, EntityReference } from \"@rebasepro/types\";\nimport { ReferencePreview } from \"../../../preview\";\nimport { Button, Checkbox, Label, Select, SelectItem } from \"@rebasepro/ui\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport { useCollectionRegistryController } from \"../../../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useReferencePaths } from \"../../../hooks/useReferencePaths\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport { isNullFilterOperator, nullFilterOperatorFor, valueOperatorFor } from \"./null_filter\";\n\ninterface ReferenceFilterFieldProps {\n name: string,\n value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];\n setValue: (filterValue?: [VirtualTableWhereFilterOp, unknown]) => void;\n isArray?: boolean;\n path?: string;\n title?: string;\n includeId?: boolean;\n previewProperties?: string[];\n hidden: boolean;\n setHidden: (hidden: boolean) => void;\n /**\n * Restrict the offered operators (already resolved against engine\n * capabilities and property config). When omitted, all operators this\n * field can render are offered.\n */\n operators?: readonly VirtualTableWhereFilterOp[];\n}\n\nconst operationLabels = {\n \"==\": \"==\",\n \"!=\": \"!=\",\n \">\": \">\",\n \"<\": \"<\",\n \">=\": \">=\",\n \"<=\": \"<=\",\n in: \"In\",\n \"not-in\": \"Not in\",\n \"array-contains\": \"Contains\",\n \"array-contains-any\": \"Contains Any\",\n \"is-null\": \"Is null\",\n \"is-not-null\": \"Is not null\"\n};\n\nconst multipleSelectOperations = [\"array-contains-any\", \"in\", \"not-in\"];\n\nexport function ReferenceFilterField({\n value,\n setValue,\n isArray,\n path,\n includeId = true,\n previewProperties,\n setHidden,\n operators\n}: ReferenceFilterFieldProps) {\n const { t } = useTranslation();\n\n let possibleOperations: (keyof typeof operationLabels)[] = isArray\n ? [\"array-contains\"]\n : [\"==\", \"!=\", \">\", \"<\", \">=\", \"<=\"];\n\n if (isArray) {\n possibleOperations.push(\"array-contains-any\");\n } else {\n possibleOperations.push(\"in\", \"not-in\");\n }\n\n // The null checks take no operand, so they apply either way.\n possibleOperations.push(\"is-null\", \"is-not-null\");\n\n if (operators) {\n possibleOperations = possibleOperations.filter(op => (operators as readonly string[]).includes(op));\n }\n\n const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];\n const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);\n const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined | null>(fieldValue as EntityReference | EntityReference[] | undefined | null);\n\n const selectedEntityIds = internalValue\n ? (Array.isArray(internalValue) ? internalValue.map((ref) => {\n if (!(ref?.isEntityReference && ref?.isEntityReference())) {\n return null;\n }\n return ref.id;\n }).filter(Boolean) as string[] : [internalValue.id])\n : [];\n\n function updateFilter(op: VirtualTableWhereFilterOp, val?: EntityReference | EntityReference[] | null) {\n\n const prevOpIsArray = multipleSelectOperations.includes(operation);\n const newOpIsArray = multipleSelectOperations.includes(op);\n let newValue = val;\n if (prevOpIsArray !== newOpIsArray) {\n newValue = newOpIsArray\n ? (newValue && !Array.isArray(newValue) && newValue.isEntityReference?.() ? [newValue] : [])\n : undefined;\n }\n\n setOperation(op);\n setInternalValue(newValue);\n\n // A null check takes no operand, so it is complete on its own — the\n // value gate below would otherwise clear the filter the moment one is\n // chosen from the dropdown, where there is no value to accompany it.\n if (isNullFilterOperator(op)) {\n setValue([op, null]);\n return;\n }\n\n const hasNewValue = newValue !== null && Array.isArray(newValue)\n ? newValue.length > 0\n : newValue !== undefined;\n if (op && hasNewValue) {\n setValue(\n [op, newValue]\n );\n } else {\n setValue(\n undefined\n );\n }\n }\n\n const collectionRegistryController = useCollectionRegistryController();\n const { toCollectionPath, referenceTo } = useReferencePaths();\n const collectionPath = path ? toCollectionPath(path) : undefined;\n const collection: AdminCollection | undefined = useMemo(() => {\n return collectionPath ? collectionRegistryController.getCollection(collectionPath) : undefined;\n }, [collectionPath]);\n\n // The filter compares against what is stored, so it carries the stored path.\n const onSingleEntitySelected = (entity: Entity<Record<string, unknown>>) => {\n updateFilter(operation, referenceTo(entity));\n };\n\n const onMultipleEntitiesSelected = (entities: Entity<Record<string, unknown>>[]) => {\n updateFilter(operation, entities.map(e => referenceTo(e)));\n };\n\n const multiple = multipleSelectOperations.includes(operation);\n const nullFiltered = isNullFilterOperator(operation);\n\n // The filters dialog renders every filterable property at once, and this\n // id was the literal string \"null-filter\" — so clicking any label toggled\n // whichever checkbox the document matched first, never the one clicked.\n const nullFilterId = useId();\n\n const referenceDialogController = useSelectionDialog({\n multiselect: multiple,\n path: collectionPath,\n collection,\n onSingleEntitySelected,\n onMultipleEntitiesSelected,\n selectedEntityIds,\n onClose: () => {\n setHidden(false);\n }\n }\n );\n\n const doOpenDialog = () => {\n setHidden(true);\n referenceDialogController.open();\n };\n\n const buildEntry = (reference: EntityReference) => {\n return (\n <ReferencePreview\n disabled={!path}\n previewProperties={previewProperties}\n size={\"medium\"}\n onClick={doOpenDialog}\n reference={reference}\n hover={true}\n includeId={includeId}\n includeEntityLink={false}\n />\n );\n };\n\n // All renderable operators were filtered out (engine/property narrowing).\n if (possibleOperations.length === 0) return null;\n\n return (\n\n <div className=\"flex w-full flex-row\">\n <div className=\"w-[100px]\">\n <Select value={operation}\n size={\"medium\"}\n fullWidth={true}\n onValueChange={(value) => {\n updateFilter(value as VirtualTableWhereFilterOp, internalValue);\n }}\n renderValue={(op) => operationLabels[op as keyof typeof operationLabels]}>\n {possibleOperations.map((op) => (\n <SelectItem key={op} value={op}>\n {operationLabels[op]}\n </SelectItem>\n ))}\n </Select>\n </div>\n\n <div className=\"grow ml-2 h-full gap-2 flex flex-col\">\n\n {internalValue && Array.isArray(internalValue) && <div>\n {internalValue.map((ref, index) => buildEntry(ref))}\n </div>}\n\n {internalValue && !Array.isArray(internalValue) && <div>\n {buildEntry(internalValue)}\n </div>}\n\n {(!internalValue || (Array.isArray(internalValue) && internalValue.length === 0)) &&\n <Button onClick={doOpenDialog}\n\n size={\"medium\"}\n className=\"h-full w-full\">\n {multiple ? t(\"select_references\") : t(\"select_reference\")}\n </Button>\n }\n\n {/*\n * Switches the operator to the matching null check rather\n * than pairing a null value with whatever operator is\n * selected. Only the operator travels to the driver, and a\n * null *operand* means different things to different ones —\n * Mongo rejects `$in: null` outright. See\n * `nullFilterOperatorFor`.\n */}\n {!isArray && <Label\n className=\"border border-hairline cursor-pointer rounded-md p-2 flex items-center gap-2 bg-surface-field hover:bg-surface-field-hover\"\n htmlFor={nullFilterId}\n >\n <Checkbox id={nullFilterId}\n checked={nullFiltered}\n size={\"small\"}\n onCheckedChange={() => {\n if (!nullFiltered) updateFilter(nullFilterOperatorFor(operation), null);\n else updateFilter(valueOperatorFor(operation, possibleOperations) ?? operation, undefined);\n }}/>\n {t(\"filter_for_null_values\")}\n </Label>}\n\n </div>\n\n </div>\n );\n\n}\n"],"mappings":";;;;;;;;;;AAgCA,IAAM,kBAAkB;CACpB,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,IAAI;CACJ,UAAU;CACV,kBAAkB;CAClB,sBAAsB;CACtB,WAAW;CACX,eAAe;AACnB;AAEA,IAAM,2BAA2B;CAAC;CAAsB;CAAM;AAAQ;AAEtE,SAAgB,qBAAqB,EACjC,OACA,UACA,SACA,MACA,YAAY,MACZ,mBACA,WACA,aAC0B;CAC1B,MAAM,EAAE,MAAM,eAAe;CAE7B,IAAI,qBAAuD,UACrD,CAAC,gBAAgB,IACjB;EAAC;EAAM;EAAM;EAAK;EAAK;EAAM;CAAI;CAEvC,IAAI,SACA,mBAAmB,KAAK,oBAAoB;MAE5C,mBAAmB,KAAK,MAAM,QAAQ;CAI1C,mBAAmB,KAAK,WAAW,aAAa;CAEhD,IAAI,WACA,qBAAqB,mBAAmB,QAAO,OAAO,UAAgC,SAAS,EAAE,CAAC;CAGtG,MAAM,CAAC,gBAAgB,cAAc,SAAS,CAAC,mBAAm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mB,IAAI,EAAE,kBAAkB;IACrD,CAAA;IAWX,CAAC,WAAW,qBAAC,OAAD;KACT,WAAU;KACV,SAAS;eAFA,CAIT,oBAAC,UAAD;MAAU,IAAI;MACV,SAAS;MACT,MAAM;MACN,uBAAuB;OACnB,IAAI,CAAC,cAAc,aAAa,sBAAsB,SAAS,GAAG,IAAI;YACjE,aAAa,iBAAiB,WAAW,kBAAkB,KAAK,WAAW,KAAA,CAAS;MAC7F;KAAG,CAAA,GACN,EAAE,wBAAwB,CACxB;;GAEN;IAEJ;;AAGb"}
|
|
1
|
+
{"version":3,"file":"ReferenceFilterField.js","names":[],"sources":["../../../../src/components/SelectableTable/filters/ReferenceFilterField.tsx"],"sourcesContent":["import { useEntitySelectionDialog } from \"../../../hooks/useSelectionDialog\";\n\nimport React, { useId, useMemo, useState } from \"react\";\nimport { VirtualTableWhereFilterOp } from \"@rebasepro/ui\";\nimport { Entity, EntityReference } from \"@rebasepro/types\";\nimport { ReferencePreview } from \"../../../preview\";\nimport { Button, Checkbox, Label, Select, SelectItem } from \"@rebasepro/ui\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport { useCollectionRegistryController } from \"../../../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useReferencePaths } from \"../../../hooks/useReferencePaths\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\nimport { isNullFilterOperator, nullFilterOperatorFor, valueOperatorFor } from \"./null_filter\";\n\ninterface ReferenceFilterFieldProps {\n name: string,\n value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];\n setValue: (filterValue?: [VirtualTableWhereFilterOp, unknown]) => void;\n isArray?: boolean;\n path?: string;\n title?: string;\n includeId?: boolean;\n previewProperties?: string[];\n hidden: boolean;\n setHidden: (hidden: boolean) => void;\n /**\n * Restrict the offered operators (already resolved against engine\n * capabilities and property config). When omitted, all operators this\n * field can render are offered.\n */\n operators?: readonly VirtualTableWhereFilterOp[];\n}\n\nconst operationLabels = {\n \"==\": \"==\",\n \"!=\": \"!=\",\n \">\": \">\",\n \"<\": \"<\",\n \">=\": \">=\",\n \"<=\": \"<=\",\n in: \"In\",\n \"not-in\": \"Not in\",\n \"array-contains\": \"Contains\",\n \"array-contains-any\": \"Contains Any\",\n \"is-null\": \"Is null\",\n \"is-not-null\": \"Is not null\"\n};\n\nconst multipleSelectOperations = [\"array-contains-any\", \"in\", \"not-in\"];\n\nexport function ReferenceFilterField({\n value,\n setValue,\n isArray,\n path,\n includeId = true,\n previewProperties,\n setHidden,\n operators\n}: ReferenceFilterFieldProps) {\n const { t } = useTranslation();\n\n let possibleOperations: (keyof typeof operationLabels)[] = isArray\n ? [\"array-contains\"]\n : [\"==\", \"!=\", \">\", \"<\", \">=\", \"<=\"];\n\n if (isArray) {\n possibleOperations.push(\"array-contains-any\");\n } else {\n possibleOperations.push(\"in\", \"not-in\");\n }\n\n // The null checks take no operand, so they apply either way.\n possibleOperations.push(\"is-null\", \"is-not-null\");\n\n if (operators) {\n possibleOperations = possibleOperations.filter(op => (operators as readonly string[]).includes(op));\n }\n\n const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];\n const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);\n const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined | null>(fieldValue as EntityReference | EntityReference[] | undefined | null);\n\n const selectedEntityIds = internalValue\n ? (Array.isArray(internalValue) ? internalValue.map((ref) => {\n if (!(ref?.isEntityReference && ref?.isEntityReference())) {\n return null;\n }\n return ref.id;\n }).filter(Boolean) as string[] : [internalValue.id])\n : [];\n\n function updateFilter(op: VirtualTableWhereFilterOp, val?: EntityReference | EntityReference[] | null) {\n\n const prevOpIsArray = multipleSelectOperations.includes(operation);\n const newOpIsArray = multipleSelectOperations.includes(op);\n let newValue = val;\n if (prevOpIsArray !== newOpIsArray) {\n newValue = newOpIsArray\n ? (newValue && !Array.isArray(newValue) && newValue.isEntityReference?.() ? [newValue] : [])\n : undefined;\n }\n\n setOperation(op);\n setInternalValue(newValue);\n\n // A null check takes no operand, so it is complete on its own — the\n // value gate below would otherwise clear the filter the moment one is\n // chosen from the dropdown, where there is no value to accompany it.\n if (isNullFilterOperator(op)) {\n setValue([op, null]);\n return;\n }\n\n const hasNewValue = newValue !== null && Array.isArray(newValue)\n ? newValue.length > 0\n : newValue !== undefined;\n if (op && hasNewValue) {\n setValue(\n [op, newValue]\n );\n } else {\n setValue(\n undefined\n );\n }\n }\n\n const collectionRegistryController = useCollectionRegistryController();\n const { toCollectionPath, referenceTo } = useReferencePaths();\n const collectionPath = path ? toCollectionPath(path) : undefined;\n const collection: AdminCollection | undefined = useMemo(() => {\n return collectionPath ? collectionRegistryController.getCollection(collectionPath) : undefined;\n }, [collectionPath]);\n\n // The filter compares against what is stored, so it carries the stored path.\n const onSingleEntitySelected = (entity: Entity<Record<string, unknown>>) => {\n updateFilter(operation, referenceTo(entity));\n };\n\n const onMultipleEntitiesSelected = (entities: Entity<Record<string, unknown>>[]) => {\n updateFilter(operation, entities.map(e => referenceTo(e)));\n };\n\n const multiple = multipleSelectOperations.includes(operation);\n const nullFiltered = isNullFilterOperator(operation);\n\n // The filters dialog renders every filterable property at once, and this\n // id was the literal string \"null-filter\" — so clicking any label toggled\n // whichever checkbox the document matched first, never the one clicked.\n const nullFilterId = useId();\n\n const referenceDialogController = useEntitySelectionDialog({\n multiselect: multiple,\n path: collectionPath,\n collection,\n onSingleEntitySelected,\n onMultipleEntitiesSelected,\n selectedEntityIds,\n onClose: () => {\n setHidden(false);\n }\n }\n );\n\n const doOpenDialog = () => {\n setHidden(true);\n referenceDialogController.open();\n };\n\n const buildEntry = (reference: EntityReference) => {\n return (\n <ReferencePreview\n disabled={!path}\n previewProperties={previewProperties}\n size={\"medium\"}\n onClick={doOpenDialog}\n reference={reference}\n hover={true}\n includeId={includeId}\n includeEntityLink={false}\n />\n );\n };\n\n // All renderable operators were filtered out (engine/property narrowing).\n if (possibleOperations.length === 0) return null;\n\n return (\n\n <div className=\"flex w-full flex-row\">\n <div className=\"w-[100px]\">\n <Select value={operation}\n size={\"medium\"}\n fullWidth={true}\n onValueChange={(value) => {\n updateFilter(value as VirtualTableWhereFilterOp, internalValue);\n }}\n renderValue={(op) => operationLabels[op as keyof typeof operationLabels]}>\n {possibleOperations.map((op) => (\n <SelectItem key={op} value={op}>\n {operationLabels[op]}\n </SelectItem>\n ))}\n </Select>\n </div>\n\n <div className=\"grow ml-2 h-full gap-2 flex flex-col\">\n\n {internalValue && Array.isArray(internalValue) && <div>\n {internalValue.map((ref, index) => buildEntry(ref))}\n </div>}\n\n {internalValue && !Array.isArray(internalValue) && <div>\n {buildEntry(internalValue)}\n </div>}\n\n {(!internalValue || (Array.isArray(internalValue) && internalValue.length === 0)) &&\n <Button onClick={doOpenDialog}\n\n size={\"medium\"}\n className=\"h-full w-full\">\n {multiple ? t(\"select_references\") : t(\"select_reference\")}\n </Button>\n }\n\n {/*\n * Switches the operator to the matching null check rather\n * than pairing a null value with whatever operator is\n * selected. Only the operator travels to the driver, and a\n * null *operand* means different things to different ones —\n * Mongo rejects `$in: null` outright. See\n * `nullFilterOperatorFor`.\n */}\n {!isArray && <Label\n className=\"border border-hairline cursor-pointer rounded-md p-2 flex items-center gap-2 bg-surface-field hover:bg-surface-field-hover\"\n htmlFor={nullFilterId}\n >\n <Checkbox id={nullFilterId}\n checked={nullFiltered}\n size={\"small\"}\n onCheckedChange={() => {\n if (!nullFiltered) updateFilter(nullFilterOperatorFor(operation), null);\n else updateFilter(valueOperatorFor(operation, possibleOperations) ?? operation, undefined);\n }}/>\n {t(\"filter_for_null_values\")}\n </Label>}\n\n </div>\n\n </div>\n );\n\n}\n"],"mappings":";;;;;;;;;;AAgCA,IAAM,kBAAkB;CACpB,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,IAAI;CACJ,UAAU;CACV,kBAAkB;CAClB,sBAAsB;CACtB,WAAW;CACX,eAAe;AACnB;AAEA,IAAM,2BAA2B;CAAC;CAAs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eACvB,gBAAgB;IACT,GAFK,EAEL,CACf;GACG,CAAA;EACP,CAAA,GAEL,qBAAC,OAAD;GAAK,WAAU;aAAf;IAEK,iBAAiB,MAAM,QAAQ,aAAa,KAAK,oBAAC,OAAD,EAAA,UAC7C,cAAc,KAAK,KAAK,UAAU,WAAW,GAAG,CAAC,EACjD,CAAA;IAEJ,iBAAiB,CAAC,MAAM,QAAQ,aAAa,KAAK,oBAAC,OAAD,EAAA,UAC9C,WAAW,aAAa,EACxB,CAAA;KAEH,CAAC,iBAAkB,MAAM,QAAQ,aAAa,KAAK,cAAc,WAAW,MAC1E,oBAAC,QAAD;KAAQ,SAAS;KAEb,MAAM;KACN,WAAU;eACT,WAAW,EAAE,mBAAmB,IAAI,EAAE,kBAAkB;IACrD,CAAA;IAWX,CAAC,WAAW,qBAAC,OAAD;KACT,WAAU;KACV,SAAS;eAFA,CAIT,oBAAC,UAAD;MAAU,IAAI;MACV,SAAS;MACT,MAAM;MACN,uBAAuB;OACnB,IAAI,CAAC,cAAc,aAAa,sBAAsB,SAAS,GAAG,IAAI;YACjE,aAAa,iBAAiB,WAAW,kBAAkB,KAAK,WAAW,KAAA,CAAS;MAC7F;KAAG,CAAA,GACN,EAAE,wBAAwB,CACxB;;GAEN;IAEJ;;AAGb"}
|
|
@@ -21,7 +21,7 @@ import { useNavigate } from "react-router";
|
|
|
21
21
|
*/
|
|
22
22
|
function SidePanelBinding(props) {
|
|
23
23
|
const { t } = useTranslation();
|
|
24
|
-
const { allowFullScreen = true, path, entityId, selectedTab, formProps } = props;
|
|
24
|
+
const { allowFullScreen = true, path, id: entityId, selectedTab, formProps } = props;
|
|
25
25
|
const ResolvedDetailView = useComponentOverride("DetailView", DetailViewBinding);
|
|
26
26
|
const { blocked, setBlocked, setBlockedNavigationMessage, close } = useSideDialogContext();
|
|
27
27
|
const navigate = useNavigate();
|
|
@@ -65,25 +65,25 @@ function SidePanelBinding(props) {
|
|
|
65
65
|
* intent. Closing wins by construction now: moving a panel to a new address
|
|
66
66
|
* it is about to leave is work whose only effect is to fight the close.
|
|
67
67
|
*
|
|
68
|
-
* `props.
|
|
68
|
+
* `props.onSaved` runs last for the same reason. It belongs to whoever
|
|
69
69
|
* opened the panel and it is free to navigate — the reference picker's
|
|
70
70
|
* selects the record and closes the picker — so the opener's intent should
|
|
71
71
|
* be the final word, not something this panel overwrites on its way out.
|
|
72
72
|
*/
|
|
73
|
-
const
|
|
73
|
+
const onSaved = (params) => {
|
|
74
74
|
setEditInDialog(false);
|
|
75
75
|
if (sideDialogsController.pendingClose || props.closeOnSave) {
|
|
76
76
|
sideDialogsController.setPendingClose(false);
|
|
77
77
|
closeAfterSave();
|
|
78
78
|
} else if (params.status !== "existing") sidePanelController.replace({
|
|
79
79
|
path: params.path,
|
|
80
|
-
|
|
80
|
+
id: params.id,
|
|
81
81
|
selectedTab: params.selectedTab,
|
|
82
82
|
updateUrl: collection?.openEntityMode !== "dialog",
|
|
83
83
|
collection: params.collection
|
|
84
84
|
});
|
|
85
85
|
else closeEditView();
|
|
86
|
-
props.
|
|
86
|
+
props.onSaved?.(params);
|
|
87
87
|
};
|
|
88
88
|
const parentCollectionSlugs = useMemo(() => {
|
|
89
89
|
return collectionRegistryController.getParentCollectionSlugs(path);
|
|
@@ -106,7 +106,7 @@ function SidePanelBinding(props) {
|
|
|
106
106
|
}
|
|
107
107
|
sidePanelController.replace({
|
|
108
108
|
path,
|
|
109
|
-
entityId,
|
|
109
|
+
id: entityId,
|
|
110
110
|
selectedTab: "edit",
|
|
111
111
|
updateUrl: true,
|
|
112
112
|
collection
|
|
@@ -125,7 +125,7 @@ function SidePanelBinding(props) {
|
|
|
125
125
|
}
|
|
126
126
|
sidePanelController.replace({
|
|
127
127
|
path,
|
|
128
|
-
entityId,
|
|
128
|
+
id: entityId,
|
|
129
129
|
selectedTab: void 0,
|
|
130
130
|
updateUrl: true,
|
|
131
131
|
collection
|
|
@@ -147,13 +147,13 @@ function SidePanelBinding(props) {
|
|
|
147
147
|
if (!hasEntityId(entityId) || !collection?.defaultSelectedView) return;
|
|
148
148
|
const effectiveDefault = resolveDefaultSelectedView(collection.defaultSelectedView, {
|
|
149
149
|
status: "existing",
|
|
150
|
-
entityId
|
|
150
|
+
id: entityId
|
|
151
151
|
});
|
|
152
152
|
if (effectiveDefault && effectiveDefault !== "edit") {
|
|
153
153
|
hasCorrectedDefaultView.current = true;
|
|
154
154
|
sidePanelController.replace({
|
|
155
155
|
path,
|
|
156
|
-
entityId,
|
|
156
|
+
id: entityId,
|
|
157
157
|
selectedTab: effectiveDefault,
|
|
158
158
|
updateUrl: collection.openEntityMode !== "dialog",
|
|
159
159
|
collection
|
|
@@ -235,7 +235,7 @@ function SidePanelBinding(props) {
|
|
|
235
235
|
if (collection?.openEntityMode === "dialog" || paramCollection?.openEntityMode === "dialog") return;
|
|
236
236
|
if (tabEntityId) sidePanelController.replace({
|
|
237
237
|
path,
|
|
238
|
-
|
|
238
|
+
id: tabEntityId,
|
|
239
239
|
selectedTab,
|
|
240
240
|
updateUrl: true,
|
|
241
241
|
collection: paramCollection ?? collection
|
|
@@ -243,12 +243,13 @@ function SidePanelBinding(props) {
|
|
|
243
243
|
}
|
|
244
244
|
}) : /* @__PURE__ */ jsx(EditViewBinding, {
|
|
245
245
|
...props,
|
|
246
|
+
entityId,
|
|
246
247
|
layout: collection?.openEntityMode === "dialog" ? "dialog" : "side_panel",
|
|
247
248
|
collection,
|
|
248
249
|
parentCollectionSlugs,
|
|
249
250
|
parentEntityIds,
|
|
250
251
|
onValuesModified,
|
|
251
|
-
onSaved
|
|
252
|
+
onSaved,
|
|
252
253
|
navigateBack: closeEditView,
|
|
253
254
|
barActionsStart,
|
|
254
255
|
barActions: ({ carryEdit }) => windowControls(allowFullScreen && /* @__PURE__ */ jsx(IconButton, {
|
|
@@ -273,7 +274,7 @@ function SidePanelBinding(props) {
|
|
|
273
274
|
if (collection?.openEntityMode === "dialog" || paramCollection?.openEntityMode === "dialog") return;
|
|
274
275
|
if (tabEntityId) sidePanelController.replace({
|
|
275
276
|
path,
|
|
276
|
-
|
|
277
|
+
id: tabEntityId,
|
|
277
278
|
selectedTab,
|
|
278
279
|
updateUrl: true,
|
|
279
280
|
collection: paramCollection ?? collection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelBinding.js","names":[],"sources":["../../src/components/SidePanelBinding.tsx"],"sourcesContent":["\nimport type { SidePanelBindingProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport { hasEntityId } from \"@rebasepro/common\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport type { OnUpdateParams } from \"../types/components/EntityFormProps\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { IconButton, Maximize2Icon, XIcon } from \"@rebasepro/ui\";\nimport { EditViewBinding } from \"./EditViewBinding\";\nimport { DetailViewBinding } from \"./DetailViewBinding\";\nimport { useSideDialogContext } from \"./SideDialogs\";\nimport { useNavigate } from \"react-router\";\nimport { useComponentOverride, useTranslation } from \"@rebasepro/app\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { resolveDefaultSelectedView } from \"@rebasepro/app\";\n\n/**\n * This is the component in charge of rendering the side dialog used\n * for editing entities. Use the {@link useSidePanel} to open\n * and control the dialogs.\n * This component needs a parent {@link Rebase}\n * {@link useSidePanel}\n * @group Components\n */\nexport function SidePanelBinding(props: SidePanelBindingProps) {\n const { t } = useTranslation();\n\n const {\n allowFullScreen = true,\n path,\n entityId,\n selectedTab,\n formProps\n } = props;\n\n const ResolvedDetailView = useComponentOverride(\"DetailView\", DetailViewBinding);\n\n const {\n blocked,\n setBlocked,\n setBlockedNavigationMessage,\n close\n } = useSideDialogContext();\n\n const navigate = useNavigate();\n\n const sidePanelController = useSidePanel();\n const collectionRegistryController = useCollectionRegistryController();\n const sideDialogsController = useSideDialogContext();\n const urlController = useUrlController();\n\n /**\n * The X in the identity bar.\n *\n * Unforced, so it stops at the same unsaved-changes prompt that Escape and\n * a click outside already do. It used to clear `blocked` and force the\n * close, which made the one control actually labelled \"close\" the only way\n * out of the panel that dropped an edit without asking.\n *\n * `props.onClose` is not called here: the panel carries the same callback\n * (see `propsToSidePanel`) and {@link SideDialogs} fires it once the panel\n * really closes — which is after the prompt, not before it.\n */\n const onClose = () => {\n close();\n }\n\n /**\n * Closing because the record was just saved, which is the one case that has\n * to force. `blocked` is driven by an effect on the form's dirty flag and is\n * still true for a tick after a save; prompting about unsaved changes here\n * would be asking about values that are already on the server.\n */\n const closeAfterSave = () => {\n setBlocked(false);\n close(true);\n }\n\n /**\n * The panel's response to a save, and the one place it decides where the\n * panel goes next.\n *\n * Exactly **one** panel navigation is raised here. These branches used to\n * run independently — a `replace` onto the saved record's address *and* a\n * close — and because the last navigation is the one that survives, which\n * of them the user got was settled by statement order rather than by\n * intent. Closing wins by construction now: moving a panel to a new address\n * it is about to leave is work whose only effect is to fight the close.\n *\n * `props.onUpdate` runs last for the same reason. It belongs to whoever\n * opened the panel and it is free to navigate — the reference picker's\n * selects the record and closes the picker — so the opener's intent should\n * be the final word, not something this panel overwrites on its way out.\n */\n const onUpdate = (params: OnUpdateParams) => {\n setEditInDialog(false);\n\n // Either \"save and close\" was clicked, or the opener asked for it when\n // it opened the panel.\n const closeRequested = sideDialogsController.pendingClose || props.closeOnSave;\n\n if (closeRequested) {\n sideDialogsController.setPendingClose(false);\n closeAfterSave();\n } else if (params.status !== \"existing\") {\n // A newly created entity replaces the panel with its own address,\n // which already leaves the edit view behind.\n sidePanelController.replace({\n path: params.path,\n entityId: params.entityId,\n selectedTab: params.selectedTab,\n updateUrl: collection?.openEntityMode !== \"dialog\",\n collection: params.collection\n });\n } else {\n closeEditView();\n }\n\n props.onUpdate?.(params);\n }\n\n const parentCollectionSlugs = useMemo(() => {\n return collectionRegistryController.getParentCollectionSlugs(path);\n }, [collectionRegistryController, path]);\n\n const parentEntityIds = useMemo(() => {\n return collectionRegistryController.getParentEntityIds(path);\n }, [collectionRegistryController, path]);\n\n const collection = collectionRegistryController.getCollection(path) ?? props.collection;\n\n // Dialog mode deliberately stays out of the URL, so it is the only case that\n // needs local edit state. Everywhere else `edit` is a path segment, which\n // keeps refresh and the back button working the same way they do in split.\n const isDialogMode = collection?.openEntityMode === \"dialog\";\n const [editInDialog, setEditInDialog] = useState(false);\n const showEditInPanel = isDialogMode ? editInDialog : selectedTab === \"edit\";\n const isDetailMode = collection?.defaultEntityAction === \"view\" && !showEditInPanel && hasEntityId(entityId);\n\n // Reset edit mode when switching entities\n useEffect(() => {\n setEditInDialog(false);\n }, [entityId]);\n\n const openEditView = useCallback(() => {\n if (isDialogMode || !hasEntityId(entityId)) {\n setEditInDialog(true);\n return;\n }\n sidePanelController.replace({\n path,\n entityId,\n selectedTab: \"edit\",\n updateUrl: true,\n collection\n });\n }, [isDialogMode, entityId, path, collection, sidePanelController]);\n\n const closeEditView = useCallback(() => {\n if (isDialogMode || !hasEntityId(entityId)) {\n setEditInDialog(false);\n return;\n }\n sidePanelController.replace({\n path,\n entityId,\n selectedTab: undefined,\n updateUrl: true,\n collection\n });\n }, [isDialogMode, entityId, path, collection, sidePanelController]);\n\n // One-time correction: when the side panel opens without the correct\n // selectedTab but the resolved collection (from the registry) has a\n // defaultSelectedView, update the panel width and URL to match.\n // This handles cases where defaultSelectedView is set via the collection\n // editor / Studio and is not available on the collection object the\n // caller passed to sidePanelController.open().\n const hasCorrectedDefaultView = useRef(false);\n useEffect(() => {\n hasCorrectedDefaultView.current = false;\n }, [entityId]);\n useEffect(() => {\n if (hasCorrectedDefaultView.current) return;\n if (selectedTab) return; // Already has a tab — no correction needed\n if (!hasEntityId(entityId) || !collection?.defaultSelectedView) return;\n\n const effectiveDefault = resolveDefaultSelectedView(\n collection.defaultSelectedView,\n { status: \"existing\",\nentityId }\n );\n if (effectiveDefault && effectiveDefault !== \"edit\") {\n hasCorrectedDefaultView.current = true;\n sidePanelController.replace({\n path,\n entityId,\n selectedTab: effectiveDefault,\n updateUrl: collection.openEntityMode !== \"dialog\",\n collection\n });\n }\n }, [selectedTab, entityId, collection, path, sidePanelController]);\n\n // Note: beforeunload is handled by useUnsavedChangesDialog in SideDialogView,\n // which listens to the same `blocked` state via SideDialogContext.\n\n const onValuesModified = useCallback((modified: boolean) => {\n setBlockedNavigationMessage(modified\n ? <> You have unsaved changes in this <b>{collection?.singularName ?? collection?.name}</b>.</>\n : undefined)\n setBlocked(modified);\n }, [collection?.name, setBlocked, setBlockedNavigationMessage]);\n\n if (!props || !collection) {\n return <div className={\"w-full\"}/>;\n }\n\n const closeButton = (\n <IconButton aria-label={t(\"close\")}\n className=\"self-center\"\n size={\"small\"}\n onClick={onClose}>\n <XIcon/>\n </IconButton>\n );\n\n /**\n * Where the panel's own two controls sit, which is not the same question in\n * the two layouts that have them.\n *\n * A **side panel** slides in over the list from the right, and its leading\n * edge is the seam between the two. Close belongs on that seam — it points\n * back at the thing still visible behind it — and it is where the eye\n * already is, because the breadcrumb starts there.\n *\n * A **dialog** has no seam and nothing behind it to point at. It is a box\n * centred on a dimmed screen, and every box like it on every platform is\n * dismissed from its top-right corner. Close was sitting at the far left\n * of the bar, a full dialog's width from the expand button it belongs\n * beside, in the one corner that means \"back\" in a layout with no back.\n *\n * So in a dialog the two travel together at the trailing edge, expand then\n * close: the window controls, after the record's actions and its overflow\n * menu, in the corner a dialog is closed from.\n */\n const barActionsStart = isDialogMode ? undefined : closeButton;\n\n const windowControls = (expandButton: React.ReactNode) => (\n <div className=\"flex gap-1 items-center\">\n {expandButton}\n {isDialogMode && closeButton}\n </div>\n );\n\n return (\n <>\n <ErrorBoundary>\n {isDetailMode\n ? <ResolvedDetailView\n path={path}\n layout={collection?.openEntityMode === \"dialog\" ? \"dialog\" : \"side_panel\"}\n collection={collection as AdminCollection}\n entityId={entityId!}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n onEditClick={openEditView}\n barActionsStart={barActionsStart}\n barActions={() => windowControls(\n allowFullScreen && <IconButton aria-label={t(\"full_screen\")}\n className=\"self-center\"\n size={\"small\"}\n onClick={() => {\n if (hasEntityId(entityId)) {\n const fullScreenUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}`);\n navigate(fullScreenUrl, { state: null });\n }\n }}>\n <Maximize2Icon/>\n </IconButton>\n )}\n onTabChange={({\n entityId: tabEntityId,\n selectedTab,\n collection: paramCollection\n }) => {\n if (collection?.openEntityMode === \"dialog\" || paramCollection?.openEntityMode === \"dialog\") {\n return;\n }\n if (tabEntityId) {\n sidePanelController.replace({\n path,\n entityId: tabEntityId,\n selectedTab,\n updateUrl: true,\n collection: paramCollection ?? collection\n });\n }\n }}\n />\n : <EditViewBinding\n {...props}\n layout={collection?.openEntityMode === \"dialog\" ? \"dialog\" : \"side_panel\"}\n collection={collection as AdminCollection}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n onValuesModified={onValuesModified}\n onSaved={onUpdate}\n navigateBack={closeEditView}\n barActionsStart={barActionsStart}\n barActions={({ carryEdit }) => windowControls(\n allowFullScreen && <IconButton aria-label={t(\"full_screen\")}\n className=\"self-center\"\n size={\"small\"}\n onClick={() => {\n // The form's own handoff, rather than a second\n // copy of the rules for it here: only an edit in\n // progress is worth carrying (a clean record\n // stashed anyway arrived announcing unsaved\n // changes to someone who had only looked at it),\n // and only the fields that were edited (carrying\n // the whole record marked every field touched).\n carryEdit?.();\n setBlocked(false);\n setBlockedNavigationMessage(undefined);\n if (hasEntityId(entityId)) {\n const fullScreenUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}`);\n navigate(fullScreenUrl, { state: null });\n } else {\n const fullScreenUrl = urlController.buildUrlCollectionPath(path);\n navigate(fullScreenUrl + \"#new\", { state: null });\n }\n }}>\n <Maximize2Icon/>\n </IconButton>\n )}\n onTabChange={({\n entityId: tabEntityId,\n selectedTab,\n collection: paramCollection\n }) => {\n if (collection?.openEntityMode === \"dialog\" || paramCollection?.openEntityMode === \"dialog\") {\n return;\n }\n if (tabEntityId) {\n sidePanelController.replace({\n path,\n entityId: tabEntityId,\n selectedTab,\n updateUrl: true,\n collection: paramCollection ?? collection\n });\n }\n }}\n formProps={formProps}\n />\n }\n </ErrorBoundary>\n\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,iBAAiB,OAA8B;CAC3D,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,EACF,kBAAkB,MAClB,MACA,UACA,aACA,cACA;CAEJ,MAAM,qBAAqB,qBAAqB,cAAc,iBAAiB;CAE/E,MAAM,EACF,SACA,YACA,6BACA,UACA,qBAAqB;CAEzB,MAAM,WAAW,YAAY;CAE7B,MAAM,sBAAsB,aAAa;CACzC,MAAM,+BAA+B,gCAAgC;CACrE,MAAM,wBAAwB,qBAAqB;CACnD,MAAM,gBAAgB,iBAAiB;;;;;;;;;;;;;CAcvC,MAAM,gBAAgB;EAClB,MAAM;CACV;;;;;;;CAQA,MAAM,uBAAuB;EACzB,WAAW,KAAK;EAChB,MAAM,IAAI;CACd;;;;;;;;;;;;;;;;;CAkBA,MAAM,YAAY,WAA2B;EACzC,gBAAgB,KAAK;EAMrB,IAFuB,sBAAsB,gBAAgB,MAAM,aAE/C;GAChB,sBAAsB,gBAAgB,KAAK;GAC3C,eAAe;EACnB,OAAO,IAAI,OAAO,WAAW,YAGzB,oBAAoB,QAAQ;GACxB,MAAM,OAAO;GACb,UAAU,OAAO;GACjB,aAAa,OAAO;GACpB,WAAW,YAAY,mBAAmB;GAC1C,YAAY,OAAO;EACvB,CAAC;OAED,cAAc;EAGlB,MAAM,WAAW,MAAM;CAC3B;CAEA,MAAM,wBAAwB,cAAc;EACxC,OAAO,6BAA6B,yBAAyB,IAAI;CACrE,GAAG,CAAC,8BAA8B,IAAI,CAAC;CAEvC,MAAM,kBAAkB,cAAc;EAClC,OAAO,6BAA6B,mBAAmB,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AAmB,UAC/E;GAEJ,IAAI,aACA,oBAAoB,QAAQ;IACxB;IACA,UAAU;IACV;IACA,WAAW;IACX,YAAY,mBAAmB;GACnC,CAAC;EAET;CACH,CAAA,IACC,oBAAC,iBAAD;EACE,GAAI;EACJ,QAAQ,YAAY,mBAAmB,WAAW,WAAW;EACjD;EACW;EAAwC;EAC7C;EAClB,SAAS;EACT,cAAc;EACG;EACjB,aAAa,EAAE,gBAAgB,eAC3B,mBAAmB,oBAAC,YAAD;GAAY,cAAY,EAAE,aAAa;GACtD,WAAU;GACV,MAAM;GACN,eAAe;IAQX,YAAY;IACZ,WAAW,KAAK;IAChB,4BAA4B,KAAA,CAAS;IACrC,IAAI,YAAY,QAAQ,GAAG;KACvB,MAAM,gBAAgB,cAAc,uBAAuB,GAAG,KAAK,GAAG,UAAU;KAChF,SAAS,eAAe,EAAE,OAAO,KAAK,CAAC;IAC3C,OAAO;KACH,MAAM,gBAAgB,cAAc,uBAAuB,IAAI;KAC/D,SAAS,gBAAgB,QAAQ,EAAE,OAAO,KAAK,CAAC;IACpD;GACJ;aACA,oBAAC,eAAD,CAAe,CAAA;EACP,CAAA,CAChB;EACA,cAAc,EACV,UAAU,aACV,aACA,YAAY,sBACV;GACF,IAAI,YAAY,mBAAmB,YAAY,iBAAiB,mBAAmB,UAC/E;GAEJ,IAAI,aACA,oBAAoB,QAAQ;IACxB;IACA,UAAU;IACV;IACA,WAAW;IACX,YAAY,mBAAmB;GACnC,CAAC;EAET;EACW;CACd,CAAA,EAEM,CAAA,EAEjB,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"SidePanelBinding.js","names":[],"sources":["../../src/components/SidePanelBinding.tsx"],"sourcesContent":["\nimport type { SidePanelBindingProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport { hasEntityId } from \"@rebasepro/common\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport type { OnSavedParams } from \"../types/components/EntityFormProps\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { IconButton, Maximize2Icon, XIcon } from \"@rebasepro/ui\";\nimport { EditViewBinding } from \"./EditViewBinding\";\nimport { DetailViewBinding } from \"./DetailViewBinding\";\nimport { useSideDialogContext } from \"./SideDialogs\";\nimport { useNavigate } from \"react-router\";\nimport { useComponentOverride, useTranslation } from \"@rebasepro/app\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { useUrlController } from \"../hooks/navigation/contexts/UrlContext\";\nimport { resolveDefaultSelectedView } from \"@rebasepro/app\";\n\n/**\n * This is the component in charge of rendering the side dialog used\n * for editing entities. Use the {@link useSidePanel} to open\n * and control the dialogs.\n * This component needs a parent {@link Rebase}\n * {@link useSidePanel}\n * @group Components\n */\nexport function SidePanelBinding(props: SidePanelBindingProps) {\n const { t } = useTranslation();\n\n const {\n allowFullScreen = true,\n path,\n id: entityId,\n selectedTab,\n formProps\n } = props;\n\n const ResolvedDetailView = useComponentOverride(\"DetailView\", DetailViewBinding);\n\n const {\n blocked,\n setBlocked,\n setBlockedNavigationMessage,\n close\n } = useSideDialogContext();\n\n const navigate = useNavigate();\n\n const sidePanelController = useSidePanel();\n const collectionRegistryController = useCollectionRegistryController();\n const sideDialogsController = useSideDialogContext();\n const urlController = useUrlController();\n\n /**\n * The X in the identity bar.\n *\n * Unforced, so it stops at the same unsaved-changes prompt that Escape and\n * a click outside already do. It used to clear `blocked` and force the\n * close, which made the one control actually labelled \"close\" the only way\n * out of the panel that dropped an edit without asking.\n *\n * `props.onClose` is not called here: the panel carries the same callback\n * (see `propsToSidePanel`) and {@link SideDialogs} fires it once the panel\n * really closes — which is after the prompt, not before it.\n */\n const onClose = () => {\n close();\n }\n\n /**\n * Closing because the record was just saved, which is the one case that has\n * to force. `blocked` is driven by an effect on the form's dirty flag and is\n * still true for a tick after a save; prompting about unsaved changes here\n * would be asking about values that are already on the server.\n */\n const closeAfterSave = () => {\n setBlocked(false);\n close(true);\n }\n\n /**\n * The panel's response to a save, and the one place it decides where the\n * panel goes next.\n *\n * Exactly **one** panel navigation is raised here. These branches used to\n * run independently — a `replace` onto the saved record's address *and* a\n * close — and because the last navigation is the one that survives, which\n * of them the user got was settled by statement order rather than by\n * intent. Closing wins by construction now: moving a panel to a new address\n * it is about to leave is work whose only effect is to fight the close.\n *\n * `props.onSaved` runs last for the same reason. It belongs to whoever\n * opened the panel and it is free to navigate — the reference picker's\n * selects the record and closes the picker — so the opener's intent should\n * be the final word, not something this panel overwrites on its way out.\n */\n const onSaved = (params: OnSavedParams) => {\n setEditInDialog(false);\n\n // Either \"save and close\" was clicked, or the opener asked for it when\n // it opened the panel.\n const closeRequested = sideDialogsController.pendingClose || props.closeOnSave;\n\n if (closeRequested) {\n sideDialogsController.setPendingClose(false);\n closeAfterSave();\n } else if (params.status !== \"existing\") {\n // A newly created entity replaces the panel with its own address,\n // which already leaves the edit view behind.\n sidePanelController.replace({\n path: params.path,\n id: params.id,\n selectedTab: params.selectedTab,\n updateUrl: collection?.openEntityMode !== \"dialog\",\n collection: params.collection\n });\n } else {\n closeEditView();\n }\n\n props.onSaved?.(params);\n }\n\n const parentCollectionSlugs = useMemo(() => {\n return collectionRegistryController.getParentCollectionSlugs(path);\n }, [collectionRegistryController, path]);\n\n const parentEntityIds = useMemo(() => {\n return collectionRegistryController.getParentEntityIds(path);\n }, [collectionRegistryController, path]);\n\n const collection = collectionRegistryController.getCollection(path) ?? props.collection;\n\n // Dialog mode deliberately stays out of the URL, so it is the only case that\n // needs local edit state. Everywhere else `edit` is a path segment, which\n // keeps refresh and the back button working the same way they do in split.\n const isDialogMode = collection?.openEntityMode === \"dialog\";\n const [editInDialog, setEditInDialog] = useState(false);\n const showEditInPanel = isDialogMode ? editInDialog : selectedTab === \"edit\";\n const isDetailMode = collection?.defaultEntityAction === \"view\" && !showEditInPanel && hasEntityId(entityId);\n\n // Reset edit mode when switching entities\n useEffect(() => {\n setEditInDialog(false);\n }, [entityId]);\n\n const openEditView = useCallback(() => {\n if (isDialogMode || !hasEntityId(entityId)) {\n setEditInDialog(true);\n return;\n }\n sidePanelController.replace({\n path,\n id: entityId,\n selectedTab: \"edit\",\n updateUrl: true,\n collection\n });\n }, [isDialogMode, entityId, path, collection, sidePanelController]);\n\n const closeEditView = useCallback(() => {\n if (isDialogMode || !hasEntityId(entityId)) {\n setEditInDialog(false);\n return;\n }\n sidePanelController.replace({\n path,\n id: entityId,\n selectedTab: undefined,\n updateUrl: true,\n collection\n });\n }, [isDialogMode, entityId, path, collection, sidePanelController]);\n\n // One-time correction: when the side panel opens without the correct\n // selectedTab but the resolved collection (from the registry) has a\n // defaultSelectedView, update the panel width and URL to match.\n // This handles cases where defaultSelectedView is set via the collection\n // editor / Studio and is not available on the collection object the\n // caller passed to sidePanelController.open().\n const hasCorrectedDefaultView = useRef(false);\n useEffect(() => {\n hasCorrectedDefaultView.current = false;\n }, [entityId]);\n useEffect(() => {\n if (hasCorrectedDefaultView.current) return;\n if (selectedTab) return; // Already has a tab — no correction needed\n if (!hasEntityId(entityId) || !collection?.defaultSelectedView) return;\n\n const effectiveDefault = resolveDefaultSelectedView(\n collection.defaultSelectedView,\n { status: \"existing\", id: entityId }\n );\n if (effectiveDefault && effectiveDefault !== \"edit\") {\n hasCorrectedDefaultView.current = true;\n sidePanelController.replace({\n path,\n id: entityId,\n selectedTab: effectiveDefault,\n updateUrl: collection.openEntityMode !== \"dialog\",\n collection\n });\n }\n }, [selectedTab, entityId, collection, path, sidePanelController]);\n\n // Note: beforeunload is handled by useUnsavedChangesDialog in SideDialogView,\n // which listens to the same `blocked` state via SideDialogContext.\n\n const onValuesModified = useCallback((modified: boolean) => {\n setBlockedNavigationMessage(modified\n ? <> You have unsaved changes in this <b>{collection?.singularName ?? collection?.name}</b>.</>\n : undefined)\n setBlocked(modified);\n }, [collection?.name, setBlocked, setBlockedNavigationMessage]);\n\n if (!props || !collection) {\n return <div className={\"w-full\"}/>;\n }\n\n const closeButton = (\n <IconButton aria-label={t(\"close\")}\n className=\"self-center\"\n size={\"small\"}\n onClick={onClose}>\n <XIcon/>\n </IconButton>\n );\n\n /**\n * Where the panel's own two controls sit, which is not the same question in\n * the two layouts that have them.\n *\n * A **side panel** slides in over the list from the right, and its leading\n * edge is the seam between the two. Close belongs on that seam — it points\n * back at the thing still visible behind it — and it is where the eye\n * already is, because the breadcrumb starts there.\n *\n * A **dialog** has no seam and nothing behind it to point at. It is a box\n * centred on a dimmed screen, and every box like it on every platform is\n * dismissed from its top-right corner. Close was sitting at the far left\n * of the bar, a full dialog's width from the expand button it belongs\n * beside, in the one corner that means \"back\" in a layout with no back.\n *\n * So in a dialog the two travel together at the trailing edge, expand then\n * close: the window controls, after the record's actions and its overflow\n * menu, in the corner a dialog is closed from.\n */\n const barActionsStart = isDialogMode ? undefined : closeButton;\n\n const windowControls = (expandButton: React.ReactNode) => (\n <div className=\"flex gap-1 items-center\">\n {expandButton}\n {isDialogMode && closeButton}\n </div>\n );\n\n return (\n <>\n <ErrorBoundary>\n {isDetailMode\n ? <ResolvedDetailView\n path={path}\n layout={collection?.openEntityMode === \"dialog\" ? \"dialog\" : \"side_panel\"}\n collection={collection as AdminCollection}\n entityId={entityId!}\n parentCollectionSlugs={parentCollectionSlugs}\n parentEntityIds={parentEntityIds}\n onEditClick={openEditView}\n barActionsStart={barActionsStart}\n barActions={() => windowControls(\n allowFullScreen && <IconButton aria-label={t(\"full_screen\")}\n className=\"self-center\"\n size={\"small\"}\n onClick={() => {\n if (hasEntityId(entityId)) {\n const fullScreenUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}`);\n navigate(fullScreenUrl, { state: null });\n }\n }}>\n <Maximize2Icon/>\n </IconButton>\n )}\n onTabChange={({\n entityId: tabEntityId,\n selectedTab,\n collection: paramCollection\n }) => {\n if (collection?.openEntityMode === \"dialog\" || paramCollection?.openEntityMode === \"dialog\") {\n return;\n }\n if (tabEntityId) {\n sidePanelController.replace({\n path,\n id: tabEntityId,\n selectedTab,\n updateUrl: true,\n collection: paramCollection ?? collection\n });\n }\n }}\n />\n : <EditViewBinding\n {...props}\n entityId={entityId}\n layout={collection?.openEntityMode === \"dialog\" ? \"dialog\" : \"side_panel\"}\n collection={collection as AdminCollection}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n onValuesModified={onValuesModified}\n onSaved={onSaved}\n navigateBack={closeEditView}\n barActionsStart={barActionsStart}\n barActions={({ carryEdit }) => windowControls(\n allowFullScreen && <IconButton aria-label={t(\"full_screen\")}\n className=\"self-center\"\n size={\"small\"}\n onClick={() => {\n // The form's own handoff, rather than a second\n // copy of the rules for it here: only an edit in\n // progress is worth carrying (a clean record\n // stashed anyway arrived announcing unsaved\n // changes to someone who had only looked at it),\n // and only the fields that were edited (carrying\n // the whole record marked every field touched).\n carryEdit?.();\n setBlocked(false);\n setBlockedNavigationMessage(undefined);\n if (hasEntityId(entityId)) {\n const fullScreenUrl = urlController.buildUrlCollectionPath(`${path}/${entityId}`);\n navigate(fullScreenUrl, { state: null });\n } else {\n const fullScreenUrl = urlController.buildUrlCollectionPath(path);\n navigate(fullScreenUrl + \"#new\", { state: null });\n }\n }}>\n <Maximize2Icon/>\n </IconButton>\n )}\n onTabChange={({\n entityId: tabEntityId,\n selectedTab,\n collection: paramCollection\n }) => {\n if (collection?.openEntityMode === \"dialog\" || paramCollection?.openEntityMode === \"dialog\") {\n return;\n }\n if (tabEntityId) {\n sidePanelController.replace({\n path,\n id: tabEntityId,\n selectedTab,\n updateUrl: true,\n collection: paramCollection ?? collection\n });\n }\n }}\n formProps={formProps}\n />\n }\n </ErrorBoundary>\n\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,iBAAiB,OAA8B;CAC3D,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,EACF,kBAAkB,MAClB,MACA,IAAI,UACJ,aACA,cACA;CAEJ,MAAM,qBAAqB,qBAAqB,cAAc,iBAAiB;CAE/E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AK;IAChB,4BAA4B,KAAA,CAAS;IACrC,IAAI,YAAY,QAAQ,GAAG;KACvB,MAAM,gBAAgB,cAAc,uBAAuB,GAAG,KAAK,GAAG,UAAU;KAChF,SAAS,eAAe,EAAE,OAAO,KAAK,CAAC;IAC3C,OAAO;KACH,MAAM,gBAAgB,cAAc,uBAAuB,IAAI;KAC/D,SAAS,gBAAgB,QAAQ,EAAE,OAAO,KAAK,CAAC;IACpD;GACJ;aACA,oBAAC,eAAD,CAAe,CAAA;EACP,CAAA,CAChB;EACA,cAAc,EACV,UAAU,aACV,aACA,YAAY,sBACV;GACF,IAAI,YAAY,mBAAmB,YAAY,iBAAiB,mBAAmB,UAC/E;GAEJ,IAAI,aACA,oBAAoB,QAAQ;IACxB;IACA,IAAI;IACJ;IACA,WAAW;IACX,YAAY,mBAAmB;GACnC,CAAC;EAET;EACW;CACd,CAAA,EAEM,CAAA,EAEjB,CAAA;AAEV"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AdminCollection } from "@rebasepro/cms-types";
|
|
2
|
+
/**
|
|
3
|
+
* A panel's `collection` and `path`, as the panel works with them: the
|
|
4
|
+
* collection as a value, or none where it is named, and where it lives.
|
|
5
|
+
*
|
|
6
|
+
* `collection="orders"` names a registered collection, as `path="orders"`
|
|
7
|
+
* does; `path` wins where both are given, so a subcollection's record can be
|
|
8
|
+
* named by its collection and addressed by its full path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function collectionPropOf<C extends AdminCollection<any>>(collection: C | string | undefined, path: string | undefined): {
|
|
11
|
+
collection: C | undefined;
|
|
12
|
+
path: string;
|
|
13
|
+
};
|
|
14
|
+
/** A record panel's props once its `collection` is a value or absent, and its `path` known. */
|
|
15
|
+
export type ScopedRecordPanelProps<O, M extends Record<string, unknown>> = O & {
|
|
16
|
+
collection?: AdminCollection<M>;
|
|
17
|
+
path: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/components/collection_prop.ts
|
|
2
|
+
/**
|
|
3
|
+
* A panel's `collection` and `path`, as the panel works with them: the
|
|
4
|
+
* collection as a value, or none where it is named, and where it lives.
|
|
5
|
+
*
|
|
6
|
+
* `collection="orders"` names a registered collection, as `path="orders"`
|
|
7
|
+
* does; `path` wins where both are given, so a subcollection's record can be
|
|
8
|
+
* named by its collection and addressed by its full path.
|
|
9
|
+
*/
|
|
10
|
+
function collectionPropOf(collection, path) {
|
|
11
|
+
if (typeof collection === "string") return {
|
|
12
|
+
collection: void 0,
|
|
13
|
+
path: path ?? collection
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
collection,
|
|
17
|
+
path: path ?? collection?.slug ?? ""
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { collectionPropOf };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=collection_prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection_prop.js","names":[],"sources":["../../src/components/collection_prop.ts"],"sourcesContent":["import type { AdminCollection } from \"@rebasepro/cms-types\";\n\n/**\n * A panel's `collection` and `path`, as the panel works with them: the\n * collection as a value, or none where it is named, and where it lives.\n *\n * `collection=\"orders\"` names a registered collection, as `path=\"orders\"`\n * does; `path` wins where both are given, so a subcollection's record can be\n * named by its collection and addressed by its full path.\n */\nexport function collectionPropOf<C extends AdminCollection<any>>(\n collection: C | string | undefined,\n path: string | undefined\n): { collection: C | undefined; path: string } {\n if (typeof collection === \"string\") return { collection: undefined, path: path ?? collection };\n return { collection, path: path ?? collection?.slug ?? \"\" };\n}\n\n/** A record panel's props once its `collection` is a value or absent, and its `path` known. */\nexport type ScopedRecordPanelProps<O, M extends Record<string, unknown>> = O & { collection?: AdminCollection<M>; path: string };\n"],"mappings":";;;;;;;;;AAUA,SAAgB,iBACZ,YACA,MAC2C;CAC3C,IAAI,OAAO,eAAe,UAAU,OAAO;EAAE,YAAY,KAAA;EAAW,MAAM,QAAQ;CAAW;CAC7F,OAAO;EAAE;EAAY,MAAM,QAAQ,YAAY,QAAQ;CAAG;AAC9D"}
|