UNPKG

react-widgetconfigurator

Version:

A React app for to generate out of box widgets

252 lines (209 loc) 12.2 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 Trends = function (_Component) { _inherits(Trends, _Component); function Trends(props) { _classCallCheck(this, Trends); var _this = _possibleConstructorReturn(this, (Trends.__proto__ || Object.getPrototypeOf(Trends)).call(this, props)); _this.state = { widgetselectionsmspvslp: { geographytype: '', geographyvalue: '', measure: 'MedSalePrice,AvgSaleOverListPrice', periodtype: '', period: '', geo: '', classtype: '', usertoken: '' }, widgetselectionsdomvslp: { geographytype: '', geographyvalue: '', measure: 'SoldMedDOM,AvgSaleOverListPrice', periodtype: '', period: '', geo: '', classtype: '', usertoken: '' }, widgetselectionsppsqft: { geographytype: '', geographyvalue: '', measure: 'AvgSalePricePerSqft', periodtype: '', period: '', geo: '', classtype: '', usertoken: '' }, widgetselectionsnvss: { geographytype: '', geographyvalue: '', measure: 'NewListingsCount,SoldCount', periodtype: '', period: '', geo: '', classtype: '', usertoken: '' }, chartselections: { colors: [], charttype: ['bar', 'spline'], download: true }, ppsqftchartselections: { colors: [], charttype: ['area-spline'], download: true }, tabindex: _this.props.tabindex }; return _this; } _createClass(Trends, [{ key: "componentWillMount", value: function componentWillMount() { var widgetselectionsmspvslp = _extends({}, this.state.widgetselectionsmspvslp); var widgetselectionsdomvslp = _extends({}, this.state.widgetselectionsdomvslp); var widgetselectionsppsqft = _extends({}, this.state.widgetselectionsppsqft); var widgetselectionsnvss = _extends({}, this.state.widgetselectionsnvss); var chartselections = _extends({}, this.state.chartselections); var ppsqftchartselections = _extends({}, this.state.ppsqftchartselections); widgetselectionsmspvslp.geo = this.props.widgetselections.geo; widgetselectionsdomvslp.geo = this.props.widgetselections.geo; widgetselectionsppsqft.geo = this.props.widgetselections.geo; widgetselectionsnvss.geo = this.props.widgetselections.geo; widgetselectionsmspvslp.period = this.props.widgetselections.period; widgetselectionsdomvslp.period = this.props.widgetselections.period; widgetselectionsppsqft.period = this.props.widgetselections.period; widgetselectionsnvss.period = this.props.widgetselections.period; widgetselectionsmspvslp.periodtype = this.props.widgetselections.periodtype; widgetselectionsdomvslp.periodtype = this.props.widgetselections.periodtype; widgetselectionsppsqft.periodtype = this.props.widgetselections.periodtype; widgetselectionsnvss.periodtype = this.props.widgetselections.periodtype; widgetselectionsmspvslp.usertoken = this.props.widgetselections.usertoken; widgetselectionsdomvslp.usertoken = this.props.widgetselections.usertoken; widgetselectionsppsqft.usertoken = this.props.widgetselections.usertoken; widgetselectionsnvss.usertoken = this.props.widgetselections.usertoken; widgetselectionsmspvslp.classtype = this.props.classtype; widgetselectionsdomvslp.classtype = this.props.classtype; widgetselectionsppsqft.classtype = this.props.classtype; widgetselectionsnvss.classtype = this.props.classtype; chartselections = this.props.chartselections; ppsqftchartselections.colors = this.props.chartselections.colors; this.setState({ widgetselectionsmspvslp: widgetselectionsmspvslp, widgetselectionsdomvslp: widgetselectionsdomvslp, widgetselectionsppsqft: widgetselectionsppsqft, widgetselectionsnvss: widgetselectionsnvss, chartselections: chartselections, ppsqftchartselections: ppsqftchartselections }); } }, { key: "componentWillReceiveProps", value: function componentWillReceiveProps(nextProps) { var widgetselectionsmspvslp = _extends({}, this.state.widgetselectionsmspvslp); var widgetselectionsdomvslp = _extends({}, this.state.widgetselectionsdomvslp); var widgetselectionsppsqft = _extends({}, this.state.widgetselectionsppsqft); var widgetselectionsnvss = _extends({}, this.state.widgetselectionsnvss); var chartselections = _extends({}, this.state.chartselections); var ppsqftchartselections = _extends({}, this.state.ppsqftchartselections); widgetselectionsmspvslp.geo = nextProps.widgetselections.geo; widgetselectionsdomvslp.geo = nextProps.widgetselections.geo; widgetselectionsppsqft.geo = nextProps.widgetselections.geo; widgetselectionsnvss.geo = nextProps.widgetselections.geo; widgetselectionsmspvslp.period = nextProps.widgetselections.period; widgetselectionsdomvslp.period = nextProps.widgetselections.period; widgetselectionsppsqft.period = nextProps.widgetselections.period; widgetselectionsnvss.period = nextProps.widgetselections.period; widgetselectionsmspvslp.periodtype = nextProps.widgetselections.periodtype; widgetselectionsdomvslp.periodtype = nextProps.widgetselections.periodtype; widgetselectionsppsqft.periodtype = nextProps.widgetselections.periodtype; widgetselectionsnvss.periodtype = nextProps.widgetselections.periodtype; widgetselectionsmspvslp.usertoken = nextProps.widgetselections.usertoken; widgetselectionsdomvslp.usertoken = nextProps.widgetselections.usertoken; widgetselectionsppsqft.usertoken = nextProps.widgetselections.usertoken; widgetselectionsnvss.usertoken = nextProps.widgetselections.usertoken; widgetselectionsmspvslp.classtype = nextProps.classtype; widgetselectionsdomvslp.classtype = nextProps.classtype; widgetselectionsppsqft.classtype = nextProps.classtype; widgetselectionsnvss.classtype = nextProps.classtype; // chartselections=this.props.chartselections; chartselections.colors = nextProps.chartselections.colors; ppsqftchartselections.colors = nextProps.chartselections.colors; this.setState({ widgetselectionsmspvslp: widgetselectionsmspvslp, widgetselectionsdomvslp: widgetselectionsdomvslp, widgetselectionsppsqft: widgetselectionsppsqft, widgetselectionsnvss: widgetselectionsnvss, chartselections: chartselections, ppsqftchartselections: ppsqftchartselections }); } // ParentSettings(cindex,selectedcolor) { // console.log(cindex,selectedcolor); // let colors=this.state.colors; // colors[cindex]=selectedcolor.hex; // this.setState({ // colors // }); // } }, { key: "render", value: function render() { return _react2.default.createElement( _reactstrap.Container, { fluid: false }, _react2.default.createElement( _reactstrap.Row, { className: "trendsrow" }, _react2.default.createElement( _reactstrap.Col, { sm: { size: 12 } }, _react2.default.createElement( _reactMarkettrendswidget2.default, { widgetselections: this.state.widgetselectionsmspvslp, assets: "", chartselections: this.state.chartselections }, " ", _react2.default.createElement(_CopyModal2.default, { wtype: "trends", tokenid: "defaultmspvslp", widgetselections: this.state.widgetselectionsmspvslp, chartselections: this.state.chartselections }) ) ) ), _react2.default.createElement( _reactstrap.Row, { className: "trendsrow" }, _react2.default.createElement( _reactstrap.Col, { sm: { size: 12 } }, _react2.default.createElement( _reactMarkettrendswidget2.default, { widgetselections: this.state.widgetselectionsdomvslp, assets: "", chartselections: this.state.chartselections }, " ", _react2.default.createElement(_CopyModal2.default, { wtype: "trends", tokenid: "defaultdomvslp", widgetselections: this.state.widgetselectionsdomvslp, assets: "", chartselections: this.state.chartselections }) ) ) ), _react2.default.createElement( _reactstrap.Row, { className: "" + (this.state.tabindex != 1 ? "bi-hidden" : "trendsrow") }, _react2.default.createElement( _reactstrap.Col, { sm: { size: 12 } }, _react2.default.createElement( _reactMarkettrendswidget2.default, { widgetselections: this.state.widgetselectionsppsqft, assets: "", chartselections: this.state.ppsqftchartselections }, " ", _react2.default.createElement(_CopyModal2.default, { wtype: "trends", tokenid: "defaultppsqft", widgetselections: this.state.widgetselectionsppsqft, assets: "", chartselections: this.state.chartselections }) ) ) ), _react2.default.createElement( _reactstrap.Row, { className: "" + (this.state.tabindex == 1 ? "bi-hidden" : "trendsrow") }, _react2.default.createElement( _reactstrap.Col, { sm: { size: 12 } }, _react2.default.createElement( _reactMarkettrendswidget2.default, { widgetselections: this.state.widgetselectionsnvss, assets: "", chartselections: this.state.chartselections }, " ", _react2.default.createElement(_CopyModal2.default, { wtype: "trends", tokenid: "defaultnvss", widgetselections: this.state.widgetselectionsnvss, assets: "", chartselections: this.state.chartselections }) ) ) ) ); } }]); return Trends; }(_react.Component); exports.default = Trends; module.exports = exports["default"];