UNPKG

react-widgetconfigurator

Version:

A React app for to generate out of box widgets

133 lines (104 loc) 5.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _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; }; 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 _reactstrap = require("reactstrap"); var _reactMarkettrendswidget = require("react-markettrendswidget"); var _reactMarkettrendswidget2 = _interopRequireDefault(_reactMarkettrendswidget); var _CopyModal = require("./CopyModal"); var _CopyModal2 = _interopRequireDefault(_CopyModal); 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 TabbedTrends = function (_Component) { _inherits(TabbedTrends, _Component); function TabbedTrends(props) { _classCallCheck(this, TabbedTrends); var _this = _possibleConstructorReturn(this, (TabbedTrends.__proto__ || Object.getPrototypeOf(TabbedTrends)).call(this, props)); _this.state = { widgetselectionstabbed: { geographytype: '', geographyvalue: '', measure: 'MedSalePrice,AvgSalePricePerSqft,SoldMedDOM', periodtype: '', period: '', geo: '', classtype: 'Residential - Single Family,Residential - Common Interest', multitab: true }, chartselections: { colors: [], charttype: ['spline', 'line'] } }; return _this; } // shouldComponentUpdate(nextProps, nextState){ // if(nextProps.widgetselections.geo===this.props.widgetselections.geo) // {return false;} else // {return true;} // } _createClass(TabbedTrends, [{ key: "componentWillMount", value: function componentWillMount() { var widgetselectionstabbed = _extends({}, this.state.widgetselectionstabbed); var chartselections = _extends({}, this.state.chartselections); widgetselectionstabbed.geo = this.props.widgetselections.geo; widgetselectionstabbed.period = this.props.widgetselections.period; widgetselectionstabbed.periodtype = this.props.widgetselections.periodtype; chartselections = this.props.chartselections; this.setState({ widgetselectionstabbed: widgetselectionstabbed, chartselections: chartselections }); } }, { key: "componentWillReceiveProps", value: function componentWillReceiveProps(nextProps) { var widgetselectionstabbed = _extends({}, this.state.widgetselectionstabbed); var chartselections = _extends({}, this.state.chartselections); widgetselectionstabbed.geo = nextProps.widgetselections.geo; widgetselectionstabbed.period = nextProps.widgetselections.period; widgetselectionstabbed.periodtype = nextProps.widgetselections.periodtype; chartselections = this.props.chartselections; this.setState({ widgetselectionstabbed: widgetselectionstabbed, chartselections: chartselections }); } // ParentSettings(cindex,selectedcolor) { // console.log(cindex,selectedcolor); // let colors=this.state.colors; // colors[cindex]=selectedcolor.hex; // this.setState({ // colors // }); // } }, { key: "render", value: function render() { //console.log(this.state.chartselections); return _react2.default.createElement( "div", null, _react2.default.createElement( _reactstrap.Container, { fluid: false }, _react2.default.createElement( _reactstrap.Row, { className: "testrow" }, _react2.default.createElement( _reactstrap.Col, { sm: { size: 12 } }, _react2.default.createElement( _reactMarkettrendswidget2.default, { widgetselections: this.state.widgetselectionstabbed, assets: "", chartselections: this.state.chartselections }, " ", _react2.default.createElement(_CopyModal2.default, { widgetselections: this.state.widgetselectionstabbed, chartselections: this.state.chartselections }) ) ) ) ) ); } }]); return TabbedTrends; }(_react.Component); exports.default = TabbedTrends; module.exports = exports["default"];