@ledvance/base 1.0.37 → 1.1.1
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/api/native.d.ts +3 -0
- package/src/components/DeleteButton.d.ts +9 -0
- package/src/components/Page.d.ts +3 -1
- package/src/components/ldvTopName.d.ts +2 -0
- package/src/composeLayout.tsx +73 -17
- package/src/i18n/strings.d.ts +56 -0
- package/src/i18n/strings.ts +98 -546
- package/src/models/TuyaApi.d.ts +12 -0
- package/src/models/modules/NativePropsSlice.d.ts +17 -5
- package/src/models/modules/NativePropsSlice.tsx +59 -25
- package/src/models/modules/common.d.ts +21 -13
- package/src/utils/common.d.ts +2 -2
- package/src/components/FanAdjustView.tsx +0 -124
- package/src/components/Popup.tsx +0 -72
- package/src/components/Segmented.tsx +0 -76
- package/src/res/Propup.tsx +0 -72
- package/src/res/iconsMaterialOutlinedCommunicationInfo.png +0 -0
- package/src/res/iconsMaterialOutlinedCommunicationInfo@2x.png +0 -0
- package/src/res/iconsMaterialOutlinedCommunicationInfo@3x.png +0 -0
package/src/models/TuyaApi.d.ts
CHANGED
|
@@ -15,3 +15,15 @@ export interface DpReportSataData {
|
|
|
15
15
|
value: string;
|
|
16
16
|
}
|
|
17
17
|
export declare function getDpReportSataData(deviceId: string, dpIds: string[], offset: number, limit: number, sortType?: 'ASC' | 'DESC'): Promise<DpReportSataResData>;
|
|
18
|
+
export interface DpResultByMonthResData {
|
|
19
|
+
years: object;
|
|
20
|
+
thisDay: string;
|
|
21
|
+
sum: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function getDpResultByMonth(devId: string, dpId: string, type: "sum" | "minux" | "mac"): Promise<DpResultByMonthResData>;
|
|
24
|
+
export interface DpResultByDataWithSpecifiedResData {
|
|
25
|
+
result: object;
|
|
26
|
+
min: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function getDataWithSpecified(devId: string, dpId: string, startDay: string, endDay: string, type: "sum" | "minux" | "avg"): Promise<DpResultByDataWithSpecifiedResData>;
|
|
29
|
+
export declare function getDpResultByHour(devId: string, dpId: string, date: string, type: "sum" | "minux" | "avg"): Promise<DpResultByDataWithSpecifiedResData>;
|
|
@@ -2,11 +2,21 @@ import { Dispatch } from 'react';
|
|
|
2
2
|
import { Result } from './Result';
|
|
3
3
|
import { DevInfo, DpValue } from 'tuya-panel-kit';
|
|
4
4
|
export interface NativeProps {
|
|
5
|
+
familyName: string;
|
|
6
|
+
deviceInfo: DeviceInfo;
|
|
7
|
+
uaGroupInfo: UAGroupInfo;
|
|
8
|
+
timeSchedule?: symbol;
|
|
9
|
+
energieverbrauch?: object;
|
|
10
|
+
}
|
|
11
|
+
export interface DeviceInfo {
|
|
5
12
|
devId: string;
|
|
6
13
|
pId: string;
|
|
7
14
|
dps: any;
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
}
|
|
16
|
+
export interface UAGroupInfo {
|
|
17
|
+
tyGroupId: number;
|
|
18
|
+
pId: string;
|
|
19
|
+
dps: any;
|
|
10
20
|
}
|
|
11
21
|
declare function simpleSetDps<T>(dispatch: Dispatch<any>): (deviceId: string, dps: any) => Promise<Result<T>>;
|
|
12
22
|
declare function simpleSetDp<T>(dispatch: Dispatch<any>): (deviceId: string, dp: string, value: any) => Promise<Result<T>>;
|
|
@@ -19,7 +29,9 @@ interface DpState {
|
|
|
19
29
|
[dpCode: string]: DpValue;
|
|
20
30
|
}
|
|
21
31
|
declare const useDeviceInfo: () => DevInfo<DpState>;
|
|
22
|
-
declare const useTimeSchedule: () => [v:
|
|
32
|
+
declare const useTimeSchedule: () => [v: symbol | undefined, f: any];
|
|
33
|
+
declare const useEnergieverbrauch: () => (object | undefined)[];
|
|
34
|
+
export declare const useEngergyGeneration: () => boolean;
|
|
23
35
|
export declare const ldvModules: import("@reduxjs/toolkit").Reducer<NativeProps, import("@reduxjs/toolkit").AnyAction>;
|
|
24
|
-
export declare const setNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setDps: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setTimeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
25
|
-
export { simpleSetDps, simpleSetDp, useDeviceId, useDeviceInfo, useDp, useDps, useFamilyName, useTimeSchedule, };
|
|
36
|
+
export declare const setNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setGroupNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setDps: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setTimeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setEnergieverbrauch: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
37
|
+
export { simpleSetDps, simpleSetDp, useDeviceId, useDeviceInfo, useDp, useDps, useFamilyName, useTimeSchedule, useEnergieverbrauch, };
|
|
@@ -7,26 +7,44 @@ import {NativeApi} from '../../api/native'
|
|
|
7
7
|
import {useDispatch} from 'react-redux'
|
|
8
8
|
|
|
9
9
|
export interface NativeProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
timeSchedule: symbol;
|
|
10
|
+
familyName: string
|
|
11
|
+
deviceInfo: DeviceInfo
|
|
12
|
+
uaGroupInfo: UAGroupInfo
|
|
13
|
+
timeSchedule?: symbol
|
|
15
14
|
energieverbrauch?: object
|
|
16
15
|
}
|
|
17
16
|
|
|
17
|
+
export interface DeviceInfo {
|
|
18
|
+
devId: string
|
|
19
|
+
pId: string
|
|
20
|
+
dps: any
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface UAGroupInfo {
|
|
24
|
+
tyGroupId: number
|
|
25
|
+
pId: string
|
|
26
|
+
dps: any
|
|
27
|
+
}
|
|
28
|
+
|
|
18
29
|
const initialState: NativeProps = {
|
|
19
|
-
devId: '',
|
|
20
|
-
pId: '',
|
|
21
|
-
dps: {},
|
|
22
30
|
familyName: '',
|
|
31
|
+
deviceInfo: {
|
|
32
|
+
devId: '',
|
|
33
|
+
pId: '',
|
|
34
|
+
dps: {},
|
|
35
|
+
},
|
|
36
|
+
uaGroupInfo: {
|
|
37
|
+
tyGroupId: -1,
|
|
38
|
+
pId: '',
|
|
39
|
+
dps: {},
|
|
40
|
+
},
|
|
23
41
|
timeSchedule: Symbol(),
|
|
24
|
-
energieverbrauch: {}
|
|
42
|
+
energieverbrauch: {},
|
|
25
43
|
}
|
|
26
44
|
|
|
27
45
|
// energy generation
|
|
28
46
|
const productList = [
|
|
29
|
-
'rcqe1i17x0vrvws7'
|
|
47
|
+
'rcqe1i17x0vrvws7',
|
|
30
48
|
]
|
|
31
49
|
|
|
32
50
|
const nativePropsSlice = createSlice({
|
|
@@ -34,19 +52,29 @@ const nativePropsSlice = createSlice({
|
|
|
34
52
|
initialState: initialState,
|
|
35
53
|
reducers: {
|
|
36
54
|
setNativeProps: (state, action: PayloadAction<NativeProps>) => {
|
|
37
|
-
state.devId = action.payload.devId
|
|
55
|
+
state.deviceInfo.devId = action.payload.deviceInfo.devId
|
|
56
|
+
if (!!action.payload.familyName) {
|
|
57
|
+
state.familyName = action.payload.familyName
|
|
58
|
+
}
|
|
59
|
+
if (!!action.payload.deviceInfo.devId) {
|
|
60
|
+
state.deviceInfo.pId = action.payload.deviceInfo.pId
|
|
61
|
+
}
|
|
62
|
+
state.deviceInfo.dps = {...state.deviceInfo.dps, ...action.payload.deviceInfo.dps}
|
|
63
|
+
},
|
|
64
|
+
setGroupNativeProps: (state, action: PayloadAction<NativeProps>) => {
|
|
65
|
+
state.uaGroupInfo.tyGroupId = action.payload.uaGroupInfo.tyGroupId
|
|
38
66
|
if (!!action.payload.familyName) {
|
|
39
67
|
state.familyName = action.payload.familyName
|
|
40
68
|
}
|
|
41
|
-
if (!!action.payload.
|
|
42
|
-
state.pId = action.payload.pId
|
|
69
|
+
if (!!action.payload.uaGroupInfo.tyGroupId) {
|
|
70
|
+
state.uaGroupInfo.pId = action.payload.uaGroupInfo.pId
|
|
43
71
|
}
|
|
44
|
-
state.dps = {...state.dps, ...action.payload.dps}
|
|
72
|
+
state.uaGroupInfo.dps = {...state.uaGroupInfo.dps, ...action.payload.uaGroupInfo.dps}
|
|
45
73
|
},
|
|
46
74
|
setDps(state, action: PayloadAction<any>) {
|
|
47
75
|
const dpKeys = Object.keys(action.payload)
|
|
48
76
|
dpKeys.forEach(dp => {
|
|
49
|
-
state.dps[dp] = action.payload[dp]
|
|
77
|
+
state.deviceInfo.dps[dp] = action.payload[dp]
|
|
50
78
|
})
|
|
51
79
|
},
|
|
52
80
|
setTimeSchedule(state, action: PayloadAction<any>) {
|
|
@@ -98,7 +126,7 @@ function simpleSetDp<T>(dispatch: Dispatch<any>): (deviceId: string, dp: string,
|
|
|
98
126
|
}
|
|
99
127
|
|
|
100
128
|
const useDeviceId = () => {
|
|
101
|
-
return useSelector(store => store.ldvModules.devId)
|
|
129
|
+
return useSelector(store => store.ldvModules.deviceInfo.devId)
|
|
102
130
|
}
|
|
103
131
|
|
|
104
132
|
const useFamilyName: () => string = () => {
|
|
@@ -108,7 +136,7 @@ const useFamilyName: () => string = () => {
|
|
|
108
136
|
function useDp<T, R>(dp: string): [T, (value: T) => Promise<Result<R>>] {
|
|
109
137
|
const deviceId = useDeviceId()
|
|
110
138
|
const dispatch = useDispatch()
|
|
111
|
-
const dpValue = useSelector(store => store.ldvModules.dps[dp])
|
|
139
|
+
const dpValue = useSelector(store => store.ldvModules.deviceInfo.dps[dp])
|
|
112
140
|
const setDp = useCallback((dpValue: T) => {
|
|
113
141
|
return simpleSetDp<R>(dispatch)(deviceId, dp, dpValue)
|
|
114
142
|
}, [])
|
|
@@ -118,7 +146,7 @@ function useDp<T, R>(dp: string): [T, (value: T) => Promise<Result<R>>] {
|
|
|
118
146
|
function useDps<R>(): [any, (dps: any) => Promise<Result<R>>] {
|
|
119
147
|
const deviceId = useDeviceId()
|
|
120
148
|
const dispatch = useDispatch()
|
|
121
|
-
const dps = useSelector(store => store.ldvModules.dps)
|
|
149
|
+
const dps = useSelector(store => store.ldvModules.deviceInfo.dps)
|
|
122
150
|
const setDps = useCallback((dps: any) => {
|
|
123
151
|
return simpleSetDps<R>(dispatch)(deviceId, dps)
|
|
124
152
|
}, [])
|
|
@@ -135,10 +163,10 @@ const useDeviceInfo: () => DevInfo<DpState> = () => {
|
|
|
135
163
|
return useSelector(state => state.devInfo)
|
|
136
164
|
}
|
|
137
165
|
|
|
138
|
-
const useTimeSchedule = (): [v:
|
|
166
|
+
const useTimeSchedule = (): [v: symbol | undefined, f: any] => {
|
|
139
167
|
const dps = useSelector(store => store.ldvModules.timeSchedule)
|
|
140
168
|
const dispatch = useDispatch()
|
|
141
|
-
const setTimeScheduleFn = (value: Symbol) =>{
|
|
169
|
+
const setTimeScheduleFn = (value: Symbol) => {
|
|
142
170
|
dispatch(setTimeSchedule(value))
|
|
143
171
|
}
|
|
144
172
|
return [dps, setTimeScheduleFn]
|
|
@@ -147,20 +175,26 @@ const useTimeSchedule = (): [v:Symbol, f:any] => {
|
|
|
147
175
|
const useEnergieverbrauch = () => {
|
|
148
176
|
const dps = useSelector(store => store.ldvModules.energieverbrauch)
|
|
149
177
|
const dispatch = useDispatch()
|
|
150
|
-
const setEnergieverbrauchFn = (value) =>{
|
|
178
|
+
const setEnergieverbrauchFn = (value) => {
|
|
151
179
|
dispatch(setEnergieverbrauch(value))
|
|
152
180
|
}
|
|
153
181
|
return [dps, setEnergieverbrauchFn]
|
|
154
182
|
}
|
|
155
183
|
|
|
156
|
-
export const useEngergyGeneration = () =>{
|
|
157
|
-
const {
|
|
184
|
+
export const useEngergyGeneration = () => {
|
|
185
|
+
const {productId} = useDeviceInfo()
|
|
158
186
|
return productList.some(val => val === productId)
|
|
159
187
|
}
|
|
160
188
|
|
|
161
189
|
export const ldvModules = nativePropsSlice.reducer
|
|
162
190
|
|
|
163
|
-
export const {
|
|
191
|
+
export const {
|
|
192
|
+
setNativeProps,
|
|
193
|
+
setGroupNativeProps,
|
|
194
|
+
setDps,
|
|
195
|
+
setTimeSchedule,
|
|
196
|
+
setEnergieverbrauch,
|
|
197
|
+
} = nativePropsSlice.actions
|
|
164
198
|
|
|
165
199
|
export {
|
|
166
200
|
simpleSetDps,
|
|
@@ -171,5 +205,5 @@ export {
|
|
|
171
205
|
useDps,
|
|
172
206
|
useFamilyName,
|
|
173
207
|
useTimeSchedule,
|
|
174
|
-
useEnergieverbrauch
|
|
208
|
+
useEnergieverbrauch,
|
|
175
209
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { DpValue } from 'tuya-panel-kit';
|
|
1
|
+
import { DevInfo, DpValue } from 'tuya-panel-kit';
|
|
2
|
+
import { Observable } from 'rxjs/Observable';
|
|
3
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
4
|
import 'rxjs/add/observable/fromPromise';
|
|
3
5
|
import 'rxjs/add/observable/of';
|
|
4
6
|
import 'rxjs/add/observable/merge';
|
|
@@ -16,21 +18,27 @@ export interface Log {
|
|
|
16
18
|
time: string;
|
|
17
19
|
isSend: boolean;
|
|
18
20
|
}
|
|
21
|
+
declare type Logs = Array<Log>;
|
|
22
|
+
declare type UpdateDevInfoPayload = DevInfo;
|
|
23
|
+
declare type UpdateDpStatePayload = Partial<DpState> & {
|
|
24
|
+
[key: string]: DpValue;
|
|
25
|
+
};
|
|
19
26
|
export declare const actions: {
|
|
20
|
-
devInfoChange:
|
|
21
|
-
deviceChange:
|
|
22
|
-
responseUpdateDp:
|
|
23
|
-
updateDp:
|
|
24
|
-
consoleChange: any
|
|
25
|
-
clearConsole: any
|
|
27
|
+
devInfoChange: import("redux-actions").ActionFunction1<UpdateDevInfoPayload, import("redux-actions").Action<UpdateDevInfoPayload>>;
|
|
28
|
+
deviceChange: import("redux-actions").ActionFunction1<UpdateDevInfoPayload, import("redux-actions").Action<UpdateDevInfoPayload>>;
|
|
29
|
+
responseUpdateDp: import("redux-actions").ActionFunction1<UpdateDpStatePayload, import("redux-actions").Action<UpdateDpStatePayload>>;
|
|
30
|
+
updateDp: import("redux-actions").ActionFunction1<UpdateDpStatePayload, import("redux-actions").Action<UpdateDpStatePayload>>;
|
|
31
|
+
consoleChange: import("redux-actions").ActionFunctionAny<import("redux-actions").Action<any>>;
|
|
32
|
+
clearConsole: import("redux-actions").ActionFunctionAny<import("redux-actions").Action<any>>;
|
|
26
33
|
};
|
|
27
|
-
export type Actions = {
|
|
34
|
+
export declare type Actions = {
|
|
28
35
|
[K in keyof typeof actions]: ReturnType<typeof actions[K]>;
|
|
29
36
|
};
|
|
30
37
|
export declare const reducers: {
|
|
31
|
-
dpState:
|
|
32
|
-
devInfo:
|
|
33
|
-
logs:
|
|
34
|
-
ldvModules:
|
|
38
|
+
dpState: import("redux-actions").ReduxCompatibleReducer<DpState, UpdateDevInfoPayload | UpdateDpStatePayload>;
|
|
39
|
+
devInfo: import("redux-actions").ReduxCompatibleReducer<DevInfo<DpState>, DevInfo<DpState>>;
|
|
40
|
+
logs: import("redux-actions").ReduxCompatibleReducer<Logs, DevInfo<Record<string, import("tuya-panel-kit").DpType>> | UpdateDpStatePayload | undefined>;
|
|
41
|
+
ldvModules: import("@reduxjs/toolkit").Reducer<import("./NativePropsSlice").NativeProps, import("@reduxjs/toolkit").AnyAction>;
|
|
35
42
|
};
|
|
36
|
-
export declare const epics: ((action$: ActionsObservable<
|
|
43
|
+
export declare const epics: ((action$: ActionsObservable<Actions['updateDp']>) => Observable<import("redux-actions").Action<UpdateDpStatePayload>>)[];
|
|
44
|
+
export {};
|
package/src/utils/common.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function getWeek(weekString: any): number[];
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function spliceByStep(str: string, step: number): string[];
|
|
13
13
|
export declare function hex2Int(hex: string): number;
|
|
14
|
-
export declare const localeNumber: (v: number | string, fixed?: number) => string | number;
|
|
14
|
+
export declare const localeNumber: (v: number | string, fixed?: number | undefined) => string | number;
|
|
15
15
|
export declare const exportFile: (list: any) => void;
|
|
16
16
|
export declare const exportHistoryFile: (list: any) => void;
|
|
17
17
|
export declare const monthFormat: (v: number | string) => string;
|
|
@@ -30,5 +30,5 @@ interface DialogProps {
|
|
|
30
30
|
close: () => void;
|
|
31
31
|
}) => void;
|
|
32
32
|
}
|
|
33
|
-
export declare function showDialog(props: DialogProps):
|
|
33
|
+
export declare function showDialog(props: DialogProps): void;
|
|
34
34
|
export {};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Utils } from 'tuya-panel-kit'
|
|
3
|
-
import Card from './Card'
|
|
4
|
-
import {View, Text, ViewProps, Image, TouchableOpacity} from 'react-native'
|
|
5
|
-
import LdvSwitch from './ldvSwitch'
|
|
6
|
-
import I18n from '@i18n'
|
|
7
|
-
import LdvSlider from './ldvSlider'
|
|
8
|
-
import Spacer from './Spacer'
|
|
9
|
-
import res from '../res'
|
|
10
|
-
import Segmented from './Segmented'
|
|
11
|
-
import Popup from './Popup'
|
|
12
|
-
const { convertX: cx } = Utils.RatioUtils
|
|
13
|
-
|
|
14
|
-
interface FanAdjustViewProps extends ViewProps {
|
|
15
|
-
fanEnable: boolean
|
|
16
|
-
fanSpeed: number
|
|
17
|
-
maxFanSpeed?: number
|
|
18
|
-
isSupportDirection?: boolean
|
|
19
|
-
isSupportDisinfect?: boolean
|
|
20
|
-
isSupportMode?: boolean
|
|
21
|
-
directValue?: string
|
|
22
|
-
modeValue?: string
|
|
23
|
-
disinfect?: boolean
|
|
24
|
-
directOptions?:any[]
|
|
25
|
-
modeOptions?: any[]
|
|
26
|
-
directChange?: (direct:string) => void
|
|
27
|
-
modeChange?: (mode: string) => void
|
|
28
|
-
disinfectChange?: (disinfect: boolean) => void
|
|
29
|
-
onFanSwitch: (fanEnable: boolean) => void
|
|
30
|
-
onFanSpeedChange?: (fanSpeed: number) => void
|
|
31
|
-
onFanSpeedChangeComplete: (fanSpeed: number) => void
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const FanAdjustView = (props: FanAdjustViewProps) => {
|
|
35
|
-
return (
|
|
36
|
-
<Card
|
|
37
|
-
style={props.style}>
|
|
38
|
-
<LdvSwitch
|
|
39
|
-
title={I18n.getLang('add_new_dynamic_mood_ceiling_fan_field_headline')}
|
|
40
|
-
enable={props.fanEnable}
|
|
41
|
-
setEnable={props.onFanSwitch}
|
|
42
|
-
color={''}
|
|
43
|
-
colorAlpha={1}/>
|
|
44
|
-
{props.fanEnable && (
|
|
45
|
-
<View>
|
|
46
|
-
<LdvSlider
|
|
47
|
-
title={I18n.getLang('add_new_dynamic_mood_ceiling_fan_field_text')}
|
|
48
|
-
value={props.fanSpeed}
|
|
49
|
-
min={1}
|
|
50
|
-
max={props.maxFanSpeed}
|
|
51
|
-
onValueChange={props.onFanSpeedChange}
|
|
52
|
-
onSlidingComplete={props.onFanSpeedChangeComplete}
|
|
53
|
-
subTitleStr={props.fanSpeed + `/${props.maxFanSpeed}`}/>
|
|
54
|
-
<Spacer/>
|
|
55
|
-
</View>
|
|
56
|
-
)}
|
|
57
|
-
{props.isSupportDirection && <View style={{marginHorizontal: cx(16)}}>
|
|
58
|
-
<View style={{flexDirection: 'row', marginBottom: cx(2), alignItems: 'center'}}>
|
|
59
|
-
<Text style={{marginRight: cx(5)}}>{I18n.getLang('ceiling_fan_tile_uvc_fan_direction')}</Text>
|
|
60
|
-
<TouchableOpacity onPress={() => Popup({
|
|
61
|
-
title: I18n.getLang('ceiling_fan_direction_info_headline'),
|
|
62
|
-
confirmText: I18n.getLang('ceiling_fan_direction_info_button_label'),
|
|
63
|
-
content: <View>
|
|
64
|
-
<Text style={{fontWeight: 'bold', color: '#000'}}>{I18n.getLang('ceiling_fan_direction_info_description_text')}</Text>
|
|
65
|
-
<Spacer />
|
|
66
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_direction_info_option_1_headline')}</Text>
|
|
67
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_direction_info_option_1_text')}</Text>
|
|
68
|
-
<Spacer />
|
|
69
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_direction_info_option_2_headline')}</Text>
|
|
70
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_direction_info_option_2_text')}</Text>
|
|
71
|
-
</View>
|
|
72
|
-
})}>
|
|
73
|
-
<Image style={{width: cx(16), height: cx(16), tintColor: '#ff6600'}} source={{uri: res.ic_info}}/>
|
|
74
|
-
</TouchableOpacity>
|
|
75
|
-
</View>
|
|
76
|
-
<Segmented
|
|
77
|
-
options={props.directOptions}
|
|
78
|
-
value={props.directValue}
|
|
79
|
-
onChange={props.directChange}
|
|
80
|
-
/>
|
|
81
|
-
<Spacer />
|
|
82
|
-
</View>}
|
|
83
|
-
|
|
84
|
-
{props.isSupportMode && <View style={{marginHorizontal: cx(16)}}>
|
|
85
|
-
<View style={{flexDirection: 'row', marginBottom: cx(2), alignItems: 'center'}}>
|
|
86
|
-
<Text style={{marginRight: cx(5)}}>{I18n.getLang('ceiling_fan_tile_uvc_fan_direction')}</Text>
|
|
87
|
-
<TouchableOpacity onPress={() => Popup({
|
|
88
|
-
title: I18n.getLang('ceiling_fan_mode_info_headline'),
|
|
89
|
-
confirmText: I18n.getLang('ceiling_fan_direction_info_button_label'),
|
|
90
|
-
content: <View>
|
|
91
|
-
<Text style={{fontWeight: 'bold', color:'#000'}}>{I18n.getLang('ceiling_fan_mode_info_description_text')}</Text>
|
|
92
|
-
<Spacer />
|
|
93
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_mode_info_option_1_headline')}</Text>
|
|
94
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_mode_info_option_1_text')}</Text>
|
|
95
|
-
<Spacer />
|
|
96
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_mode_info_option_2_headline')}</Text>
|
|
97
|
-
<Text style={{color: '#000'}}>{I18n.getLang('ceiling_fan_mode_info_option_2_text')}</Text>
|
|
98
|
-
</View>
|
|
99
|
-
})}>
|
|
100
|
-
<Image style={{width: cx(16), height: cx(16), tintColor: '#ff6600'}} source={{uri: res.ic_info}}/>
|
|
101
|
-
</TouchableOpacity>
|
|
102
|
-
</View>
|
|
103
|
-
<Segmented
|
|
104
|
-
options={props.modeOptions}
|
|
105
|
-
value={props.modeValue}
|
|
106
|
-
onChange={props.modeChange}
|
|
107
|
-
/>
|
|
108
|
-
<Spacer />
|
|
109
|
-
</View>}
|
|
110
|
-
|
|
111
|
-
{props.isSupportDisinfect && <>
|
|
112
|
-
<LdvSwitch
|
|
113
|
-
enable={props.disinfect || false}
|
|
114
|
-
setEnable={props.disinfectChange}
|
|
115
|
-
color={''}
|
|
116
|
-
colorAlpha={1}
|
|
117
|
-
title={'1'}/>
|
|
118
|
-
<Spacer height={cx(16)}/>
|
|
119
|
-
</>}
|
|
120
|
-
</Card>
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export default FanAdjustView
|
package/src/components/Popup.tsx
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Text, TouchableOpacity } from 'react-native'
|
|
3
|
-
import { Utils, Popup } from 'tuya-panel-kit'
|
|
4
|
-
|
|
5
|
-
const { convertX: cx, height } = Utils.RatioUtils
|
|
6
|
-
|
|
7
|
-
interface InformationPopupProps{
|
|
8
|
-
title: string
|
|
9
|
-
confirmText: string
|
|
10
|
-
content: any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const InformationPopup = (props: InformationPopupProps) => {
|
|
14
|
-
console.log(props, '< --- props')
|
|
15
|
-
|
|
16
|
-
const titleNode = () => {
|
|
17
|
-
return (
|
|
18
|
-
<View style={{ flexDirection: 'row', height: cx(60), justifyContent:'space-between' }}>
|
|
19
|
-
<View style={{ flexDirection: 'column-reverse', flex: 1, alignItems: 'center',paddingLeft: cx(12) }}>
|
|
20
|
-
<Text style={{
|
|
21
|
-
fontSize: cx(16),
|
|
22
|
-
fontWeight: 'bold',
|
|
23
|
-
color: '#000000',
|
|
24
|
-
paddingBottom: cx(12),
|
|
25
|
-
|
|
26
|
-
}}>{props.title}</Text>
|
|
27
|
-
</View>
|
|
28
|
-
<TouchableOpacity
|
|
29
|
-
style={{
|
|
30
|
-
flexDirection: 'column-reverse',
|
|
31
|
-
alignItems:'center',
|
|
32
|
-
paddingBottom: cx(12),
|
|
33
|
-
paddingRight: cx(6)
|
|
34
|
-
}}
|
|
35
|
-
onPress={() => Popup.close()}
|
|
36
|
-
>
|
|
37
|
-
<Text
|
|
38
|
-
style={{
|
|
39
|
-
fontSize: cx(12),
|
|
40
|
-
color: '#FF6600',
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
{props.confirmText}
|
|
44
|
-
</Text>
|
|
45
|
-
</TouchableOpacity>
|
|
46
|
-
</View>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
Popup.custom({
|
|
51
|
-
content: <View style={{height: height - cx(60), padding: cx(24)}}>
|
|
52
|
-
{props.content}
|
|
53
|
-
</View>,
|
|
54
|
-
title: titleNode(),
|
|
55
|
-
footer: null,
|
|
56
|
-
confirmText: '',
|
|
57
|
-
cancelText: '',
|
|
58
|
-
onMaskPress: ({ close }) => {
|
|
59
|
-
close()
|
|
60
|
-
},
|
|
61
|
-
onConfirm: () => {
|
|
62
|
-
Popup.close()
|
|
63
|
-
},
|
|
64
|
-
footerWrapperStyle:{
|
|
65
|
-
display: 'none'
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default InformationPopup
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
import { View, Text, TouchableOpacity, StyleSheet, ViewStyle } from "react-native";
|
|
3
|
-
import { Utils } from 'tuya-panel-kit'
|
|
4
|
-
|
|
5
|
-
const { convertX: cx } = Utils.RatioUtils
|
|
6
|
-
|
|
7
|
-
interface SegmentedItem{
|
|
8
|
-
label: ReactNode
|
|
9
|
-
value: string
|
|
10
|
-
}
|
|
11
|
-
interface SegmentedProps{
|
|
12
|
-
value?: string | number
|
|
13
|
-
options?: SegmentedItem[]
|
|
14
|
-
onChange?: (v:string) => void
|
|
15
|
-
style?: ViewStyle
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const Segmented = (props: SegmentedProps) =>{
|
|
19
|
-
return (
|
|
20
|
-
<View style={[styles.wrap_container, props.style]}>
|
|
21
|
-
{props.options && props.options.map((item,idx) => (
|
|
22
|
-
<TouchableOpacity
|
|
23
|
-
style={[
|
|
24
|
-
styles.segmented_item,
|
|
25
|
-
idx === 0 && styles.segmented_item_first,
|
|
26
|
-
idx === props.options?.length && styles.segmented_item_last,
|
|
27
|
-
item.value === props.value && styles.segmented_item_check
|
|
28
|
-
]}
|
|
29
|
-
onPress={() => props.onChange && props.onChange(item.value)}
|
|
30
|
-
key={idx}
|
|
31
|
-
>
|
|
32
|
-
<Text style={[
|
|
33
|
-
styles.segmented_text,
|
|
34
|
-
item.value === props.value && styles.segmented_text_check
|
|
35
|
-
]}>{item.label}</Text>
|
|
36
|
-
</TouchableOpacity>
|
|
37
|
-
))}
|
|
38
|
-
</View>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default Segmented
|
|
43
|
-
|
|
44
|
-
const styles = StyleSheet.create({
|
|
45
|
-
wrap_container:{
|
|
46
|
-
flexDirection: 'row',
|
|
47
|
-
height: cx(48),
|
|
48
|
-
backgroundColor: '#f6f6f6',
|
|
49
|
-
padding: cx(2),
|
|
50
|
-
borderRadius: cx(7)
|
|
51
|
-
},
|
|
52
|
-
segmented_item:{
|
|
53
|
-
flex: 1,
|
|
54
|
-
alignItems: 'center',
|
|
55
|
-
justifyContent: 'center',
|
|
56
|
-
backgroundColor: '#fff'
|
|
57
|
-
},
|
|
58
|
-
segmented_item_first:{
|
|
59
|
-
borderBottomLeftRadius: cx(7),
|
|
60
|
-
borderTopLeftRadius: cx(7),
|
|
61
|
-
},
|
|
62
|
-
segmented_item_last:{
|
|
63
|
-
borderBottomRightRadius: cx(7),
|
|
64
|
-
borderTopRightRadius: cx(7)
|
|
65
|
-
},
|
|
66
|
-
segmented_item_check:{
|
|
67
|
-
backgroundColor: '#f60'
|
|
68
|
-
},
|
|
69
|
-
segmented_text:{
|
|
70
|
-
fontSize: cx(16),
|
|
71
|
-
color: '#999',
|
|
72
|
-
},
|
|
73
|
-
segmented_text_check:{
|
|
74
|
-
color: '#fff'
|
|
75
|
-
}
|
|
76
|
-
})
|
package/src/res/Propup.tsx
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Text, TouchableOpacity } from 'react-native'
|
|
3
|
-
import { Utils, Popup } from 'tuya-panel-kit'
|
|
4
|
-
|
|
5
|
-
const { convertX: cx, height } = Utils.RatioUtils
|
|
6
|
-
|
|
7
|
-
interface InformationPopupProps{
|
|
8
|
-
title: string
|
|
9
|
-
confirmText: string
|
|
10
|
-
content: any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const InformationPopup = (props: InformationPopupProps) => {
|
|
14
|
-
console.log(props, '< --- props')
|
|
15
|
-
|
|
16
|
-
const titleNode = () => {
|
|
17
|
-
return (
|
|
18
|
-
<View style={{ flexDirection: 'row', height: cx(60), justifyContent:'space-between' }}>
|
|
19
|
-
<View style={{ flexDirection: 'column-reverse', flex: 1, alignItems: 'center',paddingLeft: cx(12) }}>
|
|
20
|
-
<Text style={{
|
|
21
|
-
fontSize: cx(16),
|
|
22
|
-
fontWeight: 'bold',
|
|
23
|
-
color: '#000000',
|
|
24
|
-
paddingBottom: cx(12),
|
|
25
|
-
|
|
26
|
-
}}>{props.title}</Text>
|
|
27
|
-
</View>
|
|
28
|
-
<TouchableOpacity
|
|
29
|
-
style={{
|
|
30
|
-
flexDirection: 'column-reverse',
|
|
31
|
-
alignItems:'center',
|
|
32
|
-
paddingBottom: cx(12),
|
|
33
|
-
paddingRight: cx(6)
|
|
34
|
-
}}
|
|
35
|
-
onPress={() => Popup.close()}
|
|
36
|
-
>
|
|
37
|
-
<Text
|
|
38
|
-
style={{
|
|
39
|
-
fontSize: cx(12),
|
|
40
|
-
color: '#FF6600',
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
{props.confirmText}
|
|
44
|
-
</Text>
|
|
45
|
-
</TouchableOpacity>
|
|
46
|
-
</View>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
Popup.custom({
|
|
51
|
-
content: <View style={{height: height - cx(60), padding: cx(24)}}>
|
|
52
|
-
{props.content}
|
|
53
|
-
</View>,
|
|
54
|
-
title: titleNode(),
|
|
55
|
-
footer: null,
|
|
56
|
-
confirmText: '',
|
|
57
|
-
cancelText: '',
|
|
58
|
-
onMaskPress: ({ close }) => {
|
|
59
|
-
close()
|
|
60
|
-
},
|
|
61
|
-
onConfirm: () => {
|
|
62
|
-
Popup.close()
|
|
63
|
-
},
|
|
64
|
-
footerWrapperStyle:{
|
|
65
|
-
display: 'none'
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default InformationPopup
|
|
Binary file
|
|
Binary file
|
|
Binary file
|