UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

67 lines (66 loc) 2.23 kB
import * as React from 'react'; import { IgrColumnGroup } from "./igr-column-group"; import { ColumnLayout } from "./ColumnLayout"; import { isValidProp } from "igniteui-react-core"; /** * Column layout for declaration of Multi-row Layout * @igxParent IgxGridComponent */ export class IgrColumnLayout extends IgrColumnGroup { createImplementation() { var _a, _b; let impl = new ColumnLayout(); let nat; if (typeof document !== 'undefined') { nat = document.createElement("igc-column-layout"); } 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); } 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]; }); const visibleChildren = []; React.Children.forEach(this.props.children, (ch) => { if (ch) { visibleChildren.push(ch); } }); let children = this._contentChildrenManager.getChildren(visibleChildren); 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; } }