UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

1,213 lines (1,208 loc) 39.4 kB
import { __assign, __extends, __values } from "tslib"; import * as React from 'react'; import { GridColumnDataType_$type } from "./GridColumnDataType"; import { IgrFilteringOperand } from "./igr-filtering-operand"; import { IgrFilteringExpressionsTree } from "./igr-filtering-expressions-tree"; import { Column } from "./Column"; import { TypeRegistrar } from "igniteui-react-core"; import { ReactRenderer, PortalManager } from "igniteui-react-core"; import { NamePatcher, getModifiedProps, isValidProp, ensureBool, ensureEnum, interfaceToInternal, toSpinal, initializePropertiesFromCss } from "igniteui-react-core"; import { SortingStrategy } from "./SortingStrategy"; import { IgrSummaryTemplateContext } from "./igr-summary-template-context"; import { ReactTemplateAdapter } from "igniteui-react-core"; import { html } from "lit-html"; import { IgrCellTemplateContext } from "./igr-cell-template-context"; import { IgrColumnTemplateContext } from "./igr-column-template-context"; import { ColumnPipeArgs } from "./ColumnPipeArgs"; import { ColumnEditorOptions } from "./ColumnEditorOptions"; var IgrColumn = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrColumn, _super); function IgrColumn(props) { var _this = _super.call(this, props) || this; _this.mounted = false; _this.__p = null; _this._hasUserValues = new Set(); _this._stylingContainer = null; _this._stylingParent = null; _this._inStyling = false; if (_this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this)); } _this._getMainRef = _this._getMainRef.bind(_this); _this._implementation = _this.createImplementation(); _this._portalManager = new PortalManager("templates", function () { if (_this.mounted) { _this.setState({}); } }); if (typeof window !== 'undefined' && typeof document !== 'undefined') { _this._renderer = new ReactRenderer(_this._implementation.nativeElement, document, false, null, _this._portalManager); } _this._implementation.externalObject = _this; _this.onImplementationCreated(); if (_this._initializeAdapters) { _this._initializeAdapters(); } return _this; } IgrColumn.prototype.createImplementation = function () { var _a, _b; var impl = new Column(); var nat; if (typeof document !== 'undefined') { nat = document.createElement("igc-column"); } else { nat = { style: {} }; } if ((_a = this.props) === null || _a === void 0 ? void 0 : _a.className) { nat.className = this.props.className; } if ((_b = this.props) === null || _b === void 0 ? void 0 : _b.id) { nat.id = this.props.id; } impl.setNativeElement(nat); return impl; }; Object.defineProperty(IgrColumn.prototype, "nativeElement", { get: function () { return this._implementation.nativeElement; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; } /** * @hidden */, enumerable: false, configurable: true }); IgrColumn._createFromInternal = function (internal) { if (!internal) { return null; } if (!internal.$type) { return null; } var name = internal.$type.name; var externalName = "Igr" + name; if (!TypeRegistrar.isRegistered(externalName)) { return null; } return TypeRegistrar.create(externalName); }; IgrColumn.prototype.onImplementationCreated = function () { }; IgrColumn.prototype.componentDidMount = function () { var e_1, _a; this.mounted = true; try { for (var _b = __values(Object.keys(this.props)), _c = _b.next(); !_c.done; _c = _b.next()) { var p = _c.value; if (isValidProp(this, p)) { this[p] = this.props[p]; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; IgrColumn.prototype.shouldComponentUpdate = function (nextProps, nextState) { var e_2, _a; var mod = getModifiedProps(this.props, nextProps); try { for (var _b = __values(Object.keys(mod)), _c = _b.next(); !_c.done; _c = _b.next()) { var p = _c.value; if (isValidProp(this, p)) { this[p] = mod[p]; } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } return true; }; IgrColumn.prototype.render = function () { var _this = this; var nativePropsName = Object.keys(this.props).filter(function (prop) { return !isValidProp(_this, prop) && prop !== "originalRef" && prop !== "className"; }); var nativeProps = {}; nativePropsName.forEach(function (propName) { nativeProps[propName] = _this.props[propName]; }); var propChildren = this.props.children; var children = []; React.Children.forEach(propChildren, function (ch) { children.push(React.cloneElement(ch)); }); this._portalManager.onRender(children); var style = {}; style.display = 'contents'; if (this.props.style) { style = this.props.style; } var div = React.createElement("div", __assign(__assign({}, nativeProps), { ref: this._getMainRef, className: this.props.className, style: style, children: children })); return div; }; IgrColumn.prototype._getMainRef = function (ref) { this._elRef = ref; }; Object.defineProperty(IgrColumn.prototype, "field", { get: function () { return this.i.bc; }, set: function (v) { this.i.bc = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "header", { get: function () { return this.i.bd; }, set: function (v) { this.i.bd = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "title", { get: function () { return this.i.bj; }, set: function (v) { this.i.bj = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "sortable", { get: function () { return this.i.ag; }, set: function (v) { this.i.ag = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "selectable", { /** * Returns if the column is selectable. * ```typescript * let columnSelectable = this.column.selectable; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.ae; }, set: function (v) { this.i.ae = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "groupable", { get: function () { return this.i.x; }, set: function (v) { this.i.x = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "editable", { /** * Gets whether the column is editable. * Default value is `false`. * ```typescript * let isEditable = this.column.editable; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.u; }, set: function (v) { this.i.u = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "filterable", { get: function () { return this.i.v; }, set: function (v) { this.i.v = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "resizable", { get: function () { return this.i.ac; }, set: function (v) { this.i.ac = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "autosizeHeader", { get: function () { return this.i.o; }, set: function (v) { this.i.o = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "hasSummary", { /** * Gets a value indicating whether the summary for the column is enabled. * ```typescript * let hasSummary = this.column.hasSummary; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.y; }, set: function (v) { this.i.y = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "hidden", { /** * Gets whether the column is hidden. * ```typescript * let isHidden = this.column.hidden; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.z; }, set: function (v) { this.i.z = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "selected", { /** * Returns if the column is selected. * ```typescript * let isSelected = this.column.selected; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.af; }, set: function (v) { this.i.af = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "disableHiding", { /** * Gets whether the hiding is disabled. * ```typescript * let isHidingDisabled = this.column.disableHiding; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.s; }, set: function (v) { this.i.s = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "disablePinning", { /** * Gets whether the pinning is disabled. * ```typescript * let isPinningDisabled = this.column.disablePinning; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.t; }, set: function (v) { this.i.t = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "width", { /** * Gets the `width` of the column. * ```typescript * let columnWidth = this.column.width; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.bk; }, set: function (v) { this.i.bk = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "maxWidth", { get: function () { return this.i.bg; }, set: function (v) { this.i.bg = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "headerClasses", { get: function () { return this.i.be; }, set: function (v) { this.i.be = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "headerStyles", { get: function () { return this.i.aw; }, set: function (v) { this.i.aw = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "headerGroupClasses", { get: function () { return this.i.bf; }, set: function (v) { this.i.bf = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "headerGroupStyles", { get: function () { return this.i.av; }, set: function (v) { this.i.av = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "cellClasses", { get: function () { return this.i.at; }, set: function (v) { this.i.at = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "cellStyles", { get: function () { return this.i.au; }, set: function (v) { this.i.au = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "formatter", { /** * Applies display format to cell values in the column. Does not modify the underlying data. * @remark * Note: As the formatter is used in places like the Excel style filtering dialog, in certain * scenarios (remote filtering for example), the row data argument can be `undefined`. * In this example, we check to see if the column name is Salary, and then provide a method as the column formatter * to format the value into a currency string. * @example * ```typescript * columnInit(column: IgxColumnComponent) { * if (column.field == "Salary") { * column.formatter = (salary => this.format(salary)); * } * } * format(value: number) : string { * return formatCurrency(value, "en-us", "$"); * } * ``` * @example * ```typescript * const column = this.grid.getColumnByName('Address'); * const addressFormatter = (address: string, rowData: any) => data.privacyEnabled ? 'unknown' : address; * column.formatter = addressFormatter; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.d; }, set: function (v) { this.i.d = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "summaryFormatter", { get: function () { return this.i.l; }, set: function (v) { this.i.l = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "filteringIgnoreCase", { get: function () { return this.i.w; }, set: function (v) { this.i.w = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "sortingIgnoreCase", { get: function () { return this.i.ah; }, set: function (v) { this.i.ah = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "searchable", { get: function () { return this.i.ad; }, set: function (v) { this.i.ad = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "dataType", { get: function () { return this.i.j; }, set: function (v) { this.i.j = ensureEnum(GridColumnDataType_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "rowEnd", { get: function () { return this.i.ao; }, set: function (v) { this.i.ao = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "colEnd", { get: function () { return this.i.ak; }, set: function (v) { this.i.ak = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "rowStart", { get: function () { return this.i.ap; }, set: function (v) { this.i.ap = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "colStart", { get: function () { return this.i.al; }, set: function (v) { this.i.al = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "additionalTemplateContext", { get: function () { return this.i.as; }, set: function (v) { this.i.as = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "minWidth", { get: function () { return this.i.bh; }, set: function (v) { this.i.bh = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "index", { /** * Gets the column index. * ```typescript * let columnIndex = this.column.index; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.am; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "pinned", { /** * Gets whether the column is `pinned`. * ```typescript * let isPinned = this.column.pinned; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.ab; }, set: function (v) { this.i.ab = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "summaries", { /** * Gets the column `summaries`. * ```typescript * let columnSummaries = this.column.summaries; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.az; }, set: function (v) { this.i.az = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "disabledSummaries", { get: function () { return this.i.c; }, set: function (v) { if (v && !Array.isArray(v) && typeof (v) == "string") { var re = /\s*(?:,|\s|$)\s*/gm; v = v.split(re); } this.i.c = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "filters", { /** * Gets the column `filters`. * ```typescript * let columnFilters = this.column.filters' * ``` * @memberof IgxColumnComponent */ get: function () { var r = this.i.i; if (r == null) { return null; } if (!r.externalObject) { var e = new IgrFilteringOperand(); 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.i = null : this.i.i = v.i; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "sortStrategy", { /** * Gets the column `sortStrategy`. * ```typescript * let sortStrategy = this.column.sortStrategy * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.k.nativeElement; }, set: function (v) { this.i.k = interfaceToInternal(v, function () { return new SortingStrategy(); }); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "summaryTemplate", { /** * Returns a reference to the `summaryTemplate`. * ```typescript * let summaryTemplate = this.column.summaryTemplate; * ``` * @memberof IgxColumnComponent */ get: function () { return this._summaryTemplate; }, set: function (v) { this._summaryTemplate = v; if (!this._summaryTemplateAdapter) { this._summaryTemplateAdapter = new ReactTemplateAdapter(this._renderer, this._portalManager, "bb", { html: html }, function () { return new IgrSummaryTemplateContext(); }); } this._summaryTemplateAdapter.setValue(this.i, this._summaryTemplate); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "bodyTemplate", { /** * Returns a reference to the `bodyTemplate`. * ```typescript * let bodyTemplate = this.column.bodyTemplate; * ``` * @memberof IgxColumnComponent */ get: function () { return this._bodyTemplate; }, set: function (v) { this._bodyTemplate = v; if (!this._bodyTemplateAdapter) { this._bodyTemplateAdapter = new ReactTemplateAdapter(this._renderer, this._portalManager, "a6", { html: html }, function () { return new IgrCellTemplateContext(); }); } this._bodyTemplateAdapter.setValue(this.i, this._bodyTemplate); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "headerTemplate", { /** * Returns a reference to the header template. * ```typescript * let headerTemplate = this.column.headerTemplate; * ``` * @memberof IgxColumnComponent */ get: function () { return this._headerTemplate; }, set: function (v) { this._headerTemplate = v; if (!this._headerTemplateAdapter) { this._headerTemplateAdapter = new ReactTemplateAdapter(this._renderer, this._portalManager, "a9", { html: html }, function () { return new IgrColumnTemplateContext(); }); } this._headerTemplateAdapter.setValue(this.i, this._headerTemplate); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "inlineEditorTemplate", { /** * Returns a reference to the inline editor template. * ```typescript * let inlineEditorTemplate = this.column.inlineEditorTemplate; * ``` * @memberof IgxColumnComponent */ get: function () { return this._inlineEditorTemplate; }, set: function (v) { this._inlineEditorTemplate = v; if (!this._inlineEditorTemplateAdapter) { this._inlineEditorTemplateAdapter = new ReactTemplateAdapter(this._renderer, this._portalManager, "ba", { html: html }, function () { return new IgrCellTemplateContext(); }); } this._inlineEditorTemplateAdapter.setValue(this.i, this._inlineEditorTemplate); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "errorTemplate", { /** * Returns a reference to the validation error template. * ```typescript * let errorTemplate = this.column.errorTemplate; * ``` */ get: function () { return this._errorTemplate; }, set: function (v) { this._errorTemplate = v; if (!this._errorTemplateAdapter) { this._errorTemplateAdapter = new ReactTemplateAdapter(this._renderer, this._portalManager, "a7", { html: html }, function () { return new IgrCellTemplateContext(); }); } this._errorTemplateAdapter.setValue(this.i, this._errorTemplate); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "filterCellTemplate", { /** * Returns a reference to the `filterCellTemplate`. * ```typescript * let filterCellTemplate = this.column.filterCellTemplate; * ``` * @memberof IgxColumnComponent */ get: function () { return this._filterCellTemplate; }, set: function (v) { this._filterCellTemplate = v; if (!this._filterCellTemplateAdapter) { this._filterCellTemplateAdapter = new ReactTemplateAdapter(this._renderer, this._portalManager, "a8", { html: html }, function () { return new IgrColumnTemplateContext(); }); } this._filterCellTemplateAdapter.setValue(this.i, this._filterCellTemplate); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "visibleIndex", { /** * Gets the column visible index. * If the column is not visible, returns `-1`. * ```typescript * let visibleColumnIndex = this.column.visibleIndex; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.aq; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "columnGroup", { /** * Returns a boolean indicating if the column is a `ColumnGroup`. * ```typescript * let columnGroup = this.column.columnGroup; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.p; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "columnLayout", { /** * Returns a boolean indicating if the column is a `ColumnLayout` for multi-row layout. * ```typescript * let columnGroup = this.column.columnGroup; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.q; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "columnLayoutChild", { /** * Returns a boolean indicating if the column is a child of a `ColumnLayout` for multi-row layout. * ```typescript * let columnLayoutChild = this.column.columnLayoutChild; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.r; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "childColumns", { /** * A list containing all the child columns under this column (if any). * Empty without children or if this column is not Group or Layout. */ get: function () { if (!this.i.b) { return undefined; } var ret = []; for (var i = 0; i < this.i.b.length; i++) { var impl = this.i.b[i]; if (!impl.externalObject) { if (impl instanceof IgrColumn) { ret.push(impl); continue; } var e = IgrColumn._createFromInternal(impl); e._implementation = impl; impl.externalObject = e; } ret.push(impl.externalObject); } return ret; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.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: function () { return this.i.an; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "visibleWhenCollapsed", { get: function () { return this.i.aj; }, set: function (v) { this.i.aj = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "pipeArgs", { get: function () { return this.i.g.nativeElement; }, set: function (v) { this.i.g = interfaceToInternal(v, function () { return new ColumnPipeArgs(); }); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "editorOptions", { get: function () { return this.i.f.nativeElement; }, set: function (v) { this.i.f = interfaceToInternal(v, function () { return new ColumnEditorOptions(); }); }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "filteringExpressionsTree", { /** * Returns the filteringExpressionsTree of the column. * ```typescript * let tree = this.column.filteringExpressionsTree; * ``` * @memberof IgxColumnComponent */ get: function () { var r = this.i.h; if (r == null) { return null; } if (!r.externalObject) { var e = new IgrFilteringExpressionsTree(); if (r.$type) { e._implementation = r; } else { if (e.i.setNativeElement) { e.i.setNativeElement(r); } } r.externalObject = e; } return r.externalObject; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "parent", { /** * Sets/gets the parent column. * ```typescript * let parentColumn = this.column.parent; * ``` * ```typescript * this.column.parent = higherLevelColumn; * ``` * @memberof IgxColumnComponent */ get: function () { return this.i.ay; }, set: function (v) { this.i.ay = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "topLevelParent", { /** * Returns a reference to the top level parent column. * ```typescript * let topLevelParent = this.column.topLevelParent; * ``` */ get: function () { var r = this.i.e; if (r == null) { return null; } if (!r.externalObject) { var e = IgrColumn._createFromInternal(r); if (e) { e._implementation = r; } r.externalObject = e; } return r.externalObject; }, enumerable: false, configurable: true }); Object.defineProperty(IgrColumn.prototype, "name", { get: function () { return this.i.bi; }, set: function (v) { this.i.bi = v; }, enumerable: false, configurable: true }); IgrColumn.prototype.findByName = function (name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } if (this.filters && this.filters.name && this.filters.name == name) { return this.filters; } if (this.sortStrategy && this.sortStrategy.name && this.sortStrategy.name == name) { return this.sortStrategy; } if (this.pipeArgs && this.pipeArgs.name && this.pipeArgs.name == name) { return this.pipeArgs; } if (this.editorOptions && this.editorOptions.name && this.editorOptions.name == name) { return this.editorOptions; } return null; }; Object.defineProperty(IgrColumn.prototype, "hasUserValues", { get: function () { return this._hasUserValues; }, enumerable: false, configurable: true }); IgrColumn.prototype.__m = function (propertyName) { if (!this._inStyling) { this._hasUserValues.add(propertyName); } }; IgrColumn.prototype._styling = function (container, component, parent) { if (this._inStyling) { return; } this._inStyling = true; this._stylingContainer = container; this._stylingParent = component; var genericPrefix = ""; var typeName = this.i.$type.name; if (typeName.indexOf("Xam") === 0) { typeName = typeName.substring(3); } genericPrefix = toSpinal("Column"); var additionalPrefixes = []; var prefix = toSpinal(typeName); additionalPrefixes.push(prefix + "-"); var b = this.i.$type.baseType; while (b && b.name != "Object" && b.name != "Base" && b.name != "Control" && b.Name != "DependencyObject" && b.Name != "FrameworkElement") { typeName = b.name; if (typeName.indexOf("Xam") === 0) { typeName = typeName.substring(3); } var basePrefix = toSpinal(typeName); additionalPrefixes.push(basePrefix + "-"); b = b.baseType; } if (parent) { var parentTypeName = parent.i.$type.name; if (parentTypeName.indexOf("Xam") === 0) { parentTypeName = parentTypeName.substring(3); } var parentPrefix = toSpinal(parentTypeName); additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-"); additionalPrefixes.push(parentPrefix + "-" + prefix + "-"); } initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes); if (this.topLevelParent && this.topLevelParent._styling) { this.topLevelParent._styling(container, component, this); } if (this._otherStyling) { this._otherStyling(container, component, parent); } this._inStyling = false; }; IgrColumn.prototype.setNativeElement = function (element) { this.i.setNativeElement(element); }; /** * Pins the column at the provided index in the pinned area. * Defaults to index `0` if not provided, or to the initial index in the pinned area. * 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 */ IgrColumn.prototype.pin = function (index) { var iv = this.i.aa(index); return (iv); }; /** * Unpins the column and place it at the provided index in the unpinned area. * Defaults to index `0` if not provided, or to the initial index in the unpinned area. * 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 */ IgrColumn.prototype.unpin = function (index) { var iv = this.i.ai(index); return (iv); }; /** * Moves a column to the specified visible index. * If passed index is invalid, or if column would receive a different visible index after moving, moving is not performed. * If passed index would move the column to a different column group. moving is not performed. * @example * ```typescript * column.move(index); * ``` * @memberof IgxColumnComponent */ IgrColumn.prototype.move = function (index) { this.i.bm(index); }; /** * Autosize the column to the longest currently visible cell value, including the header cell. * ```typescript * @ViewChild('grid') grid: IgxGridComponent; * let column = this.grid.columnList.filter(c => c.field === 'ID')[0]; * column.autosize(); * ``` * @memberof IgxColumnComponent * byHeaderOnly Set if column should be autosized based only on the header content. * @param byHeaderOnly * Set if column should be autosized based only on the header content. */ IgrColumn.prototype.autosize = function (byHeaderOnly) { this.i.bl(byHeaderOnly); }; return IgrColumn; }(React.Component)); export { IgrColumn };