Pass TableManager instance to Details sidebar of any MasterDetail table

Summary: Project: https://docs.google.com/document/d/1SbFrpvfIShX5npANNa1AkgHliR1M-VMLW5Q9RhREt94/edit#

Reviewed By: passy

Differential Revision: D45354900

fbshipit-source-id: 7f968c9d235f5d8bb23e59e50e39fc1e9f498f46
This commit is contained in:
Andrey Goncharov
2023-04-28 12:19:45 -07:00
committed by Facebook GitHub Bot
parent 423a8d1935
commit 27eb5978a9

View File

@@ -46,7 +46,10 @@ type MasterDetailProps<T> = {
* Component that accepts a 'record' prop that is used to render details.
* If none is provided, a standard `DataInspector` component will be used to display the entire record.
*/
sidebarComponent?: React.FC<{record: T}>;
sidebarComponent?: React.FC<{
record: T;
tableManagerRef?: React.RefObject<DataTableManager<T> | undefined>;
}>;
/**
* Default size of the sidebar.
*/
@@ -114,6 +117,7 @@ export function MasterDetail<T extends object>({
sidebarPosition !== 'none' && selectedRecord && sidebarComponent
? createElement(sidebarComponent, {
record: selectedRecord,
tableManagerRef,
})
: null;