@rebasepro/admin 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/dist/{CollectionEditorDialog-BO_aQ-Z4.js → CollectionEditorDialog-B-7uW3iJ.js} +11 -11
- package/dist/CollectionEditorDialog-B-7uW3iJ.js.map +1 -0
- package/dist/{PropertyEditView-DKzOpMjR.js → PropertyEditView-7KMTcrqi.js} +78 -70
- package/dist/PropertyEditView-7KMTcrqi.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-BQTIExjA.js → RouterCollectionsStudioView-epqIbZrJ.js} +4 -4
- package/dist/{RouterCollectionsStudioView-BQTIExjA.js.map → RouterCollectionsStudioView-epqIbZrJ.js.map} +1 -1
- package/dist/collection_editor/_cms_internals.d.ts +3 -3
- package/dist/collection_editor/api/generateCollectionApi.d.ts +4 -4
- package/dist/collection_editor/extensibility_types.d.ts +3 -3
- package/dist/collection_editor/index.d.ts +2 -2
- package/dist/collection_editor/pgColumnToProperty.d.ts +3 -3
- package/dist/collection_editor/serializable_types.d.ts +7 -7
- package/dist/collection_editor/serializable_utils.d.ts +8 -8
- package/dist/collection_editor/types/collection_editor_controller.d.ts +5 -5
- package/dist/collection_editor/types/collection_inference.d.ts +2 -2
- package/dist/collection_editor/types/config_controller.d.ts +7 -7
- package/dist/collection_editor/ui/AddKanbanColumnAction.d.ts +2 -2
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +2 -2
- package/dist/collection_editor/ui/KanbanSetupAction.d.ts +2 -2
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.d.ts +3 -3
- package/dist/collection_editor/ui/collection_editor/CollectionDetailsForm.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +4 -4
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +4 -4
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/EntityActionsEditTab.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +4 -4
- package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +3 -3
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +2 -2
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +2 -2
- package/dist/collection_editor/validateCollectionJson.d.ts +2 -2
- package/dist/collection_editor_ui.js +4 -4
- package/dist/components/CollectionPanel.d.ts +4 -4
- package/dist/components/{EntityCollectionTable/EntityCollectionRowActions.d.ts → CollectionTableBinding/CollectionRowActions.d.ts} +3 -3
- package/dist/components/CollectionTableBinding/CollectionTableBinding.d.ts +28 -0
- package/dist/components/{EntityCollectionTable/EntityCollectionTableProps.d.ts → CollectionTableBinding/CollectionTableBindingProps.d.ts} +1 -1
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/index.d.ts +6 -0
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.d.ts +2 -2
- package/dist/components/{EntityCollectionView/EntityBoardCard.d.ts → CollectionViewBinding/BoardCardBinding.d.ts} +8 -8
- package/dist/components/{EntityCollectionView/EntityCollectionBoardView.d.ts → CollectionViewBinding/CollectionBoardViewBinding.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionCardView.d.ts → CollectionViewBinding/CollectionCardViewBinding.d.ts} +5 -5
- package/dist/components/{EntityCollectionView/EntityCollectionListView.d.ts → CollectionViewBinding/CollectionListViewBinding.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionViewActions.d.ts → CollectionViewBinding/CollectionViewActions.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionView.d.ts → CollectionViewBinding/CollectionViewBinding.d.ts} +4 -4
- package/dist/components/{EntityCollectionView/EntityCollectionViewStartActions.d.ts → CollectionViewBinding/CollectionViewStartActions.d.ts} +4 -4
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +21 -0
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.d.ts +3 -3
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.d.ts +2 -2
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.d.ts +2 -2
- package/dist/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.d.ts +2 -2
- package/dist/components/{EntityCollectionView/useEntityPreviewSlots.d.ts → CollectionViewBinding/usePreviewSlots.d.ts} +5 -5
- package/dist/components/DeleteEntityDialog.d.ts +4 -4
- package/dist/components/{EntityDetailView.d.ts → DetailViewBinding.d.ts} +5 -5
- package/dist/components/EditFormActions.d.ts +3 -0
- package/dist/components/{EntityEditView.d.ts → EditViewBinding.d.ts} +9 -9
- package/dist/components/{EntityPreview.d.ts → EntityPreviewBinding.d.ts} +13 -13
- package/dist/components/EntityViewBinding.d.ts +13 -0
- package/dist/components/{EntityJsonPreview.d.ts → JsonPreviewBinding.d.ts} +1 -1
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/components/RebaseNavigation.d.ts +1 -1
- package/dist/components/ReferenceTable/{EntitySelectionTable.d.ts → SelectionTableBinding.d.ts} +5 -5
- package/dist/components/SelectableTable/SelectableTable.d.ts +5 -5
- package/dist/components/SelectableTable/SelectableTableContext.d.ts +3 -3
- package/dist/components/SelectableTable/SelectionStore.d.ts +2 -2
- package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +6 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +7 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +40 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +7 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +7 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +7 -1
- package/dist/components/SideDialogs.d.ts +1 -1
- package/dist/components/SidePanelBinding.d.ts +11 -0
- package/dist/components/{SideEntityProvider.d.ts → SidePanelProvider.d.ts} +7 -7
- package/dist/components/history/EntityHistoryEntry.d.ts +2 -2
- package/dist/components/history/LastEditedByIndicator.d.ts +2 -2
- package/dist/components/index.d.ts +14 -13
- package/dist/contexts/SidePanelControllerContext.d.ts +3 -0
- package/dist/data_export/export/ExportCollectionAction.d.ts +3 -3
- package/dist/data_import/components/ImportSaveInProgress.d.ts +2 -2
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/form_utils.d.ts +2 -2
- package/dist/{history-B3cqBzEV.js → history-7X5bON_n.js} +4 -4
- package/dist/history-7X5bON_n.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +2 -2
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +5 -5
- package/dist/hooks/navigation/useNavigationResolution.d.ts +4 -4
- package/dist/hooks/navigation/useResolvedCollections.d.ts +7 -7
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +2 -2
- package/dist/hooks/navigation/utils.d.ts +5 -5
- package/dist/hooks/useBuildSidePanel.d.ts +6 -0
- package/dist/hooks/useCMSContext.d.ts +2 -2
- package/dist/hooks/{useEntityHistory.d.ts → useHistory.d.ts} +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/{useEntitySelectionDialog.d.ts → useSelectionDialog.d.ts} +2 -2
- package/dist/hooks/useSideDialogsController.d.ts +1 -1
- package/dist/hooks/useSidePanel.d.ts +11 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{src-cxV1ODRG.js → src-sUZfe29F.js} +737 -647
- package/dist/src-sUZfe29F.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +2 -2
- package/dist/types/components/EntityFormProps.d.ts +3 -3
- package/dist/types/fields.d.ts +2 -2
- package/dist/util/dataControllerAdapter.d.ts +2 -5
- package/dist/util/navigation_utils.d.ts +6 -6
- package/dist/util/previews.d.ts +3 -3
- package/dist/util/property_utils.d.ts +2 -2
- package/dist/util/{entity_view_constants.d.ts → view_constants.d.ts} +1 -1
- package/package.json +8 -8
- package/src/collection_editor/ConfigControllerProvider.tsx +10 -10
- package/src/collection_editor/_cms_internals.ts +3 -3
- package/src/collection_editor/api/generateCollectionApi.ts +4 -4
- package/src/collection_editor/extensibility_types.ts +3 -3
- package/src/collection_editor/index.ts +3 -3
- package/src/collection_editor/pgColumnToProperty.ts +3 -3
- package/src/collection_editor/serializable_types.ts +8 -8
- package/src/collection_editor/serializable_utils.ts +17 -17
- package/src/collection_editor/types/collection_editor_controller.tsx +5 -5
- package/src/collection_editor/types/collection_inference.ts +2 -2
- package/src/collection_editor/types/config_controller.tsx +7 -7
- package/src/collection_editor/ui/AddKanbanColumnAction.tsx +2 -2
- package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +2 -2
- package/src/collection_editor/ui/EditorCollectionAction.tsx +2 -2
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +2 -2
- package/src/collection_editor/ui/EditorEntityAction.tsx +2 -2
- package/src/collection_editor/ui/KanbanSetupAction.tsx +2 -2
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +26 -26
- package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +8 -8
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +7 -7
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +45 -36
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +2 -2
- package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +2 -2
- package/src/collection_editor/ui/collection_editor/templates/products_template.ts +2 -2
- package/src/collection_editor/ui/collection_editor/templates/users_template.ts +2 -2
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +13 -13
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +4 -4
- package/src/collection_editor/validateCollectionJson.ts +3 -3
- package/src/components/CollectionPanel.tsx +14 -17
- package/src/components/{EntityCollectionTable/EntityCollectionRowActions.tsx → CollectionTableBinding/CollectionRowActions.tsx} +6 -6
- package/src/components/{EntityCollectionTable/EntityCollectionTable.tsx → CollectionTableBinding/CollectionTableBinding.tsx} +10 -10
- package/src/components/{EntityCollectionTable/EntityCollectionTableProps.tsx → CollectionTableBinding/CollectionTableBindingProps.tsx} +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.tsx +5 -5
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.tsx +10 -10
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.tsx +5 -5
- package/src/components/CollectionTableBinding/index.tsx +14 -0
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.tsx +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.tsx +2 -2
- package/src/components/{EntityCollectionView/EntityBoardCard.tsx → CollectionViewBinding/BoardCardBinding.tsx} +15 -15
- package/src/components/{EntityCollectionView/EntityCollectionBoardView.tsx → CollectionViewBinding/CollectionBoardViewBinding.tsx} +14 -13
- package/src/components/{EntityCollectionView/EntityCollectionCardView.tsx → CollectionViewBinding/CollectionCardViewBinding.tsx} +8 -8
- package/src/components/{EntityCollectionView/EntityCollectionListView.tsx → CollectionViewBinding/CollectionListViewBinding.tsx} +12 -12
- package/src/components/{EntityCollectionView/EntityCollectionViewActions.tsx → CollectionViewBinding/CollectionViewActions.tsx} +5 -5
- package/src/components/{EntityCollectionView/EntityCollectionView.tsx → CollectionViewBinding/CollectionViewBinding.tsx} +106 -91
- package/src/components/{EntityCollectionView/EntityCollectionViewStartActions.tsx → CollectionViewBinding/CollectionViewStartActions.tsx} +5 -5
- package/src/components/{EntityCollectionView/EntityCard.tsx → CollectionViewBinding/EntityCardBinding.tsx} +9 -9
- package/src/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.tsx +31 -72
- package/src/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.tsx +9 -9
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.ts +5 -5
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.ts +4 -4
- package/src/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.tsx +16 -10
- package/src/components/{EntityCollectionView/useEntityPreviewSlots.ts → CollectionViewBinding/usePreviewSlots.ts} +8 -8
- package/src/components/DeleteEntityDialog.tsx +6 -6
- package/src/components/{EntityDetailView.tsx → DetailViewBinding.tsx} +26 -29
- package/src/components/{EntityEditViewFormActions.tsx → EditFormActions.tsx} +12 -12
- package/src/components/{EntityEditView.tsx → EditViewBinding.tsx} +29 -32
- package/src/components/{EntityPreview.tsx → EntityPreviewBinding.tsx} +27 -27
- package/src/components/{EntityView.tsx → EntityViewBinding.tsx} +5 -5
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- package/src/components/{EntityJsonPreview.tsx → JsonPreviewBinding.tsx} +1 -1
- package/src/components/RebaseCMS.tsx +4 -3
- package/src/components/RebaseNavigation.tsx +17 -8
- package/src/components/ReferenceTable/{EntitySelectionTable.tsx → SelectionTableBinding.tsx} +22 -19
- package/src/components/ReferenceWidget.tsx +4 -4
- package/src/components/RelationSelector.tsx +14 -12
- package/src/components/SelectableTable/SelectableTable.tsx +34 -87
- package/src/components/SelectableTable/SelectableTableContext.tsx +3 -3
- package/src/components/SelectableTable/SelectionStore.ts +4 -4
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +9 -1
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +33 -12
- package/src/components/SelectableTable/filters/FilterFieldBinding.tsx +187 -0
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +21 -7
- package/src/components/SelectableTable/filters/RelationFilterField.tsx +17 -3
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +66 -12
- package/src/components/SideDialogs.tsx +3 -3
- package/src/components/{EntitySidePanel.tsx → SidePanelBinding.tsx} +19 -19
- package/src/components/{SideEntityProvider.tsx → SidePanelProvider.tsx} +16 -16
- package/src/components/common/default_entity_actions.tsx +9 -9
- package/src/components/history/EntityHistoryEntry.tsx +2 -2
- package/src/components/history/EntityHistoryView.tsx +3 -3
- package/src/components/history/LastEditedByIndicator.tsx +2 -2
- package/src/components/index.ts +15 -14
- package/src/contexts/SidePanelControllerContext.tsx +5 -0
- package/src/data_export/export/ExportCollectionAction.tsx +4 -4
- package/src/data_import/components/ImportSaveInProgress.tsx +3 -3
- package/src/data_import/import/ImportCollectionAction.tsx +4 -4
- package/src/data_import/utils/data.ts +2 -2
- package/src/form/EntityForm.tsx +2 -2
- package/src/form/EntityFormActions.tsx +3 -3
- package/src/form/EntityFormBinding.tsx +6 -6
- package/src/form/PropertyFieldBinding.tsx +4 -4
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -4
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +19 -19
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -5
- package/src/form/field_bindings/RelationFieldBinding.tsx +3 -3
- package/src/form/form_utils.ts +2 -2
- package/src/hooks/index.ts +4 -4
- package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +2 -2
- package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +11 -11
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +5 -5
- package/src/hooks/navigation/useNavigationResolution.ts +10 -10
- package/src/hooks/navigation/useResolvedCollections.ts +8 -8
- package/src/hooks/navigation/useTopLevelNavigation.ts +2 -2
- package/src/hooks/navigation/utils.ts +5 -5
- package/src/hooks/{useBuildSideEntityController.tsx → useBuildSidePanel.tsx} +28 -28
- package/src/hooks/useCMSContext.tsx +6 -6
- package/src/hooks/{useEntityHistory.ts → useHistory.ts} +1 -1
- package/src/hooks/useResolvedNavigationFrom.tsx +8 -5
- package/src/hooks/{useEntitySelectionDialog.tsx → useSelectionDialog.tsx} +7 -7
- package/src/hooks/useSideDialogsController.tsx +1 -1
- package/src/hooks/useSidePanel.tsx +13 -0
- package/src/index.ts +12 -12
- package/src/preview/components/ReferencePreview.tsx +10 -10
- package/src/preview/components/RelationPreview.tsx +13 -12
- package/src/routes/RebaseRoute.tsx +10 -10
- package/src/types/components/EntityFormActionsProps.tsx +2 -2
- package/src/types/components/EntityFormProps.tsx +3 -3
- package/src/types/fields.tsx +2 -2
- package/src/util/dataControllerAdapter.ts +9 -15
- package/src/util/navigation_utils.ts +7 -7
- package/src/util/previews.ts +3 -3
- package/src/util/property_utils.tsx +2 -2
- package/src/util/{entity_view_constants.ts → view_constants.ts} +1 -1
- package/dist/CollectionEditorDialog-BO_aQ-Z4.js.map +0 -1
- package/dist/PropertyEditView-DKzOpMjR.js.map +0 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +0 -28
- package/dist/components/EntityCollectionTable/index.d.ts +0 -6
- package/dist/components/EntityCollectionView/EntityCard.d.ts +0 -21
- package/dist/components/EntityEditViewFormActions.d.ts +0 -3
- package/dist/components/EntitySidePanel.d.ts +0 -11
- package/dist/components/EntityView.d.ts +0 -13
- package/dist/contexts/SideEntityControllerContext.d.ts +0 -3
- package/dist/history-B3cqBzEV.js.map +0 -1
- package/dist/hooks/useBuildSideEntityController.d.ts +0 -6
- package/dist/hooks/useSideEntityController.d.ts +0 -11
- package/dist/src-cxV1ODRG.js.map +0 -1
- package/src/components/EntityCollectionTable/index.tsx +0 -14
- package/src/contexts/SideEntityControllerContext.tsx +0 -5
- package/src/hooks/useSideEntityController.tsx +0 -13
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/PropertyTableCell.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationSelectorField.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableSelect.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableUserSelect.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/CollectionTableToolbar.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useDraggable.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useWindowSize.d.ts +0 -0
- /package/dist/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/FilterPresetsButton.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/ViewModeToggle.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/useSelectionController.d.ts +0 -0
- /package/dist/components/{EntityCollectionView → CollectionViewBinding}/utils.d.ts +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/PropertyTableCell.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationSelectorField.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableSelect.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/VirtualTableUserSelect.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/CollectionTableToolbar.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useDraggable.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useWindowSize.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/FilterPresetsButton.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/ViewModeToggle.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/useSelectionController.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/utils.ts +0 -0
package/src/components/ReferenceTable/{EntitySelectionTable.tsx → SelectionTableBinding.tsx}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
2
2
|
import React, { MouseEventHandler, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { CollectionSize, Entity, FilterValues } from "@rebasepro/types";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "../
|
|
6
|
+
CollectionRowActions,
|
|
7
|
+
CollectionTableBinding
|
|
8
|
+
} from "../CollectionTableBinding";
|
|
9
9
|
import {
|
|
10
|
+
CollectionScopeProvider,
|
|
10
11
|
useAuthController,
|
|
11
12
|
useCustomizationController,
|
|
12
13
|
useData,
|
|
@@ -17,17 +18,17 @@ import {
|
|
|
17
18
|
import { ErrorView } from "@rebasepro/core";
|
|
18
19
|
import { Button, DialogActions, PlusIcon, Typography } from "@rebasepro/ui";
|
|
19
20
|
import { IconForView } from "@rebasepro/core";
|
|
20
|
-
import { useSelectionController } from "../
|
|
21
|
+
import { useSelectionController } from "../CollectionViewBinding/useSelectionController";
|
|
21
22
|
|
|
22
23
|
import { useColumnIds } from "@rebasepro/core";
|
|
23
24
|
import { useSideDialogContext } from "../SideDialogs";
|
|
24
25
|
import { useAnalyticsController } from "@rebasepro/core";
|
|
25
|
-
import { useUrlController,
|
|
26
|
+
import { useUrlController, useSidePanel } from "../../index";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* @group Components
|
|
29
30
|
*/
|
|
30
|
-
export interface
|
|
31
|
+
export interface SelectionProps<M extends Record<string, unknown>> {
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* Allow multiple selection of values
|
|
@@ -37,7 +38,7 @@ export interface EntitySelectionProps<M extends Record<string, unknown>> {
|
|
|
37
38
|
/**
|
|
38
39
|
* Entity collection config
|
|
39
40
|
*/
|
|
40
|
-
collection?:
|
|
41
|
+
collection?: CollectionConfig<M>;
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* Absolute path of the collection.
|
|
@@ -87,20 +88,20 @@ export interface EntitySelectionProps<M extends Record<string, unknown>> {
|
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* This component allows to select entities from a given collection.
|
|
90
|
-
* You probably want to open this dialog as a side view using {@link
|
|
91
|
+
* You probably want to open this dialog as a side view using {@link useSelectionTableBinding}
|
|
91
92
|
* @group Components
|
|
92
93
|
*/
|
|
93
|
-
export function
|
|
94
|
-
props:
|
|
94
|
+
export function SelectionTableBinding<M extends Record<string, unknown>>(
|
|
95
|
+
props: SelectionProps<M>
|
|
95
96
|
) {
|
|
96
97
|
if (!props.collection) {
|
|
97
98
|
return <ErrorView
|
|
98
99
|
error={"Could not find collection"}/>
|
|
99
100
|
}
|
|
100
|
-
return <
|
|
101
|
+
return <SelectionTableBindingInternal {...props} collection={props.collection} />;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
function
|
|
104
|
+
function SelectionTableBindingInternal<M extends Record<string, unknown>>(
|
|
104
105
|
{
|
|
105
106
|
onSingleEntitySelected,
|
|
106
107
|
onMultipleEntitiesSelected,
|
|
@@ -111,10 +112,10 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
111
112
|
description,
|
|
112
113
|
fixedFilter,
|
|
113
114
|
maxSelection
|
|
114
|
-
}:
|
|
115
|
+
}: SelectionProps<M> & { collection: CollectionConfig<M> }) {
|
|
115
116
|
|
|
116
117
|
const sideDialogContext = useSideDialogContext();
|
|
117
|
-
const
|
|
118
|
+
const sidePanelController = useSidePanel();
|
|
118
119
|
const urlController = useUrlController();
|
|
119
120
|
const analyticsController = useAnalyticsController();
|
|
120
121
|
|
|
@@ -212,7 +213,7 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
212
213
|
analyticsController.onAnalyticsEvent?.("reference_selection_new_entity", {
|
|
213
214
|
path
|
|
214
215
|
});
|
|
215
|
-
|
|
216
|
+
sidePanelController.open({
|
|
216
217
|
path: path,
|
|
217
218
|
collection,
|
|
218
219
|
updateUrl: true,
|
|
@@ -237,7 +238,7 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
237
238
|
}) => {
|
|
238
239
|
const selectedEntities = selectionController.selectedEntities;
|
|
239
240
|
const isSelected = selectedEntities && selectedEntities.map(e => e.id).indexOf(entity.id) > -1;
|
|
240
|
-
return <
|
|
241
|
+
return <CollectionRowActions
|
|
241
242
|
width={width}
|
|
242
243
|
frozen={frozen}
|
|
243
244
|
entity={entity}
|
|
@@ -269,11 +270,12 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
269
270
|
|
|
270
271
|
return (
|
|
271
272
|
|
|
273
|
+
<CollectionScopeProvider collection={collection}>
|
|
272
274
|
<div className="flex flex-col h-full">
|
|
273
275
|
|
|
274
276
|
<div className="grow">
|
|
275
277
|
{entitiesDisplayedFirst &&
|
|
276
|
-
<
|
|
278
|
+
<CollectionTableBinding
|
|
277
279
|
additionalFields={collection.additionalFields}
|
|
278
280
|
displayedColumnIds={displayedColumnIds}
|
|
279
281
|
onEntityClick={onEntityClick}
|
|
@@ -316,6 +318,7 @@ function EntitySelectionTableInternal<M extends Record<string, unknown>>(
|
|
|
316
318
|
</Button>
|
|
317
319
|
</DialogActions>
|
|
318
320
|
</div>
|
|
321
|
+
</CollectionScopeProvider>
|
|
319
322
|
|
|
320
323
|
);
|
|
321
324
|
|
|
@@ -327,7 +330,7 @@ function EntitySelectionDialogActions({
|
|
|
327
330
|
onClear,
|
|
328
331
|
onNewClick
|
|
329
332
|
}: {
|
|
330
|
-
collection:
|
|
333
|
+
collection: CollectionConfig<any>,
|
|
331
334
|
path: string,
|
|
332
335
|
onClear: () => void,
|
|
333
336
|
onNewClick: () => void
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { useSelectionDialog } from "../hooks/useSelectionDialog";
|
|
2
|
+
import type { CollectionConfig } from "@rebasepro/types";
|
|
3
3
|
import React, { useCallback, useMemo } from "react";
|
|
4
4
|
|
|
5
5
|
import { Entity, EntityReference, FilterValues } from "@rebasepro/types";
|
|
@@ -55,7 +55,7 @@ export function ReferenceWidget<M extends Record<string, unknown>>({
|
|
|
55
55
|
|
|
56
56
|
const collectionRegistryController = useCollectionRegistryController();
|
|
57
57
|
|
|
58
|
-
const collection:
|
|
58
|
+
const collection: CollectionConfig | undefined = useMemo(() => {
|
|
59
59
|
return collectionRegistryController.getCollection(path);
|
|
60
60
|
}, [path, collectionRegistryController.getCollection]);
|
|
61
61
|
|
|
@@ -83,7 +83,7 @@ export function ReferenceWidget<M extends Record<string, unknown>>({
|
|
|
83
83
|
}
|
|
84
84
|
}, [disabled, onReferenceSelected]);
|
|
85
85
|
|
|
86
|
-
const referenceDialogController =
|
|
86
|
+
const referenceDialogController = useSelectionDialog({
|
|
87
87
|
multiselect,
|
|
88
88
|
path,
|
|
89
89
|
collection,
|
|
@@ -25,9 +25,9 @@ import * as React from "react";
|
|
|
25
25
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
26
26
|
import { Command as CommandPrimitive } from "cmdk";
|
|
27
27
|
import { Entity, EntityRelation, FilterValues, Relation, getCollectionDataPath } from "@rebasepro/types";
|
|
28
|
-
import {
|
|
28
|
+
import { EntityPreviewBindingData } from "./EntityPreviewBinding";
|
|
29
29
|
import { useData, useRelationSelector } from "@rebasepro/core";
|
|
30
|
-
import {
|
|
30
|
+
import { useSidePanel } from "../hooks/useSidePanel";
|
|
31
31
|
import { normalizeToEntityRelation } from "@rebasepro/common";
|
|
32
32
|
import { EmptyValue } from "../preview";
|
|
33
33
|
|
|
@@ -91,7 +91,7 @@ export const RelationSelector = React.forwardRef<
|
|
|
91
91
|
|
|
92
92
|
const collection = relation.target();
|
|
93
93
|
const dataClient = useData();
|
|
94
|
-
const
|
|
94
|
+
const sidePanelController = useSidePanel();
|
|
95
95
|
const multiple = relation.cardinality === "many";
|
|
96
96
|
|
|
97
97
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -102,7 +102,7 @@ export const RelationSelector = React.forwardRef<
|
|
|
102
102
|
// Track IDs that were set via local user interaction (onItemClick / handleClear / handleRemoveItem).
|
|
103
103
|
// When an incoming value change matches these IDs exactly, we skip async re-resolution.
|
|
104
104
|
const localSelectionIdsRef = useRef<string | null>(null);
|
|
105
|
-
//
|
|
105
|
+
// Entity of selected IDs captured when the popover opens.
|
|
106
106
|
// Used to sort the dropdown list so selected items appear at the top.
|
|
107
107
|
// Stays stable for the entire popover session so items don't jump around.
|
|
108
108
|
const pinnedIdsRef = useRef<Set<string> | null>(null);
|
|
@@ -213,7 +213,8 @@ export const RelationSelector = React.forwardRef<
|
|
|
213
213
|
|
|
214
214
|
if (hasEmbeddedData) {
|
|
215
215
|
const r = rel as EntityRelation;
|
|
216
|
-
|
|
216
|
+
// CMS wire format embeds relation data as { id, path, values }
|
|
217
|
+
newResolvedItems.push(toRelationItem(r.data as unknown as Entity, r));
|
|
217
218
|
} else if (currentSelectedMap.has(relId)) {
|
|
218
219
|
// We already have it in currentSelected
|
|
219
220
|
const existingItem = currentSelectedMap.get(relId)!;
|
|
@@ -248,7 +249,8 @@ export const RelationSelector = React.forwardRef<
|
|
|
248
249
|
const relation = isPrimitive ? new EntityRelation(relId, path) : rel as EntityRelation;
|
|
249
250
|
|
|
250
251
|
if (!isPrimitive && (rel as EntityRelation).data) {
|
|
251
|
-
|
|
252
|
+
// CMS wire format embeds relation data as { id, path, values }
|
|
253
|
+
return toRelationItem((rel as EntityRelation).data as unknown as Entity, relation);
|
|
252
254
|
}
|
|
253
255
|
if (currentSelectedMap.has(String(relId))) {
|
|
254
256
|
return currentSelectedMap.get(String(relId))!;
|
|
@@ -485,11 +487,11 @@ relation } as RelationItem;
|
|
|
485
487
|
<div key={String(item.id)}
|
|
486
488
|
className="flex flex-row items-center gap-1 truncate">
|
|
487
489
|
{item.data ? (
|
|
488
|
-
<
|
|
490
|
+
<EntityPreviewBindingData size={"medium"}
|
|
489
491
|
entity={item.data}
|
|
490
492
|
includeEntityLink={false}
|
|
491
493
|
includeId={false}
|
|
492
|
-
|
|
494
|
+
onSidePanelClick={closePopover}
|
|
493
495
|
/>
|
|
494
496
|
) : (
|
|
495
497
|
<span className="text-sm truncate">{item.label}</span>
|
|
@@ -504,7 +506,7 @@ relation } as RelationItem;
|
|
|
504
506
|
className={cls("flex flex-row items-center gap-1 truncate")}
|
|
505
507
|
>
|
|
506
508
|
{item.data ? (
|
|
507
|
-
<
|
|
509
|
+
<EntityPreviewBindingData size={"smallest"} entity={item.data}
|
|
508
510
|
includeEntityLink={false}
|
|
509
511
|
includeId={false}/>
|
|
510
512
|
) : (
|
|
@@ -541,7 +543,7 @@ relation } as RelationItem;
|
|
|
541
543
|
e.preventDefault();
|
|
542
544
|
const entity = selectedItems[0].data!;
|
|
543
545
|
setIsPopoverOpen(false);
|
|
544
|
-
|
|
546
|
+
sidePanelController.open({
|
|
545
547
|
entityId: entity.id,
|
|
546
548
|
path: entity.path,
|
|
547
549
|
collection,
|
|
@@ -634,7 +636,7 @@ relation } as RelationItem;
|
|
|
634
636
|
<CommandPrimitive.Group>
|
|
635
637
|
{(() => {
|
|
636
638
|
// Sort items so that initially-selected (pinned) items appear first.
|
|
637
|
-
// We use the
|
|
639
|
+
// We use the entity taken when the popover opened so items don't
|
|
638
640
|
// jump around as the user checks/unchecks.
|
|
639
641
|
const pinned = pinnedIdsRef.current;
|
|
640
642
|
const sortedItems = pinned && pinned.size > 0
|
|
@@ -666,7 +668,7 @@ relation } as RelationItem;
|
|
|
666
668
|
{item.data ? (
|
|
667
669
|
<div
|
|
668
670
|
className="flex flex-row items-center gap-2 min-w-0 w-full">
|
|
669
|
-
<
|
|
671
|
+
<EntityPreviewBindingData
|
|
670
672
|
size={multiple ? "smallest" : "medium"}
|
|
671
673
|
entity={item.data}
|
|
672
674
|
includeId={false}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { createSelectionStore, AdminSelectedCell } from "./SelectionStore";
|
|
2
|
-
import type { Property } from "@rebasepro/types";
|
|
2
|
+
import type { Property, WhereFilterOp } from "@rebasepro/types";
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
4
|
-
import { CollectionSize, Entity,
|
|
5
|
-
import { CellRendererParams, TableView, VirtualTableColumn, VirtualTableFilterValues, OnRowClickParams
|
|
6
|
-
import {
|
|
7
|
-
import { DEFAULT_PAGE_SIZE, EntityCollectionTableController, OnCellValueChange, OnColumnResizeParams } from "@rebasepro/core";
|
|
4
|
+
import { CollectionSize, Entity, EntityTableController, FilterValues, SelectedCellProps } from "@rebasepro/types";
|
|
5
|
+
import { CellRendererParams, TableView, VirtualTableColumn, VirtualTableFilterValues, OnRowClickParams } from "@rebasepro/ui";
|
|
6
|
+
import { DEFAULT_PAGE_SIZE, DataCollectionTableController, OnCellValueChange, OnColumnResizeParams } from "@rebasepro/core";
|
|
8
7
|
import { FilterFormFieldProps } from "@rebasepro/ui";
|
|
9
|
-
import { ReferenceFilterField } from "./filters/ReferenceFilterField";
|
|
10
|
-
import { StringNumberFilterField } from "./filters/StringNumberFilterField";
|
|
11
|
-
import { BooleanFilterField } from "./filters/BooleanFilterField";
|
|
12
|
-
import { DateTimeFilterField } from "./filters/DateTimeFilterField";
|
|
13
8
|
import { useOutsideAlerter } from "@rebasepro/ui";
|
|
14
9
|
import { SelectableTableContext } from "./SelectableTableContext";
|
|
15
10
|
import { getRowHeight } from "@rebasepro/core";
|
|
16
|
-
import {
|
|
11
|
+
import { FilterFieldBinding } from "./filters/FilterFieldBinding";
|
|
17
12
|
|
|
18
13
|
export type SelectableTableProps<M extends Record<string, unknown>> = {
|
|
19
14
|
|
|
@@ -107,23 +102,23 @@ export type SelectableTableProps<M extends Record<string, unknown>> = {
|
|
|
107
102
|
* This component is in charge of rendering a collection table with a high
|
|
108
103
|
* degree of customization.
|
|
109
104
|
*
|
|
110
|
-
* This component is used internally by {@link
|
|
105
|
+
* This component is used internally by {@link CollectionViewBinding} and
|
|
111
106
|
* {@link useReferenceDialog}
|
|
112
107
|
*
|
|
113
108
|
* Please note that you only need to use this component if you are building
|
|
114
109
|
* a custom view. If you just need to create a default view you can do it
|
|
115
110
|
* exclusively with config options.
|
|
116
111
|
*
|
|
117
|
-
* If you want to bind a {@link
|
|
112
|
+
* If you want to bind a {@link CollectionConfig} to a table with the default
|
|
118
113
|
* options you see in collections in the top level navigation, you can
|
|
119
|
-
* check {@link
|
|
114
|
+
* check {@link CollectionViewBinding}.
|
|
120
115
|
*
|
|
121
116
|
* The data displayed in the table is managed by a {@link EntityTableController}.
|
|
122
117
|
* You can build the default, bound to a path in the driver, by using the hook
|
|
123
118
|
* {@link useDataTableController}
|
|
124
119
|
*
|
|
125
|
-
* @see
|
|
126
|
-
* @see
|
|
120
|
+
* @see CollectionTableBindingProps
|
|
121
|
+
* @see CollectionViewBinding
|
|
127
122
|
* @see VirtualTable
|
|
128
123
|
* @group Components
|
|
129
124
|
*/
|
|
@@ -196,7 +191,7 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
196
191
|
selectionStore.select({
|
|
197
192
|
...cell,
|
|
198
193
|
columnKey: cell.propertyKey,
|
|
199
|
-
|
|
194
|
+
id: cell.entityId
|
|
200
195
|
} as AdminSelectedCell);
|
|
201
196
|
} else {
|
|
202
197
|
selectionStore.select(undefined);
|
|
@@ -244,7 +239,29 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
244
239
|
size: size ?? "m",
|
|
245
240
|
selectionStore,
|
|
246
241
|
setPopupCell
|
|
247
|
-
} as unknown as
|
|
242
|
+
} as unknown as DataCollectionTableController<Record<string, unknown>>), [setPopupCell, select, onValueChange, size, selectionStore]);
|
|
243
|
+
|
|
244
|
+
const createFilterField = useCallback(({
|
|
245
|
+
id,
|
|
246
|
+
filterValue,
|
|
247
|
+
setFilterValue,
|
|
248
|
+
column,
|
|
249
|
+
hidden,
|
|
250
|
+
setHidden
|
|
251
|
+
}: FilterFormFieldProps<unknown>): React.ReactNode => {
|
|
252
|
+
if (!column.custom) return null;
|
|
253
|
+
const { resolvedProperty } = column.custom as { resolvedProperty?: Property };
|
|
254
|
+
if (!resolvedProperty) return null;
|
|
255
|
+
// Engine-aware operator resolution happens inside FilterFieldBinding,
|
|
256
|
+
// which reads the collection from the surrounding CollectionScopeProvider.
|
|
257
|
+
return <FilterFieldBinding
|
|
258
|
+
propertyKey={id as string}
|
|
259
|
+
property={resolvedProperty}
|
|
260
|
+
value={filterValue as [WhereFilterOp, unknown] | undefined}
|
|
261
|
+
setValue={setFilterValue as (value?: [WhereFilterOp, unknown]) => void}
|
|
262
|
+
hidden={hidden}
|
|
263
|
+
setHidden={setHidden}/>;
|
|
264
|
+
}, []);
|
|
248
265
|
|
|
249
266
|
return (
|
|
250
267
|
<SelectableTableContext.Provider
|
|
@@ -289,74 +306,4 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
289
306
|
|
|
290
307
|
};
|
|
291
308
|
|
|
292
|
-
function createFilterField({
|
|
293
|
-
id,
|
|
294
|
-
filterValue,
|
|
295
|
-
setFilterValue,
|
|
296
|
-
column,
|
|
297
|
-
hidden,
|
|
298
|
-
setHidden
|
|
299
|
-
}: FilterFormFieldProps<unknown>): React.ReactNode {
|
|
300
|
-
|
|
301
|
-
if (!column.custom) {
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const { resolvedProperty } = column.custom as { resolvedProperty?: Property };
|
|
306
|
-
|
|
307
|
-
const isArray = resolvedProperty?.type === "array";
|
|
308
|
-
const ofVal = isArray && resolvedProperty ? resolvedProperty.of : undefined;
|
|
309
|
-
const baseProperty: Property | undefined = isArray ? (Array.isArray(ofVal) ? ofVal[0] : ofVal) : resolvedProperty;
|
|
310
|
-
if (!baseProperty) {
|
|
311
|
-
return null;
|
|
312
|
-
}
|
|
313
|
-
if (baseProperty.type === "reference") {
|
|
314
|
-
return <ReferenceFilterField value={filterValue}
|
|
315
|
-
setValue={setFilterValue}
|
|
316
|
-
name={id as string}
|
|
317
|
-
isArray={isArray}
|
|
318
|
-
path={baseProperty.path}
|
|
319
|
-
title={resolvedProperty?.name}
|
|
320
|
-
includeId={baseProperty.includeId}
|
|
321
|
-
previewProperties={baseProperty?.ui?.previewProperties}
|
|
322
|
-
hidden={hidden}
|
|
323
|
-
setHidden={setHidden}/>;
|
|
324
|
-
} else if (baseProperty.type === "relation" && baseProperty.relation) {
|
|
325
|
-
return <RelationFilterField value={filterValue as [VirtualTableWhereFilterOp, EntityRelation | EntityRelation[] | null]}
|
|
326
|
-
setValue={setFilterValue}
|
|
327
|
-
name={id as string}
|
|
328
|
-
relation={baseProperty.relation}
|
|
329
|
-
hidden={hidden}
|
|
330
|
-
setHidden={setHidden}/>;
|
|
331
|
-
} else if (baseProperty.type === "number" || baseProperty.type === "string") {
|
|
332
|
-
const name = baseProperty.name;
|
|
333
|
-
const enumValues = baseProperty.enum ? enumToObjectEntries(baseProperty.enum) : undefined;
|
|
334
|
-
return <StringNumberFilterField value={filterValue}
|
|
335
|
-
setValue={setFilterValue}
|
|
336
|
-
name={id as string}
|
|
337
|
-
type={baseProperty.type}
|
|
338
|
-
isArray={isArray}
|
|
339
|
-
enumValues={enumValues}
|
|
340
|
-
title={name}/>;
|
|
341
|
-
} else if (baseProperty.type === "boolean") {
|
|
342
|
-
const name = baseProperty.name;
|
|
343
|
-
return <BooleanFilterField value={filterValue}
|
|
344
|
-
setValue={setFilterValue}
|
|
345
|
-
name={id as string}
|
|
346
|
-
title={name}/>;
|
|
347
|
-
|
|
348
|
-
} else if (baseProperty.type === "date") {
|
|
349
|
-
const title = baseProperty.name;
|
|
350
|
-
return <DateTimeFilterField value={filterValue}
|
|
351
|
-
setValue={setFilterValue}
|
|
352
|
-
name={id as string}
|
|
353
|
-
mode={baseProperty.mode}
|
|
354
|
-
isArray={isArray}
|
|
355
|
-
title={title}/>;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return (
|
|
359
|
-
<div>{`Currently the filter field ${resolvedProperty?.type} is not supported`}</div>
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
309
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { DataCollectionTableController } from "@rebasepro/core";
|
|
3
3
|
|
|
4
|
-
export const SelectableTableContext = React.createContext<
|
|
4
|
+
export const SelectableTableContext = React.createContext<DataCollectionTableController<Record<string, unknown>>>(null! as DataCollectionTableController<Record<string, unknown>>);
|
|
5
5
|
|
|
6
6
|
export const useSelectableTableController = <M extends Record<string, unknown> = Record<string, unknown>>() =>
|
|
7
|
-
useContext(SelectableTableContext) as unknown as
|
|
7
|
+
useContext(SelectableTableContext) as unknown as DataCollectionTableController<M>;
|
|
@@ -22,7 +22,7 @@ export function createSelectionStore() {
|
|
|
22
22
|
export type SelectionStore = VirtualTableSelectionStore<AdminSelectedCell>;
|
|
23
23
|
|
|
24
24
|
export function useCellSelected(
|
|
25
|
-
store: {
|
|
25
|
+
store: { getEntity: () => SelectedCellProps | undefined; subscribe: (listener: () => void) => () => void },
|
|
26
26
|
propertyKey: string,
|
|
27
27
|
entityPath: string,
|
|
28
28
|
entityId: string | number
|
|
@@ -30,8 +30,8 @@ export function useCellSelected(
|
|
|
30
30
|
const selectorRef = useRef({ propertyKey, entityPath, entityId });
|
|
31
31
|
selectorRef.current = { propertyKey, entityPath, entityId };
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
const cell = store.
|
|
33
|
+
const getEntity = useCallback(() => {
|
|
34
|
+
const cell = store.getEntity();
|
|
35
35
|
if (!cell) return false;
|
|
36
36
|
const s = selectorRef.current;
|
|
37
37
|
return cell.propertyKey === s.propertyKey &&
|
|
@@ -39,5 +39,5 @@ export function useCellSelected(
|
|
|
39
39
|
cell.entityId === s.entityId;
|
|
40
40
|
}, [store]);
|
|
41
41
|
|
|
42
|
-
return useSyncExternalStore(store.subscribe,
|
|
42
|
+
return useSyncExternalStore(store.subscribe, getEntity, getEntity);
|
|
43
43
|
}
|
|
@@ -8,16 +8,24 @@ interface BooleanFieldProps {
|
|
|
8
8
|
value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];
|
|
9
9
|
setValue: (value?: [op: VirtualTableWhereFilterOp, newValue: unknown]) => void;
|
|
10
10
|
title?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Restrict the offered operators. This field only ever emits `["==", …]`,
|
|
13
|
+
* so it renders nothing when `==` is not allowed.
|
|
14
|
+
*/
|
|
15
|
+
operators?: readonly VirtualTableWhereFilterOp[];
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
export function BooleanFilterField({
|
|
14
19
|
name,
|
|
15
20
|
title,
|
|
16
21
|
value,
|
|
17
|
-
setValue
|
|
22
|
+
setValue,
|
|
23
|
+
operators
|
|
18
24
|
}: BooleanFieldProps) {
|
|
19
25
|
const { t } = useTranslation();
|
|
20
26
|
|
|
27
|
+
if (operators && !operators.includes("==")) return null;
|
|
28
|
+
|
|
21
29
|
function updateFilter(val?: boolean) {
|
|
22
30
|
if (val !== undefined) {
|
|
23
31
|
setValue(
|
|
@@ -11,9 +11,15 @@ interface DateTimeFilterFieldProps {
|
|
|
11
11
|
isArray?: boolean;
|
|
12
12
|
title?: string;
|
|
13
13
|
timezone?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Restrict the offered operators (already resolved against engine
|
|
16
|
+
* capabilities and property config). When omitted, all operators this
|
|
17
|
+
* field can render are offered.
|
|
18
|
+
*/
|
|
19
|
+
operators?: readonly VirtualTableWhereFilterOp[];
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
const operationLabels: Record<VirtualTableWhereFilterOp
|
|
22
|
+
const operationLabels: Partial<Record<VirtualTableWhereFilterOp, string>> = {
|
|
17
23
|
"==": "==",
|
|
18
24
|
"!=": "!=",
|
|
19
25
|
">": ">",
|
|
@@ -24,7 +30,8 @@ const operationLabels: Record<VirtualTableWhereFilterOp | "is-null", string> = {
|
|
|
24
30
|
in: "in",
|
|
25
31
|
"array-contains": "Contains",
|
|
26
32
|
"array-contains-any": "Any",
|
|
27
|
-
"is-null": "Is null"
|
|
33
|
+
"is-null": "Is null",
|
|
34
|
+
"is-not-null": "Is not null"
|
|
28
35
|
};
|
|
29
36
|
|
|
30
37
|
const multipleSelectOperations = ["array-contains-any", "in"];
|
|
@@ -36,26 +43,40 @@ export function DateTimeFilterField({
|
|
|
36
43
|
value,
|
|
37
44
|
setValue,
|
|
38
45
|
title,
|
|
39
|
-
timezone
|
|
46
|
+
timezone,
|
|
47
|
+
operators
|
|
40
48
|
}: DateTimeFilterFieldProps) {
|
|
41
49
|
|
|
42
50
|
const { locale } = useCustomizationController();
|
|
43
|
-
|
|
51
|
+
let possibleOperations: (keyof typeof operationLabels)[] = isArray
|
|
44
52
|
? ["array-contains"]
|
|
45
|
-
: ["==", "!=", ">", "<", ">=", "<=", "is-null"];
|
|
53
|
+
: ["==", "!=", ">", "<", ">=", "<=", "is-null", "is-not-null"];
|
|
54
|
+
|
|
55
|
+
if (operators) {
|
|
56
|
+
possibleOperations = possibleOperations.filter(op => (operators as readonly string[]).includes(op));
|
|
57
|
+
}
|
|
46
58
|
|
|
47
59
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
48
|
-
|
|
60
|
+
// Read back both the canonical null operators and the legacy `["==", null]` /
|
|
61
|
+
// `["!=", null]` form saved by older filter presets.
|
|
62
|
+
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(
|
|
63
|
+
fieldOperation === "==" && fieldValue === null ? "is-null"
|
|
64
|
+
: fieldOperation === "!=" && fieldValue === null ? "is-not-null"
|
|
65
|
+
: fieldOperation
|
|
66
|
+
);
|
|
49
67
|
const [internalValue, setInternalValue] = useState<Date | null | undefined>(fieldValue as Date | null | undefined);
|
|
50
68
|
|
|
51
|
-
const isNullOperation = operation === "is-null";
|
|
69
|
+
const isNullOperation = operation === "is-null" || operation === "is-not-null";
|
|
70
|
+
|
|
71
|
+
// All renderable operators were filtered out (engine/property narrowing).
|
|
72
|
+
if (possibleOperations.length === 0) return null;
|
|
52
73
|
|
|
53
|
-
function updateFilter(op: VirtualTableWhereFilterOp
|
|
54
|
-
//
|
|
55
|
-
if (op === "is-null") {
|
|
74
|
+
function updateFilter(op: VirtualTableWhereFilterOp, val: Date | undefined | null) {
|
|
75
|
+
// Null-testing operators ignore their value.
|
|
76
|
+
if (op === "is-null" || op === "is-not-null") {
|
|
56
77
|
setOperation(op);
|
|
57
78
|
setInternalValue(null);
|
|
58
|
-
setValue([
|
|
79
|
+
setValue([op, null]);
|
|
59
80
|
return;
|
|
60
81
|
}
|
|
61
82
|
|
|
@@ -91,7 +112,7 @@ export function DateTimeFilterField({
|
|
|
91
112
|
size={"medium"}
|
|
92
113
|
fullWidth={true}
|
|
93
114
|
onValueChange={(value) => {
|
|
94
|
-
updateFilter(value as VirtualTableWhereFilterOp
|
|
115
|
+
updateFilter(value as VirtualTableWhereFilterOp, internalValue);
|
|
95
116
|
}}
|
|
96
117
|
renderValue={(op) => operationLabels[op as keyof typeof operationLabels]}>
|
|
97
118
|
{possibleOperations.map((op) => (
|