package.build.lib.features.Grouping.d.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of table-core Show documentation
Show all versions of table-core Show documentation
Headless UI for building powerful tables & datagrids for TS/JS.
The newest version!
import { RowModel } from '..';
import { BuiltInAggregationFn } from '../aggregationFns';
import { TableFeature } from '../core/table';
import { Cell, Column, OnChangeFn, Table, Row, Updater, ColumnDefTemplate, RowData, AggregationFns } from '../types';
export type GroupingState = string[];
export interface GroupingTableState {
grouping: GroupingState;
}
export type AggregationFn = (columnId: string, leafRows: Row[], childRows: Row[]) => any;
export type CustomAggregationFns = Record>;
export type AggregationFnOption = 'auto' | keyof AggregationFns | BuiltInAggregationFn | AggregationFn;
export interface GroupingColumnDef {
aggregationFn?: AggregationFnOption;
aggregatedCell?: ColumnDefTemplate['getContext']>>;
enableGrouping?: boolean;
getGroupingValue?: (row: TData) => any;
}
export interface GroupingColumn {
getCanGroup: () => boolean;
getIsGrouped: () => boolean;
getGroupedIndex: () => number;
toggleGrouping: () => void;
getToggleGroupingHandler: () => () => void;
getAutoAggregationFn: () => AggregationFn | undefined;
getAggregationFn: () => AggregationFn | undefined;
}
export interface GroupingRow {
groupingColumnId?: string;
groupingValue?: unknown;
getIsGrouped: () => boolean;
getGroupingValue: (columnId: string) => unknown;
_groupingValuesCache: Record;
}
export interface GroupingCell {
getIsGrouped: () => boolean;
getIsPlaceholder: () => boolean;
getIsAggregated: () => boolean;
}
export interface ColumnDefaultOptions {
onGroupingChange: OnChangeFn;
enableGrouping: boolean;
}
interface GroupingOptionsBase {
manualGrouping?: boolean;
onGroupingChange?: OnChangeFn;
enableGrouping?: boolean;
getGroupedRowModel?: (table: Table) => () => RowModel;
groupedColumnMode?: false | 'reorder' | 'remove';
}
type ResolvedAggregationFns = keyof AggregationFns extends never ? {
aggregationFns?: Record>;
} : {
aggregationFns: Record>;
};
export interface GroupingOptions extends GroupingOptionsBase, ResolvedAggregationFns {
}
export type GroupingColumnMode = false | 'reorder' | 'remove';
export interface GroupingInstance {
setGrouping: (updater: Updater) => void;
resetGrouping: (defaultState?: boolean) => void;
getPreGroupedRowModel: () => RowModel;
getGroupedRowModel: () => RowModel;
_getGroupedRowModel?: () => RowModel;
}
export declare const Grouping: TableFeature;
export declare function orderColumns(leafColumns: Column[], grouping: string[], groupedColumnMode?: GroupingColumnMode): Column[];
export {};
© 2015 - 2024 Weber Informatics LLC | Privacy Policy