From cee24f7c73c3e1cfa32cde00de2c9f72208e330b Mon Sep 17 00:00:00 2001 From: Mattias Andersson Date: Mon, 2 Sep 2024 10:10:12 +0200 Subject: [PATCH] =?UTF-8?q?Add=20renderExtraHeadRows=20prop=20to=20Standar?= =?UTF-8?q?dTable,=20allows=20one=20or=20severa=E2=80=A6=20(#774)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add renderExtraHeadRows prop to StandardTable, allows one or several extra th rows in header, below ordinary header. --- .../components/StandardTable.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/grid/src/features/standard-table/components/StandardTable.tsx b/packages/grid/src/features/standard-table/components/StandardTable.tsx index b10fbc781..077ee38f3 100644 --- a/packages/grid/src/features/standard-table/components/StandardTable.tsx +++ b/packages/grid/src/features/standard-table/components/StandardTable.tsx @@ -141,17 +141,25 @@ export interface StandardTableProps< onSortOrderChange?: StandardTableOnSortOrderChange; /** - * If set, this will always show below and above first . - * This row is 100% custom, and inherits no design or functionality from StandardTable. - * You must make sure that extraHeaderRow root is a and contains elements. + * If set, this will always show inside , below last . + * This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable. + * You must make sure that renderExtraHeadRows root is one or several elements. + * You must also make sure that it has correct number of cells, with correct padding, etc. + */ + renderExtraHeadRows?: () => ReactNode; + + /** + * If set, this will always show inside , above first . + * This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable. + * You must make sure that extraHeaderRow root is a . * You must also make sure that it has correct number of cells, with correct padding, etc. */ renderExtraRowTop?: () => ReactNode; /** * If set, this will always show below last . - * This row is 100% custom, and inherits no design or functionality from StandardTable. - * You must make sure that extraHeaderRow root is a and contains elements. + * This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable. + * You must make sure that extraHeaderRow root is a . * You must also make sure that it has correct number of cells, with correct padding, etc. */ renderExtraRowBottom?: () => ReactNode; @@ -175,6 +183,7 @@ export const StandardTable = function StandardTable< variant = "standard", onKeyDown, onSortOrderChange, + renderExtraHeadRows, ...props }: StandardTableProps) { const generatedTableId = useId(); @@ -313,6 +322,7 @@ export const StandardTable = function StandardTable< items={props.items} height={"var(--current-row-height)"} /> + {renderExtraHeadRows?.()}