@idux/charts-core 0.0.4 → 0.1.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 CHANGED
@@ -1,78 +1,78 @@
1
- import { watch as h, shallowRef as v, computed as d, onMounted as w, onBeforeUnmount as T, watchEffect as E, defineComponent as y, inject as I, h as L, isVue2 as _ } from "vue-demi";
2
- import { throttle as j, init as H } from "echarts/core";
3
- import { isEqual as M, cloneDeep as x, isObject as N } from "lodash-es";
4
- function P(e, s, n) {
5
- let o;
1
+ import { watch as h, shallowRef as v, computed as l, onMounted as w, onBeforeUnmount as T, watchEffect as E, defineComponent as y, inject as I, h as L, isVue2 as P } from "vue-demi";
2
+ import { throttle as _, init as j } from "echarts/core";
3
+ import { isEqual as H, cloneDeep as x, isObject as M } from "lodash-es";
4
+ function N(e, o, t) {
5
+ let s;
6
6
  h(
7
- [e, s, n],
8
- ([t, a, r], u, l) => {
9
- !t || !a || (r ? (o ?? (o = j(() => a.resize(), 16)), W(t, o)) : z(t, o), l(() => z(t, o)));
7
+ [e, o, t],
8
+ ([n, c, a], f, d) => {
9
+ !n || !c || (a ? (s ?? (s = _(() => c.resize(), 16)), W(n, s)) : z(n, s), d(() => z(n, s)));
10
10
  }
11
11
  );
12
12
  }
13
13
  const p = /* @__PURE__ */ new Map();
14
- function W(e, s, n) {
15
- if (!(!e || !s))
14
+ function W(e, o, t) {
15
+ if (!(!e || !o))
16
16
  if (p.has(e))
17
- p.get(e).listeners.push(s);
17
+ p.get(e).listeners.push(o);
18
18
  else {
19
- const o = [s], t = new ResizeObserver((a) => {
20
- a.forEach((r) => o.forEach((u) => u(r)));
19
+ const s = [o], n = new ResizeObserver((c) => {
20
+ c.forEach((a) => s.forEach((f) => f(a)));
21
21
  });
22
- t.observe(e, n), p.set(e, { listeners: o, ro: t });
22
+ n.observe(e, t), p.set(e, { listeners: s, ro: n });
23
23
  }
24
24
  }
25
- function z(e, s) {
26
- if (!e || !s || !p.has(e))
25
+ function z(e, o) {
26
+ if (!e || !o || !p.has(e))
27
27
  return;
28
- const { listeners: n, ro: o } = p.get(e), t = n.indexOf(s);
29
- t > -1 && (n.splice(t, 1), n.length === 0 && (o.disconnect(), p.delete(e)));
28
+ const { listeners: t, ro: s } = p.get(e), n = t.indexOf(o);
29
+ n > -1 && (t.splice(n, 1), t.length === 0 && (s.disconnect(), p.delete(e)));
30
30
  }
31
31
  function G(e) {
32
- const s = v(), n = v(), o = v(), t = d(() => e.value.autoResize ?? !0), a = d(() => e.value.group), r = d(() => e.value.initOption), u = d(() => e.value.loading), l = d(() => e.value.setOptionOpts), m = d(() => e.value.theme), C = () => {
33
- const c = s.value;
34
- if (!c)
32
+ const o = v(), t = v(), s = v(), n = l(() => e.value.autoResize ?? !0), c = l(() => e.value.group), a = l(() => e.value.initOption), f = l(() => e.value.loading), d = l(() => e.value.setOptionOpts), m = l(() => e.value.theme), C = () => {
33
+ const i = o.value;
34
+ if (!i)
35
35
  return;
36
- const i = H(c, m.value, r.value), f = e.value, { restOptions: g, events: A } = b(f, !1);
37
- i.setOption(g, l.value), o.value = x(g), A.forEach(([D, R, S]) => {
36
+ const r = j(i, m.value, a.value), u = e.value, { restOptions: O, events: A } = b(u, !1);
37
+ r.setOption(O, d.value), s.value = x(O), A.forEach(([D, R, S]) => {
38
38
  let F = R;
39
39
  S && (F = (...B) => {
40
- R(...B), i.off(D, F);
41
- }), i.on(D, F);
42
- }), f.onReady && f.onReady(i), n.value = i;
43
- }, O = () => {
44
- n.value && (n.value.dispose(), n.value = void 0);
40
+ R(...B), r.off(D, F);
41
+ }), r.on(D, F);
42
+ }), u.onReady && u.onReady(r), t.value = r;
43
+ }, g = () => {
44
+ t.value && (t.value.dispose(), t.value = void 0);
45
45
  };
46
- return w(() => C()), T(() => O()), h(
46
+ return w(() => C()), T(() => g()), h(
47
47
  e,
48
- (c) => {
49
- const i = n.value;
50
- if (!i)
48
+ (i) => {
49
+ const r = t.value;
50
+ if (!r)
51
51
  return;
52
- const { restOptions: f } = b(c);
53
- M(f, o.value) || (i.setOption(f, l.value), o.value = x(f));
52
+ const { restOptions: u } = b(i);
53
+ H(u, s.value) || (r.setOption(u, d.value), s.value = x(u));
54
54
  },
55
55
  {
56
56
  deep: !0
57
57
  }
58
58
  ), h(
59
- [m, r],
59
+ [m, a],
60
60
  () => {
61
- O(), C();
61
+ g(), C();
62
62
  },
63
63
  {
64
64
  deep: !0
65
65
  }
66
66
  ), E(() => {
67
- const c = a.value;
68
- c && n.value && (n.value.group = c);
67
+ const i = c.value;
68
+ i && t.value && (t.value.group = i);
69
69
  }), E(() => {
70
- const c = n.value;
71
- if (!c)
70
+ const i = t.value;
71
+ if (!i)
72
72
  return;
73
- const i = u.value;
74
- i ? c.showLoading(N(i) ? i : void 0) : c.hideLoading();
75
- }), P(s, n, t), { containerRef: s, chartRef: n };
73
+ const r = f.value;
74
+ r ? i.showLoading(M(r) ? r : void 0) : i.hideLoading();
75
+ }), N(o, t, n), { containerRef: o, chartRef: t };
76
76
  }
77
77
  function K(e) {
78
78
  return /^on[^a-z]/.test(e);
@@ -87,35 +87,36 @@ const q = [
87
87
  "theme",
88
88
  "onReady"
89
89
  ];
90
- function b(e, s = !0) {
91
- const n = {}, o = [];
92
- return Object.keys(e).forEach((t) => {
93
- if (!q.includes(t)) {
94
- if (K(t)) {
95
- if (s)
90
+ function b(e, o = !0) {
91
+ const t = {}, s = [];
92
+ return Object.keys(e).forEach((n) => {
93
+ if (!q.includes(n)) {
94
+ if (K(n)) {
95
+ if (o)
96
96
  return;
97
- const a = e[t];
98
- if (a) {
99
- const r = t.endsWith("Once"), u = r ? t.length - 4 : void 0, l = t.charAt(2).toLowerCase() + t.substring(3, u);
100
- o.push([l, a, r]);
97
+ const c = e[n];
98
+ if (c) {
99
+ const a = n.endsWith("Once"), f = a ? n.length - 4 : void 0, d = n.charAt(2).toLowerCase() + n.substring(3, f);
100
+ s.push([d, c, a]);
101
101
  }
102
102
  return;
103
103
  }
104
- n[t] = e[t];
104
+ t[n] = e[n];
105
105
  }
106
- }), { restOptions: n, events: o };
106
+ }), { restOptions: t, events: s };
107
107
  }
108
108
  const U = Symbol("CHART_TOKEN"), V = {
109
109
  theme: "seer"
110
110
  }, J = y({
111
111
  name: "IxChart",
112
112
  inheritAttrs: !1,
113
- setup(e, { attrs: s, expose: n }) {
114
- const o = I(U, V), t = d(() => ({ ...o, ...s })), { containerRef: a } = G(t);
115
- return n({ containerRef: a }), () => {
116
- const { class: r, style: u } = t.value;
117
- return L("div", _ ? { ref: "containerRef", attrs: { class: r, style: u } } : { ref: "containerRef", class: r, style: u });
118
- };
113
+ setup(e, { attrs: o }) {
114
+ const t = I(U, V), s = l(() => ({ ...t, ...o })), { containerRef: n } = G(s);
115
+ return { containerRef: n, mergedProps: s };
116
+ },
117
+ render() {
118
+ const { class: e, style: o } = this.mergedProps;
119
+ return L("div", P ? { ref: "containerRef", attrs: { class: e, style: o } } : { ref: "containerRef", class: e, style: o });
119
120
  }
120
121
  }), $ = J, Q = [
121
122
  "#458FFF",
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(c,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue-demi"),require("echarts/core"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue-demi","echarts/core","lodash-es"],t):(c=typeof globalThis<"u"?globalThis:c||self,t(c.IduxChartsCore={},c.VueDemi,c.echarts,c._))})(this,function(c,t,O,F){"use strict";function T(e,r,o){let s;t.watch([e,r,o],([n,l,i],f,d)=>{!n||!l||(i?(s??(s=O.throttle(()=>l.resize(),16)),y(n,s)):g(n,s),d(()=>g(n,s)))})}const p=new Map;function y(e,r,o){if(!(!e||!r))if(p.has(e))p.get(e).listeners.push(r);else{const s=[r],n=new ResizeObserver(l=>{l.forEach(i=>s.forEach(f=>f(i)))});n.observe(e,o),p.set(e,{listeners:s,ro:n})}}function g(e,r){if(!e||!r||!p.has(e))return;const{listeners:o,ro:s}=p.get(e),n=o.indexOf(r);n>-1&&(o.splice(n,1),o.length===0&&(s.disconnect(),p.delete(e)))}function v(e){const r=t.shallowRef(),o=t.shallowRef(),s=t.shallowRef(),n=t.computed(()=>e.value.autoResize??!0),l=t.computed(()=>e.value.group),i=t.computed(()=>e.value.initOption),f=t.computed(()=>e.value.loading),d=t.computed(()=>e.value.setOptionOpts),z=t.computed(()=>e.value.theme),b=()=>{const u=r.value;if(!u)return;const a=O.init(u,z.value,i.value),h=e.value,{restOptions:S,events:H}=R(h,!1);a.setOption(S,d.value),s.value=F.cloneDeep(S),H.forEach(([x,A,M])=>{let C=A;M&&(C=(...N)=>{A(...N),a.off(x,C)}),a.on(x,C)}),h.onReady&&h.onReady(a),o.value=a},w=()=>{o.value&&(o.value.dispose(),o.value=void 0)};return t.onMounted(()=>b()),t.onBeforeUnmount(()=>w()),t.watch(e,u=>{const a=o.value;if(!a)return;const{restOptions:h}=R(u);F.isEqual(h,s.value)||(a.setOption(h,d.value),s.value=F.cloneDeep(h))},{deep:!0}),t.watch([z,i],()=>{w(),b()},{deep:!0}),t.watchEffect(()=>{const u=l.value;u&&o.value&&(o.value.group=u)}),t.watchEffect(()=>{const u=o.value;if(!u)return;const a=f.value;a?u.showLoading(F.isObject(a)?a:void 0):u.hideLoading()}),T(r,o,n),{containerRef:r,chartRef:o}}function B(e){return/^on[^a-z]/.test(e)}const I=["class","style","autoResize","group","loading","setOptionOpts","theme","onReady"];function R(e,r=!0){const o={},s=[];return Object.keys(e).forEach(n=>{if(!I.includes(n)){if(B(n)){if(r)return;const l=e[n];if(l){const i=n.endsWith("Once"),f=i?n.length-4:void 0,d=n.charAt(2).toLowerCase()+n.substring(3,f);s.push([d,l,i])}return}o[n]=e[n]}}),{restOptions:o,events:s}}const E=Symbol("CHART_TOKEN"),_={theme:"seer"},j=t.defineComponent({name:"IxChart",inheritAttrs:!1,setup(e,{attrs:r,expose:o}){const s=t.inject(E,_),n=t.computed(()=>({...s,...r})),{containerRef:l}=v(n);return o({containerRef:l}),()=>{const{class:i,style:f}=n.value,d=t.isVue2?{ref:"containerRef",attrs:{class:i,style:f}}:{ref:"containerRef",class:i,style:f};return t.h("div",d)}}}),m=["#458FFF","#45D9A3","#FFC145","#F5654F","#6A6AFD","#6ED1FF","#008787","#FF9245","#F587B3","#8352CC"],L=["#458FFF","#C8DEFF","#45D9A3","#C8F4E4","#FFC145","#FFEDC8","#F5654F","#FCD1CB","#6A6AFD","#D3D3FE","#6ED1FF","#D3D3FE","#008787","#B3DBDB","#FF9245","#FFDFC8","#F587B3","#FCDBE8","#8352CC","#FCDBE8"],q={color:m,textStyle:{color:"#2F3540",fontSize:"12px"},pie:{avoidLabelOverlap:!1,center:["25%","50%"],itemStyle:{borderWidth:1,borderColor:"#fff"},label:{show:!1,formatter:"{c}",position:"inside"}},legend:{textStyle:{color:"#2F3540",fontSize:"12px"}},title:{itemGap:4,textStyle:{color:"#2F3540",fontSize:"30px"},subtextStyle:{color:"#6F7785",fontSize:"12px"}},tooltip:{borderWidth:0,padding:12}};c.CHART_TOKEN=E,c.IxChart=j,c.seerColors10=m,c.seerColors20=L,c.seerTheme=q,c.useChart=v,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue-demi"),require("echarts/core"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue-demi","echarts/core","lodash-es"],t):(c=typeof globalThis<"u"?globalThis:c||self,t(c.IduxChartsCore={},c.VueDemi,c.echarts,c._))})(this,function(c,t,O,F){"use strict";function T(e,s,n){let r;t.watch([e,s,n],([o,l,f],h,p)=>{!o||!l||(f?(r??(r=O.throttle(()=>l.resize(),16)),y(o,r)):g(o,r),p(()=>g(o,r)))})}const d=new Map;function y(e,s,n){if(!(!e||!s))if(d.has(e))d.get(e).listeners.push(s);else{const r=[s],o=new ResizeObserver(l=>{l.forEach(f=>r.forEach(h=>h(f)))});o.observe(e,n),d.set(e,{listeners:r,ro:o})}}function g(e,s){if(!e||!s||!d.has(e))return;const{listeners:n,ro:r}=d.get(e),o=n.indexOf(s);o>-1&&(n.splice(o,1),n.length===0&&(r.disconnect(),d.delete(e)))}function R(e){const s=t.shallowRef(),n=t.shallowRef(),r=t.shallowRef(),o=t.computed(()=>e.value.autoResize??!0),l=t.computed(()=>e.value.group),f=t.computed(()=>e.value.initOption),h=t.computed(()=>e.value.loading),p=t.computed(()=>e.value.setOptionOpts),z=t.computed(()=>e.value.theme),b=()=>{const a=s.value;if(!a)return;const i=O.init(a,z.value,f.value),u=e.value,{restOptions:S,events:q}=v(u,!1);i.setOption(S,p.value),r.value=F.cloneDeep(S),q.forEach(([x,A,H])=>{let C=A;H&&(C=(...M)=>{A(...M),i.off(x,C)}),i.on(x,C)}),u.onReady&&u.onReady(i),n.value=i},w=()=>{n.value&&(n.value.dispose(),n.value=void 0)};return t.onMounted(()=>b()),t.onBeforeUnmount(()=>w()),t.watch(e,a=>{const i=n.value;if(!i)return;const{restOptions:u}=v(a);F.isEqual(u,r.value)||(i.setOption(u,p.value),r.value=F.cloneDeep(u))},{deep:!0}),t.watch([z,f],()=>{w(),b()},{deep:!0}),t.watchEffect(()=>{const a=l.value;a&&n.value&&(n.value.group=a)}),t.watchEffect(()=>{const a=n.value;if(!a)return;const i=h.value;i?a.showLoading(F.isObject(i)?i:void 0):a.hideLoading()}),T(s,n,o),{containerRef:s,chartRef:n}}function B(e){return/^on[^a-z]/.test(e)}const I=["class","style","autoResize","group","loading","setOptionOpts","theme","onReady"];function v(e,s=!0){const n={},r=[];return Object.keys(e).forEach(o=>{if(!I.includes(o)){if(B(o)){if(s)return;const l=e[o];if(l){const f=o.endsWith("Once"),h=f?o.length-4:void 0,p=o.charAt(2).toLowerCase()+o.substring(3,h);r.push([p,l,f])}return}n[o]=e[o]}}),{restOptions:n,events:r}}const E=Symbol("CHART_TOKEN"),_={theme:"seer"},j=t.defineComponent({name:"IxChart",inheritAttrs:!1,setup(e,{attrs:s}){const n=t.inject(E,_),r=t.computed(()=>({...n,...s})),{containerRef:o}=R(r);return{containerRef:o,mergedProps:r}},render(){const{class:e,style:s}=this.mergedProps,n=t.isVue2?{ref:"containerRef",attrs:{class:e,style:s}}:{ref:"containerRef",class:e,style:s};return t.h("div",n)}}),m=["#458FFF","#45D9A3","#FFC145","#F5654F","#6A6AFD","#6ED1FF","#008787","#FF9245","#F587B3","#8352CC"],L=["#458FFF","#C8DEFF","#45D9A3","#C8F4E4","#FFC145","#FFEDC8","#F5654F","#FCD1CB","#6A6AFD","#D3D3FE","#6ED1FF","#D3D3FE","#008787","#B3DBDB","#FF9245","#FFDFC8","#F587B3","#FCDBE8","#8352CC","#FCDBE8"],P={color:m,textStyle:{color:"#2F3540",fontSize:"12px"},pie:{avoidLabelOverlap:!1,center:["25%","50%"],itemStyle:{borderWidth:1,borderColor:"#fff"},label:{show:!1,formatter:"{c}",position:"inside"}},legend:{textStyle:{color:"#2F3540",fontSize:"12px"}},title:{itemGap:4,textStyle:{color:"#2F3540",fontSize:"30px"},subtextStyle:{color:"#6F7785",fontSize:"12px"}},tooltip:{borderWidth:0,padding:12}};c.CHART_TOKEN=E,c.IxChart=j,c.seerColors10=m,c.seerColors20=L,c.seerTheme=P,c.useChart=R,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idux/charts-core",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "description": "A UI Component Development Kit for Vue 3.x",
5
5
  "keywords": [
6
6
  "vue",
@@ -29,10 +29,6 @@
29
29
  "files": [
30
30
  "/dist"
31
31
  ],
32
- "scripts": {
33
- "clean": "rimraf dist node_modules",
34
- "build": "rimraf dist && vite build"
35
- },
36
32
  "dependencies": {
37
33
  "echarts": "^5.4.0",
38
34
  "lodash-es": "^4.17.0",
@@ -46,5 +42,9 @@
46
42
  "@vue/composition-api": {
47
43
  "optional": true
48
44
  }
45
+ },
46
+ "scripts": {
47
+ "clean": "rimraf dist node_modules",
48
+ "build": "rimraf dist && vite build"
49
49
  }
50
- }
50
+ }