UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

79 lines (78 loc) 2.95 kB
import { __assign, __extends } from "tslib"; import * as React from 'react'; import { IgrBaseToolbarColumnActionsDirective } from "./igr-base-toolbar-column-actions-directive"; import { GridToolbarPinning } from "./GridToolbarPinning"; import { isValidProp } from "igniteui-react-core"; /** * Provides a pre-configured column pinning component for the grid. * @igxModule IgxGridToolbarModule * @igxParent IgxGridToolbarComponent * @example * ```html * ``` */ var IgrGridToolbarPinning = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrGridToolbarPinning, _super); function IgrGridToolbarPinning(props) { var _this = _super.call(this, props) || this; _this._getMainRef = _this._getMainRef.bind(_this); return _this; } IgrGridToolbarPinning.prototype.createImplementation = function () { var _a, _b; var impl = new GridToolbarPinning(); var nat; if (typeof document !== 'undefined') { nat = document.createElement("igc-grid-toolbar-pinning"); } 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(IgrGridToolbarPinning.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; }, enumerable: false, configurable: true }); IgrGridToolbarPinning.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; }; IgrGridToolbarPinning.prototype._getMainRef = function (ref) { this._elRef = ref; }; return IgrGridToolbarPinning; }(IgrBaseToolbarColumnActionsDirective)); export { IgrGridToolbarPinning };