Skip to content

Commit 8241adb

Browse files
committed
change: Allow to pass table as Element to EntitiesPage
With rendering an table in the parent component it is not required to forward props through the EntitiesPage to the table. This is much easier to handle then to know which props to add to the EntitiesPage to be able to use them in the table.
1 parent 7c21230 commit 8241adb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/web/entities/EntitiesPage.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ export interface EntitiesPageProps<TModel extends Model = Model, TProps = {}> {
7676
powerfilter?: React.ComponentType<PowerFilterComponentProps>;
7777
section?: false | React.ComponentType<SectionComponentProps>;
7878
sectionIcon?: React.ReactNode;
79-
table: React.ComponentType<TableComponentProps<TModel> & TProps>;
79+
table:
80+
| React.ComponentType<TableComponentProps<TModel> & TProps>
81+
| React.ReactElement<TableComponentProps<TModel> & TProps>;
8082
title: string;
8183
toolBarIcons?: React.ComponentType<TProps> | React.ReactElement<TProps>;
8284
onError: (error: Error | Rejection) => void;
@@ -201,6 +203,10 @@ class EntitiesPage<
201203
return null;
202204
}
203205

206+
if (React.isValidElement(TableComponent)) {
207+
return TableComponent;
208+
}
209+
204210
const other = excludeObjectProps(props, excludeProps);
205211

206212
return (

0 commit comments

Comments
 (0)