UNPKG

4.19 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
8
9var _react = require("react");
10
11var _react2 = _interopRequireDefault(_react);
12
13var _beeComplexGrid = require("bee-complex-grid");
14
15var _beeComplexGrid2 = _interopRequireDefault(_beeComplexGrid);
16
17var _defaultProps = require("./defaultProps");
18
19function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
20
21function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
22
23function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
24
25function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
27function _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
29function _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) : _defaults(subClass, superClass); }
30
31var defaultProps = _extends({
32 headerScroll: false,
33 bordered: false,
34 data: [],
35 columnFilterAble: false
36}, _defaultProps.gridDefalutProps);
37
38var Grid = function (_Component) {
39 _inherits(Grid, _Component);
40
41 function Grid() {
42 var _temp, _this, _ret;
43
44 _classCallCheck(this, Grid);
45
46 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
47 args[_key] = arguments[_key];
48 }
49
50 return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.exportExcel = function () {
51 _this.grid.exportExcel();
52 }, _temp), _possibleConstructorReturn(_this, _ret);
53 }
54
55 Grid.prototype.render = function render() {
56 var _this2 = this;
57
58 var _props = this.props,
59 paginationObj = _props.paginationObj,
60 data = _props.data,
61 exportData = _props.exportData,
62 headerScroll = _props.headerScroll,
63 otherProps = _objectWithoutProperties(_props, ["paginationObj", "data", "exportData", "headerScroll"]);
64
65 var _paginationObj = 'none';
66 if (paginationObj != 'none') {
67 _paginationObj = _extends({}, _defaultProps.paginationDefaultProps, paginationObj);
68 }
69 return _react2["default"].createElement(
70 "div",
71 { className: "ac-gridcn " + (headerScroll ? 'header-scroll' : '') },
72 _react2["default"].createElement(_beeComplexGrid2["default"], _extends({}, otherProps, {
73 headerScroll: headerScroll,
74 data: data,
75 paginationObj: _paginationObj,
76 ref: function ref(_ref) {
77 return _this2.grid = _ref;
78 },
79 exportData: exportData || data
80 }))
81 );
82 };
83
84 return Grid;
85}(_react.Component);
86
87Grid.defaultProps = defaultProps;
88Grid.GridToolBar = _beeComplexGrid.GridToolBar;
89
90exports["default"] = Grid;
91module.exports = exports["default"];
\No newline at end of file