@ledvance/base 1.0.31 → 1.0.33
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.ts +20 -13
- package/src/components/Page.tsx +6 -1
- package/src/components/ldvTopName.tsx +14 -4
- package/src/i18n/strings.d.ts +0 -420
- package/src/i18n/strings.ts +29 -57
- package/src/models/modules/NativePropsSlice.tsx +16 -1
- package/src/models/modules/common.d.ts +21 -13
- package/src/utils/common.d.ts +0 -22
- package/src/utils/common.ts +0 -33
- package/src/components/DelteButton.tsx +0 -36
package/package.json
CHANGED
package/src/api/native.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native'
|
|
1
|
+
import { NativeModules, Platform } from 'react-native'
|
|
2
2
|
import { NativeResult, Result } from '../models/modules/Result'
|
|
3
3
|
|
|
4
4
|
interface LDVDevicePanelManager {
|
|
@@ -12,8 +12,10 @@ interface LDVDevicePanelManager {
|
|
|
12
12
|
putJson: (deviceId: string, featureType: string, json: string, callback: (res: NativeResult<any>) => void) => void
|
|
13
13
|
getJson: (deviceId: string, featureType: string, callback: (res: NativeResult<string>) => void) => void
|
|
14
14
|
getInitiativeQueryDpsInfoWithDpsArray: (dpIds: string, deviceId: string, callback: (res: NativeResult<string>) => void) => void
|
|
15
|
-
openDownloadFile: (filePath: string) => void
|
|
15
|
+
openDownloadFile: (filePath: string) => void
|
|
16
16
|
formatNumber: (num: number, fixed: number) => string
|
|
17
|
+
getTimeZone: () => string
|
|
18
|
+
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
const devicePanel: LDVDevicePanelManager = NativeModules.LDVDevicePanelManager
|
|
@@ -33,6 +35,7 @@ const showObj = (objc) => {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
|
|
36
39
|
const control = (devId, dps, callback) => {
|
|
37
40
|
devicePanel.control({ devId, dps: JSON.stringify(dps) }, res => {
|
|
38
41
|
callback && callback(res)
|
|
@@ -216,20 +219,24 @@ export class NativeApi {
|
|
|
216
219
|
// 打开下载文件
|
|
217
220
|
export const openDownloadFile = (filePath: string) => {
|
|
218
221
|
return new Promise((_reject) => {
|
|
219
|
-
|
|
222
|
+
devicePanel.openDownloadFile(filePath)
|
|
220
223
|
})
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export const queryDpIds = (dpIds: string, deviceId: string) => {
|
|
224
227
|
return new Promise((resolve, _reject) => {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
devicePanel.getInitiativeQueryDpsInfoWithDpsArray(dpIds, deviceId, res => {
|
|
229
|
+
resolve(res)
|
|
230
|
+
})
|
|
228
231
|
})
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export const formatNumber: (num: number, fixed: number) => string = (num, fixed) => {
|
|
232
235
|
const res = devicePanel.formatNumber(num, fixed)
|
|
233
236
|
log(`formatNumber: num=${num}, fixed=${fixed}, res=${res}`)
|
|
234
237
|
return res
|
|
235
|
-
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export const getTimeZone: () => string = () => {
|
|
241
|
+
return Platform.OS === 'android' ? devicePanel.getTimeZone() || '' : Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
242
|
+
}
|
package/src/components/Page.tsx
CHANGED
|
@@ -12,6 +12,8 @@ interface PageProps extends PropsWithChildren<ViewProps> {
|
|
|
12
12
|
headlineText?: string
|
|
13
13
|
headlineIcon?: string
|
|
14
14
|
onHeadlineIconClick?: () => void
|
|
15
|
+
showGreenery?: boolean
|
|
16
|
+
greeneryIcon?: string | undefined
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
const Page = (props: PageProps) => {
|
|
@@ -31,7 +33,10 @@ const Page = (props: PageProps) => {
|
|
|
31
33
|
<LdvTopName
|
|
32
34
|
title={props.headlineText}
|
|
33
35
|
rightIcon={props.headlineIcon}
|
|
34
|
-
rightIconClick={props.onHeadlineIconClick}
|
|
36
|
+
rightIconClick={props.onHeadlineIconClick}
|
|
37
|
+
showGreenery={props.showGreenery}
|
|
38
|
+
greeneryIcon={props.greeneryIcon}
|
|
39
|
+
/>}
|
|
35
40
|
{props.children}
|
|
36
41
|
</View>
|
|
37
42
|
)
|
|
@@ -6,12 +6,13 @@ const cx = Utils.RatioUtils.convertX
|
|
|
6
6
|
|
|
7
7
|
interface LdvTopNameProps {
|
|
8
8
|
title: string,
|
|
9
|
-
rightIcon?: string | undefined
|
|
9
|
+
rightIcon?: string | undefined,
|
|
10
10
|
rightIconClick?: () => void
|
|
11
|
+
showGreenery?: boolean
|
|
12
|
+
greeneryIcon?: string | undefined
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
const LdvTopName = (props: LdvTopNameProps) => {
|
|
14
|
-
const icon = typeof props.rightIcon === 'number' ? props.rightIcon : { uri: props.rightIcon }
|
|
15
16
|
return (
|
|
16
17
|
<View style={styles.container}>
|
|
17
18
|
<View
|
|
@@ -21,12 +22,21 @@ const LdvTopName = (props: LdvTopNameProps) => {
|
|
|
21
22
|
alignItems: 'center',
|
|
22
23
|
marginTop: cx(38),
|
|
23
24
|
}}>
|
|
24
|
-
<
|
|
25
|
+
<View style={{ flexDirection: 'row' }}>
|
|
26
|
+
<Text style={styles.title}>
|
|
27
|
+
{props.title}
|
|
28
|
+
</Text>
|
|
29
|
+
{props.showGreenery && <Image
|
|
30
|
+
source={{uri : props.greeneryIcon}}
|
|
31
|
+
resizeMode="contain"
|
|
32
|
+
style={{ height: cx(16), width: cx(16), left: 0 }}
|
|
33
|
+
/> || null}
|
|
34
|
+
</View>
|
|
25
35
|
{props.rightIcon && <TouchableOpacity
|
|
26
36
|
onPress={props.rightIconClick}>
|
|
27
37
|
<Image
|
|
28
38
|
style={{ width: cx(24), height: cx(24), tintColor: '#ff6600' }}
|
|
29
|
-
source={
|
|
39
|
+
source={{ uri: props.rightIcon }} />
|
|
30
40
|
</TouchableOpacity>}
|
|
31
41
|
</View>
|
|
32
42
|
</View>
|