@hrforte/react-pivottable 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
+
9
+ var _react = require('react');
10
+
11
+ var _react2 = _interopRequireDefault(_react);
12
+
13
+ var _propTypes = require('prop-types');
14
+
15
+ var _propTypes2 = _interopRequireDefault(_propTypes);
16
+
17
+ var _Utilities = require('./Utilities');
18
+
19
+ var _TableRenderers = require('./TableRenderers');
20
+
21
+ var _TableRenderers2 = _interopRequireDefault(_TableRenderers);
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+
25
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
+
27
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
28
+
29
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
30
+
31
+ /* eslint-disable react/prop-types */
32
+ // eslint can't see inherited propTypes!
33
+
34
+ var PivotTable = function (_React$PureComponent) {
35
+ _inherits(PivotTable, _React$PureComponent);
36
+
37
+ function PivotTable() {
38
+ _classCallCheck(this, PivotTable);
39
+
40
+ return _possibleConstructorReturn(this, (PivotTable.__proto__ || Object.getPrototypeOf(PivotTable)).apply(this, arguments));
41
+ }
42
+
43
+ _createClass(PivotTable, [{
44
+ key: 'render',
45
+ value: function render() {
46
+ var Renderer = this.props.renderers[this.props.rendererName in this.props.renderers ? this.props.rendererName : Object.keys(this.props.renderers)[0]];
47
+ return _react2.default.createElement(Renderer, this.props);
48
+ }
49
+ }]);
50
+
51
+ return PivotTable;
52
+ }(_react2.default.PureComponent);
53
+
54
+ PivotTable.propTypes = Object.assign({}, _Utilities.PivotData.propTypes, {
55
+ rendererName: _propTypes2.default.string,
56
+ renderers: _propTypes2.default.objectOf(_propTypes2.default.func),
57
+ colSorts: _propTypes2.default.objectOf(_propTypes2.default.oneOf(['ASC', 'DESC'])),
58
+ rowSorts: _propTypes2.default.objectOf(_propTypes2.default.oneOf(['ASC', 'DESC'])),
59
+ onColSort: _propTypes2.default.func,
60
+ onRowSort: _propTypes2.default.func,
61
+ tableOptions: _propTypes2.default.object
62
+ });
63
+
64
+ PivotTable.defaultProps = Object.assign({}, _Utilities.PivotData.defaultProps, {
65
+ rendererName: 'Table',
66
+ renderers: _TableRenderers2.default,
67
+ tableOptions: {}
68
+ });
69
+
70
+ exports.default = PivotTable;
71
+ module.exports = exports['default'];
72
+ //# sourceMappingURL=PivotTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/PivotTable.jsx"],"names":["PivotTable","Renderer","props","renderers","rendererName","Object","keys","React","PureComponent","propTypes","assign","PivotData","PropTypes","string","objectOf","func","colSorts","oneOf","rowSorts","onColSort","onRowSort","tableOptions","object","defaultProps","TableRenderers"],"mappings":";;;;;;;;AAAA;;;;AACA;;;;AACA;;AACA;;;;;;;;;;;;AAEA;AACA;;IAEMA,U;;;;;;;;;;;6BACK;AACP,UAAMC,WAAW,KAAKC,KAAL,CAAWC,SAAX,CACf,KAAKD,KAAL,CAAWE,YAAX,IAA2B,KAAKF,KAAL,CAAWC,SAAtC,GACI,KAAKD,KAAL,CAAWE,YADf,GAEIC,OAAOC,IAAP,CAAY,KAAKJ,KAAL,CAAWC,SAAvB,EAAkC,CAAlC,CAHW,CAAjB;AAKA,aAAO,8BAAC,QAAD,EAAc,KAAKD,KAAnB,CAAP;AACD;;;;EARsBK,gBAAMC,a;;AAW/BR,WAAWS,SAAX,GAAuBJ,OAAOK,MAAP,CAAc,EAAd,EAAkBC,qBAAUF,SAA5B,EAAuC;AAC5DL,gBAAcQ,oBAAUC,MADoC;AAE5DV,aAAWS,oBAAUE,QAAV,CAAmBF,oBAAUG,IAA7B,CAFiD;AAG5DC,YAAUJ,oBAAUE,QAAV,CAAmBF,oBAAUK,KAAV,CAAgB,CAAC,KAAD,EAAQ,MAAR,CAAhB,CAAnB,CAHkD;AAI5DC,YAAUN,oBAAUE,QAAV,CAAmBF,oBAAUK,KAAV,CAAgB,CAAC,KAAD,EAAQ,MAAR,CAAhB,CAAnB,CAJkD;AAK5DE,aAAWP,oBAAUG,IALuC;AAM5DK,aAAWR,oBAAUG,IANuC;AAO5DM,gBAAcT,oBAAUU;AAPoC,CAAvC,CAAvB;;AAUAtB,WAAWuB,YAAX,GAA0BlB,OAAOK,MAAP,CAAc,EAAd,EAAkBC,qBAAUY,YAA5B,EAA0C;AAClEnB,gBAAc,OADoD;AAElED,aAAWqB,wBAFuD;AAGlEH,gBAAc;AAHoD,CAA1C,CAA1B;;kBAMerB,U","file":"PivotTable.js","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {PivotData} from './Utilities';\nimport TableRenderers from './TableRenderers';\n\n/* eslint-disable react/prop-types */\n// eslint can't see inherited propTypes!\n\nclass PivotTable extends React.PureComponent {\n render() {\n const Renderer = this.props.renderers[\n this.props.rendererName in this.props.renderers\n ? this.props.rendererName\n : Object.keys(this.props.renderers)[0]\n ];\n return <Renderer {...this.props} />;\n }\n}\n\nPivotTable.propTypes = Object.assign({}, PivotData.propTypes, {\n rendererName: PropTypes.string,\n renderers: PropTypes.objectOf(PropTypes.func),\n colSorts: PropTypes.objectOf(PropTypes.oneOf(['ASC', 'DESC'])),\n rowSorts: PropTypes.objectOf(PropTypes.oneOf(['ASC', 'DESC'])),\n onColSort: PropTypes.func,\n onRowSort: PropTypes.func,\n tableOptions: PropTypes.object,\n});\n\nPivotTable.defaultProps = Object.assign({}, PivotData.defaultProps, {\n rendererName: 'Table',\n renderers: TableRenderers,\n tableOptions: {},\n});\n\nexport default PivotTable;\n"]}