g-ui-web 1.1.25 → 1.1.27

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/lib/g-ui-web.js CHANGED
@@ -48722,7 +48722,7 @@ class K3 {
48722
48722
  R0(this, "events");
48723
48723
  if (this.events = {}, !t)
48724
48724
  throw console.error("dataUrl is undefined or null"), new Error("Invalid dataUrl");
48725
- if (typeof t == "string" || typeof t == "number" || typeof t == "object" && t !== null && !t.path)
48725
+ if (!(t != null && t.path) && !["string", "number"].includes(typeof t) && !Array.isArray(t) || Array.isArray(t) && !t.some((r) => r.path))
48726
48726
  this.loadStaticData(t);
48727
48727
  else if (Array.isArray(t)) {
48728
48728
  if (!t.some((r) => r && r.path))
@@ -95500,87 +95500,129 @@ const Clt = (e, t) => {
95500
95500
  let i = z(0);
95501
95501
  const s = z(!1), l = z(), u = z(null), c = z({});
95502
95502
  let d = null, f = z(!1);
95503
- const p = async (v) => {
95504
- if (ya(v)) {
95503
+ const p = async (g) => {
95504
+ if (ya(g)) {
95505
95505
  s.value = !0;
95506
95506
  return;
95507
95507
  } else
95508
95508
  s.value = !1;
95509
- const g = Zd(o.dbOptions.xAxisField);
95510
- f.value = !1;
95511
- let m = z([]), _ = zp(o.options), b = [], w = [], C = {
95509
+ const m = Zd(o.dbOptions.xAxisField), { newDbO: _, newData: b } = h(o.dbOptions, g);
95510
+ console.log(_, b), g = b, f.value = !1;
95511
+ let w = z([]), C = zp(o.options), x = [], S = [], E = {
95512
95512
  xAxis: [],
95513
95513
  series: []
95514
95514
  };
95515
- if (d = v, m.value = v, f.value = !0, m.value && o.dbOptions) {
95516
- m.value.map((S) => {
95517
- w.push(
95518
- g == "function" ? o.dbOptions.xAxisField(S) : S[o.dbOptions.xAxisField]
95515
+ if (d = g, w.value = g, f.value = !0, w.value && _) {
95516
+ w.value.map((A) => {
95517
+ S.push(
95518
+ m == "function" ? _.xAxisField(A) : A[_.xAxisField]
95519
95519
  );
95520
95520
  });
95521
- let x = [];
95522
- if (o.dbOptions.yAxis && o.dbOptions.yAxis.yAxisFields ? x = o.dbOptions.columns.map((S) => {
95523
- const E = o.dbOptions.yAxis.yAxisFields.find((T) => T.field === S.field);
95524
- return E ? { ...S, ...E } : S;
95521
+ let T = [];
95522
+ if (_.yAxis && _.yAxis.yAxisFields ? T = _.columns.map((A) => {
95523
+ const M = _.yAxis.yAxisFields.find((k) => k.field === A.field);
95524
+ return M ? { ...A, ...M } : A;
95525
95525
  }).concat(
95526
- o.dbOptions.yAxis.yAxisFields.filter(
95527
- (S) => !o.dbOptions.columns.some((E) => E.field === S.field)
95526
+ _.yAxis.yAxisFields.filter(
95527
+ (A) => !_.columns.some((M) => M.field === A.field)
95528
95528
  )
95529
- ) : x = o.dbOptions.columns, x.map((S) => {
95530
- let E = {
95529
+ ) : T = _.columns, T.map((A) => {
95530
+ let M = {
95531
95531
  name: "",
95532
- type: S.type || "line",
95533
- yAxisIndex: S.yAxisIndex,
95534
- stack: S.stack,
95532
+ type: A.type || "line",
95533
+ yAxisIndex: A.yAxisIndex,
95534
+ stack: A.stack,
95535
95535
  data: [],
95536
- lineStyle: S.lineStyle,
95537
- areaStyle: S.areaStyle
95536
+ lineStyle: A.lineStyle,
95537
+ areaStyle: A.areaStyle
95538
95538
  };
95539
- m.value.map((T) => {
95540
- E.name = T[S.title] || S.title, E.data.push(T[S.field]);
95541
- }), b.push(E);
95542
- }), _) {
95543
- if (_.xAxis ? _.xAxis[0].data = w : _.xAxis = [{ data: w }], _.series ? _.series = An({}, _.series, b) : _.series = b, o.dbOptions && o.dbOptions.yAxis && o.dbOptions.yAxis.yAxises) {
95544
- let S = [];
95545
- o.dbOptions.yAxis.yAxises.map((E) => {
95546
- let T = {
95547
- name: E.name,
95539
+ w.value.map((k) => {
95540
+ M.name = k[A.title] || A.title, M.data.push(k[A.field]);
95541
+ }), x.push(M);
95542
+ }), C) {
95543
+ if (C.xAxis ? C.xAxis[0].data = S : C.xAxis = [{ data: S }], C.series ? C.series = An({}, C.series, x) : C.series = x, _ && _.yAxis && _.yAxis.yAxises) {
95544
+ let A = [];
95545
+ _.yAxis.yAxises.map((M) => {
95546
+ let k = {
95547
+ name: M.name,
95548
95548
  type: "value",
95549
- position: E.position,
95550
- alignTicks: E.alignTicks,
95551
- offset: E.offset
95549
+ position: M.position,
95550
+ alignTicks: M.alignTicks,
95551
+ offset: M.offset
95552
95552
  };
95553
- S.push(T);
95554
- }), _.yAxis = An({}, _.yAxis, S);
95553
+ A.push(k);
95554
+ }), C.yAxis = An({}, C.yAxis, A);
95555
95555
  }
95556
95556
  } else
95557
- C.xAxis = [{ data: w }], C.series = b;
95558
- }
95559
- _ ? l.value = UB(_, o.dbOptions.columns) : l.value = UB(C, o.dbOptions.columns);
95557
+ E.xAxis = [{ data: S }], E.series = x;
95558
+ }
95559
+ C ? l.value = UB(C, _.columns) : l.value = UB(E, _.columns);
95560
+ }, h = (g, m) => {
95561
+ if (g.groupField) {
95562
+ const _ = g.groupField, b = g.xAxisField, w = g.columns && g.columns[0].field, C = m, x = [...new Set(C.map((A) => A[_]))], S = [];
95563
+ x.forEach((A, M) => {
95564
+ C.filter((O) => O[_] === A).forEach((O) => {
95565
+ const V = S.find((L) => L[b] === O[b]);
95566
+ if (V)
95567
+ V[`${_}${M + 1}`] = A, V[`${w}${M + 1}`] = O[w];
95568
+ else {
95569
+ const L = {
95570
+ [b]: O[b],
95571
+ [`${_}${M + 1}`]: A,
95572
+ [`${w}${M + 1}`]: O[w]
95573
+ };
95574
+ for (let P = 0; P < x.length; P++)
95575
+ P !== M && (L[`${_}${P + 1}`] = "", L[`${w}${P + 1}`] = 0);
95576
+ S.push(L);
95577
+ }
95578
+ });
95579
+ });
95580
+ const E = [];
95581
+ return x.forEach((A, M) => {
95582
+ g.columns.forEach((k, O) => {
95583
+ E.push({
95584
+ title: A,
95585
+ field: `${k.field}${M + 1}`
95586
+ });
95587
+ });
95588
+ }), {
95589
+ newDbO: {
95590
+ xAxisField: g.xAxisField,
95591
+ groupField: g.groupField,
95592
+ columns: E,
95593
+ data: S
95594
+ },
95595
+ newData: S
95596
+ };
95597
+ } else
95598
+ return {
95599
+ newDbO: g,
95600
+ newData: m
95601
+ };
95560
95602
  };
95561
95603
  ke(
95562
95604
  () => o.dbOptions.data,
95563
- (v) => {
95564
- c.value = Kt(v);
95565
- const g = ["http://", "https://", void 0];
95566
- v ? (typeof v == "object" && !v.path && !v.dsKey && !c.value.dataUrl && !(typeof v == "string" && g.some((m) => v.includes(m))) && c.value.loadStaticData(v), (typeof v == "string" || typeof v == "object") && (v.path || v.data && typeof v.data == "string") && c.value.reload(v.data || v)) : console.warn("props.dbOptions.data is undefined");
95605
+ (g) => {
95606
+ c.value = Kt(g);
95607
+ const m = ["http://", "https://", void 0];
95608
+ g ? (typeof g == "object" && !g.path && !g.dsKey && !c.value.dataUrl && !(typeof g == "string" && m.some((_) => g.includes(_))) && c.value.loadStaticData(g), (typeof g == "string" || typeof g == "object") && (g.path || g.data && typeof g.data == "string") && c.value.reload(g.data || g)) : console.warn("props.dbOptions.data is undefined");
95567
95609
  },
95568
95610
  {
95569
95611
  deep: !0
95570
95612
  }
95571
95613
  ), ke(
95572
95614
  () => n["gui-theme"],
95573
- async (v) => {
95615
+ async (g) => {
95574
95616
  c.value = null, xe(async () => {
95575
- i++, c.value = Kt(o.dbOptions.data), p(c.value.data), c.value.on("load", (g) => {
95576
- p(g);
95617
+ i++, c.value = Kt(o.dbOptions.data), p(c.value.data), c.value.on("load", (m) => {
95618
+ p(m);
95577
95619
  });
95578
95620
  });
95579
95621
  },
95580
95622
  { deep: !0 }
95581
95623
  ), xe(async () => {
95582
- c.value = Kt(o.dbOptions.data), c.value.on("load", (v) => {
95583
- p(v);
95624
+ c.value = Kt(o.dbOptions.data), c.value.on("load", (g) => {
95625
+ p(g);
95584
95626
  });
95585
95627
  }), t({
95586
95628
  props: o,
@@ -95592,24 +95634,24 @@ const Clt = (e, t) => {
95592
95634
  return f.value;
95593
95635
  }
95594
95636
  });
95595
- const h = (v) => {
95596
- a("chart-click", v);
95637
+ const v = (g) => {
95638
+ a("chart-click", g);
95597
95639
  };
95598
- return (v, g) => {
95599
- const m = vt("g-chart");
95640
+ return (g, m) => {
95641
+ const _ = vt("g-chart");
95600
95642
  return D(), $("div", Blt, [
95601
- (D(), Se(m, Pt({ options: l.value }, v.$attrs, {
95643
+ (D(), Se(_, Pt({ options: l.value }, g.$attrs, {
95602
95644
  ref_key: "lineRef",
95603
95645
  ref: u,
95604
95646
  isEmpty: s.value,
95605
95647
  description: e.description,
95606
- onClick: h,
95648
+ onClick: v,
95607
95649
  key: y(i)
95608
95650
  }), null, 16, ["options", "isEmpty", "description"]))
95609
95651
  ]);
95610
95652
  };
95611
95653
  }
95612
- }), Wlt = /* @__PURE__ */ Qn(Hlt, [["__scopeId", "data-v-1cd424a9"]]), Glt = rr(Wlt), wm = Tr(), Gf = document.documentElement, Ult = (e) => e || "-", Klt = (e) => e || "", Ylt = (e, t) => {
95654
+ }), Wlt = /* @__PURE__ */ Qn(Hlt, [["__scopeId", "data-v-56a72cc0"]]), Glt = rr(Wlt), wm = Tr(), Gf = document.documentElement, Ult = (e) => e || "-", Klt = (e) => e || "", Ylt = (e, t) => {
95613
95655
  let r = [];
95614
95656
  for (let n = 0; n <= e; n++)
95615
95657
  r.push({
Binary file