@ecan-bi/tools 1.0.19 → 1.0.21

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