@ecan-bi/tools 1.0.6 → 1.0.8

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