import { ObjectForExtending } from '../types/utils.type'; import { MergedCellsAlign } from '../types/merged-cells.type'; import { DomMetadata, DropdownItemOption } from '../types/additional.type'; import { CanvasContent, CellInfoGlideInstance } from '../TableGlideInstance/type'; import { Theme } from '../../TableGlide'; export type GroupRow = { readonly childRows: readonly RowType[]; readonly childGroups: readonly RowType[] | Readonly>; groupKey: string; groupByKey: string; groupParents: string; }; export type GroupRowsOrRows = readonly (GroupRow | RowType)[]; type LocalColumnInstance = Record<'key' | 'name' | 'width' | string, unknown>; export type RowsGrouping = { groupByState: [string[], React.Dispatch>]; view?: 'tree' | 'merged'; mergedCellsAlign?: MergedCellsAlign; disableGroupColumnsSort?: boolean; rowKeyGetter: (row: RowType) => string | number; showInControl?: boolean; groupedColumnProps?: Partial> & { renderCell?: (props: CellInfoGlideInstance & { parentGroupKey: string | undefined; groupByArr: string[]; }) => CanvasContent; 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: ColumnConfig; tabIndex: number; theme?: Theme; } & GroupRow; export type ColumnRowsGrouping = { groupByColumn?: boolean; columnGroupLabel?: string; renderGroupCell?: (props: RenderGroupCellProps) => CanvasContent; }; export {};