kea-react
Version:
Componentes comunes de react
41 lines (40 loc) • 2.01 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var botones_1 = require("../../../botones");
var drillObjectModal_1 = require("./drillObjectModal");
var ObjectCell = /** @class */ (function (_super) {
__extends(ObjectCell, _super);
function ObjectCell(props) {
var _this = _super.call(this, props) || this;
_this.onModalCerrar = function (path) {
if (path != null) {
_this.props.onDrillDown(path);
}
_this.setState({ showDrillModal: false });
};
_this.state = {};
return _this;
}
ObjectCell.prototype.render = function () {
var _this = this;
var keys = Object.keys(this.props.value);
var _a = this, props = _a.props, state = _a.state;
return (React.createElement("span", null,
React.createElement(botones_1.Link, { style: "success", iconClass: "fa fa-list-alt", onClick: function () { return _this.setState({ showDrillModal: true }); } }),
keys.map(function (key) { return React.createElement(botones_1.Link, { style: "info", key: key, onClick: function () { return props.onDrillDown([key]); } }, key); }),
React.createElement(drillObjectModal_1.DrillObjectComponent, { show: !!state.showDrillModal, value: props.value, onCerrar: this.onModalCerrar })));
};
return ObjectCell;
}(React.PureComponent));
exports.ObjectCell = ObjectCell;