forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui-grid.d.ts
871 lines (851 loc) · 37.3 KB
/
ui-grid.d.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
// Type definitions for ui-grid
// Project: http://www.ui-grid.info/
// Definitions by: Ben Tesser <https://github.com/btesser>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// These are very definitely preliminary. Please feel free to improve.
// Changelog:
// 7/8/2015 ui-grid v3.0.0-rc.22-482dc67
// Added primary interfaces for row, column, api, grid, columnDef, and gridOptions. Needs more tests!
/// <reference path='../angularjs/angular.d.ts' />
declare module uiGrid {
export interface UIGridConstants {
LOG_DEBUG_MESSAGES: boolean;
LOG_WARN_MESSAGES: boolean;
LOG_ERROR_MESSAGES: boolean;
CUSTOM_FILTERS: RegExp;
COL_FIELD: RegExp;
MODEL_COL_FIELD: RegExp;
TOOLTIP: RegExp;
DISPLAY_CELL_TEMPLATE: RegExp;
TEMPLATE_REGEXP: RegExp;
FUNC_REGEXP: RegExp;
DOT_REGEXP: RegExp;
APOS_REGEXP: RegExp;
BRACKET_REGEXP: RegExp;
COL_CLASS_PREFIX: string;
events: {
GRID_SCROLL: string;
COLUMN_MENU_SHOWN: string;
ITEM_DRAGGING: string;
COLUMN_HEADER_CLICK: string;
};
keymap: {
TAB: number;
STRG: number;
CAPSLOCK: number;
CTRL: number;
CTRLRIGHT: number;
CTRLR: number;
SHIFT: number;
RETURN: number;
ENTER: number;
BACKSPACE: number;
BCKSP: number;
ALT: number;
ALTR: number;
ALTRIGHT: number;
SPACE: number;
WIN: number;
MAC: number;
FN: number;
PG_UP: number;
PG_DOWN: number;
UP: number;
DOWN: number;
LEFT: number;
RIGHT: number;
ESC: number;
DEL: number;
F1: number;
F2: number;
F3: number;
F4: number;
F5: number;
F6: number;
F7: number;
F8: number;
F9: number;
F10: number;
F11: number;
F12: number;
};
ASC: string;
DESC: string;
filter: {
STARTS_WITH: number;
ENDS_WITH: number;
EXACT: number;
CONTAINS: number;
GREATER_THAN: number;
GREATER_THAN_OR_EQUAL: number;
LESS_THAN: number;
LESS_THAN_OR_EQUAL: number;
NOT_EQUAL: number;
SELECT: string;
INPUT: string;
};
scrollDirection: {
UP: string;
DOWN: string;
LEFT: string;
RIGHT: string;
NONE: string;
};
aggregationTypes: {
sum: number;
count: number;
avg: number;
min: number;
max: number;
};
CURRENCY_SYMBOLS: Array<string>;
dataChange: {
ALL: string;
EDIT: string;
ROW: string;
COLUMN: string;
OPTIONS: string;
}
scrollbars: {
NEVER: number;
ALWAYS: number;
}
}
export interface IGridInstance {
appScope?: ng.IScope;
columnFooterHeight?: number;
footerHeight?: number;
isScrollingHorizontally?: boolean;
isScrollingVertically?: boolean;
scrollDirection?: number;
addRowHeaderColumn(column: IGridColumn): void;
assignTypes(): void;
buildColumnDefsFromData(rowBuilder: IRowBuilder): void;
buildColumns(options: IBuildColumnsOptions): ng.IPromise<any>;
buildStyles(): void;
callDataChangeCallbacks(type: number): void;
clearAllFilters(refreshRows: boolean, clearConditions: boolean, clearFlags: boolean): void;
columnRefreshCallback(name: string): void;
createLeftContainer(): void;
createRightContainer(): void;
flagScrollingHorizontally(): void;
flagScrollingVertically(): void;
getCellDisplayValue(row: IGridRow, col: IGridColumn): string;
getCellValue(row: IGridRow, col: IGridColumn): any;
getColDef(name: string): IColumnDef;
getColumn(name: string): IGridColumn;
getColumnSorting(): Array<IGridColumn>;
getGridQualifiedColField(col: IGridColumn): any;
getOnlyDataColumns(): Array<IGridColumn>;
getRow(rowEntity: any, rows?: Array<IGridRow>): IGridRow;
handleWindowResize(): void;
hasLeftContainer(): boolean;
hasRightContainer(): boolean;
hasLeftContainerColumns(): boolean;
hasRightContainerColumns(): boolean;
isRTL(): boolean;
isRowHeaderColumn(col: IGridColumn): boolean;
modifyRows(): void;
notifyDataChange(type: string): void;
precompileCellTemplates(): void;
processRowBuilders(gridRow: IGridRow): IGridRow;
processRowsCallback(name: string): void;
queueGridRefresh(): void;
queueRefresh(): void;
redrawCanvas(rowsAdded?: boolean): void;
refresh(rowsAltered?: boolean): void;
refreshCanvas(buildStyles?: boolean): ng.IPromise<any>;
refreshRows(): ng.IPromise<any>;
registerColumnBuilder(columnBuilder: IColumnBuilder): void;
registerColumnsProcessor(columnProcessor: IColumnProcessor, priority: number): void;
registerDataChangeCallback(callback: (grid: IGridInstance) => void, types: Array<string>): Function;
registerRowBuilder(rowBuilder: IRowBuilder): void;
registerRowsProcessor(rowProcessor: IRowProcessor, priority: number): void;
registerStyleComputation(styleComputation: ($scope: ng.IScope) => string): void;
removeRowsProcessor(rows: IRowProcessor): void;
resetColumnSorting(excludedColumn: IGridColumn): void;
scrollTo(rowEntity: IGridRow, colDef: IColumnDef): ng.IPromise<any>;
scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): ng.IPromise<any>;
sortColumn(column: IGridColumn, direction?: string, add?: boolean): ng.IPromise<IGridColumn>;
updateCanvasHeight(): void;
updateFooterHeightCallback(name: string): void;
}
export interface IBuildColumnsOptions {
orderByColumnDefs?: boolean;
}
export interface IColumnBuilder {
(colDef: IColumnDef, col: IGridColumn, gridOptions: IGridOptions): void;
}
export interface IRowBuilder {
(row: IGridRow, gridOptions: IGridOptions): void;
}
export interface IRowProcessor {
(renderedRowsToProcess: Array<IGridRow>, columns: Array<IGridColumn>): Array<IGridRow>;
}
export interface IColumnProcessor {
(renderedColumnsToProcess: Array<IGridColumn>, rows: Array<IGridRow>): Array<IGridColumn>;
}
export interface IGridOptions {
aggregationCalcThrottle?: number;
appScopeProvider?: ng.IScope | Object;
columnDefs?: IColumnDef;
columnFooterHeight?: number;
columnVirtualizationThreshold?: number;
data?: Array<any> | string;
enableColumnMenus?: boolean;
enablePagiationControls?: boolean;
enableFiltering?: boolean;
enableHorizontalScrollbar?: boolean;
enableMinHeightCheck?: boolean;
enableRowHashing?: boolean;
enableRowSelection?: boolean;
enableSorting?: boolean;
enableVerticalScrollbar?: boolean;
excessColumns?: number;
excessRows?: number;
excludeProperties?: Array<string>;
flatEntityAccess?: boolean;
footerTemplate?: string;
gridFooterTemplate?: string;
gridMenuCustomItems?: Array<IMenuItem>;
gridMenuShowHideColumns?: boolean;
gridMenuTitleFilter?: (title: string) => ng.IPromise<string> | string;
headerTemplate?: string;
horizontalScrollThreshold?: number;
infiniteScrollDown?: boolean;
infiniteScrollRowsFromEnd?: number;
infiniteScrollUp?: boolean;
maxVisibleColumnCount?: number;
minRowsToShow?: number;
minimumColumnSize?: number;
onRegisterApi?: (gridApi: IGridApi) => void;
rowHeight?: number;
rowTemplate?: string;
scrollDebounce?: number;
scrollThreshold?: number;
showColumnFooter?: boolean;
showGridFooter?: boolean;
showHeader?: boolean;
useExternalFiltering?: boolean;
useExternalSorting?: boolean;
virtualizationThreshold?: number;
wheelScrollThrottle?: number;
getRowIdentity?(): any;
rowEquality?(entityA: IGridRow, entityB: IGridRow): boolean;
rowIdentity? (): any;
totalItems?: number;
paginationPageSize?: number;
paginationCurrentPage?: number;
}
export interface IGridCoreApi {
addRowHeaderColumn(column: IColumnDef): void;
addToGridMenu(grid: IGridInstance, items: Array<IMenuItem>): void;
clearAllFilters(refreshRows?: boolean, clearConditions?: boolean, clearFlags?: boolean): ng.IPromise<Array<IGridRow>>;
clearRowInvisible(rowEntity: any): void;
getVisibleRows(grid: IGridInstance): Array<IGridRow>;
handleWindowResize(): void;
notifiyDataChange(type: string): void;
refreshRows(): ng.IPromise<boolean>;
registerColumnsProcessor(processorFunction: IColumnProcessor, priority: number): void;
registerRowsProcessor(rowProcessor: IRowProcessor, priority: number): void;
removeFromGridMenu(grid: IGridInstance, id: string): void;
scrollTo(entity: any, colDef: IColumnDef): void; /*A row entity can be anything?*/
scrollToIfNecessary(gridRow: IGridRow, gridCol: IGridColumn): void;
setRowInvisible(rowEntity: any): void;
sortHandleNulls(a: any,b: any): number;
queueGridRefresh(): void;
queueRefresh(): void;
on: {
sortChanged: (scope: ng.IScope, handler: (grid: IGridInstance, sortColumns: Array<IColumnDef>) => void) => void;
columnVisiblityChanged: (scope: ng.IScope, handler: (grid: IGridColumn) => void) => void;
canvasHeightChanged: (scope: ng.IScope, handler: (oldHeight: number, newHeight: number) => void) => void;
/**
* filterChangedis raised after the filter is changed. The nature of the watch expression doesn't allow notification
* of what changed, so the receiver of this event will need to re-extract the filter conditions from the columns.
* http://ui-grid.info/docs/#/api/ui.grid.core.api:PublicApi
*/
filterChanged: (scope: ng.IScope, handler: () => void) => void;
rowsRendered: (scope: ng.IScope, handler: () => void) => void;
rowsVisibleChanged: (scope: ng.IScope, handler: () => void) => void;
scrollBegin: (scope: ng.IScope, handler: () => void) => void;
scrollEnd: (scope: ng.IScope, handler: () => void) => void;
}
}
export interface IGridSelectionApi {
toggleRowSelection: (rowEntity: IGridRow, event?: Event) => void;
selectRow: (rowEntity: IGridRow, event?: Event) => void;
selectRowByVisibleIndex: (rowEntity: number, event?: Event) => void;
unSelectRow: (rowEntity: IGridRow, event?: Event) => void;
selectAllRows: (event?: Event) => void;
selectAllVisibleRows: (event?: Event) => void;
clearSelectedRows: (event?: Event) => void;
getSelectedRows: () => Array<IGridRow>;
getSelectedGridRows: () => Array<IGridRow>;
setMultiSelect: (multiSelect: boolean) => void;
setModifierKeysToMultiSelect: (multiSelect: boolean) => void;
getSelectAllState: () => boolean;
on: {
rowSelectionChanged: (scope: ng.IScope, handler: (row: IGridRow, event?: Event) => void) => void;
rowSelectionChangedBatch: (scope: ng.IScope, handler: (row: Array<IGridRow>, event?: Event) => void) => void;
}
}
export interface IGridPaginationApi {
getPage: () => number;
getTotalPages: () => number;
nextPage: () => void;
previousPage: () => void;
seek: () => void;
on: {
paginationChanged: (scope: ng.IScope, handler: (newPage: number, pageSize: number) => void) => void;
}
}
export interface IGridRowEditApi {
flushDirtyRows(grid?: IGridInstance): ng.IPromise<boolean>;
getDirtyRows(grid?: IGridInstance): Array<IGridRow>;
getErrorRows(grid?: IGridInstance): Array<IGridRow>;
setRowsClean(dataRows: Array<any>): Array<any>;
setRowsDirty(dataRows: Array<any>): Array<any>;
setSavePromise(rowEntity: Object, savePromise: ng.IPromise<any>): void;
on: {
saveRow: (scope: ng.IScope, handler: (rowEntity: Array<any>) => void) => void
}
}
export interface IGridApiConstructor {
new (grid: IGridInstance): IGridApi;
}
export interface IGridApi {
/**
* Registers a new event for the given feature. The event will get a .raise and .on prepended to it
*
* .raise.eventName() - takes no arguments
*
* .on.eventName(scope, callBackFn, _this)
* scope - a scope reference to add a deregister call to the scopes .$on('destroy').
* Scope is optional and can be a null value, but in this case you must deregister it yourself via the returned
* deregister function
* callBackFn - The function to call
* _this - optional this context variable for callbackFn. If omitted, grid.api will be used for the context
*
* .on.eventName returns a dereg function that will remove the listener. It's not necessary to use it as the
* listener will be removed when the scope is destroyed.
* @param featureName name of the feature that raises the event
* @param eventName name of the event
*/
registerEvent(featureName: string, eventName: string): void;
/**
* Registers features and events from a simple objectMap.
* eventObjectMap must be in this format (multiple features allowed)
* @param eventObjectMap map of feature/event names
*/
registerEventsFromObject(eventObjectMap: any): void;
/**
* Registers a new event for the given feature
* @param featureName name of the feature
* @param methodName name of the method
* @param callBackFn function to execute
* @param _this binds to callBackFn. Defaults to gridApi.grid
*/
registerMethod(featureName: string, methodName: string, callBackFn: Function, _this: any): void;
/**
* Registers features and methods from a simple objectMap.
* eventObjectMap must be in this format (multiple features allowed)
* {featureName: { methodNameOne:function(args){}, methodNameTwo:function(args){} }
* @param eventObjectMap map of feature/event names
* @param _this binds this to _this for all functions. Defaults to gridApi.grid
*/
registerMethodsFromObject(eventObjectMap: any, _this: any): void;
/**
* Used to execute a function while disabling the specified event listeners.
* Disables the listenerFunctions, executes the callbackFn, and then enables the listenerFunctions again
* @param listenerFuncs listenerFunc or array of listenerFuncs to suppress.
* These must be the same functions that were used in the .on.eventName method
* @param callBackFn function to execute
*/
suppressEvents(listenerFuncs: Function | Array<Function>, callBackFn: Function): void;
/**
* Core Api
*/
core: IGridCoreApi;
/**
* Selection api
*/
selection: IGridSelectionApi;
/**
* Pagination api
*/
pagination: IGridPaginationApi;
/**
* Grid Row Edit Api
*/
rowEdit: IGridRowEditApi;
/**
* A grid instance is made available in the gridApi.
*/
grid: IGridInstance;
}
export interface IGridRowConstructor {
/**
* GridRow is the viewModel for one logical row on the grid.
* A grid Row is not necessarily a one-to-one relation to gridOptions.data.
* @param entity the array item from GridOptions.data
* @param index the current position of the row in the array
* @param reference to the parent grid
*/
new(entity: any, index: number, reference: IGridInstance): IGridRow;
}
export interface IGridRow {
/** A reference to an item in gridOptions.data[] */
entity: any;
/** A reference back to the grid */
grid: IGridInstance;
/**
* height of each individual row. changing the height will flag all
* row renderContainers to recalculate their canvas height
*/
height: number;
/** uniqueId of row */
uid: string;
/** if true, row will be rendered */
visible: boolean;
// Additional features enabled by other modules
/** enable editing on row, grouping for example might disable editing on group header rows */
enableCellEdit: boolean;
/**
* Enable row selection for this row, only settable by internal code.
*
* The grouping feature, for example, might set group header rows to not be selectable.
* Defaults to true
* @default true
*/
enableSelection: boolean;
/**
* Selected state of row.
* Should be readonly.
* Make any changes to selected state using setSelected().
* Defaults to false
*
* @readonly
* @default false
*/
isSelected: boolean;
/**
* If set to false, then don't export this row,
* notwithstanding visible or other settings
* Defaults to true
* @default true
*/
exporterEnableExporting: boolean;
/**
* Sets the isSelected property and updates the selectedCount
* Changes to isSelected state should only be made via this function
* @param selected Value to set
*/
setSelected(selected: boolean): void;
/**
* Clears an override on the row that forces it to always be invisible.
* Emits the rowsVisibleChanged event if it changed the row visibility.
*
* This method can be called from the api, passing in the gridRow we want altered.
* It should really work by calling gridRow.clearRowInvisible,
* but that's not the way I coded it, and too late to change now.
* Changed to just call the internal function row.clearThisRowInvisible().
* @param row the row we want to clear the invisible flag
*/
clearRowInvisible(row: IGridRow): void;
/**
* Clears any override on the row visibility, returning it to normal visibility calculations.
* Emits the rowsVisibleChanged event
* @param reason the reason (usually the module) for the row to be invisible. E.g. grouping, user, filter
* @param fromRowsProcessor whether we were called from a rowsProcessor, passed through to evaluateRowVisibility
*/
clearRowInvisible(reason: string, fromRowsProcessor: boolean): void;
/**
* Determines whether the row should be visible based on invisibleReason,
* and if it changes the row visibility, then emits the rowsVisibleChanged event.
* Queues a grid refresh, but doesn't call it directly to avoid hitting lots of
* grid refreshes.
*/
evaluateRowVisibility(fromRowProcessor: boolean): void;
/**
* returns the qualified field name minus the row path ie: entity.fieldA
* @param col column instance
* @returns resulting name that can be evaluated against a row
*/
getEntityQualifiedColField(col: IGridColumn): string;
/**
* returns the qualified field name as it exists on scope ie: row.entity.fieldA
* @param col column instance
* @returns resulting name that can be evaluated on scope
*/
getQualifiedColField(col: IGridColumn): string;
/**
* Sets an override on the row that forces it to always be invisible.
* Emits the rowsVisibleChanged event if it changed the row visibility.
* This method can be called from the api, passing in the gridRow we want altered.
* It should really work by calling gridRow.setRowInvisible,
* but that's not the way I coded it, and too late to change now.
* Changed to just call the internal function row.setThisRowInvisible().
* @param row the row we want to set to invisible
*/
setRowInvisible(row: IGridRow): void;
/**
* Sets an override on the row that forces it to always be invisible.
* Emits the rowsVisibleChanged event if it changed the row visibility
* @param reason the reason (usually the module) for the row to be invisible. E.g. grouping, user, filter
* @param fromRowsProcessor whether we were called from a rowsProcessor, passed through to evaluateRowVisibility
*/
setThisRowInvisible(reason: string, fromRowsProcessor: boolean): void;
}
export interface IGridColumnConstructor {
/**
* Represents the viewModel for each column.
* Any state or methods needed for a Grid Column are defined on this prototype
* @param gridCol Column definition
* @param index the current position of the column in the array
* @param grid reference to the grid
*/
new(gridCol: IColumnDef, index: number, grid: IGridInstance): IGridColumn;
}
export interface IGridColumn {
/**
* Column name that will be shown in the header.
* If displayName is not provided then one is generated using the name.
*/
displayName?: string;
/**
* field must be provided if you wish to bind to a property in the data source.
* Should be an angular expression that evaluates against grid.options.data array element.
* Can be a complex expression: employee.address.city, or can be a function: employee.getFullAddress().
* See the angular docs on binding expressions.
*/
field?: string;
/** Filter on this column */
filter?: IFilterOptions;
/** Filters for this column. Includes 'term' property bound to filter input elements */
filters?: Array<IFilterOptions>;
name?: string;
/** Sort on this column */
sort?: ISortInfo
/** Algorithm to use for sorting this column. Takes 'a' and 'b' parameters like any normal sorting function. */
sortingAlgorithm?: (a: any, b: any) => number;
/**
* Initializes a column
* @param colDef the column def to associate with this column
* @param uid The unique and immutable uid we'd like to allocate to this column
* @param grid the grid we'd like to create this column in
*/
GridColumn(colDef: IColumnDef, uid: number, grid: IGridInstance): void;
/**
* Gets the aggregation label from colDef.aggregationLabel if specified or by using i18n,
* including deciding whether or not to display based on colDef.aggregationHideLabel.
* @param label the i18n lookup value to use for the column label
*/
getAggregationText(label: string): void;
/**
* gets the aggregation value based on the aggregation type for this column.
* Debounced using scrollDebounce option setting
*/
getAggregationValue(): string;
/**
* Returns the class name for the column
* @param prefixDot if true, will return .className instead of className
*/
getColClass(prefixDot: boolean): string;
/** Returns the class definition for th column */
getColClassDefinition(): string;
/**
* Returns the render container object that this column belongs to.
* Columns will be default be in the body render container
* if they aren't allocated to one specifically.
*/
getRenderContainer(): any; // @todo replace with interface for render container
/** Hides the column by setting colDef.visible = false */
hideColumn(): void;
/** Returns true if column is in the left render container */
isPinnedLeft(): boolean;
/** Returns true if column is in the right render container */
isPinnedRight(): boolean;
/**
* Sets a property on the column using the passed in columnDef,
* and setting the defaultValue if the value cannot be found on the colDef
* @param colDef the column def to look in for the property value
* @param propName the property name we'd like to set
* @param defaultValue the value to use if the colDef doesn't provide the setting
*/
setPropertyOrDefault(colDef: IColumnDef, propName: string, defaultValue: any): void;
/** Makes the column visible by setting colDef.visible = true */
showColumn(): void;
/**
* Moves settings from the columnDef down onto the column, and sets properties as appropriate
* @param colDef the column def to look in for property value
* @param isNew whether the column is being newly created, if not we're updating an existing
* column, and some items such as the sort shouldn't be copied down
*/
updateColumnDef(colDef: IColumnDef, isNew: boolean): void;
}
/**
* Definition / configuration of an individual column,
* which would typically be one of many column definitions within the
* gridOptions.columnDefs array
*/
export interface IColumnDef {
/**
* defaults to false
* if set to true hides the label text in the aggregation footer, so only the value is displayed.
*/
aggregationHideLabel?: boolean;
/**
* The aggregation that you'd like to show in the columnFooter for this column.
* Valid values are in uiGridConstants, and currently include:
* uiGridConstants.aggregationTypes.count, uiGridConstants.aggregationTypes.sum,
* uiGridConstants.aggregationTypes.avg, uiGridConstants.aggregationTypes.min,
* uiGridConstants.aggregationTypes.max.
*
* You can also provide a function as the aggregation type,
* in this case your function needs to accept the full set of visible rows,
* and return a value that should be shown
*/
aggregationType?: number | Function;
/**
* cellClass can be a string specifying the class to append to a cell
* or it can be a function(row,rowRenderIndex, col, colRenderIndex)
* that returns a class name
*/
cellClass?: string | ICellClassGetter;
/** cellFilter is a filter to apply to the content of each cell */
cellFilter?: string;
/**
* a custom template for each cell in this column.
* The default is ui-grid/uiGridCell.
* If you are using the cellNav feature,
* this template must contain a div that can receive focus.
*/
cellTemplate?: string;
/**
* Whether or not to show a tooltip when a user hovers over the cell.
* If set to false, no tooltip.
* If true, the cell value is shown in the tooltip (useful if you have long values in your cells),
* if a function then that function is called passing in the row and the col cellTooltip(row, col)
* and the return value is shown in the tooltip,
* if it is a static string then displays that static string.
* Defaults to false
* @default false
*/
cellTooltip?: boolean | string | ICellTooltipGetter;
/**
* Column name that will be shown in the header.
* If displayName is not provided then one is generated using the name.
*/
displayName?: string;
/**
* if column menus are enabled, controls the column menus for this specific column
* (i.e. if gridOptions.enableColumnMenus, then you can control column menus using this option.
* If gridOptions.enableColumnMenus === false then you get no column menus irrespective of the value of this
* option
* ). Defaults to true.
* @default true
*/
enableColumnMenu?: boolean;
/**
* Override for column menus everywhere - if set to false then you get no column menus.
* Defaults to true
* @default true
*/
enableColumnMenus?: boolean;
/** turn off filtering for an individual column, where you've turned on filtering for the overall grid */
enableFiltering?: boolean;
/**
* When set to false, this setting prevents a user from hiding the column using the column menu or the grid
* menu.
* @default true
*/
enableHiding?: boolean;
/**
* When enabled, this setting adds sort widgets to the column header, allowing sorting of the data in the
* individual column.
* @default true
*/
enableSorting?: boolean;
/**
* field must be provided if you wish to bind to a property in the data source.
* Should be an angular expression that evaluates against grid.options.data array element
* Can be a complex expression: employee.address.city, or can be a function: employee.getFullAddress().
* See the angular docs on binding expressions.
*/
field?: string;
/**
* Specify a single filter field on this column.
* A filter consists of a condition, a term, and a placeholder:
*/
filter?: IFilterOptions;
/**
* @default false
* When true uiGrid will apply the cellFilter before applying search filters
*/
filterCellFiltered?: boolean;
/**
* a custom template for the filter input. The default is ui-grid/ui-grid-filter
*/
filterHeaderTemplate?: string;
/** Specify multiple filter fields */
filters?: Array<IFilterOptions>;
/**
* footerCellClass can be a string specifying the class to append to a cell or it can be
* a function(row,rowRenderIndex, col, colRenderIndex) that returns a class name
*/
footerCellClass?: string | IHeaderFooterCellClassGetter;
/** footerCellFilter is a filter to apply to the content of the column footer */
footerCellFilter?: string;
/** a custom template for the footer for this column. The default is ui-grid/uiGridFooterCell */
footerCellTemplate?: string;
/**
* headerCellClass can be a string specifying the class to append to a cell or it can be
* a function(row,rowRenderIndex, col, colRenderIndex) that returns a class name
*/
headerCellClass?: string | IHeaderFooterCellClassGetter;
/** headerCellFilter is a filter to apply to the content of the column header */
headerCellFilter?: string;
/** a custom template for the header for this column. The default is ui-grid/uiGridHeaderCell */
headerCellTemplate?: string;
/**
* Whether or not to show a tooltip when a user hovers over the header cell.
* If set to false, no tooltip.
* If true, the displayName is shown in the tooltip
* (useful if you have long values in your headers),
* if a function then that function is called passing in the row and the col
* headerTooltip( col ), and the return value is shown in the tooltip,
* if a static string then shows that static string.
* @default false
*/
headerTooltip?: boolean | string | IHeaderTooltipGetter;
/** sets the maximum column width */
maxWidth?: number;
/** used to add menu items to a column. Refer to the tutorial on this functionality */
menuItems?: Array<IMenuItem>;
/** Sets the minimum column width */
minWidth?: number;
/**
* (mandatory) each column should have a name,
* although for backward compatibility with 2.x name can be omitted if field is present
*/
name?: string;
/** An object of sort information */
sort?: ISortInfo;
/**
* @default false
* When true uiGrid will apply the cellFilter before sorting the data
* Note that when using this option uiGrid will assume that the displayed value is a string,
* and use the sortAlpha sortFn.
* It is possible to return a non-string value from an angularjs filter,
* in which case you should define a sortingAlgorithm for the column
* which handles the returned type.
* You may specify one of the sortingAlgorithms found in the rowSorter service.
*/
sortCellFiltered?: boolean;
/** Algorithm to use for sorting this column */
sortingAlgorithm?: (a: any, b: any) => number;
/**
* When enabled, this setting hides the removeSort option in the menu,
* and prevents users from manually removing the sort
* @default false
*/
suppressRemoveSort?: boolean;
/**
* the type of the column, used in sorting. If not provided then the grid will guess the type.
* Add this only if the grid guessing is not to your satisfaction.
* Note that if you choose date, your dates should be in a javascript date type
* One of:
* 'string', 'boolean', 'number', 'date', 'object', 'numberStr'
*/
type?: string;
/**
* sets whether or not the column is visible
* @default true
*/
visible?: boolean;
/**
* sets the column width. Can be either a number or a percentage, or an * for auto.
*/
width?: number | string;
}
export interface ICellClassGetter {
(gridRow?: IGridRow, gridCol?: IGridColumn, colRenderIndex?: number): string;
}
export interface ICellTooltipGetter {
(gridRow: IGridRow, gridCol: IGridColumn): string;
}
export interface IHeaderTooltipGetter {
(gridCol: IGridColumn): string;
}
export interface IHeaderFooterCellClassGetter {
(gridRow: IGridRow, rowRenderIndex: number, gridCol: IGridColumn, colRenderIndex: number): string;
}
export interface IMenuItem {
/** controls the title that is displayed in the menu */
title?: string;
/** the icon shown alongside that title */
icon?: string;
/** the method to call when the menu is clicked */
action?: ($event: ng.IAngularEvent) => void;
/** a function to evaluate to determine whether or not to show the item */
shown?: () => boolean;
/** a function to evaluate to determine whether or not the item is currently selected */
active?: () => boolean;
/** context to pass to the action function, available in this.context in your handler */
context?: any;
/** if set to true, the menu should stay open after the action, defaults to false */
leaveOpen?: boolean;
}
export interface ISortInfo {
direction?: string;
ignoreSort?: boolean;
priority?: number;
}
export interface IFilterOptions {
/**
* condition defines how rows are chosen as matching the filter term.
* This can be set to one of the constants in uiGridConstants.filter,
* or you can supply a custom filter function that gets passed the
* following arguments: [searchTerm, cellValue, row, column].
*/
condition?: number;
/**
* If set, the filter field will be pre-populated with this value
*/
term?: string;
/** String that will be set to the <input>.placeholder attribute */
placeholder?: string;
/**
* set this to true if you have defined a custom function in condition,
* and your custom function doesn't require a term
* (so it can run even when the term is null)
*/
noTerm?: boolean;
/**
* only flag currently available is caseSensitive, set to false if you don't want case sensitive matching
*/
flags?: IFilterFlags;
/**
* defaults to uiGridConstants.filter.INPUT, which gives a text box. If set to uiGridConstants.filter.SELECT
* then a select box will be shown with options selectOptions
*/
type?: number;
/**
* options in the format [{ value: 1, label: 'male' }]. No i18n filter is provided, you need to perform the i18n
* on the values before you provide them
*/
selectOptions?: Array<ISelectOption>;
/**
* If set to true then the 'x' button that cancels/clears the filter will not be shown.
* @default false
*/
disableCancelButton?: boolean;
}
export interface ISelectOption {
value: number;
label: string;
}
export interface IFilterFlags {
caseSensitive?: boolean;
}
}