@hybridcore/ui 1.6.5 → 1.6.7

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.
Files changed (34) hide show
  1. package/dist/IconX-C2wmVYSK.js +11 -0
  2. package/dist/components/charts/_common/format.js +55 -0
  3. package/dist/components/charts/_common/utils.js +12 -7
  4. package/dist/components/charts/chart-wrapper/helpers.js +46 -21
  5. package/dist/components/charts/chart-wrapper/logic.js +57 -40
  6. package/dist/components/charts/column-line-mix/logic.js +87 -86
  7. package/dist/components/charts/donut-chart/logic.js +37 -36
  8. package/dist/components/charts/drill-down-treemap/logic.js +123 -123
  9. package/dist/components/charts/drill-down-voronoi-treemap/logic.js +253 -252
  10. package/dist/components/charts/heatmap/logic.js +73 -73
  11. package/dist/components/charts/line/logic.js +201 -103
  12. package/dist/components/charts/logaritmic-scale/logic.js +65 -65
  13. package/dist/components/charts/multiple-value-axes/logic.js +96 -94
  14. package/dist/components/charts/nested-pie/logic.js +43 -42
  15. package/dist/components/charts/packed-circles/logic.js +111 -110
  16. package/dist/components/charts/pie-chart/logic.js +40 -39
  17. package/dist/components/charts/stacked-area-radar/logic.js +68 -67
  18. package/dist/components/charts/stacked-column-chart/logic.js +71 -70
  19. package/dist/components/charts/xy-chart/logic.js +82 -76
  20. package/dist/components/color-picker/index.js +1645 -1602
  21. package/dist/components/color-picker/logic.js +21 -12
  22. package/dist/components/color-picker/styled.js +4 -2
  23. package/dist/components/date-range-picker/index.js +359 -365
  24. package/dist/components/metric-card/helpers.js +12 -5
  25. package/dist/components/metric-card/index.js +58 -54
  26. package/dist/components/metric-card/logic.js +78 -61
  27. package/dist/components/metric-card/styled.js +63 -45
  28. package/dist/components/simple-pivot-table/index.js +129 -54
  29. package/dist/components/simple-pivot-table/logic.js +111 -45
  30. package/dist/components/simple-pivot-table/styled.js +31 -11
  31. package/dist/main.d.ts +125 -8
  32. package/dist/main.js +145 -141
  33. package/dist/{styled-Db1RdcPA.js → styled-SoqbyrkW.js} +116 -89
  34. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
- import { C as L, L as B, k as $, l as J, T as U, R as K, A as Q } from "../../../AnimatedTheme-jnasw6rT.js";
2
- import { useThemeProps as Z, useTheme as ee } from "@mui/material";
3
- import te from "dayjs";
1
+ import { C as L, L as E, k as J, l as K, T as W, R as Q, A as Z } from "../../../AnimatedTheme-jnasw6rT.js";
2
+ import { useThemeProps as ee, useTheme as te } from "@mui/material";
3
+ import re from "dayjs";
4
4
  import T from "lodash";
5
- import { useId as re, useRef as ae, useEffect as ie } from "react";
6
- import { colorSetFromPalette as se } from "../_common/utils.js";
7
- import { m as E, f as oe, u as S, b as u, p as P, c as Y } from "../../../ColorSet-C7vpNXhM.js";
8
- import { X as ne } from "../../../AxisRenderer-DTyLLA6c.js";
9
- import { A as le, a as he } from "../../../AxisRendererY-C_ItLPNV.js";
5
+ import { useId as ae, useRef as ie, useEffect as se } from "react";
6
+ import { applyValueFormat as oe, colorSetFromPalette as ne } from "../_common/utils.js";
7
+ import { m as S, f as le, u as U, b as u, p as P, c as Y } from "../../../ColorSet-C7vpNXhM.js";
8
+ import { X as he } from "../../../AxisRenderer-DTyLLA6c.js";
9
+ import { A as ce, a as ue } from "../../../AxisRendererY-C_ItLPNV.js";
10
10
  import { C as R } from "../../../CategoryAxis-CwnfaGc8.js";
11
- import { R as ce } from "../../../RoundedRectangle-CWLi2PXn.js";
12
- import { L as ue } from "../../../LinearGradient-DiRq5YcI.js";
13
- import { C as de } from "../../../ColumnSeries-CjgdJ2QL.js";
11
+ import { R as de } from "../../../RoundedRectangle-CWLi2PXn.js";
12
+ import { L as me } from "../../../LinearGradient-DiRq5YcI.js";
13
+ import { C as pe } from "../../../ColumnSeries-CjgdJ2QL.js";
14
14
  class _ extends L {
15
15
  constructor() {
16
16
  super(...arguments), Object.defineProperty(this, "labelContainer", {
@@ -27,23 +27,23 @@ class _ extends L {
27
27
  enumerable: !0,
28
28
  configurable: !0,
29
29
  writable: !0,
30
- value: this.labelContainer.children.push(B.new(this._root, { themeTags: ["start"] }))
30
+ value: this.labelContainer.children.push(E.new(this._root, { themeTags: ["start"] }))
31
31
  }), Object.defineProperty(this, "endLabel", {
32
32
  enumerable: !0,
33
33
  configurable: !0,
34
34
  writable: !0,
35
- value: this.labelContainer.children.push(B.new(this._root, { themeTags: ["end"] }))
35
+ value: this.labelContainer.children.push(E.new(this._root, { themeTags: ["end"] }))
36
36
  }), Object.defineProperty(this, "markers", {
37
37
  enumerable: !0,
38
38
  configurable: !0,
39
39
  writable: !0,
40
- value: this.addDisposer(new $(J.new({}), () => ce._new(this._root, {
41
- themeTags: E(this.markers.template.get("themeTags", []), [this.get("orientation"), "heatlegend", "marker"])
40
+ value: this.addDisposer(new J(K.new({}), () => de._new(this._root, {
41
+ themeTags: S(this.markers.template.get("themeTags", []), [this.get("orientation"), "heatlegend", "marker"])
42
42
  }, [this.markers.template])))
43
43
  });
44
44
  }
45
45
  _afterNew() {
46
- this._settings.themeTags = E(this._settings.themeTags, ["heatlegend", this._settings.orientation]), super._afterNew(), this.set("tooltip", U.new(this._root, {
46
+ this._settings.themeTags = S(this._settings.themeTags, ["heatlegend", this._settings.orientation]), super._afterNew(), this.set("tooltip", W.new(this._root, {
47
47
  themeTags: ["heatlegend"]
48
48
  }));
49
49
  }
@@ -63,55 +63,55 @@ class _ extends L {
63
63
  * @param text Text
64
64
  * @param color Color
65
65
  */
66
- showValue(s, r, a) {
66
+ showValue(s, a, t) {
67
67
  const i = this.getTooltip();
68
- if (i && oe(s)) {
68
+ if (i && le(s)) {
69
69
  const d = this.get("startValue", 0), o = this.get("endValue", 1);
70
- let t = (s - d) / (o - d);
71
- (t == 1 / 0 || t == -1 / 0 || isNaN(t)) && (t = 0.5);
70
+ let r = (s - d) / (o - d);
71
+ (r == 1 / 0 || r == -1 / 0 || isNaN(r)) && (r = 0.5);
72
72
  const f = this.get("startColor"), y = this.get("endColor");
73
- r || (r = this.getNumberFormatter().format(s)), a || (a = S.interpolate(t, f, y)), i.label.set("text", r);
73
+ a || (a = this.getNumberFormatter().format(s)), t || (t = U.interpolate(r, f, y)), i.label.set("text", a);
74
74
  let n;
75
- this.get("orientation") == "vertical" ? n = this.markerContainer.toGlobal({ x: 0, y: this.innerHeight() * (1 - t) }) : n = this.markerContainer.toGlobal({ x: this.innerWidth() * t, y: 0 });
75
+ this.get("orientation") == "vertical" ? n = this.markerContainer.toGlobal({ x: 0, y: this.innerHeight() * (1 - r) }) : n = this.markerContainer.toGlobal({ x: this.innerWidth() * r, y: 0 });
76
76
  let l = i.get("background");
77
- l && l.set("fill", a), i.set("pointTo", n), i.show();
77
+ l && l.set("fill", t), i.set("pointTo", n), i.show();
78
78
  }
79
79
  }
80
80
  _prepareChildren() {
81
81
  super._prepareChildren();
82
- const s = this.labelContainer, r = this.get("orientation"), a = this.startLabel, i = this.endLabel, d = this.getTooltip();
83
- if (this.isDirty("orientation") && (r == "vertical" ? (this.markerContainer.setAll({ layout: this._root.verticalLayout, height: u }), this.set("layout", this._root.horizontalLayout), a.setAll({ y: u, x: void 0, centerY: u, centerX: u }), i.setAll({ y: 0, x: void 0, centerY: 0, centerX: u }), s.setAll({ height: u, width: void 0 }), d && d.set("pointerOrientation", "horizontal")) : (this.markerContainer.setAll({ layout: this._root.horizontalLayout, width: u }), this.set("layout", this._root.verticalLayout), a.setAll({ x: 0, y: void 0, centerX: 0, centerY: 0 }), i.setAll({ x: u, y: void 0, centerX: u, centerY: 0 }), s.setAll({ width: u, height: void 0 }), d && d.set("pointerOrientation", "vertical"))), this.isDirty("stepCount")) {
84
- const o = this.get("stepCount", 1), t = this.get("startColor"), f = this.get("endColor"), y = this.get("startOpacity", 1), n = this.get("endOpacity", 1);
82
+ const s = this.labelContainer, a = this.get("orientation"), t = this.startLabel, i = this.endLabel, d = this.getTooltip();
83
+ if (this.isDirty("orientation") && (a == "vertical" ? (this.markerContainer.setAll({ layout: this._root.verticalLayout, height: u }), this.set("layout", this._root.horizontalLayout), t.setAll({ y: u, x: void 0, centerY: u, centerX: u }), i.setAll({ y: 0, x: void 0, centerY: 0, centerX: u }), s.setAll({ height: u, width: void 0 }), d && d.set("pointerOrientation", "horizontal")) : (this.markerContainer.setAll({ layout: this._root.horizontalLayout, width: u }), this.set("layout", this._root.verticalLayout), t.setAll({ x: 0, y: void 0, centerX: 0, centerY: 0 }), i.setAll({ x: u, y: void 0, centerX: u, centerY: 0 }), s.setAll({ width: u, height: void 0 }), d && d.set("pointerOrientation", "vertical"))), this.isDirty("stepCount")) {
84
+ const o = this.get("stepCount", 1), r = this.get("startColor"), f = this.get("endColor"), y = this.get("startOpacity", 1), n = this.get("endOpacity", 1);
85
85
  if (this.markerContainer.children.clear(), o > 1)
86
86
  for (let l = 0; l < o; l++) {
87
87
  const h = this.makeMarker();
88
- r == "vertical" ? this.markerContainer.children.moveValue(h, 0) : this.markerContainer.children.push(h), t && f && h.setAll({
89
- fill: S.interpolate(l / o, t, f),
88
+ a == "vertical" ? this.markerContainer.children.moveValue(h, 0) : this.markerContainer.children.push(h), r && f && h.setAll({
89
+ fill: U.interpolate(l / o, r, f),
90
90
  fillOpacity: P(l / o * 100).interpolate(y, n)
91
91
  });
92
92
  }
93
93
  else if (o == 1) {
94
94
  const l = this.makeMarker();
95
95
  this.markerContainer.children.push(l);
96
- const h = ue.new(this._root, {
96
+ const h = me.new(this._root, {
97
97
  stops: [{
98
- color: t,
98
+ color: r,
99
99
  opacity: y
100
100
  }, {
101
101
  color: f,
102
102
  opacity: n
103
103
  }]
104
104
  });
105
- if (r == "vertical") {
105
+ if (a == "vertical") {
106
106
  h.set("rotation", 90);
107
107
  let b = h.get("stops");
108
108
  b && b.reverse();
109
109
  } else
110
110
  h.set("rotation", 0);
111
- t && f && l.set("fillGradient", h);
111
+ r && f && l.set("fillGradient", h);
112
112
  }
113
113
  }
114
- (this.isDirty("startText") || this.isDirty("startValue")) && a.set("text", this.get("startText", this.getNumberFormatter().format(this.get("startValue", 0)))), (this.isDirty("endText") || this.isDirty("endValue")) && i.set("text", this.get("endText", this.getNumberFormatter().format(this.get("endValue", 1))));
114
+ (this.isDirty("startText") || this.isDirty("startValue")) && t.set("text", this.get("startText", this.getNumberFormatter().format(this.get("startValue", 0)))), (this.isDirty("endText") || this.isDirty("endValue")) && i.set("text", this.get("endText", this.getNumberFormatter().format(this.get("endValue", 1))));
115
115
  }
116
116
  }
117
117
  Object.defineProperty(_, "className", {
@@ -126,31 +126,31 @@ Object.defineProperty(_, "classNames", {
126
126
  writable: !0,
127
127
  value: L.classNames.concat([_.className])
128
128
  });
129
- const Ye = (X) => {
130
- const s = Z({ props: X, name: "HCHeatmap" }), {
131
- dimensions: r,
132
- values: a,
129
+ const _e = (X) => {
130
+ const s = ee({ props: X, name: "HCHeatmap" }), {
131
+ dimensions: a,
132
+ values: t,
133
133
  data: i,
134
134
  initDelay: d = 0,
135
135
  baseInterval: o,
136
- colors: t,
136
+ colors: r,
137
137
  sx: f,
138
138
  ...y
139
- } = s, n = ee(), h = `hc-heatmap-${re().replace(/:/g, "")}`, b = ae(null);
139
+ } = s, n = te(), h = `hc-heatmap-${ae().replace(/:/g, "")}`, b = ie(null);
140
140
  let x = null;
141
- r.length < 2 ? x = "Heatmap requires at least 2 dimensions" : a.length < 1 && (x = "Heatmap requires at least 1 value"), ie(() => {
141
+ a.length < 2 ? x = "Heatmap requires at least 2 dimensions" : t.length < 1 && (x = "Heatmap requires at least 1 value"), se(() => {
142
142
  if (x) return;
143
143
  let D;
144
144
  return D = setTimeout(() => {
145
- var j, M;
146
- const e = K.new(h);
147
- b.current = e, e.setThemes([Q.new(e)]), e.interfaceColors.setAll({
145
+ var j, M, G;
146
+ const e = Q.new(h);
147
+ b.current = e, oe(e, (j = t == null ? void 0 : t[0]) == null ? void 0 : j.format), e.setThemes([Z.new(e)]), e.interfaceColors.setAll({
148
148
  text: Y(n.palette.text.primary),
149
149
  grid: Y(n.palette.divider),
150
150
  stroke: Y(n.palette.divider)
151
151
  });
152
152
  const m = e.container.children.push(
153
- ne.new(e, {
153
+ he.new(e, {
154
154
  panX: !1,
155
155
  panY: !1,
156
156
  wheelX: "none",
@@ -158,13 +158,13 @@ const Ye = (X) => {
158
158
  layout: e.verticalLayout
159
159
  })
160
160
  );
161
- m.set("colors", se(e, t));
162
- const O = le.new(e, {
161
+ m.set("colors", ne(e, r));
162
+ const O = ce.new(e, {
163
163
  visible: !1,
164
164
  minGridDistance: 30
165
165
  });
166
166
  O.grid.template.set("visible", !1);
167
- const c = r[0];
167
+ const c = a[0];
168
168
  let k, v = i;
169
169
  if (c.type === "date") {
170
170
  const p = (o == null ? void 0 : o.timeUnit) || "day";
@@ -176,19 +176,19 @@ const Ye = (X) => {
176
176
  })
177
177
  ), v = T.orderBy(i, [c.value]), v = v.map((w) => ({
178
178
  ...w,
179
- [c.value]: te(w[c.value]).format(C)
179
+ [c.value]: re(w[c.value]).format(C)
180
180
  }));
181
181
  } else
182
182
  k = m.xAxes.push(
183
183
  R.new(e, {
184
184
  categoryField: c.value,
185
185
  renderer: O,
186
- tooltip: U.new(e, {})
186
+ tooltip: W.new(e, {})
187
187
  })
188
188
  );
189
189
  const H = T.uniqBy(v, c.value);
190
- if (k.data.setAll(H), a.length === 1 && r.length > 1) {
191
- const p = r[1].value, C = he.new(e, {
190
+ if (k.data.setAll(H), t.length === 1 && a.length > 1) {
191
+ const p = a[1].value, C = ue.new(e, {
192
192
  visible: !1,
193
193
  minGridDistance: 20,
194
194
  inversed: !0
@@ -200,16 +200,16 @@ const Ye = (X) => {
200
200
  renderer: C,
201
201
  categoryField: p
202
202
  })
203
- ), G = e.interfaceColors.get("background"), N = m.bottomAxesContainer.children.push(
203
+ ), I = e.interfaceColors.get("background"), F = m.bottomAxesContainer.children.push(
204
204
  _.new(e, {
205
205
  orientation: "horizontal",
206
- startColor: G,
207
- endColor: (j = m.get("colors")) == null ? void 0 : j.getIndex(0),
206
+ startColor: I,
207
+ endColor: (M = m.get("colors")) == null ? void 0 : M.getIndex(0),
208
208
  startOpacity: 1,
209
209
  endOpacity: 1
210
210
  })
211
211
  ), g = m.series.push(
212
- de.new(e, {
212
+ pe.new(e, {
213
213
  calculateAggregates: !0,
214
214
  stroke: Y(16777215),
215
215
  clustered: !1,
@@ -217,7 +217,7 @@ const Ye = (X) => {
217
217
  yAxis: w,
218
218
  categoryXField: c.value,
219
219
  categoryYField: p,
220
- valueField: a[0].dataFieldName
220
+ valueField: t[0].dataFieldName
221
221
  })
222
222
  );
223
223
  g.columns.template.setAll({
@@ -228,41 +228,41 @@ const Ye = (X) => {
228
228
  height: P(100)
229
229
  }), g.columns.template.events.on("pointerover", function(V) {
230
230
  const A = V.target.dataItem;
231
- A && N.showValue(A.get(p, 0));
231
+ A && F.showValue(A.get(p, 0));
232
232
  }), g.events.on("datavalidated", function() {
233
- N.set("startValue", g.getPrivate("valueLow")), N.set("endValue", g.getPrivate("valueHigh"));
233
+ F.set("startValue", g.getPrivate("valueLow")), F.set("endValue", g.getPrivate("valueHigh"));
234
234
  }), g.set("heatRules", [
235
235
  {
236
236
  target: g.columns.template,
237
- min: G,
238
- max: (M = m.get("colors")) == null ? void 0 : M.getIndex(0),
237
+ min: I,
238
+ max: (G = m.get("colors")) == null ? void 0 : G.getIndex(0),
239
239
  dataField: "value",
240
240
  key: "fill"
241
241
  }
242
242
  ]);
243
- const I = T.uniqBy(v, p), F = [];
243
+ const q = T.uniqBy(v, p), N = [];
244
244
  H.forEach((V) => {
245
- I.forEach((A) => {
246
- const q = {
245
+ q.forEach((A) => {
246
+ const z = {
247
247
  [c.value]: V[c.value],
248
248
  [p]: A[p]
249
- }, z = T.find(v, q);
250
- z === void 0 ? F.push({
251
- ...q,
252
- [a[0].dataFieldName]: 0
253
- }) : F.push(z);
249
+ }, B = T.find(v, z);
250
+ B === void 0 ? N.push({
251
+ ...z,
252
+ [t[0].dataFieldName]: 0
253
+ }) : N.push(B);
254
254
  });
255
- }), w.data.setAll(I), g.data.setAll(F);
255
+ }), w.data.setAll(q), g.data.setAll(N);
256
256
  }
257
257
  m.appear(1e3, 100);
258
258
  }, d), () => {
259
259
  var e;
260
260
  D && clearTimeout(D), (e = b.current) == null || e.dispose(), b.current = null;
261
261
  };
262
- }, [i, r, a, n.palette.mode, t]);
263
- const W = { ...s };
264
- return { chartId: h, ownerState: W, sx: f, error: x, other: y };
262
+ }, [i, a, t, n.palette.mode, r]);
263
+ const $ = { ...s };
264
+ return { chartId: h, ownerState: $, sx: f, error: x, other: y };
265
265
  };
266
266
  export {
267
- Ye as useHeatmapLogic
267
+ _e as useHeatmapLogic
268
268
  };
@@ -1,143 +1,241 @@
1
- import { R as E, a as M, A as V, T as A } from "../../../AnimatedTheme-jnasw6rT.js";
2
- import { useThemeProps as z, useTheme as H } from "@mui/material";
3
- import b from "lodash";
4
- import { useId as N, useRef as S, useEffect as U } from "react";
5
- import { colorSetFromPalette as Z } from "../_common/utils.js";
6
- import { c as i, p as g, b as F } from "../../../ColorSet-C7vpNXhM.js";
7
- import { X as _, V as $ } from "../../../AxisRenderer-DTyLLA6c.js";
8
- import { D as j } from "../../../DateAxis-YX3QNIB-.js";
9
- import { A as D, a as q } from "../../../AxisRendererY-C_ItLPNV.js";
10
- import { C as G } from "../../../CategoryAxis-CwnfaGc8.js";
11
- import { L as J } from "../../../LineSeries-Uiv5o56b.js";
12
- import { D as K } from "../../../DataProcessor-CHDO51q4.js";
13
- import { X as Q } from "../../../XYCursor-C8WktvKM.js";
14
- import { L as ee } from "../../../Legend-Dp_MKfS4.js";
15
- const ge = (L) => {
16
- const v = z({ props: L, name: "HCLineChart" }), {
17
- dimensions: t,
18
- values: c,
19
- data: p,
20
- initDelay: Y = 0,
21
- baseInterval: R,
22
- colors: x,
23
- sx: I,
24
- ...O
25
- } = v, a = H(), w = `hc-line-chart-${N().replace(/:/g, "")}`, u = S(null);
26
- let m = null;
27
- t.length < 1 ? m = "Missing dimensions config!" : c.length < 1 && (m = "Missing values config!"), U(() => {
28
- if (m) return;
29
- let h;
30
- return h = setTimeout(() => {
31
- var k, T, C;
32
- const e = E.new(w);
33
- u.current = e;
34
- const W = M.new(e);
35
- e.setThemes([V.new(e), W]), e.interfaceColors.setAll({
36
- text: i(a.palette.text.primary),
37
- grid: i(a.palette.divider),
38
- stroke: i(a.palette.divider)
1
+ import { R as Z, a as q, A as J, T as K } from "../../../AnimatedTheme-jnasw6rT.js";
2
+ import { useThemeProps as Q, useTheme as ee } from "@mui/material";
3
+ import _ from "lodash";
4
+ import { useId as te, useRef as oe, useEffect as re } from "react";
5
+ import { humanizeLabel as ae } from "../_common/format.js";
6
+ import { colorSetFromPalette as se, applyValueFormat as ne } from "../_common/utils.js";
7
+ import { c, p as k, b as U } from "../../../ColorSet-C7vpNXhM.js";
8
+ import { X as ie, V as le } from "../../../AxisRenderer-DTyLLA6c.js";
9
+ import { D as me } from "../../../DateAxis-YX3QNIB-.js";
10
+ import { A as V, a as de } from "../../../AxisRendererY-C_ItLPNV.js";
11
+ import { C as pe } from "../../../CategoryAxis-CwnfaGc8.js";
12
+ import { L as ce } from "../../../LineSeries-Uiv5o56b.js";
13
+ import { D as ue } from "../../../DataProcessor-CHDO51q4.js";
14
+ import { B as ye } from "../../../Bullet-DVczI2TD.js";
15
+ import { C as fe } from "../../../Circle-Cy5s-pVc.js";
16
+ import { X as he } from "../../../XYCursor-C8WktvKM.js";
17
+ import { L as ge } from "../../../Legend-Dp_MKfS4.js";
18
+ const R = 1.1, Ae = {
19
+ millisecond: 1,
20
+ second: 1e3,
21
+ minute: 6e4,
22
+ hour: 36e5,
23
+ day: 864e5,
24
+ week: 6048e5,
25
+ month: 2592e6,
26
+ year: 31536e6
27
+ }, xe = {
28
+ millisecond: "d MMM, yyyy HH:mm:ss.SSS",
29
+ second: "d MMM, yyyy HH:mm:ss",
30
+ minute: "d MMM, yyyy HH:mm",
31
+ hour: "d MMM, yyyy HH:mm",
32
+ day: "d MMM, yyyy",
33
+ week: "d MMM, yyyy",
34
+ month: "MMM yyyy",
35
+ year: "yyyy"
36
+ }, Ue = (B) => {
37
+ const b = Q({ props: B, name: "HCLineChart" }), {
38
+ dimensions: r,
39
+ values: y,
40
+ data: w,
41
+ initDelay: E = 0,
42
+ baseInterval: l,
43
+ colors: X,
44
+ connectMissingData: T = !0,
45
+ sx: G,
46
+ ...I
47
+ } = b, m = ee(), H = `hc-line-chart-${te().replace(/:/g, "")}`, F = oe(null);
48
+ let v = null;
49
+ r.length < 1 ? v = "Missing dimensions config!" : y.length < 1 && (v = "Missing values config!"), re(() => {
50
+ if (v) return;
51
+ let C;
52
+ return C = setTimeout(() => {
53
+ var $, O, S, Y, P;
54
+ const e = Z.new(H);
55
+ F.current = e;
56
+ const j = q.new(e);
57
+ e.setThemes([J.new(e), j]), e.interfaceColors.setAll({
58
+ text: c(m.palette.text.primary),
59
+ grid: c(m.palette.divider),
60
+ stroke: c(m.palette.divider)
39
61
  });
40
- const r = e.container.children.push(
41
- _.new(e, {
62
+ const n = e.container.children.push(
63
+ ie.new(e, {
42
64
  panX: !0,
43
65
  panY: !0,
44
66
  wheelX: "none",
45
67
  wheelY: "none",
46
- maxTooltipDistance: 0,
68
+ // -1 = show the tooltip from the cursor's x-position anywhere in the
69
+ // plot, not only when the pointer is on a data point / line.
70
+ maxTooltipDistance: -1,
47
71
  pinchZoomX: !0
48
72
  })
49
73
  );
50
- r.set("colors", Z(e, x));
51
- let n, d = p;
52
- t[0].type === "date" ? (n = r.xAxes.push(
53
- j.new(e, {
74
+ n.set("colors", se(e, X));
75
+ let d, f = w;
76
+ r[0].type === "date" ? (d = n.xAxes.push(
77
+ me.new(e, {
54
78
  maxDeviation: 0.1,
55
79
  groupData: !1,
56
- baseInterval: R || { timeUnit: "day", count: 1 },
57
- renderer: D.new(e, {}),
58
- tooltip: A.new(e, {})
80
+ baseInterval: l || { timeUnit: "day", count: 1 },
81
+ renderer: V.new(e, {})
59
82
  })
60
- ), d = b.orderBy(p, [t[0].value])) : (n = r.xAxes.push(
61
- G.new(e, {
62
- categoryField: t[0].value,
63
- renderer: D.new(e, {}),
64
- tooltip: A.new(e, {})
83
+ ), f = _.orderBy(w, [r[0].value])) : (d = n.xAxes.push(
84
+ pe.new(e, {
85
+ categoryField: r[0].value,
86
+ renderer: V.new(e, {})
65
87
  })
66
88
  ), e.numberFormatter.setAll({
67
89
  numberFormat: "#",
68
90
  numericFields: ["valueX"]
69
- }), d = b.orderBy(p, [t[0].value]), n.data.setAll(d));
70
- const y = r.yAxes.push(
71
- $.new(e, {
72
- renderer: q.new(e, {})
91
+ }), f = _.orderBy(w, [r[0].value]), d.data.setAll(f));
92
+ const N = n.yAxes.push(
93
+ le.new(e, {
94
+ renderer: de.new(e, {})
73
95
  })
74
96
  );
75
- (k = n.get("renderer")) == null || k.grid.template.setAll({
76
- stroke: i(a.palette.divider),
97
+ ($ = d.get("renderer")) == null || $.grid.template.setAll({
98
+ stroke: c(m.palette.divider),
77
99
  strokeOpacity: 1
78
- }), (T = n.get("renderer")) == null || T.labels.template.setAll({ paddingTop: 12 }), (C = y.get("renderer")) == null || C.grid.template.setAll({
79
- stroke: i(a.palette.divider),
100
+ }), (O = d.get("renderer")) == null || O.labels.template.setAll({ paddingTop: 12 }), (S = N.get("renderer")) == null || S.grid.template.setAll({
101
+ stroke: c(m.palette.divider),
80
102
  strokeOpacity: 1
81
- }), c.forEach((s) => {
82
- const o = r.series.push(
83
- J.new(e, {
84
- name: s.name,
85
- xAxis: n,
86
- yAxis: y,
87
- valueYField: s.dataFieldName,
88
- ...t[0].type === "date" ? { valueXField: t[0].value } : { categoryXField: t[0].value },
89
- tooltip: A.new(e, {
90
- pointerOrientation: "horizontal",
91
- labelText: "{name}: {valueY}"
92
- })
103
+ });
104
+ const M = K.new(e, {
105
+ getFillFromSprite: !1
106
+ });
107
+ (Y = M.get("background")) == null || Y.setAll({
108
+ fill: c(m.palette.background.paper),
109
+ stroke: c(m.palette.divider),
110
+ fillOpacity: 1
111
+ }), M.label.setAll({
112
+ fill: c(m.palette.text.primary),
113
+ textAlign: "left",
114
+ lineHeight: k(160)
115
+ });
116
+ const L = xe[(l == null ? void 0 : l.timeUnit) ?? "day"], z = c(m.palette.text.secondary).toCSSHex();
117
+ M.label.adapters.add("text", () => {
118
+ let t = "";
119
+ const a = [];
120
+ if (n.series.each((i) => {
121
+ const s = i.get("tooltipDataItem"), p = s == null ? void 0 : s.get("valueY");
122
+ if (s === void 0 || p === void 0 || p === null)
123
+ return;
124
+ if (!t)
125
+ if (r[0].type === "date") {
126
+ const o = s.get("valueX");
127
+ typeof o == "number" && (t = e.dateFormatter.format(
128
+ new Date(o),
129
+ L
130
+ ));
131
+ } else
132
+ t = `${s.get("categoryX") ?? ""}`;
133
+ const u = i.get("stroke"), g = u ? `[${u.toCSSHex()}]●[/] ` : "";
134
+ a.push(
135
+ `${g}${i.get("name")}: ${e.numberFormatter.format(
136
+ p
137
+ )}`
138
+ );
139
+ }), a.length === 0) {
140
+ if (r[0].type === "date") {
141
+ const s = d.positionToValue(
142
+ d.getPrivate("tooltipPosition", 0)
143
+ );
144
+ typeof s == "number" && !Number.isNaN(s) && (t = e.dateFormatter.format(new Date(s), L));
145
+ }
146
+ const i = `[${z}]No data[/]`;
147
+ return t ? `[bold]${t}[/]
148
+ ${i}` : i;
149
+ }
150
+ return t ? `[bold]${t}[/]
151
+ ${a.join(`
152
+ `)}` : a.join(`
153
+ `);
154
+ }), d.set("tooltip", M), y.forEach((t) => {
155
+ const a = n.series.push(
156
+ ce.new(e, {
157
+ // Legend/tooltip label: explicit override, else humanize the raw
158
+ // backend field (snake_case / lowercase → Title Case).
159
+ name: t.label ?? ae(t.name),
160
+ xAxis: d,
161
+ yAxis: N,
162
+ valueYField: t.dataFieldName,
163
+ // When false, the line breaks at missing points. On a date axis the
164
+ // break is auto-detected when adjacent points are spaced more than
165
+ // `autoGapCount` (default 1.1) base intervals apart, so absent dates
166
+ // surface as gaps instead of being bridged by a straight segment.
167
+ connect: T,
168
+ autoGapCount: R,
169
+ ...r[0].type === "date" ? { valueXField: r[0].value } : { categoryXField: r[0].value }
93
170
  })
94
171
  );
95
- t[0].type === "date" && (o.data.processor = K.new(e, {
172
+ if (r[0].type === "date" && (a.data.processor = ue.new(e, {
96
173
  dateFormat: "i",
97
- dateFields: [t[0].value]
98
- })), o.data.setAll(d), o.strokes.template.setAll({ strokeWidth: 2 }), o.appear();
99
- }), r.set(
174
+ dateFields: [r[0].value]
175
+ })), r[0].type === "date") {
176
+ const i = r[0].value, s = Ae[(l == null ? void 0 : l.timeUnit) ?? "day"] * ((l == null ? void 0 : l.count) ?? 1), p = T ? 1 / 0 : s * R, u = f.map((o) => ({
177
+ t: new Date(o[i]).getTime(),
178
+ hasValue: o[t.dataFieldName] !== null && o[t.dataFieldName] !== void 0
179
+ })).filter((o) => o.hasValue && !Number.isNaN(o.t)), g = /* @__PURE__ */ new Set();
180
+ u.forEach((o, A) => {
181
+ const D = A > 0 ? o.t - u[A - 1].t : 1 / 0, x = A < u.length - 1 ? u[A + 1].t - o.t : 1 / 0;
182
+ D > p && x > p && g.add(o.t);
183
+ }), g.size > 0 && a.bullets.push((o, A, D) => {
184
+ const x = D.dataContext;
185
+ if (g.has(new Date(x == null ? void 0 : x[i]).getTime()))
186
+ return ye.new(o, {
187
+ sprite: fe.new(o, {
188
+ radius: 3,
189
+ fill: a.get("fill"),
190
+ stroke: o.interfaceColors.get("background"),
191
+ strokeWidth: 1
192
+ })
193
+ });
194
+ });
195
+ }
196
+ a.data.setAll(f), a.strokes.template.setAll({ strokeWidth: 2 }), a.appear();
197
+ }), n.set(
100
198
  "cursor",
101
- Q.new(e, { behavior: "none" })
199
+ he.new(e, { xAxis: d, behavior: "none" })
102
200
  ).lineY.set("visible", !1);
103
- const l = r.bottomAxesContainer.children.push(
104
- ee.new(e, {
105
- width: g(100),
201
+ const h = n.bottomAxesContainer.children.push(
202
+ ge.new(e, {
203
+ width: k(100),
106
204
  paddingTop: 10,
107
- centerX: g(50),
108
- x: g(50),
205
+ centerX: k(50),
206
+ x: k(50),
109
207
  layout: e.gridLayout
110
208
  })
111
209
  );
112
- l.itemContainers.template.events.on("pointerover", function(s) {
113
- var X;
114
- const o = s.target, B = (X = o == null ? void 0 : o.dataItem) == null ? void 0 : X.dataContext;
115
- r.series.each(function(f) {
116
- f !== B ? f.strokes.template.setAll({
210
+ h.itemContainers.template.events.on("pointerover", function(t) {
211
+ var s;
212
+ const a = t.target, i = (s = a == null ? void 0 : a.dataItem) == null ? void 0 : s.dataContext;
213
+ n.series.each(function(p) {
214
+ p !== i ? p.strokes.template.setAll({
117
215
  strokeOpacity: 0.15,
118
- stroke: i(0)
119
- }) : f.strokes.template.setAll({ strokeWidth: 3 });
216
+ stroke: c(0)
217
+ }) : p.strokes.template.setAll({ strokeWidth: 3 });
120
218
  });
121
- }), l.itemContainers.template.events.on("pointerout", function() {
122
- r.series.each(function(s) {
123
- s.strokes.template.setAll({
219
+ }), h.itemContainers.template.events.on("pointerout", function() {
220
+ n.series.each(function(t) {
221
+ t.strokes.template.setAll({
124
222
  strokeOpacity: 1,
125
223
  strokeWidth: 2,
126
- stroke: s.get("fill")
224
+ stroke: t.get("fill")
127
225
  });
128
226
  });
129
- }), l.itemContainers.template.set("width", F), l.valueLabels.template.setAll({
130
- width: F,
227
+ }), h.itemContainers.template.set("width", U), h.valueLabels.template.setAll({
228
+ width: U,
131
229
  textAlign: "right"
132
- }), l.data.setAll(r.series.values), r.appear(1e3, 100);
133
- }, Y), () => {
230
+ }), h.data.setAll(n.series.values), ne(e, (P = y == null ? void 0 : y[0]) == null ? void 0 : P.format), n.appear(1e3, 100);
231
+ }, E), () => {
134
232
  var e;
135
- h && clearTimeout(h), (e = u.current) == null || e.dispose(), u.current = null;
233
+ C && clearTimeout(C), (e = F.current) == null || e.dispose(), F.current = null;
136
234
  };
137
- }, [p, t, c, a.palette.mode, x]);
138
- const P = { ...v };
139
- return { chartId: w, ownerState: P, sx: I, error: m, other: O };
235
+ }, [w, r, y, m.palette.mode, X, T]);
236
+ const W = { ...b };
237
+ return { chartId: H, ownerState: W, sx: G, error: v, other: I };
140
238
  };
141
239
  export {
142
- ge as useLineChartLogic
240
+ Ue as useLineChartLogic
143
241
  };