@ledvance/ui-biz-bundle 1.1.54 → 1.1.56

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.54",
7
+ "version": "1.1.56",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -2,8 +2,7 @@ import { useDps } from "@ledvance/base/src/models/modules/NativePropsSlice";
2
2
  import { FlagPageProps } from "./FlagPage";
3
3
  import { SceneNodeTransitionMode } from "@ledvance/ui-biz-bundle/src/modules/scene/SceneInfo";
4
4
  import { WORK_MODE, nToHS, parseJSON, toFixed } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
5
- import { cloneDeep } from "lodash";
6
- import { FlagItemInfo, FlagUiInfo, defFlagList, def2FlagList, def3FlagList } from "./FlagInfo";
5
+ import { FlagItemInfo, FlagUiInfo, defFlagList } from "./FlagInfo";
7
6
  import { hex2Int } from "@ledvance/base/src/utils/common";
8
7
  import { spliceByStep } from "@ledvance/base/src/utils/common";
9
8
  import { useMemo, useState } from "react";
@@ -222,7 +221,16 @@ export function dp2Obj(dp: string, option?: FlagOption): FlagItemInfo | undefine
222
221
 
223
222
  }
224
223
 
225
- export async function getRemoteFlag(devId: string) {
224
+ export async function getRemoteFlag(devId: string, isRefresh?: boolean) {
225
+ if (isRefresh){
226
+ const res = await NativeApi.putJson(devId, featureId, JSON.stringify(defFlagList))
227
+ if (res.success){
228
+ return {
229
+ success: true,
230
+ data: defFlagList
231
+ }
232
+ }
233
+ }
226
234
  const res = await NativeApi.getJson(devId, featureId)
227
235
  const isNormalData = Array.isArray(parseJSON(res?.data))
228
236
  if (res.success && isNormalData) {
@@ -236,7 +244,7 @@ export async function getRemoteFlag(devId: string) {
236
244
  if (res.success) {
237
245
  return {
238
246
  success: true,
239
- data: cloneDeep(defFlagList)
247
+ data: defFlagList
240
248
  }
241
249
  }
242
250
  return { success: false }
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useMemo } from "react";
2
2
  import Page from "@ledvance/base/src/components/Page";
3
3
  import { useDeviceId, useDeviceInfo, useFlagMode, useFlags, useMoods } from "@ledvance/base/src/models/modules/NativePropsSlice";
4
- import { FlatList } from "react-native";
4
+ import { FlatList, Image, TouchableOpacity, View } from "react-native";
5
5
  import Spacer from "@ledvance/base/src/components/Spacer";
6
6
  import { Utils } from "tuya-panel-kit";
7
7
  import FlagItem from "./FlagItem";
@@ -19,6 +19,7 @@ import { Result } from "@ledvance/base/src/models/modules/Result";
19
19
  import { useDps } from "@ledvance/base/src/models/modules/NativePropsSlice";
20
20
  import { ColorUtils, WORK_MODE } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
21
21
  import TextField from "@ledvance/base/src/components/TextField";
22
+ import { showDialog } from "@ledvance/base/src/utils/common";
22
23
  const cx = Utils.RatioUtils.convertX
23
24
 
24
25
  export interface FlagPageProps {
@@ -108,8 +109,8 @@ const FlagPage = () => {
108
109
  state.flags = state.searchText !== '' ? cloneDeep(flags).filter(flag => flag.name.includes(state.searchText)) : cloneDeep(flags)
109
110
  }, [state.searchText, flags])
110
111
 
111
- const getRemoteFlagInfo = async () => {
112
- const res = await getRemoteFlag(devInfo.devId)
112
+ const getRemoteFlagInfo = async (isRefresh?: boolean) => {
113
+ const res = await getRemoteFlag(devInfo.devId, isRefresh)
113
114
  if (res.success) {
114
115
  let cloneFlag: FlagUiInfo[] = cloneDeep(res.data) || []
115
116
  state.flags = cloneFlag
@@ -212,14 +213,33 @@ const FlagPage = () => {
212
213
  }
213
214
  }}
214
215
  >
215
- <TextField
216
- value={state.searchText}
217
- onChangeText={text => {
218
- state.searchText = text
219
- }}
220
- placeholder={I18n.getLang('country_selection_textfield_headline_search')}
221
- style={{ marginHorizontal: cx(24) }}
222
- />
216
+ <View style={{flexDirection: 'row', display: 'flex', alignItems: 'center'}}>
217
+ <TextField
218
+ value={state.searchText}
219
+ onChangeText={text => {
220
+ state.searchText = text
221
+ }}
222
+ placeholder={I18n.getLang('country_selection_textfield_headline_search')}
223
+ style={{ marginHorizontal: cx(24), flex: 1 }}
224
+ />
225
+ <TouchableOpacity style={{paddingRight: cx(24)}}
226
+ onPress={() =>{
227
+ showDialog({
228
+ method: 'confirm',
229
+ title: I18n.getLang('flag_resetbutton'),
230
+ subTitle: I18n.getLang('flag_resetdescription'),
231
+ onConfirm: async (_, {close}) =>{
232
+ close()
233
+ state.loading = true
234
+ await getRemoteFlagInfo(true)
235
+ state.loading = false
236
+ }
237
+ })
238
+ }}
239
+ >
240
+ <Image source={res.ic_refresh} style={{width: cx(24), height: cx(24)}}/>
241
+ </TouchableOpacity>
242
+ </View>
223
243
  <FlatList
224
244
  data={state.flags}
225
245
  renderItem={({ item }) => <FlagItem
@@ -115,7 +115,7 @@ function newMixMood(mainId: number, secondlyId: number, isStatic: boolean): MixS
115
115
  id: mainId,
116
116
  speed: 100,
117
117
  mode: isStatic ? SceneNodeTransitionMode.Static : 1,
118
- nodes: isStatic ? [node] : [node, node]
118
+ nodes: isStatic ? [{...node}] : [{...node}, {...node}]
119
119
  },
120
120
  secondlyLamp: {
121
121
  ...defSecondly,
@@ -69,7 +69,7 @@ export function MixMoodColorsLine(props: { mixSubLight: MixMainLampInfo, colorLi
69
69
  <MoodColorsLine
70
70
  nodeStyle={{ borderColor: '#ccc', borderWidth: 1 }}
71
71
  width={cx(264)}
72
- type={'separate'}
72
+ type={!colorLight ? 'separate' : (mixSubLight.mode === 1 ? 'gradient' : 'separate')}
73
73
  colors={lightColors} />
74
74
  <Spacer height={0} width={cx(7)} />
75
75
  <View style={styles.gradientItemIconView}>
@@ -147,7 +147,7 @@ const MoodSetting = (props: MoodSettingProps) => {
147
147
  ListFooterComponent={() => (<Spacer />)}
148
148
  keyExtractor={item => `${item.name}`} /> :
149
149
  <>
150
- <View style={styles.tagLine}>
150
+ <View style={[styles.tagLine, {marginHorizontal: cx(24)}]}>
151
151
  <Tag
152
152
  checked={state.staticTagChecked}
153
153
  text={I18n.getLang('mood_overview_filter_name_text1')}
@@ -180,7 +180,7 @@ const MoodSetting = (props: MoodSettingProps) => {
180
180
  ListHeaderComponent={() => (<Spacer height={cx(10)} />)}
181
181
  ItemSeparatorComponent={() => (<Spacer />)}
182
182
  ListFooterComponent={() => (
183
- <View style={styles.infoLine}>
183
+ <View style={[styles.infoLine, {marginHorizontal: cx(24)}]}>
184
184
  <Spacer />
185
185
  <InfoText
186
186
  icon={res.ic_info}