@idux/charts-core 0.3.0 → 0.4.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/CHANGELOG.md +6 -0
- package/dist/index.js +92 -76
- package/dist/index.umd.cjs +1 -1
- package/dist/themes/seer.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,80 +1,81 @@
|
|
|
1
|
-
import { DataZoomComponent as
|
|
2
|
-
import { LabelLayout as
|
|
3
|
-
import { SVGRenderer as
|
|
4
|
-
import { watch as g, shallowRef as m, computed as
|
|
5
|
-
import { throttle as
|
|
6
|
-
import { isEqual as
|
|
7
|
-
function
|
|
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
8
|
let r;
|
|
9
9
|
g(
|
|
10
10
|
[e, o, t],
|
|
11
|
-
([n, a, l], f,
|
|
12
|
-
!n || !a || (l ? (r ?? (r =
|
|
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)));
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
16
|
+
const p = /* @__PURE__ */ new Map();
|
|
17
|
+
function te(e, o, t) {
|
|
18
18
|
if (!(!e || !o))
|
|
19
|
-
if (
|
|
20
|
-
|
|
19
|
+
if (p.has(e))
|
|
20
|
+
p.get(e).listeners.push(o);
|
|
21
21
|
else {
|
|
22
22
|
const r = [o], n = new ResizeObserver((a) => {
|
|
23
23
|
a.forEach((l) => r.forEach((f) => f(l)));
|
|
24
24
|
});
|
|
25
|
-
n.observe(e, t),
|
|
25
|
+
n.observe(e, t), p.set(e, { listeners: r, ro: n });
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
function y(e, o) {
|
|
29
|
-
if (!e || !o || !
|
|
29
|
+
if (!e || !o || !p.has(e))
|
|
30
30
|
return;
|
|
31
|
-
const { listeners: t, ro: r } =
|
|
32
|
-
n > -1 && (t.splice(n, 1), t.length === 0 && (r.disconnect(),
|
|
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)));
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
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 = () => {
|
|
36
37
|
const i = o.value;
|
|
37
38
|
if (!i)
|
|
38
39
|
return;
|
|
39
|
-
const s =
|
|
40
|
-
s.setOption(
|
|
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]) => {
|
|
41
42
|
let h = E;
|
|
42
|
-
|
|
43
|
-
E(...
|
|
44
|
-
}), s.on(
|
|
43
|
+
L && (h = (...B) => {
|
|
44
|
+
E(...B), s.off(O, h);
|
|
45
|
+
}), s.on(O, h);
|
|
45
46
|
}), u.onReady && u.onReady(s), t.value = s;
|
|
46
|
-
},
|
|
47
|
+
}, x = () => {
|
|
47
48
|
t.value && (t.value.dispose(), t.value = void 0);
|
|
48
49
|
};
|
|
49
|
-
return
|
|
50
|
+
return N(() => v()), P(() => x()), g(
|
|
50
51
|
() => c(e),
|
|
51
52
|
(i) => {
|
|
52
53
|
const s = t.value;
|
|
53
54
|
if (!s)
|
|
54
55
|
return;
|
|
55
|
-
const { restOptions: u } =
|
|
56
|
-
|
|
56
|
+
const { restOptions: u } = S(i);
|
|
57
|
+
X(u, r.value) || (s.setOption(u, F.value), r.value = b(u));
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
deep: !0
|
|
60
61
|
}
|
|
61
|
-
), g([
|
|
62
|
-
|
|
63
|
-
}),
|
|
62
|
+
), g([C, l], () => {
|
|
63
|
+
x(), v();
|
|
64
|
+
}), A(() => {
|
|
64
65
|
const i = a.value;
|
|
65
66
|
i && t.value && (t.value.group = i);
|
|
66
|
-
}),
|
|
67
|
+
}), A(() => {
|
|
67
68
|
const i = t.value;
|
|
68
69
|
if (!i)
|
|
69
70
|
return;
|
|
70
71
|
const s = f.value;
|
|
71
|
-
s ? i.showLoading(
|
|
72
|
-
}),
|
|
72
|
+
s ? i.showLoading(Y(s) ? R : { ...R, ...s }) : i.hideLoading();
|
|
73
|
+
}), ee(o, t, n), { containerRef: o, chartRef: t };
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
+
function ne(e) {
|
|
75
76
|
return /^on[^a-z]/.test(e);
|
|
76
77
|
}
|
|
77
|
-
const
|
|
78
|
+
const re = [
|
|
78
79
|
"class",
|
|
79
80
|
"style",
|
|
80
81
|
"autoResize",
|
|
@@ -84,17 +85,17 @@ const oe = [
|
|
|
84
85
|
"theme",
|
|
85
86
|
"onReady"
|
|
86
87
|
];
|
|
87
|
-
function
|
|
88
|
+
function S(e, o = !0) {
|
|
88
89
|
const t = {}, r = [];
|
|
89
90
|
return Object.keys(e).forEach((n) => {
|
|
90
|
-
if (!
|
|
91
|
-
if (
|
|
91
|
+
if (!re.includes(n)) {
|
|
92
|
+
if (ne(n)) {
|
|
92
93
|
if (o)
|
|
93
94
|
return;
|
|
94
95
|
const a = e[n];
|
|
95
96
|
if (a) {
|
|
96
|
-
const l = n.endsWith("Once"), f = l ? n.length - 4 : void 0,
|
|
97
|
-
r.push([
|
|
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]);
|
|
98
99
|
}
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
@@ -102,7 +103,7 @@ function R(e, o = !0) {
|
|
|
102
103
|
}
|
|
103
104
|
}), { restOptions: t, events: r };
|
|
104
105
|
}
|
|
105
|
-
const
|
|
106
|
+
const se = [
|
|
106
107
|
"#458FFF",
|
|
107
108
|
"#45D9A3",
|
|
108
109
|
"#FFC145",
|
|
@@ -114,7 +115,7 @@ const ne = [
|
|
|
114
115
|
"#F587B3",
|
|
115
116
|
"#8352CC",
|
|
116
117
|
"#65779B"
|
|
117
|
-
],
|
|
118
|
+
], he = [
|
|
118
119
|
"#458FFF",
|
|
119
120
|
"#C8DEFF",
|
|
120
121
|
"#45D9A3",
|
|
@@ -137,8 +138,16 @@ const ne = [
|
|
|
137
138
|
"#FCDBE8",
|
|
138
139
|
"#65779B",
|
|
139
140
|
"#65779B"
|
|
140
|
-
],
|
|
141
|
-
|
|
141
|
+
], me = [
|
|
142
|
+
"#8C1604",
|
|
143
|
+
"#DB4C35",
|
|
144
|
+
"#FF9245",
|
|
145
|
+
"#FFC145",
|
|
146
|
+
"#689FFF",
|
|
147
|
+
"#45D9A3",
|
|
148
|
+
"#99ACD1"
|
|
149
|
+
], ie = {
|
|
150
|
+
color: se,
|
|
142
151
|
textStyle: {
|
|
143
152
|
color: "#2F3540",
|
|
144
153
|
fontSize: "12px"
|
|
@@ -159,7 +168,6 @@ const ne = [
|
|
|
159
168
|
},
|
|
160
169
|
pie: {
|
|
161
170
|
avoidLabelOverlap: !1,
|
|
162
|
-
center: ["25%", "50%"],
|
|
163
171
|
radius: ["70%", "80%"],
|
|
164
172
|
itemStyle: {
|
|
165
173
|
borderWidth: 1,
|
|
@@ -176,7 +184,7 @@ const ne = [
|
|
|
176
184
|
itemWidth: 12,
|
|
177
185
|
itemHeight: 12,
|
|
178
186
|
textStyle: {
|
|
179
|
-
color: "#
|
|
187
|
+
color: "#6F7785",
|
|
180
188
|
fontSize: "12px"
|
|
181
189
|
}
|
|
182
190
|
},
|
|
@@ -184,7 +192,7 @@ const ne = [
|
|
|
184
192
|
itemGap: 4,
|
|
185
193
|
textStyle: {
|
|
186
194
|
color: "#2F3540",
|
|
187
|
-
fontSize: "
|
|
195
|
+
fontSize: "12px",
|
|
188
196
|
fontWeight: 500
|
|
189
197
|
},
|
|
190
198
|
subtextStyle: {
|
|
@@ -199,7 +207,7 @@ const ne = [
|
|
|
199
207
|
color: "#2F3540"
|
|
200
208
|
},
|
|
201
209
|
axisPointer: {
|
|
202
|
-
z:
|
|
210
|
+
z: 1,
|
|
203
211
|
lineStyle: {
|
|
204
212
|
type: "solid",
|
|
205
213
|
color: "#E1E5EB"
|
|
@@ -254,64 +262,72 @@ const ne = [
|
|
|
254
262
|
}
|
|
255
263
|
},
|
|
256
264
|
dataZoom: {
|
|
257
|
-
height:
|
|
265
|
+
height: 16
|
|
258
266
|
}
|
|
259
267
|
};
|
|
260
|
-
function
|
|
268
|
+
function ge(e) {
|
|
261
269
|
return !!(e && e.xAxis && e.xAxis.data);
|
|
262
270
|
}
|
|
263
|
-
function
|
|
271
|
+
function ae(e, o) {
|
|
264
272
|
const t = {
|
|
265
273
|
...e,
|
|
266
274
|
...o
|
|
267
275
|
};
|
|
268
|
-
return
|
|
276
|
+
return U ? { attrs: t } : t;
|
|
269
277
|
}
|
|
270
|
-
function
|
|
278
|
+
function Ce(e) {
|
|
271
279
|
return Object.entries(e).reduce((o, [t, r]) => (r !== void 0 && (o[t] = r), o), {});
|
|
272
280
|
}
|
|
273
|
-
function
|
|
274
|
-
return
|
|
281
|
+
function ve(e) {
|
|
282
|
+
return k(e) ? [] : Array.isArray(e) ? e : [e];
|
|
275
283
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
284
|
+
function le(e, o) {
|
|
285
|
+
K(o), Q("seer", ie);
|
|
278
286
|
const t = (r) => {
|
|
279
287
|
r.component(e.name, e);
|
|
280
288
|
};
|
|
281
289
|
e.install = t;
|
|
282
290
|
}
|
|
283
|
-
const
|
|
291
|
+
const w = Z({
|
|
284
292
|
name: "IxChart",
|
|
285
293
|
inheritAttrs: !1,
|
|
286
294
|
setup(e, { attrs: o }) {
|
|
287
|
-
const { containerRef: t } =
|
|
295
|
+
const { containerRef: t } = oe(o);
|
|
288
296
|
return { containerRef: t };
|
|
289
297
|
},
|
|
290
298
|
render() {
|
|
291
|
-
const { class: e, style: o } = this.$attrs, t =
|
|
292
|
-
|
|
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 });
|
|
293
308
|
}
|
|
294
309
|
});
|
|
295
|
-
|
|
296
|
-
B,
|
|
310
|
+
le(w, [
|
|
297
311
|
T,
|
|
298
312
|
W,
|
|
299
313
|
I,
|
|
300
314
|
G,
|
|
301
315
|
M,
|
|
316
|
+
V,
|
|
302
317
|
j,
|
|
303
|
-
|
|
318
|
+
H
|
|
304
319
|
]);
|
|
305
|
-
const
|
|
320
|
+
const xe = w;
|
|
306
321
|
export {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
322
|
+
xe as IxChart,
|
|
323
|
+
ve as convertArray,
|
|
324
|
+
le as createInstall,
|
|
325
|
+
Ce as filterEmptyProps,
|
|
326
|
+
ge as isVertical,
|
|
327
|
+
ae as mergeAttrs,
|
|
328
|
+
se as seerColors,
|
|
329
|
+
he as seerColorsForMore,
|
|
330
|
+
me as seerColorsForRisk,
|
|
331
|
+
ie as seerTheme,
|
|
332
|
+
oe as useChart
|
|
317
333
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -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,
|
|
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"})});
|
package/dist/themes/seer.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const seerColors: string[];
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const seerColorsForMore: string[];
|
|
3
|
+
export declare const seerColorsForRisk: string[];
|
|
3
4
|
export declare const seerTheme: {
|
|
4
5
|
color: string[];
|
|
5
6
|
textStyle: {
|
|
@@ -22,7 +23,6 @@ export declare const seerTheme: {
|
|
|
22
23
|
};
|
|
23
24
|
pie: {
|
|
24
25
|
avoidLabelOverlap: boolean;
|
|
25
|
-
center: string[];
|
|
26
26
|
radius: string[];
|
|
27
27
|
itemStyle: {
|
|
28
28
|
borderWidth: number;
|