@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 CHANGED
@@ -1,38 +1,84 @@
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";
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.31
8
+ * @version 0.8.32
10
9
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
11
10
  */
12
- const S = "0.8.31";
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 || {});
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
- ), g(
27
- r,
28
- y(() => {
29
- e.value && e.value.resize();
72
+ ), D(
73
+ n,
74
+ M(() => {
75
+ t.value && t.value.resize();
30
76
  }, 150)
31
77
  ), {
32
- echartsInstance: e
78
+ echartsInstance: t
33
79
  };
34
80
  }
35
- const C = l({
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(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);
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: t,
57
- option: e,
58
- styles: a,
102
+ chartRef: r,
103
+ option: t,
104
+ styles: s,
59
105
  echartsInstance: i
60
106
  };
61
107
  },
62
108
  render() {
63
- return m("div", { class: "x-chart", ref: "chartRef", style: this.styles });
109
+ return x("div", { class: "x-chart", ref: "chartRef", style: this.styles });
64
110
  },
65
111
  expose: ["chartRef", "option", "echartsInstance"]
66
- }), b = [C];
112
+ }), H = [G];
67
113
  export {
68
- S as VTJ_CHARTS_VERSION,
69
- C as XChart,
70
- b as components
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,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";/**!
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.31
5
+ * @version 0.8.32
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
- */const i="0.8.31";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"})});
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.31",
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.31",
13
- "@vtj/utils": "~0.8.31"
11
+ "@vtj/icons": "~0.8.32",
12
+ "@vtj/utils": "~0.8.32"
14
13
  },
15
14
  "devDependencies": {
16
- "@vtj/cli": "~0.8.12"
15
+ "@vueuse/core": "~10.9.0",
16
+ "@vtj/cli": "~0.8.13"
17
17
  },
18
18
  "files": [
19
19
  "dist",
@@ -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.30
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.30";
8
+ export declare const version = "0.8.31";