igniteui-react-grids
Version:
Ignite UI React grid components.
100 lines (97 loc) • 3.42 kB
JavaScript
import { __assign, __extends } from "tslib";
import * as React from 'react';
import { IgrGridActionsBaseDirective } from "./igr-grid-actions-base-directive";
import { GridPinningActions } from "./GridPinningActions";
import { isValidProp } from "igniteui-react-core";
/**
* Grid Pinning Actions for the Action Strip
* @igxParent IgxActionStripComponent
*/
var IgrGridPinningActions = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrGridPinningActions, _super);
function IgrGridPinningActions(props) {
var _this = _super.call(this, props) || this;
_this._getMainRef = _this._getMainRef.bind(_this);
return _this;
}
IgrGridPinningActions.prototype.createImplementation = function () {
var _a, _b;
var impl = new GridPinningActions();
var nat;
if (typeof document !== 'undefined') {
nat = document.createElement("igc-grid-pinning-actions");
}
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(IgrGridPinningActions.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgrGridPinningActions.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;
};
IgrGridPinningActions.prototype._getMainRef = function (ref) {
this._elRef = ref;
};
/**
* Pin the row according to the context.
* @example
* ```typescript
* this.gridPinningActions.pin();
* ```
*/
IgrGridPinningActions.prototype.pin = function (evt) {
this.i.h(evt);
};
/**
* Unpin the row according to the context.
* @example
* ```typescript
* this.gridPinningActions.unpin();
* ```
*/
IgrGridPinningActions.prototype.unpin = function (evt) {
this.i.j(evt);
};
IgrGridPinningActions.prototype.scrollToRow = function (evt) {
this.i.i(evt);
};
return IgrGridPinningActions;
}(IgrGridActionsBaseDirective));
export { IgrGridPinningActions };