UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

975 lines (969 loc) 32.4 kB
import { __extends } from "tslib"; import { delegateCombine, delegateRemove } from "igniteui-react-core"; import { IgrGridColumnAnimationSettings } from "./igr-grid-column-animation-settings"; import { IgrColumnWidth } from "./igr-column-width"; import { IgrHeader } from "./igr-header"; import { ColumnSortDirection_$type } from "./ColumnSortDirection"; import { PinnedPositions_$type } from "./PinnedPositions"; import { ColumnOptionsIconAlignment_$type } from "./ColumnOptionsIconAlignment"; import { ColumnOptionsIconBehavior_$type } from "./ColumnOptionsIconBehavior"; import { MergedCellMode_$type } from "./MergedCellMode"; import { MergedCellEvaluationCriteria_$type } from "./MergedCellEvaluationCriteria"; import { CellContentVerticalAlignment_$type } from "./CellContentVerticalAlignment"; import { FilterComparisonType_$type } from "./FilterComparisonType"; import { IgrGridFilterOperandsCollection } from "./igr-grid-filter-operands-collection"; import { IgrDefinitionBase } from "./igr-definition-base"; import { brushToString, stringToBrush, ensureBool, ensureEnum } from "igniteui-react-core"; import { ColumnWidth as ColumnWidth_internal } from "./ColumnWidth"; import { FontInfo } from "igniteui-react-core"; import { GridFilterOperandsCollection as GridFilterOperandsCollection_internal } from "./GridFilterOperandsCollection"; import { FilterOperand } from "./FilterOperand"; import { SyncableObservableCollection$1 } from "igniteui-react-core"; /** * A column in the data grid. */ var IgrDataGridColumn = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrDataGridColumn, _super); function IgrDataGridColumn(props) { var _this = _super.call(this, props) || this; _this._filterOperands = null; _this._actualHeaderTextChange = null; _this._actualHeaderTextChange_wrapped = null; return _this; } Object.defineProperty(IgrDataGridColumn.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "paddingLeft", { /** * Gets or sets the amount of left padding to use for the cell content for this column. */ get: function () { return this.i.kk; }, set: function (v) { this.i.kk = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "paddingTop", { /** * Gets or sets the amount of top padding to use for the cell content for this column. */ get: function () { return this.i.km; }, set: function (v) { this.i.km = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "paddingRight", { /** * Gets or sets the amount of right padding to use for the cell content of this column. */ get: function () { return this.i.kl; }, set: function (v) { this.i.kl = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "paddingBottom", { /** * Gets or sets the amount of bottom padding to use for the cell content of this column. */ get: function () { return this.i.kj; }, set: function (v) { this.i.kj = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "name", { /** * Gets or sets an unique name of the Column */ get: function () { return this.i.mf; }, set: function (v) { this.i.mf = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "field", { /** * Gets or sets the key used for the column binding */ get: function () { return this.i.lo; }, set: function (v) { this.i.lo = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "headerText", { /** * Gets or sets the text displayed in the header of the column */ get: function () { return this.i.lv; }, set: function (v) { this.i.lv = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualHeaderText", { /** * Gets the actual text displayed in the header of the column */ get: function () { return this.i.k3; }, set: function (v) { this.i.k3 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "selectedBackground", { /** * Gets or sets the background color to use for the cells when they are selected */ get: function () { return brushToString(this.i.n2); }, set: function (v) { this.i.n2 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualSelectedBackground", { /** * Gets the actual background color that is used for the cells when they are selected */ get: function () { return brushToString(this.i.nv); }, set: function (v) { this.i.nv = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "rowHoverBackground", { /** * Gets or sets the background color to use for the cells when the row is hovered. */ get: function () { return brushToString(this.i.n0); }, set: function (v) { this.i.n0 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualHoverBackground", { /** * Gets the actual background color that is used for the cells when they are hovered. */ get: function () { return brushToString(this.i.nt); }, set: function (v) { this.i.nt = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "rowHoverTextColor", { /** * Gets or sets the text color to use for the cells when the row is hovered. */ get: function () { return brushToString(this.i.n1); }, set: function (v) { this.i.n1 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualRowHoverTextColor", { /** * Gets the actual text color that is used for the cells when they are hovered. */ get: function () { return brushToString(this.i.nu); }, set: function (v) { this.i.nu = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "animationSettings", { /** * Gets or sets the animation settings to use for this column. */ get: function () { var r = this.i.h6; if (r == null) { return null; } if (!r.externalObject) { var e = new IgrGridColumnAnimationSettings(); if (r.$type) { e._implementation = r; } else { if (e.i.setNativeElement) { e.i.setNativeElement(r); } } r.externalObject = e; } return r.externalObject; }, set: function (v) { v == null ? this.i.h6 = null : this.i.h6 = v.i; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "width", { /** * Gets or sets the width to use for this column. */ get: function () { var r = this.i.width; if (r == null) { return null; } if (!r.externalObject) { var e = new IgrColumnWidth(); if (r.$type) { e._implementation = r; } else { if (e.i.setNativeElement) { e.i.setNativeElement(r); } } r.externalObject = e; } return r.externalObject; }, set: function (v) { if (typeof v == "string") { var int = ColumnWidth_internal.parse(v); var ext = new IgrColumnWidth(); ext._implementation = int; v = ext; } v == null ? this.i.width = null : this.i.width = v.i; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "minWidth", { /** * Gets or sets the minimum width to use for this column. Overrides the DefaultColumnMinWidth from the grid, if set. */ get: function () { return this.i.j0; }, set: function (v) { this.i.j0 = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isFromMarkup", { /** * Gets whether this column was projected from markup/templates and is constrained. */ get: function () { return this.i.jn; }, set: function (v) { this.i.jn = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isAutoGenerated", { /** * Gets whether this column was auto generated. */ get: function () { return this.i.jh; }, set: function (v) { this.i.jh = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "filter", { /** * Gets or sets a filter to apply on the values of this column */ get: function () { return this.i.g1; }, set: function (v) { this.i.g1 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "filterExpression", { /** * Gets or sets a filter to apply to the values of this column. */ get: function () { return this.i.g3; }, set: function (v) { this.i.g3 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "header", { /** * Gets or sets the header definition for this column. */ get: function () { var r = this.i.header; if (r == null) { return null; } if (!r.externalObject) { var e = IgrHeader._createFromInternal(r); if (e) { e._implementation = r; } r.externalObject = e; } return r.externalObject; }, set: function (v) { if (v != null && this._stylingContainer && v._styling) v._styling(this._stylingContainer, this, this); v == null ? this.i.header = null : this.i.header = v.i; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isFilteringEnabled", { /** * Gets or sets whether filtering is enabled for this column. */ get: function () { return this.i.jm; }, set: function (v) { this.i.jm = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isResizingEnabled", { /** * Gets or sets whether resizing is enabled for this column. */ get: function () { return this.i.jp; }, set: function (v) { this.i.jp = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isHidden", { /** * Gets or sets whether or not a column is hidden from the grid */ get: function () { return this.i.jo; }, set: function (v) { this.i.jo = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "shouldRemoveWhenHidden", { /** * Gets or sets if a column should be removed from the grid when it is fully hidden */ get: function () { return this.i.js; }, set: function (v) { this.i.js = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "sortDirection", { /** * Gets the current sort direction (None, Ascending, Descending) for this column. */ get: function () { return this.i.hr; }, set: function (v) { this.i.hr = ensureEnum(ColumnSortDirection_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "pinned", { /** * Gets or sets the current fixed position for this column. */ get: function () { return this.i.il; }, set: function (v) { this.i.il = ensureEnum(PinnedPositions_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualColumnOptionsIconAlignment", { /** * Gets the actual column options icon alignment for this column. */ get: function () { return this.i.hi; }, set: function (v) { this.i.hi = ensureEnum(ColumnOptionsIconAlignment_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "columnOptionsIconAlignment", { /** * Gets or sets whether the column options icon is aligned opposite the header text or not. */ get: function () { return this.i.hj; }, set: function (v) { this.i.hj = ensureEnum(ColumnOptionsIconAlignment_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualColumnOptionsIconColor", { /** * Gets the actual column options icon color for this column. */ get: function () { return brushToString(this.i.nr); }, set: function (v) { this.i.nr = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "columnOptionsIconColor", { /** * Gets or sets the column options icon color for this column. */ get: function () { return brushToString(this.i.nw); }, set: function (v) { this.i.nw = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "columnOptionsIconBehavior", { /** * Gets or sets how the column option icon will behave in the column header. */ get: function () { return this.i.hn; }, set: function (v) { this.i.hn = ensureEnum(ColumnOptionsIconBehavior_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualColumnOptionsIconBehavior", { /** * Gets or sets how the column option icon will behave in the column header. */ get: function () { return this.i.hm; }, set: function (v) { this.i.hm = ensureEnum(ColumnOptionsIconBehavior_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualIsColumnOptionsEnabled", { /** * Gets the actual state of the column options for this column. */ get: function () { return this.i.ja; }, set: function (v) { this.i.ja = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isColumnOptionsEnabled", { /** * Gets or sets the preferred state of the column options for this column. If the feature is disabled at the grid level * then it will be disabled for the column regardless of what this is set to. */ get: function () { return this.i.ji; }, set: function (v) { this.i.ji = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualIsColumnOptionsSummariesEnabled", { /** * Gets the actual state of summaries menu in the column options for this column. */ get: function () { return this.i.jc; }, set: function (v) { this.i.jc = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isColumnOptionsSummariesEnabled", { /** * Gets or sets whether to show the summaries option in the column options menu for this column. */ get: function () { return this.i.jk; }, set: function (v) { this.i.jk = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualIsColumnOptionsGroupingEnabled", { /** * Gets the actual state of grouping menu in the column options for this column. */ get: function () { return this.i.jb; }, set: function (v) { this.i.jb = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isColumnOptionsGroupingEnabled", { /** * Gets or sets whether to show the grouping option in the column options menu for this column. */ get: function () { return this.i.jj; }, set: function (v) { this.i.jj = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "isEditable", { /** * Gets or sets if the column is editable. */ get: function () { return this.i.jl; }, set: function (v) { this.i.jl = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "deletedTextColor", { /** * Gets or sets the text color used for deleted rows. */ get: function () { return brushToString(this.i.nx); }, set: function (v) { this.i.nx = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualDeletedTextColor", { /** * Gets the actual text color used for deleted rows. */ get: function () { return brushToString(this.i.ns); }, set: function (v) { this.i.ns = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "editOpacity", { /** * Gets or sets the opacity to use for unsaved edited cell values. */ get: function () { return this.i.jz; }, set: function (v) { this.i.jz = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualEditOpacity", { /** * Gets the actual opacity for unsaved edited cell values. */ get: function () { return this.i.jy; }, set: function (v) { this.i.jy = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "textEditStyle", { /** * Gets or sets the font style to use for unsaved cell edits. */ get: function () { if (this.i.textEditStyle == null) { return null; } return this.i.textEditStyle.fontString; }, set: function (v) { var fi = new FontInfo(); fi.fontString = v; this.i.textEditStyle = fi; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "actualEditFontInfo", { /** * Gets the actual font style used for unsaved cell edits. */ get: function () { if (this.i.is == null) { return null; } return this.i.is.fontString; }, set: function (v) { var fi = new FontInfo(); fi.fontString = v; this.i.is = fi; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "mergedCellMode", { /** * Gets or sets if and how cell merging is performed for this field. */ get: function () { return this.i.ih; }, set: function (v) { this.i.ih = ensureEnum(MergedCellMode_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "mergedCellEvaluationCriteria", { /** * Gets or sets how cells are evaluated for merging. */ get: function () { return this.i.id; }, set: function (v) { this.i.id = ensureEnum(MergedCellEvaluationCriteria_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "mergedCellVerticalAlignment", { /** * Gets or sets the vertical alignment to use for the merged cell content. */ get: function () { return this.i.ha; }, set: function (v) { this.i.ha = ensureEnum(CellContentVerticalAlignment_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "mergedCellPaddingLeft", { /** * Gets or sets the amount of left padding to use for the cell content for this column. */ get: function () { return this.i.kd; }, set: function (v) { this.i.kd = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "mergedCellPaddingTop", { /** * Gets or sets the amount of top padding to use for the cell content for this column. */ get: function () { return this.i.kf; }, set: function (v) { this.i.kf = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "mergedCellPaddingRight", { /** * Gets or sets the amount of right padding to use for the cell content of this column. */ get: function () { return this.i.ke; }, set: function (v) { this.i.ke = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "mergedCellPaddingBottom", { /** * Gets or sets the amount of bottom padding to use for the cell content of this column. */ get: function () { return this.i.kc; }, set: function (v) { this.i.kc = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "filterComparisonType", { /** * Gets or sets whether UI filters are case sensitive or not. */ get: function () { return this.i.h1; }, set: function (v) { this.i.h1 = ensureEnum(FilterComparisonType_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridColumn.prototype, "filterOperands", { /** * Gets a list of the current custom filters for this column. */ get: function () { if (this._filterOperands === null) { var coll = new IgrGridFilterOperandsCollection(); var innerColl = this.i.h8; if (!innerColl) { innerColl = new GridFilterOperandsCollection_internal(); } this._filterOperands = coll._fromInner(innerColl); } return this._filterOperands; }, set: function (v) { if (this._filterOperands !== null) { this._filterOperands._setSyncTarget(null); this._filterOperands = null; } var coll = new IgrGridFilterOperandsCollection(); this._filterOperands = coll._fromOuter(v); var syncColl = new SyncableObservableCollection$1(FilterOperand.$type); var innerColl = this.i.h8; if (!innerColl) { innerColl = new GridFilterOperandsCollection_internal(); } syncColl._inner = innerColl; syncColl.clear(); this._filterOperands._setSyncTarget(syncColl); }, enumerable: false, configurable: true }); IgrDataGridColumn.prototype.findByName = function (name) { var baseResult = _super.prototype.findByName.call(this, name); if (baseResult) { return baseResult; } if (this.animationSettings && this.animationSettings.name && this.animationSettings.name == name) { return this.animationSettings; } if (this.width && this.width.name && this.width.name == name) { return this.width; } if (this.header && this.header.name && this.header.name == name) { return this.header; } if (this.filterOperands != null && this.filterOperands.findByName && this.filterOperands.findByName(name)) { return this.filterOperands.findByName(name); } return null; }; IgrDataGridColumn.prototype._styling = function (container, component, parent) { _super.prototype._styling.call(this, container, component, parent); this._inStyling = true; if (this.header && this.header._styling) { this.header._styling(container, component, this); } this._inStyling = false; }; /** * Get the unique key used to identify this column. */ IgrDataGridColumn.prototype.getUniqueKey = function () { var iv = this.i.lt(); return (iv); }; IgrDataGridColumn.prototype.setNamedHeaderValue = function (valueName, animationType, value) { this.i.m2(valueName, (animationType == null ? null : animationType), value); }; /** * Returns if the column has named header values. */ IgrDataGridColumn.prototype.hasNamedHeaderValues = function () { var iv = this.i.jf(); return (iv); }; /** * Returns if there is a named header value with a given name. * @param valueName * The named value to check for. */ IgrDataGridColumn.prototype.hasNamedHeaderValue = function (valueName) { var iv = this.i.je(valueName); return (iv); }; /** * Removes a named header value with the given name from the named header values for this column. * @param valueName * The named header value to remove. */ IgrDataGridColumn.prototype.removeNamedHeaderValue = function (valueName) { this.i.m1(valueName); }; /** * Gets the value of a named header value for this column by name. * @param valueName * Name of the named header value to retrieve. */ IgrDataGridColumn.prototype.getNamedHeaderValue = function (valueName) { var iv = this.i.kr(valueName); return (iv); }; IgrDataGridColumn.prototype.applyCustomFilter = function (filterID, index, value) { this.i.mu(filterID, index, value); }; IgrDataGridColumn.prototype.getDesiredToolbarActions = function () { var iv = this.i.getDesiredToolbarActions(); return (iv); }; IgrDataGridColumn.prototype.addCommandAvailabilityListener = function (listener) { this.i.addCommandAvailabilityListener(listener); }; IgrDataGridColumn.prototype.removeCommandAvailabilityListener = function (listener) { this.i.removeCommandAvailabilityListener(listener); }; IgrDataGridColumn.prototype.addCommandStateChangedListener = function (listener) { this.i.addCommandStateChangedListener(listener); }; IgrDataGridColumn.prototype.removeCommandStateChangedListener = function (listener) { this.i.removeCommandStateChangedListener(listener); }; Object.defineProperty(IgrDataGridColumn.prototype, "actualHeaderTextChange", { get: function () { return this._actualHeaderTextChange; }, set: function (ev) { var _this = this; if (this._actualHeaderTextChange_wrapped !== null) { this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualHeaderTextChange_wrapped); this._actualHeaderTextChange_wrapped = null; this._actualHeaderTextChange = null; } this._actualHeaderTextChange = ev; this._actualHeaderTextChange_wrapped = function (o, e) { var ext = _this.actualHeaderText; if (_this.beforeActualHeaderTextChange) { _this.beforeActualHeaderTextChange(_this, ext); } if (_this._actualHeaderTextChange) { _this._actualHeaderTextChange(_this, ext); } }; this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualHeaderTextChange_wrapped); }, enumerable: false, configurable: true }); return IgrDataGridColumn; }(IgrDefinitionBase)); export { IgrDataGridColumn };