UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

138 lines (136 loc) 4.62 kB
import { __assign, __extends } from "tslib"; import * as React from 'react'; import { IgrGridActionsBaseDirective } from "./igr-grid-actions-base-directive"; import { GridEditingActions } from "./GridEditingActions"; import { isValidProp, ensureBool } from "igniteui-react-core"; /** * Grid Editing Actions for the Action Strip * @igxParent IgxActionStripComponent */ var IgrGridEditingActions = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrGridEditingActions, _super); function IgrGridEditingActions(props) { var _this = _super.call(this, props) || this; _this._getMainRef = _this._getMainRef.bind(_this); return _this; } IgrGridEditingActions.prototype.createImplementation = function () { var _a, _b; var impl = new GridEditingActions(); var nat; if (typeof document !== 'undefined') { nat = document.createElement("igc-grid-editing-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(IgrGridEditingActions.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; }, enumerable: false, configurable: true }); IgrGridEditingActions.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; }; IgrGridEditingActions.prototype._getMainRef = function (ref) { this._elRef = ref; }; Object.defineProperty(IgrGridEditingActions.prototype, "addRow", { /** * An input to enable/disable action strip row adding button */ get: function () { return this.i.i; }, set: function (v) { this.i.i = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrGridEditingActions.prototype, "editRow", { /** * An input to enable/disable action strip row editing button */ get: function () { return this.i.k; }, set: function (v) { this.i.k = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrGridEditingActions.prototype, "deleteRow", { /** * An input to enable/disable action strip row deleting button */ get: function () { return this.i.j; }, set: function (v) { this.i.j = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrGridEditingActions.prototype, "addChild", { /** * An input to enable/disable action strip child row adding button */ get: function () { return this.i.h; }, set: function (v) { this.i.h = ensureBool(v); }, enumerable: false, configurable: true }); /** * Enter row or cell edit mode depending the grid rowEditable option * @example * ```typescript * this.gridEditingActions.startEdit(); * ``` */ IgrGridEditingActions.prototype.startEdit = function (evt) { this.i.l(evt); }; return IgrGridEditingActions; }(IgrGridActionsBaseDirective)); export { IgrGridEditingActions };