1 |
|
2 |
|
3 |
|
4 | import { RowNode } from "./rowNode";
|
5 | import { ICellEditorComp } from "../rendering/cellEditors/iCellEditor";
|
6 | import { ICellRendererComp, ICellRendererFunc } from "../rendering/cellRenderers/iCellRenderer";
|
7 | import { Column } from "./column";
|
8 | import { IFilterComp } from "../interfaces/iFilter";
|
9 | import { GridApi } from "../gridApi";
|
10 | import { ColumnApi } from "../columnController/columnApi";
|
11 | import { IHeaderGroupComp } from "../headerRendering/headerGroup/headerGroupComp";
|
12 | import { IFloatingFilterComp } from "../filter/floatingFilter";
|
13 | import { CellClickedEvent, CellContextMenuEvent, CellDoubleClickedEvent } from "../events";
|
14 | import { DynamicComponentDef, DynamicComponentParams } from "../components/framework/componentResolver";
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | export interface AbstractColDef {
|
20 |
|
21 | headerName?: string;
|
22 |
|
23 | columnGroupShow?: string;
|
24 |
|
25 | headerClass?: string | string[] | ((params: any) => string | string[]);
|
26 | /** CSS class for the header */
|
27 | toolPanelClass?: string | string[] | ((params: any) => string | string[]);
|
28 | /** Expression or function to get the cells value. */
|
29 | headerValueGetter?: string | Function;
|
30 | /** Never set this, it is used internally by grid when doing in-grid pivoting */
|
31 | pivotKeys?: string[];
|
32 | /** Set to true to not include this column in the toolpanel */
|
33 | suppressToolPanel?: boolean;
|
34 | /** Tooltip for the column header */
|
35 | headerTooltip?: string;
|
36 | }
|
37 | export interface ColGroupDef extends AbstractColDef {
|
38 | /** Columns in this group */
|
39 | children: (ColDef | ColGroupDef)[];
|
40 | /** Group ID */
|
41 | groupId?: string;
|
42 | /** Open by Default */
|
43 | openByDefault?: boolean;
|
44 | /** If true, group cannot be broken up by column moving, child columns will always appear side by side, however you can rearrange child columns within the group */
|
45 | marryChildren?: boolean;
|
46 | /** The custom header group component to be used for rendering the component header. If none specified the default ag-Grid is used**/
|
47 | headerGroupComponent?: string | {
|
48 | new (): IHeaderGroupComp;
|
49 | };
|
50 | /** The custom header group component to be used for rendering the component header in the hosting framework (ie: React/Angular). If none specified the default ag-Grid is used**/
|
51 | headerGroupComponentFramework?: {
|
52 | new (): any;
|
53 | };
|
54 | /** The custom header group component to be used for rendering the component header. If none specified the default ag-Grid is used**/
|
55 | headerGroupComponentParams?: any;
|
56 | }
|
57 | export interface IAggFunc {
|
58 | (input: any[]): any;
|
59 | }
|
60 | /****************************************************************
|
61 | * Don't forget to update ComponentUtil if changing this class. PLEASE!*
|
62 | ****************************************************************/
|
63 | export interface ColDef extends AbstractColDef {
|
64 | /** The unique ID to give the column. This is optional. If missing, the ID will default to the field.
|
65 | * If both field and colId are missing, a unique ID will be generated.
|
66 | * This ID is used to identify the column in the API for sorting, filtering etc. */
|
67 | colId?: string;
|
68 | /** If sorting by default, set it here. Set to 'asc' or 'desc' */
|
69 | sort?: string;
|
70 | /** If sorting more than one column by default, the milliseconds when this column was sorted, so we know what order to sort the columns in. */
|
71 | sortedAt?: number;
|
72 | /** The sort order, provide an array with any of the following in any order ['asc','desc',null] */
|
73 | sortingOrder?: string[];
|
74 | /** The field of the row to get the cells data from */
|
75 | field?: string;
|
76 | /**
|
77 | * A comma separated string or array of strings containing ColumnType keys which can be used as a template for a column.
|
78 | * This helps to reduce duplication of properties when you have a lot of common column properties.
|
79 | */
|
80 | type?: string | string[];
|
81 | /** Set to true for this column to be hidden. Naturally you might think, it would make more sense to call this field 'visible' and mark it false to hide,
|
82 | * however we want all default values to be false and we want columns to be visible by default. */
|
83 | hide?: boolean;
|
84 | /** Whether this column is pinned or not. */
|
85 | pinned?: boolean | string;
|
86 | /** The field where we get the tooltip on the object */
|
87 | tooltipField?: string;
|
88 | /** The function used to calculate the tooltip of the object, tooltipField takes precedence*/
|
89 | tooltip?: (params: TooltipParams) => string;
|
90 |
|
91 | valueGetter?: ((params: ValueGetterParams) => any) | string;
|
92 | /** Expression or function to get the cells value for filtering. */
|
93 | filterValueGetter?: ((params: ValueGetterParams) => any) | string;
|
94 | /** If not using a field, then this puts the value into the cell */
|
95 | valueSetter?: ((params: ValueSetterParams) => boolean) | string;
|
96 | /** Function to return the key for a value - use this if the value is an object (not a primitive type) and you
|
97 | * want to a) group by this field or b) use set filter on this field. */
|
98 | keyCreator?: Function;
|
99 | /** Initial width, in pixels, of the cell */
|
100 | width?: number;
|
101 | /** Min width, in pixels, of the cell */
|
102 | minWidth?: number;
|
103 | /** Max width, in pixels, of the cell */
|
104 | maxWidth?: number;
|
105 | /** True if this column should stretch rows height to fit contents */
|
106 | autoHeight?: boolean;
|
107 | /** Class to use for the cell. Can be string, array of strings, or function. */
|
108 | cellClass?: string | string[] | ((cellClassParams: CellClassParams) => string | string[]);
|
109 | /** An object of css values. Or a function returning an object of css values. */
|
110 | cellStyle?: {} | ((params: any) => {});
|
111 | /** A function for rendering a cell. */
|
112 | cellRenderer?: {
|
113 | new (): ICellRendererComp;
|
114 | } | ICellRendererFunc | string;
|
115 | cellRendererFramework?: any;
|
116 | cellRendererParams?: any;
|
117 | cellRendererSelector?: (params: DynamicComponentParams) => DynamicComponentDef;
|
118 |
|
119 | cellEditor?: {
|
120 | new (): ICellEditorComp;
|
121 | } | string;
|
122 | cellEditorFramework?: any;
|
123 | cellEditorParams?: any;
|
124 | cellEditorSelector?: (params: DynamicComponentParams) => DynamicComponentDef;
|
125 |
|
126 | pinnedRowCellRenderer?: {
|
127 | new (): ICellRendererComp;
|
128 | } | ICellRendererFunc | string;
|
129 | pinnedRowCellRendererFramework?: any;
|
130 | pinnedRowCellRendererParams?: any;
|
131 |
|
132 | valueFormatter?: (params: ValueFormatterParams) => string | string;
|
133 |
|
134 | pinnedRowValueFormatter?: (params: ValueFormatterParams) => string | string;
|
135 |
|
136 | valueParser?: (params: ValueParserParams) => any | string;
|
137 |
|
138 | aggFunc?: string | IAggFunc;
|
139 | |
140 |
|
141 | allowedAggFuncs?: string[];
|
142 |
|
143 | rowGroupIndex?: number;
|
144 | rowGroup?: boolean;
|
145 |
|
146 | showRowGroup?: string | boolean;
|
147 |
|
148 | pivotIndex?: number;
|
149 | pivot?: boolean;
|
150 |
|
151 | comparator?: (valueA: any, valueB: any, nodeA?: RowNode, nodeB?: RowNode, isInverted?: boolean) => number;
|
152 |
|
153 | equals?: (valueA: any, valueB: any) => boolean;
|
154 |
|
155 | pivotComparator?: (valueA: string, valueB: string) => number;
|
156 |
|
157 | checkboxSelection?: boolean | ((params: any) => boolean);
|
158 | /** If true, a 'select all' checkbox will be put into the header */
|
159 | headerCheckboxSelection?: boolean | ((params: any) => boolean);
|
160 | /** If true, the header checkbox selection will work on filtered items*/
|
161 | headerCheckboxSelectionFilteredOnly?: boolean;
|
162 | rowDrag?: boolean | ((params: any) => boolean);
|
163 | /** Set to true if no menu should be shown for this column header. */
|
164 | suppressMenu?: boolean;
|
165 | /** The menu tabs to show, and in which order, the valid values for this property are:
|
166 | * filterMenuTab, generalMenuTab, columnsMenuTab **/
|
167 | menuTabs?: string[];
|
168 | /** Set to true if no sorting should be done for this column. */
|
169 | suppressSorting?: boolean;
|
170 | /** Set to true to not allow moving this column via dragging it's header */
|
171 | suppressMovable?: boolean;
|
172 | /** Set to true to not flash this column for value changes */
|
173 | suppressCellFlash?: boolean;
|
174 | /** Set to true to make sure this column is always first. Other columns, if movable, cannot move before this column. */
|
175 | lockPosition?: boolean;
|
176 | /** Set to true to block the user showing / hiding the column, the column can only be shown / hidden via definitions or API */
|
177 | lockVisible?: boolean;
|
178 | /** Set to true to block the user pinning the column, the column can only be pinned via definitions or API */
|
179 | lockPinned?: boolean;
|
180 | /** Set to true to not allow filter on this column */
|
181 | suppressFilter?: boolean;
|
182 | /** Set to true if you want the unsorted icon to be shown when no sort is applied to this column. */
|
183 | unSortIcon?: boolean;
|
184 | /** Set to true if you want this columns width to be fixed during 'size to fit' operation. */
|
185 | suppressSizeToFit?: boolean;
|
186 | /** Set to true if you do not want this column to be resizable by dragging it's edge. */
|
187 | suppressResize?: boolean;
|
188 | /** Set to true if you do not want this column to be auto-resizable by double clicking it's edge. */
|
189 | suppressAutoSize?: boolean;
|
190 | suppressKeyboardEvent?: (params: SuppressKeyboardEventParams) => boolean;
|
191 |
|
192 | enableRowGroup?: boolean;
|
193 |
|
194 | enablePivot?: boolean;
|
195 |
|
196 | enableValue?: boolean;
|
197 |
|
198 | editable?: boolean | IsColumnFunc;
|
199 | colSpan?: (params: ColSpanParams) => number;
|
200 | rowSpan?: (params: RowSpanParams) => number;
|
201 |
|
202 | suppressPaste?: boolean | IsColumnFunc;
|
203 |
|
204 | suppressNavigable?: boolean | IsColumnFunc;
|
205 |
|
206 | getQuickFilterText?: (params: GetQuickFilterTextParams) => string;
|
207 | |
208 |
|
209 |
|
210 |
|
211 | newValueHandler?: (params: any) => boolean;
|
212 |
|
213 | singleClickEdit?: boolean;
|
214 |
|
215 | template?: string;
|
216 |
|
217 | templateUrl?: string;
|
218 |
|
219 | filter?: string | {
|
220 | new (): IFilterComp;
|
221 | };
|
222 | filterFramework?: any;
|
223 |
|
224 | filterParams?: any;
|
225 |
|
226 | cellClassRules?: {
|
227 | [cssClassName: string]: (Function | string);
|
228 | };
|
229 |
|
230 | onCellValueChanged?: Function;
|
231 |
|
232 | onCellClicked?: (event: CellClickedEvent) => void;
|
233 |
|
234 | onCellDoubleClicked?: (event: CellDoubleClickedEvent) => void;
|
235 |
|
236 | onCellContextMenu?: (event: CellContextMenuEvent) => void;
|
237 |
|
238 | icons?: {
|
239 | [key: string]: string;
|
240 | };
|
241 |
|
242 | enableCellChangeFlash?: boolean;
|
243 |
|
244 | pivotValueColumn?: Column;
|
245 |
|
246 | pivotTotalColumnIds?: string[];
|
247 |
|
248 | headerComponent?: string | {
|
249 | new (): any;
|
250 | };
|
251 |
|
252 | headerComponentFramework?: {
|
253 | new (): any;
|
254 | };
|
255 |
|
256 | headerComponentParams?: any;
|
257 |
|
258 | floatingFilterComponent?: {
|
259 | new (): IFloatingFilterComp<any, any, any>;
|
260 | };
|
261 | floatingFilterComponentParams?: any;
|
262 | floatingFilterComponentFramework?: {
|
263 | new (): any;
|
264 | };
|
265 | refData?: {
|
266 | [key: string]: string;
|
267 | };
|
268 | }
|
269 | export interface IsColumnFunc {
|
270 | (params: IsColumnFuncParams): boolean;
|
271 | }
|
272 | export interface IsColumnFuncParams {
|
273 | node: RowNode;
|
274 | data: any;
|
275 | column: Column;
|
276 | colDef: ColDef;
|
277 | context: any;
|
278 | api: GridApi;
|
279 | columnApi: ColumnApi;
|
280 | }
|
281 | export interface GetQuickFilterTextParams {
|
282 | value: any;
|
283 | node: RowNode;
|
284 | data: any;
|
285 | column: Column;
|
286 | colDef: ColDef;
|
287 | }
|
288 | export interface BaseColDefParams {
|
289 | node: RowNode;
|
290 | data: any;
|
291 | colDef: ColDef;
|
292 | column: Column;
|
293 | api: GridApi;
|
294 | columnApi: ColumnApi;
|
295 | context: any;
|
296 | }
|
297 | export interface BaseWithValueColDefParams extends BaseColDefParams {
|
298 | value: any;
|
299 | }
|
300 | export interface ValueGetterParams extends BaseColDefParams {
|
301 | getValue: (field: string) => any;
|
302 | }
|
303 | export interface NewValueParams extends BaseColDefParams {
|
304 | oldValue: any;
|
305 | newValue: any;
|
306 | }
|
307 | export interface ValueSetterParams extends NewValueParams {
|
308 | }
|
309 | export interface ValueParserParams extends NewValueParams {
|
310 | }
|
311 | export interface ValueFormatterParams extends BaseWithValueColDefParams {
|
312 | }
|
313 | export interface ColSpanParams extends BaseColDefParams {
|
314 | }
|
315 | export interface RowSpanParams extends BaseColDefParams {
|
316 | }
|
317 | export interface SuppressKeyboardEventParams extends IsColumnFuncParams {
|
318 | event: KeyboardEvent;
|
319 | editing: boolean;
|
320 | }
|
321 | export interface CellClassParams {
|
322 | value: any;
|
323 | data: any;
|
324 | node: RowNode;
|
325 | colDef: ColDef;
|
326 | rowIndex: number;
|
327 | $scope: any;
|
328 | api: GridApi;
|
329 | context: any;
|
330 | }
|
331 | export interface TooltipParams {
|
332 | value: any;
|
333 | valueFormatted: any;
|
334 | data: any;
|
335 | node: RowNode;
|
336 | colDef: ColDef;
|
337 | rowIndex: number;
|
338 | $scope: any;
|
339 | api: GridApi;
|
340 | context: any;
|
341 | }
|