|
| 1 | +"use strict"; |
| 2 | + |
| 3 | +Object.defineProperty(exports, "__esModule", { |
| 4 | + value: true |
| 5 | +}); |
| 6 | + |
| 7 | +var _createClass = (function() { |
| 8 | + function defineProperties(target, props) { |
| 9 | + for (var i = 0; i < props.length; i++) { |
| 10 | + var descriptor = props[i]; |
| 11 | + descriptor.enumerable = descriptor.enumerable || false; |
| 12 | + descriptor.configurable = true; |
| 13 | + if ("value" in descriptor) descriptor.writable = true; |
| 14 | + Object.defineProperty(target, descriptor.key, descriptor); |
| 15 | + } |
| 16 | + } |
| 17 | + return function(Constructor, protoProps, staticProps) { |
| 18 | + if (protoProps) defineProperties(Constructor.prototype, protoProps); |
| 19 | + if (staticProps) defineProperties(Constructor, staticProps); |
| 20 | + return Constructor; |
| 21 | + }; |
| 22 | +})(); |
| 23 | + |
| 24 | +var _react = require("react"); |
| 25 | + |
| 26 | +var _react2 = _interopRequireDefault(_react); |
| 27 | + |
| 28 | +function _interopRequireDefault(obj) { |
| 29 | + return obj && obj.__esModule ? obj : { default: obj }; |
| 30 | +} |
| 31 | + |
| 32 | +function _classCallCheck(instance, Constructor) { |
| 33 | + if (!(instance instanceof Constructor)) { |
| 34 | + throw new TypeError("Cannot call a class as a function"); |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +function _possibleConstructorReturn(self, call) { |
| 39 | + if (!self) { |
| 40 | + throw new ReferenceError( |
| 41 | + "this hasn't been initialised - super() hasn't been called" |
| 42 | + ); |
| 43 | + } |
| 44 | + return call && (typeof call === "object" || typeof call === "function") |
| 45 | + ? call |
| 46 | + : self; |
| 47 | +} |
| 48 | + |
| 49 | +function _inherits(subClass, superClass) { |
| 50 | + if (typeof superClass !== "function" && superClass !== null) { |
| 51 | + throw new TypeError( |
| 52 | + "Super expression must either be null or a function, not " + |
| 53 | + typeof superClass |
| 54 | + ); |
| 55 | + } |
| 56 | + subClass.prototype = Object.create(superClass && superClass.prototype, { |
| 57 | + constructor: { |
| 58 | + value: subClass, |
| 59 | + enumerable: false, |
| 60 | + writable: true, |
| 61 | + configurable: true |
| 62 | + } |
| 63 | + }); |
| 64 | + if (superClass) |
| 65 | + Object.setPrototypeOf |
| 66 | + ? Object.setPrototypeOf(subClass, superClass) |
| 67 | + : (subClass.__proto__ = superClass); |
| 68 | +} |
| 69 | + |
| 70 | +var OutTable = (function(_Component) { |
| 71 | + _inherits(OutTable, _Component); |
| 72 | + |
| 73 | + function OutTable(props) { |
| 74 | + _classCallCheck(this, OutTable); |
| 75 | + |
| 76 | + var _this = _possibleConstructorReturn( |
| 77 | + this, |
| 78 | + (OutTable.__proto__ || Object.getPrototypeOf(OutTable)).call(this, props) |
| 79 | + ); |
| 80 | + |
| 81 | + _this.state = {}; |
| 82 | + return _this; |
| 83 | + } |
| 84 | + |
| 85 | + _createClass(OutTable, [ |
| 86 | + { |
| 87 | + key: "render", |
| 88 | + value: function render() { |
| 89 | + var _this2 = this; |
| 90 | + |
| 91 | + return _react2.default.createElement( |
| 92 | + "div", |
| 93 | + null, |
| 94 | + _react2.default.createElement( |
| 95 | + "table", |
| 96 | + { className: this.props.tableClassName }, |
| 97 | + _react2.default.createElement( |
| 98 | + "tbody", |
| 99 | + null, |
| 100 | + _react2.default.createElement( |
| 101 | + "tr", |
| 102 | + null, |
| 103 | + this.props.columns.map(function(c) { |
| 104 | + return _react2.default.createElement( |
| 105 | + "th", |
| 106 | + { |
| 107 | + key: c.key, |
| 108 | + className: |
| 109 | + c.key === -1 ? _this2.props.tableHeaderRowClass : "" |
| 110 | + }, |
| 111 | + c.key === -1 ? "" : c.name |
| 112 | + ); |
| 113 | + }) |
| 114 | + ), |
| 115 | + this.props.data.map(function(r, i) { |
| 116 | + return _react2.default.createElement( |
| 117 | + "tr", |
| 118 | + { key: i }, |
| 119 | + _react2.default.createElement( |
| 120 | + "td", |
| 121 | + { key: i, className: _this2.props.tableHeaderRowClass }, |
| 122 | + i |
| 123 | + ), |
| 124 | + _this2.props.columns.map(function(c) { |
| 125 | + return _react2.default.createElement( |
| 126 | + "td", |
| 127 | + { key: c.key }, |
| 128 | + r[c.key] |
| 129 | + ); |
| 130 | + }) |
| 131 | + ); |
| 132 | + }) |
| 133 | + ) |
| 134 | + ) |
| 135 | + ); |
| 136 | + } |
| 137 | + } |
| 138 | + ]); |
| 139 | + |
| 140 | + return OutTable; |
| 141 | +})(_react.Component); |
| 142 | + |
| 143 | +exports.default = OutTable; |
0 commit comments