@hybridcore/ui 1.6.29 → 1.6.30
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/components/charts/line/logic.js +124 -101
- package/dist/components/data-list/logic.js +131 -137
- package/dist/components/metric-card/MetricChart.js +60 -58
- package/dist/components/metric-card/index.js +53 -40
- package/dist/components/metric-card/logic.js +66 -57
- package/dist/components/metric-card/styled.js +13 -9
- package/dist/components/paginated-list/helpers.js +8 -0
- package/dist/components/paginated-list/index.js +144 -61
- package/dist/components/paginated-list/logic.js +84 -47
- package/dist/components/paginated-list/styled.js +154 -17
- package/dist/hooks/useInfinitePaging.js +51 -0
- package/dist/main.d.ts +115 -3
- package/package.json +1 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { useThemeProps as
|
|
3
|
-
import
|
|
4
|
-
import { useId as
|
|
5
|
-
import { humanizeLabel as
|
|
6
|
-
import { attachCombinedAxisTooltip as
|
|
7
|
-
import { colorSetFromPalette as
|
|
8
|
-
import { c
|
|
9
|
-
import { X as
|
|
10
|
-
import { A as
|
|
11
|
-
import { C as
|
|
12
|
-
import { L as
|
|
13
|
-
import { D as
|
|
14
|
-
import { B as
|
|
15
|
-
import { C as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
1
|
+
import { R as q, T as J, A as K } from "../../../AnimatedTheme-ktdO3Bel.js";
|
|
2
|
+
import { useThemeProps as Q, useTheme as ee } from "@mui/material";
|
|
3
|
+
import te from "lodash";
|
|
4
|
+
import { useId as re, useRef as se, useEffect as oe } from "react";
|
|
5
|
+
import { humanizeLabel as ae } from "../_common/format.js";
|
|
6
|
+
import { attachCombinedAxisTooltip as ie } from "../_common/tooltip.js";
|
|
7
|
+
import { colorSetFromPalette as ne, applyDateAxisLabelFormat as le, applyValueFormat as me } from "../_common/utils.js";
|
|
8
|
+
import { c, p as b, b as P } from "../../../Entity-BJCuhdq_.js";
|
|
9
|
+
import { X as pe, V as ce } from "../../../AxisRenderer-BCQoUJw6.js";
|
|
10
|
+
import { A as R, a as de } from "../../../AxisRendererY-AXWvGU6r.js";
|
|
11
|
+
import { C as ue } from "../../../CategoryAxis-B6NqW8qd.js";
|
|
12
|
+
import { L as fe } from "../../../LineSeries-D_IL2qGF.js";
|
|
13
|
+
import { D as he, G as ge } from "../../../GaplessDateAxis-B2g2jgSG.js";
|
|
14
|
+
import { B as Ae } from "../../../Bullet-Djj7Vs9T.js";
|
|
15
|
+
import { C as ye } from "../../../Circle-BnfBNKBD.js";
|
|
16
|
+
import { L as xe } from "../../../LinearGradient-CxQyCSEB.js";
|
|
17
|
+
import { X as we } from "../../../XYCursor-CVUSpqb9.js";
|
|
18
|
+
import { L as ke } from "../../../Legend-CFvQiIfn.js";
|
|
19
|
+
import { D as Ce } from "../../../DateAxis-DEXKps1S.js";
|
|
20
|
+
const S = 1.1, ve = {
|
|
20
21
|
millisecond: 1,
|
|
21
22
|
second: 1e3,
|
|
22
23
|
minute: 6e4,
|
|
@@ -25,35 +26,37 @@ const _ = 1.1, ge = {
|
|
|
25
26
|
week: 6048e5,
|
|
26
27
|
month: 2592e6,
|
|
27
28
|
year: 31536e6
|
|
28
|
-
},
|
|
29
|
-
const
|
|
29
|
+
}, ze = (W) => {
|
|
30
|
+
const X = Q({ props: W, name: "HCLineChart" }), {
|
|
30
31
|
dimensions: t,
|
|
31
32
|
values: m,
|
|
32
33
|
data: w,
|
|
33
|
-
initDelay:
|
|
34
|
-
baseInterval:
|
|
35
|
-
colors:
|
|
34
|
+
initDelay: B = 0,
|
|
35
|
+
baseInterval: l,
|
|
36
|
+
colors: G,
|
|
36
37
|
connectMissingData: k = !0,
|
|
37
38
|
skipEmptyDates: C = !1,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
areaFill: N = !1,
|
|
40
|
+
strokeDasharray: v,
|
|
41
|
+
sx: z,
|
|
42
|
+
...H
|
|
43
|
+
} = X, p = ee(), O = `hc-line-chart-${re().replace(/:/g, "")}`, D = se(null);
|
|
44
|
+
let g = null;
|
|
45
|
+
t.length < 1 ? g = "Missing dimensions config!" : m.length < 1 && (g = "Missing values config!"), oe(() => {
|
|
46
|
+
if (g) return;
|
|
47
|
+
let F;
|
|
48
|
+
return F = setTimeout(() => {
|
|
49
|
+
var M, U, V, _;
|
|
50
|
+
const e = q.new(O);
|
|
51
|
+
D.current = e;
|
|
52
|
+
const $ = J.new(e);
|
|
53
|
+
e.setThemes([K.new(e), $]), e.interfaceColors.setAll({
|
|
54
|
+
text: c(p.palette.text.primary),
|
|
55
|
+
grid: c(p.palette.divider),
|
|
56
|
+
stroke: c(p.palette.divider)
|
|
54
57
|
});
|
|
55
58
|
const s = e.container.children.push(
|
|
56
|
-
|
|
59
|
+
pe.new(e, {
|
|
57
60
|
panX: !0,
|
|
58
61
|
panY: !0,
|
|
59
62
|
wheelX: "none",
|
|
@@ -63,74 +66,74 @@ const _ = 1.1, ge = {
|
|
|
63
66
|
maxTooltipDistance: -1,
|
|
64
67
|
pinchZoomX: !0
|
|
65
68
|
})
|
|
66
|
-
);
|
|
67
|
-
s.set("colors",
|
|
69
|
+
), Y = ne(e, G);
|
|
70
|
+
s.set("colors", Y);
|
|
68
71
|
let i, A = w;
|
|
69
72
|
if (t[0].type === "date") {
|
|
70
|
-
const o = C ?
|
|
73
|
+
const o = C ? ge : Ce;
|
|
71
74
|
i = s.xAxes.push(
|
|
72
75
|
o.new(e, {
|
|
73
76
|
maxDeviation: 0.1,
|
|
74
77
|
groupData: !1,
|
|
75
|
-
baseInterval:
|
|
76
|
-
renderer:
|
|
78
|
+
baseInterval: l || { timeUnit: "day", count: 1 },
|
|
79
|
+
renderer: R.new(e, {})
|
|
77
80
|
})
|
|
78
|
-
),
|
|
81
|
+
), le(i, t[0]), A = te.orderBy(w, [t[0].value]);
|
|
79
82
|
} else
|
|
80
83
|
i = s.xAxes.push(
|
|
81
|
-
|
|
84
|
+
ue.new(e, {
|
|
82
85
|
categoryField: t[0].value,
|
|
83
|
-
renderer:
|
|
86
|
+
renderer: R.new(e, {})
|
|
84
87
|
})
|
|
85
88
|
), e.numberFormatter.setAll({
|
|
86
89
|
numberFormat: "#",
|
|
87
90
|
numericFields: ["valueX"]
|
|
88
91
|
}), i.data.setAll(A);
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
renderer:
|
|
92
|
+
const I = s.yAxes.push(
|
|
93
|
+
ce.new(e, {
|
|
94
|
+
renderer: de.new(e, {})
|
|
92
95
|
})
|
|
93
96
|
);
|
|
94
|
-
(
|
|
95
|
-
stroke:
|
|
97
|
+
(M = i.get("renderer")) == null || M.grid.template.setAll({
|
|
98
|
+
stroke: c(p.palette.divider),
|
|
96
99
|
strokeOpacity: 1
|
|
97
|
-
}), (
|
|
98
|
-
stroke:
|
|
100
|
+
}), (U = i.get("renderer")) == null || U.labels.template.setAll({ paddingTop: 12 }), (V = I.get("renderer")) == null || V.grid.template.setAll({
|
|
101
|
+
stroke: c(p.palette.divider),
|
|
99
102
|
strokeOpacity: 1
|
|
100
|
-
}), m.forEach((o) => {
|
|
103
|
+
}), m.forEach((o, u) => {
|
|
101
104
|
const a = s.series.push(
|
|
102
|
-
|
|
105
|
+
fe.new(e, {
|
|
103
106
|
// Legend/tooltip label: explicit override, else humanize the raw
|
|
104
107
|
// backend field (snake_case / lowercase → Title Case).
|
|
105
|
-
name: o.label ??
|
|
108
|
+
name: o.label ?? ae(o.name),
|
|
106
109
|
xAxis: i,
|
|
107
|
-
yAxis:
|
|
110
|
+
yAxis: I,
|
|
108
111
|
valueYField: o.dataFieldName,
|
|
109
112
|
// When false, the line breaks at missing points. On a date axis the
|
|
110
113
|
// break is auto-detected when adjacent points are spaced more than
|
|
111
114
|
// `autoGapCount` (default 1.1) base intervals apart, so absent dates
|
|
112
115
|
// surface as gaps instead of being bridged by a straight segment.
|
|
113
116
|
connect: k,
|
|
114
|
-
autoGapCount:
|
|
117
|
+
autoGapCount: S,
|
|
115
118
|
...t[0].type === "date" ? { valueXField: t[0].value } : { categoryXField: t[0].value }
|
|
116
119
|
})
|
|
117
120
|
);
|
|
118
|
-
if (t[0].type === "date" && (a.data.processor =
|
|
121
|
+
if (t[0].type === "date" && (a.data.processor = he.new(e, {
|
|
119
122
|
dateFormat: "i",
|
|
120
123
|
dateFields: [t[0].value]
|
|
121
124
|
})), t[0].type === "date" && !C) {
|
|
122
|
-
const
|
|
123
|
-
t: new Date(r[
|
|
125
|
+
const n = t[0].value, j = ve[(l == null ? void 0 : l.timeUnit) ?? "day"] * ((l == null ? void 0 : l.count) ?? 1), E = k ? 1 / 0 : j * S, x = A.map((r) => ({
|
|
126
|
+
t: new Date(r[n]).getTime(),
|
|
124
127
|
hasValue: r[o.dataFieldName] !== null && r[o.dataFieldName] !== void 0
|
|
125
|
-
})).filter((r) => r.hasValue && !Number.isNaN(r.t)),
|
|
126
|
-
x.forEach((r,
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
}),
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
return
|
|
133
|
-
sprite:
|
|
128
|
+
})).filter((r) => r.hasValue && !Number.isNaN(r.t)), T = /* @__PURE__ */ new Set();
|
|
129
|
+
x.forEach((r, f) => {
|
|
130
|
+
const L = f > 0 ? r.t - x[f - 1].t : 1 / 0, h = f < x.length - 1 ? x[f + 1].t - r.t : 1 / 0;
|
|
131
|
+
L > E && h > E && T.add(r.t);
|
|
132
|
+
}), T.size > 0 && a.bullets.push((r, f, L) => {
|
|
133
|
+
const h = L.dataContext;
|
|
134
|
+
if (T.has(new Date(h == null ? void 0 : h[n]).getTime()))
|
|
135
|
+
return Ae.new(r, {
|
|
136
|
+
sprite: ye.new(r, {
|
|
134
137
|
radius: 3,
|
|
135
138
|
fill: a.get("fill"),
|
|
136
139
|
stroke: r.interfaceColors.get("background"),
|
|
@@ -139,38 +142,56 @@ const _ = 1.1, ge = {
|
|
|
139
142
|
});
|
|
140
143
|
});
|
|
141
144
|
}
|
|
142
|
-
|
|
145
|
+
const y = N && m.length === 1;
|
|
146
|
+
if (a.data.setAll(A), a.strokes.template.setAll({
|
|
147
|
+
strokeWidth: 2,
|
|
148
|
+
...v && { strokeDasharray: v }
|
|
149
|
+
}), y) {
|
|
150
|
+
const n = a.get("fill") ?? Y.getIndex(u);
|
|
151
|
+
a.fills.template.setAll({
|
|
152
|
+
visible: !0,
|
|
153
|
+
fillOpacity: 1,
|
|
154
|
+
fillGradient: xe.new(e, {
|
|
155
|
+
rotation: 90,
|
|
156
|
+
stops: [
|
|
157
|
+
{ color: n, opacity: 0.6 },
|
|
158
|
+
{ color: n, opacity: 0 }
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
a.appear();
|
|
143
164
|
}), s.set(
|
|
144
165
|
"cursor",
|
|
145
|
-
|
|
146
|
-
).lineY.set("visible", !1),
|
|
166
|
+
we.new(e, { xAxis: i, behavior: "none" })
|
|
167
|
+
).lineY.set("visible", !1), ie({
|
|
147
168
|
root: e,
|
|
148
169
|
chart: s,
|
|
149
170
|
xAxis: i,
|
|
150
|
-
theme:
|
|
171
|
+
theme: p,
|
|
151
172
|
isDateAxis: t[0].type === "date",
|
|
152
|
-
baseInterval:
|
|
173
|
+
baseInterval: l,
|
|
153
174
|
follow: !0
|
|
154
175
|
});
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
width:
|
|
176
|
+
const d = s.bottomAxesContainer.children.push(
|
|
177
|
+
ke.new(e, {
|
|
178
|
+
width: b(100),
|
|
158
179
|
paddingTop: 10,
|
|
159
|
-
centerX:
|
|
160
|
-
x:
|
|
180
|
+
centerX: b(50),
|
|
181
|
+
x: b(50),
|
|
161
182
|
layout: e.gridLayout
|
|
162
183
|
})
|
|
163
184
|
);
|
|
164
|
-
|
|
185
|
+
d.itemContainers.template.events.on("pointerover", function(o) {
|
|
165
186
|
var y;
|
|
166
|
-
const
|
|
167
|
-
s.series.each(function(
|
|
168
|
-
|
|
187
|
+
const u = o.target, a = (y = u == null ? void 0 : u.dataItem) == null ? void 0 : y.dataContext;
|
|
188
|
+
s.series.each(function(n) {
|
|
189
|
+
n !== a ? n.strokes.template.setAll({
|
|
169
190
|
strokeOpacity: 0.15,
|
|
170
|
-
stroke:
|
|
171
|
-
}) :
|
|
191
|
+
stroke: c(0)
|
|
192
|
+
}) : n.strokes.template.setAll({ strokeWidth: 3 });
|
|
172
193
|
});
|
|
173
|
-
}),
|
|
194
|
+
}), d.itemContainers.template.events.on("pointerout", function() {
|
|
174
195
|
s.series.each(function(o) {
|
|
175
196
|
o.strokes.template.setAll({
|
|
176
197
|
strokeOpacity: 1,
|
|
@@ -178,26 +199,28 @@ const _ = 1.1, ge = {
|
|
|
178
199
|
stroke: o.get("fill")
|
|
179
200
|
});
|
|
180
201
|
});
|
|
181
|
-
}),
|
|
182
|
-
width:
|
|
202
|
+
}), d.itemContainers.template.set("width", P), d.valueLabels.template.setAll({
|
|
203
|
+
width: P,
|
|
183
204
|
textAlign: "right"
|
|
184
|
-
}),
|
|
185
|
-
},
|
|
205
|
+
}), d.data.setAll(s.series.values), me(e, (_ = m == null ? void 0 : m[0]) == null ? void 0 : _.format), s.appear(1e3, 100);
|
|
206
|
+
}, B), () => {
|
|
186
207
|
var e;
|
|
187
|
-
|
|
208
|
+
F && clearTimeout(F), (e = D.current) == null || e.dispose(), D.current = null;
|
|
188
209
|
};
|
|
189
210
|
}, [
|
|
190
211
|
w,
|
|
191
212
|
t,
|
|
192
213
|
m,
|
|
193
|
-
|
|
194
|
-
|
|
214
|
+
p.palette.mode,
|
|
215
|
+
G,
|
|
195
216
|
k,
|
|
196
|
-
C
|
|
217
|
+
C,
|
|
218
|
+
N,
|
|
219
|
+
v
|
|
197
220
|
]);
|
|
198
|
-
const
|
|
199
|
-
return { chartId:
|
|
221
|
+
const Z = { ...X };
|
|
222
|
+
return { chartId: O, ownerState: Z, sx: z, error: g, other: H };
|
|
200
223
|
};
|
|
201
224
|
export {
|
|
202
|
-
|
|
225
|
+
ze as useLineChartLogic
|
|
203
226
|
};
|