UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

159 lines (158 loc) 5.62 kB
import { __extends, __values } from "tslib"; import * as React from 'react'; import { ensureEnum, NamePatcher, isValidProp, getModifiedProps } from "igniteui-react-core"; import { ReactRenderer } from "igniteui-react-core"; import { DataGridStylingDefaults } from './DataGridStylingDefaults'; import { GridColumnSortOptions } from './GridColumnSortOptions'; import { IgrGridColumnOptionsSimpleSectionBase } from "./igr-grid-column-options-simple-section-base"; import { ColumnSortDirection_$type } from "./ColumnSortDirection"; var IgrGridColumnSortOptions = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrGridColumnSortOptions, _super); function IgrGridColumnSortOptions(props) { var _this = _super.call(this, props) || this; _this._reactRenderer = null; if (_this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this)); } _this._getMainRef = _this._getMainRef.bind(_this); if (document) { _this._mainDiv = document.createElement("div"); _this._mainDiv.style.display = "block"; _this._mainDiv.style.width = "100%"; _this._mainDiv.style.height = "100%"; } var ren = new ReactRenderer(_this._mainDiv, document, true, DataGridStylingDefaults); _this._reactRenderer = ren; var gridColumnSortOptions = _this.i; gridColumnSortOptions.provideRenderer(ren); if (props) { _this.initializeProperties(); } return _this; } IgrGridColumnSortOptions.prototype._getMainRef = function (ref) { this._elRef = ref; }; IgrGridColumnSortOptions.prototype.render = function () { var children = []; React.Children.forEach(this.props.children, function (ch) { children.push(ch); }); var div = React.createElement("div", { className: "ig-grid-column-sort-options igr-grid-column-sort-options", ref: this._getMainRef, children: children }); return div; }; IgrGridColumnSortOptions.prototype.shouldComponentUpdate = function (nextProps, nextState) { var e_1, _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_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; } } return true; }; IgrGridColumnSortOptions.prototype.initializeProperties = function () { var e_2, _a; 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_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; } } }; // supports angular themes or custom properties set in CSS IgrGridColumnSortOptions.prototype.updateStyle = function () { this._styling(this._mainDiv, this); }; IgrGridColumnSortOptions.prototype.destroy = function () { this.i.destroy(); this._reactRenderer.destroy(); }; IgrGridColumnSortOptions.prototype.componentWillUnmount = function () { }; IgrGridColumnSortOptions.prototype.componentDidMount = function () { this._elRef.appendChild(this._mainDiv); this.initializeContent(); }; IgrGridColumnSortOptions.prototype.initializeContent = function () { this._styling(this._mainDiv, this); this.updateStyle(); }; IgrGridColumnSortOptions.prototype.createImplementation = function () { return new GridColumnSortOptions(); }; Object.defineProperty(IgrGridColumnSortOptions.prototype, "i", { get: function () { return this._implementation; }, enumerable: false, configurable: true }); Object.defineProperty(IgrGridColumnSortOptions.prototype, "ascendingCaption", { get: function () { return this.i.b5; }, set: function (v) { this.i.b5 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrGridColumnSortOptions.prototype, "descendingCaption", { get: function () { return this.i.b9; }, set: function (v) { this.i.b9 = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrGridColumnSortOptions.prototype, "sortDirection", { get: function () { return this.i.b2; }, set: function (v) { this.i.b2 = ensureEnum(ColumnSortDirection_$type, v); }, enumerable: false, configurable: true }); return IgrGridColumnSortOptions; }(IgrGridColumnOptionsSimpleSectionBase)); export { IgrGridColumnSortOptions };