Skip to content

Commit 40ee1c7

Browse files
authored
fix(AnalyticalTable - TypeScript): fix cell types & add missing cell & row types (#7890)
Fixes #7887
1 parent 2a5e856 commit 40ee1c7

File tree

1 file changed

+26
-12
lines changed
  • packages/main/src/components/AnalyticalTable/types

1 file changed

+26
-12
lines changed

packages/main/src/components/AnalyticalTable/types/index.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,16 @@ export interface ColumnType extends Omit<AnalyticalTableColumnDefinition, 'id'>
9393
export interface CellType {
9494
column: ColumnType;
9595
row: RowType;
96-
value: string | undefined;
97-
getCellProps: (props?: any) => any;
96+
value: string | undefined | null;
97+
getCellProps: (userProps?: any) => any;
98+
/**
99+
* Indicates whether the cell is aggregated.
100+
*
101+
* __Note:__ This is a numeric flag where `1` means true and `0` means false.
102+
*/
103+
isAggregated: 0 | 1;
104+
isGrouped: boolean;
105+
isPlaceholder: boolean;
98106
[key: string]: any;
99107
}
100108

@@ -257,27 +265,33 @@ export interface WCRPropertiesType {
257265
onFilter: AnalyticalTablePropTypes['onFilter'];
258266
}
259267

260-
export type CellInstance = TableInstance & { cell: CellType } & Omit<CellType, 'getCellProps'>;
268+
export type CellInstance = TableInstance & { cell: CellType } & Omit<
269+
CellType,
270+
'getCellProps' | 'isAggregated' | 'isGrouped' | 'isPlaceholder'
271+
>;
261272

262273
export interface RowType {
263-
allCells: Record<string, any>[];
264274
canExpand: boolean;
265-
cells: Record<string, any>[];
275+
cells: CellType[];
276+
allCells: Record<string, any>[];
266277
depth: number;
267-
getRowProps: (props?: any) => any;
268-
getToggleRowExpandedProps: (userProps?: any) => any;
269-
getToggleRowSelectedProps: (userProps?: any) => any;
270278
id: string;
271279
index: number;
272-
isExpanded: boolean;
280+
isExpanded: boolean | undefined;
273281
isSelected: boolean;
274282
isSomeSelected: boolean;
283+
getRowProps: (props?: any) => any;
275284
original: Record<string, any>;
276285
originalSubRows: Record<string, any>[];
277-
subRows: Record<string, any>[];
278-
toggleRowExpanded: (isExpanded?: boolean) => void;
279-
toggleRowSelected: (isSelected?: boolean) => void;
286+
subRows: RowType[];
280287
values: Record<string, any>;
288+
groupByID?: string;
289+
groupByVal?: string;
290+
leafRows?: Omit<RowType, 'leafRows'>[];
291+
getToggleRowExpandedProps?: (userProps?: any) => any;
292+
getToggleRowSelectedProps?: (userProps?: any) => any;
293+
toggleRowExpanded?: (isExpanded?: boolean) => void;
294+
toggleRowSelected?: (isSelected?: boolean) => void;
281295
[key: string]: any;
282296
}
283297

0 commit comments

Comments
 (0)