UNPKG

a-chart

Version:

A-Chart is a ReactJS Library/Package to address all posibilities of Reporting Functionality

125 lines (95 loc) 5.5 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); 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; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _utilFns = require('./utilFns'); var Util = _interopRequireWildcard(_utilFns); var _utilPublicFns = require('./utilPublicFns'); var publicFn = _interopRequireWildcard(_utilPublicFns); var _dataGrid = require('../actions/dataGrid'); var ListFn = _interopRequireWildcard(_dataGrid); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 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; } 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; } var userMethods = function (_Component) { _inherits(userMethods, _Component); function userMethods(props) { _classCallCheck(this, userMethods); var _this = _possibleConstructorReturn(this, (userMethods.__proto__ || Object.getPrototypeOf(userMethods)).call(this, props)); userMethods.getSelectedItems = userMethods.getSelectedItems.bind(_this); userMethods.getChangedItems = userMethods.getChangedItems.bind(_this); userMethods.setEditable = userMethods.setEditable.bind(_this); userMethods.setMode = userMethods.setMode.bind(_this); userMethods.export = userMethods.export.bind(_this); userMethods.getEditable = userMethods.getEditable.bind(_this); userMethods.getMode = userMethods.getMode.bind(_this); return _this; } _createClass(userMethods, null, [{ key: 'getSelectedItems', value: function getSelectedItems() { // publicFn.getSelectedItems.bind(this.props); return publicFn.getSelectedItems.call(this); } }, { key: 'getChangedItems', value: function getChangedItems() { // publicFn.getSelectedItems.bind(this.props); return publicFn.getChangedItems.call(this); } }, { key: 'setEditable', value: function setEditable() { var f = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this.props.config) { //alert("Please configure 'fieldsToEdit' propery in 'Config'"); return; } if (f) { this.config.fieldsToEdit = this.props.config.fieldsToEdit || ""; } else { this.config.fieldsToEdit = ""; } this.store.dispatch(ListFn.RenderList(this.items, "", "RENDERFROMPUBLIC")); // this.setState({ key: Math.random() }); } }, { key: 'setMode', value: function setMode() { var f = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (f) { this.config.mode = f; } else { this.config.mode = f; } this.store.dispatch(ListFn.RenderList(this.items, "", "RENDERFROMPUBLIC")); // this.setState({ key: Math.random() }); } }, { key: 'export', value: function _export() { var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "xls"; t = t == "csv" ? t : "xls"; Util.exportData(t, this.config); } }, { key: 'getEditable', value: function getEditable() { var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "xls"; return this.config.fieldsToEdit.length ? true : false; } }, { key: 'getMode', value: function getMode() { var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "xls"; return this.config.mode == "Multi" ? "Multi" : "None"; } }]); return userMethods; }(_react.Component); exports.default = userMethods;