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