@nice2dev/ui 1.4.22 → 1.4.24
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/CHANGELOG.md +96 -0
- package/dist/{NicePivotGrid-BshofJh1.cjs → NicePivotGrid-D53CQ2cY.cjs} +1 -1
- package/dist/charts/NiceAdvancedCharts.mjs +621 -764
- package/dist/charts/NiceBarGauge.mjs +100 -65
- package/dist/charts/NiceBullet.mjs +103 -98
- package/dist/charts/NiceChart.mjs +269 -266
- package/dist/charts/NiceChartRangeSelector.mjs +159 -0
- package/dist/charts/NiceCircularGauge.mjs +99 -70
- package/dist/charts/NiceHeatMap.mjs +140 -70
- package/dist/charts/NiceLinearGauge.mjs +168 -119
- package/dist/charts/NiceOrganizationChart.mjs +183 -90
- package/dist/charts/NicePieChart.mjs +94 -49
- package/dist/charts/NicePolarChart.mjs +2 -2
- package/dist/charts/NiceSankey.mjs +166 -93
- package/dist/charts/NiceStockChart.mjs +258 -157
- package/dist/charts-CSgOgfES.cjs +867 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +150 -104
- package/dist/charts.mjs +22 -24
- package/dist/core/lazy.mjs +50 -63
- package/dist/core-lazy-sO0xvg64.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/demo/docs/docPreviews.mjs +450 -466
- package/dist/demo/docs/docRegistry.mjs +5 -35
- package/dist/index.cjs +60 -67
- package/dist/index.d.ts +145 -174
- package/dist/index.mjs +831 -836
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +49 -23
- package/dist/lazy.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/tools/NiceShowcase.mjs +1 -2
- package/package.json +4 -4
- package/dist/charts/NiceRangeSelector.mjs +0 -135
- package/dist/charts/NiceTreeMap.mjs +0 -100
- package/dist/charts/NiceVectorMap.mjs +0 -59
- package/dist/charts-C3Q3r8Yz.cjs +0 -918
- package/dist/core-lazy-CUnBYI-T.cjs +0 -1
|
@@ -1,147 +1,196 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
const
|
|
3
|
-
value:
|
|
4
|
-
min:
|
|
5
|
-
max:
|
|
6
|
-
width:
|
|
7
|
-
height:
|
|
8
|
-
orientation:
|
|
9
|
-
color:
|
|
10
|
-
label:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsx as t, jsxs as D } from "react/jsx-runtime";
|
|
2
|
+
const A = 16, I = 7, P = ({
|
|
3
|
+
value: x,
|
|
4
|
+
min: i = 0,
|
|
5
|
+
max: y = 100,
|
|
6
|
+
width: a = 300,
|
|
7
|
+
height: k = 60,
|
|
8
|
+
orientation: F = "horizontal",
|
|
9
|
+
color: J,
|
|
10
|
+
label: e,
|
|
11
|
+
labelPlacement: d = "bottom",
|
|
12
|
+
showValueLabel: f = !1,
|
|
13
|
+
formatValue: b,
|
|
14
|
+
ranges: H,
|
|
15
|
+
showTicks: _ = !0,
|
|
16
|
+
tickCount: K = 5,
|
|
17
|
+
className: L,
|
|
18
|
+
style: S,
|
|
19
|
+
testId: j,
|
|
20
|
+
"data-testid": C
|
|
19
21
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
for (const
|
|
24
|
-
if (
|
|
25
|
-
|
|
22
|
+
const Q = F === "horizontal", p = Math.max(0, Math.min(1, (x - i) / (y - i || 1))), n = 10, $ = b ? b(x) : String(x);
|
|
23
|
+
let B = J || "var(--nice-color-primary, #3b82f6)";
|
|
24
|
+
if (H) {
|
|
25
|
+
for (const c of H)
|
|
26
|
+
if (x >= c.start && x <= c.end) {
|
|
27
|
+
B = c.color;
|
|
26
28
|
break;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
(
|
|
32
|
-
|
|
33
|
-
if (u) {
|
|
34
|
-
const l = s ? 14 : 0;
|
|
35
|
-
return /* @__PURE__ */ r(
|
|
31
|
+
const R = Math.max(2, K), Y = Array.from({ length: R }, (c, s) => i + (y - i) * (s / (R - 1)));
|
|
32
|
+
if (Q) {
|
|
33
|
+
const c = e && d === "left", s = e && d === "top", O = e && d === "bottom", W = c ? Math.min(a * 0.35, e.length * I + 12) : 0, Z = (s ? A : 0) + (f ? 16 : 6), l = 20 + W, m = Math.max(20, a - 40 - W), o = Z + 8, X = o + n + 12, z = Math.max(k, X + (_ ? 4 : -8) + (O ? A + 4 : 4)), N = l + m * p;
|
|
34
|
+
return /* @__PURE__ */ t(
|
|
36
35
|
"div",
|
|
37
36
|
{
|
|
38
|
-
className: `nice-gauge nice-gauge--linear ${
|
|
39
|
-
style:
|
|
40
|
-
"data-testid":
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
37
|
+
className: `nice-gauge nice-gauge--linear ${L || ""}`,
|
|
38
|
+
style: S,
|
|
39
|
+
"data-testid": C ?? j,
|
|
40
|
+
children: /* @__PURE__ */ D(
|
|
41
|
+
"svg",
|
|
42
|
+
{
|
|
43
|
+
width: a,
|
|
44
|
+
height: z,
|
|
45
|
+
viewBox: `0 0 ${a} ${z}`,
|
|
46
|
+
style: { maxWidth: "100%" },
|
|
47
|
+
children: [
|
|
48
|
+
s && /* @__PURE__ */ t("text", { x: l, y: 12, className: "nice-gauge__label", children: e }),
|
|
49
|
+
c && /* @__PURE__ */ t(
|
|
50
|
+
"text",
|
|
51
|
+
{
|
|
52
|
+
x: W + 8,
|
|
53
|
+
y: o + n / 2,
|
|
54
|
+
textAnchor: "end",
|
|
55
|
+
dominantBaseline: "middle",
|
|
56
|
+
className: "nice-gauge__label",
|
|
57
|
+
children: e
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
f && /* @__PURE__ */ t(
|
|
61
|
+
"text",
|
|
62
|
+
{
|
|
63
|
+
x: N,
|
|
64
|
+
y: o - 10,
|
|
65
|
+
textAnchor: "middle",
|
|
66
|
+
className: "nice-gauge__value",
|
|
67
|
+
style: { fontSize: 12 },
|
|
68
|
+
children: $
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ t(
|
|
72
|
+
"rect",
|
|
73
|
+
{
|
|
74
|
+
x: l,
|
|
75
|
+
y: o,
|
|
76
|
+
width: m,
|
|
77
|
+
height: n,
|
|
78
|
+
rx: 5,
|
|
79
|
+
fill: "var(--nice-border-color, #e2e8f0)"
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ t(
|
|
83
|
+
"rect",
|
|
84
|
+
{
|
|
85
|
+
x: l,
|
|
86
|
+
y: o,
|
|
87
|
+
width: m * p,
|
|
88
|
+
height: n,
|
|
89
|
+
rx: 5,
|
|
90
|
+
fill: B
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ t(
|
|
94
|
+
"polygon",
|
|
95
|
+
{
|
|
96
|
+
points: `${N},${o - 2} ${N - 5},${o - 8} ${N + 5},${o - 8}`,
|
|
97
|
+
fill: "var(--nice-text-primary, #333)",
|
|
98
|
+
children: /* @__PURE__ */ t("title", { children: $ })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
_ && Y.map((q, T) => /* @__PURE__ */ t(
|
|
102
|
+
"text",
|
|
103
|
+
{
|
|
104
|
+
x: l + (q - i) / (y - i || 1) * m,
|
|
105
|
+
y: X,
|
|
106
|
+
textAnchor: "middle",
|
|
107
|
+
className: "nice-gauge__tick",
|
|
108
|
+
children: Math.round(q * 100) / 100
|
|
109
|
+
},
|
|
110
|
+
T
|
|
111
|
+
)),
|
|
112
|
+
O && /* @__PURE__ */ t(
|
|
113
|
+
"text",
|
|
114
|
+
{
|
|
115
|
+
x: l + m / 2,
|
|
116
|
+
y: z - 4,
|
|
117
|
+
textAnchor: "middle",
|
|
118
|
+
className: "nice-gauge__label",
|
|
119
|
+
children: e
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
)
|
|
107
125
|
}
|
|
108
126
|
);
|
|
109
127
|
}
|
|
110
|
-
|
|
128
|
+
const u = Math.max(a, k), h = Math.max(72, Math.min(a, k, 140)), E = e && d !== "bottom", G = e && d === "bottom", g = (E ? A + 4 : 0) + (f ? 18 : 8), U = G ? A + 8 : 8, v = Math.max(20, u - g - U), r = h / 2 - n / 2 - (_ ? 10 : 0), M = g + v * (1 - p);
|
|
129
|
+
return /* @__PURE__ */ t(
|
|
111
130
|
"div",
|
|
112
131
|
{
|
|
113
|
-
className: `nice-gauge nice-gauge--linear nice-gauge--vertical ${
|
|
114
|
-
style:
|
|
115
|
-
"data-testid":
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
132
|
+
className: `nice-gauge nice-gauge--linear nice-gauge--vertical ${L || ""}`,
|
|
133
|
+
style: S,
|
|
134
|
+
"data-testid": C ?? j,
|
|
135
|
+
children: /* @__PURE__ */ D("svg", { width: h, height: u, viewBox: `0 0 ${h} ${u}`, style: { maxWidth: "100%" }, children: [
|
|
136
|
+
E && /* @__PURE__ */ t("text", { x: h / 2, y: 12, textAnchor: "middle", className: "nice-gauge__label", children: e }),
|
|
137
|
+
f && /* @__PURE__ */ t(
|
|
138
|
+
"text",
|
|
139
|
+
{
|
|
140
|
+
x: r + n / 2,
|
|
141
|
+
y: g - 6,
|
|
142
|
+
textAnchor: "middle",
|
|
143
|
+
className: "nice-gauge__value",
|
|
144
|
+
style: { fontSize: 12 },
|
|
145
|
+
children: $
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ t(
|
|
118
149
|
"rect",
|
|
119
150
|
{
|
|
120
|
-
x:
|
|
121
|
-
y:
|
|
122
|
-
width:
|
|
123
|
-
height:
|
|
151
|
+
x: r,
|
|
152
|
+
y: g,
|
|
153
|
+
width: n,
|
|
154
|
+
height: v,
|
|
124
155
|
rx: 5,
|
|
125
156
|
fill: "var(--nice-border-color, #e2e8f0)"
|
|
126
157
|
}
|
|
127
158
|
),
|
|
128
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ t(
|
|
129
160
|
"rect",
|
|
130
161
|
{
|
|
131
|
-
x:
|
|
132
|
-
y:
|
|
133
|
-
width:
|
|
134
|
-
height:
|
|
162
|
+
x: r,
|
|
163
|
+
y: M,
|
|
164
|
+
width: n,
|
|
165
|
+
height: v * p,
|
|
135
166
|
rx: 5,
|
|
136
|
-
fill:
|
|
167
|
+
fill: B
|
|
137
168
|
}
|
|
138
169
|
),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
170
|
+
/* @__PURE__ */ t(
|
|
171
|
+
"polygon",
|
|
172
|
+
{
|
|
173
|
+
points: `${r - 2},${M} ${r - 8},${M - 5} ${r - 8},${M + 5}`,
|
|
174
|
+
fill: "var(--nice-text-primary, #333)",
|
|
175
|
+
children: /* @__PURE__ */ t("title", { children: $ })
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
_ && Y.map((c, s) => /* @__PURE__ */ t(
|
|
179
|
+
"text",
|
|
180
|
+
{
|
|
181
|
+
x: r + n + 6,
|
|
182
|
+
y: g + v * (1 - (c - i) / (y - i || 1)),
|
|
183
|
+
dominantBaseline: "middle",
|
|
184
|
+
className: "nice-gauge__tick",
|
|
185
|
+
children: Math.round(c * 100) / 100
|
|
186
|
+
},
|
|
187
|
+
s
|
|
188
|
+
)),
|
|
189
|
+
G && /* @__PURE__ */ t("text", { x: h / 2, y: u - 6, textAnchor: "middle", className: "nice-gauge__label", children: e })
|
|
141
190
|
] })
|
|
142
191
|
}
|
|
143
192
|
);
|
|
144
193
|
};
|
|
145
194
|
export {
|
|
146
|
-
|
|
195
|
+
P as NiceLinearGauge
|
|
147
196
|
};
|