Add extraActions fallback to MasterDetai and DataTable

Summary: Old MasterDetail and DataTable (pre-power search) are using `extraActions` prop which no longer exists in teh new components. This diff adds a fallback.

Reviewed By: ivanmisuno

Differential Revision: D49869730

fbshipit-source-id: 4c1a658aa94acc770836f9bf296a3df7d6cdcb3e
This commit is contained in:
Andrey Goncharov
2023-10-03 09:13:02 -07:00
committed by Facebook GitHub Bot
parent 9d83697168
commit 1e81fe636a
2 changed files with 5 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ export function MasterDetailWithPowerSearch<T extends object>({
sidebarSize, sidebarSize,
onSelect, onSelect,
actionsTop, actionsTop,
extraActions,
enableMenuEntries, enableMenuEntries,
enableClear, enableClear,
isPaused, isPaused,
@@ -232,6 +233,7 @@ export function MasterDetailWithPowerSearch<T extends object>({
</> </>
} }
actionsTop={actionsTop} actionsTop={actionsTop}
extraActions={extraActions}
/> />
); );

View File

@@ -87,6 +87,8 @@ type DataTableBaseProps<T = any> = {
scrollable?: boolean; scrollable?: boolean;
actionsRight?: React.ReactElement; actionsRight?: React.ReactElement;
actionsTop?: React.ReactElement; actionsTop?: React.ReactElement;
/** @deprecated **/
extraActions?: React.ReactElement;
onSelect?(record: T | undefined, records: T[]): void; onSelect?(record: T | undefined, records: T[]): void;
onRowStyle?(record: T): CSSProperties | undefined; onRowStyle?(record: T): CSSProperties | undefined;
tableManagerRef?: RefObject<DataTableManager<T> | undefined>; // Actually we want a MutableRefObject, but that is not what React.createRef() returns, and we don't want to put the burden on the plugin dev to cast it... tableManagerRef?: RefObject<DataTableManager<T> | undefined>; // Actually we want a MutableRefObject, but that is not what React.createRef() returns, and we don't want to put the burden on the plugin dev to cast it...
@@ -663,6 +665,7 @@ export function DataTable<T extends object>(
</Dropdown> </Dropdown>
)} )}
{props.actionsRight} {props.actionsRight}
{props.extraActions}
</Searchbar> </Searchbar>
)} )}
</Layout.Container> </Layout.Container>