import { ObjectForExtending } from '../types/utils.type'; import { ColumnConfig } from '../types/column-config.type'; import { DomMetadata, DropdownItemOption } from '../types/additional.type'; import { CalculatedColumn, RenderCellProps } from 'react-data-grid'; import { ReactNode } from 'react'; export type GroupRow = { readonly childRows: readonly RowType[]; readonly childGroups: readonly RowType[] | Readonly>; groupKey: string; groupByKey: string; groupParents: string; }; export type GroupRowsOrRows = readonly (GroupRow | RowType)[]; export type RowsGrouping = { groupByState: [string[], React.Dispatch>]; rowKeyGetter: (row: RowType) => string | number; showInControl?: boolean; groupedColumnProps?: Partial, 'name' | 'resizable' | 'width' | 'minWidth' | 'maxWidth' | 'renderSummaryCell'>> & { renderCell?: (props: RenderCellProps & { parentGroupKey: string | undefined; groupByArr: string[]; }) => ReactNode; rowsGrouping?: Pick, 'renderGroupCell'>; }; expandAllBtn?: { expandedAll: (p: { allRowsIds: Set | null; shownRows: readonly RowType[]; expandedRowsIds: Set; }) => boolean; }; groupButton?: { getGroupedCount?: (props: { currCount: number; groupedCols: string[]; columns: { visible: string[]; hidden: string[]; }; }) => number; defaultCustomItems?: DropdownItemOption[]; onItemSelect?: (props: { item: DropdownItemOption; setGroupedCols: React.Dispatch>; columns: { visible: string[]; hidden: string[]; }; }) => void; }; groupRowReplaceTo?: (groupRow: GroupRow) => GroupRow | RowType; domMetadata?: DomMetadata; }; export type RenderGroupCellProps = { column: CalculatedColumn; tabIndex: number; } & GroupRow; export type ColumnRowsGrouping = { groupByColumn?: boolean; columnGroupLabel?: string; renderGroupCell?: (props: RenderGroupCellProps) => ReactNode; };