igniteui-angular
Version:
Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps
1,510 lines • 177 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Input, QueryList, TemplateRef, forwardRef } from '@angular/core';
import { DataType } from '../data-operations/data-util';
import { GridBaseAPIService } from './api.service';
import { IgxDateSummaryOperand, IgxNumberSummaryOperand, IgxSummaryOperand } from './summaries/grid-summary';
import { IgxRowComponent } from './row.component';
import { IgxCellEditorTemplateDirective, IgxCellHeaderTemplateDirective, IgxCellTemplateDirective, IgxFilterCellTemplateDirective } from './grid.common';
import { DefaultSortingStrategy } from '../data-operations/sorting-strategy';
import { getNodeSizeViaRange, flatten } from '../core/utils';
import { IgxBooleanFilteringOperand, IgxNumberFilteringOperand, IgxDateFilteringOperand, IgxStringFilteringOperand, IgxFilteringOperand } from '../data-operations/filtering-condition';
import { DeprecateProperty } from '../core/deprecateDecorators';
/**
* **Ignite UI for Angular Column** -
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid.html#columns-configuration)
*
* The Ignite UI Column is used within an `igx-grid` element to define what data the column will show. Features such as sorting,
* filtering & editing are enabled at the column level. You can also provide a template containing custom content inside
* the column using `ng-template` which will be used for all cells within the column.
*/
var IgxColumnComponent = /** @class */ (function () {
function IgxColumnComponent(gridAPI, cdr) {
this.gridAPI = gridAPI;
this.cdr = cdr;
/**
* Sets/gets the `header` value.
* ```typescript
* let columnHeader = this.column.header;
* ```
* ```html
* <igx-column [header] = "'ID'"></igx-column>
* ```
*
* \@memberof IgxColumnComponent
*/
this.header = '';
/**
* Sets/gets whether the column is sortable.
* Default value is `false`.
* ```typescript
* let isSortable = this.column.sortable;
* ```
* ```html
* <igx-column [sortable] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.sortable = false;
/**
* Sets/gets whether the column is groupable.
* Default value is `false`.
* ```typescript
* let isGroupable = this.column.groupable;
* ```
* ```html
* <igx-column [groupable] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.groupable = false;
/**
* Sets/gets whether the column is editable.
* Default value is `false`.
* ```typescript
* let isEditable = this.column.editable;
* ```
* ```html
* <igx-column [editable] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.editable = null;
/**
* Sets/gets whether the column is filterable.
* Default value is `true`.
* ```typescript
* let isFilterable = this.column.filterable;
* ```
* ```html
* <igx-column [filterable] = "false"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.filterable = true;
/**
* Sets/gets whether the column is resizable.
* Default value is `false`.
* ```typescript
* let isResizable = this.column.resizable;
* ```
* ```html
* <igx-column [resizable] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.resizable = false;
/**
* Sets/gets whether the column is movable.
* Default value is `false`.
* ```typescript
* let isMovable = this.column.movable;
* ```
* ```html
* <igx-column [movable] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.movable = false;
/**
* Sets/gets the minimum `width` of the column.
* Default value is `88`;
* ```typescript
* let columnMinWidth = this.column.minWidth;
* ```
* ```html
* <igx-column [minWidth] = "'15%'"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.minWidth = this.defaultMinWidth;
/**
* Sets/gets the class selector of the column header.
* ```typescript
* let columnHeaderClass = this.column.headerClasses;
* ```
* ```html
* <igx-column [headerClasses] = "'column-header'"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.headerClasses = '';
/**
* Sets/gets the class selector of the column group header.
* ```typescript
* let columnHeaderClass = this.column.headerGroupClasses;
* ```
* ```html
* <igx-column [headerGroupClasses] = "'column-group-header'"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.headerGroupClasses = '';
/**
* Sets/gets whether the column filtering should be case sensitive.
* Default value is `true`.
* ```typescript
* let filteringIgnoreCase = this.column.filteringIgnoreCase;
* ```
* ```html
* <igx-column [filteringIgnoreCase] = "false"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.filteringIgnoreCase = true;
/**
* Sets/gets whether the column sorting should be case sensitive.
* Default value is `true`.
* ```typescript
* let sortingIgnoreCase = this.column.sortingIgnoreCase;
* ```
* ```html
* <igx-column [sortingIgnoreCase] = "false"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.sortingIgnoreCase = true;
/**
* Sets/gets the data type of the column values.
* Default value is `string`.
* ```typescript
* let columnDataType = this.column.dataType;
* ```
* ```html
* <igx-column [dataType] = "'number'"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.dataType = DataType.String;
/**
* Sets/gets whether the column is `searchable`.
* Default value is `true`.
* ```typescript
* let isSearchable = this.column.searchable';
* ```
* ```html
* <igx-column [searchable] = "false"></igx-column>
* ```
* \@memberof IgxColumnComponent
*/
this.searchable = true;
/**
* Sets/gets the parent column.
* ```typescript
* let parentColumn = this.column.parent;
* ```
* ```typescript
* this.column.parent = higherLevelColumn;
* ```
* \@memberof IgxColumnComponent
*/
this.parent = null;
/**
* @hidden
*/
this._pinned = false;
/**
* @hidden
*/
this._summaries = null;
/**
* @hidden
*/
this._filters = null;
/**
* @hidden
*/
this._sortStrategy = DefaultSortingStrategy.instance();
/**
* @hidden
*/
this._hidden = false;
/**
* @hidden
*/
this._disableHiding = false;
/**
* @hidden
*/
this._disablePinning = false;
/**
* @hidden
*/
this._defaultMinWidth = '80';
/**
* @hidden
*/
this._hasSummary = false;
this._vIndex = NaN;
}
Object.defineProperty(IgxColumnComponent.prototype, "hasSummary", {
/**
* Gets a value indicating whether the summary for the column is enabled.
* ```typescript
* let hasSummary = this.column.hasSummary;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets a value indicating whether the summary for the column is enabled.
* ```typescript
* let hasSummary = this.column.hasSummary;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._hasSummary;
},
/**
* Sets a value indicating whether the summary for the column is enabled.
* Default value is `false`.
* ```html
* <igx-column [hasSummary] = "true"></igx-column>
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets a value indicating whether the summary for the column is enabled.
* Default value is `false`.
* ```html
* <igx-column [hasSummary] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
* @param {?} value
* @return {?}
*/
function (value) {
this._hasSummary = value;
if (this.grid) {
this.grid.summaryService.recalculateSummaries();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "hidden", {
/**
* Gets whether the column is hidden.
* ```typescript
* let isHidden = this.column.hidden;
* ```
*@memberof IgxColumnComponent
*/
get: /**
* Gets whether the column is hidden.
* ```typescript
* let isHidden = this.column.hidden;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._hidden;
},
/**
* Sets the column hidden property.
* Default value is `false`.
* ```typescript
* <igx-column [hidden] = "true"></igx-column>
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the column hidden property.
* Default value is `false`.
* ```typescript
* <igx-column [hidden] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
* @param {?} value
* @return {?}
*/
function (value) {
if (this._hidden !== value) {
this._hidden = value;
if (this.grid) {
this.grid.resetCaches();
this.grid.endEdit(false);
}
// TODO: Simplify
this.check();
if (this.grid) {
this.grid.refreshSearch(true);
this.grid.summaryService.resetSummaryHeight();
this.grid.reflow();
this.grid.filteringService.refreshExpressions();
}
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "disableHiding", {
/**
* Gets whether the hiding is disabled.
* ```typescript
* let isHidingDisabled = this.column.disableHiding;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets whether the hiding is disabled.
* ```typescript
* let isHidingDisabled = this.column.disableHiding;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._disableHiding;
},
/**
* Enables/disables hiding for the column.
* Default value is `false`.
* ```typescript
* <igx-column [hidden] = "true"></igx-column>
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Enables/disables hiding for the column.
* Default value is `false`.
* ```typescript
* <igx-column [hidden] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
* @param {?} value
* @return {?}
*/
function (value) {
if (this._disableHiding !== value) {
this._disableHiding = value;
this.check();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "disablePinning", {
/**
* Gets whether the pinning is disabled.
* ```typescript
* let isPinningDisabled = this.column.disablePinning;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets whether the pinning is disabled.
* ```typescript
* let isPinningDisabled = this.column.disablePinning;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._disablePinning;
},
/**
* Enables/disables pinning for the column.
* Default value is `false`.
* ```typescript
* <igx-column [pinned] = "true"></igx-column>
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Enables/disables pinning for the column.
* Default value is `false`.
* ```typescript
* <igx-column [pinned] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
* @param {?} value
* @return {?}
*/
function (value) {
if (this._disablePinning !== value) {
this._disablePinning = value;
this.check();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "width", {
/**
* Gets the `width` of the column.
* ```typescript
* let columnWidth = this.column.width;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the `width` of the column.
* ```typescript
* let columnWidth = this.column.width;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this.widthSetByUser ? this._width : this.defaultWidth;
},
/**
* Sets the `width` of the column.
* ```html
* <igx-column [width] = "'25%'"></igx-column>
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the `width` of the column.
* ```html
* <igx-column [width] = "'25%'"></igx-column>
* ```
* \@memberof IgxColumnComponent
* @param {?} value
* @return {?}
*/
function (value) {
if (value) {
this.widthSetByUser = true;
this._width = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "calcWidth", {
get: /**
* @return {?}
*/
function () {
/** @type {?} */
var colWidth = this.width;
/** @type {?} */
var isPercentageWidth = colWidth && typeof colWidth === 'string' && colWidth.indexOf('%') !== -1;
if (isPercentageWidth) {
return parseInt(colWidth, 10) / 100 * this.grid.unpinnedWidth;
}
else if (!colWidth) {
// no width
return this.defaultWidth || this.grid.getPossibleColumnWidth();
}
else {
return this.width;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "index", {
/**
* Gets the column index.
* ```typescript
* let columnIndex = this.column.index;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the column index.
* ```typescript
* let columnIndex = this.column.index;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this.grid.columns.indexOf(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "pinned", {
/**
* Gets whether the column is `pinned`.
* ```typescript
* let isPinned = this.column.pinned;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets whether the column is `pinned`.
* ```typescript
* let isPinned = this.column.pinned;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._pinned;
},
/**
* Sets whether the column is pinned.
* Default value is `false`.
* ```html
* <igx-column [pinned] = "true"></igx-column>
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets whether the column is pinned.
* Default value is `false`.
* ```html
* <igx-column [pinned] = "true"></igx-column>
* ```
* \@memberof IgxColumnComponent
* @param {?} value
* @return {?}
*/
function (value) {
if (this._pinned !== value) {
if (this.grid && this.width && !isNaN(parseInt(this.width, 10))) {
value ? this.pin() : this.unpin();
return;
}
/* No grid/width available at initialization. `initPinning` in the grid
will re-init the group (if present)
*/
this._pinned = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "summaries", {
/**
* Gets the column `summaries`.
* ```typescript
* let columnSummaries = this.column.summaries;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the column `summaries`.
* ```typescript
* let columnSummaries = this.column.summaries;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._summaries;
},
/**
* Sets the column `summaries`.
* ```typescript
* this.column.summaries = IgxNumberSummaryOperand;
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the column `summaries`.
* ```typescript
* this.column.summaries = IgxNumberSummaryOperand;
* ```
* \@memberof IgxColumnComponent
* @param {?} classRef
* @return {?}
*/
function (classRef) {
this._summaries = new classRef();
if (this.grid) {
this.grid.summaryService.removeSummariesCachePerColumn(this.field);
((/** @type {?} */ (this.grid)))._summaryPipeTrigger++;
this.grid.summaryService.recalculateSummaries();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "filters", {
/**
* Gets the column `filters`.
* ```typescript
* let columnFilters = this.column.filters'
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the column `filters`.
* ```typescript
* let columnFilters = this.column.filters'
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._filters;
},
/**
* Sets the column `filters`.
* ```typescript
* this.column.filters = IgxBooleanFilteringOperand.instance().
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the column `filters`.
* ```typescript
* this.column.filters = IgxBooleanFilteringOperand.instance().
* ```
* \@memberof IgxColumnComponent
* @param {?} instance
* @return {?}
*/
function (instance) {
this._filters = instance;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "sortStrategy", {
/**
* Gets the column `sortStrategy`.
* ```typescript
* let sortStrategy = this.column.sortStrategy'
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the column `sortStrategy`.
* ```typescript
* let sortStrategy = this.column.sortStrategy'
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._sortStrategy;
},
/**
* Sets the column `sortStrategy`.
* ```typescript
* this.column.sortStrategy = new CustomSortingStrategy().
*
* class CustomSortingStrategy extends SortingStrategy {
* ...
* }
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the column `sortStrategy`.
* ```typescript
* this.column.sortStrategy = new CustomSortingStrategy().
*
* class CustomSortingStrategy extends SortingStrategy {
* ...
* }
* ```
* \@memberof IgxColumnComponent
* @param {?} classRef
* @return {?}
*/
function (classRef) {
this._sortStrategy = classRef;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "groupingComparer", {
/**
* Gets the function that compares values for grouping.
* ```typescript
* let groupingComparer = this.column.groupingComparer'
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the function that compares values for grouping.
* ```typescript
* let groupingComparer = this.column.groupingComparer'
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._groupingComparer;
},
/**
* Sets a custom function to compare values for grouping.
* Subsequent values in the sorted data that the function returns 0 for are grouped.
* ```typescript
* this.column.groupingComparer = (a: any, b: any) => { return a === b ? 0 : -1; }
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets a custom function to compare values for grouping.
* Subsequent values in the sorted data that the function returns 0 for are grouped.
* ```typescript
* this.column.groupingComparer = (a: any, b: any) => { return a === b ? 0 : -1; }
* ```
* \@memberof IgxColumnComponent
* @param {?} funcRef
* @return {?}
*/
function (funcRef) {
this._groupingComparer = funcRef;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "defaultMinWidth", {
/**
* Gets the default minimum `width` of the column.
* ```typescript
* let defaultMinWidth = this.column.defaultMinWidth;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the default minimum `width` of the column.
* ```typescript
* let defaultMinWidth = this.column.defaultMinWidth;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._defaultMinWidth;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "bodyTemplate", {
/**
* Returns a reference to the `bodyTemplate`.
* ```typescript
* let bodyTemplate = this.column.bodyTemplate;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns a reference to the `bodyTemplate`.
* ```typescript
* let bodyTemplate = this.column.bodyTemplate;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._bodyTemplate;
},
/**
* Sets the body template.
* ```html
* <ng-template #bodyTemplate igxCell let-val>
* <div style = "background-color: yellowgreen" (click) = "changeColor(val)">
* <span> {{val}} </span>
* </div>
* </ng-template>
* ```
* ```typescript
* @ViewChild("'bodyTemplate'", {read: TemplateRef })
* public bodyTemplate: TemplateRef<any>;
* this.column.bodyTemplate = this.bodyTemplate;
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the body template.
* ```html
* <ng-template #bodyTemplate igxCell let-val>
* <div style = "background-color: yellowgreen" (click) = "changeColor(val)">
* <span> {{val}} </span>
* </div>
* </ng-template>
* ```
* ```typescript
* \@ViewChild("'bodyTemplate'", {read: TemplateRef })
* public bodyTemplate: TemplateRef<any>;
* this.column.bodyTemplate = this.bodyTemplate;
* ```
* \@memberof IgxColumnComponent
* @param {?} template
* @return {?}
*/
function (template) {
this._bodyTemplate = template;
if (this.grid) {
this.grid.cdr.markForCheck();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "headerTemplate", {
/**
* Returns a reference to the header template.
* ```typescript
* let headerTemplate = this.column.headerTemplate;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns a reference to the header template.
* ```typescript
* let headerTemplate = this.column.headerTemplate;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._headerTemplate;
},
/**
* Sets the header template.
* ```html
* <ng-template #headerTemplate>
* <div style = "background-color:black" (click) = "changeColor(val)">
* <span style="color:red" >{{column.field}}</span>
* </div>
* </ng-template>
* ```
* ```typescript
* @ViewChild("'headerTemplate'", {read: TemplateRef })
* public headerTemplate: TemplateRef<any>;
* this.column.headerTemplate = this.headerTemplate;
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the header template.
* ```html
* <ng-template #headerTemplate>
* <div style = "background-color:black" (click) = "changeColor(val)">
* <span style="color:red" >{{column.field}}</span>
* </div>
* </ng-template>
* ```
* ```typescript
* \@ViewChild("'headerTemplate'", {read: TemplateRef })
* public headerTemplate: TemplateRef<any>;
* this.column.headerTemplate = this.headerTemplate;
* ```
* \@memberof IgxColumnComponent
* @param {?} template
* @return {?}
*/
function (template) {
this._headerTemplate = template;
if (this.grid) {
this.grid.cdr.markForCheck();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "inlineEditorTemplate", {
/**
* Returns a reference to the inline editor template.
* ```typescript
* let inlineEditorTemplate = this.column.inlineEditorTemplate;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns a reference to the inline editor template.
* ```typescript
* let inlineEditorTemplate = this.column.inlineEditorTemplate;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._inlineEditorTemplate;
},
/**
* Sets the inline editor template.
* ```html
* <ng-template #inlineEditorTemplate igxCellEditor let-cell="cell">
* <input type="string" [(ngModel)]="cell.value"/>
* </ng-template>
* ```
* ```typescript
* @ViewChild("'inlineEditorTemplate'", {read: TemplateRef })
* public inlineEditorTemplate: TemplateRef<any>;
* this.column.inlineEditorTemplate = this.inlineEditorTemplate;
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the inline editor template.
* ```html
* <ng-template #inlineEditorTemplate igxCellEditor let-cell="cell">
* <input type="string" [(ngModel)]="cell.value"/>
* </ng-template>
* ```
* ```typescript
* \@ViewChild("'inlineEditorTemplate'", {read: TemplateRef })
* public inlineEditorTemplate: TemplateRef<any>;
* this.column.inlineEditorTemplate = this.inlineEditorTemplate;
* ```
* \@memberof IgxColumnComponent
* @param {?} template
* @return {?}
*/
function (template) {
this._inlineEditorTemplate = template;
if (this.grid) {
this.grid.cdr.markForCheck();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "filterCellTemplate", {
/**
* Returns a reference to the `filterCellTemplate`.
* ```typescript
* let filterCellTemplate = this.column.filterCellTemplate;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns a reference to the `filterCellTemplate`.
* ```typescript
* let filterCellTemplate = this.column.filterCellTemplate;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return this._filterCellTemplate;
},
/**
* Sets the quick filter template.
* ```html
* <ng-template #filterCellTemplate IgxFilterCellTemplate let-column="column">
* <input (input)="onInput()">
* </ng-template>
* ```
* ```typescript
* @ViewChild("'filterCellTemplate'", {read: TemplateRef })
* public filterCellTemplate: TemplateRef<any>;
* this.column.filterCellTemplate = this.filterCellTemplate;
* ```
* @memberof IgxColumnComponent
*/
set: /**
* Sets the quick filter template.
* ```html
* <ng-template #filterCellTemplate IgxFilterCellTemplate let-column="column">
* <input (input)="onInput()">
* </ng-template>
* ```
* ```typescript
* \@ViewChild("'filterCellTemplate'", {read: TemplateRef })
* public filterCellTemplate: TemplateRef<any>;
* this.column.filterCellTemplate = this.filterCellTemplate;
* ```
* \@memberof IgxColumnComponent
* @param {?} template
* @return {?}
*/
function (template) {
this._filterCellTemplate = template;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "cells", {
/**
* Gets the cells of the column.
* ```typescript
* let columnCells = this.column.cells;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the cells of the column.
* ```typescript
* let columnCells = this.column.cells;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
var _this = this;
return this.grid.rowList.filter(function (row) { return row instanceof IgxRowComponent; })
.map(function (row) {
if (row.cells) {
return row.cells.filter(function (cell) { return cell.columnIndex === _this.index; });
}
}).reduce(function (a, b) { return a.concat(b); }, []);
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "visibleIndex", {
/**
* Gets the column visible index.
* If the column is not visible, returns `-1`.
* ```typescript
* let visibleColumnIndex = this.column.visibleIndex;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Gets the column visible index.
* If the column is not visible, returns `-1`.
* ```typescript
* let visibleColumnIndex = this.column.visibleIndex;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
if (!isNaN(this._vIndex)) {
return this._vIndex;
}
/** @type {?} */
var unpinnedColumns = this.grid.unpinnedColumns.filter(function (c) { return !c.columnGroup; });
/** @type {?} */
var pinnedColumns = this.grid.pinnedColumns.filter(function (c) { return !c.columnGroup; });
/** @type {?} */
var col = this;
/** @type {?} */
var vIndex = -1;
if (this.columnGroup) {
col = (/** @type {?} */ (this.allChildren.filter(function (c) { return !c.columnGroup; })[0]));
}
if (!this.pinned) {
/** @type {?} */
var indexInCollection = unpinnedColumns.indexOf(col);
vIndex = indexInCollection === -1 ? -1 : pinnedColumns.length + indexInCollection;
}
else {
vIndex = pinnedColumns.indexOf(col);
}
this._vIndex = vIndex;
return vIndex;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "columnGroup", {
/**
* Returns a boolean indicating if the column is a `ColumnGroup`.
* ```typescript
* let columnGroup = this.column.columnGroup;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns a boolean indicating if the column is a `ColumnGroup`.
* ```typescript
* let columnGroup = this.column.columnGroup;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return false;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "allChildren", {
/**
* Returns the children columns collection.
* Returns an empty array if the column does not contain children columns.
* ```typescript
* let childrenColumns = this.column.allChildren;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns the children columns collection.
* Returns an empty array if the column does not contain children columns.
* ```typescript
* let childrenColumns = this.column.allChildren;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return [];
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "level", {
/**
* Returns the level of the column in a column group.
* Returns `0` if the column doesn't have a `parent`.
* ```typescript
* let columnLevel = this.column.level;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns the level of the column in a column group.
* Returns `0` if the column doesn't have a `parent`.
* ```typescript
* let columnLevel = this.column.level;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
/** @type {?} */
var ptr = this.parent;
/** @type {?} */
var lvl = 0;
while (ptr) {
lvl++;
ptr = ptr.parent;
}
return lvl;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "isLastPinned", {
get: /**
* @return {?}
*/
function () {
return this.grid.pinnedColumns[this.grid.pinnedColumns.length - 1] === this;
},
enumerable: true,
configurable: true
});
Object.defineProperty(IgxColumnComponent.prototype, "filteringExpressionsTree", {
/**
* Returns the filteringExpressionsTree of the column.
* ```typescript
* let tree = this.column.filteringExpressionsTree;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns the filteringExpressionsTree of the column.
* ```typescript
* let tree = this.column.filteringExpressionsTree;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
return (/** @type {?} */ (this.grid.filteringExpressionsTree.find(this.field)));
},
enumerable: true,
configurable: true
});
/**
* @hidden
* @internal
*/
/**
* @hidden
* \@internal
* @return {?}
*/
IgxColumnComponent.prototype.resetVisibleIndex = /**
* @hidden
* \@internal
* @return {?}
*/
function () {
this._vIndex = NaN;
};
/**
*@hidden
*/
/**
* @hidden
* @return {?}
*/
IgxColumnComponent.prototype.ngAfterContentInit = /**
* @hidden
* @return {?}
*/
function () {
if (this.cellTemplate) {
this._bodyTemplate = this.cellTemplate.template;
}
if (this.headTemplate) {
this._headerTemplate = this.headTemplate.template;
}
if (this.editorTemplate) {
this._inlineEditorTemplate = this.editorTemplate.template;
}
if (this.filterCellTemplateDirective) {
this._filterCellTemplate = this.filterCellTemplateDirective.template;
}
if (!this.summaries) {
switch (this.dataType) {
case DataType.String:
case DataType.Boolean:
this.summaries = IgxSummaryOperand;
break;
case DataType.Number:
this.summaries = IgxNumberSummaryOperand;
break;
case DataType.Date:
this.summaries = IgxDateSummaryOperand;
break;
default:
this.summaries = IgxSummaryOperand;
break;
}
}
if (!this.filters) {
switch (this.dataType) {
case DataType.Boolean:
this.filters = IgxBooleanFilteringOperand.instance();
break;
case DataType.Number:
this.filters = IgxNumberFilteringOperand.instance();
break;
case DataType.Date:
this.filters = IgxDateFilteringOperand.instance();
break;
case DataType.String:
default:
this.filters = IgxStringFilteringOperand.instance();
break;
}
}
};
/**
* Pins the column at the provided index in the pinned area. Defaults to index `0` if not provided.
* Returns `true` if the column is successfully pinned. Returns `false` if the column cannot be pinned.
* Column cannot be pinned if:
* - Is already pinned
* - index argument is out of range
* - The pinned area exceeds 80% of the grid width
* ```typescript
* let success = this.column.pin();
* ```
* @memberof IgxColumnComponent
*/
/**
* Pins the column at the provided index in the pinned area. Defaults to index `0` if not provided.
* Returns `true` if the column is successfully pinned. Returns `false` if the column cannot be pinned.
* Column cannot be pinned if:
* - Is already pinned
* - index argument is out of range
* - The pinned area exceeds 80% of the grid width
* ```typescript
* let success = this.column.pin();
* ```
* \@memberof IgxColumnComponent
* @param {?=} index
* @return {?}
*/
IgxColumnComponent.prototype.pin = /**
* Pins the column at the provided index in the pinned area. Defaults to index `0` if not provided.
* Returns `true` if the column is successfully pinned. Returns `false` if the column cannot be pinned.
* Column cannot be pinned if:
* - Is already pinned
* - index argument is out of range
* - The pinned area exceeds 80% of the grid width
* ```typescript
* let success = this.column.pin();
* ```
* \@memberof IgxColumnComponent
* @param {?=} index
* @return {?}
*/
function (index) {
// TODO: Probably should the return type of the old functions
// should be moved as a event parameter.
if (this.grid) {
this.grid.endEdit(true);
}
if (this._pinned) {
return false;
}
if (this.parent && !this.parent.pinned) {
return this.topLevelParent.pin(index);
}
/** @type {?} */
var grid = ((/** @type {?} */ (this.grid)));
/** @type {?} */
var hasIndex = index !== undefined;
if (hasIndex && (index < 0 || index >= grid.pinnedColumns.length)) {
return false;
}
/** @type {?} */
var width = parseInt(this.width, 10);
if (!this.parent && (grid.getUnpinnedWidth(true) - width < grid.unpinnedAreaMinWidth)) {
return false;
}
this._pinned = true;
this._unpinnedIndex = grid._unpinnedColumns.indexOf(this);
index = index !== undefined ? index : grid._pinnedColumns.length;
/** @type {?} */
var targetColumn = grid._pinnedColumns[index];
/** @type {?} */
var args = { column: this, insertAtIndex: index, isPinned: true };
grid.onColumnPinning.emit(args);
if (grid._pinnedColumns.indexOf(this) === -1) {
grid._pinnedColumns.splice(args.insertAtIndex, 0, this);
if (grid._unpinnedColumns.indexOf(this) !== -1) {
grid._unpinnedColumns.splice(grid._unpinnedColumns.indexOf(this), 1);
}
}
if (hasIndex) {
grid._moveColumns(this, targetColumn);
}
if (this.columnGroup) {
this.allChildren.forEach(function (child) { return child.pin(); });
grid.reinitPinStates();
}
grid.resetCaches();
grid.cdr.detectChanges();
this.grid.filteringService.refreshExpressions();
this.grid.refreshSearch(true);
return true;
};
/**
* Unpins the column and place it at the provided index in the unpinned area. Defaults to index `0` if not provided.
* Returns `true` if the column is successfully unpinned. Returns `false` if the column cannot be unpinned.
* Column cannot be unpinned if:
* - Is already unpinned
* - index argument is out of range
* ```typescript
* let success = this.column.unpin();
* ```
* @memberof IgxColumnComponent
*/
/**
* Unpins the column and place it at the provided index in the unpinned area. Defaults to index `0` if not provided.
* Returns `true` if the column is successfully unpinned. Returns `false` if the column cannot be unpinned.
* Column cannot be unpinned if:
* - Is already unpinned
* - index argument is out of range
* ```typescript
* let success = this.column.unpin();
* ```
* \@memberof IgxColumnComponent
* @param {?=} index
* @return {?}
*/
IgxColumnComponent.prototype.unpin = /**
* Unpins the column and place it at the provided index in the unpinned area. Defaults to index `0` if not provided.
* Returns `true` if the column is successfully unpinned. Returns `false` if the column cannot be unpinned.
* Column cannot be unpinned if:
* - Is already unpinned
* - index argument is out of range
* ```typescript
* let success = this.column.unpin();
* ```
* \@memberof IgxColumnComponent
* @param {?=} index
* @return {?}
*/
function (index) {
if (this.grid) {
this.grid.endEdit(true);
}
if (!this._pinned) {
return false;
}
if (this.parent && this.parent.pinned) {
return this.topLevelParent.unpin(index);
}
/** @type {?} */
var grid = ((/** @type {?} */ (this.grid)));
/** @type {?} */
var hasIndex = index !== undefined;
if (hasIndex && (index < 0 || index >= grid._unpinnedColumns.length)) {
return false;
}
index = (index !== undefined ? index :
this._unpinnedIndex !== undefined ? this._unpinnedIndex : this.index);
this._pinned = false;
/** @type {?} */
var targetColumn = grid._unpinnedColumns[index];
grid._unpinnedColumns.splice(index, 0, this);
if (grid._pinnedColumns.indexOf(this) !== -1) {
grid._pinnedColumns.splice(grid._pinnedColumns.indexOf(this), 1);
}
if (hasIndex) {
grid._moveColumns(this, targetColumn);
}
if (this.columnGroup) {
this.allChildren.forEach(function (child) { return child.unpin(); });
}
grid.reinitPinStates();
grid.resetCaches();
/** @type {?} */
var insertAtIndex = grid._unpinnedColumns.indexOf(this);
/** @type {?} */
var args = { column: this, insertAtIndex: insertAtIndex, isPinned: false };
grid.onColumnPinning.emit(args);
grid.cdr.detectChanges();
this.grid.filteringService.refreshExpressions();
this.grid.refreshSearch(true);
return true;
};
Object.defineProperty(IgxColumnComponent.prototype, "topLevelParent", {
/**
* Returns a reference to the top level parent column.
* ```typescript
* let topLevelParent = this.column.topLevelParent;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns a reference to the top level parent column.
* ```typescript
* let topLevelParent = this.column.topLevelParent;
* ```
* \@memberof IgxColumnComponent
* @return {?}
*/
function () {
/** @type {?} */
var parent = this.parent;
while (parent && parent.parent) {
parent = parent.parent;
}
return parent;
},
enumerable: true,
configurable: true
});
/**
*@hidden
*/
/**
* @hidden
* @protected
* @return {?}
*/
IgxColumnComponent.prototype.check = /**
* @hidden
* @protected
* @return {?}
*/
function () {
if (this.grid) {
this.grid.markForCheck();
}
};
Object.defineProperty(IgxColumnComponent.prototype, "headerCell", {
/**
* Returns a reference to the header of the column.
* ```typescript
* let column = this.grid.columnList.filter(c => c.field === 'ID')[0];
* let headerCell = column.headerCell;
* ```
* @memberof IgxColumnComponent
*/
get: /**
* Returns a reference to the header of the column.
* ```typescript
* let column = this.grid.columnList.filter(c => c.field === 'ID')[0];
* let headerCell = column.headerCell;
* ```
* \@mem