@vtj/charts 0.19.21 → 0.19.23-alpha.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/dist/index.mjs +28 -28
- package/dist/index.umd.js +2 -2
- package/package.json +3 -3
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -6,25 +6,25 @@ import { kebabCase as x, camelCase as M, debounce as k } from "@vtj/utils";
|
|
|
6
6
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
7
7
|
* @name @vtj/charts
|
|
8
8
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
9
|
-
* @version 0.19.
|
|
9
|
+
* @version 0.19.23-alpha.0
|
|
10
10
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
11
11
|
*/
|
|
12
|
-
const T = "0.19.
|
|
13
|
-
function J(
|
|
12
|
+
const T = "0.19.23-alpha.0";
|
|
13
|
+
function J(a) {
|
|
14
14
|
const o = w({});
|
|
15
|
-
for (const [u, e] of Object.entries(
|
|
16
|
-
const [r, ...
|
|
15
|
+
for (const [u, e] of Object.entries(a)) {
|
|
16
|
+
const [r, ...s] = x(u).split("-");
|
|
17
17
|
if (r === "on" && typeof e == "function") {
|
|
18
|
-
const t = M(
|
|
18
|
+
const t = M(s.join("-"));
|
|
19
19
|
o[t] = e;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
return o;
|
|
23
23
|
}
|
|
24
|
-
function L(
|
|
24
|
+
function L(a, o, u) {
|
|
25
25
|
const e = f(), r = J(u);
|
|
26
26
|
return v(() => {
|
|
27
|
-
const t = b(
|
|
27
|
+
const t = b(a);
|
|
28
28
|
if (t && (e.value || (e.value = S(h.init(t))), e.value)) {
|
|
29
29
|
for (const [i, n] of Object.entries(r))
|
|
30
30
|
e.value.on(i, n);
|
|
@@ -43,7 +43,7 @@ function L(s, o, u) {
|
|
|
43
43
|
},
|
|
44
44
|
{ deep: !0 }
|
|
45
45
|
), E(
|
|
46
|
-
|
|
46
|
+
a,
|
|
47
47
|
k(() => {
|
|
48
48
|
e.value && e.value.resize();
|
|
49
49
|
}, 150)
|
|
@@ -52,31 +52,31 @@ function L(s, o, u) {
|
|
|
52
52
|
getEChart: () => e.value
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function X(
|
|
56
|
-
const e = f(), r = j(null),
|
|
55
|
+
function X(a, o, u) {
|
|
56
|
+
const e = f(), r = j(null), s = f({}), t = async (i, n) => {
|
|
57
57
|
const c = e.value?.instance;
|
|
58
58
|
c && c.showLoading();
|
|
59
59
|
const l = typeof n == "string" ? await fetch(n).then((O) => O.json()).catch(() => null) : n;
|
|
60
60
|
return c && c.hideLoading(), l && h.registerMap(i, l), l;
|
|
61
61
|
};
|
|
62
|
-
return p([
|
|
63
|
-
r.value = await t(
|
|
62
|
+
return p([a, o], async () => {
|
|
63
|
+
r.value = await t(a.value, o.value);
|
|
64
64
|
}), p(r, (i) => {
|
|
65
65
|
if (i) {
|
|
66
66
|
const n = u.option || {};
|
|
67
|
-
n.geo && (n.geo.map =
|
|
68
|
-
l?.type === "map" && (l.map =
|
|
69
|
-
}),
|
|
67
|
+
n.geo && (n.geo.map = a.value), (n.series || []).map((l) => {
|
|
68
|
+
l?.type === "map" && (l.map = a.value);
|
|
69
|
+
}), s.value = n;
|
|
70
70
|
}
|
|
71
71
|
}), v(async () => {
|
|
72
|
-
r.value = await t(
|
|
72
|
+
r.value = await t(a.value, o.value);
|
|
73
73
|
}), d(() => {
|
|
74
74
|
const i = e.value?.instance;
|
|
75
75
|
i && i.hideLoading();
|
|
76
76
|
}), {
|
|
77
77
|
chartRef: e,
|
|
78
78
|
geoJSON: r,
|
|
79
|
-
option:
|
|
79
|
+
option: s
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
const R = g({
|
|
@@ -94,19 +94,19 @@ const R = g({
|
|
|
94
94
|
type: Object
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
-
setup(
|
|
98
|
-
const { width: e, height: r, option:
|
|
97
|
+
setup(a, { expose: o, attrs: u }) {
|
|
98
|
+
const { width: e, height: r, option: s } = y(a), t = f(), i = C(() => ({
|
|
99
99
|
width: e.value,
|
|
100
100
|
height: r.value
|
|
101
|
-
})), { instance: n, getEChart: c } = L(t,
|
|
101
|
+
})), { instance: n, getEChart: c } = L(t, s, u);
|
|
102
102
|
return o({
|
|
103
103
|
elRef: t,
|
|
104
|
-
option:
|
|
104
|
+
option: s,
|
|
105
105
|
instance: n,
|
|
106
106
|
getEChart: c
|
|
107
107
|
}), {
|
|
108
108
|
elRef: t,
|
|
109
|
-
option:
|
|
109
|
+
option: s,
|
|
110
110
|
styles: i,
|
|
111
111
|
instance: n,
|
|
112
112
|
getEChart: c
|
|
@@ -129,16 +129,16 @@ const R = g({
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
emits: ["ready"],
|
|
132
|
-
async setup(
|
|
133
|
-
const { name: e, geoJson: r } = y(
|
|
132
|
+
async setup(a, { attrs: o, emit: u }) {
|
|
133
|
+
const { name: e, geoJson: r } = y(a), { chartRef: s, geoJSON: t, option: i } = X(e, r, o), n = C(() => s.value?.instance);
|
|
134
134
|
return p(t, async (c) => {
|
|
135
135
|
c && u("ready", c);
|
|
136
136
|
}), {
|
|
137
|
-
chartRef:
|
|
137
|
+
chartRef: s,
|
|
138
138
|
option: i,
|
|
139
139
|
instance: n,
|
|
140
|
-
getChartRef: () =>
|
|
141
|
-
getEChart: () =>
|
|
140
|
+
getChartRef: () => s.value,
|
|
141
|
+
getEChart: () => s.value?.getEChart(),
|
|
142
142
|
geoJSON: t
|
|
143
143
|
};
|
|
144
144
|
},
|
package/dist/index.umd.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/charts
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.19.
|
|
5
|
+
* @version 0.19.23-alpha.0
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const h="0.19.
|
|
7
|
+
*/const h="0.19.23-alpha.0";function v(t){const s=Vue.reactive({});for(const[l,e]of Object.entries(t)){const[r,...i]=VtjUtils.kebabCase(l).split("-");if(r==="on"&&typeof e=="function"){const n=VtjUtils.camelCase(i.join("-"));s[n]=e}}return s}function g(t,s,l){const e=Vue.ref(),r=v(l);return Vue.onMounted(()=>{const n=Vue.unref(t);if(n&&(e.value||(e.value=Vue.markRaw(echarts.init(n))),e.value)){for(const[c,a]of Object.entries(r))e.value.on(c,a);e.value.setOption(s.value||{})}}),Vue.onUnmounted(()=>{if(e.value){for(const n of Object.keys(r))e.value.off(n);e.value.dispose()}}),Vue.watch(s,async n=>{e.value&&e.value.setOption(n||{})},{deep:!0}),VueUse.useResizeObserver(t,VtjUtils.debounce(()=>{e.value&&e.value.resize()},150)),{instance:e,getEChart:()=>e.value}}function V(t,s,l){const e=Vue.ref(),r=Vue.shallowRef(null),i=Vue.ref({}),n=async(c,a)=>{var C;const o=(C=e.value)==null?void 0:C.instance;o&&o.showLoading();const f=typeof a=="string"?await fetch(a).then(j=>j.json()).catch(()=>null):a;return o&&o.hideLoading(),f&&echarts.registerMap(c,f),f};return Vue.watch([t,s],async()=>{r.value=await n(t.value,s.value)}),Vue.watch(r,c=>{if(c){const a=l.option||{};a.geo&&(a.geo.map=t.value),(a.series||[]).map(f=>{(f==null?void 0:f.type)==="map"&&(f.map=t.value)}),i.value=a}}),Vue.onMounted(async()=>{r.value=await n(t.value,s.value)}),Vue.onUnmounted(()=>{var a;const c=(a=e.value)==null?void 0:a.instance;c&&c.hideLoading()}),{chartRef:e,geoJSON:r,option:i}}const p=Vue.defineComponent({name:"XChart",props:{width:{type:String,default:"100%"},height:{type:String,default:"400px"},option:{type:Object}},setup(t,{expose:s,attrs:l}){const{width:e,height:r,option:i}=Vue.toRefs(t),n=Vue.ref(),c=Vue.computed(()=>({width:e.value,height:r.value})),{instance:a,getEChart:o}=g(n,i,l);return s({elRef:n,option:i,instance:a,getEChart:o}),{elRef:n,option:i,styles:c,instance:a,getEChart:o}},render(){return Vue.h("div",{class:"x-chart",ref:"elRef",style:this.styles})}}),m=Vue.defineComponent({name:"XMapChart",inheritAttrs:!1,props:{geoJson:{type:[String,Object],default:"https://unpkg.com/vtj-geojson@0.1.3/geo/100000/100000.geoJson"},name:{type:String,default:"china"}},emits:["ready"],async setup(t,{attrs:s,emit:l}){const{name:e,geoJson:r}=Vue.toRefs(t),{chartRef:i,geoJSON:n,option:c}=V(e,r,s),a=Vue.computed(()=>{var o;return(o=i.value)==null?void 0:o.instance});return Vue.watch(n,async o=>{o&&l("ready",o)}),{chartRef:i,option:c,instance:a,getChartRef:()=>i.value,getEChart:()=>{var o;return(o=i.value)==null?void 0:o.getEChart()},geoJSON:n}},render(){return Vue.h(p,{...this.$attrs,ref:"chartRef",class:"x-map-chart",option:this.option},this.$slots)},methods:{}}),y=[p,m];var b=echarts;const d=Symbol("INSTALLED_KEY");function S(t){t[d]||(t[d]=!0,y.forEach(s=>{s.name&&t.component(s.name,s)}))}u.INSTALLED_KEY=d,u.VTJ_CHARTS_VERSION=h,u.XChart=p,u.XMapChart=m,u.components=y,u.echarts=b,u.install=S,u.useChart=g,u.useListeners=v,u.useMapChart=V,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/charts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.19.
|
|
4
|
+
"version": "0.19.23-alpha.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"低代码引擎",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@vueuse/core": "~14.1.0",
|
|
28
28
|
"echarts": "~5.6.0",
|
|
29
|
-
"@vtj/utils": "~0.19.
|
|
30
|
-
"@vtj/icons": "~0.19.
|
|
29
|
+
"@vtj/utils": "~0.19.23-alpha.0",
|
|
30
|
+
"@vtj/icons": "~0.19.23-alpha.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@vtj/cli": "~0.14.2"
|
package/types/version.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/charts
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.19.
|
|
5
|
+
* @version 0.19.22
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "0.19.
|
|
8
|
+
export declare const version = "0.19.22";
|