UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

304 lines (303 loc) 11 kB
import { __extends, __values } from "tslib"; import * as React from 'react'; import { delegateCombine, delegateRemove } from "igniteui-react-core"; import { ColumnSortDirection_$type } from "./ColumnSortDirection"; import { SortIndicatorStyle_$type } from "./SortIndicatorStyle"; import { IgrSortIndicatorRenderCompletedEventArgs } from "./igr-sort-indicator-render-completed-event-args"; import { GridSortIndicator } from "./GridSortIndicator"; import { TypeRegistrar } from "igniteui-react-core"; import { NamePatcher, getModifiedProps, isValidProp, ensureEnum, brushToString, stringToBrush, ensureBool, toSpinal, initializePropertiesFromCss } from "igniteui-react-core"; /** * An advanced grid for displaying data. */ var IgrDataGridSortIndicator = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrDataGridSortIndicator, _super); function IgrDataGridSortIndicator(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; _this._renderCompleted = null; _this._renderCompleted_wrapped = null; if (_this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this)); } _this._implementation = _this.createImplementation(); _this._implementation.externalObject = _this; _this.onImplementationCreated(); if (_this._initializeAdapters) { _this._initializeAdapters(); } return _this; } IgrDataGridSortIndicator.prototype.createImplementation = function () { return new GridSortIndicator(); }; Object.defineProperty(IgrDataGridSortIndicator.prototype, "nativeElement", { get: function () { return this._implementation.nativeElement; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridSortIndicator.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; } /** * @hidden */, enumerable: false, configurable: true }); IgrDataGridSortIndicator._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); }; IgrDataGridSortIndicator.prototype.onImplementationCreated = function () { }; IgrDataGridSortIndicator.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; } } }; IgrDataGridSortIndicator.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; }; IgrDataGridSortIndicator.prototype.render = function () { return null; }; Object.defineProperty(IgrDataGridSortIndicator.prototype, "sortDirection", { get: function () { return this.i.b; }, set: function (v) { this.i.b = ensureEnum(ColumnSortDirection_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridSortIndicator.prototype, "iconColor", { get: function () { return brushToString(this.i.a0); }, set: function (v) { this.i.a0 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridSortIndicator.prototype, "isAnimationEnabled", { get: function () { return this.i.l; }, set: function (v) { this.i.l = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridSortIndicator.prototype, "pixelScalingRatio", { /** * Gets or sets the scaling value used to affect the pixel density of the control. * A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control * to appear blurry. */ get: function () { return this.i.w; }, set: function (v) { this.i.w = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridSortIndicator.prototype, "actualPixelScalingRatio", { /** * Gets the actual pixel scaling ratio used to affect the pixel density of the control. * A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control * to appear blurry. */ get: function () { return this.i.p; }, set: function (v) { this.i.p = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGridSortIndicator.prototype, "sortIndicatorStyle", { get: function () { return this.i.f; }, set: function (v) { this.i.f = ensureEnum(SortIndicatorStyle_$type, v); }, enumerable: false, configurable: true }); IgrDataGridSortIndicator.prototype.findByName = function (name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } return null; }; Object.defineProperty(IgrDataGridSortIndicator.prototype, "hasUserValues", { get: function () { return this._hasUserValues; }, enumerable: false, configurable: true }); IgrDataGridSortIndicator.prototype.__m = function (propertyName) { if (!this._inStyling) { this._hasUserValues.add(propertyName); } }; IgrDataGridSortIndicator.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("DataGridSortIndicator"); 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._otherStyling) { this._otherStyling(container, component, parent); } this._inStyling = false; }; IgrDataGridSortIndicator.prototype.getDesiredScale = function () { var iv = this.i.v(); return (iv); }; IgrDataGridSortIndicator.prototype.notifySizeChanged = function (width, height) { this.i.ar(width, height); }; IgrDataGridSortIndicator.prototype.notifyCellSizeChanged = function () { this.i.aq(); }; Object.defineProperty(IgrDataGridSortIndicator.prototype, "renderCompleted", { get: function () { return this._renderCompleted; }, set: function (ev) { var _this = this; if (this._renderCompleted_wrapped !== null) { this.i.renderCompleted = delegateRemove(this.i.renderCompleted, this._renderCompleted_wrapped); this._renderCompleted_wrapped = null; this._renderCompleted = null; } this._renderCompleted = ev; this._renderCompleted_wrapped = function (o, e) { var outerArgs = new IgrSortIndicatorRenderCompletedEventArgs(); outerArgs._provideImplementation(e); if (_this.beforeRenderCompleted) { _this.beforeRenderCompleted(_this, outerArgs); } if (_this._renderCompleted) { _this._renderCompleted(_this, outerArgs); } }; this.i.renderCompleted = delegateCombine(this.i.renderCompleted, this._renderCompleted_wrapped); ; }, enumerable: false, configurable: true }); return IgrDataGridSortIndicator; }(React.Component)); export { IgrDataGridSortIndicator };