UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

71 lines (70 loc) 2.27 kB
import * as React from 'react'; import { IgrRowDirective } from "./igr-row-directive"; import { GridRow } from "./GridRow"; import { isValidProp } from "igniteui-react-core"; export class IgrGridRow extends IgrRowDirective { createImplementation() { var _a, _b; let impl = new GridRow(); let 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; } /** * @hidden */ get i() { return this._implementation; } constructor(props) { super(props); this._getMainRef = this._getMainRef.bind(this); } componentDidMount() { this.mounted = true; super.componentDidMount(); } render() { const nativePropsName = Object.keys(this.props).filter(prop => !isValidProp(this, prop) && prop !== "originalRef" && prop !== "className"); const nativeProps = {}; nativePropsName.forEach(propName => { nativeProps[propName] = this.props[propName]; }); let propChildren = this.props.children; let children = []; React.Children.forEach(propChildren, (ch) => { children.push(React.cloneElement(ch)); }); this._portalManager.onRender(children); let style = {}; style.display = 'contents'; if (this.props.style) { style = this.props.style; } let div = React.createElement("div", Object.assign(Object.assign({}, nativeProps), { ref: this._getMainRef, style: style, children: children })); return div; } _getMainRef(ref) { this._elRef = ref; } getContext(col, row) { this.i.q(col, row); } getContextMRL(pinnedCols, row) { this.i.r(pinnedCols, row); } }