@ecan-bi/tools 1.0.20 → 1.0.22

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.es.js DELETED
@@ -1,1731 +0,0 @@
1
- /*! @ecan-bi/tools@1.0.20 */
2
- var Qe = Object.defineProperty, Pe = Object.defineProperties;
3
- var qe = Object.getOwnPropertyDescriptors;
4
- var se = Object.getOwnPropertySymbols;
5
- var Be = Object.prototype.hasOwnProperty, Ke = Object.prototype.propertyIsEnumerable;
6
- var Ye = (e, o, l) => o in e ? Qe(e, o, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[o] = l, C = (e, o) => {
7
- for (var l in o || (o = {}))
8
- Be.call(o, l) && Ye(e, l, o[l]);
9
- if (se)
10
- for (var l of se(o))
11
- Ke.call(o, l) && Ye(e, l, o[l]);
12
- return e;
13
- }, Y = (e, o) => Pe(e, qe(o));
14
- var Se = (e, o) => {
15
- var l = {};
16
- for (var t in e)
17
- Be.call(e, t) && o.indexOf(t) < 0 && (l[t] = e[t]);
18
- if (e != null && se)
19
- for (var t of se(e))
20
- o.indexOf(t) < 0 && Ke.call(e, t) && (l[t] = e[t]);
21
- return l;
22
- };
23
- var Ue = (e, o, l) => new Promise((t, c) => {
24
- var f = (n) => {
25
- try {
26
- s(l.next(n));
27
- } catch (i) {
28
- c(i);
29
- }
30
- }, r = (n) => {
31
- try {
32
- s(l.throw(n));
33
- } catch (i) {
34
- c(i);
35
- }
36
- }, s = (n) => n.done ? t(n.value) : Promise.resolve(n.value).then(f, r);
37
- s((l = l.apply(e, o)).next());
38
- });
39
- import { unref as k, computed as le } from "vue";
40
- import $ from "dayjs";
41
- import { cloneDeep as ue } from "lodash-es";
42
- const Le = (e, o) => {
43
- const l = C({
44
- dayjs: $
45
- }, o);
46
- let t = "";
47
- const c = [];
48
- for (const s in l)
49
- t += `${s},`, c.push(l[s]);
50
- t = t.replace(/,$/, "");
51
- const f = `function (${t}){return ${e}}`;
52
- let r;
53
- try {
54
- r = Function(`"use strict";return (${f})`)()(...c);
55
- } catch (s) {
56
- return e;
57
- }
58
- return r;
59
- }, te = (e = "", { textData: o, codeData: l } = {}, { useNewline: t = !1, useSpace: c = !1 } = {}) => {
60
- const f = C({}, o), r = (e || "").match(/\{(.+?)\}/g);
61
- if (r == null || r.length === 0)
62
- return e;
63
- for (let s = 0; s < r.length; s++) {
64
- const n = r[s];
65
- let i = n.slice(1, -1).trim();
66
- const a = /[\u4e00-\u9fa5a-z-_A-Z0-9]*/g, d = i.match(a);
67
- for (let y = 0; y < d.length; y++) {
68
- const m = d[y], g = f[m];
69
- g != null && (i = i.replace(m, g));
70
- }
71
- (/\(.*\)/g.test(i) || /[+/\\*]/g.test(i)) && (i = Le(i, l)), e = e.replace(n, i);
72
- }
73
- return t && (e = e == null ? void 0 : e.replace(/\n|\\n/g, "<br/>")), c && (e = e == null ? void 0 : e.replace(/\s{2,}?/g, "&nbsp;&nbsp;")), e = e.replace(/Qfw\((.*?)\)/, (s, n) => o != null && o.Qfw ? o == null ? void 0 : o.Qfw(n) : n), e;
74
- }, K = (e, o) => {
75
- if (typeof e == "string" && typeof o == "string")
76
- return e.toLocaleLowerCase().includes(o.toLocaleLowerCase());
77
- if (typeof e == "string" && Array.isArray(o)) {
78
- const l = o.length;
79
- for (let t = 0; t < l; t++) {
80
- const c = o[t];
81
- if (typeof c == "string" && e.toLocaleLowerCase().includes(c.toLocaleLowerCase()))
82
- return !0;
83
- }
84
- }
85
- return !1;
86
- }, W = (e, o) => Object.prototype.hasOwnProperty.call(e, o), ce = (e) => {
87
- const o = [];
88
- for (const l of e)
89
- l.conditions ? o.push(...ce(l.conditions)) : (l == null ? void 0 : l.dataType) === "component" && o.push(l);
90
- return o;
91
- };
92
- function Xe(e) {
93
- const o = e.split("-");
94
- let l = "";
95
- if (o != null && o.length)
96
- switch (o[o.length - 1]) {
97
- case "YYYY":
98
- l = "year";
99
- break;
100
- case "MM":
101
- l = "month";
102
- break;
103
- case "DD":
104
- l = "day";
105
- break;
106
- }
107
- return l;
108
- }
109
- const Je = (e) => e.replace(/\\n/g, `
110
- `), Ze = (e = "", o) => {
111
- var r;
112
- const l = e.match(/\{(.+?)\}/g), t = ((r = e.split(`
113
- `)) == null ? void 0 : r.length) - 1;
114
- let c = "";
115
- if (t)
116
- for (let s = 0; s < t; s++)
117
- c += `
118
- `;
119
- let f = e;
120
- if (l != null && l.length) {
121
- for (const s of l) {
122
- const n = te(
123
- s,
124
- {
125
- textData: o
126
- },
127
- {
128
- useNewline: !1,
129
- useSpace: !1
130
- }
131
- );
132
- n && (f = f.replace(s, n));
133
- }
134
- return `${c}{text|${f}}`;
135
- } else
136
- return e;
137
- };
138
- function Oe(e) {
139
- let o = "", l = "", t = "", c = "";
140
- e.indexOf(".") > -1 ? (l = e.split(".")[0], t = e.split(".")[1]) : l = e;
141
- let f = 0, r = 0;
142
- for (r = l.length - 1; r >= 0; )
143
- f % 3 === 0 && f !== 0 ? l[r] === "-" ? o += l[r] : o += "," + l[r] : o += l[r], r--, f++;
144
- return o = o.split("").reverse().join(""), e.indexOf(".") > -1 ? c = o + "." + t : c = o, c;
145
- }
146
- function el(f) {
147
- return Ue(this, arguments, function* ({ graphicConfig: e, request: o, INDICATOR_URL: l = "", PAGE_ID: t, dataSourceId: c }) {
148
- var r;
149
- try {
150
- const { leftAxisList: s = [], rightAxisList: n = [], queryColumnList: i = [], indicators: a = [] } = k(e), d = [...s, ...n, ...i, ...a], y = {};
151
- for (const m of d) {
152
- const { indexCode: g = "", parentId: A = "" } = m;
153
- A && !W(m, "calcType") && !y[A] && (y[A] = g);
154
- }
155
- if ((r = Object.keys(y)) != null && r.length) {
156
- const m = [];
157
- for (const b in y)
158
- m.push(
159
- new Promise((u, x) => {
160
- o.post(
161
- `${l}/diagram/hrpIndexWithComplex`,
162
- {
163
- pageId: t,
164
- indexGuid: b,
165
- indexCode: y[b],
166
- dataSourceId: c
167
- }
168
- ).then((S) => {
169
- var V;
170
- const { success: L, data: p = [] } = S.data;
171
- L && ((V = p == null ? void 0 : p.dataViewColumns) != null && V.length) ? u(p.dataViewColumns) : x(p);
172
- }).catch((S) => {
173
- console.error(S), x(S);
174
- });
175
- })
176
- );
177
- return (yield Promise.all(m)).reduce(
178
- (b, u) => b.filter((x) => u.find((S) => S.typeGuid === x.typeGuid))
179
- ).filter((b) => b.typeGuid);
180
- }
181
- } catch (s) {
182
- console.error(s);
183
- }
184
- return [];
185
- });
186
- }
187
- const ll = ["table", "bar", "combograph", "line", "pie", "radar", "scatter", "list", "circulate"];
188
- let _e = /* @__PURE__ */ new Map();
189
- const ol = [
190
- "keyValue",
191
- "conditionKey",
192
- "conditionLabel",
193
- "conditionName",
194
- "conditionValueType",
195
- "customValue",
196
- "id",
197
- "keyName"
198
- ], ye = (e) => _e.get(e), tl = (e, o = {}) => {
199
- const { around: l, unit: t, id: c } = e;
200
- let f = "";
201
- const { pageMode: r = "", componentList: s = [] } = (o == null ? void 0 : o.graphicConfig) || {};
202
- let n = null, i = null;
203
- if (r === "design") {
204
- const a = s == null ? void 0 : s.find((u) => u.id === c);
205
- if (!a)
206
- return [];
207
- const { interval: d, intervalUnit: y, startTime: m, endTime: g, operate: A, useCurrentTime: b } = a || {};
208
- if (b && (n = $().subtract(d, y), i = $()), m && (n = $(m)), g && (i = $(g)), A) {
209
- const { type: u, value: x, mode: S } = A;
210
- switch (u) {
211
- case "add":
212
- n = n && n.add(x, S), i = i && i.add(x, S);
213
- break;
214
- case "minus":
215
- n = n && n.subtract(x, S), i = i && i.subtract(x, S);
216
- }
217
- }
218
- } else {
219
- const a = ye(c) || {};
220
- k(a.startTime) && (n = $(k(a.startTime))), k(a.endTime) && (i = $(k(a.endTime)));
221
- }
222
- if (n && i) {
223
- const a = i.diff(n, t.toLowerCase());
224
- f = `${l === "before" ? "-" : ""}${a + 1}`;
225
- }
226
- return f ? [f] : [];
227
- }, We = (e, o) => {
228
- if (o)
229
- W(e, "indexCode") && (e.hrpIndexCode = e.indexCode, delete e.indexCode), W(e, "indexCodeNum") && (e.hrpIndexCodeNum = e.indexCodeNum, delete e.indexCodeNum), W(e, "dataType") && delete e.dataType;
230
- else {
231
- const { calcWays: l = [], dateCalcTypes: t = [], activeKey: c, componentId: f = "" } = e;
232
- if (c === 5 && (l != null && l.length) && (t != null && t.length) && f) {
233
- const r = l[0].split("-");
234
- (r == null ? void 0 : r.length) > 1 && r[0] === "rangeValue" && (e.calcWays = tl({
235
- around: r[1],
236
- unit: t[0],
237
- id: f
238
- })), delete e.radioValue;
239
- }
240
- if (W(e, "dataType")) {
241
- if (e.fieldType === "DATE" && (e.label = e.fieldName), e.dataType === "component")
242
- if (e.fieldValue === "PARENT") {
243
- let r = e.modelKey;
244
- r && e.prop && (r += `-${e.prop}`), e.fieldValue = "${" + r + "}";
245
- } else
246
- e.fieldValue = "${" + e.fieldValue + "}";
247
- delete e.dataType;
248
- }
249
- W(e, "activeKey") && delete e.activeKey, W(e, "radioValue") && delete e.radioValue, W(e, "indexCode") && (e.hrpIndexCode = e.indexCode, delete e.indexCode), W(e, "indexCodeNum") && (e.hrpIndexCodeNum = e.indexCodeNum, delete e.indexCodeNum), e.dataType !== "component" && e.useCurrentTime && (e.fieldValue = $().format(e.dateFormat)), W(e, "modelKey") && delete e.modelKey, W(e, "prop") && delete e.prop, delete e.useCurrentTime;
250
- }
251
- }, ee = (e, o) => {
252
- const l = [];
253
- return e != null && e.length && ue(e).forEach((t) => {
254
- if (t.join && t.conditions) {
255
- const c = !t.conditions.some((f) => f.join && f.conditions);
256
- t.conditions.forEach((f, r) => {
257
- We(f, o);
258
- const s = {};
259
- if (r < t.conditions.length - 1 && (s.join = t.join), c)
260
- l.push(C(C({}, s), f));
261
- else if (f.join && f.conditions) {
262
- const n = o ? "sqlConditions" : "conditions";
263
- l.push(C({
264
- [n]: ee([f], o)
265
- }, s));
266
- } else
267
- l.push(C(C({}, s), f));
268
- });
269
- } else
270
- We(t, o), l.push(t);
271
- }), l;
272
- }, Ae = (e = {}, o) => {
273
- if (e != null && e.sortCpnts && o) {
274
- const L = He(e);
275
- L && (o.sort = L);
276
- }
277
- const {
278
- label: l,
279
- name: t,
280
- location: c,
281
- show: f,
282
- indexCode: r,
283
- indexCodeNum: s,
284
- calcType: n = "COLUMN",
285
- builtInFormula: i,
286
- builtInValueSource: a,
287
- builtInCalcWay: d,
288
- formula: y,
289
- conditions: m,
290
- aggregate: g,
291
- distinct: A,
292
- dimByCount: b,
293
- dataTo: u
294
- } = e;
295
- let x;
296
- if (m && (x = ee(m)), n === "COMPONENT") {
297
- const L = {};
298
- return me(L, a), {
299
- label: l.trim(),
300
- columnName: t,
301
- show: f,
302
- calcType: n,
303
- componentAlias: d,
304
- componentValue: L.fieldValue || null
305
- };
306
- }
307
- const S = {
308
- label: l.trim(),
309
- columnName: t,
310
- location: c,
311
- show: f,
312
- calcType: u === "1" ? "VIEW" : n,
313
- hrpIndexCode: r,
314
- hrpIndexCodeNum: s,
315
- aggregate: g,
316
- builtInFormula: i,
317
- builtInValueSource: a,
318
- formula: y,
319
- conditions: x
320
- };
321
- if (i === "DATE_OFFSET") {
322
- const L = d.split("-");
323
- if ((L == null ? void 0 : L.length) === 3) {
324
- let p = L[0];
325
- return L[2] === "before" && L[0] !== "0" && (p = `-${L[0]}`), Y(C({}, S), {
326
- calcWays: [p],
327
- dateCalcTypes: [L[1]]
328
- });
329
- }
330
- } else
331
- return t === "the_count" && (S.calcType = "AGGREGATE", S.distinct = !!A, S.typeGuid = b), Y(C({}, S), {
332
- builtInCalcWay: d
333
- });
334
- }, il = (e) => {
335
- if (!e)
336
- return [];
337
- const o = ue((e == null ? void 0 : e.controlList) || []).filter((g) => g.conditionKey !== "parentCode"), {
338
- classificationList: l = [],
339
- rowHeaderList: t = [],
340
- dimensionList: c = [],
341
- seriesList: f = [],
342
- leftAxisList: r = [],
343
- rightAxisList: s = [],
344
- queryColumnList: n = [],
345
- indicators: i = []
346
- } = e;
347
- $e(o);
348
- const a = [
349
- ...l,
350
- ...t,
351
- ...c,
352
- ...f,
353
- ...r,
354
- ...s,
355
- ...n,
356
- ...i
357
- ], d = [];
358
- for (const g of a) {
359
- const A = ce((g == null ? void 0 : g.conditions) || []);
360
- if (A != null && A.length) {
361
- const b = A.filter((u) => (u == null ? void 0 : u.dataType) === "component").map((u) => {
362
- const x = {};
363
- return u != null && u.dateFormat && (x.format = u.dateFormat), u.fieldValue === "PARENT" && (x.id = "PARENT", x.keyName = u.modelKey, x.modelKey = u.modelKey, x.prop = u.prop), C({
364
- conditionKey: u.fieldName,
365
- conditionLabel: u.fieldName,
366
- conditionName: u.fieldName,
367
- conditionValueType: u.fieldType,
368
- id: u.componentId,
369
- keyName: u.fieldValue,
370
- rule: u.rule,
371
- notGlobal: !0,
372
- indexCode: u.indexCode,
373
- typeGuid: u.typeGuid,
374
- indexCodeNum: u.indexCodeNum
375
- }, x);
376
- });
377
- if (b != null && b.length)
378
- for (const u of b)
379
- d.find((x) => x.keyName === u.keyName) || d.push(u);
380
- }
381
- }
382
- const y = d.length, m = o;
383
- for (let g = 0; g < y; g++) {
384
- const A = d[g];
385
- if ((A == null ? void 0 : A.conditionKey) === "parentCode")
386
- continue;
387
- const {
388
- id: b,
389
- keyName: u,
390
- prop: x,
391
- format: S,
392
- modelKey: L,
393
- dataType: p = "component",
394
- customValue: V
395
- } = A, E = ze(A);
396
- me(E, b, { prop: x, dateFormat: S, modelKey: L, keyName: u }), p === "" && (E.fieldValue = V || ""), m.push(E);
397
- }
398
- for (let g = m.length - 1; g >= 0; g--) {
399
- const A = m[g];
400
- A.globalCondition || ce(m).find((u) => u.alias === A.alias && u.globalCondition) && m.splice(g, 1);
401
- }
402
- return m;
403
- };
404
- function ze(e) {
405
- const {
406
- id: o,
407
- keyName: l,
408
- conditionLabel: t,
409
- conditionKey: c,
410
- conditionValueType: f,
411
- prop: r,
412
- rule: s = "NONE",
413
- notGlobal: n = !1,
414
- indexCode: i,
415
- typeGuid: a,
416
- indexCodeNum: d,
417
- dataType: y = "component"
418
- } = e;
419
- let m = l || o;
420
- m && r && (m += `-${r}`);
421
- let g = s;
422
- return g === "NONE" && (["startTime", "endTime"].includes(r) ? g = r === "startTime" ? "GREATER_EQUAL" : "LESS_EQUAL" : l != null && l.includes("startTime") ? g = r === "GREATER_EQUAL" : l != null && l.includes("endTime") ? g = r === "LESS_EQUAL" : g = "EQUAL"), o === "PARENT" && (m = e.modelKey, m && r && (m += `-${r}`), g = s), {
423
- rule: g,
424
- label: t,
425
- fieldName: c,
426
- fieldValue: "",
427
- // 在关联控件中取
428
- // dateFormat: 'YYYY-MM',
429
- valueType: f,
430
- alias: m,
431
- globalCondition: !n,
432
- indexCode: i,
433
- typeGuid: a,
434
- indexCodeNum: d,
435
- dataType: y
436
- };
437
- }
438
- function $e(e) {
439
- if (e != null && e.length)
440
- for (const o of e)
441
- if (o != null && o.conditions)
442
- $e(o.conditions);
443
- else {
444
- const {
445
- id: l,
446
- keyName: t,
447
- prop: c,
448
- modelKey: f,
449
- format: r,
450
- dataType: s = "component",
451
- customValue: n
452
- } = o, i = ze(o);
453
- me(i, l, { prop: c, dateFormat: r, modelKey: f, keyName: t }), s === "" && (i.fieldValue = n || "");
454
- for (const a in i)
455
- o[a] = i[a];
456
- for (const a of ol)
457
- delete o[a];
458
- }
459
- }
460
- function nl(e) {
461
- const o = [];
462
- if (e != null && e.length) {
463
- for (const l of e)
464
- if (l.variableName) {
465
- const t = {
466
- variateName: l.variableName,
467
- globalCondition: !1,
468
- valueType: l.variableType,
469
- alias: l.keyName || ""
470
- };
471
- me(t, l.id, {
472
- dateFormat: l.format,
473
- prop: l.dateTypeValue,
474
- keyName: l.keyName,
475
- operateType: l.operateType,
476
- operateMode: l.operateMode,
477
- operateValue: l.operateValue
478
- }), l.dataType === "" && (t.fieldValue = l.variableValue), l.format && (t.dateFormat = l.format), l.label && (t.label = l.label), o.push(t);
479
- }
480
- }
481
- return o;
482
- }
483
- function me(e, o, l) {
484
- const { prop: t = "", dateFormat: c = "", modelKey: f = "", keyName: r = "", operateValue: s, operateMode: n, operateType: i } = l || {}, a = f || r;
485
- if (o === "PARENT" && a && t) {
486
- const x = window.config.record;
487
- let S = t, L = c;
488
- const p = t.match(/\{(.+?)\}/g);
489
- if (p != null && p.length) {
490
- const V = p[0].slice(1, -1).trim();
491
- S = t.replace(p[0], ""), L = V, e.dateFormat = L;
492
- }
493
- if (x && x[a]) {
494
- const V = k(x[a][S]);
495
- $.isDayjs(V) ? e.fieldValue = V.format(L || "YYYY-MM-DD") : e.fieldValue = V;
496
- }
497
- return;
498
- }
499
- const d = ye(o) || {}, { value: y, format: m = "YYYY-MM-DD", type: g = "", useCurrentTime: A, RECORD: b } = d || {}, u = c || m;
500
- if (K(d.type, "date")) {
501
- let x;
502
- if (A ? y ? x = k(y) : x = $() : x = k(y), s && n && i)
503
- switch (i) {
504
- case "add":
505
- x = x.add(s, n);
506
- break;
507
- case "minus":
508
- x = x.subtract(s, n);
509
- break;
510
- }
511
- e.fieldValue = x == null ? void 0 : x.format(u), e.dateFormat = u;
512
- } else if (g === "ecanRangePicker") {
513
- let x = t;
514
- if (!t) {
515
- const L = r && r.split("-");
516
- L != null && L.length && (x = L[L.length - 1]);
517
- }
518
- if (!x)
519
- return;
520
- let S = null;
521
- if (k(d[x]) && (S = $(k(d[x]))), s && n && i) {
522
- if (s === "rangeValue") {
523
- if (d.startTime && d.endTime) {
524
- const L = k(d.endTime).diff(k(d.startTime), n) + 1;
525
- switch (i) {
526
- case "add":
527
- S = S && S.add(L, n);
528
- break;
529
- case "minus":
530
- S = S && S.subtract(L, n);
531
- }
532
- }
533
- } else if (!isNaN(+s))
534
- switch (i) {
535
- case "add":
536
- S = S && S.add(s, n);
537
- break;
538
- case "minus":
539
- S = S && S.subtract(s, n);
540
- }
541
- }
542
- if (S && (e.fieldValue = S == null ? void 0 : S.format(u)), x === "rangeValue" && d.startTime && d.endTime) {
543
- const L = Xe(u);
544
- L && (e.fieldValue = k(d.endTime).diff(k(d.startTime), L) + 1);
545
- }
546
- e.dateFormat = u;
547
- } else
548
- K(g, ll) ? f && b ? e.fieldValue = b[f] : !f && b ? e.fieldValue = b.value : e.fieldValue = k(y) : e.fieldValue = k(y);
549
- }
550
- const fe = (e) => {
551
- var o;
552
- if (e) {
553
- const l = Array.isArray(e) ? ue(e) : [ue(e)];
554
- let t = "", c = [];
555
- const f = [], r = [], s = [];
556
- for (const n of l) {
557
- if (n.defaultCode && (n.label = n.columnName, delete n.defaultCode), n.type === "CUSTOM" && (c = n.customOrderColumns), t = n.type, f.push(n.label), (o = n.columnName) != null && o.includes("_ecanrepeat_")) {
558
- const i = n.columnName.split("_ecanrepeat_");
559
- r.push(i[0]);
560
- } else
561
- r.push(n.columnName);
562
- s.push(n.order);
563
- }
564
- return t !== "CUSTOM" && (f == null ? void 0 : f.length) > 1 && (t = "COMBINATION"), t === "CUSTOM" ? {
565
- label: f.join(","),
566
- columnName: r.join(","),
567
- type: t,
568
- customOrderColumns: c
569
- } : {
570
- label: f.join(","),
571
- columnName: r.join(","),
572
- order: s.join(","),
573
- type: t
574
- };
575
- } else
576
- return e;
577
- }, He = (e) => {
578
- const { sortCpnts: o = [] } = e;
579
- let l, t = "";
580
- for (const c of o) {
581
- const f = ye(c) || {}, { type: r, RECORD: s } = f;
582
- if (K(r, "image") && K(s == null ? void 0 : s.value, ["asc", "desc"])) {
583
- t = s.value.toUpperCase();
584
- break;
585
- }
586
- }
587
- return t && (l = {
588
- label: e.label,
589
- columnName: e.name,
590
- order: t,
591
- type: "NORMAL"
592
- }), l;
593
- }, rl = (e, o = {}) => {
594
- var pe, Ne, Fe, ve, ke, Ve, Ie, Ee, Ge, De;
595
- const { graphicConfig: l, type: t, globalModel: c, isGroupTable: f = !1 } = e;
596
- c && (_e = c);
597
- const r = K(t, "pivottable");
598
- let {
599
- source: s,
600
- dataViewId: n,
601
- plugin: i = "1",
602
- // 插件类型
603
- layer: a,
604
- // 后台图表类型,值分0,1
605
- chartType: d,
606
- // 前端图表类型
607
- classificationList: y = [],
608
- rowHeaderList: m = [],
609
- dimensionList: g = [],
610
- // 文本组件的维度列表
611
- seriesList: A = [],
612
- leftAxisList: b = [],
613
- rightAxisList: u = [],
614
- queryColumnList: x = [],
615
- indicators: S = [],
616
- controlList: L = [],
617
- formFields: p = {},
618
- variableList: V = [],
619
- variableConditions: E = [],
620
- // dataSourceId, // 所属数据源ID
621
- idxLibMode: ne,
622
- // 指标库模式, source= INDICATOR_LIB时候必填, NORMAL_YEAR_TABLE = 普通年表, WITH_DATE_DIM_TABLE = 带有时间维度表
623
- preview: re = !1,
624
- // 预览开关
625
- edvDataSetId: ae
626
- // 数据集id
627
- } = l || {}, I = [];
628
- if ((l == null ? void 0 : l.pageMode) === "design" ? (I = ((pe = l.sqlConditions) != null ? pe : []).map((w) => {
629
- const N = {};
630
- if (!W(w, "globalCondition") && !w.join && (N.globalCondition = !0), !w.join) {
631
- const T = w.rule || "EQUAL";
632
- N.rule = T === "NONE" ? "EQUAL" : T;
633
- }
634
- return C(C({}, w), N);
635
- }), E != null && E.length && (I = I.concat(E))) : (I = il(l), V != null && V.length && (I = I.concat(nl(V)))), I != null && I.length) {
636
- const w = I.filter((T) => T.globalCondition), N = I.filter((T) => !T.globalCondition);
637
- (w == null ? void 0 : w.length) > 1 && (I = [
638
- {
639
- join: "&&",
640
- conditions: w
641
- },
642
- ...N
643
- ]);
644
- }
645
- I != null && I.length && (I = ee(I, "1")), a == null && (K(t, ["table", "card"]) || K(t, ["list", "circulate"]) && (y == null ? void 0 : y.length) > 1 ? a = "1" : K(t, ["select", "checkbox", "radio"]) ? a = "3" : a = "2");
646
- let H;
647
- const we = [];
648
- let xe = "";
649
- if (Array.isArray(y) && y.length > 0 && (!["ecanList", "ecanCirculate"].includes(t) || (y == null ? void 0 : y.length) === 1)) {
650
- const w = y.length;
651
- for (let N = 0; N < w; N++) {
652
- const T = y[N] || {}, {
653
- label: G = "",
654
- name: D = "",
655
- show: j = !1,
656
- sort: Q,
657
- customGroup: q,
658
- conditions: F,
659
- dateFormat: v,
660
- typeGuid: R = "",
661
- truncations: h = []
662
- } = T;
663
- if (j || w === 1) {
664
- xe = R, H = {
665
- label: G.trim(),
666
- columnName: D,
667
- show: j,
668
- sort: He(T) || fe(Q) || Q,
669
- customGroup: q,
670
- conditions: ee(F),
671
- typeGuid: R
672
- }, v && (H.dateFormat = v), D === "the_date" && !H.dateFormat && (H.dateFormat = "YYYY-MM");
673
- const M = {};
674
- if (Array.isArray(h) && h.length > 0) {
675
- const U = h.length;
676
- for (let _ = 0; _ < U; _++) {
677
- const z = h[_] || {}, { rule: P = "", num: X = 0, name: O = "" } = z;
678
- P && X && (M.num = X, M.rule = P, O && (M.otherGroupName = O));
679
- }
680
- }
681
- if ((Ne = Object.keys(M)) != null && Ne.length && (H.truncation = M), K(t, ["scatter", "valueline"]))
682
- we.push(H);
683
- else
684
- break;
685
- }
686
- }
687
- }
688
- let Ce;
689
- if (Array.isArray(A) && A.length > 0) {
690
- const w = A.length;
691
- for (let N = 0; N < w; N++) {
692
- const T = A[N] || {}, { label: G = "", name: D = "", show: j = !1, sort: Q, customGroup: q, conditions: F, typeGuid: v } = T;
693
- if (j || w === 1) {
694
- Ce = {
695
- label: G.trim(),
696
- columnName: D,
697
- show: j,
698
- sort: fe(Q),
699
- customGroup: q,
700
- conditions: ee(F),
701
- typeGuid: v
702
- };
703
- break;
704
- }
705
- }
706
- }
707
- const B = [];
708
- b == null || b.forEach((w) => {
709
- w.location = "LEFT", B.push(Ae(w, H));
710
- }), u == null || u.forEach((w) => {
711
- w.location = "RIGHT", B.push(Ae(w, H));
712
- });
713
- let de = S;
714
- (ve = (Fe = o == null ? void 0 : o.pivotTableCal) == null ? void 0 : Fe.indicators) != null && ve.length && (de = o.pivotTableCal.indicators), de == null || de.forEach((w) => {
715
- w.location = "LEFT", B.push(Ae(w, H));
716
- });
717
- const J = [];
718
- ["ecanList", "ecanCirculate"].includes(t) && (y == null ? void 0 : y.length) > 1 && (x = y), (Ve = (ke = o == null ? void 0 : o.pivotTableCal) == null ? void 0 : ke.dimensions) != null && Ve.length && (x = o.pivotTableCal.dimensions), x == null || x.forEach((w) => {
719
- const { label: N, name: T, location: G, show: D, indexCode: j, sort: Q, typeGuid: q, indexCodeNum: F, dateFormat: v, conditions: R } = w;
720
- let h = fe(Q);
721
- if (o.sort) {
722
- const { field: U, order: _ } = o.sort;
723
- let z = B.find((P) => P.label === U);
724
- !z && N === U && (z = w), z && (h = {
725
- columnName: z.columnName,
726
- label: o.sort.field,
727
- order: _.toUpperCase(),
728
- type: "NORMAL"
729
- });
730
- }
731
- const M = {
732
- label: N,
733
- columnName: T,
734
- location: G,
735
- show: D,
736
- sort: h,
737
- calcType: "COLUMN",
738
- hrpIndexCode: j,
739
- hrpIndexCodeNum: F,
740
- conditions: ee(R),
741
- typeGuid: q
742
- };
743
- v && (M.dateFormat = v), T === "the_date" && !M.dateFormat && (M.dateFormat = "YYYY-MM"), J.push(M);
744
- });
745
- let ie = [], Z = [];
746
- if (Array.isArray(m) && m.length > 0 ? Z = m : Array.isArray(g) && g.length > 0 && (Z = g), Z != null && Z.length) {
747
- const w = Z.length;
748
- for (let N = 0; N < w; N++) {
749
- const T = Z[N] || {}, { label: G = "", name: D = "", show: j = !1, sort: Q, customGroup: q, conditions: F, truncations: v, typeGuid: R = "", dateFormat: h } = T;
750
- let M = fe(Q);
751
- if (o.sort) {
752
- const { field: z, order: P } = o.sort;
753
- let X = B.find((O) => O.label === z);
754
- !X && T.label === z && (X = T), X && (M = {
755
- columnName: X.columnName,
756
- label: o.sort.field,
757
- order: P.toUpperCase(),
758
- type: "NORMAL"
759
- });
760
- }
761
- const U = {
762
- label: G.trim(),
763
- columnName: D,
764
- show: j,
765
- sort: M,
766
- customGroup: q,
767
- conditions: ee(F),
768
- typeGuid: R
769
- };
770
- h && (U.dateFormat = h), D === "the_date" && !U.dateFormat && (U.dateFormat = "YYYY-MM");
771
- const _ = {};
772
- if (Array.isArray(v) && v.length > 0) {
773
- const z = v.length;
774
- for (let P = 0; P < z; P++) {
775
- const X = v[P] || {}, { rule: O = "", num: je = 0, name: Re = "" } = X;
776
- O && je && (_.num = je, _.rule = O, Re && (_.otherGroupName = Re));
777
- }
778
- }
779
- (Ie = Object.keys(_)) != null && Ie.length && (U.truncation = _), ie.push(U);
780
- }
781
- }
782
- let ge = [], Te;
783
- if (o != null && o.pivotTableCal) {
784
- let w = [];
785
- const {
786
- calc: N = [],
787
- filter: T = [],
788
- truncations: G = [],
789
- sorts: D = [],
790
- aggregateMethod: j = [],
791
- rowDimensionKeys: Q = [],
792
- colDimensionKeys: q = []
793
- } = o.pivotTableCal;
794
- if (B.push(...N), T != null && T.length)
795
- for (const F of T) {
796
- const Me = F, { type: v } = Me, R = Se(Me, ["type"]);
797
- v === "indicators" ? w = B : v === "dimension" && (w = J);
798
- const h = w.find((M) => M.columnName === F.fieldName);
799
- h && (h.conditions || (h.conditions = []), h.conditions.push(R));
800
- }
801
- if (G != null && G.length)
802
- for (const F of G) {
803
- const v = J.find((R) => R.columnName === F.key);
804
- v && (v.truncation = {
805
- num: F.num,
806
- rule: F.rule
807
- });
808
- }
809
- if (D != null && D.length)
810
- for (const F of D) {
811
- const he = F, { fieldType: v, columnData: R } = he, h = Se(he, ["fieldType", "columnData"]);
812
- v === "indicators" ? (w = B, Te = R) : v === "dimension" && (w = J);
813
- const M = w.find((U) => U.label === h.label);
814
- M && (M.sort = Y(C({}, h), {
815
- columnName: M.columnName
816
- }));
817
- }
818
- if ((Ee = Object.keys(j)) != null && Ee.length)
819
- for (const F in j) {
820
- const v = J.find((R) => R.label === F);
821
- v && ((Ge = j[F]) != null && Ge.length) && (v.aggregateMethod = j[F]);
822
- }
823
- ie = [], ge = [];
824
- for (const F of J)
825
- Q.includes(F.columnName) ? ie.push(F) : q.includes(F.columnName) && ge.push(F);
826
- }
827
- if (K(t, ["text", "proportion", "counter"]) ? d = "zb" : K(t, ["valueline"]) && (d = "valueline"), f || t === "card") {
828
- if (ie.length === 0 || B.length === 0)
829
- return;
830
- d = "grouptable";
831
- } else {
832
- if (a === "1" && J.length === 0)
833
- return;
834
- if (a === "2" && B.length === 0)
835
- return;
836
- if (a === "3" && (!xe && s !== "EDV_DATA_SET" || !p.labelField || !p.valueField))
837
- return;
838
- if (a === "3" && t === "ecanDataSelect" && B.length === 0)
839
- return;
840
- }
841
- g != null && g.length && (a = "1", d = "grouptable");
842
- let be;
843
- if (!K(t, ["scatter", "valueline"]) && ((De = Object.keys(p)) != null && De.length)) {
844
- const w = ce(L).find((T) => T.conditionKey === "parentCode"), N = {};
845
- if (w) {
846
- const T = ye(w.id) || {};
847
- if (T != null && T.itemCodes)
848
- N.parentItemCodes = T.itemCodes;
849
- else
850
- return;
851
- }
852
- t === "ecanDataSelect" && (N.indicatorList = B.filter((T) => T.show)), s === "EDV_DATA_SET" && (N.edvDataSetId = ae), be = C({
853
- url: "/diagram/formData",
854
- source: s,
855
- dataViewId: n,
856
- plugin: "4",
857
- layer: a,
858
- chartType: "normalSelect",
859
- rangeIndexTypeGuid: xe,
860
- type: t === "ecanDataSelect" ? "normalSelectData" : "normalSelect",
861
- labelField: p.labelField,
862
- valueField: p.valueField,
863
- sqlConditions: I,
864
- idxLibMode: "WITH_DATE_DIM_TABLE",
865
- keyName: e.keyName
866
- }, N);
867
- } else {
868
- let w = {};
869
- K(t, ["scatter", "valueline"]) ? w = {
870
- classifications: we
871
- } : w = {
872
- classification: H
873
- }, be = C({
874
- url: "/diagram",
875
- source: s,
876
- dataViewId: n,
877
- plugin: r ? "5" : i,
878
- layer: a,
879
- chartType: r ? "pivot-table" : d,
880
- series: Ce,
881
- indicatorList: B,
882
- queryColumns: f ? [] : J,
883
- pageFlag: !0,
884
- edvDataSetId: ae || "",
885
- sqlConditions: I.map((N) => {
886
- const { fieldValue: T } = N, G = {};
887
- return T && Array.isArray(T) && (G.fieldValue = JSON.stringify(T)), C(C({}, N), G);
888
- }),
889
- idxLibMode: ne,
890
- preview: re,
891
- rowHeaders: ie,
892
- keyName: e.keyName,
893
- // 透视表指标排序相关入参
894
- columnData: Te,
895
- columnHeaders: ge
896
- }, w);
897
- }
898
- return be;
899
- }, al = {
900
- formatIndicatorParams: rl
901
- }, dl = (e = [], o) => {
902
- let { name: l = "name", types: t = [] } = o || {};
903
- l = (l == null ? void 0 : l.trim()) || l;
904
- const c = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), r = e.length, s = t.length;
905
- if (r === 1) {
906
- const a = [];
907
- for (let y = 0; y < s; y++) {
908
- const m = t[y], { label: g, value: A } = m, b = Y(C({}, e[0]), { value: e[0][A] });
909
- c.add(g), a.push(b);
910
- }
911
- const d = e[0][l] || "";
912
- f.set(d, a);
913
- } else
914
- for (let a = 0; a < r; a++) {
915
- const d = e[a], y = d[l];
916
- c.add(y);
917
- for (let m = 0; m < s; m++) {
918
- const g = t[m], { label: A, value: b } = g, u = Y(C({}, d), { value: d[b] });
919
- if (f.has(A)) {
920
- const x = f.get(A);
921
- x.push(u), f.set(A, x);
922
- } else
923
- f.set(A, [u]);
924
- }
925
- }
926
- const n = Array.from(c), i = [];
927
- for (const [a, d] of f)
928
- i.push({
929
- name: a,
930
- data: d
931
- });
932
- return {
933
- dimensions: n,
934
- dataset: i
935
- };
936
- }, sl = (e, o) => {
937
- let { name: l = "name", value: t = "value", type: c = "type" } = o || {};
938
- l = l == null ? void 0 : l.trim(), t = t == null ? void 0 : t.trim(), c = c == null ? void 0 : c.trim();
939
- const f = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), s = e.length;
940
- for (let a = 0; a < s; a++) {
941
- const d = e[a], y = d[l] || "", m = d[t] || "", g = d[c] || "";
942
- if (f.add(y), r.has(g)) {
943
- const A = r.get(g);
944
- A.push(C({ name: y, value: m }, d)), r.set(g, A);
945
- } else
946
- r.set(g, [C({ name: y, value: m }, d)]);
947
- }
948
- const n = Array.from(f), i = [];
949
- for (const [a, d] of r)
950
- i.push({
951
- name: a,
952
- data: d
953
- });
954
- return {
955
- dimensions: n,
956
- dataset: i
957
- };
958
- }, oe = (e, o) => {
959
- var c;
960
- if (e == null)
961
- return o;
962
- const l = e.match(/\{.*\}/g);
963
- if (l == null || l.length === 0)
964
- return o;
965
- const t = l.length;
966
- for (let f = 0; f < t; f++) {
967
- const r = l[f];
968
- if (r == null || r === "")
969
- break;
970
- let s = (c = r.slice(1, -1)) == null ? void 0 : c.trim();
971
- s = s == null ? void 0 : s.replace(/value/g, o);
972
- try {
973
- let n = s;
974
- (/\(.*\)/g.test(s) || /[+/\\*]/g.test(s)) && (n = Le(s)), e = e.replace(r, n);
975
- } catch (n) {
976
- e = e.replace(r, s);
977
- }
978
- }
979
- return e;
980
- };
981
- function fl(e) {
982
- return e.isShowMarkLine ? {
983
- markLine: {
984
- data: [{ type: e.markLineType }]
985
- }
986
- } : {};
987
- }
988
- const ul = (e, o, l) => {
989
- switch (e.type) {
990
- case "bar":
991
- return cl(e, o, l);
992
- case "line":
993
- return yl(e, o, l);
994
- case "pie":
995
- return ml(e, o, l);
996
- case "comboGraph":
997
- return xl(e, o, l);
998
- default:
999
- return {};
1000
- }
1001
- }, cl = (e, o, l) => {
1002
- const t = e.yAxisLabelFormatter, c = e.xAxisLabelFormatter, { dimensions: f = [], dataset: r = [] } = o, s = le(() => {
1003
- const { gradientShow: i, gradientColors: a, gradientOffset: d, barBorderRadius: y } = e, m = r, g = m.length, A = [];
1004
- for (let b = 0; b < g; b++) {
1005
- const u = Y(C({}, m[b]), {
1006
- type: "bar",
1007
- barWidth: e.barWidth,
1008
- showBackground: e.showBarBackground
1009
- }), { isStack: x, stackColumns: S } = e;
1010
- if (x && S.includes(m[b].name || !S) && (u.stack = "stack"), u.label = {
1011
- show: e.labelShow,
1012
- fontSize: e.labelFontSize,
1013
- position: e.labelPosition,
1014
- color: e.labelColor,
1015
- width: e.labelWidth,
1016
- overflow: e.labelOverflow,
1017
- formatter: (L) => {
1018
- let p = "", V = e.labelFormatter;
1019
- V === "" && (V = "{c}");
1020
- const { seriesName: E, name: ne, value: re, data: ae } = L || {};
1021
- return p += te(
1022
- V,
1023
- {
1024
- textData: C({
1025
- name: ne,
1026
- value: re,
1027
- a: E,
1028
- b: ne,
1029
- c: re || 0
1030
- }, ae)
1031
- },
1032
- {
1033
- useNewline: !0,
1034
- useSpace: !0
1035
- }
1036
- ), p;
1037
- }
1038
- }, u.itemStyle = {}, i && (u.itemStyle = {
1039
- color: {
1040
- x: e.isUseHorizontalAxis ? 1 : 0,
1041
- y: 0,
1042
- x2: 0,
1043
- y2: e.isUseHorizontalAxis ? 0 : 1,
1044
- colorStops: [{
1045
- offset: 0,
1046
- color: e.colors[b]
1047
- }, {
1048
- offset: d,
1049
- color: a[b]
1050
- }, {
1051
- offset: 1,
1052
- color: a[b]
1053
- }]
1054
- }
1055
- }), y) {
1056
- const L = y.split(",");
1057
- if (L != null && L.length) {
1058
- const p = [];
1059
- for (const V of L) {
1060
- const E = parseFloat(V);
1061
- isNaN(E) || p.push(E);
1062
- }
1063
- u.itemStyle.barBorderRadius = p;
1064
- }
1065
- }
1066
- e.isShowMarkLine && (u.markLine = {
1067
- data: [{ type: e.markLineType }]
1068
- }), A.push(u);
1069
- }
1070
- return A;
1071
- }), n = le(() => f.map((i) => {
1072
- let a = {};
1073
- return i && typeof i == "object" ? a = Y(C({}, i), {
1074
- textStyle: {
1075
- fontSize: l
1076
- }
1077
- }) : a = {
1078
- value: i,
1079
- textStyle: {
1080
- fontSize: l
1081
- }
1082
- }, a;
1083
- }));
1084
- return {
1085
- tooltip: {
1086
- trigger: "axis",
1087
- show: e.tooltipShow,
1088
- formatter: (i) => {
1089
- const a = i.length;
1090
- let d = "", y = e.tooltipFormatter;
1091
- y === "" && (y = "{marker} {a} {c}");
1092
- for (let m = 0; m < a; m++) {
1093
- const { marker: g, seriesName: A, name: b, value: u, data: x } = i[m] || {};
1094
- if (m === 0) {
1095
- let S = b;
1096
- typeof b == "string" && b[0] === "0" && !isNaN(+b) && (S = (+b).toString()), d += `${oe(c, S)}<br/>`;
1097
- }
1098
- d += te(
1099
- y,
1100
- {
1101
- textData: C({
1102
- marker: g,
1103
- name: b,
1104
- value: u,
1105
- Qfw: Oe,
1106
- a: A,
1107
- b,
1108
- c: u || 0
1109
- }, x)
1110
- },
1111
- {
1112
- useNewline: !0,
1113
- useSpace: !0
1114
- }
1115
- ), d += "<br/>";
1116
- }
1117
- return d;
1118
- },
1119
- // valueFormatter: (value) => {
1120
- // return useVariablesInText(chartsOptions.tooltipValueFormatter as string, { value })
1121
- // },
1122
- textStyle: {
1123
- color: e.tooltipTextStyleColor,
1124
- fontSize: l
1125
- },
1126
- position: e.tooltipPosition || void 0,
1127
- backgroundColor: e.tooltipBackgroundColor || "#fff"
1128
- },
1129
- legend: {
1130
- type: e.legendScroll ? "scroll" : "plain",
1131
- width: e.legendWidth,
1132
- height: e.legendHeight,
1133
- show: e.legendShow,
1134
- orient: e.legendOrient,
1135
- top: e.legendTop,
1136
- left: e.legendLeft,
1137
- textStyle: {
1138
- // lineHeight: parseFloat(chartsOptions.legendFontSize) + 8,
1139
- rich: {
1140
- text: {
1141
- width: e.legendTextWidth,
1142
- color: e.legendTextStyleColor,
1143
- fontSize: e.legendFontSize
1144
- }
1145
- }
1146
- },
1147
- itemHeight: e.legendItemHeight,
1148
- itemWidth: e.legendItemWidth,
1149
- itemGap: e.legendItemGap,
1150
- data: r.map((i, a) => ({
1151
- name: i.name,
1152
- itemStyle: {
1153
- color: e.colors[a]
1154
- },
1155
- icon: e.legendType
1156
- })),
1157
- formatter: (i) => Ze(e.legendFormatter, {
1158
- name: i
1159
- })
1160
- },
1161
- xAxis: {
1162
- type: e.isUseHorizontalAxis ? "value" : "category",
1163
- data: e.isUseHorizontalAxis ? null : k(n),
1164
- inverse: e.isUseHorizontalAxis ? e.xAxisInverse : e.axisInverse,
1165
- minInterval: e.xAxisMinInterval,
1166
- splitLine: {
1167
- show: e.xAxisSplitLineShow,
1168
- lineStyle: {
1169
- color: e.xAxisSplitLineStyleColor,
1170
- type: e.xAxisSplitLineType
1171
- },
1172
- interval: e.xAxisSplitLineInterval
1173
- },
1174
- splitArea: {
1175
- show: e.xAxisSplitAreaShow
1176
- },
1177
- axisLabel: {
1178
- color: e.xAxisLabelColor,
1179
- interval: e.xAxisLabelInterval || 0,
1180
- rotate: e.xAxisLabelRotate,
1181
- width: e.xAxisLabelWidth,
1182
- overflow: e.xAxisLabelOverflow,
1183
- fontSize: e.xAxisLabelFontSize,
1184
- formatter(i) {
1185
- return typeof i == "string" && i[0] === "0" && !isNaN(+i) && (i = (+i).toString()), oe(c, i);
1186
- }
1187
- },
1188
- axisLine: {
1189
- show: e.xAxisLineShow,
1190
- lineStyle: {
1191
- color: e.xAxisLineStyleColor
1192
- }
1193
- },
1194
- axisTick: {
1195
- show: e.xAxisTickShow
1196
- },
1197
- name: e.xAxisName,
1198
- nameTextStyle: {
1199
- fontSize: e.xAxisLabelFontSize,
1200
- color: e.xAxisLabelColor,
1201
- align: "left"
1202
- },
1203
- max: e.xAxisMaxValue || null
1204
- },
1205
- yAxis: {
1206
- type: e.isUseHorizontalAxis ? "category" : "value",
1207
- data: e.isUseHorizontalAxis ? k(f) : null,
1208
- inverse: e.isUseHorizontalAxis ? e.axisInverse : e.yAxisInverse,
1209
- minInterval: e.yAxisMinInterval,
1210
- splitLine: {
1211
- show: e.yAxisSplitLineShow,
1212
- lineStyle: {
1213
- color: e.yAxisSplitLineStyleColor,
1214
- type: e.yAxisSplitLineType
1215
- }
1216
- },
1217
- splitArea: {
1218
- show: e.yAxisSplitAreaShow
1219
- },
1220
- axisLabel: {
1221
- show: e.yAxisLabelShow,
1222
- fontSize: e.yAxisLabelFontSize,
1223
- color: e.yAxisLabelColor,
1224
- rotate: e.yAxisLabelRotate,
1225
- width: e.yAxisLabelWidth,
1226
- overflow: e.yAxisLabelOverflow,
1227
- formatter(i) {
1228
- return oe(t, i);
1229
- }
1230
- },
1231
- axisLine: {
1232
- show: e.yAxisLineAlwaysDisplay,
1233
- lineStyle: {
1234
- color: e.yAxisLineStyleColor
1235
- }
1236
- },
1237
- name: e.yAxisName,
1238
- nameTextStyle: {
1239
- fontSize: e.yAxisLabelFontSize,
1240
- color: e.yAxisLabelColor,
1241
- align: "right"
1242
- },
1243
- max: e.yAxisMaxValue || null
1244
- },
1245
- series: k(s)
1246
- };
1247
- }, yl = (e, o, l) => {
1248
- const t = e.yAxisLabelFormatter, c = e.xAxisLabelFormatter, { dimensions: f = [], dataset: r = [] } = o, s = le(() => f.map((i) => {
1249
- let a = {};
1250
- return i && typeof i == "object" ? a = Y(C({}, i), {
1251
- textStyle: {
1252
- fontSize: l
1253
- }
1254
- }) : a = {
1255
- value: i,
1256
- textStyle: {
1257
- fontSize: l
1258
- }
1259
- }, a;
1260
- })), n = le(() => {
1261
- const i = [], a = r.length;
1262
- for (let d = 0; d < a; d++) {
1263
- const y = {};
1264
- e.shadowColor && (y.shadowColor = e.shadowColor, y.shadowBlur = e.shadowBlur, y.shadowOffsetY = e.shadowOffsetY, y.shadowOffsetX = e.shadowOffsetX), i.push(C(Y(C({
1265
- type: "line"
1266
- }, r[d]), {
1267
- symbolSize: e.symbolSize,
1268
- smooth: e.smooth,
1269
- areaStyle: {
1270
- color: e.areaGradientShow ? {
1271
- type: "linear",
1272
- x: 0,
1273
- y: 0,
1274
- x2: 0,
1275
- y2: 1,
1276
- colorStops: [{
1277
- offset: 0,
1278
- color: e.colors[d]
1279
- }, {
1280
- offset: 1,
1281
- color: e.areaGradientColor || "transparent"
1282
- }],
1283
- global: !1
1284
- } : e.colors[d],
1285
- opacity: e.areaStyleOpacity
1286
- },
1287
- lineStyle: C({
1288
- width: e.lineStyleWidth
1289
- }, y)
1290
- }), fl(e)));
1291
- }
1292
- return i;
1293
- });
1294
- return {
1295
- tooltip: {
1296
- trigger: "axis",
1297
- show: e.tooltipShow,
1298
- formatter: (i) => {
1299
- const a = i.length;
1300
- let d = "", y = e.tooltipFormatter;
1301
- y === "" && (y = "{marker} {a} {c}");
1302
- for (let m = 0; m < a; m++) {
1303
- const { marker: g, seriesName: A, name: b, value: u, data: x } = i[m] || {};
1304
- m === 0 && (d += `${b}<br/>`), d += te(
1305
- y,
1306
- {
1307
- textData: C({
1308
- marker: g,
1309
- name: b,
1310
- value: u,
1311
- a: A,
1312
- b,
1313
- c: u
1314
- }, x)
1315
- },
1316
- {
1317
- useNewline: !0,
1318
- useSpace: !0
1319
- }
1320
- ), d += "<br/>";
1321
- }
1322
- return d;
1323
- },
1324
- textStyle: {
1325
- color: e.tooltipTextStyleColor,
1326
- fontSize: l.value
1327
- },
1328
- position: e.tooltipPosition || void 0,
1329
- backgroundColor: e.tooltipBackgroundColor || "#fff"
1330
- },
1331
- xAxis: {
1332
- name: e.xAxisName,
1333
- type: "category",
1334
- data: k(s),
1335
- minInterval: e.xAxisMinInterval,
1336
- splitLine: {
1337
- show: e.xAxisSplitLineShow,
1338
- lineStyle: {
1339
- color: e.xAxisSplitLineStyleColor
1340
- }
1341
- },
1342
- axisLabel: {
1343
- color: e.xAxisLabelColor,
1344
- interval: e.xAxisLabelInterval || 0,
1345
- rotate: e.xAxisLabelRotate,
1346
- width: e.xAxisLabelWidth,
1347
- overflow: e.xAxisLabelOverflow,
1348
- formatter(i) {
1349
- return oe(c, i);
1350
- }
1351
- },
1352
- axisLine: {
1353
- lineStyle: {
1354
- color: e.xAxisLineStyleColor
1355
- }
1356
- },
1357
- axisTick: {
1358
- show: e.xAxisTickShow
1359
- }
1360
- },
1361
- yAxis: {
1362
- type: "value",
1363
- name: e.yAxisName,
1364
- minInterval: e.yAxisMinInterval,
1365
- splitLine: {
1366
- show: e.yAxisSplitLineShow,
1367
- lineStyle: {
1368
- color: e.yAxisSplitLineStyleColor
1369
- }
1370
- },
1371
- axisLabel: {
1372
- fontSize: l,
1373
- color: e.yAxisLabelColor,
1374
- formatter(i) {
1375
- return oe(t, i);
1376
- }
1377
- },
1378
- axisLine: {
1379
- show: e.yAxisLineAlwaysDisplay,
1380
- lineStyle: {
1381
- color: e.yAxisLineStyleColor
1382
- }
1383
- }
1384
- },
1385
- // 图例
1386
- legend: {
1387
- show: e.legendShow,
1388
- orient: e.legendOrient,
1389
- top: e.legendTop,
1390
- left: e.legendLeft,
1391
- textStyle: {
1392
- fontSize: l
1393
- }
1394
- },
1395
- series: k(n)
1396
- };
1397
- }, ml = (e, o, l) => {
1398
- const { dataset: t = [] } = o;
1399
- let { data: c = [] } = t[0] || {};
1400
- if (Array.isArray(e.colors)) {
1401
- const f = e.isUseLabelColors, r = e.colors;
1402
- c = c.map((s, n) => C({
1403
- label: f ? { color: r[n] } : {}
1404
- }, s));
1405
- }
1406
- return {
1407
- title: {
1408
- text: e.titleText,
1409
- subtext: e.titleSubtext,
1410
- textStyle: {
1411
- fontSize: e.titleFontSize,
1412
- fontWeight: e.fontWeight,
1413
- color: e.titleColor
1414
- },
1415
- left: e.textAlign || "center"
1416
- },
1417
- // 提示
1418
- tooltip: {
1419
- show: e.tooltipShow,
1420
- trigger: e.tooltipTrigger,
1421
- formatter: (f) => {
1422
- const { marker: r, seriesName: s, name: n, value: i, percent: a, data: d } = f || {};
1423
- return te(
1424
- e.tooltipFormatter,
1425
- {
1426
- textData: C({
1427
- marker: r,
1428
- name: n,
1429
- value: i,
1430
- percent: a,
1431
- a: s,
1432
- b: n,
1433
- c: i,
1434
- d: a
1435
- }, d)
1436
- },
1437
- {
1438
- useNewline: !0,
1439
- useSpace: !0
1440
- }
1441
- );
1442
- },
1443
- textStyle: {
1444
- color: e.tooltipTextStyleColor || "#333"
1445
- },
1446
- backgroundColor: e.tooltipBackgroundColor || "#fff",
1447
- borderColor: e.tooltipBorderColor || "#eee"
1448
- },
1449
- // 图例
1450
- legend: {
1451
- show: e.legendShow,
1452
- orient: e.legendOrient,
1453
- top: e.legendTop,
1454
- left: e.legendLeft,
1455
- textStyle: {
1456
- color: e.legendTextStyleColor,
1457
- fontSize: l === 18 ? l : e.labelFontSize
1458
- }
1459
- },
1460
- series: [
1461
- {
1462
- data: c,
1463
- type: "pie",
1464
- radius: [e.innerRadius, e.outerRadius],
1465
- center: [e.centerLeft, e.centerTop],
1466
- roseType: e.roseType,
1467
- avoidLabelOverlap: !1,
1468
- minAngle: e.minAngle,
1469
- label: {
1470
- show: e.labelPosition !== "center" && e.labelShow,
1471
- color: e.labelColor,
1472
- fontSize: l === 18 ? l : e.labelFontSize,
1473
- position: e.labelPosition,
1474
- formatter: Je(e.labelFormatter)
1475
- },
1476
- labelLine: {
1477
- show: e.labelLineShow,
1478
- length: e.labelLineLength,
1479
- length2: e.labelLineLength2
1480
- },
1481
- emphasis: {
1482
- itemStyle: {
1483
- shadowBlur: 10,
1484
- shadowOffsetX: 0,
1485
- shadowColor: "rgba(0, 0, 0, 0.5)"
1486
- },
1487
- label: {}
1488
- }
1489
- }
1490
- ]
1491
- };
1492
- }, xl = (e, o, l) => {
1493
- const { dimensions: t = [], dataset: c = [] } = o, f = le(() => t.map((n) => {
1494
- let i = {};
1495
- return n && typeof n == "object" ? i = Y(C({}, n), {
1496
- textStyle: {
1497
- fontSize: l
1498
- }
1499
- }) : i = {
1500
- value: n,
1501
- textStyle: {
1502
- fontSize: l
1503
- }
1504
- }, i;
1505
- })), r = le(() => {
1506
- const n = [], i = c.length, a = e.seriesTypes;
1507
- for (let d = 0; d < i; d++) {
1508
- const y = a[d], { type: m, axisIndex: g } = y || {};
1509
- let A = C({
1510
- type: m,
1511
- yAxisIndex: g
1512
- }, c[d]);
1513
- if (m === "line") {
1514
- const b = {};
1515
- e.shadowColor && (b.shadowColor = e.shadowColor, b.shadowBlur = e.shadowBlur, b.shadowOffsetY = e.shadowOffsetY, b.shadowOffsetX = e.shadowOffsetX), A = Y(C({}, A), {
1516
- symbolSize: e.symbolSize,
1517
- smooth: e.smooth,
1518
- itemStyle: {
1519
- color: e.colors[d]
1520
- },
1521
- areaStyle: {
1522
- color: e.areaGradientShow ? {
1523
- type: "linear",
1524
- x: 0,
1525
- y: 0,
1526
- x2: 0,
1527
- y2: 1,
1528
- colorStops: [{
1529
- offset: 0,
1530
- color: e.colors[d]
1531
- }, {
1532
- offset: 1,
1533
- color: e.areaGradientColor || "transparent"
1534
- }],
1535
- global: !1
1536
- } : e.colors[d],
1537
- opacity: e.areaStyleOpacity
1538
- },
1539
- lineStyle: C({
1540
- width: e.lineStyleWidth
1541
- }, b)
1542
- });
1543
- }
1544
- if (m === "bar") {
1545
- const { gradientShow: b, gradientColors: u, gradientOffset: x } = e, S = {};
1546
- if (e.barBorderRadius) {
1547
- const L = e.barBorderRadius.split(",");
1548
- if (L != null && L.length) {
1549
- const p = [];
1550
- for (const V of L) {
1551
- const E = parseFloat(V);
1552
- isNaN(E) || p.push(E);
1553
- }
1554
- S.borderRadius = p;
1555
- }
1556
- }
1557
- b && (S.color = {
1558
- x: 0,
1559
- y: 0,
1560
- x2: 0,
1561
- y2: 1,
1562
- colorStops: [{
1563
- offset: 0,
1564
- color: e.colors[d]
1565
- }, {
1566
- offset: x,
1567
- color: u[d]
1568
- }, {
1569
- offset: 1,
1570
- color: u[d]
1571
- }]
1572
- }), A = Y(C({}, A), {
1573
- barWidth: e.barWidth,
1574
- itemStyle: S
1575
- });
1576
- }
1577
- e.isShowMarkLine && (A.markLine = {
1578
- data: [{ type: e.markLineType }]
1579
- }), n.push(A);
1580
- }
1581
- return n;
1582
- }), s = le(() => {
1583
- const n = e.yAxis;
1584
- return n == null ? void 0 : n.map((i, a) => ({
1585
- type: "value",
1586
- minInterval: e.yAxisMinInterval,
1587
- splitLine: {
1588
- show: a === 0 ? e.yAxisLeftSplitLineShow : e.yAxisRightSplitLineShow,
1589
- lineStyle: {
1590
- color: e.yAxisSplitLineStyleColor,
1591
- type: a === 0 ? e.yAxisLeftSplitLineType : e.yAxisRightSplitLineType
1592
- }
1593
- },
1594
- splitArea: {
1595
- show: e.yAxisSplitAreaShow
1596
- },
1597
- axisLabel: {
1598
- fontSize: l,
1599
- show: e.yAxisLabelShow,
1600
- color: e.yAxisLabelColor,
1601
- formatter(d) {
1602
- return oe(i.axisLabelFormatter, d);
1603
- }
1604
- },
1605
- axisLine: {
1606
- show: e.yAxisLineAlwaysDisplay,
1607
- lineStyle: {
1608
- color: e.yAxisLineStyleColor
1609
- }
1610
- },
1611
- name: a === 0 ? e.yAxisLeftName : e.yAxisRightName,
1612
- nameTextStyle: {
1613
- fontSize: e.yAxisLabelFontSize,
1614
- color: e.yAxisLabelColor,
1615
- align: a === 0 ? "right" : "left"
1616
- },
1617
- max: e.yAxisMaxValue || null
1618
- }));
1619
- });
1620
- return {
1621
- legend: {
1622
- show: e.legendShow,
1623
- orient: e.legendOrient,
1624
- top: e.legendTop,
1625
- left: e.legendLeft,
1626
- textStyle: {
1627
- color: e.legendTextStyleColor,
1628
- fontSize: l
1629
- }
1630
- },
1631
- tooltip: {
1632
- trigger: "axis",
1633
- show: e.tooltipShow,
1634
- formatter: (n) => {
1635
- const i = n.length;
1636
- let a = "", d = e.tooltipFormatter;
1637
- d === "" && (d = "{marker} {a} {c}");
1638
- const y = e.seriesTypes;
1639
- for (let m = 0; m < i; m++) {
1640
- const g = y[m], { tooltipFormatter: A } = g || {}, { marker: b, seriesName: u, name: x, value: S, data: L } = n[m] || {};
1641
- m === 0 && (a += `${x}<br/>`), a += te(
1642
- // 如果系列有提示框组件就使用自定义,没有就用默认的
1643
- A || d,
1644
- {
1645
- textData: C({
1646
- marker: b,
1647
- name: x,
1648
- value: S,
1649
- seriesName: u,
1650
- a: u,
1651
- b: x,
1652
- c: S
1653
- }, L)
1654
- },
1655
- {
1656
- useNewline: !0,
1657
- useSpace: !0
1658
- }
1659
- ), a += "<br/>";
1660
- }
1661
- return a;
1662
- },
1663
- textStyle: {
1664
- color: e.tooltipTextStyleColor || "#333",
1665
- fontSize: l
1666
- },
1667
- backgroundColor: e.tooltipBackgroundColor || "#fff",
1668
- borderColor: e.tooltipBorderColor || "#eee"
1669
- },
1670
- xAxis: {
1671
- name: e.xAxisName,
1672
- minInterval: e.xAxisMinInterval,
1673
- type: "category",
1674
- data: k(f),
1675
- splitLine: {
1676
- show: e.xAxisSplitLineShow,
1677
- lineStyle: {
1678
- color: e.xAxisSplitLineStyleColor
1679
- }
1680
- },
1681
- axisLabel: {
1682
- color: e.xAxisLabelColor,
1683
- interval: e.xAxisLabelInterval || 0,
1684
- rotate: e.xAxisLabelRotate,
1685
- width: e.xAxisLabelWidth,
1686
- overflow: e.xAxisLabelOverflow
1687
- },
1688
- axisLine: {
1689
- lineStyle: {
1690
- color: e.xAxisLineStyleColor
1691
- }
1692
- },
1693
- axisTick: {
1694
- show: e.xAxisTickShow
1695
- }
1696
- },
1697
- yAxis: k(s),
1698
- series: k(r)
1699
- };
1700
- }, gl = (e) => ({
1701
- title: {
1702
- text: e.titleText,
1703
- subtext: e.titleSubtext,
1704
- textStyle: {
1705
- fontSize: e.titleFontSize,
1706
- fontWeight: e.fontWeight,
1707
- color: e.titleColor
1708
- },
1709
- left: e.textAlign || "center"
1710
- },
1711
- grid: {
1712
- top: e.gridTop,
1713
- bottom: e.gridBottom,
1714
- left: e.gridLeft,
1715
- right: e.gridRight,
1716
- containLabel: e.gridContainLabel
1717
- },
1718
- color: e.colors
1719
- }), bl = (e, o, l = 12) => C(C({}, gl(e)), ul(e, o, l)), Cl = Y(C({}, al), {
1720
- runCode: Le,
1721
- useTransformChartDataByAttrKey: dl,
1722
- useTransformChartDataByAttrValue: sl,
1723
- useValueFormatter: oe,
1724
- useVariablesInText: te,
1725
- transformProps: bl,
1726
- getIndicatorParams: el
1727
- });
1728
- export {
1729
- Cl as default
1730
- };
1731
- //# sourceMappingURL=index.es.js.map