sag_components 1.0.602 → 1.0.604
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.
|
@@ -47,14 +47,37 @@ const BarChartsByWeeks = props => {
|
|
|
47
47
|
} = controlsContainerRef.current;
|
|
48
48
|
setBarChartContainerHeight(offsetHeight - 40);
|
|
49
49
|
}, [height]);
|
|
50
|
+
const displayFormattedValue = value => {
|
|
51
|
+
if (!value) return '';
|
|
52
|
+
let formattedValue = '';
|
|
53
|
+
formattedValue = isPercentValue ? ''.concat('', value.toFixed(1), '%') : ''.concat('', (0, _CommonFunctions.getFormattedValue)(value), (0, _CommonFunctions.getFormattedUnits)(value));
|
|
54
|
+
return formattedValue;
|
|
55
|
+
};
|
|
50
56
|
|
|
51
57
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
52
|
-
const CustomTooltip =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
const CustomTooltip = tooltipData => {
|
|
59
|
+
var _payload$0$payload, _payload$0$payload2;
|
|
60
|
+
const {
|
|
61
|
+
active,
|
|
62
|
+
payload,
|
|
63
|
+
label
|
|
64
|
+
} = tooltipData;
|
|
65
|
+
if (!active || !payload || (payload === null || payload === void 0 ? void 0 : payload.length) === 0) return null;
|
|
66
|
+
const week = label && (label === null || label === void 0 ? void 0 : label.toString().length) === 6 ? label.toString().substring(4, 6) : 0;
|
|
67
|
+
let currentTooltipValue = 0;
|
|
68
|
+
if ((_payload$0$payload = payload[0].payload) !== null && _payload$0$payload !== void 0 && _payload$0$payload.value) currentTooltipValue = (_payload$0$payload2 = payload[0].payload) === null || _payload$0$payload2 === void 0 ? void 0 : _payload$0$payload2.value;
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipTitle, null, "Week: ".concat(week)), /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipLabel, null, "".concat(tooltipTitle, " \n ").concat(displayFormattedValue(currentTooltipValue), " \n ")));
|
|
70
|
+
};
|
|
71
|
+
const getWeek = () => {
|
|
72
|
+
if (!barChartData || (barChartData === null || barChartData === void 0 ? void 0 : barChartData.length) === 0) return null;
|
|
73
|
+
const newFormattedData = barChartData === null || barChartData === void 0 ? void 0 : barChartData.map(item => {
|
|
74
|
+
var _item$title;
|
|
75
|
+
return {
|
|
76
|
+
...item,
|
|
77
|
+
titleWeek: item.title && ((_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.toString().length) === 6 ? item.title.toString().substring(4, 6) : 0
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
return newFormattedData;
|
|
58
81
|
};
|
|
59
82
|
const displayEventWeeksElements = () => {
|
|
60
83
|
var _getWeek;
|
|
@@ -66,24 +89,13 @@ const BarChartsByWeeks = props => {
|
|
|
66
89
|
color: item.title >= startWeekRange && item.title <= endWeekRange ? xselectedColor : '',
|
|
67
90
|
textColor: item.title >= startWeekRange && item.title <= endWeekRange ? '#212121' : '#B1B1B1',
|
|
68
91
|
fontWeight: item.title >= startWeekRange && item.title <= endWeekRange ? 600 : 400,
|
|
69
|
-
borderLeftRadius: item.title === startWeekRange ? '12px' : '0px',
|
|
70
|
-
borderRightRadius: item.title === endWeekRange ? '12px' : '0px'
|
|
92
|
+
borderLeftRadius: startWeekRange && item.title === (startWeekRange === null || startWeekRange === void 0 ? void 0 : startWeekRange.toString()) ? '12px' : '0px',
|
|
93
|
+
borderRightRadius: endWeekRange && item.title === (endWeekRange === null || endWeekRange === void 0 ? void 0 : endWeekRange.toString()) ? '12px' : '0px'
|
|
71
94
|
}, item.titleWeek)));
|
|
72
95
|
};
|
|
73
96
|
const displayEventWeeksLegendData = () => /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendMainContainer, {
|
|
74
97
|
id: "EventWeeksLegendMainContainer"
|
|
75
98
|
}, displayEventWeeksElements());
|
|
76
|
-
const getWeek = () => {
|
|
77
|
-
if (!barChartData || (barChartData === null || barChartData === void 0 ? void 0 : barChartData.length) === 0) return null;
|
|
78
|
-
const newFormattedData = barChartData === null || barChartData === void 0 ? void 0 : barChartData.map(item => {
|
|
79
|
-
var _item$title;
|
|
80
|
-
return {
|
|
81
|
-
...item,
|
|
82
|
-
titleWeek: item.title && ((_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.toString().length) === 6 ? item.title.toString().substring(4, 6) : 0
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
return newFormattedData;
|
|
86
|
-
};
|
|
87
99
|
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.ControlsContainer, {
|
|
88
100
|
id: "ControlsContainer",
|
|
89
101
|
height: height,
|
|
@@ -98,7 +110,7 @@ const BarChartsByWeeks = props => {
|
|
|
98
110
|
}, title)), /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
99
111
|
id: "ResponsiveContainer",
|
|
100
112
|
width: "100%",
|
|
101
|
-
height: showLegend ?
|
|
113
|
+
height: showLegend ? '80%' : '86%'
|
|
102
114
|
}, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
103
115
|
width: BarChartContainerWidth,
|
|
104
116
|
height: BarChartContainerHeight,
|
|
@@ -127,10 +139,10 @@ const BarChartsByWeeks = props => {
|
|
|
127
139
|
fontWeight: 400,
|
|
128
140
|
fontSize: "12px",
|
|
129
141
|
tickLine: false,
|
|
130
|
-
tickFormatter: value => "".concat(
|
|
142
|
+
tickFormatter: value => "".concat(displayFormattedValue(value))
|
|
131
143
|
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
132
144
|
content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
|
|
133
|
-
}), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
145
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
134
146
|
dataKey: "value",
|
|
135
147
|
name: "title",
|
|
136
148
|
maxBarSize: 30,
|
|
@@ -263,7 +263,7 @@ const FilterPanel = props => {
|
|
|
263
263
|
placeHolderFontSize: "14px",
|
|
264
264
|
onChange: eventDropdownMulti => {
|
|
265
265
|
var _eventDropdownMulti$n;
|
|
266
|
-
const selectedValue = "".concat(eventDropdownMulti === null || eventDropdownMulti === void 0 ? void 0 : (_eventDropdownMulti$n = eventDropdownMulti.newValue) === null || _eventDropdownMulti$n === void 0 ? void 0 : _eventDropdownMulti$n.map(selectedItem => "
|
|
266
|
+
const selectedValue = "".concat(eventDropdownMulti === null || eventDropdownMulti === void 0 ? void 0 : (_eventDropdownMulti$n = eventDropdownMulti.newValue) === null || _eventDropdownMulti$n === void 0 ? void 0 : _eventDropdownMulti$n.map(selectedItem => "".concat(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value)));
|
|
267
267
|
const newFieldsDataState = FieldsDataState === null || FieldsDataState === void 0 ? void 0 : FieldsDataState.map(itemField => itemField.name === item.name ? {
|
|
268
268
|
...itemField,
|
|
269
269
|
selectedValue: "".concat(selectedValue)
|