react-fusioncharts
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -1,3 +0,289 @@ | ||
import DrillDown from '../src/DrillDown'; | ||
"use strict"; | ||
module.exports = DrillDown; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _ReactFC = _interopRequireDefault(require("../lib/ReactFC")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
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); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
var DrillDown = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(DrillDown, _React$Component); | ||
_createClass(DrillDown, null, [{ | ||
key: "fcRoot", | ||
// Resolve FusionCharts | ||
value: function fcRoot(core) { | ||
for (var _len = arguments.length, modules = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
modules[_key - 1] = arguments[_key]; | ||
} | ||
_ReactFC.default.fcRoot.apply(_ReactFC.default, [core].concat(modules)); | ||
} | ||
}]); | ||
function DrillDown(props) { | ||
var _this$defButtonStyle; | ||
var _this; | ||
_classCallCheck(this, DrillDown); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(DrillDown).call(this, props)); | ||
var btnConfig = props.btnConfig, | ||
btnStyle = props.btnStyle; | ||
_this.finalBtnConfig = Object.assign({}, DrillDown.defaultProps.btnConfig, btnConfig); | ||
var _this$finalBtnConfig$ = _this.finalBtnConfig.placement.split('-'); | ||
var _this$finalBtnConfig$2 = _slicedToArray(_this$finalBtnConfig$, 2); | ||
_this.positionV = _this$finalBtnConfig$2[0]; | ||
_this.positionH = _this$finalBtnConfig$2[1]; | ||
_this.state = { | ||
isBtnVisible: true, | ||
selectedChild: -1, | ||
isDrilledDown: false | ||
}; | ||
/* Function Bindings */ | ||
_this.plotClicked = _this.plotClicked.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this.onChildRendered = _this.onChildRendered.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this.toggleParentBtnVisibility = _this.toggleParentBtnVisibility.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
_this.onBtnClick = _this.onBtnClick.bind(_assertThisInitialized(_assertThisInitialized(_this))); | ||
/* Default styles */ | ||
_this.wrapperStyle = { | ||
position: 'relative', | ||
display: 'inline-block' | ||
}; | ||
_this.defButtonStyle = (_this$defButtonStyle = { | ||
border: "1px solid ".concat(_this.finalBtnConfig.borderColor), | ||
backgroundColor: "".concat(_this.finalBtnConfig.backgroundColor), | ||
color: "".concat(_this.finalBtnConfig.color), | ||
fontFamily: "".concat(_this.finalBtnConfig.fontFamily), | ||
fontSize: "".concat(_this.finalBtnConfig.fontSize), | ||
padding: "".concat(_this.finalBtnConfig.padding), | ||
fontWeight: "".concat(_this.finalBtnConfig.fontWeight), | ||
position: 'absolute' | ||
}, _defineProperty(_this$defButtonStyle, _this.positionH, "".concat(_this.finalBtnConfig.margin)), _defineProperty(_this$defButtonStyle, _this.positionV, "".concat(_this.finalBtnConfig.margin)), _defineProperty(_this$defButtonStyle, "cursor", 'pointer'), _this$defButtonStyle); | ||
_this.finBtnStyle = typeof btnStyle === 'undefined' ? _this.defButtonStyle : btnStyle; | ||
return _this; | ||
} | ||
_createClass(DrillDown, [{ | ||
key: "determinePlotMapType", | ||
value: function determinePlotMapType(plotChildMap) { | ||
var isNumberFound = false; | ||
var isObjectFound = false; | ||
plotChildMap.forEach(function (val) { | ||
if (typeof val === 'undefined' || val === null) return; | ||
if (typeof val === 'number' && val > -1) isNumberFound = true; | ||
if (_typeof(val) === 'object') isObjectFound = true; | ||
}); | ||
if (isNumberFound && isObjectFound) { | ||
return 'invalid'; | ||
} | ||
if (isNumberFound) return 'number'; | ||
if (isObjectFound) return 'object'; | ||
return 'noop'; | ||
} | ||
}, { | ||
key: "plotClicked", | ||
value: function plotClicked(e) { | ||
var index = e.data.index; | ||
var propChildren = Array.isArray(this.props.children) ? this.props.children : [this.props.children]; | ||
var childrenLen = propChildren.length; | ||
var plotChildMap = this.props.plotChildMap; | ||
if (childrenLen === 0) return; // Further Optimization needed. | ||
var mapType = this.determinePlotMapType(plotChildMap); // Case : Array of numbers | ||
if (mapType === 'number') { | ||
var childPosition = plotChildMap[index]; | ||
if (childPosition === null || typeof childPosition === 'undefined' || childPosition >= childrenLen || childPosition < 0) return; | ||
this.setState({ | ||
selectedChild: childPosition, | ||
isDrilledDown: true | ||
}); | ||
} // Case : Array of objects | ||
if (mapType === 'object') { | ||
for (var i = 0; i < childrenLen; i++) { | ||
if (typeof plotChildMap[i] === 'undefined' || plotChildMap[i] === null) continue; | ||
var _plotChildMap$i = plotChildMap[i], | ||
plotPosition = _plotChildMap$i.plotPosition, | ||
_childPosition = _plotChildMap$i.childPosition; | ||
if (plotPosition === index && _childPosition !== null && typeof _childPosition !== 'undefined' && _childPosition < childrenLen && _childPosition > -1) { | ||
this.setState({ | ||
selectedChild: _childPosition, | ||
isDrilledDown: true | ||
}); | ||
return; | ||
} | ||
} | ||
} // Case : Heterogeneous | ||
if (mapType === 'invalid') { | ||
console.log('Invalid heterogeneous data: Please check proptypes for - plotChildMap'); | ||
} | ||
} | ||
}, { | ||
key: "cloneReactFCChild", | ||
value: function cloneReactFCChild(reactFCElem, customProps) { | ||
return _react.default.cloneElement(reactFCElem, customProps); | ||
} | ||
}, { | ||
key: "onChildRendered", | ||
value: function onChildRendered() { | ||
if (this.props.toggleParentBtnVisibility) { | ||
this.props.toggleParentBtnVisibility(false); | ||
} | ||
} | ||
}, { | ||
key: "toggleParentBtnVisibility", | ||
value: function toggleParentBtnVisibility(isBtnVisible) { | ||
this.setState({ | ||
isBtnVisible: isBtnVisible | ||
}); | ||
} | ||
}, { | ||
key: "onBtnClick", | ||
value: function onBtnClick() { | ||
this.setState({ | ||
isDrilledDown: false | ||
}); | ||
if (this.props.toggleParentBtnVisibility) { | ||
this.props.toggleParentBtnVisibility(true); | ||
} | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var component; | ||
var _this$state = this.state, | ||
selectedChild = _this$state.selectedChild, | ||
isBtnVisible = _this$state.isBtnVisible; | ||
var _this$props = this.props, | ||
children = _this$props.children, | ||
width = _this$props.width, | ||
height = _this$props.height; | ||
var clonedElemConfig = { | ||
width: width, | ||
height: height, | ||
onRender: this.onChildRendered, | ||
toggleParentBtnVisibility: this.toggleParentBtnVisibility | ||
}; | ||
if (!this.state.isDrilledDown) { | ||
component = _react.default.createElement(_ReactFC.default, _extends({}, this.props, { | ||
"fcEvent-dataplotClick": this.plotClicked | ||
})); | ||
} else { | ||
var propChildren = Array.isArray(children) ? children : [children]; | ||
component = _react.default.createElement("div", { | ||
style: this.wrapperStyle | ||
}, this.cloneReactFCChild(propChildren[selectedChild], clonedElemConfig), isBtnVisible ? _react.default.createElement("button", { | ||
style: this.finBtnStyle, | ||
onClick: this.onBtnClick | ||
}, this.finalBtnConfig.text) : null); | ||
} | ||
return component; | ||
} | ||
}]); | ||
return DrillDown; | ||
}(_react.default.Component); | ||
DrillDown.defaultProps = { | ||
plotChildMap: [], | ||
btnConfig: { | ||
text: 'Back', | ||
color: '#000000', | ||
backgroundColor: '#F6F6F6', | ||
borderColor: '#000000', | ||
fontSize: '14px', | ||
fontWeight: 'bold', | ||
padding: '3px', | ||
fontFamily: 'Verdana, sans', | ||
placement: 'top-right', | ||
margin: '10px' | ||
}, | ||
btnStyle: undefined, | ||
dataSource: {}, | ||
dataFormat: 'json', | ||
type: '', | ||
height: '', | ||
width: '' | ||
}; | ||
DrillDown.propTypes = { | ||
plotChildMap: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.shape({ | ||
plotPosition: _propTypes.default.number, | ||
childPosition: _propTypes.default.number | ||
})), _propTypes.default.arrayOf(_propTypes.default.number)]), | ||
btnConfig: _propTypes.default.shape({ | ||
text: _propTypes.default.string, | ||
color: _propTypes.default.string, | ||
backgroundColor: _propTypes.default.string, | ||
borderColor: _propTypes.default.string, | ||
fontSize: _propTypes.default.string, | ||
fontWeight: _propTypes.default.string, | ||
padding: _propTypes.default.string, | ||
fontFamily: _propTypes.default.string, | ||
placement: _propTypes.default.oneOf(['top-left', 'top-right', 'bottom-left', 'bottom-right']), | ||
margin: _propTypes.default.string | ||
}), | ||
btnStyle: _propTypes.default.object, | ||
dataSource: _propTypes.default.object, | ||
dataFormat: _propTypes.default.string, | ||
type: _propTypes.default.string, | ||
height: _propTypes.default.string, | ||
width: _propTypes.default.string | ||
}; | ||
var _default = DrillDown; | ||
exports.default = _default; |
@@ -5,3 +5,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
else if(typeof define === 'function' && define.amd) | ||
define(["react", "fusioncharts"], factory); | ||
define("ReactFC", ["react", "fusioncharts"], factory); | ||
else if(typeof exports === 'object') | ||
@@ -11,43 +11,87 @@ exports["ReactFC"] = factory(require("react"), require("fusioncharts")); | ||
root["ReactFC"] = factory(root["React"], root["FusionCharts"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) { | ||
})(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__3__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = function(exports) { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ | ||
/******/ // create a fake namespace object | ||
/******/ // mode & 1: value is a module id, require it | ||
/******/ // mode & 2: merge all properties of value into the ns | ||
/******/ // mode & 4: return value when already ns object | ||
/******/ // mode & 8|1: behave like require | ||
/******/ __webpack_require__.t = function(value, mode) { | ||
/******/ if(mode & 1) value = __webpack_require__(value); | ||
/******/ if(mode & 8) return value; | ||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; | ||
/******/ var ns = Object.create(null); | ||
/******/ __webpack_require__.r(ns); | ||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); | ||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); | ||
/******/ return ns; | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
@@ -59,345 +103,347 @@ /************************************************************************/ | ||
'use strict'; | ||
// import ReactFC from './src/ReactFC'; | ||
// Use this format to export ReactFC as default module | ||
// Ref: https://gist.github.com/iamakulov/966b91c0fc6363a16ff0650b51fb991b | ||
// export default ReactFC; | ||
module.exports = __webpack_require__(1).default; | ||
var _ReactFC = __webpack_require__(1); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
var _ReactFC2 = _interopRequireDefault(_ReactFC); | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); | ||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var fusioncharts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | ||
/* harmony import */ var fusioncharts__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fusioncharts__WEBPACK_IMPORTED_MODULE_1__); | ||
/* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); | ||
/* harmony import */ var uuid_v4__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(uuid_v4__WEBPACK_IMPORTED_MODULE_2__); | ||
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7); | ||
/* harmony import */ var _utils_options__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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"); } } | ||
// Use this format to export ReactFC as default module | ||
// Ref: https://gist.github.com/iamakulov/966b91c0fc6363a16ff0650b51fb991b | ||
module.exports = _ReactFC2.default; | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
'use strict'; | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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); } } | ||
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; }; }(); | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
var _react = __webpack_require__(2); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
var _react2 = _interopRequireDefault(_react); | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var _fusioncharts = __webpack_require__(3); | ||
var _fusioncharts2 = _interopRequireDefault(_fusioncharts); | ||
var _v = __webpack_require__(4); | ||
var _v2 = _interopRequireDefault(_v); | ||
var _utils = __webpack_require__(7); | ||
var utils = _interopRequireWildcard(_utils); | ||
var _options = __webpack_require__(8); | ||
var ReactFC = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(ReactFC, _React$Component); | ||
var _options2 = _interopRequireDefault(_options); | ||
_createClass(ReactFC, null, [{ | ||
key: "fcRoot", | ||
value: function fcRoot(core) { | ||
for (var _len = arguments.length, modules = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
modules[_key - 1] = arguments[_key]; | ||
} | ||
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; } } | ||
modules.forEach(function (m) { | ||
if (m.getName || m.name) { | ||
core.addDep(m); | ||
} else { | ||
m(core); | ||
} | ||
}); | ||
ReactFC.fusionChartsCore = core; | ||
} | ||
}]); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function ReactFC(props) { | ||
var _this; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
_classCallCheck(this, ReactFC); | ||
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; } | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ReactFC).call(this, props)); | ||
_this.containerId = uuid_v4__WEBPACK_IMPORTED_MODULE_2___default()(); | ||
_this.oldOptions = null; | ||
_this.FusionCharts = props.fcLibrary || ReactFC.fusionChartsCore || fusioncharts__WEBPACK_IMPORTED_MODULE_1___default.a; | ||
return _this; | ||
} | ||
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; } | ||
_createClass(ReactFC, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.renderChart(); | ||
} | ||
}, { | ||
key: "componentWillReceiveProps", | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (!this.oldOptions) { | ||
return; | ||
} | ||
var ReactFC = function (_React$Component) { | ||
_inherits(ReactFC, _React$Component); | ||
this.detectChanges(nextProps); | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.chartObj.dispose(); | ||
} | ||
}, { | ||
key: "detectChanges", | ||
value: function detectChanges(nextProps) { | ||
var currentOptions = this.resolveChartOptions(nextProps); | ||
var oldOptions = this.oldOptions; | ||
var optionsUpdatedNatively = ['width', 'height', 'type', 'dataFormat', 'dataSource', 'events']; | ||
this.checkAndUpdateChartDimensions(currentOptions, oldOptions); | ||
this.checkAndUpdateChartType(currentOptions, oldOptions); | ||
this.checkAndUpdateChartData(currentOptions, oldOptions); | ||
this.checkAndUpdateEvents(currentOptions, oldOptions); | ||
this.checkAndUpdateRestOptions(_utils_options__WEBPACK_IMPORTED_MODULE_4__["default"].filter(function (option) { | ||
return optionsUpdatedNatively.indexOf(option) === -1; | ||
}), currentOptions, oldOptions); | ||
this.oldOptions = currentOptions; | ||
} | ||
}, { | ||
key: "checkAndUpdateChartDimensions", | ||
value: function checkAndUpdateChartDimensions(currentOptions, oldOptions) { | ||
var currWidth = currentOptions.width; | ||
var currHeight = currentOptions.height; | ||
var oldWidth = oldOptions.width; | ||
var oldHeight = oldOptions.height; | ||
_createClass(ReactFC, null, [{ | ||
key: 'fcRoot', | ||
value: function fcRoot(core) { | ||
for (var _len = arguments.length, modules = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
modules[_key - 1] = arguments[_key]; | ||
} | ||
if (String(currWidth) !== String(oldWidth) || String(currHeight) !== String(oldHeight)) { | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currWidth) && !_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currHeight)) { | ||
this.chartObj.resizeTo(currWidth, currHeight); | ||
} else { | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currWidth)) { | ||
this.chartObj.resizeTo({ | ||
w: currWidth | ||
}); | ||
} | ||
modules.forEach(function (m) { | ||
if (m.getName || m.name) { | ||
core.addDep(m); | ||
} else { | ||
m(core); | ||
} | ||
}); | ||
ReactFC.fusionChartsCore = core; | ||
} | ||
}]); | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currHeight)) { | ||
this.chartObj.resizeTo({ | ||
h: currHeight | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
}, { | ||
key: "checkAndUpdateChartType", | ||
value: function checkAndUpdateChartType(currentOptions, oldOptions) { | ||
var currType = currentOptions.type; | ||
var oldType = oldOptions.type; | ||
function ReactFC(props) { | ||
_classCallCheck(this, ReactFC); | ||
if (String(currType).toLowerCase() !== String(oldType).toLowerCase()) { | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currType)) { | ||
this.chartObj.chartType(String(currType).toLowerCase()); | ||
} | ||
} | ||
} | ||
}, { | ||
key: "checkAndUpdateChartData", | ||
value: function checkAndUpdateChartData(currentOptions, oldOptions) { | ||
var currDataFormat = currentOptions.dataFormat; | ||
var currData = currentOptions.dataSource; | ||
var oldDataFormat = oldOptions.dataFormat; | ||
var oldData = oldOptions.dataSource; | ||
var _this = _possibleConstructorReturn(this, (ReactFC.__proto__ || Object.getPrototypeOf(ReactFC)).call(this, props)); | ||
if (String(currDataFormat).toLowerCase() !== String(oldDataFormat).toLowerCase()) { | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currDataFormat) && !_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currData)) { | ||
this.chartObj.setChartData(currData, String(currDataFormat).toLowerCase()); // If the chart dataFormat is changed then | ||
// animate the chart to show the changes | ||
_this.containerId = (0, _v2.default)(); | ||
_this.oldOptions = null; | ||
_this.FusionCharts = props.fcLibrary || ReactFC.fusionChartsCore || _fusioncharts2.default; | ||
return _this; | ||
} | ||
this.chartObj.render(); | ||
} | ||
} else if (!this.isSameChartData(currData, oldData)) { | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currData)) { | ||
this.chartObj.setChartData(currData, // When dataFormat is not given, but data is changed, | ||
// then use 'json' as default dataFormat | ||
currDataFormat ? String(currDataFormat).toLowerCase() : 'json'); | ||
} | ||
} | ||
} | ||
}, { | ||
key: "isSameChartData", | ||
value: function isSameChartData(currData, oldData) { | ||
if (_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](currData) && _utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](oldData)) { | ||
return _utils_utils__WEBPACK_IMPORTED_MODULE_3__["isSameObjectContent"](currData, oldData); | ||
} | ||
_createClass(ReactFC, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.renderChart(); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (!this.oldOptions) { | ||
return; | ||
} | ||
this.detectChanges(nextProps); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.chartObj.dispose(); | ||
} | ||
}, { | ||
key: 'detectChanges', | ||
value: function detectChanges(nextProps) { | ||
var currentOptions = this.resolveChartOptions(nextProps); | ||
var oldOptions = this.oldOptions; | ||
return currData === oldData; | ||
} | ||
}, { | ||
key: "checkAndUpdateEvents", | ||
value: function checkAndUpdateEvents(currentOptions, oldOptions) { | ||
var _this2 = this; | ||
var optionsUpdatedNatively = ['width', 'height', 'type', 'dataFormat', 'dataSource', 'events']; | ||
var currEvents = currentOptions.events; | ||
var oldEvents = oldOptions.events; | ||
var temp1; | ||
var temp2; | ||
this.checkAndUpdateChartDimensions(currentOptions, oldOptions); | ||
this.checkAndUpdateChartType(currentOptions, oldOptions); | ||
this.checkAndUpdateChartData(currentOptions, oldOptions); | ||
this.checkAndUpdateEvents(currentOptions, oldOptions); | ||
this.checkAndUpdateRestOptions(_options2.default.filter(function (option) { | ||
return optionsUpdatedNatively.indexOf(option) === -1; | ||
}), currentOptions, oldOptions); | ||
if (this.detectChartEventsChange(currEvents, oldEvents)) { | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currEvents)) { | ||
temp1 = Object.assign({}, currEvents); | ||
temp2 = _utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](oldEvents) ? {} : Object.assign({}, oldEvents); | ||
Object.keys(temp2).forEach(function (eventName) { | ||
if (temp2[eventName] === temp1[eventName]) { | ||
temp1[eventName] = undefined; | ||
} else { | ||
_this2.chartObj.removeEventListener(eventName, temp2[eventName]); | ||
} | ||
}); | ||
Object.keys(temp1).forEach(function (eventName) { | ||
if (temp1[eventName]) { | ||
_this2.chartObj.addEventListener(eventName, temp1[eventName]); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
}, { | ||
key: "detectChartEventsChange", | ||
value: function detectChartEventsChange(currEvents, oldEvents) { | ||
if (_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](currEvents) && _utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](oldEvents)) { | ||
return !this.isSameChartEvents(currEvents, oldEvents); | ||
} | ||
this.oldOptions = currentOptions; | ||
} | ||
}, { | ||
key: 'checkAndUpdateChartDimensions', | ||
value: function checkAndUpdateChartDimensions(currentOptions, oldOptions) { | ||
var currWidth = currentOptions.width; | ||
var currHeight = currentOptions.height; | ||
var oldWidth = oldOptions.width; | ||
var oldHeight = oldOptions.height; | ||
return !(currEvents === oldEvents); | ||
} | ||
}, { | ||
key: "isSameChartEvents", | ||
value: function isSameChartEvents(currEvents, oldEvents) { | ||
if (Object.keys(currEvents).length !== Object.keys(oldEvents).length) { | ||
return false; | ||
} | ||
if (String(currWidth) !== String(oldWidth) || String(currHeight) !== String(oldHeight)) { | ||
if (!utils.isUndefined(currWidth) && !utils.isUndefined(currHeight)) { | ||
this.chartObj.resizeTo(currWidth, currHeight); | ||
} else { | ||
if (!utils.isUndefined(currWidth)) { | ||
this.chartObj.resizeTo({ | ||
w: currWidth | ||
}); | ||
} | ||
if (!utils.isUndefined(currHeight)) { | ||
this.chartObj.resizeTo({ | ||
h: currHeight | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'checkAndUpdateChartType', | ||
value: function checkAndUpdateChartType(currentOptions, oldOptions) { | ||
var currType = currentOptions.type; | ||
var oldType = oldOptions.type; | ||
var currEventNames = Object.keys(currEvents); | ||
if (String(currType).toLowerCase() !== String(oldType).toLowerCase()) { | ||
if (!utils.isUndefined(currType)) { | ||
this.chartObj.chartType(String(currType).toLowerCase()); | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'checkAndUpdateChartData', | ||
value: function checkAndUpdateChartData(currentOptions, oldOptions) { | ||
var currDataFormat = currentOptions.dataFormat; | ||
var currData = currentOptions.dataSource; | ||
var oldDataFormat = oldOptions.dataFormat; | ||
var oldData = oldOptions.dataSource; | ||
for (var i = 0; i < currEventNames.length; ++i) { | ||
var evName = currEventNames[i]; | ||
if (String(currDataFormat).toLowerCase() !== String(oldDataFormat).toLowerCase()) { | ||
if (!utils.isUndefined(currDataFormat) && !utils.isUndefined(currData)) { | ||
this.chartObj.setChartData(currData, String(currDataFormat).toLowerCase()); | ||
// If the chart dataFormat is changed then | ||
// animate the chart to show the changes | ||
this.chartObj.render(); | ||
} | ||
} else if (!this.isSameChartData(currData, oldData)) { | ||
if (!utils.isUndefined(currData)) { | ||
this.chartObj.setChartData(currData, | ||
// When dataFormat is not given, but data is changed, | ||
// then use 'json' as default dataFormat | ||
currDataFormat ? String(currDataFormat).toLowerCase() : 'json'); | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'isSameChartData', | ||
value: function isSameChartData(currData, oldData) { | ||
if (utils.isObject(currData) && utils.isObject(oldData)) { | ||
return utils.isSameObjectContent(currData, oldData); | ||
} | ||
return currData === oldData; | ||
} | ||
}, { | ||
key: 'checkAndUpdateEvents', | ||
value: function checkAndUpdateEvents(currentOptions, oldOptions) { | ||
var _this2 = this; | ||
if (currEvents[evName] !== oldEvents[evName]) { | ||
return false; | ||
} | ||
} | ||
var currEvents = currentOptions.events; | ||
var oldEvents = oldOptions.events; | ||
var temp1 = void 0; | ||
var temp2 = void 0; | ||
return true; | ||
} | ||
}, { | ||
key: "checkAndUpdateRestOptions", | ||
value: function checkAndUpdateRestOptions(restOptions, currentOptions, oldOptions) { | ||
var _this3 = this; | ||
if (this.detectChartEventsChange(currEvents, oldEvents)) { | ||
if (!utils.isUndefined(currEvents)) { | ||
temp1 = Object.assign({}, currEvents); | ||
temp2 = utils.isUndefined(oldEvents) ? {} : Object.assign({}, oldEvents); | ||
Object.keys(temp2).forEach(function (eventName) { | ||
if (temp2[eventName] === temp1[eventName]) { | ||
temp1[eventName] = undefined; | ||
} else { | ||
_this2.chartObj.removeEventListener(eventName, temp2[eventName]); | ||
} | ||
}); | ||
Object.keys(temp1).forEach(function (eventName) { | ||
if (temp1[eventName]) { | ||
_this2.chartObj.addEventListener(eventName, temp1[eventName]); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'detectChartEventsChange', | ||
value: function detectChartEventsChange(currEvents, oldEvents) { | ||
if (utils.isObject(currEvents) && utils.isObject(oldEvents)) { | ||
return !this.isSameChartEvents(currEvents, oldEvents); | ||
} | ||
return !(currEvents === oldEvents); | ||
} | ||
}, { | ||
key: 'isSameChartEvents', | ||
value: function isSameChartEvents(currEvents, oldEvents) { | ||
if (Object.keys(currEvents).length !== Object.keys(oldEvents).length) { | ||
return false; | ||
} | ||
var currEventNames = Object.keys(currEvents); | ||
for (var i = 0; i < currEventNames.length; ++i) { | ||
var evName = currEventNames[i]; | ||
if (currEvents[evName] !== oldEvents[evName]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
}, { | ||
key: 'checkAndUpdateRestOptions', | ||
value: function checkAndUpdateRestOptions(restOptions, currentOptions, oldOptions) { | ||
var _this3 = this; | ||
var optionsUpdated = false; | ||
restOptions.forEach(function (optionName) { | ||
var currValue = currentOptions[optionName]; | ||
var oldValue = oldOptions[optionName]; | ||
var optionsUpdated = false; | ||
if (!_this3.isSameOptionValue(currValue, oldValue)) { | ||
if (!_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isUndefined"](currValue)) { | ||
if (_this3.chartObj.options && _this3.chartObj.options.hasOwnProperty(optionName)) { | ||
_this3.chartObj.options[optionName] = currValue; | ||
optionsUpdated = true; | ||
} | ||
} | ||
} | ||
}); | ||
restOptions.forEach(function (optionName) { | ||
var currValue = currentOptions[optionName]; | ||
var oldValue = oldOptions[optionName]; | ||
if (optionsUpdated) { | ||
this.chartObj.render(); // re-render the chart to reflect the changes | ||
} | ||
} | ||
}, { | ||
key: "isSameOptionValue", | ||
value: function isSameOptionValue(currValue, oldValue) { | ||
if (_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](currValue) && _utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](oldValue)) { | ||
return _utils_utils__WEBPACK_IMPORTED_MODULE_3__["isSameObjectContent"](currValue, oldValue); | ||
} | ||
if (!_this3.isSameOptionValue(currValue, oldValue)) { | ||
if (!utils.isUndefined(currValue)) { | ||
if (_this3.chartObj.options && _this3.chartObj.options.hasOwnProperty(optionName)) { | ||
_this3.chartObj.options[optionName] = currValue; | ||
optionsUpdated = true; | ||
} | ||
} | ||
} | ||
}); | ||
return String(currValue) === String(oldValue); | ||
} | ||
}, { | ||
key: "renderChart", | ||
value: function renderChart() { | ||
var _this4 = this; | ||
if (optionsUpdated) { | ||
this.chartObj.render(); // re-render the chart to reflect the changes | ||
} | ||
} | ||
}, { | ||
key: 'isSameOptionValue', | ||
value: function isSameOptionValue(currValue, oldValue) { | ||
if (utils.isObject(currValue) && utils.isObject(oldValue)) { | ||
return utils.isSameObjectContent(currValue, oldValue); | ||
} | ||
return String(currValue) === String(oldValue); | ||
} | ||
}, { | ||
key: 'renderChart', | ||
value: function renderChart() { | ||
var _this4 = this; | ||
var currentOptions = this.resolveChartOptions(this.props); | ||
var events = {}; | ||
currentOptions.renderAt = this.containerId; | ||
Object.keys(this.props).forEach(function (value) { | ||
var event = value.match(/^fcEvent-.*/i); | ||
var currentOptions = this.resolveChartOptions(this.props); | ||
var events = {}; | ||
if (event && typeof _this4.props[value] === 'function') { | ||
var eventName = value.replace(/^fcEvent-/i, ''); | ||
events[eventName] = _this4.props[value]; | ||
} | ||
}); | ||
currentOptions.renderAt = this.containerId; | ||
if (Object.keys(events).length > 0) { | ||
if (currentOptions.events === undefined) { | ||
currentOptions.events = events; | ||
} else { | ||
currentOptions.events = Object.assign(currentOptions.events, events); | ||
} | ||
} | ||
Object.keys(this.props).forEach(function (value) { | ||
var event = value.match(/^fcEvent-.*/i); | ||
if (event && typeof _this4.props[value] === 'function') { | ||
var eventName = value.replace(/^fcEvent-/i, ''); | ||
events[eventName] = _this4.props[value]; | ||
} | ||
}); | ||
this.chartObj = new this.FusionCharts(currentOptions); | ||
this.chartObj.render(); | ||
this.oldOptions = currentOptions; | ||
if (Object.keys(events).length > 0) { | ||
if (currentOptions.events === undefined) { | ||
currentOptions.events = events; | ||
} else { | ||
currentOptions.events = Object.assign(currentOptions.events, events); | ||
} | ||
} | ||
if (this.props.onRender && typeof this.props.onRender === 'function') { | ||
this.props.onRender(this.chartObj); | ||
} | ||
} | ||
}, { | ||
key: "resolveChartOptions", | ||
value: function resolveChartOptions(props) { | ||
var chartConfig = props.chartConfig ? props.chartConfig : {}; | ||
var inlineOptions = _utils_options__WEBPACK_IMPORTED_MODULE_4__["default"].reduce(function (options, optionName) { | ||
options[optionName] = props[optionName]; | ||
return options; | ||
}, {}); | ||
Object.assign(inlineOptions, chartConfig); | ||
this.chartObj = new this.FusionCharts(currentOptions); | ||
this.chartObj.render(); | ||
this.oldOptions = currentOptions; | ||
if (_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](inlineOptions.dataSource)) { | ||
inlineOptions.dataSource = _utils_utils__WEBPACK_IMPORTED_MODULE_3__["deepCopyOf"](inlineOptions.dataSource); | ||
} | ||
if (this.props.onRender && typeof this.props.onRender === 'function') { | ||
this.props.onRender(this.chartObj); | ||
} | ||
} | ||
}, { | ||
key: 'resolveChartOptions', | ||
value: function resolveChartOptions(props) { | ||
var chartConfig = props.chartConfig ? props.chartConfig : {}; | ||
var inlineOptions = _options2.default.reduce(function (options, optionName) { | ||
options[optionName] = props[optionName]; | ||
return options; | ||
}, {}); | ||
Object.assign(inlineOptions, chartConfig); | ||
if (_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](inlineOptions.link)) { | ||
inlineOptions.link = _utils_utils__WEBPACK_IMPORTED_MODULE_3__["deepCopyOf"](inlineOptions.link); | ||
} | ||
if (utils.isObject(inlineOptions.dataSource)) { | ||
inlineOptions.dataSource = utils.deepCopyOf(inlineOptions.dataSource); | ||
} | ||
if (utils.isObject(inlineOptions.link)) { | ||
inlineOptions.link = utils.deepCopyOf(inlineOptions.link); | ||
} | ||
if (utils.isObject(inlineOptions.events)) { | ||
inlineOptions.events = Object.assign({}, inlineOptions.events); | ||
} | ||
return inlineOptions; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement('div', { className: this.props.className, id: this.containerId }); | ||
} | ||
}]); | ||
if (_utils_utils__WEBPACK_IMPORTED_MODULE_3__["isObject"](inlineOptions.events)) { | ||
inlineOptions.events = Object.assign({}, inlineOptions.events); | ||
} | ||
return ReactFC; | ||
}(_react2.default.Component); | ||
return inlineOptions; | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { | ||
className: this.props.className, | ||
id: this.containerId | ||
}); | ||
} | ||
}]); | ||
exports.default = ReactFC; | ||
return ReactFC; | ||
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); | ||
/* harmony default export */ __webpack_exports__["default"] = (ReactFC); | ||
/***/ }), | ||
@@ -407,3 +453,3 @@ /* 2 */ | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_2__; | ||
module.exports = __WEBPACK_EXTERNAL_MODULE__2__; | ||
@@ -414,3 +460,3 @@ /***/ }), | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_3__; | ||
module.exports = __WEBPACK_EXTERNAL_MODULE__3__; | ||
@@ -421,31 +467,31 @@ /***/ }), | ||
var rng = __webpack_require__(5); | ||
var bytesToUuid = __webpack_require__(6); | ||
var rng = __webpack_require__(5); | ||
var bytesToUuid = __webpack_require__(6); | ||
function v4(options, buf, offset) { | ||
var i = buf && offset || 0; | ||
function v4(options, buf, offset) { | ||
var i = buf && offset || 0; | ||
if (typeof(options) == 'string') { | ||
buf = options === 'binary' ? new Array(16) : null; | ||
options = null; | ||
} | ||
options = options || {}; | ||
if (typeof(options) == 'string') { | ||
buf = options === 'binary' ? new Array(16) : null; | ||
options = null; | ||
} | ||
options = options || {}; | ||
var rnds = options.random || (options.rng || rng)(); | ||
var rnds = options.random || (options.rng || rng)(); | ||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved` | ||
rnds[6] = (rnds[6] & 0x0f) | 0x40; | ||
rnds[8] = (rnds[8] & 0x3f) | 0x80; | ||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved` | ||
rnds[6] = (rnds[6] & 0x0f) | 0x40; | ||
rnds[8] = (rnds[8] & 0x3f) | 0x80; | ||
// Copy bytes to buffer, if provided | ||
if (buf) { | ||
for (var ii = 0; ii < 16; ++ii) { | ||
buf[i + ii] = rnds[ii]; | ||
} | ||
} | ||
// Copy bytes to buffer, if provided | ||
if (buf) { | ||
for (var ii = 0; ii < 16; ++ii) { | ||
buf[i + ii] = rnds[ii]; | ||
} | ||
} | ||
return buf || bytesToUuid(rnds); | ||
} | ||
return buf || bytesToUuid(rnds); | ||
} | ||
module.exports = v4; | ||
module.exports = v4; | ||
@@ -457,36 +503,36 @@ | ||
// Unique ID creation requires a high quality random # generator. In the | ||
// browser this is a little complicated due to unknown quality of Math.random() | ||
// and inconsistent support for the `crypto` API. We do the best we can via | ||
// feature-detection | ||
// Unique ID creation requires a high quality random # generator. In the | ||
// browser this is a little complicated due to unknown quality of Math.random() | ||
// and inconsistent support for the `crypto` API. We do the best we can via | ||
// feature-detection | ||
// getRandomValues needs to be invoked in a context where "this" is a Crypto | ||
// implementation. Also, find the complete implementation of crypto on IE11. | ||
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || | ||
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); | ||
// getRandomValues needs to be invoked in a context where "this" is a Crypto | ||
// implementation. Also, find the complete implementation of crypto on IE11. | ||
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || | ||
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); | ||
if (getRandomValues) { | ||
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto | ||
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef | ||
if (getRandomValues) { | ||
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto | ||
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef | ||
module.exports = function whatwgRNG() { | ||
getRandomValues(rnds8); | ||
return rnds8; | ||
}; | ||
} else { | ||
// Math.random()-based (RNG) | ||
// | ||
// If all else fails, use Math.random(). It's fast, but is of unspecified | ||
// quality. | ||
var rnds = new Array(16); | ||
module.exports = function whatwgRNG() { | ||
getRandomValues(rnds8); | ||
return rnds8; | ||
}; | ||
} else { | ||
// Math.random()-based (RNG) | ||
// | ||
// If all else fails, use Math.random(). It's fast, but is of unspecified | ||
// quality. | ||
var rnds = new Array(16); | ||
module.exports = function mathRNG() { | ||
for (var i = 0, r; i < 16; i++) { | ||
if ((i & 0x03) === 0) r = Math.random() * 0x100000000; | ||
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; | ||
} | ||
module.exports = function mathRNG() { | ||
for (var i = 0, r; i < 16; i++) { | ||
if ((i & 0x03) === 0) r = Math.random() * 0x100000000; | ||
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; | ||
} | ||
return rnds; | ||
}; | ||
} | ||
return rnds; | ||
}; | ||
} | ||
@@ -498,26 +544,26 @@ | ||
/** | ||
* Convert array of 16 byte values to UUID string format of the form: | ||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | ||
*/ | ||
var byteToHex = []; | ||
for (var i = 0; i < 256; ++i) { | ||
byteToHex[i] = (i + 0x100).toString(16).substr(1); | ||
} | ||
/** | ||
* Convert array of 16 byte values to UUID string format of the form: | ||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | ||
*/ | ||
var byteToHex = []; | ||
for (var i = 0; i < 256; ++i) { | ||
byteToHex[i] = (i + 0x100).toString(16).substr(1); | ||
} | ||
function bytesToUuid(buf, offset) { | ||
var i = offset || 0; | ||
var bth = byteToHex; | ||
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 | ||
return ([bth[buf[i++]], bth[buf[i++]], | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], | ||
bth[buf[i++]], bth[buf[i++]], | ||
bth[buf[i++]], bth[buf[i++]]]).join(''); | ||
} | ||
function bytesToUuid(buf, offset) { | ||
var i = offset || 0; | ||
var bth = byteToHex; | ||
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 | ||
return ([bth[buf[i++]], bth[buf[i++]], | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], '-', | ||
bth[buf[i++]], bth[buf[i++]], | ||
bth[buf[i++]], bth[buf[i++]], | ||
bth[buf[i++]], bth[buf[i++]]]).join(''); | ||
} | ||
module.exports = bytesToUuid; | ||
module.exports = bytesToUuid; | ||
@@ -527,68 +573,59 @@ | ||
/* 7 */ | ||
/***/ (function(module, exports) { | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
'use strict'; | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return isObject; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isCallable", function() { return isCallable; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSameObjectContent", function() { return isSameObjectContent; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return isUndefined; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deepCopyOf", function() { return deepCopyOf; }); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function isObject(value) { | ||
return value !== null && _typeof(value) === 'object'; | ||
} | ||
function isCallable(value) { | ||
return typeof value === 'function'; | ||
} | ||
function isSameObjectContent(obj1, obj2) { | ||
if (Object.keys(obj1).length !== Object.keys(obj2).length) { | ||
return false; | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var keys = Object.keys(obj1); | ||
exports.isObject = isObject; | ||
exports.isCallable = isCallable; | ||
exports.isSameObjectContent = isSameObjectContent; | ||
exports.isUndefined = isUndefined; | ||
exports.deepCopyOf = deepCopyOf; | ||
function isObject(value) { | ||
return value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object'; | ||
} | ||
for (var i = 0; i < keys.length; i += 1) { | ||
var key = keys[i]; | ||
function isCallable(value) { | ||
return typeof value === 'function'; | ||
} | ||
if (isObject(obj1[key]) && isObject(obj2[key])) { | ||
if (!isSameObjectContent(obj1[key], obj2[key])) { | ||
return false; | ||
} | ||
} else if (obj1[key] !== obj2[key]) { | ||
return false; | ||
} | ||
} | ||
function isSameObjectContent(obj1, obj2) { | ||
if (Object.keys(obj1).length !== Object.keys(obj2).length) { | ||
return false; | ||
} | ||
var keys = Object.keys(obj1); | ||
return true; | ||
} | ||
function isUndefined(value) { | ||
// eslint-disable-next-line no-void | ||
var UNDEFINED = void 0; | ||
return value === UNDEFINED; | ||
} | ||
function deepCopyOf(obj) { | ||
return JSON.parse(JSON.stringify(obj)); | ||
} | ||
for (var i = 0; i < keys.length; i += 1) { | ||
var key = keys[i]; | ||
if (isObject(obj1[key]) && isObject(obj2[key])) { | ||
if (!isSameObjectContent(obj1[key], obj2[key])) { | ||
return false; | ||
} | ||
} else if (obj1[key] !== obj2[key]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function isUndefined(value) { | ||
// eslint-disable-next-line no-void | ||
var UNDEFINED = void 0; | ||
return value === UNDEFINED; | ||
} | ||
function deepCopyOf(obj) { | ||
return JSON.parse(JSON.stringify(obj)); | ||
} | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports) { | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
'use strict'; | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony default export */ __webpack_exports__["default"] = (['type', 'id', 'width', 'height', 'dataFormat', 'dataSource', 'events', 'link', 'showDataLoadingMessage', 'showChartLoadingMessage', 'baseChartMessageFont', 'baseChartMessageFontSize', 'baseChartMessageColor', 'dataLoadStartMessage', 'dataLoadErrorMessage', 'dataInvalidMessage', 'dataEmptyMessage', 'typeNotSupportedMessage', 'loadMessage', 'renderErrorMessage', 'containerBackgroundColor', 'containerBackgroundOpacity', 'containerClassName', 'baseChartMessageImageHAlign', 'baseChartMessageImageVAlign', 'baseChartMessageImageAlpha', 'baseChartMessageImageScale', 'typeNotSupportedMessageImageHAalign', 'typeNotSupportedMessageImageVAlign', 'typeNotSupportedMessageImageAlpha', 'typeNotSupportedMessageImageScale', 'dataLoadErrorMessageImageHAlign', 'dataLoadErrorMessageImageVAlign', 'dataLoadErrorMessageImageAlpha', 'dataLoadErrorMessageImageScale', 'dataLoadStartMessageImageHAlign', 'dataLoadStartMessageImageVAlign', 'dataLoadStartMessageImageAlpha', 'dataLoadStartMessageImageScale', 'dataInvalidMessageImageHAlign', 'dataInvalidMessageImageVAlign', 'dataInvalidMessageImageAlpha', 'dataInvalidMessageImageScale', 'dataEmptyMessageImageHAlign', 'dataEmptyMessageImageVAlign', 'dataEmptyMessageImageAlpha', 'dataEmptyMessageImageScale', 'renderErrorMessageImageHAlign', 'renderErrorMessageImageVAlign', 'renderErrorMessageImageAlpha', 'renderErrorMessageImageScale', 'loadMessageImageHAlign', 'loadMessageImageVAlign', 'loadMessageImageAlpha', 'loadMessageImageScale']); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = ['type', 'id', 'width', 'height', 'dataFormat', 'dataSource', 'events', 'link', 'showDataLoadingMessage', 'showChartLoadingMessage', 'baseChartMessageFont', 'baseChartMessageFontSize', 'baseChartMessageColor', 'dataLoadStartMessage', 'dataLoadErrorMessage', 'dataInvalidMessage', 'dataEmptyMessage', 'typeNotSupportedMessage', 'loadMessage', 'renderErrorMessage', 'containerBackgroundColor', 'containerBackgroundOpacity', 'containerClassName', 'baseChartMessageImageHAlign', 'baseChartMessageImageVAlign', 'baseChartMessageImageAlpha', 'baseChartMessageImageScale', 'typeNotSupportedMessageImageHAalign', 'typeNotSupportedMessageImageVAlign', 'typeNotSupportedMessageImageAlpha', 'typeNotSupportedMessageImageScale', 'dataLoadErrorMessageImageHAlign', 'dataLoadErrorMessageImageVAlign', 'dataLoadErrorMessageImageAlpha', 'dataLoadErrorMessageImageScale', 'dataLoadStartMessageImageHAlign', 'dataLoadStartMessageImageVAlign', 'dataLoadStartMessageImageAlpha', 'dataLoadStartMessageImageScale', 'dataInvalidMessageImageHAlign', 'dataInvalidMessageImageVAlign', 'dataInvalidMessageImageAlpha', 'dataInvalidMessageImageScale', 'dataEmptyMessageImageHAlign', 'dataEmptyMessageImageVAlign', 'dataEmptyMessageImageAlpha', 'dataEmptyMessageImageScale', 'renderErrorMessageImageHAlign', 'renderErrorMessageImageVAlign', 'renderErrorMessageImageAlpha', 'renderErrorMessageImageScale', 'loadMessageImageHAlign', 'loadMessageImageVAlign', 'loadMessageImageAlpha', 'loadMessageImageScale']; | ||
/***/ }) | ||
/******/ ]) | ||
}); | ||
; | ||
/******/ ]); | ||
}); |
@@ -1,6 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("fusioncharts")):"function"==typeof define&&define.amd?define(["react","fusioncharts"],t):"object"==typeof exports?exports.DrillDown=t(require("react"),require("fusioncharts")):e.DrillDown=t(e.React,e.FusionCharts)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n(4),i=r(o);e.exports=i.default},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){h&&d&&(h=!1,d.length?y=d.concat(y):g=-1,y.length&&s())}function s(){if(!h){var e=o(a);h=!0;for(var t=y.length;t;){for(d=y,y=[];++g<t;)d&&d[g].run();g=-1,t=y.length}d=null,h=!1,i(e)}}function u(e,t){this.fun=e,this.array=t}function l(){}var c,f,p=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var d,y=[],h=!1,g=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];y.push(new u(e,t)),1!==y.length||h||o(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=n(3),d=r(p),y=n(12),h=r(y),g=n(5),v=r(g),b=function(e){function t(e){var n;i(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),s=e.btnConfig,u=e.btnStyle;r.finalBtnConfig=Object.assign({},t.defaultProps.btnConfig,s);var l=r.finalBtnConfig.placement.split("-"),f=c(l,2);return r.positionV=f[0],r.positionH=f[1],r.state={isBtnVisible:!0,selectedChild:-1,isDrilledDown:!1},r.plotClicked=r.plotClicked.bind(r),r.onChildRendered=r.onChildRendered.bind(r),r.toggleParentBtnVisibility=r.toggleParentBtnVisibility.bind(r),r.onBtnClick=r.onBtnClick.bind(r),r.wrapperStyle={position:"relative",display:"inline-block"},r.defButtonStyle=(n={border:"1px solid "+r.finalBtnConfig.borderColor,backgroundColor:""+r.finalBtnConfig.backgroundColor,color:""+r.finalBtnConfig.color,fontFamily:""+r.finalBtnConfig.fontFamily,fontSize:""+r.finalBtnConfig.fontSize,padding:""+r.finalBtnConfig.padding,fontWeight:""+r.finalBtnConfig.fontWeight,position:"absolute"},o(n,r.positionH,""+r.finalBtnConfig.margin),o(n,r.positionV,""+r.finalBtnConfig.margin),o(n,"cursor","pointer"),n),r.finBtnStyle="undefined"==typeof u?r.defButtonStyle:u,r}return s(t,e),f(t,null,[{key:"fcRoot",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];v.default.fcRoot.apply(v.default,[e].concat(n))}}]),f(t,[{key:"determinePlotMapType",value:function(e){var t=!1,n=!1;return e.forEach(function(e){"undefined"!=typeof e&&null!==e&&("number"==typeof e&&e>-1&&(t=!0),"object"===("undefined"==typeof e?"undefined":l(e))&&(n=!0))}),t&&n?"invalid":t?"number":n?"object":"noop"}},{key:"plotClicked",value:function(e){var t=e.data.index,n=Array.isArray(this.props.children)?this.props.children:[this.props.children],r=n.length,o=this.props.plotChildMap;if(0!==r){var i=this.determinePlotMapType(o);if("number"===i){var a=o[t];if(null===a||"undefined"==typeof a||a>=r||a<0)return;this.setState({selectedChild:a,isDrilledDown:!0})}if("object"===i)for(var s=0;s<r;s++)if("undefined"!=typeof o[s]&&null!==o[s]){var u=o[s],l=u.plotPosition,c=u.childPosition;if(l===t&&null!==c&&"undefined"!=typeof c&&c<r&&c>-1)return void this.setState({selectedChild:c,isDrilledDown:!0})}"invalid"===i&&console.log("Invalid heterogeneous data: Please check proptypes for - plotChildMap")}}},{key:"cloneReactFCChild",value:function(e,t){return d.default.cloneElement(e,t)}},{key:"onChildRendered",value:function(){this.props.toggleParentBtnVisibility&&this.props.toggleParentBtnVisibility(!1)}},{key:"toggleParentBtnVisibility",value:function(e){this.setState({isBtnVisible:e})}},{key:"onBtnClick",value:function(){this.setState({isDrilledDown:!1}),this.props.toggleParentBtnVisibility&&this.props.toggleParentBtnVisibility(!0)}},{key:"render",value:function(){var e=void 0,t=this.state,n=t.selectedChild,r=t.isBtnVisible,o=this.props,i=o.children,a=o.width,s=o.height,l={width:a,height:s,onRender:this.onChildRendered,toggleParentBtnVisibility:this.toggleParentBtnVisibility};if(this.state.isDrilledDown){var c=Array.isArray(i)?i:[i];e=d.default.createElement("div",{style:this.wrapperStyle},this.cloneReactFCChild(c[n],l),r?d.default.createElement("button",{style:this.finBtnStyle,onClick:this.onBtnClick},this.finalBtnConfig.text):null)}else e=d.default.createElement(v.default,u({},this.props,{"fcEvent-dataplotClick":this.plotClicked}));return e}}]),t}(d.default.Component);b.defaultProps={plotChildMap:[],btnConfig:{text:"Back",color:"#000000",backgroundColor:"#F6F6F6",borderColor:"#000000",fontSize:"14px",fontWeight:"bold",padding:"3px",fontFamily:"Verdana, sans",placement:"top-right",margin:"10px"},btnStyle:void 0,dataSource:{},dataFormat:"json",type:"",height:"",width:""},b.propTypes={plotChildMap:h.default.oneOfType([h.default.arrayOf(h.default.shape({plotPosition:h.default.number,childPosition:h.default.number})),h.default.arrayOf(h.default.number)]),btnConfig:h.default.shape({text:h.default.string,color:h.default.string,backgroundColor:h.default.string,borderColor:h.default.string,fontSize:h.default.string,fontWeight:h.default.string,padding:h.default.string,fontFamily:h.default.string,placement:h.default.oneOf(["top-left","top-right","bottom-left","bottom-right"]),margin:h.default.string}),btnStyle:h.default.object,dataSource:h.default.object,dataFormat:h.default.string,type:h.default.string,height:h.default.string,width:h.default.string},t.default=b},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(3),c=o(l),f=n(16),p=o(f),d=n(15),y=o(d),h=n(7),g=r(h),v=n(6),b=o(v),m=function(e){function t(e){i(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.containerId=(0,y.default)(),n.oldOptions=null,n.FusionCharts=e.fcLibrary||t.fusionChartsCore||p.default,n}return s(t,e),u(t,null,[{key:"fcRoot",value:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];r.forEach(function(t){t.getName||t.name?e.addDep(t):t(e)}),t.fusionChartsCore=e}}]),u(t,[{key:"componentDidMount",value:function(){this.renderChart()}},{key:"componentWillReceiveProps",value:function(e){this.oldOptions&&this.detectChanges(e)}},{key:"componentWillUnmount",value:function(){this.chartObj.dispose()}},{key:"detectChanges",value:function(e){var t=this.resolveChartOptions(e),n=this.oldOptions,r=["width","height","type","dataFormat","dataSource","events"];this.checkAndUpdateChartDimensions(t,n),this.checkAndUpdateChartType(t,n),this.checkAndUpdateChartData(t,n),this.checkAndUpdateEvents(t,n),this.checkAndUpdateRestOptions(b.default.filter(function(e){return r.indexOf(e)===-1}),t,n),this.oldOptions=t}},{key:"checkAndUpdateChartDimensions",value:function(e,t){var n=e.width,r=e.height,o=t.width,i=t.height;String(n)===String(o)&&String(r)===String(i)||(g.isUndefined(n)||g.isUndefined(r)?(g.isUndefined(n)||this.chartObj.resizeTo({w:n}),g.isUndefined(r)||this.chartObj.resizeTo({h:r})):this.chartObj.resizeTo(n,r))}},{key:"checkAndUpdateChartType",value:function(e,t){var n=e.type,r=t.type;String(n).toLowerCase()!==String(r).toLowerCase()&&(g.isUndefined(n)||this.chartObj.chartType(String(n).toLowerCase()))}},{key:"checkAndUpdateChartData",value:function(e,t){var n=e.dataFormat,r=e.dataSource,o=t.dataFormat,i=t.dataSource;String(n).toLowerCase()!==String(o).toLowerCase()?g.isUndefined(n)||g.isUndefined(r)||(this.chartObj.setChartData(r,String(n).toLowerCase()),this.chartObj.render()):this.isSameChartData(r,i)||g.isUndefined(r)||this.chartObj.setChartData(r,n?String(n).toLowerCase():"json")}},{key:"isSameChartData",value:function(e,t){return g.isObject(e)&&g.isObject(t)?g.isSameObjectContent(e,t):e===t}},{key:"checkAndUpdateEvents",value:function(e,t){var n=this,r=e.events,o=t.events,i=void 0,a=void 0;this.detectChartEventsChange(r,o)&&(g.isUndefined(r)||(i=Object.assign({},r),a=g.isUndefined(o)?{}:Object.assign({},o),Object.keys(a).forEach(function(e){a[e]===i[e]?i[e]=void 0:n.chartObj.removeEventListener(e,a[e])}),Object.keys(i).forEach(function(e){i[e]&&n.chartObj.addEventListener(e,i[e])})))}},{key:"detectChartEventsChange",value:function(e,t){return g.isObject(e)&&g.isObject(t)?!this.isSameChartEvents(e,t):!(e===t)}},{key:"isSameChartEvents",value:function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=Object.keys(e),r=0;r<n.length;++r){var o=n[r];if(e[o]!==t[o])return!1}return!0}},{key:"checkAndUpdateRestOptions",value:function(e,t,n){var r=this,o=!1;e.forEach(function(e){var i=t[e],a=n[e];r.isSameOptionValue(i,a)||g.isUndefined(i)||r.chartObj.options&&r.chartObj.options.hasOwnProperty(e)&&(r.chartObj.options[e]=i,o=!0)}),o&&this.chartObj.render()}},{key:"isSameOptionValue",value:function(e,t){return g.isObject(e)&&g.isObject(t)?g.isSameObjectContent(e,t):String(e)===String(t)}},{key:"renderChart",value:function(){var e=this,t=this.resolveChartOptions(this.props),n={};t.renderAt=this.containerId,Object.keys(this.props).forEach(function(t){var r=t.match(/^fcEvent-.*/i);if(r&&"function"==typeof e.props[t]){var o=t.replace(/^fcEvent-/i,"");n[o]=e.props[t]}}),Object.keys(n).length>0&&(void 0===t.events?t.events=n:t.events=Object.assign(t.events,n)),this.chartObj=new this.FusionCharts(t),this.chartObj.render(),this.oldOptions=t,this.props.onRender&&"function"==typeof this.props.onRender&&this.props.onRender(this.chartObj)}},{key:"resolveChartOptions",value:function(e){var t=e.chartConfig?e.chartConfig:{},n=b.default.reduce(function(t,n){return t[n]=e[n],t},{});return Object.assign(n,t),g.isObject(n.dataSource)&&(n.dataSource=g.deepCopyOf(n.dataSource)),g.isObject(n.link)&&(n.link=g.deepCopyOf(n.link)),g.isObject(n.events)&&(n.events=Object.assign({},n.events)),n}},{key:"render",value:function(){return c.default.createElement("div",{className:this.props.className,id:this.containerId})}}]),t}(c.default.Component);t.default=m},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=["type","id","width","height","dataFormat","dataSource","events","link","showDataLoadingMessage","showChartLoadingMessage","baseChartMessageFont","baseChartMessageFontSize","baseChartMessageColor","dataLoadStartMessage","dataLoadErrorMessage","dataInvalidMessage","dataEmptyMessage","typeNotSupportedMessage","loadMessage","renderErrorMessage","containerBackgroundColor","containerBackgroundOpacity","containerClassName","baseChartMessageImageHAlign","baseChartMessageImageVAlign","baseChartMessageImageAlpha","baseChartMessageImageScale","typeNotSupportedMessageImageHAalign","typeNotSupportedMessageImageVAlign","typeNotSupportedMessageImageAlpha","typeNotSupportedMessageImageScale","dataLoadErrorMessageImageHAlign","dataLoadErrorMessageImageVAlign","dataLoadErrorMessageImageAlpha","dataLoadErrorMessageImageScale","dataLoadStartMessageImageHAlign","dataLoadStartMessageImageVAlign","dataLoadStartMessageImageAlpha","dataLoadStartMessageImageScale","dataInvalidMessageImageHAlign","dataInvalidMessageImageVAlign","dataInvalidMessageImageAlpha","dataInvalidMessageImageScale","dataEmptyMessageImageHAlign","dataEmptyMessageImageVAlign","dataEmptyMessageImageAlpha","dataEmptyMessageImageScale","renderErrorMessageImageHAlign","renderErrorMessageImageVAlign","renderErrorMessageImageAlpha","renderErrorMessageImageScale","loadMessageImageHAlign","loadMessageImageVAlign","loadMessageImageAlpha","loadMessageImageScale"]},function(e,t){"use strict";function n(e){return null!==e&&"object"===("undefined"==typeof e?"undefined":s(e))}function r(e){return"function"==typeof e}function o(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r=Object.keys(e),i=0;i<r.length;i+=1){var a=r[i];if(n(e[a])&&n(t[a])){if(!o(e[a],t[a]))return!1}else if(e[a]!==t[a])return!1}return!0}function i(e){var t=void 0;return e===t}function a(e){return JSON.parse(JSON.stringify(e))}Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.isObject=n,t.isCallable=r,t.isSameObjectContent=o,t.isUndefined=i,t.deepCopyOf=a},function(e,t){/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/ | ||
"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,s,u=n(e),l=1;l<arguments.length;l++){r=Object(arguments[l]);for(var c in r)i.call(r,c)&&(u[c]=r[c]);if(o){s=o(r);for(var f=0;f<s.length;f++)a.call(r,s[f])&&(u[s[f]]=r[s[f]])}}return u}},function(e,t,n){(function(t){"use strict";function r(e,n,r,s,u){if("production"!==t.env.NODE_ENV)for(var l in e)if(e.hasOwnProperty(l)){var c;try{if("function"!=typeof e[l]){var f=Error((s||"React class")+": "+r+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.");throw f.name="Invariant Violation",f}c=e[l](n,l,s,r,null,i)}catch(e){c=e}if(!c||c instanceof Error||o((s||"React class")+": type specification of "+r+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in a)){a[c.message]=!0;var p=u?u():"";o("Failed "+r+" type: "+c.message+(null!=p?p:""))}}}var o=function(){};if("production"!==t.env.NODE_ENV){var i=n(2),a={};o=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}e.exports=r}).call(t,n(1))},function(e,t,n){"use strict";function r(){}var o=n(2);e.exports=function(){function e(e,t,n,r,i,a){if(a!==o){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){(function(t){"use strict";function r(){return null}var o=n(8),i=n(2),a=n(9),s=function(){};"production"!==t.env.NODE_ENV&&(s=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),e.exports=function(e,n){function u(e){var t=e&&(A&&e[A]||e[T]);if("function"==typeof t)return t}function l(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function c(e){this.message=e,this.stack=""}function f(e){function r(r,u,l,f,p,d,y){if(f=f||x,d=d||l,y!==i){if(n){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var g=f+":"+l;!o[g]&&a<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+f+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),o[g]=!0,a++)}}return null==u[l]?r?new c(null===u[l]?"The "+p+" `"+d+"` is marked as required "+("in `"+f+"`, but its value is `null`."):"The "+p+" `"+d+"` is marked as required in "+("`"+f+"`, but its value is `undefined`.")):null:e(u,l,f,p,d)}if("production"!==t.env.NODE_ENV)var o={},a=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function p(e){function t(t,n,r,o,i,a){var s=t[n],u=k(s);if(u!==e){var l=E(s);return new c("Invalid "+o+" `"+i+"` of type "+("`"+l+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return f(t)}function d(){return f(r)}function y(e){function t(t,n,r,o,a){if("function"!=typeof e)return new c("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var u=k(s);return new c("Invalid "+o+" `"+a+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var f=e(s,l,r,o,a+"["+l+"]",i);if(f instanceof Error)return f}return null}return f(t)}function h(){function t(t,n,r,o,i){var a=t[n];if(!e(a)){var s=k(a);return new c("Invalid "+o+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return f(t)}function g(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var a=e.name||x,s=M(t[n]);return new c("Invalid "+o+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+a+"`."))}return null}return f(t)}function v(e){function n(t,n,r,o,i){for(var a=t[n],s=0;s<e.length;s++)if(l(a,e[s]))return null;var u=JSON.stringify(e);return new c("Invalid "+o+" `"+i+"` of value `"+a+"` "+("supplied to `"+r+"`, expected one of "+u+"."))}return Array.isArray(e)?f(n):("production"!==t.env.NODE_ENV?s("Invalid argument supplied to oneOf, expected an instance of array."):void 0,r)}function b(e){function t(t,n,r,o,a){if("function"!=typeof e)return new c("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[n],u=k(s);if("object"!==u)return new c("Invalid "+o+" `"+a+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."));for(var l in s)if(s.hasOwnProperty(l)){var f=e(s,l,r,o,a+"."+l,i);if(f instanceof Error)return f}return null}return f(t)}function m(e){function n(t,n,r,o,a){for(var s=0;s<e.length;s++){var u=e[s];if(null==u(t,n,r,o,a,i))return null}return new c("Invalid "+o+" `"+a+"` supplied to "+("`"+r+"`."))}if(!Array.isArray(e))return"production"!==t.env.NODE_ENV?s("Invalid argument supplied to oneOfType, expected an instance of array."):void 0,r;for(var o=0;o<e.length;o++){var a=e[o];if("function"!=typeof a)return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+I(a)+" at index "+o+"."),r}return f(n)}function O(){function e(e,t,n,r,o){return w(e[t])?null:new c("Invalid "+r+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return f(e)}function C(e){function t(t,n,r,o,a){var s=t[n],u=k(s);if("object"!==u)return new c("Invalid "+o+" `"+a+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var f=e[l];if(f){var p=f(s,l,r,o,a+"."+l,i);if(p)return p}}return null}return f(t)}function j(e){function t(t,n,r,a,s){var u=t[n],l=k(u);if("object"!==l)return new c("Invalid "+a+" `"+s+"` of type `"+l+"` "+("supplied to `"+r+"`, expected `object`."));var f=o({},t[n],e);for(var p in f){var d=e[p];if(!d)return new c("Invalid "+a+" `"+s+"` key `"+p+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=d(u,p,r,a,s+"."+p,i);if(y)return y}return null}return f(t)}function w(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(w);if(null===t||e(t))return!0;var n=u(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!w(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!w(i[1]))return!1}return!0;default:return!1}}function S(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function k(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":S(t,e)?"symbol":t}function E(e){if("undefined"==typeof e||null===e)return""+e;var t=k(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function I(e){var t=E(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function M(e){return e.constructor&&e.constructor.name?e.constructor.name:x}var A="function"==typeof Symbol&&Symbol.iterator,T="@@iterator",x="<<anonymous>>",P={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:d(),arrayOf:y,element:h(),instanceOf:g,node:O(),objectOf:b,oneOf:v,oneOfType:m,shape:C,exact:j};return c.prototype=Error.prototype,P.checkPropTypes=a,P.PropTypes=P,P}}).call(t,n(1))},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},i=!0;e.exports=n(11)(o,i)}else e.exports=n(10)()}).call(t,n(1))},function(e,t){function n(e,t){var n=t||0,o=r;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}for(var r=[],o=0;o<256;++o)r[o]=(o+256).toString(16).substr(1);e.exports=n},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t,n){function r(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var a=e.random||(e.rng||o)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[r+s]=a[s];return t||i(a)}var o=n(14),i=n(13);e.exports=r},function(e,n){e.exports=t}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("fusioncharts")):"function"==typeof define&&define.amd?define("ReactFC",["react","fusioncharts"],t):"object"==typeof exports?exports.ReactFC=t(require("react"),require("fusioncharts")):e.ReactFC=t(e.React,e.FusionCharts)}(window,function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var r=n(4),a=n(5);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var i=0;i<16;++i)t[o+i]=s[i];return t||a(s)}},function(e,t,n){e.exports=n(6).default},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var a=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),a[t]=e>>>((3&t)<<3)&255;return a}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,a=n;return[a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],"-",a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]],a[e[r++]]].join("")}},function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),o=n(1),s=n.n(o),i=n(2),c=n.n(i);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e){return null!==e&&"object"===u(e)}function l(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=Object.keys(e),r=0;r<n.length;r+=1){var a=n[r];if(f(e[a])&&f(t[a])){if(!l(e[a],t[a]))return!1}else if(e[a]!==t[a])return!1}return!0}function d(e){return void 0===e}function p(e){return JSON.parse(JSON.stringify(e))}var h=["type","id","width","height","dataFormat","dataSource","events","link","showDataLoadingMessage","showChartLoadingMessage","baseChartMessageFont","baseChartMessageFontSize","baseChartMessageColor","dataLoadStartMessage","dataLoadErrorMessage","dataInvalidMessage","dataEmptyMessage","typeNotSupportedMessage","loadMessage","renderErrorMessage","containerBackgroundColor","containerBackgroundOpacity","containerClassName","baseChartMessageImageHAlign","baseChartMessageImageVAlign","baseChartMessageImageAlpha","baseChartMessageImageScale","typeNotSupportedMessageImageHAalign","typeNotSupportedMessageImageVAlign","typeNotSupportedMessageImageAlpha","typeNotSupportedMessageImageScale","dataLoadErrorMessageImageHAlign","dataLoadErrorMessageImageVAlign","dataLoadErrorMessageImageAlpha","dataLoadErrorMessageImageScale","dataLoadStartMessageImageHAlign","dataLoadStartMessageImageVAlign","dataLoadStartMessageImageAlpha","dataLoadStartMessageImageScale","dataInvalidMessageImageHAlign","dataInvalidMessageImageVAlign","dataInvalidMessageImageAlpha","dataInvalidMessageImageScale","dataEmptyMessageImageHAlign","dataEmptyMessageImageVAlign","dataEmptyMessageImageAlpha","dataEmptyMessageImageScale","renderErrorMessageImageHAlign","renderErrorMessageImageVAlign","renderErrorMessageImageAlpha","renderErrorMessageImageScale","loadMessageImageHAlign","loadMessageImageVAlign","loadMessageImageAlpha","loadMessageImageScale"];function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),e}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var S=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=y(this,m(t).call(this,e))).containerId=c()(),n.oldOptions=null,n.FusionCharts=e.fcLibrary||t.fusionChartsCore||s.a,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&O(e,t)}(t,a.a.Component),b(t,null,[{key:"fcRoot",value:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];r.forEach(function(t){t.getName||t.name?e.addDep(t):t(e)}),t.fusionChartsCore=e}}]),b(t,[{key:"componentDidMount",value:function(){this.renderChart()}},{key:"componentWillReceiveProps",value:function(e){this.oldOptions&&this.detectChanges(e)}},{key:"componentWillUnmount",value:function(){this.chartObj.dispose()}},{key:"detectChanges",value:function(e){var t=this.resolveChartOptions(e),n=this.oldOptions,r=["width","height","type","dataFormat","dataSource","events"];this.checkAndUpdateChartDimensions(t,n),this.checkAndUpdateChartType(t,n),this.checkAndUpdateChartData(t,n),this.checkAndUpdateEvents(t,n),this.checkAndUpdateRestOptions(h.filter(function(e){return-1===r.indexOf(e)}),t,n),this.oldOptions=t}},{key:"checkAndUpdateChartDimensions",value:function(e,t){var n=e.width,r=e.height,a=t.width,o=t.height;String(n)===String(a)&&String(r)===String(o)||(d(n)||d(r)?(d(n)||this.chartObj.resizeTo({w:n}),d(r)||this.chartObj.resizeTo({h:r})):this.chartObj.resizeTo(n,r))}},{key:"checkAndUpdateChartType",value:function(e,t){var n=e.type,r=t.type;String(n).toLowerCase()!==String(r).toLowerCase()&&(d(n)||this.chartObj.chartType(String(n).toLowerCase()))}},{key:"checkAndUpdateChartData",value:function(e,t){var n=e.dataFormat,r=e.dataSource,a=t.dataFormat,o=t.dataSource;String(n).toLowerCase()!==String(a).toLowerCase()?d(n)||d(r)||(this.chartObj.setChartData(r,String(n).toLowerCase()),this.chartObj.render()):this.isSameChartData(r,o)||d(r)||this.chartObj.setChartData(r,n?String(n).toLowerCase():"json")}},{key:"isSameChartData",value:function(e,t){return f(e)&&f(t)?l(e,t):e===t}},{key:"checkAndUpdateEvents",value:function(e,t){var n,r,a=this,o=e.events,s=t.events;this.detectChartEventsChange(o,s)&&(d(o)||(n=Object.assign({},o),r=d(s)?{}:Object.assign({},s),Object.keys(r).forEach(function(e){r[e]===n[e]?n[e]=void 0:a.chartObj.removeEventListener(e,r[e])}),Object.keys(n).forEach(function(e){n[e]&&a.chartObj.addEventListener(e,n[e])})))}},{key:"detectChartEventsChange",value:function(e,t){return f(e)&&f(t)?!this.isSameChartEvents(e,t):!(e===t)}},{key:"isSameChartEvents",value:function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=Object.keys(e),r=0;r<n.length;++r){var a=n[r];if(e[a]!==t[a])return!1}return!0}},{key:"checkAndUpdateRestOptions",value:function(e,t,n){var r=this,a=!1;e.forEach(function(e){var o=t[e],s=n[e];r.isSameOptionValue(o,s)||d(o)||r.chartObj.options&&r.chartObj.options.hasOwnProperty(e)&&(r.chartObj.options[e]=o,a=!0)}),a&&this.chartObj.render()}},{key:"isSameOptionValue",value:function(e,t){return f(e)&&f(t)?l(e,t):String(e)===String(t)}},{key:"renderChart",value:function(){var e=this,t=this.resolveChartOptions(this.props),n={};t.renderAt=this.containerId,Object.keys(this.props).forEach(function(t){if(t.match(/^fcEvent-.*/i)&&"function"==typeof e.props[t]){var r=t.replace(/^fcEvent-/i,"");n[r]=e.props[t]}}),Object.keys(n).length>0&&(void 0===t.events?t.events=n:t.events=Object.assign(t.events,n)),this.chartObj=new this.FusionCharts(t),this.chartObj.render(),this.oldOptions=t,this.props.onRender&&"function"==typeof this.props.onRender&&this.props.onRender(this.chartObj)}},{key:"resolveChartOptions",value:function(e){var t=e.chartConfig?e.chartConfig:{},n=h.reduce(function(t,n){return t[n]=e[n],t},{});return Object.assign(n,t),f(n.dataSource)&&(n.dataSource=p(n.dataSource)),f(n.link)&&(n.link=p(n.link)),f(n.events)&&(n.events=Object.assign({},n.events)),n}},{key:"render",value:function(){return a.a.createElement("div",{className:this.props.className,id:this.containerId})}}]),t}();t.default=S}])}); |
@@ -1,6 +0,7 @@ | ||
import ReactFC from './src/ReactFC'; | ||
// import ReactFC from './src/ReactFC'; | ||
// Use this format to export ReactFC as default module | ||
// Ref: https://gist.github.com/iamakulov/966b91c0fc6363a16ff0650b51fb991b | ||
module.exports = ReactFC; | ||
// export default ReactFC; | ||
module.exports = require('./src/ReactFC').default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,42 +6,45 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
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 = _interopRequireDefault(require("react")); | ||
var _react = require('react'); | ||
var _fusioncharts = _interopRequireDefault(require("fusioncharts")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _v = _interopRequireDefault(require("uuid/v4")); | ||
var _fusioncharts = require('fusioncharts'); | ||
var utils = _interopRequireWildcard(require("./utils/utils")); | ||
var _fusioncharts2 = _interopRequireDefault(_fusioncharts); | ||
var _options = _interopRequireDefault(require("./utils/options")); | ||
var _v = require('uuid/v4'); | ||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
var _v2 = _interopRequireDefault(_v); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _utils = require('./utils/utils'); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var utils = _interopRequireWildcard(_utils); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _options = require('./utils/options'); | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
var _options2 = _interopRequireDefault(_options); | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
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); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
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; } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var ReactFC = function (_React$Component) { | ||
var ReactFC = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(ReactFC, _React$Component); | ||
_createClass(ReactFC, null, [{ | ||
key: 'fcRoot', | ||
key: "fcRoot", | ||
value: function fcRoot(core) { | ||
for (var _len = arguments.length, modules = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
for (var _len = arguments.length, modules = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
modules[_key - 1] = arguments[_key]; | ||
@@ -62,9 +65,10 @@ } | ||
function ReactFC(props) { | ||
var _this; | ||
_classCallCheck(this, ReactFC); | ||
var _this = _possibleConstructorReturn(this, (ReactFC.__proto__ || Object.getPrototypeOf(ReactFC)).call(this, props)); | ||
_this.containerId = (0, _v2.default)(); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(ReactFC).call(this, props)); | ||
_this.containerId = (0, _v.default)(); | ||
_this.oldOptions = null; | ||
_this.FusionCharts = props.fcLibrary || ReactFC.fusionChartsCore || _fusioncharts2.default; | ||
_this.FusionCharts = props.fcLibrary || ReactFC.fusionChartsCore || _fusioncharts.default; | ||
return _this; | ||
@@ -74,3 +78,3 @@ } | ||
_createClass(ReactFC, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
@@ -80,3 +84,3 @@ this.renderChart(); | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
key: "componentWillReceiveProps", | ||
value: function componentWillReceiveProps(nextProps) { | ||
@@ -86,6 +90,7 @@ if (!this.oldOptions) { | ||
} | ||
this.detectChanges(nextProps); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
@@ -95,9 +100,7 @@ this.chartObj.dispose(); | ||
}, { | ||
key: 'detectChanges', | ||
key: "detectChanges", | ||
value: function detectChanges(nextProps) { | ||
var currentOptions = this.resolveChartOptions(nextProps); | ||
var oldOptions = this.oldOptions; | ||
var optionsUpdatedNatively = ['width', 'height', 'type', 'dataFormat', 'dataSource', 'events']; | ||
this.checkAndUpdateChartDimensions(currentOptions, oldOptions); | ||
@@ -107,10 +110,9 @@ this.checkAndUpdateChartType(currentOptions, oldOptions); | ||
this.checkAndUpdateEvents(currentOptions, oldOptions); | ||
this.checkAndUpdateRestOptions(_options2.default.filter(function (option) { | ||
this.checkAndUpdateRestOptions(_options.default.filter(function (option) { | ||
return optionsUpdatedNatively.indexOf(option) === -1; | ||
}), currentOptions, oldOptions); | ||
this.oldOptions = currentOptions; | ||
} | ||
}, { | ||
key: 'checkAndUpdateChartDimensions', | ||
key: "checkAndUpdateChartDimensions", | ||
value: function checkAndUpdateChartDimensions(currentOptions, oldOptions) { | ||
@@ -131,2 +133,3 @@ var currWidth = currentOptions.width; | ||
} | ||
if (!utils.isUndefined(currHeight)) { | ||
@@ -141,3 +144,3 @@ this.chartObj.resizeTo({ | ||
}, { | ||
key: 'checkAndUpdateChartType', | ||
key: "checkAndUpdateChartType", | ||
value: function checkAndUpdateChartType(currentOptions, oldOptions) { | ||
@@ -154,3 +157,3 @@ var currType = currentOptions.type; | ||
}, { | ||
key: 'checkAndUpdateChartData', | ||
key: "checkAndUpdateChartData", | ||
value: function checkAndUpdateChartData(currentOptions, oldOptions) { | ||
@@ -164,5 +167,5 @@ var currDataFormat = currentOptions.dataFormat; | ||
if (!utils.isUndefined(currDataFormat) && !utils.isUndefined(currData)) { | ||
this.chartObj.setChartData(currData, String(currDataFormat).toLowerCase()); | ||
// If the chart dataFormat is changed then | ||
this.chartObj.setChartData(currData, String(currDataFormat).toLowerCase()); // If the chart dataFormat is changed then | ||
// animate the chart to show the changes | ||
this.chartObj.render(); | ||
@@ -172,4 +175,3 @@ } | ||
if (!utils.isUndefined(currData)) { | ||
this.chartObj.setChartData(currData, | ||
// When dataFormat is not given, but data is changed, | ||
this.chartObj.setChartData(currData, // When dataFormat is not given, but data is changed, | ||
// then use 'json' as default dataFormat | ||
@@ -181,3 +183,3 @@ currDataFormat ? String(currDataFormat).toLowerCase() : 'json'); | ||
}, { | ||
key: 'isSameChartData', | ||
key: "isSameChartData", | ||
value: function isSameChartData(currData, oldData) { | ||
@@ -187,6 +189,7 @@ if (utils.isObject(currData) && utils.isObject(oldData)) { | ||
} | ||
return currData === oldData; | ||
} | ||
}, { | ||
key: 'checkAndUpdateEvents', | ||
key: "checkAndUpdateEvents", | ||
value: function checkAndUpdateEvents(currentOptions, oldOptions) { | ||
@@ -197,4 +200,4 @@ var _this2 = this; | ||
var oldEvents = oldOptions.events; | ||
var temp1 = void 0; | ||
var temp2 = void 0; | ||
var temp1; | ||
var temp2; | ||
@@ -221,3 +224,3 @@ if (this.detectChartEventsChange(currEvents, oldEvents)) { | ||
}, { | ||
key: 'detectChartEventsChange', | ||
key: "detectChartEventsChange", | ||
value: function detectChartEventsChange(currEvents, oldEvents) { | ||
@@ -227,6 +230,7 @@ if (utils.isObject(currEvents) && utils.isObject(oldEvents)) { | ||
} | ||
return !(currEvents === oldEvents); | ||
} | ||
}, { | ||
key: 'isSameChartEvents', | ||
key: "isSameChartEvents", | ||
value: function isSameChartEvents(currEvents, oldEvents) { | ||
@@ -236,5 +240,8 @@ if (Object.keys(currEvents).length !== Object.keys(oldEvents).length) { | ||
} | ||
var currEventNames = Object.keys(currEvents); | ||
for (var i = 0; i < currEventNames.length; ++i) { | ||
var evName = currEventNames[i]; | ||
if (currEvents[evName] !== oldEvents[evName]) { | ||
@@ -244,6 +251,7 @@ return false; | ||
} | ||
return true; | ||
} | ||
}, { | ||
key: 'checkAndUpdateRestOptions', | ||
key: "checkAndUpdateRestOptions", | ||
value: function checkAndUpdateRestOptions(restOptions, currentOptions, oldOptions) { | ||
@@ -253,3 +261,2 @@ var _this3 = this; | ||
var optionsUpdated = false; | ||
restOptions.forEach(function (optionName) { | ||
@@ -274,3 +281,3 @@ var currValue = currentOptions[optionName]; | ||
}, { | ||
key: 'isSameOptionValue', | ||
key: "isSameOptionValue", | ||
value: function isSameOptionValue(currValue, oldValue) { | ||
@@ -280,6 +287,7 @@ if (utils.isObject(currValue) && utils.isObject(oldValue)) { | ||
} | ||
return String(currValue) === String(oldValue); | ||
} | ||
}, { | ||
key: 'renderChart', | ||
key: "renderChart", | ||
value: function renderChart() { | ||
@@ -290,7 +298,6 @@ var _this4 = this; | ||
var events = {}; | ||
currentOptions.renderAt = this.containerId; | ||
Object.keys(this.props).forEach(function (value) { | ||
var event = value.match(/^fcEvent-.*/i); | ||
if (event && typeof _this4.props[value] === 'function') { | ||
@@ -319,9 +326,11 @@ var eventName = value.replace(/^fcEvent-/i, ''); | ||
}, { | ||
key: 'resolveChartOptions', | ||
key: "resolveChartOptions", | ||
value: function resolveChartOptions(props) { | ||
var chartConfig = props.chartConfig ? props.chartConfig : {}; | ||
var inlineOptions = _options2.default.reduce(function (options, optionName) { | ||
var inlineOptions = _options.default.reduce(function (options, optionName) { | ||
options[optionName] = props[optionName]; | ||
return options; | ||
}, {}); | ||
Object.assign(inlineOptions, chartConfig); | ||
@@ -332,14 +341,20 @@ | ||
} | ||
if (utils.isObject(inlineOptions.link)) { | ||
inlineOptions.link = utils.deepCopyOf(inlineOptions.link); | ||
} | ||
if (utils.isObject(inlineOptions.events)) { | ||
inlineOptions.events = Object.assign({}, inlineOptions.events); | ||
} | ||
return inlineOptions; | ||
} | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
return _react2.default.createElement('div', { className: this.props.className, id: this.containerId }); | ||
return _react.default.createElement("div", { | ||
className: this.props.className, | ||
id: this.containerId | ||
}); | ||
} | ||
@@ -349,4 +364,5 @@ }]); | ||
return ReactFC; | ||
}(_react2.default.Component); | ||
}(_react.default.Component); | ||
exports.default = ReactFC; | ||
var _default = ReactFC; | ||
exports.default = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,2 +6,4 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = ['type', 'id', 'width', 'height', 'dataFormat', 'dataSource', 'events', 'link', 'showDataLoadingMessage', 'showChartLoadingMessage', 'baseChartMessageFont', 'baseChartMessageFontSize', 'baseChartMessageColor', 'dataLoadStartMessage', 'dataLoadErrorMessage', 'dataInvalidMessage', 'dataEmptyMessage', 'typeNotSupportedMessage', 'loadMessage', 'renderErrorMessage', 'containerBackgroundColor', 'containerBackgroundOpacity', 'containerClassName', 'baseChartMessageImageHAlign', 'baseChartMessageImageVAlign', 'baseChartMessageImageAlpha', 'baseChartMessageImageScale', 'typeNotSupportedMessageImageHAalign', 'typeNotSupportedMessageImageVAlign', 'typeNotSupportedMessageImageAlpha', 'typeNotSupportedMessageImageScale', 'dataLoadErrorMessageImageHAlign', 'dataLoadErrorMessageImageVAlign', 'dataLoadErrorMessageImageAlpha', 'dataLoadErrorMessageImageScale', 'dataLoadStartMessageImageHAlign', 'dataLoadStartMessageImageVAlign', 'dataLoadStartMessageImageAlpha', 'dataLoadStartMessageImageScale', 'dataInvalidMessageImageHAlign', 'dataInvalidMessageImageVAlign', 'dataInvalidMessageImageAlpha', 'dataInvalidMessageImageScale', 'dataEmptyMessageImageHAlign', 'dataEmptyMessageImageVAlign', 'dataEmptyMessageImageAlpha', 'dataEmptyMessageImageScale', 'renderErrorMessageImageHAlign', 'renderErrorMessageImageVAlign', 'renderErrorMessageImageAlpha', 'renderErrorMessageImageScale', 'loadMessageImageHAlign', 'loadMessageImageVAlign', 'loadMessageImageAlpha', 'loadMessageImageScale']; | ||
exports.default = void 0; | ||
var _default = ['type', 'id', 'width', 'height', 'dataFormat', 'dataSource', 'events', 'link', 'showDataLoadingMessage', 'showChartLoadingMessage', 'baseChartMessageFont', 'baseChartMessageFontSize', 'baseChartMessageColor', 'dataLoadStartMessage', 'dataLoadErrorMessage', 'dataInvalidMessage', 'dataEmptyMessage', 'typeNotSupportedMessage', 'loadMessage', 'renderErrorMessage', 'containerBackgroundColor', 'containerBackgroundOpacity', 'containerClassName', 'baseChartMessageImageHAlign', 'baseChartMessageImageVAlign', 'baseChartMessageImageAlpha', 'baseChartMessageImageScale', 'typeNotSupportedMessageImageHAalign', 'typeNotSupportedMessageImageVAlign', 'typeNotSupportedMessageImageAlpha', 'typeNotSupportedMessageImageScale', 'dataLoadErrorMessageImageHAlign', 'dataLoadErrorMessageImageVAlign', 'dataLoadErrorMessageImageAlpha', 'dataLoadErrorMessageImageScale', 'dataLoadStartMessageImageHAlign', 'dataLoadStartMessageImageVAlign', 'dataLoadStartMessageImageAlpha', 'dataLoadStartMessageImageScale', 'dataInvalidMessageImageHAlign', 'dataInvalidMessageImageVAlign', 'dataInvalidMessageImageAlpha', 'dataInvalidMessageImageScale', 'dataEmptyMessageImageHAlign', 'dataEmptyMessageImageVAlign', 'dataEmptyMessageImageAlpha', 'dataEmptyMessageImageScale', 'renderErrorMessageImageHAlign', 'renderErrorMessageImageVAlign', 'renderErrorMessageImageAlpha', 'renderErrorMessageImageScale', 'loadMessageImageHAlign', 'loadMessageImageVAlign', 'loadMessageImageAlpha', 'loadMessageImageScale']; | ||
exports.default = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,5 +6,2 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.isObject = isObject; | ||
@@ -15,4 +12,7 @@ exports.isCallable = isCallable; | ||
exports.deepCopyOf = deepCopyOf; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function isObject(value) { | ||
return value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object'; | ||
return value !== null && _typeof(value) === 'object'; | ||
} | ||
@@ -28,2 +28,3 @@ | ||
} | ||
var keys = Object.keys(obj1); | ||
@@ -33,2 +34,3 @@ | ||
var key = keys[i]; | ||
if (isObject(obj1[key]) && isObject(obj2[key])) { | ||
@@ -42,2 +44,3 @@ if (!isSameObjectContent(obj1[key], obj2[key])) { | ||
} | ||
return true; | ||
@@ -44,0 +47,0 @@ } |
{ | ||
"name": "react-fusioncharts", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Simple and Lightweight React component for FusionCharts JavaScript Charting Library", | ||
@@ -35,10 +35,9 @@ "main": "lib/ReactFC.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.21.0", | ||
"babel-eslint": "^4.1.3", | ||
"babel-jest": "^23.0.0-alpha.0", | ||
"babel-loader": "^6.2.10", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"@babel/cli": "^7.1.0", | ||
"@babel/core": "^7.1.0", | ||
"@babel/preset-env": "^7.1.0", | ||
"@babel/preset-es2015": "^7.0.0-beta.53", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/preset-stage-0": "^7.0.0", | ||
"babel-loader": "^8.0.4", | ||
"eslint": "^4.19.0", | ||
@@ -52,2 +51,3 @@ "eslint-config-airbnb": "^16.1.0", | ||
"jest": "^22.4.2", | ||
"lodash": "^4.17.11", | ||
"prop-types": "^15.6.2", | ||
@@ -61,3 +61,4 @@ "react": "^16.2.0", | ||
"serve": "^10.0.1", | ||
"webpack": "^1.14.0" | ||
"webpack": "^4.20.2", | ||
"webpack-cli": "^3.1.1" | ||
}, | ||
@@ -68,4 +69,4 @@ "peerDependencies": { | ||
"scripts": { | ||
"build:lib": "babel ./src -d ./lib", | ||
"build:umd": "webpack && webpack -p --output-path ./dist --output-file react-fusioncharts.min.js", | ||
"build:lib": "babel ./src -d ./lib && mv ./lib/DrillDown.js ./components/DrillDown.js", | ||
"build:umd": "webpack", | ||
"build": "npm run build:lib && npm run build:umd", | ||
@@ -72,0 +73,0 @@ "build:example": "npm run build:lib && webpack --config webpack.config.example.js", |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import ReactFC from './ReactFC'; | ||
import ReactFC from '../lib/ReactFC'; | ||
@@ -14,3 +14,3 @@ | ||
super(props); | ||
const { btnConfig, btnStyle } = props; | ||
@@ -17,0 +17,0 @@ this.finalBtnConfig = Object.assign({}, DrillDown.defaultProps.btnConfig, btnConfig); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
177470
19
0
0
26
3267
2