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