igniteui-react-grids
Version:
Ignite UI React grid components.
81 lines (80 loc) • 2.92 kB
JavaScript
import { __assign, __extends } from "tslib";
import * as React from 'react';
import { IgrRowDirective } from "./igr-row-directive";
import { GridRow } from "./GridRow";
import { isValidProp } from "igniteui-react-core";
var IgrGridRow = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrGridRow, _super);
function IgrGridRow(props) {
var _this = _super.call(this, props) || this;
_this._getMainRef = _this._getMainRef.bind(_this);
return _this;
}
IgrGridRow.prototype.createImplementation = function () {
var _a, _b;
var impl = new GridRow();
var nat;
if (typeof document !== 'undefined') {
nat = document.createElement("igc-grid-row");
}
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(IgrGridRow.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgrGridRow.prototype.componentDidMount = function () {
this.mounted = true;
_super.prototype.componentDidMount.call(this);
};
IgrGridRow.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, style: style, children: children }));
return div;
};
IgrGridRow.prototype._getMainRef = function (ref) {
this._elRef = ref;
};
IgrGridRow.prototype.getContext = function (col, row) {
this.i.q(col, row);
};
IgrGridRow.prototype.getContextMRL = function (pinnedCols, row) {
this.i.r(pinnedCols, row);
};
return IgrGridRow;
}(IgrRowDirective));
export { IgrGridRow };