impaktapps-design 0.1.6 → 0.1.8
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.
|
@@ -11142,6 +11142,7 @@ const ToolTip = ({
|
|
|
11142
11142
|
left: left2,
|
|
11143
11143
|
children: /* @__PURE__ */ jsxs("div", {
|
|
11144
11144
|
style: {
|
|
11145
|
+
minWidth: 60,
|
|
11145
11146
|
textAlign: "center",
|
|
11146
11147
|
background: "black",
|
|
11147
11148
|
padding: "10px",
|
|
@@ -11686,11 +11687,7 @@ function DrawBarGraph({
|
|
|
11686
11687
|
};
|
|
11687
11688
|
return width < 10 ? null : /* @__PURE__ */ jsxs("div", {
|
|
11688
11689
|
style: {},
|
|
11689
|
-
children: [
|
|
11690
|
-
dataKeyArray: keys2,
|
|
11691
|
-
colorRange: [((_o = (_n2 = (_m = value.style) == null ? void 0 : _m.barStyle) == null ? void 0 : _n2.color) == null ? void 0 : _o.firstBarColor) || "#aeeef8", ((_r = (_q = (_p = value.style) == null ? void 0 : _p.barStyle) == null ? void 0 : _q.color) == null ? void 0 : _r.secondBarColor) || "#e5fd3d", ((_u = (_t2 = (_s = value.style) == null ? void 0 : _s.barStyle) == null ? void 0 : _t2.color) == null ? void 0 : _u.thirdBarColor) || "#9caff6"],
|
|
11692
|
-
value
|
|
11693
|
-
}), /* @__PURE__ */ jsxs("svg", {
|
|
11690
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
11694
11691
|
ref: containerRef,
|
|
11695
11692
|
width,
|
|
11696
11693
|
height,
|
|
@@ -11708,7 +11705,7 @@ function DrawBarGraph({
|
|
|
11708
11705
|
value,
|
|
11709
11706
|
yScale: tempScale,
|
|
11710
11707
|
parentWidth: width
|
|
11711
|
-
}), ((
|
|
11708
|
+
}), ((_l = value == null ? void 0 : value.main) == null ? void 0 : _l.type) === "StackBarGraph" ? /* @__PURE__ */ jsx(BarStack, {
|
|
11712
11709
|
data,
|
|
11713
11710
|
keys: keys2,
|
|
11714
11711
|
x: getDate,
|
|
@@ -11770,20 +11767,34 @@ function DrawBarGraph({
|
|
|
11770
11767
|
xScale: dateScale,
|
|
11771
11768
|
parentWidth: width
|
|
11772
11769
|
})]
|
|
11770
|
+
}), ((_m = value == null ? void 0 : value.main) == null ? void 0 : _m.legendAvailable) && keys2.length > 1 && /* @__PURE__ */ jsx(Legend, {
|
|
11771
|
+
dataKeyArray: keys2,
|
|
11772
|
+
colorRange: [((_p = (_o = (_n2 = value.style) == null ? void 0 : _n2.barStyle) == null ? void 0 : _o.color) == null ? void 0 : _p.firstBarColor) || "#aeeef8", ((_s = (_r = (_q = value.style) == null ? void 0 : _q.barStyle) == null ? void 0 : _r.color) == null ? void 0 : _s.secondBarColor) || "#e5fd3d", ((_v = (_u = (_t2 = value.style) == null ? void 0 : _t2.barStyle) == null ? void 0 : _u.color) == null ? void 0 : _v.thirdBarColor) || "#9caff6"],
|
|
11773
|
+
value
|
|
11773
11774
|
}), ((_w = value == null ? void 0 : value.main) == null ? void 0 : _w.type) === "StackBarGraph" ? tooltipOpen && tooltipData && /* @__PURE__ */ jsxs(TooltipInPortal, {
|
|
11774
11775
|
top: tooltipTop,
|
|
11775
11776
|
left: tooltipLeft,
|
|
11776
11777
|
style: tooltipStyles,
|
|
11777
11778
|
children: [/* @__PURE__ */ jsx("div", {
|
|
11778
11779
|
style: {
|
|
11779
|
-
color: tooltipData.color
|
|
11780
|
+
color: tooltipData.color,
|
|
11781
|
+
marginBottom: "10px",
|
|
11782
|
+
width: "100%",
|
|
11783
|
+
padding: "2px 1px",
|
|
11784
|
+
borderBottom: "1px solid gray"
|
|
11780
11785
|
},
|
|
11781
11786
|
children: /* @__PURE__ */ jsx("strong", {
|
|
11782
11787
|
children: tooltipData.label
|
|
11783
11788
|
})
|
|
11784
11789
|
}), /* @__PURE__ */ jsx("div", {
|
|
11790
|
+
style: {
|
|
11791
|
+
padding: "1px 1px 5px 5px"
|
|
11792
|
+
},
|
|
11785
11793
|
children: tooltipData.key
|
|
11786
11794
|
}), /* @__PURE__ */ jsx("div", {
|
|
11795
|
+
style: {
|
|
11796
|
+
padding: "1px 1px 5px 5px"
|
|
11797
|
+
},
|
|
11787
11798
|
children: /* @__PURE__ */ jsx("small", {
|
|
11788
11799
|
children: tooltipData.value
|
|
11789
11800
|
})
|
|
@@ -35843,6 +35854,10 @@ const SpeedoMeter = ({
|
|
|
35843
35854
|
value
|
|
35844
35855
|
}) => {
|
|
35845
35856
|
var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s, _t2, _u, _v;
|
|
35857
|
+
const [speedoValue, setspeedoValue] = useState(value.main.data);
|
|
35858
|
+
useEffect(() => {
|
|
35859
|
+
setspeedoValue(value.main.data);
|
|
35860
|
+
}, [value.main.data]);
|
|
35846
35861
|
return /* @__PURE__ */ jsxs("div", {
|
|
35847
35862
|
style: {
|
|
35848
35863
|
...(_a2 = value == null ? void 0 : value.style) == null ? void 0 : _a2.containerStyle
|
|
@@ -35867,7 +35882,7 @@ const SpeedoMeter = ({
|
|
|
35867
35882
|
ReactSpeedometer,
|
|
35868
35883
|
{
|
|
35869
35884
|
segmentColors: (_d = value == null ? void 0 : value.style) == null ? void 0 : _d.segmentColors,
|
|
35870
|
-
maxValue: ((_f = (_e2 =
|
|
35885
|
+
maxValue: ((_f = (_e2 = speedoValue == null ? void 0 : speedoValue.main) == null ? void 0 : _e2.data) == null ? void 0 : _f.maxValue) || 500,
|
|
35871
35886
|
width: ((_g = value == null ? void 0 : value.style) == null ? void 0 : _g.width) || 500,
|
|
35872
35887
|
needleHeightRatio: ((_h = value == null ? void 0 : value.style) == null ? void 0 : _h.needleHeightRatio) || 0.7,
|
|
35873
35888
|
currentValueText: (_i = value == null ? void 0 : value.main) == null ? void 0 : _i.currentValueText,
|
|
@@ -35875,9 +35890,9 @@ const SpeedoMeter = ({
|
|
|
35875
35890
|
ringWidth: ((_k = value == null ? void 0 : value.style) == null ? void 0 : _k.ringWidth) || 37,
|
|
35876
35891
|
needleTransitionDuration: ((_l = value == null ? void 0 : value.style) == null ? void 0 : _l.needleTransitionDuration) || 5333,
|
|
35877
35892
|
needleTransition: ((_m = value == null ? void 0 : value.style) == null ? void 0 : _m.needleTransition) || "easeElastic",
|
|
35878
|
-
value: ((_o = (_n2 =
|
|
35893
|
+
value: ((_o = (_n2 = speedoValue == null ? void 0 : speedoValue.main) == null ? void 0 : _n2.data) == null ? void 0 : _o.value) || 473,
|
|
35879
35894
|
needleColor: ((_p = value == null ? void 0 : value.style) == null ? void 0 : _p.needleColor) || "red",
|
|
35880
|
-
minValue: ((_r = (_q =
|
|
35895
|
+
minValue: ((_r = (_q = speedoValue == null ? void 0 : speedoValue.main) == null ? void 0 : _q.data) == null ? void 0 : _r.minValue) || 0,
|
|
35881
35896
|
startColor: ((_s = value == null ? void 0 : value.style) == null ? void 0 : _s.startColor) || "red",
|
|
35882
35897
|
segments: ((_t2 = value == null ? void 0 : value.main) == null ? void 0 : _t2.segments) || 5,
|
|
35883
35898
|
endColor: ((_u = value == null ? void 0 : value.style) == null ? void 0 : _u.endColor) || "green",
|
package/package.json
CHANGED
|
@@ -104,15 +104,7 @@ const colorScale = scaleOrdinal<string, string>({
|
|
|
104
104
|
};
|
|
105
105
|
return width < 10 ? null : (
|
|
106
106
|
<div style={{ }}>
|
|
107
|
-
|
|
108
|
-
<Legend
|
|
109
|
-
dataKeyArray={keys}
|
|
110
|
-
colorRange={[value.style?.barStyle?.color?.firstBarColor||"#aeeef8" ,
|
|
111
|
-
value.style?.barStyle?.color?.secondBarColor||"#e5fd3d" ,
|
|
112
|
-
value.style?.barStyle?.color?.thirdBarColor||"#9caff6" ]}
|
|
113
|
-
value={value}
|
|
114
|
-
/>
|
|
115
|
-
}
|
|
107
|
+
|
|
116
108
|
<svg ref={containerRef} width={width} height={height}>
|
|
117
109
|
<rect
|
|
118
110
|
x={0}
|
|
@@ -204,23 +196,31 @@ const colorScale = scaleOrdinal<string, string>({
|
|
|
204
196
|
/>
|
|
205
197
|
|
|
206
198
|
</svg>
|
|
199
|
+
{value?.main?.legendAvailable && keys.length >1 &&
|
|
200
|
+
<Legend
|
|
201
|
+
dataKeyArray={keys}
|
|
202
|
+
colorRange={[value.style?.barStyle?.color?.firstBarColor||"#aeeef8" ,
|
|
203
|
+
value.style?.barStyle?.color?.secondBarColor||"#e5fd3d" ,
|
|
204
|
+
value.style?.barStyle?.color?.thirdBarColor||"#9caff6" ]}
|
|
205
|
+
value={value}
|
|
206
|
+
/>
|
|
207
|
+
}
|
|
207
208
|
{
|
|
208
209
|
value?.main?.type === "StackBarGraph"?
|
|
209
210
|
tooltipOpen && tooltipData && (
|
|
210
|
-
|
|
211
211
|
<TooltipInPortal
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
212
|
+
top={tooltipTop}
|
|
213
|
+
left={tooltipLeft}
|
|
214
|
+
style={tooltipStyles}
|
|
215
|
+
>
|
|
216
|
+
<div style={{ color:tooltipData.color,marginBottom:"10px",width:"100%",padding:"2px 1px",borderBottom:"1px solid gray" }}>
|
|
217
|
+
<strong>{tooltipData.label}</strong>
|
|
218
|
+
</div>
|
|
219
|
+
<div style={{padding:"1px 1px 5px 5px"}}>{tooltipData.key}</div>
|
|
220
|
+
<div style={{padding:"1px 1px 5px 5px"}}>
|
|
221
|
+
<small>{tooltipData.value}</small>
|
|
222
|
+
</div>
|
|
223
|
+
</TooltipInPortal>
|
|
224
224
|
):
|
|
225
225
|
tooltipOpen &&
|
|
226
226
|
<ToolTip
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import ReactSpeedometer from "react-d3-speedometer";
|
|
3
3
|
|
|
4
4
|
const SpeedoMeter = ({ value }: any) => {
|
|
5
|
+
const [speedoValue, setspeedoValue] = useState(value.main.data);
|
|
6
|
+
useEffect(()=>{
|
|
7
|
+
setspeedoValue(value.main.data)
|
|
8
|
+
},[value.main.data])
|
|
5
9
|
return (
|
|
6
10
|
<div style={{ ...value?.style?.containerStyle }}>
|
|
7
11
|
{value?.main?.header && (
|
|
@@ -22,7 +26,7 @@ const SpeedoMeter = ({ value }: any) => {
|
|
|
22
26
|
<ReactSpeedometer
|
|
23
27
|
// needleTransition=''
|
|
24
28
|
segmentColors={value?.style?.segmentColors}
|
|
25
|
-
maxValue={
|
|
29
|
+
maxValue={speedoValue?.main?.data?.maxValue || 500}
|
|
26
30
|
width={value?.style?.width || 500}
|
|
27
31
|
needleHeightRatio={value?.style?.needleHeightRatio || 0.7}
|
|
28
32
|
currentValueText={value?.main?.currentValueText}
|
|
@@ -32,9 +36,9 @@ const SpeedoMeter = ({ value }: any) => {
|
|
|
32
36
|
value?.style?.needleTransitionDuration || 5333
|
|
33
37
|
}
|
|
34
38
|
needleTransition={value?.style?.needleTransition || "easeElastic"}
|
|
35
|
-
value={
|
|
39
|
+
value={speedoValue?.main?.data?.value || 473}
|
|
36
40
|
needleColor={value?.style?.needleColor || "red"}
|
|
37
|
-
minValue={
|
|
41
|
+
minValue={speedoValue?.main?.data?.minValue || 0}
|
|
38
42
|
startColor={value?.style?.startColor || "red"}
|
|
39
43
|
segments={value?.main?.segments || 5}
|
|
40
44
|
endColor={value?.style?.endColor || "green"}
|
|
@@ -13,15 +13,13 @@ const ToolTip = ({ style, top, left, tooltipData }: tooltipProps) => {
|
|
|
13
13
|
>
|
|
14
14
|
<div
|
|
15
15
|
style={{
|
|
16
|
-
|
|
16
|
+
minWidth:60,
|
|
17
17
|
textAlign:"center",
|
|
18
18
|
background:"black",
|
|
19
19
|
padding:"10px",
|
|
20
20
|
boxShadow:"2px 2px 5px black",
|
|
21
21
|
color:"#6c5efb",
|
|
22
22
|
backgroundColor:"black",
|
|
23
|
-
// padding:"5px",
|
|
24
|
-
// backgroundColor:style?.tooltipbackground||"black",
|
|
25
23
|
...style?.tooltipStyle,
|
|
26
24
|
margin:"-20px",
|
|
27
25
|
}}
|