@ledvance/ui-biz-bundle 1.1.103 → 1.1.104

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/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.103",
7
+ "version": "1.1.104",
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 {Image, Platform, StyleSheet, View} from "react-native";
2
+ import {Image, Platform, StyleSheet, View, 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
  loading={state.loading}
149
148
  greeneryIcon={res.energy_consumption_greenery}
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
 
@@ -15,14 +15,27 @@ interface DateTypeItemProps extends PropsWithChildren<ViewProps> {
15
15
  onDateTypeChange: (dateType: DateType) => void
16
16
  }
17
17
 
18
+ const getDateTypeTitle = (dateType: DateType) => {
19
+ switch (dateType) {
20
+ case DateType.Year:
21
+ return I18n.getLang('year');
22
+ case DateType.Month:
23
+ return I18n.getLang('month');
24
+ case DateType.Day:
25
+ return I18n.getLang('day');
26
+ }
27
+ }
28
+
18
29
  export default withTheme(function DateTypeItem(props: DateTypeItemProps) {
19
30
  const {dateType} = props;
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,7 +7,7 @@ import {Utils} from "tuya-panel-kit";
7
7
  import {OverviewItem} from "../EnergyConsumptionPage";
8
8
 
9
9
  const {withTheme} = Utils.ThemeUtils
10
-
10
+ const cx = Utils.RatioUtils.convertX;
11
11
  interface BarChartProps {
12
12
  theme?: ThemeType
13
13
  data: OverviewItem[],
@@ -61,12 +61,21 @@ const BarChartWithTouch = (props: BarChartProps) => {
61
61
  position: 'left',
62
62
  axisLabel: {
63
63
  formatter: function (value) {
64
- return parseFloat(value).toFixed(2);
64
+ const kwh=parseFloat(value);
65
+ let toFixed = 2;
66
+ if (kwh >= 100) {
67
+ toFixed = 0;
68
+ } else if (kwh >= 10) {
69
+ toFixed = 1;
70
+ }
71
+ return kwh.toFixed(toFixed);
65
72
  },
66
73
  color:props.theme?.global.secondFontColor,
67
74
  },
68
75
  nameTextStyle: {
69
76
  fontSize: 14,
77
+ align:'left',
78
+ padding: [0, 0, 0, cx(-30)],
70
79
  color: props.theme?.global.secondFontColor,
71
80
  },
72
81
  }, {
@@ -79,12 +88,21 @@ const BarChartWithTouch = (props: BarChartProps) => {
79
88
  minInterval: 1,
80
89
  axisLabel: {
81
90
  formatter: function (value) {
82
- return parseFloat(value).toFixed(1);
91
+ const price=parseFloat(value);
92
+ let toFixed = 2;
93
+ if (price >= 100) {
94
+ toFixed = 0;
95
+ } else if (price >= 10) {
96
+ toFixed = 1;
97
+ }
98
+ return price.toFixed(toFixed);
83
99
  },
84
100
  color:props.theme?.global.secondFontColor,
85
101
  },
86
102
  nameTextStyle: {
87
103
  fontSize: 14,
104
+ align:'right',
105
+ padding: [0, cx(-30), 0, 0],
88
106
  color: props.theme?.global.secondFontColor,
89
107
  },
90
108
  }],