react-fusioncharts
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -1,1 +0,6 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("fusioncharts"),require("react")):"function"==typeof define&&define.amd?define(["fusioncharts","react"],t):"object"==typeof exports?exports.ReactFC=t(require("fusioncharts"),require("react")):e.ReactFC=t(e.FusionCharts,e.React)}(this,function(e,t){return function(e){function t(n){if(a[n])return a[n].exports;var r=a[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var a={};return t.m=e,t.c=a,t.p="",t(0)}([function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var r=a(1),o=n(r);e.exports=o.default},function(e,t,a){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 i(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 c=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),u=a(8),d=r(u),f=a(7),l=r(f),p=a(6),h=r(p),g=a(3),y=n(g),v=a(2),m=r(v),b=function(e){function t(e){o(this,t);var a=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.containerId=(0,h.default)(),a.oldOptions=null,a.FusionCharts=e.fcLibrary||t.fusionChartsCore||l.default,a}return i(t,e),c(t,null,[{key:"fcRoot",value:function(e){for(var a=arguments.length,n=Array(a>1?a-1:0),r=1;r<a;r++)n[r-1]=arguments[r];n.forEach(function(t){t.getName||t.name?e.addDep(t):t(e)}),t.fusionChartsCore=e}}]),c(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),a=this.oldOptions,n=["width","height","type","dataFormat","dataSource","events"];this.checkAndUpdateChartDimensions(t,a),this.checkAndUpdateChartType(t,a),this.checkAndUpdateChartData(t,a),this.checkAndUpdateEvents(t,a),this.checkAndUpdateRestOptions(m.default.filter(function(e){return n.indexOf(e)===-1}),t,a),this.oldOptions=t}},{key:"checkAndUpdateChartDimensions",value:function(e,t){var a=e.width,n=e.height,r=t.width,o=t.height;String(a)===String(r)&&String(n)===String(o)||(y.isUndefined(a)||y.isUndefined(n)?(y.isUndefined(a)||this.chartObj.resizeTo({w:a}),y.isUndefined(n)||this.chartObj.resizeTo({h:n})):this.chartObj.resizeTo(a,n))}},{key:"checkAndUpdateChartType",value:function(e,t){var a=e.type,n=t.type;String(a).toLowerCase()!==String(n).toLowerCase()&&(y.isUndefined(a)||this.chartObj.chartType(String(a).toLowerCase()))}},{key:"checkAndUpdateChartData",value:function(e,t){var a=e.dataFormat,n=e.dataSource,r=t.dataFormat,o=t.dataSource;String(a).toLowerCase()!==String(r).toLowerCase()?y.isUndefined(a)||y.isUndefined(n)||(this.chartObj.setChartData(n,String(a).toLowerCase()),this.chartObj.render()):this.isSameChartData(n,o)||y.isUndefined(n)||this.chartObj.setChartData(n,a?String(a).toLowerCase():"json")}},{key:"isSameChartData",value:function(e,t){return y.isObject(e)&&y.isObject(t)?y.isSameObjectContent(e,t):e===t}},{key:"checkAndUpdateEvents",value:function(e,t){var a=this,n=e.events,r=t.events,o=void 0,s=void 0;this.detectChartEventsChange(n,r)&&(y.isUndefined(n)||(o=Object.assign({},n),s=y.isUndefined(r)?{}:Object.assign({},r),Object.keys(s).forEach(function(e){s[e]===o[e]?o[e]=void 0:a.chartObj.removeEventListener(e,s[e])}),Object.keys(o).forEach(function(e){o[e]&&a.chartObj.addEventListener(e,o[e])})))}},{key:"detectChartEventsChange",value:function(e,t){return y.isObject(e)&&y.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 a=Object.keys(e),n=0;n<a.length;++n){var r=a[n];if(e[r]!==t[r])return!1}return!0}},{key:"checkAndUpdateRestOptions",value:function(e,t,a){var n=this,r=!1;e.forEach(function(e){var o=t[e],s=a[e];n.isSameOptionValue(o,s)||y.isUndefined(o)||n.chartObj.options&&n.chartObj.options.hasOwnProperty(e)&&(n.chartObj.options[e]=o,r=!0)}),r&&this.chartObj.render()}},{key:"isSameOptionValue",value:function(e,t){return y.isObject(e)&&y.isObject(t)?y.isSameObjectContent(e,t):String(e)===String(t)}},{key:"renderChart",value:function(){var e=this,t=this.resolveChartOptions(this.props),a={};t.renderAt=this.containerId,Object.keys(this.props).forEach(function(t){var n=t.match(/^fcEvent-.*/i);if(n&&"function"==typeof e.props[t]){var r=t.replace(/^fcEvent-/i,"");a[r]=e.props[t]}}),Object.keys(a).length>0&&(void 0===t.events?t.events=a:t.events=Object.assign(t.events,a)),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:{},a=m.default.reduce(function(t,a){return t[a]=e[a],t},{});return Object.assign(a,t),y.isObject(a.dataSource)&&(a.dataSource=y.deepCopyOf(a.dataSource)),y.isObject(a.link)&&(a.link=y.deepCopyOf(a.link)),y.isObject(a.events)&&(a.events=Object.assign({},a.events)),a}},{key:"render",value:function(){return d.default.createElement("div",{className:this.props.className,id:this.containerId})}}]),t}(d.default.Component);t.default=b},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 a(e){return null!==e&&"object"===("undefined"==typeof e?"undefined":i(e))}function n(e){return"function"==typeof e}function r(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=Object.keys(e),o=0;o<n.length;o+=1){var s=n[o];if(a(e[s])&&a(t[s])){if(!r(e[s],t[s]))return!1}else if(e[s]!==t[s])return!1}return!0}function o(e){var t=void 0;return e===t}function s(e){return JSON.parse(JSON.stringify(e))}Object.defineProperty(t,"__esModule",{value:!0});var i="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=a,t.isCallable=n,t.isSameObjectContent=r,t.isUndefined=o,t.deepCopyOf=s},function(e,t){function a(e,t){var a=t||0,r=n;return[r[e[a++]],r[e[a++]],r[e[a++]],r[e[a++]],"-",r[e[a++]],r[e[a++]],"-",r[e[a++]],r[e[a++]],"-",r[e[a++]],r[e[a++]],"-",r[e[a++]],r[e[a++]],r[e[a++]],r[e[a++]],r[e[a++]],r[e[a++]]].join("")}for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=a},function(e,t){var a="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(a){var n=new Uint8Array(16);e.exports=function(){return a(n),n}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},function(e,t,a){function n(e,t,a){var n=t&&a||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var s=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[n+i]=s[i];return t||o(s)}var r=a(5),o=a(4);e.exports=n},function(t,a){t.exports=e},function(e,a){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(["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}])}); |
{ | ||
"name": "react-fusioncharts", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Simple and Lightweight React component for FusionCharts JavaScript Charting Library", | ||
@@ -45,6 +45,9 @@ "main": "lib/ReactFC.js", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-config-prettier": "^3.1.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.7.0", | ||
"fusioncharts": "^3.13.1-sr.2", | ||
"jest": "^22.4.2", | ||
"prop-types": "^15.6.2", | ||
"react": "^16.2.0", | ||
@@ -67,3 +70,3 @@ "react-addons-test-utils": "15.3.0", | ||
"build:example": "npm run build:lib && webpack --config webpack.config.example.js", | ||
"start": "npm run build:example && serve example/ -o", | ||
"start": "npm run build:example && serve example/", | ||
"test": "jest --coverage --verbose", | ||
@@ -70,0 +73,0 @@ "test:report": "npm test && serve coverage/lcov-report -o" |
Sorry, the diff of this file is not supported yet
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
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
173895
18
3336
25
9
1