vue-echarts 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ 4.1.0
2
+ * Fix the problem that `mergeOptions` didn't use the correct options if the instance is inited on-the-fly.
3
+ * Expose ZRender events via `zr:` prefixed events.
4
+ * Update to `echarts@4.5.0` (only affects the bundled version).
5
+
6
+ 4.0.4
7
+ * Update to `echarts@4.3.0` (only affects the bundled version).
8
+
9
+ 4.0.3
10
+ * Update to `resize-detector@0.1.10`.
11
+
12
+ 4.0.2
13
+ * Make `manual-update` truely responsive.
14
+
1
15
  4.0.1
2
16
  * Fix `legendscroll` event.
3
17
 
@@ -11,7 +25,7 @@
11
25
  * Move `echarts` into `peerDependencies`. **BREAKING**
12
26
  * Rename `auto-resize` to `autoresize`. **BREAKING**
13
27
  * Point `module` entry to the source version. **BREAKING**
14
- * Swith to Vue CLI 3 for demo.
28
+ * Switch to Vue CLI 3 for demo.
15
29
 
16
30
  3.1.2
17
31
  * Fix the problem that `setOption` is always called with `notMerge: true`.
package/README.md CHANGED
@@ -20,7 +20,7 @@ Include `echarts` and `vue-echarts` in your HTML file like this:
20
20
 
21
21
  ```html
22
22
  <script src="https://cdn.jsdelivr.net/npm/echarts@4.1.0/dist/echarts.js"></script>
23
- <script src="https://cdn.jsdelivr.net/npm/vue-echarts@4.0.0"></script>
23
+ <script src="https://cdn.jsdelivr.net/npm/vue-echarts@4.0.2"></script>
24
24
  ```
25
25
 
26
26
  ## Usage
@@ -154,6 +154,11 @@ Vue.component('v-chart', VueECharts)
154
154
  </template>
155
155
 
156
156
  <style>
157
+ /**
158
+ * The default size is 600px×400px, for responsive charts
159
+ * you may need to set percentage values as follows (also
160
+ * don't forget to provide a size for the container).
161
+ */
157
162
  .echarts {
158
163
  width: 100%;
159
164
  height: 100%;
@@ -219,7 +224,7 @@ export default {
219
224
  </script>
220
225
  ```
221
226
 
222
- See more examples [here](https://github.com/Justineo/vue-echarts/tree/master/demo).
227
+ See more examples [here](https://github.com/ecomfe/vue-echarts/tree/master/src/demo).
223
228
 
224
229
  ### Props *(all reactive)*
225
230
 
@@ -345,8 +350,15 @@ Vue-ECharts support the following events:
345
350
  * `mouseup`
346
351
  * `globalout`
347
352
  * `contextmenu`
353
+ * ZRender events *(since v4.1.0)*
354
+ * `click`
355
+ * `mousedown`
356
+ * `mouseup`
357
+ * `mousewheel`
358
+ * `dblclick`
359
+ * `contextmenu`
348
360
 
349
- For further details, see [ECharts' API documentation](https://ecomfe.github.io/echarts-doc/public/en/api.html).
361
+ For further details, see [ECharts' API documentation](https://echarts.apache.org/en/api.html).
350
362
 
351
363
  ## Local development
352
364
 
package/README.zh_CN.md CHANGED
@@ -18,7 +18,7 @@ $ npm install echarts vue-echarts
18
18
 
19
19
  ```html
20
20
  <script src="https://cdn.jsdelivr.net/npm/echarts@4.1.0/dist/echarts.js"></script>
21
- <script src="https://cdn.jsdelivr.net/npm/vue-echarts@4.0.0"></script>
21
+ <script src="https://cdn.jsdelivr.net/npm/vue-echarts@4.0.2"></script>
22
22
  ```
23
23
 
24
24
  ## 使用方法
@@ -153,6 +153,10 @@ Vue.component('v-chart', VueECharts)
153
153
  </template>
154
154
 
155
155
  <style>
156
+ /**
157
+ * 默认尺寸为 600px×400px,如果想让图表响应尺寸变化,可以像下面这样
158
+ * 把尺寸设为百分比值(同时请记得为容器设置尺寸)。
159
+ */
156
160
  .echarts {
157
161
  width: 100%;
158
162
  height: 100%;
@@ -218,7 +222,7 @@ export default {
218
222
  </script>
219
223
  ```
220
224
 
221
- 查看[这里](https://github.com/Justineo/vue-echarts/tree/master/demo)了解更多例子。
225
+ 查看[这里](https://github.com/ecomfe/vue-echarts/tree/master/src/demo)了解更多例子。
222
226
 
223
227
  ### Props *(均为响应式)*
224
228
 
@@ -344,8 +348,15 @@ Vue-ECharts 支持如下事件:
344
348
  * `mouseup`
345
349
  * `globalout`
346
350
  * `contextmenu`
351
+ * ZRender 事件 *(v4.1.0 新增)*
352
+ * `click`
353
+ * `mousedown`
354
+ * `mouseup`
355
+ * `mousewheel`
356
+ * `dblclick`
357
+ * `contextmenu`
347
358
 
348
- 更多详细信息请参考 [ECharts 的 API 文档](https://ecomfe.github.io/echarts-doc/public/cn/api.html)。
359
+ 更多详细信息请参考 [ECharts 的 API 文档](https://echarts.apache.org/zh/api.html)。
349
360
 
350
361
  ## 本地开发
351
362
 
@@ -54,6 +54,18 @@ const EVENTS = [
54
54
  'contextmenu'
55
55
  ]
56
56
 
57
+ const ZR_EVENTS = [
58
+ 'click',
59
+ 'mousedown',
60
+ 'mouseup',
61
+ 'mousewheel',
62
+ 'dblclick',
63
+ 'contextmenu'
64
+ ]
65
+
66
+ const INIT_TRIGGERS = ['theme', 'initOptions', 'autoresize']
67
+ const REWATCH_TRIGGERS = ['manualUpdate', 'watchShallow']
68
+
57
69
  export default {
58
70
  props: {
59
71
  options: Object,
@@ -75,14 +87,14 @@ export default {
75
87
  }
76
88
  },
77
89
  methods: {
78
- // provide a explicit merge option method
90
+ // provide an explicit merge option method
79
91
  mergeOptions (options, notMerge, lazyUpdate) {
80
92
  if (this.manualUpdate) {
81
93
  this.manualOptions = options
82
94
  }
83
95
 
84
96
  if (!this.chart) {
85
- this.init()
97
+ this.init(options)
86
98
  } else {
87
99
  this.delegateMethod('setOption', options, notMerge, lazyUpdate)
88
100
  }
@@ -131,16 +143,16 @@ export default {
131
143
  }
132
144
  return this.chart[name](...args)
133
145
  },
134
- delegateGet (name, method) {
146
+ delegateGet (methodName) {
135
147
  if (!this.chart) {
136
148
  this.init()
137
149
  }
138
- return this.chart[method]()
150
+ return this.chart[methodName]()
139
151
  },
140
152
  getArea () {
141
153
  return this.$el.offsetWidth * this.$el.offsetHeight
142
154
  },
143
- init () {
155
+ init (options) {
144
156
  if (this.chart) {
145
157
  return
146
158
  }
@@ -151,7 +163,7 @@ export default {
151
163
  chart.group = this.group
152
164
  }
153
165
 
154
- chart.setOption(this.manualOptions || this.options || {}, true)
166
+ chart.setOption(options || this.manualOptions || this.options || {}, true)
155
167
 
156
168
  // expose ECharts events as custom events
157
169
  EVENTS.forEach(event => {
@@ -160,6 +172,12 @@ export default {
160
172
  })
161
173
  })
162
174
 
175
+ ZR_EVENTS.forEach(event => {
176
+ chart.getZr().on(event, params => {
177
+ this.$emit(`zr:${event}`, params)
178
+ })
179
+ })
180
+
163
181
  if (this.autoresize) {
164
182
  this.lastArea = this.getArea()
165
183
  this.__resizeHandler = debounce(() => {
@@ -183,31 +201,54 @@ export default {
183
201
  width: {
184
202
  configurable: true,
185
203
  get: () => {
186
- return this.delegateGet('width', 'getWidth')
204
+ return this.delegateGet('getWidth')
187
205
  }
188
206
  },
189
207
  height: {
190
208
  configurable: true,
191
209
  get: () => {
192
- return this.delegateGet('height', 'getHeight')
210
+ return this.delegateGet('getHeight')
193
211
  }
194
212
  },
195
213
  isDisposed: {
196
214
  configurable: true,
197
215
  get: () => {
198
- return !!this.delegateGet('isDisposed', 'isDisposed')
216
+ return !!this.delegateGet('isDisposed')
199
217
  }
200
218
  },
201
219
  computedOptions: {
202
220
  configurable: true,
203
221
  get: () => {
204
- return this.delegateGet('computedOptions', 'getOption')
222
+ return this.delegateGet('getOption')
205
223
  }
206
224
  }
207
225
  })
208
226
 
209
227
  this.chart = chart
210
228
  },
229
+ initOptionsWatcher () {
230
+ if (this.__unwatchOptions) {
231
+ this.__unwatchOptions()
232
+ this.__unwatchOptions = null
233
+ }
234
+
235
+ if (!this.manualUpdate) {
236
+ this.__unwatchOptions = this.$watch('options', (val, oldVal) => {
237
+ if (!this.chart && val) {
238
+ this.init()
239
+ } else {
240
+ // mutating `options` will lead to merging
241
+ // replacing it with new reference will lead to not merging
242
+ // eg.
243
+ // `this.options = Object.assign({}, this.options, { ... })`
244
+ // will trigger `this.chart.setOption(val, true)
245
+ // `this.options.title.text = 'Trends'`
246
+ // will trigger `this.chart.setOption(val, false)`
247
+ this.chart.setOption(val, val !== oldVal)
248
+ }
249
+ }, { deep: !this.watchShallow })
250
+ }
251
+ },
211
252
  destroy () {
212
253
  if (this.autoresize) {
213
254
  removeListener(this.$el, this.__resizeHandler)
@@ -223,29 +264,20 @@ export default {
223
264
  }
224
265
  },
225
266
  created () {
226
- if (!this.manualUpdate) {
227
- this.$watch('options', (val, oldVal) => {
228
- if (!this.chart && val) {
229
- this.init()
230
- } else {
231
- // mutating `options` will lead to merging
232
- // replacing it with new reference will lead to not merging
233
- // eg.
234
- // `this.options = Object.assign({}, this.options, { ... })`
235
- // will trigger `this.chart.setOption(val, true)
236
- // `this.options.title.text = 'Trends'`
237
- // will trigger `this.chart.setOption(val, false)`
238
- this.chart.setOption(val, val !== oldVal)
239
- }
240
- }, { deep: !this.watchShallow })
241
- }
267
+ this.initOptionsWatcher()
242
268
 
243
- let watched = ['theme', 'initOptions', 'autoresize', 'manualUpdate', 'watchShallow']
244
- watched.forEach(prop => {
269
+ INIT_TRIGGERS.forEach(prop => {
245
270
  this.$watch(prop, () => {
246
271
  this.refresh()
247
272
  }, { deep: true })
248
273
  })
274
+
275
+ REWATCH_TRIGGERS.forEach(prop => {
276
+ this.$watch(prop, () => {
277
+ this.initOptionsWatcher()
278
+ this.refresh()
279
+ })
280
+ })
249
281
  },
250
282
  mounted () {
251
283
  // auto init if `options` is already provided
@@ -258,11 +290,10 @@ export default {
258
290
  this.chart && this.chart.resize()
259
291
  }
260
292
  },
261
- beforeDestroy () {
262
- if (!this.chart) {
263
- return
293
+ destroyed () {
294
+ if (this.chart) {
295
+ this.destroy()
264
296
  }
265
- this.destroy()
266
297
  },
267
298
  connect (group) {
268
299
  if (typeof group !== 'string') {
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("echarts/lib/echarts")):"function"==typeof define&&define.amd?define(["echarts/lib/echarts"],t):(e=e||self).VueECharts=t(e.echarts)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n="object"==typeof i&&i&&i.Object===Object&&i,r="object"==typeof self&&self&&self.Object===Object&&self,o=n||r||Function("return this")(),s=function(){return o.Date.now()},a=o.Symbol,d=Object.prototype,c=d.hasOwnProperty,l=d.toString,u=a?a.toStringTag:void 0;var h=function(e){var t=c.call(e,u),i=e[u];try{e[u]=void 0;var n=!0}catch(e){}var r=l.call(e);return n&&(t?e[u]=i:delete e[u]),r},_=Object.prototype.toString;var f=function(e){return _.call(e)},g="[object Null]",p="[object Undefined]",m=a?a.toStringTag:void 0;var v=function(e){return null==e?void 0===e?p:g:m&&m in Object(e)?h(e):f(e)};var b=function(e){return null!=e&&"object"==typeof e},z="[object Symbol]";var y=function(e){return"symbol"==typeof e||b(e)&&v(e)==z},w=NaN,O=/^\s+|\s+$/g,x=/^[-+]0x[0-9a-f]+$/i,C=/^0b[01]+$/i,E=/^0o[0-7]+$/i,M=parseInt;var S=function(e){if("number"==typeof e)return e;if(y(e))return w;if(t(e)){var i="function"==typeof e.valueOf?e.valueOf():e;e=t(i)?i+"":i}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(O,"");var n=C.test(e);return n||E.test(e)?M(e.slice(2),n?2:8):x.test(e)?w:+e},T="Expected a function",j=Math.max,L=Math.min;var $=function(e,i,n){var r,o,a,d,c,l,u=0,h=!1,_=!1,f=!0;if("function"!=typeof e)throw new TypeError(T);function g(t){var i=r,n=o;return r=o=void 0,u=t,d=e.apply(n,i)}function p(e){var t=e-l;return void 0===l||t>=i||t<0||_&&e-u>=a}function m(){var e=s();if(p(e))return v(e);c=setTimeout(m,function(e){var t=i-(e-l);return _?L(t,a-(e-u)):t}(e))}function v(e){return c=void 0,f&&r?g(e):(r=o=void 0,d)}function b(){var e=s(),t=p(e);if(r=arguments,o=this,l=e,t){if(void 0===c)return function(e){return u=e,c=setTimeout(m,i),h?g(e):d}(l);if(_)return c=setTimeout(m,i),g(l)}return void 0===c&&(c=setTimeout(m,i)),d}return i=S(i)||0,t(n)&&(h=!!n.leading,a=(_="maxWait"in n)?j(S(n.maxWait)||0,i):a,f="trailing"in n?!!n.trailing:f),b.cancel=function(){void 0!==c&&clearTimeout(c),u=0,r=l=o=c=void 0},b.flush=function(){return void 0===c?d:v(s())},b},R=null;var A=null;function N(e,t){void 0===t&&(t={});var i=document.createElement(e);return Object.keys(t).forEach(function(e){i[e]=t[e]}),i}function D(e,t,i){return(window.getComputedStyle(e,i||null)||{display:"none"})[t]}function U(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===D(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var F='.resize-triggers{visibility:hidden;opacity:0}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:"";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}',H=0,W=null;function P(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=function(){var e=U(this),t=e.rendered,i=e.detached;t!==this.__resize_rendered__&&(!i&&this.__resize_triggers__&&(q(this),this.addEventListener("scroll",k,!0)),this.__resize_rendered__=t,B(this))}.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var i=e.offsetWidth,n=e.offsetHeight,r=new ResizeObserver(function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==i||e.offsetHeight!==n))&&B(e)}),o=U(e),s=o.detached,a=o.rendered;e.__resize_observer_triggered__=!1===s&&!1===a,e.__resize_observer__=r,r.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){B(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(H||(W=function(e){var t=document.createElement("style");return t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),(document.querySelector("head")||document.body).appendChild(t),t}(F)),function(e){var t=D(e,"position");t&&"static"!==t||(e.style.position="relative");e.__resize_old_position__=t,e.__resize_last__={};var i=N("div",{className:"resize-triggers"}),n=N("div",{className:"resize-expand-trigger"}),r=N("div"),o=N("div",{className:"resize-contract-trigger"});n.appendChild(r),i.appendChild(n),i.appendChild(o),e.appendChild(i),e.__resize_triggers__={triggers:i,expand:n,expandChild:r,contract:o},q(e),e.addEventListener("scroll",k,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=U(e).rendered,window.MutationObserver){var d=new MutationObserver(e.__resize_mutation_handler__);d.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=d}e.__resize_listeners__.push(t),H++}function k(){var e,t,i=this;q(this),this.__resize_raf__&&(e=this.__resize_raf__,A||(A=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),A(e)),this.__resize_raf__=(t=function(){var e,t,n,r,o,s,a=(t=(e=i).__resize_last__,n=t.width,r=t.height,o=e.offsetWidth,s=e.offsetHeight,o!==n||s!==r?{width:o,height:s}:null);a&&(i.__resize_last__=a,B(i))},R||(R=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),R(t))}function B(e){e.__resize_listeners__.forEach(function(t){t.call(e)})}function q(e){var t=e.__resize_triggers__,i=t.expand,n=t.expandChild,r=t.contract,o=r.scrollWidth,s=r.scrollHeight,a=i.offsetWidth,d=i.offsetHeight,c=i.scrollWidth,l=i.scrollHeight;r.scrollLeft=o,r.scrollTop=s,n.style.width=a+1+"px",n.style.height=d+1+"px",i.scrollLeft=c,i.scrollTop=l}var G=["legendselectchanged","legendselected","legendunselected","legendscroll","datazoom","datarangeselected","timelinechanged","timelineplaychanged","restore","dataviewchanged","magictypechanged","geoselectchanged","geoselected","geounselected","pieselectchanged","pieselected","pieunselected","mapselectchanged","mapselected","mapunselected","axisareaselected","focusnodeadjacency","unfocusnodeadjacency","brush","brushselected","rendered","finished","click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"],I={props:{options:Object,theme:[String,Object],initOptions:Object,group:String,autoresize:Boolean,watchShallow:Boolean,manualUpdate:Boolean},data:function(){return{lastArea:0}},watch:{group:function(e){this.chart.group=e}},methods:{mergeOptions:function(e,t,i){this.manualUpdate&&(this.manualOptions=e),this.chart?this.delegateMethod("setOption",e,t,i):this.init()},appendData:function(e){this.delegateMethod("appendData",e)},resize:function(e){this.delegateMethod("resize",e)},dispatchAction:function(e){this.delegateMethod("dispatchAction",e)},convertToPixel:function(e,t){return this.delegateMethod("convertToPixel",e,t)},convertFromPixel:function(e,t){return this.delegateMethod("convertFromPixel",e,t)},containPixel:function(e,t){return this.delegateMethod("containPixel",e,t)},showLoading:function(e,t){this.delegateMethod("showLoading",e,t)},hideLoading:function(){this.delegateMethod("hideLoading")},getDataURL:function(e){return this.delegateMethod("getDataURL",e)},getConnectedDataURL:function(e){return this.delegateMethod("getConnectedDataURL",e)},clear:function(){this.delegateMethod("clear")},dispose:function(){this.delegateMethod("dispose")},delegateMethod:function(e){for(var t,i=[],n=arguments.length-1;n-- >0;)i[n]=arguments[n+1];return this.chart||this.init(),(t=this.chart)[e].apply(t,i)},delegateGet:function(e,t){return this.chart||this.init(),this.chart[t]()},getArea:function(){return this.$el.offsetWidth*this.$el.offsetHeight},init:function(){var t=this;if(!this.chart){var i=e.init(this.$el,this.theme,this.initOptions);this.group&&(i.group=this.group),i.setOption(this.manualOptions||this.options||{},!0),G.forEach(function(e){i.on(e,function(i){t.$emit(e,i)})}),this.autoresize&&(this.lastArea=this.getArea(),this.__resizeHandler=$(function(){0===t.lastArea?(t.mergeOptions({},!0),t.resize(),t.mergeOptions(t.options||t.manualOptions||{},!0)):t.resize(),t.lastArea=t.getArea()},100,{leading:!0}),P(this.$el,this.__resizeHandler)),Object.defineProperties(this,{width:{configurable:!0,get:function(){return t.delegateGet("width","getWidth")}},height:{configurable:!0,get:function(){return t.delegateGet("height","getHeight")}},isDisposed:{configurable:!0,get:function(){return!!t.delegateGet("isDisposed","isDisposed")}},computedOptions:{configurable:!0,get:function(){return t.delegateGet("computedOptions","getOption")}}}),this.chart=i}},destroy:function(){this.autoresize&&function(e,t){if(e.detachEvent&&e.removeEventListener)return e.detachEvent("onresize",e.__resize_legacy_resize_handler__),void document.removeEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);var i=e.__resize_listeners__;i&&(i.splice(i.indexOf(t),1),i.length||(e.__resize_observer__?(e.__resize_observer__.unobserve(e),e.__resize_observer__.disconnect(),e.__resize_observer__=null):(e.__resize_mutation_observer__&&(e.__resize_mutation_observer__.disconnect(),e.__resize_mutation_observer__=null),e.removeEventListener("scroll",k),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null),!--H&&W&&W.parentNode.removeChild(W))}(this.$el,this.__resizeHandler),this.dispose(),this.chart=null},refresh:function(){this.chart&&(this.destroy(),this.init())}},created:function(){var e=this;this.manualUpdate||this.$watch("options",function(t,i){!e.chart&&t?e.init():e.chart.setOption(t,t!==i)},{deep:!this.watchShallow});["theme","initOptions","autoresize","manualUpdate","watchShallow"].forEach(function(t){e.$watch(t,function(){e.refresh()},{deep:!0})})},mounted:function(){this.options&&this.init()},activated:function(){this.autoresize&&this.chart&&this.chart.resize()},beforeDestroy:function(){this.chart&&this.destroy()},connect:function(t){"string"!=typeof t&&(t=t.map(function(e){return e.chart})),e.connect(t)},disconnect:function(t){e.disConnect(t)},registerMap:function(t,i,n){e.registerMap(t,i,n)},registerTheme:function(t,i){e.registerTheme(t,i)},graphic:e.graphic};var V="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var X=document.head||document.getElementsByTagName("head")[0],J={};var K=I;I.__file="ECharts.vue";return function(e,t,i,n,r,o,s,a,d,c){"function"==typeof s&&(d=a,a=s,s=!1);var l,u="function"==typeof i?i.options:i;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),n&&(u._scopeId=n),o?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,d(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=l):t&&(l=s?function(){t.call(this,c(this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),l)if(u.functional){var h=u.render;u.render=function(e,t){return l.call(t),h(e,t)}}else{var _=u.beforeCreate;u.beforeCreate=_?[].concat(_,l):[l]}return i}({render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"echarts"})},staticRenderFns:[]},function(e){e&&e("data-v-47b5abce_0",{source:".echarts{width:600px;height:400px}",map:void 0,media:void 0})},K,void 0,!1,void 0,function(e){return function(e,t){return function(e,t){var i=V?t.media||"default":e,n=J[i]||(J[i]={ids:new Set,styles:[]});if(!n.ids.has(e)){n.ids.add(e);var r=t.source;if(t.map&&(r+="\n/*# sourceURL="+t.map.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),n.element||(n.element=document.createElement("style"),n.element.type="text/css",t.media&&n.element.setAttribute("media",t.media),X.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(r),n.element.styleSheet.cssText=n.styles.filter(Boolean).join("\n");else{var o=n.ids.size-1,s=document.createTextNode(r),a=n.element.childNodes;a[o]&&n.element.removeChild(a[o]),a.length?n.element.insertBefore(s,a[o]):n.element.appendChild(s)}}}(e,t)}},void 0)});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("echarts/lib/echarts")):"function"==typeof define&&define.amd?define(["echarts/lib/echarts"],t):(e=e||self).VueECharts=t(e.echarts)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n="object"==typeof i&&i&&i.Object===Object&&i,r="object"==typeof self&&self&&self.Object===Object&&self,o=n||r||Function("return this")(),s=function(){return o.Date.now()},a=o.Symbol,c=Object.prototype,d=c.hasOwnProperty,l=c.toString,u=a?a.toStringTag:void 0;var h=function(e){var t=d.call(e,u),i=e[u];try{e[u]=void 0;var n=!0}catch(e){}var r=l.call(e);return n&&(t?e[u]=i:delete e[u]),r},_=Object.prototype.toString;var f=function(e){return _.call(e)},g="[object Null]",p="[object Undefined]",m=a?a.toStringTag:void 0;var v=function(e){return null==e?void 0===e?p:g:m&&m in Object(e)?h(e):f(e)};var b=function(e){return null!=e&&"object"==typeof e},z="[object Symbol]";var w=function(e){return"symbol"==typeof e||b(e)&&v(e)==z},y=NaN,O=/^\s+|\s+$/g,x=/^[-+]0x[0-9a-f]+$/i,C=/^0b[01]+$/i,E=/^0o[0-7]+$/i,T=parseInt;var M=function(e){if("number"==typeof e)return e;if(w(e))return y;if(t(e)){var i="function"==typeof e.valueOf?e.valueOf():e;e=t(i)?i+"":i}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(O,"");var n=C.test(e);return n||E.test(e)?T(e.slice(2),n?2:8):x.test(e)?y:+e},S="Expected a function",j=Math.max,L=Math.min;var $=function(e,i,n){var r,o,a,c,d,l,u=0,h=!1,_=!1,f=!0;if("function"!=typeof e)throw new TypeError(S);function g(t){var i=r,n=o;return r=o=void 0,u=t,c=e.apply(n,i)}function p(e){var t=e-l;return void 0===l||t>=i||t<0||_&&e-u>=a}function m(){var e=s();if(p(e))return v(e);d=setTimeout(m,function(e){var t=i-(e-l);return _?L(t,a-(e-u)):t}(e))}function v(e){return d=void 0,f&&r?g(e):(r=o=void 0,c)}function b(){var e=s(),t=p(e);if(r=arguments,o=this,l=e,t){if(void 0===d)return function(e){return u=e,d=setTimeout(m,i),h?g(e):c}(l);if(_)return clearTimeout(d),d=setTimeout(m,i),g(l)}return void 0===d&&(d=setTimeout(m,i)),c}return i=M(i)||0,t(n)&&(h=!!n.leading,a=(_="maxWait"in n)?j(M(n.maxWait)||0,i):a,f="trailing"in n?!!n.trailing:f),b.cancel=function(){void 0!==d&&clearTimeout(d),u=0,r=l=o=d=void 0},b.flush=function(){return void 0===d?c:v(s())},b},R=null;var A=null;function N(e,t){void 0===t&&(t={});var i=document.createElement(e);return Object.keys(t).forEach(function(e){i[e]=t[e]}),i}function U(e,t,i){return(window.getComputedStyle(e,i||null)||{display:"none"})[t]}function W(e){if(!document.documentElement.contains(e))return{detached:!0,rendered:!1};for(var t=e;t!==document;){if("none"===U(t,"display"))return{detached:!1,rendered:!1};t=t.parentNode}return{detached:!1,rendered:!0}}var D='.resize-triggers{visibility:hidden;opacity:0}.resize-contract-trigger,.resize-contract-trigger:before,.resize-expand-trigger,.resize-triggers{content:"";position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden}.resize-contract-trigger,.resize-expand-trigger{background:#eee;overflow:auto}.resize-contract-trigger:before{width:200%;height:200%}',F=0,H=null;function P(e,t){if(e.__resize_mutation_handler__||(e.__resize_mutation_handler__=function(){var e=W(this),t=e.rendered,i=e.detached;t!==this.__resize_rendered__&&(!i&&this.__resize_triggers__&&(q(this),this.addEventListener("scroll",k,!0)),this.__resize_rendered__=t,B(this))}.bind(e)),!e.__resize_listeners__)if(e.__resize_listeners__=[],window.ResizeObserver){var i=e.offsetWidth,n=e.offsetHeight,r=new ResizeObserver(function(){(e.__resize_observer_triggered__||(e.__resize_observer_triggered__=!0,e.offsetWidth!==i||e.offsetHeight!==n))&&B(e)}),o=W(e),s=o.detached,a=o.rendered;e.__resize_observer_triggered__=!1===s&&!1===a,e.__resize_observer__=r,r.observe(e)}else if(e.attachEvent&&e.addEventListener)e.__resize_legacy_resize_handler__=function(){B(e)},e.attachEvent("onresize",e.__resize_legacy_resize_handler__),document.addEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);else if(F||(H=function(e){var t=document.createElement("style");return t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),(document.querySelector("head")||document.body).appendChild(t),t}(D)),function(e){var t=U(e,"position");t&&"static"!==t||(e.style.position="relative");e.__resize_old_position__=t,e.__resize_last__={};var i=N("div",{className:"resize-triggers"}),n=N("div",{className:"resize-expand-trigger"}),r=N("div"),o=N("div",{className:"resize-contract-trigger"});n.appendChild(r),i.appendChild(n),i.appendChild(o),e.appendChild(i),e.__resize_triggers__={triggers:i,expand:n,expandChild:r,contract:o},q(e),e.addEventListener("scroll",k,!0),e.__resize_last__={width:e.offsetWidth,height:e.offsetHeight}}(e),e.__resize_rendered__=W(e).rendered,window.MutationObserver){var c=new MutationObserver(e.__resize_mutation_handler__);c.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__resize_mutation_observer__=c}e.__resize_listeners__.push(t),F++}function k(){var e,t,i=this;q(this),this.__resize_raf__&&(e=this.__resize_raf__,A||(A=(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}).bind(window)),A(e)),this.__resize_raf__=(t=function(){var e,t,n,r,o,s,a=(t=(e=i).__resize_last__,n=t.width,r=t.height,o=e.offsetWidth,s=e.offsetHeight,o!==n||s!==r?{width:o,height:s}:null);a&&(i.__resize_last__=a,B(i))},R||(R=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return setTimeout(e,16)}).bind(window)),R(t))}function B(e){e&&e.__resize_listeners__&&e.__resize_listeners__.forEach(function(t){t.call(e)})}function q(e){var t=e.__resize_triggers__,i=t.expand,n=t.expandChild,r=t.contract,o=r.scrollWidth,s=r.scrollHeight,a=i.offsetWidth,c=i.offsetHeight,d=i.scrollWidth,l=i.scrollHeight;r.scrollLeft=o,r.scrollTop=s,n.style.width=a+1+"px",n.style.height=c+1+"px",i.scrollLeft=d,i.scrollTop=l}var G=["legendselectchanged","legendselected","legendunselected","legendscroll","datazoom","datarangeselected","timelinechanged","timelineplaychanged","restore","dataviewchanged","magictypechanged","geoselectchanged","geoselected","geounselected","pieselectchanged","pieselected","pieunselected","mapselectchanged","mapselected","mapunselected","axisareaselected","focusnodeadjacency","unfocusnodeadjacency","brush","brushselected","rendered","finished","click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"],I=["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],V=["theme","initOptions","autoresize"],X=["manualUpdate","watchShallow"],J={props:{options:Object,theme:[String,Object],initOptions:Object,group:String,autoresize:Boolean,watchShallow:Boolean,manualUpdate:Boolean},data:function(){return{lastArea:0}},watch:{group:function(e){this.chart.group=e}},methods:{mergeOptions:function(e,t,i){this.manualUpdate&&(this.manualOptions=e),this.chart?this.delegateMethod("setOption",e,t,i):this.init(e)},appendData:function(e){this.delegateMethod("appendData",e)},resize:function(e){this.delegateMethod("resize",e)},dispatchAction:function(e){this.delegateMethod("dispatchAction",e)},convertToPixel:function(e,t){return this.delegateMethod("convertToPixel",e,t)},convertFromPixel:function(e,t){return this.delegateMethod("convertFromPixel",e,t)},containPixel:function(e,t){return this.delegateMethod("containPixel",e,t)},showLoading:function(e,t){this.delegateMethod("showLoading",e,t)},hideLoading:function(){this.delegateMethod("hideLoading")},getDataURL:function(e){return this.delegateMethod("getDataURL",e)},getConnectedDataURL:function(e){return this.delegateMethod("getConnectedDataURL",e)},clear:function(){this.delegateMethod("clear")},dispose:function(){this.delegateMethod("dispose")},delegateMethod:function(e){for(var t,i=[],n=arguments.length-1;n-- >0;)i[n]=arguments[n+1];return this.chart||this.init(),(t=this.chart)[e].apply(t,i)},delegateGet:function(e){return this.chart||this.init(),this.chart[e]()},getArea:function(){return this.$el.offsetWidth*this.$el.offsetHeight},init:function(t){var i=this;if(!this.chart){var n=e.init(this.$el,this.theme,this.initOptions);this.group&&(n.group=this.group),n.setOption(t||this.manualOptions||this.options||{},!0),G.forEach(function(e){n.on(e,function(t){i.$emit(e,t)})}),I.forEach(function(e){n.getZr().on(e,function(t){i.$emit("zr:"+e,t)})}),this.autoresize&&(this.lastArea=this.getArea(),this.__resizeHandler=$(function(){0===i.lastArea?(i.mergeOptions({},!0),i.resize(),i.mergeOptions(i.options||i.manualOptions||{},!0)):i.resize(),i.lastArea=i.getArea()},100,{leading:!0}),P(this.$el,this.__resizeHandler)),Object.defineProperties(this,{width:{configurable:!0,get:function(){return i.delegateGet("getWidth")}},height:{configurable:!0,get:function(){return i.delegateGet("getHeight")}},isDisposed:{configurable:!0,get:function(){return!!i.delegateGet("isDisposed")}},computedOptions:{configurable:!0,get:function(){return i.delegateGet("getOption")}}}),this.chart=n}},initOptionsWatcher:function(){var e=this;this.__unwatchOptions&&(this.__unwatchOptions(),this.__unwatchOptions=null),this.manualUpdate||(this.__unwatchOptions=this.$watch("options",function(t,i){!e.chart&&t?e.init():e.chart.setOption(t,t!==i)},{deep:!this.watchShallow}))},destroy:function(){this.autoresize&&function(e,t){if(e.detachEvent&&e.removeEventListener)return e.detachEvent("onresize",e.__resize_legacy_resize_handler__),void document.removeEventListener("DOMSubtreeModified",e.__resize_mutation_handler__);var i=e.__resize_listeners__;i&&(i.splice(i.indexOf(t),1),i.length||(e.__resize_observer__?(e.__resize_observer__.unobserve(e),e.__resize_observer__.disconnect(),e.__resize_observer__=null):(e.__resize_mutation_observer__&&(e.__resize_mutation_observer__.disconnect(),e.__resize_mutation_observer__=null),e.removeEventListener("scroll",k),e.removeChild(e.__resize_triggers__.triggers),e.__resize_triggers__=null),e.__resize_listeners__=null),!--F&&H&&H.parentNode.removeChild(H))}(this.$el,this.__resizeHandler),this.dispose(),this.chart=null},refresh:function(){this.chart&&(this.destroy(),this.init())}},created:function(){var e=this;this.initOptionsWatcher(),V.forEach(function(t){e.$watch(t,function(){e.refresh()},{deep:!0})}),X.forEach(function(t){e.$watch(t,function(){e.initOptionsWatcher(),e.refresh()})})},mounted:function(){this.options&&this.init()},activated:function(){this.autoresize&&this.chart&&this.chart.resize()},destroyed:function(){this.chart&&this.destroy()},connect:function(t){"string"!=typeof t&&(t=t.map(function(e){return e.chart})),e.connect(t)},disconnect:function(t){e.disConnect(t)},registerMap:function(t,i,n){e.registerMap(t,i,n)},registerTheme:function(t,i){e.registerTheme(t,i)},graphic:e.graphic};var Z=function(e,t,i,n,r,o,s,a,c,d){"boolean"!=typeof s&&(c=a,a=s,s=!1);var l,u="function"==typeof i?i.options:i;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),n&&(u._scopeId=n),o?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=l):t&&(l=s?function(){t.call(this,d(this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),l)if(u.functional){var h=u.render;u.render=function(e,t){return l.call(t),h(e,t)}}else{var _=u.beforeCreate;u.beforeCreate=_?[].concat(_,l):[l]}return i},K="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var Q=document.head||document.getElementsByTagName("head")[0],Y={};return Z({render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"echarts"})},staticRenderFns:[]},function(e){e&&e("data-v-32078220_0",{source:".echarts{width:600px;height:400px}",map:void 0,media:void 0})},J,void 0,!1,void 0,function(e){return function(e,t){return function(e,t){var i=K?t.media||"default":e,n=Y[i]||(Y[i]={ids:new Set,styles:[]});if(!n.ids.has(e)){n.ids.add(e);var r=t.source;if(t.map&&(r+="\n/*# sourceURL="+t.map.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),n.element||(n.element=document.createElement("style"),n.element.type="text/css",t.media&&n.element.setAttribute("media",t.media),Q.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(r),n.element.styleSheet.cssText=n.styles.filter(Boolean).join("\n");else{var o=n.ids.size-1,s=document.createTextNode(r),a=n.element.childNodes;a[o]&&n.element.removeChild(a[o]),a.length?n.element.insertBefore(s,a[o]):n.element.appendChild(s)}}}(e,t)}},void 0)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-echarts",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "description": "ECharts component for Vue.js.",
5
5
  "main": "dist/vue-echarts.js",
6
6
  "module": "components/ECharts.vue",
@@ -18,32 +18,32 @@
18
18
  "author": "Justineo (justice360@gmail.com)",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "lodash": "^4.17.11",
22
- "resize-detector": "^0.1.9"
21
+ "lodash": "^4.17.15",
22
+ "resize-detector": "^0.1.10"
23
23
  },
24
24
  "devDependencies": {
25
- "@vue/cli-plugin-babel": "^3.3.0",
26
- "@vue/cli-plugin-eslint": "^3.3.0",
27
- "@vue/cli-service": "^3.3.0",
25
+ "@vue/cli-plugin-babel": "^3.12.1",
26
+ "@vue/cli-plugin-eslint": "^3.12.1",
27
+ "@vue/cli-service": "^3.12.1",
28
28
  "@vue/eslint-config-standard": "^4.0.0",
29
- "babel-eslint": "^10.0.1",
30
- "echarts": "^4.2.0-rc.2",
31
- "echarts-liquidfill": "^2.0.4",
32
- "eslint": "^5.8.0",
33
- "eslint-plugin-vue": "^5.0.0",
34
- "promise-polyfill": "^8.1.0",
29
+ "babel-eslint": "^10.0.3",
30
+ "echarts": "^4.5.0",
31
+ "echarts-liquidfill": "^2.0.5",
32
+ "eslint": "^5.16.0",
33
+ "eslint-plugin-vue": "^5.2.3",
34
+ "promise-polyfill": "^8.1.3",
35
35
  "raw-loader": "^1.0.0",
36
- "rollup": "^1.1.0",
37
- "rollup-plugin-buble": "^0.19.6",
38
- "rollup-plugin-commonjs": "^9.2.0",
39
- "rollup-plugin-node-resolve": "^4.0.0",
40
- "rollup-plugin-terser": "^4.0.2",
41
- "rollup-plugin-vue": "^4.6.1",
42
- "stylus": "^0.54.5",
36
+ "rollup": "^1.27.8",
37
+ "rollup-plugin-buble": "^0.19.8",
38
+ "rollup-plugin-commonjs": "^9.3.4",
39
+ "rollup-plugin-node-resolve": "^4.2.4",
40
+ "rollup-plugin-terser": "^4.0.4",
41
+ "rollup-plugin-vue": "^4.7.2",
42
+ "stylus": "^0.54.7",
43
43
  "stylus-loader": "^3.0.2",
44
- "vue": "^2.5.21",
45
- "vue-template-compiler": "^2.5.21",
46
- "vuex": "^3.1.0"
44
+ "vue": "^2.6.10",
45
+ "vue-template-compiler": "^2.6.10",
46
+ "vuex": "^3.1.2"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "echarts": "^4.1.0",