Skip to content

Commit

Permalink
Merge pull request #75 from edsonmartins/renderpanel
Browse files Browse the repository at this point in the history
feat: adicionar o parâmetro renderDetailPanel no ArchbaseTableTemplate
  • Loading branch information
edsonmartins committed Jun 12, 2024
2 parents 7121664 + 14dea7b commit 56a63a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/template/ArchbaseTableTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AlertVariant, Button, ButtonVariant, Flex, Paper, useMantineColorScheme
import { IconBug, IconEdit, IconEye, IconTrash } from '@tabler/icons-react';
import { IconPlus } from '@tabler/icons-react';
import { t } from 'i18next';
import { MRT_Row } from 'mantine-react-table';
import { MRT_Row, MRT_TableInstance } from 'mantine-react-table';
import React, { Fragment, ReactNode, useEffect, useRef, useState } from 'react';
import { v4 as uuidv4 } from 'uuid';
import '../../styles/template.scss';
Expand Down Expand Up @@ -79,6 +79,7 @@ export interface ArchbaseTableTemplateProps<T extends Object, ID> {
enableRowSelection?: boolean;
/* Padding da célula do cabeçalho da tabela */
tableHeadCellPadding?: string | number;
renderDetailPanel?: (props: { row: MRT_Row<T>; table: MRT_TableInstance<T> }) => ReactNode;
}

const getFilter = (
Expand Down Expand Up @@ -132,6 +133,7 @@ export function ArchbaseTableTemplate<T extends object, ID>({
bottomToolbarMinHeight,
enableRowSelection,
tableHeadCellPadding,
renderDetailPanel,
}: ArchbaseTableTemplateProps<T, ID>) {
const appContext = useArchbaseAppContext();
const filterRef = useRef<any>();
Expand Down Expand Up @@ -319,6 +321,7 @@ export function ArchbaseTableTemplate<T extends object, ID>({
bottomToolbarMinHeight={bottomToolbarMinHeight}
enableRowSelection={enableRowSelection}
tableHeadCellPadding={tableHeadCellPadding}
renderDetailPanel={renderDetailPanel}
>
{columns}
{userActions?.visible ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ const ArchbaseTableTemplateExample = () => {
}}
filterType="advanced"
filterPersistenceDelegator={dsFilters as ArchbaseQueryFilterDelegator}
renderDetailPanel={({row, table}) => <div>{row.original.nome}</div>}
/>
</Grid.Col>
</Grid>
Expand Down

0 comments on commit 56a63a6

Please sign in to comment.