@idux/charts-core 0.4.0 → 0.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @idux/charts-core
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 84c8aeb: the listeners not work in vue2.x
8
+
3
9
  ## 0.4.0
4
10
 
5
11
  ### Minor Changes
@@ -2,7 +2,7 @@ import { type Ref, type ShallowRef } from 'vue-demi';
2
2
  import { type EChartsType } from 'echarts/core';
3
3
  import { type ChartProps } from '../types';
4
4
  export type MaybeRef<T> = T | Ref<T>;
5
- export declare function useChart<U extends ChartProps>(options: MaybeRef<U>): {
5
+ export declare function useChart<U extends ChartProps>(options: MaybeRef<U>, listeners?: Record<string, Function>): {
6
6
  containerRef: ShallowRef<HTMLDivElement | undefined>;
7
7
  chartRef: ShallowRef<EChartsType | undefined>;
8
8
  };
package/dist/index.js CHANGED
@@ -1,81 +1,83 @@
1
- import { DataZoomComponent as T, LegendComponent as W, GridComponent as I, TitleComponent as G, TooltipComponent as M } from "echarts/components";
2
- import { LabelLayout as V, UniversalTransition as j } from "echarts/features";
3
- import { SVGRenderer as H } from "echarts/renderers";
4
- import { watch as g, shallowRef as m, computed as d, unref as c, onMounted as N, onBeforeUnmount as P, watchEffect as A, isVue2 as U, defineComponent as Z, normalizeStyle as _, h as q } from "vue-demi";
5
- import { throttle as $, init as J, use as K, registerTheme as Q } from "echarts/core";
6
- import { isEqual as X, cloneDeep as b, isBoolean as Y, isNil as k } from "lodash-es";
7
- function ee(e, o, t) {
8
- let r;
9
- g(
10
- [e, o, t],
11
- ([n, a, l], f, F) => {
12
- !n || !a || (l ? (r ?? (r = $(() => a.resize(), 16)), te(n, r)) : y(n, r), F(() => y(n, r)));
1
+ import { DataZoomComponent as G, LegendComponent as M, GridComponent as j, TitleComponent as N, TooltipComponent as V } from "echarts/components";
2
+ import { LabelLayout as H, UniversalTransition as P } from "echarts/features";
3
+ import { SVGRenderer as U } from "echarts/renderers";
4
+ import { watch as C, shallowRef as g, computed as p, unref as f, onMounted as Z, onBeforeUnmount as _, watchEffect as y, isVue2 as z, defineComponent as q, h as $ } from "vue-demi";
5
+ import { throttle as J, init as K, use as Q, registerTheme as X } from "echarts/core";
6
+ import { isEqual as Y, cloneDeep as R, isBoolean as k, isNil as ee } from "lodash-es";
7
+ function te(e, o, r) {
8
+ let t;
9
+ C(
10
+ [e, o, r],
11
+ ([s, n, a], c, u) => {
12
+ !s || !n || (a ? (t ?? (t = J(() => n.resize(), 16)), oe(s, t)) : S(s, t), u(() => S(s, t)));
13
13
  }
14
14
  );
15
15
  }
16
- const p = /* @__PURE__ */ new Map();
17
- function te(e, o, t) {
16
+ const h = /* @__PURE__ */ new Map();
17
+ function oe(e, o, r) {
18
18
  if (!(!e || !o))
19
- if (p.has(e))
20
- p.get(e).listeners.push(o);
19
+ if (h.has(e))
20
+ h.get(e).listeners.push(o);
21
21
  else {
22
- const r = [o], n = new ResizeObserver((a) => {
23
- a.forEach((l) => r.forEach((f) => f(l)));
22
+ const t = [o], s = new ResizeObserver((n) => {
23
+ n.forEach((a) => t.forEach((c) => c(a)));
24
24
  });
25
- n.observe(e, t), p.set(e, { listeners: r, ro: n });
25
+ s.observe(e, r), h.set(e, { listeners: t, ro: s });
26
26
  }
27
27
  }
28
- function y(e, o) {
29
- if (!e || !o || !p.has(e))
28
+ function S(e, o) {
29
+ if (!e || !o || !h.has(e))
30
30
  return;
31
- const { listeners: t, ro: r } = p.get(e), n = t.indexOf(o);
32
- n > -1 && (t.splice(n, 1), t.length === 0 && (r.disconnect(), p.delete(e)));
31
+ const { listeners: r, ro: t } = h.get(e), s = r.indexOf(o);
32
+ s > -1 && (r.splice(s, 1), r.length === 0 && (t.disconnect(), h.delete(e)));
33
33
  }
34
- const R = { text: "加载中..." };
35
- function oe(e) {
36
- const o = m(), t = m(), r = m(), n = d(() => c(e).autoResize ?? !0), a = d(() => c(e).group), l = d(() => c(e).initOption), f = d(() => c(e).loading), F = d(() => c(e).setOptionOpts), C = d(() => c(e).theme ?? "seer"), v = () => {
37
- const i = o.value;
38
- if (!i)
34
+ const w = { text: "加载中..." };
35
+ function ne(e, o) {
36
+ const r = g(), t = g(), s = g(), n = p(() => f(e).autoResize ?? !0), a = p(() => f(e).group), c = p(() => f(e).initOption), u = p(() => f(e).loading), d = p(() => f(e).setOptionOpts), x = p(() => f(e).theme ?? "seer"), v = () => {
37
+ const l = r.value;
38
+ if (!l)
39
39
  return;
40
- const s = J(i, C.value, l.value), u = c(e), { restOptions: D, events: z } = S(u, !1);
41
- s.setOption(D, F.value), r.value = b(D), z.forEach(([O, E, L]) => {
42
- let h = E;
43
- L && (h = (...B) => {
44
- E(...B), s.off(O, h);
45
- }), s.on(O, h);
46
- }), u.onReady && u.onReady(s), t.value = s;
47
- }, x = () => {
40
+ const i = K(l, x.value, c.value), F = f(e), { restOptions: D, events: T } = L(F, o, !1);
41
+ i.setOption(D, d.value), s.value = R(D), T.forEach(([E, A, W]) => {
42
+ let m = A;
43
+ W && (m = (...I) => {
44
+ A(...I), i.off(E, m);
45
+ }), i.on(E, m);
46
+ });
47
+ const b = F.onReady || (o == null ? void 0 : o.ready);
48
+ b && b(i), t.value = i;
49
+ }, O = () => {
48
50
  t.value && (t.value.dispose(), t.value = void 0);
49
51
  };
50
- return N(() => v()), P(() => x()), g(
51
- () => c(e),
52
- (i) => {
53
- const s = t.value;
54
- if (!s)
52
+ return Z(() => v()), _(() => O()), C(
53
+ () => f(e),
54
+ (l) => {
55
+ const i = t.value;
56
+ if (!i)
55
57
  return;
56
- const { restOptions: u } = S(i);
57
- X(u, r.value) || (s.setOption(u, F.value), r.value = b(u));
58
+ const { restOptions: F } = L(l);
59
+ Y(F, s.value) || (i.setOption(F, d.value), s.value = R(F));
58
60
  },
59
61
  {
60
62
  deep: !0
61
63
  }
62
- ), g([C, l], () => {
63
- x(), v();
64
- }), A(() => {
65
- const i = a.value;
66
- i && t.value && (t.value.group = i);
67
- }), A(() => {
68
- const i = t.value;
69
- if (!i)
64
+ ), C([x, c], () => {
65
+ O(), v();
66
+ }), y(() => {
67
+ const l = a.value;
68
+ l && t.value && (t.value.group = l);
69
+ }), y(() => {
70
+ const l = t.value;
71
+ if (!l)
70
72
  return;
71
- const s = f.value;
72
- s ? i.showLoading(Y(s) ? R : { ...R, ...s }) : i.hideLoading();
73
- }), ee(o, t, n), { containerRef: o, chartRef: t };
73
+ const i = u.value;
74
+ i ? l.showLoading(k(i) ? w : { ...w, ...i }) : l.hideLoading();
75
+ }), te(r, t, n), { containerRef: r, chartRef: t };
74
76
  }
75
- function ne(e) {
77
+ function re(e) {
76
78
  return /^on[^a-z]/.test(e);
77
79
  }
78
- const re = [
80
+ const se = [
79
81
  "class",
80
82
  "style",
81
83
  "autoResize",
@@ -85,25 +87,53 @@ const re = [
85
87
  "theme",
86
88
  "onReady"
87
89
  ];
88
- function S(e, o = !0) {
89
- const t = {}, r = [];
90
+ function L(e, o = {}, r = !0) {
91
+ const t = {}, s = [];
90
92
  return Object.keys(e).forEach((n) => {
91
- if (!re.includes(n)) {
92
- if (ne(n)) {
93
- if (o)
93
+ if (!se.includes(n)) {
94
+ if (re(n)) {
95
+ if (r)
94
96
  return;
95
97
  const a = e[n];
96
98
  if (a) {
97
- const l = n.endsWith("Once"), f = l ? n.length - 4 : void 0, F = n.charAt(2).toLowerCase() + n.substring(3, f);
98
- r.push([F, a, l]);
99
+ const c = n.endsWith("Once"), u = c ? n.length - 4 : void 0, d = n.charAt(2).toLowerCase() + n.substring(3, u);
100
+ s.push([d, a, c]);
99
101
  }
100
102
  return;
101
103
  }
102
104
  t[n] = e[n];
103
105
  }
104
- }), { restOptions: t, events: r };
106
+ }), z && !r && Object.keys(o).forEach((n) => {
107
+ if (n !== "ready")
108
+ return;
109
+ const a = o[n];
110
+ if (a) {
111
+ const c = n.startsWith("~"), u = c ? 1 : 0, d = n.substring(u);
112
+ s.push([d, a, c]);
113
+ }
114
+ }), { restOptions: t, events: s };
105
115
  }
106
- const se = [
116
+ const B = q({
117
+ name: "IxChart",
118
+ inheritAttrs: !1,
119
+ // @ts-ignore
120
+ setup(e, { attrs: o, listeners: r }) {
121
+ const { containerRef: t } = ne(o, r);
122
+ return { containerRef: t };
123
+ },
124
+ render() {
125
+ const { class: e, style: o } = this.$attrs;
126
+ return $("div", {
127
+ ref: "containerRef",
128
+ class: e,
129
+ style: {
130
+ width: "100%",
131
+ height: "100%",
132
+ ...o
133
+ }
134
+ });
135
+ }
136
+ }), ie = [
107
137
  "#458FFF",
108
138
  "#45D9A3",
109
139
  "#FFC145",
@@ -146,8 +176,8 @@ const se = [
146
176
  "#689FFF",
147
177
  "#45D9A3",
148
178
  "#99ACD1"
149
- ], ie = {
150
- color: se,
179
+ ], ae = {
180
+ color: ie,
151
181
  textStyle: {
152
182
  color: "#2F3540",
153
183
  fontSize: "12px"
@@ -268,66 +298,43 @@ const se = [
268
298
  function ge(e) {
269
299
  return !!(e && e.xAxis && e.xAxis.data);
270
300
  }
271
- function ae(e, o) {
272
- const t = {
273
- ...e,
274
- ...o
275
- };
276
- return U ? { attrs: t } : t;
301
+ function Ce(e, o) {
302
+ return z ? { attrs: { ...e }, on: { ...o } } : { ...e };
277
303
  }
278
- function Ce(e) {
279
- return Object.entries(e).reduce((o, [t, r]) => (r !== void 0 && (o[t] = r), o), {});
304
+ function xe(e) {
305
+ return Object.entries(e).reduce((o, [r, t]) => (t !== void 0 && (o[r] = t), o), {});
280
306
  }
281
307
  function ve(e) {
282
- return k(e) ? [] : Array.isArray(e) ? e : [e];
308
+ return ee(e) ? [] : Array.isArray(e) ? e : [e];
283
309
  }
284
- function le(e, o) {
285
- K(o), Q("seer", ie);
286
- const t = (r) => {
287
- r.component(e.name, e);
310
+ function ce(e, o) {
311
+ Q(o), X("seer", ae);
312
+ const r = (t) => {
313
+ t.component(e.name, e);
288
314
  };
289
- e.install = t;
315
+ e.install = r;
290
316
  }
291
- const w = Z({
292
- name: "IxChart",
293
- inheritAttrs: !1,
294
- setup(e, { attrs: o }) {
295
- const { containerRef: t } = oe(o);
296
- return { containerRef: t };
297
- },
298
- render() {
299
- const { class: e, style: o } = this.$attrs, t = ae({
300
- class: e,
301
- style: _({
302
- width: "100%",
303
- height: "100%",
304
- ...o
305
- })
306
- });
307
- return q("div", { ref: "containerRef", ...t });
308
- }
309
- });
310
- le(w, [
311
- T,
312
- W,
313
- I,
317
+ ce(B, [
314
318
  G,
315
319
  M,
316
- V,
317
320
  j,
318
- H
321
+ N,
322
+ V,
323
+ H,
324
+ P,
325
+ U
319
326
  ]);
320
- const xe = w;
327
+ const Oe = B;
321
328
  export {
322
- xe as IxChart,
329
+ Oe as IxChart,
323
330
  ve as convertArray,
324
- le as createInstall,
325
- Ce as filterEmptyProps,
331
+ ce as createInstall,
332
+ xe as filterEmptyProps,
326
333
  ge as isVertical,
327
- ae as mergeAttrs,
328
- se as seerColors,
334
+ Ce as mergeAttrs,
335
+ ie as seerColors,
329
336
  he as seerColorsForMore,
330
337
  me as seerColorsForRisk,
331
- ie as seerTheme,
332
- oe as useChart
338
+ ae as seerTheme,
339
+ ne as useChart
333
340
  };
@@ -1 +1 @@
1
- (function(o,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("echarts/components"),require("echarts/features"),require("echarts/renderers"),require("vue-demi"),require("echarts/core"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","echarts/components","echarts/features","echarts/renderers","vue-demi","echarts/core","lodash-es"],l):(o=typeof globalThis<"u"?globalThis:o||self,l(o.IduxChartsCore={},o.echarts,o.echarts,o.echarts,o.VueDemi,o.echarts,o._))})(this,function(o,l,y,W,r,g,C){"use strict";function M(e,n,t){let i;r.watch([e,n,t],([s,f,u],F,p)=>{!s||!f||(u?(i??(i=g.throttle(()=>f.resize(),16)),G(s,i)):A(s,i),p(()=>A(s,i)))})}const h=new Map;function G(e,n,t){if(!(!e||!n))if(h.has(e))h.get(e).listeners.push(n);else{const i=[n],s=new ResizeObserver(f=>{f.forEach(u=>i.forEach(F=>F(u)))});s.observe(e,t),h.set(e,{listeners:i,ro:s})}}function A(e,n){if(!e||!n||!h.has(e))return;const{listeners:t,ro:i}=h.get(e),s=t.indexOf(n);s>-1&&(t.splice(s,1),t.length===0&&(i.disconnect(),h.delete(e)))}const x={text:"加载中..."};function m(e){const n=r.shallowRef(),t=r.shallowRef(),i=r.shallowRef(),s=r.computed(()=>r.unref(e).autoResize??!0),f=r.computed(()=>r.unref(e).group),u=r.computed(()=>r.unref(e).initOption),F=r.computed(()=>r.unref(e).loading),p=r.computed(()=>r.unref(e).setOptionOpts),L=r.computed(()=>r.unref(e).theme??"seer"),B=()=>{const c=n.value;if(!c)return;const a=g.init(c,L.value,u.value),d=r.unref(e),{restOptions:I,events:D}=w(d,!1);a.setOption(I,p.value),i.value=C.cloneDeep(I),D.forEach(([q,v,$])=>{let O=v;$&&(O=(...J)=>{v(...J),a.off(q,O)}),a.on(q,O)}),d.onReady&&d.onReady(a),t.value=a},T=()=>{t.value&&(t.value.dispose(),t.value=void 0)};return r.onMounted(()=>B()),r.onBeforeUnmount(()=>T()),r.watch(()=>r.unref(e),c=>{const a=t.value;if(!a)return;const{restOptions:d}=w(c);C.isEqual(d,i.value)||(a.setOption(d,p.value),i.value=C.cloneDeep(d))},{deep:!0}),r.watch([L,u],()=>{T(),B()}),r.watchEffect(()=>{const c=f.value;c&&t.value&&(t.value.group=c)}),r.watchEffect(()=>{const c=t.value;if(!c)return;const a=F.value;a?c.showLoading(C.isBoolean(a)?x:{...x,...a}):c.hideLoading()}),M(n,t,s),{containerRef:n,chartRef:t}}function V(e){return/^on[^a-z]/.test(e)}const j=["class","style","autoResize","group","loading","setOptionOpts","theme","onReady"];function w(e,n=!0){const t={},i=[];return Object.keys(e).forEach(s=>{if(!j.includes(s)){if(V(s)){if(n)return;const f=e[s];if(f){const u=s.endsWith("Once"),F=u?s.length-4:void 0,p=s.charAt(2).toLowerCase()+s.substring(3,F);i.push([p,f,u])}return}t[s]=e[s]}}),{restOptions:t,events:i}}const E=["#458FFF","#45D9A3","#FFC145","#F5654F","#6A6AFD","#6ED1FF","#008787","#FF9245","#F587B3","#8352CC","#65779B"],P=["#458FFF","#C8DEFF","#45D9A3","#C8F4E4","#FFC145","#FFEDC8","#F5654F","#FCD1CB","#6A6AFD","#D3D3FE","#6ED1FF","#D3D3FE","#008787","#B3DBDB","#FF9245","#FFDFC8","#F587B3","#FCDBE8","#8352CC","#FCDBE8","#65779B","#65779B"],_=["#8C1604","#DB4C35","#FF9245","#FFC145","#689FFF","#45D9A3","#99ACD1"],R={color:E,textStyle:{color:"#2F3540",fontSize:"12px"},bar:{barGap:.2,barWidth:10,label:{color:"#6F7785",position:"top"}},line:{label:{color:"#6F7785",position:"top"}},pie:{avoidLabelOverlap:!1,radius:["70%","80%"],itemStyle:{borderWidth:1,borderColor:"#fff"},label:{show:!1,color:"#2F3540",formatter:"{c}",position:"inside"}},legend:{itemWidth:12,itemHeight:12,textStyle:{color:"#6F7785",fontSize:"12px"}},title:{itemGap:4,textStyle:{color:"#2F3540",fontSize:"12px",fontWeight:500},subtextStyle:{color:"#6F7785",fontSize:"12px"}},tooltip:{borderWidth:0,padding:12,textStyle:{color:"#2F3540"},axisPointer:{z:1,lineStyle:{type:"solid",color:"#E1E5EB"}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:"#EDF1F7"}},axisTick:{show:!0,alignWithLabel:!0,lineStyle:{color:"#EDF1F7"}},axisLabel:{color:"#6F7785"},splitLine:{show:!1},splitArea:{show:!1}},valueAxis:{axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#6F7785"},splitLine:{lineStyle:{color:"#EDF1F7"}},splitArea:{show:!1},nameTextStyle:{color:"#6F7785",padding:[0,30,-4,0]}},dataZoom:{height:16}};function H(e){return!!(e&&e.xAxis&&e.xAxis.data)}function S(e,n){const t={...e,...n};return r.isVue2?{attrs:t}:t}function N(e){return Object.entries(e).reduce((n,[t,i])=>(i!==void 0&&(n[t]=i),n),{})}function U(e){return C.isNil(e)?[]:Array.isArray(e)?e:[e]}function b(e,n){g.use(n),g.registerTheme("seer",R);const t=i=>{i.component(e.name,e)};e.install=t}const z=r.defineComponent({name:"IxChart",inheritAttrs:!1,setup(e,{attrs:n}){const{containerRef:t}=m(n);return{containerRef:t}},render(){const{class:e,style:n}=this.$attrs,t=S({class:e,style:r.normalizeStyle({width:"100%",height:"100%",...n})});return r.h("div",{ref:"containerRef",...t})}});b(z,[l.DataZoomComponent,l.LegendComponent,l.GridComponent,l.TitleComponent,l.TooltipComponent,y.LabelLayout,y.UniversalTransition,W.SVGRenderer]);const Z=z;o.IxChart=Z,o.convertArray=U,o.createInstall=b,o.filterEmptyProps=N,o.isVertical=H,o.mergeAttrs=S,o.seerColors=E,o.seerColorsForMore=P,o.seerColorsForRisk=_,o.seerTheme=R,o.useChart=m,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
1
+ (function(o,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("echarts/components"),require("echarts/features"),require("echarts/renderers"),require("vue-demi"),require("echarts/core"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","echarts/components","echarts/features","echarts/renderers","vue-demi","echarts/core","lodash-es"],d):(o=typeof globalThis<"u"?globalThis:o||self,d(o.IduxChartsCore={},o.echarts,o.echarts,o.echarts,o.VueDemi,o.echarts,o._))})(this,function(o,d,y,M,r,O,g){"use strict";function V(e,n,i){let t;r.watch([e,n,i],([a,s,l],f,h)=>{!a||!s||(l?(t??(t=O.throttle(()=>s.resize(),16)),j(a,t)):A(a,t),h(()=>A(a,t)))})}const F=new Map;function j(e,n,i){if(!(!e||!n))if(F.has(e))F.get(e).listeners.push(n);else{const t=[n],a=new ResizeObserver(s=>{s.forEach(l=>t.forEach(f=>f(l)))});a.observe(e,i),F.set(e,{listeners:t,ro:a})}}function A(e,n){if(!e||!n||!F.has(e))return;const{listeners:i,ro:t}=F.get(e),a=i.indexOf(n);a>-1&&(i.splice(a,1),i.length===0&&(t.disconnect(),F.delete(e)))}const w={text:"加载中..."};function E(e,n){const i=r.shallowRef(),t=r.shallowRef(),a=r.shallowRef(),s=r.computed(()=>r.unref(e).autoResize??!0),l=r.computed(()=>r.unref(e).group),f=r.computed(()=>r.unref(e).initOption),h=r.computed(()=>r.unref(e).loading),p=r.computed(()=>r.unref(e).setOptionOpts),z=r.computed(()=>r.unref(e).theme??"seer"),B=()=>{const u=i.value;if(!u)return;const c=O.init(u,z.value,f.value),C=r.unref(e),{restOptions:I,events:J}=R(C,n,!1);c.setOption(I,p.value),a.value=g.cloneDeep(I),J.forEach(([q,v,K])=>{let x=v;K&&(x=(...Q)=>{v(...Q),c.off(q,x)}),c.on(q,x)});const W=C.onReady||(n==null?void 0:n.ready);W&&W(c),t.value=c},T=()=>{t.value&&(t.value.dispose(),t.value=void 0)};return r.onMounted(()=>B()),r.onBeforeUnmount(()=>T()),r.watch(()=>r.unref(e),u=>{const c=t.value;if(!c)return;const{restOptions:C}=R(u);g.isEqual(C,a.value)||(c.setOption(C,p.value),a.value=g.cloneDeep(C))},{deep:!0}),r.watch([z,f],()=>{T(),B()}),r.watchEffect(()=>{const u=l.value;u&&t.value&&(t.value.group=u)}),r.watchEffect(()=>{const u=t.value;if(!u)return;const c=h.value;c?u.showLoading(g.isBoolean(c)?w:{...w,...c}):u.hideLoading()}),V(i,t,s),{containerRef:i,chartRef:t}}function G(e){return/^on[^a-z]/.test(e)}const P=["class","style","autoResize","group","loading","setOptionOpts","theme","onReady"];function R(e,n={},i=!0){const t={},a=[];return Object.keys(e).forEach(s=>{if(!P.includes(s)){if(G(s)){if(i)return;const l=e[s];if(l){const f=s.endsWith("Once"),h=f?s.length-4:void 0,p=s.charAt(2).toLowerCase()+s.substring(3,h);a.push([p,l,f])}return}t[s]=e[s]}}),r.isVue2&&!i&&Object.keys(n).forEach(s=>{if(s!=="ready")return;const l=n[s];if(l){const f=s.startsWith("~"),h=f?1:0,p=s.substring(h);a.push([p,l,f])}}),{restOptions:t,events:a}}const b=r.defineComponent({name:"IxChart",inheritAttrs:!1,setup(e,{attrs:n,listeners:i}){const{containerRef:t}=E(n,i);return{containerRef:t}},render(){const{class:e,style:n}=this.$attrs;return r.h("div",{ref:"containerRef",class:e,style:{width:"100%",height:"100%",...n}})}}),m=["#458FFF","#45D9A3","#FFC145","#F5654F","#6A6AFD","#6ED1FF","#008787","#FF9245","#F587B3","#8352CC","#65779B"],N=["#458FFF","#C8DEFF","#45D9A3","#C8F4E4","#FFC145","#FFEDC8","#F5654F","#FCD1CB","#6A6AFD","#D3D3FE","#6ED1FF","#D3D3FE","#008787","#B3DBDB","#FF9245","#FFDFC8","#F587B3","#FCDBE8","#8352CC","#FCDBE8","#65779B","#65779B"],_=["#8C1604","#DB4C35","#FF9245","#FFC145","#689FFF","#45D9A3","#99ACD1"],S={color:m,textStyle:{color:"#2F3540",fontSize:"12px"},bar:{barGap:.2,barWidth:10,label:{color:"#6F7785",position:"top"}},line:{label:{color:"#6F7785",position:"top"}},pie:{avoidLabelOverlap:!1,radius:["70%","80%"],itemStyle:{borderWidth:1,borderColor:"#fff"},label:{show:!1,color:"#2F3540",formatter:"{c}",position:"inside"}},legend:{itemWidth:12,itemHeight:12,textStyle:{color:"#6F7785",fontSize:"12px"}},title:{itemGap:4,textStyle:{color:"#2F3540",fontSize:"12px",fontWeight:500},subtextStyle:{color:"#6F7785",fontSize:"12px"}},tooltip:{borderWidth:0,padding:12,textStyle:{color:"#2F3540"},axisPointer:{z:1,lineStyle:{type:"solid",color:"#E1E5EB"}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:"#EDF1F7"}},axisTick:{show:!0,alignWithLabel:!0,lineStyle:{color:"#EDF1F7"}},axisLabel:{color:"#6F7785"},splitLine:{show:!1},splitArea:{show:!1}},valueAxis:{axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#6F7785"},splitLine:{lineStyle:{color:"#EDF1F7"}},splitArea:{show:!1},nameTextStyle:{color:"#6F7785",padding:[0,30,-4,0]}},dataZoom:{height:16}};function H(e){return!!(e&&e.xAxis&&e.xAxis.data)}function U(e,n){return r.isVue2?{attrs:{...e},on:{...n}}:{...e}}function Z(e){return Object.entries(e).reduce((n,[i,t])=>(t!==void 0&&(n[i]=t),n),{})}function D(e){return g.isNil(e)?[]:Array.isArray(e)?e:[e]}function L(e,n){O.use(n),O.registerTheme("seer",S);const i=t=>{t.component(e.name,e)};e.install=i}L(b,[d.DataZoomComponent,d.LegendComponent,d.GridComponent,d.TitleComponent,d.TooltipComponent,y.LabelLayout,y.UniversalTransition,M.SVGRenderer]);const $=b;o.IxChart=$,o.convertArray=D,o.createInstall=L,o.filterEmptyProps=Z,o.isVertical=H,o.mergeAttrs=U,o.seerColors=m,o.seerColorsForMore=N,o.seerColorsForRisk=_,o.seerTheme=S,o.useChart=E,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
@@ -3,7 +3,7 @@ export type Writeable<T> = {
3
3
  -readonly [P in keyof T]: T[P];
4
4
  };
5
5
  export declare function isVertical(option: any): boolean;
6
- export declare function mergeAttrs(props: any, attrs?: any): any;
6
+ export declare function mergeAttrs(props: any, listeners?: Record<string, Function>): any;
7
7
  export declare function filterEmptyProps<T extends object>(props: T): T;
8
8
  export declare function convertArray<T>(value: T | undefined | null | Array<T | undefined | null>): T[];
9
9
  export declare function convertArray<T>(value: T | readonly T[]): readonly T[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idux/charts-core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "A UI Component Development Kit for Vue 3.x",
5
5
  "keywords": [
6
6
  "vue",