-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathcolumnExcelExportOption.interface.ts
62 lines (50 loc) · 2.03 KB
/
columnExcelExportOption.interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import type { ExcelColumnMetadata, ExcelStyleInstruction, StyleSheet } from '@excel-builder-vanilla/types';
import type { Column } from './column.interface.js';
import type { GridOption } from './gridOption.interface.js';
import type { SlickGroupTotals } from '../core/index.js';
/** Excel custom export options (formatting & width) that can be applied to a column */
export interface ColumnExcelExportOption {
/** Defaults to true, when enabled the system will try to find the best possible format to use when exporting. */
autoDetectCellFormat?: boolean;
/**
* Option to provide custom Excel styling
* NOTE: this option will completely override any detected cell styling
*/
style?: ExcelStyleInstruction;
/** Excel column width */
width?: number;
/** Cell data value parser callback function */
valueParserCallback?: GetDataValueCallback;
}
export interface GroupTotalExportOption {
/**
* Option to provide custom Excel styling
* NOTE: this option will completely override any detected cell styling
*/
style?: ExcelStyleInstruction;
/** Cell data value parser callback function */
valueParserCallback?: GetGroupTotalValueCallback;
/** Allows to define a group type (sum, avg, ...) when auto-detect doesn't work when used with `valueParserCallback` without a `groupTotalsFormatter` to auto-detect. */
groupType?: string;
}
export interface BaseExcelValueParserArgs {
columnDef: Column;
gridOptions: GridOption;
excelFormatId: number | undefined;
stylesheet: StyleSheet;
dataRowIdx: number;
}
export interface ExcelCellValueParserArgs<T = any> extends BaseExcelValueParserArgs {
dataContext: T;
}
export interface ExcelGroupValueParserArgs extends BaseExcelValueParserArgs {
groupType: string;
}
export type GetDataValueCallback = (
data: Date | string | number,
args: ExcelCellValueParserArgs
) => Date | string | number | ExcelColumnMetadata;
export type GetGroupTotalValueCallback = (
totals: SlickGroupTotals,
args: ExcelGroupValueParserArgs
) => Date | string | number | ExcelColumnMetadata;