@ledvance/group-ui-biz-bundle 1.0.88 → 1.0.89

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
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.88",
7
+ "version": "1.0.89",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback } from "react";
2
- import { Platform, View, StyleSheet, Image } from "react-native";
2
+ import { Platform, View, StyleSheet, Image, Text} from "react-native";
3
3
  import { useRoute } from '@react-navigation/core'
4
4
  import Page from "@ledvance/base/src/components/Page";
5
5
  import res from "@ledvance/base/src/res";
@@ -139,7 +139,6 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
139
139
  return (
140
140
  <Page
141
141
  backText={I18n.getLang('consumption_data_annual_bar_chart_system_back_text')}
142
- headlineText={state.headlineText}
143
142
  headlineIcon={state.chartData?.length ? res.download_icon : undefined}
144
143
  onHeadlineIconClick={() => {
145
144
  exportFile(state.chartData,params.price,params.unit)
@@ -147,6 +146,11 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
147
146
  showGreenery={false}
148
147
  greeneryIcon={res.energy_consumption_greenery}
149
148
  loading={state.loading}
149
+ headlineContent={
150
+ <View style={{alignItems: 'center', justifyContent: 'center', flex: 1, marginStart: cx(24)}}>
151
+ <Text style={{fontSize: cx(24), color: props.theme?.global.brand}}>{state.headlineText}</Text>
152
+ </View>
153
+ }
150
154
  >
151
155
  <View style={{ marginHorizontal: cx(24) }}>
152
156
  <View style={{flexDirection: 'row'}}>
@@ -9,6 +9,17 @@ import { DateType } from "@ledvance/group-ui-biz-bundle/src/modules/energyConsum
9
9
  const {convertX: cx} = Utils.RatioUtils
10
10
  const {withTheme} = Utils.ThemeUtils
11
11
 
12
+ const getDateTypeTitle = (dateType: DateType) => {
13
+ switch (dateType) {
14
+ case DateType.Year:
15
+ return I18n.getLang('year');
16
+ case DateType.Month:
17
+ return I18n.getLang('month');
18
+ case DateType.Day:
19
+ return I18n.getLang('day');
20
+ }
21
+ }
22
+
12
23
  interface DateTypeItemProps extends PropsWithChildren<ViewProps> {
13
24
  theme?: ThemeType
14
25
  dateType: string,
@@ -20,9 +31,11 @@ export default withTheme(function DateTypeItem(props: DateTypeItemProps) {
20
31
  const state = useReactive({
21
32
  showDateTypeModal: false,
22
33
  dateType: dateType,
34
+ dateTypeTitle: getDateTypeTitle(dateType)
23
35
  });
24
36
  useUpdateEffect(() => {
25
37
  state.dateType = dateType;
38
+ state.dateTypeTitle = getDateTypeTitle(dateType);
26
39
  }, [dateType])
27
40
  return (<View style={props.style}>
28
41
  <TouchableOpacity
@@ -49,7 +62,7 @@ export default withTheme(function DateTypeItem(props: DateTypeItemProps) {
49
62
  flex: 1,
50
63
  color: props.theme?.textInput.fontColor,
51
64
  fontFamily: 'helvetica_neue_lt_std_roman',
52
- }}>{state.dateType}</Text>
65
+ }}>{state.dateTypeTitle}</Text>
53
66
  </View>
54
67
  </TouchableOpacity>
55
68
 
@@ -59,17 +72,17 @@ export default withTheme(function DateTypeItem(props: DateTypeItemProps) {
59
72
  value={state.dateType}
60
73
  dataSource={[
61
74
  {
62
- title: I18n.getLang('day'),
75
+ title: getDateTypeTitle(DateType.Day),
63
76
  key: DateType.Day,
64
77
  value: DateType.Day,
65
78
  },
66
79
  {
67
- title: I18n.getLang('month'),
80
+ title: getDateTypeTitle(DateType.Month),
68
81
  key: DateType.Month,
69
82
  value: DateType.Month,
70
83
  },
71
84
  {
72
- title: I18n.getLang('year'),
85
+ title: getDateTypeTitle(DateType.Year),
73
86
  key: DateType.Year,
74
87
  value: DateType.Year,
75
88
  }
@@ -7,6 +7,7 @@ import {Utils} from "tuya-panel-kit";
7
7
  import {OverviewItem} from "../EnergyConsumptionPage";
8
8
 
9
9
  const {withTheme} = Utils.ThemeUtils
10
+ const cx = Utils.RatioUtils.convertX;
10
11
 
11
12
  interface BarChartProps {
12
13
  theme?: ThemeType
@@ -61,12 +62,21 @@ const BarChartWithTouch = (props: BarChartProps) => {
61
62
  position: 'left',
62
63
  axisLabel: {
63
64
  formatter: function (value) {
64
- return parseFloat(value).toFixed(2);
65
+ const kwh=parseFloat(value);
66
+ let toFixed = 2;
67
+ if (kwh >= 100) {
68
+ toFixed = 0;
69
+ } else if (kwh >= 10) {
70
+ toFixed = 1;
71
+ }
72
+ return kwh.toFixed(toFixed);
65
73
  },
66
74
  color:props.theme?.global.secondFontColor,
67
75
  },
68
76
  nameTextStyle: {
69
77
  fontSize: 14,
78
+ align:'left',
79
+ padding: [0, 0, 0, cx(-30)],
70
80
  color: props.theme?.global.secondFontColor,
71
81
  },
72
82
  }, {
@@ -79,12 +89,21 @@ const BarChartWithTouch = (props: BarChartProps) => {
79
89
  minInterval: 1,
80
90
  axisLabel: {
81
91
  formatter: function (value) {
82
- return parseFloat(value).toFixed(1);
92
+ const price=parseFloat(value);
93
+ let toFixed = 2;
94
+ if (price >= 100) {
95
+ toFixed = 0;
96
+ } else if (price >= 10) {
97
+ toFixed = 1;
98
+ }
99
+ return price.toFixed(toFixed);
83
100
  },
84
101
  color:props.theme?.global.secondFontColor,
85
102
  },
86
103
  nameTextStyle: {
87
104
  fontSize: 14,
105
+ align:'right',
106
+ padding: [0, cx(-30), 0, 0],
88
107
  color: props.theme?.global.secondFontColor,
89
108
  },
90
109
  }],