@ledvance/group-ui-biz-bundle 1.0.77 → 1.0.78

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.77",
7
+ "version": "1.0.78",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -23,6 +23,7 @@ import { showDialog } from '@ledvance/base/src/utils/common'
23
23
  import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
24
24
 
25
25
  const cx = Utils.RatioUtils.convertX
26
+ const { withTheme } = Utils.ThemeUtils
26
27
 
27
28
  export interface FlagEditParams {
28
29
  mode: 'add' | 'edit'
@@ -32,7 +33,7 @@ export interface FlagEditParams {
32
33
  modDeleteFlag: (mode: 'add' | 'edit' | 'del', currentMood: FlagUiInfo, options?: FlagOption) => Promise<Result<any>>
33
34
  }
34
35
 
35
- const FlagEditPage = () => {
36
+ const FlagEditPage = (props: { theme?: any }) => {
36
37
  const navigation = useNavigation()
37
38
  const params = cloneDeep(useRoute().params as FlagEditParams)
38
39
  const state = useReactive({
@@ -79,6 +80,102 @@ const FlagEditPage = () => {
79
80
  return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodDataChanged)
80
81
  }, [nameRepeat, state.mood.name, checkMoodDataChanged, params.mode])
81
82
 
83
+
84
+ const styles = StyleSheet.create({
85
+ root: {
86
+ flex: 1,
87
+ flexDirection: 'column',
88
+ },
89
+ name: {
90
+ marginHorizontal: cx(24),
91
+ },
92
+ adjustCard: {
93
+ marginVertical: cx(12),
94
+ marginHorizontal: cx(24),
95
+ },
96
+ fanAdjustCard: {
97
+ marginHorizontal: cx(24),
98
+ },
99
+ lightLine: {
100
+ flexDirection: 'row',
101
+ marginHorizontal: cx(16),
102
+ },
103
+ light: {
104
+ color: props.theme.global.fontColor,
105
+ fontSize: cx(18),
106
+ fontFamily: 'helvetica_neue_lt_std_bd',
107
+ },
108
+ transitionMode: {
109
+ marginHorizontal: cx(16),
110
+ },
111
+ preview: {
112
+ width: cx(20),
113
+ height: cx(20),
114
+ marginStart: cx(12),
115
+ borderRadius: cx(4),
116
+ },
117
+ nodesAdjust: {
118
+ flexDirection: 'row',
119
+ alignItems: 'center',
120
+ },
121
+ adjustButtons: {
122
+ width: cx(44),
123
+ marginStart: cx(16),
124
+ },
125
+ adjustButton: {
126
+ width: cx(44),
127
+ height: cx(44),
128
+ },
129
+ nodeList: {
130
+ flex: 1,
131
+ marginHorizontal: cx(16),
132
+ },
133
+ nodeItem: {
134
+ flexDirection: 'row',
135
+ alignItems: 'center',
136
+ },
137
+ nodeBlock: {
138
+ flex: 1,
139
+ height: cx(40),
140
+ borderRadius: cx(8),
141
+ borderWidth: 1,
142
+ borderColor: props.theme.card.border
143
+ },
144
+ nodeDeleteBtn: {
145
+ width: cx(24),
146
+ height: cx(30),
147
+ justifyContent: 'center',
148
+ alignItems: 'center',
149
+ },
150
+ nodeDeleteIcon: {
151
+ width: cx(16),
152
+ height: cx(16),
153
+ },
154
+ nodeAddBtn: {
155
+ height: cx(40),
156
+ justifyContent: 'center',
157
+ alignItems: 'center',
158
+ marginEnd: cx(26),
159
+ borderRadius: cx(8),
160
+ borderWidth: cx(1),
161
+ borderStyle: 'dashed',
162
+ borderColor: props.theme.addNode.border,
163
+ backgroundColor: props.theme.addNode.background,
164
+ },
165
+ deleteBtn: {
166
+ width: '100%',
167
+ height: cx(50),
168
+ backgroundColor: props.theme.button.delete,
169
+ borderRadius: cx(8),
170
+ },
171
+ deleteBtnText: {
172
+ color: props.theme.button.fontColor,
173
+ fontSize: cx(16),
174
+ fontFamily: 'helvetica_neue_lt_std_bd',
175
+ },
176
+ })
177
+
178
+
82
179
  return (
83
180
  <Page
84
181
  backText={I18n.getLang('Feature_devicepanel_flags')}
@@ -116,57 +213,57 @@ const FlagEditPage = () => {
116
213
  }}
117
214
  maxLength={33}
118
215
  showError={state.mood.name.length > 32 || nameRepeat}
119
- tipColor={nameRepeat ? '#f00' : undefined}
216
+ tipColor={nameRepeat ? props.theme.global.error : undefined}
120
217
  tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
121
218
  errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
122
219
  {(params.moduleParams.isMixLight || params.moduleParams.isCeilingLight) && <><Card style={styles.adjustCard}>
123
- <Spacer height={cx(16)} />
124
- <View style={styles.lightLine}>
125
- <Text style={styles.light}>
126
- {I18n.getLang('light_sources_tile_main_lighting_headline')}
127
- </Text>
128
- <View style={[styles.preview, { backgroundColor: getColorBlockColor(true) }]} />
129
- </View>
130
- <Spacer />
131
- <ColorTempAdjustView
132
- isSupportBrightness={!!params.moduleParams.isSupportBrightness}
133
- isSupportTemperature={!!params.moduleParams.isSupportTemperature}
134
- colorTemp={state.currentWhiteNode.colorTemp}
135
- brightness={state.currentWhiteNode.brightness}
136
- onCCTChange={(cct) => {
137
- state.currentWhiteNode.colorTemp = cct
138
- }}
139
- onCCTChangeComplete={(cct) => {
140
- state.currentWhiteNode.colorTemp = cct
141
- state.mood.whiteColors = state.mood.whiteColors.map((item, idx) => {
142
- if (idx === state.whitePaintBucketIdx) {
143
- return {
144
- ...state.mood.whiteColors[idx],
145
- colorTemp: cct
146
- }
147
- }
148
- return item
149
- })
150
- }}
151
- onBrightnessChange={(bright) => {
152
- state.currentWhiteNode.brightness = bright
153
- }}
154
- onBrightnessChangeComplete={(bright) => {
155
- state.currentWhiteNode.brightness = bright
156
- state.mood.whiteColors = state.mood.whiteColors.map((item, idx) => {
157
- if (idx === state.whitePaintBucketIdx) {
158
- return {
159
- ...state.mood.whiteColors[idx],
160
- brightness: bright
161
- }
162
- }
163
- return item
164
- })
165
- }}
166
- />
167
- <Spacer height={cx(16)} />
220
+ <Spacer height={cx(16)} />
221
+ <View style={styles.lightLine}>
222
+ <Text style={styles.light}>
223
+ {I18n.getLang('light_sources_tile_main_lighting_headline')}
224
+ </Text>
225
+ <View style={[styles.preview, { backgroundColor: getColorBlockColor(true) }]} />
226
+ </View>
227
+ <Spacer />
228
+ <ColorTempAdjustView
229
+ isSupportBrightness={!!params.moduleParams.isSupportBrightness}
230
+ isSupportTemperature={!!params.moduleParams.isSupportTemperature}
231
+ colorTemp={state.currentWhiteNode.colorTemp}
232
+ brightness={state.currentWhiteNode.brightness}
233
+ onCCTChange={(cct) => {
234
+ state.currentWhiteNode.colorTemp = cct
235
+ }}
236
+ onCCTChangeComplete={(cct) => {
237
+ state.currentWhiteNode.colorTemp = cct
238
+ state.mood.whiteColors = state.mood.whiteColors.map((item, idx) => {
239
+ if (idx === state.whitePaintBucketIdx) {
240
+ return {
241
+ ...state.mood.whiteColors[idx],
242
+ colorTemp: cct
243
+ }
244
+ }
245
+ return item
246
+ })
247
+ }}
248
+ onBrightnessChange={(bright) => {
249
+ state.currentWhiteNode.brightness = bright
250
+ }}
251
+ onBrightnessChangeComplete={(bright) => {
252
+ state.currentWhiteNode.brightness = bright
253
+ state.mood.whiteColors = state.mood.whiteColors.map((item, idx) => {
254
+ if (idx === state.whitePaintBucketIdx) {
255
+ return {
256
+ ...state.mood.whiteColors[idx],
257
+ brightness: bright
258
+ }
259
+ }
260
+ return item
261
+ })
262
+ }}
263
+ />
264
+ <Spacer height={cx(16)} />
168
265
  </Card>
169
- <Spacer />
266
+ <Spacer />
170
267
  </>}
171
268
  <Card style={styles.adjustCard}>
172
269
  <Spacer height={cx(16)} />
@@ -177,16 +274,16 @@ const FlagEditPage = () => {
177
274
  </View>
178
275
  <Spacer height={cx(10)} />
179
276
  {(!params.moduleParams.isStripLight && !params.moduleParams.isCeilingLight) && <>
180
- <LdvSlider
181
- title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
182
- value={state.mood.speed}
183
- onValueChange={value => {
184
- state.mood.speed = value
185
- }}
186
- onSlidingComplete={value => {
187
- state.mood.speed = value
188
- }} />
189
- <Spacer height={cx(16)} />
277
+ <LdvSlider
278
+ title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
279
+ value={state.mood.speed}
280
+ onValueChange={value => {
281
+ state.mood.speed = value
282
+ }}
283
+ onSlidingComplete={value => {
284
+ state.mood.speed = value
285
+ }} />
286
+ <Spacer height={cx(16)} />
190
287
  </>}
191
288
  <View style={styles.nodesAdjust}>
192
289
  <View style={styles.adjustButtons}>
@@ -195,7 +292,7 @@ const FlagEditPage = () => {
195
292
  state.colorPaintBucketSelected = true
196
293
  }}>
197
294
  <Image
198
- style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ? '#f60' : '#666' }]}
295
+ style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ? props.theme.icon.primary : props.theme.icon.normal }]}
199
296
  source={res.ic_paint_bucket} />
200
297
  </TouchableOpacity>
201
298
  <TouchableOpacity
@@ -203,7 +300,7 @@ const FlagEditPage = () => {
203
300
  state.colorPaintBucketSelected = false
204
301
  }}>
205
302
  <Image
206
- style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ? '#666' : '#f60' }]}
303
+ style={[styles.adjustButton, { tintColor: state.colorPaintBucketSelected ? props.theme.icon.normal : props.theme.icon.primary }]}
207
304
  source={res.ic_colorize} />
208
305
  </TouchableOpacity>
209
306
  </View>
@@ -235,7 +332,7 @@ const FlagEditPage = () => {
235
332
  style={[
236
333
  styles.nodeDeleteIcon,
237
334
  {
238
- tintColor: state.mood.colors.length < 3 ? '#ccc' : '#666',
335
+ tintColor: state.mood.colors.length < 3 ? props.theme.icon.disable : props.theme.icon.normal,
239
336
  },
240
337
  ]}
241
338
  source={res.ic_mood_del} />
@@ -266,7 +363,7 @@ const FlagEditPage = () => {
266
363
  style={{
267
364
  width: cx(18),
268
365
  height: cx(18),
269
- tintColor: '#000',
366
+ tintColor: props.theme.global.fontColor,
270
367
  }}
271
368
  source={{ uri: res.add }} />
272
369
  </TouchableOpacity>
@@ -321,29 +418,29 @@ const FlagEditPage = () => {
321
418
  </Card>
322
419
  <Spacer />
323
420
  {params.mode === 'edit' &&
324
- <View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
325
- <TextButton
326
- style={styles.deleteBtn}
327
- textStyle={styles.deleteBtnText}
328
- text={I18n.getLang('flag_deleteflag')}
329
- onPress={() => {
330
- showDialog({
331
- method: 'confirm',
332
- title: I18n.getLang('flag_deletepopup'),
333
- subTitle: I18n.getLang('strip_light_static_mood_edit_dialog_text'),
334
- onConfirm: async (_, { close }) => {
335
- close()
336
- if (state.loading) return
337
- state.loading = true
338
- const res = await params.modDeleteFlag('del', state.mood)
339
- if (res.success) {
340
- state.loading = false
341
- navigation.goBack()
342
- }
343
- }
344
- })
345
- }} />
346
- </View>}
421
+ <View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
422
+ <TextButton
423
+ style={styles.deleteBtn}
424
+ textStyle={styles.deleteBtnText}
425
+ text={I18n.getLang('flag_deleteflag')}
426
+ onPress={() => {
427
+ showDialog({
428
+ method: 'confirm',
429
+ title: I18n.getLang('flag_deletepopup'),
430
+ subTitle: I18n.getLang('strip_light_static_mood_edit_dialog_text'),
431
+ onConfirm: async (_, { close }) => {
432
+ close()
433
+ if (state.loading) return
434
+ state.loading = true
435
+ const res = await params.modDeleteFlag('del', state.mood)
436
+ if (res.success) {
437
+ state.loading = false
438
+ navigation.goBack()
439
+ }
440
+ }
441
+ })
442
+ }} />
443
+ </View>}
347
444
  <Spacer />
348
445
  </View>
349
446
  </ScrollView>
@@ -351,98 +448,4 @@ const FlagEditPage = () => {
351
448
  )
352
449
  }
353
450
 
354
- const styles = StyleSheet.create({
355
- root: {
356
- flex: 1,
357
- flexDirection: 'column',
358
- },
359
- name: {
360
- marginHorizontal: cx(24),
361
- },
362
- adjustCard: {
363
- marginVertical: cx(12),
364
- marginHorizontal: cx(24),
365
- },
366
- fanAdjustCard: {
367
- marginHorizontal: cx(24),
368
- },
369
- lightLine: {
370
- flexDirection: 'row',
371
- marginHorizontal: cx(16),
372
- },
373
- light: {
374
- color: '#000',
375
- fontSize: cx(18),
376
- fontFamily: 'helvetica_neue_lt_std_bd',
377
- },
378
- transitionMode: {
379
- marginHorizontal: cx(16),
380
- },
381
- preview: {
382
- width: cx(20),
383
- height: cx(20),
384
- marginStart: cx(12),
385
- borderRadius: cx(4),
386
- },
387
- nodesAdjust: {
388
- flexDirection: 'row',
389
- alignItems: 'center',
390
- },
391
- adjustButtons: {
392
- width: cx(44),
393
- marginStart: cx(16),
394
- },
395
- adjustButton: {
396
- width: cx(44),
397
- height: cx(44),
398
- },
399
- nodeList: {
400
- flex: 1,
401
- marginHorizontal: cx(16),
402
- },
403
- nodeItem: {
404
- flexDirection: 'row',
405
- alignItems: 'center',
406
- },
407
- nodeBlock: {
408
- flex: 1,
409
- height: cx(40),
410
- borderRadius: cx(8),
411
- borderWidth: 1,
412
- borderColor: '#ccc'
413
- },
414
- nodeDeleteBtn: {
415
- width: cx(24),
416
- height: cx(30),
417
- justifyContent: 'center',
418
- alignItems: 'center',
419
- },
420
- nodeDeleteIcon: {
421
- width: cx(16),
422
- height: cx(16),
423
- },
424
- nodeAddBtn: {
425
- height: cx(40),
426
- justifyContent: 'center',
427
- alignItems: 'center',
428
- marginEnd: cx(26),
429
- borderRadius: cx(8),
430
- borderWidth: cx(1),
431
- borderStyle: 'dashed',
432
- borderColor: '#666',
433
- backgroundColor: '#f6f6f6',
434
- },
435
- deleteBtn: {
436
- width: '100%',
437
- height: cx(50),
438
- backgroundColor: '#666',
439
- borderRadius: cx(8),
440
- },
441
- deleteBtnText: {
442
- color: '#fff',
443
- fontSize: cx(16),
444
- fontFamily: 'helvetica_neue_lt_std_bd',
445
- },
446
- })
447
-
448
- export default FlagEditPage
451
+ export default withTheme(FlagEditPage)
@@ -6,8 +6,10 @@ import MoodColorsLine from '@ledvance/base/src/components/MoodColorsLine'
6
6
  import Spacer from '@ledvance/base/src/components/Spacer'
7
7
 
8
8
  const cx = Utils.RatioUtils.convertX
9
+ const { withTheme } = Utils.ThemeUtils
9
10
 
10
11
  interface RecommendMoodItemProps {
12
+ theme?: any
11
13
  enable: boolean
12
14
  title: string
13
15
  colors: string[]
@@ -17,9 +19,33 @@ interface RecommendMoodItemProps {
17
19
  onSwitch: (enable: boolean) => void
18
20
  }
19
21
 
20
- export default function FlagItem(props: RecommendMoodItemProps) {
22
+ const FlagItem = (props: RecommendMoodItemProps) => {
21
23
  const icon = typeof props.icon === 'number' ? props.icon : { uri: props.icon }
22
24
 
25
+ const styles = StyleSheet.create({
26
+ card: {
27
+ marginHorizontal: cx(24),
28
+ },
29
+ headline: {
30
+ flexDirection: 'row',
31
+ marginHorizontal: cx(16),
32
+ justifyContent: 'space-between',
33
+ },
34
+ headText: {
35
+ color: props.theme.global.fontColor,
36
+ fontSize: cx(16),
37
+ fontFamily: 'helvetica_neue_lt_std_bd',
38
+ lineHeight: cx(20),
39
+ flex: 1
40
+ },
41
+ gradientItem: {
42
+ alignItems: 'center',
43
+ },
44
+ gradient: {
45
+ borderRadius: cx(8),
46
+ },
47
+ })
48
+
23
49
  return (
24
50
  <Card
25
51
  style={[styles.card, props.style]}
@@ -40,7 +66,7 @@ export default function FlagItem(props: RecommendMoodItemProps) {
40
66
  <View style={styles.gradientItem}>
41
67
  <MoodColorsLine
42
68
  type={'separate'}
43
- nodeStyle={{ borderColor: '#ccc', borderWidth: 1 }}
69
+ nodeStyle={{ borderColor: props.theme.card.border, borderWidth: 1 }}
44
70
  colors={props.colors} />
45
71
  </View>
46
72
  <Spacer height={cx(16)} />
@@ -49,43 +75,4 @@ export default function FlagItem(props: RecommendMoodItemProps) {
49
75
  )
50
76
  }
51
77
 
52
- const styles = StyleSheet.create({
53
- card: {
54
- marginHorizontal: cx(24),
55
- },
56
- headline: {
57
- flexDirection: 'row',
58
- marginHorizontal: cx(16),
59
- justifyContent: 'space-between',
60
- },
61
- headText: {
62
- color: '#000',
63
- fontSize: cx(16),
64
- fontFamily: 'helvetica_neue_lt_std_bd',
65
- lineHeight: cx(20),
66
- flex: 1
67
- },
68
- gradientItem: {
69
- alignItems: 'center',
70
- },
71
- gradient: {
72
- borderRadius: cx(8),
73
- },
74
- moodTypeItem: {
75
- flexDirection: 'row',
76
- },
77
- moodTypeLabel: {
78
- marginStart: cx(16),
79
- paddingHorizontal: cx(12.5),
80
- backgroundColor: '#E6E7E8',
81
- borderRadius: cx(8),
82
- },
83
- moodTypeLabelText: {
84
- height: cx(16),
85
- color: '#000000DD',
86
- fontSize: cx(10),
87
- textAlignVertical: 'center',
88
- fontFamily: 'helvetica_neue_lt_std_roman',
89
- lineHeight: cx(16),
90
- },
91
- })
78
+ export default withTheme(FlagItem)
@@ -14,12 +14,13 @@ import { cloneDeep, difference, last, map, range } from "lodash";
14
14
  import { ui_biz_routerKey } from "../../navigation/Routers";
15
15
  import res from "@ledvance/base/src/res";
16
16
  import { hsv2Hex } from "@ledvance/base/src/utils";
17
- import { SceneNodeTransitionMode } from "@ledvance/group-ui-biz-bundle/src/modules/mood/SceneInfo";
17
+ import { SceneNodeTransitionMode } from "../mood/SceneInfo";
18
18
  import TextField from "@ledvance/base/src/components/TextField";
19
19
  import { useParams } from "@ledvance/base/src/hooks/Hooks";
20
20
  import { WorkMode } from "@ledvance/base/src/utils/interface";
21
21
  import { showDialog } from "@ledvance/base/src/utils/common";
22
22
  const cx = Utils.RatioUtils.convertX
23
+ const { withTheme } = Utils.ThemeUtils
23
24
 
24
25
  export interface FlagPageProps {
25
26
  isMixLight?: boolean
@@ -29,10 +30,10 @@ export interface FlagPageProps {
29
30
  isMatterLight?: boolean
30
31
  isSupportTemperature?: boolean
31
32
  isSupportBrightness?: boolean
32
- switchLedCode: string
33
+ switchLedCode: string
33
34
  }
34
35
 
35
- const FlagPage = () => {
36
+ const FlagPage = (props: { theme?: any }) => {
36
37
  const params = useParams<FlagPageProps>()
37
38
  const devInfo = useDeviceInfo()
38
39
  const uaGroupInfo = useUAGroupInfo()
@@ -146,7 +147,7 @@ const FlagPage = () => {
146
147
  loading={state.loading}
147
148
  >
148
149
  <View style={{flexDirection: 'row', display: 'flex', alignItems: 'center'}}>
149
- <TextField
150
+ <TextField
150
151
  value={state.searchText}
151
152
  onChangeText={text => {
152
153
  state.searchText = text
@@ -155,21 +156,21 @@ const FlagPage = () => {
155
156
  style={{ marginHorizontal: cx(24), flex: 1 }}
156
157
  />
157
158
  <TouchableOpacity style={{paddingRight: cx(24)}}
158
- onPress={() =>{
159
- showDialog({
160
- method: 'confirm',
161
- title: I18n.getLang('flag_resetbutton'),
162
- subTitle: I18n.getLang('flag_resetdescription'),
163
- onConfirm: async (_, {close}) =>{
164
- close()
165
- state.loading = true
166
- await getRemoteFlagInfo(true)
167
- state.loading = false
168
- }
169
- })
170
- }}
159
+ onPress={() =>{
160
+ showDialog({
161
+ method: 'confirm',
162
+ title: I18n.getLang('flag_resetbutton'),
163
+ subTitle: I18n.getLang('flag_resetdescription'),
164
+ onConfirm: async (_, {close}) =>{
165
+ close()
166
+ state.loading = true
167
+ await getRemoteFlagInfo(true)
168
+ state.loading = false
169
+ }
170
+ })
171
+ }}
171
172
  >
172
- <Image source={res.ic_refresh} style={{width: cx(24), height: cx(24)}}/>
173
+ <Image source={res.ic_refresh} style={{width: cx(24), height: cx(24), tintColor: props.theme.global.fontColor}}/>
173
174
  </TouchableOpacity>
174
175
  </View>
175
176
  <FlatList
@@ -216,4 +217,4 @@ export const newFlag = (id: number) => {
216
217
  }
217
218
  }
218
219
 
219
- export default FlagPage
220
+ export default withTheme(FlagPage)