Skip to content

Commit 95b736b

Browse files
committed
fix #141: typescript error in [email protected]
1 parent a886b8b commit 95b736b

File tree

5 files changed

+206
-112
lines changed

5 files changed

+206
-112
lines changed

dist/vue3-apexcharts.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const A = [
4242
// events emitted by this component
4343
emits: A,
4444
setup(a, { emit: x }) {
45-
const g = b(null), n = b(null), f = (e) => e && typeof e == "object" && !Array.isArray(e) && e != null, S = (e, t) => {
45+
const g = b(null), t = b(null), f = (e) => e && typeof e == "object" && !Array.isArray(e) && e != null, S = (e, n) => {
4646
typeof Object.assign != "function" && function() {
4747
Object.assign = function(o) {
4848
if (o == null)
@@ -58,15 +58,15 @@ const A = [
5858
};
5959
}();
6060
let s = Object.assign({}, e);
61-
return f(e) && f(t) && Object.keys(t).forEach((o) => {
62-
f(t[o]) ? o in e ? s[o] = S(e[o], t[o]) : Object.assign(s, {
63-
[o]: t[o]
61+
return f(e) && f(n) && Object.keys(n).forEach((o) => {
62+
f(n[o]) ? o in e ? s[o] = S(e[o], n[o]) : Object.assign(s, {
63+
[o]: n[o]
6464
}) : Object.assign(s, {
65-
[o]: t[o]
65+
[o]: n[o]
6666
});
6767
}), s;
6868
}, r = async () => {
69-
if (await H(), n.value)
69+
if (await H(), t.value)
7070
return;
7171
const e = {
7272
chart: {
@@ -76,50 +76,50 @@ const A = [
7676
events: {}
7777
},
7878
series: a.series
79-
}, t = a.options.chart ? a.options.chart.events : null;
79+
}, n = a.options.chart ? a.options.chart.events : null;
8080
A.forEach((o) => {
8181
let v = (...i) => x(o, ...i);
8282
e.chart.events[o] = (...i) => {
83-
v(...i), t && t.hasOwnProperty(o) && t[o](...i);
83+
v(...i), n && n.hasOwnProperty(o) && n[o](...i);
8484
};
8585
});
8686
const s = S(a.options, e);
87-
return n.value = new w(g.value, s), n.value.render();
87+
return t.value = new w(g.value, s), t.value.render();
8888
}, d = () => (h(), r()), h = () => {
89-
n.value.destroy();
90-
}, O = (e, t) => n.value.updateSeries(e, t), y = (e, t, s, o) => n.value.updateOptions(e, t, s, o), j = (e) => n.value.toggleSeries(e), P = (e) => {
91-
n.value.showSeries(e);
89+
t.value.destroy(), t.value = null;
90+
}, O = (e, n) => t.value.updateSeries(e, n), y = (e, n, s, o) => t.value.updateOptions(e, n, s, o), j = (e) => t.value.toggleSeries(e), P = (e) => {
91+
t.value.showSeries(e);
9292
}, C = (e) => {
93-
n.value.hideSeries(e);
94-
}, E = (e, t) => n.value.appendSeries(e, t), M = () => {
95-
n.value.resetSeries();
96-
}, D = (e, t) => {
97-
n.value.toggleDataPointSelection(e, t);
98-
}, L = (e) => n.value.appendData(e), R = (e, t) => n.value.zoomX(e, t), X = (e) => n.value.dataURI(e), z = (e) => n.value.setLocale(e), I = (e, t) => {
99-
n.value.addXaxisAnnotation(e, t);
100-
}, U = (e, t) => {
101-
n.value.addYaxisAnnotation(e, t);
102-
}, B = (e, t) => {
103-
n.value.addPointAnnotation(e, t);
104-
}, T = (e, t) => {
105-
n.value.removeAnnotation(e, t);
93+
t.value.hideSeries(e);
94+
}, E = (e, n) => t.value.appendSeries(e, n), M = () => {
95+
t.value.resetSeries();
96+
}, D = (e, n) => {
97+
t.value.toggleDataPointSelection(e, n);
98+
}, L = (e) => t.value.appendData(e), R = (e, n) => t.value.zoomX(e, n), X = (e) => t.value.dataURI(e), z = (e) => t.value.setLocale(e), I = (e, n) => {
99+
t.value.addXaxisAnnotation(e, n);
100+
}, U = (e, n) => {
101+
t.value.addYaxisAnnotation(e, n);
102+
}, B = (e, n) => {
103+
t.value.addPointAnnotation(e, n);
104+
}, T = (e, n) => {
105+
t.value.removeAnnotation(e, n);
106106
}, Y = () => {
107-
n.value.clearAnnotations();
107+
t.value.clearAnnotations();
108108
};
109109
_(() => {
110110
window.ApexCharts = w;
111111
}), q(() => {
112112
g.value = K().proxy.$el, r();
113113
}), $(() => {
114-
n.value && h();
114+
t.value && h();
115115
});
116116
const u = F(a);
117117
return c(u.options, () => {
118-
!n.value && a.options ? r() : n.value.updateOptions(a.options);
118+
!t.value && a.options ? r() : t.value.updateOptions(a.options);
119119
}), c(
120120
u.series,
121121
() => {
122-
!n.value && a.series ? r() : n.value.updateSeries(a.series);
122+
!t.value && a.series ? r() : t.value.updateSeries(a.series);
123123
},
124124
{ deep: !0 }
125125
), c(u.type, () => {
@@ -129,7 +129,7 @@ const A = [
129129
}), c(u.height, () => {
130130
d();
131131
}), {
132-
chart: n,
132+
chart: t,
133133
init: r,
134134
refresh: d,
135135
destroy: h,

dist/vue3-apexcharts.umd.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(function(o,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("vue"),require("apexcharts")):typeof define=="function"&&define.amd?define(["vue","apexcharts"],u):(o=typeof globalThis<"u"?globalThis:o||self,o.VueApexCharts=u(o.Vue,o.ApexCharts))})(this,function(o,u){"use strict";const x=["animationEnd","beforeMount","mounted","updated","click","mouseMove","mouseLeave","legendClick","markerClick","selection","dataPointSelection","dataPointMouseEnter","dataPointMouseLeave","beforeZoom","beforeResetZoom","zoomed","scrolled","brushScrolled"],f=o.defineComponent({name:"apexchart",props:{options:{type:Object},type:{type:String},series:{type:Array,required:!0},width:{default:"100%"},height:{default:"auto"}},emits:x,setup(i,{emit:A}){const S=o.ref(null),n=o.ref(null),v=e=>e&&typeof e=="object"&&!Array.isArray(e)&&e!=null,g=(e,t)=>{typeof Object.assign!="function"&&function(){Object.assign=function(a){if(a==null)throw new TypeError("Cannot convert undefined or null to object");let p=Object(a);for(let r=1;r<arguments.length;r++){let d=arguments[r];if(d!=null)for(let w in d)d.hasOwnProperty(w)&&(p[w]=d[w])}return p}}();let s=Object.assign({},e);return v(e)&&v(t)&&Object.keys(t).forEach(a=>{v(t[a])?a in e?s[a]=g(e[a],t[a]):Object.assign(s,{[a]:t[a]}):Object.assign(s,{[a]:t[a]})}),s},c=async()=>{if(await o.nextTick(),n.value)return;const e={chart:{type:i.type||i.options.chart.type||"line",height:i.height,width:i.width,events:{}},series:i.series},t=i.options.chart?i.options.chart.events:null;x.forEach(a=>{let p=(...r)=>A(a,...r);e.chart.events[a]=(...r)=>{p(...r),t&&t.hasOwnProperty(a)&&t[a](...r)}});const s=g(i.options,e);return n.value=new u(S.value,s),n.value.render()},h=()=>(m(),c()),m=()=>{n.value.destroy()},b=(e,t)=>n.value.updateSeries(e,t),O=(e,t,s,a)=>n.value.updateOptions(e,t,s,a),j=e=>n.value.toggleSeries(e),P=e=>{n.value.showSeries(e)},C=e=>{n.value.hideSeries(e)},E=(e,t)=>n.value.appendSeries(e,t),M=()=>{n.value.resetSeries()},D=(e,t)=>{n.value.toggleDataPointSelection(e,t)},L=e=>n.value.appendData(e),R=(e,t)=>n.value.zoomX(e,t),T=e=>n.value.dataURI(e),X=e=>n.value.setLocale(e),q=(e,t)=>{n.value.addXaxisAnnotation(e,t)},z=(e,t)=>{n.value.addYaxisAnnotation(e,t)},I=(e,t)=>{n.value.addPointAnnotation(e,t)},U=(e,t)=>{n.value.removeAnnotation(e,t)},B=()=>{n.value.clearAnnotations()};o.onBeforeMount(()=>{window.ApexCharts=u}),o.onMounted(()=>{S.value=o.getCurrentInstance().proxy.$el,c()}),o.onBeforeUnmount(()=>{n.value&&m()});const l=o.toRefs(i);return o.watch(l.options,()=>{!n.value&&i.options?c():n.value.updateOptions(i.options)}),o.watch(l.series,()=>{!n.value&&i.series?c():n.value.updateSeries(i.series)},{deep:!0}),o.watch(l.type,()=>{h()}),o.watch(l.width,()=>{h()}),o.watch(l.height,()=>{h()}),{chart:n,init:c,refresh:h,destroy:m,updateOptions:O,updateSeries:b,toggleSeries:j,showSeries:P,hideSeries:C,resetSeries:M,zoomX:R,toggleDataPointSelection:D,appendData:L,appendSeries:E,addXaxisAnnotation:q,addYaxisAnnotation:z,addPointAnnotation:I,removeAnnotation:U,clearAnnotations:B,setLocale:X,dataURI:T}},render(){return o.h("div",{class:"vue-apexcharts"})}}),y=i=>{i.component(f.name,f)};return f.install=y,f});
1+
(function(o,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("vue"),require("apexcharts")):typeof define=="function"&&define.amd?define(["vue","apexcharts"],u):(o=typeof globalThis<"u"?globalThis:o||self,o.VueApexCharts=u(o.Vue,o.ApexCharts))})(this,function(o,u){"use strict";const x=["animationEnd","beforeMount","mounted","updated","click","mouseMove","mouseLeave","legendClick","markerClick","selection","dataPointSelection","dataPointMouseEnter","dataPointMouseLeave","beforeZoom","beforeResetZoom","zoomed","scrolled","brushScrolled"],f=o.defineComponent({name:"apexchart",props:{options:{type:Object},type:{type:String},series:{type:Array,required:!0},width:{default:"100%"},height:{default:"auto"}},emits:x,setup(i,{emit:A}){const S=o.ref(null),t=o.ref(null),v=e=>e&&typeof e=="object"&&!Array.isArray(e)&&e!=null,g=(e,n)=>{typeof Object.assign!="function"&&function(){Object.assign=function(a){if(a==null)throw new TypeError("Cannot convert undefined or null to object");let p=Object(a);for(let r=1;r<arguments.length;r++){let d=arguments[r];if(d!=null)for(let w in d)d.hasOwnProperty(w)&&(p[w]=d[w])}return p}}();let s=Object.assign({},e);return v(e)&&v(n)&&Object.keys(n).forEach(a=>{v(n[a])?a in e?s[a]=g(e[a],n[a]):Object.assign(s,{[a]:n[a]}):Object.assign(s,{[a]:n[a]})}),s},l=async()=>{if(await o.nextTick(),t.value)return;const e={chart:{type:i.type||i.options.chart.type||"line",height:i.height,width:i.width,events:{}},series:i.series},n=i.options.chart?i.options.chart.events:null;x.forEach(a=>{let p=(...r)=>A(a,...r);e.chart.events[a]=(...r)=>{p(...r),n&&n.hasOwnProperty(a)&&n[a](...r)}});const s=g(i.options,e);return t.value=new u(S.value,s),t.value.render()},h=()=>(m(),l()),m=()=>{t.value.destroy(),t.value=null},b=(e,n)=>t.value.updateSeries(e,n),O=(e,n,s,a)=>t.value.updateOptions(e,n,s,a),j=e=>t.value.toggleSeries(e),P=e=>{t.value.showSeries(e)},C=e=>{t.value.hideSeries(e)},E=(e,n)=>t.value.appendSeries(e,n),M=()=>{t.value.resetSeries()},D=(e,n)=>{t.value.toggleDataPointSelection(e,n)},L=e=>t.value.appendData(e),R=(e,n)=>t.value.zoomX(e,n),T=e=>t.value.dataURI(e),X=e=>t.value.setLocale(e),q=(e,n)=>{t.value.addXaxisAnnotation(e,n)},z=(e,n)=>{t.value.addYaxisAnnotation(e,n)},I=(e,n)=>{t.value.addPointAnnotation(e,n)},U=(e,n)=>{t.value.removeAnnotation(e,n)},B=()=>{t.value.clearAnnotations()};o.onBeforeMount(()=>{window.ApexCharts=u}),o.onMounted(()=>{S.value=o.getCurrentInstance().proxy.$el,l()}),o.onBeforeUnmount(()=>{t.value&&m()});const c=o.toRefs(i);return o.watch(c.options,()=>{!t.value&&i.options?l():t.value.updateOptions(i.options)}),o.watch(c.series,()=>{!t.value&&i.series?l():t.value.updateSeries(i.series)},{deep:!0}),o.watch(c.type,()=>{h()}),o.watch(c.width,()=>{h()}),o.watch(c.height,()=>{h()}),{chart:t,init:l,refresh:h,destroy:m,updateOptions:O,updateSeries:b,toggleSeries:j,showSeries:P,hideSeries:C,resetSeries:M,zoomX:R,toggleDataPointSelection:D,appendData:L,appendSeries:E,addXaxisAnnotation:q,addYaxisAnnotation:z,addPointAnnotation:I,removeAnnotation:U,clearAnnotations:B,setLocale:X,dataURI:T}},render(){return o.h("div",{class:"vue-apexcharts"})}}),y=i=>{i.component(f.name,f)};return f.install=y,f});

package-lock.json

Lines changed: 18 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typings/vue-apexcharts.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ApexCharts, { ApexOptions } from "apexcharts";
2-
import { Component, ComponentOptions, ComponentPublicInstance, Plugin } from "vue";
2+
import { DefineComponent, Plugin } from "vue";
33

4-
export interface VueApexChartsComponent extends ComponentPublicInstance {
4+
export interface VueApexChartsComponent {
55
// data
66
readonly chart?: ApexCharts;
77
// props
@@ -52,6 +52,8 @@ export interface VueApexChartsComponent extends ComponentPublicInstance {
5252
dataURI(options?: { scale?: number; width?: number }): Promise<void>;
5353
}
5454

55-
declare const VueApexCharts: Component & ComponentOptions<VueApexChartsComponent> & Plugin;
55+
type VueApexChartsComponentType = DefineComponent<VueApexChartsComponent>;
56+
57+
declare const VueApexCharts: VueApexChartsComponentType & Plugin;
5658

5759
export default VueApexCharts;

0 commit comments

Comments
 (0)