@ecan-bi/tools 1.0.18 → 1.0.19

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 CHANGED
@@ -1,4 +1,4 @@
1
- /*! @ecan-bi/tools@1.0.18 */
1
+ /*! @ecan-bi/tools@1.0.19 */
2
2
  var Pe = Object.defineProperty, qe = Object.defineProperties;
3
3
  var Xe = Object.getOwnPropertyDescriptors;
4
4
  var de = Object.getOwnPropertySymbols;
@@ -154,31 +154,32 @@ function ll(s) {
154
154
  }
155
155
  if ((r = Object.keys(b)) != null && r.length) {
156
156
  const u = [];
157
- for (const x in b)
157
+ for (const g in b)
158
158
  u.push(
159
159
  new Promise((c, m) => {
160
160
  o.post(
161
161
  `${l}/diagram/hrpIndexWithComplex`,
162
162
  {
163
163
  pageId: t,
164
- indexGuid: x,
165
- indexCode: b[x],
164
+ indexGuid: g,
165
+ indexCode: b[g],
166
166
  dataSourceId: y
167
167
  }
168
- ).then((g) => {
168
+ ).then((x) => {
169
169
  var v;
170
- const { success: w, data: N = [] } = g.data;
170
+ const { success: w, data: N = [] } = x.data;
171
171
  w && ((v = N == null ? void 0 : N.dataViewColumns) != null && v.length) ? c(N.dataViewColumns) : m(N);
172
- }).catch((g) => {
173
- m(g);
172
+ }).catch((x) => {
173
+ console.error(x), m(x);
174
174
  });
175
175
  })
176
176
  );
177
177
  return (yield Promise.all(u)).reduce(
178
- (x, c) => x.filter((m) => c.find((g) => g.typeGuid === m.typeGuid))
179
- ).filter((x) => x.typeGuid);
178
+ (g, c) => g.filter((m) => c.find((x) => x.typeGuid === m.typeGuid))
179
+ ).filter((g) => g.typeGuid);
180
180
  }
181
181
  } catch (d) {
182
+ console.error(d);
182
183
  }
183
184
  return [];
184
185
  });
@@ -203,15 +204,15 @@ const tl = [
203
204
  const f = d == null ? void 0 : d.find((c) => c.id === y);
204
205
  if (!f)
205
206
  return [];
206
- const { interval: a, intervalUnit: b, startTime: u, endTime: S, operate: A, useCurrentTime: x } = f || {};
207
- if (x && (n = $().subtract(a, b), i = $()), u && (n = $(u)), S && (i = $(S)), A) {
208
- const { type: c, value: m, mode: g } = A;
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;
209
210
  switch (c) {
210
211
  case "add":
211
- n = n && n.add(m, g), i = i && i.add(m, g);
212
+ n = n && n.add(m, x), i = i && i.add(m, x);
212
213
  break;
213
214
  case "minus":
214
- n = n && n.subtract(m, g), i = i && i.subtract(m, g);
215
+ n = n && n.subtract(m, x), i = i && i.subtract(m, x);
215
216
  }
216
217
  }
217
218
  } else {
@@ -288,7 +289,7 @@ const tl = [
288
289
  conditions: u,
289
290
  aggregate: S,
290
291
  distinct: A,
291
- dimByCount: x,
292
+ dimByCount: g,
292
293
  dataTo: c
293
294
  } = e;
294
295
  let m;
@@ -303,7 +304,7 @@ const tl = [
303
304
  componentValue: w.fieldValue || null
304
305
  };
305
306
  }
306
- const g = {
307
+ const x = {
307
308
  label: l.trim(),
308
309
  columnName: t,
309
310
  location: y,
@@ -321,13 +322,13 @@ const tl = [
321
322
  const w = a.split("-");
322
323
  if ((w == null ? void 0 : w.length) === 3) {
323
324
  let N = w[0];
324
- return w[2] === "before" && w[0] !== "0" && (N = `-${w[0]}`), Y(C({}, g), {
325
+ return w[2] === "before" && w[0] !== "0" && (N = `-${w[0]}`), Y(C({}, x), {
325
326
  calcWays: [N],
326
327
  dateCalcTypes: [w[1]]
327
328
  });
328
329
  }
329
330
  } else
330
- return t === "the_count" && (g.calcType = "AGGREGATE", g.distinct = !!A, g.typeGuid = x), Y(C({}, g), {
331
+ return t === "the_count" && (x.calcType = "AGGREGATE", x.distinct = !!A, x.typeGuid = g), Y(C({}, x), {
331
332
  builtInCalcWay: a
332
333
  });
333
334
  }, nl = (e) => {
@@ -357,7 +358,7 @@ const tl = [
357
358
  for (const S of f) {
358
359
  const A = ue((S == null ? void 0 : S.conditions) || []);
359
360
  if (A != null && A.length) {
360
- const x = A.filter((c) => (c == null ? void 0 : c.dataType) === "component").map((c) => {
361
+ const g = A.filter((c) => (c == null ? void 0 : c.dataType) === "component").map((c) => {
361
362
  const m = {};
362
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({
363
364
  conditionKey: c.fieldName,
@@ -373,8 +374,8 @@ const tl = [
373
374
  indexCodeNum: c.indexCodeNum
374
375
  }, m);
375
376
  });
376
- if (x != null && x.length)
377
- for (const c of x)
377
+ if (g != null && g.length)
378
+ for (const c of g)
378
379
  a.find((m) => m.keyName === c.keyName) || a.push(c);
379
380
  }
380
381
  }
@@ -384,15 +385,15 @@ const tl = [
384
385
  if ((A == null ? void 0 : A.conditionKey) === "parentCode")
385
386
  continue;
386
387
  const {
387
- id: x,
388
+ id: g,
388
389
  keyName: c,
389
390
  prop: m,
390
- format: g,
391
+ format: x,
391
392
  modelKey: w,
392
393
  dataType: N = "component",
393
394
  customValue: v
394
395
  } = A, E = $e(A);
395
- ye(E, x, { prop: m, dateFormat: g, modelKey: w, keyName: c }), N === "" && (E.fieldValue = v || ""), u.push(E);
396
+ ye(E, g, { prop: m, dateFormat: x, modelKey: w, keyName: c }), N === "" && (E.fieldValue = v || ""), u.push(E);
396
397
  }
397
398
  for (let S = u.length - 1; S >= 0; S--) {
398
399
  const A = u[S];
@@ -483,19 +484,19 @@ function ye(e, o, l) {
483
484
  const { prop: t = "", dateFormat: y = "", modelKey: s = "", keyName: r = "", operateValue: d, operateMode: n, operateType: i } = l || {}, f = s || r;
484
485
  if (o === "PARENT" && f && t) {
485
486
  const m = window.config.record;
486
- let g = t, w = y;
487
+ let x = t, w = y;
487
488
  const N = t.match(/\{(.+?)\}/g);
488
489
  if (N != null && N.length) {
489
490
  const v = N[0].slice(1, -1).trim();
490
- g = t.replace(N[0], ""), w = v, e.dateFormat = w;
491
+ x = t.replace(N[0], ""), w = v, e.dateFormat = w;
491
492
  }
492
493
  if (m && m[f]) {
493
- const v = V(m[f][g]);
494
+ const v = V(m[f][x]);
494
495
  $.isDayjs(v) ? e.fieldValue = v.format(w || "YYYY-MM-DD") : e.fieldValue = v;
495
496
  }
496
497
  return;
497
498
  }
498
- const a = ce(o) || {}, { value: b, format: u = "YYYY-MM-DD", type: S = "", useCurrentTime: A, RECORD: x } = a || {}, c = y || u;
499
+ const a = ce(o) || {}, { value: b, format: u = "YYYY-MM-DD", type: S = "", useCurrentTime: A, RECORD: g } = a || {}, c = y || u;
499
500
  if (K(a.type, "date")) {
500
501
  let m;
501
502
  if (A ? b ? m = V(b) : m = $() : m = V(b), d && n && i)
@@ -516,35 +517,35 @@ function ye(e, o, l) {
516
517
  }
517
518
  if (!m)
518
519
  return;
519
- let g = null;
520
- if (V(a[m]) && (g = $(V(a[m]))), d && n && i) {
520
+ let x = null;
521
+ if (V(a[m]) && (x = $(V(a[m]))), d && n && i) {
521
522
  if (d === "rangeValue") {
522
523
  if (a.startTime && a.endTime) {
523
524
  const w = V(a.endTime).diff(V(a.startTime), n) + 1;
524
525
  switch (i) {
525
526
  case "add":
526
- g = g && g.add(w, n);
527
+ x = x && x.add(w, n);
527
528
  break;
528
529
  case "minus":
529
- g = g && g.subtract(w, n);
530
+ x = x && x.subtract(w, n);
530
531
  }
531
532
  }
532
533
  } else if (!isNaN(+d))
533
534
  switch (i) {
534
535
  case "add":
535
- g = g && g.add(d, n);
536
+ x = x && x.add(d, n);
536
537
  break;
537
538
  case "minus":
538
- g = g && g.subtract(d, n);
539
+ x = x && x.subtract(d, n);
539
540
  }
540
541
  }
541
- if (g && (e.fieldValue = g == null ? void 0 : g.format(c)), m === "rangeValue" && a.startTime && a.endTime) {
542
+ if (x && (e.fieldValue = x == null ? void 0 : x.format(c)), m === "rangeValue" && a.startTime && a.endTime) {
542
543
  const w = Je(c);
543
544
  w && (e.fieldValue = V(a.endTime).diff(V(a.startTime), w) + 1);
544
545
  }
545
546
  e.dateFormat = c;
546
547
  } else
547
- K(S, ol) ? s && x ? e.fieldValue = x[s] : !s && x ? e.fieldValue = x.value : e.fieldValue = V(b) : e.fieldValue = V(b);
548
+ K(S, ol) ? s && g ? e.fieldValue = g[s] : !s && g ? e.fieldValue = g.value : e.fieldValue = V(b) : e.fieldValue = V(b);
548
549
  }
549
550
  const se = (e) => {
550
551
  var o;
@@ -608,10 +609,10 @@ const se = (e) => {
608
609
  rowHeaderList: S = [],
609
610
  dimensionList: A = [],
610
611
  // 文本组件的维度列表
611
- seriesList: x = [],
612
+ seriesList: g = [],
612
613
  leftAxisList: c = [],
613
614
  rightAxisList: m = [],
614
- queryColumnList: g = [],
615
+ queryColumnList: x = [],
615
616
  indicators: w = [],
616
617
  controlList: N = [],
617
618
  formFields: v = {},
@@ -686,10 +687,10 @@ const se = (e) => {
686
687
  }
687
688
  }
688
689
  let Te;
689
- if (Array.isArray(x) && x.length > 0) {
690
- const L = x.length;
690
+ if (Array.isArray(g) && g.length > 0) {
691
+ const L = g.length;
691
692
  for (let T = 0; T < L; T++) {
692
- const p = x[T] || {}, { label: G = "", name: D = "", show: j = !1, sort: Q, customGroup: q, conditions: F, typeGuid: k } = p;
693
+ const p = g[T] || {}, { label: G = "", name: D = "", show: j = !1, sort: Q, customGroup: q, conditions: F, typeGuid: k } = p;
693
694
  if (j || L === 1) {
694
695
  Te = {
695
696
  label: G.trim(),
@@ -715,7 +716,7 @@ const se = (e) => {
715
716
  L.location = "LEFT", B.push(Ae(L, H));
716
717
  });
717
718
  const J = [];
718
- ["ecanList", "ecanCirculate"].includes(t) && (u == null ? void 0 : u.length) > 1 && (g = u), (Ie = (Ve = o == null ? void 0 : o.pivotTableCal) == null ? void 0 : Ve.dimensions) != null && Ie.length && (g = o.pivotTableCal.dimensions), g == null || g.forEach((L) => {
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) => {
719
720
  const { label: T, name: p, location: G, show: D, indexCode: j, sort: Q, typeGuid: q, indexCodeNum: F, dateFormat: k, conditions: R } = L;
720
721
  let M = se(Q);
721
722
  if (o.sort) {
@@ -913,8 +914,8 @@ const se = (e) => {
913
914
  if (r === 1) {
914
915
  const f = [];
915
916
  for (let b = 0; b < d; b++) {
916
- const u = t[b], { label: S, value: A } = u, x = Y(C({}, e[0]), { value: e[0][A] });
917
- y.add(S), f.push(x);
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);
918
919
  }
919
920
  const a = e[0][l] || "";
920
921
  s.set(a, f);
@@ -923,7 +924,7 @@ const se = (e) => {
923
924
  const a = e[f], b = a[l];
924
925
  y.add(b);
925
926
  for (let u = 0; u < d; u++) {
926
- const S = t[u], { label: A, value: x } = S, c = Y(C({}, a), { value: a[x] });
927
+ const S = t[u], { label: A, value: g } = S, c = Y(C({}, a), { value: a[g] });
927
928
  if (s.has(A)) {
928
929
  const m = s.get(A);
929
930
  m.push(c), s.set(A, m);
@@ -1009,13 +1010,13 @@ const cl = (e, o, l) => {
1009
1010
  }, yl = (e, o, l) => {
1010
1011
  const t = e.yAxisLabelFormatter, y = e.xAxisLabelFormatter, { dimensions: s = [], dataset: r = [] } = o, d = oe(() => {
1011
1012
  const { gradientShow: i, gradientColors: f, gradientOffset: a, barBorderRadius: b } = e, u = r, S = u.length, A = [];
1012
- for (let x = 0; x < S; x++) {
1013
- const c = Y(C({}, u[x]), {
1013
+ for (let g = 0; g < S; g++) {
1014
+ const c = Y(C({}, u[g]), {
1014
1015
  type: "bar",
1015
1016
  barWidth: e.barWidth,
1016
1017
  showBackground: e.showBarBackground
1017
- }), { isStack: m, stackColumns: g } = e;
1018
- if (m && g.includes(u[x].name || !g) && (c.stack = "stack"), c.label = {
1018
+ }), { isStack: m, stackColumns: x } = e;
1019
+ if (m && x.includes(u[g].name || !x) && (c.stack = "stack"), c.label = {
1019
1020
  show: e.labelShow,
1020
1021
  fontSize: e.labelFontSize,
1021
1022
  position: e.labelPosition,
@@ -1051,13 +1052,13 @@ const cl = (e, o, l) => {
1051
1052
  y2: e.isUseHorizontalAxis ? 0 : 1,
1052
1053
  colorStops: [{
1053
1054
  offset: 0,
1054
- color: e.colors[x]
1055
+ color: e.colors[g]
1055
1056
  }, {
1056
1057
  offset: a,
1057
- color: f[x]
1058
+ color: f[g]
1058
1059
  }, {
1059
1060
  offset: 1,
1060
- color: f[x]
1061
+ color: f[g]
1061
1062
  }]
1062
1063
  }
1063
1064
  }), b) {
@@ -1098,21 +1099,21 @@ const cl = (e, o, l) => {
1098
1099
  let a = "", b = e.tooltipFormatter;
1099
1100
  b === "" && (b = "{marker} {a} {c}");
1100
1101
  for (let u = 0; u < f; u++) {
1101
- const { marker: S, seriesName: A, name: x, value: c, data: m } = i[u] || {};
1102
+ const { marker: S, seriesName: A, name: g, value: c, data: m } = i[u] || {};
1102
1103
  if (u === 0) {
1103
- let g = x;
1104
- typeof x == "string" && x[0] === "0" && !isNaN(+x) && (g = (+x).toString()), a += `${te(y, g)}<br/>`;
1104
+ let x = g;
1105
+ typeof g == "string" && g[0] === "0" && !isNaN(+g) && (x = (+g).toString()), a += `${te(y, x)}<br/>`;
1105
1106
  }
1106
1107
  a += ie(
1107
1108
  b,
1108
1109
  {
1109
1110
  textData: C({
1110
1111
  marker: S,
1111
- name: x,
1112
+ name: g,
1112
1113
  value: c,
1113
1114
  Qfw: el,
1114
1115
  a: A,
1115
- b: x,
1116
+ b: g,
1116
1117
  c: c || 0
1117
1118
  }, m)
1118
1119
  },
@@ -1308,16 +1309,16 @@ const cl = (e, o, l) => {
1308
1309
  let a = "", b = e.tooltipFormatter;
1309
1310
  b === "" && (b = "{marker} {a} {c}");
1310
1311
  for (let u = 0; u < f; u++) {
1311
- const { marker: S, seriesName: A, name: x, value: c, data: m } = i[u] || {};
1312
- u === 0 && (a += `${x}<br/>`), a += ie(
1312
+ const { marker: S, seriesName: A, name: g, value: c, data: m } = i[u] || {};
1313
+ u === 0 && (a += `${g}<br/>`), a += ie(
1313
1314
  b,
1314
1315
  {
1315
1316
  textData: C({
1316
1317
  marker: S,
1317
- name: x,
1318
+ name: g,
1318
1319
  value: c,
1319
1320
  a: A,
1320
- b: x,
1321
+ b: g,
1321
1322
  c
1322
1323
  }, m)
1323
1324
  },
@@ -1519,8 +1520,8 @@ const cl = (e, o, l) => {
1519
1520
  yAxisIndex: S
1520
1521
  }, y[a]);
1521
1522
  if (u === "line") {
1522
- const x = {};
1523
- e.shadowColor && (x.shadowColor = e.shadowColor, x.shadowBlur = e.shadowBlur, x.shadowOffsetY = e.shadowOffsetY, x.shadowOffsetX = e.shadowOffsetX), A = Y(C({}, A), {
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), {
1524
1525
  symbolSize: e.symbolSize,
1525
1526
  smooth: e.smooth,
1526
1527
  itemStyle: {
@@ -1546,11 +1547,11 @@ const cl = (e, o, l) => {
1546
1547
  },
1547
1548
  lineStyle: C({
1548
1549
  width: e.lineStyleWidth
1549
- }, x)
1550
+ }, g)
1550
1551
  });
1551
1552
  }
1552
1553
  if (u === "bar") {
1553
- const { gradientShow: x, gradientColors: c, gradientOffset: m } = e, g = {};
1554
+ const { gradientShow: g, gradientColors: c, gradientOffset: m } = e, x = {};
1554
1555
  if (e.barBorderRadius) {
1555
1556
  const w = e.barBorderRadius.split(",");
1556
1557
  if (w != null && w.length) {
@@ -1559,10 +1560,10 @@ const cl = (e, o, l) => {
1559
1560
  const E = parseFloat(v);
1560
1561
  isNaN(E) || N.push(E);
1561
1562
  }
1562
- g.borderRadius = N;
1563
+ x.borderRadius = N;
1563
1564
  }
1564
1565
  }
1565
- x && (g.color = {
1566
+ g && (x.color = {
1566
1567
  x: 0,
1567
1568
  y: 0,
1568
1569
  x2: 0,
@@ -1579,7 +1580,7 @@ const cl = (e, o, l) => {
1579
1580
  }]
1580
1581
  }), A = Y(C({}, A), {
1581
1582
  barWidth: e.barWidth,
1582
- itemStyle: g
1583
+ itemStyle: x
1583
1584
  });
1584
1585
  }
1585
1586
  e.isShowMarkLine && (A.markLine = {
@@ -1645,19 +1646,19 @@ const cl = (e, o, l) => {
1645
1646
  a === "" && (a = "{marker} {a} {c}");
1646
1647
  const b = e.seriesTypes;
1647
1648
  for (let u = 0; u < i; u++) {
1648
- const S = b[u], { tooltipFormatter: A } = S || {}, { marker: x, seriesName: c, name: m, value: g, data: w } = n[u] || {};
1649
+ const S = b[u], { tooltipFormatter: A } = S || {}, { marker: g, seriesName: c, name: m, value: x, data: w } = n[u] || {};
1649
1650
  u === 0 && (f += `${m}<br/>`), f += ie(
1650
1651
  // 如果系列有提示框组件就使用自定义,没有就用默认的
1651
1652
  A || a,
1652
1653
  {
1653
1654
  textData: C({
1654
- marker: x,
1655
+ marker: g,
1655
1656
  name: m,
1656
- value: g,
1657
+ value: x,
1657
1658
  seriesName: c,
1658
1659
  a: c,
1659
1660
  b: m,
1660
- c: g
1661
+ c: x
1661
1662
  }, w)
1662
1663
  },
1663
1664
  {