@vtj/charts 0.8.32 → 0.8.33
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/dist/index.mjs +36 -82
- package/dist/index.umd.js +3 -3
- package/package.json +4 -4
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,84 +1,38 @@
|
|
1
|
-
import {
|
2
|
-
import * as
|
3
|
-
import {
|
1
|
+
import { ref as o, onMounted as u, unref as c, markRaw as h, onUnmounted as p, watch as f, defineComponent as l, toRefs as v, computed as d, h as m } from "vue";
|
2
|
+
import * as R from "echarts";
|
3
|
+
import { useResizeObserver as g } from "@vueuse/core";
|
4
|
+
import { debounce as y } from "@vtj/utils";
|
4
5
|
/**!
|
5
6
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
6
7
|
* @name @vtj/charts
|
7
8
|
* @author CHC chenhuachun1549@dingtalk.com
|
8
|
-
* @version 0.8.
|
9
|
+
* @version 0.8.33
|
9
10
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
10
11
|
*/
|
11
|
-
const
|
12
|
-
function
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
return (n = o?.$el) != null ? n : o;
|
24
|
-
}
|
25
|
-
const A = k ? window : void 0;
|
26
|
-
function T() {
|
27
|
-
const e = a(!1), n = R();
|
28
|
-
return n && m(() => {
|
29
|
-
e.value = !0;
|
30
|
-
}, n), e;
|
31
|
-
}
|
32
|
-
function V(e) {
|
33
|
-
const n = T();
|
34
|
-
return c(() => (n.value, !!e()));
|
35
|
-
}
|
36
|
-
function D(e, n, o = {}) {
|
37
|
-
const { window: t = A, ...r } = o;
|
38
|
-
let s;
|
39
|
-
const i = V(() => t && "ResizeObserver" in t), f = () => {
|
40
|
-
s && (s.disconnect(), s = void 0);
|
41
|
-
}, w = c(() => Array.isArray(e) ? e.map((u) => d(u)) : [d(e)]), y = h(
|
42
|
-
w,
|
43
|
-
(u) => {
|
44
|
-
if (f(), i.value && t) {
|
45
|
-
s = new ResizeObserver(n);
|
46
|
-
for (const p of u)
|
47
|
-
p && s.observe(p, r);
|
48
|
-
}
|
49
|
-
},
|
50
|
-
{ immediate: !0, flush: "post" }
|
51
|
-
), l = () => {
|
52
|
-
f(), y();
|
53
|
-
};
|
54
|
-
return W(l), {
|
55
|
-
isSupported: i,
|
56
|
-
stop: l
|
57
|
-
};
|
58
|
-
}
|
59
|
-
function E(e, n, o) {
|
60
|
-
const t = a();
|
61
|
-
return m(() => {
|
62
|
-
const r = v(n);
|
63
|
-
r && (t.value || (t.value = O(e.init(r))), t.value && t.value.setOption(o.value || {}));
|
64
|
-
}), g(() => {
|
65
|
-
t.value && t.value.dispose();
|
66
|
-
}), h(
|
67
|
-
o,
|
68
|
-
(r) => {
|
69
|
-
t.value && t.value.setOption(r || {});
|
12
|
+
const S = "0.8.33";
|
13
|
+
function w(s, r, n) {
|
14
|
+
const e = o();
|
15
|
+
return u(() => {
|
16
|
+
const t = c(r);
|
17
|
+
t && (e.value || (e.value = h(s.init(t))), e.value && e.value.setOption(n.value || {}));
|
18
|
+
}), p(() => {
|
19
|
+
e.value && e.value.dispose();
|
20
|
+
}), f(
|
21
|
+
n,
|
22
|
+
(t) => {
|
23
|
+
e.value && e.value.setOption(t || {});
|
70
24
|
},
|
71
25
|
{ deep: !0 }
|
72
|
-
),
|
73
|
-
|
74
|
-
|
75
|
-
|
26
|
+
), g(
|
27
|
+
r,
|
28
|
+
y(() => {
|
29
|
+
e.value && e.value.resize();
|
76
30
|
}, 150)
|
77
31
|
), {
|
78
|
-
echartsInstance:
|
32
|
+
echartsInstance: e
|
79
33
|
};
|
80
34
|
}
|
81
|
-
const
|
35
|
+
const C = l({
|
82
36
|
name: "XChart",
|
83
37
|
props: {
|
84
38
|
width: {
|
@@ -93,25 +47,25 @@ const G = C({
|
|
93
47
|
type: Object
|
94
48
|
}
|
95
49
|
},
|
96
|
-
setup(
|
97
|
-
const { width:
|
98
|
-
width:
|
99
|
-
height:
|
100
|
-
})), { echartsInstance: i } =
|
50
|
+
setup(s) {
|
51
|
+
const { width: r, height: n, option: e } = v(s), t = o(), a = d(() => ({
|
52
|
+
width: r.value,
|
53
|
+
height: n.value
|
54
|
+
})), { echartsInstance: i } = w(R, t, e);
|
101
55
|
return {
|
102
|
-
chartRef:
|
103
|
-
option:
|
104
|
-
styles:
|
56
|
+
chartRef: t,
|
57
|
+
option: e,
|
58
|
+
styles: a,
|
105
59
|
echartsInstance: i
|
106
60
|
};
|
107
61
|
},
|
108
62
|
render() {
|
109
|
-
return
|
63
|
+
return m("div", { class: "x-chart", ref: "chartRef", style: this.styles });
|
110
64
|
},
|
111
65
|
expose: ["chartRef", "option", "echartsInstance"]
|
112
|
-
}),
|
66
|
+
}), b = [C];
|
113
67
|
export {
|
114
|
-
|
115
|
-
|
116
|
-
|
68
|
+
S as VTJ_CHARTS_VERSION,
|
69
|
+
C as XChart,
|
70
|
+
b as components
|
117
71
|
};
|
package/dist/index.umd.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
(function(t,
|
1
|
+
(function(t,i){typeof exports=="object"&&typeof module!="undefined"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(t=typeof globalThis!="undefined"?globalThis:t||self,i(t.VtjCharts={}))})(this,function(t){"use strict";/**!
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
3
3
|
* @name @vtj/charts
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
5
|
-
* @version 0.8.
|
5
|
+
* @version 0.8.33
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
7
|
-
*/const
|
7
|
+
*/const i="0.8.33";function f(u,n,o){const e=Vue.ref();return Vue.onMounted(()=>{const s=Vue.unref(n);s&&(e.value||(e.value=Vue.markRaw(u.init(s))),e.value&&e.value.setOption(o.value||{}))}),Vue.onUnmounted(()=>{e.value&&e.value.dispose()}),Vue.watch(o,s=>{e.value&&e.value.setOption(s||{})},{deep:!0}),VueUse.useResizeObserver(n,VtjUtils.debounce(()=>{e.value&&e.value.resize()},150)),{echartsInstance:e}}const a=Vue.defineComponent({name:"XChart",props:{width:{type:String,default:"100%"},height:{type:String,default:"400px"},option:{type:Object}},setup(u){const{width:n,height:o,option:e}=Vue.toRefs(u),s=Vue.ref(),l=Vue.computed(()=>({width:n.value,height:o.value})),{echartsInstance:d}=f(echarts,s,e);return{chartRef:s,option:e,styles:l,echartsInstance:d}},render(){return Vue.h("div",{class:"x-chart",ref:"chartRef",style:this.styles})},expose:["chartRef","option","echartsInstance"]}),c=[a],r=Symbol("INSTALLED_KEY");function h(u){u[r]||(u[r]=!0,c.forEach(n=>{n.name&&u.component(n.name,n)}))}t.INSTALLED_KEY=r,t.VTJ_CHARTS_VERSION=i,t.XChart=a,t.components=c,t.install=h,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vtj/charts",
|
3
3
|
"private": false,
|
4
|
-
"version": "0.8.
|
4
|
+
"version": "0.8.33",
|
5
5
|
"type": "module",
|
6
6
|
"engines": {
|
7
7
|
"node": ">=16.0.0"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
10
|
+
"@vueuse/core": "~10.9.0",
|
10
11
|
"echarts": "~5.5.0",
|
11
|
-
"@vtj/icons": "~0.8.
|
12
|
-
"@vtj/utils": "~0.8.
|
12
|
+
"@vtj/icons": "~0.8.33",
|
13
|
+
"@vtj/utils": "~0.8.33"
|
13
14
|
},
|
14
15
|
"devDependencies": {
|
15
|
-
"@vueuse/core": "~10.9.0",
|
16
16
|
"@vtj/cli": "~0.8.13"
|
17
17
|
},
|
18
18
|
"files": [
|
package/types/version.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
3
3
|
* @name @vtj/charts
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
5
|
-
* @version 0.8.
|
5
|
+
* @version 0.8.32
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
7
7
|
*/
|
8
|
-
export declare const version = "0.8.
|
8
|
+
export declare const version = "0.8.32";
|