@rebasepro/admin 0.8.0 → 0.9.1-canary.09aaf62
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 +26 -26
- package/dist/{CollectionEditorDialog-BO_aQ-Z4.js → CollectionEditorDialog-DbPpDDwb.js} +40 -18
- package/dist/CollectionEditorDialog-DbPpDDwb.js.map +1 -0
- package/dist/{PropertyEditView-DKzOpMjR.js → PropertyEditView-DfJbZ67t.js} +81 -73
- package/dist/PropertyEditView-DfJbZ67t.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-BQTIExjA.js → RouterCollectionsStudioView-C6XQ7Il5.js} +5 -5
- package/dist/RouterCollectionsStudioView-C6XQ7Il5.js.map +1 -0
- package/dist/collection_editor/_cms_internals.d.ts +3 -3
- package/dist/collection_editor/api/generateCollectionApi.d.ts +8 -8
- 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 +5 -5
- package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +3 -3
- package/dist/collection_editor/ui/collection_editor/SwitchControl.d.ts +1 -1
- 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/useSafeSnackbarController.d.ts +1 -1
- package/dist/collection_editor/validateCollectionJson.d.ts +2 -2
- package/dist/collection_editor_ui.js +5 -5
- package/dist/collection_editor_ui.js.map +1 -1
- 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} +2 -2
- 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/EntityTableCell.d.ts +1 -1
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.d.ts +2 -2
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.d.ts +3 -3
- package/dist/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.d.ts +1 -1
- 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 +3 -3
- 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 → RebaseAdmin.d.ts} +2 -2
- package/dist/components/RebaseLayout.d.ts +5 -4
- package/dist/components/RebaseNavigation.d.ts +1 -1
- package/dist/components/RebaseShell.d.ts +1 -0
- package/dist/components/ReferenceTable/{EntitySelectionTable.d.ts → SelectionTableBinding.d.ts} +5 -5
- package/dist/components/SelectableTable/SelectableTable.d.ts +6 -6
- 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 +15 -14
- 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/editor.js +1 -1
- package/dist/editor.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/LocalChangesMenu.d.ts +1 -1
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
- package/dist/form/form_utils.d.ts +2 -2
- package/dist/{history-B3cqBzEV.js → history-GSa4BgDt.js} +7 -7
- package/dist/history-GSa4BgDt.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-B8WuGSPZ.js} +886 -692
- package/dist/src-B8WuGSPZ.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/components/formex.d.ts +1 -1
- 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 +12 -17
- package/src/collection_editor/ConfigControllerProvider.tsx +11 -11
- package/src/collection_editor/_cms_internals.ts +3 -3
- package/src/collection_editor/api/generateCollectionApi.ts +8 -8
- 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 +3 -3
- package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +3 -3
- package/src/collection_editor/ui/EditorCollectionAction.tsx +3 -3
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +3 -3
- package/src/collection_editor/ui/EditorEntityAction.tsx +3 -3
- package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +1 -1
- package/src/collection_editor/ui/KanbanSetupAction.tsx +3 -3
- package/src/collection_editor/ui/MissingReferenceWidget.tsx +1 -1
- package/src/collection_editor/ui/NewCollectionButton.tsx +1 -1
- package/src/collection_editor/ui/NewCollectionCard.tsx +1 -1
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +6 -6
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +6 -6
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +29 -29
- package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +10 -10
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +38 -7
- package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/EntityActionsSelectDialog.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/EnumForm.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +7 -7
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +9 -9
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +46 -37
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +7 -7
- package/src/collection_editor/ui/collection_editor/SwitchControl.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/BooleanPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.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/useSafeSnackbarController.ts +1 -1
- package/src/collection_editor/validateCollectionJson.ts +3 -3
- package/src/components/AdminModeSyncer.tsx +1 -1
- package/src/components/ArrayContainer.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +1 -1
- package/src/components/CollectionPanel.tsx +14 -17
- package/src/components/{EntityCollectionTable/EntityCollectionRowActions.tsx → CollectionTableBinding/CollectionRowActions.tsx} +8 -8
- package/src/components/{EntityCollectionTable/EntityCollectionTable.tsx → CollectionTableBinding/CollectionTableBinding.tsx} +13 -13
- package/src/components/{EntityCollectionTable/EntityCollectionTableProps.tsx → CollectionTableBinding/CollectionTableBindingProps.tsx} +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/PropertyTableCell.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/column_utils.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableMultipleRelationField.tsx +7 -7
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableReferenceField.tsx +10 -10
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableRelationField.tsx +7 -7
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/fields/TableStorageUpload.tsx +1 -1
- package/src/components/CollectionTableBinding/index.tsx +14 -0
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/CollectionTableToolbar.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCell.tsx +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/EntityTableCellActions.tsx +1 -1
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/common.tsx +2 -2
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/PopupFormField.tsx +6 -6
- package/src/components/{EntityCollectionTable → CollectionTableBinding}/table_bindings.tsx +1 -1
- package/src/components/{EntityCollectionView/EntityBoardCard.tsx → CollectionViewBinding/BoardCardBinding.tsx} +17 -17
- package/src/components/{EntityCollectionView/EntityCollectionBoardView.tsx → CollectionViewBinding/CollectionBoardViewBinding.tsx} +17 -16
- package/src/components/{EntityCollectionView/EntityCollectionCardView.tsx → CollectionViewBinding/CollectionCardViewBinding.tsx} +9 -9
- package/src/components/{EntityCollectionView/EntityCollectionListView.tsx → CollectionViewBinding/CollectionListViewBinding.tsx} +15 -15
- package/src/components/{EntityCollectionView/EntityCollectionViewActions.tsx → CollectionViewBinding/CollectionViewActions.tsx} +7 -7
- package/src/components/{EntityCollectionView/EntityCollectionView.tsx → CollectionViewBinding/CollectionViewBinding.tsx} +107 -92
- package/src/components/{EntityCollectionView/EntityCollectionViewStartActions.tsx → CollectionViewBinding/CollectionViewStartActions.tsx} +6 -6
- package/src/components/{EntityCollectionView/EntityCard.tsx → CollectionViewBinding/EntityCardBinding.tsx} +12 -12
- package/src/components/{EntityCollectionView → CollectionViewBinding}/FiltersDialog.tsx +49 -72
- package/src/components/{EntityCollectionView → CollectionViewBinding}/SplitListView.tsx +10 -10
- package/src/components/{EntityCollectionView → CollectionViewBinding}/ViewModeToggle.tsx +1 -1
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useCollectionInlineEditor.ts +6 -6
- package/src/components/{EntityCollectionView → CollectionViewBinding}/hooks/useKanbanDragAndDrop.ts +5 -5
- package/src/components/{EntityCollectionView → CollectionViewBinding}/useBoardDataController.tsx +25 -13
- package/src/components/{EntityCollectionView/useEntityPreviewSlots.ts → CollectionViewBinding/usePreviewSlots.ts} +9 -9
- package/src/components/DefaultAppBar.tsx +3 -3
- package/src/components/DefaultDrawer.tsx +3 -3
- package/src/components/DeleteEntityDialog.tsx +7 -7
- package/src/components/{EntityDetailView.tsx → DetailViewBinding.tsx} +28 -31
- package/src/components/DrawerNavigationGroup.tsx +2 -2
- package/src/components/{EntityEditViewFormActions.tsx → EditFormActions.tsx} +16 -16
- package/src/components/{EntityEditView.tsx → EditViewBinding.tsx} +34 -37
- package/src/components/{EntityPreview.tsx → EntityPreviewBinding.tsx} +30 -30
- package/src/components/{EntityView.tsx → EntityViewBinding.tsx} +7 -7
- package/src/components/HomePage/ContentHomePage.tsx +4 -4
- package/src/components/HomePage/FavouritesView.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +4 -4
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/HomePage/RenameGroupDialog.tsx +1 -1
- package/src/components/{EntityJsonPreview.tsx → JsonPreviewBinding.tsx} +2 -2
- package/src/components/{RebaseCMS.tsx → RebaseAdmin.tsx} +6 -5
- package/src/components/RebaseAuthGate.tsx +2 -2
- package/src/components/RebaseLayout.tsx +7 -13
- package/src/components/RebaseNavigation.tsx +35 -11
- package/src/components/RebaseRouteDefs.tsx +2 -2
- package/src/components/RebaseShell.tsx +2 -1
- package/src/components/ReferenceTable/{EntitySelectionTable.tsx → SelectionTableBinding.tsx} +27 -24
- package/src/components/ReferenceWidget.tsx +4 -4
- package/src/components/RelationSelector.tsx +15 -13
- package/src/components/SearchIconsView.tsx +2 -2
- package/src/components/SelectableTable/SelectableTable.tsx +35 -88
- package/src/components/SelectableTable/SelectableTableContext.tsx +3 -3
- package/src/components/SelectableTable/SelectionStore.ts +4 -4
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +10 -2
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +34 -13
- package/src/components/SelectableTable/filters/FilterFieldBinding.tsx +187 -0
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +22 -8
- package/src/components/SelectableTable/filters/RelationFilterField.tsx +17 -3
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +67 -13
- package/src/components/SideDialogs.tsx +4 -4
- package/src/components/{EntitySidePanel.tsx → SidePanelBinding.tsx} +20 -20
- package/src/components/{SideEntityProvider.tsx → SidePanelProvider.tsx} +17 -17
- package/src/components/UserSelector.tsx +1 -1
- package/src/components/admin/CreationResultDialog.tsx +6 -3
- package/src/components/app/Scaffold.tsx +6 -2
- package/src/components/common/default_entity_actions.tsx +132 -34
- package/src/components/field_configs.tsx +1 -1
- package/src/components/history/EntityHistoryEntry.tsx +3 -3
- package/src/components/history/EntityHistoryView.tsx +7 -7
- package/src/components/history/LastEditedByIndicator.tsx +4 -4
- package/src/components/index.ts +16 -15
- package/src/contexts/SidePanelControllerContext.tsx +5 -0
- package/src/data_export/export/BasicExportAction.tsx +1 -1
- package/src/data_export/export/ExportCollectionAction.tsx +5 -5
- package/src/data_import/components/DataNewPropertiesMapping.tsx +1 -1
- package/src/data_import/components/ImportFileUpload.tsx +1 -1
- package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +1 -1
- package/src/data_import/components/ImportSaveInProgress.tsx +4 -4
- package/src/data_import/import/ImportCollectionAction.tsx +6 -6
- package/src/data_import/utils/data.ts +4 -4
- package/src/data_import/utils/get_properties_mapping.ts +1 -1
- package/src/editor/components/image-bubble.tsx +1 -1
- package/src/editor/components/table-bubble.tsx +1 -1
- package/src/editor/editor.tsx +1 -1
- package/src/editor/selectors/link-selector.tsx +1 -1
- package/src/editor/selectors/node-selector.tsx +1 -1
- package/src/form/EntityForm.tsx +6 -6
- package/src/form/EntityFormActions.tsx +4 -4
- package/src/form/EntityFormBinding.tsx +10 -10
- package/src/form/PropertyFieldBinding.tsx +7 -7
- package/src/form/components/ErrorFocus.tsx +1 -1
- package/src/form/components/LocalChangesMenu.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +1 -1
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +5 -5
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +21 -21
- package/src/form/field_bindings/MapFieldBinding.tsx +1 -1
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +2 -2
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +3 -3
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +7 -7
- package/src/form/field_bindings/RelationFieldBinding.tsx +4 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +3 -3
- package/src/form/form_utils.ts +3 -3
- 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 +28 -13
- 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} +29 -29
- package/src/hooks/useCMSContext.tsx +7 -7
- package/src/hooks/{useEntityHistory.ts → useHistory.ts} +2 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +10 -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 +15 -15
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/preview/components/DatePreview.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +11 -11
- package/src/preview/components/RelationPreview.tsx +13 -12
- package/src/preview/components/StorageThumbnail.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
- package/src/routes/RebaseRoute.tsx +12 -12
- package/src/types/components/EntityFormActionsProps.tsx +2 -2
- package/src/types/components/EntityFormProps.tsx +3 -3
- package/src/types/components/formex.tsx +1 -1
- 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 +7 -5
- 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/RouterCollectionsStudioView-BQTIExjA.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/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/{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}/fields/TableRelationSelectorField.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/popup_field/useDraggable.tsx +0 -0
- /package/src/components/{EntityCollectionTable → CollectionTableBinding}/internal/popup_field/useWindowSize.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/FilterPresetsButton.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/useSelectionController.tsx +0 -0
- /package/src/components/{EntityCollectionView → CollectionViewBinding}/utils.ts +0 -0
|
@@ -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 {
|
|
29
|
-
import { useData, useRelationSelector } from "@rebasepro/
|
|
30
|
-
import {
|
|
28
|
+
import { EntityPreviewBindingData } from "./EntityPreviewBinding";
|
|
29
|
+
import { useData, useRelationSelector } from "@rebasepro/app";
|
|
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}
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
SearchBar,
|
|
11
11
|
Tooltip
|
|
12
12
|
} from "@rebasepro/ui";
|
|
13
|
-
import { iconsSearch } from "@rebasepro/
|
|
14
|
-
import { useTranslation } from "@rebasepro/
|
|
13
|
+
import { iconsSearch } from "@rebasepro/app";
|
|
14
|
+
import { useTranslation } from "@rebasepro/app";
|
|
15
15
|
|
|
16
16
|
const UPDATE_SEARCH_INDEX_WAIT_MS = 220;
|
|
17
17
|
|
|
@@ -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/app";
|
|
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
|
-
import { getRowHeight } from "@rebasepro/
|
|
16
|
-
import {
|
|
10
|
+
import { getRowHeight } from "@rebasepro/app";
|
|
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/app";
|
|
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
|
}
|
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { VirtualTableWhereFilterOp } from "@rebasepro/ui";
|
|
3
3
|
import { BooleanSwitchWithLabel } from "@rebasepro/ui";
|
|
4
|
-
import { useTranslation } from "@rebasepro/
|
|
4
|
+
import { useTranslation } from "@rebasepro/app";
|
|
5
5
|
|
|
6
6
|
interface BooleanFieldProps {
|
|
7
7
|
name: string,
|
|
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(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { VirtualTableWhereFilterOp } from "@rebasepro/ui";
|
|
3
3
|
import { DateTimeField, Select, SelectItem } from "@rebasepro/ui";
|
|
4
|
-
import { useCustomizationController } from "@rebasepro/
|
|
4
|
+
import { useCustomizationController } from "@rebasepro/app";
|
|
5
5
|
|
|
6
6
|
interface DateTimeFilterFieldProps {
|
|
7
7
|
name: string,
|
|
@@ -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) => (
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import React, { Suspense } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ArrayProperty,
|
|
4
|
+
FilterFieldBindingProps,
|
|
5
|
+
Property,
|
|
6
|
+
ReferenceProperty,
|
|
7
|
+
RelationProperty,
|
|
8
|
+
WhereFilterOp
|
|
9
|
+
} from "@rebasepro/types";
|
|
10
|
+
import { enumToObjectEntries, resolveFilterOperators } from "@rebasepro/common";
|
|
11
|
+
import { useCollectionScope, useComponentOverride, useResolvedComponent } from "@rebasepro/app";
|
|
12
|
+
import { StringNumberFilterField } from "./StringNumberFilterField";
|
|
13
|
+
import { BooleanFilterField } from "./BooleanFilterField";
|
|
14
|
+
import { DateTimeFilterField } from "./DateTimeFilterField";
|
|
15
|
+
import { ReferenceFilterField } from "./ReferenceFilterField";
|
|
16
|
+
import { RelationFilterField } from "./RelationFilterField";
|
|
17
|
+
|
|
18
|
+
export interface FilterFieldBindingInput {
|
|
19
|
+
/** Key of the property being filtered (the column id). */
|
|
20
|
+
propertyKey: string;
|
|
21
|
+
/** The raw property — array properties are unwrapped internally. */
|
|
22
|
+
property: Property;
|
|
23
|
+
/**
|
|
24
|
+
* Engine backing the collection (`collection.engine`). Drives which
|
|
25
|
+
* operators the engine can execute. Usually omitted — it is read from
|
|
26
|
+
* the surrounding {@link CollectionScopeProvider}; pass it explicitly
|
|
27
|
+
* only when rendering outside any collection scope.
|
|
28
|
+
*/
|
|
29
|
+
engine?: string;
|
|
30
|
+
value?: [WhereFilterOp, unknown];
|
|
31
|
+
setValue: (value?: [WhereFilterOp, unknown]) => void;
|
|
32
|
+
/** Coordination flags for fields that open their own dialogs. */
|
|
33
|
+
hidden?: boolean;
|
|
34
|
+
setHidden?: (hidden: boolean) => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The single entry point for rendering a collection filter field.
|
|
39
|
+
* Used by both the table header filters ({@link SelectableTable}) and the
|
|
40
|
+
* Filters dialog.
|
|
41
|
+
*
|
|
42
|
+
* Resolution order:
|
|
43
|
+
* 1. `property.ui.Filter` — per-property replacement (rendered even when the
|
|
44
|
+
* resolved operator list is empty; the component owns filterability).
|
|
45
|
+
* 2. `components["Collection.FilterField"]` — collection-level or app-level
|
|
46
|
+
* override (wrap mode supported via `OriginalComponent`).
|
|
47
|
+
* 3. Built-in field dispatched by property type.
|
|
48
|
+
*
|
|
49
|
+
* The operators handed to the field are the intersection of the engine's
|
|
50
|
+
* capabilities, the property-type defaults, and `property.ui.filterOperators`
|
|
51
|
+
* (see `resolveFilterOperators`). When that intersection is empty and no
|
|
52
|
+
* per-property `Filter` is set, nothing is rendered.
|
|
53
|
+
*
|
|
54
|
+
* @group Components
|
|
55
|
+
*/
|
|
56
|
+
export function FilterFieldBinding({
|
|
57
|
+
propertyKey,
|
|
58
|
+
property,
|
|
59
|
+
engine,
|
|
60
|
+
value,
|
|
61
|
+
setValue,
|
|
62
|
+
hidden,
|
|
63
|
+
setHidden
|
|
64
|
+
}: FilterFieldBindingInput): React.ReactNode {
|
|
65
|
+
|
|
66
|
+
const isArray = property.type === "array";
|
|
67
|
+
const ofVal = isArray ? (property as ArrayProperty).of : undefined;
|
|
68
|
+
const baseProperty: Property | undefined = isArray
|
|
69
|
+
? (Array.isArray(ofVal) ? ofVal[0] : ofVal) as Property | undefined
|
|
70
|
+
: property;
|
|
71
|
+
|
|
72
|
+
// Hooks must run unconditionally — before any early return.
|
|
73
|
+
const scopeCollection = useCollectionScope();
|
|
74
|
+
const ResolvedFilterField = useComponentOverride<FilterFieldBindingProps>("Collection.FilterField", DefaultFilterField);
|
|
75
|
+
const PropertyFilter = useResolvedComponent<FilterFieldBindingProps>(baseProperty?.ui?.Filter);
|
|
76
|
+
|
|
77
|
+
if (!baseProperty) return null;
|
|
78
|
+
|
|
79
|
+
const operators = resolveFilterOperators({
|
|
80
|
+
property: baseProperty,
|
|
81
|
+
isArray,
|
|
82
|
+
engine: engine ?? scopeCollection?.engine
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const bindingProps: FilterFieldBindingProps = {
|
|
86
|
+
propertyKey,
|
|
87
|
+
property: baseProperty,
|
|
88
|
+
isArray,
|
|
89
|
+
operators,
|
|
90
|
+
value,
|
|
91
|
+
setValue,
|
|
92
|
+
title: property.name,
|
|
93
|
+
hidden,
|
|
94
|
+
setHidden
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// 1. Per-property replacement — always rendered, the dev owns filterability.
|
|
98
|
+
if (PropertyFilter) {
|
|
99
|
+
return (
|
|
100
|
+
<Suspense fallback={null}>
|
|
101
|
+
<PropertyFilter {...bindingProps}/>
|
|
102
|
+
</Suspense>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 2/3. Override or built-in — only when the property is filterable here.
|
|
107
|
+
if (operators.length === 0) return null;
|
|
108
|
+
|
|
109
|
+
return <ResolvedFilterField {...bindingProps}/>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Built-in filter field dispatch by property type. This is the
|
|
114
|
+
* `OriginalComponent` received by `"Collection.FilterField"` overrides in
|
|
115
|
+
* wrap mode.
|
|
116
|
+
*/
|
|
117
|
+
function DefaultFilterField({
|
|
118
|
+
propertyKey,
|
|
119
|
+
property,
|
|
120
|
+
isArray,
|
|
121
|
+
operators,
|
|
122
|
+
value,
|
|
123
|
+
setValue,
|
|
124
|
+
title,
|
|
125
|
+
hidden,
|
|
126
|
+
setHidden
|
|
127
|
+
}: FilterFieldBindingProps): React.ReactNode {
|
|
128
|
+
|
|
129
|
+
if (property.type === "reference") {
|
|
130
|
+
const referenceProperty = property as ReferenceProperty;
|
|
131
|
+
return <ReferenceFilterField value={value}
|
|
132
|
+
setValue={setValue}
|
|
133
|
+
name={propertyKey}
|
|
134
|
+
isArray={isArray}
|
|
135
|
+
operators={operators}
|
|
136
|
+
path={referenceProperty.path}
|
|
137
|
+
title={title}
|
|
138
|
+
includeId={referenceProperty.includeId}
|
|
139
|
+
previewProperties={referenceProperty.ui?.previewProperties}
|
|
140
|
+
hidden={hidden ?? false}
|
|
141
|
+
setHidden={setHidden ?? (() => undefined)}/>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (property.type === "relation") {
|
|
145
|
+
const relation = (property as RelationProperty).relation;
|
|
146
|
+
if (!relation) return null;
|
|
147
|
+
return <RelationFilterField value={value as never}
|
|
148
|
+
setValue={setValue}
|
|
149
|
+
name={propertyKey}
|
|
150
|
+
operators={operators}
|
|
151
|
+
relation={relation}
|
|
152
|
+
hidden={hidden ?? false}
|
|
153
|
+
setHidden={setHidden ?? (() => undefined)}/>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (property.type === "number" || property.type === "string") {
|
|
157
|
+
const enumValues = property.enum ? enumToObjectEntries(property.enum) : undefined;
|
|
158
|
+
return <StringNumberFilterField value={value}
|
|
159
|
+
setValue={setValue}
|
|
160
|
+
name={propertyKey}
|
|
161
|
+
type={property.type}
|
|
162
|
+
isArray={isArray}
|
|
163
|
+
operators={operators}
|
|
164
|
+
enumValues={enumValues}
|
|
165
|
+
title={title}/>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (property.type === "boolean") {
|
|
169
|
+
return <BooleanFilterField value={value}
|
|
170
|
+
setValue={setValue}
|
|
171
|
+
name={propertyKey}
|
|
172
|
+
operators={operators}
|
|
173
|
+
title={title}/>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (property.type === "date") {
|
|
177
|
+
return <DateTimeFilterField value={value}
|
|
178
|
+
setValue={setValue}
|
|
179
|
+
name={propertyKey}
|
|
180
|
+
mode={property.mode}
|
|
181
|
+
isArray={isArray}
|
|
182
|
+
operators={operators}
|
|
183
|
+
title={title}/>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return null;
|
|
187
|
+
}
|