@ledvance/group-ui-biz-bundle 1.0.85 → 1.0.86
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/package.json
CHANGED
|
@@ -82,6 +82,7 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
|
|
|
82
82
|
useUpdateEffect(() => {
|
|
83
83
|
state.over365Days = overDays(state.date, 365);
|
|
84
84
|
state.over7Days = overDays(state.date, 7);
|
|
85
|
+
updateHeadlineText(dayjs(state.date));
|
|
85
86
|
state.loading = true;
|
|
86
87
|
getElectricity(deviceIdGroup, addEleDpCode, state.date, state.dateType).then((res) => {
|
|
87
88
|
state.chartData = res;
|
|
@@ -94,23 +95,37 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
|
|
|
94
95
|
const year = date.year().toString();
|
|
95
96
|
const month = (date.month() + 1).toString().padStart(2, '0');
|
|
96
97
|
const day = date.date().toString().padStart(2, '0');
|
|
97
|
-
const dayOfWeek = date.day() % 7;
|
|
98
98
|
switch (state.dateType) {
|
|
99
99
|
case DateType.Year:
|
|
100
100
|
state.date = year;
|
|
101
|
-
state.headlineText = year;
|
|
102
101
|
break
|
|
103
102
|
case DateType.Month:
|
|
104
103
|
state.date = `${year}${month}`
|
|
105
|
-
state.headlineText = `${monthFormat(month)} ${year}`;
|
|
106
104
|
break
|
|
107
105
|
case DateType.Day:
|
|
108
106
|
state.date = `${year}${month}${day}`
|
|
109
|
-
state.headlineText = `${day}/${month}/${year}\n${loopsText[dayOfWeek]}`;
|
|
110
107
|
break
|
|
111
108
|
}
|
|
112
109
|
}, [state.dateType]);
|
|
113
110
|
|
|
111
|
+
const updateHeadlineText = useCallback((date: dayjs.Dayjs) => {
|
|
112
|
+
const year = date.year().toString();
|
|
113
|
+
const month = (date.month() + 1).toString().padStart(2, '0');
|
|
114
|
+
const day = date.date().toString().padStart(2, '0');
|
|
115
|
+
const dayOfWeek = date.day() % 7;
|
|
116
|
+
switch (state.dateType) {
|
|
117
|
+
case DateType.Year:
|
|
118
|
+
state.headlineText = year;
|
|
119
|
+
break
|
|
120
|
+
case DateType.Month:
|
|
121
|
+
state.headlineText = `${monthFormat(month)} ${year}`;
|
|
122
|
+
break
|
|
123
|
+
case DateType.Day:
|
|
124
|
+
state.headlineText = `${day}/${month}/${year}\n${loopsText[dayOfWeek]}`;
|
|
125
|
+
break
|
|
126
|
+
}
|
|
127
|
+
}, [state.dateType, state.headlineText]);
|
|
128
|
+
|
|
114
129
|
const getEmptyDataTip = useCallback(() => {
|
|
115
130
|
if (state.over365Days) {
|
|
116
131
|
return I18n.getLang('energyconsumption_Daylimit')
|