igniteui-react-grids
Version:
Ignite UI React grid components.
128 lines (127 loc) • 4.67 kB
JavaScript
import { __extends, __values } from "tslib";
import * as React from 'react';
import { NamePatcher, isValidProp, getModifiedProps } from "igniteui-react-core";
import { ReactRenderer } from "igniteui-react-core";
import { DataGridStylingDefaults } from './DataGridStylingDefaults';
import { GridColumnHideOptions } from './GridColumnHideOptions';
import { IgrGridColumnOptionsSimpleSectionBase } from "./igr-grid-column-options-simple-section-base";
var IgrGridColumnHideOptions = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrGridColumnHideOptions, _super);
function IgrGridColumnHideOptions(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 gridColumnHideOptions = _this.i;
gridColumnHideOptions.provideRenderer(ren);
if (props) {
_this.initializeProperties();
}
return _this;
}
IgrGridColumnHideOptions.prototype._getMainRef = function (ref) {
this._elRef = ref;
};
IgrGridColumnHideOptions.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-hide-options igr-grid-column-hide-options",
ref: this._getMainRef,
children: children
});
return div;
};
IgrGridColumnHideOptions.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;
};
IgrGridColumnHideOptions.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
IgrGridColumnHideOptions.prototype.updateStyle = function () {
this._styling(this._mainDiv, this);
};
IgrGridColumnHideOptions.prototype.destroy = function () {
this.i.destroy();
this._reactRenderer.destroy();
};
IgrGridColumnHideOptions.prototype.componentWillUnmount = function () {
};
IgrGridColumnHideOptions.prototype.componentDidMount = function () {
this._elRef.appendChild(this._mainDiv);
this.initializeContent();
};
IgrGridColumnHideOptions.prototype.initializeContent = function () {
this._styling(this._mainDiv, this);
this.updateStyle();
};
IgrGridColumnHideOptions.prototype.createImplementation = function () {
return new GridColumnHideOptions();
};
Object.defineProperty(IgrGridColumnHideOptions.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
return IgrGridColumnHideOptions;
}(IgrGridColumnOptionsSimpleSectionBase));
export { IgrGridColumnHideOptions };