@ledvance/ui-biz-bundle 1.1.99 → 1.1.101

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.99",
7
+ "version": "1.1.101",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -72,7 +72,8 @@ export const useFlag: UseFlagType = (flagCode, extra) => {
72
72
  return setDps(extraDps)
73
73
  } else {
74
74
  const hex = obj2Dp(flagItem, extra)
75
- return setDps({ [flagCode]: hex, [extra.workModeCode]: WORK_MODE.SCENE, [extra.switchLedCode]: true })
75
+ const newHex = extra.isSolarLight ? ('01'+hex.substring(2)) : hex
76
+ return setDps({ [flagCode]: newHex, [extra.workModeCode]: WORK_MODE.SCENE, [extra.switchLedCode]: true })
76
77
  }
77
78
  }
78
79
  return [flagState, setFlagFn]
@@ -36,6 +36,7 @@ export interface FlagPageProps {
36
36
  isStringLight?: boolean
37
37
  isStripLight?: boolean
38
38
  isCeilingLight?: boolean
39
+ isSolarLight?: boolean
39
40
  isSupportMixScene?: boolean
40
41
  isSupportSceneStatus?: boolean
41
42
  drawToolLight?: {
@@ -72,10 +72,6 @@ const getDpResultByYearMonth = async (devId: string, addEleDpCode: string, dateS
72
72
  const date = dayjs(dateStr)
73
73
  const startDay = date.startOf('month').format('YYYYMMDD')
74
74
  const endDay = date.endOf('month').format('YYYYMMDD')
75
- if (overDays(startDay, 365)) {
76
- console.log("getDpResultByYearMonth overDays true")
77
- return []
78
- }
79
75
  const res = await getDataWithSpecified(devId, addEleDpCode, startDay, endDay, 'sum')
80
76
  if (!isEmpty(res) && res.result) {
81
77
  const dayList = res.result
@@ -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(devId, addEleDpCode, state.date, state.dateType).then((res) => {
87
88
  state.chartData = res;
@@ -99,25 +100,38 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
99
100
  return I18n.getLang('energyconsumption_emptydata')
100
101
  }, [state.dateType, state.over365Days, state.over7Days]);
101
102
 
103
+ const updateHeadlineText = useCallback((date: dayjs.Dayjs) => {
104
+ const year = date.year().toString();
105
+ const month = (date.month() + 1).toString().padStart(2, '0');
106
+ const day = date.date().toString().padStart(2, '0');
107
+ const dayOfWeek = date.day() % 7;
108
+ switch (state.dateType) {
109
+ case DateType.Year:
110
+ state.headlineText = year;
111
+ break
112
+ case DateType.Month:
113
+ state.headlineText = `${monthFormat(month)} ${year}`;
114
+ break
115
+ case DateType.Day:
116
+ state.headlineText = `${day}/${month}/${year}\n${loopsText[dayOfWeek]}`;
117
+ break
118
+ }
119
+ }, [state.dateType, state.headlineText]);
102
120
 
103
121
  useUpdateEffect(() => {
104
122
  const date = dayjs();
105
123
  const year = date.year().toString();
106
124
  const month = (date.month() + 1).toString().padStart(2, '0');
107
125
  const day = date.date().toString().padStart(2, '0');
108
- const dayOfWeek = date.day() % 7;
109
126
  switch (state.dateType) {
110
127
  case DateType.Year:
111
128
  state.date = year;
112
- state.headlineText = year;
113
129
  break
114
130
  case DateType.Month:
115
131
  state.date = `${year}${month}`
116
- state.headlineText = `${monthFormat(month)} ${year}`;
117
132
  break
118
133
  case DateType.Day:
119
134
  state.date = `${year}${month}${day}`
120
- state.headlineText = `${day}/${month}/${year}\n${loopsText[dayOfWeek]}`;
121
135
  break
122
136
  }
123
137
  }, [state.dateType]);
@@ -170,7 +184,7 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
170
184
  </View>
171
185
  ) : (
172
186
  state.chartData.length > 0 && !state.loading &&
173
- <NewBarChart height={400} data={state.chartData} price={state.price}
187
+ <NewBarChart height={cx(400)} data={state.chartData} price={state.price}
174
188
  unit={unit}/>
175
189
  )
176
190
  }
@@ -87,6 +87,7 @@ export interface LightCategory {
87
87
  isMatterLight?: boolean;
88
88
  isCeilingFan?: boolean;
89
89
  isUVCFan?: boolean;
90
+ isSolarLight?: boolean;
90
91
  }
91
92
  export interface DefMoodOption extends LightCategory{
92
93
  isSupportColor: boolean;
@@ -187,7 +187,7 @@ export const useMoodScene = (params: MoodPageParams): [MoodInfo, (moodInfo: Mood
187
187
  const { mainLamp, secondaryLamp } = moodInfo
188
188
  if (params.isMixLight || mainLamp?.nodes?.length) {
189
189
  const mainHex = getMoodDp(params.isCeilingLight ? {...moodInfo, id: mainLamp.id!} : moodInfo, params);
190
- mainDps[params.mainDp] = mainHex
190
+ mainDps[params.mainDp] = params.isSolarLight ? ('01' + mainHex.substring(2)) : mainHex
191
191
  mainDps[params.mainWorkMode] = WorkMode.Scene;
192
192
  mainDps[params.mainSwitch] = true;
193
193
  }
@@ -207,7 +207,7 @@ export const useMoodScene = (params: MoodPageParams): [MoodInfo, (moodInfo: Mood
207
207
  }
208
208
  setDps(secondaryDps).then()
209
209
  }
210
- mainLamp[params.switchLedDp] = true
210
+ mainLamp[params.switchLedDp] = true
211
211
  }
212
212
  return setDps(mainDps)
213
213
  };