From 70951e3b0fa87fb95e17d017a53faca1e07c941d Mon Sep 17 00:00:00 2001 From: weizhenye Date: Sun, 30 Oct 2016 03:52:42 +0800 Subject: [PATCH] 0.0.7 --- dist/vue-highcharts.js | 28 +++++++++++++++++++++++----- dist/vue-highcharts.min.js | 2 +- package.json | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/dist/vue-highcharts.js b/dist/vue-highcharts.js index b3dd069..67ae337 100644 --- a/dist/vue-highcharts.js +++ b/dist/vue-highcharts.js @@ -13,6 +13,28 @@ var ctors = { 'highcharts-renderer': 'Renderer' }; +/* istanbul ignore next */ +function clone(obj) { + var copy; + if (obj === null || typeof obj !== 'object') { + return obj; + } + if (obj instanceof Array) { + copy = []; + for (var i = obj.length - 1; i >= 0; i--) { + copy[i] = clone(obj[i]); + } + return copy; + } + if (obj instanceof Object) { + copy = {}; + for (var key in obj) { + copy[key] = clone(obj[key]); + } + return copy; + } +} + function create(tagName, Highcharts) { var Ctor = Highcharts[ctors[tagName]]; if (!Ctor) { @@ -43,11 +65,7 @@ function create(tagName, Highcharts) { this.renderer && this.$el.removeChild(this.renderer.box); this.renderer = new Ctor(this.$el, this.width, this.height); } else { - var opts = {}; - for (var property in this.options) { - opts[property] = this.options[property]; - } - this.chart = new Ctor(this.$el, opts); + this.chart = new Ctor(this.$el, clone(this.options)); } } }, diff --git a/dist/vue-highcharts.min.js b/dist/vue-highcharts.min.js index c6f36fd..45ccd7d 100644 --- a/dist/vue-highcharts.min.js +++ b/dist/vue-highcharts.min.js @@ -1 +1 @@ -(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?module.exports=t(require("highcharts")):typeof define==="function"&&define.amd?define(["highcharts"],t):e.VueHighcharts=t(e.Highcharts)})(this,function(e){"use strict";e="default"in e?e["default"]:e;var t={highcharts:"Chart",highstock:"StockChart",highmaps:"Map","highcharts-renderer":"Renderer"};function r(e,r){var i=r[t[e]];if(!i){return null}var h=e==="highcharts-renderer";return{name:e,template:"
",props:h?{width:{type:Number,required:true},height:{type:Number,required:true}}:{options:{type:Object,required:true}},methods:{_init:function(){this._renderChart();if(h){this.$watch("width",this._renderChart);this.$watch("height",this._renderChart)}else{this.$watch("options",this._renderChart,{deep:true})}},_renderChart:function(){if(h){this.renderer&&this.$el.removeChild(this.renderer.box);this.renderer=new i(this.$el,this.width,this.height)}else{var e={};for(var t in this.options){e[t]=this.options[t]}this.chart=new i(this.$el,e)}}},mounted:function(){this._init()},beforeDestroy:function(){if(h){this.$el.removeChild(this.renderer.box);for(var e in this.renderer){delete this.renderer[e]}this.renderer=null}else{this.chart.destroy()}},ready:function(){this._init()}}}function i(i,h){var n=h&&h.Highcharts||e;i.prototype.Highcharts=n;for(var s in t){var o=r(s,n);o&&i.component(s,o)}}return i}); \ No newline at end of file +(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?module.exports=t(require("highcharts")):typeof define==="function"&&define.amd?define(["highcharts"],t):e.VueHighcharts=t(e.Highcharts)})(this,function(e){"use strict";e="default"in e?e["default"]:e;var t={highcharts:"Chart",highstock:"StockChart",highmaps:"Map","highcharts-renderer":"Renderer"};function r(e){var t;if(e===null||typeof e!=="object"){return e}if(e instanceof Array){t=[];for(var i=e.length-1;i>=0;i--){t[i]=r(e[i])}return t}if(e instanceof Object){t={};for(var h in e){t[h]=r(e[h])}return t}}function i(e,i){var h=i[t[e]];if(!h){return null}var n=e==="highcharts-renderer";return{name:e,template:"
",props:n?{width:{type:Number,required:true},height:{type:Number,required:true}}:{options:{type:Object,required:true}},methods:{_init:function(){this._renderChart();if(n){this.$watch("width",this._renderChart);this.$watch("height",this._renderChart)}else{this.$watch("options",this._renderChart,{deep:true})}},_renderChart:function(){if(n){this.renderer&&this.$el.removeChild(this.renderer.box);this.renderer=new h(this.$el,this.width,this.height)}else{this.chart=new h(this.$el,r(this.options))}}},mounted:function(){this._init()},beforeDestroy:function(){if(n){this.$el.removeChild(this.renderer.box);for(var e in this.renderer){delete this.renderer[e]}this.renderer=null}else{this.chart.destroy()}},ready:function(){this._init()}}}function h(r,h){var n=h&&h.Highcharts||e;r.prototype.Highcharts=n;for(var s in t){var o=i(s,n);o&&r.component(s,o)}}return h}); \ No newline at end of file diff --git a/package.json b/package.json index 1746f1b..06a0213 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-highcharts", - "version": "0.0.6", + "version": "0.0.7", "description": "Highcharts component for Vue", "main": "dist/vue-highcharts.js", "jsnext:main": "src/index.js",