@ledvance/ui-biz-bundle 1.1.70 → 1.1.71
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 +1 -1
- package/src/newModules/mood/AddMoodPage.tsx +194 -194
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +650 -650
- package/src/newModules/mood/Interface.ts +225 -220
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +789 -786
- package/src/newModules/mood/MoodActions.ts +244 -232
- package/src/newModules/mood/MoodInfo.ts +2151 -2151
- package/src/newModules/mood/MoodItem.tsx +160 -160
- package/src/newModules/mood/MoodPage.tsx +402 -386
- package/src/newModules/mood/MoodParse.ts +442 -443
- package/src/newModules/mood/RecommendMoodItem.tsx +81 -81
- package/src/newModules/mood/Router.ts +52 -43
- package/src/newModules/mood/StaticMoodEditorPage.tsx +290 -290
|
@@ -1,786 +1,789 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
FlatList,
|
|
4
|
-
Image,
|
|
5
|
-
ScrollView,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Text,
|
|
8
|
-
TouchableOpacity,
|
|
9
|
-
View,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
import { Utils } from 'tuya-panel-kit';
|
|
12
|
-
import { useReactive } from 'ahooks';
|
|
13
|
-
import { cloneDeep,
|
|
14
|
-
import Page from '@ledvance/base/src/components/Page';
|
|
15
|
-
import Strings from '@ledvance/base/src/i18n';
|
|
16
|
-
import { StaticMoodEditorPageParams, StaticMoodEditorPageState } from './StaticMoodEditorPage';
|
|
17
|
-
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
18
|
-
import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
|
|
19
|
-
import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
|
|
20
|
-
import res from '@ledvance/base/src/res';
|
|
21
|
-
import TextField from '@ledvance/base/src/components/TextField';
|
|
22
|
-
import Card from '@ledvance/base/src/components/Card';
|
|
23
|
-
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
24
|
-
import LdvSlider from '@ledvance/base/src/components/ldvSlider';
|
|
25
|
-
import TextButton from '@ledvance/base/src/components/TextButton';
|
|
26
|
-
import {
|
|
27
|
-
MoodNodeTransitionMode,
|
|
28
|
-
stripLightMoodMode,
|
|
29
|
-
lightMoodMode,
|
|
30
|
-
StripLightMoodMode,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if(moduleParams.isSupportBrightness
|
|
159
|
-
newMood.mainLamp.type =
|
|
160
|
-
}
|
|
161
|
-
if(moduleParams.
|
|
162
|
-
newMood.
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
state.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (state.
|
|
366
|
-
node.brightness = bright;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if (state.
|
|
376
|
-
node.colorTemp = cct;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
state.
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
state.
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
)}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
state.mood.secondaryLamp.expand
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
<
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
node.
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
},
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
marginHorizontal: cx(24),
|
|
703
|
-
},
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
},
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
height: cx(
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
FlatList,
|
|
4
|
+
Image,
|
|
5
|
+
ScrollView,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Text,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
View,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { Utils } from 'tuya-panel-kit';
|
|
12
|
+
import { useReactive } from 'ahooks';
|
|
13
|
+
import { cloneDeep, isEqual } from 'lodash';
|
|
14
|
+
import Page from '@ledvance/base/src/components/Page';
|
|
15
|
+
import Strings from '@ledvance/base/src/i18n';
|
|
16
|
+
import { StaticMoodEditorPageParams, StaticMoodEditorPageState } from './StaticMoodEditorPage';
|
|
17
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
18
|
+
import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
|
|
19
|
+
import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
|
|
20
|
+
import res from '@ledvance/base/src/res';
|
|
21
|
+
import TextField from '@ledvance/base/src/components/TextField';
|
|
22
|
+
import Card from '@ledvance/base/src/components/Card';
|
|
23
|
+
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
24
|
+
import LdvSlider from '@ledvance/base/src/components/ldvSlider';
|
|
25
|
+
import TextButton from '@ledvance/base/src/components/TextButton';
|
|
26
|
+
import {
|
|
27
|
+
MoodNodeTransitionMode,
|
|
28
|
+
stripLightMoodMode,
|
|
29
|
+
lightMoodMode,
|
|
30
|
+
StripLightMoodMode,
|
|
31
|
+
CeilingLightSceneMode
|
|
32
|
+
} from './Interface';
|
|
33
|
+
import TextFieldStyleButton from '@ledvance/base/src/components/TextFieldStyleButton';
|
|
34
|
+
import {ui_biz_routerKey} from '../../navigation/Routers'
|
|
35
|
+
import { SelectPageParams } from '@ledvance/ui-biz-bundle/src/modules/select/SelectPage';
|
|
36
|
+
import I18n from '@ledvance/base/src/i18n';
|
|
37
|
+
import Segmented from '@ledvance/base/src/components/Segmented';
|
|
38
|
+
import { MoodNodeInfo } from './Interface';
|
|
39
|
+
import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
|
|
40
|
+
import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
|
|
41
|
+
import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
|
|
42
|
+
import { showDialog } from '@ledvance/base/src/utils/common';
|
|
43
|
+
|
|
44
|
+
const cx = Utils.RatioUtils.convertX;
|
|
45
|
+
interface MixDynamicMoodEditorPageState extends StaticMoodEditorPageState {
|
|
46
|
+
mainBucketSelected: boolean;
|
|
47
|
+
secondaryBucketSelected: boolean;
|
|
48
|
+
mainNodeIdx: number;
|
|
49
|
+
secondaryIdx: number;
|
|
50
|
+
sceneMode: StripLightMoodMode;
|
|
51
|
+
mainSceneMode: any
|
|
52
|
+
}
|
|
53
|
+
const MixDynamicMoodEditorPage = () => {
|
|
54
|
+
const navigation = useNavigation();
|
|
55
|
+
const routeParams = useRoute().params as StaticMoodEditorPageParams;
|
|
56
|
+
const params = cloneDeep(routeParams);
|
|
57
|
+
const moduleParams = params.moduleParams;
|
|
58
|
+
const state = useReactive<MixDynamicMoodEditorPageState>({
|
|
59
|
+
headline: '',
|
|
60
|
+
mood: params.currentMood,
|
|
61
|
+
mainNode: params.currentMood.mainLamp.nodes[params.currentMood.mainLamp.nodes.length - 1],
|
|
62
|
+
secondaryNode:
|
|
63
|
+
params.currentMood.secondaryLamp.nodes[params.currentMood.secondaryLamp.nodes.length - 1],
|
|
64
|
+
mainNodeIdx: params.currentMood.mainLamp.nodes.length - 1,
|
|
65
|
+
secondaryIdx: params.currentMood.secondaryLamp.nodes.length - 1,
|
|
66
|
+
mainBucketSelected: false,
|
|
67
|
+
secondaryBucketSelected: false,
|
|
68
|
+
loading: false,
|
|
69
|
+
sceneMode: moduleParams.isCeilingLight ? stripLightMoodMode : lightMoodMode,
|
|
70
|
+
mainSceneMode: moduleParams.isCeilingLight ? CeilingLightSceneMode : lightMoodMode
|
|
71
|
+
});
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
state.headline = Strings.getLang(
|
|
74
|
+
params.mode === 'add'
|
|
75
|
+
? 'add_new_dynamic_mood_headline_text'
|
|
76
|
+
: 'edit_static_mood_headline_text'
|
|
77
|
+
);
|
|
78
|
+
}, [params.mode]);
|
|
79
|
+
|
|
80
|
+
const getColorBlockColor = useCallback((node: MoodNodeInfo) => {
|
|
81
|
+
const s = Math.round(mapFloatToRange(node.s / 100, 30, 100));
|
|
82
|
+
if (node.isColorNode) {
|
|
83
|
+
return hsv2Hex(node.h, s, 100);
|
|
84
|
+
} else {
|
|
85
|
+
return cctToColor(node.colorTemp.toFixed());
|
|
86
|
+
}
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
89
|
+
const getNodeColor = useCallback((node: MoodNodeInfo) => {
|
|
90
|
+
if (node.isColorNode) {
|
|
91
|
+
const s = Math.round(mapFloatToRange(node.s / 100, 30, 100));
|
|
92
|
+
return hsv2Hex(node.h, s, 100);
|
|
93
|
+
}
|
|
94
|
+
return cctToColor(node.colorTemp.toFixed());
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
const createSelectModeData = useCallback(
|
|
98
|
+
(mode: number, moodMode: StripLightMoodMode) => {
|
|
99
|
+
return Object.values(moodMode).map(scene => {
|
|
100
|
+
return {
|
|
101
|
+
text: scene.title,
|
|
102
|
+
selected: scene.mode === mode,
|
|
103
|
+
value: scene.mode,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
[]
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const createSelectOtherData = useCallback((otherData, expand) => {
|
|
111
|
+
return otherData.map(other => {
|
|
112
|
+
return {
|
|
113
|
+
text: other.label,
|
|
114
|
+
selected: other.value === expand,
|
|
115
|
+
value: other.value,
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
const getSelectOther = useCallback((otherData, expand) => {
|
|
121
|
+
const currentOther = otherData.find(other => other.value === expand);
|
|
122
|
+
return currentOther.label;
|
|
123
|
+
}, []);
|
|
124
|
+
|
|
125
|
+
const nameRepeat = useMemo(() => {
|
|
126
|
+
return params.nameRepeat(state.mood)
|
|
127
|
+
}, [state.mood.name]);
|
|
128
|
+
|
|
129
|
+
const checkMoodChanged = useMemo(() =>{
|
|
130
|
+
return isEqual(state.mood, params.currentMood)
|
|
131
|
+
}, [JSON.stringify(state.mood), params.currentMood])
|
|
132
|
+
|
|
133
|
+
const canSaveMoodData = useMemo(() =>{
|
|
134
|
+
return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodChanged)
|
|
135
|
+
}, [nameRepeat, state.mood.name, checkMoodChanged, params.mode])
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<Page
|
|
139
|
+
backText={Strings.getLang('mesh_device_detail_mode')}
|
|
140
|
+
showBackDialog={!checkMoodChanged}
|
|
141
|
+
backDialogTitle={Strings.getLang(
|
|
142
|
+
params.mode === 'add'
|
|
143
|
+
? 'string_light_pp_dialog_sm_add_headline_c'
|
|
144
|
+
: 'manage_user_unsaved_changes_dialog_headline'
|
|
145
|
+
)}
|
|
146
|
+
backDialogContent={Strings.getLang(
|
|
147
|
+
params.mode === 'add'
|
|
148
|
+
? 'strip_light_static_mood_add_step_2_dialog_text'
|
|
149
|
+
: 'strip_light_static_mood_editor_step_2_dialog_text'
|
|
150
|
+
)}
|
|
151
|
+
headlineText={state.headline}
|
|
152
|
+
rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
|
|
153
|
+
rightButtonIconClick={async () => {
|
|
154
|
+
if (state.loading || !canSaveMoodData) return;
|
|
155
|
+
state.loading = true;
|
|
156
|
+
const newMood = cloneDeep(state.mood)
|
|
157
|
+
if(moduleParams.isMixLight){
|
|
158
|
+
if(moduleParams.isSupportBrightness){
|
|
159
|
+
newMood.mainLamp.type = 1
|
|
160
|
+
}
|
|
161
|
+
if(moduleParams.isSupportBrightness && moduleParams.isSupportTemperature){
|
|
162
|
+
newMood.mainLamp.type = 2
|
|
163
|
+
}
|
|
164
|
+
if(moduleParams.isSupportColor){
|
|
165
|
+
newMood.secondaryLamp.type = 3
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const res = await params.modDeleteMood(params.mode, newMood);
|
|
169
|
+
if (res.success) {
|
|
170
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_mood);
|
|
171
|
+
}
|
|
172
|
+
state.loading = false;
|
|
173
|
+
}}
|
|
174
|
+
loading={state.loading}
|
|
175
|
+
>
|
|
176
|
+
<ScrollView style={{ flex: 1 }} nestedScrollEnabled={true}>
|
|
177
|
+
<View style={styles.root}>
|
|
178
|
+
<TextField
|
|
179
|
+
style={styles.name}
|
|
180
|
+
value={state.mood.name}
|
|
181
|
+
placeholder={Strings.getLang('edit_static_mood_inputfield_topic_text')}
|
|
182
|
+
onChangeText={text => {
|
|
183
|
+
state.mood.name = text;
|
|
184
|
+
}}
|
|
185
|
+
maxLength={33}
|
|
186
|
+
showError={state.mood.name.length > 32 || nameRepeat}
|
|
187
|
+
tipColor={nameRepeat ? '#f00' : undefined}
|
|
188
|
+
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
189
|
+
errorText={Strings.getLang(
|
|
190
|
+
nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
|
|
191
|
+
)}
|
|
192
|
+
/>
|
|
193
|
+
<Card style={styles.adjustCard}>
|
|
194
|
+
<LdvSwitch
|
|
195
|
+
title={I18n.getLang('light_sources_tile_main_lighting_headline')}
|
|
196
|
+
color="#fff"
|
|
197
|
+
colorAlpha={1}
|
|
198
|
+
enable={!!state.mood.mainLamp.enable}
|
|
199
|
+
setEnable={v => {
|
|
200
|
+
if (v && !state.mood.mainLamp.nodes.length) {
|
|
201
|
+
state.mood.mainLamp.nodes.push(
|
|
202
|
+
{
|
|
203
|
+
h: 0,
|
|
204
|
+
s: 0,
|
|
205
|
+
v: 0,
|
|
206
|
+
brightness: 100,
|
|
207
|
+
colorTemp: 0,
|
|
208
|
+
isColorNode: false,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
h: 0,
|
|
212
|
+
s: 0,
|
|
213
|
+
v: 0,
|
|
214
|
+
brightness: 100,
|
|
215
|
+
colorTemp: 0,
|
|
216
|
+
isColorNode: false,
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
state.mood.mainLamp.mode = MoodNodeTransitionMode.Gradient;
|
|
220
|
+
state.mood.mainLamp.speed = 75;
|
|
221
|
+
state.mainNodeIdx = 1;
|
|
222
|
+
state.mainNode = state.mood.mainLamp.nodes[1];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
state.mood.mainLamp.enable = v;
|
|
226
|
+
}}
|
|
227
|
+
showSwitch={!!moduleParams.isMixLight}
|
|
228
|
+
/>
|
|
229
|
+
{state.mood.mainLamp.enable && (
|
|
230
|
+
<>
|
|
231
|
+
<TextFieldStyleButton
|
|
232
|
+
style={styles.transitionMode}
|
|
233
|
+
text={state.mainSceneMode[state.mood.mainLamp.mode]?.title}
|
|
234
|
+
placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
|
|
235
|
+
onPress={() => {
|
|
236
|
+
const paramsSelect: SelectPageParams<number> = {
|
|
237
|
+
title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
|
|
238
|
+
data: createSelectModeData(state.mood.mainLamp.mode, state.mainSceneMode),
|
|
239
|
+
onSelect: selectPageData => {
|
|
240
|
+
state.mood.mainLamp.mode = selectPageData.value;
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
<Spacer height={cx(10)} />
|
|
247
|
+
<LdvSlider
|
|
248
|
+
title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
|
|
249
|
+
value={state.mood.mainLamp.speed}
|
|
250
|
+
onValueChange={() => {}}
|
|
251
|
+
onSlidingComplete={value => {
|
|
252
|
+
state.mood.mainLamp.speed = value;
|
|
253
|
+
}}
|
|
254
|
+
/>
|
|
255
|
+
<Spacer height={cx(16)} />
|
|
256
|
+
<View style={styles.nodesAdjust}>
|
|
257
|
+
<View style={styles.adjustButtons}>
|
|
258
|
+
<TouchableOpacity
|
|
259
|
+
onPress={() => {
|
|
260
|
+
state.mainBucketSelected = true;
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
<Image
|
|
264
|
+
style={[
|
|
265
|
+
styles.adjustButton,
|
|
266
|
+
{ tintColor: state.mainBucketSelected ? '#f60' : '#666' },
|
|
267
|
+
]}
|
|
268
|
+
source={res.ic_paint_bucket}
|
|
269
|
+
/>
|
|
270
|
+
</TouchableOpacity>
|
|
271
|
+
<TouchableOpacity
|
|
272
|
+
onPress={() => {
|
|
273
|
+
state.mainBucketSelected = false;
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
<Image
|
|
277
|
+
style={[
|
|
278
|
+
styles.adjustButton,
|
|
279
|
+
{ tintColor: state.mainBucketSelected ? '#666' : '#f60' },
|
|
280
|
+
]}
|
|
281
|
+
source={res.ic_colorize}
|
|
282
|
+
/>
|
|
283
|
+
</TouchableOpacity>
|
|
284
|
+
</View>
|
|
285
|
+
<FlatList
|
|
286
|
+
data={state.mood.mainLamp.nodes}
|
|
287
|
+
style={styles.nodeList}
|
|
288
|
+
renderItem={({ item, index }) => {
|
|
289
|
+
return (
|
|
290
|
+
<View style={styles.nodeItem}>
|
|
291
|
+
<TouchableOpacity
|
|
292
|
+
style={[
|
|
293
|
+
styles.nodeBlock,
|
|
294
|
+
{
|
|
295
|
+
backgroundColor: getNodeColor(item),
|
|
296
|
+
},
|
|
297
|
+
]}
|
|
298
|
+
onPress={() => {
|
|
299
|
+
state.mainNodeIdx = index;
|
|
300
|
+
state.mainNode = state.mood.mainLamp.nodes[index];
|
|
301
|
+
}}
|
|
302
|
+
/>
|
|
303
|
+
<TouchableOpacity
|
|
304
|
+
style={styles.nodeDeleteBtn}
|
|
305
|
+
disabled={state.mood.mainLamp.nodes.length < 3}
|
|
306
|
+
onPress={() => {
|
|
307
|
+
state.mood.mainLamp.nodes.splice(index, 1);
|
|
308
|
+
state.mainNodeIdx = state.mood.mainLamp.nodes.length - 1;
|
|
309
|
+
}}
|
|
310
|
+
>
|
|
311
|
+
<Image
|
|
312
|
+
style={[
|
|
313
|
+
styles.nodeDeleteIcon,
|
|
314
|
+
{
|
|
315
|
+
tintColor: state.mood.mainLamp.nodes.length < 3 ? '#ccc' : '#666',
|
|
316
|
+
},
|
|
317
|
+
]}
|
|
318
|
+
source={res.ic_mood_del}
|
|
319
|
+
/>
|
|
320
|
+
</TouchableOpacity>
|
|
321
|
+
</View>
|
|
322
|
+
);
|
|
323
|
+
}}
|
|
324
|
+
keyExtractor={(_, index) => `${index}`}
|
|
325
|
+
ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
|
|
326
|
+
ListFooterComponent={() => {
|
|
327
|
+
if (state.mood.mainLamp.nodes.length >= 8) {
|
|
328
|
+
return <></>;
|
|
329
|
+
}
|
|
330
|
+
return (
|
|
331
|
+
<View>
|
|
332
|
+
<Spacer height={cx(12)} />
|
|
333
|
+
<TouchableOpacity
|
|
334
|
+
style={styles.nodeAddBtn}
|
|
335
|
+
onPress={() => {
|
|
336
|
+
const node = {
|
|
337
|
+
...state.mood.mainLamp.nodes[state.mainNodeIdx],
|
|
338
|
+
};
|
|
339
|
+
state.mood.mainLamp.nodes.push(node);
|
|
340
|
+
state.mainNodeIdx = state.mood.mainLamp.nodes.length - 1;
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
<Image
|
|
344
|
+
style={{
|
|
345
|
+
width: cx(18),
|
|
346
|
+
height: cx(18),
|
|
347
|
+
tintColor: '#000',
|
|
348
|
+
}}
|
|
349
|
+
source={{ uri: res.add }}
|
|
350
|
+
/>
|
|
351
|
+
</TouchableOpacity>
|
|
352
|
+
</View>
|
|
353
|
+
);
|
|
354
|
+
}}
|
|
355
|
+
/>
|
|
356
|
+
</View>
|
|
357
|
+
<Spacer />
|
|
358
|
+
<ColorTempAdjustView
|
|
359
|
+
isSupportBrightness={moduleParams.isSupportBrightness}
|
|
360
|
+
isSupportTemperature={moduleParams.isSupportTemperature}
|
|
361
|
+
colorTemp={state.mood.mainLamp.nodes[state.mainNodeIdx].colorTemp}
|
|
362
|
+
brightness={state.mood.mainLamp.nodes[state.mainNodeIdx].brightness}
|
|
363
|
+
onBrightnessChangeComplete={bright => {
|
|
364
|
+
state.mood.mainLamp.nodes.forEach((node, idx) => {
|
|
365
|
+
if (state.mainBucketSelected) {
|
|
366
|
+
node.brightness = bright;
|
|
367
|
+
}
|
|
368
|
+
if (state.mainNodeIdx === idx) {
|
|
369
|
+
node.brightness = bright;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}}
|
|
373
|
+
onCCTChangeComplete={cct => {
|
|
374
|
+
state.mood.mainLamp.nodes.forEach((node, idx) => {
|
|
375
|
+
if (state.mainBucketSelected) {
|
|
376
|
+
node.colorTemp = cct;
|
|
377
|
+
}
|
|
378
|
+
if (state.mainNodeIdx === idx) {
|
|
379
|
+
node.colorTemp = cct;
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}}
|
|
383
|
+
/>
|
|
384
|
+
<Spacer height={cx(10)} />
|
|
385
|
+
</>
|
|
386
|
+
)}
|
|
387
|
+
</Card>
|
|
388
|
+
<Card style={styles.adjustCard}>
|
|
389
|
+
<LdvSwitch
|
|
390
|
+
title={I18n.getLang('light_sources_tile_sec_lighting_headline')}
|
|
391
|
+
color={'#fff'}
|
|
392
|
+
colorAlpha={1}
|
|
393
|
+
enable={!!state.mood.secondaryLamp.enable}
|
|
394
|
+
setEnable={v => {
|
|
395
|
+
state.mood.secondaryLamp.enable = v;
|
|
396
|
+
if (v && !state.mood.secondaryLamp.nodes.length) {
|
|
397
|
+
state.mood.secondaryLamp.nodes.push(
|
|
398
|
+
{
|
|
399
|
+
h: 0,
|
|
400
|
+
s: 100,
|
|
401
|
+
v: 100,
|
|
402
|
+
brightness: 0,
|
|
403
|
+
colorTemp: 0,
|
|
404
|
+
isColorNode: true,
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
h: 0,
|
|
408
|
+
s: 100,
|
|
409
|
+
v: 100,
|
|
410
|
+
brightness: 0,
|
|
411
|
+
colorTemp: 0,
|
|
412
|
+
isColorNode: true,
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
state.mood.secondaryLamp.mode = MoodNodeTransitionMode.Gradient;
|
|
416
|
+
state.mood.secondaryLamp.speed = 75;
|
|
417
|
+
state.secondaryIdx = 1;
|
|
418
|
+
state.secondaryNode = state.mood.secondaryLamp.nodes[1];
|
|
419
|
+
}
|
|
420
|
+
}}
|
|
421
|
+
showSwitch={!!moduleParams.isMixLight}
|
|
422
|
+
/>
|
|
423
|
+
{state.mood.secondaryLamp.enable && (
|
|
424
|
+
<>
|
|
425
|
+
<TextFieldStyleButton
|
|
426
|
+
style={styles.transitionMode}
|
|
427
|
+
text={state.sceneMode[state.mood.secondaryLamp.mode]?.title}
|
|
428
|
+
placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
|
|
429
|
+
onPress={() => {
|
|
430
|
+
const paramsSelect: SelectPageParams<number> = {
|
|
431
|
+
title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
|
|
432
|
+
data: createSelectModeData(
|
|
433
|
+
state.mood.secondaryLamp.mode,
|
|
434
|
+
state.sceneMode
|
|
435
|
+
),
|
|
436
|
+
onSelect: selectPageData => {
|
|
437
|
+
state.mood.secondaryLamp.mode = selectPageData.value;
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
|
|
441
|
+
}}
|
|
442
|
+
/>
|
|
443
|
+
<Spacer height={cx(10)} />
|
|
444
|
+
<LdvSlider
|
|
445
|
+
title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
|
|
446
|
+
value={state.mood.secondaryLamp.speed}
|
|
447
|
+
onValueChange={() => {}}
|
|
448
|
+
onSlidingComplete={value => {
|
|
449
|
+
state.mood.secondaryLamp.speed = value;
|
|
450
|
+
}}
|
|
451
|
+
/>
|
|
452
|
+
<Spacer height={cx(16)} />
|
|
453
|
+
{state.sceneMode[state.mood.secondaryLamp.mode]?.turnOn && (
|
|
454
|
+
<View style={styles.transitionMode}>
|
|
455
|
+
<Segmented
|
|
456
|
+
value={state.mood.secondaryLamp.direction}
|
|
457
|
+
options={[
|
|
458
|
+
{
|
|
459
|
+
label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text1'),
|
|
460
|
+
value: 0,
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text2'),
|
|
464
|
+
value: 1,
|
|
465
|
+
},
|
|
466
|
+
]}
|
|
467
|
+
onChange={v => (state.mood.secondaryLamp.direction = Number(v))}
|
|
468
|
+
/>
|
|
469
|
+
<Spacer />
|
|
470
|
+
</View>
|
|
471
|
+
)}
|
|
472
|
+
{state.sceneMode[state.mood.secondaryLamp.mode]?.paragraph && (
|
|
473
|
+
<View style={styles.transitionMode}>
|
|
474
|
+
<Segmented
|
|
475
|
+
value={state.mood.secondaryLamp.segmented}
|
|
476
|
+
options={[
|
|
477
|
+
{
|
|
478
|
+
label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text3'),
|
|
479
|
+
value: 0,
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text4'),
|
|
483
|
+
value: 1,
|
|
484
|
+
},
|
|
485
|
+
]}
|
|
486
|
+
onChange={v => (state.mood.secondaryLamp.segmented = Number(v))}
|
|
487
|
+
/>
|
|
488
|
+
<Spacer />
|
|
489
|
+
</View>
|
|
490
|
+
)}
|
|
491
|
+
{state.sceneMode[state.mood.secondaryLamp.mode]?.other && (
|
|
492
|
+
<>
|
|
493
|
+
<TextFieldStyleButton
|
|
494
|
+
style={styles.transitionMode}
|
|
495
|
+
text={getSelectOther(
|
|
496
|
+
state.sceneMode[state.mood.secondaryLamp.mode]?.other,
|
|
497
|
+
state.mood.secondaryLamp.expand
|
|
498
|
+
)}
|
|
499
|
+
placeholder={I18n.getLang(
|
|
500
|
+
'add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'
|
|
501
|
+
)}
|
|
502
|
+
onPress={() => {
|
|
503
|
+
const paramsSelect: SelectPageParams<number> = {
|
|
504
|
+
title: I18n.getLang(
|
|
505
|
+
'add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'
|
|
506
|
+
),
|
|
507
|
+
data: createSelectOtherData(
|
|
508
|
+
state.sceneMode[state.mood.secondaryLamp.mode]?.other,
|
|
509
|
+
state.mood.secondaryLamp.expand
|
|
510
|
+
),
|
|
511
|
+
onSelect: selectPageData => {
|
|
512
|
+
state.mood.secondaryLamp.expand = selectPageData.value;
|
|
513
|
+
},
|
|
514
|
+
};
|
|
515
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect);
|
|
516
|
+
}}
|
|
517
|
+
/>
|
|
518
|
+
<Spacer />
|
|
519
|
+
</>
|
|
520
|
+
)}
|
|
521
|
+
<View style={styles.nodesAdjust}>
|
|
522
|
+
<View style={styles.adjustButtons}>
|
|
523
|
+
<TouchableOpacity
|
|
524
|
+
onPress={() => {
|
|
525
|
+
state.secondaryBucketSelected = true;
|
|
526
|
+
}}
|
|
527
|
+
>
|
|
528
|
+
<Image
|
|
529
|
+
style={[
|
|
530
|
+
styles.adjustButton,
|
|
531
|
+
{ tintColor: state.secondaryBucketSelected ? '#f60' : '#666' },
|
|
532
|
+
]}
|
|
533
|
+
source={res.ic_paint_bucket}
|
|
534
|
+
/>
|
|
535
|
+
</TouchableOpacity>
|
|
536
|
+
<TouchableOpacity
|
|
537
|
+
onPress={() => {
|
|
538
|
+
state.secondaryBucketSelected = false;
|
|
539
|
+
}}
|
|
540
|
+
>
|
|
541
|
+
<Image
|
|
542
|
+
style={[
|
|
543
|
+
styles.adjustButton,
|
|
544
|
+
{ tintColor: state.secondaryBucketSelected ? '#666' : '#f60' },
|
|
545
|
+
]}
|
|
546
|
+
source={res.ic_colorize}
|
|
547
|
+
/>
|
|
548
|
+
</TouchableOpacity>
|
|
549
|
+
</View>
|
|
550
|
+
<FlatList
|
|
551
|
+
data={state.mood.secondaryLamp.nodes}
|
|
552
|
+
style={styles.nodeList}
|
|
553
|
+
renderItem={({ item, index }) => {
|
|
554
|
+
return (
|
|
555
|
+
<View style={styles.nodeItem}>
|
|
556
|
+
<TouchableOpacity
|
|
557
|
+
style={[
|
|
558
|
+
styles.nodeBlock,
|
|
559
|
+
{
|
|
560
|
+
backgroundColor: getNodeColor(item),
|
|
561
|
+
},
|
|
562
|
+
]}
|
|
563
|
+
onPress={() => {
|
|
564
|
+
state.secondaryIdx = index;
|
|
565
|
+
}}
|
|
566
|
+
/>
|
|
567
|
+
<TouchableOpacity
|
|
568
|
+
style={styles.nodeDeleteBtn}
|
|
569
|
+
disabled={state.mood.secondaryLamp.nodes.length < 3}
|
|
570
|
+
onPress={() => {
|
|
571
|
+
state.mood.secondaryLamp.nodes.splice(index, 1);
|
|
572
|
+
state.secondaryIdx = state.mood.secondaryLamp.nodes.length - 1;
|
|
573
|
+
}}
|
|
574
|
+
>
|
|
575
|
+
<Image
|
|
576
|
+
style={[
|
|
577
|
+
styles.nodeDeleteIcon,
|
|
578
|
+
{
|
|
579
|
+
tintColor:
|
|
580
|
+
state.mood.secondaryLamp.nodes.length < 3 ? '#ccc' : '#666',
|
|
581
|
+
},
|
|
582
|
+
]}
|
|
583
|
+
source={res.ic_mood_del}
|
|
584
|
+
/>
|
|
585
|
+
</TouchableOpacity>
|
|
586
|
+
</View>
|
|
587
|
+
);
|
|
588
|
+
}}
|
|
589
|
+
keyExtractor={(_, index) => `${index}`}
|
|
590
|
+
ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
|
|
591
|
+
ListFooterComponent={() => {
|
|
592
|
+
if (state.mood.secondaryLamp.nodes.length >= 8) {
|
|
593
|
+
return <></>;
|
|
594
|
+
}
|
|
595
|
+
return (
|
|
596
|
+
<View>
|
|
597
|
+
<Spacer height={cx(12)} />
|
|
598
|
+
<TouchableOpacity
|
|
599
|
+
style={styles.nodeAddBtn}
|
|
600
|
+
onPress={() => {
|
|
601
|
+
const node = {
|
|
602
|
+
...state.mood.secondaryLamp.nodes[state.secondaryIdx],
|
|
603
|
+
};
|
|
604
|
+
state.mood.secondaryLamp.nodes.push(node);
|
|
605
|
+
state.secondaryIdx = state.mood.secondaryLamp.nodes.length - 1;
|
|
606
|
+
}}
|
|
607
|
+
>
|
|
608
|
+
<Image
|
|
609
|
+
style={{
|
|
610
|
+
width: cx(18),
|
|
611
|
+
height: cx(18),
|
|
612
|
+
tintColor: '#000',
|
|
613
|
+
}}
|
|
614
|
+
source={{ uri: res.add }}
|
|
615
|
+
/>
|
|
616
|
+
</TouchableOpacity>
|
|
617
|
+
</View>
|
|
618
|
+
);
|
|
619
|
+
}}
|
|
620
|
+
/>
|
|
621
|
+
</View>
|
|
622
|
+
<Spacer />
|
|
623
|
+
<View style={styles.lightLine}>
|
|
624
|
+
<Text style={styles.light}>
|
|
625
|
+
{I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
|
|
626
|
+
</Text>
|
|
627
|
+
<View
|
|
628
|
+
style={[
|
|
629
|
+
styles.preview,
|
|
630
|
+
{ backgroundColor: getColorBlockColor(state.secondaryNode) },
|
|
631
|
+
]}
|
|
632
|
+
/>
|
|
633
|
+
</View>
|
|
634
|
+
<Spacer />
|
|
635
|
+
<ColorAdjustView
|
|
636
|
+
h={state.secondaryNode.h}
|
|
637
|
+
s={state.secondaryNode.s}
|
|
638
|
+
v={state.secondaryNode.v}
|
|
639
|
+
reserveSV={true}
|
|
640
|
+
onHSVChange={() => {}}
|
|
641
|
+
onHSVChangeComplete={(h, s, v) => {
|
|
642
|
+
state.mood.secondaryLamp.nodes.forEach((node, idx) => {
|
|
643
|
+
if (state.secondaryBucketSelected) {
|
|
644
|
+
node.h = h;
|
|
645
|
+
node.s = s;
|
|
646
|
+
node.v = v;
|
|
647
|
+
}
|
|
648
|
+
if (state.secondaryIdx === idx) {
|
|
649
|
+
node.h = h;
|
|
650
|
+
node.s = s;
|
|
651
|
+
node.v = v;
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
}}
|
|
655
|
+
/>
|
|
656
|
+
<Spacer height={cx(10)} />
|
|
657
|
+
</>
|
|
658
|
+
)}
|
|
659
|
+
</Card>
|
|
660
|
+
|
|
661
|
+
{params.mode === 'edit' && (
|
|
662
|
+
<View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
|
|
663
|
+
<TextButton
|
|
664
|
+
style={styles.deleteBtn}
|
|
665
|
+
textStyle={styles.deleteBtnText}
|
|
666
|
+
text={Strings.getLang('edit_static_mood_button_delete_text')}
|
|
667
|
+
onPress={() => {
|
|
668
|
+
showDialog({
|
|
669
|
+
method: 'confirm',
|
|
670
|
+
title: I18n.getLang('string_light_pp_dialog_sm_ed_headline_d'),
|
|
671
|
+
subTitle: I18n.getLang(`strip_light_static_mood_edit_dialog_text`),
|
|
672
|
+
onConfirm: async (_, {close})=>{
|
|
673
|
+
close();
|
|
674
|
+
state.loading = true;
|
|
675
|
+
const res = await params.modDeleteMood('del', state.mood);
|
|
676
|
+
state.loading = false;
|
|
677
|
+
if (res.success) {
|
|
678
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_mood);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
})
|
|
682
|
+
}}
|
|
683
|
+
/>
|
|
684
|
+
</View>
|
|
685
|
+
)}
|
|
686
|
+
<Spacer />
|
|
687
|
+
</View>
|
|
688
|
+
</ScrollView>
|
|
689
|
+
</Page>
|
|
690
|
+
);
|
|
691
|
+
};
|
|
692
|
+
const styles = StyleSheet.create({
|
|
693
|
+
root: {
|
|
694
|
+
flex: 1,
|
|
695
|
+
flexDirection: 'column',
|
|
696
|
+
},
|
|
697
|
+
name: {
|
|
698
|
+
marginHorizontal: cx(24),
|
|
699
|
+
},
|
|
700
|
+
adjustCard: {
|
|
701
|
+
marginVertical: cx(12),
|
|
702
|
+
marginHorizontal: cx(24),
|
|
703
|
+
},
|
|
704
|
+
fanAdjustCard: {
|
|
705
|
+
marginHorizontal: cx(24),
|
|
706
|
+
},
|
|
707
|
+
lightLine: {
|
|
708
|
+
flexDirection: 'row',
|
|
709
|
+
marginHorizontal: cx(16),
|
|
710
|
+
},
|
|
711
|
+
light: {
|
|
712
|
+
color: '#000',
|
|
713
|
+
fontSize: cx(18),
|
|
714
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
715
|
+
},
|
|
716
|
+
transitionMode: {
|
|
717
|
+
marginHorizontal: cx(16),
|
|
718
|
+
},
|
|
719
|
+
preview: {
|
|
720
|
+
width: cx(20),
|
|
721
|
+
height: cx(20),
|
|
722
|
+
marginStart: cx(12),
|
|
723
|
+
borderRadius: cx(4),
|
|
724
|
+
},
|
|
725
|
+
nodesAdjust: {
|
|
726
|
+
flexDirection: 'row',
|
|
727
|
+
alignItems: 'center',
|
|
728
|
+
},
|
|
729
|
+
adjustButtons: {
|
|
730
|
+
width: cx(44),
|
|
731
|
+
marginStart: cx(16),
|
|
732
|
+
},
|
|
733
|
+
adjustButton: {
|
|
734
|
+
width: cx(44),
|
|
735
|
+
height: cx(44),
|
|
736
|
+
},
|
|
737
|
+
nodeList: {
|
|
738
|
+
flex: 1,
|
|
739
|
+
marginHorizontal: cx(16),
|
|
740
|
+
},
|
|
741
|
+
nodeItem: {
|
|
742
|
+
flexDirection: 'row',
|
|
743
|
+
alignItems: 'center',
|
|
744
|
+
},
|
|
745
|
+
nodeBlock: {
|
|
746
|
+
flex: 1,
|
|
747
|
+
height: cx(40),
|
|
748
|
+
borderRadius: cx(8),
|
|
749
|
+
},
|
|
750
|
+
nodeDeleteBtn: {
|
|
751
|
+
width: cx(24),
|
|
752
|
+
height: cx(30),
|
|
753
|
+
justifyContent: 'center',
|
|
754
|
+
alignItems: 'center',
|
|
755
|
+
},
|
|
756
|
+
nodeDeleteIcon: {
|
|
757
|
+
width: cx(16),
|
|
758
|
+
height: cx(16),
|
|
759
|
+
},
|
|
760
|
+
nodeAddBtn: {
|
|
761
|
+
height: cx(40),
|
|
762
|
+
justifyContent: 'center',
|
|
763
|
+
alignItems: 'center',
|
|
764
|
+
marginEnd: cx(26),
|
|
765
|
+
borderRadius: cx(8),
|
|
766
|
+
borderWidth: cx(1),
|
|
767
|
+
borderStyle: 'dashed',
|
|
768
|
+
borderColor: '#666',
|
|
769
|
+
backgroundColor: '#f6f6f6',
|
|
770
|
+
},
|
|
771
|
+
deleteBtn: {
|
|
772
|
+
width: '100%',
|
|
773
|
+
height: cx(50),
|
|
774
|
+
backgroundColor: '#666',
|
|
775
|
+
borderRadius: cx(8),
|
|
776
|
+
},
|
|
777
|
+
deleteBtnText: {
|
|
778
|
+
color: '#fff',
|
|
779
|
+
fontSize: cx(16),
|
|
780
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
781
|
+
},
|
|
782
|
+
});
|
|
783
|
+
export default MixDynamicMoodEditorPage;
|
|
784
|
+
export function getTransitionModeString(transitionMode: MoodNodeTransitionMode): string {
|
|
785
|
+
if (transitionMode === MoodNodeTransitionMode.Jump) {
|
|
786
|
+
return Strings.getLang('other_lights_modes_jump_text');
|
|
787
|
+
}
|
|
788
|
+
return Strings.getLang('other_lights_modes_gradient_text');
|
|
789
|
+
}
|